From 586c9f468d762f86c06ee0aa82fbc3fef36a64c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Thu, 5 May 2022 13:47:26 +0200 Subject: [PATCH] api: namespace: return popped component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit helpful for places where namespaces need to be (re)created Signed-off-by: Fabian Grünbichler Signed-off-by: Thomas Lamprecht --- pbs-api-types/src/datastore.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs index 33216bcf..a6d6f625 100644 --- a/pbs-api-types/src/datastore.rs +++ b/pbs-api-types/src/datastore.rs @@ -575,10 +575,12 @@ impl BackupNamespace { } /// Pop one level off the namespace hierachy - pub fn pop(&mut self) { - if let Some(dropped) = self.inner.pop() { + pub fn pop(&mut self) -> Option { + let dropped = self.inner.pop(); + if let Some(ref dropped) = dropped { self.len = self.len.saturating_sub(dropped.len() + 1); } + dropped } /// Get the namespace parent as owned BackupNamespace