MCPcopy Create free account
hub / github.com/LaBatata101/sith-language-server / try_into_module

Method try_into_module

crates/sith_python_parser/src/lib.rs:301–310  ·  view source on GitHub ↗

Attempts to convert the [`Parsed `] into a [`Parsed `]. This method checks if the `syntax` field of the output is a [`Mod::Module`]. If it is, the method returns [`Some(Parsed )`] with the contained module. Otherwise, it returns [`None`]. [`Some(Parsed )`]: Some

(self)

Source from the content-addressed store, hash-verified

299 ///
300 /// [`Some(Parsed<ModModule>)`]: Some
301 pub fn try_into_module(self) -> Option<Parsed<ModModule>> {
302 match self.syntax {
303 Mod::Module(module) => Some(Parsed {
304 syntax: module,
305 tokens: self.tokens,
306 errors: self.errors,
307 }),
308 Mod::Expression(_) => None,
309 }
310 }
311
312 /// Attempts to convert the [`Parsed<Mod>`] into a [`Parsed<ModExpression>`].
313 ///

Callers 2

parse_moduleFunction · 0.80
parse_unchecked_sourceFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected