pub trait Flux {
type Moment: Moment<Flux = Self>;
type Kind: FluxKind;
// Required methods
fn base_value(&self) -> <Self::Kind as FluxKind>::Value;
fn base_time(&self) -> Time;
fn change<'a>(
&self,
accum: <Self::Kind as FluxKind>::Accum<'a>
) -> <Self::Kind as FluxKind>::OutAccum<'a>;
fn to_moment(self, time: Time) -> Self::Moment;
// Provided methods
fn set_moment(&mut self, time: Time, moment: Self::Moment)
where Self: Sized { ... }
fn at(&self, time: Time) -> MomentRef<'_, Self::Moment>
where Self: Clone { ... }
fn at_mut(&mut self, time: Time) -> MomentRefMut<'_, Self::Moment>
where Self: Clone { ... }
fn value(&self, time: Time) -> <Self::Kind as FluxKind>::Value { ... }
fn poly(
&self,
time: Time
) -> Poly<Self::Kind, <Self::Moment as Moment>::Value> { ... }
fn when<T>(
&self,
order: Ordering,
other: &T
) -> TimeRanges<impl TimeRangeIter> ⓘ
where T: Flux,
Poly<Self::Kind, <Self::Moment as Moment>::Value>: When<T::Kind> { ... }
fn when_eq<T>(&self, other: &T) -> TimeRanges<impl TimeRangeIter> ⓘ
where T: Flux,
Poly<Self::Kind, <Self::Moment as Moment>::Value>: WhenEq<T::Kind> { ... }
}Expand description
The continuous interface for a value that changes over time.
Required Associated Types§
Required Methods§
sourcefn base_value(&self) -> <Self::Kind as FluxKind>::Value
fn base_value(&self) -> <Self::Kind as FluxKind>::Value
An evaluation of this flux at some point in time.
sourcefn base_time(&self) -> Time
fn base_time(&self) -> Time
The time of Flux::base_value.
Provided Methods§
sourcefn set_moment(&mut self, time: Time, moment: Self::Moment)where
Self: Sized,
fn set_moment(&mut self, time: Time, moment: Self::Moment)where
Self: Sized,
Sets a moment in the timeline (affects all moments).
sourcefn at(&self, time: Time) -> MomentRef<'_, Self::Moment>where
Self: Clone,
fn at(&self, time: Time) -> MomentRef<'_, Self::Moment>where
Self: Clone,
A reference to a moment in the timeline.
sourcefn at_mut(&mut self, time: Time) -> MomentRefMut<'_, Self::Moment>where
Self: Clone,
fn at_mut(&mut self, time: Time) -> MomentRefMut<'_, Self::Moment>where
Self: Clone,
A unique, mutable reference to a moment in the timeline.
let mut moment = self.at_mut(time);
// modifications
equivalent to:
let mut moment = self.at(time);
// modifications
self.set_moment(time, moment);
sourcefn value(&self, time: Time) -> <Self::Kind as FluxKind>::Value
fn value(&self, time: Time) -> <Self::Kind as FluxKind>::Value
A point in the timeline.
self.value(self.base_time()) == self.base_value()
sourcefn poly(&self, time: Time) -> Poly<Self::Kind, <Self::Moment as Moment>::Value>
fn poly(&self, time: Time) -> Poly<Self::Kind, <Self::Moment as Moment>::Value>
A polynomial description of this flux at the given time.
sourcefn when<T>(&self, order: Ordering, other: &T) -> TimeRanges<impl TimeRangeIter> ⓘ
fn when<T>(&self, order: Ordering, other: &T) -> TimeRanges<impl TimeRangeIter> ⓘ
Ranges when this is above/below/equal to another flux.
Object Safety§
This trait is not object safe.