#[non_exhaustive]pub enum TaskId {
Int(u64),
String(String),
Uuid(Uuid),
Ulid(Ulid),
}Expand description
A wrapper type that defines a task id.
Supports a fixed set of common identifier representations. Uuid and
Ulid variants are only available when the corresponding crate features
are enabled.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Int(u64)
An integer-based id
String(String)
A string-based id
Uuid(Uuid)
Available on crate feature
uuid only.A UUID-based id
Ulid(Ulid)
Available on crate feature
ulid only.A ULID-based id
Implementations§
Source§impl TaskId
impl TaskId
Sourcepub fn from_string(id: impl Into<String>) -> Self
pub fn from_string(id: impl Into<String>) -> Self
Construct a TaskId from a string.
Sourcepub fn from_uuid(id: Uuid) -> Self
Available on crate feature uuid only.
pub fn from_uuid(id: Uuid) -> Self
uuid only.Construct a TaskId from a UUID.
Sourcepub fn from_ulid(id: Ulid) -> Self
Available on crate feature ulid only.
pub fn from_ulid(id: Ulid) -> Self
ulid only.Construct a TaskId from a ULID.
Sourcepub fn as_int(&self) -> Option<u64>
pub fn as_int(&self) -> Option<u64>
Returns the inner value as an integer, if this is an Int variant.
Sourcepub fn as_string(&self) -> Option<&str>
pub fn as_string(&self) -> Option<&str>
Returns the inner value as a string slice, if this is a String variant.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskId
Available on crate feature serde only.
impl<'de> Deserialize<'de> for TaskId
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for TaskId
Source§impl<Args: Sync> FromRequest<Task<Args>> for TaskId
impl<Args: Sync> FromRequest<Task<Args>> for TaskId
Source§type Error = MissingDataError
type Error = MissingDataError
The error type that can occur during extraction.
Source§impl Ord for TaskId
impl Ord for TaskId
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 TaskId
impl PartialOrd for TaskId
impl StructuralPartialEq for TaskId
Auto Trait Implementations§
impl Freeze for TaskId
impl RefUnwindSafe for TaskId
impl Send for TaskId
impl Sync for TaskId
impl Unpin for TaskId
impl UnsafeUnpin for TaskId
impl UnwindSafe for TaskId
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