Struct Text

Source
pub struct Text { /* private fields */ }
Expand description

A text label.

Implementations§

Source§

impl Text

Source

pub fn new(content: impl Into<String>) -> Text

Examples found in repository?
examples/hello.rs (line 13)
11    fn body(&self) -> Self::Body {
12        VStack::new((
13            Text::new("Hello"),
14            Text::new("World"),
15        ))
16    }
More examples
Hide additional examples
examples/adwaita.rs (line 7)
5fn main() {
6    nuit::run_app(
7        ConfigBuilder::from(Text::new("Hello Adwaita!"))
8            .preferred_backend(Backend::Adwaita)
9    );
10}
examples/list.rs (line 13)
11    fn body(&self) -> Self::Body {
12        List::new((
13            Text::new("Hello, world!"),
14            Text::new("This is an item."),
15            Text::new("This is another."),
16            Text::new("You get the idea."),
17        ))
18    }
examples/nested.rs (line 38)
35    fn body(&self) -> Self::Body {
36        let count = self.count.clone();
37        VStack::new((
38            Text::new(format!("Count: {}", count.get())),
39            IncrementView::new(move || {
40                count.set(count.get() + 1);
41            })
42        ))
43    }
examples/counter.rs (line 16)
13    fn body(&self) -> Self::Body {
14        let count = self.count.clone();
15        VStack::new((
16            Text::new(format!("Count: {}", count.get())),
17            Button::with_text("Increment", move || {
18                count.set(count.get() + 1);
19            })
20        ))
21    }
examples/loops.rs (line 15)
11    fn body(&self) -> Self::Body {
12        VStack::new((
13            HStack::new(
14                ForEach::new(["Hello", "World"], |s| {
15                    Text::new(s)
16                }),
17            ),
18            HStack::new(
19                ForEach::new(0..10, |i| {
20                    Text::new(format!("{i}"))
21                })
22            ),
23        ))
24    }

Trait Implementations§

Source§

impl Bind for Text

Source§

fn bind(&self, context: &Context)

Source§

impl Clone for Text

Source§

fn clone(&self) -> Text

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Text

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Text

Source§

fn eq(&self, other: &Text) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl View for Text

Source§

fn fire(&self, _event: &Event, _id_path: &IdPath, _context: &Context)

Source§

fn render(&self, _context: &Context) -> Node

Source§

type Body = NeverView

Source§

fn body(&self) -> Self::Body

Source§

impl Eq for Text

Source§

impl StructuralPartialEq for Text

Auto Trait Implementations§

§

impl Freeze for Text

§

impl RefUnwindSafe for Text

§

impl Send for Text

§

impl Sync for Text

§

impl Unpin for Text

§

impl UnwindSafe for Text

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> IdentifyExt for T

Source§

fn identify(self, id: impl Into<Id>) -> Identified<T>

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ViewExt for T
where T: View,

Source§

fn modifier(self, modifier: ModifierNode) -> Modified<Self>

Source§

fn gesture<G>(self, gesture: G) -> Gestured<Self, G>
where G: Gesture,

Source§

fn on_taps<F>(self, count: usize, action: F) -> Gestured<Self, TapGesture<F>>
where F: Fn(),

Source§

fn on_tap<F>(self, action: F) -> Gestured<Self, TapGesture<F>>
where F: Fn(),

Source§

fn on_drag_by<F>( self, minimum_distance: impl Into<f64>, action: F, ) -> Gestured<Self, DragGesture<F>>
where F: Fn(&DragEvent),

Source§

fn on_drag<F>(self, action: F) -> Gestured<Self, DragGesture<F>>
where F: Fn(&DragEvent),

Source§

fn overlay_at<O>(self, alignment: Alignment, overlayed: O) -> Overlay<Self, O>
where O: View,

Source§

fn overlay<O>(self, overlayed: O) -> Overlay<Self, O>
where O: View,

Source§

fn padding(self, insets: impl Into<Insets>) -> Modified<Self>

Source§

fn position(self, position: Vec2<f64>) -> Modified<Self>

Source§

fn offset(self, delta: Vec2<f64>) -> Modified<Self>

Source§

fn opacity(self, opacity: impl Into<f64>) -> Modified<Self>

Source§

fn frame_with( self, alignment: Alignment, frame: impl Into<Frame>, ) -> Modified<Self>

Source§

fn frame(self, frame: impl Into<Frame>) -> Modified<Self>

Source§

fn font(self, font: impl Into<Font>) -> Modified<Self>

Source§

fn foreground_style(self, style: impl Into<Style>) -> Modified<Self>

Source§

fn scale_effect_around( self, anchor: UnitPoint, factor: impl Into<f64>, ) -> Modified<Self>

Source§

fn scale_effect(self, factor: impl Into<f64>) -> Modified<Self>

Source§

fn rotation_effect_around( self, anchor: UnitPoint, angle: impl Into<Angle>, ) -> Modified<Self>

Source§

fn rotation_effect(self, angle: impl Into<Angle>) -> Modified<Self>

Source§

fn on_appear(self, action: impl Fn() + 'static) -> Handler<Self, impl Fn(Event)>

Source§

fn on_disappear( self, action: impl Fn() + 'static, ) -> Handler<Self, impl Fn(Event)>