MCPcopy Create free account
hub / github.com/angular-rust/ux-components / remove

Method remove

src/elements/element.rs:557–576  ·  view source on GitHub ↗

The child must be sure that his parent reference is correct. The child must remove the parent reference by himself: child.set_parent(None);

(&self, child: Id)

Source from the content-addressed store, hash-verified

555 /// The child must be sure that his parent reference is correct.
556 /// The child must remove the parent reference by himself: child.set_parent(None);
557 fn remove(&self, child: Id) {
558 let mut comp = self.as_ref().borrow_mut();
559
560 assert!(
561 !comp.destroyed,
562 "Widget was already destroyed but is being interacted with"
563 );
564
565 if let Some(index) = comp.children.iter().position(|x| x == &child) {
566 comp.children.remove(index);
567
568 if comp.onchildremove.is_some() {
569 let _ = comp.onchildremove.get().try_send(child);
570 }
571
572 if let Some(widget) = comp.canvas.as_ref() {
573 widget.sync_depth();
574 }
575 }
576 }
577
578 fn children_bounds(&self) -> ChildBounds {
579 let mut comp = self.as_ref().borrow_mut();

Callers 1

addMethod · 0.45

Implementers 15

transform.rssrc/elements/transform.rs
media_query.rssrc/elements/media_query.rs
navigation_toolbar.rssrc/elements/navigation_toolbar.rs
calendar_date_picker.rssrc/elements/calendar_date_picker.rs
custom_scroll_view.rssrc/elements/custom_scroll_view.rs
preferred_size.rssrc/elements/preferred_size.rs
rust_logo.rssrc/elements/rust_logo.rs
panel.rssrc/elements/panel.rs
single_child_scroll_view.rssrc/elements/single_child_scroll_view.
choice_chip.rssrc/elements/choice_chip.rs
tab_page_selector.rssrc/elements/tab_page_selector.rs
align.rssrc/elements/align.rs

Calls 4

try_sendMethod · 0.80
as_refMethod · 0.45
getMethod · 0.45
sync_depthMethod · 0.45

Tested by

no test coverage detected