pub trait BytesExt: AsBytesRef {
Show 72 methods fn bytes_eq(&self, other: impl AsBytesRef) -> bool { ... }
fn has_prefix(&self, prefix: impl AsBytesRef) -> bool { ... }
fn has_suffix(&self, suffix: impl AsBytesRef) -> bool { ... }
fn longest_prefix(&self, other: impl AsBytesRef) -> &[u8]
Notable traits for &'_ mut [u8]
impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
{ ... }
fn longest_suffix(&self, other: impl AsBytesRef) -> &[u8]
Notable traits for &'_ mut [u8]
impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
{ ... }
fn longest_prefix_lossy(&self, other: impl AsBytesRef) -> Cow<'_, [u8]> { ... }
fn longest_suffix_lossy(&self, other: impl AsBytesRef) -> Cow<'_, [u8]> { ... }
fn to_be_u16_vec(&self) -> Vec<u16> { ... }
fn to_le_u16_vec(&self) -> Vec<u16> { ... }
fn to_ne_u16_vec(&self) -> Vec<u16> { ... }
fn to_be_u32_vec(&self) -> Vec<u32> { ... }
fn to_le_u32_vec(&self) -> Vec<u32> { ... }
fn to_ne_u32_vec(&self) -> Vec<u32> { ... }
fn to_be_usize_vec(&self) -> Vec<usize> { ... }
fn to_le_usize_vec(&self) -> Vec<usize> { ... }
fn to_ne_usize_vec(&self) -> Vec<usize> { ... }
fn to_be_u64_vec(&self) -> Vec<u64> { ... }
fn to_le_u64_vec(&self) -> Vec<u64> { ... }
fn to_ne_u64_vec(&self) -> Vec<u64> { ... }
fn to_be_u128_vec(&self) -> Vec<u128> { ... }
fn to_le_u128_vec(&self) -> Vec<u128> { ... }
fn to_ne_u128_vec(&self) -> Vec<u128> { ... }
fn to_be_i8_vec(&self) -> Vec<i8> { ... }
fn to_le_i8_vec(&self) -> Vec<i8> { ... }
fn to_ne_i8_vec(&self) -> Vec<i8> { ... }
fn to_be_i16_vec(&self) -> Vec<i16> { ... }
fn to_le_i16_vec(&self) -> Vec<i16> { ... }
fn to_ne_i16_vec(&self) -> Vec<i16> { ... }
fn to_be_i32_vec(&self) -> Vec<i32> { ... }
fn to_le_i32_vec(&self) -> Vec<i32> { ... }
fn to_ne_i32_vec(&self) -> Vec<i32> { ... }
fn to_be_i64_vec(&self) -> Vec<i64> { ... }
fn to_le_i64_vec(&self) -> Vec<i64> { ... }
fn to_ne_i64_vec(&self) -> Vec<i64> { ... }
fn to_be_isize_vec(&self) -> Vec<isize> { ... }
fn to_le_isize_vec(&self) -> Vec<isize> { ... }
fn to_ne_isize_vec(&self) -> Vec<isize> { ... }
fn to_be_i128_vec(&self) -> Vec<i128> { ... }
fn to_le_i128_vec(&self) -> Vec<i128> { ... }
fn to_ne_i128_vec(&self) -> Vec<i128> { ... }
fn to_be_f32_vec(&self) -> Vec<f32> { ... }
fn to_le_f32_vec(&self) -> Vec<f32> { ... }
fn to_ne_f32_vec(&self) -> Vec<f32> { ... }
fn to_be_f64_vec(&self) -> Vec<f64> { ... }
fn to_le_f64_vec(&self) -> Vec<f64> { ... }
fn to_ne_f64_vec(&self) -> Vec<f64> { ... }
fn to_u16_slice_lossy(&self) -> Cow<'_, [u16]> { ... }
fn to_u32_slice_lossy(&self) -> Cow<'_, [u32]> { ... }
fn to_usize_slice_lossy(&self) -> Cow<'_, [usize]> { ... }
fn to_u64_slice_lossy(&self) -> Cow<'_, [u64]> { ... }
fn to_u128_slice_lossy(&self) -> Cow<'_, [u128]> { ... }
fn to_i8_slice_lossy(&self) -> Cow<'_, [i8]> { ... }
fn to_i16_slice_lossy(&self) -> Cow<'_, [i16]> { ... }
fn to_i32_slice_lossy(&self) -> Cow<'_, [i32]> { ... }
fn to_i64_slice_lossy(&self) -> Cow<'_, [i64]> { ... }
fn to_isize_slice_lossy(&self) -> Cow<'_, [isize]> { ... }
fn to_i128_slice_lossy(&self) -> Cow<'_, [i128]> { ... }
fn to_f32_slice_lossy(&self) -> Cow<'_, [f32]> { ... }
fn to_f64_slice_lossy(&self) -> Cow<'_, [f64]> { ... }
fn to_u16_slice(&self) -> &[u16] { ... }
fn to_u32_slice(&self) -> &[u32] { ... }
fn to_usize_slice(&self) -> &[usize] { ... }
fn to_u64_slice(&self) -> &[u64] { ... }
fn to_u128_slice(&self) -> &[u128] { ... }
fn to_i8_slice(&self) -> &[i8] { ... }
fn to_i16_slice(&self) -> &[i16] { ... }
fn to_i32_slice(&self) -> &[i32] { ... }
fn to_i64_slice(&self) -> &[i64] { ... }
fn to_isize_slice(&self) -> &[isize] { ... }
fn to_i128_slice(&self) -> &[i128] { ... }
fn to_f32_slice(&self) -> &[f32] { ... }
fn to_f64_slice(&self) -> &[f64] { ... }
}
Expand description

Extensions for bytes

Provided methods

Returns whether the underlying bytes is equal

Returns whether the slice self begins with prefix.

Returns whether the slice self ends with suffix.

Finds the longest shared prefix

Finds the longest shared suffix

Finds the longest shared prefix, return a Cow<’_, u8>.

Finds the longest shared suffix, return a Cow<’_, u8>.

Copy u8 slice to u16 vec in big-endian

Copy u8 slice to u16 vec in little-endian

Copy u8 slice to u16 vec in native-endian

Copy u8 slice to u32 vec in big-endian

Copy u8 slice to u32 vec in little-endian

Copy u8 slice to u32 vec in native-endian

Copy u8 slice to usize vec in big-endian

Copy u8 slice to usize vec in little-endian

Copy u8 slice to usize vec in native-endian

Copy u8 slice to u64 vec in big-endian

Copy u8 slice to u64 vec in little-endian

Copy u8 slice to u64 vec in native-endian

Copy u8 slice to u128 vec in big-endian

Copy u8 slice to u128 vec in little-endian

Copy u8 slice to u128 vec in native-endian

Copy u8 slice to i8 vec in big-endian

Copy u8 slice to i8 vec in little-endian

Copy u8 slice to i8 vec in native-endian

Copy u8 slice to i16 vec in big-endian

Copy u8 slice to i16 vec in little-endian

Copy u8 slice to i16 vec in native-endian

Copy u8 slice to i32 vec in big-endian

Copy u8 slice to i32 vec in little-endian

Copy u8 slice to i32 vec in native-endian

Copy u8 slice to i64 vec in big-endian

Copy u8 slice to i64 vec in little-endian

Copy u8 slice to i64 vec in native-endian

Copy u8 slice to isize vec in big-endian

Copy u8 slice to isize vec in little-endian

Copy u8 slice to isize vec in native-endian

Copy u8 slice to i128 vec in big-endian

Copy u8 slice to i128 vec in little-endian

Copy u8 slice to i128 vec in native-endian

Copy u8 slice to f32 vec in big-endian

Copy u8 slice to f32 vec in little-endian

Copy u8 slice to f32 vec in native-endian

Copy u8 slice to f64 vec in big-endian

Copy u8 slice to f64 vec in little-endian

Copy u8 slice to f64 vec in native-endian

convert u8 slice to Cow<’_, u16> in native-endian (zero-copy)

convert u8 slice to Cow<’_, u32> in native-endian (zero-copy)

convert u8 slice to Cow<’_, usize> in native-endian (zero-copy)

convert u8 slice to Cow<’_, u64> in native-endian (zero-copy)

convert u8 slice to Cow<’_, u128> in native-endian (zero-copy)

convert u8 slice to Cow<’_, i8> in native-endian (zero-copy)

convert u8 slice to Cow<’_, i16> in native-endian (zero-copy)

convert u8 slice to Cow<’_, i32> in native-endian (zero-copy)

convert u8 slice to Cow<’_, i64> in native-endian (zero-copy)

convert u8 slice to Cow<’_, isize> in native-endian (zero-copy)

convert u8 slice to Cow<’_, i128> in native-endian (zero-copy)

convert u8 slice to Cow<’_, f32> in native-endian (zero-copy)

convert u8 slice to Cow<’_, f64> in native-endian (zero-copy)

Convert u8 slice to u16 slice in native-endian(zero-copy)

Convert u8 slice to u32 slice in native-endian(zero-copy)

Convert u8 slice to usize slice in native-endian(zero-copy)

Convert u8 slice to u64 slice in native-endian(zero-copy)

Convert u8 slice to u128 slice in native-endian(zero-copy)

Convert u8 slice to i8 slice in native-endian(zero-copy)

Convert u8 slice to i16 slice in native-endian(zero-copy)

Convert u8 slice to i32 slice in native-endian(zero-copy)

Convert u8 slice to i64 slice in native-endian(zero-copy)

Convert u8 slice to isize slice in native-endian(zero-copy)

Convert u8 slice to i128 slice in native-endian(zero-copy)

Convert u8 slice to f32 slice in native-endian(zero-copy)

Convert u8 slice to f64 slice in native-endian(zero-copy)

Implementations on Foreign Types

Implementors