pub struct RenderContext<'a> {
pub doc: &'a mut Document<Ast>,
pub templates: &'a TemplateManager,
pub extra_args: Context,
pub notebook_output_meta: &'a NotebookMeta,
pub format: &'a dyn Format,
pub parser_settings: ParserSettings,
pub references: LinkedHashMap<String, Reference>,
pub references_by_type: HashMap<String, Vec<(String, Reference)>>,
}
Expand description
Context that is passed to the render functions.
Fields§
§doc: &'a mut Document<Ast>
The document that is being rendered
templates: &'a TemplateManager
§extra_args: Context
Extra arguments (this type is essentially a wrapped HashMap)
notebook_output_meta: &'a NotebookMeta
For syntax highlighting using Syntect
format: &'a dyn Format
§parser_settings: ParserSettings
§references: LinkedHashMap<String, Reference>
§references_by_type: HashMap<String, Vec<(String, Reference)>>
Implementations§
Source§impl<'a> RenderContext<'a>
impl<'a> RenderContext<'a>
pub fn new( doc: &'a mut Document<Ast>, templates: &'a TemplateManager, extra_args: Context, notebook_output_meta: &'a NotebookMeta, format: &'a dyn Format, parser_settings: ParserSettings, ) -> Result<Self>
Auto Trait Implementations§
impl<'a> Freeze for RenderContext<'a>
impl<'a> !RefUnwindSafe for RenderContext<'a>
impl<'a> Send for RenderContext<'a>
impl<'a> Sync for RenderContext<'a>
impl<'a> Unpin for RenderContext<'a>
impl<'a> !UnwindSafe for RenderContext<'a>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T, R> RenderElement<Vec<R>> for Twhere
T: RenderElement<R>,
impl<T, R> RenderElement<Vec<R>> for Twhere
T: RenderElement<R>,
Source§fn render(
&mut self,
elem: &Vec<R>,
ctx: &RenderContext<'_>,
buf: impl Write,
) -> Result<(), Error>
fn render( &mut self, elem: &Vec<R>, ctx: &RenderContext<'_>, buf: impl Write, ) -> Result<(), Error>
Render the element to a buffer
Source§fn render_inner(&mut self, elem: &T, ctx: &RenderContext<'_>) -> Result<CowStr>
fn render_inner(&mut self, elem: &T, ctx: &RenderContext<'_>) -> Result<CowStr>
Convenience function for creating a buffer, rendering the element into the buffer, and
returning the result as a string. This is useful when an inner element needs to be rendered
first to be used in an outer element, hence the name.