pub enum Kind {
Keyword,
Type,
Str,
Number,
Slot,
Comment,
Plain,
}Expand description
What one piece of a text is coloured as.
Variants§
Keyword
A keyword, and true / false with them: they are spelled like
keywords, a reader reads them as keywords, and a category of their own
would buy a colour nobody needs.
Type
An identifier beginning with an uppercase letter. See the module documentation: this is the one category the lexer does not decide.
Str
A string literal, interpolations and all. "Hello, {name}!" is one
piece and not three — the interpolated expression is not re-lexed,
because a second colour inside a string is a detail a playground can
do without.
Number
An integer, a float, or a duration such as 500ms. In a
disassembly it is also a program counter, a jump target and a
function’s id: an index into the program is the same kind of fact as a
number written in it, and a reader scanning for “where” wants them one
colour rather than two.
Slot
A slot and what it is annotated with, s3:int, in a disassembly.
The one category source has no use for, and the one the disassembly
could not do without: a slot number is the thing a reader follows from
line to line, and it is written in more places than any other token.
It is one piece and not three because the annotation is what makes the
number mean something — s3 on its own says nothing about whether the
instruction moved a word or a Point.
Comment
A //, /* */ or /// comment.
Plain
Everything else: punctuation, operators, ordinary names, whitespace.
Implementations§
Trait Implementations§
impl Copy for Kind
impl Eq for Kind
impl StructuralPartialEq for Kind
Auto Trait Implementations§
impl Freeze for Kind
impl RefUnwindSafe for Kind
impl Send for Kind
impl Sync for Kind
impl Unpin for Kind
impl UnsafeUnpin for Kind
impl UnwindSafe for Kind
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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<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.