Skip to main content

HostV1

Struct HostV1 

Source
#[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), pub resource_path: unsafe extern "C" fn(context: *mut c_void, name: *const u8, name_len: usize, len: *mut usize) -> *const u8, }
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, refuses a table shorter than HOST_V1_BASE_BYTES and uses only the fields size covers.

Fields§

§abi: u32§size: u32

Bytes of the table as the host that filled it knows it.

§context: *mut c_void

The host’s own state for this instance.

§emit: unsafe extern "C" fn(context: *mut c_void, records: *const u8, len: usize) -> i32

Takes 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 u8

The 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.

§resource_path: unsafe extern "C" fn(context: *mut c_void, name: *const u8, name_len: usize, len: *mut usize) -> *const u8

The absolute path (UTF-8) of the supplied file, filled directory slot or directory under one named name, and its length; null for a pinned resource, an empty or undeclared name, or a path that is not UTF-8. Valid until the instance is destroyed. Appended within /1.

Trait Implementations§

Source§

impl Clone for HostV1

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HostV1

Source§

impl Debug for HostV1

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.