syntect/highlighting/
settings.rs1use std::io::{Read, Seek};
4
5pub use serde_json::Value as Settings;
6
7pub trait ParseSettings: Sized {
8 type Error;
9 fn parse_settings(settings: Settings) -> Result<Self, Self::Error>;
10}
11
12#[derive(Debug, thiserror::Error)]
14#[non_exhaustive]
15pub enum SettingsError {
16 #[error("Incorrect Plist syntax: {0}")]
18 Plist(#[source] Box<dyn std::error::Error + Send + Sync>),
19}
20
21pub fn read_plist<R: Read + Seek>(reader: R) -> Result<Settings, SettingsError> {
22 let settings = plist::from_reader(reader).map_err(|e| SettingsError::Plist(Box::new(e)))?;
23 Ok(settings)
24}