[−][src]Trait Rusty_CryptoAuthLib::ConvertTo
Helper trait to convert ATCA_CMD_SIZE_MAX (151-byte) array to
- a 3-byte (ATCA_RSP_SIZE_MIN-1) array
- or a 64-byte array
This is just to optimize runtime space requirements. We use a ATCA_CMD_SIZE_MAX (151-byte) array to store all responses from the ATECC device as Rust does not yet support code that is generic over the size of an array type i.e. [Foo; 3] and [Bar; 3] are instances of same generic type [T; 3], but [Foo; 3] and [Foo; 5] are entirely different types.
Required methods
fn convert_to_3(&self) -> [u8; 3]
Trait to convert any array (of u8s) of size > 3 to a 3 byte array.
fn convert_to_4(&self) -> [u8; 4]
Trait to convert any array (of u8s) of size > 4 to a 4 byte array.
fn convert_to_32(&self) -> [u8; 32]
Trait to convert any array (of u8s) of size > 32 to a 32 byte array.
fn convert_to_64(&self) -> [u8; 64]
Trait to convert any array (of u8s) of size > 64 to a 64 byte array.
Implementors
impl ConvertTo for [u8; 151]
[src]
fn convert_to_3(&self) -> [u8; 3]
[src]
This method takes a reference to self
(an array) and returns the first 3-bytes.
Responses that do not contain data are 4 bytes in length. The method send_packet
returns
a [u8;151] which does not include the count (or first) byte. So, we only need to pick the first 3 bytes.
fn convert_to_4(&self) -> [u8; 4]
[src]
This method takes a reference to self
(an array) and returns the first 4-bytes.
fn convert_to_64(&self) -> [u8; 64]
[src]
This method takes a reference to self
(an array) and returns the first 64-bytes.
fn convert_to_32(&self) -> [u8; 32]
[src]
This method takes a reference to self
(an array) and returns the first 32-bytes.