pub struct Ecosystem { /* private fields */ }Expand description
The registry. Total resolution: an unmatched path resolves to
PLAIN_TEXT, never a panic.
Implementations§
Source§impl Ecosystem
impl Ecosystem
Sourcepub fn with_builtins() -> Ecosystem
pub fn with_builtins() -> Ecosystem
The batteries-included default: every built-in language plugin.
pub fn register(&mut self, plugin: Box<dyn LanguagePlugin>)
Sourcepub fn resolve(&self, path: &str) -> Language
pub fn resolve(&self, path: &str) -> Language
Resolve a file path to a language. Filename match wins over extension;
no match resolves to PLAIN_TEXT.
Sourcepub fn highlighter_for(&self, lang: Language) -> Box<dyn Highlighter>
pub fn highlighter_for(&self, lang: Language) -> Box<dyn Highlighter>
A highlighter for a language, or the plain-text highlighter if none is registered for it.
Sourcepub fn highlighter_for_path(&self, path: &str) -> Box<dyn Highlighter>
pub fn highlighter_for_path(&self, path: &str) -> Box<dyn Highlighter>
The one call an editor needs: path → highlighter.
Sourcepub fn incremental_highlighter_for(
&self,
lang: Language,
) -> Box<dyn IncrementalHighlighter>
pub fn incremental_highlighter_for( &self, lang: Language, ) -> Box<dyn IncrementalHighlighter>
An incremental highlighter for a language, or the plain-text fallback. This is the call an editor’s render loop holds across frames — it re-lexes only what changed.
Sourcepub fn incremental_highlighter_for_path(
&self,
path: &str,
) -> Box<dyn IncrementalHighlighter>
pub fn incremental_highlighter_for_path( &self, path: &str, ) -> Box<dyn IncrementalHighlighter>
Path → incremental highlighter. The render-loop entry point.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Ecosystem
impl !UnwindSafe for Ecosystem
impl Freeze for Ecosystem
impl Send for Ecosystem
impl Sync for Ecosystem
impl Unpin for Ecosystem
impl UnsafeUnpin for Ecosystem
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