We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b7236ba commit d77cca2Copy full SHA for d77cca2
1 file changed
libsql-wal/src/swap_strategy/mod.rs
@@ -12,6 +12,14 @@ pub(crate) trait SwapStrategy: Sync + Send + 'static {
12
And(self, other)
13
}
14
15
+ fn or<O: SwapStrategy>(self, other: O) -> Or<Self, O>
16
+ where
17
+ Self: Sized,
18
+ {
19
+ Or(self, other)
20
+ }
21
+}
22
+
23
pub struct And<A, B>(A, B);
24
25
impl<A, B> SwapStrategy for And<A, B>
@@ -31,4 +39,21 @@ where
31
39
32
40
33
41
42
+pub struct Or<A, B>(A, B);
43
44
+impl<A, B> SwapStrategy for Or<A, B>
45
+where
46
+ A: SwapStrategy,
47
+ B: SwapStrategy,
48
+{
49
+ #[inline(always)]
50
+ fn should_swap(&self, frames_in_wal: usize) -> bool {
51
+ self.0.should_swap(frames_in_wal) || self.1.should_swap(frames_in_wal)
52
53
54
55
+ fn swapped(&self) {
56
+ self.0.swapped();
57
+ self.1.swapped();
58
34
59
0 commit comments