pub struct Text(/* private fields */);Expand description
A word a panel renders: plain text, or a message the request’s
Locale spells.
Every builder that takes a label, a description or a placeholder takes impl Into<Text>, so a
string literal stays plain and a message translates:
TextColumn::new(lens!(Post.title)).label("Headline"); // plain: every locale reads "Headline"
TextColumn::new(lens!(Post.title)).label(Text::message("post-headline"));
TextColumn::new(lens!(Post.title)).label(text!("post-headline")); // the same messageA message names a Fluent message of the panel’s catalogs, or one of its attributes as
id.attribute. Each argument fills the placeable of its name: a number selects a plural
variant, and a Text argument renders in the same locale first.
post-headline = Headline
posts-published = { $count ->
[one] One post published
*[other] { $count } posts published
}A message no catalog of the request’s locale holds reads from the default locale’s, then from English, and one no catalog holds at all renders its id, so a missing translation shows on the page rather than an empty label.
Implementations§
Source§impl Text
impl Text
Sourcepub fn message(id: impl Into<Cow<'static, str>>) -> Self
pub fn message(id: impl Into<Cow<'static, str>>) -> Self
The message id of the panel’s catalogs, or its attribute as id.attribute.
Trait Implementations§
Source§impl AttributeValueViewParts for Text
impl AttributeValueViewParts for Text
Source§fn attribute_present(&self) -> bool
fn attribute_present(&self) -> bool
Source§fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
Source§impl AttributeValueViewParts for &Text
impl AttributeValueViewParts for &Text
Source§fn attribute_present(&self) -> bool
fn attribute_present(&self) -> bool
Source§fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
impl Eq for Text
Source§impl NodeViewParts for Text
A text renders in the request’s locale, in a view!’s content or an attribute’s value.
impl NodeViewParts for Text
A text renders in the request’s locale, in a view!’s content or an attribute’s value.
Source§fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
Source§impl NodeViewParts for &Text
impl NodeViewParts for &Text
Source§fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
fn into_view_parts(self, cx: &Cx, parts: &mut PartsWriter<'_>)
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 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
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
key and return true if they are equal.