less type bounds

This commit is contained in:
Alex 2020-11-20 23:23:55 +01:00
parent 68be5072e5
commit 4f7f1d1cb3

View file

@ -27,7 +27,7 @@ pub struct LWW<T> {
impl<T> LWW<T> impl<T> LWW<T>
where where
T: Serialize + for<'de> Deserialize<'de> + Clone + core::fmt::Debug + PartialEq + CRDT, T: CRDT,
{ {
pub fn new(value: T) -> Self { pub fn new(value: T) -> Self {
Self { Self {
@ -52,7 +52,7 @@ where
impl<T> CRDT for LWW<T> impl<T> CRDT for LWW<T>
where where
T: Serialize + for<'de> Deserialize<'de> + Clone + core::fmt::Debug + PartialEq + CRDT, T: Clone + CRDT,
{ {
fn merge(&mut self, other: &Self) { fn merge(&mut self, other: &Self) {
if other.ts > self.ts { if other.ts > self.ts {
@ -96,8 +96,8 @@ pub struct LWWMap<K, V> {
impl<K, V> LWWMap<K, V> impl<K, V> LWWMap<K, V>
where where
K: Serialize + for<'de> Deserialize<'de> + Clone + core::fmt::Debug + PartialEq + Ord, K: Ord,
V: Serialize + for<'de> Deserialize<'de> + Clone + core::fmt::Debug + PartialEq + CRDT, V: CRDT,
{ {
pub fn new() -> Self { pub fn new() -> Self {
Self { vals: vec![] } Self { vals: vec![] }
@ -138,8 +138,8 @@ where
impl<K, V> CRDT for LWWMap<K, V> impl<K, V> CRDT for LWWMap<K, V>
where where
K: Serialize + for<'de> Deserialize<'de> + Clone + core::fmt::Debug + Ord, K: Clone + Ord,
V: Serialize + for<'de> Deserialize<'de> + Clone + core::fmt::Debug + CRDT, V: Clone + CRDT,
{ {
fn merge(&mut self, other: &Self) { fn merge(&mut self, other: &Self) {
for (k, ts2, v2) in other.vals.iter() { for (k, ts2, v2) in other.vals.iter() {