#[non_exhaustive]
pub struct OckamMessage { pub data: Vec<u8>, pub scope: Vec<Vec<u8>>, pub generic: Option<Metadata>, }
Expand description

A message metadata wrapper type

This message wraps around a well-typed Message type, with additional metadata. Metadata is split between the “scope” and “generic” sections.

Scope metadata

This metadata is passed around in a particular metadata scope. For example, a worker that adds some behaviour to message sending may chose to embed “scope” metadata. When wrapping this message in another scope the previously scoped metadata becomes part of the opaque data section.

Thus it is not possible to retrieve metadata from a different nested scope!

Generic metadata

When creating an OckamMessage it’s also possible to attach generic metadata. This data is passed around for every nested scope and must be re-attached to the outest-most scope when peeling a nested message stack.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
data: Vec<u8>

Main data section of this message

scope: Vec<Vec<u8>>

Metadata for this specific scope

generic: Option<Metadata>

Metadata that is carried to the final recipient of the message

Implementations

Create a new OckamMessage with the data from msg.

Create a new OckamMessage from an untyped Any message

Create a new OckamMessage by nesting a previous one

Wrap this OckamMessage with a new Routed message type

Add some metadata to this scope

Add to the generic metadata section

Dissolve this outer layer of Message and reveal nested message

Will throw a deserialisation error if the inner data is NOT an OckamMessage!

Decode the data section of this OckamMessage

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Try cloning a object and return an Err in case of failure.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Decode a slice.

Encode the type into an Encoded type.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more