merge-rs
The merge crate provides the Merge trait that can be used to merge multiple
values into one:
Merge can be derived for structs:
use Merge;
let defaults = User ;
let mut ferris = User ;
ferris.merge;
assert_eq!;
assert_eq!;
assert_eq!;
A merge strategy is a function with the signature fn merge<T>(left: &mut T, right: T) that merges right into left. The merge crate provides
strategies for the most common types, but you can also define your own
strategies.
The trait can be used to merge configuration from different sources, for
example environment variables, multiple configuration files and command-line
arguments, see the args.rs example.
Features
This crate has the following features:
derive(default): Enables the derive macro for theMergetrait using themerge_derivecrate.num(default): Enables the merge strategies in thenummodule that require thenum_traitscrate.std(default): Enables the merge strategies in thehashmapandvecmodules that require the standard library. If this feature is not set,mergeis ano_stdlibrary.
Minimum Supported Rust Version
This crate supports Rust 1.70.0 or later.
Contact
For bug reports, patches, feature requests and other messages, please send a
mail to ~ireas/public-inbox@lists.sr.ht (archive) using the
[merge-rs] prefix in the subject.
You can submit patches using git send-email, for example:
git send-email --to=~ireas/public-inbox@lists.sr.ht --subject-prefix="PATCH merge-rs"
Please prefix the subject with PATCH merge-rs so that CI will be
automatically run.
License
This project is dual-licensed under the Apache-2.0 and MIT licenses.
The documentation and configuration files contained in this repository are
licensed under the Creative Commons Zero license. You can find a copy
of the license texts in the LICENSES directory.
merge-rs complies with version 3.0 of the REUSE specification.