pub struct ImportDetector { /* private fields */ }Expand description
Import detection and resolution engine with pre-computed lookup optimization
Implementations§
Source§impl ImportDetector
impl ImportDetector
Sourcepub fn with_config(config: ImportResolutionConfig) -> Self
pub fn with_config(config: ImportResolutionConfig) -> Self
Create with configuration
Sourcepub fn with_file_index<T>(
config: ImportResolutionConfig,
scan_results: &[T],
) -> Selfwhere
T: ScanResult,
pub fn with_file_index<T>(
config: ImportResolutionConfig,
scan_results: &[T],
) -> Selfwhere
T: ScanResult,
Create with pre-computed lookup maps for massive performance improvement
Sourcepub fn detect_language(&self, file_path: &str) -> Option<String>
pub fn detect_language(&self, file_path: &str) -> Option<String>
Detect programming language from file extension
Sourcepub fn resolve_import<T>(
&self,
import_str: &str,
current_file: &str,
file_map: &HashMap<&str, &T>,
) -> Option<String>where
T: ScanResult,
pub fn resolve_import<T>(
&self,
import_str: &str,
current_file: &str,
file_map: &HashMap<&str, &T>,
) -> Option<String>where
T: ScanResult,
Resolve import string to actual file path
Trait Implementations§
Source§impl Clone for ImportDetector
impl Clone for ImportDetector
Source§fn clone(&self) -> ImportDetector
fn clone(&self) -> ImportDetector
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 moreAuto Trait Implementations§
impl Freeze for ImportDetector
impl RefUnwindSafe for ImportDetector
impl Send for ImportDetector
impl Sync for ImportDetector
impl Unpin for ImportDetector
impl UnwindSafe for ImportDetector
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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