pub struct Sequence { /* private fields */ }Expand description
A chain of specifications, each starting when the one before it has finished.
MotionSpec::after already composes two, and a chain of them is a
perfectly good way to write “and then”. This exists for what that shape
cannot answer: it keeps the steps, so a caller can ask where step three
starts or drive the whole chain from one clock, and it reports the total —
which Presence, a caller holding an element on screen,
or anything else waiting for the group to be over cannot otherwise know
without adding the durations up by hand.
Each step keeps its own delay, counted from the end of the previous step, so a gap between two motions is written where the gap is.
Implementations§
Source§impl Sequence
impl Sequence
pub fn new(steps: impl IntoIterator<Item = MotionSpec>) -> Self
Sourcepub fn then(self, spec: MotionSpec) -> Self
pub fn then(self, spec: MotionSpec) -> Self
Adds a step that begins when everything already in the sequence has finished.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn start(&self, index: usize) -> Duration
pub fn start(&self, index: usize) -> Duration
When step index starts, measured from the start of the sequence.
Its own delay is part of the step, not part of the wait.
Sourcepub fn step(&self, index: usize) -> Option<MotionSpec>
pub fn step(&self, index: usize) -> Option<MotionSpec>
Step index with its delay measured from the start of the sequence,
so it can be handed to anything that runs a single specification.
pub fn steps(&self) -> impl Iterator<Item = MotionSpec> + '_
Sourcepub fn progress(&self, index: usize, raw: f32) -> f32
pub fn progress(&self, index: usize, raw: f32) -> f32
Where step index has got to when the sequence as a whole is raw
through, so one clock over Sequence::total drives every step.
A step that has not started reports 0 and a step that has finished reports 1, which is what a caller painting all of them at once needs: the steps that are over stay where they landed.
Trait Implementations§
impl StructuralPartialEq for Sequence
Auto Trait Implementations§
impl Freeze for Sequence
impl RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl UnsafeUnpin for Sequence
impl UnwindSafe for Sequence
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().