Struct nannou_laser::Api

source ·
pub struct Api { /* private fields */ }
Expand description

A general API that allows for detecting and enumerating laser DACs on a network and establishing new streams of communication with them.

Implementations§

source§

impl Api

source

pub fn new() -> Self

Instantiate the laser API.

source

pub fn detect_dacs(&self) -> Result<DetectDacs>

An iterator yielding laser DACs available on the system as they are discovered.

Currently, the only laser protocol supported is the ether dream protocol. Thus, this enumerates ether dream DACs that are discovered on the LAN.

Note that the produced iterator will iterate forever and never terminate unless set_timeout is called on the returned DetectDacs instance.

source

pub fn detect_dac(&self, id: DacId) -> Result<DetectedDac>

Block and wait until the DAC with the given Id is detected.

source

pub fn detect_dacs_async<F>( &self, timeout: Option<Duration>, callback: F ) -> Result<DetectDacsAsync>
where F: 'static + DetectedDacCallback + Send,

Spawn a thread for DAC detection.

Calls the given callback with broadcasts as they are received.

The thread is closed when the returned DetectDacsAsync instance is dropped.

source

pub fn new_frame_stream<M, F>(&self, model: M, render: F) -> Builder<M, F>
where F: RenderFn<M>,

Begin building a new laser frame stream.

The stream will call the render function each time new points are needed to feed the laser DAC buffer. The rate at which this will be called depends on the point_hz, frame_hz and the latency_points.

source

pub fn new_raw_stream<M, F>(&self, model: M, render: F) -> Builder<M, F>
where F: RenderFn<M>,

Begin building a new laser raw stream.

The raw stream will call the given render function with a request for as many points as the DAC currently might need to fill the buffer based on the stream latency.

Auto Trait Implementations§

§

impl RefUnwindSafe for Api

§

impl Send for Api

§

impl Sync for Api

§

impl Unpin for Api

§

impl UnwindSafe for Api

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<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> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.