Struct type_safe_id::DynamicType
source · pub struct DynamicType(/* private fields */);
Expand description
A dynamic type prefix
use type_safe_id::{DynamicType, TypeSafeId};
let id: TypeSafeId<DynamicType> = "prefix_01h2xcejqtf2nbrexx3vqjhp41".parse().unwrap();
assert_eq!(id.type_prefix(), "prefix");
assert_eq!(id.uuid(), uuid::uuid!("0188bac7-4afa-78aa-bc3b-bd1eef28d881"));
Implementations§
source§impl DynamicType
impl DynamicType
sourcepub fn new(s: &str) -> Result<Self, Error>
pub fn new(s: &str) -> Result<Self, Error>
Create a new type prefix from a dynamic str
use type_safe_id::{DynamicType, TypeSafeId};
let dynamic_type = DynamicType::new("prefix").unwrap();
let data = uuid::uuid!("0188bac7-4afa-78aa-bc3b-bd1eef28d881");
let id = TypeSafeId::from_type_and_uuid(dynamic_type, data);
assert_eq!(id.to_string(), "prefix_01h2xcejqtf2nbrexx3vqjhp41");
Trait Implementations§
source§impl<'a> Arbitrary<'a> for DynamicType
Available on crate feature arbitrary
only.
impl<'a> Arbitrary<'a> for DynamicType
Available on crate feature
arbitrary
only.source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moresource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moresource§impl Clone for DynamicType
impl Clone for DynamicType
source§fn clone(&self) -> DynamicType
fn clone(&self) -> DynamicType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DynamicType
impl Debug for DynamicType
source§impl Ord for DynamicType
impl Ord for DynamicType
source§fn cmp(&self, other: &DynamicType) -> Ordering
fn cmp(&self, other: &DynamicType) -> Ordering
1.21.0 · 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
source§impl PartialEq for DynamicType
impl PartialEq for DynamicType
source§fn eq(&self, other: &DynamicType) -> bool
fn eq(&self, other: &DynamicType) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for DynamicType
impl PartialOrd for DynamicType
source§fn partial_cmp(&self, other: &DynamicType) -> Option<Ordering>
fn partial_cmp(&self, other: &DynamicType) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Type for DynamicType
impl Type for DynamicType
impl Eq for DynamicType
impl StructuralPartialEq for DynamicType
Auto Trait Implementations§
impl Freeze for DynamicType
impl RefUnwindSafe for DynamicType
impl Send for DynamicType
impl Sync for DynamicType
impl Unpin for DynamicType
impl UnwindSafe for DynamicType
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