Trait capnp::capability::FromClientHook
source · pub trait FromClientHook {
fn new(hook: Box<dyn ClientHook>) -> Self;
fn into_client_hook(self) -> Box<dyn ClientHook>;
fn as_client_hook(&self) -> &dyn ClientHook;
fn cast_to<T: FromClientHook + Sized>(self) -> T
where
Self: Sized,
{ ... }
}
Expand description
Trait implemented (via codegen) by all user-defined capability client types.
Required Methods§
sourcefn new(hook: Box<dyn ClientHook>) -> Self
fn new(hook: Box<dyn ClientHook>) -> Self
Wraps a client hook to create a new client.
sourcefn into_client_hook(self) -> Box<dyn ClientHook>
fn into_client_hook(self) -> Box<dyn ClientHook>
Unwraps client to get the underlying client hook.
sourcefn as_client_hook(&self) -> &dyn ClientHook
fn as_client_hook(&self) -> &dyn ClientHook
Gets a reference to the underlying client hook.
Provided Methods§
sourcefn cast_to<T: FromClientHook + Sized>(self) -> Twhere
Self: Sized,
fn cast_to<T: FromClientHook + Sized>(self) -> Twhere
Self: Sized,
Casts self
to another instance of FromClientHook
. This always succeeds,
but if the underlying capability does not actually implement T
’s interface,
then method calls will fail with “unimplemented” errors.