[][src]Struct ulid_rs::Ulid

pub struct Ulid(_);

Ulid

Implementations

impl Ulid[src]

pub fn new<F>(timestamp: u64, rng: F) -> Ulid where
    F: Fn() -> u8
[src]

creates new Ulid from a timestamp and a custom rng

pub fn encode_time(&mut self, timestamp: u64)[src]

encodes time in the first 6 words

pub fn encode_entropy<F>(&mut self, rng: F) where
    F: Fn() -> u8
[src]

encodes entropy in the last 10 words

pub fn marshal(&self) -> [u8; 26][src]

create a string representation of the stored ULID

https://github.com/suyash/val/blob/master/ulid_uint128.hh#L253

pub fn unmarshal<S>(s: S) -> Result<Ulid, UlidError> where
    S: AsRef<[u8]>, 
[src]

unmarshals a string-like into a ULID

pub fn timestamp(&self) -> u64[src]

return the timestamp associated with the Ulid

Trait Implementations

impl Debug for Ulid[src]

impl From<[u8; 16]> for Ulid[src]

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

impl Into<[u8; 16]> for Ulid[src]

impl Into<Vec<u8>> for Ulid[src]

impl PartialEq<Ulid> for Ulid[src]

impl PartialOrd<Ulid> for Ulid[src]

impl StructuralPartialEq for Ulid[src]

impl ToString for Ulid[src]

impl<'_> TryFrom<&'_ [u8]> for Ulid[src]

type Error = TryFromSliceError

The type returned in the event of a conversion error.

impl<'_> TryFrom<&'_ str> for Ulid[src]

type Error = UlidError

The type returned in the event of a conversion error.

impl TryFrom<String> for Ulid[src]

type Error = UlidError

The type returned in the event of a conversion error.

impl TryInto<String> for Ulid[src]

type Error = FromUtf8Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Ulid

impl Send for Ulid

impl Sync for Ulid

impl Unpin for Ulid

impl UnwindSafe for Ulid

Blanket Implementations

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

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

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

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

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

impl<T> ToString for T where
    T: Display + ?Sized
[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.