Struct FreightDeclaration

Source
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

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