Trait hydro_lang::location::Location

source ·
pub trait Location<'a>: Clone {
    type Root: Location<'a>;

    // Required methods
    fn root(&self) -> Self::Root;
    fn id(&self) -> LocationId;
    fn flow_state(&self) -> &FlowState;
    fn is_top_level() -> bool;

    // Provided methods
    fn tick(&self) -> Tick<Self>
       where Self: NoTick { ... }
    fn spin(&self) -> Stream<(), Self, Unbounded>
       where Self: Sized + NoTick { ... }
    fn source_stream<T, E: FuturesStream<Item = T> + Unpin>(
        &self,
        e: impl QuotedWithContext<'a, E, Self>,
    ) -> Stream<T, Self, Unbounded>
       where Self: Sized + NoTick { ... }
    fn source_iter<T, E: IntoIterator<Item = T>>(
        &self,
        e: impl QuotedWithContext<'a, E, Self>,
    ) -> Stream<T, Self, Unbounded>
       where Self: Sized + NoTick { ... }
    fn singleton<T: Clone>(
        &self,
        e: impl QuotedWithContext<'a, T, Self>,
    ) -> Singleton<T, Self, Unbounded>
       where Self: Sized + NoTick { ... }
    unsafe fn source_interval(
        &self,
        interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
    ) -> Stream<Instant, Self, Unbounded>
       where Self: Sized + NoTick { ... }
    unsafe fn source_interval_delayed(
        &self,
        delay: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
        interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a,
    ) -> Stream<Instant, Self, Unbounded>
       where Self: Sized + NoTick { ... }
    fn forward_ref<S: CycleCollection<'a, ForwardRefMarker, Location = Self>>(
        &self,
    ) -> (ForwardRef<'a, S>, S)
       where Self: NoTick { ... }
}

Required Associated Types§

Required Methods§

source

fn root(&self) -> Self::Root

source

fn id(&self) -> LocationId

source

fn flow_state(&self) -> &FlowState

source

fn is_top_level() -> bool

Provided Methods§

source

fn tick(&self) -> Tick<Self>
where Self: NoTick,

source

fn spin(&self) -> Stream<(), Self, Unbounded>
where Self: Sized + NoTick,

source

fn source_stream<T, E: FuturesStream<Item = T> + Unpin>( &self, e: impl QuotedWithContext<'a, E, Self>, ) -> Stream<T, Self, Unbounded>
where Self: Sized + NoTick,

source

fn source_iter<T, E: IntoIterator<Item = T>>( &self, e: impl QuotedWithContext<'a, E, Self>, ) -> Stream<T, Self, Unbounded>
where Self: Sized + NoTick,

source

fn singleton<T: Clone>( &self, e: impl QuotedWithContext<'a, T, Self>, ) -> Singleton<T, Self, Unbounded>
where Self: Sized + NoTick,

source

unsafe fn source_interval( &self, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, ) -> Stream<Instant, Self, Unbounded>
where Self: Sized + NoTick,

Generates a stream with values emitted at a fixed interval, with each value being the current time (as an [tokio::time::Instant]).

The clock source used is monotonic, so elements will be emitted in increasing order.

§Safety

Because this stream is generated by an OS timer, it will be non-deterministic because each timestamp will be arbitrary.

source

unsafe fn source_interval_delayed( &self, delay: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, interval: impl QuotedWithContext<'a, Duration, Self> + Copy + 'a, ) -> Stream<Instant, Self, Unbounded>
where Self: Sized + NoTick,

Generates a stream with values emitted at a fixed interval (with an initial delay), with each value being the current time (as an [tokio::time::Instant]).

The clock source used is monotonic, so elements will be emitted in increasing order.

§Safety

Because this stream is generated by an OS timer, it will be non-deterministic because each timestamp will be arbitrary.

source

fn forward_ref<S: CycleCollection<'a, ForwardRefMarker, Location = Self>>( &self, ) -> (ForwardRef<'a, S>, S)
where Self: NoTick,

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, C> Location<'a> for Cluster<'a, C>

source§

type Root = Cluster<'a, C>

source§

impl<'a, L: Location<'a>> Location<'a> for Tick<L>

source§

type Root = <L as Location<'a>>::Root

source§

impl<'a, L: Location<'a>> Location<'a> for Timestamped<L>

source§

type Root = <L as Location<'a>>::Root

source§

impl<'a, P> Location<'a> for ExternalProcess<'a, P>

source§

impl<'a, P> Location<'a> for Process<'a, P>

source§

type Root = Process<'a, P>