pub struct AsyncHighlighter<P: GrammarProvider> { /* private fields */ }Expand description
Asynchronous highlighter for WASM/browser contexts.
Uses an async provider where get() may need to load plugins.
§Example
ⓘ
use arborium_highlight::{AsyncHighlighter, WasmPluginProvider};
let mut highlighter = AsyncHighlighter::new(WasmPluginProvider::new());
let html = highlighter.highlight("rust", "fn main() {}").await?;Implementations§
Source§impl<P: GrammarProvider> AsyncHighlighter<P>
impl<P: GrammarProvider> AsyncHighlighter<P>
Sourcepub fn new(provider: P) -> Self
pub fn new(provider: P) -> Self
Create a new asynchronous highlighter with default configuration.
Sourcepub fn with_config(provider: P, config: HighlightConfig) -> Self
pub fn with_config(provider: P, config: HighlightConfig) -> Self
Create a new asynchronous highlighter with custom configuration.
Sourcepub fn provider_mut(&mut self) -> &mut P
pub fn provider_mut(&mut self) -> &mut P
Get a mutable reference to the underlying provider.
Auto Trait Implementations§
impl<P> Freeze for AsyncHighlighter<P>where
P: Freeze,
impl<P> RefUnwindSafe for AsyncHighlighter<P>where
P: RefUnwindSafe,
impl<P> Send for AsyncHighlighter<P>where
P: Send,
impl<P> Sync for AsyncHighlighter<P>where
P: Sync,
impl<P> Unpin for AsyncHighlighter<P>where
P: Unpin,
impl<P> UnsafeUnpin for AsyncHighlighter<P>where
P: UnsafeUnpin,
impl<P> UnwindSafe for AsyncHighlighter<P>where
P: UnwindSafe,
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