pub struct Element {
pub type_id: TypeId,
pub widget: Box<dyn Widget>,
}Expand description
A container for any widget implementing the Widget trait.
A container for any widget implementing the Widget trait.
This is the primary type used to store and manipulate widgets in layout
trees. Element wraps a widget in a dynamic trait object.
Use Element::new to convert a widget into an Element.
Fields§
§type_id: TypeId§widget: Box<dyn Widget>Implementations§
Source§impl Element
impl Element
pub fn map<W: Widget + 'static, F: FnOnce(W) -> W>(self, f: F) -> Self
Trait Implementations§
Source§impl From<ProgressBar> for Element
impl From<ProgressBar> for Element
Source§fn from(value: ProgressBar) -> Self
fn from(value: ProgressBar) -> Self
Converts to this type from the input type.
Source§impl<W> From<Scrollable<W>> for Elementwhere
W: Widget + 'static,
impl<W> From<Scrollable<W>> for Elementwhere
W: Widget + 'static,
Source§fn from(value: Scrollable<W>) -> Self
fn from(value: Scrollable<W>) -> Self
Converts to this type from the input type.
Source§impl Widget for Element
impl Widget for Element
Source§fn height(&self, size: &Vec2) -> usize
fn height(&self, size: &Vec2) -> usize
Returns the height of the
Widget based on the width of the given
size.Auto Trait Implementations§
impl Freeze for Element
impl !RefUnwindSafe for Element
impl !Send for Element
impl !Sync for Element
impl Unpin for Element
impl !UnwindSafe for Element
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
Mutably borrows from an owned value. Read more