pub struct Buffer { /* private fields */ }Expand description
A Buffer holding HackRF transfer data.
Samples can be directly accessed as slices, and can be extended up to the length of the fixed-size underlying buffer.
When dropped, this buffer returns to the internal buffer pool it came from. It can either be backed by an allocation from the system allocator, or by some platform-specific way of allocating memory for zero-copy USB transfers.
Implementations§
Source§impl Buffer
impl Buffer
pub fn clear(&mut self)
Sourcepub fn remaining_capacity(&self) -> usize
pub fn remaining_capacity(&self) -> usize
Remaining capacity in the buffer, in samples.
Sourcepub fn extend_from_slice(&mut self, slice: &[ComplexI8])
pub fn extend_from_slice(&mut self, slice: &[ComplexI8])
Extend the buffer with a slice of samples.
§Panics
- if there is no space left in the buffer for the slice.
Sourcepub fn bytes(&self) -> &[u8] ⓘ
pub fn bytes(&self) -> &[u8] ⓘ
Get the sample sequence as a slice of bytes instead of complex values.
Sourcepub fn bytes_mut(&mut self) -> &mut [u8] ⓘ
pub fn bytes_mut(&mut self) -> &mut [u8] ⓘ
Get the sample sequence as a mutable slice of bytes instead of complex values.
Sourcepub fn samples_mut(&mut self) -> &mut [ComplexI8] ⓘ
pub fn samples_mut(&mut self) -> &mut [ComplexI8] ⓘ
Mutably get the samples in the buffer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Buffer
impl RefUnwindSafe for Buffer
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more