cl-structures: add to_ref associated function on Interned type, for non-borrowing conversion

This commit is contained in:
John 2025-01-16 21:01:28 -06:00
parent 883fd31d38
commit e5a51ba6c2

View File

@ -35,6 +35,11 @@ pub mod interned {
pub fn as_ptr(interned: &Self) -> *const T { pub fn as_ptr(interned: &Self) -> *const T {
interned.value interned.value
} }
/// Gets the internal value as a reference with the interner's lifetime
pub fn to_ref(interned: &Self) -> &'a T {
interned.value
}
} }
impl<T: ?Sized + Debug> Debug for Interned<'_, T> { impl<T: ?Sized + Debug> Debug for Interned<'_, T> {