diff --git a/src/mako/lib/util.py b/src/mako/lib/util.py index 926d55ef23..3ea372689b 100644 --- a/src/mako/lib/util.py +++ b/src/mako/lib/util.py @@ -76,13 +76,18 @@ def to_rust_type(sn, pn, t, allow_optionals=True): return "Option<%s>" % tn return tn try: + is_pod = True rust_type = TYPE_MAP[t.type] if t.type == 'array': rust_type = "%s<%s>" % (rust_type, nested_type(t)) + is_pod = False elif t.type == 'object': rust_type = "%s" % (rust_type, nested_type(t)) + is_pod = False elif rust_type == USE_FORMAT: rust_type = TYPE_MAP[t.format] + if is_pod and allow_optionals: + return "Option<%s>" % rust_type return rust_type except KeyError as err: raise AssertionError("%s: Property type '%s' unknown - add new type mapping: %s" % (str(err), t.type, str(t)))