fn shift(&mut self, value: u8) -> Option<u8> {
        self.register >>= 1;
        self.register |= (value & 1) << 4;
        self.count += 1;
        if self.count == 5 {
            let ret = self.register;
            *self = ShiftRegister::default();
            Some(ret)
        } else {
            None
        }
    }
// This returns Some if the shifting is done, and we have a final value
This returns Some if the shifting is done, and we have a final value
This returns Some if the shifting is done and we have a final value
fn shift(&mut self, value: u8) -> Option<u8> {
        self.register >>= 1;
        self.register |= (value & 1) << 4;
        self.count += 1;
        if self.count == 5 {
            let ret = self.register;
            *self = ShiftRegister::default();
            Some(ret)
        } else {
            None
        }
    }
fn shift ( & mut self , value : u8 ) -> Option < u8 > { self . register >>= 1 ; self . register |= ( value & 1 ) << 4 ; self . count += 1 ; if self . count == 5 { let ret = self . register ; * self = ShiftRegister :: default ( ) ; Some ( ret ) } else { None } }
This returns Some if the shifting is done, and we have a final value
This returns Some if the shifting is done and we have a final value
&mut self
value
u8
&mut self
value
u8