Skip to main content

BackendKind

Struct BackendKind 

Source
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

Source

pub fn fifo(backend: Box<dyn FifoBackend>) -> Result<Self>

Wrap a FIFO backend, rejecting frame-swap capability metadata.

Source

pub fn frame_swap(backend: Box<dyn FrameSwapBackend>) -> Result<Self>

Wrap a frame-swap backend, requiring frame-swap capability metadata.

Source

pub fn validate_output_model(&self) -> Result<()>

Verify that capability metadata agrees with the runtime backend kind.

Source

pub fn dac_type(&self) -> DacType

Returns the DAC type.

Source

pub fn caps(&self) -> &DacCapabilities

Returns the device capabilities.

Source

pub fn connect(&mut self) -> Result<()>

Connect to the device and revalidate metadata that may have changed while the concrete backend initialized itself.

Source

pub fn disconnect(&mut self) -> Result<()>

Disconnect from the device.

Source

pub fn is_connected(&self) -> bool

Returns whether the device is connected.

Source

pub fn stop(&mut self) -> Result<()>

Stop output.

Source

pub fn set_shutter(&mut self, open: bool) -> Result<()>

Open/close the shutter.

Source

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.

Source

pub fn estimator(&self) -> Option<&dyn BufferEstimator>

The protocol-owned BufferEstimator for FIFO backends.

Frame-swap backends never queue points, so they return None.

Source

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.

Source

pub fn reset_device_buffer(&mut self) -> Result<()>

Clear the device-side queue and reset queue-depth bookkeeping.

Source

pub fn is_frame_swap(&self) -> bool

Returns true when the runtime object is a frame-swap backend.

Source

pub fn frame_capacity(&self) -> Option<usize>

Returns the frame capacity for frame-swap backends, or None for FIFO.

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.