ninja_files_data2/variable/mod.rs
1use std::borrow::Cow;
2
3mod as_ref;
4//mod try_from;
5
6#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
7pub struct Variable(Cow<'static, str>);
8
9#[derive(Clone, Debug)]
10pub struct InvalidVariable(pub Cow<'static, str>);
11
12impl Variable {
13 pub fn try_create<Var>(variable: Var) -> Result<Self, InvalidVariable>
14 where
15 Var: AsRef<str>,
16 {
17 Ok(Variable(Cow::Owned(variable.as_ref().into())))
18 }
19}