Skip to content

Commit

Permalink
docs: Document absence of “capacity” from lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-ferdinand committed Jan 23, 2025
1 parent 55fc928 commit bb4245c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tasm-lib/src/list.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//! List operations, mimicking [`Vec`] in some ways (but not in others).
//!
//! Lists may only contain elements whose type has
//! [static size](BFieldCodec::static_length).
//!
//! Like [`Vec`], a list can be [created][self::new::New],
//! [pushed to][self::push::Push], [popped from][self::pop::Pop],
//! [written to][self::set::Set], and asked for its
//! [length][self::length::Length], among other operations.
//!
//! Unlike [`Vec`], lists do not track their capacity. Instead, list created at
//! Triton VM's runtime get access to an entire [memory page][crate::memory].
//! Lists spawned in Triton VM's memory through
//! [non-determinism][crate::triton_vm::prelude::NonDeterminism] might have
//! access to smaller memory regions. As with all non-determinism, handling them
//! requires additional care.
/// The number of VM words required to store the metadata / bookkeeping data of a list.
pub const LIST_METADATA_SIZE: usize = 1;

Expand Down

0 comments on commit bb4245c

Please sign in to comment.