[][src]Trait mruby::load::MrbLoadSources

pub trait MrbLoadSources {
    fn def_file<T>(
        &self,
        filename: T,
        require: fn(_: Self) -> Result<(), MrbError>
    ) -> Result<(), MrbError>
    where
        T: AsRef<str>
;
fn def_file_for_type<T, F>(&self, filename: T) -> Result<(), MrbError>
    where
        T: AsRef<str>,
        F: MrbFile
;
fn def_rb_source_file<T, F>(
        &self,
        filename: T,
        contents: F
    ) -> Result<(), MrbError>
    where
        T: AsRef<str>,
        F: AsRef<[u8]>
; fn normalize_source_path<T>(&self, filename: T) -> PathBuf
    where
        T: AsRef<str>
, { ... } }

Required methods

fn def_file<T>(
    &self,
    filename: T,
    require: fn(_: Self) -> Result<(), MrbError>
) -> Result<(), MrbError> where
    T: AsRef<str>, 

Add a Rust-backed Ruby source file to the virtual filesystem. A stub Ruby file is added to the filesystem and require will dynamically define Ruby items when invoked via Kernel#require.

If filename is a relative path, the Ruby source is added to the filesystem relative to RUBY_LOAD_PATH. If the path is absolute, the file is placed directly on the filesystem. Anscestor directories are created automatically.

fn def_file_for_type<T, F>(&self, filename: T) -> Result<(), MrbError> where
    T: AsRef<str>,
    F: MrbFile

Add a Rust-backed Ruby source file to the virtual filesystem. A stub Ruby file is added to the filesystem and MrbFile::require will dynamically define Ruby items when invoked via Kernel#require.

If filename is a relative path, the Ruby source is added to the filesystem relative to RUBY_LOAD_PATH. If the path is absolute, the file is placed directly on the filesystem. Anscestor directories are created automatically.

fn def_rb_source_file<T, F>(
    &self,
    filename: T,
    contents: F
) -> Result<(), MrbError> where
    T: AsRef<str>,
    F: AsRef<[u8]>, 

Add a pure Ruby source file to the virtual filesystem.

If filename is a relative path, the Ruby source is added to the filesystem relative to RUBY_LOAD_PATH. If the path is absolute, the file is placed directly on the filesystem. Anscestor directories are created automatically.

Loading content...

Provided methods

fn normalize_source_path<T>(&self, filename: T) -> PathBuf where
    T: AsRef<str>, 

Normalize path of a Ruby source to be relative to RUBY_LOAD_PATH unless the path is absolute.

Loading content...

Implementors

impl MrbLoadSources for Mrb[src]

Loading content...