pub fn from_element(elem: &T) -> &Self {
		unsafe {
			BitPtr::from_ref(elem)
				.span_unchecked(mem::bits_of::<T::Mem>())
				.into_bitslice_ref()
		}
	}
/// Constructs a shared `&BitSlice` reference over a shared element.
///
/// The [`BitView`] trait, implemented on all [`BitStore`] implementors,
/// provides a [`.view_bits::<O>()`] method which delegates to this function
/// and may be more convenient for you to write.
///
/// ## Parameters
///
/// - `elem`: A shared reference to a memory element.
///
/// ## Returns
///
/// A shared `&BitSlice` over `elem`.
///
/// ## Examples
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let elem = 0u8;
/// let bits = BitSlice::<_, Lsb0>::from_element(&elem);
/// assert_eq!(bits.len(), 8);
///
/// let bits = elem.view_bits::<Lsb0>();
/// ```
///
/// [`BitStore`]: crate::store::BitStore
/// [`BitView`]: crate::view::BitView
/// [`.view_bits::<O>()`]: crate::view::BitView::view_bits
Constructs a shared `&BitSlice` reference over a shared element.
Constructs a shared ` &BitSlice ` reference over a shared element .
pub fn from_element(elem: &T) -> &Self {
		unsafe {
			BitPtr::from_ref(elem)
				.span_unchecked(mem::bits_of::<T::Mem>())
				.into_bitslice_ref()
		}
	}
pub fn from_element ( elem : & T ) -> & Self { unsafe { BitPtr :: from_ref ( elem ) . span_unchecked ( mem :: bits_of :: < T :: Mem > ( ) ) . into_bitslice_ref ( ) } }
Constructs a shared `&BitSlice` reference over a shared element.
Constructs a shared ` &BitSlice ` reference over a shared element .
elem
&T
A shared `&BitSlice` over `elem`.
A shared ` &BitSlice ` over ` elem ` .
elem
&T
A shared reference to a memory element.
A shared reference to a memory element .
examples
```rust
use bitvec::prelude::*.

let elem = 0u8;
let bits = BitSlice::<_, Lsb0>::from_element(&elem);
assert_eq!(bits.len(), 8).



[`BitStore`]: crate::store::BitStore
[`BitView`]: crate::view::BitView
[`.view_bits::()`]: crate::view::BitView::view_bits
` ` ` rust use bitvec :: prelude :: * . let elem = 0u8 ; let bits = BitSlice :: <_ Lsb0 > :: from_element ( &elem ) ; assert_eq! ( bits . len () 8 ) . [ ` BitStore ` ] : crate :: store :: BitStore [ ` BitView ` ] : crate :: view :: BitView [ ` . view_bits :: () ` ] : crate :: view :: BitView :: view_bits