Struct embedded_graphics::text::Text
source · [−]pub struct Text<'a, S> {
pub text: &'a str,
pub position: Point,
pub character_style: S,
pub text_style: TextStyle,
}
Expand description
Text drawable.
A text drawable can be used to draw text to a draw target.
See the module-level documentation for more information about text drawables and examples.
Fields
text: &'a str
The string.
position: Point
The position.
character_style: S
The character style.
text_style: TextStyle
The text style.
Implementations
sourceimpl<'a, S> Text<'a, S>
impl<'a, S> Text<'a, S>
sourcepub const fn new(text: &'a str, position: Point, character_style: S) -> Self
pub const fn new(text: &'a str, position: Point, character_style: S) -> Self
Creates a text drawable with the default text style.
sourcepub const fn with_text_style(
text: &'a str,
position: Point,
character_style: S,
text_style: TextStyle
) -> Self
pub const fn with_text_style(
text: &'a str,
position: Point,
character_style: S,
text_style: TextStyle
) -> Self
Creates a text drawable with the given text style.
sourcepub const fn with_baseline(
text: &'a str,
position: Point,
character_style: S,
baseline: Baseline
) -> Self
pub const fn with_baseline(
text: &'a str,
position: Point,
character_style: S,
baseline: Baseline
) -> Self
Creates a text drawable with the given baseline.
sourcepub const fn with_alignment(
text: &'a str,
position: Point,
character_style: S,
alignment: Alignment
) -> Self
pub const fn with_alignment(
text: &'a str,
position: Point,
character_style: S,
alignment: Alignment
) -> Self
Creates a text drawable with the given alignment.
Trait Implementations
sourceimpl<S: TextRenderer> Dimensions for Text<'_, S>
impl<S: TextRenderer> Dimensions for Text<'_, S>
sourcefn bounding_box(&self) -> Rectangle
fn bounding_box(&self) -> Rectangle
Returns the bounding box.
sourceimpl<S: TextRenderer> Drawable for Text<'_, S>
impl<S: TextRenderer> Drawable for Text<'_, S>
sourceimpl<'a, S: Ord> Ord for Text<'a, S>
impl<'a, S: Ord> Ord for Text<'a, S>
sourceimpl<'a, S: PartialOrd> PartialOrd<Text<'a, S>> for Text<'a, S>
impl<'a, S: PartialOrd> PartialOrd<Text<'a, S>> for Text<'a, S>
sourcefn partial_cmp(&self, other: &Text<'a, S>) -> Option<Ordering>
fn partial_cmp(&self, other: &Text<'a, S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<'a, S: Copy> Copy for Text<'a, S>
impl<'a, S: Eq> Eq for Text<'a, S>
impl<'a, S> StructuralEq for Text<'a, S>
impl<'a, S> StructuralPartialEq for Text<'a, S>
Auto Trait Implementations
impl<'a, S> RefUnwindSafe for Text<'a, S> where
S: RefUnwindSafe,
impl<'a, S> Send for Text<'a, S> where
S: Send,
impl<'a, S> Sync for Text<'a, S> where
S: Sync,
impl<'a, S> Unpin for Text<'a, S> where
S: Unpin,
impl<'a, S> UnwindSafe for Text<'a, S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcepub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
pub fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcepub fn checked_cast_from(src: Src) -> Option<Dst>
pub fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcepub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcepub fn overflowing_cast_from(src: Src) -> (Dst, bool)
pub fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcepub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
pub fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcepub fn saturating_cast_from(src: Src) -> Dst
pub fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcepub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
pub fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcepub fn unwrapped_cast_from(src: Src) -> Dst
pub fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcepub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
pub fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcepub fn wrapping_cast_from(src: Src) -> Dst
pub fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.