pub struct Children<'tree, 'bp>(/* private fields */);Implementations§
Source§impl<'tree, 'bp> Children<'tree, 'bp>
impl<'tree, 'bp> Children<'tree, 'bp>
pub fn new( children: TreeView<'tree, WidgetContainer<'bp>>, attribute_storage: &'tree mut AttributeStorage<'bp>, needs_layout: &'tree mut bool, ) -> Children<'tree, 'bp>
Sourcepub fn elements(&mut self) -> Elements<'_, 'tree, 'bp>
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
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 }pub fn components(&mut self) -> Components<'_, 'tree, 'bp>
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> 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