freya_core/values/
highlight.rs

1use crate::parsing::{
2    Parse,
3    ParseError,
4};
5
6#[derive(Default, Clone, Debug, PartialEq)]
7pub enum HighlightMode {
8    #[default]
9    /// Highlight considering the actual measure text bounds.
10    Fit,
11    /// Highlight considering the `paragraph` element bounds.
12    Expanded,
13}
14
15impl Parse for HighlightMode {
16    fn parse(value: &str) -> Result<Self, ParseError> {
17        match value {
18            "expanded" => Ok(HighlightMode::Expanded),
19            _ => Ok(HighlightMode::Fit),
20        }
21    }
22}