pub enum TimeScale {
Seconds,
Frames(FrameRate),
Beats(Tempo),
}Expand description
How a timeline counts time: its ruler, its text, its steps and its grid.
Variants§
Seconds
Seconds, written 1:02.500 (hours when there are some).
Frames(FrameRate)
Frames at a rate, written as a timecode HH:MM:SS:FF; a time on
this scale is always a whole frame.
Beats(Tempo)
Bars and beats at a tempo, written bar.beat.tick from 1.1.000.
Implementations§
Source§impl TimeScale
impl TimeScale
Sourcepub fn to_units(&self, seconds: f64) -> f64
pub fn to_units(&self, seconds: f64) -> f64
A time in its units: seconds, frames, beats from bar 1.
Sourcepub fn from_units(&self, units: f64) -> f64
pub fn from_units(&self, units: f64) -> f64
A time given in its units, in seconds.
Sourcepub fn step(&self, big: bool) -> f64
pub fn step(&self, big: bool) -> f64
What Left and Right move by: a second, a frame, a beat; with Shift
(big), ten seconds, a timecode second, a bar.
Sourcepub fn quantize(&self, seconds: f64) -> f64
pub fn quantize(&self, seconds: f64) -> f64
The time it can hold nearest to seconds: the nearest whole frame on
frames, the time itself otherwise.
Sourcepub fn round_to(&self, seconds: f64, step: f64) -> f64
pub fn round_to(&self, seconds: f64, step: f64) -> f64
The line of a grid step apart nearest to seconds (the grid starts
at origin).
Sourcepub fn steps(&self) -> Vec<f64>
pub fn steps(&self) -> Vec<f64>
The ruler’s steps from the finest to the coarsest, in seconds; each lands on the scale’s units (whole frames, divisions of a beat, bars).
Sourcepub fn format(&self, seconds: f64) -> String
pub fn format(&self, seconds: f64) -> String
The full text of a time: 1:02.500, 00:01:02:12, 17.2.480.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TimeScale
impl<'de> Deserialize<'de> for TimeScale
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for TimeScale
impl StructuralPartialEq for TimeScale
Auto Trait Implementations§
impl Freeze for TimeScale
impl RefUnwindSafe for TimeScale
impl Send for TimeScale
impl Sync for TimeScale
impl Unpin for TimeScale
impl UnsafeUnpin for TimeScale
impl UnwindSafe for TimeScale
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more