Skip to main content

Crate zestors_codegen

Crate zestors_codegen 

Source
Expand description

The derive macros of zestors, re-exported in zestors::prelude:

  • Message: a message, fire-and-forget or with a reply.
  • Interface: the set of messages an actor accepts.
  • HandlerInterface: dispatch from an interface to a Handler’s Handle<M> implementations.
  • StableId: a message’s id on the wire, for sending it to other nodes.

§Attributes

All derives read #[msg(...)] and #[zestors(...)]; the two are interchangeable.

KeyUsed byMeaning
reply = TMessageThe message expects a reply of type T. Quote types with generics: reply = "Option<u32>".
id = "<uuid>"StableIdThe message’s id. Required.
no_auto_registerStableIdLeave the type out of ClusterConfig::auto_register.
interface_path = "path"Message, InterfaceWhere to find zestors-interface. Default ::zestors::interface.
actor_path = "path"HandlerInterfaceWhere to find zestors-actor. Default ::zestors::actor.
distr_path = "path"StableIdWhere to find zestors-distr. Default ::zestors::distr.

The path keys are only needed when depending on the zestors-* crates directly instead of on zestors.

Derive Macros§

HandlerInterface
Derives the HandlerInterface trait for an enum, which dispatches each variant to the Handle<M> implementation of a Handler. Use it next to #[derive(Interface)] on the enum that is the handler’s Interface.
Interface
Derives the Interface trait for an enum: the set of messages an actor accepts.
Message
Derives the Message trait.
StableId
Derives the StableId trait, giving the message a stable, globally unique MessageId that identifies it across nodes.