Skip to content

Instantly share code, notes, and snippets.

@sanbox-irl
Created November 14, 2019 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanbox-irl/da63e097fa4779ee54ffe9230e8d93c0 to your computer and use it in GitHub Desktop.
Save sanbox-irl/da63e097fa4779ee54ffe9230e8d93c0 to your computer and use it in GitHub Desktop.
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct SerializedMetaData {
pub created: SystemTime,
pub modified: SystemTime,
}
impl SerializedMetaData {
/// There is a possibility of failure reading the created/modified. Unlikely
/// on any target platforms, but quite likely on consoles. Unfortunately,
/// NDAs prevent me from going into any detail there...
pub fn new(metadata: fs::Metadata) -> Result<SerializedMetaData, Error> {
Ok(SerializedMetaData {
created: metadata.created()?,
modified: metadata.modified()?,
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment