pub struct FreightDeclaration {
pub rustc_version: &'static str,
pub api_version: &'static str,
pub freight_version: &'static str,
pub name: &'static str,
pub register: fn(&mut dyn FreightRegistrar),
}
Expand description
A structure, exported by plugin, containing some package details and register function
This structure contains the rust compiler version, the plugin was compiled with, api version it uses, the plugin name and version and the actual function, that is used to register the plugin.
The function is only needed to pass a structure, that implements
trait Freight to the FreightRegistrar::register_freight
as
structures can not be put into static variables, but static
functions can.
This structure must only be built by export_freight!
macro
in plugins. And its fields are only read by
FreightProxy::load
function when loading the plugin
Fields§
§rustc_version: &'static str
Rust compiler version as a static string
api_version: &'static str
Api version as a static string
freight_version: &'static str
Version of the freight being imported
name: &'static str
Name of the freight being imported
register: fn(&mut dyn FreightRegistrar)
Function that gets a FreightRegistrar
trait implementor
as an argument and calls its freight_register function
to provide unexportable things, such as structs, in
particular, Freight
implementor structures