#[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: TimeEpochImplementations§
Source§impl Time
impl Time
Sourcepub fn abs(self) -> Time
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);Sourcepub fn add(self, rhs: Time) -> Time
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);Sourcepub fn convert_scale(
self,
new_time_scale: TimeScale,
rounding_method: TimeRoundingMethod,
) -> Time
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);pub fn desc_in(self, allocator: Option<&Allocator>) -> Option<R<String>>
pub fn desc(self) -> Option<R<String>>
pub fn indefinit() -> Time
pub fn invalid() -> Time
Sourcepub const fn is_invalid(&self) -> bool
pub const fn is_invalid(&self) -> bool
use cidre::cm;
let time = cm::Time::invalid();
assert!(!time.is_valid());
assert!(time.is_invalid());Sourcepub const fn is_neg_infinity(&self) -> bool
pub const fn is_neg_infinity(&self) -> bool
use cidre::cm;
assert!(cm::Time::neg_infinity().is_neg_infinity())Sourcepub const fn is_pos_infinity(&self) -> bool
pub const fn is_pos_infinity(&self) -> bool
use cidre::cm;
assert!(cm::Time::infinity().is_pos_infinity());pub const fn is_indefinite(&self) -> bool
pub const fn is_numeric(&self) -> bool
Sourcepub const fn has_been_rounded(&self) -> bool
pub const fn has_been_rounded(&self) -> bool
Returns true if the cm::Time has been rounded, false if it is completely accurate.
Sourcepub const fn is_valid(&self) -> bool
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());pub const fn is_ok(&self) -> bool
Sourcepub fn mul_i32(self, multiplier: i32) -> Time
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);pub fn mul_f64(self, multiplier: f64) -> Time
Sourcepub fn new(value: TimeValue, timescale: i32) -> Time
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);pub fn infinity() -> Time
pub fn neg_infinity() -> Time
pub fn show(self)
Sourcepub fn sub(self, rhs: Time) -> Time
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);Sourcepub fn with_epoch(value: TimeValue, timescale: i32, epoch: TimeEpoch) -> Time
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);Sourcepub fn with_secs(seconds: f64, preferred_timescale: TimeScale) -> Time
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);pub const fn zero() -> Time
pub fn max(l: Time, r: Time) -> Time
pub fn min(l: Time, r: Time) -> Time
Trait Implementations§
impl Copy for Time
impl Eq for Time
Source§impl Ord for Time
impl Ord for Time
Source§impl PartialEq for Time
impl PartialEq for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
Source§fn partial_cmp(&self, other: &Self) -> Option<Ordering>
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());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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more