aboutsummaryrefslogtreecommitdiffstats
path: root/log_db/src/common.rs
diff options
context:
space:
mode:
Diffstat (limited to 'log_db/src/common.rs')
-rw-r--r--log_db/src/common.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/log_db/src/common.rs b/log_db/src/common.rs
index 1841175..48c85ea 100644
--- a/log_db/src/common.rs
+++ b/log_db/src/common.rs
@@ -5,6 +5,7 @@ use std::collections::HashSet;
use std::fmt::Display;
use std::fs::{self, metadata, File};
use std::io::{self, Read, Seek, SeekFrom, Write};
+use std::ops::{Bound, RangeBounds};
use std::path::{Path, PathBuf};
use std::thread;
use thiserror::Error;
@@ -768,3 +769,24 @@ pub fn request_exclusive_lock(data_dir: &Path, file: &mut fs::File) -> Result<()
Ok(())
}
+
+pub struct OwnedBounds<T> {
+ start: Bound<T>,
+ end: Bound<T>,
+}
+
+impl<T> OwnedBounds<T> {
+ pub fn new(start: Bound<T>, end: Bound<T>) -> Self {
+ OwnedBounds { start, end }
+ }
+}
+
+impl<T> RangeBounds<T> for OwnedBounds<T> {
+ fn start_bound(&self) -> Bound<&T> {
+ self.start.as_ref()
+ }
+
+ fn end_bound(&self) -> Bound<&T> {
+ self.end.as_ref()
+ }
+}