pub trait ValuePayload:
Sync
+ Send
+ Ord
+ Display
+ Debug
+ Default
+ Clone
+ Serialize
+ DeserializeOwned { }Expand description
A trait for consensus value payloads.
This trait defines the requirements for consensus value types used in the consensus engine. Your consensus value type must implement all the required traits to be compatible with the consensus engine.
§Required Traits
Sync + Send: Thread-safe and sendable across threadsOrd + Display + Debug + Default + Clone: Standard Rust traitsSerialize + DeserializeOwned: Serde serialization support
§Example Implementation
#[derive(Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
struct BlockData(String);
impl std::fmt::Display for BlockData {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}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.