pub struct Name { /* private fields */ }Expand description
A control’s accessible name and description.
React Aria’s useField builds aria-describedby by concatenating the
description node’s id and the field-error node’s id
(react-aria/dist/private/label/useField.js); the resulting accessible
description is those two texts, in that order. gpui takes the text
directly, so Self::field performs the same concatenation on the strings.
Implementations§
Source§impl Name
impl Name
Sourcepub fn labelled(label: impl Into<SharedString>) -> Self
pub fn labelled(label: impl Into<SharedString>) -> Self
A control named by a literal string.
Sourcepub fn maybe(label: Option<impl Into<SharedString>>) -> Self
pub fn maybe(label: Option<impl Into<SharedString>>) -> Self
A control named by an optional string, unnamed when it is absent.
Sourcepub fn field(
label: Option<&SharedString>,
description: Option<&SharedString>,
validity: &Validity,
) -> Self
pub fn field( label: Option<&SharedString>, description: Option<&SharedString>, validity: &Validity, ) -> Self
The name and description a field’s own anatomy already computed.
label is the visible crate::field::Label’s text — React Aria
points aria-labelledby at that element, so its text is the name.
description is the crate::field::Description’s text, and the
validation messages join it exactly when the field is invalid, which is
exactly when React Aria’s FieldError renders and contributes its id to
aria-describedby.
Sourcepub fn described(self, description: Option<impl Into<SharedString>>) -> Self
pub fn described(self, description: Option<impl Into<SharedString>>) -> Self
Replaces the description, for the controls that carry one without a validation story (a menu subtitle, a stepper hint).
Sourcepub fn prefixed(&self, prefix: &str) -> Self
pub fn prefixed(&self, prefix: &str) -> Self
Prefixes the name, the way useNumberField names its steppers
“Increase {label}” rather than pointing at the field’s label alone.
Sourcepub fn label(&self) -> Option<&SharedString>
pub fn label(&self) -> Option<&SharedString>
The accessible name, if any.
Sourcepub fn description(&self) -> Option<&SharedString>
pub fn description(&self) -> Option<&SharedString>
The accessible description, if any.
Trait Implementations§
impl Eq for Name
impl StructuralPartialEq for Name
Auto Trait Implementations§
impl Freeze for Name
impl RefUnwindSafe for Name
impl Send for Name
impl Sync for Name
impl Unpin for Name
impl UnsafeUnpin for Name
impl UnwindSafe for Name
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
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§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.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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().