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: i64, i: i64, v: T)
pub fn set_nested(&self, k: i64, i: i64, v: T)
Value-semantic nested write Set item i of item k of grid to v (the through-write fast path):
copy-on-write the ROW k names (deep-copy only if its buffer is shared with a value-semantics
sibling), then set the item i names in that row in place. Both are 1-based LOGOS indices under
crate::resolve_logos_index, the row’s first. 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 + Into<LogosValue>> From<LogosSeq<T>> for LogosValue
impl<T: Clone + Into<LogosValue>> From<LogosSeq<T>> for LogosValue
Source§impl<T: Into<Value> + Clone> From<LogosSeq<T>> for Value
BOX a homogeneous sequence into a Value so it can ride as a tuple element. Each element is boxed
via its own Into<Value> (so LogosSeq<i64> → Value::Seq of Value::Int, and a LogosSeq<LogosSeq<_>>
nests by boxing each inner seq the same way; a LogosSeq<Value> uses the reflexive Value: Into<Value>).
Pairs with the logos_seq_* unboxers.
impl<T: Into<Value> + Clone> From<LogosSeq<T>> for Value
BOX a homogeneous sequence into a Value so it can ride as a tuple element. Each element is boxed
via its own Into<Value> (so LogosSeq<i64> → Value::Seq of Value::Int, and a LogosSeq<LogosSeq<_>>
nests by boxing each inner seq the same way; a LogosSeq<Value> uses the reflexive Value: Into<Value>).
Pairs with the logos_seq_* unboxers.
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: ToRationals> ToRationals for LogosSeq<T>
impl<T: ToRationals> ToRationals for LogosSeq<T>
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.