summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-06-25 19:20:27 +0200
committerMatthias Beyer <mail@beyermatthias.de>2019-06-25 20:46:47 +0200
commitc022e64aff9e7c9374c9a95b08d5dfcf59ce06ef (patch)
treef0d01ff9e217084e2e9742caed2ba98b6639a0fb
parent2d25173aeafe9357f7cbd5c1edf6225d9ccf1114 (diff)
WIP: Add RepositoryExt trait
-rw-r--r--src/lib.rs1
-rw-r--r--src/repository_ext.rs46
2 files changed, 47 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bda0996..f900dd0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -7,3 +7,4 @@
pub mod id;
pub mod node;
pub mod repository;
+pub mod repository_ext;
diff --git a/src/repository_ext.rs b/src/repository_ext.rs
new file mode 100644
index 0000000..f45256a
--- /dev/null
+++ b/src/repository_ext.rs
@@ -0,0 +1,46 @@
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+//
+
+use std::fmt::Debug;
+
+use crate::node;
+use crate::id;
+use crate::repository::Repository;
+
+use futures::future::Future;
+use futures::stream::Stream;
+use futures::stream;
+
+///
+pub trait RepositoryExt : Repository {
+ fn log(&self, head: Self::Id) -> Box<Stream<Item = Self::Node, Error = Self::Error>>;
+}
+
+impl<R
+ , Error
+ , Id
+ , Node
+ >
+ RepositoryExt for R
+ where
+ Error: Debug,
+ Id: id::Id,
+ Node: node::Node<Id = Id, Error = Error>,
+
+ R: Repository<
+ Id = Id,
+ Node = Node,
+ Error = Error,
+ >,
+{
+ fn log(&self, head: Self::Id) -> Box<Stream<Item = Self::Node, Error = Self::Error>> {
+ unimplemented!()
+
+ // not so easy.
+ }
+}
+
+