pub struct PlaneDescriptor { /* private fields */ }Expand description
Per-plane DMA-BUF descriptor for external buffer import.
Owns a duplicated file descriptor plus optional stride and offset metadata.
The fd is duplicated eagerly in new() so that a bad fd is
caught immediately. import_image consumes the descriptor and takes
ownership of the duped fd — no further cleanup is needed by the caller.
§Examples
use edgefirst_tensor::PlaneDescriptor;
use std::os::fd::BorrowedFd;
// SAFETY: fd 42 is hypothetical; real code must pass a valid fd.
let pd = unsafe { PlaneDescriptor::new(BorrowedFd::borrow_raw(42)) }
.unwrap()
.with_stride(2048)
.with_offset(0);Implementations§
Source§impl PlaneDescriptor
impl PlaneDescriptor
Sourcepub fn new(fd: BorrowedFd<'_>) -> Result<Self>
pub fn new(fd: BorrowedFd<'_>) -> Result<Self>
Create a new plane descriptor by duplicating the given file descriptor.
The fd is duped immediately — a bad fd fails here rather than inside
import_image. The caller retains ownership of the original fd.
§Errors
Returns an error if the dup() syscall fails (e.g. invalid fd or
fd limit reached).
Sourcepub fn with_stride(self, stride: usize) -> Self
pub fn with_stride(self, stride: usize) -> Self
Set the row stride in bytes (consuming builder).
Sourcepub fn with_offset(self, offset: usize) -> Self
pub fn with_offset(self, offset: usize) -> Self
Set the plane offset in bytes (consuming builder).
Auto Trait Implementations§
impl Freeze for PlaneDescriptor
impl RefUnwindSafe for PlaneDescriptor
impl Send for PlaneDescriptor
impl Sync for PlaneDescriptor
impl Unpin for PlaneDescriptor
impl UnsafeUnpin for PlaneDescriptor
impl UnwindSafe for PlaneDescriptor
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more