pub struct Data<'a> {
pub points: Cow<'a, [DacPoint]>,
}Expand description
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]>Implementations§
Source§impl<'a> Data<'a>
impl<'a> Data<'a>
Sourcepub fn read_n_points<R>(reader: R) -> Result<u16>where
R: ReadBytesExt,
pub fn read_n_points<R>(reader: R) -> Result<u16>where
R: ReadBytesExt,
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.
Sourcepub fn read_points<R>(
reader: R,
n_points: u16,
points: &mut Vec<DacPoint>,
) -> Result<()>where
R: ReadBytesExt,
pub fn read_points<R>(
reader: R,
n_points: u16,
points: &mut Vec<DacPoint>,
) -> Result<()>where
R: ReadBytesExt,
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.
Source§impl Data<'static>
impl Data<'static>
Sourcepub fn read_fields<R: ReadBytesExt>(reader: R) -> Result<Self>
pub fn read_fields<R: ReadBytesExt>(reader: R) -> Result<Self>
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.