pub trait Message<L>: Sized {
// Required methods
fn upcast(label: L) -> Self;
fn downcast(self) -> Result<L, Self>;
}Expand description
This trait represents a message to be exchanged between two participants. The generic type L is the type of the label (i.e. the content of the message).
Required Methods§
Sourcefn downcast(self) -> Result<L, Self>
fn downcast(self) -> Result<L, Self>
Tries to get the label contained in the Message. This might fail,
typically if we are trying to get a label of the wrong type. In case of
failure, the result contains self, hence the message is not lost.
§Errors
Returns Err(self) if the message does not contain a label of type L.
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.