pub enum Language {
Rust,
TypeScript,
JavaScript,
Python,
}Expand description
Supported programming languages.
Variants§
Implementations§
Source§impl Language
impl Language
Sourcepub fn extensions(&self) -> &'static [&'static str]
pub fn extensions(&self) -> &'static [&'static str]
Returns file extensions associated with this language.
Sourcepub fn from_extension(ext: &str) -> Option<Self>
pub fn from_extension(ext: &str) -> Option<Self>
Detect language from a file extension (without the leading dot).
Returns None for unrecognised extensions.
Sourcepub fn visibility_keyword(self, is_public: bool) -> &'static str
pub fn visibility_keyword(self, is_public: bool) -> &'static str
Visibility/export marker rendered before a public symbol in this language’s syntax. Empty string when the symbol is private or when the language has no syntactic visibility keyword.
Used by crate::symbol_snippet so synthetic definition snippets read
natively for each language instead of always borrowing Rust’s pub.
- Rust:
pubfor public,""for private. - TypeScript / JavaScript:
exportfor public,""for private. (TS/JS parsers setis_public = trueexactly when a symbol carries theexportkeyword.) - Python: always
""— Python has no syntactic visibility marker.
Sourcepub fn function_keyword(self) -> &'static str
pub fn function_keyword(self) -> &'static str
Source keyword for declaring a function in this language: fn /
function / def.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Language
impl<'de> Deserialize<'de> for Language
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Language
impl Eq for Language
impl StructuralPartialEq for Language
Auto Trait Implementations§
impl Freeze for Language
impl RefUnwindSafe for Language
impl Send for Language
impl Sync for Language
impl Unpin for Language
impl UnsafeUnpin for Language
impl UnwindSafe for Language
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