pub struct TupleView<'id> { /* private fields */ }Expand description
A Tuple whose elements have been resolved, produced by
Tuple::with_elements.
It is still a tuple Term (it carries the original term word, so it
encodes and compares like one), and additionally behaves as a fixed-size
collection of its elements: len/is_empty,
tuple[i] indexing, and iteration, all yielding AnyTerm<'id> — the
unresolved element terms. enif_get_tuple returns a pointer into the boxed
tuple’s own heap storage (it hands back tuple_val(t)+1, confirmed in the
ERTS source); the process heap holds that at a fixed address for the
duration of a NIF call (no GC mid-NIF), so the cached slice is valid for
this view’s brand 'id and the type stays Copy.
Implementations§
Trait Implementations§
impl<'id> Copy for TupleView<'id>
Source§impl<'id> Encoder<'id> for TupleView<'id>
Encodes for free by rewrapping the term’s own machine word — an otter
term is already an Erlang term. Never fails.
impl<'id> Encoder<'id> for TupleView<'id>
Encodes for free by rewrapping the term’s own machine word — an otter term is already an Erlang term. Never fails.
Source§impl<'id> IntoIterator for TupleView<'id>
impl<'id> IntoIterator for TupleView<'id>
Source§impl<'id> Term<'id> for TupleView<'id>
impl<'id> Term<'id> for TupleView<'id>
Source§fn copy_to<'dst>(self, env: impl Env<'dst>) -> AnyTerm<'dst>where
Self: Sized,
fn copy_to<'dst>(self, env: impl Env<'dst>) -> AnyTerm<'dst>where
Self: Sized,
enif_make_copy), producing a
term branded to the destination. The general cross-env copy — distinct
from same-brand Encoder (which wraps for free)
and from OwnedEnvArena copy_out (the arena exit).