Struct Rpc
pub struct Rpc<I, R>(/* private fields */);Expand description
An RPC message for a request with input of type I and output of type R.
The receiver of the message should process the request and return results
via the Sender<R>.
Implementations§
§impl<I, R> Rpc<I, R>where
    R: 'static + Send,
 
impl<I, R> Rpc<I, R>where
    R: 'static + Send,
pub fn detached(input: I) -> Rpc<I, R>
pub fn detached(input: I) -> Rpc<I, R>
Returns a new RPC message with input and no one listening for the
result.
pub fn split(self) -> (I, Rpc<(), R>)
pub fn split(self) -> (I, Rpc<(), R>)
Splits the RPC into its input and an input-less RPC. This is useful when the input is needed in one place but the RPC will be completed in another.
pub fn handle_sync<F>(self, f: F)where
    F: FnOnce(I) -> R,
pub fn handle_sync<F>(self, f: F)where
    F: FnOnce(I) -> R,
Handles an RPC request by calling f and sending the result to the
initiator.
pub async fn handle<F>(self, f: F)where
    F: AsyncFnOnce(I) -> R,
pub async fn handle<F>(self, f: F)where
    F: AsyncFnOnce(I) -> R,
Handles an RPC request by calling f, awaiting its result, and sending
the result to the initiator.
pub async fn handle_must_succeed<F, E>(self, f: F) -> Result<(), E>where
    F: AsyncFnOnce(I) -> Result<R, E>,
pub async fn handle_must_succeed<F, E>(self, f: F) -> Result<(), E>where
    F: AsyncFnOnce(I) -> Result<R, E>,
Handles an RPC request by calling f, awaiting its result, and sending
Ok results back to the initiator.
If f fails, the error is propagated back to the caller, and the RPC
channel is dropped (resulting in a RecvError::Closed on the
initiator).
pub fn complete(self, result: R)
pub fn complete(self, result: R)
Completes the RPC with the specified result value.
§impl<I, R> Rpc<I, Result<R, RemoteError>>where
    R: 'static + Send,
 
impl<I, R> Rpc<I, Result<R, RemoteError>>where
    R: 'static + Send,
pub fn handle_failable_sync<F, E>(self, f: F)
pub fn handle_failable_sync<F, E>(self, f: F)
Handles an RPC request by calling f and sending the result to the
initiator, after converting any error to a RemoteError.
pub async fn handle_failable<F, E>(self, f: F)
pub async fn handle_failable<F, E>(self, f: F)
Handles an RPC request by calling f, awaiting its result, and sending
the result to the initiator, after converting any error to a
RemoteError.
Trait Implementations§
§impl<I, R> DefaultEncoding for Rpc<I, R>
 
impl<I, R> DefaultEncoding for Rpc<I, R>
§type Encoding = TableEncoder
 
type Encoding = TableEncoder
§impl<'encoding, I, R> StructDecodeMetadata<'encoding, Resource> for Rpc<I, R>
 
impl<'encoding, I, R> StructDecodeMetadata<'encoding, Resource> for Rpc<I, R>
§const DECODERS: &'static [ErasedDecoderEntry]
 
const DECODERS: &'static [ErasedDecoderEntry]
§impl<I, R> StructEncodeMetadata<Resource> for Rpc<I, R>
 
impl<I, R> StructEncodeMetadata<Resource> for Rpc<I, R>
§const ENCODERS: &'static [ErasedEncoderEntry]
 
const ENCODERS: &'static [ErasedEncoderEntry]
Auto Trait Implementations§
impl<I, R> Freeze for Rpc<I, R>where
    I: Freeze,
impl<I, R> !RefUnwindSafe for Rpc<I, R>
impl<I, R> Send for Rpc<I, R>
impl<I, R> Sync for Rpc<I, R>
impl<I, R> Unpin for Rpc<I, R>where
    I: Unpin,
impl<I, R> !UnwindSafe for Rpc<I, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
 
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
§impl<T> SerializeMessage for Twhere
    T: 'static + MeshPayload + Send,
 
impl<T> SerializeMessage for Twhere
    T: 'static + MeshPayload + Send,
§fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
 
fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
MessageEncode::compute_message_size.§fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
 
fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
MessageEncode::write_message.