Function read
pub unsafe fn read<T, O>(src: BitPtr<Const, T, O>) -> boolExpand description
§Single-Bit Read
This reads the bit out of src directly.
§Original
§Safety
Because this performs a dereference of memory, it inherits the original
ptr::read’s requirements:
- srcmust be valid to read.
- srcmust be properly aligned. This is an invariant of the- BitPtrtype as well as of the memory access.
- srcmust point to an initialized value of- T.
§Examples
use bitvec::prelude::*;
use bitvec::ptr as bv_ptr;
let data = 128u8;
let ptr = BitPtr::<_, _, Msb0>::from_ref(&data);
assert!(unsafe { bv_ptr::read(ptr) });