#[non_exhaustive]pub struct GridArea {
pub id: SharedString,
pub col: usize,
pub row: usize,
pub col_span: usize,
pub row_span: usize,
pub min_col_span: usize,
pub min_row_span: usize,
pub max_col_span: Option<usize>,
pub max_row_span: Option<usize>,
pub locked: bool,
}Expand description
Where one item sits in a grid layout, in zero-based grid cells.
col and row are the item’s leading column and top row, counted from
zero; col_span and row_span are how many columns and rows it covers.
Unlike GPUI’s col_start, which names a one-based CSS grid line, col is
a cell index, so a layout reads the same in code and in its saved form.
A layout is a list of areas keyed by id, which is what an application
persists to restore a user’s arrangement. Every field after the place has a
serde default, so a layout saved with only the place still loads.
GridArea::new("revenue").col_span(6).row_span(4).min_span(3, 2)Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: SharedStringThe stable identity that pairs this area with its GridItem.
col: usizeThe leading column, from zero.
row: usizeThe top row, from zero.
col_span: usizeThe number of columns covered; at least 1.
row_span: usizeThe number of rows covered; at least 1.
min_col_span: usizeThe fewest columns a resize may leave the item.
min_row_span: usizeThe fewest rows a resize may leave the item.
max_col_span: Option<usize>The most columns a resize may give the item; None allows the full width.
max_row_span: Option<usize>The most rows a resize may give the item; None is unbounded.
locked: boolA locked item is neither dragged, resized nor pushed; other items flow around it.
Implementations§
Source§impl GridArea
impl GridArea
Sourcepub fn new(id: impl Into<SharedString>) -> Self
pub fn new(id: impl Into<SharedString>) -> Self
A one-cell area at the top-leading corner; place and size it with the builders.
Sourcepub fn min_span(self, col_span: usize, row_span: usize) -> Self
pub fn min_span(self, col_span: usize, row_span: usize) -> Self
The fewest columns and rows a resize may leave the item.
Sourcepub fn max_span(self, col_span: usize, row_span: usize) -> Self
pub fn max_span(self, col_span: usize, row_span: usize) -> Self
The most columns and rows a resize may give the item.
Sourcepub fn locked(self, locked: bool) -> Self
pub fn locked(self, locked: bool) -> Self
Lock the item in place; see GridArea::locked.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GridArea
impl<'de> Deserialize<'de> for GridArea
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for GridArea
impl StructuralPartialEq for GridArea
Auto Trait Implementations§
impl Forget for GridArea
impl Freeze for GridArea
impl RefUnwindSafe for GridArea
impl Send for GridArea
impl Sync for GridArea
impl Unpin for GridArea
impl UnsafeUnpin for GridArea
impl UnwindSafe for GridArea
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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