Struct Text

Source
pub struct Text<Content = String, Font = Font> {
    pub content: Content,
    pub bounds: Size,
    pub size: Pixels,
    pub line_height: LineHeight,
    pub font: Font,
    pub align_x: Alignment,
    pub align_y: Vertical,
    pub shaping: Shaping,
    pub wrapping: Wrapping,
}
Expand description

A paragraph.

Fields§

§content: Content

The content of the paragraph.

§bounds: Size

The bounds of the paragraph.

§size: Pixels

The size of the Text in logical pixels.

§line_height: LineHeight

The line height of the Text.

§font: Font

The font of the Text.

§align_x: Alignment

The horizontal alignment of the Text.

§align_y: Vertical

The vertical alignment of the Text.

§shaping: Shaping

The Shaping strategy of the Text.

§wrapping: Wrapping

The Wrapping strategy of the Text.

Implementations§

Source§

impl<Content, Font> Text<Content, Font>
where Font: Copy,

Source

pub fn with_content<T>(&self, content: T) -> Text<T, Font>

Returns a new Text replacing only the content with the given value.

Source§

impl<Content, Font> Text<Content, Font>
where Content: AsRef<str>, Font: Copy,

Source

pub fn as_ref(&self) -> Text<&str, Font>

Returns a borrowed version of Text.

Trait Implementations§

Source§

impl<Content: Clone, Font: Clone> Clone for Text<Content, Font>

Source§

fn clone(&self) -> Text<Content, Font>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Content: Debug, Font: Debug> Debug for Text<Content, Font>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Content: Copy, Font: Copy> Copy for Text<Content, Font>

Auto Trait Implementations§

§

impl<Content, Font> Freeze for Text<Content, Font>
where Content: Freeze, Font: Freeze,

§

impl<Content, Font> RefUnwindSafe for Text<Content, Font>
where Content: RefUnwindSafe, Font: RefUnwindSafe,

§

impl<Content, Font> Send for Text<Content, Font>
where Content: Send, Font: Send,

§

impl<Content, Font> Sync for Text<Content, Font>
where Content: Sync, Font: Sync,

§

impl<Content, Font> Unpin for Text<Content, Font>
where Content: Unpin, Font: Unpin,

§

impl<Content, Font> UnwindSafe for Text<Content, Font>
where Content: UnwindSafe, Font: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T