Struct lovm2_core::module::Module [−][src]
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]
T: AsRef<Path>,
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]
T: AsRef<Path>,
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]
T: AsRef<Path>,
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]
fn from(code_object: CodeObject) -> Self
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Module
[src]
impl !Send for Module
[src]
impl !Sync for Module
[src]
impl Unpin for Module
[src]
impl !UnwindSafe for Module
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,