Skip to main content

PluginDescriptor

Struct PluginDescriptor 

Source
#[repr(C)]
pub struct PluginDescriptor {
Show 14 fields pub descriptor_size: u32, pub abi_version: u32, pub interface_name: *const c_char, pub interface_hash: u64, pub interface_version: u32, pub capabilities: u64, pub buffer_strategy: u8, pub plugin_name: *const c_char, pub vtable: *const c_void, pub free_buffer: Option<unsafe extern "C" fn(*mut u8, usize)>, pub method_count: u32, pub method_metadata: *const MethodMetaEntry, pub trait_metadata: *const MetaKv, pub trait_metadata_count: u32,
}
Expand description

Metadata descriptor for a single plugin within a dylib.

Contains all information the host needs to validate and call the plugin without executing any plugin code. All string fields are pointers to static, null-terminated C strings embedded in the dylib.

§Safety

  • interface_name and plugin_name must point to valid, null-terminated, UTF-8 C strings with 'static lifetime.
  • vtable must point to a valid #[repr(C)] vtable struct matching the interface identified by interface_name and interface_hash.
  • When buffer_strategy == PluginAllocated, free_buffer must be Some.
  • All pointed-to data must outlive any PluginHandle derived from this descriptor.

Fields§

§descriptor_size: u32

Size in bytes of this descriptor struct at plugin build time.

The host reads this field FIRST (it’s at offset 0) before trusting any other offset calculation. Any field whose offset is >= descriptor_size is not present in this plugin’s build — the plugin was compiled against an older fidius version that didn’t have that field yet.

Enables post-1.0 minor releases to add new fields at the end of this struct without breaking older plugins. See ADR-0002.

§abi_version: u32

Descriptor struct layout version. Must equal ABI_VERSION.

§interface_name: *const c_char

Null-terminated name of the trait this plugin implements (e.g., "ImageFilter").

§interface_hash: u64

FNV-1a hash of the required method signatures. Detects ABI drift.

§interface_version: u32

User-specified interface version from #[plugin_interface(version = N)].

§capabilities: u64

Bitfield where bit N indicates optional method N is implemented. Supports up to 64 optional methods per interface.

§buffer_strategy: u8

Buffer management strategy this plugin’s vtable expects.

§plugin_name: *const c_char

Null-terminated human-readable name for this plugin implementation.

§vtable: *const c_void

Opaque pointer to the interface-specific #[repr(C)] vtable struct.

§free_buffer: Option<unsafe extern "C" fn(*mut u8, usize)>

Deallocation function for plugin-allocated buffers. Must be Some when buffer_strategy == PluginAllocated. The host calls this after reading output data to free the plugin’s allocation.

§method_count: u32

Total number of methods in the vtable (required + optional). Used for bounds checking in call_method.

§method_metadata: *const MethodMetaEntry

Pointer to an array of method_count MethodMetaEntry structs, one per method in declaration order. Each entry may be empty (kvs=null, kv_count=0) if the method declared no metadata.

Null if the interface used no #[method_meta(...)] annotations at all (optimization for the common case).

§trait_metadata: *const MetaKv

Pointer to an array of trait_metadata_count MetaKv entries for trait-level metadata (declared via #[trait_meta(...)]).

Null if no trait-level metadata was declared.

§trait_metadata_count: u32

Number of entries in trait_metadata. Zero when trait_metadata is null.

Implementations§

Source§

impl PluginDescriptor

Source

pub unsafe fn interface_name_str(&self) -> &str

Read the interface_name field as a Rust &str.

§Safety

interface_name must point to a valid, null-terminated, UTF-8 C string that outlives the returned reference.

Source

pub unsafe fn plugin_name_str(&self) -> &str

Read the plugin_name field as a Rust &str.

§Safety

plugin_name must point to a valid, null-terminated, UTF-8 C string that outlives the returned reference.

Source

pub fn buffer_strategy_kind(&self) -> Result<BufferStrategyKind, u8>

Returns the buffer_strategy field as a BufferStrategyKind.

Returns Err(value) if the discriminant is unknown. This can happen with malformed plugins — callers should reject rather than panic.

Source

pub fn has_capability(&self, bit: u32) -> bool

Check if the given optional method capability bit is set.

Returns false for bit indices >= 64 rather than panicking.

Trait Implementations§

Auto Trait Implementations§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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