Trait capnp_rpc::OutgoingMessage

source ·
pub trait OutgoingMessage {
    // Required methods
    fn get_body(&mut self) -> Result<Builder<'_>>;
    fn get_body_as_reader(&self) -> Result<Reader<'_>>;
    fn send(
        self: Box<Self>
    ) -> (Promise<Rc<Builder<HeapAllocator>>, Error>, Rc<Builder<HeapAllocator>>);
    fn take(self: Box<Self>) -> Builder<HeapAllocator>;
}
Expand description

A message to be sent by a VatNetwork.

Required Methods§

source

fn get_body(&mut self) -> Result<Builder<'_>>

Gets the message body, which the caller may fill in any way it wants.

The standard RPC implementation initializes it as a Message as defined in schema/rpc.capnp.

source

fn get_body_as_reader(&self) -> Result<Reader<'_>>

Same as get_body(), but returns the corresponding reader type.

source

fn send( self: Box<Self> ) -> (Promise<Rc<Builder<HeapAllocator>>, Error>, Rc<Builder<HeapAllocator>>)

Sends the message. Returns a promise for the message that resolves once the send has completed. Dropping the returned promise does not cancel the send.

source

fn take(self: Box<Self>) -> Builder<HeapAllocator>

Takes the inner message out of self.

Implementors§