pub struct StreamId(/* private fields */);Expand description
Unique identifier for a stream within the system.
Implementations§
Source§impl StreamId
impl StreamId
pub fn new(id: u64) -> Self
Sourcepub fn from_tenant_and_local(tenant_id: TenantId, local_id: u32) -> Self
pub fn from_tenant_and_local(tenant_id: TenantId, local_id: u32) -> Self
Creates stream ID from tenant ID and local stream number.
Bit Layout:
- Upper 32 bits:
tenant_id(supports 4.3B tenants) - Lower 32 bits:
local_stream_id(4.3B streams per tenant)
§Examples
let stream_id = StreamId::from_tenant_and_local(TenantId::from(5), 1);
assert_eq!(u64::from(stream_id), 21474836481); // (5 << 32) | 1
assert_eq!(TenantId::from_stream_id(stream_id), TenantId::from(5));Trait Implementations§
Source§impl<'de> Deserialize<'de> for StreamId
impl<'de> Deserialize<'de> for StreamId
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for StreamId
impl Ord for StreamId
Source§impl PartialOrd for StreamId
impl PartialOrd for StreamId
impl Copy for StreamId
impl Eq for StreamId
impl StructuralPartialEq for StreamId
Auto Trait Implementations§
impl Freeze for StreamId
impl RefUnwindSafe for StreamId
impl Send for StreamId
impl Sync for StreamId
impl Unpin for StreamId
impl UnwindSafe for StreamId
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