#[repr(C)]pub struct FfiBuffer<'a> {
pub data: *mut u8,
pub data_len: usize,
/* private fields */
}
Expand description
A Rust u8 mutable slice, but compatible with FFI. Assume the lifetime is only valid until the callee returns to the caller.
Fields§
§data: *mut u8
A pointer to where the data can be put
data_len: usize
The maximum number of bytes we can store in this buffer
Implementations§
Source§impl<'a> FfiBuffer<'a>
impl<'a> FfiBuffer<'a>
Sourcepub fn new(s: &'a mut [u8]) -> FfiBuffer<'a>
pub fn new(s: &'a mut [u8]) -> FfiBuffer<'a>
Create a new buffer we can send over the FFI.
This buffer is a mutable borrow of some storage space allocated elsewhere. If you are given this type in an API, assume it is only valid for as long as the function call you were given in it.
Sourcepub fn as_mut_slice(&mut self) -> Option<&mut [u8]>
pub fn as_mut_slice(&mut self) -> Option<&mut [u8]>
Turn this buffer into a Rust mutable byte slice.
You will get None
if the buffer is empty (i.e. has zero length).
Trait Implementations§
Source§impl<'a> Ord for FfiBuffer<'a>
impl<'a> Ord for FfiBuffer<'a>
Source§fn cmp(&self, rhs: &FfiBuffer<'a>) -> Ordering
fn cmp(&self, rhs: &FfiBuffer<'a>) -> Ordering
Compare two ApiBuffers.
We just make some actual slices and compare then.
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<'a> PartialEq for FfiBuffer<'a>
impl<'a> PartialEq for FfiBuffer<'a>
Source§impl<'a> PartialOrd for FfiBuffer<'a>
impl<'a> PartialOrd for FfiBuffer<'a>
impl<'a> Eq for FfiBuffer<'a>
Auto Trait Implementations§
impl<'a> Freeze for FfiBuffer<'a>
impl<'a> RefUnwindSafe for FfiBuffer<'a>
impl<'a> !Send for FfiBuffer<'a>
impl<'a> !Sync for FfiBuffer<'a>
impl<'a> Unpin for FfiBuffer<'a>
impl<'a> UnwindSafe for FfiBuffer<'a>
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