use std::path::PathBuf;
use syntect::parsing::SyntaxSet;
use super::*;
#[derive(Debug)]
pub enum SerializedSyntaxSet {
FromFile(PathBuf),
FromBinary(&'static [u8]),
}
impl SerializedSyntaxSet {
pub fn deserialize(&self) -> Result<SyntaxSet> {
match self {
SerializedSyntaxSet::FromBinary(data) => Ok(from_binary(data, COMPRESS_SYNTAXES)),
SerializedSyntaxSet::FromFile(ref path) => {
asset_from_cache(path, "syntax set", COMPRESS_SYNTAXES)
}
}
}
}