pub(super) fn new<R>(source: &'a mut BitVec<T, O>, range: R) -> Self
	where R: RangeExt<usize> {
		let len = source.len();
		let region = range.normalize(None, len);
		assert!(
			region.end <= len,
			"drains cannot extend past the length of their source bit-vector",
		);

		//  The `.tail` region is everything in the bit-vector after the drain.
		let tail = region.end .. len;
		let drain = unsafe {
			//  Artificially truncate the source bit-vector to before the drain
			//  region. This is restored in the destructor.
			source.set_len_unchecked(region.start);
			let base = source.as_mut_bitptr();
			BitPtrRange {
				start: base.add(region.start),
				end:   base.add(region.end),
			}
		};

		Self {
			source,
			drain,
			tail,
		}
	}
/// Produces a new drain over a region of a bit-vector.
Produces a new drain over a region of a bit-vector.
Produces a new drain over a region of a bit - vector .
pub(super) fn new<R>(source: &'a mut BitVec<T, O>, range: R) -> Self
	where R: RangeExt<usize> {
		let len = source.len();
		let region = range.normalize(None, len);
		assert!(
			region.end <= len,
			"drains cannot extend past the length of their source bit-vector",
		);
		//  The `.tail` region is everything in the bit-vector after the drain.
		let tail = region.end .. len;
		let drain = unsafe {
			//  Artificially truncate the source bit-vector to before the drain
			//  region. This is restored in the destructor.
			source.set_len_unchecked(region.start);
			let base = source.as_mut_bitptr();
			BitPtrRange {
				start: base.add(region.start),
				end:   base.add(region.end),
			}
		};
		Self {
			source,
			drain,
			tail,
		}
	}
pub ( super ) fn new < R > ( source : & ' a mut BitVec < T , O > , range : R ) -> Self where R : RangeExt < usize > { let len = source . len ( ) ; let region = range . normalize ( None , len ) ; assert ! ( region end len " " ) ; //  The `.tail` region is everything in the bit-vector after the drain. let tail = region . end .. len ; let drain = unsafe { //  Artificially truncate the source bit-vector to before the drain //  region. This is restored in the destructor. source . set_len_unchecked ( region . start ) ; let base = source . as_mut_bitptr ( ) ; BitPtrRange { start : base . add ( region . start ) , end : base . add ( region . end ) , } } ; Self { source , drain , tail , } }
Produces a new drain over a region of a bit-vector.
Produces a new drain over a region of a bit - vector .
source
&'a mut BitVec<T, O>
range
R
source
&'a mut BitVec<T, O>
range
R