1
0

Fix doc tests; Add from impls for Identifier

This commit is contained in:
Jeff 2024-02-16 10:58:37 -05:00
parent 9f2b0461df
commit c466096c8d
2 changed files with 15 additions and 3 deletions

View File

@ -86,6 +86,18 @@ impl Format for Identifier {
} }
} }
impl From<String> 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 { impl Display for Identifier {
fn fmt(&self, f: &mut Formatter) -> fmt::Result { fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{}", self.0) write!(f, "{}", self.0)

View File

@ -12,7 +12,7 @@
//! let context = Context::new(); //! let context = Context::new();
//! //!
//! context.set_value( //! context.set_value(
//! "foobar".to_string(), //! "foobar".into(),
//! Value::String("FOOBAR".to_string()) //! Value::String("FOOBAR".to_string())
//! ).unwrap(); //! ).unwrap();
//! //!
@ -84,8 +84,8 @@ impl Context {
/// let second_context = Context::new(); /// let second_context = Context::new();
/// ///
/// second_context.set_value( /// second_context.set_value(
/// "Foo".to_string(), /// "Foo".into(),
/// Value::String("Bar".to_string()) /// Value::String("Bar".to_string())
/// ); /// );
/// ///
/// first_context.inherit_from(&second_context).unwrap(); /// first_context.inherit_from(&second_context).unwrap();