pub struct Import<I = DefaultImporter> {
pub paths: RwLock<Vec<PathBuf>>,
pub importer: I,
pub compiler: Mutex<CompilerDatabase>,
}
Expand description
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
§compiler: Mutex<CompilerDatabase>
Implementations§
source§impl<I> Import<I>
impl<I> Import<I>
sourcepub fn add_path<P: Into<PathBuf>>(&self, path: P)
pub fn add_path<P: Into<PathBuf>>(&self, path: P)
Adds a path to the list of paths which the importer uses to find files
pub fn set_paths(&self, paths: Vec<PathBuf>)
pub fn modules( &self, compiler: &mut ModuleCompiler<'_, '_> ) -> Vec<Cow<'static, str>>
pub fn database_mut(self: Arc<Self>, thread: RootedThread) -> DatabaseMutwhere
I: Importer,
pub fn snapshot(&self, thread: RootedThread) -> Snapshot<CompilerDatabase>
pub fn fork( &mut self, forker: ForkState, thread: RootedThread ) -> Snapshot<CompilerDatabase>
Trait Implementations§
source§impl<I> Macro for Import<I>where
I: Importer,
impl<I> Macro for Import<I>where
I: Importer,
fn get_capability_impl( &self, thread: &Thread, arc_self: &Arc<dyn Macro>, id: TypeId ) -> Option<Box<dyn Any>>
source§fn expand<'r, 'a: 'r, 'b: 'r, 'c: 'r, 'ast: 'r>(
&self,
macros: &'b mut MacroExpander<'a>,
_symbols: &'c mut Symbols,
_arena: &'b mut OwnedArena<'ast, Symbol>,
args: &'b mut [SpannedExpr<'ast, Symbol>]
) -> MacroFuture<'r, 'ast>
fn expand<'r, 'a: 'r, 'b: 'r, 'c: 'r, 'ast: 'r>( &self, macros: &'b mut MacroExpander<'a>, _symbols: &'c mut Symbols, _arena: &'b mut OwnedArena<'ast, Symbol>, args: &'b mut [SpannedExpr<'ast, Symbol>] ) -> MacroFuture<'r, 'ast>
Creating a symbol in
symbols
will put it in the same scope as the code surrounding the
expansion. If you want to create a unique symbol then call Symbol::from
or create a new
Symbols
tablefn get_capability<T>( &self, thread: &Thread, arc_self: &Arc<dyn Macro> ) -> Option<T>
Auto Trait Implementations§
impl<I> RefUnwindSafe for Import<I>where
I: RefUnwindSafe,
impl<I> Send for Import<I>where
I: Send,
impl<I> Sync for Import<I>where
I: Sync,
impl<I> Unpin for Import<I>where
I: Unpin,
impl<I> UnwindSafe for Import<I>where
I: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.