def attrAsWrapper(iface, m, getter): try: if m.implicit_jscontext: raise xpidl.RustNoncompat("jscontext is unsupported") if m.nostdcall: raise xpidl.RustNoncompat("nostdcall is unsupported") name = attributeParamName(m) if getter and m.infallible and m.realtype.kind == 'builtin': # NOTE: We don't support non-builtin infallible getters in Rust code. return infallible_impl_tmpl % { 'name': attributeNativeName(m, getter), 'realtype': m.realtype.rustType('in'), } rust_type = m.realtype.rustType('out' if getter else 'in') return method_impl_tmpl % { 'name': attributeNativeName(m, getter), 'params': name + ': ' + rust_type, 'ret_ty': '::nserror::nsresult', 'args': name, } except xpidl.RustNoncompat: # Dummy field for the doc comments to attach to. # Private so that it's not shown in rustdoc. return "const _%s: () = ();" % attributeNativeName(m, getter)
def attrAsWrapper(iface, m, getter): try: if m.implicit_jscontext: raise xpidl.RustNoncompat("jscontext is unsupported") if m.nostdcall: raise xpidl.RustNoncompat("nostdcall is unsupported") name = attributeParamName(m) if getter and m.infallible and m.realtype.kind == 'builtin': # NOTE: We don't support non-builtin infallible getters in Rust code. return infallible_impl_tmpl % { 'name': attributeNativeName(m, getter), 'realtype': m.realtype.rustType('in'), } param_list = attributeRawParamList(iface, m, getter) params = ["%s: %s" % x for x in param_list] return method_impl_tmpl % { 'name': attributeNativeName(m, getter), 'params': ', '.join(params), 'ret_ty': attributeReturnType(m, getter), 'args': '' if getter and m.notxpcom else name, } except xpidl.RustNoncompat: # Dummy field for the doc comments to attach to. # Private so that it's not shown in rustdoc. return "const _%s: () = ();" % attributeNativeName(m, getter)
def attributeRawParamList(iface, a, getter): l = [(attributeParamName(a), a.realtype.rustType('out' if getter else 'in'))] if a.implicit_jscontext: raise xpidl.RustNoncompat("jscontext is unsupported") if a.nostdcall: raise xpidl.RustNoncompat("nostdcall is unsupported") return l
def methodRawParamList(iface, m): l = [(rustSanitize(p.name), p.rustType()) for p in m.params] if m.implicit_jscontext: raise xpidl.RustNoncompat("jscontext is unsupported") if m.optional_argc: raise xpidl.RustNoncompat("optional_argc is unsupported") if m.nostdcall: raise xpidl.RustNoncompat("nostdcall is unsupported") if not m.notxpcom and m.realtype.name != 'void': l.append(("_retval", m.realtype.rustType('out'))) return l