Skip to main content

Paragraph

Trait Paragraph 

Source
pub trait Paragraph: Sized + Default {
Show 26 methods // Required methods fn with_text(text: Text<&str>) -> Self; fn with_spans<Link>(text: Text<&[Span<'_, Link>]>) -> Self; fn resize(&mut self, new_bounds: Size); fn compare(&self, text: Text<()>) -> Difference; fn size(&self) -> Pixels; fn hint_factor(&self) -> Option<f32>; fn font(&self) -> Font; fn line_height(&self) -> LineHeight; fn align_x(&self) -> Alignment; fn align_y(&self) -> Vertical; fn wrapping(&self) -> Wrapping; fn ellipsis(&self) -> Ellipsis; fn shaping(&self) -> Shaping; fn bounds(&self) -> Size; fn min_bounds(&self) -> Size; fn hit_test(&self, point: Point) -> Option<Hit>; fn hit_span(&self, point: Point) -> Option<usize>; fn span_bounds(&self, index: usize) -> Vec<Rectangle>; fn select(&mut self, start: Point, end: Point, target: Target); fn select_all(&mut self); fn deselect(&mut self); fn selection(&self) -> &[Rectangle]; fn copy(&mut self) -> Option<String>; // Provided methods fn hit_glyph(&self, point: Point) -> bool { ... } fn min_width(&self) -> f32 { ... } fn min_height(&self) -> f32 { ... }
}
Expand description

A text paragraph.

Required Methods§

Source

fn with_text(text: Text<&str>) -> Self

Creates a new Paragraph laid out with the given Text.

Source

fn with_spans<Link>(text: Text<&[Span<'_, Link>]>) -> Self

Creates a new Paragraph laid out with the given Text.

Source

fn resize(&mut self, new_bounds: Size)

Lays out the Paragraph with some new boundaries.

Source

fn compare(&self, text: Text<()>) -> Difference

Compares the Paragraph with some desired Text and returns the Difference.

Source

fn size(&self) -> Pixels

Returns the text size of the Paragraph in Pixels.

Source

fn hint_factor(&self) -> Option<f32>

Returns the hint factor of the Paragraph.

Source

fn font(&self) -> Font

Returns the Font of the Paragraph.

Source

fn line_height(&self) -> LineHeight

Returns the LineHeight of the Paragraph.

Source

fn align_x(&self) -> Alignment

Returns the horizontal alignment of the Paragraph.

Source

fn align_y(&self) -> Vertical

Returns the vertical alignment of the Paragraph.

Source

fn wrapping(&self) -> Wrapping

Returns the Wrapping strategy of the Paragraph>

Source

fn ellipsis(&self) -> Ellipsis

Returns the Ellipsis strategy of the Paragraph>

Source

fn shaping(&self) -> Shaping

Returns the Shaping strategy of the Paragraph>

Source

fn bounds(&self) -> Size

Returns the available bounds used to layout the Paragraph.

Source

fn min_bounds(&self) -> Size

Returns the minimum boundaries that can fit the contents of the Paragraph.

Source

fn hit_test(&self, point: Point) -> Option<Hit>

Tests whether the provided point is within the boundaries of the Paragraph, returning information about the nearest character.

Source

fn hit_span(&self, point: Point) -> Option<usize>

Tests whether the provided point is within the boundaries of a Span in the Paragraph, returning the index of the Span that was hit.

Source

fn span_bounds(&self, index: usize) -> Vec<Rectangle>

Returns all bounds for the provided Span index of the Paragraph. A Span can have multiple bounds for each line it’s on.

Source

fn select(&mut self, start: Point, end: Point, target: Target)

Selects the text between the given positions.

The positions are relative to the origin of the Paragraph. start is the position where the selection began, while end is its final position. The Target determines how the selection is expanded around these positions.

Source

fn select_all(&mut self)

Selects all the text of the Paragraph.

Source

fn deselect(&mut self)

Deselects any selected text.

Source

fn selection(&self) -> &[Rectangle]

Returns the regions of the current selection of the Paragraph.

Each Rectangle corresponds to a line of the selection.

Source

fn copy(&mut self) -> Option<String>

Returns the current selected text of the Paragraph.

Provided Methods§

Source

fn hit_glyph(&self, point: Point) -> bool

Tests whether the provided point is inside the boundaries of a glyph in the Paragraph.

Source

fn min_width(&self) -> f32

Returns the minimum width that can fit the contents of the Paragraph.

Source

fn min_height(&self) -> f32

Returns the minimum height that can fit the contents of the Paragraph.

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.

Implementations on Foreign Types§

Source§

impl Paragraph for ()

Source§

fn with_text(_text: Text<&str>) -> Self

Source§

fn with_spans<Link>(_text: Text<&[Span<'_, Link>]>) -> Self

Source§

fn resize(&mut self, _new_bounds: Size)

Source§

fn compare(&self, _text: Text<()>) -> Difference

Source§

fn hint_factor(&self) -> Option<f32>

Source§

fn size(&self) -> Pixels

Source§

fn font(&self) -> Font

Source§

fn line_height(&self) -> LineHeight

Source§

fn align_x(&self) -> Alignment

Source§

fn align_y(&self) -> Vertical

Source§

fn wrapping(&self) -> Wrapping

Source§

fn ellipsis(&self) -> Ellipsis

Source§

fn shaping(&self) -> Shaping

Source§

fn bounds(&self) -> Size

Source§

fn min_bounds(&self) -> Size

Source§

fn hit_test(&self, _point: Point) -> Option<Hit>

Source§

fn hit_span(&self, _point: Point) -> Option<usize>

Source§

fn span_bounds(&self, _index: usize) -> Vec<Rectangle>

Source§

fn select(&mut self, _start: Point, _end: Point, _target: Target)

Source§

fn select_all(&mut self)

Source§

fn deselect(&mut self)

Source§

fn selection(&self) -> &[Rectangle]

Source§

fn copy(&mut self) -> Option<String>

Implementors§