pub fn split_to(&mut self, at: usize) -> Bytes {
        assert!(at <= self.len());

        if at == self.len() {
            return mem::replace(self, Bytes::new());
        }

        if at == 0 {
            Bytes::new()
        } else {
            Bytes {
                inner: self.inner.split_to(at, true),
            }
        }
    }
/// Splits the bytes into two at the given index.
///
/// Afterwards `self` contains elements `[at, len)`, and the returned
/// `Bytes` contains elements `[0, at)`.
///
/// This is an `O(1)` operation that just increases the reference count and
/// sets a few indices.
///
/// # Examples
///
/// ```
/// use ntex_bytes::Bytes;
///
/// let mut a = Bytes::from(&b"hello world"[..]);
/// let b = a.split_to(5);
///
/// assert_eq!(&a[..], b" world");
/// assert_eq!(&b[..], b"hello");
/// ```
///
/// # Panics
///
/// Panics if `at > len`.
Splits the bytes into two at the given index.

This is an `O(1)` operation that just increases the reference count and
sets a few indices.
Splits the bytes into two at the given index . This is an ` O ( 1 ) ` operation that just increases the reference count and sets a few indices .
pub fn split_to(&mut self, at: usize) -> Bytes {
        assert!(at <= self.len());
        if at == self.len() {
            return mem::replace(self, Bytes::new());
        }
        if at == 0 {
            Bytes::new()
        } else {
            Bytes {
                inner: self.inner.split_to(at, true),
            }
        }
    }
pub fn split_to ( & mut self , at : usize ) -> Bytes { assert ! ( at self len ( ) ) ; if at == self . len ( ) { return mem :: replace ( self , Bytes :: new ( ) ) ; } if at == 0 { Bytes :: new ( ) } else { Bytes { inner : self . inner . split_to ( at , true ) , } } }
Splits the bytes into two at the given index.
Splits the bytes into two at the given index .
&mut self
at
usize
&mut self
at
usize
examples
```
use ntex_bytes::Bytes.

let mut a = Bytes::from(&b"hello world"[..]);
let b = a.split_to(5).


` ` ` use ntex_bytes :: Bytes . let mut a = Bytes :: from ( &b " hello world " [ .. ] ) ; let b = a . split_to ( 5 ) .
panics
Panics if `at > len`.
Panics if ` at > len ` .