Skip to main content

Caller

Trait Caller 

Source
pub trait Caller:
    Clone
    + MaybeSend
    + MaybeSync
    + 'static {
    // Required method
    fn call<'a>(
        &'a self,
        call: RequestCall<'a>,
    ) -> impl Future<Output = Result<SelfRef<RequestResponse<'static>>, RoamError>> + MaybeSend + 'a;

    // Provided method
    fn channel_binder(&self) -> Option<&dyn ChannelBinder> { ... }
}
Expand description

Type-erased handler for incoming service calls.

Implemented (by the macro-generated dispatch code) for server-side types. Takes a fully decoded RequestCall — already parsed from the wire — and a ReplySink through which the response is sent.

The dispatch impl decodes the args, routes by crate::MethodId, and invokes the appropriate typed Call-based method on the concrete server type. A cloneable handle to a connection, handed out by the session driver.

Generated clients hold an ErasedCaller and use it to send calls. The caller serializes the outgoing RequestCall (with borrowed args), registers a pending response slot, and awaits the response from the peer.

Required Methods§

Source

fn call<'a>( &'a self, call: RequestCall<'a>, ) -> impl Future<Output = Result<SelfRef<RequestResponse<'static>>, RoamError>> + MaybeSend + 'a

Send a call and wait for the response.

Provided Methods§

Source

fn channel_binder(&self) -> Option<&dyn ChannelBinder>

Return a channel binder for binding Tx/Rx handles in args before sending.

Returns None by default. The driver’s Caller implementation overrides this to provide actual channel binding.

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.

Implementors§