diff options
Diffstat (limited to 'library/src/math')
| -rw-r--r-- | library/src/math/matrix.rs | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index 148d79e8..d79c7ca5 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -169,12 +169,22 @@ impl LayoutMath for CasesNode { } /// A vector / matrix delimiter. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Cast)] pub enum Delimiter { + /// Delimit with parentheses. + #[string("(")] Paren, + /// Delimit with brackets. + #[string("[")] Bracket, + /// Delimit with curly braces. + #[string("{")] Brace, + /// Delimit with vertical bars. + #[string("|")] Bar, + /// Delimit with double vertical bars. + #[string("||")] DoubleBar, } @@ -202,30 +212,6 @@ impl Delimiter { } } -cast_from_value! { - Delimiter, - /// Delimit with parentheses. - "(" => Self::Paren, - /// Delimit with brackets. - "[" => Self::Bracket, - /// Delimit with curly braces. - "{" => Self::Brace, - /// Delimit with vertical bars. - "|" => Self::Bar, - /// Delimit with double vertical bars. - "||" => Self::DoubleBar, -} - -cast_to_value! { - v: Delimiter => Value::from(match v { - Delimiter::Paren => "(", - Delimiter::Bracket => "[", - Delimiter::Brace => "{", - Delimiter::Bar => "|", - Delimiter::DoubleBar => "||", - }) -} - /// Layout the inner contents of a vector. fn layout_vec_body( ctx: &mut MathContext, |
