Skip to main content

DequeData

Struct DequeData 

Source
pub struct DequeData {
    pub items: VecDeque<Arc<HeapValue>>,
}
Expand description

Double-ended queue storage. Heterogeneous element kinds are stored as Arc<HeapValue> payloads (mirror of HashMapData::values per ADR-005 §1 single-discriminator) — the deque is element-kind-agnostic at landing, in line with the W13-hashmap precedent.

ADR-006 §2.7.19 / Q20 amendment (Wave 15 W15-deque, 2026-05-10). Mirror of the §2.7.15 HashSet shape (full HeapValue::Deque arm, NOT pure-discriminator like FilterExpr / SharedCell): receivers flow through slot.as_heap_value() for receiver classification at method dispatch (d.pushBack(...) / d.popFront() / d.size()).

Heterogeneous-element keyspace at landing. Element kinds that can be heap-wrapped (string / int via BigInt(Arc<i64>) / typed arrays / typed objects / hashmaps / etc.) are accepted by the mutation API; bare Float64 / Bool results are rejected (no matching HeapValue::* arm exists post-§2.3). Same coverage shape as HashMapData::values storage (hashmap_methods.rs:: result_slot_to_heap_value_arc).

Per the W15-deque audit: VecDeque<Arc<HeapValue>> chosen over the alternative Vec<u64> + parallel Vec<NativeKind> (per §2.7.7 stack ABI) — Deque is heterogeneous-element, not scalar-only, so the parallel-kind track shape would force every push site to carry both bits and kind through the deque API. The Arc<HeapValue> shape collapses both into a single payload at the element tier and matches the Stage C P1(b) HashMap precedent.

Fields§

§items: VecDeque<Arc<HeapValue>>

Insertion-ordered double-ended queue of heap-allocated element payloads. Element kinds are recovered via the canonical ADR-005 §1 single-discriminator HeapValue match at the read site.

Implementations§

Source§

impl DequeData

Source

pub fn new() -> Self

Build an empty DequeData with no elements.

Source

pub fn from_items(items: Vec<Arc<HeapValue>>) -> Self

Build from a Vec<Arc<HeapValue>>. Insertion order is the front-to-back walk order.

Source

pub fn len(&self) -> usize

Number of elements.

Source

pub fn is_empty(&self) -> bool

Whether the deque is empty.

Source

pub fn peek_front(&self) -> Option<&Arc<HeapValue>>

Borrow the front element without removing it. None when empty.

Source

pub fn peek_back(&self) -> Option<&Arc<HeapValue>>

Borrow the back element without removing it. None when empty.

Source

pub fn get(&self, index: usize) -> Option<&Arc<HeapValue>>

Borrow the element at index (front-counted). None when out of bounds.

Source

pub fn push_back(&mut self, value: Arc<HeapValue>)

Push an element onto the back of the deque.

Source

pub fn push_front(&mut self, value: Arc<HeapValue>)

Push an element onto the front of the deque.

Source

pub fn pop_back(&mut self) -> Option<Arc<HeapValue>>

Remove and return the back element. None when empty.

Source

pub fn pop_front(&mut self) -> Option<Arc<HeapValue>>

Remove and return the front element. None when empty.

Trait Implementations§

Source§

impl Clone for DequeData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DequeData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DequeData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.