Skip to content

Commit

Permalink
update note in option example
Browse files Browse the repository at this point in the history
  • Loading branch information
yanganto committed Aug 13, 2024
1 parent a3a8948 commit eafbb4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion struct-patch/examples/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,17 @@ fn keep_none_feature() {

#[cfg(feature = "option")]
fn main() {
// NOTE:
// The `pure_none_feature` and `none_as_default_feature` are the same logic,
// but the former uses `From` trait and the later uses `Default` trait.
// You can base on your need to use `option` feature or `none_as_default` feature
#[cfg(all(not(feature = "keep_none"), not(feature = "none_as_default")))]
pure_none_feature();

#[cfg(feature = "none_as_default")]
none_as_default_feature();

// NOTE:
// In the feature, the patch do not allow to apply on None
#[cfg(feature = "keep_none")]
keep_none_feature();
}
Expand Down

0 comments on commit eafbb4d

Please sign in to comment.