Skip to main content

FeatureExchange

Struct FeatureExchange 

Source
pub struct FeatureExchange<T, D = ThreadDelay> { /* private fields */ }
Expand description

A serialized classic feature-report exchange over a byte transport.

字节传输之上的串行经典功能报文交换。

Implementations§

Source§

impl<T> FeatureExchange<T, ThreadDelay>

Source

pub fn new(transport: T, policy: ExchangePolicy) -> Self

Source§

impl<T, D> FeatureExchange<T, D>

Source

pub fn with_delay(transport: T, policy: ExchangePolicy, delay: D) -> Self

Source

pub const fn policy(&self) -> &ExchangePolicy

Source

pub fn into_parts(self) -> (T, D)

Source§

impl<T: ReportIo, D: Delay> FeatureExchange<T, D>

Source

pub fn execute(&mut self, request: &Report90) -> Result<Report90, ExchangeError>

Send one request and return a validated response.

Command class and ID are always validated. Transaction ID and remaining packet validation are policy controlled because upstream devices differ.

发送一条请求并返回已校验响应。始终校验命令类与命令 ID;因上游设备存在差异,事务 ID 和剩余包数由策略决定是否校验。

Auto Trait Implementations§

§

impl<T, D> Freeze for FeatureExchange<T, D>
where T: Freeze, D: Freeze,

§

impl<T, D> RefUnwindSafe for FeatureExchange<T, D>

§

impl<T, D> Send for FeatureExchange<T, D>
where T: Send, D: Send,

§

impl<T, D> Sync for FeatureExchange<T, D>
where T: Sync, D: Sync,

§

impl<T, D> Unpin for FeatureExchange<T, D>
where T: Unpin, D: Unpin,

§

impl<T, D> UnsafeUnpin for FeatureExchange<T, D>
where T: UnsafeUnpin, D: UnsafeUnpin,

§

impl<T, D> UnwindSafe for FeatureExchange<T, D>
where T: UnwindSafe, D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.