pub struct BytesResource { /* private fields */ }Expand description
A checked range of a CPU allocation. Clones share the allocation and its borrow registry, not independently mutable slices.
Implementations§
Source§impl BytesResource
impl BytesResource
Sourcepub fn get_write_ptr_and_length(&self) -> (*mut u8, usize)
pub fn get_write_ptr_and_length(&self) -> (*mut u8, usize)
Returns a raw pointer and the checked range length for a kernel/FFI call.
This does not acquire a safe-access guard. To dereference the pointer, the caller must keep this resource (or an allocation-owning lease) alive, enforce initialization/bounds, and synchronize kernel accesses with all host guards and other raw accesses. Safe host code should use read/write.
Sourcepub fn try_write(&self) -> Result<BytesWriteGuard, BytesAccessError>
pub fn try_write(&self) -> Result<BytesWriteGuard, BytesAccessError>
Try to acquire an exclusive range without waiting or spinning on readers.
Sourcepub fn write(&self) -> BytesWriteGuard
pub fn write(&self) -> BytesWriteGuard
Acquire an exclusive range, panicking on conflicting live access. Use try_write to handle conflicts as ordinary errors.
Sourcepub fn try_read(&self) -> Result<BytesReadGuard, BytesAccessError>
pub fn try_read(&self) -> Result<BytesReadGuard, BytesAccessError>
Try to acquire a shared range without waiting for overlapping writers.
Sourcepub fn read(&self) -> BytesReadGuard
pub fn read(&self) -> BytesReadGuard
Acquire a shared range, panicking on conflicting live access. Use try_read to handle conflicts as ordinary errors.