chromium/mojo/public/tools/bindings/generators/cpp_templates/struct_traits_definition.tmpl

{%- import "struct_macros.tmpl" as struct_macros %}
{%- set mojom_type = struct|get_qualified_name_for_kind %}

// static
bool StructTraits<{{mojom_type}}::DataView, {{mojom_type}}Ptr>::Read(
    {{mojom_type}}::DataView input,
    {{mojom_type}}Ptr* output) {
  bool success = true;
  {{mojom_type}}Ptr result({{mojom_type}}::New());
  {{struct_macros.deserialize(struct, "input", "result->%s",
                              "success")|indent(4)}}
  *output = std::move(result);
  return success;
}