pub struct ReplayTransport { /* private fields */ }Expand description
A strict in-memory transport for protocol tests and captured golden traces.
用于协议测试和基准轨迹回放的严格内存传输实现。
Implementations§
Source§impl ReplayTransport
impl ReplayTransport
Sourcepub fn new(steps: impl IntoIterator<Item = ReplayStep>) -> Self
pub fn new(steps: impl IntoIterator<Item = ReplayStep>) -> Self
Create a replay that consumes operations in order. 构建严格按序消费操作的回放。
Sourcepub fn verify_complete(&self) -> Result<(), TransportError>
pub fn verify_complete(&self) -> Result<(), TransportError>
Reject incomplete traces with TransportError::ReplayIncomplete.
未完成全部预期操作时返回错误,防止测试遗漏协议步骤。
Trait Implementations§
Source§impl Clone for ReplayTransport
impl Clone for ReplayTransport
Source§fn clone(&self) -> ReplayTransport
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReplayTransport
impl Debug for ReplayTransport
Source§impl Default for ReplayTransport
impl Default for ReplayTransport
Source§fn default() -> ReplayTransport
fn default() -> ReplayTransport
Returns the “default value” for a type. Read more
Source§impl ReportIo for ReplayTransport
impl ReportIo for ReplayTransport
Source§fn set_feature(
&mut self,
report_id: u8,
payload: &[u8],
) -> Result<(), TransportError>
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>
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>
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>
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§
impl Freeze for ReplayTransport
impl RefUnwindSafe for ReplayTransport
impl Send for ReplayTransport
impl Sync for ReplayTransport
impl Unpin for ReplayTransport
impl UnsafeUnpin for ReplayTransport
impl UnwindSafe for ReplayTransport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more