Trait capnp::capability::FromClientHook

source ·
pub trait FromClientHook {
    // Required methods
    fn new(hook: Box<dyn ClientHook>) -> Self;
    fn into_client_hook(self) -> Box<dyn ClientHook>;
    fn as_client_hook(&self) -> &dyn ClientHook;

    // Provided method
    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§


fn new(hook: Box<dyn ClientHook>) -> Self

Wraps a client hook to create a new client.


fn into_client_hook(self) -> Box<dyn ClientHook>

Unwraps client to get the underlying client hook.


fn as_client_hook(&self) -> &dyn ClientHook

Gets a reference to the underlying client hook.

Provided Methods§


fn cast_to<T: FromClientHook + Sized>(self) -> T
where 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.

Object Safety§

This trait is not object safe.