seed 0.9.2

A Rust framework for creating web apps, using WebAssembly
Documentation
/// Common Namespaces
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum Namespace {
    Html,
    Svg,
    MathMl,
    Xul,
    Xbl,
    Custom(String),
}

// https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS
impl Namespace {
    pub fn as_str(&self) -> &str {
        match self {
            Namespace::Html => "http://www.w3.org/1999/xhtml",
            Namespace::Svg => "http://www.w3.org/2000/svg",
            Namespace::MathMl => "http://www.w3.org/1998/mathml",
            Namespace::Xul => "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
            Namespace::Xbl => "http://www.mozilla.org/xbl",
            Namespace::Custom(namespace) => namespace,
        }
    }
}

impl From<String> for Namespace {
    fn from(namespace: String) -> Self {
        match namespace.as_ref() {
            "http://www.w3.org/1999/xhtml" => Namespace::Html,
            "http://www.w3.org/2000/svg" => Namespace::Svg,
            "http://www.w3.org/1998/mathml" => Namespace::MathMl,
            "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" => Namespace::Xul,
            "http://www.mozilla.org/xbl" => Namespace::Xbl,
            _ => Namespace::Custom(namespace),
        }
    }
}