Skip to main content

PathLoader

Struct PathLoader 

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

A loader over the filesystem, with a search list for #include.

A quoted include resolves against the including file’s own directory first, which is what every C preprocessor does and what an IDL author expects when they write #include "common.idl" next to their file. Only then does the search list apply. Getting that order wrong makes a file compile against a header from somewhere else, and the two are indistinguishable in the output.

Implementations§

Source§

impl PathLoader

Source

pub fn new(roots: Vec<PathBuf>) -> Self

A loader over roots, searched in the order given.

Source

pub fn bare() -> Self

A loader with no search list — quoted includes still resolve beside the including file.

Source

pub fn opened(&self) -> Vec<String>

Every file opened so far, in order.

Trait Implementations§

Source§

impl FileLoader for PathLoader

Source§

fn load(&self, path: &str, from: Option<&str>) -> Option<(String, String)>

Resolve and read path, as requested from from. Read more

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.