pub struct PlainTextRenderer<W> { /* private fields */ }Expand description
Plain text renderer that writes MPEG syntax to any io::Write.
Implementations§
Source§impl<W: Write> PlainTextRenderer<W>
impl<W: Write> PlainTextRenderer<W>
pub fn new(writer: W) -> Self
Sourcepub fn into_inner(self) -> W
pub fn into_inner(self) -> W
Get the underlying writer back.
Trait Implementations§
Source§impl<W: Write> SyntaxWrite for PlainTextRenderer<W>
impl<W: Write> SyntaxWrite for PlainTextRenderer<W>
type Error = TextRenderError
Source§fn begin_element(
&mut self,
name: &str,
params: Option<&str>,
) -> Result<(), Self::Error>
fn begin_element( &mut self, name: &str, params: Option<&str>, ) -> Result<(), Self::Error>
Begin a named syntax element (a “syntax table” in MPEG specs). Read more
Source§fn fixed_width_field(
&mut self,
field: &FixedWidthField<'_>,
) -> Result<(), Self::Error>
fn fixed_width_field( &mut self, field: &FixedWidthField<'_>, ) -> Result<(), Self::Error>
Render a fixed-width field.
Source§fn variable_length_field(
&mut self,
field: &VariableLengthField<'_>,
) -> Result<(), Self::Error>
fn variable_length_field( &mut self, field: &VariableLengthField<'_>, ) -> Result<(), Self::Error>
Render a variable-length coded field.
Source§fn bit_pattern(
&mut self,
field: &BitPatternField<'_>,
) -> Result<(), Self::Error>
fn bit_pattern( &mut self, field: &BitPatternField<'_>, ) -> Result<(), Self::Error>
Render a fixed bit pattern or marker bit.
Source§fn raw_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>
fn raw_bytes(&mut self, data: &[u8]) -> Result<(), Self::Error>
Render raw bytes as a hex dump. Called after a field template line;
the renderer formats as hex lines (16 bytes per line).
Source§fn begin_if(
&mut self,
condition: &str,
terms: &[TermAnnotation<'_>],
_taken: bool,
) -> Result<(), Self::Error>
fn begin_if( &mut self, condition: &str, terms: &[TermAnnotation<'_>], _taken: bool, ) -> Result<(), Self::Error>
Begin an
if block. The renderer adds if (condition) { and any
term annotations. taken is a hint for dimming not-taken branches.Source§fn begin_else_if(
&mut self,
condition: &str,
terms: &[TermAnnotation<'_>],
_taken: bool,
) -> Result<(), Self::Error>
fn begin_else_if( &mut self, condition: &str, terms: &[TermAnnotation<'_>], _taken: bool, ) -> Result<(), Self::Error>
Close the previous branch and open an
else if branch.Source§fn begin_else(&mut self, _taken: bool) -> Result<(), Self::Error>
fn begin_else(&mut self, _taken: bool) -> Result<(), Self::Error>
Close the previous branch and open an
else branch.Source§fn end_if(&mut self) -> Result<(), Self::Error>
fn end_if(&mut self) -> Result<(), Self::Error>
Close the final branch of an if/else-if/else chain.
Source§fn begin_for(
&mut self,
header: &str,
terms: &[TermAnnotation<'_>],
) -> Result<(), Self::Error>
fn begin_for( &mut self, header: &str, terms: &[TermAnnotation<'_>], ) -> Result<(), Self::Error>
Begin a
for loop. header is the loop clause, e.g.
"i = 0; i < N; i++". The renderer adds for (header) {.Source§fn for_iteration(
&mut self,
variable: &str,
index: u64,
) -> Result<(), Self::Error>
fn for_iteration( &mut self, variable: &str, index: u64, ) -> Result<(), Self::Error>
Mark a for-loop iteration with the variable name and index.
Source§fn while_iteration(&mut self, index: u64) -> Result<(), Self::Error>
fn while_iteration(&mut self, index: u64) -> Result<(), Self::Error>
Mark a while-loop iteration.
Source§fn do_while_iteration(&mut self, index: u64) -> Result<(), Self::Error>
fn do_while_iteration(&mut self, index: u64) -> Result<(), Self::Error>
Mark a do-while iteration.
Source§fn end_do_while(&mut self, condition: &str) -> Result<(), Self::Error>
fn end_do_while(&mut self, condition: &str) -> Result<(), Self::Error>
End a
do-while loop with the given condition.Source§fn begin_switch(
&mut self,
expression: &str,
terms: &[TermAnnotation<'_>],
) -> Result<(), Self::Error>
fn begin_switch( &mut self, expression: &str, terms: &[TermAnnotation<'_>], ) -> Result<(), Self::Error>
Begin a
switch statement. expression is the switch discriminator,
e.g. "id". terms provides term annotations for the discriminator.Source§fn begin_case(&mut self, label: &str, _taken: bool) -> Result<(), Self::Error>
fn begin_case(&mut self, label: &str, _taken: bool) -> Result<(), Self::Error>
Begin a
case within a switch. label is the case label,
e.g. "ID_CPE". taken indicates whether this is the active case.Source§fn assignment(
&mut self,
expression: &str,
computed_value: Option<&Value>,
) -> Result<(), Self::Error>
fn assignment( &mut self, expression: &str, computed_value: Option<&Value>, ) -> Result<(), Self::Error>
Render an inline variable assignment.
computed_value of Some(value)
renders a trailing /* = value */ annotation.Source§fn comment(&mut self, text: &str) -> Result<(), Self::Error>
fn comment(&mut self, text: &str) -> Result<(), Self::Error>
Render a standalone comment line.
Source§fn ellipsis(&mut self) -> Result<(), Self::Error>
fn ellipsis(&mut self) -> Result<(), Self::Error>
Render an ellipsis (
...) indicating omitted content.Source§fn field_table(&mut self, table: &FieldTable<'_>) -> Result<(), Self::Error>
fn field_table(&mut self, table: &FieldTable<'_>) -> Result<(), Self::Error>
Render a table of homogeneous field values from a loop. Read more
Auto Trait Implementations§
impl<W> Freeze for PlainTextRenderer<W>where
W: Freeze,
impl<W> RefUnwindSafe for PlainTextRenderer<W>where
W: RefUnwindSafe,
impl<W> Send for PlainTextRenderer<W>where
W: Send,
impl<W> Sync for PlainTextRenderer<W>where
W: Sync,
impl<W> Unpin for PlainTextRenderer<W>where
W: Unpin,
impl<W> UnsafeUnpin for PlainTextRenderer<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for PlainTextRenderer<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more