#[repr(C)]pub struct RbResponse {
pub error_code: u32,
pub len: u32,
pub capacity: u32,
pub data: *mut c_void,
}Expand description
FFI buffer for binary transport responses
Similar to FfiBuffer but designed specifically for binary struct responses.
The response data is a raw C struct that can be cast directly by the host.
§Memory Layout
+------------+--------+----------+------------+
| error_code | len | capacity | data |
| (u32) | (u32) | (u32) | (*mut u8) |
+------------+--------+----------+------------+§Usage
error_code == 0: Success,datapoints to response structerror_code != 0: Error,datamay point to error message
Fields§
§error_code: u32Error code (0 = success)
len: u32Size of response data in bytes
capacity: u32Allocation capacity
data: *mut c_voidPointer to response data (or error message)
Implementations§
Source§impl RbResponse
impl RbResponse
Sourcepub fn success<T: Sized>(value: T) -> Self
pub fn success<T: Sized>(value: T) -> Self
Create a successful response with struct data
§Safety
The type T must be #[repr(C)] and safe to transmit across FFI.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RbResponse
impl RefUnwindSafe for RbResponse
impl !Sync for RbResponse
impl Unpin for RbResponse
impl UnsafeUnpin for RbResponse
impl UnwindSafe for RbResponse
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