pub struct Timestamp(pub u64);Expand description
Timestamp
Tuple Fields§
§0: u64Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn is_multiple_of(self, other: Resolution) -> bool
pub fn is_multiple_of(self, other: Resolution) -> bool
Checks if the timestamp is a multiple of the given resolution.
Sourcepub fn as_idx(self) -> Result<u32, IndexError>
pub fn as_idx(self) -> Result<u32, IndexError>
trues to convert the secs into a u32 index
Sourcepub fn diff(self, other: Self) -> Option<Resolution>
pub fn diff(self, other: Self) -> Option<Resolution>
Returns the difference between two timestamps as a Resolution.
Returns None if the timestamps are equal.
Sourcepub fn align_down(self, resolution: Resolution) -> Self
pub fn align_down(self, resolution: Resolution) -> Self
Aligns the timestamp down to a given resolution.
Sourcepub fn align_up(self, resolution: Resolution) -> Self
pub fn align_up(self, resolution: Resolution) -> Self
Aligns the timestamp up to a given resolution.
Source§impl Timestamp
impl Timestamp
Sourcepub fn saturating_sub(self, rhs: Self) -> Self
pub fn saturating_sub(self, rhs: Self) -> Self
Saturating subtraction of two timestamps.
Trait Implementations§
Source§impl Add<Resolution> for Timestamp
impl Add<Resolution> for Timestamp
Source§impl AddAssign<Resolution> for Timestamp
impl AddAssign<Resolution> for Timestamp
Source§fn add_assign(&mut self, rhs: Resolution)
fn add_assign(&mut self, rhs: Resolution)
Performs the
+= operation. Read moreSource§impl AddAssign<u32> for Timestamp
impl AddAssign<u32> for Timestamp
Source§fn add_assign(&mut self, rhs: u32)
fn add_assign(&mut self, rhs: u32)
Performs the
+= operation. Read moreSource§impl AddAssign for Timestamp
impl AddAssign for Timestamp
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<'__de, __Context> BorrowDecode<'__de, __Context> for Timestamp
impl<'__de, __Context> BorrowDecode<'__de, __Context> for Timestamp
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Div<Resolution> for Timestamp
impl Div<Resolution> for Timestamp
Source§impl Mul<Resolution> for Timestamp
impl Mul<Resolution> for Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialEq<Resolution> for Timestamp
impl PartialEq<Resolution> for Timestamp
Source§impl PartialEq<Timestamp> for Resolution
impl PartialEq<Timestamp> for Resolution
Source§impl PartialOrd<Resolution> for Timestamp
impl PartialOrd<Resolution> for Timestamp
Source§impl PartialOrd<Timestamp> for Resolution
impl PartialOrd<Timestamp> for Resolution
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
Source§impl Rem<Resolution> for Timestamp
impl Rem<Resolution> for Timestamp
impl Copy for Timestamp
impl Eq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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