pub struct TimestampSeq { /* private fields */ }
Expand description
Represents a timestamped sequence generator.
Implementations§
Source§impl TimestampSeq
impl TimestampSeq
Sourcepub fn new() -> TimestampSeq
pub fn new() -> TimestampSeq
Creates a new TimestampSeq
instance with default values.
Sourcepub fn next_id(&self) -> u64
pub fn next_id(&self) -> u64
Generates the next unique ID based on the timestamp and sequence number.
The generated ID is a combination of timestamp and sequence number, ensuring uniqueness.
- Note that it is not guaranteed to be in increasing order。
§Examples
use idable::TimestampSeq;
let mut timestamp_seq = TimestampSeq::new();
// Generate the next unique ID.
let unique_id = timestamp_seq.next_id();
// Print the generated unique ID.
println!("Generated Unique ID: {}", unique_id);
Trait Implementations§
Source§impl Default for TimestampSeq
impl Default for TimestampSeq
Source§fn default() -> TimestampSeq
fn default() -> TimestampSeq
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for TimestampSeq
impl RefUnwindSafe for TimestampSeq
impl Send for TimestampSeq
impl Sync for TimestampSeq
impl Unpin for TimestampSeq
impl UnwindSafe for TimestampSeq
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more