pub struct Lang;Implementations§
Source§impl Lang
impl Lang
Sourcepub fn from_filename(filename: &str) -> Option<&'static LangConfig>
pub fn from_filename(filename: &str) -> Option<&'static LangConfig>
Determines the language configuration based on the given filename.
This method attempts to match the file extension of the provided filename
with the supported language configurations. If a match is found, it returns
the corresponding LangConfig.
§Arguments
filename- A string slice that holds the name of the file
§Returns
Some(&'static LangConfig)if a matching language configuration is foundNoneif no matching language configuration is found
§Example
use devgen_splitter::Lang;
let filename = "example.rs";
if let Some(lang_config) = Lang::from_filename(filename) {
println!("Language: {:?}", lang_config.lang);
println!("File extensions: {:?}", lang_config.file_extensions);
} else {
println!("Unsupported file type");
}Auto Trait Implementations§
impl Freeze for Lang
impl RefUnwindSafe for Lang
impl Send for Lang
impl Sync for Lang
impl Unpin for Lang
impl UnwindSafe for Lang
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