Struct ulid::Ulid
[−]
[src]
pub struct Ulid(_, _);
A Ulid is a unique 128-bit lexicographically sortable identifier
Canonically, it is represented as a 26 character Crockford Base32 encoded string.
Of the 128-bits, the first 48 are a unix timestamp in milliseconds. The remaining 80 are random. The first 48 provide for lexicographic sorting and the remaining 80 ensure that the identifier is unique.
Methods
impl Ulid
[src]
fn new() -> Ulid
Creates a new Ulid with the current time
fn from_datetime<T: TimeZone>(datetime: DateTime<T>) -> Ulid
Creates a new Ulid with the given datetime
This can be useful when migrating data to use Ulid identifiers
fn from_string(encoded: &str) -> Result<Ulid, EncodingError>
Creates a Ulid from a Crockford Base32 encoded string
An EncodingError will be returned when the given string is not formated properly.
fn datetime(&self) -> DateTime<UTC>
Gets the datetime of when this Ulid was created accurate to 1ms
fn to_string(&self) -> String
Creates a Crockford Base32 encoded string that represents this Ulid
Trait Implementations
impl Debug for Ulid
[src]
impl PartialOrd for Ulid
[src]
fn partial_cmp(&self, __arg_0: &Ulid) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Ulid) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Ulid) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Ulid) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Ulid) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl PartialEq for Ulid
[src]
fn eq(&self, __arg_0: &Ulid) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Ulid) -> bool
This method tests for !=
.
impl Clone for Ulid
[src]
fn clone(&self) -> Ulid
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more