pub struct GridLineNames<S: CheapCloneStr = String> {
names: Vec<S>,
offsets: Vec<u32>,
resolver: HashMap<StrHasher<S>, SmallVec<[u32; 4]>, RandomState>,
}Expand description
The names of each explicit grid line in a single axis, stored in CSR (compressed sparse
row) format: a single flat Vec of names plus a Vec of offsets into it (one more offset
than there are lines). The names of line i (0-indexed) are names[offsets[i]..offsets[i + 1]].
Line indices here are relative to the explicit grid;
DetailedGridTracksInfo provides accessors with indices
relative to the full grid (including implicit tracks).
Iterate over per-line name groups with GridLineNames::iter, or access a single line’s
names with GridLineNames::line. A grid with no named lines is represented by two empty
Vecs (see GridLineNames::is_empty).
Fields§
§names: Vec<S>The names of every grid line in the axis, concatenated in line order
offsets: Vec<u32>Offsets into names: line i’s names are names[offsets[i]..offsets[i + 1]].
Either empty (no named lines) or of length line count + 1.
resolver: HashMap<StrHasher<S>, SmallVec<[u32; 4]>, RandomState>Named line lookup used to resolve arbitrary grid placements
Implementations§
Source§impl<S: CheapCloneStr> GridLineNames<S>
impl<S: CheapCloneStr> GridLineNames<S>
Sourcepub(crate) fn with_capacity(
name_capacity: usize,
offset_capacity: usize,
) -> Self
pub(crate) fn with_capacity( name_capacity: usize, offset_capacity: usize, ) -> Self
Create an empty GridLineNames with pre-allocated capacity
Sourcepub(crate) fn start_line(&mut self)
pub(crate) fn start_line(&mut self)
Start a new (initially empty) line
Sourcepub(crate) fn current_line_contains(&self, name: &str) -> bool
pub(crate) fn current_line_contains(&self, name: &str) -> bool
Whether the current (last) line already contains the passed name
Sourcepub(crate) fn resolve_line_names(
&self,
line: &Line<GridPlacement<S>>,
explicit_track_count: u16,
) -> Line<GenericGridPlacement<GridLine>>
pub(crate) fn resolve_line_names( &self, line: &Line<GridPlacement<S>>, explicit_track_count: u16, ) -> Line<GenericGridPlacement<GridLine>>
Resolve named lines and spans using the retained line-name map
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
The number of grid lines represented (zero if the grid has no named lines)
Sourcepub fn line(&self, line_index: usize) -> &[S]
pub fn line(&self, line_index: usize) -> &[S]
The names of the line with the passed 0-indexed line index. Returns an empty slice if the line has no names or the index is out of range.
Sourcepub fn iter(&self) -> GridLineNamesIter<'_, S> ⓘ
pub fn iter(&self) -> GridLineNamesIter<'_, S> ⓘ
Iterate over the name group (&[S]) of each grid line in line order
Sourcepub(crate) fn iter_padded(
&self,
leading_empty: usize,
trailing_empty: usize,
) -> GridLineNamesIter<'_, S> ⓘ
pub(crate) fn iter_padded( &self, leading_empty: usize, trailing_empty: usize, ) -> GridLineNamesIter<'_, S> ⓘ
Iterate over the name group (&[S]) of each grid line in line order, additionally
yielding leading_empty empty groups before the stored lines and trailing_empty
empty groups after them (representing unnamed implicit grid lines)
Trait Implementations§
Source§impl<S: Clone + CheapCloneStr> Clone for GridLineNames<S>
impl<S: Clone + CheapCloneStr> Clone for GridLineNames<S>
Source§fn clone(&self) -> GridLineNames<S>
fn clone(&self) -> GridLineNames<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<S: Debug + CheapCloneStr> Debug for GridLineNames<S>
impl<S: Debug + CheapCloneStr> Debug for GridLineNames<S>
Source§impl<S: Default + CheapCloneStr> Default for GridLineNames<S>
impl<S: Default + CheapCloneStr> Default for GridLineNames<S>
Source§fn default() -> GridLineNames<S>
fn default() -> GridLineNames<S>
Source§impl<'a, S: CheapCloneStr> IntoIterator for &'a GridLineNames<S>
Available on crate feature detailed_layout_info only.
impl<'a, S: CheapCloneStr> IntoIterator for &'a GridLineNames<S>
detailed_layout_info only.Source§impl<S: PartialEq + CheapCloneStr> PartialEq for GridLineNames<S>
impl<S: PartialEq + CheapCloneStr> PartialEq for GridLineNames<S>
Source§fn eq(&self, other: &GridLineNames<S>) -> bool
fn eq(&self, other: &GridLineNames<S>) -> bool
self and other values to be equal, and is used by ==.