pub trait Module {
type InputMessage;
type OutputMessage;
type ModulePrivateInterface: ModulePrivateInterface<Self::InputMessage, Self::OutputMessage>;
// Provided method
fn prepare_interfaces(
cap: usize,
) -> (ModuleInterface<Self::InputMessage, Self::OutputMessage>, Self::ModulePrivateInterface) { ... }
}
Expand description
Define an agent module. Each module can receive message as inputs and send via its outputs. All the messages are broadcasted. Each module has a single thread used for handling the messages. If longer computation are needed, they can spawn other modules.
Required Associated Types§
Sourcetype InputMessage
type InputMessage
Type of the input message for this module
Sourcetype OutputMessage
type OutputMessage
Type of the output message for this module
Sourcetype ModulePrivateInterface: ModulePrivateInterface<Self::InputMessage, Self::OutputMessage>
type ModulePrivateInterface: ModulePrivateInterface<Self::InputMessage, Self::OutputMessage>
Type of the private interface
Provided Methods§
Sourcefn prepare_interfaces(
cap: usize,
) -> (ModuleInterface<Self::InputMessage, Self::OutputMessage>, Self::ModulePrivateInterface)
fn prepare_interfaces( cap: usize, ) -> (ModuleInterface<Self::InputMessage, Self::OutputMessage>, Self::ModulePrivateInterface)
This function is called ahead
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.