Fix doc tests; Add from impls for Identifier
This commit is contained in:
parent
9f2b0461df
commit
c466096c8d
@ -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)
|
||||||
|
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user