Struct FsModuleLoader

Source
pub struct FsModuleLoader { /* private fields */ }
Expand description

The loader is used to manage the process of creating an in-memory model from file-system resources.

A Module Loader is therefore responsible for:

  1. finding the resource that contains a module definition,
  2. parsing the source into an in-memory representation,
  3. caching the loaded module, and it’s source, for future use.

Implementations§

Source§

impl FsModuleLoader

Source

pub fn with_resolver(self, resolver: FsModuleResolver) -> Self

Source

pub fn with_reporter(self, reporter: Box<dyn Reporter>) -> Self

Source

pub fn load_from_file( &mut self, file: PathBuf, cache: &mut impl ModuleStore, recursive: bool, ) -> Result<Identifier, Error>

Load a module from the source in file.

Source

pub fn load_from_reader( &mut self, reader: &mut dyn Read, cache: &mut impl ModuleStore, recursive: bool, ) -> Result<Identifier, Error>

Load a module reading the source from reader.

Trait Implementations§

Source§

impl Debug for FsModuleLoader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FsModuleLoader

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ModuleLoader for FsModuleLoader

Source§

fn load( &mut self, name: &Identifier, from: Option<FileId>, cache: &mut impl ModuleStore, recursive: bool, ) -> Result<Identifier, Error>

Resolve name into a resource identifier (URL) and parse into memory. The loader will check the store first to see if the module is already loaded, and will add the module into the store after parsing. The value of recursive tells the loader whether to also load the module’s dependencies as well.
Source§

fn resolver(&self) -> &impl ModuleResolver

Returns the instance of ModuleResolver used by this loader.
Source§

fn get_file_id(&self, name: &Identifier) -> Option<FileId>

Source§

fn get_source(&self, file_id: FileId) -> Option<Source>

Source§

fn report(&self, diagnostic: &Diagnostic) -> Result<(), Error>

Source§

fn reporter_done( &self, top_module_name: Option<String>, ) -> Result<ReportCounters, Error>

Source§

fn set_severity_filter(&mut self, filter: SeverityFilter)

Source§

fn get_source_by_name(&self, name: &Identifier) -> Option<Source>

Source§

fn has_source(&self, file_id: usize) -> bool

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T