mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-12 16:43:03 +03:00
add core lib id docs
This commit is contained in:
parent
e67e1b983f
commit
354afedea2
@ -1,9 +1,16 @@
|
|||||||
|
//! A generic UUID-based wrapper, via a newtype pattern
|
||||||
|
//! with a few key integrations used throughout the library.
|
||||||
|
|
||||||
use std::{fmt, hash::Hash, marker::PhantomData, str};
|
use std::{fmt, hash::Hash, marker::PhantomData, str};
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
/// A generic UUID-based newtype.
|
||||||
|
///
|
||||||
|
/// `Default` is implemented to generate a new UUID
|
||||||
|
/// via [`Uuid::new_v4`].
|
||||||
pub struct Id<T>(Uuid, PhantomData<T>);
|
pub struct Id<T>(Uuid, PhantomData<T>);
|
||||||
|
|
||||||
impl<T> Hash for Id<T> {
|
impl<T> Hash for Id<T> {
|
||||||
|
Loading…
Reference in New Issue
Block a user