IntoBytes

Trait IntoBytes 

Source
pub trait IntoBytes {
    // Required method
    fn into_bytes(self) -> Vec<u8> ;
}
Expand description

Trait for consuming data into an owned byte vector. This trait is for types that can be meaningfully converted into a Vec< u8 > by consuming the original value.

Required Methods§

Source

fn into_bytes(self) -> Vec<u8>

Consumes the value and returns its byte representation as an owned Vec< u8 >.

Implementations on Foreign Types§

Source§

impl IntoBytes for &str

Implementation for &str. This handles string slices specifically.

Source§

impl IntoBytes for CString

Implementation for CString. Returns the byte slice without the trailing NUL byte.

Source§

impl IntoBytes for String

Implementation for String.

Source§

impl<T> IntoBytes for &[T]
where T: Pod,

Implementation for &[T] where T is Pod. This handles slices of POD types specifically.

Source§

impl<T> IntoBytes for &T
where T: Pod,

Implementation for &T.

Source§

impl<T> IntoBytes for (T,)
where T: Pod,

Implementation for single POD types wrapped in a tuple (T,). This mirrors the approach used in AsBytes for consistency with single items. Covers primitive types (u8, i32, f64, bool, etc.) and other POD structs when wrapped.

Source§

impl<T> IntoBytes for Box<[T]>
where T: Pod,

Implementation for Box<[T]> where T is POD.

Source§

impl<T> IntoBytes for Box<T>
where T: Pod,

Implementation for Box where T is POD.

Source§

impl<T> IntoBytes for VecDeque<T>
where T: Pod,

Implementation for VecDeque where T is POD.

Source§

impl<T> IntoBytes for Vec<T>
where T: Pod,

Implementation for owned vectors of POD types.

Source§

impl<T, const N: usize> IntoBytes for [T; N]
where T: Pod,

Implementation for owned arrays of POD types.

Implementors§