api: namespace: return popped component
helpful for places where namespaces need to be (re)created Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
7a404dc53d
commit
bc06c7b4e9
|
@ -575,10 +575,12 @@ impl BackupNamespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Pop one level off the namespace hierachy
|
/// Pop one level off the namespace hierachy
|
||||||
pub fn pop(&mut self) {
|
pub fn pop(&mut self) -> Option<String> {
|
||||||
if let Some(dropped) = self.inner.pop() {
|
let dropped = self.inner.pop();
|
||||||
|
if let Some(ref dropped) = dropped {
|
||||||
self.len = self.len.saturating_sub(dropped.len() + 1);
|
self.len = self.len.saturating_sub(dropped.len() + 1);
|
||||||
}
|
}
|
||||||
|
dropped
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the namespace parent as owned BackupNamespace
|
/// Get the namespace parent as owned BackupNamespace
|
||||||
|
|
Loading…
Reference in New Issue