1. item order in LogEntry. 2. Implement From<> instead of Into<>.
@@ -49,8 +49,8 @@ pub type Index = usize;
#[derive(Clone, Debug, Serialize, Deserialize)]
struct LogEntry<Command> {
- term: Term,
index: Index,
+ term: Term,
command: Command,
}
@@ -48,9 +48,9 @@ impl<Command: DeserializeOwned> TryFrom<Bytes> for PersistedRaftState<Command> {
-impl<Command: Serialize> Into<Bytes> for PersistedRaftState<Command> {
- fn into(self) -> Bytes {
- bincode::serialize(&self)
+impl<Command: Serialize> From<PersistedRaftState<Command>> for Bytes {
+ fn from(value: PersistedRaftState<Command>) -> Bytes {
+ bincode::serialize(&value)
.expect("Serialization should not fail")
.into()