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 {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "{}", self.0)

View File

@ -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();