Skip to main content

CancelKeyMap

Struct CancelKeyMap 

Source
pub struct CancelKeyMap { /* private fields */ }
Expand description

Client-facing cancellation keys mapped to their current upstream keys.

Implementations§

Source§

impl CancelKeyMap

Source

pub fn new() -> Self

Creates an empty in-memory cancellation-key registry.

Source

pub fn register( &mut self, client: CancelKey, upstream: CancelKey, ) -> Result<(), RegisterError>

Registers one proxy-minted client key for an attached upstream session.

§Errors

Rejects keys outside the protocol’s 4–256 byte range and client-key collisions. Existing mappings are never silently replaced.

Source

pub fn resolve(&self, process_id: u32, secret_key: &[u8]) -> Option<&CancelKey>

Resolves an inspected client CancelRequest to its upstream key.

Source

pub fn remove(&mut self, client: &CancelKey) -> Option<CancelKey>

Detaches a client key when its upstream session is released or replaced.

Source

pub fn len(&self) -> usize

Returns the number of live client-to-upstream mappings.

Source

pub fn is_empty(&self) -> bool

Returns whether the registry contains no mappings.

Trait Implementations§

Source§

impl CancelKeyRegistry for CancelKeyMap

Source§

type Error = RegisterError

Error returned when a key association cannot be registered.
Source§

fn register_cancel_key( &mut self, client: CancelKey, upstream: CancelKey, ) -> Result<(), Self::Error>

Observes the association between a client-facing and upstream key. Read more
Source§

fn resolve_cancel_key(&self, client: &CancelKey) -> Option<CancelKey>

Resolves an incoming client cancellation request without borrowing the registry, so the result can safely cross an asynchronous boundary.
Source§

fn remove_cancel_key(&mut self, client: &CancelKey) -> Option<CancelKey>

Removes an association when either side of a session is detached.
Source§

impl Debug for CancelKeyMap

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CancelKeyMap

Source§

fn default() -> CancelKeyMap

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.