Skip to main content

Message

Enum Message 

Source
pub enum Message {
    Describe {
        version: DataVersion,
        reply_limit: u64,
    },
    Described(Versioned),
    Call(Call),
    Reply(Reply),
    Cancel {
        run: RunId,
        call: CallRef,
    },
    NoAnswer {
        run: RunId,
        call: CallRef,
        reason: String,
    },
    Ack {
        run: RunId,
        call: CallRef,
        result: Ack,
    },
    Hold {
        run: RunId,
        call: CallRef,
        retry_at: Option<Instant>,
    },
    Log(Log),
    Type {
        run: RunId,
        call: CallRef,
    },
    Typed {
        run: RunId,
        call: CallRef,
        answer: Result<ResultType, Untyped>,
    },
}
Expand description

One message of the protocol, on either route: what one frame’s body holds. Its number is the frame’s kind.

Variants§

§

Describe

describe, host or client to its peer: its data version and the largest encoded answer, in bytes, it admits; a client sends 0.

Fields

§version: DataVersion

The sender’s data version.

§reply_limit: u64

The largest encoded answer it admits, in bytes.

§

Described(Versioned)

The answer to describe, implementation to host: its data version and, in that version, each declaration it serves (served).

§

Call(Call)

call, host to implementation.

§

Reply(Reply)

reply, implementation or client to host.

§

Cancel

cancel, host to implementation: a request to stop work on a call, which proves nothing.

Fields

§run: RunId

The host’s run id.

§call: CallRef

The call’s history id.

§

NoAnswer

no_answer, implementation to host: it has no answer to a call. The call stays open, and the run stops.

Fields

§run: RunId

The host’s run id, as the call carried it.

§call: CallRef

The call’s history id, as the call carried it.

§reason: String

Why, as the implementation wrote it.

§

Ack

ack, host to implementation or client: what became of a reply.

Fields

§run: RunId

The host’s run id, as the reply carried it.

§call: CallRef

The call’s history id, as the reply carried it.

§result: Ack

Whether the answer was recorded.

§

Hold

hold, implementation to host: not an answer, but the promise to answer the call later. With retry_at, the host asks again then.

Fields

§run: RunId

The host’s run id, as the call carried it.

§call: CallRef

The call’s history id, as the call carried it.

§retry_at: Option<Instant>

When to ask again; None waits for a reply.

§

Log(Log)

log, implementation to host: one line for a run’s log.

§

Type

type, client to host: which type a reply to a call is encoded at.

Fields

§run: RunId

The run’s id.

§call: CallRef

The call’s history id.

§

Typed

The answer to type, host to client.

Fields

§run: RunId

The run’s id, as the type carried it.

§call: CallRef

The call’s history id, as the type carried it.

§answer: Result<ResultType, Untyped>

The call’s result type, or why the host has none to give.

Implementations§

Source§

impl Message

Source

pub fn kind(&self) -> Kind

Which constructor it is.

Source§

impl Message

Source

pub fn described(tools: Vec<(Identity, TypeSpec)>) -> Message

The answer to describe serving tools, in this build’s data version.

Source

pub fn body(&self) -> Vec<u8> ⓘ

The frame’s body: the message.

Source

pub fn frame(&self) -> Vec<u8> ⓘ

The whole frame: the body’s length, then the body.

Source

pub fn parse(route: Route, body: &[u8]) -> Result<Message, Malformed>

The message body holds on route, refusing any other bytes: a kind the route does not carry, a field that does not read, and bytes left over. A reply or a hold whose run and call read is malformed for its call (Malformed::Reply).

§Errors

Malformed, saying which of those it met.

Source

pub fn reply_head(head: &[u8]) -> Option<(RunId, CallRef)>

The run and call of a frame whose first bytes are head, when it begins as a reply or a hold that names them: what a frame too large to keep still says.

Source

pub fn head(head: &[u8], kinds: &[Kind]) -> Option<(RunId, CallRef)>

The run and call of a frame whose first bytes are head, when its kind is one of kinds and both ids read whole and are ids.

Trait Implementations§

Source§

impl Clone for Message

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Message

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Declared for Message

Source§

const SHAPE: Shape

Its declaration, the only one.
Source§

fn shape() -> &'static Shape

Its shape.
Source§

impl Eq for Message

Source§

impl Keyed for Message

Source§

fn payload<'a>(&'a self, parts: &mut Vec<&'a dyn AnyWire>)

Pushes its payload’s parts to parts, in the order they are written, without its constructor’s number.
Source§

fn open_payload(number: u64, at: usize) -> Result<Opened, DecodeError>

Opens the payload of the constructor written with number, the number read at byte at. Read more
Source§

fn payload_bytes(&self) -> Vec<u8> ⓘ

Its payload’s bytes.
Source§

fn decode_payload(number: u64, bytes: &[u8]) -> Result<Self, DecodeError>

The one value of the constructor written with number whose payload bytes hold, and nothing else. Read more
Source§

impl PartialEq for Message

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Shaped for Message

Source§

const FORM: WireForm

How a value of it is written.
Source§

fn write_at( &self, catalog: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>

Writes it as a value of ty, the Flow type its form projects to in out’s catalog. Read more
Source§

fn read_at( catalog: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Self, DecodeError>

Reads one, a value of ty in input’s catalog. Read more
Source§

impl StructuralPartialEq for Message

Source§

impl Wire for Message

Source§

fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)

Appends the bytes it writes before its parts to out, and pushes its parts to parts in the order they are written after them.
Source§

fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>

Reads its head at reader: the value itself when it has no parts, else its parts to read and what joins them. Read more
Source§

fn write(&self, out: &mut Vec<u8>)

Appends its bytes to out: its head, and then each part’s bytes in order, written over a stack on the heap, so a value nested however deep is written on a native stack of fixed size.
Source§

fn read(reader: &mut Reader<'_>) -> Result<Self, DecodeError>

Reads one from reader, leaving the reader just past it. Read more
Source§

fn bytes(&self) -> Vec<u8> ⓘ

Its bytes.
Source§

fn decode(bytes: &[u8]) -> Result<Self, DecodeError>

The one value bytes hold, and nothing else. Read more

Auto Trait Implementations§

§

impl !Freeze for Message

§

impl Forget for Message

§

impl Move for Message

§

impl RefUnwindSafe for Message

§

impl Send for Message
where RawVecInner: Send, NonZero<u64>: Send, BoxRaw<Term>: Send, Arc<RecordShape>: Send, BoxRaw<Type>: Send, Arc<EnumShape>: Send, Mutex<HashMap<(Type, Settings), Option<String>>>: Send, RawTable<(Box<str>, usize)>: Send, BoxRaw<[usize]>: Send, BoxRaw<[Option<OptionCtor>]>: Send, BoxRaw<[Option<JsonValueCtor>]>: Send, Arc<[u8]>: Send,

§

impl Sync for Message
where RawVecInner: Sync, NonZero<u64>: Sync, BoxRaw<Term>: Sync, Arc<RecordShape>: Sync, BoxRaw<Type>: Sync, Arc<EnumShape>: Sync, Mutex<HashMap<(Type, Settings), Option<String>>>: Sync, RawTable<(Box<str>, usize)>: Sync, BoxRaw<[usize]>: Sync, BoxRaw<[Option<OptionCtor>]>: Sync, BoxRaw<[Option<JsonValueCtor>]>: Sync, Arc<[u8]>: Sync,

§

impl Unpin for Message

§

impl UnsafeUnpin for Message

§

impl UnwindSafe for Message

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AnyWire for T
where T: Wire,

Source§

fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Part for T
where T: Shaped,

Source§

fn write_part( &self, out: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>

Writes it as a value of ty, as Shaped::write_at does. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.