Add variants
method to symbol
This commit is contained in:
parent
a96141a3ea
commit
c7c135f25e
@ -81,12 +81,12 @@ impl Symbol {
|
||||
}
|
||||
|
||||
/// The characters that are covered by this symbol.
|
||||
pub fn chars(&self) -> impl Iterator<Item = char> {
|
||||
pub fn variants(&self) -> impl Iterator<Item = (&str, char)> {
|
||||
let (first, slice) = match self.repr {
|
||||
Repr::Single(c) => (Some(c), [].as_slice()),
|
||||
Repr::Single(c) => (Some(("", c)), [].as_slice()),
|
||||
Repr::List(list) => (None, list),
|
||||
};
|
||||
first.into_iter().chain(slice.iter().map(|&(_, c)| c))
|
||||
first.into_iter().chain(slice.iter().copied())
|
||||
}
|
||||
|
||||
/// Possible modifiers.
|
||||
|
Loading…
Reference in New Issue
Block a user