[go: up one dir, main page]

Context

Struct Context 

Source
pub struct Context<'o, 'c, T = ()> {
    pub options: &'o Options<'c>,
    pub plugins: &'o Plugins<'o>,
    pub anchorizer: Anchorizer,
    pub user: T,
    /* private fields */
}
Expand description

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.

Implementations§

Source§

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

Source

pub 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.)

Source

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

Convenience wrapper for html::escape.

Source

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

Convenience wrapper for html::escape_href.

Trait Implementations§

Source§

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

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

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

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0 · Source§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a char into this writer, returning whether the write succeeded. Read more
1.0.0 · Source§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the write! macro with implementors of this trait. Read more

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> Unpin for Context<'o, 'c, T>
where T: Unpin,

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.