pub struct StreamId(/* private fields */);Expand description
Identify a single stream on a circuit.
These identifiers are local to each hop on a circuit.
This can’t be zero; if you need something that can be zero in the protocol,
use Option<StreamId>.
Implementations§
source§impl StreamId
impl StreamId
sourcepub fn new(stream_id: u16) -> Option<Self>
pub fn new(stream_id: u16) -> Option<Self>
Creates a StreamId for non-zero stream_id.
Returns None when stream_id is zero. Messages with a zero/None stream ID
apply to the circuit as a whole instead of a particular stream.
sourcepub fn get_or_zero(stream_id: Option<Self>) -> u16
pub fn get_or_zero(stream_id: Option<Self>) -> u16
Convenience function to convert to a u16; None is mapped to 0.
Trait Implementations§
source§impl From<NonZeroU16> for StreamId
impl From<NonZeroU16> for StreamId
source§fn from(id: NonZeroU16) -> Self
fn from(id: NonZeroU16) -> Self
Converts to this type from the input type.
source§impl From<StreamId> for NonZeroU16
impl From<StreamId> for NonZeroU16
source§fn from(id: StreamId) -> NonZeroU16
fn from(id: StreamId) -> NonZeroU16
Converts to this type from the input type.
source§impl PartialEq for StreamId
impl PartialEq for StreamId
impl Copy for StreamId
impl Eq for StreamId
impl StructuralEq for StreamId
impl StructuralPartialEq for StreamId
Auto Trait Implementations§
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.