Skip to main content

LayoutPartialTree

Trait LayoutPartialTree 

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§

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

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§

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

Get core style

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

Set the node’s unrounded layout

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§

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§