pub struct InMemorySourceProvider { /* private fields */ }Expand description
An in-memory SourceProvider backed by a HashMap.
Useful for testing and environments without filesystem access. Keys are stored and looked up exactly as provided — there is no path normalization. The caller controls both the registered keys and the import paths, so they are responsible for making them match.
resolve_path joins the parent directory of from with import_path,
appends .orr, and does a direct HashMap lookup on the result.
Implementations§
Trait Implementations§
Source§impl Clone for InMemorySourceProvider
impl Clone for InMemorySourceProvider
Source§fn clone(&self) -> InMemorySourceProvider
fn clone(&self) -> InMemorySourceProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InMemorySourceProvider
impl Debug for InMemorySourceProvider
Source§impl Default for InMemorySourceProvider
impl Default for InMemorySourceProvider
Source§fn default() -> InMemorySourceProvider
fn default() -> InMemorySourceProvider
Returns the “default value” for a type. Read more
Source§impl SourceProvider for InMemorySourceProvider
impl SourceProvider for InMemorySourceProvider
Source§fn resolve_path(
&self,
from: &Path,
import_path: &str,
) -> Result<PathBuf, SourceError>
fn resolve_path( &self, from: &Path, import_path: &str, ) -> Result<PathBuf, SourceError>
Resolve an import path relative to the importing file. Read more
Source§fn read_source(&self, path: &Path) -> Result<String, SourceError>
fn read_source(&self, path: &Path) -> Result<String, SourceError>
Read the source text of a file at the given path. Read more
Source§fn derive_namespace(&self, import_path: &Path) -> Result<Id, SourceError>
fn derive_namespace(&self, import_path: &Path) -> Result<Id, SourceError>
Auto Trait Implementations§
impl Freeze for InMemorySourceProvider
impl RefUnwindSafe for InMemorySourceProvider
impl Send for InMemorySourceProvider
impl Sync for InMemorySourceProvider
impl Unpin for InMemorySourceProvider
impl UnsafeUnpin for InMemorySourceProvider
impl UnwindSafe for InMemorySourceProvider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more