summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-04-05 12:00:46 +0200
committerMatthias Beyer <mail@beyermatthias.de>2021-04-05 12:00:46 +0200
commit69bd12bc78b1dbf60c911016c1a475ab2de4fa16 (patch)
tree344d586727c93e88857edac930368ea28a74887b
parent731549ac1d08df6c956be672353e11c4aac1716f (diff)
Add AsycnDag::head() to get current HEAD id
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r--src/async_dag.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/async_dag.rs b/src/async_dag.rs
index 88a839e..85b1f9e 100644
--- a/src/async_dag.rs
+++ b/src/async_dag.rs
@@ -65,6 +65,10 @@ impl<Id, N, Backend> AsyncDag<Id, N, Backend>
.ok_or_else(|| anyhow!("Node not found"))
}
+ pub fn head(&self) -> &Id {
+ &self.head
+ }
+
/// Check whether an `id` is in the DAG.
pub async fn has_id(&self, id: &Id) -> Result<bool> {
self.stream()