pub trait Metadata {
type Init: Types;
type Handle: Types;
type Reply: Type;
type Others: Types;
type Signal: Type;
type State: Types;
// Provided method
fn repr() -> MetadataRepr { ... }
}
Expand description
Trait used for defining metadata.
Required Associated Types§
sourcetype Init: Types
type Init: Types
Init message type.
Describes incoming/outgoing types for the init()
function. Incoming
message can be read by calling
msg::load
function. Outgoing message is a reply to the incoming message and
can be sent by calling the
msg::reply
function.
- Use unit tuple
()
if neither incoming nor outgoing messages are expected in theinit()
function. - Use
In
type alias if only incoming message is expected in theinit()
function. - Use
Out
type alias if only outgoing message is expected in theinit()
function. - Use
InOut
type alias if both incoming and outgoing messages are expected in theinit()
function.
§Note
If an outgoing message has been sent using the
msg::send
function,
then it is supposed to be parsed by the another type metadata.
See Others
type for more details.
sourcetype Handle: Types
type Handle: Types
Handle message type.
Describes incoming/outgoing types for the handle()
function.
This type is similar to the Init
type, but it is used
for the handle()
function.
sourcetype Others: Types
type Others: Types
Message types for miscellaneous purposes.
Here we can define types used in some specific functions. For example,
the outgoing message type in Others
is used as a ordinary message
sent by the program using the
msg::send
function.
Provided Methods§
sourcefn repr() -> MetadataRepr
fn repr() -> MetadataRepr
Create metadata representation and register types in registry.