#[repr(C)]pub struct HostV1 {
pub abi: u32,
pub size: u32,
pub context: *mut c_void,
pub emit: unsafe extern "C" fn(context: *mut c_void, records: *const u8, len: usize) -> i32,
pub resource: unsafe extern "C" fn(context: *mut c_void, name: *const u8, name_len: usize, len: *mut usize) -> *const u8,
pub fail: unsafe extern "C" fn(context: *mut c_void, message: *const u8, len: usize),
pub log: unsafe extern "C" fn(context: *mut c_void, level: u32, message: *const u8, len: usize),
}Expand description
What a host gives a native plugin instance. Every function takes context first.
Pointers passed to these functions are borrowed for the call alone. /1 grows only by fields
appended here; a plugin reads abi and size first and uses only the fields size covers.
Fields§
§abi: u32§size: u32Bytes of the table as the host that filled it knows it.
context: *mut c_voidThe host’s own state for this instance.
emit: unsafe extern "C" fn(context: *mut c_void, records: *const u8, len: usize) -> i32Takes a batch of records; returns status::OK, or status::FAILED once the
session has refused an emit and the plugin should stop.
resource: unsafe extern "C" fn(context: *mut c_void, name: *const u8, name_len: usize, len: *mut usize) -> *const u8The resource name (UTF-8) and its length, or null when the manifest declares none by that
name. The bytes stay valid until the instance is destroyed.
fail: unsafe extern "C" fn(context: *mut c_void, message: *const u8, len: usize)Records why the call about to return status::FAILED failed (UTF-8).
log: unsafe extern "C" fn(context: *mut c_void, level: u32, message: *const u8, len: usize)Writes a diagnostic (UTF-8) at a log_level.
Trait Implementations§
Auto Trait Implementations§
impl !Send for HostV1
impl !Sync for HostV1
impl Forget for HostV1
impl Freeze for HostV1
impl Move for HostV1
impl RefUnwindSafe for HostV1
impl Unpin for HostV1
impl UnsafeUnpin for HostV1
impl UnwindSafe for HostV1
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