Fix docs, OMG, finding this was *hard*

Lesson learned: Don't be to much in a rush or you will miss
what's rigth in front of your nose
This commit is contained in:
Sebastian Thiel
2021-04-01 22:07:28 +08:00
parent b272b3f4e2
commit 11fae8353b
3 changed files with 5 additions and 3 deletions

View File

@@ -148,7 +148,7 @@ All *structures* are marked with applicable traits to further categorize them an
Generally speaking, you can invoke *Activities* like this:
```Rust,ignore
let r = hub.resource().activity(...).${api.terms.action}()
let r = hub.resource().activity(...).${api.terms.action}().await
```
% if fr:
@@ -157,7 +157,7 @@ Or specifically ...
```ignore
% for an, a in c.sta_map[fr.id].items():
<% category, resource, activity = activity_split(an) %>\
let r = hub.${mangle_ident(resource)}().${mangle_ident(activity)}(...).${api.terms.action}()
let r = hub.${mangle_ident(resource)}().${mangle_ident(activity)}(...).${api.terms.action}().await
% endfor
```
% endif

View File

@@ -287,7 +287,7 @@ ${self._setter_fn(resource, method, m, p, part_prop, ThisType, c)}\
# could also just skip the first element, but ... let's be safe
if request_value and request_value.id == p.get(TREF):
continue
v = rvfrt(p.name, p)
v = rnd_arg_val_for_type(activity_input_type(schemas, p))
# we chose to replace random strings with their meaning, as indicated by the name !
if is_string_value(v):
v = '"%s"' % p.name

View File

@@ -46,6 +46,8 @@ RUST_TYPE_RND_MAP = {'bool': lambda: str(bool(randint(0, 1))).lower(),
'i32' : lambda: randint(-101, -1),
'i64' : lambda: randint(-101, -1),
'String': lambda: '"%s"' % choice(words),
'&str': lambda: '"%s"' % choice(words),
'&Vec<String>': lambda: '&vec!["%s".into()]' % choice(words), # why a reference to Vec? Because it works. Should be slice, but who knows how typing works here.
}
TREF = '$ref'
IO_RESPONSE = 'response'