api types: namespace: add from_parent_ns helper
will be used in the (recursive) namespace iterator Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c2425132c4
commit
02ec2ae9b8
|
@ -553,6 +553,16 @@ impl BackupNamespace {
|
||||||
Ok(this)
|
Ok(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Create a new Namespace attached to parent
|
||||||
|
///
|
||||||
|
/// `name` must be a single level namespace ID, that is, no '/' is allowed.
|
||||||
|
/// This rule also avoids confusion about the name being a NS or NS-path
|
||||||
|
pub fn from_parent_ns(parent: &Self, name: String) -> Result<Self, Error> {
|
||||||
|
let mut child = parent.to_owned();
|
||||||
|
child.push(name)?;
|
||||||
|
Ok(child)
|
||||||
|
}
|
||||||
|
|
||||||
/// Create a new namespace directly from a vec.
|
/// Create a new namespace directly from a vec.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
|
|
Loading…
Reference in New Issue