[−][src]Trait tinkerforge::byte_converter::ToBytes
A trait to serialize the implementing type to a byte vector.
Required methods
fn to_le_byte_vec(_: Self) -> Vec<u8>
Serialize the implementing type to a byte vector.
Provided methods
fn try_to_le_byte_vec(
var: Self,
_max_len: usize
) -> Result<Vec<u8>, BrickletError> where
Self: Sized,
var: Self,
_max_len: usize
) -> Result<Vec<u8>, BrickletError> where
Self: Sized,
Try to serialize the implementing type to a byte vector. If the type is shorter than max_len, it will be padded with zero bytes. Currently this method is only used for strings. Other types use the standard implementation, which calls to_le_byte_vec
without further checks or padding.
Errors
Returns an InvalidArgument error if the type was too long.
Implementations on Foreign Types
impl ToBytes for ()
[src]
fn to_le_byte_vec(_: ()) -> Vec<u8>
[src]
impl ToBytes for bool
[src]
fn to_le_byte_vec(b: bool) -> Vec<u8>
[src]
impl ToBytes for u8
[src]
fn to_le_byte_vec(num: u8) -> Vec<u8>
[src]
impl ToBytes for i8
[src]
fn to_le_byte_vec(num: i8) -> Vec<u8>
[src]
impl ToBytes for u16
[src]
fn to_le_byte_vec(num: u16) -> Vec<u8>
[src]
impl ToBytes for i16
[src]
fn to_le_byte_vec(num: i16) -> Vec<u8>
[src]
impl ToBytes for u32
[src]
fn to_le_byte_vec(num: u32) -> Vec<u8>
[src]
impl ToBytes for i32
[src]
fn to_le_byte_vec(num: i32) -> Vec<u8>
[src]
impl ToBytes for u64
[src]
fn to_le_byte_vec(num: u64) -> Vec<u8>
[src]
impl ToBytes for i64
[src]
fn to_le_byte_vec(num: i64) -> Vec<u8>
[src]
impl ToBytes for char
[src]
fn to_le_byte_vec(c: char) -> Vec<u8>
[src]
impl ToBytes for String
[src]
fn to_le_byte_vec(s: String) -> Vec<u8>
[src]
fn try_to_le_byte_vec(
s: String,
max_len: usize
) -> Result<Vec<u8>, BrickletError>
[src]
s: String,
max_len: usize
) -> Result<Vec<u8>, BrickletError>