Struct glsl_lang_pp::processor::fs::Processor

source ·
pub struct Processor<F: FileSystem> {
    file_cache: HashMap<FileId, Ast>,
    file_ids: BiHashMap<PathOrSource, FileId>,
    canonical_paths: BiHashMap<PathBuf, PathBuf>,
    system_paths: Vec<PathBuf>,
    fs: F,
}
Expand description

Preprocessor based on a filesystem

Fields§

§file_cache: HashMap<FileId, Ast>

Cache of parsed files (preprocessor token sequences)

§file_ids: BiHashMap<PathOrSource, FileId>

Mapping from canonical paths to FileIds

§canonical_paths: BiHashMap<PathBuf, PathBuf>

Mapping from #include/input paths to canonical paths

§system_paths: Vec<PathBuf>

List of include paths in resolution order

§fs: F

Filesystem abstraction

Implementations§

source§

impl<F: FileSystem> Processor<F>

source

pub fn new_with_fs(fs: F) -> Self

source

fn get_paths(&self, file_id: FileId) -> Option<(&PathBuf, &PathBuf)>

source

pub fn system_paths(&self) -> &Vec<PathBuf>

source

pub fn system_paths_mut(&mut self) -> &mut Vec<PathBuf>

source

fn resolve_relative_to_id( &self, relative_to: FileId, path: &ParsedPath, ) -> Option<PathBuf>

source

pub fn resolve_relative_to_path( &self, parent: impl AsRef<Path>, path: &ParsedPath, ) -> Option<PathBuf>

source

pub fn parse(&mut self, path: &Path) -> Result<ParsedFile<'_, F>, F::Error>

source

pub fn parse_source(&mut self, source: &str, path: &Path) -> ParsedFile<'_, F>

Parse a given source block as if it belonged in a specific directory

§Parameters
  • source: GLSL source block to parse
  • path: path to the directory that (virtually) contains this GLSL source block
source§

impl<F: FileSystem + Default> Processor<F>

source

pub fn new() -> Self

Trait Implementations§

source§

impl<F: Debug + FileSystem> Debug for Processor<F>

source§

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

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

impl<F: FileSystem + Default> Default for Processor<F>

source§

fn default() -> Self

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

impl<F: FileSystem> FileIdResolver for Processor<F>

source§

fn resolve(&self, file_id: FileId) -> Option<&Path>

Return the path corresponding to the FileId, if known

Auto Trait Implementations§

§

impl<F> Freeze for Processor<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for Processor<F>
where F: RefUnwindSafe,

§

impl<F> Send for Processor<F>
where F: Send,

§

impl<F> Sync for Processor<F>
where F: Sync,

§

impl<F> Unpin for Processor<F>
where F: Unpin,

§

impl<F> UnwindSafe for Processor<F>
where F: UnwindSafe,

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> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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