Skip to main content

Children

Struct Children 

Source
pub struct Children<'tree, 'bp>(/* private fields */);

Implementations§

Source§

impl<'tree, 'bp> Children<'tree, 'bp>

Source

pub fn new( children: TreeView<'tree, WidgetContainer<'bp>>, attribute_storage: &'tree mut AttributeStorage<'bp>, needs_layout: &'tree mut bool, ) -> Children<'tree, 'bp>

Source

pub fn elements(&mut self) -> Elements<'_, 'tree, 'bp>

Examples found in repository?
examples/buttons.rs (line 65)
57    fn on_mouse(
58        &mut self,
59        mouse: MouseEvent,
60        _: &mut Self::State,
61        mut children: Children<'_, '_>,
62        mut context: Context<'_, '_, Self::State>,
63    ) {
64        let pos = mouse.pos();
65        children.elements().at_position(pos).first(|_, _| {
66            if mouse.left_down() {
67                context.publish("click", ());
68
69                let id = context.attributes.get_as::<i64>("id").unwrap();
70                context.components.by_attribute("id", id).focus();
71            }
72        });
73    }
More examples
Hide additional examples
examples/message-passing.rs (line 23)
14    fn on_mouse(
15        &mut self,
16        mouse: MouseEvent,
17        _: &mut Self::State,
18        mut children: Children<'_, '_>,
19        mut context: Context<'_, '_, Self::State>,
20    ) {
21        if mouse.left_down() {
22            children
23                .elements()
24                .at_position(mouse.pos())
25                .by_attribute("id", "button")
26                .first(|_, attr| {
27                    let Some(value) = attr.get_as::<&str>("id").map(|s| s.to_string()) else { return };
28                    context.components.by_name("messages").send(value);
29                });
30        }
31    }
Source

pub fn components(&mut self) -> Components<'_, 'tree, 'bp>

Source

pub fn parent_path(&self) -> &[u16]

Auto Trait Implementations§

§

impl<'tree, 'bp> Freeze for Children<'tree, 'bp>

§

impl<'tree, 'bp> !RefUnwindSafe for Children<'tree, 'bp>

§

impl<'tree, 'bp> !Send for Children<'tree, 'bp>

§

impl<'tree, 'bp> !Sync for Children<'tree, 'bp>

§

impl<'tree, 'bp> Unpin for Children<'tree, 'bp>

§

impl<'tree, 'bp> UnsafeUnpin for Children<'tree, 'bp>

§

impl<'tree, 'bp> !UnwindSafe for Children<'tree, 'bp>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.