pub(crate) trait ChildPropertyExt {
// Required methods
fn child_property(&self) -> Option<Widget>;
fn set_child_property(&self, child: Option<&impl IsA<Widget>>);
// Provided methods
fn child_or_else<W>(&self, f: impl FnOnce() -> W) -> W
where W: IsA<Widget> { ... }
fn child_or_default<W>(&self) -> W
where W: IsA<Widget> + Default { ... }
}
Expand description
Extensions trait for types with a child
property.
Required Methods§
Sourcefn child_property(&self) -> Option<Widget>
fn child_property(&self) -> Option<Widget>
The child of this widget, is any.
Sourcefn set_child_property(&self, child: Option<&impl IsA<Widget>>)
fn set_child_property(&self, child: Option<&impl IsA<Widget>>)
Set the child of this widget.
Provided Methods§
Sourcefn child_or_else<W>(&self, f: impl FnOnce() -> W) -> W
fn child_or_else<W>(&self, f: impl FnOnce() -> W) -> W
Get the child if it is of the proper type, or construct it with the given function and set is as the child of this widget before returning it.
Sourcefn child_or_default<W>(&self) -> W
fn child_or_default<W>(&self) -> W
Get the child if it is of the proper type, or construct it with its
Default
implementation and set is as the child of this widget before
returning it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.