Enum Id
Source pub enum Id {
Uuid(Uuid),
Ulid(Ulid),
Sequential(u64),
}
Expand description
Represents a unique identifier in the trading system.
This enum supports multiple ID formats to provide flexibility
in identifier handling across different systems.
UUID (Universally Unique Identifier) format.
A 128-bit identifier that is globally unique across space and time.
ULID (Universally Unique Lexicographically Sortable Identifier) format.
A 128-bit identifier that is lexicographically sortable and globally unique.
Sequential u64 identifier.
Useful for CEX systems where orders are assigned sequential IDs per market.
Create a new random id (defaults to ULID for better sortability).
Create a new UUID-based id.
Create a new ULID-based id.
Create an id from an existing UUID.
Create an id from an existing ULID.
Get identifier bytes.
UUID and ULID return 16 bytes.
Sequential returns 8 bytes zero-padded to 16 bytes.
Create a sequential id from a u64.
Create an id from a u64 by embedding it in a UUID.
This exists for backward compatibility.
Returns the u64 value when the id is sequential.
Returns true if the id is sequential.
Returns true if the id is UUID-based.
Returns true if the id is ULID-based.
Performs copy-assignment from
source.
Read more
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Deserialize this value from the given Serde deserializer.
Read more
Formats the value using the given formatter.
Read more
The associated error which can be returned from parsing.
Parses a string
s to return a value of this type.
Read more
Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Serialize this value into the given Serde serializer.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
Read more
Checks if this value is equivalent to the given key.
Read more
Returns the argument unchanged.
Instruments this type with the provided
Span, returning an
Instrumented wrapper.
Read more
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer.
Read more
Mutably dereferences the given pointer.
Read more
Drops the object pointed to by the given pointer.
Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
Converts the given value to a
String.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.