Trait openraft::raft::RaftTypeConfig
source · pub trait RaftTypeConfig: Sized + Send + Sync + Debug + Clone + Copy + Default + Eq + PartialEq + Ord + PartialOrd + 'static {
type D: AppData;
type R: AppDataResponse;
type NodeId: NodeId;
type Node: Node;
}
Expand description
Configuration of types used by the Raft
core engine.
The (empty) implementation structure defines request/response types, node ID type and the like. Refer to the documentation of associated types for more information.
Note
Since Rust cannot automatically infer traits for various inner types using this config
type as a parameter, this trait simply uses all the traits required for various types
as its supertraits as a workaround. To ease the declaration, the macro
declare_raft_types
is provided, which can be used to declare the type easily.
Example:
ⓘ
openraft::declare_raft_types!(
/// Declare the type configuration for `MemStore`.
pub Config: D = ClientRequest, R = ClientResponse, NodeId = MemNodeId
);
Required Associated Types§
sourcetype R: AppDataResponse
type R: AppDataResponse
Application-specific response data returned by the state machine.