Skip to main content

Uuid

Struct Uuid 

Source
pub struct Uuid {
    pub most: u64,
    pub least: u64,
}
Expand description

A 128-bit universally unique identifier used throughout the Minecraft protocol.

UUIDs identify players, entities, and various protocol objects. They are encoded as two consecutive big-endian 64-bit integers (most significant bits first, then least significant bits), occupying exactly 16 bytes on the wire. The Minecraft protocol uses UUIDs in login packets (player UUID), entity spawn packets, player info, and boss bar management.

The standard display format is 8-4-4-4-12 lowercase hex with dashes (e.g., 550e8400-e29b-41d4-a716-446655440000).

Fields§

§most: u64

Most significant 64 bits of the UUID.

§least: u64

Least significant 64 bits of the UUID.

Implementations§

Source§

impl Uuid

Source

pub fn new(most: u64, least: u64) -> Self

Creates a new UUID from its most and least significant 64-bit halves.

Source

pub fn from_bytes(bytes: [u8; 16]) -> Self

Creates a UUID from a 16-byte array in big-endian order.

The first 8 bytes form the most significant bits, the last 8 form the least significant bits.

Source

pub fn to_bytes(self) -> [u8; 16]

Converts the UUID to a 16-byte array in big-endian order.

Trait Implementations§

Source§

impl Clone for Uuid

Source§

fn clone(&self) -> Uuid

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Uuid

Debug output uses the same 8-4-4-4-12 hex format as Display for readability.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decode for Uuid

Decodes a UUID from two consecutive big-endian u64 values (16 bytes).

Reads the most significant 64 bits first, then the least significant 64 bits. Fails if fewer than 16 bytes remain in the buffer.

Source§

fn decode(buf: &mut &[u8]) -> Result<Self>

Reads 16 big-endian bytes and reconstructs the UUID.

Fails with Error::BufferUnderflow if fewer than 16 bytes remain.

Source§

impl Default for Uuid

Source§

fn default() -> Uuid

Returns the “default value” for a type. Read more
Source§

impl Display for Uuid

Displays the UUID in the standard 8-4-4-4-12 lowercase hex format.

This matches the format used by Mojang’s API and the Minecraft client (e.g., 550e8400-e29b-41d4-a716-446655440000).

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Encode for Uuid

Encodes a UUID as two consecutive big-endian u64 values (16 bytes total).

The most significant 64 bits are written first, followed by the least significant 64 bits. This matches the Minecraft protocol wire format for all UUID fields.

Source§

fn encode(&self, buf: &mut Vec<u8>) -> Result<()>

Writes the UUID as 16 big-endian bytes (most significant first).

Source§

impl EncodedSize for Uuid

A UUID always occupies exactly 16 bytes on the wire.

Source§

impl From<[u8; 16]> for Uuid

Converts a 16-byte array into a UUID.

Source§

fn from(bytes: [u8; 16]) -> Self

Converts to this type from the input type.
Source§

impl From<Uuid> for [u8; 16]

Converts a UUID into a 16-byte array in big-endian order.

Source§

fn from(uuid: Uuid) -> Self

Converts to this type from the input type.
Source§

impl Hash for Uuid

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Uuid

Source§

fn eq(&self, other: &Uuid) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Uuid

Source§

impl Eq for Uuid

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.