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§
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.