dioxus_native_core::prelude

Trait State

Source
pub trait State<V: FromAnyValue + Send + Sync = ()>:
    Any
    + Send
    + Sync {
    type ParentDependencies: Dependancy;
    type ChildDependencies: Dependancy;
    type NodeDependencies: Dependancy;

    const NODE_MASK: NodeMaskBuilder<'static>;
    const TRAVERSE_SHADOW_DOM: bool = false;

    // Required methods
    fn update<'a>(
        &mut self,
        node_view: NodeView<'_, V>,
        node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
        parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
        children: Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>,
        context: &SendAnyMap,
    ) -> bool;
    fn create<'a>(
        node_view: NodeView<'_, V>,
        node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>,
        parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>,
        children: Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>,
        context: &SendAnyMap,
    ) -> Self;
    fn workload_system(
        type_id: TypeId,
        dependants: Arc<Dependants>,
        pass_direction: PassDirection,
    ) -> WorkloadSystem;

    // Provided method
    fn to_type_erased() -> TypeErasedState<V>
       where Self: Sized { ... }
}
Expand description

A state that is automatically inserted in a node with dependencies.

Required Associated Constants§

Source

const NODE_MASK: NodeMaskBuilder<'static>

This is a mask of what aspects of the node are required to update this state

Provided Associated Constants§

Source

const TRAVERSE_SHADOW_DOM: bool = false

Does the state traverse into the shadow dom or pass over it. This should be true for layout and false for styles

Required Associated Types§

Source

type ParentDependencies: Dependancy

This is a tuple of (T: State, ..) of states read from the parent required to update this state

Source

type ChildDependencies: Dependancy

This is a tuple of (T: State, ..) of states read from the children required to update this state

Source

type NodeDependencies: Dependancy

This is a tuple of (T: State, ..) of states read from the node required to update this state

Required Methods§

Source

fn update<'a>( &mut self, node_view: NodeView<'_, V>, node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, children: Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>, context: &SendAnyMap, ) -> bool

Update this state in a node, returns if the state was updated

Source

fn create<'a>( node_view: NodeView<'_, V>, node: <Self::NodeDependencies as Dependancy>::ElementBorrowed<'a>, parent: Option<<Self::ParentDependencies as Dependancy>::ElementBorrowed<'a>>, children: Vec<<Self::ChildDependencies as Dependancy>::ElementBorrowed<'a>>, context: &SendAnyMap, ) -> Self

Create a new instance of this state

Source

fn workload_system( type_id: TypeId, dependants: Arc<Dependants>, pass_direction: PassDirection, ) -> WorkloadSystem

Create a workload system for this state

Provided Methods§

Source

fn to_type_erased() -> TypeErasedState<V>
where Self: Sized,

Converts to a type erased version of the trait

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§