mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-02-02 07:02:07 +01:00
fix(cosmetics): nicer code and identifiers
This commit is contained in:
@@ -27,7 +27,7 @@ Handle the following *Resources* with ease ...
|
||||
md_methods = list()
|
||||
for method in sorted(c.rta_map[r]):
|
||||
if rust_doc:
|
||||
md_methods.append("[*%s*](struct.%s.html)" % (method, mb_type(r, method)))
|
||||
md_methods.append("[*%s*](struct.%s.html)" % (' '.join(n.lower() for n in reversed(method.split('.'))), mb_type(r, method)))
|
||||
else:
|
||||
# TODO: link to final destination, possibly just have one for all ...
|
||||
md_methods.append("*%s*" % method)
|
||||
|
||||
@@ -67,6 +67,10 @@ impl${rb_params} ${ThisType} {
|
||||
# we would could have information about data requirements for each property in it's dict.
|
||||
# for now, we just hardcode it, and treat the entries as way to easily change param names
|
||||
assert len(api.properties) == 2, "Hardcoded for now, thanks to scope requirements"
|
||||
|
||||
type_params = ''
|
||||
if mb_additional_type_params(m):
|
||||
type_params = '<%s>' % ', '.join(mb_additional_type_params(m))
|
||||
%>\
|
||||
|
||||
% if 'description' in m:
|
||||
@@ -74,7 +78,7 @@ impl${rb_params} ${ThisType} {
|
||||
///
|
||||
${m.description | rust_doc_comment, indent_all_but_first_by(1)}
|
||||
% endif
|
||||
pub fn ${mangle_ident(a)}<${', '.join(mb_additional_type_params(m))}>(&self${method_args}) -> ${RType}${mb_tparams} {
|
||||
pub fn ${mangle_ident(a)}${type_params}(&self${method_args}) -> ${RType}${mb_tparams} {
|
||||
${RType} {
|
||||
hub: self.hub,
|
||||
% for p in required_props:
|
||||
|
||||
@@ -254,7 +254,7 @@ def nested_type_name(sn, pn):
|
||||
|
||||
# Make properties which are reserved keywords usable
|
||||
def mangle_ident(n):
|
||||
n = camel_to_under(n).replace('-', '.').replace('.', '').replace('$', '')
|
||||
n = camel_to_under(n).replace('-', '.').replace('.', '_').replace('$', '')
|
||||
if n in RESERVED_WORDS:
|
||||
return n + '_'
|
||||
return n
|
||||
|
||||
Reference in New Issue
Block a user