Struct okane_core::load::Loader

source ·
pub struct Loader { /* private fields */ }
Expand description

Loader is an object to keep loading a given file and may recusrively load them as repr::LedgerEntry, with the metadata about filename or line/column to point the error in a user friendly manner.

Implementations§

source§

impl Loader

source

pub fn new(source: PathBuf) -> Self

Create a new instance of Loader to load the given path.

It might look weird to have the source path as a Loader member, but that would give future flexibility to support loading from stdio/network without include, or completely static one.

source

pub fn with_fake_files( &mut self, fake_files: HashMap<PathBuf, Vec<u8>>, ) -> &mut Self

Set fake_files which resolves Path -> its contents conversion.

source

pub fn load_repl<T, E>(&self, callback: T) -> Result<(), E>
where T: FnMut(&Path, &LedgerEntry<'_>) -> Result<(), E>, E: Error + From<LoadError>,

Loads repl::LedgerEntry and invoke callback on every entry, recursively resolving include directives.

Auto Trait Implementations§

§

impl Freeze for Loader

§

impl RefUnwindSafe for Loader

§

impl Send for Loader

§

impl Sync for Loader

§

impl Unpin for Loader

§

impl UnwindSafe for Loader

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, 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.