{{! Copyright (c) Meta Platforms, Inc. and its affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. }} {{#struct:union?}} impl ::std::default::Default for {{struct:rust_name}} { fn default() -> Self { Self::UnknownField(-1) } } impl ::fbthrift::GetTType for {{struct:rust_name}} { const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct; } {{!newline}} {{#struct:thrift_uri}} impl ::fbthrift::GetUri for self::{{struct:rust_name}} { fn uri() -> &'static str { "{{struct:thrift_uri}}" } } {{/struct:thrift_uri}} impl
::fbthrift::Serialize
for {{struct:rust_name}} where P: ::fbthrift::ProtocolWriter, { fn write(&self, p: &mut P) { p.write_struct_begin("{{struct:name}}"); match self {{>lib/block}}{{! }}{{#struct:fields}} Self::{{field:rust_name}}(inner) => { p.write_field_begin({{! }}"{{field:name}}", {{! }}{{#field:type}}{{>lib/ttype}}{{/field:type}}, {{! }}{{field:key}}{{! }}); {{#field:type}}{{#field:type_annotation?}}{{>lib/annfieldwrite}}{{/field:type_annotation?}}{{^field:type_annotation?}}{{>lib/write}}{{/field:type_annotation?}}{{/field:type}}({{! }}{{#field:has_adapter?}}&{{>lib/adapter/qualified}}::to_thrift_field::<{{struct:rust_name}}>({{/field:has_adapter?}}{{! }}inner{{! }}{{#field:has_adapter?}}, {{field:key}}){{/field:has_adapter?}}{{! }}, p); p.write_field_end(); }{{! }}{{/struct:fields}} Self::UnknownField(_) => {} } p.write_field_stop(); p.write_struct_end(); } } impl
::fbthrift::Deserialize
for {{struct:rust_name}}
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result