Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exclude = [

[workspace.package]
authors = ["Antonio Yang <yanganto@gmail.com>"]
version = "0.12.3"
version = "0.12.4"
edition = "2021"
categories = ["development-tools"]
keywords = ["struct", "patch", "macro", "derive", "overlay"]
Expand Down
2 changes: 1 addition & 1 deletion complex-example/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct-patch = { path = "../lib", features = ["catalyst"] }

[workspace.package]
authors = ["Antonio Yang <yanganto@gmail.com>"]
version = "0.12.3"
version = "0.12.4"
edition = "2021"
categories = ["development-tools"]
keywords = ["struct", "patch", "macro", "derive", "overlay"]
Expand Down
2 changes: 2 additions & 0 deletions derive/src/catalyst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ impl Catalyst {
})
.collect::<Vec<_>>();
let catalyst_impl = quote! {
#[automatically_derived]
impl struct_patch::traits::Catalyst < #substrate_name, #complex_struct_name > for #struct_name {
fn bind(self, s: #substrate_name) -> #complex_struct_name {
let (
Expand All @@ -123,6 +124,7 @@ impl Catalyst {
#(#complex_fields)*
}

#[automatically_derived]
impl struct_patch::traits::Complex < #struct_name, #substrate_name > for #complex_struct_name {
fn decouple(self) -> (#struct_name, #substrate_name) {
let #complex_struct_name {
Expand Down
4 changes: 4 additions & 0 deletions derive/src/filler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ impl Filler {

#[cfg(feature = "status")]
let status_impl = quote!(
#[automatically_derived]
impl #generics struct_patch::traits::Status for #name #generics #where_clause {
fn is_empty(&self) -> bool {
#(
Expand All @@ -168,6 +169,7 @@ impl Filler {

#[cfg(feature = "op")]
let op_impl = quote! {
#[automatically_derived]
impl #generics core::ops::Shl<#name #generics> for #struct_name #generics #where_clause {
type Output = Self;

Expand All @@ -177,6 +179,7 @@ impl Filler {
}
}

#[automatically_derived]
impl #generics core::ops::Add<Self> for #name #generics #where_clause {
type Output = Self;

Expand Down Expand Up @@ -223,6 +226,7 @@ impl Filler {
let op_impl = quote!();

let filler_impl = quote! {
#[automatically_derived]
impl #generics struct_patch::traits::Filler< #name #generics > for #struct_name #generics #where_clause {
fn apply(&mut self, filler: #name #generics) {
#(
Expand Down
8 changes: 8 additions & 0 deletions derive/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ impl Patch {

#[cfg(feature = "status")]
let patch_status_impl = quote!(
#[automatically_derived]
impl #generics struct_patch::traits::Status for #name #generics #where_clause {
fn is_empty(&self) -> bool {
#(
Expand All @@ -220,6 +221,7 @@ impl Patch {

#[cfg(feature = "merge")]
let patch_merge_impl = quote!(
#[automatically_derived]
impl #generics struct_patch::traits::Merge for #name #generics #where_clause {
fn merge(self, other: Self) -> Self {
Self {
Expand Down Expand Up @@ -290,6 +292,7 @@ impl Patch {

#[cfg(all(feature = "op", not(feature = "merge")))]
let op_impl = quote! {
#[automatically_derived]
impl #generics core::ops::Shl<#name #generics> for #struct_name #generics #where_clause {
type Output = Self;

Expand All @@ -299,6 +302,7 @@ impl Patch {
}
}

#[automatically_derived]
impl #generics core::ops::Add<Self> for #name #generics #where_clause {
type Output = Self;

Expand Down Expand Up @@ -358,6 +362,7 @@ impl Patch {

#[cfg(all(feature = "op", feature = "merge"))]
let op_impl = quote! {
#[automatically_derived]
impl #generics core::ops::Shl<#name #generics> for #struct_name #generics #where_clause {
type Output = Self;

Expand All @@ -367,6 +372,7 @@ impl Patch {
}
}

#[automatically_derived]
impl #generics core::ops::Shl<#name #generics> for #name #generics #where_clause {
type Output = Self;

Expand All @@ -375,6 +381,7 @@ impl Patch {
}
}

#[automatically_derived]
impl #generics core::ops::Add<Self> for #name #generics #where_clause {
type Output = Self;

Expand Down Expand Up @@ -436,6 +443,7 @@ impl Patch {
let op_impl = quote!();

let patch_impl = quote! {
#[automatically_derived]
impl #generics struct_patch::traits::Patch< #name #generics > for #struct_name #generics #where_clause {
fn apply(&mut self, patch: #name #generics) {
#(
Expand Down
5 changes: 5 additions & 0 deletions derive/src/substrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl Substrate {
let active_site = json::to_string(fields);

Ok(quote! {
#[automatically_derived]
impl struct_patch::traits::Substrate for #struct_name {
fn expose_content() -> &'static str {
#active_site
Expand All @@ -34,7 +35,10 @@ impl Substrate {
println!("cargo:rustc-env={}={}", stringify!(#struct_name), Self::expose_content());
}
}

#[automatically_derived]
impl #struct_name {
#[allow(clippy::too_many_arguments)]
/// Support `decouple` of Complex with private fields, a new function generated by Substrate macro
pub fn __substrate_new(
#( #field_idents: #field_tys, )*
Expand All @@ -44,6 +48,7 @@ impl Substrate {
}
}

#[allow(clippy::too_many_arguments)]
/// Support `bind` of Catalyst with private fields, an unpack function generated by Substrate macro
pub fn __substrate_unpack(
self
Expand Down
2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ readme.workspace = true
rust-version.workspace = true

[dependencies]
struct-patch-derive = { version = "=0.12.3", path = "../derive" }
struct-patch-derive = { version = "=0.12.4", path = "../derive" }

[dev-dependencies]
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion no-std-examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "no-std-examples"
authors = ["Antonio Yang <yanganto@gmail.com>"]
version = "0.12.3"
version = "0.12.4"
edition = "2021"
license = "MIT"

Expand Down