pub struct TermDisplay<'a> {
pub term: &'a Term,
pub arena: &'a Arena,
}Expand description
A wrapper that pairs a Term with the Arena it was interned in.
This type implements fmt::Display, allowing you to use
standard formatting macros (format!, println!, etc.) on terms
without manually passing the arena each time.
Typically you don’t construct this struct directly, but instead
call Term::display or [Arena::display], which create it for you.
Fields§
§term: &'a TermThe interned term to display.
arena: &'a ArenaThe arena where the term is stored.
Trait Implementations§
Source§impl<'a> Display for TermDisplay<'a>
Because a Term alone does not carry enough information to render
a human-readable representation, it must be paired with the Arena
it was interned into. The TermDisplay adapter provides this
pairing and implements fmt::Display for convenient printing.
impl<'a> Display for TermDisplay<'a>
Because a Term alone does not carry enough information to render
a human-readable representation, it must be paired with the Arena
it was interned into. The TermDisplay adapter provides this
pairing and implements fmt::Display for convenient printing.
§Example
use arena_terms::{Term, Arena, func, IntoTerm};
let mut arena = Arena::new();
let term = func!("foo"; 1, "hello, world!" => &mut arena);
println!("{}", term.display(&arena));Auto Trait Implementations§
impl<'a> Freeze for TermDisplay<'a>
impl<'a> RefUnwindSafe for TermDisplay<'a>
impl<'a> Send for TermDisplay<'a>
impl<'a> Sync for TermDisplay<'a>
impl<'a> Unpin for TermDisplay<'a>
impl<'a> UnwindSafe for TermDisplay<'a>
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