pub struct Semantic64<K> { /* private fields */ }
Expand description
Semantic64<K>
is a struct that contains a 64-bit integer ID. This ID is composed of the following parts:
- 48-bit millisecond timestamp: Used to represent the time when the ID was created. The timestamp range starts from January 1, 1970, 00:00:00 UTC, and can represent approximately 279,000 years.
- 8-bit device ID: Used to identify the device or service instance that created the ID. It can represent up to 256 different devices.
- 8-bit sequential ID: Used to generate multiple IDs within a 1-millisecond interval. It can represent a sequential ID between 0 and 255.
This ID structure can guarantee uniqueness in a distributed system, while also providing time and device information. It is suitable for scenarios that require generating unique IDs, such as message IDs, event IDs, and so on.
Implementations§
Trait Implementations§
Source§impl<K> Clone for Semantic64<K>
impl<K> Clone for Semantic64<K>
Source§impl<K: SemanticKey> Debug for Semantic64<K>
impl<K: SemanticKey> Debug for Semantic64<K>
Source§impl<K> Default for Semantic64<K>
impl<K> Default for Semantic64<K>
Source§impl<K: SemanticKey> Display for Semantic64<K>
impl<K: SemanticKey> Display for Semantic64<K>
Source§impl<K> From<i64> for Semantic64<K>
impl<K> From<i64> for Semantic64<K>
Source§impl<K> From<u64> for Semantic64<K>
impl<K> From<u64> for Semantic64<K>
Source§impl<K> FromStr for Semantic64<K>
impl<K> FromStr for Semantic64<K>
Source§impl<K> Hash for Semantic64<K>
impl<K> Hash for Semantic64<K>
Source§impl<K> LowerHex for Semantic64<K>
impl<K> LowerHex for Semantic64<K>
Source§impl<K> PartialEq for Semantic64<K>
impl<K> PartialEq for Semantic64<K>
impl<K> Copy for Semantic64<K>
impl<K> Eq for Semantic64<K>
Auto Trait Implementations§
impl<K> Freeze for Semantic64<K>
impl<K> RefUnwindSafe for Semantic64<K>where
K: RefUnwindSafe,
impl<K> Send for Semantic64<K>where
K: Send,
impl<K> Sync for Semantic64<K>where
K: Sync,
impl<K> Unpin for Semantic64<K>where
K: Unpin,
impl<K> UnwindSafe for Semantic64<K>where
K: UnwindSafe,
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