#[repr(C)]pub struct NrOwnedBytes {
pub ptr: *const u8,
pub len: u64,
pub owner_ctx: *mut c_void,
pub release: Option<unsafe extern "C" fn(owner_ctx: *mut c_void, ptr: *const u8, len: u64)>,
}Expand description
A callee-owned byte buffer handed across the ABI without a copy.
Contract: the consumer calls release exactly once when it is done with
the bytes (possibly from a different thread than the producer), and the
producer keeps ptr..ptr+len valid and immutable until then. A None
release means there is nothing to free (static or arena-backed data).
Fields§
§ptr: *const u8§len: u64§owner_ctx: *mut c_void§release: Option<unsafe extern "C" fn(owner_ctx: *mut c_void, ptr: *const u8, len: u64)>Implementations§
Source§impl NrOwnedBytes
impl NrOwnedBytes
Sourcepub const fn from_static(bytes: &'static [u8]) -> Self
pub const fn from_static(bytes: &'static [u8]) -> Self
Borrows static data; no release callback is needed.
Trait Implementations§
Auto Trait Implementations§
impl !Send for NrOwnedBytes
impl !Sync for NrOwnedBytes
impl Freeze for NrOwnedBytes
impl RefUnwindSafe for NrOwnedBytes
impl Unpin for NrOwnedBytes
impl UnsafeUnpin for NrOwnedBytes
impl UnwindSafe for NrOwnedBytes
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