MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / name

Method name

atomic-core/src/diff/token/kind.rs:160–172  ·  view source on GitHub ↗

Get a short name for display purposes. Returns a brief, lowercase string identifying the token kind. Useful for debugging output and test assertions. # Example ```rust use atomic_core::diff::token::TokenKind; assert_eq!(TokenKind::Word.name(), "word"); assert_eq!(TokenKind::Operator.name(), "op"); ```

(&self)

Source from the content-addressed store, hash-verified

158 /// assert_eq!(TokenKind::Operator.name(), "op");
159 /// ```
160 pub fn name(&self) -> &'static str {
161 match self {
162 TokenKind::Word => "word",
163 TokenKind::Whitespace => "ws",
164 TokenKind::Operator => "op",
165 TokenKind::Punctuation => "punct",
166 TokenKind::String => "string",
167 TokenKind::Number => "number",
168 TokenKind::Comment => "comment",
169 TokenKind::Newline => "newline",
170 TokenKind::Other => "other",
171 }
172 }
173}
174
175impl std::fmt::Display for TokenKind {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected