pub struct KeyedSingleton<K, V, Loc, Bound: KeyedSingletonBound> { /* private fields */ }
Implementations§
Source§impl<'a, K, V, L: Location<'a>, B: KeyedSingletonBound<ValueBound = Bounded>> KeyedSingleton<K, V, L, B>
impl<'a, K, V, L: Location<'a>, B: KeyedSingletonBound<ValueBound = Bounded>> KeyedSingleton<K, V, L, B>
pub fn entries( self, ) -> Stream<(K, V), L, B::UnderlyingBound, NoOrder, ExactlyOnce>
pub fn values(self) -> Stream<V, L, B::UnderlyingBound, NoOrder, ExactlyOnce>
pub fn keys(self) -> Stream<K, L, B::UnderlyingBound, NoOrder, ExactlyOnce>
pub fn filter_key_not_in<O2, R2>( self, other: Stream<K, L, Bounded, O2, R2>, ) -> Self
pub fn inspect<F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, V, L, B>
pub fn inspect_with_key<F>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> KeyedSingleton<K, V, L, B>
pub fn into_keyed_stream( self, ) -> KeyedStream<K, V, L, B::UnderlyingBound, TotalOrder, ExactlyOnce>
Source§impl<'a, K, V, L: Location<'a>, B: KeyedSingletonBound> KeyedSingleton<K, V, L, B>
impl<'a, K, V, L: Location<'a>, B: KeyedSingletonBound> KeyedSingleton<K, V, L, B>
pub fn map<U, F>(
self,
f: impl IntoQuotedMut<'a, F, L> + Copy,
) -> KeyedSingleton<K, U, L, B>where
F: Fn(V) -> U + 'a,
pub fn map_with_key<U, F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, U, L, B>
pub fn filter<F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, V, L, B>
pub fn filter_map<F, U>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, U, L, B>
pub fn key_count(self) -> Singleton<usize, L, B::UnderlyingBound>
Sourcepub fn ir_node_named(self, name: &str) -> KeyedSingleton<K, V, L, B>
pub fn ir_node_named(self, name: &str) -> KeyedSingleton<K, V, L, B>
An operator which allows you to “name” a HydroNode
.
This is only used for testing, to correlate certain HydroNode
s with IDs.
Source§impl<'a, K, V, L: Location<'a>> KeyedSingleton<K, V, Tick<L>, Bounded>
impl<'a, K, V, L: Location<'a>> KeyedSingleton<K, V, Tick<L>, Bounded>
pub fn latest(self) -> KeyedSingleton<K, V, L, Unbounded>
Source§impl<'a, K: Hash + Eq, V, L: Location<'a>> KeyedSingleton<K, V, Tick<L>, Bounded>
impl<'a, K: Hash + Eq, V, L: Location<'a>> KeyedSingleton<K, V, Tick<L>, Bounded>
Sourcepub fn get(
self,
key: Singleton<K, Tick<L>, Bounded>,
) -> Optional<V, Tick<L>, Bounded>
pub fn get( self, key: Singleton<K, Tick<L>, Bounded>, ) -> Optional<V, Tick<L>, Bounded>
Gets the value associated with a specific key from the keyed singleton.
§Example
let tick = process.tick();
let keyed_data = process
.source_iter(q!(vec![(1, 2), (2, 3)]))
.into_keyed()
.batch(&tick, nondet!(/** test */))
.fold(q!(|| 0), q!(|acc, x| *acc = x));
let key = tick.singleton(q!(1));
keyed_data.get(key).all_ticks()
// 2
Sourcepub fn get_many_if_present<O2, R2, V2>(
self,
requests: KeyedStream<K, V2, Tick<L>, Bounded, O2, R2>,
) -> KeyedStream<K, (V, V2), Tick<L>, Bounded, NoOrder, R2>
pub fn get_many_if_present<O2, R2, V2>( self, requests: KeyedStream<K, V2, Tick<L>, Bounded, O2, R2>, ) -> KeyedStream<K, (V, V2), Tick<L>, Bounded, NoOrder, R2>
Given a keyed stream of lookup requests, where the key is the lookup and the value is some additional metadata, emits a keyed stream of lookup results where the key is the same as before, but the value is a tuple of the lookup result and the metadata of the request. If the key is not found, no output will be produced.
§Example
let tick = process.tick();
let keyed_data = process
.source_iter(q!(vec![(1, 10), (2, 20)]))
.into_keyed()
.batch(&tick, nondet!(/** test */))
.fold(q!(|| 0), q!(|acc, x| *acc = x));
let other_data = process
.source_iter(q!(vec![(1, 100), (2, 200), (1, 101)]))
.into_keyed()
.batch(&tick, nondet!(/** test */));
keyed_data.get_many_if_present(other_data).entries().all_ticks()
// { 1: [(10, 100), (10, 101)], 2: [(20, 200)] } in any order
pub fn get_from<V2: Clone>( self, from: KeyedSingleton<V, V2, Tick<L>, Bounded>, ) -> KeyedSingleton<K, (V, Option<V2>), Tick<L>, Bounded>
Source§impl<'a, K, V, L, B: KeyedSingletonBound> KeyedSingleton<K, V, L, B>
impl<'a, K, V, L, B: KeyedSingletonBound> KeyedSingleton<K, V, L, B>
pub fn atomic(self, tick: &Tick<L>) -> KeyedSingleton<K, V, Atomic<L>, B>
Sourcepub fn snapshot(
self,
tick: &Tick<L>,
nondet: NonDet,
) -> KeyedSingleton<K, V, Tick<L>, Bounded>
pub fn snapshot( self, tick: &Tick<L>, nondet: NonDet, ) -> KeyedSingleton<K, V, Tick<L>, Bounded>
Given a tick, returns a keyed singleton with a entries consisting of keys with snapshots of the value singleton.
§Non-Determinism
Because this picks a snapshot of each singleton whose value is continuously changing, the output singleton has a non-deterministic value since each snapshot can be at an arbitrary point in time.
Source§impl<'a, K, V, L, B: KeyedSingletonBound<ValueBound = Bounded>> KeyedSingleton<K, V, L, B>
impl<'a, K, V, L, B: KeyedSingletonBound<ValueBound = Bounded>> KeyedSingleton<K, V, L, B>
Sourcepub fn batch(
self,
tick: &Tick<L>,
nondet: NonDet,
) -> KeyedSingleton<K, V, Tick<L>, Bounded>
pub fn batch( self, tick: &Tick<L>, nondet: NonDet, ) -> KeyedSingleton<K, V, Tick<L>, Bounded>
Returns a keyed singleton with entries consisting of new key-value pairs that have arrived since the previous batch was released.
§Non-Determinism
Because this picks a batch of asynchronously added entries, each output keyed singleton has a non-deterministic set of key-value pairs.
Source§impl<'a, K, V, L, B: KeyedSingletonBound> KeyedSingleton<K, V, Atomic<L>, B>
impl<'a, K, V, L, B: KeyedSingletonBound> KeyedSingleton<K, V, Atomic<L>, B>
Sourcepub fn snapshot(self, _nondet: NonDet) -> KeyedSingleton<K, V, Tick<L>, Bounded>
pub fn snapshot(self, _nondet: NonDet) -> KeyedSingleton<K, V, Tick<L>, Bounded>
Returns a keyed singleton with a entries consisting of keys with snapshots of the value singleton being atomically processed.
§Non-Determinism
Because this picks a snapshot of each singleton whose value is continuously changing, each output singleton has a non-deterministic value since each snapshot can be at an arbitrary point in time.
pub fn end_atomic(self) -> KeyedSingleton<K, V, L, B>
Source§impl<'a, K, V, L, B: KeyedSingletonBound<ValueBound = Bounded>> KeyedSingleton<K, V, Atomic<L>, B>
impl<'a, K, V, L, B: KeyedSingletonBound<ValueBound = Bounded>> KeyedSingleton<K, V, Atomic<L>, B>
Sourcepub fn batch(self, nondet: NonDet) -> KeyedSingleton<K, V, Tick<L>, Bounded>
pub fn batch(self, nondet: NonDet) -> KeyedSingleton<K, V, Tick<L>, Bounded>
Returns a keyed singleton with entries consisting of new key-value pairs that have arrived since the previous batch was released.
§Non-Determinism
Because this picks a batch of asynchronously added entries, each output keyed singleton has a non-deterministic set of key-value pairs.
Trait Implementations§
Source§impl<'a, K: Clone, V: Clone, Loc: Location<'a>, Bound: KeyedSingletonBound> Clone for KeyedSingleton<K, V, Loc, Bound>
impl<'a, K: Clone, V: Clone, Loc: Location<'a>, Bound: KeyedSingletonBound> Clone for KeyedSingleton<K, V, Loc, Bound>
Source§impl<'a, K, V, L, B: KeyedSingletonBound> CycleCollection<'a, ForwardRefMarker> for KeyedSingleton<K, V, L, B>
impl<'a, K, V, L, B: KeyedSingletonBound> CycleCollection<'a, ForwardRefMarker> for KeyedSingleton<K, V, L, B>
Source§impl<'a, K, V, L, B: KeyedSingletonBound> CycleComplete<'a, ForwardRefMarker> for KeyedSingleton<K, V, L, B>
impl<'a, K, V, L, B: KeyedSingletonBound> CycleComplete<'a, ForwardRefMarker> for KeyedSingleton<K, V, L, B>
fn complete(self, ident: Ident, expected_location: LocationId)
Auto Trait Implementations§
impl<K, V, Loc, Bound> !Freeze for KeyedSingleton<K, V, Loc, Bound>
impl<K, V, Loc, Bound> !RefUnwindSafe for KeyedSingleton<K, V, Loc, Bound>
impl<K, V, Loc, Bound> !Send for KeyedSingleton<K, V, Loc, Bound>
impl<K, V, Loc, Bound> !Sync for KeyedSingleton<K, V, Loc, Bound>
impl<K, V, Loc, Bound> Unpin for KeyedSingleton<K, V, Loc, Bound>
impl<K, V, Loc, Bound> !UnwindSafe for KeyedSingleton<K, V, Loc, Bound>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more