Skip to main content

Emitter

Struct Emitter 

Source
pub struct Emitter<W: Write> { /* private fields */ }
Expand description

A SIF document emitter.

Implementations§

Source§

impl<W: Write> Emitter<W>

Extension methods for emitting streaming directives.

Source

pub fn emit_stream_start( &mut self, id: Option<&str>, mode: StreamMode, ) -> Result<()>

Write #stream start with optional attributes.

Source

pub fn emit_stream_end( &mut self, id: Option<&str>, records: Option<u64>, ) -> Result<()>

Write #stream end with optional attributes.

Source

pub fn emit_heartbeat(&mut self, timestamp: Option<&str>) -> Result<()>

Write #heartbeat with optional timestamp.

Source

pub fn emit_status(&mut self, level: StatusLevel, message: &str) -> Result<()>

Write #status <level> <message>.

Source

pub fn emit_pause(&mut self) -> Result<()>

Write #pause.

Source

pub fn emit_resume(&mut self) -> Result<()>

Write #resume.

Source

pub fn emit_error(&mut self, message: &str) -> Result<()>

Write #error <message>.

Source§

impl<W: Write> Emitter<W>

Source

pub fn new(out: W) -> Self

Source

pub fn emit_document(&mut self, doc: &Document) -> Result<()>

Write a complete document.

Source

pub fn emit_header(&mut self, header: &Header) -> Result<()>

Write the header line.

Source

pub fn emit_section_break(&mut self) -> Result<()>

Write a section break.

Source

pub fn emit_section_id(&mut self, id: &str) -> Result<()>

Write a section identifier.

Source

pub fn emit_section(&mut self, section: &Section) -> Result<()>

Write a complete section.

Source

pub fn emit_schema(&mut self, schema: &Schema) -> Result<()>

Write a #schema directive.

Source

pub fn emit_record(&mut self, record: &Record) -> Result<()>

Write a data record.

Source

pub fn emit_directive(&mut self, directive: &Directive) -> Result<()>

Write a directive.

Source

pub fn emit_block(&mut self, block: &Block) -> Result<()>

Write a block.

Source

pub fn emit_template(&mut self, template: &Template) -> Result<()>

Write a template.

Source

pub fn emit_recall(&mut self) -> Result<()>

Write a #recall schema directive.

Source

pub fn writer_mut(&mut self) -> &mut W

Get a mutable reference to the underlying writer.

Source

pub fn into_inner(self) -> W

Consume the emitter and return the underlying writer.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<W> UnsafeUnpin for Emitter<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for Emitter<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.