pub struct SourceRendererFormat { /* private fields */ }Expand description
A plugin’s SourceRenderer as a document format: the renderer draws the
source; the id, name, extensions and an optional sniffer come from the
host that wraps it.
Implementations§
Source§impl SourceRendererFormat
impl SourceRendererFormat
Sourcepub fn new(id: impl Into<String>, renderer: Arc<dyn SourceRenderer>) -> Self
pub fn new(id: impl Into<String>, renderer: Arc<dyn SourceRenderer>) -> Self
Wrap renderer as the format id.
Sourcepub fn extensions(self, extensions: &[&str]) -> Self
pub fn extensions(self, extensions: &[&str]) -> Self
The extensions it claims, without the dot.
Trait Implementations§
Source§impl DocumentFormat for SourceRendererFormat
impl DocumentFormat for SourceRendererFormat
Source§fn extensions(&self) -> Vec<String>
fn extensions(&self) -> Vec<String>
The file extensions it claims, lowercase, without the dot.
Source§fn render(&self, source: &str, _options: &RenderOptions) -> Rendered
fn render(&self, source: &str, _options: &RenderOptions) -> Rendered
Render
source. The default draws parse’s document
with DocumentView, or the source as plain text when the format
does not parse into the model.Source§fn match_name(&self, file_name: &str) -> NameMatch
fn match_name(&self, file_name: &str) -> NameMatch
How
file_name (a base name) relates to this format. By default a
name whose extension is one of extensions is
NameMatch::Yes.Auto Trait Implementations§
impl !RefUnwindSafe for SourceRendererFormat
impl !UnwindSafe for SourceRendererFormat
impl Freeze for SourceRendererFormat
impl Send for SourceRendererFormat
impl Sync for SourceRendererFormat
impl Unpin for SourceRendererFormat
impl UnsafeUnpin for SourceRendererFormat
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