Trait gmeta::Metadata

source ·
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§

source

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 the init() function.
  • Use In type alias if only incoming message is expected in the init() function.
  • Use Out type alias if only outgoing message is expected in the init() function.
  • Use InOut type alias if both incoming and outgoing messages are expected in the init() 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.

source

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.

source

type Reply: Type

Reply message type.

Describes incoming type for the handle_reply() function.

source

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.

source

type Signal: Type

Signal message type.

Describes only the outgoing type from the program while processing the system signal.

source

type State: Types

State type.

Describes the type for the queried state returned by the state() function.

Use the type that you pass to the msg::reply function in the state() function or unit tuple () if no state() function is defined.

Provided Methods§

source

fn repr() -> MetadataRepr

Create metadata representation and register types in registry.

Object Safety§

This trait is not object safe.

Implementors§