compose_taffy

Struct TaffyTree

Source
pub struct TaffyTree<'a, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,
{ /* private fields */ }

Implementations§

Source§

impl<'a, T, M> TaffyTree<'a, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source

pub fn new( composer: &'a mut Composer<LayoutNode<T>>, measure_function: M, ) -> Self

Trait Implementations§

Source§

impl<T, M> CacheTree for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

fn cache_get( &self, node_id: NodeId, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, run_mode: RunMode, ) -> Option<LayoutOutput>

Try to retrieve a cached result from the cache
Source§

fn cache_store( &mut self, node_id: NodeId, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, run_mode: RunMode, layout_output: LayoutOutput, )

Store a computed size in the cache
Source§

fn cache_clear(&mut self, node_id: NodeId)

Clear all cache entries for the node
Source§

impl<T, M> LayoutBlockContainer for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

type BlockContainerStyle<'a> = &'a Style where Self: 'a

The style type representing the CSS Block container’s styles
Source§

type BlockItemStyle<'a> = &'a Style where Self: 'a

The style type representing each CSS Block item’s styles
Source§

fn get_block_container_style( &self, node_id: NodeId, ) -> Self::BlockContainerStyle<'_>

Get the container’s styles
Source§

fn get_block_child_style(&self, node_id: NodeId) -> Self::BlockItemStyle<'_>

Get the child’s styles
Source§

impl<T, M> LayoutFlexboxContainer for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

type FlexboxContainerStyle<'a> = &'a Style where Self: 'a

The style type representing the Flexbox container’s styles
Source§

type FlexboxItemStyle<'a> = &'a Style where Self: 'a

The style type representing each Flexbox item’s styles
Source§

fn get_flexbox_container_style( &self, node_id: NodeId, ) -> Self::FlexboxContainerStyle<'_>

Get the container’s styles
Source§

fn get_flexbox_child_style(&self, node_id: NodeId) -> Self::FlexboxItemStyle<'_>

Get the child’s styles
Source§

impl<T, M> LayoutGridContainer for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

type GridContainerStyle<'a> = &'a Style where Self: 'a

The style type representing the CSS Grid container’s styles
Source§

type GridItemStyle<'a> = &'a Style where Self: 'a

The style type representing each CSS Grid item’s styles
Source§

fn get_grid_container_style( &self, node_id: NodeId, ) -> Self::GridContainerStyle<'_>

Get the container’s styles
Source§

fn get_grid_child_style(&self, node_id: NodeId) -> Self::GridItemStyle<'_>

Get the child’s styles
Source§

impl<T, M> LayoutPartialTree for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

type CoreContainerStyle<'a> = &'a Style 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§

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

impl<T, M> PrintTree for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

fn get_debug_label(&self, node_id: NodeId) -> &'static str

Get a debug label for the node (typically the type of node: flexbox, grid, text, image, etc)
Source§

fn get_final_layout(&self, node_id: NodeId) -> &Layout

Get a reference to the node’s final layout
Source§

impl<T, M> RoundTree for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

fn get_unrounded_layout(&self, node_id: NodeId) -> &Layout

Get the node’s unrounded layout
Source§

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

Get a reference to the node’s final layout
Source§

impl<T, M> TraversePartialTree for TaffyTree<'_, T, M>
where T: 'static, M: FnMut(Size<Option<f32>>, Size<AvailableSpace>, NodeId, Option<&mut T>, &Style) -> Size<f32>,

Source§

type ChildIter<'a> = ChildIter<'a> where Self: 'a

Type representing an iterator of the children of a node
Source§

fn child_ids(&self, node_id: NodeId) -> Self::ChildIter<'_>

Get the list of children IDs for the given node
Source§

fn child_count(&self, node_id: NodeId) -> usize

Get the number of children for the given node
Source§

fn get_child_id(&self, node_id: NodeId, child_index: usize) -> NodeId

Get a specific child of a node, where the index represents the nth child
Source§

impl<T, M> TraverseTree for TaffyTree<'_, T, M>

Auto Trait Implementations§

§

impl<'a, T, M> Freeze for TaffyTree<'a, T, M>
where M: Freeze,

§

impl<'a, T, M> !RefUnwindSafe for TaffyTree<'a, T, M>

§

impl<'a, T, M> !Send for TaffyTree<'a, T, M>

§

impl<'a, T, M> !Sync for TaffyTree<'a, T, M>

§

impl<'a, T, M> Unpin for TaffyTree<'a, T, M>
where M: Unpin,

§

impl<'a, T, M> !UnwindSafe for TaffyTree<'a, T, M>

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.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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

Source§

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.