#[repr(C)]pub struct RbBytes {
pub len: u32,
pub data: *const u8,
}Expand description
FFI-safe borrowed byte slice reference
This is a view into binary data that the caller owns. The data must remain valid for the duration of the FFI call.
§Memory Layout
+--------+--------+
| len | data |
| (u32) | (*u8) |
+--------+--------+§Invariants
- If
datais non-null, it must point tolenvalid bytes - If
len == 0anddata == null, represents “not present” (None) - Maximum size is 4GB (u32::MAX bytes)
Fields§
§len: u32Length in bytes
data: *const u8Pointer to binary data
Implementations§
Source§impl RbBytes
impl RbBytes
Sourcepub const fn from_static(bytes: &'static [u8]) -> Self
pub const fn from_static(bytes: &'static [u8]) -> Self
Create from a static byte slice
Sourcepub fn is_present(&self) -> bool
pub fn is_present(&self) -> bool
Check if this byte slice is present (not None)
Trait Implementations§
impl Copy for RbBytes
impl Send for RbBytes
impl Sync for RbBytes
Auto Trait Implementations§
impl Freeze for RbBytes
impl RefUnwindSafe for RbBytes
impl Unpin for RbBytes
impl UnsafeUnpin for RbBytes
impl UnwindSafe for RbBytes
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