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<NonZero<u16>> for StreamId
impl From<NonZero<u16>> 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 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
§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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