#[repr(transparent)]pub struct Frozen<T: ?Sized>(_);
Expand description
Erases interior mutability by preventing reference forming.
Implementations§
source§impl<T: Copy> Frozen<T>
impl<T: Copy> Frozen<T>
sourcepub const fn leak_slice<'out>(x: &[T]) -> &'out [Frozen<T>]where
T: 'out,
pub const fn leak_slice<'out>(x: &[T]) -> &'out [Frozen<T>]where T: 'out,
Copy the referenced [T]
to the CTFE heap. The resulting reference can
be safely consumed at runtime.
Example
use r3_core::utils::Frozen;
const SLICE: &[Frozen<u8>] = Frozen::leak_slice(&[1, 2, 3]);
assert_eq!(SLICE[1].get(), 2);