pub struct StreamId(/* private fields */);
Expand description
Identifies a (multiplexed) stream.
Stream IDs are variable-length integers with the least significant 3 bits denoting the stream type and initiator.
The first bit denotes the initiator (outbound or inbound), while the second
and third bit denote the stream type. See StreamKind
.
In a situation where Alice connects to Bob, Alice will have the initiator
bit set to 1
for all streams she creates, while Bob will have it set to 0
.
This ensures that Stream IDs never collide. Additionally, Stream IDs must never be re-used within a connection.
+=======+==================================+ | Bits | Stream Type | +=======+==================================+ | 0b000 | Outbound Control stream | +—––+–––––––––––––––––+ | 0b001 | Inbound Control stream | +—––+–––––––––––––––––+ | 0b010 | Outbound Gossip stream | +—––+–––––––––––––––––+ | 0b011 | Inbound Gossip stream | +—––+–––––––––––––––––+ | 0b100 | Outbound Git stream | +—––+–––––––––––––––––+ | 0b101 | Inbound Git stream | +—––+–––––––––––––––––+
Implementations§
Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more