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>

Options in use in this render.

plugins: &'o Plugins<'o>

Plugins in use in this render.

anchorizer: Anchorizer

Anchorizer instance used in this render.

user: T

Any 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) -> Result

If the last byte written to ts Write interface 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_html is on.

fn lf(&mut self) -> Result

Writes \n unless compact_html is on.

fn escape(&mut self, buffer: &str) -> Result

Convenience wrapper for html::escape.

fn escape_href(&mut self, buffer: &str) -> Result

Convenience 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

Auto Trait Implementations

impl<'o, 'c, T = ()> !Freeze for Context<'o, 'c, T>

impl<'o, 'c, T = ()> !RefUnwindSafe for Context<'o, 'c, T>

impl<'o, 'c, T = ()> !Send for Context<'o, 'c, T>

impl<'o, 'c, T = ()> !Sync for Context<'o, 'c, T>

impl<'o, 'c, T = ()> !UnwindSafe for Context<'o, 'c, T>

impl<'o, 'c, T> Unpin for Context<'o, 'c, T> where T: Unpin,

impl<'o, 'c, T> UnsafeUnpin for Context<'o, 'c, T> where T: UnsafeUnpin,

Blanket Implementations

impl<T> Any for Context<'o, 'c, T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Context<'o, 'c, T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Context<'o, 'c, T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Context<'o, 'c, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for Context<'o, 'c, T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Context<'o, 'c, T> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Context<'o, 'c, T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>