pub struct Timestamp;Expand description
Helper for generating Discord timestamp strings.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn from_unix(seconds: i64, style: TimestampStyle) -> String
pub fn from_unix(seconds: i64, style: TimestampStyle) -> String
Create a Discord timestamp tag from unix seconds.
Sourcepub fn expires_in(duration_secs: u64) -> String
pub fn expires_in(duration_secs: u64) -> String
Create a Discord timestamp tag from time remaining (now + duration). Useful for “Ends in…”
§Panics
Panics if the system time is before the unix epoch.
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin 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