pub trait ReusableMessageRecipe<Parent, Route, I, Context>: Sizedwhere
Context: ?Sized,{
// Required method
fn prepare(
parent: &mut Parent,
instruction: &I,
context: &Context,
) -> Result<Self, Report>;
}Expand description
Reusable message construction over machines with specified capabilities.
Upstream message authors implement this trait generically over Parent,
requiring capabilities such as crate::Field or operand-stack access
instead of depending on a particular composite type. Route identifies the
destination device, I supplies instruction data, and Context supplies
shared read-only runtime data. Context may be unsized.
A recipe does not provide a BuildMessage implementation. Composite
authors choose whether to call Self::prepare on the message type from the
body of their own BuildMessage::build_message implementation, or construct
the message using machine-specific logic instead.
Available with the experimental typed-declarations feature. “Reusable”
describes the intended use; implementations may also name a concrete parent.
Required Methods§
Sourcefn prepare(
parent: &mut Parent,
instruction: &I,
context: &Context,
) -> Result<Self, Report>
fn prepare( parent: &mut Parent, instruction: &I, context: &Context, ) -> Result<Self, Report>
Construct the message from the parent’s capabilities and runtime inputs.
§Errors
Returns construction or validation failures. Mutations made before an error, including successful operand pops, are retained.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".