1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
#![doc = include_str!("../../doc/array/api.md")]
use super::BitArray;
use crate::{
order::BitOrder,
slice::BitSlice,
view::BitViewSized,
};
impl<A, O> BitArray<A, O>
where
A: BitViewSized,
O: BitOrder,
{
/// Returns a bit-slice containing the entire bit-array. Equivalent to
/// `&a[..]`.
///
/// Because `BitArray` can be viewed as a slice of bits or as a slice of
/// elements with equal ease, you should switch to using [`.as_bitslice()`]
/// or [`.as_raw_slice()`] to make your choice explicit.
///
/// ## Original
///
/// [`array::as_slice`](https://doc.rust-lang.org/std/primitive.array.html#method.as_slice)
///
/// [`.as_bitslice()`]: Self::as_bitslice
/// [`.as_raw_slice()`]: Self::as_raw_slice
#[inline]
#[cfg(not(tarpaulin_include))]
#[deprecated = "use `.as_bitslice()` or `.as_raw_slice()` instead"]
pub fn as_slice(&self) -> &BitSlice<A::Store, O> {
self.as_bitslice()
}
/// Returns a mutable bit-slice containing the entire bit-array. Equivalent
/// to `&mut a[..]`.
///
/// Because `BitArray` can be viewed as a slice of bits or as a slice of
/// elements with equal ease, you should switch to using
/// [`.as_mut_bitslice()`] or [`.as_raw_mut_slice()`] to make your choice
/// explicit.
///
/// ## Original
///
/// [`array::as_mut_slice`](https://doc.rust-lang.org/std/primitive.array.html#method.as_mut_slice)
///
/// [`.as_mut_bitslice()`]: Self::as_mut_bitslice
/// [`.as_raw_mut_slice()`]: Self::as_raw_mut_slice
#[inline]
#[cfg(not(tarpaulin_include))]
#[deprecated = "use `.as_mut_bitslice()` or `.as_raw_mut_slice()` instead"]
pub fn as_mut_slice(&mut self) -> &mut BitSlice<A::Store, O> {
self.as_mut_bitslice()
}
}