some comments

master
rasul 5 years ago
parent 659f4f9f7f
commit e3be6592b4

@ -1,3 +1,7 @@
//! Universally unique identifier
//!
//! Wrapper around `Uuid` to store it as text in sql table.
use std::cmp::{Eq, PartialEq}; use std::cmp::{Eq, PartialEq};
use std::fmt; use std::fmt;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
@ -6,10 +10,12 @@ use rusqlite::types::{FromSql, FromSqlError, FromSqlResult, ToSql, ToSqlOutput,
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use uuid::Uuid; use uuid::Uuid;
/// Universally unique identifier
#[derive(Clone, Copy, Debug, Deserialize, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct Id(Uuid); pub struct Id(Uuid);
impl Id { impl Id {
/// Return a newly generated `Id`
pub fn new() -> Self { pub fn new() -> Self {
Self(Uuid::new_v4()) Self(Uuid::new_v4())
} }

Loading…
Cancel
Save