[][src]Struct scribble_curves::time::Diff

pub struct Diff(_);

The difference between two Times. Unlike std::time::Duration, this can be negative.

Implementations

impl Diff[src]

pub fn as_audio_idx(&self, sample_rate: u32) -> isize[src]

Interpreting self as the offset from the beginning of an audio buffer, return the corresponding index into that buffer. Note that the return value is signed, because a negative offset from the beginning of an audio buffer corresponds to a negative index.

Examples

use scribble_curves::time::{ZERO, Time};
assert_eq!((ZERO - ZERO).as_audio_idx(44100), 0);
assert_eq!((Time::from_micros(1000000) - ZERO).as_audio_idx(44100), 44100);
assert_eq!((ZERO - Time::from_micros(1000000)).as_audio_idx(44100), -44100);

pub fn from_audio_idx(idx: i64, sample_rate: u32) -> Diff[src]

pub const fn as_micros(self) -> i64[src]

pub const fn from_micros(us: i64) -> Diff[src]

Trait Implementations

impl Add<Diff> for Time[src]

type Output = Time

The resulting type after applying the + operator.

impl Add<Diff> for Diff[src]

type Output = Diff

The resulting type after applying the + operator.

impl AddAssign<Diff> for Time[src]

impl Clone for Diff[src]

impl Copy for Diff[src]

impl Data for Diff[src]

impl Debug for Diff[src]

impl Default for Diff[src]

impl<'de> Deserialize<'de> for Diff[src]

impl Eq for Diff[src]

impl Hash for Diff[src]

impl Ord for Diff[src]

impl PartialEq<Diff> for Diff[src]

impl PartialOrd<Diff> for Diff[src]

impl Serialize for Diff[src]

impl StructuralEq for Diff[src]

impl StructuralPartialEq for Diff[src]

impl Sub<Diff> for Diff[src]

type Output = Diff

The resulting type after applying the - operator.

impl Sub<Diff> for Time[src]

type Output = Time

The resulting type after applying the - operator.

impl SubAssign<Diff> for Time[src]

Auto Trait Implementations

impl RefUnwindSafe for Diff

impl Send for Diff

impl Sync for Diff

impl Unpin for Diff

impl UnwindSafe for Diff

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyEq for T where
    T: PartialEq<T> + Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> RoundFrom<T> for T

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.