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 = CallResult> + MaybeSend + 'a;

    // Provided methods
    fn closed(&self) -> BoxFut<'_, ()> { ... }
    fn is_connected(&self) -> bool { ... }
    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 — one wire-level request attempt already parsed from the connection — and a ReplySink through which the terminal response for that attempt 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.

Generated clients hold an ErasedCaller and use it to start API-level calls. The caller serializes the outgoing RequestCall (with borrowed args), registers a pending response slot for that request attempt, and awaits the response from the peer.

Required Methods§

Source

fn call<'a>( &'a self, call: RequestCall<'a>, ) -> impl Future<Output = CallResult> + MaybeSend + 'a

Start one outgoing request attempt for an API-level call and wait for its response.

Returns the wire-level response paired with the SchemaRecvTracker that was active when the response was received, for schema-aware deserialization.

Provided Methods§

Source

fn closed(&self) -> BoxFut<'_, ()>

Resolve when the underlying connection closes.

Runtime-backed callers can override this to expose connection liveness. The default implementation never resolves.

Source

fn is_connected(&self) -> bool

Return whether the underlying connection is still considered connected.

Runtime-backed callers can override this to provide eager liveness checks. The default implementation assumes the connection is live.

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§