Enum TextKind
pub enum TextKind {
Prose,
Numeric,
Secret,
Identifier,
Url,
Code,
}Expand description
What a run of text is, so the toolkit can pick its OpenType features.
Applications never name a feature: they say what the text is (or the widget knows it) and the features are resolved against the face the text is actually set in, applying only what that face supports.
| Kind | Features, where the face has them |
|---|---|
Prose | none |
Numeric | tabular lining figures (tnum, lnum) |
Secret | tabular figures, slashed or dotted zero (zero), distinct I and l |
Identifier | distinct I and l |
Url | slashed or dotted zero, distinct I and l |
Code | none; set in the mono face |
Identifiers inside Prose (links, email addresses, mentions, room
aliases) are found by crate::text_detect and set as Url or
Identifier on their own. A TextStyle marked
TextStyle::on_security_surface, and all text while the person’s
“Always distinguish similar letters” setting is on, gets the distinct
forms whatever its kind.
Variants§
Prose
Running text. Numbers stay proportional.
Numeric
Figures that line up in columns or change in place: times, dates, durations, counts, prices, sizes, progress, clocks.
Secret
Characters someone copies or compares one by one: verification and recovery codes, TOTP, API keys, hashes, revealed passwords, Wi-Fi and licence keys.
Identifier
Names that must not be mistaken for another: usernames, handles, email addresses, invite codes, room names, other people’s file names.
Url
Web and other links. An identifier that also sets the zero apart:
a look-alike domain (paypa1.com, g00gle.com) is a phishing
vector.
Code
Source code and terminal text, in the mono face.
Trait Implementations§
impl Copy for TextKind
impl Eq for TextKind
impl StructuralPartialEq for TextKind
Auto Trait Implementations§
impl Freeze for TextKind
impl RefUnwindSafe for TextKind
impl Send for TextKind
impl Sync for TextKind
impl Unpin for TextKind
impl UnsafeUnpin for TextKind
impl UnwindSafe for TextKind
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more