pub trait Signal<Value>: Send + Sync {
// Required method
fn sample(&self, time: Time) -> Value;
// Provided methods
fn sample_at(&self, elapsed: Duration) -> Value { ... }
fn map<Output, Function>(
self,
function: Function,
) -> Map<Self, Function, Value>
where Self: Sized,
Function: Fn(Value) -> Output + Send + Sync { ... }
fn zip<OtherValue, Other>(self, other: Other) -> Zip<Self, Other>
where Self: Sized,
Other: Signal<OtherValue> { ... }
fn boxed(self) -> Arc<dyn Signal<Value>> ⓘ
where Self: Sized + 'static { ... }
}Expand description
A thread-safe, randomly addressable signal of values over signed local time.
A signal has no end: it may be sampled at any signed time. Sampling must not
depend on earlier calls. Signals with a known end implement
FiniteAnimation, which owns the duration-aware combinators.
Required Methods§
Provided Methods§
Sourcefn sample_at(&self, elapsed: Duration) -> Value
fn sample_at(&self, elapsed: Duration) -> Value
Samples elapsed after the time origin, shorthand for sample(elapsed.after_origin()).
Panics if elapsed is beyond the representable time range, like Duration::after_origin.
Sourcefn map<Output, Function>(self, function: Function) -> Map<Self, Function, Value>
fn map<Output, Function>(self, function: Function) -> Map<Self, Function, Value>
Transforms values without changing timing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".