Struct Tick

Source
pub struct Tick(/* private fields */);
Expand description

Fixed-point representation of time where each second is divided into TICKS_PER_SECOND.

This type can also represent negative time as this is common in DCCs like a video editor or animation system where this type would typically be used.

Implementations§

Source§

impl Tick

Source

pub fn new(value: i64) -> Self

Source

pub fn from_secs(secs: f64) -> Self

Create ticks from seconds.

Source

pub fn to_secs(&self) -> f64

Convert ticks to seconds.

Source

pub fn lerp(self, other: Self, t: f64) -> Self

Linearly interpolate between two ticks.

Trait Implementations§

Source§

impl Add for Tick

Source§

type Output = Tick

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl AsMut<i64> for Tick

Source§

fn as_mut(&mut self) -> &mut i64

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<i64> for Tick

Source§

fn as_ref(&self) -> &i64

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Tick

Source§

fn clone(&self) -> Tick

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tick

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Tick

Source§

fn default() -> Tick

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Tick

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Tick

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Div<f32> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<f64> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<i128> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i128) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<i16> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i16) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<i32> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<i64> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<i8> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: i8) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<isize> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: isize) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<u128> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u128) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<u16> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u16) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<u32> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<u64> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u64) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<u8> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u8) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<usize> for Tick

Source§

type Output = Tick

The resulting type after applying the / operator.
Source§

fn div(self, rhs: usize) -> Self::Output

Performs the / operation. Read more
Source§

impl FrameRateConversion<NonZero<u32>> for Tick

Source§

fn to_frame(self, frame_rate: FramesPerSec) -> i64

Convert ticks to frame number at the specified integer frame rate.

Source§

fn from_frame(frame: i64, frame_rate: FramesPerSec) -> Self

Convert frame number to ticks at the specified integer frame rate.

Source§

impl FrameRateConversion<StrictlyPositiveFinite<f32>> for Tick

Source§

fn to_frame(self, frame_rate: FramesPerSecF32) -> i64

Convert ticks to frame number at the specified floating point frame rate.

Source§

fn from_frame(frame: i64, frame_rate: FramesPerSecF32) -> Self

Convert frame number to ticks at the specified floating point frame rate.

Source§

impl FrameRateConversion<StrictlyPositiveFinite> for Tick

Source§

fn to_frame(self, frame_rate: FramesPerSecF64) -> i64

Convert ticks to frame number at the specified floating point frame rate.

Source§

fn from_frame(frame: i64, frame_rate: FramesPerSecF64) -> Self

Convert frame number to ticks at the specified floating point frame rate.

Source§

impl From<&Tick> for f32

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for f64

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for i128

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for i64

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for isize

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for u128

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for u64

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<&Tick> for usize

Source§

fn from(tick: &Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Duration> for Tick

Source§

fn from(duration: Duration) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for Duration

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for f32

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for f64

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for i128

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for i64

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for isize

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for u128

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for u64

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<Tick> for usize

Source§

fn from(tick: Tick) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for Tick

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for Tick

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for Tick

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for Tick

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for Tick

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for Tick

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for Tick

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for Tick

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Tick

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Tick

Source§

type Err = ParseIntError

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Tick

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoIterator for Tick

Source§

type IntoIter = TickIter

Which kind of iterator are we turning this into?
Source§

type Item = i64

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Mul<f32> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<f64> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<i128> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i128) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<i16> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i16) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<i32> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<i64> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<i8> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: i8) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<isize> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: isize) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<u128> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u128) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<u16> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u16) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<u32> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<u64> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u64) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<u8> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u8) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<usize> for Tick

Source§

type Output = Tick

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: usize) -> Self::Output

Performs the * operation. Read more
Source§

impl Ord for Tick

Source§

fn cmp(&self, other: &Tick) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Tick

Source§

fn eq(&self, other: &Tick) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Tick

Source§

fn partial_cmp(&self, other: &Tick) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Tick

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for Tick

Source§

type Output = Tick

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl Copy for Tick

Source§

impl Eq for Tick

Source§

impl StructuralPartialEq for Tick

Auto Trait Implementations§

§

impl Freeze for Tick

§

impl RefUnwindSafe for Tick

§

impl Send for Tick

§

impl Sync for Tick

§

impl Unpin for Tick

§

impl UnwindSafe for Tick

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,