/// Reports the remaining size of the audio data buffer.
///
/// From 5.14.6.8: An RX message has the readable header, then the writable buffer, then
/// the writable status. If this is called when no data has yet been written to `chain`,
/// then this will return the full size of the audio data buffer.
Reports the remaining size of the audio data buffer.
From 5.14.6.8: An RX message has the readable header, then the writable buffer, then
the writable status. If this is called when no data has yet been written to `chain`,
then this will return the full size of the audio data buffer.
Reports the remaining size of the audio data buffer . From 5 . 14 . 6 . 8 : An RX message has the readable header then the writable buffer then the writable status . If this is called when no data has yet been written to ` chain ` then this will return the full size of the audio data buffer .
pub fn buffer_size<'a, 'b>(chain: &WritableChain<'a, 'b>) -> Result<usize, Error> {
        // Therefore, the size of the writable buffer is the size of the total writable area
        // minus the size of the status field.
        let total_size = chain.remaining()?;
        let status_size = std::mem::size_of::<wire::VirtioSndPcmStatus>();
        if total_size < status_size {
            Err(anyhow!(
                "writable chain is too small: has {} writable bytes, need {} to write status",
                total_size,
                status_size
            ))
        } else {
            Ok(total_size - status_size)
        }
    }
pub fn buffer_size < ' a , ' b > ( chain : & WritableChain < ' a , ' b > ) -> Result < usize , Error > { // Therefore, the size of the writable buffer is the size of the total writable area // minus the size of the status field. let total_size = chain . remaining ( ) ? ; let status_size = std :: mem :: size_of :: < wire :: VirtioSndPcmStatus > ( ) ; if total_size < status_size { Err ( anyhow ! ( " " total_size status_size ) ) } else { Ok ( total_size - status_size ) } }
Reports the remaining size of the audio data buffer.
Reports the remaining size of the audio data buffer .
chain
&WritableChain<'a, 'b>