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>
impl<'a, T, L: Location<'a>, B> Singleton<T, L, B>
pub fn map<U, F: Fn(T) -> U + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Singleton<U, L, B>
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>
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>
pub fn filter<F: Fn(&T) -> bool + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Optional<T, L, B>
pub fn filter_map<U, F: Fn(T) -> Option<U> + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Optional<U, L, B>
pub fn zip<Other>(self, other: Other) -> <Self as ZipResult<'a, Other>>::Outwhere
Self: ZipResult<'a, Other, Location = L>,
pub fn continue_if<U>( self, signal: Optional<U, L, Bounded>, ) -> Optional<T, L, Bounded>
pub fn continue_unless<U>( self, other: Optional<U, L, Bounded>, ) -> Optional<T, L, Bounded>
source§impl<'a, T, L: Location<'a> + NoTick, B> Singleton<T, Timestamped<L>, B>
impl<'a, T, L: Location<'a> + NoTick, B> Singleton<T, Timestamped<L>, B>
sourcepub unsafe fn latest_tick(self) -> Singleton<T, Tick<L>, Bounded>
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.
pub fn drop_timestamp(self) -> Optional<T, L, B>
source§impl<'a, T, L: Location<'a> + NoTick, B> Singleton<T, L, B>
impl<'a, T, L: Location<'a> + NoTick, B> Singleton<T, L, B>
pub fn timestamped(self, tick: &Tick<L>) -> Singleton<T, Timestamped<L>, B>
sourcepub unsafe fn sample_eager(self) -> Stream<T, L, Unbounded>
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.
sourcepub unsafe fn sample_every(
self,
interval: impl QuotedWithContext<'a, Duration, L> + Copy + 'a,
) -> Stream<T, L, Unbounded>where
L: NoTimestamp,
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>
impl<'a, T, L: Location<'a>> Singleton<T, Tick<L>, Bounded>
pub fn all_ticks(self) -> Stream<T, Timestamped<L>, Unbounded>
pub fn latest(self) -> Singleton<T, Timestamped<L>, Unbounded>
pub fn defer_tick(self) -> Singleton<T, Tick<L>, Bounded>
pub fn persist(self) -> Stream<T, Tick<L>, Bounded>
pub fn delta(self) -> Optional<T, Tick<L>, Bounded>
pub fn into_stream(self) -> Stream<T, Tick<L>, Bounded>
Trait Implementations§
source§impl<'a, T, L: Location<'a> + NoTick, B> CycleCollection<'a, ForwardRefMarker> for Singleton<T, L, B>
impl<'a, T, L: Location<'a> + NoTick, B> CycleCollection<'a, ForwardRefMarker> for Singleton<T, L, B>
source§impl<'a, T, L: Location<'a>> CycleCollection<'a, ForwardRefMarker> for Singleton<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleCollection<'a, ForwardRefMarker> for Singleton<T, Tick<L>, Bounded>
source§impl<'a, T, L: Location<'a>> CycleCollectionWithInitial<'a, TickCycleMarker> for Singleton<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleCollectionWithInitial<'a, TickCycleMarker> for Singleton<T, Tick<L>, Bounded>
source§impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> for Singleton<T, L, B>
impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> for Singleton<T, L, B>
fn complete(self, ident: Ident, expected_location: LocationId)
source§impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> for Singleton<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> for Singleton<T, Tick<L>, Bounded>
fn complete(self, ident: Ident, expected_location: LocationId)
source§impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Singleton<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Singleton<T, Tick<L>, Bounded>
fn complete(self, ident: Ident, expected_location: LocationId)
source§impl<'a, T, L: Location<'a>> DeferTick for Singleton<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> DeferTick for Singleton<T, Tick<L>, Bounded>
fn defer_tick(self) -> Self
source§impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional<U, Tick<L>, B>> for Singleton<T, Tick<L>, B>
impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional<U, Tick<L>, B>> for Singleton<T, Tick<L>, B>
source§impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional<U, Timestamped<L>, B>> for Singleton<T, Timestamped<L>, B>
impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Optional<U, Timestamped<L>, B>> for Singleton<T, Timestamped<L>, B>
type Out = Optional<(T, U), Timestamped<L>, B>
type Location = Timestamped<L>
fn other_location(other: &Optional<U, Timestamped<L>, B>) -> Timestamped<L>
fn other_ir_node(other: Optional<U, Timestamped<L>, B>) -> HydroNode
fn make(location: Timestamped<L>, ir_node: HydroNode) -> Self::Out
source§impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton<U, Tick<L>, B>> for Singleton<T, Tick<L>, B>
impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton<U, Tick<L>, B>> for Singleton<T, Tick<L>, B>
source§impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton<U, Timestamped<L>, B>> for Singleton<T, Timestamped<L>, B>
impl<'a, T, U: Clone, L: Location<'a>, B> ZipResult<'a, Singleton<U, Timestamped<L>, B>> for Singleton<T, Timestamped<L>, B>
type Out = Singleton<(T, U), Timestamped<L>, B>
type Location = Timestamped<L>
fn other_location(other: &Singleton<U, Timestamped<L>, B>) -> Timestamped<L>
fn other_ir_node(other: Singleton<U, Timestamped<L>, B>) -> HydroNode
fn make(location: Timestamped<L>, ir_node: HydroNode) -> Self::Out
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>
impl<T, L, B> !UnwindSafe for Singleton<T, L, B>
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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