pub enum View<'a> {
Int(i64),
Real(f64),
Date(i64),
Var(&'a str),
Atom(&'a str),
Str(&'a str),
Bin(&'a [u8]),
Func(&'a Arena, &'a Term, &'a [Term]),
List(&'a Arena, &'a [Term], &'a Term),
Tuple(&'a Arena, &'a [Term]),
}Expand description
A borrowed view into the interned contents of a Term.
Use Term::view to obtain a view. Each variant of View
represents the decoded form of a term and borrows any data
referenced from the Arena or the term handle itself. No
allocations are performed when constructing a View; instead
references into the underlying storage are returned directly. The
lifetime 'a binds the returned references to both the borrowed
Term and the supplied Arena.
Variants§
Int(i64)
An integer value.
Real(f64)
A floating point value.
Date(i64)
A date value (milliseconds since the Unix epoch).
Var(&'a str)
A variable name borrowed from the term or arena.
Atom(&'a str)
An atom name borrowed from the term or arena.
Str(&'a str)
A UTF‑8 string borrowed from the term or arena.
Bin(&'a [u8])
A binary slice borrowed from the term or arena.
Func(&'a Arena, &'a Term, &'a [Term])
A compound term view containing the functor name and a slice
of arguments. Both the functor and the argument slice are
borrowed; the arguments themselves are Term handles owned
by the arena.
List(&'a Arena, &'a [Term], &'a Term)
A list view containing a slice of the list elements
and a reference to the tail term. The element slice and the tail are
borrowed; the elements themselves are Term handles owned by the arena.
The tail of a proper list will always reference Term::NIL.
Tuple(&'a Arena, &'a [Term])
A tuple view containing a slice of the tuple elements.
The element slice are borrowed; the elements
themselves are Term handles owned by the arena.
Trait Implementations§
Source§impl Ord for View<'_>
impl Ord for View<'_>
Source§impl PartialOrd for View<'_>
impl PartialOrd for View<'_>
impl<'a> Copy for View<'a>
impl<'a> Eq for View<'a>
Auto Trait Implementations§
impl<'a> Freeze for View<'a>
impl<'a> RefUnwindSafe for View<'a>
impl<'a> Send for View<'a>
impl<'a> Sync for View<'a>
impl<'a> Unpin for View<'a>
impl<'a> UnwindSafe for View<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.