pub struct StreamRegistry { /* private fields */ }Expand description
Per-connection registry of in-flight output streams. Keyed by
stream_id — the wire-spec multiplex tag — so a StreamCancel
can target one stream without disturbing the rest of the
connection (AC #3).
Implementations§
Source§impl StreamRegistry
impl StreamRegistry
pub fn new() -> StreamRegistry
Sourcepub async fn register(
&self,
stream_id: u16,
) -> Result<Receiver<()>, RegisterError>
pub async fn register( &self, stream_id: u16, ) -> Result<Receiver<()>, RegisterError>
Register a new stream. Returns the receiver half the worker
task selects on for cancellation, or Err(InUse) if the
stream_id is already active on this connection.
Sourcepub async fn cancel(&self, stream_id: u16) -> bool
pub async fn cancel(&self, stream_id: u16) -> bool
Signal the named stream to cancel. Returns false if the
stream_id is unknown — caller should emit StreamError
with unknown_stream.
Sourcepub async fn unregister(&self, stream_id: u16)
pub async fn unregister(&self, stream_id: u16)
Remove the stream from the registry once the worker task has finished (normally or via cancel). Idempotent.
pub async fn active_count(&self) -> usize
Trait Implementations§
Source§impl Default for StreamRegistry
impl Default for StreamRegistry
Source§fn default() -> StreamRegistry
fn default() -> StreamRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for StreamRegistry
impl !RefUnwindSafe for StreamRegistry
impl Send for StreamRegistry
impl Sync for StreamRegistry
impl Unpin for StreamRegistry
impl UnsafeUnpin for StreamRegistry
impl !UnwindSafe for StreamRegistry
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request