[][src]Trait tinkerforge::byte_converter::ToBytes

pub trait ToBytes {
    fn to_le_byte_vec(_: Self) -> Vec<u8>;

    fn try_to_le_byte_vec(
        var: Self,
        _max_len: usize
    ) -> Result<Vec<u8>, BrickletError>
    where
        Self: Sized
, { ... } }

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.

Loading content...

Provided methods

fn try_to_le_byte_vec(
    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.

Loading content...

Implementations on Foreign Types

impl ToBytes for ()[src]

impl ToBytes for bool[src]

impl ToBytes for u8[src]

impl ToBytes for i8[src]

impl ToBytes for u16[src]

impl ToBytes for i16[src]

impl ToBytes for u32[src]

impl ToBytes for i32[src]

impl ToBytes for u64[src]

impl ToBytes for i64[src]

impl ToBytes for char[src]

impl ToBytes for String[src]

impl ToBytes for f32[src]

impl ToBytes for f64[src]

impl ToBytes for [bool; 2][src]

impl ToBytes for [bool; 4][src]

impl ToBytes for [bool; 8][src]

impl ToBytes for [bool; 10][src]

impl ToBytes for [bool; 13][src]

impl ToBytes for [bool; 16][src]

impl ToBytes for [bool; 32][src]

impl ToBytes for [bool; 168][src]

impl ToBytes for [bool; 432][src]

impl ToBytes for [bool; 440][src]

impl ToBytes for [bool; 448][src]

impl ToBytes for [bool; 464][src]

impl ToBytes for [bool; 472][src]

impl ToBytes for [bool; 480][src]

impl ToBytes for [u8; 3][src]

impl ToBytes for [u8; 4][src]

impl ToBytes for [u8; 6][src]

impl ToBytes for [u8; 7][src]

impl ToBytes for [u8; 8][src]

impl ToBytes for [u8; 12][src]

impl ToBytes for [u8; 15][src]

impl ToBytes for [u8; 16][src]

impl ToBytes for [u8; 32][src]

impl ToBytes for [u8; 52][src]

impl ToBytes for [u8; 56][src]

impl ToBytes for [u8; 58][src]

impl ToBytes for [u8; 59][src]

impl ToBytes for [u8; 60][src]

impl ToBytes for [u8; 61][src]

impl ToBytes for [u8; 62][src]

impl ToBytes for [u8; 64][src]

impl ToBytes for [i8; 4][src]

impl ToBytes for [char; 4][src]

impl ToBytes for [i8; 32][src]

impl ToBytes for [char; 56][src]

impl ToBytes for [char; 58][src]

impl ToBytes for [char; 59][src]

impl ToBytes for [i8; 60][src]

impl ToBytes for [char; 60][src]

impl ToBytes for [char; 61][src]

impl ToBytes for [char; 62][src]

impl ToBytes for [char; 63][src]

impl ToBytes for [u16; 2][src]

impl ToBytes for [u16; 4][src]

impl ToBytes for [u16; 8][src]

impl ToBytes for [u16; 10][src]

impl ToBytes for [u16; 27][src]

impl ToBytes for [u16; 29][src]

impl ToBytes for [u16; 30][src]

impl ToBytes for [u16; 31][src]

impl ToBytes for [i16; 3][src]

impl ToBytes for [i16; 4][src]

impl ToBytes for [i16; 10][src]

impl ToBytes for [i16; 30][src]

impl ToBytes for [u32; 4][src]

impl ToBytes for [i32; 2][src]

impl ToBytes for [u64; 4][src]

impl ToBytes for [u64; 7][src]

impl ToBytes for [i64; 4][src]

Loading content...

Implementors

Loading content...