time
Generated Rust API reference for byte_engine.
Module time
Fixed-rate time used by engine simulation and media timelines.
Quick Reference
| Item | Kind | Description |
|---|---|---|
MediaTime | struct | The MediaTime struct provides a shared, allocation-free time unit for simulation, animation, and media synchronization. |
TICKS_PER_SECOND | const | The number of engine ticks in one second. |
Structs
MediaTime
struct MediaTime();Defined in crates/byte-engine/src/time.rs:20
The MediaTime struct provides a shared, allocation-free time unit for
simulation, animation, and media synchronization.
Implementations
-
const ZERO: Self -
const MIN: Self -
const MAX: Self -
const TICKS_PER_SECOND: i64 -
const fn from_ticks(ticks: i64) -> SelfCreates a time value from raw engine ticks.
-
const fn as_ticks(self) -> i64Returns the raw engine tick count.
-
fn from_seconds(seconds: i64) -> SelfCreates a time value from a whole number of seconds.
-
fn from_seconds_f64(seconds: f64) -> SelfCreates a time value from fractional seconds, rounded to the nearest tick.
-
fn from_seconds_f32(seconds: f32) -> SelfCreates a time value from fractional seconds, rounded to the nearest tick.
-
fn from_millis(milliseconds: i64) -> SelfCreates a time value from milliseconds.
-
fn from_micros(microseconds: i64) -> SelfCreates a time value from microseconds, rounded to the nearest tick.
-
fn from_frames(frame_count: i64, frames_per_second: u32) -> Option<Self>Creates the duration occupied by an exact number of frames.
Returns
Nonewhen the frame rate does not divide the engine timebase orwhen the resulting tick count would overflow.
-
fn from_samples(sample_count: i64, samples_per_second: u32) -> Option<Self>Creates the duration occupied by an exact number of audio samples.
Returns
Nonewhen the sample rate does not divide the engine timebase orwhen the resulting tick count would overflow.
-
fn from_std(duration: Duration) -> SelfConverts a standard duration into engine time, rounded to the nearest tick.
-
fn to_std(self) -> DurationConverts a non-negative engine time into a standard duration.
-
fn as_seconds_f64(self) -> f64Returns this time value as fractional seconds.
-
fn as_seconds_f32(self) -> f32Returns this time value as fractional seconds.
-
const fn checked_add(self, rhs: Self) -> Option<Self>Returns the sum, or
Nonewhen it falls outside the timeline range. -
const fn checked_sub(self, rhs: Self) -> Option<Self>Returns the difference, or
Nonewhen it falls outside the timeline range. -
const fn saturating_sub(self, rhs: Self) -> SelfReturns the difference clamped to the timeline range.
Trait Implementations
impl Add for MediaTime
-
type Output = MediaTime -
fn add(self, rhs: Self) -> <Self as >::Output
impl AddAssign for MediaTime
-
fn add_assign(&mut self, rhs: Self)
impl ArchivePointee for MediaTime
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for MediaTime
impl Clone for MediaTime
-
fn clone(&self) -> MediaTimeRelated:
MediaTime
impl<K> Comparable for MediaTime
-
fn compare(&self, key: &K) -> Ordering
impl Copy for MediaTime
impl Debug for MediaTime
-
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Default for MediaTime
-
fn default() -> MediaTimeRelated:
MediaTime
impl Div for MediaTime
-
type Output = MediaTime -
fn div(self, rhs: i64) -> <Self as >::Output
impl Downcast for MediaTime
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSend for MediaTime
-
fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>
impl DowncastSync for MediaTime
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>
impl Eq for MediaTime
impl<K> Equivalent for MediaTime
-
fn equivalent(&self, key: &K) -> bool
impl Hash for MediaTime
-
fn hash<__H: hash::Hasher>(&self, state: &mut __H)
impl Instrument for MediaTime
impl LayoutRaw for MediaTime
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl Mul for MediaTime
-
type Output = MediaTime -
fn mul(self, rhs: i64) -> <Self as >::Output
impl Neg for MediaTime
-
type Output = MediaTime -
fn neg(self) -> <Self as >::Output
impl<T, N1> Niching for MediaTime
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Ord for MediaTime
-
fn cmp(&self, other: &MediaTime) -> cmp::OrderingRelated:
MediaTime
impl PartialEq for MediaTime
-
fn eq(&self, other: &MediaTime) -> boolRelated:
MediaTime
impl PartialOrd for MediaTime
-
fn partial_cmp(&self, other: &MediaTime) -> option::Option<cmp::Ordering>Related:
MediaTime
impl Pointable for MediaTime
-
const ALIGN: usize -
type Init = T -
unsafe fn init(init: <T as Pointable>::Init) -> usize -
unsafe fn deref<'a>(ptr: usize) -> &'a T -
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T -
unsafe fn drop(ptr: usize)
impl Pointee for MediaTime
-
type Metadata = ()
impl Read for MediaTime
impl<R> ReadPrimitive for MediaTime
impl StructuralPartialEq for MediaTime
impl Sub for MediaTime
-
type Output = MediaTime -
fn sub(self, rhs: Self) -> <Self as >::Output
impl SubAssign for MediaTime
-
fn sub_assign(&mut self, rhs: Self)
impl WithSubscriber for MediaTime
Constants
TICKS_PER_SECOND
const TICKS_PER_SECOND: i64 = 28_224_000i64;Defined in crates/byte-engine/src/time.rs:12
The number of engine ticks in one second.
This rate exactly represents the engine's conventional frame rates and 44.1, 48, 96, and 192 kHz audio sample boundaries.