pub struct DisplayValue<'a, const N: usize> { /* private fields */ }Expand description
A wrapper that enables core::fmt::Display for Lisp values.
Because formatting a value requires access to the arena (to follow
cons-cell chains, read strings, etc.), this wrapper carries both the
value index and a reference to the Lisp context.
§Example
use grift_core::{Lisp, DisplayValue};
let lisp = Lisp::<1000>::new();
let nil = lisp.nil().unwrap();
let dv = DisplayValue::new(nil, &lisp);
// In a no_std context, use core::fmt::Write:
// write!(some_writer, "{}", dv).ok();Implementations§
Source§impl<'a, const N: usize> DisplayValue<'a, N>
impl<'a, const N: usize> DisplayValue<'a, N>
Sourcepub fn new(value: ArenaIndex, lisp: &'a Lisp<N>) -> DisplayValue<'a, N>
pub fn new(value: ArenaIndex, lisp: &'a Lisp<N>) -> DisplayValue<'a, N>
Create a new DisplayValue wrapper.
Trait Implementations§
Auto Trait Implementations§
impl<'a, const N: usize> Freeze for DisplayValue<'a, N>
impl<'a, const N: usize> !RefUnwindSafe for DisplayValue<'a, N>
impl<'a, const N: usize> !Send for DisplayValue<'a, N>
impl<'a, const N: usize> !Sync for DisplayValue<'a, N>
impl<'a, const N: usize> Unpin for DisplayValue<'a, N>
impl<'a, const N: usize> !UnwindSafe for DisplayValue<'a, N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more