[][src]Struct ggez::graphics::TextFragment

pub struct TextFragment {
    pub text: String,
    pub color: Option<Color>,
    pub font: Option<Font>,
    pub scale: Option<Scale>,
}

A piece of text with optional color, font and font scale information. Drawing text generally involves one or more of these. These options take precedence over any similar field/argument. Implements From for char, &str, String and (String, Font, Scale).

Fields

text: String

Text string itself.

color: Option<Color>

Fragment's color, defaults to text's color.

font: Option<Font>

Fragment's font, defaults to text's font.

scale: Option<Scale>

Fragment's scale, defaults to text's scale.

Methods

impl TextFragment[src]

pub fn new<T: Into<Self>>(text: T) -> Self[src]

Creates a new fragment from String or &str.

pub fn color(self, color: Color) -> TextFragment[src]

Set fragment's color, overrides text's color.

pub fn font(self, font: Font) -> TextFragment[src]

Set fragment's font, overrides text's font.

pub fn scale(self, scale: Scale) -> TextFragment[src]

Set fragment's scale, overrides text's scale.

Trait Implementations

impl<'a> From<&'a str> for TextFragment[src]

impl From<char> for TextFragment[src]

impl From<String> for TextFragment[src]

impl<T> From<(T, Font, f32)> for TextFragment where
    T: Into<TextFragment>, 
[src]

impl Clone for TextFragment[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for TextFragment[src]

impl Debug for TextFragment[src]

Auto Trait Implementations

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> Erased for T

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.