Skip to main content

Desc

Struct Desc 

Source
#[repr(C)]
pub struct Desc { pub abi_version: u32, pub struct_size: u32, pub script_wire_version: u16, pub flags: u16, pub reserved: u32, pub name: *const c_char, pub version: *const c_char, pub init: Option<InitFn>, pub call: Option<HookFn>, pub shutdown: Option<unsafe extern "C" fn()>, pub free: Option<FreeFn>, }
Expand description

The descriptor a plugin’s entry function returns. Lives for the process; the host reads it after the handshake below.

abi_version and struct_size sit first and their offsets are frozen forever: the host reads them before it trusts anything else about the struct, so a future layout can still be refused with a clear error.

Fields§

§abi_version: u32

Must equal ABI_VERSION.

§struct_size: u32

size_of::<Desc>() on the plugin side; a shorter value than the host’s own means a truncated or foreign struct.

§script_wire_version: u16

lumen_script::SCRIPT_WIRE_VERSION the plugin was built against. The values, commands, and signatures it exchanges are only meaningful when it matches the host’s.

§flags: u16

Bit set of FLAG_PANIC_ABORT and future flags; zero otherwise.

§reserved: u32

Zero. Keeps the pointer fields below 8-aligned on every target.

§name: *const c_char

NUL-terminated UTF-8, 'static. Must match the name the app declared the module under.

§version: *const c_char

NUL-terminated UTF-8, 'static.

§init: Option<InitFn>

Required. Runs once, before any call.

§call: Option<HookFn>

Required when the manifest declares functions. input is a bincode Call, ctx is empty (the plugin already has its context from init), and out is a bincode CallOut.

§shutdown: Option<unsafe extern "C" fn()>

Optional. Runs once, when the app is going down.

§free: Option<FreeFn>

Required. Frees every buffer the entries above hand out.

Trait Implementations§

Auto Trait Implementations§

§

impl Freeze for Desc

§

impl RefUnwindSafe for Desc

§

impl Unpin for Desc

§

impl UnsafeUnpin for Desc

§

impl UnwindSafe for Desc

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> IntoResult<T> for T

§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ConditionalSend for T
where T: Send,