]> git.mikk.net Git - mtbl-rs/commitdiff
source.rs: Remove unneeded GenSource trait
authorchris mikkelson <chris@mikk.net>
Mon, 29 Jul 2024 18:45:20 +0000 (13:45 -0500)
committerchris mikkelson <chris@mikk.net>
Mon, 29 Jul 2024 18:45:20 +0000 (13:45 -0500)
Rename GenWrap to BoxWrap for clarity.

src/source.rs

index 4e25abc573474163932fce5485a1946cd584ccc5..6699f8e59e260bda6b4241dd9b946d1816aab3b5 100644 (file)
@@ -119,19 +119,14 @@ impl<I: Iter> Iter for RangeIter<I> {
     }
 }
 
-trait GenSource<'a>:
-    Source<It = BoxedIter<'a>, Get = BoxedIter<'a>, Prefix = BoxedIter<'a>, Range = BoxedIter<'a>> + 'a
-{
-}
-
-struct GenWrap<'a, S: Source + 'a>(S, PhantomData<&'a S>);
-impl<'a, S: Source + 'a> IterSource for GenWrap<'a, S> {
+struct BoxWrap<'a, S: Source + 'a>(S, PhantomData<&'a S>);
+impl<'a, S: Source + 'a> IterSource for BoxWrap<'a, S> {
     type It = BoxedIter<'a>;
     fn iter(&self) -> Self::It {
         Box::new(self.0.iter())
     }
 }
-impl<'a, S: Source + 'a> Source for GenWrap<'a, S> {
+impl<'a, S: Source + 'a> Source for BoxWrap<'a, S> {
     type Get = BoxedIter<'a>;
     fn get(&self, key: &[u8]) -> Self::Get {
         Box::new(self.0.get(key))
@@ -145,12 +140,20 @@ impl<'a, S: Source + 'a> Source for GenWrap<'a, S> {
         Box::new(self.0.get_range(start, end))
     }
 }
-impl<'a, S: Source + 'a> GenSource<'a> for GenWrap<'a, S> {}
 
-pub struct BoxedSource<'a>(Box<dyn GenSource<'a>>);
+pub struct BoxedSource<'a>(
+    Box<
+        dyn Source<
+                It = BoxedIter<'a>,
+                Get = BoxedIter<'a>,
+                Prefix = BoxedIter<'a>,
+                Range = BoxedIter<'a>,
+            > + 'a,
+    >,
+);
 impl<'a> BoxedSource<'a> {
     fn from<S: Source + 'a>(source: S) -> Self {
-        Self(Box::new(GenWrap(source, PhantomData)))
+        Self(Box::new(BoxWrap(source, PhantomData)))
     }
 }
 impl<'a> IterSource for BoxedSource<'a> {