pub struct Text { /* private fields */ }Expand description
Text that wraps to its width, or is cut with … when wrapping is off.
Its look comes from a typography role of the theme (body by default); spans can use
other roles, colour tokens and bold.
Text is not selectable with the mouse by itself: titles, labels and hints are not content to
copy. Make it selectable where it is, e.g. a message or an address, with
ui.add(Text::new(url)).selectable(true) (NodeMut::selectable).
Implementations§
Source§impl Text
impl Text
Sourcepub fn rich(spans: impl IntoIterator<Item = Span>) -> Self
pub fn rich(spans: impl IntoIterator<Item = Span>) -> Self
Text made of differently styled spans.
Sourcepub fn role(self, role: impl Into<String>) -> Self
pub fn role(self, role: impl Into<String>) -> Self
Uses typography role role for the whole text.
Trait Implementations§
impl Eq for Text
impl StructuralPartialEq for Text
Source§impl<Msg: 'static> Widget<Msg> for Text
impl<Msg: 'static> Widget<Msg> for Text
Source§fn measure(&self, _cx: &mut MeasureCx<'_>, available: Size) -> Size
fn measure(&self, _cx: &mut MeasureCx<'_>, available: Size) -> Size
The size the widget wants when it may use up to
available.Source§fn paint_overlay(&self, _cx: &mut PaintCx<'_>, _anchor: Rect)
fn paint_overlay(&self, _cx: &mut PaintCx<'_>, _anchor: Rect)
Draws the widget’s overlay after the whole view was painted, when it asked for one with
PaintCx::request_overlay. anchor is the area the widget was painted in.Source§fn event(&self, _cx: &mut EventCx<'_, Msg>, _event: &Event) -> bool
fn event(&self, _cx: &mut EventCx<'_, Msg>, _event: &Event) -> bool
Handles input. Returns
true when the event was used; unused key and scroll events
bubble to the parent widget.Source§fn children_mut(&mut self) -> &mut [Node<Msg>]
fn children_mut(&mut self) -> &mut [Node<Msg>]
Mutable child nodes, used to assign ids.
Auto Trait Implementations§
impl Freeze for Text
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnsafeUnpin for Text
impl UnwindSafe for Text
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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