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§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for DynamicType
impl Clone for DynamicType
Source§fn clone(&self) -> DynamicType
fn clone(&self) -> DynamicType
Returns a duplicate 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§impl PartialOrd for DynamicType
impl PartialOrd for DynamicType
Source§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