Skip to main content

just/
delimiter.rs

1use super::*;
2
3#[derive(Clone, Copy, Debug, Eq, PartialEq)]
4pub(crate) enum Delimiter {
5  Brace,
6  Bracket,
7  FormatString(StringKind),
8  Paren,
9}
10
11impl Delimiter {
12  pub(crate) fn open(self) -> char {
13    match self {
14      Self::Brace | Self::FormatString(_) => '{',
15      Self::Bracket => '[',
16      Self::Paren => '(',
17    }
18  }
19
20  pub(crate) fn close(self) -> char {
21    match self {
22      Self::Brace | Self::FormatString(_) => '}',
23      Self::Bracket => ']',
24      Self::Paren => ')',
25    }
26  }
27}