pub struct List {
pub ordered: bool,
pub items: Vec<String>,
pub depths: Vec<usize>,
}Fields§
§ordered: bool§items: Vec<String>§depths: Vec<usize>Nesting depth of each item, parallel to items (depths[i] is the
indent level of items[i], 0 = top level). Marker-style list nesting
(kopitiam_token_max.md task #16): reconstruction infers depth from the
left-edge x-indentation of each item’s line and the renderer indents
accordingly.
§Why a parallel Vec, not Vec<ListItem>
items stays Vec<String> so existing readers that iterate the item
text unchanged (e.g. kopitiam-insurance’s clause ingest, which appends
each item as a line) keep compiling and behaving exactly as before. A
flat list built by hand can leave depths empty, which
List::depth reads as “every item is top level” — so a Default/
hand-constructed list needs no depth bookkeeping.
Invariant: depths is either empty (all top level) or exactly
items.len() long. List::depth upholds the “empty means flat”
reading regardless.
Implementations§
Trait Implementations§
impl StructuralPartialEq for List
Auto Trait Implementations§
impl Freeze for List
impl RefUnwindSafe for List
impl Send for List
impl Sync for List
impl Unpin for List
impl UnsafeUnpin for List
impl UnwindSafe for List
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more