Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Send for BitValIter #258

Open
akoshelev opened this issue Dec 15, 2023 · 0 comments
Open

Implement Send for BitValIter #258

akoshelev opened this issue Dec 15, 2023 · 0 comments

Comments

@akoshelev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant