diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-05-19 11:04:20 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-05-19 11:04:20 +0200 |
| commit | 56a96881a54dd3784e0db22e36130eddf4e19a02 (patch) | |
| tree | 4a1a78c35663a81a77406e5b21f0b8d423e98130 /docs/src/lib.rs | |
| parent | 551ea99d05166b0be50792f767ddd38b996e32fa (diff) | |
Doc links for function scopes
Diffstat (limited to 'docs/src/lib.rs')
| -rw-r--r-- | docs/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/docs/src/lib.rs b/docs/src/lib.rs index a9a640f6..af786cd1 100644 --- a/docs/src/lib.rs +++ b/docs/src/lib.rs @@ -213,7 +213,7 @@ fn category_page(resolver: &dyn Resolver, category: &str) -> PageModel { let focus = match category { "math" => &LIBRARY.math, - "calculate" => module(&LIBRARY.global, "calc"), + "calculate" => module(&LIBRARY.global, "calc").unwrap(), _ => &LIBRARY.global, }; @@ -807,7 +807,7 @@ pub struct SymbolModel { /// Create a page for symbols. fn symbol_page(resolver: &dyn Resolver, parent: &str, name: &str) -> PageModel { - let module = &module(&LIBRARY.global, name); + let module = module(&LIBRARY.global, name).unwrap(); let mut list = vec![]; for (name, value) in module.scope().iter() { @@ -873,10 +873,10 @@ struct GroupData { /// Extract a module from another module. #[track_caller] -fn module<'a>(parent: &'a Module, name: &str) -> &'a Module { +fn module<'a>(parent: &'a Module, name: &str) -> Result<&'a Module, String> { match parent.scope().get(name) { - Some(Value::Module(module)) => module, - _ => panic!("module doesn't contain module `{name}`"), + Some(Value::Module(module)) => Ok(module), + _ => Err(format!("module doesn't contain module `{name}`")), } } |
