Skip to main content

ReplayTransport

Struct ReplayTransport 

Source
pub struct ReplayTransport { /* private fields */ }
Expand description

A strict in-memory transport for protocol tests and captured golden traces.

用于协议测试和基准轨迹回放的严格内存传输实现。

Implementations§

Source§

impl ReplayTransport

Source

pub fn new(steps: impl IntoIterator<Item = ReplayStep>) -> Self

Create a replay that consumes operations in order. 构建严格按序消费操作的回放。

Source

pub fn remaining(&self) -> usize

Number of operations not yet consumed. 尚未消费的操作数量。

Source

pub fn verify_complete(&self) -> Result<(), TransportError>

Reject incomplete traces with TransportError::ReplayIncomplete. 未完成全部预期操作时返回错误,防止测试遗漏协议步骤。

Trait Implementations§

Source§

impl Clone for ReplayTransport

Source§

fn clone(&self) -> ReplayTransport

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReplayTransport

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ReplayTransport

Source§

fn default() -> ReplayTransport

Returns the “default value” for a type. Read more
Source§

impl ReportIo for ReplayTransport

Source§

fn set_feature( &mut self, report_id: u8, payload: &[u8], ) -> Result<(), TransportError>

Send a feature payload using the backend’s report-ID convention. 按后端的报文 ID 约定发送 Feature 负载;错误不代表可以安全重试。
Source§

fn get_feature( &mut self, report_id: u8, output: &mut [u8], ) -> Result<usize, TransportError>

Read a feature response into the caller’s buffer and return bytes copied. 将 Feature 响应写入调用方缓冲区并返回复制字节数;调用方需校验长度和协议内容。
Source§

fn write_output( &mut self, report_id: u8, payload: &[u8], ) -> Result<(), TransportError>

Send an output report. Backends report I/O errors without semantic retries. 发送 Output 报告;后端返回 I/O 错误,不自行进行语义重试。
Source§

fn read_input(&mut self, output: &mut [u8]) -> Result<usize, TransportError>

Read an input report and return bytes copied; framing belongs to the backend. 读取 Input 报告并返回复制字节数;报文封装由后端处理。

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.