pub struct BackendKind { /* private fields */ }Expand description
Type-erased backend wrapper for use in the stream scheduler.
Fallible construction rejects a runtime kind that initially disagrees with
DacCapabilities::output_model, and connection revalidates the invariant
after backend initialization. Runtime dispatch is always derived from the
private variant; capabilities remain discovery metadata and select the
concrete FIFO pacing adapter.
Implementations§
Source§impl BackendKind
impl BackendKind
Sourcepub fn fifo(backend: Box<dyn FifoBackend>) -> Result<Self>
pub fn fifo(backend: Box<dyn FifoBackend>) -> Result<Self>
Wrap a FIFO backend, rejecting frame-swap capability metadata.
Sourcepub fn frame_swap(backend: Box<dyn FrameSwapBackend>) -> Result<Self>
pub fn frame_swap(backend: Box<dyn FrameSwapBackend>) -> Result<Self>
Wrap a frame-swap backend, requiring frame-swap capability metadata.
Sourcepub fn validate_output_model(&self) -> Result<()>
pub fn validate_output_model(&self) -> Result<()>
Verify that capability metadata agrees with the runtime backend kind.
Sourcepub fn caps(&self) -> &DacCapabilities
pub fn caps(&self) -> &DacCapabilities
Returns the device capabilities.
Sourcepub fn connect(&mut self) -> Result<()>
pub fn connect(&mut self) -> Result<()>
Connect to the device and revalidate metadata that may have changed while the concrete backend initialized itself.
Sourcepub fn disconnect(&mut self) -> Result<()>
pub fn disconnect(&mut self) -> Result<()>
Disconnect from the device.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns whether the device is connected.
Sourcepub fn set_shutter(&mut self, open: bool) -> Result<()>
pub fn set_shutter(&mut self, open: bool) -> Result<()>
Open/close the shutter.
Sourcepub fn try_write(
&mut self,
pps: u32,
points: &[LaserPoint],
) -> Result<WriteOutcome>
pub fn try_write( &mut self, pps: u32, points: &[LaserPoint], ) -> Result<WriteOutcome>
Safely attempt a write.
FIFO backends call FifoBackend::try_write_points. Frame-swap
backends call the conservative FrameSwapBackend::write_frame, which
owns any required readiness probe.
Sourcepub fn estimator(&self) -> Option<&dyn BufferEstimator>
pub fn estimator(&self) -> Option<&dyn BufferEstimator>
The protocol-owned BufferEstimator for FIFO backends.
Frame-swap backends never queue points, so they return None.
Sourcepub fn target_buffer_ceiling(&self) -> Option<usize>
pub fn target_buffer_ceiling(&self) -> Option<usize>
The FIFO backend’s FifoBackend::target_buffer_ceiling.
Frame-swap backends never queue points, so they return None.
Sourcepub fn reset_device_buffer(&mut self) -> Result<()>
pub fn reset_device_buffer(&mut self) -> Result<()>
Clear the device-side queue and reset queue-depth bookkeeping.
Sourcepub fn is_frame_swap(&self) -> bool
pub fn is_frame_swap(&self) -> bool
Returns true when the runtime object is a frame-swap backend.
Sourcepub fn frame_capacity(&self) -> Option<usize>
pub fn frame_capacity(&self) -> Option<usize>
Returns the frame capacity for frame-swap backends, or None for FIFO.