pub struct ElementHandle<'a> { /* private fields */ }Expand description
Handle returned by Elements::add for chaining .key() and .width().
This handle has a builder-style API — call methods on it immediately
after adding a component to an Elements list:
ⓘ
let mut els = Elements::new();
els.add(Spinner::new("loading..."))
.key("my-spinner")
.width(WidthConstraint::Fixed(20));Implementations§
Source§impl<'a> ElementHandle<'a>
impl<'a> ElementHandle<'a>
Sourcepub fn key(self, key: impl Into<String>) -> Self
pub fn key(self, key: impl Into<String>) -> Self
Set a key for stable identity across rebuilds.
Keyed elements are matched by key during reconciliation, allowing them to survive position changes. Without a key, elements are matched by position and type.
Sourcepub fn width(self, constraint: WidthConstraint) -> Self
pub fn width(self, constraint: WidthConstraint) -> Self
Set the width constraint for this element within a horizontal container.
Only meaningful when the element is a child of an HStack.
Fixed(n) reserves exactly n columns. Fill (default) takes
remaining space, split equally among Fill siblings.
Auto Trait Implementations§
impl<'a> Freeze for ElementHandle<'a>
impl<'a> !RefUnwindSafe for ElementHandle<'a>
impl<'a> Send for ElementHandle<'a>
impl<'a> !Sync for ElementHandle<'a>
impl<'a> Unpin for ElementHandle<'a>
impl<'a> UnsafeUnpin for ElementHandle<'a>
impl<'a> !UnwindSafe for ElementHandle<'a>
Blanket Implementations§
Source§impl<T, V> AddTo<DataChildren<T>> for Vwhere
V: Into<T>,
impl<T, V> AddTo<DataChildren<T>> for Vwhere
V: Into<T>,
Source§type Handle<'a> = DataHandle
where
T: 'a
type Handle<'a> = DataHandle where T: 'a
Handle returned after adding. Supports
.key() / .width() chaining.Source§fn add_to(self, collector: &mut DataChildren<T>) -> DataHandle
fn add_to(self, collector: &mut DataChildren<T>) -> DataHandle
Add this value to the collector, returning a handle for chaining
.key() and .width().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
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>
Converts
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>
Converts
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