Struct Context
pub struct Context<'o, 'c, T = ()> { pub options: &'o Options<'c>, pub plugins: &'o Plugins<'o>, pub anchorizer: Anchorizer, pub user: T, pub current_anchorized_id: Option<String>, /* private fields */ }
Context struct given to formatter functions as taken by
html::format_document_with_formatter. Output can be appended to through
this struct's Write interface.
Fields
options: &'o Options<'c>Optionsin use in this render.plugins: &'o Plugins<'o>Pluginsin use in this render.anchorizer: AnchorizerAnchorizerinstance used in this render.user: TAny user data used by the
Context.current_anchorized_id: Option<String>Current anchorized id being rendered.
Implementations
impl<'o, 'c, T> Context<'o, 'c, T>
fn cr(&mut self) -> ResultIf the last byte written to ts
Writeinterface was not a U+000A LINE FEED, writes one. Otherwise, does nothing.(In other words, ensures the output is at a new line.)
No-op when
compact_htmlis on.fn lf(&mut self) -> ResultWrites
\nunlesscompact_htmlis on.fn escape(&mut self, buffer: &str) -> ResultConvenience wrapper for
html::escape.fn escape_href(&mut self, buffer: &str) -> ResultConvenience wrapper for
html::escape_href.
Trait Implementations
impl<T> Debug for Context<'_, '_, T>
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>
impl<T> Write for Context<'_, '_, T>
fn write_str(&mut self, s: &str) -> Result