Struct nannou_laser::stream::frame::Stream[][src]

pub struct Stream<M> { /* fields omitted */ }

A clone-able handle around a laser stream of frames.

Implementations

impl<M> Stream<M>[src]

pub fn set_distance_per_point(&self, d: f32) -> Result<(), SendError<()>>[src]

Update the distance_per_point field of the interpolation configuration.

The value will be updated on the laser thread prior to requesting the next frame.

Returns an Err if communication with the laser thread has been closed.

pub fn set_blank_delay_points(&self, ps: u32) -> Result<(), SendError<()>>[src]

Update the blank_delay_points field of the interpolation configuration.

The value will be updated on the laser thread prior to requesting the next frame.

Returns an Err if communication with the laser thread has been closed.

pub fn set_radians_per_point(&self, rad: f32) -> Result<(), SendError<()>>[src]

Update the radians_per_point field of the interpolation configuration.

The value will be updated on the laser thread prior to requesting the next frame.

Returns an Err if communication with the laser thread has been closed.

pub fn set_frame_hz(&self, fps: u32) -> Result<(), SendError<()>>[src]

Update the rate at which the stream will attempt to present images via the DAC.

The value will be updated on the laser thread prior to requesting the next frame.

Returns an Err if communication with the laser thread has been closed.

pub fn enable_optimisations(&self, enabled: bool) -> Result<(), SendError<()>>[src]

Update whether or not frame optimisations and interpolation should be enabled.

pub fn enable_draw_reorder(&self, enabled: bool) -> Result<(), SendError<()>>[src]

Update whether or not draw path reordering is enabled.

When true, the optimisation pass will attempt to find a more optimal path for the drawing of each line segment before performing interpolation.

When false, the draw order will follow the order in which segments were submitted via the Frame.

By default, this value is true.

pub fn close(self) -> Option<Result<Result<(), StreamError>>>[src]

Close the TCP communication thread and wait for the thread to join.

This consumes and drops the Stream, returning the result produced by joining the thread.

This method will block until the associated thread has been joined.

If the thread has already been closed by another handle to the stream, this will return None.

Methods from Deref<Target = Stream<M>>

pub fn set_point_hz(&self, point_hz: u32) -> Result<(), SendError<()>>[src]

Update the rate at which the DAC should process points per second.

This value should be no greater than the detected DAC’s max_point_hz.

By default this value is stream::DEFAULT_POINT_HZ.

pub fn set_latency_points(&self, points: u32) -> Result<(), SendError<()>>[src]

The maximum latency specified as a number of points.

Each time the laser indicates its “fullness”, the raw stream will request enough points from the render function to fill the DAC buffer up to latency_points.

This value should be no greaterthan the DAC’s buffer_capacity.

pub fn dac(&self) -> Option<DetectedDac>[src]

The DetectedDac with which the Stream was initialised.

Returns None if no DAC was specified, meaning that the stream is associated with the first DAC it could find.

pub fn send<F>(&self, update: F) -> Result<(), SendError<ModelUpdate<M>>> where
    F: FnOnce(&mut M) + Send + 'static, 
[src]

Send the given model update to the laser thread to be applied ASAP.

If the laser is currently rendering, the update will be applied immediately after the function call completes.

If the stream is currently paused, the update will be applied immediately.

Note: This function will be applied on the real-time laser thread so users should avoid performing any kind of I/O, locking, blocking, (de)allocations or anything that may run for an indeterminate amount of time.

pub fn is_closed(&self) -> bool[src]

Returns whether or not the communication thread has closed.

A stream may be closed if an error has occurred and the stream error callback indicated to close the thread. A stream might also be closed if another close was called on another handle to the stream.

In this case, the Stream should be closed or dropped and a new one should be created to replace it.

Trait Implementations

impl<M> Deref for Stream<M>[src]

type Target = Stream<M>

The resulting type after dereferencing.

Auto Trait Implementations

impl<M> !RefUnwindSafe for Stream<M>

impl<M> Send for Stream<M> where
    M: Send

impl<M> !Sync for Stream<M>

impl<M> Unpin for Stream<M>

impl<M> !UnwindSafe for Stream<M>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.