Struct hydro_lang::optional::Optional
source · pub struct Optional<T, L, B> { /* private fields */ }
Implementations§
source§impl<'a, T, L: Location<'a>, B> Optional<T, L, B>
impl<'a, T, L: Location<'a>, B> Optional<T, L, B>
pub fn map<U, F: Fn(T) -> U + 'a>( self, f: impl IntoQuotedMut<'a, F, L>, ) -> Optional<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, NoOrder>
pub fn flatten_ordered<U>(self) -> Stream<U, L, B>where
T: IntoIterator<Item = U>,
pub fn flatten_unordered<U>(self) -> Stream<U, L, B, NoOrder>where
T: IntoIterator<Item = U>,
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 union(self, other: Optional<T, L, B>) -> Optional<T, L, B>
pub fn zip<O>(
self,
other: impl Into<Optional<O, L, B>>,
) -> Optional<(T, O), L, B>where
O: Clone,
pub fn unwrap_or(self, other: Singleton<T, L, B>) -> Singleton<T, L, B>
pub fn into_singleton(self) -> Singleton<Option<T>, L, B>where
T: Clone,
source§impl<'a, T, L: Location<'a>> Optional<T, L, Bounded>
impl<'a, T, L: Location<'a>> Optional<T, L, Bounded>
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>
pub fn then<U>(self, value: Singleton<U, L, Bounded>) -> Optional<U, L, Bounded>
pub fn into_stream(self) -> Stream<T, L, Bounded>
source§impl<'a, T, L: Location<'a> + NoTick, B> Optional<T, Timestamped<L>, B>
impl<'a, T, L: Location<'a> + NoTick, B> Optional<T, Timestamped<L>, B>
sourcepub unsafe fn latest_tick(self) -> Optional<T, Tick<L>, Bounded>
pub unsafe fn latest_tick(self) -> Optional<T, Tick<L>, Bounded>
Given a tick, returns a optional value corresponding to a snapshot of the optional
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 optional whose value is continuously changing, the output optional 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> Optional<T, L, B>
impl<'a, T, L: Location<'a> + NoTick, B> Optional<T, L, B>
pub fn timestamped(self, tick: &Tick<L>) -> Optional<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 optional as fast as possible, returning a stream of snapshots with order corresponding to increasing prefixes of data contributing to the optional.
§Safety
At runtime, the optional 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 optional
value taken at various points in time. Because the input optional may be
Unbounded
, there are no guarantees on what these snapshots are other than they
represent the value of the optional 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>> Optional<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> Optional<T, Tick<L>, Bounded>
pub fn all_ticks(self) -> Stream<T, Timestamped<L>, Unbounded>
pub fn latest(self) -> Optional<T, Timestamped<L>, Unbounded>
pub fn defer_tick(self) -> Optional<T, Tick<L>, Bounded>
pub fn persist(self) -> Stream<T, Tick<L>, Bounded>
pub fn delta(self) -> Optional<T, Tick<L>, Bounded>
Trait Implementations§
source§impl<'a, T, L: Location<'a> + NoTick, B> CycleCollection<'a, ForwardRefMarker> for Optional<T, L, B>
impl<'a, T, L: Location<'a> + NoTick, B> CycleCollection<'a, ForwardRefMarker> for Optional<T, L, B>
source§impl<'a, T, L: Location<'a>> CycleCollection<'a, ForwardRefMarker> for Optional<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleCollection<'a, ForwardRefMarker> for Optional<T, Tick<L>, Bounded>
source§impl<'a, T, L: Location<'a>> CycleCollection<'a, TickCycleMarker> for Optional<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleCollection<'a, TickCycleMarker> for Optional<T, Tick<L>, Bounded>
source§impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> for Optional<T, L, B>
impl<'a, T, L: Location<'a> + NoTick, B> CycleComplete<'a, ForwardRefMarker> for Optional<T, L, B>
fn complete(self, ident: Ident, expected_location: LocationId)
source§impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> for Optional<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleComplete<'a, ForwardRefMarker> for Optional<T, Tick<L>, Bounded>
fn complete(self, ident: Ident, expected_location: LocationId)
source§impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Optional<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> CycleComplete<'a, TickCycleMarker> for Optional<T, Tick<L>, Bounded>
fn complete(self, ident: Ident, expected_location: LocationId)
source§impl<'a, T, L: Location<'a>> DeferTick for Optional<T, Tick<L>, Bounded>
impl<'a, T, L: Location<'a>> DeferTick for Optional<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
Auto Trait Implementations§
impl<T, L, B> !Freeze for Optional<T, L, B>
impl<T, L, B> !RefUnwindSafe for Optional<T, L, B>
impl<T, L, B> !Send for Optional<T, L, B>
impl<T, L, B> !Sync for Optional<T, L, B>
impl<T, L, B> Unpin for Optional<T, L, B>
impl<T, L, B> !UnwindSafe for Optional<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