pub struct CellsPayload {
pub rows: u32,
pub cols: u32,
pub cells: Vec<CellSpec>,
}Expand description
The payload of flm.pres.cells, a whole table of cells: its size and one
entry per cell. The cells’ content is held in the node’s content slots.
The node carries one content slot named cell
(CELL_SLOT) per entry of cells, in the
same order, so the slot at index i holds the content of entry i, a run
of blocks (cells_of reads the two together). A grid
position no cell covers has no entry and no slot. The node has no anchor and
no role: a table of cells becomes a link target only through the node that
holds it, such as a float of the table float type.
An emitter visits the grid through grid and never
computes the occupancy from the entries itself.
Fields§
§rows: u32The number of rows of the grid.
cols: u32The number of columns of the grid.
cells: Vec<CellSpec>The cells, in row-major order of their top-left positions: by row, and within a row by column.
Implementations§
Source§impl CellsPayload
impl CellsPayload
Sourcepub fn grid(&self) -> Vec<Vec<GridPosition>>
pub fn grid(&self) -> Vec<Vec<GridPosition>>
What occupies every position of the grid: grid()[row][col], the
rows from zero, each row holding cols positions.
Every emitter of a table of cells uses this, and none computes the
occupancy itself. It is built from the entries in their order: an entry
marks its top-left position and covers the rest of its rectangle. A
payload the cells feature stages has no two entries overlapping and
none outside the grid, and a payload read back from a projection has
none either (from_projection refuses any
other). For a payload built by hand otherwise, a position already held
keeps its first holder and a position outside the grid is ignored.
The result holds rows times cols
positions, at most MAX_CELLS_POSITIONS for a payload the feature or
the projection reader produced.
Sourcepub fn from_projection(
value: &SerialValue,
) -> Result<CellsPayload, DeserializeError>
pub fn from_projection( value: &SerialValue, ) -> Result<CellsPayload, DeserializeError>
The payload rebuilt from its projection, the value
project produced.
§Errors
Returns a DeserializeError mentioning flm.pres.cells when the
projection is not a map; when rows, cols or cells is missing or of
the wrong type; when an entry is not a map, lacks row or col, gives
a span below one or a number outside the unsigned 32-bit range, or gives
an alignment, a header kind or an edge that does not exist; and when the
payload is not one the cells feature could stage: a grid of more than
MAX_CELLS_POSITIONS positions, an entry reaching outside the grid,
two entries overlapping, or the entries out of row-major order.
Trait Implementations§
Source§impl Clone for CellsPayload
impl Clone for CellsPayload
Source§impl Debug for CellsPayload
impl Debug for CellsPayload
Source§impl Default for CellsPayload
impl Default for CellsPayload
impl Eq for CellsPayload
Source§impl PartialEq for CellsPayload
impl PartialEq for CellsPayload
Source§impl PresPayload for CellsPayload
impl PresPayload for CellsPayload
Source§fn project(&self) -> SerialValue
fn project(&self) -> SerialValue
impl StructuralPartialEq for CellsPayload
Auto Trait Implementations§
impl Forget for CellsPayload
impl Freeze for CellsPayload
impl Move for CellsPayload
impl RefUnwindSafe for CellsPayload
impl Send for CellsPayload
impl Sync for CellsPayload
impl Unpin for CellsPayload
impl UnsafeUnpin for CellsPayload
impl UnwindSafe for CellsPayload
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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