#[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_nameandplugin_namemust point to valid, null-terminated, UTF-8 C strings with'staticlifetime.vtablemust point to a valid#[repr(C)]vtable struct matching the interface identified byinterface_nameandinterface_hash.- When
buffer_strategy == PluginAllocated,free_buffermust beSome. - All pointed-to data must outlive any
PluginHandlederived from this descriptor.
Fields§
§descriptor_size: u32Size 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: u32Descriptor struct layout version. Must equal ABI_VERSION.
interface_name: *const c_charNull-terminated name of the trait this plugin implements (e.g., "ImageFilter").
interface_hash: u64FNV-1a hash of the required method signatures. Detects ABI drift.
interface_version: u32User-specified interface version from #[plugin_interface(version = N)].
capabilities: u64Bitfield where bit N indicates optional method N is implemented. Supports up to 64 optional methods per interface.
buffer_strategy: u8Buffer management strategy this plugin’s vtable expects.
plugin_name: *const c_charNull-terminated human-readable name for this plugin implementation.
vtable: *const c_voidOpaque 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: u32Total number of methods in the vtable (required + optional).
Used for bounds checking in call_method.
method_metadata: *const MethodMetaEntryPointer 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 MetaKvPointer 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: u32Number of entries in trait_metadata. Zero when trait_metadata
is null.
Implementations§
Source§impl PluginDescriptor
impl PluginDescriptor
Sourcepub unsafe fn interface_name_str(&self) -> &str
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.
Sourcepub unsafe fn plugin_name_str(&self) -> &str
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.
Sourcepub fn buffer_strategy_kind(&self) -> Result<BufferStrategyKind, u8>
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.
Sourcepub fn has_capability(&self, bit: u32) -> bool
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.