| 105 | /// 必须是 Send,以便在 Tokio 任务中运行 |
| 106 | #[async_trait] |
| 107 | pub trait Stream: Send { |
| 108 | /// 启动采集 (Alloc buffers, Start DMA) |
| 109 | async fn start(&mut self) -> Result<()>; |
| 110 | |
| 111 | /// 停止采集 (Release bandwidth) |
| 112 | async fn stop(&mut self) -> Result<()>; |
| 113 | |
| 114 | /// 获取下一帧 |
| 115 | /// 注意:这里返回的 Frame 生命周期绑定到 self (Stream) |
| 116 | /// 实现 Ring Buffer 的借用语义 |
| 117 | async fn next_frame(&mut self) -> Result<Frame<'_>>; |
| 118 | |
| 119 | /// 【逃生舱口】直接注入虚拟帧 (用于仿真) |
| 120 | #[cfg(feature = "simulation")] |
| 121 | async fn inject_frame(&mut self, frame: Frame<'_>) -> Result<()>; |
| 122 | } |
| 123 | |
| 124 | /// 3. 控制面聚合体 |
| 125 | #[allow(missing_debug_implementations)] |