Skip to content

Commit

Permalink
fix(json): Vec/HashMap are Optionals
Browse files Browse the repository at this point in the history
That assures that we can decode partial server responses, and send
partial structures as well.
  • Loading branch information
Byron committed Mar 20, 2015
1 parent 9f719dd commit cfb8fae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mako/lib/mbuild.mako
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ else {
% if request_value:
let mut json_mime_type = mime::Mime(mime::TopLevel::Application, mime::SubLevel::Json, Default::default());
let mut request_value_reader = io::Cursor::new(json::to_vec(&self.${property(REQUEST_VALUE_PROPERTY_NAME)}).unwrap());
let mut request_value_reader = io::Cursor::new(json::to_vec(&self.${property(REQUEST_VALUE_PROPERTY_NAME)}));
let request_size = request_value_reader.seek(io::SeekFrom::End(0)).unwrap();
request_value_reader.seek(io::SeekFrom::Start(0)).unwrap();
% endif
Expand Down
4 changes: 2 additions & 2 deletions src/mako/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,10 @@ def wrap_type(tn):
try:
rust_type = TYPE_MAP[t.type]
if t.type == 'array':
return "%s<%s>" % (rust_type, unique_type_name((nested_type(t))))
return wrap_type("%s<%s>" % (rust_type, unique_type_name((nested_type(t)))))
elif t.type == 'object':
if _is_map_prop(t):
return "%s<String, %s>" % (rust_type, nested_type(t))
return wrap_type("%s<String, %s>" % (rust_type, nested_type(t)))
else:
return wrap_type(nested_type(t))
elif t.type == 'string' and 'Count' in pn:
Expand Down

0 comments on commit cfb8fae

Please sign in to comment.