pub fn encode_str<W>(v: &str, base: Option<&str>, w: &mut Writer<W>) -> io::Result<()>
    where W: Write
{
    if let Some(base) = base {
        if base == v {
            w.write_bool(false)?;
            return Ok(())
        }
    }
    w.write_bool(true)?;
    write_str(v, w)
}
/// Encodes a `&str` without allocating.
///
/// Only encodes if the passed string is different from the base
/// otherwise it just uses a single bit
Encodes a `&str` without allocating.
Only encodes if the passed string is different from the base
otherwise it just uses a single bit
Encodes a ` &str ` without allocating . Only encodes if the passed string is different from the base otherwise it just uses a single bit
pub fn encode_str<W>(v: &str, base: Option<&str>, w: &mut Writer<W>) -> io::Result<()>
    where W: Write
{
    if let Some(base) = base {
        if base == v {
            w.write_bool(false)?;
            return Ok(())
        }
    }
    w.write_bool(true)?;
    write_str(v, w)
}
pub fn encode_str < W > ( v : & str , base : Option < & str > , w : & mut Writer < W > ) -> io :: Result < ( ) > where W : Write { if let Some ( base ) = base { if base == v { w . write_bool ( false ) ? ; return Ok ( ( ) ) } } w . write_bool ( true ) ? ; write_str ( v , w ) }
Encodes a `&str` without allocating.
Encodes a ` &str ` without allocating .
v
&str
base
Option<&str>
w
&mut Writer<W>