Struct druid::widget::SizedBox

source ·
pub struct SizedBox<T> { /* private fields */ }
Expand description

A widget with predefined size.

If given a child, this widget forces its child to have a specific width and/or height (assuming values are permitted by this widget’s parent). If either the width or height is not set, this widget will size itself to match the child’s size in that dimension.

If not given a child, SizedBox will try to size itself as close to the specified height and width as possible given the parent’s constraints. If height or width is not set, it will be treated as zero.

Implementations§

Construct container with child, and both width and height not set.

Construct container without child, and both width and height not set.

If the widget is unchanged, it will do nothing, which can be useful if you want to draw a widget some of the time (for example, it is used to implement Maybe).

Set container’s width.

Set container’s height.

Expand container to fit the parent.

Only call this method if you want your widget to occupy all available space. If you only care about expanding in one of width or height, use expand_width or expand_height instead.

Expand the container on the x-axis.

This will force the child to have maximum width.

Expand the container on the y-axis.

This will force the child to have maximum height.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Performs the conversion.
Performs the conversion.
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more