bty 0.2.0

Streamlined definition and usage of branded types in Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[cfg(feature = "uuid")]
impl<Tag> crate::Brand<Tag, uuid::Uuid> {
    #[cfg(feature = "uuid-v4")]
    /// Creates a new brand value using [`uuid::Uuid::new_v4`].
    #[must_use]
    pub fn new_v4() -> Self {
        Self::unchecked_from_inner(uuid::Uuid::new_v4())
    }

    #[cfg(feature = "uuid-v7")]
    /// Creates a new brand value using [`uuid::Uuid::now_v7`].
    #[must_use]
    pub fn now_v7() -> Self {
        Self::unchecked_from_inner(uuid::Uuid::now_v7())
    }
}