pub fn next(&mut self, bit :bool) -> Option<u32> {
		// Assertion test for the paranoid and testing, comment out if you are:
		/*let cur_entry = self.desc_prog[self.pos as usize];
		assert!((cur_entry & (1u32 << 31)) != 0);*/

		//print!("With bit {:?}, pos {:?} becomes pos ", bit, self.pos);
		self.pos = self.desc_prog[self.pos as usize + 1 + bit as usize];
		//print!("{:?}", self.pos);
		let child = self.desc_prog[self.pos as usize];
		if (child & (1u32 << 31)) != 0 {
			//println!(" => None");
			// child has children
			return None;
		} else {
			//println!(" => Some({:?})", child);
			// child has no children, it's a leaf
			self.pos = 0;
			return Some(child);
		}
	}
/// Iterate one level deeper inside the tree.
/// Returns `Some(p)` if it encounters a leaf with a payload p,
/// None if it only processed an inner node.
///
/// Inner nodes don't carry payloads in huffman trees.
///
/// If this function encounters a leaf, it automatically resets
/// the iterator to its starting state.
///
/// # Panics
///
/// Panics if the vorbis huffman treee is empty. It has to be found out
/// what to do if the huffman tree is empty, whether to reject the stream,
/// or whether to do sth else. Finding this out is a TODO.
Iterate one level deeper inside the tree.
Returns `Some(p)` if it encounters a leaf with a payload p,
None if it only processed an inner node.

Inner nodes don't carry payloads in huffman trees.

If this function encounters a leaf, it automatically resets
the iterator to its starting state.
Iterate one level deeper inside the tree . Returns ` Some ( p ) ` if it encounters a leaf with a payload p None if it only processed an inner node . Inner nodes don ' t carry payloads in huffman trees . If this function encounters a leaf it automatically resets the iterator to its starting state .
pub fn next(&mut self, bit :bool) -> Option<u32> {
		// Assertion test for the paranoid and testing, comment out if you are:
		/*let cur_entry = self.desc_prog[self.pos as usize];
		assert!((cur_entry & (1u32 << 31)) != 0);*/
		//print!("With bit {:?}, pos {:?} becomes pos ", bit, self.pos);
		self.pos = self.desc_prog[self.pos as usize + 1 + bit as usize];
		//print!("{:?}", self.pos);
		let child = self.desc_prog[self.pos as usize];
		if (child & (1u32 << 31)) != 0 {
			//println!(" => None");
			// child has children
			return None;
		} else {
			//println!(" => Some({:?})", child);
			// child has no children, it's a leaf
			self.pos = 0;
			return Some(child);
		}
	}
pub fn next ( & mut self , bit : bool ) -> Option < u32 > { // Assertion test for the paranoid and testing, comment out if you are: /*let cur_entry = self.desc_prog[self.pos as usize];
		assert!((cur_entry & (1u32 << 31)) != 0);*/ //print!("With bit {:?}, pos {:?} becomes pos ", bit, self.pos); self . pos = self . desc_prog [ self . pos as usize + 1 + bit as usize ] ; //print!("{:?}", self.pos); let child = self . desc_prog [ self . pos as usize ] ; if ( child & ( 1u32 << 31 ) ) != 0 { //println!(" => None"); // child has children return None ; } else { //println!(" => Some({:?})", child); // child has no children, it's a leaf self . pos = 0 ; return Some ( child ) ; } }
Iterate one level deeper inside the tree.
Iterate one level deeper inside the tree .
&mut self
bit
bool
&mut self
bit
bool
panics
Panics if the vorbis huffman treee is empty. It has to be found out
what to do if the huffman tree is empty, whether to reject the stream,
or whether to do sth else. Finding this out is a TODO.
Panics if the vorbis huffman treee is empty . It has to be found out what to do if the huffman tree is empty whether to reject the stream or whether to do sth else . Finding this out is a TODO .