diff options
Diffstat (limited to 'src/node.rs')
-rw-r--r-- | src/node.rs | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/src/node.rs b/src/node.rs index b6a088b..58515a8 100644 --- a/src/node.rs +++ b/src/node.rs @@ -4,36 +4,10 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. // -use std::fmt::Debug; +use crate::NodeId; -use crate::id::Id; - -use futures::future::Future; -use futures::stream::Stream; - -/// A "Node" is an object of the (DA)Graph -/// -/// In git-speak, this would be an "Object". -/// -/// -/// # Equality -/// -/// A node might be compared to another node. In git, for example, equality would be the equality -/// of the nodes ids, because objects are non-mutable. -/// -pub trait Node: Debug + PartialEq + Eq { - type Id: Id; - type NodePayload: Debug; - type Error: Debug; - type Payload: Future<Item = Self::NodePayload, Error = Self::Error>; - - /// It should be trivial to get the Id of a Node. - fn id(&self) -> Self::Id; - - /// Fetch the payload of the node. - fn payload(&self) -> Self::Payload; - - /// Fetch the Ids of the parents of this node - fn parent_ids(&self) -> Stream<Item = Self::Id, Error = Self::Error>; +/// A Node in the DAG, holding the data. +pub trait Node { + type Id: NodeId; + fn parent_ids(&self) -> Vec<Self::Id>; } - |