pub struct LanguageDetector { /* private fields */ }Expand description
High-performance language detector with multiple strategies
Implementations§
Source§impl LanguageDetector
impl LanguageDetector
Sourcepub fn new() -> LanguageDetector
pub fn new() -> LanguageDetector
Create a new language detector with default configuration
Sourcepub fn with_strategy(strategy: DetectionStrategy) -> LanguageDetector
pub fn with_strategy(strategy: DetectionStrategy) -> LanguageDetector
Create a language detector with custom strategy
Sourcepub fn detect_language(&self, path: &Path) -> Language
pub fn detect_language(&self, path: &Path) -> Language
Detect language for a file path (extension-based)
Sourcepub fn detect_language_with_content(
&mut self,
path: &Path,
content: &str,
) -> DetectionResult
pub fn detect_language_with_content( &mut self, path: &Path, content: &str, ) -> DetectionResult
Detect language with full content analysis
Sourcepub fn detect_with_hints(
&mut self,
path: &Path,
content: &str,
hints: &LanguageHints,
) -> DetectionResult
pub fn detect_with_hints( &mut self, path: &Path, content: &str, hints: &LanguageHints, ) -> DetectionResult
Detect language with project context hints
Trait Implementations§
Source§impl Default for LanguageDetector
impl Default for LanguageDetector
Source§fn default() -> LanguageDetector
fn default() -> LanguageDetector
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LanguageDetector
impl RefUnwindSafe for LanguageDetector
impl Send for LanguageDetector
impl Sync for LanguageDetector
impl Unpin for LanguageDetector
impl UnwindSafe for LanguageDetector
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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