InlineMeasure

Trait InlineMeasure 

Source
pub trait InlineMeasure<T: LayoutTreeNode> {
    type InlineUnit: InlineUnit<T, Env = Self::Env>;
    type Env;

    // Required method
    fn block_size(
        env: &mut Self::Env,
        block_node: &T,
        inline_nodes: Vec<InlineUnitMetadata<T>>,
        req_size: OptionSize<T::Length>,
        max_content_with_max_size: OptionSize<T::Length>,
        update_position: bool,
    ) -> (Size<T::Length>, Vec<(Point<T::Length>, MeasureResult<T::Length>)>);
}
Expand description

A helper type to measure inline nodes.

This should be implemented by the text layout engine.

Required Associated Types§

Source

type InlineUnit: InlineUnit<T, Env = Self::Env>

A helper type to represent the current node as an inline node.

Source

type Env

Some custom environment data.

Required Methods§

Source

fn block_size( env: &mut Self::Env, block_node: &T, inline_nodes: Vec<InlineUnitMetadata<T>>, req_size: OptionSize<T::Length>, max_content_with_max_size: OptionSize<T::Length>, update_position: bool, ) -> (Size<T::Length>, Vec<(Point<T::Length>, MeasureResult<T::Length>)>)

Measure a series of inline nodes.

Continous inline nodes will be collected together, and treat as a whole block. The text layout engine should returns:

  • the total size;
  • the position and detailed measure results for each inline node.

The env will be received in measure functions. The block_node is the parent of these inline nodes. If update_position is set, then the returned result will be used as the new layout result.

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§