ChipFrameFormat

Trait ChipFrameFormat 

Source
pub trait ChipFrameFormat {
    // Required methods
    fn create_header(len: u16) -> Vec<u8> ;
    fn parse_frame_header(
        reader: &mut BufReader<Box<dyn Read + Send>>,
    ) -> Result<usize, RecvError>;
    fn encode_command_data(command: &SifliUartCommand<'_>) -> Vec<u8> ;
    fn decode_response_data(data: &[u8]) -> u32;

    // Provided method
    fn map_address(addr: u32) -> u32 { ... }
}

Required Methods§

Source

fn create_header(len: u16) -> Vec<u8>

Create chip-specific header with appropriate endianness and fields

Source

fn parse_frame_header( reader: &mut BufReader<Box<dyn Read + Send>>, ) -> Result<usize, RecvError>

Parse received frame header and return payload size

Source

fn encode_command_data(command: &SifliUartCommand<'_>) -> Vec<u8>

Encode command data with chip-specific endianness

Source

fn decode_response_data(data: &[u8]) -> u32

Decode response data with chip-specific endianness

Provided Methods§

Source

fn map_address(addr: u32) -> u32

Apply chip-specific address mapping (default: no mapping)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§