pub struct TextPreset { /* private fields */ }Expand description
A named text style an app applies to many labels: label(t).preset(&CAPTION) for
const CAPTION: TextPreset = TextPreset::new(Font::Caption).secondary();. Every builder is
const, so a preset is a constant, not a runtime value, and it composes the same
LabelBuilder steps a chain would (docs/text.md).
Implementations§
Source§impl TextPreset
impl TextPreset
Sourcepub const fn new(font: Font) -> TextPreset
pub const fn new(font: Font) -> TextPreset
A preset in font, with nothing else set.
Sourcepub const fn font_scale(self, scale: f64) -> TextPreset
pub const fn font_scale(self, scale: f64) -> TextPreset
Scale the resolved font, as LabelBuilder::font_scale.
Sourcepub const fn weight(self, weight: FontWeight) -> TextPreset
pub const fn weight(self, weight: FontWeight) -> TextPreset
The font weight, as LabelBuilder::weight.
Sourcepub const fn bold(self) -> TextPreset
pub const fn bold(self) -> TextPreset
Shorthand for .weight(FontWeight::Bold).
pub const fn italic(self) -> TextPreset
pub const fn tabular(self) -> TextPreset
pub const fn monospace(self) -> TextPreset
Sourcepub const fn secondary(self) -> TextPreset
pub const fn secondary(self) -> TextPreset
The platform’s secondary label color, as Label::secondary.
pub const fn single_line(self) -> TextPreset
Sourcepub const fn color(self, color: Color) -> TextPreset
pub const fn color(self, color: Color) -> TextPreset
A fixed text color. Prefer secondary for de-emphasis, which follows
the appearance; a fixed color is for meaning (a warning, a brand).
Trait Implementations§
Source§impl Clone for TextPreset
impl Clone for TextPreset
Source§fn clone(&self) -> TextPreset
fn clone(&self) -> TextPreset
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TextPreset
Source§impl Debug for TextPreset
impl Debug for TextPreset
Source§impl PartialEq for TextPreset
impl PartialEq for TextPreset
impl StructuralPartialEq for TextPreset
Auto Trait Implementations§
impl Freeze for TextPreset
impl RefUnwindSafe for TextPreset
impl Send for TextPreset
impl Sync for TextPreset
impl Unpin for TextPreset
impl UnsafeUnpin for TextPreset
impl UnwindSafe for TextPreset
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more