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.
Implementations§
source§impl<S, C> CapabilityServerSet<S, C>where
C: FromServer<S>,
impl<S, C> CapabilityServerSet<S, C>where
C: FromServer<S>,
pub fn new() -> Self
sourcepub fn new_client(&mut self, s: S) -> C
pub fn new_client(&mut self, s: S) -> C
Adds a new capability to the set and returns a client backed by it.
sourcepub async fn get_local_server(
&self,
client: &C
) -> Option<&Rc<RefCell<C::Dispatch>>>where
C: FromClientHook,
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.
sourcepub fn get_local_server_of_resolved(
&self,
client: &C
) -> Option<&Rc<RefCell<C::Dispatch>>>where
C: FromClientHook,
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
).