[][src]Struct ether_dream::protocol::command::Data

pub struct Data<'a> {
    pub points: Cow<'a, [DacPoint]>,
}

Indicates to the DAC to add the following point data into its buffer.

Point data is laid out as follows:

  • 0x64
  • : u16

Fields

points: Cow<'a, [DacPoint]>

Methods

impl<'a> Data<'a>[src]

pub fn read_n_points<R>(reader: R) -> Result<u16> where
    R: ReadBytesExt
[src]

Read the u16 representing the number of points within the Data from the given reader.

This method is useful for determining how many more bytes should be read from a stream.

Note that if reading from a stream, this method assumes that the starting command byte has already been read.

pub fn read_points<R>(
    reader: R,
    n_points: u16,
    points: &mut Vec<DacPoint>
) -> Result<()> where
    R: ReadBytesExt
[src]

Read and append the given number of points into the given Vec of DacPoints.

This method is useful as an alternative to Self::read_fields or Self::read_from_bytes as it allows for re-using a buffer of points rather than dynamically allocating a new one each time.

Note that if reading from a stream, this method assumes that the starting command byte and the u16 representing the number of points have both already been read.

impl Data<'static>[src]

pub fn read_fields<R: ReadBytesExt>(reader: R) -> Result<Self>[src]

Consecutively read the fields of the Data type and return a Data instance.

Note that if reading from a stream, this method assumes that the starting command byte has already been read.

Trait Implementations

impl<'a> Clone for Data<'a>[src]

impl<'a> Command for Data<'a>[src]

impl<'a> Debug for Data<'a>[src]

impl<'a> Eq for Data<'a>[src]

impl<'a> From<Data<'a>> for Command<'a>[src]

impl<'a> Hash for Data<'a>[src]

impl<'a> PartialEq<Data<'a>> for Data<'a>[src]

impl ReadFromBytes for Data<'static>[src]

impl<'a> StructuralEq for Data<'a>[src]

impl<'a> StructuralPartialEq for Data<'a>[src]

impl<'a> WriteToBytes for Data<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Data<'a>

impl<'a> Send for Data<'a>

impl<'a> Sync for Data<'a>

impl<'a> Unpin for Data<'a>

impl<'a> UnwindSafe for Data<'a>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.