pub fn write_string_map(&mut self, map: &HashMap<String, String>) {
        let total_length = map.iter()
            .map(|x| x.0.len() + x.1.len() + if !x.1.is_empty() { 4 } else { 0 })
            .fold(map.len() * 8, |x, y| x + y) as u32;

        self.write_u32(total_length);

        for (k,v) in map {
            self.write_string(k);
            if v.is_empty() {
                self.write_u32(0x0);
            } else {
                self.write_u32(v.len() as u32 + 4);
                self.write_string(v);
            }
        }
    }
/// Writes a `HashMap<String, String>` to the underlying byte sequence.
///
/// # Example
/// ```rust
/// # use sshcerts::ssh::Writer;
/// # use std::collections::HashMap;
/// 
/// let mut writer = Writer::new();
/// let mut example_map = HashMap::new();
/// example_map.insert(String::from("Test"), String::from(""));
/// writer.write_string_map(&example_map);
/// let bytes = writer.into_bytes();
/// assert_eq!(bytes, [0, 0, 0, 12, 0, 0, 0, 4, 84, 101, 115, 116, 0, 0, 0, 0]);
/// ```
Writes a `HashMap` to the underlying byte sequence.
Writes a ` HashMap ` to the underlying byte sequence .
pub fn write_string_map(&mut self, map: &HashMap<String, String>) {
        let total_length = map.iter()
            .map(|x| x.0.len() + x.1.len() + if !x.1.is_empty() { 4 } else { 0 })
            .fold(map.len() * 8, |x, y| x + y) as u32;
        self.write_u32(total_length);
        for (k,v) in map {
            self.write_string(k);
            if v.is_empty() {
                self.write_u32(0x0);
            } else {
                self.write_u32(v.len() as u32 + 4);
                self.write_string(v);
            }
        }
    }
pub fn write_string_map ( & mut self , map : & HashMap < String , String > ) { let total_length = map . iter ( ) . map ( | x | x . 0 . len ( ) + x . 1 . len ( ) + if ! x . 1 . is_empty ( ) { 4 } else { 0 } ) . fold ( map . len ( ) * 8 , | x , y | x + y ) as u32 ; self . write_u32 ( total_length ) ; for ( k , v ) in map { self . write_string ( k ) ; if v . is_empty ( ) { self . write_u32 ( 0x0 ) ; } else { self . write_u32 ( v . len ( ) as u32 + 4 ) ; self . write_string ( v ) ; } } }
Writes a `HashMap<String, String>` to the underlying byte sequence.
Writes a ` HashMap<String String > ` to the underlying byte sequence .
&mut self
map
&HashMap<String, String>
example
None
use sshcerts::ssh::writer;
None
use std::collections::hashmap;
None