BlockWriterProxy

Struct BlockWriterProxy 

Source
pub struct BlockWriterProxy<'a> { /* private fields */ }
Expand description

Proxy that exposes a restricted API for block-level custom node rendering.

Implementations§

Source§

impl<'a> BlockWriterProxy<'a>

Source

pub fn write_block(&mut self, node: &Node) -> WriteResult<()>

Write a block-level node through the underlying writer.

Source

pub fn write_inline(&mut self, node: &Node) -> WriteResult<()>

Write an inline node while remaining in a block context.

Source

pub fn write_inline_nodes(&mut self, nodes: &[Node]) -> WriteResult<()>

Write a collection of inline nodes.

Source

pub fn write_str(&mut self, text: &str) -> WriteResult<()>

Write raw text into the buffer.

Source

pub fn write_char(&mut self, ch: char) -> WriteResult<()>

Write a single character into the buffer.

Source

pub fn ensure_trailing_newline(&mut self) -> WriteResult<()>

Ensure the buffer ends with a newline.

Source

pub fn ensure_blank_line(&mut self) -> WriteResult<()>

Ensure there is a blank line at the end of the buffer.

Source

pub fn capture_block<F>(&mut self, f: F) -> WriteResult<EcoString>
where F: FnOnce(&mut BlockWriterProxy<'_>) -> WriteResult<()>,

Capture the output produced inside the closure using a fresh block proxy.

Source

pub fn capture_inline<F>(&mut self, f: F) -> WriteResult<EcoString>
where F: FnOnce(&mut InlineWriterProxy<'_>) -> WriteResult<()>,

Capture output produced in an inline context.

Source

pub fn with_temporary_options<F, R, G>( &mut self, modify: F, f: G, ) -> WriteResult<R>
where F: FnOnce(&mut WriterOptions), G: FnMut(&mut BlockWriterProxy<'_>) -> WriteResult<R>,

Temporarily modify writer options while executing the provided closure.

Auto Trait Implementations§

§

impl<'a> Freeze for BlockWriterProxy<'a>

§

impl<'a> !RefUnwindSafe for BlockWriterProxy<'a>

§

impl<'a> !Send for BlockWriterProxy<'a>

§

impl<'a> !Sync for BlockWriterProxy<'a>

§

impl<'a> Unpin for BlockWriterProxy<'a>

§

impl<'a> !UnwindSafe for BlockWriterProxy<'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 = 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.