From e5a51ba6c2eb3b753cc2c841c1e6c8a5aecdbd05 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 16 Jan 2025 21:01:28 -0600 Subject: [PATCH] cl-structures: add `to_ref` associated function on `Interned` type, for non-borrowing conversion --- compiler/cl-structures/src/intern.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/cl-structures/src/intern.rs b/compiler/cl-structures/src/intern.rs index 5c04d8b..1858e3e 100644 --- a/compiler/cl-structures/src/intern.rs +++ b/compiler/cl-structures/src/intern.rs @@ -35,6 +35,11 @@ pub mod interned { pub fn as_ptr(interned: &Self) -> *const T { 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 Debug for Interned<'_, T> {