mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-02 17:42:16 +01:00
fix(test): method builder examples work now
It was easier than expected, but in the end needs quite some custom code and handling. Good to have mako (and python !!!)
This commit is contained in:
@@ -97,6 +97,8 @@ let mut hub = YouTube::new(hyper::Client::new(), auth);
|
||||
|
||||
## About Customization/Callbacks
|
||||
|
||||
## About Optionals in parts (needed for Json, otherwise I'd happily drop them)
|
||||
|
||||
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
|
||||
[google-go-api]: https://github.com/google/google-api-go-client
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -68,6 +68,8 @@ ${'##'} About error handling
|
||||
|
||||
${'##'} About Customization/Callbacks
|
||||
|
||||
${'##'} About Optionals in parts (needed for Json, otherwise I'd happily drop them)
|
||||
|
||||
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
|
||||
[google-go-api]: https://github.com/google/google-api-go-client
|
||||
</%def>
|
||||
|
||||
@@ -63,9 +63,13 @@ ${capture(lib.test_hub, hub_type_name, comments=False) | hide_rust_doc_test}
|
||||
let mut ${rb_name}: ${request_value.id} = Default::default();
|
||||
% for spn, sp in request_value.get('properties', dict()).iteritems():
|
||||
<%
|
||||
assignment = rvfrt(spn, sp)
|
||||
assignment = rvfrt(spn, sp, request_value.id)
|
||||
if is_string_value(assignment):
|
||||
assignment = assignment + '.to_string()'
|
||||
if assignment.endswith('default()'):
|
||||
assignment = assignment[1:] # cut & - it's not ok in this case :)!
|
||||
else:
|
||||
assignment = 'Some(%s)' % assignment
|
||||
%>\
|
||||
## ${to_rust_type(request_value.id, spn, sp, allow_optionals=False)}
|
||||
${rb_name}.${mangle_ident(spn)} = ${assignment};
|
||||
|
||||
@@ -489,6 +489,4 @@ def rnd_arg_val_for_type(tn):
|
||||
try:
|
||||
return str(RUST_TYPE_RND_MAP[tn]())
|
||||
except KeyError:
|
||||
# be verbose to show actual type ! It's for documentation, after all, people should see what's going on
|
||||
# right away without another lookup
|
||||
return '&<%s as Default>::default()' % tn
|
||||
return '&Default::default()'
|
||||
|
||||
Reference in New Issue
Block a user