pub enum Module {
Rust(RustModule),
Python(PythonModule),
}Expand description
A parsed module, either Rust or Python.
This enum allows parsers to return a unified type while preserving the specific module information for each language.
Variants§
Implementations§
Source§impl Module
impl Module
Sourcepub fn language(&self) -> ParserLanguage
pub fn language(&self) -> ParserLanguage
Get the language of this module.
Sourcepub fn as_rust(&self) -> Option<&RustModule>
pub fn as_rust(&self) -> Option<&RustModule>
Try to get as a Rust module.
Sourcepub fn as_python(&self) -> Option<&PythonModule>
pub fn as_python(&self) -> Option<&PythonModule>
Try to get as a Python module.
Sourcepub fn into_rust(self) -> Option<RustModule>
pub fn into_rust(self) -> Option<RustModule>
Convert into a Rust module, if applicable.
Sourcepub fn into_python(self) -> Option<PythonModule>
pub fn into_python(self) -> Option<PythonModule>
Convert into a Python module, if applicable.
Trait Implementations§
Source§impl From<PythonModule> for Module
impl From<PythonModule> for Module
Source§fn from(m: PythonModule) -> Self
fn from(m: PythonModule) -> Self
Converts to this type from the input type.
Source§impl From<RustModule> for Module
impl From<RustModule> for Module
Source§fn from(m: RustModule) -> Self
fn from(m: RustModule) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
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