Struct cssparser::CssStringWriter [] [src]

pub struct CssStringWriter<'a, W: 'a> {
    // some fields omitted
}

A fmt::Write adapter that escapes text for writing as a double-quoted CSS string. Quotes are not included.

Typical usage:

fn write_foo<W>(foo: &Foo, dest: &mut W) -> fmt::Result where W: fmt::Write {
    try!(dest.write_str("\""));
    {
        let mut string_dest = CssStringWriter::new(dest);
        // Write into string_dest...
    }
    try!(dest.write_str("\""));
    Ok(())
}

Methods

impl<'a, W> CssStringWriter<'a, W> where W: Write
[src]

fn new(inner: &'a mut W) -> CssStringWriter<'a, W>

Wrap a text writer to create a CssStringWriter.

Trait Implementations

impl<'a, W> Write for CssStringWriter<'a, W> where W: Write
[src]

fn write_str(&mut self, s: &str) -> Result

Writes a slice of bytes into this writer, returning whether the write succeeded. Read more

fn write_char(&mut self, c: char) -> Result<()Error>
1.1.0

Writes a char into this writer, returning whether the write succeeded. Read more

fn write_fmt(&mut self, args: Arguments) -> Result<()Error>
1.0.0

Glue for usage of the write! macro with implementors of this trait. Read more