Skip to main content

Eval

Trait Eval 

Source
pub trait Eval {
    type Output;

    // Required method
    fn eval_alpha(&self, alpha: f64) -> Self::Output;

    // Provided method
    fn sim_step(&self) -> Option<f64> { ... }
}
Expand description

The general animation segment protocol: what the runtime can do with a segment.

An animation’s content is immutable once defined: it is a pure function of its own normalized progress alpha ∈ [0, 1]. The protocol exposes a single entry — eval_alpha — and it is a pure query on &self (evaluating the same alpha always yields the same Output, regardless of call order or repetition). No evaluator sees seconds or the scene clock; the owning cell remaps time to progress before calling in.

Stateful (iterative) segments memoize their integration behind a snapshot so repeated queries are cheap; pure segments are a closed form. The standard author-facing adapters live here too: Iterative turns an IterativeEval step function into an Eval, and Pure wraps a raw closure Fn(f64) -> T. Implementing Eval directly remains the path for exotic segments.

Required Associated Types§

Source

type Output

Value produced by this evaluator.

Required Methods§

Source

fn eval_alpha(&self, alpha: f64) -> Self::Output

Evaluate the segment’s content at normalized progress alpha.

Provided Methods§

Source

fn sim_step(&self) -> Option<f64>

The content resolution declared by iterative segments: 1/N progress per integration step (N declared via Iterative::with_steps).

None for non-iterative segments. This is an introspection query for tooling (e.g. ranim inspect tree); it does not affect evaluation.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Eval for Orbit

Source§

impl<T> Eval for Create<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <Create<T> as Eval>::Output

Source§

impl<T> Eval for FadeIn<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <FadeIn<T> as Eval>::Output

Source§

impl<T> Eval for FadeOut<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <FadeOut<T> as Eval>::Output

Source§

impl<T> Eval for Morph<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <Morph<T> as Eval>::Output

Source§

impl<T> Eval for RotatingAnimation<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <RotatingAnimation<T> as Eval>::Output

Source§

impl<T> Eval for UnCreate<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <UnCreate<T> as Eval>::Output

Source§

impl<T> Eval for Unwrite<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <Unwrite<T> as Eval>::Output

Source§

impl<T> Eval for Write<T>

Source§

type Output = T

Source§

fn eval_alpha(&self, alpha: f64) -> <Write<T> as Eval>::Output

Implementors§

Source§

impl<E> Eval for Iterative<E>

Source§

impl<T, F> Eval for Pure<F>
where F: Fn(f64) -> T,

Source§

impl<T> Eval for Static<T>
where T: Clone,