#![no_std]

extern crate alloc;
use alloc::borrow::Cow;
use serde::{Deserialize, Serialize};
pub use uuid::Uuid;
pub mod uuid_ns;

/// used solely for references, resolved via workspace
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Deserialize, Serialize)]
pub struct Ident {
    pub id: Uuid,

    /// A counter, starting at 0, which should be increased every time the document
    /// structure changes drastically, in order to warn users when using it with
    /// documents which hadn't seen that epoch of the document yet, as it might break links.
    pub epoch: u32,
}

/// An export format, able to turn values of type `V` into strings.
pub trait Strifier<V>: Sized {
    fn strify(self, v: V) -> Cow<'static, str>;
}