[][src]Trait artichoke_backend::LoadSources

pub trait LoadSources {
    type Artichoke;
    type Error: Error;
    type Exception: Error;
    fn def_file_for_type<T>(
        &mut self,
        filename: &[u8]
    ) -> Result<(), Self::Error>
    where
        T: File<Artichoke = Self::Artichoke, Error = Self::Exception>
;
fn def_rb_source_file<T>(
        &mut self,
        filename: &[u8],
        contents: T
    ) -> Result<(), Self::Error>
    where
        T: Into<Cow<'static, [u8]>>
; }

Load Ruby sources and Rust extensions into an interpreter.

Associated Types

type Artichoke

Concrete type for interpreter.

type Error: Error

Concrete type for errors returned from filesystem IO.

type Exception: Error

Concrete type for errors returned by File::require.

Loading content...

Required methods

fn def_file_for_type<T>(&mut self, filename: &[u8]) -> Result<(), Self::Error> where
    T: File<Artichoke = Self::Artichoke, Error = Self::Exception>, 

Add a Rust extension hook to the virtual filesystem. A stub Ruby file is added to the filesystem and File::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.

Errors

If writes to the underlying filesystem fail, an error is returned.

fn def_rb_source_file<T>(
    &mut self,
    filename: &[u8],
    contents: T
) -> Result<(), Self::Error> where
    T: Into<Cow<'static, [u8]>>, 

Add a Ruby source 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.

Errors

If writes to the underlying filesystem fail, an error is returned.

Loading content...

Implementors

impl LoadSources for Artichoke[src]

type Artichoke = Self

type Error = Exception

type Exception = Exception

Loading content...