either-or-both 0.3.0

The enums EitherOrBoth with the three variants Left, Right, Both and Either with the Left and Right variants
Documentation
# spell-checker: ignore nofile nocapture Cinstrument

prettier_bin := ```
    if command -V prettier 2>&1 | grep -q 'not found'; then
        echo -n npx prettier
    else
        echo -n prettier
    fi
    ```

cspell_bin := ```
    if command -V cspell 2>&1 | grep -q 'not found'; then
        echo -n npx cspell
    else
        echo -n cspell
    fi
    ```

this_dir := `realpath .`
args := ''
msrv := '1.63.0'

# A thorough build of all packages with `cargo hack` and the feature powerset (Uses: 'cargo-hack')
[group('build')]
build-hack:
    cargo hack --workspace --feature-powerset build

# Check and fix format of rust files (Uses: 'cargo +nightly')
[group('formatting')]
fmt:
    cargo +nightly fmt --all

# Check and fix format of toml files (Uses: 'taplo')
[group('formatting')]
fmt-toml:
    taplo fmt

# Check and fix format of json and yaml files (Uses: 'prettier' or 'npx prettier')
[group('formatting')]
fmt-prettier:
   {{ prettier_bin }} --write '**/*.json' '**/*.yml' --ignore-path '.gitignore' --ignore-path '.prettierignore'

# Run all fmt rules (Depends on: fmt, fmt-toml, fmt-prettier)
[group('formatting')]
fmt-all: fmt fmt-toml fmt-prettier

# Check format of rust files (Uses: 'cargo +nightly')
[group('formatting')]
check-fmt:
    cargo +nightly fmt --all --check

# Check format of toml files with `taplo` (Uses: 'taplo')
[group('formatting')]
check-fmt-toml:
    taplo fmt --check --verbose

# Check format of json and yaml files (Uses: 'prettier' or 'npx prettier')
[group('formatting')]
check-fmt-prettier:
    {{ prettier_bin }} --check --log-level warn '**/*.json' '**/*.yml' --ignore-path '.gitignore' --ignore-path '.prettierignore'

# Check spelling with cspell (Uses: 'cspell' or 'npx cspell')
[group('formatting')]
check-spelling:
    {{ cspell_bin }} lint .

# Run all format checkers (Depends on: check-fmt, check-fmt-toml, check-fmt-prettier, check-spelling)
[group('formatting')]
check-fmt-all: check-fmt check-fmt-toml check-fmt-prettier check-spelling

# Run clippy (Uses 'cargo +stable')
[group('lint')]
lint:
    cargo +stable clippy --all-features --all-targets -- -D warnings

# Run cargo deny check (Uses 'cargo-deny')
[group('dependencies')]
deny +check='all':
    cargo deny check {{ if args != '' { args } else { '' } }} {{ check }}

# Build a package with the optional toolchain (Uses: 'cargo')
[group('build')]
build package:
    cargo build -p {{ package }} {{ if args != '' { args } else { '' } }}

# Build the documentation (Uses: 'cargo')
[group('build')]
build-docs:
    DOCS_RS=1 cargo doc --all-features --no-deps --workspace


# Run all tests in a package. (Uses: 'cargo')
[group('test')]
test:
    cargo test --all-features --all-targets {{ if args != '' { args } else { '' } }}

# Run all doc tests (Uses: 'cargo')
[group('test')]
test-doc:
    DOCS_RS=1 cargo test --all-features --doc

# Build and test the documentation (Uses: 'cargo')
[group('test')]
build-and-test-docs: build-docs test-doc

[group('test')]
test-hack:
    cargo hack --workspace --feature-powerset test

# Generate the coverage of tests (Uses: 'cargo', 'grcov')
[group('coverage')]
coverage mode:
    CARGO_INCREMENTAL=0 \
        RUSTFLAGS='-Cinstrument-coverage' \
        LLVM_PROFILE_FILE='cargo-test-%p-%m.profraw' \
        cargo test --profile coverage --all-features --all-targets
    # Tests are excluded since coverage doesn't work properly with `rstest`
    grcov . --binary-path ./target/coverage/deps/ \
        -s . \
        -t {{ mode }} \
        --branch \
        --ignore-not-existing \
        --ignore '../*' \
        --ignore "/*" \
        --ignore "tests/it/*" \
        --excl-start 'cov:\s*excl-start' \
        --excl-stop 'cov:\s*excl-stop' \
        --excl-line '^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\(|.*cov:\s*excl-line)|#\[inline\]' \
        -o {{ if mode == 'lcov' { 'lcov.info' } else { 'target/coverage/' + mode } }}

[group('coverage')]
coverage-fresh mode: clean-coverage (coverage mode)

[group('coverage')]
coverage-html: (coverage 'html')

[group('coverage')]
coverage-html-fresh: (coverage-fresh 'html')

[group('coverage')]
coverage-lcov: (coverage 'lcov')

[group('coverage')]
coverage-lcov-fresh: (coverage-fresh 'lcov')

# Clean the workspace from all artifacts (Uses: other recipes)
[group('clean')]
clean-all: clean-coverage clean-benchmarks clean-cargo

# Clean the artifacts generated by benchmarks (Uses: 'coreutils')
[group('clean')]
clean-benchmarks:
    rm -rf target/iai

# Clean the target directory with `cargo clean` (Uses: 'cargo')
[group('clean')]
clean-cargo:
    cargo clean

# Clean the artifacts generated by the `coverage` recipe (Uses: 'coreutils')
[group('clean')]
clean-coverage:
    rm -f *.profraw
    rm -f lcov.info
    rm -rf target/coverage

[group('bench')]
bench:
    cargo bench -p benchmarks

# Check minimal version requirements of dependencies. (Uses: 'cargo-minimal-versions')
[group('dependencies')]
minimal-versions:
    cargo minimal-versions check --workspace --all-targets --ignore-private --direct

# Bump the version of either-or-both or the MSRV (Uses: 'cargo', 'grep')
[group('chore')]
bump config part:
    #!/usr/bin/env -S sh -e
    current_version=$(bump-my-version show-bump --config-file ".bumpversion/{{ config }}.toml" --ascii | grep -Eo '^[0-9]+(\.[0-9]+\.[0-9]+)?')
    new_version=$(bump-my-version show-bump --config-file ".bumpversion/{{ config }}.toml" --ascii | grep -Po '(?<={{ part }} - )[0-9]+(\.[0-9]+\.[0-9]+)?')

    bump-my-version bump --no-commit --config-file ".bumpversion/{{ config }}.toml" {{ part }}
    just args="--all-features --lib" build either-or-both