Trait isotp_rs::IsoTpFrame
source · pub trait IsoTpFrame: Sized + Send {
// Required methods
fn decode<T: AsRef<[u8]>>(data: T) -> Result<Self, Error>;
fn encode(self, padding: Option<u8>) -> Vec<u8>;
fn from_data<T: AsRef<[u8]>>(
data: T,
flow_ctrl: Vec<FlowControlContext>,
) -> Result<Vec<Self>, Error>;
fn single_frame<T: AsRef<[u8]>>(data: T) -> Result<Self, Error>;
fn flow_ctrl_frame(
state: FlowControlState,
suppress_positive: bool,
st_min: u8,
) -> Result<Self, Error>;
// Provided method
fn default_flow_ctrl_frame() -> Self { ... }
}Expand description
ISO-TP frame trait define.
Required Methods§
sourcefn decode<T: AsRef<[u8]>>(data: T) -> Result<Self, Error>
fn decode<T: AsRef<[u8]>>(data: T) -> Result<Self, Error>
Decode frame from origin data like 02 10 01.
§Parameters
data- the source data.
§Return
A struct that implements IsoTpFrame if parameters are valid.
sourcefn from_data<T: AsRef<[u8]>>(
data: T,
flow_ctrl: Vec<FlowControlContext>,
) -> Result<Vec<Self>, Error>
fn from_data<T: AsRef<[u8]>>( data: T, flow_ctrl: Vec<FlowControlContext>, ) -> Result<Vec<Self>, Error>
sourcefn single_frame<T: AsRef<[u8]>>(data: T) -> Result<Self, Error>
fn single_frame<T: AsRef<[u8]>>(data: T) -> Result<Self, Error>
New single frame from data.
data- the single frame data
§Returns
A new SingleFrame if parameters are valid.
sourcefn flow_ctrl_frame(
state: FlowControlState,
suppress_positive: bool,
st_min: u8,
) -> Result<Self, Error>
fn flow_ctrl_frame( state: FlowControlState, suppress_positive: bool, st_min: u8, ) -> Result<Self, Error>
New flow control frame from data.
§Parameters
state-FlowControlStatest_min- separation time minimumsuppress_positive- true if suppress positive else false
§Returns
A new FlowControlFrame if parameters are valid.
Provided Methods§
fn default_flow_ctrl_frame() -> Self
Object Safety§
This trait is not object safe.