pub fn write_bit(&mut self, bit: bool) {
        let size = self.wpos + 1;
        if size > self.data.len() {
            self.resize(size);
        }

        if bit {
            self.data[self.wpos] |= 1 << (7 - self.wbit);
        }

        self.wbit += 1;

        if self.wbit > 7 {
            self.wbit = 0;
            self.wpos += 1;
        }
    }
/// Append 1 bit value to the buffer.
/// The bit is happened like this :
///
/// ```text
/// ...| XXXXXXXX | 10000000 |....
/// ```
Append 1 bit value to the buffer.
The bit is happened like this .


Append 1 bit value to the buffer . The bit is happened like this .
pub fn write_bit(&mut self, bit: bool) {
        let size = self.wpos + 1;
        if size > self.data.len() {
            self.resize(size);
        }
        if bit {
            self.data[self.wpos] |= 1 << (7 - self.wbit);
        }
        self.wbit += 1;
        if self.wbit > 7 {
            self.wbit = 0;
            self.wpos += 1;
        }
    }
pub fn write_bit ( & mut self , bit : bool ) { let size = self . wpos + 1 ; if size > self . data . len ( ) { self . resize ( size ) ; } if bit { self . data [ self . wpos ] |= 1 << ( 7 - self . wbit ) ; } self . wbit += 1 ; if self . wbit > 7 { self . wbit = 0 ; self . wpos += 1 ; } }
Append 1 bit value to the buffer.
Append 1 bit value to the buffer .
&mut self
bit
bool