Struct freya_native_core::real_dom::NodeMut

source ·
pub struct NodeMut<'a, V: FromAnyValue + Send + Sync = ()> { /* private fields */ }
Expand description

A mutable refrence to a node in the RealDom that tracks what States need to be updated

Implementations§

source§

impl<'a, V: FromAnyValue + Send + Sync> NodeMut<'a, V>

source

pub fn new(id: NodeId, dom: &'a mut RealDom<V>) -> Self

Create a new mutable refrence to a node in a RealDom

source§

impl<'a, V: FromAnyValue + Send + Sync> NodeMut<'a, V>

source

pub fn real_dom_mut(&mut self) -> &mut RealDom<V>

Get the real dom this node was created in mutably

source

pub fn get_mut<T: Component<Tracking = Untracked> + Sync + Send>( &mut self, ) -> Option<ViewEntryMut<'_, T>>

Get a component from the current node mutably

source

pub fn insert<T: Component + Sync + Send>(&mut self, value: T)

Insert a custom component into this node

Note: Components that implement State and are added when the RealDom is created will automatically be created

source

pub fn add_child(&mut self, child: NodeId)

Add the given node to the end of this nodes children

source

pub fn insert_after(&mut self, old: NodeId)

Insert this node after the given node

source

pub fn insert_before(&mut self, old: NodeId)

Insert this node before the given node

source

pub fn remove(&mut self)

Remove this node from the RealDom

source

pub fn add_event_listener(&mut self, event: EventName)

Add an event listener

source

pub fn remove_event_listener(&mut self, event: &EventName)

Remove an event listener

source

pub fn node_type_mut(&mut self) -> NodeTypeMut<'_, V>

Get a mutable reference to the type of the current node

source

pub fn set_type(&mut self, new: NodeType<V>)

Set the type of the current node

source

pub fn clone_node(&mut self) -> NodeId

Clone a node and it’s children and returns the id of the new node. This is more effecient than creating the node from scratch because it can pre-allocate the memory required.

Trait Implementations§

source§

impl<'a, V: FromAnyValue + Send + Sync> NodeImmutable<V> for NodeMut<'a, V>

source§

fn real_dom(&self) -> &RealDom<V>

Get the real dom this node was created in
source§

fn id(&self) -> NodeId

Get the id of the current node
source§

fn node_type(&self) -> ViewEntry<'_, NodeType<V>>

Get the type of the current node
source§

fn get<'a, T: Component + Sync + Send>(&'a self) -> Option<ViewEntry<'a, T>>

Get a component from the current node
source§

fn children_ids_advanced( &self, id: NodeId, enter_shadow_dom: bool, ) -> Vec<NodeId>

Get the ids of the children of the current node, if enter_shadow_dom is true and the current node is a shadow slot, the ids of the nodes under the node the shadow slot is attached to will be returned
source§

fn child_ids(&self) -> Vec<NodeId>

Get the ids of the children of the current node
source§

fn children(&self) -> Vec<NodeRef<'_, V>>

Get the children of the current node
source§

fn parent_id(&self) -> Option<NodeId>

Get the id of the parent of the current node
source§

fn parent(&self) -> Option<NodeRef<'_, V>>

Get the parent of the current node
source§

fn height(&self) -> u16

Get the height of the current node in the tree (the number of nodes between the current node and the root)

Auto Trait Implementations§

§

impl<'a, V> Freeze for NodeMut<'a, V>

§

impl<'a, V = ()> !RefUnwindSafe for NodeMut<'a, V>

§

impl<'a, V> Send for NodeMut<'a, V>

§

impl<'a, V> Sync for NodeMut<'a, V>

§

impl<'a, V> Unpin for NodeMut<'a, V>

§

impl<'a, V = ()> !UnwindSafe for NodeMut<'a, V>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T, V> NodeImmutableDioxusExt<V> for T
where T: NodeImmutable<V>, V: FromAnyValue + Send + Sync,

source§

fn mounted_id(&self) -> Option<ElementId>

Returns the id of the element that this node is mounted to. Not all nodes are mounted to an element, only nodes with dynamic content that have been renderered will have an id.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

§

fn super_from(input: T) -> O

Convert from a type to another type.
§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

§

fn super_into(self) -> O

Convert from a type to another type.
source§

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

§

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>,

§

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more