From 69bd12bc78b1dbf60c911016c1a475ab2de4fa16 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 5 Apr 2021 12:00:46 +0200 Subject: Add AsycnDag::head() to get current HEAD id Signed-off-by: Matthias Beyer --- src/async_dag.rs | 4 ++++ 1 file changed, 4 insertions(+) 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 AsyncDag .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 { self.stream() -- cgit v1.2.3