Trait rust_dmx::DmxPort[][src]

pub trait DmxPort: Display + Serialize + Deserialize {
    fn available_ports() -> Result<Vec<Box<dyn DmxPort>>, Error>
    where
        Self: Sized
;
fn open(&mut self) -> Result<(), Error>;
fn close(&mut self);
fn write(&mut self, frame: &[u8]) -> Result<(), Error>; }

Trait for the general notion of a DMX port. This enables creation of an “offline” port to slot into place if an API requires an output.

Required methods

fn available_ports() -> Result<Vec<Box<dyn DmxPort>>, Error> where
    Self: Sized
[src]

Return the available ports. The ports will need to be opened before use.

fn open(&mut self) -> Result<(), Error>[src]

Open the port for writing. Implementations should no-op if this is called twice rather than returning an error. Primarily used to re-open a port that has be deserialized.

fn close(&mut self)[src]

Close the port.

fn write(&mut self, frame: &[u8]) -> Result<(), Error>[src]

Write a DMX frame out to the port. If the frame is smaller than the minimum universe size, it will be padded with zeros. If the frame is larger than the maximum universe size, the values beyond the max size will be ignored.

Loading content...

Trait Implementations

impl<'typetag> Serialize for dyn DmxPort + 'typetag[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<'typetag> Serialize for dyn DmxPort + Send + 'typetag[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<'typetag> Serialize for dyn DmxPort + Sync + 'typetag[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl<'typetag> Serialize for dyn DmxPort + Send + Sync + 'typetag[src]

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
    S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl Strictest for dyn DmxPort[src]

type Object = dyn DmxPort

Implementors

impl DmxPort for EnttecDmxPort[src]

fn available_ports() -> Result<Vec<Box<dyn DmxPort>>, Error>[src]

Return the available enttec ports connected to this system. TODO: provide a mechanism to specialize this implementation depending on platform.

fn open(&mut self) -> Result<(), Error>[src]

Open the port.

fn close(&mut self)[src]

fn write(&mut self, frame: &[u8]) -> Result<(), Error>[src]

impl DmxPort for OfflineDmxPort[src]

fn available_ports() -> Result<Vec<Box<dyn DmxPort>>, Error>[src]

fn open(&mut self) -> Result<(), Error>[src]

fn close(&mut self)[src]

fn write(&mut self, _: &[u8]) -> Result<(), Error>[src]

Loading content...