pub fn from_bitslice(slice: &BitSlice<T, O>) -> Self {
		let bitspan = slice.as_bitspan();

		let mut vec = bitspan
			.elements()
			.pipe(Vec::with_capacity)
			.pipe(ManuallyDrop::new);
		vec.extend(slice.domain());

		let bitspan = unsafe {
			BitSpan::new_unchecked(
				vec.as_mut_ptr().cast::<T>().into_address(),
				bitspan.head(),
				bitspan.len(),
			)
		};
		let capacity = vec.capacity();
		Self { bitspan, capacity }
	}
/// Copies the contents of a bit-slice into a new heap allocation.
///
/// This copies the raw underlying elements into a new allocation, and sets
/// the produced bit-vector to use the same memory layout as the originating
/// bit-slice. This means that it may begin at any bit in the first element,
/// not just the zeroth bit. If you require this property, call
/// [`.force_align()`].
///
/// Dead bits in the copied memory elements are guaranteed to be zeroed.
///
/// ## Examples
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let bits = bits![0, 1, 0, 0, 1];
/// let bv = BitVec::from_bitslice(bits);
/// assert_eq!(bv, bits);
/// ```
///
/// [`.force_align()`]: Self::force_align
Copies the contents of a bit-slice into a new heap allocation.
This copies the raw underlying elements into a new allocation, and sets
the produced bit-vector to use the same memory layout as the originating
bit-slice. This means that it may begin at any bit in the first element,
not just the zeroth bit. If you require this property, call
[`.force_align()`].

Dead bits in the copied memory elements are guaranteed to be zeroed.
Copies the contents of a bit - slice into a new heap allocation . This copies the raw underlying elements into a new allocation and sets the produced bit - vector to use the same memory layout as the originating bit - slice . This means that it may begin at any bit in the first element not just the zeroth bit . If you require this property call [ ` . force_align () ` ] . Dead bits in the copied memory elements are guaranteed to be zeroed .
pub fn from_bitslice(slice: &BitSlice<T, O>) -> Self {
		let bitspan = slice.as_bitspan();
		let mut vec = bitspan
			.elements()
			.pipe(Vec::with_capacity)
			.pipe(ManuallyDrop::new);
		vec.extend(slice.domain());
		let bitspan = unsafe {
			BitSpan::new_unchecked(
				vec.as_mut_ptr().cast::<T>().into_address(),
				bitspan.head(),
				bitspan.len(),
			)
		};
		let capacity = vec.capacity();
		Self { bitspan, capacity }
	}
pub fn from_bitslice ( slice : & BitSlice < T , O > ) -> Self { let bitspan = slice . as_bitspan ( ) ; let mut vec = bitspan . elements ( ) . pipe ( Vec :: with_capacity ) . pipe ( ManuallyDrop :: new ) ; vec . extend ( slice . domain ( ) ) ; let bitspan = unsafe { BitSpan :: new_unchecked ( vec . as_mut_ptr ( ) . cast :: < T > ( ) . into_address ( ) , bitspan . head ( ) , bitspan . len ( ) , ) } ; let capacity = vec . capacity ( ) ; Self { bitspan , capacity } }
Copies the contents of a bit-slice into a new heap allocation.
Copies the contents of a bit - slice into a new heap allocation .
slice
&BitSlice<T, O>
slice
&BitSlice<T, O>
examples
```rust
use bitvec::prelude::*.



[`.force_align()`]: Self::force_align
` ` ` rust use bitvec :: prelude :: * . [ ` . force_align () ` ] : Self :: force_align