Struct dusk_api::FreightProxy[][src]

pub struct FreightProxy {
    pub freight: Box<dyn Freight>,
    pub lib: Rc<Library>,
    pub name: &'static str,
    pub version: &'static str,
}

A structure, that contains a Freight object and is used to import and use it safely

This structure is a Freight trait implementor and FreightRegistrar trait implementor. It provides FreightProxy::load function that is used to build the FreightProxy from a library path

To learn more about the functions you may call on the FreightProxy, see Freight trait documentation

Example

let mut my_f_proxy: FreightProxy = unsafe{
    FreightProxy::load("/bin/libtest_plug.so").expect("fail")
};
println!("{}, {}", my_f_proxy.name, my_f_proxy.version);
let fnlist: Vec<Function> = my_f_proxy.get_function_list();
for func in fnlist {
    println!("{}, {}", func.name, func.number);
}

Fields

freight: Box<dyn Freight>

Imported freight, solely for internal purposes

lib: Rc<Library>

Lib this freight was imported from to make sure this structure does not outlive the library it was imported from

name: &'static str

Imported freights name as a static string

version: &'static str

Imported freights version as a static string

Implementations

impl FreightProxy[src]

Functions, needed to configure FreightProxy structure initially

pub unsafe fn load(lib_path: &str) -> Result<FreightProxy, RuntimeError>[src]

Function, used to build a FreightProxy object from a library path

Trait Implementations

impl Freight for FreightProxy[src]

impl FreightRegistrar for FreightProxy[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.