summaryrefslogtreecommitdiff
path: root/docs/src/lib.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-06-06 21:13:59 +0200
committerLaurenz <laurmaedje@gmail.com>2023-06-06 22:06:16 +0200
commitfd417da04f7ca4b995de7f6510abafd3e9c31307 (patch)
tree3675529c75ca7363701ac8ea306de2cc1d3cbcb3 /docs/src/lib.rs
parent168bdf35bd773e67343c965cb473492cc5cae9e7 (diff)
Improve value casting infrastructure
Diffstat (limited to 'docs/src/lib.rs')
-rw-r--r--docs/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/src/lib.rs b/docs/src/lib.rs
index 4cb47283..bc3be0cc 100644
--- a/docs/src/lib.rs
+++ b/docs/src/lib.rs
@@ -415,7 +415,8 @@ fn func_model(
name = name
.strip_prefix(parent)
.or(name.strip_prefix(parent.strip_suffix('s').unwrap_or(parent)))
- .unwrap_or(name);
+ .unwrap_or(name)
+ .trim_matches('-');
}
path.push(name);
@@ -429,6 +430,13 @@ fn func_model(
})
.collect();
+ let mut returns = vec![];
+ casts(resolver, &mut returns, &mut vec![], &info.returns);
+ returns.sort_by_key(|ty| type_index(ty));
+ if returns == ["none"] {
+ returns.clear();
+ }
+
FuncModel {
path,
display: info.display,
@@ -437,7 +445,7 @@ fn func_model(
element: func.element().is_some(),
details: Html::markdown_with_id_base(resolver, docs, id_base),
params: info.params.iter().map(|param| param_model(resolver, param)).collect(),
- returns: info.returns.clone(),
+ returns,
methods: method_models(resolver, info.docs),
scope,
}