pub fn encode_str(&self, s: &str) -> Option<Vec<char>> {
        let mut res = Vec::new();
        for c in s.chars(){
            let v = self.encode_char(c)?;
            res.extend(v.into_iter());
        }
        Some(res)
    }
// iterate over all chars on string, and convert to Huffman coder format
iterate over all chars on string, and convert to Huffman coder format
iterate over all chars on string and convert to Huffman coder format
pub fn encode_str(&self, s: &str) -> Option<Vec<char>> {
        let mut res = Vec::new();
        for c in s.chars(){
            let v = self.encode_char(c)?;
            res.extend(v.into_iter());
        }
        Some(res)
    }
pub fn encode_str ( & self , s : & str ) -> Option < Vec < char > > { let mut res = Vec :: new ( ) ; for c in s . chars ( ) { let v = self . encode_char ( c ) ? ; res . extend ( v . into_iter ( ) ) ; } Some ( res ) }
iterate over all chars on string, and convert to Huffman coder format
iterate over all chars on string and convert to Huffman coder format
&self
s
&str
&self
s
&str