Struct DefaultHtmlWriter

Source
pub struct DefaultHtmlWriter<W: StrWrite> { /* private fields */ }
Expand description

An HTML writer implementation. This type implements methods for writing HTML elements. Default HTML writer implementation that can work with any StrWrite-compatible writer This should be the approximate amount of code any custom implementation needs to provide

Implementations§

Source§

impl<W: StrWrite> DefaultHtmlWriter<W>

Source

pub fn new(writer: W, config: HtmlConfig) -> Self

Create a new DefaultHtmlWriter with the given writer and configuration

Trait Implementations§

Source§

impl<W: StrWrite> HtmlWriter<W> for DefaultHtmlWriter<W>

Source§

fn get_writer(&mut self) -> &mut W

Source§

fn get_config(&self) -> &HtmlConfig

Source§

fn get_state(&mut self) -> &mut HtmlState

Source§

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

Write a string directly to the output
Source§

fn write_attributes(&mut self, element: &str) -> Result<(), HtmlError>

Write HTML attributes for a given element
Check if a URL points to an external resource
Source§

fn start_paragraph(&mut self) -> Result<(), HtmlError>

Source§

fn end_paragraph(&mut self) -> Result<(), HtmlError>

Source§

fn start_heading( &mut self, level: HeadingLevel, id: Option<&str>, classes: &[CowStr<'_>], attrs: &Vec<(CowStr<'_>, Option<CowStr<'_>>)>, ) -> Result<(), HtmlError>

Source§

fn end_heading(&mut self, level: HeadingLevel) -> Result<(), HtmlError>

Source§

fn start_blockquote(&mut self) -> Result<(), HtmlError>

Source§

fn end_blockquote(&mut self) -> Result<(), HtmlError>

Source§

fn start_code_block(&mut self, kind: CodeBlockKind<'_>) -> Result<(), HtmlError>

Source§

fn end_code_block(&mut self) -> Result<(), HtmlError>

Source§

fn start_inline_code(&mut self) -> Result<(), HtmlError>

Source§

fn end_inline_code(&mut self) -> Result<(), HtmlError>

Source§

fn start_list(&mut self, first_number: Option<u64>) -> Result<(), HtmlError>

Source§

fn end_list(&mut self, ordered: bool) -> Result<(), HtmlError>

Source§

fn start_list_item(&mut self) -> Result<(), HtmlError>

Source§

fn end_list_item(&mut self) -> Result<(), HtmlError>

Source§

fn start_table(&mut self, alignments: Vec<Alignment>) -> Result<(), HtmlError>

Source§

fn end_table(&mut self) -> Result<(), HtmlError>

Source§

fn start_table_head(&mut self) -> Result<(), HtmlError>

Source§

fn end_table_head(&mut self) -> Result<(), HtmlError>

Source§

fn start_table_row(&mut self) -> Result<(), HtmlError>

Source§

fn end_table_row(&mut self) -> Result<(), HtmlError>

Source§

fn start_table_cell(&mut self) -> Result<(), HtmlError>

Source§

fn end_table_cell(&mut self) -> Result<(), HtmlError>

Source§

fn start_emphasis(&mut self) -> Result<(), HtmlError>

Source§

fn end_emphasis(&mut self) -> Result<(), HtmlError>

Source§

fn start_strong(&mut self) -> Result<(), HtmlError>

Source§

fn end_strong(&mut self) -> Result<(), HtmlError>

Source§

fn start_strikethrough(&mut self) -> Result<(), HtmlError>

Source§

fn end_strikethrough(&mut self) -> Result<(), HtmlError>

Source§

fn start_image<'a, I>( &mut self, _link_type: LinkType, dest: &str, title: &str, iter: &mut Peekable<I>, ) -> Result<(), HtmlError>
where I: Iterator<Item = Event<'a>>,

Source§

fn end_image(&mut self) -> Result<(), HtmlError>

Source§

fn footnote_reference(&mut self, name: &str) -> Result<(), HtmlError>

Source§

fn start_footnote_definition(&mut self, name: &str) -> Result<(), HtmlError>

Source§

fn end_footnote_definition(&mut self) -> Result<(), HtmlError>

Source§

fn task_list_item(&mut self, checked: bool) -> Result<(), HtmlError>

Source§

fn horizontal_rule(&mut self) -> Result<(), HtmlError>

Source§

fn soft_break(&mut self) -> Result<(), HtmlError>

Source§

fn hard_break(&mut self) -> Result<(), HtmlError>

Source§

fn text(&mut self, text: &str) -> Result<(), HtmlError>

Source§

fn start_definition_list(&mut self) -> Result<(), HtmlError>

Source§

fn end_definition_list(&mut self) -> Result<(), HtmlError>

Source§

fn start_definition_list_title(&mut self) -> Result<(), HtmlError>

Source§

fn end_definition_list_title(&mut self) -> Result<(), HtmlError>

Source§

fn start_definition_list_definition(&mut self) -> Result<(), HtmlError>

Source§

fn end_definition_list_definition(&mut self) -> Result<(), HtmlError>

Source§

fn start_metadata_block( &mut self, _metadata_type: &MetadataBlockKind, ) -> Result<(), HtmlError>

Source§

fn end_metadata_block(&mut self) -> Result<(), HtmlError>

Source§

fn html_raw(&mut self, html: &CowStr<'_>) -> Result<(), HtmlError>

Source§

fn collect_alt_text<'a, I>(&self, iter: &mut Peekable<I>) -> String
where I: Iterator<Item = Event<'a>>,

Auto Trait Implementations§

§

impl<W> Freeze for DefaultHtmlWriter<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for DefaultHtmlWriter<W>
where W: RefUnwindSafe,

§

impl<W> Send for DefaultHtmlWriter<W>
where W: Send,

§

impl<W> Sync for DefaultHtmlWriter<W>
where W: Sync,

§

impl<W> Unpin for DefaultHtmlWriter<W>
where W: Unpin,

§

impl<W> UnwindSafe for DefaultHtmlWriter<W>
where W: UnwindSafe,

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.