lewp_css/domain/at_rules/namespace/
namespace_prefix.rs1use {
5 crate::domain::Atom,
6 cssparser::ToCss,
7 std::fmt::{self, Display, Formatter},
8};
9
10#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
11pub struct NamespacePrefix(pub Atom);
12
13impl ToCss for NamespacePrefix {
14 fn to_css<W: fmt::Write>(&self, dest: &mut W) -> fmt::Result {
16 self.0.to_css(dest)
17 }
18}
19
20impl Default for NamespacePrefix {
21 #[inline(always)]
22 fn default() -> Self {
23 NamespacePrefix(Atom::default())
24 }
25}
26
27impl Display for NamespacePrefix {
28 #[inline(always)]
29 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
30 self.0.fmt(f)
31 }
32}
33
34impl From<String> for NamespacePrefix {
35 #[inline(always)]
36 fn from(value: String) -> Self {
37 NamespacePrefix(Atom::from(value))
38 }
39}
40
41impl<'a> From<&'a str> for NamespacePrefix {
42 #[inline(always)]
43 fn from(value: &'a str) -> Self {
44 NamespacePrefix(Atom::from(value))
45 }
46}