OutgoingMessage

Trait 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<(), Error>, Rc<Builder<HeapAllocator>>);
    fn take(self: Box<Self>) -> Builder<HeapAllocator>;
    fn size_in_words(&self) -> usize;
}
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<(), Error>, Rc<Builder<HeapAllocator>>)

Sends the message. Returns a promise 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.

Source

fn size_in_words(&self) -> usize

Gets the total size of the message, for flow control purposes. Although the caller could also call get_body().target_size(0, doing that would walk th emessage tree, whereas typical implementations can compute the size more cheaply by summing segment sizes.

Implementors§