Struct NamedLineResolver

Source
pub(crate) struct NamedLineResolver<S: CheapCloneStr> {
    row_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>,
    column_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>,
    areas: HashMap<StrHasher<S>, GridTemplateArea<S>, RandomState>,
    area_column_count: u16,
    area_row_count: u16,
    explicit_column_count: u16,
    explicit_row_count: u16,
}
Expand description

Resolver that takes grid lines names and area names as input and can then be used to resolve line names of grid placement properties into line numbers.

Fields§

§row_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>

Map of row line names to line numbers. Each line name may correspond to multiple lines so we store a Vec

§column_lines: HashMap<StrHasher<S>, Vec<u16>, RandomState>

Map of column line names to line numbers. Each line name may correspond to multiple lines so we store a Vec

§areas: HashMap<StrHasher<S>, GridTemplateArea<S>, RandomState>

Map of area names to area definitions (start and end lines numbers in each axis)

§area_column_count: u16

Number of columns implied by grid area definitions

§area_row_count: u16

Number of rows implied by grid area definitions

§explicit_column_count: u16

The number of explicit columns in the grid. This is an input to the NamedLineResolver and is used when computing the fallback line when a non-existent named line is specified.

§explicit_row_count: u16

The number of explicit rows in the grid. This is an input to the NamedLineResolver and is used when computing the fallback line when a non-existent named line is specified.

Implementations§

Source§

impl<S: CheapCloneStr> NamedLineResolver<S>

Source

pub(crate) fn new( style: &impl GridContainerStyle<CustomIdent = S>, column_auto_repetitions: u16, row_auto_repetitions: u16, ) -> Self

Create and initialise a new NamedLineResolver

Source

pub(crate) fn resolve_row_names( &self, line: &Line<GridPlacement<S>>, ) -> Line<GenericGridPlacement<GridLine>>

Resolve named lines for both the start and end of a row-axis grid placement

Source

pub(crate) fn resolve_column_names( &self, line: &Line<GridPlacement<S>>, ) -> Line<GenericGridPlacement<GridLine>>

Resolve named lines for both the start and end of a column-axis grid placement

Source

pub(crate) fn resolve_line_names( &self, line: &Line<GridPlacement<S>>, axis: GridAreaAxis, ) -> Line<GenericGridPlacement<GridLine>>

Resolve named lines for both the start and end of a grid placement

Source

fn find_line_index( &self, name: &S, idx: i16, axis: GridAreaAxis, end: GridAreaEnd, filter_lines: &dyn Fn(&[u16]) -> &[u16], ) -> GridLine

Resolve the grid line for a named grid line or span

Source

pub(crate) fn area_column_count(&self) -> u16

Get the number of columns defined by the grid areas

Source

pub(crate) fn area_row_count(&self) -> u16

Get the number of rows defined by the grid areas

Source

pub(crate) fn set_explicit_column_count(&mut self, count: u16)

Set the number of columns in the explicit grid

Source

pub(crate) fn set_explicit_row_count(&mut self, count: u16)

Set the number of rows in the explicit grid

Trait Implementations§

Source§

impl<S: CheapCloneStr> Debug for NamedLineResolver<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> Freeze for NamedLineResolver<S>

§

impl<S> RefUnwindSafe for NamedLineResolver<S>
where S: RefUnwindSafe,

§

impl<S> Send for NamedLineResolver<S>
where S: Send,

§

impl<S> Sync for NamedLineResolver<S>
where S: Sync,

§

impl<S> Unpin for NamedLineResolver<S>
where S: Unpin,

§

impl<S> UnwindSafe for NamedLineResolver<S>
where S: UnwindSafe,

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> 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, 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.