Skip to main content

Layouter

Trait Layouter 

Source
pub trait Layouter<W, K, N, T, V, P>
where W: Weave<K, N, T>, K: Hash + Copy + Eq + Ord, N: Node<K, T>,
{ // Required methods fn layout(&mut self, weave: &mut W, sizes: impl FnMut(&K) -> V); fn size(&self) -> V; fn view( &mut self, min: V, max: V, callback: impl FnMut(LayoutItem<K, V, P>), ); }
Expand description

An algorithm which arranges a Weave’s content for graphical rendering in an efficiently accessible form.

§Panics

All panics should be assumed to leave the Layouter and Weave in a malformed state unless otherwise specified by the implementation.

Required Methods§

Source

fn layout(&mut self, weave: &mut W, sizes: impl FnMut(&K) -> V)

Arranges a Weave’s content for graphical rendering using a closure which maps Nodes to their dimensions.

§Panics

Panics if the Weave’s content could not be arranged due to an unsatisfiable constraint or numerical overflow.

May panic if map panics or if the underlying Weave is improperly implemented.

Source

fn size(&self) -> V

Returns the size of the bounding box enclosing the arrangement’s content.

Source

fn view(&mut self, min: V, max: V, callback: impl FnMut(LayoutItem<K, V, P>))

Returns LayoutItems within the specified bounds in the order that they should be rendered.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<K, T, M, S> Layouter<DependentWeave<K, T, M, S>, K, DependentNode<K, T, S>, T, Vec2, ArrayVec<[Vec2; 6]>> for DependentLayouter<K>
where K: Hash + Copy + Eq + Ord + 'static, S: BuildHasher + Default + Clone + 'static,

Source§

impl<K, T, M, S> Layouter<IndependentWeave<K, T, M, S>, K, IndependentNode<K, T, S>, T, Vec2, ArrayVec<[Vec2; 6]>> for IndependentLayouter<K>
where K: Hash + Copy + Eq + Ord + 'static, T: IndependentContents, S: BuildHasher + Default + Clone + 'static,

Source§

impl<W, K, N, T, S> Layouter<W, K, N, T, Vec2, ArrayVec<[Vec2; 6]>> for TopologicalLayouter<K, S>
where W: Weave<K, N, T>, K: Hash + Copy + Eq + Ord + 'static, N: Node<K, T>, S: BuildHasher + Default + Clone + 'static, for<'a> &'a N::From: IntoIterator<Item = &'a K>,