Skip to main content

GridItem

Struct GridItem 

Source
pub struct GridItem {
    pub column_start: usize,
    pub column_end: usize,
    pub row_start: usize,
    pub row_end: usize,
    pub area: Option<String>,
    pub column_span: usize,
    pub row_span: usize,
    pub justify_self: Option<GridAlign>,
    pub align_self: Option<GridAlign>,
}
Expand description

Grid item placement properties.

Fields§

§column_start: usize

Column start (1-indexed like CSS, 0 = auto)

§column_end: usize

Column end (exclusive, 0 = auto)

§row_start: usize

Row start (1-indexed like CSS, 0 = auto)

§row_end: usize

Row end (exclusive, 0 = auto)

§area: Option<String>

Named area to place in

§column_span: usize

Column span (alternative to column_end)

§row_span: usize

Row span (alternative to row_end)

§justify_self: Option<GridAlign>

Alignment within cell (horizontal)

§align_self: Option<GridAlign>

Alignment within cell (vertical)

Implementations§

Source§

impl GridItem

Source

pub fn new() -> Self

Create a new grid item with auto placement.

Source

pub const fn column(self, col: usize) -> Self

Place in a specific column.

Source

pub const fn row(self, row: usize) -> Self

Place in a specific row.

Source

pub const fn span_columns(self, span: usize) -> Self

Span multiple columns.

Source

pub const fn span_rows(self, span: usize) -> Self

Span multiple rows.

Source

pub fn in_area(self, area: impl Into<String>) -> Self

Place in a named area.

Source

pub const fn justify_self(self, align: GridAlign) -> Self

Set horizontal alignment.

Source

pub const fn align_self(self, align: GridAlign) -> Self

Set vertical alignment.

Source

pub fn effective_column_span(&self) -> usize

Get effective column span.

Source

pub fn effective_row_span(&self) -> usize

Get effective row span.

Trait Implementations§

Source§

impl Clone for GridItem

Source§

fn clone(&self) -> GridItem

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GridItem

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for GridItem

Source§

fn default() -> GridItem

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GridItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for GridItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,