Struct ulid::Ulid [] [src]

pub struct Ulid(pub u64, pub u64);

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]

Creates a new Ulid with the current time

Creates a new Ulid with the given datetime

This can be useful when migrating data to use Ulid identifiers

Creates a Ulid from a Crockford Base32 encoded string

An EncodingError will be returned when the given string is not formated properly.

Gets the datetime of when this Ulid was created accurate to 1ms

Gets the timestamp section of this ulid

Creates a Crockford Base32 encoded string that represents this Ulid

Trait Implementations

impl Debug for Ulid
[src]

Formats the value using the given formatter.

impl PartialOrd for Ulid
[src]

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

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]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Clone for Ulid
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Into<String> for &'a Ulid
[src]

Performs the conversion.

impl From<(u64, u64)> for Ulid
[src]

Performs the conversion.

impl Into<(u64, u64)> for Ulid
[src]

Performs the conversion.

impl Display for Ulid
[src]

Formats the value using the given formatter. Read more