pub struct LogosSeq<T>(pub Rc<RefCell<Vec<T>>>);Expand description
Ordered sequence with reference semantics.
LogosSeq<T> wraps Rc<RefCell<Vec<T>>> to provide shared mutable access.
Cloning a LogosSeq produces a shallow copy (shared reference), not a deep copy.
Use .deep_clone() for an independent copy (LOGOS copy of).
Tuple Fields§
§0: Rc<RefCell<Vec<T>>>Implementations§
Source§impl<T> LogosSeq<T>
impl<T> LogosSeq<T>
pub fn new() -> Self
pub fn from_vec(v: Vec<T>) -> Self
pub fn with_capacity(cap: usize) -> Self
pub fn push(&self, value: T)
pub fn pop(&self) -> Option<T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn remove(&self, index: usize) -> T
pub fn borrow(&self) -> Ref<'_, Vec<T>>
pub fn borrow_mut(&self) -> RefMut<'_, Vec<T>>
Source§impl<T: Clone> LogosSeq<T>
impl<T: Clone> LogosSeq<T>
pub fn deep_clone(&self) -> Self
pub fn to_vec(&self) -> Vec<T>
pub fn extend_from_slice(&self, other: &[T])
pub fn iter(&self) -> LogosSeqIter<T> ⓘ
Source§impl<T: Clone> LogosSeq<T>
impl<T: Clone> LogosSeq<T>
Sourcepub fn cow(&mut self)
pub fn cow(&mut self)
Copy-on-write: make this handle uniquely own its buffer before an
in-place mutation, so the mutation cannot leak into a value-semantics
sibling that shares the same allocation. A no-op when already unique
(strong_count == 1), so the common case pays only a count read.
Mirrors the tree-walker’s ensure_collection_owned and the VM’s
ensure_reg_owned.
Source§impl<T: Clone> LogosSeq<LogosSeq<T>>
impl<T: Clone> LogosSeq<LogosSeq<T>>
Sourcepub fn set_nested(&self, k: usize, i: usize, v: T)
pub fn set_nested(&self, k: usize, i: usize, v: T)
Value-semantic nested write grid[k][i] = v (the through-write fast path): copy-on-write the
ROW at k (deep-copy only if its buffer is shared with a value-semantics sibling), then set
element i of that row in place. The compiled mirror of the parser’s clone-modify-writeback
place desugar, but O(1) when the row is uniquely owned — no full-row clone. The caller cow()s
the OUTER handle first (as the codegen emits), so a shared grid is never mutated in place.
Trait Implementations§
Source§impl<'de, T: Deserialize<'de>> Deserialize<'de> for LogosSeq<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for LogosSeq<T>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl<T: Clone> IntoIterator for LogosSeq<T>
impl<T: Clone> IntoIterator for LogosSeq<T>
Source§impl<T: PartialEq> LogosContains<T> for LogosSeq<T>
impl<T: PartialEq> LogosContains<T> for LogosSeq<T>
Source§fn logos_contains(&self, value: &T) -> bool
fn logos_contains(&self, value: &T) -> bool
Source§impl<T: WireDecode> WireDecode for LogosSeq<T>
impl<T: WireDecode> WireDecode for LogosSeq<T>
Source§impl<T: WireEncode> WireEncode for LogosSeq<T>
impl<T: WireEncode> WireEncode for LogosSeq<T>
Source§fn wire_encode(&self, out: &mut Vec<u8>)
fn wire_encode(&self, out: &mut Vec<u8>)
self’s tagged wire bytes to out.