[][src]Enum ron_uuid::UUID

pub enum UUID {
    Name {
        name: u64,
        scope: u64,
    },
    Number {
        value1: u64,
        value2: u64,
    },
    Event {
        timestamp: u64,
        origin: u64,
    },
    Derived {
        timestamp: u64,
        origin: u64,
    },
}

UUIDs are used by RON to identify types, objects, events, etc.

There are different kinds of UUIDs: Name, number, event and derived.

Any UUID has four parts, two related to its content, and two related to its type.

The type of an UUID is a 2-bit number called the scheme. The subtype of an UUID is a 4-bit number called the variety (currently unsupported). Together, the scheme and variety specify the kind of UUID.

Two other fields describe the actual content of the UUID. Both are 60-bit numbers that can be represented as ten-digit Base64 characters.

That leaves 2 bits to make up a 128-bit number. These 2 bits are always 0 and are provided for backwards compatibility with RFC4122 (variant field).

Variants

Name

Name UUIDs are often used to encode short string atoms, such as types (e.g. lww). The string is read as a Base64-literal to determine the actual (numeric) UUID component. Name UUIDs can be global (e.g. lww = lww$0) or scoped (e.g. dbtest$client1)

Fields of Name

name: u64

Local name.

scope: u64

Global namespace/node ID.

Number

Number UUIDs encode numbers (e.g. indices into a matrix) and hash values. The meaning of the two values is context-dependent.

Fields of Number

value1: u64

First value.

value2: u64

Second value.

Event

Event UUIDs are Lamport-timestamps that are used to identify operations and objects. The timestamp is clock-dependent, while the origin is a replica ID.

Fields of Event

timestamp: u64

Local timestamp.

origin: u64

Global namespace/node ID.

Derived

Derived UUIDs refer to an event ID, without being the event ID.

Fields of Derived

timestamp: u64

Local timestamp.

origin: u64

Global namespace/node ID.

Methods

impl UUID[src]

pub fn set_node_id(val: u64)[src]

Sets the default UUID origin. s must not be longer than 10 characters and only consist of [0-9a-zA-Z~_].

pub fn node_id() -> u64[src]

The current default UUID origin. Initially "0".

pub fn now() -> Self[src]

New UUID with the default origin (see node_id and set_node_id) and the current time. Ignoring leap seconds and other events that mess with the system time all calls to this functions return unique UUID (duh).

pub fn zero() -> Self[src]

Creates a new 0 UUID

pub fn is_name(&self) -> bool[src]

Return true if and only if this is a name UUID.

pub fn is_number(&self) -> bool[src]

Return true if and only if this is a number UUID.

pub fn is_event(&self) -> bool[src]

Return true if and only if this is an event UUID.

pub fn is_derived(&self) -> bool[src]

Return true if and only if this is a derived UUID.

pub fn is_zero(&self) -> bool[src]

Returns true if high() = low() = 0.

pub fn weak_cmp(a: &UUID, b: &UUID) -> Ordering[src]

Compares a and b while ignoring the scheme.

pub fn parse<'a>(
    input: &'a str,
    context: Option<(&UUID, &UUID)>
) -> Option<(UUID, &'a str)>
[src]

Parse a single UUID and return the remaining string. The context argument is the pair previous column UUID / previous row UUID or None.

pub fn compress(&self, context: Option<(&UUID, &UUID)>) -> String[src]

Serialize this UUID the text optionally compressing it against (previous column UUID / previous row UUID) if context is not None.

Trait Implementations

impl Eq for UUID[src]

impl Ord for UUID[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl PartialEq<UUID> for UUID[src]

impl Copy for UUID[src]

impl Clone for UUID[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl PartialOrd<UUID> for UUID[src]

impl Default for UUID[src]

impl Debug for UUID[src]

impl Display for UUID[src]

impl Hash for UUID[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for UUID[src]

type Err = ()

The associated error which can be returned from parsing.

impl Arbitrary for UUID[src]

fn shrink(&self) -> Box<dyn Iterator<Item = Self> + 'static>[src]

Auto Trait Implementations

impl Send for UUID

impl Sync for UUID

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]