pub fn starts_with<T2, O2>(&self, needle: &BitSlice<T2, O2>) -> bool
	where
		T2: BitStore,
		O2: BitOrder,
	{
		self.get(.. needle.len())
			.map(|slice| slice == needle)
			.unwrap_or(false)
	}
/// Tests if the bit-slice begins with the given sequence.
///
/// The search key does not need to share type parameters with the bit-slice
/// being tested, as the comparison is bit-wise. However, sharing type
/// parameters will accelerate the comparison.
///
/// ## Original
///
/// [`slice::starts_with`](https://doc.rust-lang.org/std/primitive.slice.html#method.starts_with)
///
/// ## Examples
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let bits = bits![0, 1, 1, 0];
/// assert!( bits.starts_with(bits![0, 1]));
/// assert!(!bits.starts_with(bits![1, 0]));
/// ```
///
/// This always returns `true` if the needle is empty:
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let bits = bits![0, 1, 0];
/// let empty = bits![];
/// assert!(bits.starts_with(empty));
/// assert!(empty.starts_with(empty));
/// ```
Tests if the bit-slice begins with the given sequence.
The search key does not need to share type parameters with the bit-slice
being tested, as the comparison is bit-wise. However, sharing type
parameters will accelerate the comparison.
Tests if the bit - slice begins with the given sequence . The search key does not need to share type parameters with the bit - slice being tested as the comparison is bit - wise . However sharing type parameters will accelerate the comparison .
pub fn starts_with<T2, O2>(&self, needle: &BitSlice<T2, O2>) -> bool
	where
		T2: BitStore,
		O2: BitOrder,
	{
		self.get(.. needle.len())
			.map(|slice| slice == needle)
			.unwrap_or(false)
	}
pub fn starts_with < T2 , O2 > ( & self , needle : & BitSlice < T2 , O2 > ) -> bool where T2 : BitStore , O2 : BitOrder , { self . get ( .. needle . len ( ) ) . map ( | slice | slice == needle ) . unwrap_or ( false ) }
Tests if the bit-slice begins with the given sequence.
Tests if the bit - slice begins with the given sequence .
&self
needle
&BitSlice<T2, O2>
&self
needle
&BitSlice<T2, O2>
original
None
examples
```rust
use bitvec::prelude::*.



This always returns `true` if the needle is empty.

```rust
use bitvec::prelude::*.

let bits = bits![0, 1, 0];
let empty = bits![];
assert!(bits.starts_with(empty));
assert!(empty.starts_with(empty));
```
` ` ` rust use bitvec :: prelude :: * . This always returns ` true ` if the needle is empty . ` ` ` rust use bitvec :: prelude :: * . let bits = bits! [ 0 1 0 ] ; let empty = bits! [] ; assert! ( bits . starts_with ( empty )) ; assert! ( empty . starts_with ( empty )) ; ` ` `