aboutsummaryrefslogtreecommitdiff
path: root/src/namespace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/namespace.rs')
-rw-r--r--src/namespace.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/namespace.rs b/src/namespace.rs
index 216a982..02f3b3d 100644
--- a/src/namespace.rs
+++ b/src/namespace.rs
@@ -1,5 +1,6 @@
//! Contains namespace manipulation types and functions.
+use std::borrow::Cow;
use std::collections::btree_map::Iter as Entries;
use std::collections::btree_map::{BTreeMap, Entry};
use std::collections::HashSet;
@@ -165,6 +166,12 @@ impl Namespace {
pub fn get<'a, P: ?Sized + AsRef<str>>(&'a self, prefix: &P) -> Option<&'a str> {
self.0.get(prefix.as_ref()).map(|s| &**s)
}
+
+ /// Borrowed namespace for the writer
+ #[must_use]
+ pub fn borrow(&self) -> Cow<'_, Self> {
+ Cow::Borrowed(self)
+ }
}
/// An alias for iterator type for namespace mappings contained in a namespace.