ninja-files-data 0.1.0

Core data structures for ninja files
Documentation
use std::borrow::Cow;

mod as_ref;
//mod try_from;

#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Variable(Cow<'static, str>);

#[derive(Clone, Debug)]
pub struct InvalidVariable(pub Cow<'static, str>);

impl Variable {
    pub fn try_create<Var>(variable: Var) -> Result<Self, InvalidVariable>
    where
        Var: AsRef<str>,
    {
        Ok(Variable(Cow::Owned(variable.as_ref().into())))
    }
}