add some utility From<Interned<T>> impls

This commit is contained in:
Jacob Lifshay 2024-10-07 19:05:20 -07:00
parent aec383c0af
commit eed0afc6ab
Signed by: programmerjake
SSH key fingerprint: SHA256:B1iRVvUJkvd7upMIiMqn6OyxvD2SgJkAH3ZnUOj6z+c

View file

@ -764,6 +764,24 @@ where
} }
} }
impl<T: 'static + Clone + Send + Sync, C: InternContext> From<Interned<[T], C>> for Vec<T> {
fn from(value: Interned<[T], C>) -> Self {
Vec::from(&*value.guard())
}
}
impl<T: 'static + Clone + Send + Sync, C: InternContext> From<Interned<[T], C>> for Box<[T]> {
fn from(value: Interned<[T], C>) -> Self {
Box::from(&*value.guard())
}
}
impl<C: InternContext> From<Interned<str, C>> for String {
fn from(value: Interned<str, C>) -> Self {
String::from(&*value.guard())
}
}
impl<I, C: InternContext<AllContextsAreIdentical = ConstBool<true>> + Default> Default impl<I, C: InternContext<AllContextsAreIdentical = ConstBool<true>> + Default> Default
for Interned<[I], C> for Interned<[I], C>
where where