[][src]Struct pixel_widgets::text::Text

pub struct Text<'a> {
    pub text: Cow<'a, str>,
    pub font: Font,
    pub size: f32,
    pub wrap: TextWrap,
    pub color: Color,
}

A styled paragraph of text

Fields

text: Cow<'a, str>

The text

font: Font

Font to render the text with

size: f32

Font size to render the text with

wrap: TextWrap

Wrapping style to use

color: Color

Color to render the text with

Implementations

impl<'t> Text<'t>[src]

pub fn measure(&self, rect: Option<Rectangle>) -> Rectangle[src]

Measure the size of the text. If a rectangle is supplied and the text wraps, the layout will stay within the width of the given rectangle.

pub fn measure_range(
    &self,
    from: usize,
    to: usize,
    rect: Rectangle
) -> ((f32, f32), (f32, f32))
[src]

Measure the start and end coordinates of some selected glyphs

pub fn hitdetect(&self, cursor: (f32, f32), rect: Rectangle) -> usize[src]

Find out the index of a character where the mouse is.

impl<'a> Text<'a>[src]

pub fn to_owned(&self) -> Text<'static>[src]

Convert a borrowed to text to owned text.

Trait Implementations

impl<'a> Clone for Text<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Text<'a>

impl<'a> Send for Text<'a>

impl<'a> Sync for Text<'a>

impl<'a> Unpin for Text<'a>

impl<'a> UnwindSafe for Text<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.