Skip to main content

FrameIndex

Struct FrameIndex 

Source
pub struct FrameIndex<T>(/* private fields */);
Expand description

Represents a frame index.

Implementations§

Source§

impl<T> FrameIndex<T>

Source

pub fn new(value: T) -> Self

Creates a new FrameIndex from the given value.

Source

pub const fn index(&self) -> T
where T: Copy,

Returns the raw frame value.

Source

pub fn into_index(self) -> T

Consumes this FrameIndex value and returns the inner frame value.

Source

pub fn from_time<S>(time: Time<S>, rate: FrameRate<S>) -> Self
where S: Copy + Mul<Output = S> + Floor + SaturatingCast<T>,

Creates a FrameIndex from Time at the specified FrameRate.

Source

pub fn to_time<S>(self, rate: FrameRate<S>) -> Time<S>
where T: Copy + LossyCast<S>, S: Copy + Div<Output = S>,

Converts this FrameIndex to Time at the specified FrameRate.

Source

pub fn offset_from(self, other: Self) -> <T as SignedEquivalent>::Signed

Returns the signed frame offset from this index to another index. The result is positive when self is ahead of other, negative when behind, and zero when equal.

Source

pub fn next(&self) -> Self
where T: One + SaturatingAdd<Output = T>, Self: Copy + SaturatingAdd<T, Output = Self>,

Returns the next FrameIndex, saturating at T::MAX.

Source

pub fn previous(&self) -> Self
where T: One + SaturatingSub<Output = T>, Self: Copy + SaturatingSub<T, Output = Self>,

Returns the previous FrameIndex, saturating at T::MIN.

Source§

impl<T> FrameIndex<T>
where T: Zero,

Source

pub const ZERO: Self

Returns the zero.

Source§

impl<T> FrameIndex<T>
where T: BoundedMin,

Source

pub const MIN: Self

Returns the minimum value.

Source§

impl<T> FrameIndex<T>
where T: BoundedMax,

Source

pub const MAX: Self

Returns the maximum value.

Source§

impl<T> FrameIndex<T>
where T: MinMax,

Source

pub fn min(self, other: Self) -> Self

Returns the minimum of two values.

Source

pub fn max(self, other: Self) -> Self

Returns the maximum of two values.

Source§

impl<T> FrameIndex<T>
where T: SaturatingAdd<Output = T>,

Source

pub fn saturating_add(self, rhs: Self) -> Self

Returns the result of saturating addition of two FrameIndex values.

Source

pub fn saturating_add_t(self, rhs: T) -> Self

Returns the result of saturating addition of a FrameIndex value and a raw frame value.

Source§

impl<T> FrameIndex<T>
where T: SaturatingSub<Output = T>,

Source

pub fn saturating_sub(self, rhs: Self) -> Self

Returns the result of saturating subtraction of two FrameIndex values.

Source

pub fn saturating_sub_t(self, rhs: T) -> Self

Returns the result of saturating subtraction of a FrameIndex value and a raw frame value.

Trait Implementations§

Source§

impl<T> Add for FrameIndex<T>
where T: Add<Output = T>,

Source§

type Output = FrameIndex<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> Add<T> for FrameIndex<T>
where T: Add<Output = T>,

Source§

type Output = FrameIndex<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T> AddAssign for FrameIndex<T>
where T: AddAssign,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T> AddAssign<T> for FrameIndex<T>
where T: AddAssign,

Source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
Source§

impl<T> ApproxEqAbs for FrameIndex<T>
where T: Copy + ApproxEqAbs<Tolerance = T>,

Source§

const DEFAULT_TOLERANCE_ABS: Self::Tolerance = <T as ::rinia::algebra::ApproxEqAbs>::DEFAULT_TOLERANCE_ABS

The default absolute tolerance for approximate equality checks.
Source§

type Tolerance = T

The type of the tolerance used for absolute approximate equality checks.
Source§

fn approx_eq_abs_tol(self, other: Self, tol: Self::Tolerance) -> bool

Checks if the value is approximately equal to another value within a given absolute tolerance.
Source§

fn approx_eq_abs(self, other: Rhs) -> bool
where Self: Sized,

Checks if the value is approximately equal to another value within the default absolute tolerance.
Source§

impl<T> ApproxEqRel for FrameIndex<T>
where T: Copy + ApproxEqRel<Tolerance = T>,

Source§

const DEFAULT_TOLERANCE_REL: Self::Tolerance = <T as ::rinia::algebra::ApproxEqRel>::DEFAULT_TOLERANCE_REL

The default relative tolerance for approximate equality checks.
Source§

type Tolerance = T

The type of the tolerance used for relative approximate equality checks.
Source§

fn approx_eq_rel_tol(self, other: Self, tol: Self::Tolerance) -> bool

Checks if the value is approximately equal to another value within a given relative tolerance.
Source§

fn approx_eq_rel(self, other: Rhs) -> bool
where Self: Sized,

Checks if the value is approximately equal to another value within the default relative tolerance.
Source§

impl<T> BoundedMax for FrameIndex<T>
where T: BoundedMax,

Source§

const MAX: Self = FrameIndex::MAX

The maximum value of the type.
Source§

impl<T> BoundedMin for FrameIndex<T>
where T: BoundedMin,

Source§

const MIN: Self = FrameIndex::MIN

The minimum value of the type.
Source§

impl<T: Clone> Clone for FrameIndex<T>

Source§

fn clone(&self) -> FrameIndex<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Copy> Copy for FrameIndex<T>

Source§

impl<T: Debug> Debug for FrameIndex<T>

Source§

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

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

impl<T> Default for FrameIndex<T>
where Self: Zero,

Source§

fn default() -> Self

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

impl From<FrameIndex<u32>> for u32

Source§

fn from(frame: FrameIndex<u32>) -> Self

Converts to this type from the input type.
Source§

impl From<FrameIndex<u64>> for u64

Source§

fn from(frame: FrameIndex<u64>) -> Self

Converts to this type from the input type.
Source§

impl From<FrameIndex<usize>> for usize

Source§

fn from(frame: FrameIndex<usize>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<T> for FrameIndex<T>

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T> MinMax for FrameIndex<T>
where T: MinMax,

Source§

fn minimum(self, other: Self) -> Self

Computes the minimum of two values.
Source§

fn maximum(self, other: Self) -> Self

Computes the maximum of two values.
Source§

impl<T: PartialEq> PartialEq for FrameIndex<T>

Source§

fn eq(&self, other: &FrameIndex<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T: PartialOrd> PartialOrd for FrameIndex<T>

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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<T> SaturatingAdd for FrameIndex<T>
where T: SaturatingAdd<Output = T>,

Source§

type Output = FrameIndex<T>

The output type for the saturating addition.
Source§

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

Performs saturating addition of self and rhs.
Source§

impl<T> SaturatingAdd<T> for FrameIndex<T>
where T: SaturatingAdd<Output = T>,

Source§

type Output = FrameIndex<T>

The output type for the saturating addition.
Source§

fn saturating_add(self, rhs: T) -> Self::Output

Performs saturating addition of self and rhs.
Source§

impl<T> SaturatingSub for FrameIndex<T>
where T: SaturatingSub<Output = T>,

Source§

type Output = FrameIndex<T>

The output type for the saturating subtraction.
Source§

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

Performs saturating subtraction of self and rhs.
Source§

impl<T> SaturatingSub<T> for FrameIndex<T>
where T: SaturatingSub<Output = T>,

Source§

type Output = FrameIndex<T>

The output type for the saturating subtraction.
Source§

fn saturating_sub(self, rhs: T) -> Self::Output

Performs saturating subtraction of self and rhs.
Source§

impl<T: PartialEq> StructuralPartialEq for FrameIndex<T>

Source§

impl<T> Sub for FrameIndex<T>
where T: Sub<Output = T>,

Source§

type Output = FrameIndex<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> Sub<T> for FrameIndex<T>
where T: Sub<Output = T>,

Source§

type Output = FrameIndex<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T> SubAssign for FrameIndex<T>
where T: SubAssign,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<T> SubAssign<T> for FrameIndex<T>
where T: SubAssign,

Source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
Source§

impl<T> Zero for FrameIndex<T>
where T: Zero,

Source§

const ZERO: Self = FrameIndex::ZERO

The zero constant for the type.

Auto Trait Implementations§

§

impl<T> Freeze for FrameIndex<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for FrameIndex<T>
where T: RefUnwindSafe,

§

impl<T> Send for FrameIndex<T>
where T: Send,

§

impl<T> Sync for FrameIndex<T>
where T: Sync,

§

impl<T> Unpin for FrameIndex<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for FrameIndex<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for FrameIndex<T>
where T: UnwindSafe,

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, U> CastFrom<T> for U
where T: Cast<U>,

Source§

fn cast_from(value: T) -> U

Casts value to type Self.
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<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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, U> LossyCastFrom<T> for U
where T: LossyCast<U>,

Source§

fn lossy_cast_from(value: T) -> U

Casts value to type Self, potentially losing information.
Source§

impl<T, U> SaturatingCastFrom<T> for U
where T: SaturatingCast<U>,

Source§

fn saturating_cast_from(value: T) -> U

Casts value to type Self, saturating the value if it is out of range.
Source§

impl<T, U> SignedCastFrom<T> for U
where T: SignedCast<U>,

Source§

fn signed_cast_from(value: T) -> U

Casts value to type Self, which is the signed equivalent of the original type.
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, U> TryCastFrom<T> for U
where T: TryCast<U>,

Source§

fn try_cast_from(value: T) -> Result<U, CastError>

Attempts to cast value to type Self.
Source§

impl<T, U> TryExactCastFrom<T> for U
where T: TryExactCast<U>,

Source§

fn try_exact_cast_from(value: T) -> Result<U, CastError>

Attempts to cast value to type Self without loss of information.
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, U> UnsignedCastFrom<T> for U
where T: UnsignedCast<U>,

Source§

fn unsigned_cast_from(value: T) -> U

Casts value to type Self, which is the unsigned equivalent of the original type.