use core::cell::Cell; /// Provides a view only reference to a [Cell]. /// Useful alternative to `&Cell` when an API wants to control where a [Cell]s value can be set. #[derive(Copy, Clone)] pub struct CellView<'a, T: Copy>(&'a Cell); impl CellView<'_, T> { #[inline(always)] pub fn get(self) -> T { self.0.get() } } impl<'a, T: Copy> From<&'a Cell> for CellView<'a, T> { #[inline(always)] fn from(value: &'a Cell) -> Self { CellView(value) } }