fn decode_bytes(&mut self, bytes: &[u8]) -> Vec<u8> {
        let mut output = Vec::new();
        if self.is_finished() {
            return output;
        }
        'byte_loop: for mut byte in bytes.iter().cloned() {
            for _ in 0..8 {
                self.tree = match self.tree {
                    HuffmanTree::Node { left, right, .. } => {
                        if byte % 2 == 0 { left } else { right }
                    }
                    HuffmanTree::Leaf { .. } => {
                        unreachable!()
                    }
                };
                byte /= 2;
                if let HuffmanTree::Leaf { byte, .. } = self.tree {
                    output.push(*byte);
                    self.tree = self.root;
                    self.n_symbols -= 1;
                    if self.is_finished() {
                        break 'byte_loop;
                    }
                };
            }
        }
        output
    }
/// Advance in the tree with the given encoded bytes, yielding the
/// decoded bytes.
Advance in the tree with the given encoded bytes, yielding the
decoded bytes.
Advance in the tree with the given encoded bytes yielding the decoded bytes .
fn decode_bytes(&mut self, bytes: &[u8]) -> Vec<u8> {
        let mut output = Vec::new();
        if self.is_finished() {
            return output;
        }
        'byte_loop: for mut byte in bytes.iter().cloned() {
            for _ in 0..8 {
                self.tree = match self.tree {
                    HuffmanTree::Node { left, right, .. } => {
                        if byte % 2 == 0 { left } else { right }
                    }
                    HuffmanTree::Leaf { .. } => {
                        unreachable!()
                    }
                };
                byte /= 2;
                if let HuffmanTree::Leaf { byte, .. } = self.tree {
                    output.push(*byte);
                    self.tree = self.root;
                    self.n_symbols -= 1;
                    if self.is_finished() {
                        break 'byte_loop;
                    }
                };
            }
        }
        output
    }
fn decode_bytes ( & mut self , bytes : & [ u8 ] ) -> Vec < u8 > { let mut output = Vec :: new ( ) ; if self . is_finished ( ) { return output ; } ' byte_loop : for mut byte in bytes . iter ( ) . cloned ( ) { for _ in 0 .. 8 { self . tree = match self . tree { HuffmanTree :: Node { left , right , .. } => { if byte % 2 == 0 { left } else { right } } HuffmanTree :: Leaf { .. } => { unreachable ! ( ) } } ; byte /= 2 ; if let HuffmanTree :: Leaf { byte , .. } = self . tree { output . push ( * byte ) ; self . tree = self . root ; self . n_symbols -= 1 ; if self . is_finished ( ) { break ' byte_loop ; } } ; } } output }
Advance in the tree with the given encoded bytes, yielding the
decoded bytes.
Advance in the tree with the given encoded bytes yielding the decoded bytes .
&mut self
bytes
&[u8]
&mut self
bytes
&[u8]