Struct alpm_types::BuildDate
source · pub struct BuildDate(i64);
Expand description
A build date in seconds since the epoch
§Examples
use alpm_types::{BuildDate, Error};
use time::OffsetDateTime;
use std::str::FromStr;
// create BuildDate from OffsetDateTime
let datetime: BuildDate = OffsetDateTime::from_unix_timestamp(1).unwrap().into();
assert_eq!(BuildDate::new(1), datetime);
// create BuildDate from &str
assert_eq!(BuildDate::from_str("1"), Ok(BuildDate::new(1)));
assert_eq!(
BuildDate::from_str("foo"),
Err(Error::InvalidBuildDate(String::from("foo")))
);
// format as String
assert_eq!("1", format!("{}", BuildDate::new(1)));
Tuple Fields§
§0: i64
Implementations§
Trait Implementations§
source§impl PartialEq for BuildDate
impl PartialEq for BuildDate
impl Copy for BuildDate
impl Eq for BuildDate
impl StructuralPartialEq for BuildDate
Auto Trait Implementations§
impl Freeze for BuildDate
impl RefUnwindSafe for BuildDate
impl Send for BuildDate
impl Sync for BuildDate
impl Unpin for BuildDate
impl UnwindSafe for BuildDate
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