Skip to main content

Sink

Struct Sink 

Source
pub struct Sink<'a>(/* private fields */);
Expand description

A Renderer that appends to a Trusted under construction.

This is what lets a document being built by hand reach the attribute machinery — Attr, TokenList, Attrs all write through a Renderer, and there is no reason for tag! to own a second implementation of what disabled or a token list means.

It escapes as HTML and lays nothing out, which is what a value being assembled in Rust wants: there is no template whose newlines a policy could be about.

Trait Implementations§

Source§

impl Renderer for Sink<'_>

Source§

fn finish(self: Box<Self>) -> String

The output is the Trusted this was borrowed from, which the caller still holds — so there is nothing to hand back here.

Source§

fn write_raw(&mut self, s: &str)

Append text with no transformation. Read more
Source§

fn write_escaped(&mut self, value: &dyn Display)

Append a value, applying this renderer’s escaping policy. Read more
Source§

fn write_text(&mut self, s: &str)

Append literal text from between a template’s tags. Read more
Source§

fn write_display_raw(&mut self, value: &dyn Display)

Append a value with no escaping. Read more
Source§

fn push_indent(&mut self, levels: usize)

Enter levels of nesting, for renderers that lay their output out. Read more
Source§

fn pop_indent(&mut self, levels: usize)

Leave levels opened by push_indent.
Source§

fn close_line(&mut self, depth: usize)

Set the indentation already written for the current line to depth levels below the running total, because what comes next is the end tag of an element at that depth. Read more
Source§

fn set_verbatim(&mut self, on: bool)

Enter or leave a region where whitespace is significant — the content of <pre>, <textarea>, <script> and <style>, where a space this renderer added is a space the reader gets. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for Sink<'a>

§

impl<'a> Freeze for Sink<'a>

§

impl<'a> RefUnwindSafe for Sink<'a>

§

impl<'a> Send for Sink<'a>

§

impl<'a> Sync for Sink<'a>

§

impl<'a> Unpin for Sink<'a>

§

impl<'a> UnsafeUnpin for Sink<'a>

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.