[−][src]Struct ulid_generator_rs::ULIDGenerator
This is the ULID Generator.
Implementations
impl ULIDGenerator
[src]
#[must_use]pub fn new() -> Self
[src]
The Constructor for ULIDGenerator.
pub fn generate(&mut self) -> Result<ULID, ULIDError>
[src]
Generate a ULID.
Generate a ULID based on the current time.
Example
use ulid_generator_rs::ULIDGenerator; let mut generator = ULIDGenerator::new(); let ulid = generator.generate().unwrap();
pub fn generate_monotonic(
&mut self,
previous_id: &ULID
) -> Result<ULID, ULIDError>
[src]
&mut self,
previous_id: &ULID
) -> Result<ULID, ULIDError>
Generate a monotonic ULID.
Generate a ULID based on the current time,
but if the current is the same timestamp as the previous_id
,
the lower 64 bits are incremented.
Example
use ulid_generator_rs::ULIDGenerator; let mut generator = ULIDGenerator::new(); let previous_id = generator.generate().unwrap(); let ulid = generator.generate_monotonic(&previous_id).unwrap();
pub fn generate_strictly_monotonic(
&mut self,
previous_id: &ULID
) -> Result<Option<ULID>, ULIDError>
[src]
&mut self,
previous_id: &ULID
) -> Result<Option<ULID>, ULIDError>
Generate a strictly monotonic ULID.
If the ULID generated by ULIDGenerator::generate_monotonic
is smaller than previous_id
,
None
is returned. Otherwise, the ULID will be returned wrapped in Some
.
Example
use ulid_generator_rs::ULIDGenerator; let mut generator = ULIDGenerator::new(); let prev_id = generator.generate().unwrap(); let ulid = generator.generate_monotonic(&prev_id).unwrap();
Trait Implementations
impl Clone for ULIDGenerator
[src]
pub fn clone(&self) -> ULIDGenerator
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for ULIDGenerator
[src]
impl Debug for ULIDGenerator
[src]
impl Default for ULIDGenerator
[src]
Auto Trait Implementations
impl RefUnwindSafe for ULIDGenerator
[src]
impl !Send for ULIDGenerator
[src]
impl !Sync for ULIDGenerator
[src]
impl Unpin for ULIDGenerator
[src]
impl UnwindSafe for ULIDGenerator
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,