Struct capnp_rpc::CapabilityServerSet

source ·
pub struct CapabilityServerSet<S, C>
where C: FromServer<S>,
{ /* private fields */ }
Expand description

Allows a server to recognize its own capabilities when passed back to it, and obtain the underlying Server objects associated with them. Holds only weak references to Server objects allowing Server objects to be dropped when dropped by the remote client. Call the gc method to reclaim memory used for Server objects that have been dropped.

Implementations§

source§

impl<S, C> CapabilityServerSet<S, C>
where C: FromServer<S>,

source

pub fn new() -> Self

source

pub fn new_client(&mut self, s: S) -> C

Adds a new capability to the set and returns a client backed by it.

source

pub async fn get_local_server( &self, client: &C ) -> Option<Rc<RefCell<C::Dispatch>>>
where C: FromClientHook,

Looks up a capability and returns its underlying server object, if found. Fully resolves the capability before looking it up.

source

pub fn get_local_server_of_resolved( &self, client: &C ) -> Option<Rc<RefCell<C::Dispatch>>>
where C: FromClientHook,

Looks up a capability and returns its underlying server object, if found. Does not attempt to resolve the capability first, so you will usually want to call get_resolved_cap() before calling this. The advantage of this method over get_local_server() is that this one is synchronous and borrows self over a shorter span (which can be very important if self is inside a RefCell).

source

pub fn gc(&mut self)

Reclaim memory used for Server objects that no longer exist.

Trait Implementations§

source§

impl<S, C> Default for CapabilityServerSet<S, C>
where C: FromServer<S>,

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<S, C> Freeze for CapabilityServerSet<S, C>

§

impl<S, C> !RefUnwindSafe for CapabilityServerSet<S, C>

§

impl<S, C> !Send for CapabilityServerSet<S, C>

§

impl<S, C> !Sync for CapabilityServerSet<S, C>

§

impl<S, C> Unpin for CapabilityServerSet<S, C>

§

impl<S, C> !UnwindSafe for CapabilityServerSet<S, C>

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<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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.