Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

derive: Use #[automatically_derived] on generated impls #136

Merged
merged 1 commit into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions valuable-derive/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn derive_struct(
);
let access = respan(quote! { &self.#access }, &field.ty);
let valuable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Valuable for #name #ty_generics #where_clause {
fn as_value(&self) -> ::valuable::Value<'_> {
::valuable::Valuable::as_value(#access)
Expand Down Expand Up @@ -151,6 +152,7 @@ fn derive_struct(
}

let structable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Structable for #name #ty_generics #where_clause {
fn definition(&self) -> ::valuable::StructDef<'_> {
#struct_def
Expand All @@ -159,6 +161,7 @@ fn derive_struct(
};

let valuable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Valuable for #name #ty_generics #where_clause {
fn as_value(&self) -> ::valuable::Value<'_> {
::valuable::Value::Structable(self)
Expand Down Expand Up @@ -349,6 +352,7 @@ fn derive_enum(cx: Context, input: &syn::DeriveInput, data: &syn::DataEnum) -> R

let (impl_generics, ty_generics, where_clause) = input.generics.split_for_impl();
let enumerable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Enumerable for #name #ty_generics #where_clause {
fn definition(&self) -> ::valuable::EnumDef<'_> {
::valuable::EnumDef::new_static(
Expand All @@ -366,6 +370,7 @@ fn derive_enum(cx: Context, input: &syn::DeriveInput, data: &syn::DataEnum) -> R
};

let valuable_impl = quote! {
#[automatically_derived]
impl #impl_generics ::valuable::Valuable for #name #ty_generics #where_clause {
fn as_value(&self) -> ::valuable::Value<'_> {
::valuable::Value::Enumerable(self)
Expand Down
Loading