pub struct TextElement {
pub content: String,
pub font_size: Option<f64>,
pub font_weight: Option<FontWeight>,
pub font_design: Option<FontDesign>,
pub text_style: Option<TextStyle>,
pub color: Option<ColorValue>,
pub alignment: Option<TextAlignment>,
pub line_limit: Option<u32>,
pub style: ElementStyle,
}Expand description
Text label with optional semantic typography.
Fields§
§content: StringString to display.
font_size: Option<f64>Font size in points (overridden by textStyle when set).
font_weight: Option<FontWeight>Font weight.
font_design: Option<FontDesign>Font design (default, monospaced, rounded, serif).
text_style: Option<TextStyle>Semantic text style (uses Dynamic Type on Apple, sp on Android).
Overrides fontSize when set.
color: Option<ColorValue>Text color.
alignment: Option<TextAlignment>Text alignment within the line.
line_limit: Option<u32>Maximum number of lines before truncation.
style: ElementStyleShared visual style (padding, background, frame, …).
Implementations§
Source§impl TextElement
impl TextElement
Sourcepub fn font_size(self, size: f64) -> Self
pub fn font_size(self, size: f64) -> Self
Set explicit point size (ignored when text_style is set).
Sourcepub fn font_weight(self, weight: FontWeight) -> Self
pub fn font_weight(self, weight: FontWeight) -> Self
Set font weight.
Sourcepub fn color(self, color: impl Into<ColorValue>) -> Self
pub fn color(self, color: impl Into<ColorValue>) -> Self
Set text color.
Trait Implementations§
Source§impl Clone for TextElement
impl Clone for TextElement
Source§fn clone(&self) -> TextElement
fn clone(&self) -> TextElement
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 moreSource§impl Debug for TextElement
impl Debug for TextElement
Source§impl Default for TextElement
impl Default for TextElement
Source§fn default() -> TextElement
fn default() -> TextElement
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TextElement
impl<'de> Deserialize<'de> for TextElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<TextElement> for WidgetElement
impl From<TextElement> for WidgetElement
Source§fn from(value: TextElement) -> Self
fn from(value: TextElement) -> Self
Converts to this type from the input type.
Source§impl JsonSchema for TextElement
impl JsonSchema for TextElement
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreAuto Trait Implementations§
impl Freeze for TextElement
impl RefUnwindSafe for TextElement
impl Send for TextElement
impl Sync for TextElement
impl Unpin for TextElement
impl UnsafeUnpin for TextElement
impl UnwindSafe for TextElement
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
Mutably borrows from an owned value. Read more