Trait LayoutPartialTree

Source
pub trait LayoutPartialTree: TraversePartialTree {
    type CoreContainerStyle<'a>: CoreStyle<CustomIdent = Self::CustomIdent>
       where Self: 'a;
    type CustomIdent: CheapCloneStr;

    // Required methods
    fn get_core_container_style(
        &self,
        node_id: NodeId,
    ) -> Self::CoreContainerStyle<'_>;
    fn set_unrounded_layout(&mut self, node_id: NodeId, layout: &Layout);
    fn compute_child_layout(
        &mut self,
        node_id: NodeId,
        inputs: LayoutInput,
    ) -> LayoutOutput;

    // Provided method
    fn resolve_calc_value(&self, val: *const (), basis: f32) -> f32 { ... }
}
Expand description

Any type that implements LayoutPartialTree can be laid out using Taffy’s algorithms

Note that this trait extends TraversePartialTree (not TraverseTree). Taffy’s algorithm implementations have been designed such that they can be used for a laying out a single node that only has access to it’s immediate children.

Required Associated Types§

Source

type CoreContainerStyle<'a>: CoreStyle<CustomIdent = Self::CustomIdent> where Self: 'a

The style type representing the core container styles that all containers should have Used when laying out the root node of a tree

Source

type CustomIdent: CheapCloneStr

String type for representing “custom identifiers” (for example, named grid lines or areas) If you are unsure what to use here then consider Arc<str>.

Required Methods§

Source

fn get_core_container_style( &self, node_id: NodeId, ) -> Self::CoreContainerStyle<'_>

Get core style

Source

fn set_unrounded_layout(&mut self, node_id: NodeId, layout: &Layout)

Set the node’s unrounded layout

Source

fn compute_child_layout( &mut self, node_id: NodeId, inputs: LayoutInput, ) -> LayoutOutput

Compute the specified node’s size or full layout given the specified constraints

Provided Methods§

Source

fn resolve_calc_value(&self, val: *const (), basis: f32) -> f32

Resolve calc value

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§