Struct scribl_curves::TimeDiff [−][src]
The difference between two Time
s. Unlike std::time::Duration
, this
can be negative.
Implementations
impl TimeDiff
[src]
pub const ZERO: TimeDiff
[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 scribl_curves::Time; assert_eq!((Time::ZERO - Time::ZERO).as_audio_idx(44100), 0); assert_eq!((Time::from_micros(1000000) - Time::ZERO).as_audio_idx(44100), 44100); assert_eq!((Time::ZERO - Time::from_micros(1000000)).as_audio_idx(44100), -44100);
pub fn from_audio_idx(idx: i64, sample_rate: u32) -> TimeDiff
[src]
pub const fn as_micros(self) -> i64
[src]
pub const fn from_micros(us: i64) -> TimeDiff
[src]
Trait Implementations
impl Add<TimeDiff> for Time
[src]
type Output = Time
The resulting type after applying the +
operator.
fn add(self, rhs: TimeDiff) -> Time
[src]
impl Add<TimeDiff> for TimeDiff
[src]
type Output = TimeDiff
The resulting type after applying the +
operator.
fn add(self, rhs: TimeDiff) -> TimeDiff
[src]
impl AddAssign<TimeDiff> for Time
[src]
fn add_assign(&mut self, rhs: TimeDiff)
[src]
impl Clone for TimeDiff
[src]
impl Copy for TimeDiff
[src]
impl Data for TimeDiff
[src]
impl Debug for TimeDiff
[src]
impl Default for TimeDiff
[src]
impl<'de> Deserialize<'de> for TimeDiff
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for TimeDiff
[src]
impl Hash for TimeDiff
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for TimeDiff
[src]
fn cmp(&self, other: &TimeDiff) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<TimeDiff> for TimeDiff
[src]
impl PartialOrd<TimeDiff> for TimeDiff
[src]
fn partial_cmp(&self, other: &TimeDiff) -> Option<Ordering>
[src]
fn lt(&self, other: &TimeDiff) -> bool
[src]
fn le(&self, other: &TimeDiff) -> bool
[src]
fn gt(&self, other: &TimeDiff) -> bool
[src]
fn ge(&self, other: &TimeDiff) -> bool
[src]
impl Serialize for TimeDiff
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for TimeDiff
[src]
impl StructuralPartialEq for TimeDiff
[src]
impl Sub<TimeDiff> for TimeDiff
[src]
type Output = TimeDiff
The resulting type after applying the -
operator.
fn sub(self, rhs: TimeDiff) -> TimeDiff
[src]
impl Sub<TimeDiff> for Time
[src]
type Output = Time
The resulting type after applying the -
operator.
fn sub(self, rhs: TimeDiff) -> Time
[src]
impl SubAssign<TimeDiff> for Time
[src]
fn sub_assign(&mut self, rhs: TimeDiff)
[src]
Auto Trait Implementations
impl RefUnwindSafe for TimeDiff
[src]
impl Send for TimeDiff
[src]
impl Sync for TimeDiff
[src]
impl Unpin for TimeDiff
[src]
impl UnwindSafe for TimeDiff
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AnyEq for T where
T: PartialEq<T> + Any,
T: PartialEq<T> + Any,
pub fn equals(&self, other: &(dyn Any + 'static)) -> bool
pub fn as_any(&self) -> &(dyn Any + 'static)
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> RoundFrom<T> for T
pub fn round_from(x: T) -> T
impl<T, U> RoundInto<U> for T where
U: RoundFrom<T>,
U: RoundFrom<T>,
pub fn round_into(self) -> U
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,