#[repr(C)]pub struct NrHostVTable {
pub send_result: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, status: NrStatus, payload: NrVec<u8>) -> NrStatus,
pub send_result_owned: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, status: NrStatus, payload: NrOwnedBytes) -> NrStatus,
pub acquire_result_buffer: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, capacity: u64) -> NrBufferLease,
pub commit_result_buffer: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, status: NrStatus, token: u64, initialized_len: u64) -> NrStatus,
}Expand description
Host callback table.
Fields§
§send_result: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, status: NrStatus, payload: NrVec<u8>) -> NrStatusDelivers a response the host copies into its own memory. The payload
may be borrowed (owned = 0); an owned payload is freed through its
drop_fn after the copy.
send_result_owned: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, status: NrStatus, payload: NrOwnedBytes) -> NrStatusDelivers a response without a host-side copy; the host takes ownership of the payload and calls its release exactly once.
acquire_result_buffer: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, capacity: u64) -> NrBufferLeaseLeases a host-owned buffer of at least capacity bytes for the
response to sid. Fails (null ptr) for unknown sids, streaming
sids, and sids that already hold an outstanding lease.
commit_result_buffer: unsafe extern "C" fn(host_ctx: *mut c_void, sid: u64, status: NrStatus, token: u64, initialized_len: u64) -> NrStatusCommits the leased buffer as the response to sid:
initialized_len bytes (at most the leased capacity) must have been
written. On Ok the buffer now belongs to the host; on Invalid
with a live lease (bad token or oversized length) the lease stays
valid and may be committed again.
Trait Implementations§
Source§impl Clone for NrHostVTable
impl Clone for NrHostVTable
Source§fn clone(&self) -> NrHostVTable
fn clone(&self) -> NrHostVTable
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more