Skip to main content

FrameSession

Struct FrameSession 

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

A frame-mode streaming session.

Owns a scheduler thread that reads frames from a channel and writes them to the DAC backend using the appropriate strategy (FIFO or frame-swap).

§Example

use laser_dac::{open_device, FrameSessionConfig, Frame, LaserPoint};

let device = open_device("my-device")?;
let config = FrameSessionConfig::new(30_000);
let (session, _info) = device.start_frame_session(config)?;

session.control().arm()?;
session.send_frame(Frame::new(vec![
    LaserPoint::new(0.0, 0.0, 65535, 0, 0, 65535),
]));

Implementations§

Source§

impl FrameSession

Source

pub fn control(&self) -> StreamControl

Returns a control handle for arm/disarm/stop.

Source

pub fn send_frame(&self, frame: Frame)

Submit a frame for display. Latest-wins: overwrites any unconsumed pending frame immediately, with no buffering or memory growth.

Source

pub fn is_finished(&self) -> bool

Returns true if the scheduler thread has finished.

Source

pub fn metrics(&self) -> FrameSessionMetrics

Returns a metrics handle for observing scheduler liveness.

Source

pub fn join(self) -> Result<RunExit>

Wait for the session thread to finish and return the exit reason.

Trait Implementations§

Source§

impl Drop for FrameSession

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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 = 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.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,