/// Writes the palette map using the given writer.
/// The output content will follow the same format described in [from_stream()]
/// The name/color pairs will be sorted by name in lexicographic order.
Writes the palette map using the given writer.
The output content will follow the same format described in [from_stream()]
The name/color pairs will be sorted by name in lexicographic order.
Writes the palette map using the given writer . The output content will follow the same format described in [ from_stream () ] The name / color pairs will be sorted by name in lexicographic order .
pub fn to_writer(&self, writer: &mut dyn io::Write) -> io::Result<()> {
        let mut entries = self.0.iter().collect::<Vec<_>>();
        // We sort the palette because the Perl implementation does.
        entries.sort_unstable();
        for (name, color) in entries {
            writer.write_all(
                format!("{}->rgb({},{},{})\n", name, color.r, color.g, color.b).as_bytes(),
            )?
        }
        Ok(())
    }
pub fn to_writer ( & self , writer : & mut dyn io :: Write ) -> io :: Result < ( ) > { let mut entries = self . 0 . iter ( ) . collect :: < Vec < _ > > ( ) ; // We sort the palette because the Perl implementation does. entries . sort_unstable ( ) ; for ( name , color ) in entries { writer . write_all ( format ! ( " \n " name color r color g color b ) . as_bytes ( ) , ) ? } Ok ( ( ) ) }
Writes the palette map using the given writer.
Writes the palette map using the given writer .
&self
writer
&mut dyn io::Write