[−][src]Struct sise::CompactStringWriter
Writer that writes everything into a single line string.
Example
use sise::Writer as _; let mut result = String::new(); let mut writer = sise::CompactStringWriter::new(&mut result); writer.begin_list(&sise::VoidWriterOptions).unwrap(); writer.write_atom("example", &sise::VoidWriterOptions).unwrap(); writer.begin_list(&sise::VoidWriterOptions).unwrap(); // Write the three atoms in a single line. writer.write_atom("1", &sise::VoidWriterOptions).unwrap(); writer.write_atom("2", &sise::VoidWriterOptions).unwrap(); writer.write_atom("3", &sise::VoidWriterOptions).unwrap(); writer.end_list(&sise::VoidWriterOptions).unwrap(); writer.begin_list(&sise::VoidWriterOptions).unwrap(); // Write the three atoms in a single line. writer.write_atom("a", &sise::VoidWriterOptions).unwrap(); writer.write_atom("b", &sise::VoidWriterOptions).unwrap(); writer.write_atom("c", &sise::VoidWriterOptions).unwrap(); writer.end_list(&sise::VoidWriterOptions).unwrap(); writer.end_list(&sise::VoidWriterOptions).unwrap(); writer.finish(&sise::VoidWriterOptions); let expected_result = "(example (1 2 3) (a b c))"; assert_eq!(result, expected_result);
Methods
impl<'a> CompactStringWriter<'a>
[src]
Trait Implementations
impl<'a> Writer for CompactStringWriter<'a>
[src]
type Result = ()
Type of data returned by the writer.
type Error = Infallible
The error type that may be produced while writing.
type AtomOptions = VoidWriterOptions
Type of options that can be passed to write_atom
.
type BeginListOptions = VoidWriterOptions
Type of options that can be passed to begin_list
.
type EndListOptions = VoidWriterOptions
Type of options that can be passed to end_list
.
type FinishOptions = VoidWriterOptions
Type of options that can be passed to finish
.
fn write_atom(
&mut self,
atom: &str,
_opts: &VoidWriterOptions
) -> Result<(), Infallible>
[src]
&mut self,
atom: &str,
_opts: &VoidWriterOptions
) -> Result<(), Infallible>
fn begin_list(&mut self, _opts: &VoidWriterOptions) -> Result<(), Infallible>
[src]
fn end_list(&mut self, _opts: &Self::EndListOptions) -> Result<(), Infallible>
[src]
fn finish(self, _opts: &Self::FinishOptions) -> Result<(), Infallible>
[src]
Auto Trait Implementations
impl<'a> Send for CompactStringWriter<'a>
impl<'a> Sync for CompactStringWriter<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,