pub struct ManuallyManaged {
common: Common,
bufs: BufferSwapper<DmaBuf>,
}
Expand description
Allows the user to manage buffers manually. Buffers must be explicitly replaced. Release will only succeed if all buffers were returned with replace_buffer.
Fields§
§common: Common
§bufs: BufferSwapper<DmaBuf>
Implementations§
source§impl ManuallyManaged
impl ManuallyManaged
sourcepub fn new(handle: Arc<Handle>, buf_type: Type, count: usize) -> Result<Self>
pub fn new(handle: Arc<Handle>, buf_type: Type, count: usize) -> Result<Self>
Returns a new buffer manager instance
You usually do not need to use this directly. A UserBufferStream creates its own manager instance by default.
§Arguments
handle
- Device handle to get its file descriptorbuf_type
- Type of the buffers
pub fn len(&self) -> usize
pub fn take_buffer( &mut self, index: usize, ) -> Result<BufProtected<DmaBuf>, &'static str>
pub fn replace_buffer( &mut self, buf: BufProtected<DmaBuf>, ) -> Result<usize, (BufProtected<DmaBuf>, &'static str)>
sourcepub fn get_buf_mut(&mut self, index: usize) -> Result<&mut DmaBuf, &'static str>
pub fn get_buf_mut(&mut self, index: usize) -> Result<&mut DmaBuf, &'static str>
Returns a writeably-locked buffer for this index
source§impl ManuallyManaged
impl ManuallyManaged
sourcepub unsafe fn force_release(&mut self) -> Result<()>
pub unsafe fn force_release(&mut self) -> Result<()>
Release buffers without checking if any buffers are gone missing.
What makes this unsafe is that the buffers out there may become unuseable (TODO: check semantics). See V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ManuallyManaged
impl !RefUnwindSafe for ManuallyManaged
impl !Send for ManuallyManaged
impl !Sync for ManuallyManaged
impl Unpin for ManuallyManaged
impl !UnwindSafe for ManuallyManaged
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