pub struct IncludeHandler { /* private fields */ }Expand description
Include handler for all languages
Implementations§
Source§impl IncludeHandler
impl IncludeHandler
Sourcepub const DEPTH_LIMIT: usize = 30usize
pub const DEPTH_LIMIT: usize = 30usize
Maximum limit for including to avoid recursion stack overflow
Sourcepub fn main_without_config(file: &Path) -> Self
pub fn main_without_config(file: &Path) -> Self
Create handler with empty config
Sourcepub fn main(
file_path: &Path,
includes: Vec<PathBuf>,
path_remapping: HashMap<PathBuf, PathBuf>,
) -> Self
pub fn main( file_path: &Path, includes: Vec<PathBuf>, path_remapping: HashMap<PathBuf, PathBuf>, ) -> Self
Create handler with given config
Sourcepub fn get_includes(&self) -> &HashSet<PathBuf>
pub fn get_includes(&self) -> &HashSet<PathBuf>
Get all includes of handler
Sourcepub fn get_visited_count(&self, path: &Path) -> usize
pub fn get_visited_count(&self, path: &Path) -> usize
Get the number of time a file has been visited
Sourcepub fn search_in_includes(
&mut self,
relative_path: &Path,
include_callback: &mut dyn FnMut(&Path) -> Option<String>,
) -> Option<(String, PathBuf)>
pub fn search_in_includes( &mut self, relative_path: &Path, include_callback: &mut dyn FnMut(&Path) -> Option<String>, ) -> Option<(String, PathBuf)>
Search for a given relative path in all includes and call the callback on the resolved absolute path to handle loading of the file.
Sourcepub fn push_directory_stack(&mut self, canonical_path: &Path)
pub fn push_directory_stack(&mut self, canonical_path: &Path)
Push a file on directory stack for include context.
Sourcepub fn search_path_in_includes(
&mut self,
relative_path: &Path,
) -> Option<PathBuf>
pub fn search_path_in_includes( &mut self, relative_path: &Path, ) -> Option<PathBuf>
Search a path in include. Return an absolute canonicalized path.
Trait Implementations§
Source§impl Clone for IncludeHandler
impl Clone for IncludeHandler
Source§fn clone(&self) -> IncludeHandler
fn clone(&self) -> IncludeHandler
Returns a duplicate of the value. Read more
1.0.0 · 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 IncludeHandler
impl Debug for IncludeHandler
Source§impl Default for IncludeHandler
impl Default for IncludeHandler
Source§fn default() -> IncludeHandler
fn default() -> IncludeHandler
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IncludeHandler
impl RefUnwindSafe for IncludeHandler
impl Send for IncludeHandler
impl Sync for IncludeHandler
impl Unpin for IncludeHandler
impl UnwindSafe for IncludeHandler
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