Function bitvec::ptr::eq [−][src]
pub fn eq<O, T1, T2>(a: BitPtr<Const, O, T1>, b: BitPtr<Const, O, T2>) -> bool where
O: BitOrder,
T1: BitStore,
T2: BitStore,
BitPtr<Const, O, T1>: PartialEq<BitPtr<Const, O, T2>>,
Compares raw bit-pointers for equality.
This is the same as using the ==
operator, but less generic: the arguments
have to be BitPtr<Const, _, _>
bit-pointers, not anything that implements
PartialEq
.
Original
API Differences
The two pointers can differ in their storage type parameters. bitvec
defines
pointer equality only between pointers with the same underlying BitStore::Mem
register type.
This cannot compare span pointers. *const BitSlice
can be used in the standard
library ptr::eq
and does not need an override.
Examples
use bitvec::prelude::*; use core::cell::Cell; let data = 0u8; let bare_ptr = BitPtr::<_, Lsb0, _>::from_ref(&data); let cell_ptr = bare_ptr.cast::<Cell<u8>>(); assert!(bitvec::ptr::eq(bare_ptr, cell_ptr));