diff --git a/src/abstract_tree/identifier.rs b/src/abstract_tree/identifier.rs index 900960b..ac091a2 100644 --- a/src/abstract_tree/identifier.rs +++ b/src/abstract_tree/identifier.rs @@ -86,6 +86,18 @@ impl Format for Identifier { } } +impl From for Identifier { + fn from(value: String) -> Self { + Identifier::from_raw_parts(Arc::new(value)) + } +} + +impl From<&str> for Identifier { + fn from(value: &str) -> Self { + Identifier::new(value) + } +} + impl Display for Identifier { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "{}", self.0) diff --git a/src/context.rs b/src/context.rs index 8741f7b..67d0d9f 100644 --- a/src/context.rs +++ b/src/context.rs @@ -12,7 +12,7 @@ //! let context = Context::new(); //! //! context.set_value( -//! "foobar".to_string(), +//! "foobar".into(), //! Value::String("FOOBAR".to_string()) //! ).unwrap(); //! @@ -84,8 +84,8 @@ impl Context { /// let second_context = Context::new(); /// /// second_context.set_value( - /// "Foo".to_string(), - /// Value::String("Bar".to_string()) + /// "Foo".into(), + /// Value::String("Bar".to_string()) /// ); /// /// first_context.inherit_from(&second_context).unwrap();