rustical_xml/
namespace.rs

1use quick_xml::name::Namespace;
2
3#[derive(Debug, Clone, Default, PartialEq)]
4pub struct NamespaceOwned(pub Vec<u8>);
5
6impl<'a> From<Namespace<'a>> for NamespaceOwned {
7    fn from(value: Namespace<'a>) -> Self {
8        Self(value.0.to_vec())
9    }
10}
11
12impl From<String> for NamespaceOwned {
13    fn from(value: String) -> Self {
14        Self(value.into_bytes())
15    }
16}
17
18impl From<&str> for NamespaceOwned {
19    fn from(value: &str) -> Self {
20        Self(value.as_bytes().to_vec())
21    }
22}
23
24impl<'a> From<&'a Namespace<'a>> for NamespaceOwned {
25    fn from(value: &'a Namespace<'a>) -> Self {
26        Self(value.0.to_vec())
27    }
28}
29
30impl NamespaceOwned {
31    pub fn as_ref(&self) -> Namespace {
32        Namespace(&self.0)
33    }
34}