Struct gluon::import::Import
[−]
[src]
pub struct Import<I = DefaultImporter> { pub paths: RwLock<Vec<PathBuf>>, pub importer: I, }
Macro which rewrites occurances of import! "filename"
to a load of that file if it is not
already loaded and then a global access to the loaded module
Fields
paths: RwLock<Vec<PathBuf>>
importer: I
Methods
impl<I> Import<I>
[src]
fn new(importer: I) -> Import<I>
Creates a new import macro
fn add_path<P: Into<PathBuf>>(&self, path: P)
Adds a path to the list of paths which the importer uses to find files
fn read_file<P>(&self, filename: P) -> Result<Cow<'static, str>, MacroError> where
P: AsRef<Path>,
P: AsRef<Path>,
Trait Implementations
impl<I> Macro for Import<I> where
I: Importer,
[src]
I: Importer,
fn expand(
&self,
macros: &mut MacroExpander,
args: &mut [SpannedExpr<Symbol>]
) -> Result<SpannedExpr<Symbol>, MacroError>
&self,
macros: &mut MacroExpander,
args: &mut [SpannedExpr<Symbol>]
) -> Result<SpannedExpr<Symbol>, MacroError>