i0 0.1.4

thei.rs/i0 reference implementation written in rust
Documentation
use crate::Timestamp;
use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD};
use std::fmt::{Display, Formatter};

/// Parametes necessary to generate an [i0:2](https://thei.rs/i0:2) or [i0:3](https://thei.rs/i0:3)
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Metadata<'a> {
    /// A user-specified string describing the object the i0 is representing
    pub designation: &'a str,
    /// When generation of this i0 was requested
    pub timestamp: &'a Timestamp,
    /// Some random data used to reduce collision chance
    pub seed: &'a [u8; 32],
}

impl Display for Metadata<'_> {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        write!(
            f,
            "-d '{desig}' -t '{ts}' -s '{seed}' ",
            seed = URL_SAFE_NO_PAD.encode(self.seed),
            desig = self.designation,
            ts = self.timestamp
        )?;
        Ok(())
    }
}