pub struct Uuid(pub Uuid);Expand description
A 128-bit universally unique identifier.
Encoded as an unsigned 128-bit integer (or two unsigned 64-bit integers: the most significant 64 bits and then the least significant 64 bits).
See Universally unique identifier.
§Examples
use mcproto_types::{TypeCodec, basic::Uuid};
let value = Uuid::from_bytes([
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
0x0f, 0xed, 0xcb, 0xa9, 0x87, 0x65, 0x43, 0x21,
]);
let mut encoded = Vec::new();
value.encode(&mut encoded)?;
assert_eq!(
encoded,
[
0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0,
0x0f, 0xed, 0xcb, 0xa9, 0x87, 0x65, 0x43, 0x21,
]
);
let mut input = encoded.as_slice();
assert_eq!(Uuid::decode(&mut input)?, value);
assert!(input.is_empty());Tuple Fields§
§0: UuidThe UUID value.
Implementations§
Trait Implementations§
impl Copy for Uuid
Source§impl<'de> Deserialize<'de> for Uuid
impl<'de> Deserialize<'de> for Uuid
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 Uuid
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