Skip to content

Commit a4570af

Browse files
authored
Handle merge feature only (#95)
* add test merge feature without op * fix merge feature dependency * bounce version
1 parent 8cd94ca commit a4570af

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
run: |
4444
nix develop -c cargo run --features=option --features=merge --example option
4545
nix develop -c cargo run --features=merge --example op
46+
nix develop -c cargo test --features=merge --no-default-features
4647
nix develop -c cargo test --features=merge
4748
4849
- name: Test with option features

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77

88
[workspace.package]
99
authors = ["Antonio Yang <yanganto@gmail.com>"]
10-
version = "0.9.3"
10+
version = "0.9.4"
1111
edition = "2021"
1212
categories = ["development-tools"]
1313
keywords = ["struct", "patch", "macro", "derive", "overlay"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ This crate also includes the following optional features:
133133
- `status`(default): implements the `Status` trait for the patch struct, which provides the `is_empty` method.
134134
- `op` (default): provide operators `<<` between instance and patch, and `+` for patches
135135
- default: when there is a field conflict between patches, `+` will add together if the `#[patch(addable)]` or `#[patch(add=fn)]` is provided, else it will panic.
136-
- `merge` (optional): implements the `Merge` trait for the patch struct, which provides the `merge` method, and `<<` between patches.
136+
- `merge` (optional): implements the `Merge` trait for the patch struct, which provides the `merge` method, and `<<` (if `op` feature enabled) between patches.
137137
- `std`(optional):
138138
- `box`: implements the `Patch<Box<P>>` trait for `T` where `T` implements `Patch<P>`.
139139
This let you patch a boxed (or not) struct with a boxed patch.

struct-patch-derive/src/patch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl Patch {
187187
}
188188
};
189189

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

struct-patch/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ license.workspace = true
1111
readme.workspace = true
1212

1313
[dependencies]
14-
struct-patch-derive = { version = "=0.9.3", path = "../struct-patch-derive" }
14+
struct-patch-derive = { version = "=0.9.4", path = "../struct-patch-derive" }
1515

1616
[dev-dependencies]
1717
serde_json = "1.0"

0 commit comments

Comments
 (0)