[][src]Trait sbitty::GetBit

pub trait GetBit {
    fn get_bit(&self, idx: usize) -> Option<bool>;
}

performing _ & (1 << idx) with n the index

Examples

Getting bits in an u8

assert.eq!(0b1000_0000u8.get_bit( 7 ) , Some(true));
assert.eq!(0b1111_1110u8.get_bit( 0 ) , Some(false));
assert.eq!(0b0000_0000u8.get_bit( 8 ) , None);

Required methods

fn get_bit(&self, idx: usize) -> Option<bool>

Loading content...

Implementors

impl GetBit for i8[src]

impl GetBit for i16[src]

impl GetBit for i32[src]

impl GetBit for i64[src]

impl GetBit for isize[src]

impl GetBit for u8[src]

impl GetBit for u16[src]

impl GetBit for u32[src]

impl GetBit for u64[src]

impl GetBit for usize[src]

Loading content...