pub struct Timecode;Expand description
Implementationsยง
Sourceยงimpl Timecode
impl Timecode
Sourcepub const fn split_secs_f64(
seconds: f64,
) -> TimeSplitHourNano<u32, u8, u8, u16, NoTime, NoTime>
pub const fn split_secs_f64( seconds: f64, ) -> TimeSplitHourNano<u32, u8, u8, u16, NoTime, NoTime>
Decomposes a number of seconds in { h, m, s, ms }.
The maximum decomposition for u64::MAX is
{ h: 5_124_095_576_030_431, .. } (more than 584_942_417 millenia).
Sourcepub const fn split_nanos_u64(
nanos: u64,
) -> TimeSplitHourNano<NoTime, NoTime, u32, u16, u16, u16>
pub const fn split_nanos_u64( nanos: u64, ) -> TimeSplitHourNano<NoTime, NoTime, u32, u16, u16, u16>
Splits a number of nanoseconds in { s, ms, ยตs, ns }.
The maximum decomposition for u64::MAX is
{ s: 1_266_874_889, .. } (more than 40 years).
Sourcepub const fn split_nanos_u32(
nanos: u32,
) -> TimeSplitHourNano<NoTime, NoTime, u8, u16, u16, u16>
pub const fn split_nanos_u32( nanos: u32, ) -> TimeSplitHourNano<NoTime, NoTime, u8, u16, u16, u16>
Splits a number of nanoseconds in { s, ms, ยตs, ns }.
The maximum decomposition for u32::MAX is
{ ns: 295, ยตs: 967, ms: 294, s: 4 } (more than 4 seconds).
Sourcepub const fn write_secs_f64(buf: &mut [u8], seconds: f64) -> usize
pub const fn write_secs_f64(buf: &mut [u8], seconds: f64) -> usize
Writes the time code as HH:MM:SS.mmm or MM:SS.mmm.
Hours are clamped to 99.
Returns the number of bytes written, or 0 if buf is too small.
Sourcepub const fn secs_f64(seconds: f64) -> StringU8<12>
pub const fn secs_f64(seconds: f64) -> StringU8<12>
Returns the time code as HH:MM:SS.mmm or MM:SS.mmm.
Hours are clamped to 99.
ยงFeatures
Uses unsafe_str if enabled.
Sourcepub fn nanos_u64_alloc(ns: u64) -> String โ
Available on crate feature alloc only.
pub fn nanos_u64_alloc(ns: u64) -> String โ
alloc only.Returns the time code, up to seconds, as 001s 012ms 012ยตs 012ns.
The seconds are clamped to 999 (more than 16 minutes). TODO TEST
Sourcepub const fn write_nanos_u64(buf: &mut [u8], nanos: u64) -> usize
pub const fn write_nanos_u64(buf: &mut [u8], nanos: u64) -> usize
Writes a compact nanosecond time code.
Format examples:
001s 002ms 003ยตs 004ns002ms 003ยตs 004ns003ยตs 004ns004ns
Seconds are clamped to 999.
Returns the number of bytes written, or 0 if buf is too small.
Trait Implementationsยง
Auto Trait Implementationsยง
impl Freeze for Timecode
impl RefUnwindSafe for Timecode
impl Send for Timecode
impl Sync for Timecode
impl Unpin for Timecode
impl UnsafeUnpin for Timecode
impl UnwindSafe for Timecode
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
alloc only.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
Sourceยงimpl<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout only.T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
unsafe_slice only.