pub struct Registry {
pub grammars: Vec<Grammar>,
pub themes: Vec<Theme>,
}Expand description
A reusable registry of compiled grammars and themes.
Fields§
§grammars: Vec<Grammar>Registered grammars.
themes: Vec<Theme>Registered themes.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn with_plain_text() -> Self
pub fn with_plain_text() -> Self
Creates an empty registry with a plain-text fallback grammar.
Sourcepub fn with_builtin_syntaxes() -> Self
pub fn with_builtin_syntaxes() -> Self
Creates an empty registry with the built-in fast grammars.
Sourcepub fn add_grammar(&mut self, grammar: Grammar)
pub fn add_grammar(&mut self, grammar: Grammar)
Adds a compiled grammar.
Sourcepub fn add_grammar_json(&mut self, input: &str) -> Result<(), Error>
pub fn add_grammar_json(&mut self, input: &str) -> Result<(), Error>
Parses, compiles, and adds a grammar from JSON.
Sourcepub fn add_theme_json(&mut self, input: &str) -> Result<(), Error>
pub fn add_theme_json(&mut self, input: &str) -> Result<(), Error>
Parses, compiles, and adds a theme from JSON.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnsafeUnpin for Registry
impl UnwindSafe for Registry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more