pub struct ShardCodec { /* private fields */ }Expand description
Packs a physical shard number into the high bits of a u64 id, so any id
(primary key or a shard-encoded foreign key) self-describes its shard.
With shard_bits = 12, ids carry a 12-bit shard (up to 4096 shards) and a
52-bit per-shard sequence — ample for app-generated ids. Auto-increment is
not used for sharded entities (it can’t carry the shard); the app composes
the id with compose.
Implementations§
Source§impl ShardCodec
impl ShardCodec
Trait Implementations§
Source§impl Clone for ShardCodec
impl Clone for ShardCodec
impl Copy for ShardCodec
Source§impl Debug for ShardCodec
impl Debug for ShardCodec
impl Eq for ShardCodec
Source§impl PartialEq for ShardCodec
impl PartialEq for ShardCodec
Source§impl ShardLocator for ShardCodec
impl ShardLocator for ShardCodec
impl StructuralPartialEq for ShardCodec
Auto Trait Implementations§
impl Freeze for ShardCodec
impl RefUnwindSafe for ShardCodec
impl Send for ShardCodec
impl Sync for ShardCodec
impl Unpin for ShardCodec
impl UnsafeUnpin for ShardCodec
impl UnwindSafe for ShardCodec
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