diff --git a/crates/content/src/lib.rs b/crates/content/src/lib.rs index 46598b8..70becbf 100644 --- a/crates/content/src/lib.rs +++ b/crates/content/src/lib.rs @@ -12,6 +12,7 @@ use rhai::ImmutableString; use serde::{Deserialize, Deserializer}; use smartstring::{LazyCompact, SmartString}; use std::{ + borrow::Borrow, collections::HashMap, fmt::Display, fs::File, @@ -130,7 +131,20 @@ pub struct ContentIndex(Arc>); impl From for ContentIndex { fn from(value: ImmutableString) -> Self { - Self::new(&value) + Self(Arc::new(value.into())) + } +} + +impl From for ImmutableString { + fn from(value: ContentIndex) -> Self { + ImmutableString::from(Arc::into_inner(value.0).unwrap()) + } +} + +impl From<&ContentIndex> for ImmutableString { + fn from(value: &ContentIndex) -> Self { + let x: &SmartString = value.0.borrow(); + ImmutableString::from(x.clone()) } }