tasm_lib/
list.rs

1//! List operations, mimicking [`Vec`] in some ways (but not in others).
2//!
3//! The snippets in this module are only designed for lists that contain
4//! elements whose type has [static size](crate::BFieldCodec::static_length).
5//! The exception from this rule is [`Map`][self::higher_order::map::Map] (and
6//! the more general [`ChainMap`][self::higher_order::map::ChainMap]).
7//!
8//! Like [`Vec`], a list can be [created][self::new::New],
9//! [pushed to][self::push::Push], [popped from][self::pop::Pop],
10//! [written to][self::set::Set], [read from][self::get::Get],
11//! and asked for its [length][self::length::Length], among other operations.
12//!
13//! Unlike [`Vec`], lists do not track their capacity. Instead, list created at
14//! Triton VM's runtime get access to an entire [memory page][crate::memory].
15//! Lists spawned in Triton VM's memory through
16//! [non-determinism][crate::triton_vm::prelude::NonDeterminism] might have
17//! access to smaller memory regions. As with all non-determinism, handling them
18//! requires additional care.
19
20/// The number of VM words required to store the metadata / bookkeeping data of a list.
21pub const LIST_METADATA_SIZE: usize = 1;
22
23pub mod contains;
24pub mod get;
25pub mod higher_order;
26pub mod horner_evaluation_dynamic_length;
27pub mod length;
28pub mod multiset_equality_digests;
29pub mod multiset_equality_u64s;
30pub mod new;
31pub mod pop;
32pub mod push;
33pub mod range;
34pub mod set;
35pub mod set_length;
36pub mod split_off;
37pub mod sum_bfes;
38pub mod sum_xfes;
39pub mod swap_unchecked;