Struct hydro_lang::singleton::Singleton

source ·
pub struct Singleton<T, L, B> { /* private fields */ }

Implementations§

source§

impl<'a, T, L: Location<'a>, B> Singleton<T, L, B>

source

pub fn map<U, F: Fn(T) -> U + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Singleton<U, L, B>

source

pub fn flat_map_ordered<U, I: IntoIterator<Item = U>, F: Fn(T) -> I + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Stream<U, L, B>

source

pub fn flat_map_unordered<U, I: IntoIterator<Item = U>, F: Fn(T) -> I + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Stream<U, L, B>

source

pub fn filter<F: Fn(&T) -> bool + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Optional<T, L, B>

source

pub fn filter_map<U, F: Fn(T) -> Option<U> + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Optional<U, L, B>

source

pub fn zip<Other>(self, other: Other) -> <Self as ZipResult<'a, Other>>::Out
where Self: ZipResult<'a, Other, Location = L>,

source

pub fn continue_if<U>( self, signal: Optional<U, L, Bounded>, ) -> Optional<T, L, Bounded>
where Self: ZipResult<'a, Optional<(), L, Bounded>, Location = L, Out = Optional<(T, ()), L, Bounded>>,

source

pub fn continue_unless<U>( self, other: Optional<U, L, Bounded>, ) -> Optional<T, L, Bounded>
where Singleton<T, L, B>: ZipResult<'a, Optional<(), L, Bounded>, Location = L, Out = Optional<(T, ()), L, Bounded>>,

source§

impl<'a, T, L: Location<'a> + NoTick, B> Singleton<T, Timestamped<L>, B>

source

pub unsafe fn latest_tick(self) -> Singleton<T, Tick<L>, Bounded>

Given a tick, returns a singleton value corresponding to a snapshot of the singleton as of that tick. The snapshot at tick t + 1 is guaranteed to include at least all relevant data that contributed to the snapshot at tick t.

§Safety

Because this picks a snapshot of a singleton whose value is continuously changing, the output singleton has a non-deterministic value since the snapshot can be at an arbitrary point in time.

source

pub fn drop_timestamp(self) -> Optional<T, L, B>

source§

impl<'a, T, L: Location<'a> + NoTick, B> Singleton<T, L, B>

source

pub fn timestamped(self, tick: &Tick<L>) -> Singleton<T, Timestamped<L>, B>

source

pub unsafe fn sample_eager(self) -> Stream<T, L, Unbounded>

Eagerly samples the singleton as fast as possible, returning a stream of snapshots with order corresponding to increasing prefixes of data contributing to the singleton.

§Safety

At runtime, the singleton will be arbitrarily sampled as fast as possible, but due to non-deterministic batching and arrival of inputs, the output stream is non-deterministic.

source

pub unsafe fn sample_every( self, interval: impl QuotedWithContext<'a, Duration, L> + Copy + 'a, ) -> Stream<T, L, Unbounded>
where L: NoTimestamp,

Given a time interval, returns a stream corresponding to snapshots of the singleton value taken at various points in time. Because the input singleton may be Unbounded, there are no guarantees on what these snapshots are other than they represent the value of the singleton given some prefix of the streams leading up to it.

§Safety

The output stream is non-deterministic in which elements are sampled, since this is controlled by a clock.

source§

impl<'a, T, L: Location<'a>> Singleton<T, Tick<L>, Bounded>

source

pub fn all_ticks(self) -> Stream<T, Timestamped<L>, Unbounded>

source

pub fn latest(self) -> Singleton<T, Timestamped<L>, Unbounded>

source

pub fn defer_tick(self) -> Singleton<T, Tick<L>, Bounded>

source

pub fn persist(self) -> Stream<T, Tick<L>, Bounded>

source

pub fn delta(self) -> Optional<T, Tick<L>, Bounded>

source

pub fn into_stream(self) -> Stream<T, Tick<L>, Bounded>

Trait Implementations§

source§

impl<'a, T: Clone, L: Location<'a>, B> Clone for Singleton<T, L, B>

source§

fn clone(&self) -> Self

Returns a copy 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, T, L: Location<'a> + NoTick, B> CycleCollection<'a, ForwardRefMarker> for Singleton<T, L, B>

source§

type Location = L

source§

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

source§

impl<'a, T, L: Location<'a>> CycleCollection<'a, ForwardRefMarker> for Singleton<T, Tick<L>, Bounded>

source§

type Location = Tick<L>

source§

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

source§

impl<'a, T, L: Location<'a>> CycleCollectionWithInitial<'a, TickCycleMarker> for Singleton<T, Tick<L>, Bounded>

source§

type Location = Tick<L>

source§

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

source§

impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> for Singleton<T, L, B>

source§

fn complete(self, ident: Ident, expected_location: LocationId)

source§

impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> for Singleton<T, Tick<L>, Bounded>

source§

fn complete(self, ident: Ident, expected_location: LocationId)

source§

impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Singleton<T, Tick<L>, Bounded>

source§

fn complete(self, ident: Ident, expected_location: LocationId)

source§

impl<'a, T, L: Location<'a>> DeferTick for Singleton<T, Tick<L>, Bounded>

source§

fn defer_tick(self) -> Self

source§

impl<'a, T, L: Location<'a>, B> From<Singleton<T, L, B>> for Optional<T, L, B>

source§

fn from(singleton: Singleton<T, L, B>) -> Self

Converts to this type from the input type.
source§

impl<'a, T, L: Location<'a>> From<Singleton<T, L, Bounded>> for Singleton<T, L, Unbounded>

source§

fn from(singleton: Singleton<T, L, Bounded>) -> Self

Converts to this type from the input type.
source§

impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional<U, Tick<L>, B>> for Singleton<T, Tick<L>, B>

source§

type Out = Optional<(T, U), Tick<L>, B>

source§

type Location = Tick<L>

source§

fn other_location(other: &Optional<U, Tick<L>, B>) -> Tick<L>

source§

fn other_ir_node(other: Optional<U, Tick<L>, B>) -> HydroNode

source§

fn make(location: Tick<L>, ir_node: HydroNode) -> Self::Out

source§

impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional<U, Timestamped<L>, B>> for Singleton<T, Timestamped<L>, B>

source§

impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton<U, Tick<L>, B>> for Singleton<T, Tick<L>, B>

source§

type Out = Singleton<(T, U), Tick<L>, B>

source§

type Location = Tick<L>

source§

fn other_location(other: &Singleton<U, Tick<L>, B>) -> Tick<L>

source§

fn other_ir_node(other: Singleton<U, Tick<L>, B>) -> HydroNode

source§

fn make(location: Tick<L>, ir_node: HydroNode) -> Self::Out

source§

impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton<U, Timestamped<L>, B>> for Singleton<T, Timestamped<L>, B>

Auto Trait Implementations§

§

impl<T, L, B> !Freeze for Singleton<T, L, B>

§

impl<T, L, B> !RefUnwindSafe for Singleton<T, L, B>

§

impl<T, L, B> !Send for Singleton<T, L, B>

§

impl<T, L, B> !Sync for Singleton<T, L, B>

§

impl<T, L, B> Unpin for Singleton<T, L, B>
where L: Unpin, T: Unpin, B: Unpin,

§

impl<T, L, B> !UnwindSafe for Singleton<T, L, B>

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
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> 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<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