pub enum Term {
Show 19 variants
Int,
Decimal,
Bool,
Text,
Bytes,
Duration,
Instant,
Unit,
Never,
JsonValue,
List(Box<Term>),
Set(Box<Term>),
Option(Box<Term>),
Task(Box<Term>),
Dict(Box<Term>, Box<Term>),
Tuple(Vec<Term>),
Function {
params: Vec<Term>,
result: Box<Term>,
},
Named {
declaration: Int,
args: Vec<Term>,
},
Param {
owner: Owner,
index: Int,
},
}Expand description
A type term: a type with no name of its own, a declaration by its place in the description with its arguments, or a type parameter.
Variants§
Int
Int.
Decimal
Decimal.
Bool
Bool.
Text
Text.
Bytes
Bytes.
Duration
Duration.
Instant
Instant.
Unit
Unit.
Never
Never.
JsonValue
json.Value.
List(Box<Term>)
List of this.
Set(Box<Term>)
Set of this.
Option(Box<Term>)
Option of this.
Task(Box<Term>)
task.Task of this.
Dict(Box<Term>, Box<Term>)
Dict of these keys and values.
Tuple(Vec<Term>)
A tuple of these parts, two or more.
Function
A function.
Named
A declaration.
Param
A type parameter.
Trait Implementations§
impl Eq for Term
Source§impl Hash for Term
Hashes each node’s kind, declaration and parameter in pre-order: equal
terms hash alike.
impl Hash for Term
Hashes each node’s kind, declaration and parameter in pre-order: equal terms hash alike.
Source§impl Keyed for Term
impl Keyed for Term
Source§fn payload<'a>(&'a self, parts: &mut Vec<&'a dyn AnyWire>)
fn payload<'a>(&'a self, parts: &mut Vec<&'a dyn AnyWire>)
parts, in the order they are
written, without its constructor’s number.Source§fn open_payload(number: u64, at: usize) -> Result<Opened, DecodeError>
fn open_payload(number: u64, at: usize) -> Result<Opened, DecodeError>
Source§fn payload_bytes(&self) -> Vec<u8> ⓘ
fn payload_bytes(&self) -> Vec<u8> ⓘ
Source§fn decode_payload(number: u64, bytes: &[u8]) -> Result<Self, DecodeError>
fn decode_payload(number: u64, bytes: &[u8]) -> Result<Self, DecodeError>
number whose
payload bytes hold, and nothing else. Read moreSource§impl Nested for Term
A term nests as deeply as its bytes do, so it is a Nested tree, which
clones, compares, hashes and drops on a native stack of bounded size.
impl Nested for Term
A term nests as deeply as its bytes do, so it is a Nested tree, which
clones, compares, hashes and drops on a native stack of bounded size.
Source§fn parts(&self) -> impl DoubleEndedIterator<Item = &Term>
fn parts(&self) -> impl DoubleEndedIterator<Item = &Term>
An item, a key and a value, a tuple’s parts, a declared type’s arguments, or a function’s parameters and then its result.
Source§const LEAF: Term = Term::Int
const LEAF: Term = Term::Int
Source§fn parts_mut(&mut self) -> impl Iterator<Item = &mut Term>
fn parts_mut(&mut self) -> impl Iterator<Item = &mut Term>
self holds, in Nested::parts order, for moving
out: none of those it shares with another tree.Source§fn same_tree(
&self,
other: &Self,
same_node: impl FnMut(&Self, &Self) -> bool,
) -> bool
fn same_tree( &self, other: &Self, same_node: impl FnMut(&Self, &Self) -> bool, ) -> bool
self and other are alike node by node, by same_node,
which says whether two nodes are alike on their own, with as many
parts: with each node’s count of parts, pre-order spells the tree.Source§fn free_parts(&mut self)
fn free_parts(&mut self)
self holds that has parts of its own, leaving
Nested::LEAF in its place: what dropping self does first, so a
tree nested however deep drops on a native stack of fixed size.Source§impl PartialEq for Term
Two terms are equal when their nodes, read in pre-order, are alike one
by one.
impl PartialEq for Term
Two terms are equal when their nodes, read in pre-order, are alike one by one.
Source§impl Shaped for Term
impl Shaped for Term
Source§fn write_at(
&self,
catalog: &mut ValueWriter<'_, '_>,
ty: &Type,
) -> Result<(), EncodeError>
fn write_at( &self, catalog: &mut ValueWriter<'_, '_>, ty: &Type, ) -> Result<(), EncodeError>
Source§fn read_at(
catalog: &mut ValueReader<'_, '_, '_>,
ty: &Type,
) -> Result<Self, DecodeError>
fn read_at( catalog: &mut ValueReader<'_, '_, '_>, ty: &Type, ) -> Result<Self, DecodeError>
Source§impl Wire for Term
impl Wire for Term
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
out, and pushes
its parts to parts in the order they are written after them.Source§fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
fn open(reader: &mut Reader<'_>) -> Result<Opened, DecodeError>
reader: the value itself when it has no parts,
else its parts to read and what joins them. Read moreSource§fn write(&self, out: &mut Vec<u8>)
fn write(&self, out: &mut Vec<u8>)
out: its head, and then each part’s bytes in
order, written over a stack on the heap, so a value nested however
deep is written on a native stack of fixed size.Auto Trait Implementations§
impl Forget for Term
impl Freeze for Term
impl Move for Term
impl RefUnwindSafe for Term
impl Send for Term
impl Sync for Term
impl Unpin for Term
impl UnsafeUnpin for Termwhere
*const Term is !null: UnsafeUnpin,
PhantomData<Term>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u64>: UnsafeUnpin,
impl UnwindSafe for Term
Blanket Implementations§
Source§impl<T> AnyWire for Twhere
T: Wire,
impl<T> AnyWire for Twhere
T: Wire,
Source§fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
fn write_head<'a>(&'a self, out: &mut Vec<u8>, parts: &mut Vec<&'a dyn AnyWire>)
Wire::write_head.