This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro-rs.git
The following commit(s) were added to refs/heads/main by this push:
new 7e1c909 feat: Add `#[automatically_derived]` attribute to the auto
generated impls (#211)
7e1c909 is described below
commit 7e1c90924606929a41140d7bcf4b135587d10003
Author: Martin Grigorov <[email protected]>
AuthorDate: Tue Jun 10 14:05:46 2025 +0300
feat: Add `#[automatically_derived]` attribute to the auto generated impls
(#211)
See
https://doc.rust-lang.org/reference/attributes/derive.html#the-automatically_derived-attribute
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
---
avro_derive/src/lib.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/avro_derive/src/lib.rs b/avro_derive/src/lib.rs
index bf52f95..767a46a 100644
--- a/avro_derive/src/lib.rs
+++ b/avro_derive/src/lib.rs
@@ -112,6 +112,7 @@ fn derive_avro_schema(input: &mut DeriveInput) ->
Result<TokenStream, Vec<syn::E
let ident = &input.ident;
let (impl_generics, ty_generics, where_clause) =
input.generics.split_for_impl();
Ok(quote! {
+ #[automatically_derived]
impl #impl_generics apache_avro::schema::derive::AvroSchemaComponent
for #ident #ty_generics #where_clause {
fn get_schema_in_ctxt(named_schemas: &mut
std::collections::HashMap<apache_avro::schema::Name,
apache_avro::schema::Schema>, enclosing_namespace: &Option<String>) ->
apache_avro::schema::Schema {
let name =
apache_avro::schema::Name::new(#full_schema_name).expect(&format!("Unable to
parse schema name {}",
#full_schema_name)[..]).fully_qualified_name(enclosing_namespace);
@@ -521,6 +522,7 @@ mod tests {
let derived = derive_avro_schema(&mut input);
assert!(derived.is_ok());
assert_eq!(derived.unwrap().to_string(), quote! {
+ #[automatically_derived]
impl apache_avro::schema::derive::AvroSchemaComponent for
Basic {
fn get_schema_in_ctxt(
named_schemas: &mut std::collections::HashMap<