1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use std::fmt;

use crate::{
    Parse,
    ParseError,
};

#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CursorMode {
    None,
    Editable,
}

impl Parse for CursorMode {
    fn parse(value: &str) -> Result<Self, ParseError> {
        Ok(match value {
            "editable" => CursorMode::Editable,
            _ => CursorMode::None,
        })
    }
}

impl fmt::Display for CursorMode {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str(match self {
            CursorMode::Editable => "editable",
            CursorMode::None => "none",
        })
    }
}