use crate::shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
use crate::str::CssStringWriter;
use crate::{Namespace, Prefix};
use cssparser::SourceLocation;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
#[derive(Clone, Debug, PartialEq, ToShmem)]
#[allow(missing_docs)]
pub struct NamespaceRule {
pub prefix: Option<Prefix>,
pub url: Namespace,
pub source_location: SourceLocation,
}
impl ToCssWithGuard for NamespaceRule {
fn to_css(
&self,
_guard: &SharedRwLockReadGuard,
dest_str: &mut CssStringWriter,
) -> fmt::Result {
let mut dest = CssWriter::new(dest_str);
dest.write_str("@namespace ")?;
if let Some(ref prefix) = self.prefix {
prefix.to_css(&mut dest)?;
dest.write_char(' ')?;
}
dest.write_str("url(")?;
self.url.to_string().to_css(&mut dest)?;
dest.write_str(");")
}
}