struct

Phosphor::KeyChar

Inherits Struct < Value < Object

A printable ASCII character that has no named Key constant (digits, punctuation, symbols).

Crystal enum members can't carry an associated value the way, say, a Rust enum variant can — enum Key; Char(Char); end doesn't parse, and nesting a struct inside Key to spell it Key::Char isn't allowed either ("can't declare type inside enum Key"). This record is the closest equivalent: a value type holding the one character, unioned with Key via KeyKind below so KeyEvent#key can hold either.

Constructors

new(char : Char)
Source

Instance methods

char
clone
Source
copy_with(char _char = @char)
Source