Trait Paragraph
pub trait Paragraph: Sized + Default {
type Font: Copy + PartialEq;
Show 19 methods
// Required methods
fn with_text(text: Text<&str, Self::Font>) -> Self;
fn with_spans<Link>(
text: Text<&[Span<'_, Link, Self::Font>], Self::Font>,
) -> Self;
fn resize(&mut self, new_bounds: Size);
fn compare(&self, text: Text<(), Self::Font>) -> Difference;
fn size(&self) -> Pixels;
fn font(&self) -> Self::Font;
fn line_height(&self) -> LineHeight;
fn align_x(&self) -> Alignment;
fn align_y(&self) -> Vertical;
fn wrapping(&self) -> Wrapping;
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 grapheme_position(&self, line: usize, index: usize) -> Option<Point>;
// Provided methods
fn min_width(&self) -> f32 { ... }
fn min_height(&self) -> f32 { ... }
}Available on crate feature
advanced only.Expand description
A text paragraph.
Required Associated Types§
Required Methods§
fn with_spans<Link>(
text: Text<&[Span<'_, Link, Self::Font>], Self::Font>,
) -> Self
fn with_spans<Link>( text: Text<&[Span<'_, Link, Self::Font>], Self::Font>, ) -> Self
fn compare(&self, text: Text<(), Self::Font>) -> Difference
fn compare(&self, text: Text<(), Self::Font>) -> Difference
Compares the Paragraph with some desired Text and returns the
Difference.
fn line_height(&self) -> LineHeight
fn line_height(&self) -> LineHeight
Returns the LineHeight of the Paragraph.
fn min_bounds(&self) -> Size
fn min_bounds(&self) -> Size
Returns the minimum boundaries that can fit the contents of the
Paragraph.
fn hit_test(&self, point: Point) -> Option<Hit>
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.
fn span_bounds(&self, index: usize) -> Vec<Rectangle>
fn span_bounds(&self, index: usize) -> Vec<Rectangle>
Provided Methods§
fn min_height(&self) -> f32
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.