Kriskras99 commented on code in PR #569:
URL: https://github.com/apache/avro-rs/pull/569#discussion_r3494533776
##########
avro_derive/tests/expanded/avro_rs_569_tuple_struct.expanded.rs:
##########
@@ -0,0 +1,101 @@
+use apache_avro::AvroSchema;
+struct B(i32, String);
+#[automatically_derived]
+impl ::apache_avro::AvroSchemaComponent for B {
+ fn get_schema_in_ctxt(
+ named_schemas: &mut
::std::collections::HashSet<::apache_avro::schema::Name>,
+ enclosing_namespace: ::apache_avro::schema::NamespaceRef,
+ ) -> ::apache_avro::schema::Schema {
+ let name = ::apache_avro::schema::Name::new_with_enclosing_namespace(
+ "B",
+ enclosing_namespace,
+ )
+ .expect("Unable to parse `B` as a Name");
+ if named_schemas.contains(&name) {
+ ::apache_avro::schema::Schema::Ref {
+ name,
+ }
+ } else {
+ let enclosing_namespace = name.namespace();
+ named_schemas.insert(name.clone());
+ ::apache_avro::schema::Schema::Record(
+ ::apache_avro::schema::RecordSchema::builder()
+ .aliases(::std::option::Option::None)
+ .maybe_doc(::std::option::Option::None)
+ .fields(
+ ::alloc::boxed::box_assume_init_into_vec_unsafe(
+ ::alloc::intrinsics::write_box_via_move(
+ ::alloc::boxed::Box::new_uninit(),
+ [
+ ::apache_avro::schema::RecordField {
+ name: "field_0".to_string(),
+ doc: ::std::option::Option::None,
+ default: <i32 as
::apache_avro::AvroSchemaComponent>::field_default(),
+ aliases: ::alloc::vec::Vec::new(),
+ schema: <i32 as
::apache_avro::AvroSchemaComponent>::get_schema_in_ctxt(
+ named_schemas,
+ enclosing_namespace,
+ ),
+ custom_attributes:
::std::collections::BTreeMap::new(),
+ },
+ ::apache_avro::schema::RecordField {
+ name: "field_1".to_string(),
+ doc: ::std::option::Option::None,
+ default: <String as
::apache_avro::AvroSchemaComponent>::field_default(),
+ aliases: ::alloc::vec::Vec::new(),
+ schema: <String as
::apache_avro::AvroSchemaComponent>::get_schema_in_ctxt(
+ named_schemas,
+ enclosing_namespace,
+ ),
+ custom_attributes:
::std::collections::BTreeMap::new(),
+ },
+ ],
+ ),
+ ),
+ )
Review Comment:
Tuple structs don't actually require the attribute, only real tuples and
tuple variants
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]