Struct lovm2_core::module::Module[][src]

pub struct Module {
    pub code_object: Rc<CodeObject>,
    pub slots: Slots,
}

Main runtime representation for loadable modules.

Fields

code_object: Rc<CodeObject>

Always required. Shared object libraries will only fill the name and loc attribute.

slots: Slots

Contains CallProtocol entries that will be added to the context.

Implementations

impl Module[src]

pub fn is_loadable<T>(path: T) -> Lovm2Result<bool> where
    T: AsRef<Path>, 
[src]

A module is loadable if the first four bytes of the file are either the ELF magic number (shared object) or the lovm2 magic number LV2_MAGIC_NUMBER.

pub fn load_from_file<T>(path: T) -> Lovm2Result<Self> where
    T: AsRef<Path>, 
[src]

Checks if the file is loadable and tries creating a module from it.

pub fn name(&self) -> &str[src]

Returns the modules name.

pub fn location(&self) -> Option<&String>[src]

Returns the filesystem path from which the module was created.

pub fn slots(&self) -> &Slots[src]

pub fn slot(&self, name: &Variable) -> Option<Rc<dyn CallProtocol>>[src]

Try looking up a Callable by name.

pub fn store_to_file<T>(&self, path: T) -> Lovm2Result<()> where
    T: AsRef<Path>, 
[src]

Write the contained CodeObject into a file. This wil do nothing for shared object modules.

pub fn to_bytes(&self) -> Lovm2Result<Vec<u8>>[src]

Returns the CodeObject representation as bytes.

pub fn uses(&self) -> &[String][src]

List static dependencies of the module.

Trait Implementations

impl Clone for Module[src]

impl Debug for Module[src]

impl Display for Module[src]

impl From<CodeObject> for Module[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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[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.