KeyedSingleton

Struct KeyedSingleton 

Source
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>

Source

pub fn entries( self, ) -> Stream<(K, V), L, B::UnderlyingBound, NoOrder, ExactlyOnce>

Source

pub fn values(self) -> Stream<V, L, B::UnderlyingBound, NoOrder, ExactlyOnce>

Source

pub fn keys(self) -> Stream<K, L, B::UnderlyingBound, NoOrder, ExactlyOnce>

Source

pub fn filter_key_not_in<O2, R2>( self, other: Stream<K, L, Bounded, O2, R2>, ) -> Self
where K: Hash + Eq,

Source

pub fn inspect<F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, V, L, B>
where F: Fn(&V) + 'a,

Source

pub fn inspect_with_key<F>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> KeyedSingleton<K, V, L, B>
where F: Fn(&(K, V)) + 'a,

Source

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>

Source

pub fn map<U, F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, U, L, B>
where F: Fn(V) -> U + 'a,

Source

pub fn map_with_key<U, F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, U, L, B>
where F: Fn((K, V)) -> U + 'a, K: Clone,

Source

pub fn filter<F>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, V, L, B>
where F: Fn(&V) -> bool + 'a,

Source

pub fn filter_map<F, U>( self, f: impl IntoQuotedMut<'a, F, L> + Copy, ) -> KeyedSingleton<K, U, L, B>
where F: Fn(V) -> Option<U> + 'a,

Source

pub fn key_count(self) -> Singleton<usize, L, B::UnderlyingBound>

Source

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 HydroNodes with IDs.

Source§

impl<'a, K, V, L: Location<'a>> KeyedSingleton<K, V, Tick<L>, Bounded>

Source

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>

Source

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
Source

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
Source

pub fn get_from<V2: Clone>( self, from: KeyedSingleton<V, V2, Tick<L>, Bounded>, ) -> KeyedSingleton<K, (V, Option<V2>), Tick<L>, Bounded>
where K: Clone, V: Hash + Eq + Clone,

Source§

impl<'a, K, V, L, B: KeyedSingletonBound> KeyedSingleton<K, V, L, B>
where L: Location<'a> + NoTick + NoAtomic,

Source

pub fn atomic(self, tick: &Tick<L>) -> KeyedSingleton<K, V, Atomic<L>, B>

Source

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>
where L: Location<'a> + NoTick + NoAtomic,

Source

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>
where L: Location<'a> + NoTick + NoAtomic,

Source

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.

Source

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>
where L: Location<'a> + NoTick + NoAtomic,

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, K, V, L, B: KeyedSingletonBound> CycleCollection<'a, ForwardRefMarker> for KeyedSingleton<K, V, L, B>
where L: Location<'a> + NoTick,

Source§

type Location = L

Source§

fn create_source(ident: Ident, location: L) -> Self

Source§

impl<'a, K, V, L, B: KeyedSingletonBound> CycleComplete<'a, ForwardRefMarker> for KeyedSingleton<K, V, L, B>
where L: Location<'a> + NoTick,

Source§

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>
where Loc: Unpin, <Bound as KeyedSingletonBound>::UnderlyingBound: Unpin, K: Unpin, V: Unpin,

§

impl<K, V, Loc, Bound> !UnwindSafe for KeyedSingleton<K, V, Loc, Bound>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MinOrder<T> for T

Source§

type Min = T

The weaker of the two orderings.
Source§

impl<T> MinRetries<T> for T

Source§

type Min = T

The weaker of the two retry guarantees.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,