pub struct Uuid(/* private fields */);Available on crate features
model-mysql or model-postgres or model-sqlite only.Expand description
A UUID, kept as its 16 bytes.
use rust_web_server::model::Uuid;
let id = Uuid::now_v7();
assert_eq!(id.version(), 7);
assert_eq!(Uuid::parse(&id.to_string()).unwrap(), id);
assert!(Uuid::default().is_nil());Implementations§
Source§impl Uuid
impl Uuid
Sourcepub const NIL: Uuid
pub const NIL: Uuid
00000000-0000-0000-0000-000000000000, also Uuid::default(): a key
not chosen yet — save generates a v7 in its place.
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> Uuid
pub const fn from_bytes(bytes: [u8; 16]) -> Uuid
The UUID with these bytes.
Sourcepub fn version(&self) -> u8
pub fn version(&self) -> u8
The version field (4 for Uuid::new_v4, 7 for Uuid::now_v7).
Trait Implementations§
impl Copy for Uuid
Source§impl<'de> Deserialize<'de> for Uuid
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Uuid
Available on crate feature
serde only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<Uuid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Uuid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Uuid
Source§impl Ord for Uuid
impl Ord for Uuid
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Uuid
impl PartialOrd for Uuid
impl PrimaryKey for Uuid
Source§impl<'a, T> Repository<T, Uuid> for ModelRepository<'a, T, Uuid>where
T: Model,
impl<'a, T> Repository<T, Uuid> for ModelRepository<'a, T, Uuid>where
T: Model,
async fn find_by_id(&self, id: Uuid) -> Result<Option<T>, DbError>
async fn find_all(&self) -> Result<Vec<T>, DbError>
async fn save(&self, entity: &T) -> Result<T, DbError>
async fn save_all(&self, entities: &[T]) -> Result<Vec<T>, DbError>
async fn delete_by_id(&self, id: Uuid) -> Result<(), DbError>
async fn delete_all_by_id(&self, ids: &[Uuid]) -> Result<(), DbError>
async fn count(&self) -> Result<i64, DbError>
async fn exists_by_id(&self, id: Uuid) -> Result<bool, DbError>
Source§impl Serialize for Uuid
Available on crate feature serde only.
impl Serialize for Uuid
Available on crate feature
serde only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Uuid
Auto Trait Implementations§
impl Freeze for Uuid
impl RefUnwindSafe for Uuid
impl Send for Uuid
impl Sync for Uuid
impl Unpin for Uuid
impl UnsafeUnpin for Uuid
impl UnwindSafe for Uuid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> RuleType for T
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Available on crate feature
map-response-body only.Apply a transformation to the response body. Read more
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using HTTP status codes. Read more
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Available on crate feature
trace only.High level tracing that classifies responses using gRPC headers. Read more