Skip to main content

Time

Struct Time 

Source
#[repr(C)]
pub struct Time { pub value: TimeValue, pub scale: TimeScale, pub flags: TimeFlags, pub epoch: TimeEpoch, }

Fields§

§value: TimeValue§scale: TimeScale§flags: TimeFlags§epoch: TimeEpoch

Implementations§

Source§

impl Time

Source

pub fn abs(self) -> Time

Returns the absolute value of a Time.

use cidre::cm;

let t1 = cm::Time::with_secs(-5.0, 10);
let t2 = t1.abs();
assert_eq!(t2.scale, 10);
assert_eq!(t2.as_secs(), 5.0);
Source

pub fn add(self, rhs: Time) -> Time

use cidre::cm;

let t1 = cm::Time::with_secs(100.0, 10);
let t2 = cm::Time::with_secs(200.0, 10);
let t3 = t1.add(t2);
assert!(t3.is_valid());
assert_eq!(t3.scale, 10);
assert_eq!(t3.as_secs(), 300.0);
Source

pub fn convert_scale( self, new_time_scale: TimeScale, rounding_method: TimeRoundingMethod, ) -> Time

use cidre::cm;

let time = cm::Time::default().convert_scale(100, cm::TimeRoundingMethod::default());
assert!(time.is_valid());
assert_eq!(time.scale, 100);
Source

pub fn desc_in(self, allocator: Option<&Allocator>) -> Option<R<String>>

Source

pub fn desc(self) -> Option<R<String>>

Source

pub fn as_secs(self) -> f64

Converts a Time to seconds.

Source

pub fn indefinit() -> Time

Source

pub fn invalid() -> Time

Source

pub const fn is_invalid(&self) -> bool

use cidre::cm;

let time = cm::Time::invalid();
assert!(!time.is_valid());
assert!(time.is_invalid());
Source

pub const fn is_neg_infinity(&self) -> bool

use cidre::cm;

assert!(cm::Time::neg_infinity().is_neg_infinity())
Source

pub const fn is_pos_infinity(&self) -> bool

use cidre::cm;

assert!(cm::Time::infinity().is_pos_infinity());
Source

pub const fn is_indefinite(&self) -> bool

Source

pub const fn is_numeric(&self) -> bool

Source

pub const fn has_been_rounded(&self) -> bool

Returns true if the cm::Time has been rounded, false if it is completely accurate.

Source

pub const fn is_valid(&self) -> bool

Returns Time from a f64 number of seconds, and a preferred timescale.

use cidre::cm;

let time = cm::Time::with_secs(100.0, 40_000);
assert!(time.is_valid());
Source

pub const fn is_ok(&self) -> bool

Source

pub fn mul_i32(self, multiplier: i32) -> Time

use cidre::cm;

let t1 = cm::Time::with_secs(5.0, 10);
let t2 = t1.mul_i32(2);
assert!(t2.is_valid());
assert_eq!(t2.scale, 10);
assert_eq!(t2.as_secs(), 10.0);
Source

pub fn mul_f64(self, multiplier: f64) -> Time

Source

pub fn new(value: TimeValue, timescale: i32) -> Time

Returns valid Time with value and timescale. Epoch is implied to be 0.

use cidre::cm;

let time = cm::Time::new(100, 10);
assert!(time.is_valid());
assert_eq!(time.epoch, 0);
Source

pub fn infinity() -> Time

Source

pub fn neg_infinity() -> Time

Source

pub fn show(self)

Source

pub fn sub(self, rhs: Time) -> Time

use cidre::cm;

let t1 = cm::Time::with_secs(100.0, 10);
let t2 = cm::Time::with_secs(100.0, 10);
let t3 = t1.sub(t2);
assert!(t3.is_valid());
assert_eq!(t3.scale, 10);
assert_eq!(t3.as_secs(), 0.0);
Source

pub fn with_epoch(value: TimeValue, timescale: i32, epoch: TimeEpoch) -> Time

use cidre::cm;

let time = cm::Time::with_epoch(100, 10, 5);
assert!(time.is_valid());
assert_eq!(time.epoch, 5);
Source

pub fn with_secs(seconds: f64, preferred_timescale: TimeScale) -> Time

Returns Time from a f64 number of seconds, and a preferred timescale.

use cidre::cm;

let time = cm::Time::with_secs(100.0, 10);
assert!(time.is_valid());
assert_eq!(time.scale, 10);
assert_eq!(time.as_secs(), 100.0);
Source

pub const fn zero() -> Time

Source

pub fn max(l: Time, r: Time) -> Time

Source

pub fn min(l: Time, r: Time) -> Time

Trait Implementations§

Source§

impl Clone for Time

Source§

fn clone(&self) -> Time

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 Copy for Time

Source§

impl Debug for Time

Source§

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

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

impl Default for Time

Source§

fn default() -> Self

use cidre::cm;

let t1 = cm::Time::default();
assert_eq!(t1, cm::Time::zero());
Source§

impl Eq for Time

Source§

impl Hash for Time

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 Ord for Time

Source§

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

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

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

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

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · 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 Time

Source§

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

use cidre::cm;

let t1 = cm::Time::with_secs(5.0, 10);
let t2 = t1.mul_i32(2);
let t3 = cm::Time::with_secs(5.0, 100);
assert!(t1 != t2);
assert!(t1 == t1);
assert!(t1 == t3);
1.0.0 (const: unstable) · 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 Time

Source§

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

use cidre::cm;

let t1 = cm::Time::with_secs(5.0, 10);
let t2 = cm::Time::with_secs(5.5, 10);
assert!(t1 < t2);
assert!(cm::Time::neg_infinity() < cm::Time::zero());
assert!(cm::Time::neg_infinity() < cm::Time::infinity());
assert!(cm::Time::zero() < cm::Time::infinity());
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

Auto Trait Implementations§

§

impl Freeze for Time

§

impl RefUnwindSafe for Time

§

impl Send for Time

§

impl Sync for Time

§

impl Unpin for Time

§

impl UnsafeUnpin for Time

§

impl UnwindSafe for Time

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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> 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.