Skip to main content

Grid

Struct Grid 

Source
pub struct Grid {
    pub rows: usize,
    pub cols: usize,
    pub spacing: f32,
}
Expand description

Grid - lays out children in a 2D grid

Fields§

§rows: usize§cols: usize§spacing: f32

Implementations§

Source§

impl Grid

Source

pub fn new(rows: usize, cols: usize, spacing: f32) -> Self

Source

pub fn compute_layout( rows: usize, cols: usize, spacing: f32, bounds: Rect, subviews: &[&dyn LayoutView], _cache: &mut LayoutCache, ) -> Vec<Rect>

Trait Implementations§

Source§

impl LayoutView for Grid

Source§

fn size_that_fits( &self, proposal: SizeProposal, _subviews: &[&dyn LayoutView], _cache: &mut LayoutCache, ) -> Size

Propose a size for this view given the available space
Source§

fn place_subviews( &self, bounds: Rect, subviews: &mut [&mut dyn LayoutView], cache: &mut LayoutCache, )

Place subviews within the given bounds
Source§

fn flex_weight(&self) -> f32

Returns the flex weight of this view (default is 0.0, which means fixed/intrinsic)
Source§

fn debug_layout(&self, indent: usize) -> String

Return a debug representation of this layout subtree. The indent parameter controls the indentation level for nested display.

Auto Trait Implementations§

§

impl Freeze for Grid

§

impl RefUnwindSafe for Grid

§

impl Send for Grid

§

impl Sync for Grid

§

impl Unpin for Grid

§

impl UnsafeUnpin for Grid

§

impl UnwindSafe for Grid

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.