Trait ChildPropertyExt

Source
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§

Source

fn child_property(&self) -> Option<Widget>

The child of this widget, is any.

Source

fn set_child_property(&self, child: Option<&impl IsA<Widget>>)

Set the child of this widget.

Provided Methods§

Source

fn child_or_else<W>(&self, f: impl FnOnce() -> W) -> W
where W: IsA<Widget>,

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.

Source

fn child_or_default<W>(&self) -> W
where W: IsA<Widget> + Default,

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.

Implementations on Foreign Types§

Source§

impl ChildPropertyExt for ListItem

Implementors§