From eed0afc6ab2f656794eaf3fbfa2978abed21e0b7 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 7 Oct 2024 19:05:20 -0700 Subject: [PATCH] add some utility From> impls --- crates/fayalite/src/intern.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/fayalite/src/intern.rs b/crates/fayalite/src/intern.rs index 81d8434..9bd4d56 100644 --- a/crates/fayalite/src/intern.rs +++ b/crates/fayalite/src/intern.rs @@ -764,6 +764,24 @@ where } } +impl From> for Vec { + fn from(value: Interned<[T], C>) -> Self { + Vec::from(&*value.guard()) + } +} + +impl From> for Box<[T]> { + fn from(value: Interned<[T], C>) -> Self { + Box::from(&*value.guard()) + } +} + +impl From> for String { + fn from(value: Interned) -> Self { + String::from(&*value.guard()) + } +} + impl> + Default> Default for Interned<[I], C> where