pub struct InheritedElement { /* private fields */ }Expand description
An Element that uses an InheritedWidget as its configuration.
Implementations§
Source§impl InheritedElement
impl InheritedElement
Sourcepub fn new(app: &mut App, widget: WidgetRef) -> Handle<Self>
pub fn new(app: &mut App, widget: WidgetRef) -> Handle<Self>
Creates an element that uses the given widget as its configuration.
Sourcepub fn widget(self: Handle<Self>, app: &App) -> &dyn AnyInheritedWidget
pub fn widget(self: Handle<Self>, app: &App) -> &dyn AnyInheritedWidget
The widget, as an inherited widget.
Sourcepub fn get_dependencies(
self: Handle<Self>,
app: &App,
dependent: AnyElement,
) -> Option<Rc<dyn Any>>
pub fn get_dependencies( self: Handle<Self>, app: &App, dependent: AnyElement, ) -> Option<Rc<dyn Any>>
Returns the dependencies value recorded for dependent with
set_dependencies.
Each dependent element is mapped to a single object value which represents how the
element depends on this InheritedElement. This value is None by default and by
default dependent elements are rebuilt unconditionally.
Sourcepub fn set_dependencies(
self: Handle<Self>,
app: &mut App,
dependent: AnyElement,
value: Option<Rc<dyn Any>>,
)
pub fn set_dependencies( self: Handle<Self>, app: &mut App, dependent: AnyElement, value: Option<Rc<dyn Any>>, )
Sets the value returned by get_dependencies value for
dependent.
Each dependent element is mapped to a single object value which represents how the
element depends on this InheritedElement. The update_dependencies method sets
this value to None by default so that dependent elements are rebuilt unconditionally.
Sourcepub fn notify_dependent(
self: Handle<Self>,
app: &mut App,
old_widget: &WidgetRef,
dependent: AnyElement,
)
pub fn notify_dependent( self: Handle<Self>, app: &mut App, old_widget: &WidgetRef, dependent: AnyElement, )
Called by notify_clients for each dependent.
Calls dependent.did_change_dependencies() by default.
Subclasses can override this method to selectively call
did_change_dependencies based on the value of
get_dependencies.
Trait Implementations§
Source§impl ComponentElement for InheritedElement
impl ComponentElement for InheritedElement
Source§fn component_data(self: Handle<Self>, app: &App) -> &ComponentElementData
fn component_data(self: Handle<Self>, app: &App) -> &ComponentElementData
component.Source§fn component_data_mut(
self: Handle<Self>,
app: &mut App,
) -> &mut ComponentElementData
fn component_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut ComponentElementData
component_data.Source§fn build(self: Handle<Self>, app: &mut App) -> WidgetRef
fn build(self: Handle<Self>, app: &mut App) -> WidgetRef
build
function (e.g., StatelessWidget::build or State::build) for their widget.Source§fn build_tracked(self: Handle<Self>, app: &mut App) -> WidgetRef
fn build_tracked(self: Handle<Self>, app: &mut App) -> WidgetRef
build inside App::entity_track and binds watches.Source§fn child(self: Handle<Self>, app: &App) -> Option<AnyElement>
fn child(self: Handle<Self>, app: &App) -> Option<AnyElement>
Source§fn mount(
self: Handle<Self>,
app: &mut App,
parent: Option<AnyElement>,
new_slot: Option<Slot>,
)
fn mount( self: Handle<Self>, app: &mut App, parent: Option<AnyElement>, new_slot: Option<Slot>, )
ComponentElement.mount: the base mount, then the first build.Source§fn first_build(self: Handle<Self>, app: &mut App)
fn first_build(self: Handle<Self>, app: &mut App)
ComponentElement._firstBuild.Source§fn perform_rebuild(self: Handle<Self>, app: &mut App)
fn perform_rebuild(self: Handle<Self>, app: &mut App)
Source§fn visit_children_component(
self: Handle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyElement),
)
fn visit_children_component( self: Handle<Self>, app: &App, visitor: &mut dyn FnMut(AnyElement), )
ComponentElement.visitChildren.Source§fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
ComponentElement.forgetChild.Source§impl Element for InheritedElement
impl Element for InheritedElement
Source§const IS_INHERITED_ELEMENT: bool = true
const IS_INHERITED_ELEMENT: bool = true
this is InheritedElement.Source§fn element_data(self: Handle<Self>, app: &App) -> &ElementData
fn element_data(self: Handle<Self>, app: &App) -> &ElementData
element
(element_accessors!).Source§fn element_data_mut(self: Handle<Self>, app: &mut App) -> &mut ElementData
fn element_data_mut(self: Handle<Self>, app: &mut App) -> &mut ElementData
element_data.Source§fn visit_children(
self: Handle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyElement),
)
fn visit_children( self: Handle<Self>, app: &App, visitor: &mut dyn FnMut(AnyElement), )
Source§fn render_object_attaching_child(
self: Handle<Self>,
app: &App,
) -> Option<AnyElement>
fn render_object_attaching_child( self: Handle<Self>, app: &App, ) -> Option<AnyElement>
Source§fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
fn forget_child(self: Handle<Self>, app: &mut App, child: AnyElement)
Source§fn debug_doing_build(self: Handle<Self>, app: &App) -> bool
fn debug_doing_build(self: Handle<Self>, app: &App) -> bool
Source§fn mount(
self: Handle<Self>,
app: &mut App,
parent: Option<AnyElement>,
new_slot: Option<Slot>,
)
fn mount( self: Handle<Self>, app: &mut App, parent: Option<AnyElement>, new_slot: Option<Slot>, )
Source§fn update(self: Handle<Self>, app: &mut App, new_widget: WidgetRef)
fn update(self: Handle<Self>, app: &mut App, new_widget: WidgetRef)
Source§fn perform_rebuild(self: Handle<Self>, app: &mut App)
fn perform_rebuild(self: Handle<Self>, app: &mut App)
Source§fn update_inheritance(self: Handle<Self>, app: &mut App)
fn update_inheritance(self: Handle<Self>, app: &mut App)
_updateInheritance: inherit the parent’s inherited-element map.Source§fn debug_deactivated(self: Handle<Self>, app: &mut App)
fn debug_deactivated(self: Handle<Self>, app: &mut App)
Source§fn update_dependencies(
self: Handle<Self>,
app: &mut App,
dependent: AnyElement,
aspect: Option<Rc<dyn Any>>,
)
fn update_dependencies( self: Handle<Self>, app: &mut App, dependent: AnyElement, aspect: Option<Rc<dyn Any>>, )
InheritedElement.updateDependencies.Source§fn remove_dependent(self: Handle<Self>, app: &mut App, dependent: AnyElement)
fn remove_dependent(self: Handle<Self>, app: &mut App, dependent: AnyElement)
InheritedElement.removeDependent.Source§fn as_element(self: Handle<Self>) -> AnyElement
fn as_element(self: Handle<Self>) -> AnyElement
Source§fn debug_visit_onstage_children(
self: Handle<Self>,
app: &App,
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( self: Handle<Self>, app: &App, visitor: &mut dyn FnMut(AnyElement), )
Source§fn update_slot(self: Handle<Self>, app: &mut App, new_slot: Option<Slot>)
fn update_slot(self: Handle<Self>, app: &mut App, new_slot: Option<Slot>)
AnyElement::update_slot_for_child when the slot for a child has changed.Source§fn detach_render_object(self: Handle<Self>, app: &mut App)
fn detach_render_object(self: Handle<Self>, app: &mut App)
AnyElement::render_object from the render tree. Read moreSource§fn activate(self: Handle<Self>, app: &mut App)
fn activate(self: Handle<Self>, app: &mut App)
Source§fn deactivate(self: Handle<Self>, app: &mut App)
fn deactivate(self: Handle<Self>, app: &mut App)
Source§fn unmount(self: Handle<Self>, app: &mut App)
fn unmount(self: Handle<Self>, app: &mut App)
Source§fn did_change_dependencies(self: Handle<Self>, app: &mut App)
fn did_change_dependencies(self: Handle<Self>, app: &mut App)
Source§fn attach_notification_tree(self: Handle<Self>, app: &mut App)
fn attach_notification_tree(self: Handle<Self>, app: &mut App)
Source§fn build_scope(self: Handle<Self>, app: &App) -> Handle<BuildScope>
fn build_scope(self: Handle<Self>, app: &App) -> Handle<BuildScope>
BuildScope whose dirty list this element is in. Read moreSource§fn mark_needs_build(self: Handle<Self>, app: &mut App)
fn mark_needs_build(self: Handle<Self>, app: &mut App)
Source§fn on_notification(
self: Handle<Self>,
app: &mut App,
notification: &dyn Notification,
) -> bool
fn on_notification( self: Handle<Self>, app: &mut App, notification: &dyn Notification, ) -> bool
NotifiableElementMixin.onNotification). Read moreSource§fn debug_expects_render_object_for_slot(
self: Handle<Self>,
app: &App,
slot: Option<&Slot>,
) -> bool
fn debug_expects_render_object_for_slot( self: Handle<Self>, app: &App, slot: Option<&Slot>, ) -> bool
slot (or one of its descendants) must insert a
RenderObject into its ancestor RenderObjectElement by calling
RenderObjectElement::insert_render_object_child on it.Source§fn render_object(self: Handle<Self>, app: &App) -> Option<AnyRenderObject>
fn render_object(self: Handle<Self>, app: &App) -> Option<AnyRenderObject>
Source§const IS_RENDER_OBJECT_ELEMENT: bool = false
const IS_RENDER_OBJECT_ELEMENT: bool = false
this is RenderObjectElement.Source§fn insert_render_object_child(
self: Handle<Self>,
app: &mut App,
child: AnyRenderObject,
slot: Option<Slot>,
)
fn insert_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, slot: Option<Slot>, )
RenderObjectElement.insertRenderObjectChild.Source§fn move_render_object_child(
self: Handle<Self>,
app: &mut App,
child: AnyRenderObject,
old_slot: Option<Slot>,
new_slot: Option<Slot>,
)
fn move_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, old_slot: Option<Slot>, new_slot: Option<Slot>, )
RenderObjectElement.moveRenderObjectChild.Source§fn remove_render_object_child(
self: Handle<Self>,
app: &mut App,
child: AnyRenderObject,
slot: Option<Slot>,
)
fn remove_render_object_child( self: Handle<Self>, app: &mut App, child: AnyRenderObject, slot: Option<Slot>, )
RenderObjectElement.removeRenderObjectChild.Source§fn update_parent_data(
self: Handle<Self>,
app: &mut App,
parent_data_element: AnyElement,
)
fn update_parent_data( self: Handle<Self>, app: &mut App, parent_data_element: AnyElement, )
RenderObjectElement._updateParentData: apply a parent-data widget to this element’s
render object.Source§const IS_PARENT_DATA_ELEMENT: bool = false
const IS_PARENT_DATA_ELEMENT: bool = false
this is ParentDataElement.Source§fn apply_parent_data(
self: Handle<Self>,
app: &mut App,
render_object: AnyRenderObject,
) -> bool
fn apply_parent_data( self: Handle<Self>, app: &mut App, render_object: AnyRenderObject, ) -> bool
ParentDataWidget.applyParentData through the element that holds the widget.Source§fn state_handle_id(self: Handle<Self>, app: &App) -> Option<(TypeId, HandleId)>
fn state_handle_id(self: Handle<Self>, app: &App) -> Option<(TypeId, HandleId)>
this is StatefulElement && state is T: the state’s type and arena id.Source§fn debug_fill_properties(
self: Handle<Self>,
app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( self: Handle<Self>, app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties as an element class overrides it: the properties it adds
after Element’s, and RenderObjectElement’s for a render object element, which the
framework adds first since a trait default cannot call super.Source§fn debug_describe_children(
self: Handle<Self>,
app: &App,
) -> Vec<Rc<dyn DiagnosticsNode>>
fn debug_describe_children( self: Handle<Self>, app: &App, ) -> Vec<Rc<dyn DiagnosticsNode>>
debugDescribeChildren: the children a dump shows under this element, by
default every child visit_children visits.Source§impl ProxyElement for InheritedElement
impl ProxyElement for InheritedElement
Source§fn updated(self: Handle<Self>, app: &mut App, old_widget: WidgetRef)
fn updated(self: Handle<Self>, app: &mut App, old_widget: WidgetRef)
Auto Trait Implementations§
impl !RefUnwindSafe for InheritedElement
impl !Send for InheritedElement
impl !Sync for InheritedElement
impl !UnwindSafe for InheritedElement
impl Forget for InheritedElement
impl Freeze for InheritedElementwhere
NonZero<u32>: Freeze,
&'static ElementVTable: Freeze,
*const RcInner<dyn Any> is !null: Freeze,
PhantomData<RcInner<dyn Any>>: Freeze,
*const RcInner<dyn Widget> is !null: Freeze,
PhantomData<RcInner<dyn Widget>>: Freeze,
PhantomData<fn() -> BuildOwner>: Freeze,
PhantomData<fn() -> BuildScope>: Freeze,
*const RcInner<Keep> is !null: Freeze,
PhantomData<RcInner<Keep>>: Freeze,
*const RcInner<HashMap<TypeId, AnyElement>> is !null: Freeze,
PhantomData<RcInner<HashMap<TypeId, AnyElement>>>: Freeze,
*const RcInner<NotificationNode> is !null: Freeze,
PhantomData<RcInner<NotificationNode>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<(AnyElement, ())>: Freeze,
PhantomData<(EntityId, Subscription)>: Freeze,
PhantomData<(AnyElement, Option<Rc<dyn Any>>)>: Freeze,
impl Move for InheritedElement
impl Unpin for InheritedElement
impl UnsafeUnpin for InheritedElementwhere
NonZeroU32Inner: UnsafeUnpin,
&'static ElementVTable: UnsafeUnpin,
*const RcInner<dyn Any> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Any>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
PhantomData<fn() -> BuildOwner>: UnsafeUnpin,
PhantomData<fn() -> BuildScope>: UnsafeUnpin,
*const RcInner<Keep> is !null: UnsafeUnpin,
PhantomData<RcInner<Keep>>: UnsafeUnpin,
*const RcInner<HashMap<TypeId, AnyElement>> is !null: UnsafeUnpin,
PhantomData<RcInner<HashMap<TypeId, AnyElement>>>: UnsafeUnpin,
*const RcInner<NotificationNode> is !null: UnsafeUnpin,
PhantomData<RcInner<NotificationNode>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<(AnyElement, ())>: UnsafeUnpin,
PhantomData<(EntityId, Subscription)>: UnsafeUnpin,
PhantomData<(AnyElement, Option<Rc<dyn Any>>)>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> ElementBase for Twhere
T: Element,
impl<T> ElementBase for Twhere
T: Element,
Source§fn rebuild(self: Handle<Self>, app: &mut App, force: bool)
fn rebuild(self: Handle<Self>, app: &mut App, force: bool)
Element.rebuild for an element whose type is known: calls its
perform_rebuild directly rather than through the vtable,
so a first build adds no frame on the way down the tree.Source§fn render_object_attaching_child(
self: Handle<Self>,
app: &App,
) -> Option<AnyElement>
fn render_object_attaching_child( self: Handle<Self>, app: &App, ) -> Option<AnyElement>
Element.renderObjectAttachingChild: the single child, if any.Source§fn mount(
self: Handle<Self>,
app: &mut App,
parent: Option<AnyElement>,
new_slot: Option<Slot>,
)
fn mount( self: Handle<Self>, app: &mut App, parent: Option<AnyElement>, new_slot: Option<Slot>, )
Element.mount.Source§fn attach_render_object(
self: Handle<Self>,
app: &mut App,
new_slot: Option<Slot>,
)
fn attach_render_object( self: Handle<Self>, app: &mut App, new_slot: Option<Slot>, )
Element.attachRenderObject.Source§fn detach_render_object(self: Handle<Self>, app: &mut App)
fn detach_render_object(self: Handle<Self>, app: &mut App)
Element.detachRenderObject.Source§fn deactivate(self: Handle<Self>, app: &mut App)
fn deactivate(self: Handle<Self>, app: &mut App)
Element.deactivate.Source§fn perform_rebuild(self: Handle<Self>, app: &mut App)
fn perform_rebuild(self: Handle<Self>, app: &mut App)
Element.performRebuild: clears the dirty flag.Source§fn did_change_dependencies(self: Handle<Self>, app: &mut App)
fn did_change_dependencies(self: Handle<Self>, app: &mut App)
Element.didChangeDependencies.Source§fn attach_notification_tree(self: Handle<Self>, app: &mut App)
fn attach_notification_tree(self: Handle<Self>, app: &mut App)
Element.attachNotificationTree: inherit the parent’s notification chain.Source§fn build_scope(self: Handle<Self>, app: &App) -> Handle<BuildScope>
fn build_scope(self: Handle<Self>, app: &App) -> Handle<BuildScope>
Element.buildScope: the scope inherited from the parent at mount.Source§fn mark_needs_build(self: Handle<Self>, app: &mut App)
fn mark_needs_build(self: Handle<Self>, app: &mut App)
Element.markNeedsBuild.Source§fn update_inheritance(self: Handle<Self>, app: &mut App)
fn update_inheritance(self: Handle<Self>, app: &mut App)
Element._updateInheritance.Source§fn render_object(self: Handle<Self>, app: &App) -> Option<AnyRenderObject>
fn render_object(self: Handle<Self>, app: &App) -> Option<AnyRenderObject>
Element.renderObject: walk down through the attaching children.