pub struct TextArgsBuilder { /* private fields */ }
Expand description
Builder for TextArgs
.
Implementations§
Source§impl TextArgsBuilder
impl TextArgsBuilder
Sourcepub fn text(self, value: String) -> Self
pub fn text(self, value: String) -> Self
The text content to be rendered.
This is the actual string that will be displayed on screen. It can contain Unicode characters and will be rendered using the specified font properties.
Sourcepub fn color(self, value: Color) -> Self
pub fn color(self, value: Color) -> Self
The color of the text.
Defaults to Color::BLACK
if not specified. The color is applied uniformly
to all characters in the text string.
Sourcepub fn size(self, value: Dp) -> Self
pub fn size(self, value: Dp) -> Self
The font size in density-independent pixels (dp).
Defaults to Dp(25.0)
if not specified. This size is automatically scaled
based on the device’s pixel density to ensure consistent visual appearance
across different screen densities.
Sourcepub fn line_height(self, value: Dp) -> Self
pub fn line_height(self, value: Dp) -> Self
Optional override for line height in density-independent pixels (dp).
If not specified (None), the line height will automatically be calculated as 1.2 times the font size, which provides good readability for most text.
Set this to a specific value if you need precise control over line spacing, such as for dense layouts or specific design requirements.
§Example
use tessera_ui_basic_components::text::TextArgsBuilder;
use tessera_ui::Dp;
// Automatic line height (1.2 × size)
let auto = TextArgsBuilder::default()
.text("Auto spacing".to_string())
.size(Dp(20.0)) // line_height will be Dp(24.0)
.build()
.unwrap();
// Custom line height
let custom = TextArgsBuilder::default()
.text("Custom spacing".to_string())
.size(Dp(20.0))
.line_height(Dp(30.0)) // Explicit line height
.build()
.unwrap();
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextArgsBuilder
impl RefUnwindSafe for TextArgsBuilder
impl Send for TextArgsBuilder
impl Sync for TextArgsBuilder
impl Unpin for TextArgsBuilder
impl UnwindSafe for TextArgsBuilder
Blanket Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.