Trait freya_native_core::prelude::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 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 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 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

Object Safety§

This trait is not object safe.

Implementors§