Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hydro_lang/src/live_collections/keyed_singleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ impl<'a, K, V, L: Location<'a>, B: KeyedSingletonBound> KeyedSingleton<K, V, L,
}

/// Gets the value associated with a specific key from the keyed singleton.
/// Returns `None` if the key is `None` or there is no associated value.
///
/// # Example
/// ```rust
Expand All @@ -574,7 +575,7 @@ impl<'a, K, V, L: Location<'a>, B: KeyedSingletonBound> KeyedSingleton<K, V, L,
/// # }));
/// # }
/// ```
pub fn get(self, key: Singleton<K, L, Bounded>) -> Optional<V, L, Bounded>
pub fn get(self, key: impl Into<Optional<K, L, Bounded>>) -> Optional<V, L, Bounded>
where
B: IsBounded,
K: Hash + Eq,
Expand Down
6 changes: 3 additions & 3 deletions hydro_lang/src/live_collections/keyed_stream/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use stageleft::{IntoQuotedMut, QuotedWithContext, QuotedWithContextWithProps, q}
use super::boundedness::{Bounded, Boundedness, IsBounded, Unbounded};
use super::keyed_singleton::KeyedSingleton;
use super::optional::Optional;
use super::singleton::Singleton;
use super::stream::{
ExactlyOnce, IsExactlyOnce, IsOrdered, MinOrder, MinRetries, NoOrder, Stream, TotalOrder,
};
Expand Down Expand Up @@ -2103,6 +2102,7 @@ impl<'a, K, V, L: Location<'a>, B: Boundedness, O: Ordering, R: Retries>
}

/// Gets the values associated with a specific key from the keyed stream.
/// Returns an empty stream if the key is `None` or there are no associated values.
///
/// # Example
/// ```rust
Expand All @@ -2128,14 +2128,14 @@ impl<'a, K, V, L: Location<'a>, B: Boundedness, O: Ordering, R: Retries>
/// # }));
/// # }
/// ```
pub fn get(self, key: Singleton<K, L, Bounded>) -> Stream<V, L, Bounded, NoOrder, R>
pub fn get(self, key: impl Into<Optional<K, L, Bounded>>) -> Stream<V, L, Bounded, NoOrder, R>
where
B: IsBounded,
K: Eq + Hash,
{
self.make_bounded()
.entries()
.join(key.into_stream().map(q!(|k| (k, ()))))
.join(key.into().into_stream().map(q!(|k| (k, ()))))
.map(q!(|(_, (v, _))| v))
}

Expand Down
Loading