pub trait ProtocolState<R: RoleT>: Sized + SendData {
type WireMsg: for<'de> Decode<'de, ()> + Encode<()> + Send;
type Action: Debug + Send;
type Out: Debug + PartialEq + Send;
type Error: Debug + Display + PartialEq + Send;
// Required methods
fn init(
&self,
) -> Result<(Outcome<Self::WireMsg, Self::Out, Self::Error>, Self)>;
fn network(
&self,
input: Self::WireMsg,
) -> Result<(Outcome<Self::WireMsg, Self::Out, Self::Error>, Self)>;
fn local(
&self,
input: Self::Action,
) -> Result<(Outcome<Self::WireMsg, Void, Self::Error>, Self)>;
}Expand description
This tracks only the network protocol state, reacting to local decisions
(Action) or incoming network messages (WireMsg). It may emit information
via the Out type.
Required Associated Types§
type WireMsg: for<'de> Decode<'de, ()> + Encode<()> + Send
type Action: Debug + Send
type Out: Debug + PartialEq + Send
type Error: Debug + Display + PartialEq + Send
Required Methods§
fn init(&self) -> Result<(Outcome<Self::WireMsg, Self::Out, Self::Error>, Self)>
fn network( &self, input: Self::WireMsg, ) -> Result<(Outcome<Self::WireMsg, Self::Out, Self::Error>, Self)>
fn local( &self, input: Self::Action, ) -> Result<(Outcome<Self::WireMsg, Void, Self::Error>, Self)>
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.