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>
impl<F: FileSystem> Processor<F>
pub fn new_with_fs(fs: F) -> Self
fn get_paths(&self, file_id: FileId) -> Option<(&PathBuf, &PathBuf)>
pub fn system_paths(&self) -> &Vec<PathBuf>
pub fn system_paths_mut(&mut self) -> &mut Vec<PathBuf>
fn resolve_relative_to_id( &self, relative_to: FileId, path: &ParsedPath, ) -> Option<PathBuf>
pub fn resolve_relative_to_path( &self, parent: impl AsRef<Path>, path: &ParsedPath, ) -> Option<PathBuf>
pub fn parse(&mut self, path: &Path) -> Result<ParsedFile<'_, F>, F::Error>
sourcepub fn parse_source(&mut self, source: &str, path: &Path) -> ParsedFile<'_, F>
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 parsepath
: path to the directory that (virtually) contains this GLSL source block
Trait Implementations§
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> 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> 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