Currently Iter and BitValIter have identical bodies, but only the former implements Send.
#[repr(transparent)]
#[doc = include_str!("../../doc/slice/iter/Iter.md")]
pub struct Iter<'a, T, O>
where
T: 'a + BitStore,
O: BitOrder,
{
/// A dual-pointer range of the bit-slice undergoing iteration.
///
/// This structure stores two fully-decode pointers to the first live and
/// first dead bits, trading increased size (three words instead of two) for
/// faster performance when iterating.
range: BitPtrRange<Const, T, O>,
/// `Iter` is semantically equivalent to a `&BitSlice`.
_ref: PhantomData<&'a BitSlice<T, O>>,
}
...
pub struct BitValIter<'a, T, O>
where
T: 'a + BitStore,
O: BitOrder,
{
/// The start and end bit-pointers in the iteration region.
range: BitPtrRange<Const, T, O>,
/// Hold the lifetime of the source region, so that this does not cause UAF.
_life: PhantomData<&'a BitSlice<T, O>>,
}
It would be nice if BitValIter could also implement Send so it can be used as a direct replacement for Iter where bool values are needed
Currently
Iter
andBitValIter
have identical bodies, but only the former implementsSend
.It would be nice if
BitValIter
could also implementSend
so it can be used as a direct replacement forIter
wherebool
values are needed