Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "map-api"
description = "Raft state machine"
version = "0.2.2"
version = "0.2.3"
authors = ["Databend Authors <opensource@datafuselabs.com>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
20 changes: 13 additions & 7 deletions src/match_seq/match_seq_ext_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,21 @@ impl<M, T> MatchSeqExt<SeqV<M, T>> for MatchSeq {
}
}

impl<M, T> MatchSeqExt<Option<&SeqV<M, T>>> for MatchSeq {
fn match_seq(&self, sv: &Option<&SeqV<M, T>>) -> Result<(), ConflictSeq> {
let seq = sv.map_or(0, |sv| sv.seq);
self.match_seq(&seq)
impl<T> MatchSeqExt<&T> for MatchSeq
where MatchSeq: MatchSeqExt<T>
{
fn match_seq(&self, sv: &&T) -> Result<(), ConflictSeq> {
self.match_seq(*sv)
}
}

impl<M, T> MatchSeqExt<Option<SeqV<M, T>>> for MatchSeq {
fn match_seq(&self, sv: &Option<SeqV<M, T>>) -> Result<(), ConflictSeq> {
self.match_seq(&sv.as_ref())
impl<T> MatchSeqExt<Option<T>> for MatchSeq
where MatchSeq: MatchSeqExt<T>
{
fn match_seq(&self, sv: &Option<T>) -> Result<(), ConflictSeq> {
match sv {
Some(sv) => self.match_seq(sv),
None => MatchSeqExt::<u64>::match_seq(self, &0u64),
}
}
}
Loading