Merge ~athos-ribeiro/ubuntu/+source/mdevctl:merge-mdevctl-rust-kinetic into ubuntu/+source/mdevctl:debian/sid

Proposed by Athos Ribeiro
Status: Merged
Merge reported by: git-ubuntu bot
Merged at revision: 1bcabcb794dcc8b30ccb0dd3418c92edc1040394
Proposed branch: ~athos-ribeiro/ubuntu/+source/mdevctl:merge-mdevctl-rust-kinetic
Merge into: ubuntu/+source/mdevctl:debian/sid
Diff against target: 658907 lines (+636077/-4)
1936 files modified
debian/README.source (+9/-0)
debian/changelog (+19/-0)
debian/config.toml (+7/-0)
debian/control (+2/-2)
debian/copyright (+430/-0)
debian/install (+1/-0)
debian/patches/series (+1/-1)
debian/watch (+3/-1)
vendor/aho-corasick/.cargo-checksum.json (+1/-0)
vendor/aho-corasick/COPYING (+3/-0)
vendor/aho-corasick/Cargo.toml (+43/-0)
vendor/aho-corasick/DESIGN.md (+483/-0)
vendor/aho-corasick/LICENSE-MIT (+21/-0)
vendor/aho-corasick/README.md (+181/-0)
vendor/aho-corasick/UNLICENSE (+24/-0)
vendor/aho-corasick/rustfmt.toml (+2/-0)
vendor/aho-corasick/src/ahocorasick.rs (+2143/-0)
vendor/aho-corasick/src/automaton.rs (+573/-0)
vendor/aho-corasick/src/buffer.rs (+132/-0)
vendor/aho-corasick/src/byte_frequencies.rs (+258/-0)
vendor/aho-corasick/src/classes.rs (+238/-0)
vendor/aho-corasick/src/dfa.rs (+713/-0)
vendor/aho-corasick/src/error.rs (+101/-0)
vendor/aho-corasick/src/lib.rs (+297/-0)
vendor/aho-corasick/src/nfa.rs (+1377/-0)
vendor/aho-corasick/src/packed/api.rs (+632/-0)
vendor/aho-corasick/src/packed/mod.rs (+117/-0)
vendor/aho-corasick/src/packed/pattern.rs (+318/-0)
vendor/aho-corasick/src/packed/rabinkarp.rs (+185/-0)
vendor/aho-corasick/src/packed/teddy/README.md (+386/-0)
vendor/aho-corasick/src/packed/teddy/compile.rs (+414/-0)
vendor/aho-corasick/src/packed/teddy/mod.rs (+62/-0)
vendor/aho-corasick/src/packed/teddy/runtime.rs (+1204/-0)
vendor/aho-corasick/src/packed/tests.rs (+568/-0)
vendor/aho-corasick/src/packed/vector.rs (+181/-0)
vendor/aho-corasick/src/prefilter.rs (+1057/-0)
vendor/aho-corasick/src/state_id.rs (+192/-0)
vendor/aho-corasick/src/tests.rs (+1252/-0)
vendor/anyhow/.cargo-checksum.json (+1/-0)
vendor/anyhow/Cargo.toml (+59/-0)
vendor/anyhow/LICENSE-APACHE (+201/-0)
vendor/anyhow/LICENSE-MIT (+23/-0)
vendor/anyhow/README.md (+182/-0)
vendor/anyhow/build.rs (+113/-0)
vendor/anyhow/rust-toolchain.toml (+2/-0)
vendor/anyhow/src/backtrace.rs (+401/-0)
vendor/anyhow/src/chain.rs (+102/-0)
vendor/anyhow/src/context.rs (+177/-0)
vendor/anyhow/src/ensure.rs (+834/-0)
vendor/anyhow/src/error.rs (+970/-0)
vendor/anyhow/src/fmt.rs (+155/-0)
vendor/anyhow/src/kind.rs (+116/-0)
vendor/anyhow/src/lib.rs (+680/-0)
vendor/anyhow/src/macros.rs (+231/-0)
vendor/anyhow/src/ptr.rs (+199/-0)
vendor/anyhow/src/wrapper.rs (+78/-0)
vendor/anyhow/tests/common/mod.rs (+14/-0)
vendor/anyhow/tests/compiletest.rs (+7/-0)
vendor/anyhow/tests/drop/mod.rs (+53/-0)
vendor/anyhow/tests/test_autotrait.rs (+13/-0)
vendor/anyhow/tests/test_backtrace.rs (+13/-0)
vendor/anyhow/tests/test_boxed.rs (+45/-0)
vendor/anyhow/tests/test_chain.rs (+68/-0)
vendor/anyhow/tests/test_context.rs (+172/-0)
vendor/anyhow/tests/test_convert.rs (+46/-0)
vendor/anyhow/tests/test_downcast.rs (+123/-0)
vendor/anyhow/tests/test_ensure.rs (+698/-0)
vendor/anyhow/tests/test_ffi.rs (+18/-0)
vendor/anyhow/tests/test_fmt.rs (+94/-0)
vendor/anyhow/tests/test_macros.rs (+80/-0)
vendor/anyhow/tests/test_repr.rs (+29/-0)
vendor/anyhow/tests/test_source.rs (+62/-0)
vendor/anyhow/tests/ui/chained-comparison.rs (+8/-0)
vendor/anyhow/tests/ui/chained-comparison.stderr (+10/-0)
vendor/anyhow/tests/ui/empty-ensure.rs (+6/-0)
vendor/anyhow/tests/ui/empty-ensure.stderr (+7/-0)
vendor/anyhow/tests/ui/must-use.rs (+11/-0)
vendor/anyhow/tests/ui/must-use.stderr (+12/-0)
vendor/anyhow/tests/ui/no-impl.rs (+8/-0)
vendor/anyhow/tests/ui/no-impl.stderr (+31/-0)
vendor/anyhow/tests/ui/temporary-value.rs (+5/-0)
vendor/anyhow/tests/ui/temporary-value.stderr (+9/-0)
vendor/anyhow/tests/ui/wrong-interpolation.rs (+5/-0)
vendor/anyhow/tests/ui/wrong-interpolation.stderr (+5/-0)
vendor/atty/.cargo-checksum.json (+1/-0)
vendor/atty/CHANGELOG.md (+73/-0)
vendor/atty/Cargo.lock (+49/-0)
vendor/atty/Cargo.toml (+34/-0)
vendor/atty/LICENSE (+20/-0)
vendor/atty/README.md (+74/-0)
vendor/atty/examples/atty.rs (+9/-0)
vendor/atty/rustfmt.toml (+4/-0)
vendor/atty/src/lib.rs (+210/-0)
vendor/autocfg/.cargo-checksum.json (+1/-0)
vendor/autocfg/Cargo.lock (+7/-0)
vendor/autocfg/Cargo.toml (+24/-0)
vendor/autocfg/LICENSE-APACHE (+201/-0)
vendor/autocfg/LICENSE-MIT (+25/-0)
vendor/autocfg/README.md (+95/-0)
vendor/autocfg/examples/integers.rs (+9/-0)
vendor/autocfg/examples/paths.rs (+22/-0)
vendor/autocfg/examples/traits.rs (+26/-0)
vendor/autocfg/examples/versions.rs (+9/-0)
vendor/autocfg/src/error.rs (+69/-0)
vendor/autocfg/src/lib.rs (+453/-0)
vendor/autocfg/src/tests.rs (+174/-0)
vendor/autocfg/src/version.rs (+60/-0)
vendor/autocfg/tests/rustflags.rs (+33/-0)
vendor/bitflags/.cargo-checksum.json (+1/-0)
vendor/bitflags/CHANGELOG.md (+206/-0)
vendor/bitflags/CODE_OF_CONDUCT.md (+73/-0)
vendor/bitflags/Cargo.toml (+58/-0)
vendor/bitflags/LICENSE-APACHE (+201/-0)
vendor/bitflags/LICENSE-MIT (+25/-0)
vendor/bitflags/README.md (+32/-0)
vendor/bitflags/src/example_generated.rs (+14/-0)
vendor/bitflags/src/lib.rs (+1729/-0)
vendor/bitflags/tests/basic.rs (+20/-0)
vendor/bitflags/tests/compile-fail/impls/copy.rs (+10/-0)
vendor/bitflags/tests/compile-fail/impls/copy.stderr.beta (+27/-0)
vendor/bitflags/tests/compile-fail/impls/eq.rs (+10/-0)
vendor/bitflags/tests/compile-fail/impls/eq.stderr.beta (+55/-0)
vendor/bitflags/tests/compile-fail/non_integer_base/all_defined.rs (+123/-0)
vendor/bitflags/tests/compile-fail/non_integer_base/all_defined.stderr.beta (+27/-0)
vendor/bitflags/tests/compile-fail/non_integer_base/all_missing.rs (+13/-0)
vendor/bitflags/tests/compile-fail/non_integer_base/all_missing.stderr.beta (+13/-0)
vendor/bitflags/tests/compile-fail/visibility/private_field.rs (+13/-0)
vendor/bitflags/tests/compile-fail/visibility/private_field.stderr.beta (+10/-0)
vendor/bitflags/tests/compile-fail/visibility/private_flags.rs (+18/-0)
vendor/bitflags/tests/compile-fail/visibility/private_flags.stderr.beta (+18/-0)
vendor/bitflags/tests/compile-fail/visibility/pub_const.rs (+9/-0)
vendor/bitflags/tests/compile-fail/visibility/pub_const.stderr.beta (+5/-0)
vendor/bitflags/tests/compile-pass/impls/convert.rs (+17/-0)
vendor/bitflags/tests/compile-pass/impls/default.rs (+10/-0)
vendor/bitflags/tests/compile-pass/impls/inherent_methods.rs (+15/-0)
vendor/bitflags/tests/compile-pass/redefinition/core.rs (+14/-0)
vendor/bitflags/tests/compile-pass/redefinition/stringify.rs (+19/-0)
vendor/bitflags/tests/compile-pass/repr/c.rs (+10/-0)
vendor/bitflags/tests/compile-pass/repr/transparent.rs (+10/-0)
vendor/bitflags/tests/compile-pass/visibility/bits_field.rs (+11/-0)
vendor/bitflags/tests/compile-pass/visibility/pub_in.rs (+19/-0)
vendor/bitflags/tests/compile.rs (+63/-0)
vendor/cfg-if/.cargo-checksum.json (+1/-0)
vendor/cfg-if/Cargo.toml (+36/-0)
vendor/cfg-if/LICENSE-APACHE (+201/-0)
vendor/cfg-if/LICENSE-MIT (+25/-0)
vendor/cfg-if/README.md (+47/-0)
vendor/cfg-if/src/lib.rs (+176/-0)
vendor/cfg-if/tests/xcrate.rs (+14/-0)
vendor/clap/.cargo-checksum.json (+1/-0)
vendor/clap/Cargo.lock (+746/-0)
vendor/clap/Cargo.toml (+474/-0)
vendor/clap/LICENSE-APACHE (+201/-0)
vendor/clap/LICENSE-MIT (+21/-0)
vendor/clap/README.md (+43/-0)
vendor/clap/examples/cargo-example-derive.md (+43/-0)
vendor/clap/examples/cargo-example-derive.rs (+20/-0)
vendor/clap/examples/cargo-example.md (+43/-0)
vendor/clap/examples/cargo-example.rs (+19/-0)
vendor/clap/examples/demo.md (+19/-0)
vendor/clap/examples/demo.rs (+22/-0)
vendor/clap/examples/derive_ref/augment_args.rs (+30/-0)
vendor/clap/examples/derive_ref/augment_subcommands.rs (+21/-0)
vendor/clap/examples/derive_ref/custom-bool.md (+47/-0)
vendor/clap/examples/derive_ref/custom-bool.rs (+32/-0)
vendor/clap/examples/derive_ref/flatten_hand_args.rs (+81/-0)
vendor/clap/examples/derive_ref/hand_subcommand.rs (+81/-0)
vendor/clap/examples/derive_ref/interop_tests.md (+256/-0)
vendor/clap/examples/escaped-positional-derive.md (+63/-0)
vendor/clap/examples/escaped-positional-derive.rs (+25/-0)
vendor/clap/examples/escaped-positional.md (+63/-0)
vendor/clap/examples/escaped-positional.rs (+39/-0)
vendor/clap/examples/git-derive.md (+138/-0)
vendor/clap/examples/git-derive.rs (+105/-0)
vendor/clap/examples/git.md (+136/-0)
vendor/clap/examples/git.rs (+101/-0)
vendor/clap/examples/multicall-busybox.md (+42/-0)
vendor/clap/examples/multicall-busybox.rs (+48/-0)
vendor/clap/examples/multicall-hostname.md (+10/-0)
vendor/clap/examples/multicall-hostname.rs (+17/-0)
vendor/clap/examples/pacman.md (+85/-0)
vendor/clap/examples/pacman.rs (+114/-0)
vendor/clap/examples/repl.rs (+92/-0)
vendor/clap/examples/tutorial_builder/01_quick.md (+37/-0)
vendor/clap/examples/tutorial_builder/01_quick.rs (+63/-0)
vendor/clap/examples/tutorial_builder/02_app_settings.md (+19/-0)
vendor/clap/examples/tutorial_builder/02_app_settings.rs (+19/-0)
vendor/clap/examples/tutorial_builder/02_apps.md (+19/-0)
vendor/clap/examples/tutorial_builder/02_apps.rs (+20/-0)
vendor/clap/examples/tutorial_builder/02_crate.md (+18/-0)
vendor/clap/examples/tutorial_builder/02_crate.rs (+18/-0)
vendor/clap/examples/tutorial_builder/03_01_flag_bool.md (+23/-0)
vendor/clap/examples/tutorial_builder/03_01_flag_bool.rs (+19/-0)
vendor/clap/examples/tutorial_builder/03_01_flag_count.md (+23/-0)
vendor/clap/examples/tutorial_builder/03_01_flag_count.rs (+14/-0)
vendor/clap/examples/tutorial_builder/03_02_option.md (+32/-0)
vendor/clap/examples/tutorial_builder/03_02_option.rs (+9/-0)
vendor/clap/examples/tutorial_builder/03_03_positional.md (+22/-0)
vendor/clap/examples/tutorial_builder/03_03_positional.rs (+9/-0)
vendor/clap/examples/tutorial_builder/03_04_subcommands.md (+64/-0)
vendor/clap/examples/tutorial_builder/03_04_subcommands.rs (+22/-0)
vendor/clap/examples/tutorial_builder/03_05_default_values.md (+22/-0)
vendor/clap/examples/tutorial_builder/03_05_default_values.rs (+14/-0)
vendor/clap/examples/tutorial_builder/04_01_enum.md (+29/-0)
vendor/clap/examples/tutorial_builder/04_01_enum.rs (+30/-0)
vendor/clap/examples/tutorial_builder/04_01_possible.md (+29/-0)
vendor/clap/examples/tutorial_builder/04_01_possible.rs (+26/-0)
vendor/clap/examples/tutorial_builder/04_02_parse.md (+31/-0)
vendor/clap/examples/tutorial_builder/04_02_parse.rs (+17/-0)
vendor/clap/examples/tutorial_builder/04_02_validate.md (+31/-0)
vendor/clap/examples/tutorial_builder/04_02_validate.rs (+36/-0)
vendor/clap/examples/tutorial_builder/04_03_relations.md (+58/-0)
vendor/clap/examples/tutorial_builder/04_03_relations.rs (+80/-0)
vendor/clap/examples/tutorial_builder/04_04_custom.md (+57/-0)
vendor/clap/examples/tutorial_builder/04_04_custom.rs (+91/-0)
vendor/clap/examples/tutorial_builder/05_01_assert.rs (+25/-0)
vendor/clap/examples/tutorial_derive/01_quick.md (+37/-0)
vendor/clap/examples/tutorial_derive/01_quick.rs (+69/-0)
vendor/clap/examples/tutorial_derive/02_app_settings.md (+19/-0)
vendor/clap/examples/tutorial_derive/02_app_settings.rs (+19/-0)
vendor/clap/examples/tutorial_derive/02_apps.md (+19/-0)
vendor/clap/examples/tutorial_derive/02_apps.rs (+20/-0)
vendor/clap/examples/tutorial_derive/02_crate.md (+18/-0)
vendor/clap/examples/tutorial_derive/02_crate.rs (+17/-0)
vendor/clap/examples/tutorial_derive/03_01_flag_bool.md (+23/-0)
vendor/clap/examples/tutorial_derive/03_01_flag_bool.rs (+14/-0)
vendor/clap/examples/tutorial_derive/03_01_flag_count.md (+23/-0)
vendor/clap/examples/tutorial_derive/03_01_flag_count.rs (+14/-0)
vendor/clap/examples/tutorial_derive/03_02_option.md (+32/-0)
vendor/clap/examples/tutorial_derive/03_02_option.rs (+14/-0)
vendor/clap/examples/tutorial_derive/03_03_positional.md (+22/-0)
vendor/clap/examples/tutorial_derive/03_03_positional.rs (+14/-0)
vendor/clap/examples/tutorial_derive/03_04_subcommands.md (+64/-0)
vendor/clap/examples/tutorial_derive/03_04_subcommands.rs (+30/-0)
vendor/clap/examples/tutorial_derive/03_04_subcommands_alt.rs (+33/-0)
vendor/clap/examples/tutorial_derive/03_05_default_values.md (+22/-0)
vendor/clap/examples/tutorial_derive/03_05_default_values.rs (+14/-0)
vendor/clap/examples/tutorial_derive/04_01_enum.md (+29/-0)
vendor/clap/examples/tutorial_derive/04_01_enum.rs (+28/-0)
vendor/clap/examples/tutorial_derive/04_02_parse.md (+31/-0)
vendor/clap/examples/tutorial_derive/04_02_parse.rs (+15/-0)
vendor/clap/examples/tutorial_derive/04_02_validate.md (+31/-0)
vendor/clap/examples/tutorial_derive/04_02_validate.rs (+34/-0)
vendor/clap/examples/tutorial_derive/04_03_relations.md (+58/-0)
vendor/clap/examples/tutorial_derive/04_03_relations.rs (+72/-0)
vendor/clap/examples/tutorial_derive/04_04_custom.md (+57/-0)
vendor/clap/examples/tutorial_derive/04_04_custom.rs (+93/-0)
vendor/clap/examples/tutorial_derive/05_01_assert.rs (+21/-0)
vendor/clap/examples/typed-derive.md (+84/-0)
vendor/clap/examples/typed-derive.rs (+44/-0)
vendor/clap/src/_cookbook/cargo_example.rs (+7/-0)
vendor/clap/src/_cookbook/cargo_example_derive (+0/-0)
vendor/clap/src/_cookbook/cargo_example_derive.rs (+7/-0)
vendor/clap/src/_cookbook/escaped_positional.rs (+7/-0)
vendor/clap/src/_cookbook/escaped_positional_derive.rs (+7/-0)
vendor/clap/src/_cookbook/git.rs (+7/-0)
vendor/clap/src/_cookbook/git_derive.rs (+7/-0)
vendor/clap/src/_cookbook/mod.rs (+55/-0)
vendor/clap/src/_cookbook/multicall_busybox.rs (+7/-0)
vendor/clap/src/_cookbook/multicall_hostname.rs (+7/-0)
vendor/clap/src/_cookbook/pacman.rs (+7/-0)
vendor/clap/src/_cookbook/repl.rs (+5/-0)
vendor/clap/src/_cookbook/typed_derive.rs (+7/-0)
vendor/clap/src/_derive/_tutorial.rs (+205/-0)
vendor/clap/src/_derive/mod.rs (+502/-0)
vendor/clap/src/_faq.rs (+95/-0)
vendor/clap/src/_features.rs (+27/-0)
vendor/clap/src/_tutorial.rs (+204/-0)
vendor/clap/src/bin/stdio-fixture.rs (+14/-0)
vendor/clap/src/builder/action.rs (+325/-0)
vendor/clap/src/builder/app_settings.rs (+864/-0)
vendor/clap/src/builder/arg.rs (+5494/-0)
vendor/clap/src/builder/arg_group.rs (+633/-0)
vendor/clap/src/builder/arg_predicate.rs (+14/-0)
vendor/clap/src/builder/arg_settings.rs (+456/-0)
vendor/clap/src/builder/command.rs (+5164/-0)
vendor/clap/src/builder/debug_asserts.rs (+851/-0)
vendor/clap/src/builder/macros.rs (+180/-0)
vendor/clap/src/builder/mod.rs (+61/-0)
vendor/clap/src/builder/possible_value.rs (+259/-0)
vendor/clap/src/builder/regex.rs (+88/-0)
vendor/clap/src/builder/tests.rs (+56/-0)
vendor/clap/src/builder/usage_parser.rs (+1277/-0)
vendor/clap/src/builder/value_hint.rs (+95/-0)
vendor/clap/src/builder/value_parser.rs (+2089/-0)
vendor/clap/src/derive.rs (+577/-0)
vendor/clap/src/error/context.rs (+55/-0)
vendor/clap/src/error/kind.rs (+440/-0)
vendor/clap/src/error/mod.rs (+1153/-0)
vendor/clap/src/lib.rs (+232/-0)
vendor/clap/src/macros.rs (+1058/-0)
vendor/clap/src/mkeymap.rs (+193/-0)
vendor/clap/src/output/fmt.rs (+158/-0)
vendor/clap/src/output/help.rs (+1176/-0)
vendor/clap/src/output/mod.rs (+7/-0)
vendor/clap/src/output/usage.rs (+449/-0)
vendor/clap/src/parser/arg_matcher.rs (+280/-0)
vendor/clap/src/parser/error.rs (+67/-0)
vendor/clap/src/parser/features/mod.rs (+1/-0)
vendor/clap/src/parser/features/suggestions.rs (+105/-0)
vendor/clap/src/parser/matches/any_value.rs (+112/-0)
vendor/clap/src/parser/matches/arg_matches.rs (+1833/-0)
vendor/clap/src/parser/matches/matched_arg.rs (+240/-0)
vendor/clap/src/parser/matches/mod.rs (+17/-0)
vendor/clap/src/parser/matches/value_source.rs (+11/-0)
vendor/clap/src/parser/mod.rs (+27/-0)
vendor/clap/src/parser/parser.rs (+1729/-0)
vendor/clap/src/parser/validator.rs (+692/-0)
vendor/clap/src/util/color.rs (+62/-0)
vendor/clap/src/util/fnv.rs (+46/-0)
vendor/clap/src/util/graph.rs (+49/-0)
vendor/clap/src/util/id.rs (+92/-0)
vendor/clap/src/util/mod.rs (+40/-0)
vendor/clap/src/util/str_to_bool.rs (+21/-0)
vendor/clap_complete/.cargo-checksum.json (+1/-0)
vendor/clap_complete/Cargo.lock (+687/-0)
vendor/clap_complete/Cargo.toml (+156/-0)
vendor/clap_complete/LICENSE-APACHE (+201/-0)
vendor/clap_complete/LICENSE-MIT (+21/-0)
vendor/clap_complete/README.md (+23/-0)
vendor/clap_complete/examples/completion-derive.rs (+74/-0)
vendor/clap_complete/examples/completion.rs (+107/-0)
vendor/clap_complete/examples/dynamic.rs (+39/-0)
vendor/clap_complete/src/dynamic.rs (+556/-0)
vendor/clap_complete/src/generator/mod.rs (+242/-0)
vendor/clap_complete/src/generator/utils.rs (+283/-0)
vendor/clap_complete/src/lib.rs (+73/-0)
vendor/clap_complete/src/macros.rs (+21/-0)
vendor/clap_complete/src/shells/bash.rs (+218/-0)
vendor/clap_complete/src/shells/elvish.rs (+142/-0)
vendor/clap_complete/src/shells/fish.rs (+192/-0)
vendor/clap_complete/src/shells/mod.rs (+15/-0)
vendor/clap_complete/src/shells/powershell.rs (+178/-0)
vendor/clap_complete/src/shells/shell.rs (+100/-0)
vendor/clap_complete/src/shells/zsh.rs (+666/-0)
vendor/clap_derive/.cargo-checksum.json (+1/-0)
vendor/clap_derive/Cargo.toml (+83/-0)
vendor/clap_derive/LICENSE-APACHE (+201/-0)
vendor/clap_derive/LICENSE-MIT (+21/-0)
vendor/clap_derive/README.md (+24/-0)
vendor/clap_derive/src/attrs.rs (+1412/-0)
vendor/clap_derive/src/derives/args.rs (+796/-0)
vendor/clap_derive/src/derives/into_app.rs (+119/-0)
vendor/clap_derive/src/derives/mod.rs (+23/-0)
vendor/clap_derive/src/derives/parser.rs (+95/-0)
vendor/clap_derive/src/derives/subcommand.rs (+678/-0)
vendor/clap_derive/src/derives/value_enum.rs (+124/-0)
vendor/clap_derive/src/dummies.rs (+91/-0)
vendor/clap_derive/src/lib.rs (+74/-0)
vendor/clap_derive/src/parse.rs (+288/-0)
vendor/clap_derive/src/utils/doc_comments.rs (+107/-0)
vendor/clap_derive/src/utils/mod.rs (+9/-0)
vendor/clap_derive/src/utils/spanned.rs (+92/-0)
vendor/clap_derive/src/utils/ty.rs (+119/-0)
vendor/clap_lex/.cargo-checksum.json (+1/-0)
vendor/clap_lex/Cargo.toml (+87/-0)
vendor/clap_lex/LICENSE-APACHE (+201/-0)
vendor/clap_lex/LICENSE-MIT (+21/-0)
vendor/clap_lex/README.md (+19/-0)
vendor/clap_lex/src/lib.rs (+484/-0)
vendor/env_logger/.cargo-checksum.json (+1/-0)
vendor/env_logger/CHANGELOG.md (+3/-0)
vendor/env_logger/Cargo.toml (+65/-0)
vendor/env_logger/LICENSE-APACHE (+201/-0)
vendor/env_logger/LICENSE-MIT (+25/-0)
vendor/env_logger/README.md (+185/-0)
vendor/env_logger/src/filter/mod.rs (+868/-0)
vendor/env_logger/src/filter/regex.rs (+29/-0)
vendor/env_logger/src/filter/string.rs (+24/-0)
vendor/env_logger/src/fmt/humantime/extern_impl.rs (+118/-0)
vendor/env_logger/src/fmt/humantime/mod.rs (+11/-0)
vendor/env_logger/src/fmt/humantime/shim_impl.rs (+5/-0)
vendor/env_logger/src/fmt/mod.rs (+547/-0)
vendor/env_logger/src/fmt/writer/atty.rs (+32/-0)
vendor/env_logger/src/fmt/writer/mod.rs (+252/-0)
vendor/env_logger/src/fmt/writer/termcolor/extern_impl.rs (+510/-0)
vendor/env_logger/src/fmt/writer/termcolor/mod.rs (+12/-0)
vendor/env_logger/src/fmt/writer/termcolor/shim_impl.rs (+73/-0)
vendor/env_logger/src/lib.rs (+1299/-0)
vendor/env_logger/tests/init-twice-retains-filter.rs (+40/-0)
vendor/env_logger/tests/log-in-log.rs (+39/-0)
vendor/env_logger/tests/log_tls_dtors.rs (+66/-0)
vendor/env_logger/tests/regexp_filter.rs (+57/-0)
vendor/fastrand/.cargo-checksum.json (+1/-0)
vendor/fastrand/CHANGELOG.md (+81/-0)
vendor/fastrand/Cargo.toml (+53/-0)
vendor/fastrand/LICENSE-APACHE (+201/-0)
vendor/fastrand/LICENSE-MIT (+23/-0)
vendor/fastrand/README.md (+92/-0)
vendor/fastrand/benches/bench.rs (+75/-0)
vendor/fastrand/src/lib.rs (+680/-0)
vendor/fastrand/tests/char.rs (+44/-0)
vendor/fastrand/tests/smoke.rs (+117/-0)
vendor/getrandom/.cargo-checksum.json (+1/-0)
vendor/getrandom/CHANGELOG.md (+334/-0)
vendor/getrandom/Cargo.toml (+83/-0)
vendor/getrandom/LICENSE-APACHE (+201/-0)
vendor/getrandom/LICENSE-MIT (+26/-0)
vendor/getrandom/README.md (+64/-0)
vendor/getrandom/benches/mod.rs (+22/-0)
vendor/getrandom/src/3ds.rs (+17/-0)
vendor/getrandom/src/bsd_arandom.rs (+53/-0)
vendor/getrandom/src/custom.rs (+102/-0)
vendor/getrandom/src/dragonfly.rs (+27/-0)
vendor/getrandom/src/error.rs (+187/-0)
vendor/getrandom/src/error_impls.rs (+24/-0)
vendor/getrandom/src/espidf.rs (+26/-0)
vendor/getrandom/src/fuchsia.rs (+20/-0)
vendor/getrandom/src/ios.rs (+27/-0)
vendor/getrandom/src/js.rs (+129/-0)
vendor/getrandom/src/lib.rs (+263/-0)
vendor/getrandom/src/linux_android.rs (+47/-0)
vendor/getrandom/src/macos.rs (+36/-0)
vendor/getrandom/src/openbsd.rs (+21/-0)
vendor/getrandom/src/rdrand.rs (+97/-0)
vendor/getrandom/src/solaris_illumos.rs (+48/-0)
vendor/getrandom/src/solid.rs (+26/-0)
vendor/getrandom/src/use_file.rs (+139/-0)
vendor/getrandom/src/util.rs (+64/-0)
vendor/getrandom/src/util_libc.rs (+160/-0)
vendor/getrandom/src/vxworks.rs (+34/-0)
vendor/getrandom/src/wasi.rs (+19/-0)
vendor/getrandom/src/windows.rs (+49/-0)
vendor/getrandom/tests/common/mod.rs (+66/-0)
vendor/getrandom/tests/custom.rs (+50/-0)
vendor/getrandom/tests/normal.rs (+11/-0)
vendor/getrandom/tests/rdrand.rs (+15/-0)
vendor/hashbrown/.cargo-checksum.json (+1/-0)
vendor/hashbrown/CHANGELOG.md (+402/-0)
vendor/hashbrown/Cargo.toml (+113/-0)
vendor/hashbrown/LICENSE-APACHE (+201/-0)
vendor/hashbrown/LICENSE-MIT (+25/-0)
vendor/hashbrown/README.md (+126/-0)
vendor/hashbrown/benches/bench.rs (+331/-0)
vendor/hashbrown/benches/insert_unique_unchecked.rs (+32/-0)
vendor/hashbrown/clippy.toml (+1/-0)
vendor/hashbrown/src/external_trait_impls/mod.rs (+4/-0)
vendor/hashbrown/src/external_trait_impls/rayon/helpers.rs (+27/-0)
vendor/hashbrown/src/external_trait_impls/rayon/map.rs (+734/-0)
vendor/hashbrown/src/external_trait_impls/rayon/mod.rs (+4/-0)
vendor/hashbrown/src/external_trait_impls/rayon/raw.rs (+231/-0)
vendor/hashbrown/src/external_trait_impls/rayon/set.rs (+659/-0)
vendor/hashbrown/src/external_trait_impls/serde.rs (+201/-0)
vendor/hashbrown/src/lib.rs (+150/-0)
vendor/hashbrown/src/macros.rs (+70/-0)
vendor/hashbrown/src/map.rs (+8408/-0)
vendor/hashbrown/src/raw/alloc.rs (+73/-0)
vendor/hashbrown/src/raw/bitmask.rs (+122/-0)
vendor/hashbrown/src/raw/generic.rs (+154/-0)
vendor/hashbrown/src/raw/mod.rs (+2460/-0)
vendor/hashbrown/src/raw/sse2.rs (+146/-0)
vendor/hashbrown/src/rustc_entry.rs (+630/-0)
vendor/hashbrown/src/scopeguard.rs (+74/-0)
vendor/hashbrown/src/set.rs (+2790/-0)
vendor/hashbrown/tests/hasher.rs (+65/-0)
vendor/hashbrown/tests/rayon.rs (+533/-0)
vendor/hashbrown/tests/serde.rs (+65/-0)
vendor/hashbrown/tests/set.rs (+34/-0)
vendor/heck/.cargo-checksum.json (+1/-0)
vendor/heck/CHANGELOG.md (+11/-0)
vendor/heck/Cargo.toml (+31/-0)
vendor/heck/LICENSE-APACHE (+201/-0)
vendor/heck/LICENSE-MIT (+25/-0)
vendor/heck/README.md (+63/-0)
vendor/heck/src/kebab.rs (+70/-0)
vendor/heck/src/lib.rs (+206/-0)
vendor/heck/src/lower_camel.rs (+85/-0)
vendor/heck/src/shouty_kebab.rs (+72/-0)
vendor/heck/src/shouty_snake.rs (+85/-0)
vendor/heck/src/snake.rs (+98/-0)
vendor/heck/src/title.rs (+71/-0)
vendor/heck/src/upper_camel.rs (+84/-0)
vendor/hermit-abi/.cargo-checksum.json (+1/-0)
vendor/hermit-abi/Cargo.toml (+44/-0)
vendor/hermit-abi/LICENSE-APACHE (+201/-0)
vendor/hermit-abi/LICENSE-MIT (+23/-0)
vendor/hermit-abi/README.md (+22/-0)
vendor/hermit-abi/rust-toolchain (+1/-0)
vendor/hermit-abi/src/lib.rs (+490/-0)
vendor/hermit-abi/src/tcplistener.rs (+13/-0)
vendor/hermit-abi/src/tcpstream.rs (+109/-0)
vendor/humantime/.cargo-checksum.json (+1/-0)
vendor/humantime/Cargo.toml (+37/-0)
vendor/humantime/LICENSE-APACHE (+202/-0)
vendor/humantime/LICENSE-MIT (+26/-0)
vendor/humantime/README.md (+68/-0)
vendor/humantime/benches/datetime_format.rs (+56/-0)
vendor/humantime/benches/datetime_parse.rs (+47/-0)
vendor/humantime/bulk.yaml (+8/-0)
vendor/humantime/src/date.rs (+623/-0)
vendor/humantime/src/duration.rs (+456/-0)
vendor/humantime/src/lib.rs (+34/-0)
vendor/humantime/src/wrapper.rs (+107/-0)
vendor/humantime/vagga.yaml (+92/-0)
vendor/indexmap/.cargo-checksum.json (+1/-0)
vendor/indexmap/Cargo.toml (+95/-0)
vendor/indexmap/LICENSE-APACHE (+201/-0)
vendor/indexmap/LICENSE-MIT (+25/-0)
vendor/indexmap/README.md (+55/-0)
vendor/indexmap/RELEASES.md (+379/-0)
vendor/indexmap/benches/bench.rs (+763/-0)
vendor/indexmap/benches/faststring.rs (+185/-0)
vendor/indexmap/build.rs (+8/-0)
vendor/indexmap/src/equivalent.rs (+27/-0)
vendor/indexmap/src/lib.rs (+193/-0)
vendor/indexmap/src/macros.rs (+178/-0)
vendor/indexmap/src/map.rs (+1947/-0)
vendor/indexmap/src/map/core.rs (+700/-0)
vendor/indexmap/src/map/core/raw.rs (+191/-0)
vendor/indexmap/src/mutable_keys.rs (+75/-0)
vendor/indexmap/src/rayon/map.rs (+583/-0)
vendor/indexmap/src/rayon/mod.rs (+27/-0)
vendor/indexmap/src/rayon/set.rs (+741/-0)
vendor/indexmap/src/rustc.rs (+158/-0)
vendor/indexmap/src/serde.rs (+155/-0)
vendor/indexmap/src/serde_seq.rs (+112/-0)
vendor/indexmap/src/set.rs (+1912/-0)
vendor/indexmap/src/util.rs (+31/-0)
vendor/indexmap/tests/equivalent_trait.rs (+53/-0)
vendor/indexmap/tests/macros_full_path.rs (+19/-0)
vendor/indexmap/tests/quick.rs (+573/-0)
vendor/indexmap/tests/tests.rs (+28/-0)
vendor/instant/.cargo-checksum.json (+1/-0)
vendor/instant/AUTHORS (+2/-0)
vendor/instant/CHANGELOGS.md (+7/-0)
vendor/instant/Cargo.toml (+81/-0)
vendor/instant/LICENSE (+27/-0)
vendor/instant/README.md (+143/-0)
vendor/instant/src/lib.rs (+22/-0)
vendor/instant/src/native.rs (+9/-0)
vendor/instant/src/wasm.rs (+240/-0)
vendor/instant/tests/wasm.rs (+57/-0)
vendor/itoa/.cargo-checksum.json (+1/-0)
vendor/itoa/Cargo.toml (+34/-0)
vendor/itoa/LICENSE-APACHE (+201/-0)
vendor/itoa/LICENSE-MIT (+23/-0)
vendor/itoa/README.md (+59/-0)
vendor/itoa/benches/bench.rs (+55/-0)
vendor/itoa/src/lib.rs (+284/-0)
vendor/itoa/src/udiv128.rs (+43/-0)
vendor/itoa/tests/test.rs (+29/-0)
vendor/libc/.cargo-checksum.json (+1/-0)
vendor/libc/CONTRIBUTING.md (+93/-0)
vendor/libc/Cargo.toml (+64/-0)
vendor/libc/LICENSE-APACHE (+176/-0)
vendor/libc/LICENSE-MIT (+25/-0)
vendor/libc/README.md (+110/-0)
vendor/libc/build.rs (+174/-0)
vendor/libc/rustfmt.toml (+1/-0)
vendor/libc/src/fixed_width_ints.rs (+99/-0)
vendor/libc/src/fuchsia/aarch64.rs (+66/-0)
vendor/libc/src/fuchsia/align.rs (+142/-0)
vendor/libc/src/fuchsia/mod.rs (+4287/-0)
vendor/libc/src/fuchsia/no_align.rs (+129/-0)
vendor/libc/src/fuchsia/x86_64.rs (+152/-0)
vendor/libc/src/hermit/aarch64.rs (+2/-0)
vendor/libc/src/hermit/mod.rs (+64/-0)
vendor/libc/src/hermit/x86_64.rs (+2/-0)
vendor/libc/src/lib.rs (+161/-0)
vendor/libc/src/macros.rs (+343/-0)
vendor/libc/src/psp.rs (+4174/-0)
vendor/libc/src/sgx.rs (+47/-0)
vendor/libc/src/solid/aarch64.rs (+4/-0)
vendor/libc/src/solid/arm.rs (+4/-0)
vendor/libc/src/solid/mod.rs (+904/-0)
vendor/libc/src/switch.rs (+49/-0)
vendor/libc/src/unix/align.rs (+6/-0)
vendor/libc/src/unix/bsd/apple/b32/align.rs (+7/-0)
vendor/libc/src/unix/bsd/apple/b32/mod.rs (+119/-0)
vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs (+56/-0)
vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs (+16/-0)
vendor/libc/src/unix/bsd/apple/b64/align.rs (+7/-0)
vendor/libc/src/unix/bsd/apple/b64/mod.rs (+124/-0)
vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs (+7/-0)
vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs (+180/-0)
vendor/libc/src/unix/bsd/apple/mod.rs (+5592/-0)
vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs (+13/-0)
vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs (+1690/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs (+146/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs (+50/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs (+32/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs (+467/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs (+34/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs (+493/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs (+5/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs (+34/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs (+546/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs (+5/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs (+34/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs (+546/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs (+5/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs (+4538/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs (+47/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs (+47/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs (+154/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs (+46/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs (+197/-0)
vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs (+334/-0)
vendor/libc/src/unix/bsd/freebsdlike/mod.rs (+1845/-0)
vendor/libc/src/unix/bsd/mod.rs (+896/-0)
vendor/libc/src/unix/bsd/netbsdlike/mod.rs (+753/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs (+103/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs (+22/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs (+2996/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs (+21/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs (+8/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs (+15/-0)
vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs (+40/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs (+30/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs (+16/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs (+8/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs (+1908/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs (+16/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs (+16/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs (+16/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs (+8/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs (+16/-0)
vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs (+130/-0)
vendor/libc/src/unix/haiku/b32.rs (+20/-0)
vendor/libc/src/unix/haiku/b64.rs (+20/-0)
vendor/libc/src/unix/haiku/mod.rs (+2019/-0)
vendor/libc/src/unix/haiku/native.rs (+1366/-0)
vendor/libc/src/unix/haiku/x86_64.rs (+264/-0)
vendor/libc/src/unix/hermit/aarch64.rs (+2/-0)
vendor/libc/src/unix/hermit/mod.rs (+1024/-0)
vendor/libc/src/unix/hermit/x86_64.rs (+2/-0)
vendor/libc/src/unix/linux_like/android/b32/arm.rs (+539/-0)
vendor/libc/src/unix/linux_like/android/b32/mod.rs (+244/-0)
vendor/libc/src/unix/linux_like/android/b32/x86/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs (+611/-0)
vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs (+29/-0)
vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs (+7/-0)
vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs (+391/-0)
vendor/libc/src/unix/linux_like/android/b64/mod.rs (+352/-0)
vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs (+791/-0)
vendor/libc/src/unix/linux_like/android/mod.rs (+3316/-0)
vendor/libc/src/unix/linux_like/emscripten/align.rs (+74/-0)
vendor/libc/src/unix/linux_like/emscripten/mod.rs (+1895/-0)
vendor/libc/src/unix/linux_like/emscripten/no_align.rs (+63/-0)
vendor/libc/src/unix/linux_like/linux/align.rs (+150/-0)
vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs (+278/-0)
vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs (+285/-0)
vendor/libc/src/unix/linux_like/linux/arch/mod.rs (+15/-0)
vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs (+240/-0)
vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs (+228/-0)
vendor/libc/src/unix/linux_like/linux/gnu/align.rs (+13/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs (+53/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs (+844/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs (+849/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs (+810/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs (+356/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs (+816/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs (+44/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs (+767/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs (+848/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs (+1101/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs (+51/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs (+62/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs (+71/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs (+922/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs (+877/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs (+923/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs (+126/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs (+968/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs (+44/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs (+806/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs (+953/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs (+920/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs (+24/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs (+824/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs (+442/-0)
vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs (+395/-0)
vendor/libc/src/unix/linux_like/linux/gnu/mod.rs (+1362/-0)
vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs (+10/-0)
vendor/libc/src/unix/linux_like/linux/mod.rs (+4143/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs (+850/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs (+673/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs (+786/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs (+63/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs (+796/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs (+807/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs (+888/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs (+42/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs (+651/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs (+681/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs (+166/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs (+685/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs (+44/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs (+741/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs (+712/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs (+25/-0)
vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs (+905/-0)
vendor/libc/src/unix/linux_like/linux/musl/mod.rs (+777/-0)
vendor/libc/src/unix/linux_like/linux/no_align.rs (+105/-0)
vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs (+9/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/align.rs (+28/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs (+13/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs (+897/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs (+10/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs (+13/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs (+664/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs (+10/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs (+10/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs (+205/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs (+7/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs (+292/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs (+392/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs (+53/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs (+53/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs (+341/-0)
vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs (+5/-0)
vendor/libc/src/unix/linux_like/mod.rs (+1818/-0)
vendor/libc/src/unix/mod.rs (+1531/-0)
vendor/libc/src/unix/newlib/aarch64/mod.rs (+54/-0)
vendor/libc/src/unix/newlib/align.rs (+61/-0)
vendor/libc/src/unix/newlib/arm/mod.rs (+56/-0)
vendor/libc/src/unix/newlib/espidf/mod.rs (+105/-0)
vendor/libc/src/unix/newlib/generic.rs (+27/-0)
vendor/libc/src/unix/newlib/horizon/mod.rs (+268/-0)
vendor/libc/src/unix/newlib/mod.rs (+759/-0)
vendor/libc/src/unix/newlib/no_align.rs (+51/-0)
vendor/libc/src/unix/newlib/powerpc/mod.rs (+16/-0)
vendor/libc/src/unix/no_align.rs (+6/-0)
vendor/libc/src/unix/redox/mod.rs (+1227/-0)
vendor/libc/src/unix/solarish/compat.rs (+171/-0)
vendor/libc/src/unix/solarish/illumos.rs (+85/-0)
vendor/libc/src/unix/solarish/mod.rs (+3265/-0)
vendor/libc/src/unix/solarish/solaris.rs (+94/-0)
vendor/libc/src/unix/solarish/x86.rs (+29/-0)
vendor/libc/src/unix/solarish/x86_64.rs (+159/-0)
vendor/libc/src/unix/solarish/x86_common.rs (+65/-0)
vendor/libc/src/vxworks/aarch64.rs (+4/-0)
vendor/libc/src/vxworks/arm.rs (+4/-0)
vendor/libc/src/vxworks/mod.rs (+1925/-0)
vendor/libc/src/vxworks/powerpc.rs (+4/-0)
vendor/libc/src/vxworks/powerpc64.rs (+4/-0)
vendor/libc/src/vxworks/x86.rs (+4/-0)
vendor/libc/src/vxworks/x86_64.rs (+4/-0)
vendor/libc/src/wasi.rs (+822/-0)
vendor/libc/src/windows/gnu/align.rs (+19/-0)
vendor/libc/src/windows/gnu/mod.rs (+23/-0)
vendor/libc/src/windows/mod.rs (+576/-0)
vendor/libc/src/windows/msvc/mod.rs (+20/-0)
vendor/libc/tests/const_fn.rs (+5/-0)
vendor/log/.cargo-checksum.json (+1/-0)
vendor/log/CHANGELOG.md (+241/-0)
vendor/log/Cargo.toml (+112/-0)
vendor/log/LICENSE-APACHE (+201/-0)
vendor/log/LICENSE-MIT (+25/-0)
vendor/log/README.md (+117/-0)
vendor/log/benches/value.rs (+30/-0)
vendor/log/build.rs (+46/-0)
vendor/log/src/kv/error.rs (+90/-0)
vendor/log/src/kv/key.rs (+172/-0)
vendor/log/src/kv/mod.rs (+26/-0)
vendor/log/src/kv/source.rs (+754/-0)
vendor/log/src/kv/value.rs (+1034/-0)
vendor/log/src/lib.rs (+1971/-0)
vendor/log/src/macros.rs (+280/-0)
vendor/log/src/serde.rs (+400/-0)
vendor/log/triagebot.toml (+1/-0)
vendor/memchr/.cargo-checksum.json (+1/-0)
vendor/memchr/COPYING (+3/-0)
vendor/memchr/Cargo.toml (+78/-0)
vendor/memchr/LICENSE-MIT (+21/-0)
vendor/memchr/README.md (+107/-0)
vendor/memchr/UNLICENSE (+24/-0)
vendor/memchr/build.rs (+88/-0)
vendor/memchr/rustfmt.toml (+2/-0)
vendor/memchr/scripts/make-byte-frequency-table (+74/-0)
vendor/memchr/src/cow.rs (+97/-0)
vendor/memchr/src/lib.rs (+181/-0)
vendor/memchr/src/memchr/c.rs (+44/-0)
vendor/memchr/src/memchr/fallback.rs (+329/-0)
vendor/memchr/src/memchr/iter.rs (+173/-0)
vendor/memchr/src/memchr/mod.rs (+410/-0)
vendor/memchr/src/memchr/naive.rs (+25/-0)
vendor/memchr/src/memchr/x86/avx.rs (+755/-0)
vendor/memchr/src/memchr/x86/mod.rs (+148/-0)
vendor/memchr/src/memchr/x86/sse2.rs (+791/-0)
vendor/memchr/src/memchr/x86/sse42.rs (+72/-0)
vendor/memchr/src/memmem/byte_frequencies.rs (+258/-0)
vendor/memchr/src/memmem/genericsimd.rs (+266/-0)
vendor/memchr/src/memmem/mod.rs (+1321/-0)
vendor/memchr/src/memmem/prefilter/fallback.rs (+122/-0)
vendor/memchr/src/memmem/prefilter/genericsimd.rs (+207/-0)
vendor/memchr/src/memmem/prefilter/mod.rs (+570/-0)
vendor/memchr/src/memmem/prefilter/wasm.rs (+39/-0)
vendor/memchr/src/memmem/prefilter/x86/avx.rs (+46/-0)
vendor/memchr/src/memmem/prefilter/x86/mod.rs (+5/-0)
vendor/memchr/src/memmem/prefilter/x86/sse.rs (+42/-0)
vendor/memchr/src/memmem/rabinkarp.rs (+233/-0)
vendor/memchr/src/memmem/rarebytes.rs (+136/-0)
vendor/memchr/src/memmem/twoway.rs (+878/-0)
vendor/memchr/src/memmem/util.rs (+88/-0)
vendor/memchr/src/memmem/vector.rs (+131/-0)
vendor/memchr/src/memmem/wasm.rs (+75/-0)
vendor/memchr/src/memmem/x86/avx.rs (+139/-0)
vendor/memchr/src/memmem/x86/mod.rs (+2/-0)
vendor/memchr/src/memmem/x86/sse.rs (+89/-0)
vendor/memchr/src/tests/memchr/iter.rs (+230/-0)
vendor/memchr/src/tests/memchr/memchr.rs (+134/-0)
vendor/memchr/src/tests/memchr/mod.rs (+7/-0)
vendor/memchr/src/tests/memchr/simple.rs (+23/-0)
vendor/memchr/src/tests/memchr/testdata.rs (+351/-0)
vendor/memchr/src/tests/mod.rs (+15/-0)
vendor/memchr/src/tests/x86_64-soft_float.json (+15/-0)
vendor/once_cell/.cargo-checksum.json (+1/-0)
vendor/once_cell/CHANGELOG.md (+185/-0)
vendor/once_cell/Cargo.lock (+334/-0)
vendor/once_cell/Cargo.toml (+92/-0)
vendor/once_cell/LICENSE-APACHE (+201/-0)
vendor/once_cell/LICENSE-MIT (+23/-0)
vendor/once_cell/README.md (+56/-0)
vendor/once_cell/bors.toml (+2/-0)
vendor/once_cell/examples/bench.rs (+28/-0)
vendor/once_cell/examples/bench_acquire.rs (+39/-0)
vendor/once_cell/examples/bench_vs_lazy_static.rs (+51/-0)
vendor/once_cell/examples/lazy_static.rs (+36/-0)
vendor/once_cell/examples/reentrant_init_deadlocks.rs (+14/-0)
vendor/once_cell/examples/regex.rs (+49/-0)
vendor/once_cell/examples/test_synchronization.rs (+38/-0)
vendor/once_cell/src/imp_pl.rs (+182/-0)
vendor/once_cell/src/imp_std.rs (+384/-0)
vendor/once_cell/src/lib.rs (+1304/-0)
vendor/once_cell/src/race.rs (+303/-0)
vendor/once_cell/tests/it.rs (+915/-0)
vendor/os_str_bytes/.cargo-checksum.json (+1/-0)
vendor/os_str_bytes/COPYRIGHT (+5/-0)
vendor/os_str_bytes/Cargo.toml (+78/-0)
vendor/os_str_bytes/LICENSE-APACHE (+201/-0)
vendor/os_str_bytes/LICENSE-MIT (+21/-0)
vendor/os_str_bytes/README.md (+98/-0)
vendor/os_str_bytes/src/common/mod.rs (+41/-0)
vendor/os_str_bytes/src/common/raw.rs (+38/-0)
vendor/os_str_bytes/src/iter.rs (+110/-0)
vendor/os_str_bytes/src/lib.rs (+452/-0)
vendor/os_str_bytes/src/pattern.rs (+71/-0)
vendor/os_str_bytes/src/raw_str.rs (+1164/-0)
vendor/os_str_bytes/src/util.rs (+9/-0)
vendor/os_str_bytes/src/wasm/mod.rs (+56/-0)
vendor/os_str_bytes/src/wasm/raw.rs (+28/-0)
vendor/os_str_bytes/src/windows/mod.rs (+95/-0)
vendor/os_str_bytes/src/windows/raw.rs (+41/-0)
vendor/os_str_bytes/src/windows/wtf8/code_points.rs (+122/-0)
vendor/os_str_bytes/src/windows/wtf8/convert.rs (+177/-0)
vendor/os_str_bytes/src/windows/wtf8/mod.rs (+18/-0)
vendor/os_str_bytes/src/windows/wtf8/string.rs (+61/-0)
vendor/proc-macro-error-attr/.cargo-checksum.json (+1/-0)
vendor/proc-macro-error-attr/Cargo.toml (+33/-0)
vendor/proc-macro-error-attr/LICENSE-APACHE (+201/-0)
vendor/proc-macro-error-attr/LICENSE-MIT (+21/-0)
vendor/proc-macro-error-attr/build.rs (+5/-0)
vendor/proc-macro-error-attr/src/lib.rs (+121/-0)
vendor/proc-macro-error-attr/src/parse.rs (+89/-0)
vendor/proc-macro-error-attr/src/settings.rs (+72/-0)
vendor/proc-macro-error/.cargo-checksum.json (+1/-0)
vendor/proc-macro-error/CHANGELOG.md (+162/-0)
vendor/proc-macro-error/Cargo.toml (+56/-0)
vendor/proc-macro-error/LICENSE-APACHE (+201/-0)
vendor/proc-macro-error/LICENSE-MIT (+21/-0)
vendor/proc-macro-error/README.md (+258/-0)
vendor/proc-macro-error/build.rs (+11/-0)
vendor/proc-macro-error/src/diagnostic.rs (+349/-0)
vendor/proc-macro-error/src/dummy.rs (+150/-0)
vendor/proc-macro-error/src/imp/delegate.rs (+69/-0)
vendor/proc-macro-error/src/imp/fallback.rs (+30/-0)
vendor/proc-macro-error/src/lib.rs (+560/-0)
vendor/proc-macro-error/src/macros.rs (+288/-0)
vendor/proc-macro-error/src/sealed.rs (+3/-0)
vendor/proc-macro-error/tests/macro-errors.rs (+8/-0)
vendor/proc-macro-error/tests/ok.rs (+10/-0)
vendor/proc-macro-error/tests/runtime-errors.rs (+13/-0)
vendor/proc-macro-error/tests/ui/abort.rs (+11/-0)
vendor/proc-macro-error/tests/ui/abort.stderr (+48/-0)
vendor/proc-macro-error/tests/ui/append_dummy.rs (+13/-0)
vendor/proc-macro-error/tests/ui/append_dummy.stderr (+5/-0)
vendor/proc-macro-error/tests/ui/children_messages.rs (+6/-0)
vendor/proc-macro-error/tests/ui/children_messages.stderr (+23/-0)
vendor/proc-macro-error/tests/ui/dummy.rs (+13/-0)
vendor/proc-macro-error/tests/ui/dummy.stderr (+5/-0)
vendor/proc-macro-error/tests/ui/emit.rs (+7/-0)
vendor/proc-macro-error/tests/ui/emit.stderr (+48/-0)
vendor/proc-macro-error/tests/ui/explicit_span_range.rs (+6/-0)
vendor/proc-macro-error/tests/ui/explicit_span_range.stderr (+5/-0)
vendor/proc-macro-error/tests/ui/misuse.rs (+11/-0)
vendor/proc-macro-error/tests/ui/misuse.stderr (+13/-0)
vendor/proc-macro-error/tests/ui/multiple_tokens.rs (+6/-0)
vendor/proc-macro-error/tests/ui/multiple_tokens.stderr (+5/-0)
vendor/proc-macro-error/tests/ui/not_proc_macro.rs (+4/-0)
vendor/proc-macro-error/tests/ui/not_proc_macro.stderr (+10/-0)
vendor/proc-macro-error/tests/ui/option_ext.rs (+6/-0)
vendor/proc-macro-error/tests/ui/option_ext.stderr (+7/-0)
vendor/proc-macro-error/tests/ui/proc_macro_hack.rs (+10/-0)
vendor/proc-macro-error/tests/ui/proc_macro_hack.stderr (+26/-0)
vendor/proc-macro-error/tests/ui/result_ext.rs (+7/-0)
vendor/proc-macro-error/tests/ui/result_ext.stderr (+11/-0)
vendor/proc-macro-error/tests/ui/to_tokens_span.rs (+6/-0)
vendor/proc-macro-error/tests/ui/to_tokens_span.stderr (+11/-0)
vendor/proc-macro-error/tests/ui/unknown_setting.rs (+4/-0)
vendor/proc-macro-error/tests/ui/unknown_setting.stderr (+5/-0)
vendor/proc-macro-error/tests/ui/unrelated_panic.rs (+6/-0)
vendor/proc-macro-error/tests/ui/unrelated_panic.stderr (+7/-0)
vendor/proc-macro2/.cargo-checksum.json (+1/-0)
vendor/proc-macro2/Cargo.toml (+60/-0)
vendor/proc-macro2/LICENSE-APACHE (+201/-0)
vendor/proc-macro2/LICENSE-MIT (+25/-0)
vendor/proc-macro2/README.md (+94/-0)
vendor/proc-macro2/build.rs (+180/-0)
vendor/proc-macro2/src/detection.rs (+75/-0)
vendor/proc-macro2/src/fallback.rs (+976/-0)
vendor/proc-macro2/src/lib.rs (+1318/-0)
vendor/proc-macro2/src/marker.rs (+18/-0)
vendor/proc-macro2/src/parse.rs (+871/-0)
vendor/proc-macro2/src/rcvec.rs (+142/-0)
vendor/proc-macro2/src/wrapper.rs (+978/-0)
vendor/proc-macro2/tests/comments.rs (+105/-0)
vendor/proc-macro2/tests/features.rs (+8/-0)
vendor/proc-macro2/tests/marker.rs (+98/-0)
vendor/proc-macro2/tests/test.rs (+632/-0)
vendor/proc-macro2/tests/test_fmt.rs (+28/-0)
vendor/quote/.cargo-checksum.json (+1/-0)
vendor/quote/Cargo.toml (+46/-0)
vendor/quote/LICENSE-APACHE (+201/-0)
vendor/quote/LICENSE-MIT (+25/-0)
vendor/quote/README.md (+261/-0)
vendor/quote/build.rs (+38/-0)
vendor/quote/rust-toolchain.toml (+2/-0)
vendor/quote/src/ext.rs (+110/-0)
vendor/quote/src/format.rs (+168/-0)
vendor/quote/src/ident_fragment.rs (+86/-0)
vendor/quote/src/lib.rs (+1434/-0)
vendor/quote/src/runtime.rs (+438/-0)
vendor/quote/src/spanned.rs (+43/-0)
vendor/quote/src/to_tokens.rs (+209/-0)
vendor/quote/tests/compiletest.rs (+7/-0)
vendor/quote/tests/test.rs (+520/-0)
vendor/quote/tests/ui/does-not-have-iter-interpolated-dup.rs (+9/-0)
vendor/quote/tests/ui/does-not-have-iter-interpolated-dup.stderr (+10/-0)
vendor/quote/tests/ui/does-not-have-iter-interpolated.rs (+9/-0)
vendor/quote/tests/ui/does-not-have-iter-interpolated.stderr (+10/-0)
vendor/quote/tests/ui/does-not-have-iter-separated.rs (+5/-0)
vendor/quote/tests/ui/does-not-have-iter-separated.stderr (+10/-0)
vendor/quote/tests/ui/does-not-have-iter.rs (+5/-0)
vendor/quote/tests/ui/does-not-have-iter.stderr (+10/-0)
vendor/quote/tests/ui/not-quotable.rs (+7/-0)
vendor/quote/tests/ui/not-quotable.stderr (+17/-0)
vendor/quote/tests/ui/not-repeatable.rs (+8/-0)
vendor/quote/tests/ui/not-repeatable.stderr (+35/-0)
vendor/quote/tests/ui/wrong-type-span.rs (+7/-0)
vendor/quote/tests/ui/wrong-type-span.stderr (+8/-0)
vendor/redox_syscall/.cargo-checksum.json (+1/-0)
vendor/redox_syscall/Cargo.toml (+26/-0)
vendor/redox_syscall/LICENSE (+22/-0)
vendor/redox_syscall/README.md (+6/-0)
vendor/redox_syscall/src/arch/aarch64.rs (+132/-0)
vendor/redox_syscall/src/arch/nonredox.rs (+26/-0)
vendor/redox_syscall/src/arch/riscv64.rs (+93/-0)
vendor/redox_syscall/src/arch/x86.rs (+105/-0)
vendor/redox_syscall/src/arch/x86_64.rs (+155/-0)
vendor/redox_syscall/src/call.rs (+420/-0)
vendor/redox_syscall/src/daemon.rs (+62/-0)
vendor/redox_syscall/src/data.rs (+297/-0)
vendor/redox_syscall/src/error.rs (+311/-0)
vendor/redox_syscall/src/flag.rs (+348/-0)
vendor/redox_syscall/src/io/dma.rs (+200/-0)
vendor/redox_syscall/src/io/io.rs (+71/-0)
vendor/redox_syscall/src/io/mmio.rs (+45/-0)
vendor/redox_syscall/src/io/mod.rs (+15/-0)
vendor/redox_syscall/src/io/pio.rs (+90/-0)
vendor/redox_syscall/src/lib.rs (+65/-0)
vendor/redox_syscall/src/number.rs (+78/-0)
vendor/redox_syscall/src/scheme/generate.sh (+23/-0)
vendor/redox_syscall/src/scheme/mod.rs (+18/-0)
vendor/redox_syscall/src/scheme/scheme.rs (+211/-0)
vendor/redox_syscall/src/scheme/scheme_block.rs (+211/-0)
vendor/redox_syscall/src/scheme/scheme_block_mut.rs (+211/-0)
vendor/redox_syscall/src/scheme/scheme_mut.rs (+211/-0)
vendor/redox_syscall/src/scheme/seek.rs (+33/-0)
vendor/redox_syscall/src/tests.rs (+470/-0)
vendor/regex-syntax/.cargo-checksum.json (+1/-0)
vendor/regex-syntax/Cargo.toml (+41/-0)
vendor/regex-syntax/LICENSE-APACHE (+201/-0)
vendor/regex-syntax/LICENSE-MIT (+25/-0)
vendor/regex-syntax/README.md (+98/-0)
vendor/regex-syntax/benches/bench.rs (+63/-0)
vendor/regex-syntax/src/ast/mod.rs (+1502/-0)
vendor/regex-syntax/src/ast/parse.rs (+5930/-0)
vendor/regex-syntax/src/ast/print.rs (+568/-0)
vendor/regex-syntax/src/ast/visitor.rs (+517/-0)
vendor/regex-syntax/src/either.rs (+8/-0)
vendor/regex-syntax/src/error.rs (+324/-0)
vendor/regex-syntax/src/hir/interval.rs (+520/-0)
vendor/regex-syntax/src/hir/literal/mod.rs (+1686/-0)
vendor/regex-syntax/src/hir/mod.rs (+2296/-0)
vendor/regex-syntax/src/hir/print.rs (+367/-0)
vendor/regex-syntax/src/hir/translate.rs (+3207/-0)
vendor/regex-syntax/src/hir/visitor.rs (+203/-0)
vendor/regex-syntax/src/lib.rs (+312/-0)
vendor/regex-syntax/src/parser.rs (+200/-0)
vendor/regex-syntax/src/unicode.rs (+1000/-0)
vendor/regex-syntax/src/unicode_tables/LICENSE-UNICODE (+57/-0)
vendor/regex-syntax/src/unicode_tables/age.rs (+1755/-0)
vendor/regex-syntax/src/unicode_tables/case_folding_simple.rs (+2888/-0)
vendor/regex-syntax/src/unicode_tables/general_category.rs (+6476/-0)
vendor/regex-syntax/src/unicode_tables/grapheme_cluster_break.rs (+1400/-0)
vendor/regex-syntax/src/unicode_tables/mod.rs (+57/-0)
vendor/regex-syntax/src/unicode_tables/perl_decimal.rs (+75/-0)
vendor/regex-syntax/src/unicode_tables/perl_space.rs (+23/-0)
vendor/regex-syntax/src/unicode_tables/perl_word.rs (+769/-0)
vendor/regex-syntax/src/unicode_tables/property_bool.rs (+11255/-0)
vendor/regex-syntax/src/unicode_tables/property_names.rs (+264/-0)
vendor/regex-syntax/src/unicode_tables/property_values.rs (+916/-0)
vendor/regex-syntax/src/unicode_tables/script.rs (+1244/-0)
vendor/regex-syntax/src/unicode_tables/script_extension.rs (+1443/-0)
vendor/regex-syntax/src/unicode_tables/sentence_break.rs (+2452/-0)
vendor/regex-syntax/src/unicode_tables/word_break.rs (+1098/-0)
vendor/regex-syntax/src/utf8.rs (+587/-0)
vendor/regex-syntax/test (+22/-0)
vendor/regex/.cargo-checksum.json (+1/-0)
vendor/regex/CHANGELOG.md (+1069/-0)
vendor/regex/Cargo.lock (+98/-0)
vendor/regex/Cargo.toml (+149/-0)
vendor/regex/HACKING.md (+341/-0)
vendor/regex/LICENSE-APACHE (+201/-0)
vendor/regex/LICENSE-MIT (+25/-0)
vendor/regex/PERFORMANCE.md (+277/-0)
vendor/regex/README.md (+250/-0)
vendor/regex/UNICODE.md (+259/-0)
vendor/regex/examples/regexdna-input.txt (+1671/-0)
vendor/regex/examples/regexdna-output.txt (+13/-0)
vendor/regex/examples/shootout-regex-dna-bytes.rs (+68/-0)
vendor/regex/examples/shootout-regex-dna-cheat.rs (+90/-0)
vendor/regex/examples/shootout-regex-dna-replace.rs (+17/-0)
vendor/regex/examples/shootout-regex-dna-single-cheat.rs (+75/-0)
vendor/regex/examples/shootout-regex-dna-single.rs (+57/-0)
vendor/regex/examples/shootout-regex-dna.rs (+68/-0)
vendor/regex/rustfmt.toml (+2/-0)
vendor/regex/src/backtrack.rs (+282/-0)
vendor/regex/src/compile.rs (+1264/-0)
vendor/regex/src/dfa.rs (+1945/-0)
vendor/regex/src/error.rs (+71/-0)
vendor/regex/src/exec.rs (+1655/-0)
vendor/regex/src/expand.rs (+239/-0)
vendor/regex/src/find_byte.rs (+18/-0)
vendor/regex/src/freqs.rs (+261/-0)
vendor/regex/src/input.rs (+432/-0)
vendor/regex/src/lib.rs (+766/-0)
vendor/regex/src/literal/imp.rs (+402/-0)
vendor/regex/src/literal/mod.rs (+55/-0)
vendor/regex/src/pattern.rs (+63/-0)
vendor/regex/src/pikevm.rs (+360/-0)
vendor/regex/src/pool.rs (+333/-0)
vendor/regex/src/prog.rs (+447/-0)
vendor/regex/src/re_builder.rs (+421/-0)
vendor/regex/src/re_bytes.rs (+1260/-0)
vendor/regex/src/re_set.rs (+507/-0)
vendor/regex/src/re_trait.rs (+294/-0)
vendor/regex/src/re_unicode.rs (+1311/-0)
vendor/regex/src/sparse.rs (+84/-0)
vendor/regex/src/testdata/LICENSE (+19/-0)
vendor/regex/src/testdata/README (+17/-0)
vendor/regex/src/testdata/basic.dat (+221/-0)
vendor/regex/src/testdata/nullsubexpr.dat (+79/-0)
vendor/regex/src/testdata/repetition.dat (+163/-0)
vendor/regex/src/utf8.rs (+264/-0)
vendor/regex/test (+30/-0)
vendor/regex/tests/api.rs (+234/-0)
vendor/regex/tests/api_str.rs (+34/-0)
vendor/regex/tests/bytes.rs (+107/-0)
vendor/regex/tests/consistent.rs (+238/-0)
vendor/regex/tests/crates_regex.rs (+3287/-0)
vendor/regex/tests/crazy.rs (+459/-0)
vendor/regex/tests/flags.rs (+31/-0)
vendor/regex/tests/fowler.rs (+1588/-0)
vendor/regex/tests/macros.rs (+160/-0)
vendor/regex/tests/macros_bytes.rs (+39/-0)
vendor/regex/tests/macros_str.rs (+38/-0)
vendor/regex/tests/misc.rs (+4/-0)
vendor/regex/tests/multiline.rs (+144/-0)
vendor/regex/tests/noparse.rs (+45/-0)
vendor/regex/tests/regression.rs (+222/-0)
vendor/regex/tests/regression_fuzz.rs (+31/-0)
vendor/regex/tests/replace.rs (+230/-0)
vendor/regex/tests/searcher.rs (+95/-0)
vendor/regex/tests/set.rs (+67/-0)
vendor/regex/tests/shortest_match.rs (+14/-0)
vendor/regex/tests/suffix_reverse.rs (+6/-0)
vendor/regex/tests/test_backtrack.rs (+56/-0)
vendor/regex/tests/test_backtrack_bytes.rs (+55/-0)
vendor/regex/tests/test_backtrack_utf8bytes.rs (+58/-0)
vendor/regex/tests/test_crates_regex.rs (+54/-0)
vendor/regex/tests/test_default.rs (+222/-0)
vendor/regex/tests/test_default_bytes.rs (+75/-0)
vendor/regex/tests/test_nfa.rs (+50/-0)
vendor/regex/tests/test_nfa_bytes.rs (+55/-0)
vendor/regex/tests/test_nfa_utf8bytes.rs (+54/-0)
vendor/regex/tests/unicode.rs (+251/-0)
vendor/regex/tests/word_boundary.rs (+89/-0)
vendor/regex/tests/word_boundary_ascii.rs (+9/-0)
vendor/regex/tests/word_boundary_unicode.rs (+6/-0)
vendor/remove_dir_all/.cargo-checksum.json (+1/-0)
vendor/remove_dir_all/Cargo.toml (+28/-0)
vendor/remove_dir_all/LICENCE-APACHE (+191/-0)
vendor/remove_dir_all/LICENCE-MIT (+26/-0)
vendor/remove_dir_all/README.md (+20/-0)
vendor/remove_dir_all/src/fs.rs (+278/-0)
vendor/remove_dir_all/src/lib.rs (+26/-0)
vendor/ryu/.cargo-checksum.json (+1/-0)
vendor/ryu/Cargo.lock (+152/-0)
vendor/ryu/Cargo.toml (+50/-0)
vendor/ryu/LICENSE-APACHE (+201/-0)
vendor/ryu/LICENSE-BOOST (+23/-0)
vendor/ryu/README.md (+110/-0)
vendor/ryu/benches/bench.rs (+62/-0)
vendor/ryu/examples/upstream_benchmark.rs (+85/-0)
vendor/ryu/src/buffer/mod.rs (+170/-0)
vendor/ryu/src/common.rs (+95/-0)
vendor/ryu/src/d2s.rs (+300/-0)
vendor/ryu/src/d2s_full_table.rs (+696/-0)
vendor/ryu/src/d2s_intrinsics.rs (+89/-0)
vendor/ryu/src/d2s_small_table.rs (+142/-0)
vendor/ryu/src/digit_table.rs (+28/-0)
vendor/ryu/src/f2s.rs (+176/-0)
vendor/ryu/src/f2s_intrinsics.rs (+113/-0)
vendor/ryu/src/lib.rs (+123/-0)
vendor/ryu/src/parse.rs (+19/-0)
vendor/ryu/src/pretty/exponent.rs (+48/-0)
vendor/ryu/src/pretty/mantissa.rs (+82/-0)
vendor/ryu/src/pretty/mod.rs (+225/-0)
vendor/ryu/src/s2d.rs (+217/-0)
vendor/ryu/src/s2f.rs (+227/-0)
vendor/ryu/tests/common_test.rs (+91/-0)
vendor/ryu/tests/d2s_table_test.rs (+59/-0)
vendor/ryu/tests/d2s_test.rs (+330/-0)
vendor/ryu/tests/exhaustive.rs (+52/-0)
vendor/ryu/tests/f2s_test.rs (+180/-0)
vendor/ryu/tests/macros/mod.rs (+8/-0)
vendor/ryu/tests/s2d_test.rs (+167/-0)
vendor/ryu/tests/s2f_test.rs (+110/-0)
vendor/serde/.cargo-checksum.json (+1/-0)
vendor/serde/Cargo.toml (+67/-0)
vendor/serde/LICENSE-APACHE (+201/-0)
vendor/serde/LICENSE-MIT (+23/-0)
vendor/serde/README.md (+114/-0)
vendor/serde/build.rs (+140/-0)
vendor/serde/crates-io.md (+65/-0)
vendor/serde/src/de/format.rs (+30/-0)
vendor/serde/src/de/ignored_any.rs (+243/-0)
vendor/serde/src/de/impls.rs (+2725/-0)
vendor/serde/src/de/mod.rs (+2300/-0)
vendor/serde/src/de/seed.rs (+19/-0)
vendor/serde/src/de/utf8.rs (+46/-0)
vendor/serde/src/de/value.rs (+1679/-0)
vendor/serde/src/integer128.rs (+82/-0)
vendor/serde/src/lib.rs (+300/-0)
vendor/serde/src/macros.rs (+236/-0)
vendor/serde/src/private/de.rs (+2984/-0)
vendor/serde/src/private/doc.rs (+159/-0)
vendor/serde/src/private/mod.rs (+50/-0)
vendor/serde/src/private/ser.rs (+1310/-0)
vendor/serde/src/private/size_hint.rs (+21/-0)
vendor/serde/src/ser/fmt.rs (+174/-0)
vendor/serde/src/ser/impls.rs (+936/-0)
vendor/serde/src/ser/impossible.rs (+216/-0)
vendor/serde/src/ser/mod.rs (+1986/-0)
vendor/serde/src/std_error.rs (+48/-0)
vendor/serde_json/.cargo-checksum.json (+1/-0)
vendor/serde_json/CONTRIBUTING.md (+46/-0)
vendor/serde_json/Cargo.toml (+103/-0)
vendor/serde_json/LICENSE-APACHE (+201/-0)
vendor/serde_json/LICENSE-MIT (+23/-0)
vendor/serde_json/README.md (+390/-0)
vendor/serde_json/build.rs (+52/-0)
vendor/serde_json/src/de.rs (+2614/-0)
vendor/serde_json/src/error.rs (+445/-0)
vendor/serde_json/src/features_check/error.rs (+1/-0)
vendor/serde_json/src/features_check/mod.rs (+13/-0)
vendor/serde_json/src/io/core.rs (+79/-0)
vendor/serde_json/src/io/mod.rs (+20/-0)
vendor/serde_json/src/iter.rs (+70/-0)
vendor/serde_json/src/lexical/algorithm.rs (+193/-0)
vendor/serde_json/src/lexical/bhcomp.rs (+218/-0)
vendor/serde_json/src/lexical/bignum.rs (+33/-0)
vendor/serde_json/src/lexical/cached.rs (+82/-0)
vendor/serde_json/src/lexical/cached_float80.rs (+206/-0)
vendor/serde_json/src/lexical/digit.rs (+15/-0)
vendor/serde_json/src/lexical/errors.rs (+133/-0)
vendor/serde_json/src/lexical/exponent.rs (+50/-0)
vendor/serde_json/src/lexical/float.rs (+183/-0)
vendor/serde_json/src/lexical/large_powers.rs (+9/-0)
vendor/serde_json/src/lexical/large_powers32.rs (+183/-0)
vendor/serde_json/src/lexical/large_powers64.rs (+625/-0)
vendor/serde_json/src/lexical/math.rs (+886/-0)
vendor/serde_json/src/lexical/mod.rs (+38/-0)
vendor/serde_json/src/lexical/num.rs (+440/-0)
vendor/serde_json/src/lexical/parse.rs (+83/-0)
vendor/serde_json/src/lexical/rounding.rs (+231/-0)
vendor/serde_json/src/lexical/shift.rs (+46/-0)
vendor/serde_json/src/lexical/small_powers.rs (+70/-0)
vendor/serde_json/src/lib.rs (+421/-0)
vendor/serde_json/src/macros.rs (+303/-0)
vendor/serde_json/src/map.rs (+936/-0)
vendor/serde_json/src/number.rs (+784/-0)
vendor/serde_json/src/raw.rs (+531/-0)
vendor/serde_json/src/read.rs (+1004/-0)
vendor/serde_json/src/ser.rs (+2257/-0)
vendor/serde_json/src/value/de.rs (+1386/-0)
vendor/serde_json/src/value/from.rs (+282/-0)
vendor/serde_json/src/value/index.rs (+258/-0)
vendor/serde_json/src/value/mod.rs (+989/-0)
vendor/serde_json/src/value/partial_eq.rs (+95/-0)
vendor/serde_json/src/value/ser.rs (+1025/-0)
vendor/serde_json/tests/compiletest.rs (+7/-0)
vendor/serde_json/tests/debug.rs (+68/-0)
vendor/serde_json/tests/lexical.rs (+52/-0)
vendor/serde_json/tests/lexical/algorithm.rs (+110/-0)
vendor/serde_json/tests/lexical/exponent.rs (+54/-0)
vendor/serde_json/tests/lexical/float.rs (+581/-0)
vendor/serde_json/tests/lexical/math.rs (+211/-0)
vendor/serde_json/tests/lexical/num.rs (+76/-0)
vendor/serde_json/tests/lexical/parse.rs (+204/-0)
vendor/serde_json/tests/lexical/rounding.rs (+316/-0)
vendor/serde_json/tests/macros/mod.rs (+61/-0)
vendor/serde_json/tests/map.rs (+47/-0)
vendor/serde_json/tests/regression.rs (+3/-0)
vendor/serde_json/tests/regression/issue520.rs (+20/-0)
vendor/serde_json/tests/regression/issue795.rs (+59/-0)
vendor/serde_json/tests/regression/issue845.rs (+74/-0)
vendor/serde_json/tests/stream.rs (+183/-0)
vendor/serde_json/tests/test.rs (+2388/-0)
vendor/serde_json/tests/ui/missing_colon.rs (+5/-0)
vendor/serde_json/tests/ui/missing_colon.stderr (+7/-0)
vendor/serde_json/tests/ui/missing_comma.rs (+5/-0)
vendor/serde_json/tests/ui/missing_comma.stderr (+7/-0)
vendor/serde_json/tests/ui/missing_value.rs (+5/-0)
vendor/serde_json/tests/ui/missing_value.stderr (+7/-0)
vendor/serde_json/tests/ui/not_found.rs (+5/-0)
vendor/serde_json/tests/ui/not_found.stderr (+5/-0)
vendor/serde_json/tests/ui/parse_expr.rs (+5/-0)
vendor/serde_json/tests/ui/parse_expr.stderr (+5/-0)
vendor/serde_json/tests/ui/parse_key.rs (+5/-0)
vendor/serde_json/tests/ui/parse_key.stderr (+5/-0)
vendor/serde_json/tests/ui/unexpected_after_array_element.rs (+5/-0)
vendor/serde_json/tests/ui/unexpected_after_array_element.stderr (+5/-0)
vendor/serde_json/tests/ui/unexpected_after_map_entry.rs (+5/-0)
vendor/serde_json/tests/ui/unexpected_after_map_entry.stderr (+5/-0)
vendor/serde_json/tests/ui/unexpected_colon.rs (+5/-0)
vendor/serde_json/tests/ui/unexpected_colon.stderr (+5/-0)
vendor/serde_json/tests/ui/unexpected_comma.rs (+5/-0)
vendor/serde_json/tests/ui/unexpected_comma.stderr (+5/-0)
vendor/strsim/.cargo-checksum.json (+1/-0)
vendor/strsim/CHANGELOG.md (+203/-0)
vendor/strsim/Cargo.toml (+24/-0)
vendor/strsim/LICENSE (+23/-0)
vendor/strsim/README.md (+102/-0)
vendor/strsim/benches/benches.rs (+100/-0)
vendor/strsim/src/lib.rs (+1005/-0)
vendor/strsim/tests/lib.rs (+49/-0)
vendor/syn/.cargo-checksum.json (+1/-0)
vendor/syn/Cargo.toml (+144/-0)
vendor/syn/LICENSE-APACHE (+201/-0)
vendor/syn/LICENSE-MIT (+23/-0)
vendor/syn/README.md (+285/-0)
vendor/syn/benches/file.rs (+55/-0)
vendor/syn/benches/rust.rs (+167/-0)
vendor/syn/build.rs (+51/-0)
vendor/syn/src/attr.rs (+662/-0)
vendor/syn/src/await.rs (+2/-0)
vendor/syn/src/bigint.rs (+66/-0)
vendor/syn/src/buffer.rs (+443/-0)
vendor/syn/src/custom_keyword.rs (+253/-0)
vendor/syn/src/custom_punctuation.rs (+300/-0)
vendor/syn/src/data.rs (+493/-0)
vendor/syn/src/derive.rs (+274/-0)
vendor/syn/src/discouraged.rs (+194/-0)
vendor/syn/src/error.rs (+416/-0)
vendor/syn/src/export.rs (+39/-0)
vendor/syn/src/expr.rs (+3547/-0)
vendor/syn/src/ext.rs (+139/-0)
vendor/syn/src/file.rs (+125/-0)
vendor/syn/src/gen/clone.rs (+2241/-0)
vendor/syn/src/gen/debug.rs (+3042/-0)
vendor/syn/src/gen/eq.rs (+2195/-0)
vendor/syn/src/gen/fold.rs (+3341/-0)
vendor/syn/src/gen/hash.rs (+2869/-0)
vendor/syn/src/gen/visit.rs (+3786/-0)
vendor/syn/src/gen/visit_mut.rs (+3786/-0)
vendor/syn/src/gen_helper.rs (+154/-0)
vendor/syn/src/generics.rs (+1337/-0)
vendor/syn/src/group.rs (+282/-0)
vendor/syn/src/ident.rs (+101/-0)
vendor/syn/src/item.rs (+3321/-0)
vendor/syn/src/lib.rs (+989/-0)
vendor/syn/src/lifetime.rs (+154/-0)
vendor/syn/src/lit.rs (+1600/-0)
vendor/syn/src/lookahead.rs (+169/-0)
vendor/syn/src/mac.rs (+219/-0)
vendor/syn/src/macros.rs (+177/-0)
vendor/syn/src/op.rs (+234/-0)
vendor/syn/src/parse.rs (+1314/-0)
vendor/syn/src/parse_macro_input.rs (+179/-0)
vendor/syn/src/parse_quote.rs (+167/-0)
vendor/syn/src/pat.rs (+924/-0)
vendor/syn/src/path.rs (+871/-0)
vendor/syn/src/print.rs (+16/-0)
vendor/syn/src/punctuated.rs (+1068/-0)
vendor/syn/src/reserved.rs (+44/-0)
vendor/syn/src/sealed.rs (+4/-0)
vendor/syn/src/span.rs (+67/-0)
vendor/syn/src/spanned.rs (+114/-0)
vendor/syn/src/stmt.rs (+345/-0)
vendor/syn/src/thread.rs (+41/-0)
vendor/syn/src/token.rs (+1013/-0)
vendor/syn/src/tt.rs (+107/-0)
vendor/syn/src/ty.rs (+1255/-0)
vendor/syn/src/verbatim.rs (+15/-0)
vendor/syn/src/whitespace.rs (+65/-0)
vendor/syn/tests/.gitignore (+1/-0)
vendor/syn/tests/common/eq.rs (+771/-0)
vendor/syn/tests/common/mod.rs (+28/-0)
vendor/syn/tests/common/parse.rs (+48/-0)
vendor/syn/tests/debug/gen.rs (+5640/-0)
vendor/syn/tests/debug/mod.rs (+125/-0)
vendor/syn/tests/macros/mod.rs (+79/-0)
vendor/syn/tests/regression.rs (+5/-0)
vendor/syn/tests/regression/issue1108.rs (+5/-0)
vendor/syn/tests/repo/mod.rs (+180/-0)
vendor/syn/tests/repo/progress.rs (+37/-0)
vendor/syn/tests/test_asyncness.rs (+37/-0)
vendor/syn/tests/test_attribute.rs (+336/-0)
vendor/syn/tests/test_derive_input.rs (+894/-0)
vendor/syn/tests/test_expr.rs (+326/-0)
vendor/syn/tests/test_generics.rs (+285/-0)
vendor/syn/tests/test_grouping.rs (+52/-0)
vendor/syn/tests/test_ident.rs (+85/-0)
vendor/syn/tests/test_item.rs (+336/-0)
vendor/syn/tests/test_iterators.rs (+49/-0)
vendor/syn/tests/test_lit.rs (+266/-0)
vendor/syn/tests/test_meta.rs (+378/-0)
vendor/syn/tests/test_parse_buffer.rs (+92/-0)
vendor/syn/tests/test_parse_stream.rs (+12/-0)
vendor/syn/tests/test_pat.rs (+67/-0)
vendor/syn/tests/test_path.rs (+126/-0)
vendor/syn/tests/test_precedence.rs (+455/-0)
vendor/syn/tests/test_receiver.rs (+127/-0)
vendor/syn/tests/test_round_trip.rs (+241/-0)
vendor/syn/tests/test_shebang.rs (+59/-0)
vendor/syn/tests/test_should_parse.rs (+45/-0)
vendor/syn/tests/test_size.rs (+29/-0)
vendor/syn/tests/test_stmt.rs (+93/-0)
vendor/syn/tests/test_token_trees.rs (+30/-0)
vendor/syn/tests/test_ty.rs (+352/-0)
vendor/syn/tests/test_visibility.rs (+148/-0)
vendor/syn/tests/zzz_stable.rs (+33/-0)
vendor/tempfile/.cargo-checksum.json (+1/-0)
vendor/tempfile/Cargo.toml (+43/-0)
vendor/tempfile/LICENSE-APACHE (+201/-0)
vendor/tempfile/LICENSE-MIT (+25/-0)
vendor/tempfile/NEWS (+206/-0)
vendor/tempfile/README.md (+45/-0)
vendor/tempfile/src/dir.rs (+415/-0)
vendor/tempfile/src/error.rs (+45/-0)
vendor/tempfile/src/file/imp/mod.rs (+12/-0)
vendor/tempfile/src/file/imp/other.rs (+30/-0)
vendor/tempfile/src/file/imp/unix.rs (+156/-0)
vendor/tempfile/src/file/imp/windows.rs (+108/-0)
vendor/tempfile/src/file/mod.rs (+973/-0)
vendor/tempfile/src/lib.rs (+537/-0)
vendor/tempfile/src/spooled.rs (+158/-0)
vendor/tempfile/src/util.rs (+48/-0)
vendor/tempfile/tests/namedtempfile.rs (+328/-0)
vendor/tempfile/tests/spooled.rs (+307/-0)
vendor/tempfile/tests/tempdir.rs (+261/-0)
vendor/tempfile/tests/tempfile.rs (+65/-0)
vendor/termcolor/.cargo-checksum.json (+1/-0)
vendor/termcolor/COPYING (+3/-0)
vendor/termcolor/Cargo.toml (+43/-0)
vendor/termcolor/LICENSE-MIT (+21/-0)
vendor/termcolor/README.md (+115/-0)
vendor/termcolor/UNLICENSE (+24/-0)
vendor/termcolor/rustfmt.toml (+2/-0)
vendor/termcolor/src/lib.rs (+2260/-0)
vendor/textwrap/.cargo-checksum.json (+1/-0)
vendor/textwrap/CHANGELOG.md (+568/-0)
vendor/textwrap/Cargo.lock (+962/-0)
vendor/textwrap/Cargo.toml (+82/-0)
vendor/textwrap/LICENSE (+21/-0)
vendor/textwrap/README.md (+176/-0)
vendor/textwrap/rustfmt.toml (+1/-0)
vendor/textwrap/src/core.rs (+433/-0)
vendor/textwrap/src/indentation.rs (+347/-0)
vendor/textwrap/src/lib.rs (+1847/-0)
vendor/textwrap/src/word_separators.rs (+428/-0)
vendor/textwrap/src/word_splitters.rs (+314/-0)
vendor/textwrap/src/wrap_algorithms.rs (+381/-0)
vendor/textwrap/src/wrap_algorithms/optimal_fit.rs (+433/-0)
vendor/textwrap/tests/indent.rs (+88/-0)
vendor/textwrap/tests/version-numbers.rs (+22/-0)
vendor/unicode-ident/.cargo-checksum.json (+1/-0)
vendor/unicode-ident/Cargo.toml (+55/-0)
vendor/unicode-ident/LICENSE-APACHE (+201/-0)
vendor/unicode-ident/LICENSE-MIT (+23/-0)
vendor/unicode-ident/LICENSE-UNICODE (+46/-0)
vendor/unicode-ident/README.md (+283/-0)
vendor/unicode-ident/benches/xid.rs (+124/-0)
vendor/unicode-ident/src/lib.rs (+268/-0)
vendor/unicode-ident/src/tables.rs (+630/-0)
vendor/unicode-ident/tests/compare.rs (+64/-0)
vendor/unicode-ident/tests/fst/mod.rs (+11/-0)
vendor/unicode-ident/tests/roaring/mod.rs (+21/-0)
vendor/unicode-ident/tests/static_size.rs (+96/-0)
vendor/unicode-ident/tests/trie/mod.rs (+7/-0)
vendor/unicode-ident/tests/trie/trie.rs (+436/-0)
vendor/uuid/.cargo-checksum.json (+1/-0)
vendor/uuid/CODEOWNERS (+16/-0)
vendor/uuid/CODE_OF_CONDUCT.md (+77/-0)
vendor/uuid/CONTRIBUTING.md (+149/-0)
vendor/uuid/COPYRIGHT (+8/-0)
vendor/uuid/Cargo.toml (+91/-0)
vendor/uuid/LICENSE-APACHE (+201/-0)
vendor/uuid/LICENSE-MIT (+26/-0)
vendor/uuid/README.md (+141/-0)
vendor/uuid/README.tpl (+29/-0)
vendor/uuid/benches/format_str.rs (+66/-0)
vendor/uuid/benches/invalid_parse_str.rs (+58/-0)
vendor/uuid/benches/mod.rs (+4/-0)
vendor/uuid/benches/serde_support.rs (+48/-0)
vendor/uuid/benches/slog_support/mod.rs (+1/-0)
vendor/uuid/benches/slog_support/parse_str.rs (+15/-0)
vendor/uuid/benches/valid_parse_str.rs (+39/-0)
vendor/uuid/src/adapter/compact.rs (+81/-0)
vendor/uuid/src/adapter/mod.rs (+1027/-0)
vendor/uuid/src/builder/error.rs (+52/-0)
vendor/uuid/src/builder/mod.rs (+473/-0)
vendor/uuid/src/error.rs (+79/-0)
vendor/uuid/src/lib.rs (+1070/-0)
vendor/uuid/src/parser/error.rs (+149/-0)
vendor/uuid/src/parser/mod.rs (+447/-0)
vendor/uuid/src/prelude.rs (+47/-0)
vendor/uuid/src/serde_support.rs (+125/-0)
vendor/uuid/src/slog_support.rs (+39/-0)
vendor/uuid/src/test_util.rs (+26/-0)
vendor/uuid/src/v1.rs (+326/-0)
vendor/uuid/src/v3.rs (+146/-0)
vendor/uuid/src/v4.rs (+60/-0)
vendor/uuid/src/v5.rs (+158/-0)
vendor/uuid/src/winapi_support.rs (+79/-0)
vendor/version_check/.cargo-checksum.json (+1/-0)
vendor/version_check/Cargo.toml (+24/-0)
vendor/version_check/LICENSE-APACHE (+201/-0)
vendor/version_check/LICENSE-MIT (+19/-0)
vendor/version_check/README.md (+80/-0)
vendor/version_check/src/channel.rs (+193/-0)
vendor/version_check/src/date.rs (+203/-0)
vendor/version_check/src/lib.rs (+493/-0)
vendor/version_check/src/version.rs (+316/-0)
vendor/wasi/.cargo-checksum.json (+1/-0)
vendor/wasi/CODE_OF_CONDUCT.md (+49/-0)
vendor/wasi/CONTRIBUTING.md (+8/-0)
vendor/wasi/Cargo.toml (+42/-0)
vendor/wasi/LICENSE-APACHE (+201/-0)
vendor/wasi/LICENSE-Apache-2.0_WITH_LLVM-exception (+220/-0)
vendor/wasi/LICENSE-MIT (+23/-0)
vendor/wasi/ORG_CODE_OF_CONDUCT.md (+143/-0)
vendor/wasi/README.md (+94/-0)
vendor/wasi/SECURITY.md (+29/-0)
vendor/wasi/src/lib.rs (+47/-0)
vendor/wasi/src/lib_generated.rs (+2366/-0)
vendor/winapi-i686-pc-windows-gnu/.cargo-checksum.json (+1/-0)
vendor/winapi-i686-pc-windows-gnu/Cargo.toml (+22/-0)
vendor/winapi-i686-pc-windows-gnu/build.rs (+18/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_mincore.a (+167/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_mincore_downlevel.a (+11/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_onecore.a (+257/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_onecore_downlevel.a (+36/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_onecoreuap.a (+324/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_onecoreuap_downlevel.a (+36/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_runtimeobject.a (+10/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_shcore.a (+8/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_vfw32.a (+5/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_windowsapp.a (+183/-0)
vendor/winapi-i686-pc-windows-gnu/lib/libwinapi_windowsapp_downlevel.a (+38/-0)
vendor/winapi-i686-pc-windows-gnu/src/lib.rs (+7/-0)
vendor/winapi-util/.cargo-checksum.json (+1/-0)
vendor/winapi-util/COPYING (+3/-0)
vendor/winapi-util/Cargo.toml (+30/-0)
vendor/winapi-util/LICENSE-MIT (+21/-0)
vendor/winapi-util/README.md (+58/-0)
vendor/winapi-util/UNLICENSE (+24/-0)
vendor/winapi-util/rustfmt.toml (+2/-0)
vendor/winapi-util/src/console.rs (+402/-0)
vendor/winapi-util/src/file.rs (+168/-0)
vendor/winapi-util/src/lib.rs (+32/-0)
vendor/winapi-util/src/win.rs (+246/-0)
vendor/winapi-x86_64-pc-windows-gnu/.cargo-checksum.json (+1/-0)
vendor/winapi-x86_64-pc-windows-gnu/Cargo.toml (+22/-0)
vendor/winapi-x86_64-pc-windows-gnu/build.rs (+18/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_mincore.a (+167/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_mincore_downlevel.a (+11/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_nanosrv.a (+36/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_onecore.a (+257/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_onecore_downlevel.a (+36/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_onecoreuap.a (+324/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_onecoreuap_downlevel.a (+36/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_runtimeobject.a (+10/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_shcore.a (+8/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_vfw32.a (+5/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_windowsapp.a (+182/-0)
vendor/winapi-x86_64-pc-windows-gnu/lib/libwinapi_windowsapp_downlevel.a (+38/-0)
vendor/winapi-x86_64-pc-windows-gnu/src/lib.rs (+7/-0)
vendor/winapi/.cargo-checksum.json (+1/-0)
vendor/winapi/Cargo.toml (+434/-0)
vendor/winapi/LICENSE-APACHE (+201/-0)
vendor/winapi/LICENSE-MIT (+19/-0)
vendor/winapi/README.md (+90/-0)
vendor/winapi/build.rs (+527/-0)
vendor/winapi/src/km/d3dkmthk.rs (+312/-0)
vendor/winapi/src/km/mod.rs (+7/-0)
vendor/winapi/src/lib.rs (+71/-0)
vendor/winapi/src/macros.rs (+440/-0)
vendor/winapi/src/shared/basetsd.rs (+70/-0)
vendor/winapi/src/shared/bcrypt.rs (+1001/-0)
vendor/winapi/src/shared/bthdef.rs (+1103/-0)
vendor/winapi/src/shared/bthioctl.rs (+151/-0)
vendor/winapi/src/shared/bthsdpdef.rs (+68/-0)
vendor/winapi/src/shared/bugcodes.rs (+456/-0)
vendor/winapi/src/shared/cderr.rs (+44/-0)
vendor/winapi/src/shared/cfg.rs (+138/-0)
vendor/winapi/src/shared/d3d9.rs (+1268/-0)
vendor/winapi/src/shared/d3d9caps.rs (+366/-0)
vendor/winapi/src/shared/d3d9types.rs (+1487/-0)
vendor/winapi/src/shared/d3dkmdt.rs (+45/-0)
vendor/winapi/src/shared/d3dukmdt.rs (+413/-0)
vendor/winapi/src/shared/dcomptypes.rs (+50/-0)
vendor/winapi/src/shared/devguid.rs (+178/-0)
vendor/winapi/src/shared/devpkey.rs (+401/-0)
vendor/winapi/src/shared/devpropdef.rs (+83/-0)
vendor/winapi/src/shared/dinputd.rs (+21/-0)
vendor/winapi/src/shared/dxgi.rs (+411/-0)
vendor/winapi/src/shared/dxgi1_2.rs (+355/-0)
vendor/winapi/src/shared/dxgi1_3.rs (+190/-0)
vendor/winapi/src/shared/dxgi1_4.rs (+112/-0)
vendor/winapi/src/shared/dxgi1_5.rs (+92/-0)
vendor/winapi/src/shared/dxgi1_6.rs (+98/-0)
vendor/winapi/src/shared/dxgiformat.rs (+127/-0)
vendor/winapi/src/shared/dxgitype.rs (+109/-0)
vendor/winapi/src/shared/evntprov.rs (+309/-0)
vendor/winapi/src/shared/evntrace.rs (+990/-0)
vendor/winapi/src/shared/guiddef.rs (+36/-0)
vendor/winapi/src/shared/hidclass.rs (+68/-0)
vendor/winapi/src/shared/hidpi.rs (+393/-0)
vendor/winapi/src/shared/hidsdi.rs (+110/-0)
vendor/winapi/src/shared/hidusage.rs (+274/-0)
vendor/winapi/src/shared/ifdef.rs (+208/-0)
vendor/winapi/src/shared/ifmib.rs (+53/-0)
vendor/winapi/src/shared/in6addr.rs (+18/-0)
vendor/winapi/src/shared/inaddr.rs (+29/-0)
vendor/winapi/src/shared/intsafe.rs (+5/-0)
vendor/winapi/src/shared/ipifcons.rs (+244/-0)
vendor/winapi/src/shared/ipmib.rs (+381/-0)
vendor/winapi/src/shared/iprtrmib.rs (+125/-0)
vendor/winapi/src/shared/ks.rs (+63/-0)
vendor/winapi/src/shared/ksmedia.rs (+110/-0)
vendor/winapi/src/shared/ktmtypes.rs (+138/-0)
vendor/winapi/src/shared/lmcons.rs (+60/-0)
vendor/winapi/src/shared/minwindef.rs (+102/-0)
vendor/winapi/src/shared/mmreg.rs (+309/-0)
vendor/winapi/src/shared/mod.rs (+92/-0)
vendor/winapi/src/shared/mprapidef.rs (+14/-0)
vendor/winapi/src/shared/mstcpip.rs (+492/-0)
vendor/winapi/src/shared/mswsockdef.rs (+48/-0)
vendor/winapi/src/shared/netioapi.rs (+702/-0)
vendor/winapi/src/shared/nldef.rs (+204/-0)
vendor/winapi/src/shared/ntddndis.rs (+75/-0)
vendor/winapi/src/shared/ntddscsi.rs (+834/-0)
vendor/winapi/src/shared/ntddser.rs (+17/-0)
vendor/winapi/src/shared/ntdef.rs (+1083/-0)
vendor/winapi/src/shared/ntstatus.rs (+2574/-0)
vendor/winapi/src/shared/qos.rs (+20/-0)
vendor/winapi/src/shared/rpc.rs (+9/-0)
vendor/winapi/src/shared/rpcdce.rs (+563/-0)
vendor/winapi/src/shared/rpcndr.rs (+25/-0)
vendor/winapi/src/shared/sddl.rs (+217/-0)
vendor/winapi/src/shared/sspi.rs (+1074/-0)
vendor/winapi/src/shared/stralign.rs (+40/-0)
vendor/winapi/src/shared/tcpestats.rs (+211/-0)
vendor/winapi/src/shared/tcpmib.rs (+244/-0)
vendor/winapi/src/shared/transportsettingcommon.rs (+10/-0)
vendor/winapi/src/shared/tvout.rs (+72/-0)
vendor/winapi/src/shared/udpmib.rs (+130/-0)
vendor/winapi/src/shared/usb.rs (+523/-0)
vendor/winapi/src/shared/usbioctl.rs (+705/-0)
vendor/winapi/src/shared/usbiodef.rs (+120/-0)
vendor/winapi/src/shared/usbscan.rs (+21/-0)
vendor/winapi/src/shared/usbspec.rs (+860/-0)
vendor/winapi/src/shared/windef.rs (+125/-0)
vendor/winapi/src/shared/windot11.rs (+2853/-0)
vendor/winapi/src/shared/windowsx.rs (+17/-0)
vendor/winapi/src/shared/winerror.rs (+6150/-0)
vendor/winapi/src/shared/winusbio.rs (+38/-0)
vendor/winapi/src/shared/wlantypes.rs (+78/-0)
vendor/winapi/src/shared/wmistr.rs (+199/-0)
vendor/winapi/src/shared/wnnc.rs (+77/-0)
vendor/winapi/src/shared/ws2def.rs (+556/-0)
vendor/winapi/src/shared/ws2ipdef.rs (+112/-0)
vendor/winapi/src/shared/wtypes.rs (+344/-0)
vendor/winapi/src/shared/wtypesbase.rs (+161/-0)
vendor/winapi/src/ucrt/corecrt.rs (+11/-0)
vendor/winapi/src/ucrt/mod.rs (+7/-0)
vendor/winapi/src/um/accctrl.rs (+371/-0)
vendor/winapi/src/um/aclapi.rs (+362/-0)
vendor/winapi/src/um/adhoc.rs (+220/-0)
vendor/winapi/src/um/appmgmt.rs (+122/-0)
vendor/winapi/src/um/audioclient.rs (+172/-0)
vendor/winapi/src/um/audiosessiontypes.rs (+37/-0)
vendor/winapi/src/um/avrt.rs (+82/-0)
vendor/winapi/src/um/bits.rs (+295/-0)
vendor/winapi/src/um/bits10_1.rs (+37/-0)
vendor/winapi/src/um/bits1_5.rs (+70/-0)
vendor/winapi/src/um/bits2_0.rs (+51/-0)
vendor/winapi/src/um/bits2_5.rs (+64/-0)
vendor/winapi/src/um/bits3_0.rs (+179/-0)
vendor/winapi/src/um/bits4_0.rs (+32/-0)
vendor/winapi/src/um/bits5_0.rs (+95/-0)
vendor/winapi/src/um/bitscfg.rs (+70/-0)
vendor/winapi/src/um/bitsmsg.rs (+142/-0)
vendor/winapi/src/um/bluetoothapis.rs (+414/-0)
vendor/winapi/src/um/bluetoothleapis.rs (+104/-0)
vendor/winapi/src/um/bthledef.rs (+280/-0)
vendor/winapi/src/um/cfgmgr32.rs (+2077/-0)
vendor/winapi/src/um/cguid.rs (+134/-0)
vendor/winapi/src/um/combaseapi.rs (+477/-0)
vendor/winapi/src/um/coml2api.rs (+10/-0)
vendor/winapi/src/um/commapi.rs (+87/-0)
vendor/winapi/src/um/commctrl.rs (+4135/-0)
vendor/winapi/src/um/commdlg.rs (+712/-0)
vendor/winapi/src/um/commoncontrols.rs (+232/-0)
vendor/winapi/src/um/consoleapi.rs (+91/-0)
vendor/winapi/src/um/corsym.rs (+89/-0)
vendor/winapi/src/um/d2d1.rs (+982/-0)
vendor/winapi/src/um/d2d1_1.rs (+847/-0)
vendor/winapi/src/um/d2d1_2.rs (+68/-0)
vendor/winapi/src/um/d2d1_3.rs (+698/-0)
vendor/winapi/src/um/d2d1effectauthor.rs (+516/-0)
vendor/winapi/src/um/d2d1effects.rs (+617/-0)
vendor/winapi/src/um/d2d1effects_1.rs (+31/-0)
vendor/winapi/src/um/d2d1effects_2.rs (+40/-0)
vendor/winapi/src/um/d2d1svg.rs (+411/-0)
vendor/winapi/src/um/d2dbasetypes.rs (+15/-0)
vendor/winapi/src/um/d3d.rs (+61/-0)
vendor/winapi/src/um/d3d10.rs (+57/-0)
vendor/winapi/src/um/d3d10_1.rs (+11/-0)
vendor/winapi/src/um/d3d10_1shader.rs (+7/-0)
vendor/winapi/src/um/d3d10effect.rs (+45/-0)
vendor/winapi/src/um/d3d10misc.rs (+7/-0)
vendor/winapi/src/um/d3d10sdklayers.rs (+13/-0)
vendor/winapi/src/um/d3d10shader.rs (+206/-0)
vendor/winapi/src/um/d3d11.rs (+3421/-0)
vendor/winapi/src/um/d3d11_1.rs (+484/-0)
vendor/winapi/src/um/d3d11_2.rs (+146/-0)
vendor/winapi/src/um/d3d11_3.rs (+23/-0)
vendor/winapi/src/um/d3d11_4.rs (+7/-0)
vendor/winapi/src/um/d3d11on12.rs (+67/-0)
vendor/winapi/src/um/d3d11sdklayers.rs (+2679/-0)
vendor/winapi/src/um/d3d11shader.rs (+477/-0)
vendor/winapi/src/um/d3d11tokenizedprogramformat.rs (+1335/-0)
vendor/winapi/src/um/d3d12.rs (+2722/-0)
vendor/winapi/src/um/d3d12sdklayers.rs (+1364/-0)
vendor/winapi/src/um/d3d12shader.rs (+347/-0)
vendor/winapi/src/um/d3dcommon.rs (+744/-0)
vendor/winapi/src/um/d3dcompiler.rs (+274/-0)
vendor/winapi/src/um/d3dcsx.rs (+11/-0)
vendor/winapi/src/um/d3dx10core.rs (+11/-0)
vendor/winapi/src/um/d3dx10math.rs (+7/-0)
vendor/winapi/src/um/d3dx10mesh.rs (+19/-0)
vendor/winapi/src/um/datetimeapi.rs (+60/-0)
vendor/winapi/src/um/davclnt.rs (+104/-0)
vendor/winapi/src/um/dbghelp.rs (+750/-0)
vendor/winapi/src/um/dbt.rs (+192/-0)
vendor/winapi/src/um/dcommon.rs (+114/-0)
vendor/winapi/src/um/dcomp.rs (+1159/-0)
vendor/winapi/src/um/dcompanimation.rs (+38/-0)
vendor/winapi/src/um/dde.rs (+20/-0)
vendor/winapi/src/um/ddraw.rs (+37/-0)
vendor/winapi/src/um/ddrawi.rs (+13/-0)
vendor/winapi/src/um/ddrawint.rs (+41/-0)
vendor/winapi/src/um/debugapi.rs (+41/-0)
vendor/winapi/src/um/devicetopology.rs (+462/-0)
vendor/winapi/src/um/dinput.rs (+107/-0)
vendor/winapi/src/um/dispex.rs (+221/-0)
vendor/winapi/src/um/dmksctl.rs (+11/-0)
vendor/winapi/src/um/dmusicc.rs (+71/-0)
vendor/winapi/src/um/docobj.rs (+136/-0)
vendor/winapi/src/um/documenttarget.rs (+24/-0)
vendor/winapi/src/um/dot1x.rs (+151/-0)
vendor/winapi/src/um/dpa_dsa.rs (+283/-0)
vendor/winapi/src/um/dpapi.rs (+100/-0)
vendor/winapi/src/um/dsgetdc.rs (+267/-0)
vendor/winapi/src/um/dsound.rs (+342/-0)
vendor/winapi/src/um/dsrole.rs (+66/-0)
vendor/winapi/src/um/dvp.rs (+25/-0)
vendor/winapi/src/um/dwmapi.rs (+295/-0)
vendor/winapi/src/um/dwrite.rs (+1477/-0)
vendor/winapi/src/um/dwrite_1.rs (+746/-0)
vendor/winapi/src/um/dwrite_2.rs (+293/-0)
vendor/winapi/src/um/dwrite_3.rs (+578/-0)
vendor/winapi/src/um/dxdiag.rs (+11/-0)
vendor/winapi/src/um/dxfile.rs (+23/-0)
vendor/winapi/src/um/dxgidebug.rs (+235/-0)
vendor/winapi/src/um/dxva2api.rs (+706/-0)
vendor/winapi/src/um/dxvahd.rs (+555/-0)
vendor/winapi/src/um/eaptypes.rs (+403/-0)
vendor/winapi/src/um/enclaveapi.rs (+64/-0)
vendor/winapi/src/um/endpointvolume.rs (+123/-0)
vendor/winapi/src/um/errhandlingapi.rs (+75/-0)
vendor/winapi/src/um/evntcons.rs (+229/-0)
vendor/winapi/src/um/exdisp.rs (+220/-0)
vendor/winapi/src/um/fibersapi.rs (+23/-0)
vendor/winapi/src/um/fileapi.rs (+639/-0)
vendor/winapi/src/um/functiondiscoverykeys_devpkey.rs (+117/-0)
vendor/winapi/src/um/gl/gl.rs (+52/-0)
vendor/winapi/src/um/gl/mod.rs (+7/-0)
vendor/winapi/src/um/handleapi.rs (+36/-0)
vendor/winapi/src/um/heapapi.rs (+92/-0)
vendor/winapi/src/um/highlevelmonitorconfigurationapi.rs (+171/-0)
vendor/winapi/src/um/http.rs (+1096/-0)
vendor/winapi/src/um/imm.rs (+42/-0)
vendor/winapi/src/um/interlockedapi.rs (+31/-0)
vendor/winapi/src/um/ioapiset.rs (+71/-0)
vendor/winapi/src/um/ipexport.rs (+174/-0)
vendor/winapi/src/um/iphlpapi.rs (+521/-0)
vendor/winapi/src/um/iptypes.rs (+372/-0)
vendor/winapi/src/um/jobapi.rs (+14/-0)
vendor/winapi/src/um/jobapi2.rs (+63/-0)
vendor/winapi/src/um/knownfolders.rs (+287/-0)
vendor/winapi/src/um/ktmw32.rs (+63/-0)
vendor/winapi/src/um/l2cmn.rs (+55/-0)
vendor/winapi/src/um/libloaderapi.rs (+236/-0)
vendor/winapi/src/um/lmaccess.rs (+1215/-0)
vendor/winapi/src/um/lmalert.rs (+75/-0)
vendor/winapi/src/um/lmapibuf.rs (+30/-0)
vendor/winapi/src/um/lmat.rs (+62/-0)
vendor/winapi/src/um/lmdfs.rs (+483/-0)
vendor/winapi/src/um/lmerrlog.rs (+268/-0)
vendor/winapi/src/um/lmjoin.rs (+232/-0)
vendor/winapi/src/um/lmmsg.rs (+56/-0)
vendor/winapi/src/um/lmremutl.rs (+61/-0)
vendor/winapi/src/um/lmrepl.rs (+200/-0)
vendor/winapi/src/um/lmserver.rs (+1255/-0)
vendor/winapi/src/um/lmshare.rs (+379/-0)
vendor/winapi/src/um/lmstats.rs (+85/-0)
vendor/winapi/src/um/lmsvc.rs (+180/-0)
vendor/winapi/src/um/lmuse.rs (+101/-0)
vendor/winapi/src/um/lmwksta.rs (+421/-0)
vendor/winapi/src/um/lowlevelmonitorconfigurationapi.rs (+49/-0)
vendor/winapi/src/um/lsalookup.rs (+109/-0)
vendor/winapi/src/um/memoryapi.rs (+390/-0)
vendor/winapi/src/um/minschannel.rs (+58/-0)
vendor/winapi/src/um/minwinbase.rs (+337/-0)
vendor/winapi/src/um/mmdeviceapi.rs (+220/-0)
vendor/winapi/src/um/mmeapi.rs (+336/-0)
vendor/winapi/src/um/mmsystem.rs (+266/-0)
vendor/winapi/src/um/mod.rs (+302/-0)
vendor/winapi/src/um/msaatext.rs (+59/-0)
vendor/winapi/src/um/mscat.rs (+36/-0)
vendor/winapi/src/um/mschapp.rs (+48/-0)
vendor/winapi/src/um/mssip.rs (+255/-0)
vendor/winapi/src/um/mswsock.rs (+413/-0)
vendor/winapi/src/um/namedpipeapi.rs (+93/-0)
vendor/winapi/src/um/namespaceapi.rs (+36/-0)
vendor/winapi/src/um/nb30.rs (+214/-0)
vendor/winapi/src/um/ncrypt.rs (+88/-0)
vendor/winapi/src/um/ntlsa.rs (+1530/-0)
vendor/winapi/src/um/ntsecapi.rs (+1728/-0)
vendor/winapi/src/um/oaidl.rs (+915/-0)
vendor/winapi/src/um/objbase.rs (+64/-0)
vendor/winapi/src/um/objidl.rs (+525/-0)
vendor/winapi/src/um/objidlbase.rs (+952/-0)
vendor/winapi/src/um/ocidl.rs (+68/-0)
vendor/winapi/src/um/ole2.rs (+21/-0)
vendor/winapi/src/um/oleauto.rs (+849/-0)
vendor/winapi/src/um/olectl.rs (+14/-0)
vendor/winapi/src/um/oleidl.rs (+43/-0)
vendor/winapi/src/um/opmapi.rs (+362/-0)
vendor/winapi/src/um/pdh.rs (+806/-0)
vendor/winapi/src/um/perflib.rs (+331/-0)
vendor/winapi/src/um/physicalmonitorenumerationapi.rs (+43/-0)
vendor/winapi/src/um/playsoundapi.rs (+46/-0)
vendor/winapi/src/um/portabledevice.rs (+163/-0)
vendor/winapi/src/um/portabledeviceapi.rs (+288/-0)
vendor/winapi/src/um/portabledevicetypes.rs (+255/-0)
vendor/winapi/src/um/powerbase.rs (+35/-0)
vendor/winapi/src/um/powersetting.rs (+60/-0)
vendor/winapi/src/um/powrprof.rs (+550/-0)
vendor/winapi/src/um/processenv.rs (+98/-0)
vendor/winapi/src/um/processsnapshot.rs (+120/-0)
vendor/winapi/src/um/processthreadsapi.rs (+441/-0)
vendor/winapi/src/um/processtopologyapi.rs (+23/-0)
vendor/winapi/src/um/profileapi.rs (+15/-0)
vendor/winapi/src/um/propidl.rs (+392/-0)
vendor/winapi/src/um/propkey.rs (+2300/-0)
vendor/winapi/src/um/propkeydef.rs (+13/-0)
vendor/winapi/src/um/propsys.rs (+46/-0)
vendor/winapi/src/um/prsht.rs (+361/-0)
vendor/winapi/src/um/psapi.rs (+422/-0)
vendor/winapi/src/um/realtimeapiset.rs (+30/-0)
vendor/winapi/src/um/reason.rs (+60/-0)
vendor/winapi/src/um/restartmanager.rs (+150/-0)
vendor/winapi/src/um/restrictederrorinfo.rs (+20/-0)
vendor/winapi/src/um/rmxfguid.rs (+67/-0)
vendor/winapi/src/um/rtinfo.rs (+7/-0)
vendor/winapi/src/um/sapi.rs (+1388/-0)
vendor/winapi/src/um/sapi51.rs (+3726/-0)
vendor/winapi/src/um/sapi53.rs (+1823/-0)
vendor/winapi/src/um/sapiddk.rs (+238/-0)
vendor/winapi/src/um/sapiddk51.rs (+651/-0)
vendor/winapi/src/um/schannel.rs (+339/-0)
vendor/winapi/src/um/securityappcontainer.rs (+16/-0)
vendor/winapi/src/um/securitybaseapi.rs (+690/-0)
vendor/winapi/src/um/servprov.rs (+23/-0)
vendor/winapi/src/um/setupapi.rs (+3571/-0)
vendor/winapi/src/um/shellapi.rs (+923/-0)
vendor/winapi/src/um/shellscalingapi.rs (+44/-0)
vendor/winapi/src/um/shlobj.rs (+260/-0)
vendor/winapi/src/um/shobjidl.rs (+329/-0)
vendor/winapi/src/um/shobjidl_core.rs (+576/-0)
vendor/winapi/src/um/shtypes.rs (+44/-0)
vendor/winapi/src/um/softpub.rs (+3/-0)
vendor/winapi/src/um/spapidef.rs (+53/-0)
vendor/winapi/src/um/spellcheck.rs (+146/-0)
vendor/winapi/src/um/sporder.rs (+41/-0)
vendor/winapi/src/um/sql.rs (+108/-0)
vendor/winapi/src/um/sqlext.rs (+95/-0)
vendor/winapi/src/um/sqltypes.rs (+142/-0)
vendor/winapi/src/um/sqlucode.rs (+106/-0)
vendor/winapi/src/um/sspi.rs (+7/-0)
vendor/winapi/src/um/stringapiset.rs (+75/-0)
vendor/winapi/src/um/strmif.rs (+7/-0)
vendor/winapi/src/um/subauth.rs (+204/-0)
vendor/winapi/src/um/synchapi.rs (+349/-0)
vendor/winapi/src/um/sysinfoapi.rs (+217/-0)
vendor/winapi/src/um/systemtopologyapi.rs (+20/-0)
vendor/winapi/src/um/taskschd.rs (+1233/-0)
vendor/winapi/src/um/textstor.rs (+11/-0)
vendor/winapi/src/um/threadpoolapiset.rs (+171/-0)
vendor/winapi/src/um/threadpoollegacyapiset.rs (+44/-0)
vendor/winapi/src/um/timeapi.rs (+20/-0)
vendor/winapi/src/um/timezoneapi.rs (+89/-0)
vendor/winapi/src/um/tlhelp32.rs (+194/-0)
vendor/winapi/src/um/unknwnbase.rs (+43/-0)
vendor/winapi/src/um/urlhist.rs (+97/-0)
vendor/winapi/src/um/urlmon.rs (+21/-0)
vendor/winapi/src/um/userenv.rs (+159/-0)
vendor/winapi/src/um/usp10.rs (+560/-0)
vendor/winapi/src/um/utilapiset.rs (+25/-0)
vendor/winapi/src/um/uxtheme.rs (+772/-0)
vendor/winapi/src/um/vsbackup.rs (+520/-0)
vendor/winapi/src/um/vss.rs (+284/-0)
vendor/winapi/src/um/vsserror.rs (+89/-0)
vendor/winapi/src/um/vswriter.rs (+397/-0)
vendor/winapi/src/um/wbemads.rs (+41/-0)
vendor/winapi/src/um/wbemcli.rs (+1174/-0)
vendor/winapi/src/um/wbemdisp.rs (+1344/-0)
vendor/winapi/src/um/wbemprov.rs (+302/-0)
vendor/winapi/src/um/wbemtran.rs (+184/-0)
vendor/winapi/src/um/wct.rs (+114/-0)
vendor/winapi/src/um/werapi.rs (+64/-0)
vendor/winapi/src/um/winbase.rs (+2854/-0)
vendor/winapi/src/um/wincodec.rs (+1861/-0)
vendor/winapi/src/um/wincodecsdk.rs (+564/-0)
vendor/winapi/src/um/wincon.rs (+459/-0)
vendor/winapi/src/um/wincontypes.rs (+114/-0)
vendor/winapi/src/um/wincred.rs (+532/-0)
vendor/winapi/src/um/wincrypt.rs (+7365/-0)
vendor/winapi/src/um/windowsceip.rs (+9/-0)
vendor/winapi/src/um/winefs.rs (+178/-0)
vendor/winapi/src/um/winevt.rs (+543/-0)
vendor/winapi/src/um/wingdi.rs (+5591/-0)
vendor/winapi/src/um/winhttp.rs (+658/-0)
vendor/winapi/src/um/wininet.rs (+2364/-0)
vendor/winapi/src/um/winineti.rs (+142/-0)
vendor/winapi/src/um/winioctl.rs (+1091/-0)
vendor/winapi/src/um/winnetwk.rs (+446/-0)
vendor/winapi/src/um/winnls.rs (+817/-0)
vendor/winapi/src/um/winnt.rs (+8648/-0)
vendor/winapi/src/um/winreg.rs (+684/-0)
vendor/winapi/src/um/winsafer.rs (+228/-0)
vendor/winapi/src/um/winscard.rs (+709/-0)
vendor/winapi/src/um/winsmcrd.rs (+166/-0)
vendor/winapi/src/um/winsock2.rs (+1450/-0)
vendor/winapi/src/um/winspool.rs (+2433/-0)
vendor/winapi/src/um/winsvc.rs (+695/-0)
vendor/winapi/src/um/wintrust.rs (+123/-0)
vendor/winapi/src/um/winusb.rs (+224/-0)
vendor/winapi/src/um/winuser.rs (+7251/-0)
vendor/winapi/src/um/winver.rs (+53/-0)
vendor/winapi/src/um/wlanapi.rs (+1459/-0)
vendor/winapi/src/um/wlanihv.rs (+410/-0)
vendor/winapi/src/um/wlanihvtypes.rs (+41/-0)
vendor/winapi/src/um/wlclient.rs (+33/-0)
vendor/winapi/src/um/wow64apiset.rs (+32/-0)
vendor/winapi/src/um/wpdmtpextensions.rs (+60/-0)
vendor/winapi/src/um/ws2bth.rs (+211/-0)
vendor/winapi/src/um/ws2spi.rs (+909/-0)
vendor/winapi/src/um/ws2tcpip.rs (+346/-0)
vendor/winapi/src/um/wtsapi32.rs (+6/-0)
vendor/winapi/src/um/xinput.rs (+173/-0)
vendor/winapi/src/vc/excpt.rs (+18/-0)
vendor/winapi/src/vc/limits.rs (+7/-0)
vendor/winapi/src/vc/mod.rs (+10/-0)
vendor/winapi/src/vc/vadefs.rs (+8/-0)
vendor/winapi/src/vc/vcruntime.rs (+9/-0)
vendor/winapi/src/winrt/activation.rs (+13/-0)
vendor/winapi/src/winrt/hstring.rs (+25/-0)
vendor/winapi/src/winrt/inspectable.rs (+29/-0)
vendor/winapi/src/winrt/mod.rs (+12/-0)
vendor/winapi/src/winrt/roapi.rs (+60/-0)
vendor/winapi/src/winrt/robuffer.rs (+12/-0)
vendor/winapi/src/winrt/roerrorapi.rs (+103/-0)
vendor/winapi/src/winrt/winstring.rs (+150/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Needs Information
Canonical Server Reporter Pending
Canonical Server Core Reviewers Pending
Canonical Server packageset reviewers Pending
Review via email: mp+425351@code.launchpad.net

Description of the change

This is the current proposal for using vendorized code in the new, rust based, mdevctl package.

Do note that this could be ported to Debian and be used as a sync IF having vendorized code in the debian source package does not infringe any Debian policies. I could not find a reference for the matter in the Debian policy. While this is not clear, this should be a delta here.

PPA: https://launchpad.net/~athos-ribeiro/+archive/ubuntu/mdevctl-mre/+packages

To build the package with the delta, one would need to use uscan to fetch the vendorized code as described in the d/watch file since it will not be available in Debian.

It is worth mentioning that dh-cargo generates a X-Cargo-Built-Using field, describing some package build dependencies. For instance, the current Debian unstable package has

$ dpkg-deb --info ../mdevctl_1.1.0-1+b1_amd64.deb
 ...
 Depends: udev, libc6 (>= 2.33), libgcc-s1 (>= 4.2)
 Built-Using: rustc (= 1.58.1+dfsg1-1)
 ...
 X-Cargo-Built-Using: rust-aho-corasick (= 0.7.10-1), rust-ansi-term (= 0.12.1-1), rust-anyhow (= 1.0.44-2), rust-atty (= 0.2.14-2), rust-bitflags (= 1.3.2-2), rust-cfg-if-0.1 (= 0.1.10-2), rust-cfg-if (= 1.0.0-1), rust-clap-2 (= 2.34.0-1), rust-env-logger (= 0.9.0-1), rust-getrandom (= 0.2.4-2), rust-hashbrown (= 0.11.2-2), rust-humantime (= 2.1.0-1), rust-indexmap (= 1.7.0-1), rust-itoa (= 0.4.8-1), rust-lazy-static (= 1.4.0-1), rust-libc (= 0.2.103-1), rust-log (= 0.4.11-2), rust-memchr (= 2.4.1-1), rust-ppv-lite86 (= 0.2.16-1), rust-rand-chacha (= 0.3.1-2), rust-rand-core (= 0.6.3-2), rust-rand (= 0.8.4-2), rust-regex (= 1.5.5-1), rust-regex-syntax (= 0.6.25-1), rust-remove-dir-all (= 0.5.2-1), rust-ryu (= 1.0.2-1), rust-serde (= 1.0.130-2), rust-serde-json (= 1.0.45-1), rust-smawk (= 0.3.1-2), rust-strsim (= 0.9.3-1), rust-structopt (= 0.3.26-2), rust-tempfile (= 3.2.0-2), rust-termcolor (= 1.1.2-1), rust-textwrap (= 0.15.0-2), rust-unicode-linebreak (= 0.1.2-1), rust-unicode-width (= 0.1.9-3), rust-uuid (= 0.8.1-4), rust-vec-map (= 0.8.1-2), rustc (= 1.58.1+dfsg1-1)

This field will no longer be meaningful once we are building from vendorized dependencies:

$ dpkg-deb --info ../mdevctl_1.1.0-1ubuntu1_amd64.deb
 ...
 Depends: udev, libc6 (>= 2.34), libgcc-s1 (>= 4.2)
 Built-Using: rustc (= 1.59.0+dfsg1-1~ubuntu2)
 ...
 X-Cargo-Built-Using: rustc (= 1.59.0+dfsg1-1~ubuntu2)

In the future, if vendoring becomes a standard for rust packages in main, we may want to add a delta to dh-cargo to possibly include the vendored data in that field. Alternatively, the sec team would need to monitor the vendored code in the source package. For either of these cases, we would need to fetch the data from the `vendor` directory, for instance:

find vendor -name Cargo.toml -exec grep -m2 -E '^name|^version' '{}' \;

To post a comment you must log in.
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Do note that this MP was filed to present and discuss the proposed approach on how to deal with mdevctl. This would only be merged and uploaded after the rust-based mdevctl MIR process is complete.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Also, the hack in execute_after_dh_auto_configure could be a complete override in dh_auto_configure, which would look like

override_dh_auto_configure:
 cp debian/cargo-checksum.json
 rm -rf Cargo.lock
 /usr/share/cargo/bin/cargo prepare-debian $(CURDIR)/vendor

But then we would risk missing any further changes in dh-cargo regarding dh_auto_configure.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Hi,
thanks for your work here, going through one by one:

56c301e * New changes: - d/control: depend on librust-uuid+rand-dev for v4 feature.
  The change to the new librust-uuid+rand-dev (>= 0.8.1) is fine for Debian
  But since we want to become all-vendored do we want/need it here?
  Would it make sense to split this into a salsa PR instead?

1170c60 - d/watch: introduce vendor component with bundled dependencies.
  haven't seen opts=component=vendor before but it LGTM
  Tried it and it worked including the subdir repack
  ack for this as ubuntu delta

39c8e95 - vendor: unpack vendorized sources.
50d5f29 - d/copyright: include vendorized projects copyright data.
  ack for these as ubuntu delta

73d40a9 - d/rules: use vendorized dependencies for Ubuntu builds.
  Nice use of /usr/share/dpkg/vendor.mk
  ack for this as ubuntu delta
  This part is a Debian no-op and could even be added there I guess.

3df8c59 - d/patches: drop dependency version tweaks in favor of vendorized dependencies.
  Maybe just disable it in d/p/series but do not remove the patch
  That way you have less noise and will
  a) easier rebase future versions
  b) allow people to "go back for deb style build" more easily
  This is up to you though, not enough to mark this won't fix

80b5454 Update changelog for 1.1.0-1ubuntu1 release
1d1eb5e Update maintainer
  Just mechanical, yes that LGTM as well

Back in the "debate rust MIR rules" we had discussed about ways for security to track those inclcuded things. See https://github.com/cpaelzer/ubuntu-mir/pull/3/files
Do you have a new build/buildlog so we can check to modify getting any of that?

#1 We either want a .lock file (which dh-cargo deleted the one you get from upstream and does IIRC not create a new one). The discussion there wasn't 100% final so if that isn't working it might be ok but then it needs proper mentioning in some Built-Using that works.

#2 Other than those dependencies we also had the need to document "how to refresh vendored code" in debian/README.source - you could drop an example how uscan works with component=vendor in this case.

review: Needs Information
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks for the review, Christian!

> 56c301e * New changes: - d/control: depend on librust-uuid+rand-dev for
> v4 feature.
> The change to the new librust-uuid+rand-dev (>= 0.8.1) is fine for Debian
> But since we want to become all-vendored do we want/need it here?
> Would it make sense to split this into a salsa PR instead?

This was already submitted and merged into Debian (it was not released yet though).

> 73d40a9 - d/rules: use vendorized dependencies for Ubuntu builds.
> Nice use of /usr/share/dpkg/vendor.mk
> ack for this as ubuntu delta
> This part is a Debian no-op and could even be added there I guess.

I submitted https://salsa.debian.org/debian/mdevctl/-/merge_requests/4 for this one.

> 3df8c59 - d/patches: drop dependency version tweaks in favor of vendorized
> dependencies.
> Maybe just disable it in d/p/series but do not remove the patch
> That way you have less noise and will
> a) easier rebase future versions
> b) allow people to "go back for deb style build" more easily
> This is up to you though, not enough to mark this won't fix

+1 Done.

> Back in the "debate rust MIR rules" we had discussed about ways for security
> to track those inclcuded things. See https://github.com/cpaelzer/ubuntu-
> mir/pull/3/files
> Do you have a new build/buildlog so we can check to modify getting any of
> that?
>

The current proposal is in a PPA at https://launchpad.net/~athos-ribeiro/+archive/ubuntu/mdevctl-mre/+packages

> #1 We either want a .lock file (which dh-cargo deleted the one you get from
> upstream and does IIRC not create a new one). The discussion there wasn't 100%
> final so if that isn't working it might be ok but then it needs proper
> mentioning in some Built-Using that works.
>
> #2 Other than those dependencies we also had the need to document "how to
> refresh vendored code" in debian/README.source - you could drop an example how
> uscan works with component=vendor in this case.

I added a small comment in d/README.source to address #2.

I am working on a solution for #1 and will update this MP as soon as it is up.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

On Tue, Jun 28, 2022 at 2:57 PM Athos Ribeiro
<email address hidden> wrote:
>
> Thanks for the review, Christian!
>
> > 56c301e * New changes: - d/control: depend on librust-uuid+rand-dev for
> > v4 feature.
> > The change to the new librust-uuid+rand-dev (>= 0.8.1) is fine for Debian
> > But since we want to become all-vendored do we want/need it here?
> > Would it make sense to split this into a salsa PR instead?
>
> This was already submitted and merged into Debian (it was not released yet though).

oO - I should know since I merged it :-)

> > 73d40a9 - d/rules: use vendorized dependencies for Ubuntu builds.
> > Nice use of /usr/share/dpkg/vendor.mk
> > ack for this as ubuntu delta
> > This part is a Debian no-op and could even be added there I guess.
>
> I submitted https://salsa.debian.org/debian/mdevctl/-/merge_requests/4 for this one.

merged

> > 3df8c59 - d/patches: drop dependency version tweaks in favor of vendorized
> > dependencies.
> > Maybe just disable it in d/p/series but do not remove the patch
> > That way you have less noise and will
> > a) easier rebase future versions
> > b) allow people to "go back for deb style build" more easily
> > This is up to you though, not enough to mark this won't fix
>
> +1 Done.
>
> > Back in the "debate rust MIR rules" we had discussed about ways for security
> > to track those inclcuded things. See https://github.com/cpaelzer/ubuntu-
> > mir/pull/3/files
> > Do you have a new build/buildlog so we can check to modify getting any of
> > that?
> >
>
> The current proposal is in a PPA at https://launchpad.net/~athos-ribeiro/+archive/ubuntu/mdevctl-mre/+packages
>
> > #1 We either want a .lock file (which dh-cargo deleted the one you get from
> > upstream and does IIRC not create a new one). The discussion there wasn't 100%
> > final so if that isn't working it might be ok but then it needs proper
> > mentioning in some Built-Using that works.
> >
> > #2 Other than those dependencies we also had the need to document "how to
> > refresh vendored code" in debian/README.source - you could drop an example how
> > uscan works with component=vendor in this case.
>
> I added a small comment in d/README.source to address #2.

Thanks, that part LGTM!

> I am working on a solution for #1 and will update this MP as soon as it is up.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

On Tue, Jun 28, 2022 at 6:24 PM Athos Ribeiro
<email address hidden> wrote:
>
> MP updated to ship the cargo lockfile, as proposed in https://github.com/cpaelzer/ubuntu-mir/pull/3.

Nice, that looks cleaner than I thought, so you generate it right out
of the real vendor source that we added.
Awesome!

> PPA available at https://launchpad.net/~athos-ribeiro/+archive/ubuntu/mdevctl-vendored-plus-lockfile/+packages

Downloaded and checked, LGTM!
It is auto-compressed though since it is in the doc path - that is
fine but whatever checkers security had in mind need to be able to
deal with it.

Thanks, overall I think with that PPA we can go to security and MIR
team and ask if this can be approved as sufficient until the dh_cargo
tooling exists.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Merge Proposal updated to include a build-time test suite run with the vendorized dependencies.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks, with the Rust rules landed I think this is now ready for review.
You could set it form WIP to "review"

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

FYI - if anyone crosses this MP, here an update.

We got the MIR approved by the MIR team

We have got a few smaller improvements to land (they are all generic, so we preferably land them in Debian) and will re-base this onto the latest Debian version then. Athos is working on those.

All of this is worked on while the security review is going on.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Please rebase for 1.2.0 - until then please mark it WIP to not clutter our to-be-reviewed list.

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

I rebased this one on top of 1.2.0. The PPA has been updated as well.

15f87ca... by Athos Ribeiro

    - d/control: remove librust-uuid B-D. This is now vendorized in this
      package and the new librust-uuid version in kinetic is currently
      incompatible.

1bcabcb... by Athos Ribeiro

update-maintainer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/README.source b/debian/README.source
2index 9835852..e9161d2 100644
3--- a/debian/README.source
4+++ b/debian/README.source
5@@ -1,3 +1,12 @@
6+The debian/watch file was crafted with Multiple Upstream Tarball (MUT) support
7+in mind. This was performed to account for the vendorized dependencies bundle,
8+which is shipped by the upstream project as a separate tarball. To obtain the
9+sources with the vendorized code and update the package when new upstream
10+versions are available, a regular uscan/uupdate workflow will suffice. The
11+"component" option in the debian/watch file will ensure the vendorized code is
12+expanded in the expected "vendor" directory. Please, refer to the uscan docs
13+and manpage for more information on MUT support.
14+
15 `wrap-and-sort -at` is the convention for d/control and other affected
16 files to ensure auto-ordering, but with the benefit of having just one
17 package per line giving the benefit of more readable diffs.
18diff --git a/debian/changelog b/debian/changelog
19index fec5934..2561c06 100644
20--- a/debian/changelog
21+++ b/debian/changelog
22@@ -1,3 +1,22 @@
23+mdevctl (1.2.0-1ubuntu1) kinetic; urgency=medium
24+
25+ * d/watch: introduce vendor component with bundled dependencies.
26+ * vendor: unpack vendorized sources.
27+ * d/p/series: drop dependency version tweaks in favor of vendorized
28+ dependencies.
29+ * d/README.source: include information on uscan's Multiple Upstream
30+ Tarball (MUT) support for the vendorized code.
31+ * Ship Cargo lockfile to provide data on the vendorized code:
32+ - d/config.toml: provide a custom Cargo configuration to generate
33+ a lockfile from the vendorized dependencies.
34+ - d/install: ship the build-time generated lockfile.
35+ * d/copyright: include vendorized projects copyright data.
36+ * d/control: remove librust-uuid B-D. This is now vendorized in this
37+ package and the new librust-uuid version in kinetic is currently
38+ incompatible.
39+
40+ -- Athos Ribeiro <athos.ribeiro@canonical.com> Thu, 11 Aug 2022 11:54:53 -0300
41+
42 mdevctl (1.2.0-1) unstable; urgency=medium
43
44 [ Athos Ribeiro ]
45diff --git a/debian/config.toml b/debian/config.toml
46new file mode 100644
47index 0000000..ecda502
48--- /dev/null
49+++ b/debian/config.toml
50@@ -0,0 +1,7 @@
51+# Use the vendorized sources to produce the Cargo.lock file. This can be
52+# performed by pointing $CARGO_HOME to the path containing this file.
53+[source]
54+[source.my-vendor-source]
55+directory = "vendor"
56+[source.crates-io]
57+replace-with = "my-vendor-source"
58diff --git a/debian/control b/debian/control
59index 44c3b25..5810f31 100644
60--- a/debian/control
61+++ b/debian/control
62@@ -1,7 +1,8 @@
63 Source: mdevctl
64 Section: admin
65 Priority: optional
66-Maintainer: Christian Ehrhardt <christian.ehrhardt@canonical.com>
67+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
68+XSBC-Original-Maintainer: Christian Ehrhardt <christian.ehrhardt@canonical.com>
69 Rules-Requires-Root: no
70 Build-Depends: cargo,
71 debhelper-compat (= 13),
72@@ -14,7 +15,6 @@ Build-Depends: cargo,
73 librust-clap-complete-dev (>= 3.0.6),
74 librust-clap+strsim-dev,
75 librust-tempfile-dev (>= 3.1.0) <!nocheck>,
76- librust-uuid+rand-dev (>= 0.8.1),
77 pkg-config,
78 python3-docutils,
79 systemd,
80diff --git a/debian/copyright b/debian/copyright
81index d71245b..92abbc2 100644
82--- a/debian/copyright
83+++ b/debian/copyright
84@@ -10,6 +10,260 @@ Files: debian/*
85 Copyright: 2019-2022 Christian Ehrhardt <paelzer@gmail.com>
86 License: GPL-2
87
88+Files: vendor/winapi-x86_64-pc-windows-gnu/*
89+Copyright: 2015-2019 Peter Atashian <retep998@gmail.com>
90+ 2015-2019 The winapi-rs Developers
91+License: MIT or Apache-2.0
92+
93+Files: vendor/winapi/*
94+Copyright: 2015-2019 Peter Atashian <retep998@gmail.com>
95+ 2015-2019 The winapi-rs Developers
96+License: MIT or Apache-2.0
97+
98+Files: vendor/anyhow/*
99+Copyright: 2019 David Tolnay <dtolnay@gmail.com>
100+License: MIT or Apache-2.0
101+
102+Files: vendor/serde/*
103+Copyright: 2017-2018 Erick Tryzelaar <erick.tryzelaar@gmail.com>
104+ 2017-2019 David Tolnay <dtolnay@gmail.com>
105+ 2017-2022 Serde Developers
106+License: MIT or Apache-2.0
107+
108+Files: vendor/strsim/*
109+Copyright: Danny Guo <dannyguo91@gmail.com>
110+ 2016 Titus Wormer <tituswormer@gmail.com>
111+ 2006-2009 Graydon Hoare
112+ 2009-2013 Mozilla Foundation
113+License: MIT
114+
115+Files: vendor/regex-syntax/*
116+Copyright: 2014-2019 The Rust Project Developers
117+License: MIT or Apache-2.0
118+
119+Files: vendor/regex-syntax/src/unicode_tables/*
120+Copyright: 1991-2018 Unicode, Inc. All rights reserved.
121+License: Unicode
122+
123+Files: vendor/termcolor/*
124+Copyright: 2015 Andrew Gallant <jamslam@gmail.com>
125+License: Unlicense or MIT
126+
127+Files: vendor/proc-macro-error-attr/*
128+Copyright: 2019-2020 CreepySkeleton <creepy-skeleton@yandex.ru>
129+License: MIT or Apache-2.0
130+
131+Files: vendor/log/*
132+Copyright: 2014-2015 The Rust Project Developers
133+License: MIT or Apache-2.0
134+
135+Files: vendor/env_logger/*
136+Copyright: 2014-2019 The Rust Project Developers
137+License: MIT or Apache-2.0
138+
139+Files: vendor/syn/*
140+Copyright:
141+ 2016-2019 David Tolnay <dtolnay@gmail.com>
142+ 2016-2019 Syn Developers
143+License: MIT or Apache-2.0
144+
145+Files: vendor/ryu/*
146+Copyright:
147+ 2018-2020 David Tolnay <dtolnay@gmail.com>
148+ 2018 Ulf Adams
149+License: Apache-2.0 or BSL-1.0
150+
151+Files: vendor/autocfg/*
152+Copyright: 2018 Josh Stone <cuviper@gmail.com>
153+License: Apache-2.0 or MIT
154+
155+Files: vendor/regex/*
156+Copyright: 2014-2018 The Rust Project Developers
157+License: MIT or Apache-2.0
158+
159+Files: vendor/itoa/*
160+Copyright: 2016-2021 David Tolnay <dtolnay@gmail.com>
161+ 2016-2021 Itoa Developers
162+License: MIT or Apache-2.0
163+
164+Files: vendor/bitflags/*
165+Copyright: 2014-2018 The Rust Project Developers
166+License: MIT or Apache-2.0
167+
168+Files: vendor/quote/*
169+Copyright:
170+ 2016-2019 David Tolnay <dtolnay@gmail.com>
171+ 2016 The Rust Project Developers
172+License: MIT or Apache-2.0
173+
174+Files: vendor/cfg-if/*
175+Copyright: 2014-2019 Alex Crichton <alex@alexcrichton.com>
176+License: MIT or Apache-2.0
177+
178+Files: vendor/winapi-util/*
179+Copyright: 2017 Andrew Gallant <jamslam@gmail.com>
180+License: Unlicense or MIT
181+
182+Files: vendor/libc/*
183+Copyright: 2012-2020 The Rust Project Developers
184+License: MIT or Apache-2.0
185+
186+Files: vendor/atty/*
187+Copyright: 2015-2019 Doug Tangren
188+License: MIT
189+
190+Files: vendor/wasi/*
191+Copyright: 2018 The Cranelift Project Developers
192+License: MIT or Apache-2.0 or APACHE-2-LLVM-EXCEPTIONS
193+
194+Files: vendor/uuid/*
195+Copyright:
196+ 2013-2014 The Rust Project Developers
197+ 2018 The Uuid Project Developers
198+ 2013-2018 Ashley Mannix<ashleymannix@live.com.au>
199+ 2013-2018 Christopher Armstrong
200+ 2013-2018 Dylan DPC<dylan.dpc@gmail.com>
201+ 2013-2018 Hunar Roop Kahlon<hunar.roop@gmail.com>
202+License: Apache-2.0 or MIT
203+
204+Files: vendor/textwrap/*
205+Copyright: 2016 Martin Geisler <martin@geisler.net>
206+License: MIT
207+
208+Files: vendor/version_check/*
209+Copyright: Sergio Benitez <sb@sergio.bz>
210+License: MIT or Apache-2.0
211+
212+Files: vendor/aho-corasick/*
213+Copyright: 2015-2020 Andrew Gallant <jamslam@gmail.com>
214+License: Unlicense or MIT
215+
216+Files: vendor/clap/*
217+Copyright: 2015-2020 Kevin B. Knapp <kbknapp@gmail.com>
218+License: MIT
219+
220+Files: vendor/clap/src/parser/matches/arg_matches.rs
221+Copyright: 2015 The Rust Project Developers
222+License: MIT
223+
224+Files: vendor/clap/src/macros.rs
225+Copyright:
226+ 2015 grabbag contributors
227+ 2015-2020 Kevin B. Knapp <kbknapp@gmail.com>
228+License: MIT
229+
230+Files: vendor/humantime/*
231+Copyright:
232+ 2016-2018 Paul Colomiets <paul@colomiets.name>
233+ 2016 The humantime Developers
234+ 2016 Pyfisch
235+ 2005-2013 Rich Felker
236+License: MIT or Apache-2.0
237+
238+Files: vendor/getrandom/*
239+Copyright:
240+ 2018-2021 Developers of the Rand project
241+ 2014 The Rust Project Developers
242+License: MIT or Apache-2.0
243+
244+Files: vendor/remove_dir_all/*
245+Copyright: 2017 Aaron Power <theaaronepower@gmail.com>
246+License: MIT or Apache-2.0
247+
248+Files: vendor/memchr/*
249+Copyright: 2015 Andrew Gallant <jamslam@gmail.com>
250+ bluss
251+License: Unlicense or MIT
252+
253+Files: vendor/serde_json/*
254+Copyright: 2014-2019 Serde Developers
255+License: MIT or Apache-2.0
256+
257+Files: vendor/redox_syscall/*
258+Copyright:
259+ 2017-2019 Jeremy Soller <jackpot51@gmail.com>
260+ 2017-2019 Redox OS Developers
261+License: MIT
262+
263+Files: vendor/hermit-abi/*
264+Copyright: 2019 Stefan Lankes
265+License: MIT or Apache-2.0
266+
267+Files: vendor/proc-macro2/*
268+Copyright:
269+ 2014-2020 Alex Crichton <alex@alexcrichton.com>
270+ 2017-2020 David Tolnay <dtolnay@gmail.com>
271+License: MIT or Apache-2.0
272+
273+Files: vendor/winapi-i686-pc-windows-gnu/*
274+Copyright: 2015-2019 Peter Atashian <retep998@gmail.com>
275+ 2015-2019 The winapi-rs Developers
276+License: MIT or Apache-2.0
277+
278+Files: vendor/tempfile/*
279+Copyright:
280+ 2015-2020 Steven Allen <steven@stebalien.com>
281+ 2015-2018 Ashley Mannix <ashleymannix@live.com.au>
282+ 2015-2019 Jason White <jasonaw0@gmail.com>
283+ 2013-2020 The Rust Project Developers
284+License: MIT or Apache-2.0
285+
286+Files: vendor/proc-macro-error/*
287+Copyright:
288+ 2019-2020 CreepySkeleton <creepy-skeleton@yandex.ru>
289+ 2019-2020 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
290+ 2019-2020 kpcyrd <git@rxv.cc>
291+ 2020 Daniel Kahn Gillmor <dkg@fifthhorseman.net>
292+License: MIT or Apache-2.0
293+
294+Files: vendor/hashbrown/*
295+Copyright: 2018-2019 Amanieu d'Antras <amanieu@gmail.com>
296+License: Apache-2.0 or MIT
297+
298+Files: vendor/heck/*
299+Copyright: 2015-2021 Without Boats <woboats@gmail.com>
300+License: MIT or Apache-2.0
301+
302+Files: vendor/indexmap/*
303+Copyright:
304+ 2016-2020 bluss
305+ 2017-2020 Josh Stone <cuviper@gmail.com>
306+License: Apache-2.0 or MIT
307+
308+Files: vendor/clap_complete/*
309+Copyright: 2015-2022 Kevin B. Knapp and Clap Contributors
310+License: Apache-2.0 or MIT
311+
312+Files: vendor/clap_derive/*
313+Copyright: 2015-2022 Kevin B. Knapp and Clap Contributors
314+License: Apache-2.0 or MIT
315+
316+Files: vendor/clap_lex/*
317+Copyright: 2015-2022 Kevin B. Knapp and Clap Contributors
318+License: Apache-2.0 or MIT
319+
320+Files: vendor/fastrand/*
321+Copyright: 2018 Stjepan Glavina <stjepang@gmail.com>
322+License: Apache-2.0 or MIT
323+
324+Files: vendor/instant/*
325+Copyright: 2018 Sébastien Crozet <developer@crozet.re>
326+License: BSD-3-clause
327+
328+Files: vendor/once_cell/*
329+Copyright: 2018 Aleksey Kladov <aleksey.kladov@gmail.com>
330+License: Apache-2.0 or MIT
331+
332+Files: vendor/os_str_bytes/*
333+Copyright: 2019 dylni
334+License: Apache-2.0 or MIT
335+
336+Files: vendor/unicode-ident/*
337+Copyright:
338+ 2018 David Tolnay <dtolnay@gmail.com>
339+ 1991-2022 Unicode, Inc. All rights reserved.
340+License: Apache-2.0 or MIT, and Unicode
341+
342 License: LGPL-2.1
343 Licensed under the GNU Lesser General Public License aka LGPL v2.1.
344 See [COPYING](COPYING) for details.
345@@ -21,3 +275,179 @@ License: GPL-2
346 This software is released under the terms of the GNU General Public
347 License version 2, which on Debian systems can be found in the file
348 '/usr/share/common-licenses/GPL-2'.
349+
350+License: MIT
351+ Permission is hereby granted, free of charge, to any person obtaining a copy
352+ of this software and associated documentation files (the "Software"), to deal
353+ in the Software without restriction, including without limitation the rights
354+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
355+ copies of the Software, and to permit persons to whom the Software is
356+ furnished to do so, subject to the following conditions:
357+ .
358+ The above copyright notice and this permission notice shall be included in all
359+ copies or substantial portions of the Software.
360+ .
361+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
362+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
363+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
364+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
365+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
366+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
367+ SOFTWARE.
368+
369+License: Unlicense
370+ This is free and unencumbered software released into the public domain.
371+ .
372+ Anyone is free to copy, modify, publish, use, compile, sell, or
373+ distribute this software, either in source code form or as a compiled
374+ binary, for any purpose, commercial or non-commercial, and by any
375+ means.
376+ .
377+ In jurisdictions that recognize copyright laws, the author or authors
378+ of this software dedicate any and all copyright interest in the
379+ software to the public domain. We make this dedication for the benefit
380+ of the public at large and to the detriment of our heirs and
381+ successors. We intend this dedication to be an overt act of
382+ relinquishment in perpetuity of all present and future rights to this
383+ software under copyright law.
384+ .
385+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
386+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
387+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
388+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
389+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
390+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
391+ OTHER DEALINGS IN THE SOFTWARE.
392+
393+License: Apache-2.0
394+ Debian systems provide the Apache 2.0 license in
395+ /usr/share/common-licenses/Apache-2.0
396+
397+License: Unicode
398+ UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
399+ .
400+ Unicode Data Files include all data files under the directories
401+ http://www.unicode.org/Public/, http://www.unicode.org/reports/,
402+ http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and
403+ http://www.unicode.org/utility/trac/browser/.
404+ .
405+ Unicode Data Files do not include PDF online code charts under the
406+ directory http://www.unicode.org/Public/.
407+ .
408+ Software includes any source code published in the Unicode Standard
409+ or under the directories
410+ http://www.unicode.org/Public/, http://www.unicode.org/reports/,
411+ http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and
412+ http://www.unicode.org/utility/trac/browser/.
413+ .
414+ NOTICE TO USER: Carefully read the following legal agreement.
415+ BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
416+ DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
417+ YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
418+ TERMS AND CONDITIONS OF THIS AGREEMENT.
419+ IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
420+ THE DATA FILES OR SOFTWARE.
421+ .
422+ COPYRIGHT AND PERMISSION NOTICE
423+ .
424+ Copyright © 1991-2018 Unicode, Inc. All rights reserved.
425+ Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
426+ .
427+ Permission is hereby granted, free of charge, to any person obtaining
428+ a copy of the Unicode data files and any associated documentation
429+ (the "Data Files") or Unicode software and any associated documentation
430+ (the "Software") to deal in the Data Files or Software
431+ without restriction, including without limitation the rights to use,
432+ copy, modify, merge, publish, distribute, and/or sell copies of
433+ the Data Files or Software, and to permit persons to whom the Data Files
434+ or Software are furnished to do so, provided that either
435+ (a) this copyright and permission notice appear with all copies
436+ of the Data Files or Software, or
437+ (b) this copyright and permission notice appear in associated
438+ Documentation.
439+ .
440+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
441+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
442+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
443+ NONINFRINGEMENT OF THIRD PARTY RIGHTS.
444+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
445+ NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
446+ DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
447+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
448+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
449+ PERFORMANCE OF THE DATA FILES OR SOFTWARE.
450+ .
451+ Except as contained in this notice, the name of a copyright holder
452+ shall not be used in advertising or otherwise to promote the sale,
453+ use or other dealings in these Data Files or Software without prior
454+ written authorization of the copyright holder.
455+
456+License: BSL-1.0
457+ Boost Software License - Version 1.0 - August 17th, 2003
458+ .
459+ Permission is hereby granted, free of charge, to any person or organization
460+ obtaining a copy of the software and accompanying documentation covered by
461+ this license (the "Software") to use, reproduce, display, distribute,
462+ execute, and transmit the Software, and to prepare derivative works of the
463+ Software, and to permit third-parties to whom the Software is furnished to
464+ do so, all subject to the following:
465+ .
466+ The copyright notices in the Software and this entire statement, including
467+ the above license grant, this restriction and the following disclaimer,
468+ must be included in all copies of the Software, in whole or in part, and
469+ all derivative works of the Software, unless such copies or derivative
470+ works are solely in the form of machine-executable object code generated by
471+ a source language processor.
472+ .
473+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
474+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
475+ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
476+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
477+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
478+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
479+ DEALINGS IN THE SOFTWARE.
480+
481+License: APACHE-2-LLVM-EXCEPTIONS
482+ On Debian systems the full text of the Apache Software License 2.0 can be
483+ found in the `/usr/share/common-licenses/Apache-2.0' file.
484+ .
485+ ---- LLVM Exceptions to the Apache 2.0 License ----
486+ .
487+ As an exception, if, as a result of your compiling your source code, portions
488+ of this Software are embedded into an Object form of such source code, you
489+ may redistribute such embedded portions in such Object form without complying
490+ with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
491+ .
492+ In addition, if you combine or link compiled forms of this Software with
493+ software that is licensed under the GPLv2 ("Combined Software") and if a
494+ court of competent jurisdiction determines that the patent provision (Section
495+ 3), the indemnity provision (Section 9) or other Section of the License
496+ conflicts with the conditions of the GPLv2, you may retroactively and
497+ prospectively choose to deem waived or otherwise exclude such Section(s) of
498+ the License, but only in their entirety and only with respect to the Combined
499+ Software.
500+
501+License: BSD-3-clause
502+ Redistribution and use in source and binary forms, with or without
503+ modification, are permitted provided that the following conditions
504+ are met:
505+ 1. Redistributions of source code must retain the above copyright
506+ notice, this list of conditions and the following disclaimer.
507+ 2. Redistributions in binary form must reproduce the above copyright
508+ notice, this list of conditions and the following disclaimer in the
509+ documentation and/or other materials provided with the distribution.
510+ 3. Neither the name of the University nor the names of its contributors
511+ may be used to endorse or promote products derived from this software
512+ without specific prior written permission.
513+ .
514+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
515+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
516+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
517+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
518+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
519+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
520+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
521+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
522+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
523+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
524+ SUCH DAMAGE.
525diff --git a/debian/install b/debian/install
526new file mode 100644
527index 0000000..7f858c7
528--- /dev/null
529+++ b/debian/install
530@@ -0,0 +1 @@
531+Cargo.lock /usr/share/doc/mdevctl
532diff --git a/debian/patches/series b/debian/patches/series
533index f658191..7f0629b 100644
534--- a/debian/patches/series
535+++ b/debian/patches/series
536@@ -1,2 +1,2 @@
537-lower-versions-for-unstable.patch
538+# lower-versions-for-unstable.patch
539 main-binary-already-installed.patch
540diff --git a/debian/watch b/debian/watch
541index b30bd79..b6c4aee 100644
542--- a/debian/watch
543+++ b/debian/watch
544@@ -1,3 +1,5 @@
545 version=4
546 opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/mdevctl-$1\.tar\.gz/ \
547- https://github.com/mdevctl/mdevctl/tags .*/v?(\d\S+)\.tar\.gz
548+ https://github.com/mdevctl/mdevctl/releases/latest .*/v@ANY_VERSION@\.tar\.gz debian
549+opts=component=vendor \
550+ https://github.com/mdevctl/mdevctl/releases/latest .*/@PACKAGE@@ANY_VERSION@-vendor\.tar\.gz ignore
551diff --git a/vendor/aho-corasick/.cargo-checksum.json b/vendor/aho-corasick/.cargo-checksum.json
552new file mode 100644
553index 0000000..ec143d7
554--- /dev/null
555+++ b/vendor/aho-corasick/.cargo-checksum.json
556@@ -0,0 +1 @@
557+{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"f61283fd900435313b9ba8c1b87a4b5b31d442f9b554222136ec8d1d3d1e39d8","DESIGN.md":"9065f33d818d1562244d36dc4781e2a351108030cee17f11c2ba512ca7b4c27e","LICENSE-MIT":"0f96a83840e146e43c0ec96a22ec1f392e0680e6c1226e6f3ba87e0740af850f","README.md":"741e7249c8d1d6a7ba9341d68253dbf4952477c5620ff37c5325f2e894b148b6","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/ahocorasick.rs":"6fcbe812eec7af44b104c6b8a27b0a2ea8d67c3d9aec73cb69d802b30be5f005","src/automaton.rs":"610b3e2c104c51bf4f51a6d07626c3972e9d1274ca276e987385a231b284cc8b","src/buffer.rs":"dae7ee7c1f846ca9cf115ba4949484000e1837b4fb7311f8d8c9a35011c9c26f","src/byte_frequencies.rs":"2fb85b381c038c1e44ce94294531cdcd339dca48b1e61f41455666e802cbbc9e","src/classes.rs":"99a53a2ed8eea8c13699def90e31dfdff9d0b90572b1db3cb534e3396e7a0ed0","src/dfa.rs":"25e4455b3e179a7e192108d05f3683993456b36e3ebed99f827558c52525b7e6","src/error.rs":"d34c2c9c815df5d9dedc46b4b3ce109cd2cee07825de643f0c574ec960367beb","src/lib.rs":"f0c48b0ee093dd8b3034d025d052c3667860c5d4a196cb178588012b719acea4","src/nfa.rs":"2f443951c78196126bfd237ed5770a69077e6190daeecd47131339c25e51a3d0","src/packed/api.rs":"ec58ff1b4375dd4ff88fb5859c7ede994fe08d31b7d3677720a086592aa0fe53","src/packed/mod.rs":"d7ee11d487a7f129f16dc8f1473442a7127905933f378504bae83df0f23c5e2a","src/packed/pattern.rs":"3abf3835d4c4f8a43753c52936a894d819f713f233fc046e19de5ef95200dcce","src/packed/rabinkarp.rs":"caf9563b7442c9b75c9cb520fa236c7a6da8173705889b8d79b69ede14a20767","src/packed/teddy/README.md":"5819f40d221af93288e705eadef5393a41d7a0900881b4d676e01fd65d5adf15","src/packed/teddy/compile.rs":"aad40b3f93d2c388b409b31fb2795d414a365237789d5b1a7510d97ceb8ce260","src/packed/teddy/mod.rs":"83b52bd80272970ad17234d0db293d17c1710ec582302bf516b203c8edec037e","src/packed/teddy/runtime.rs":"836146e90b320b14fa2c65fe4af7915a41f6fb04408aac5fac731c22ff46adae","src/packed/tests.rs":"b8dc4d3281ecd6d0fa2bf7ef16cf292a467dfdce64e470c7921e983bfa60fee2","src/packed/vector.rs":"ab3c0535fca5f09198d58cbfae44c292aeb3ce44bc92bca36d30dc72963639fc","src/prefilter.rs":"82a3eb6d5c0c3f10bc8d5f57d55d6d14cf4cf21c475bb5253e1921084063b8d7","src/state_id.rs":"519ec8c7bf3fa72103d4c561c193759759f535dca924c9853efe630f406d2029","src/tests.rs":"6522ed1b244513c01de5bbcf0fe35571454fdea2c2a9d8dfe13a04bf57b70eca"},"package":"1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"}
558\ No newline at end of file
559diff --git a/vendor/aho-corasick/COPYING b/vendor/aho-corasick/COPYING
560new file mode 100644
561index 0000000..bb9c20a
562--- /dev/null
563+++ b/vendor/aho-corasick/COPYING
564@@ -0,0 +1,3 @@
565+This project is dual-licensed under the Unlicense and MIT licenses.
566+
567+You may use this code under the terms of either license.
568diff --git a/vendor/aho-corasick/Cargo.toml b/vendor/aho-corasick/Cargo.toml
569new file mode 100644
570index 0000000..62b5f7e
571--- /dev/null
572+++ b/vendor/aho-corasick/Cargo.toml
573@@ -0,0 +1,43 @@
574+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
575+#
576+# When uploading crates to the registry Cargo will automatically
577+# "normalize" Cargo.toml files for maximal compatibility
578+# with all versions of Cargo and also rewrite `path` dependencies
579+# to registry (e.g., crates.io) dependencies
580+#
581+# If you believe there's an error in this file please file an
582+# issue against the rust-lang/cargo repository. If you're
583+# editing this file be aware that the upstream Cargo.toml
584+# will likely look very different (and much more reasonable)
585+
586+[package]
587+edition = "2018"
588+name = "aho-corasick"
589+version = "0.7.18"
590+authors = ["Andrew Gallant <jamslam@gmail.com>"]
591+exclude = ["/aho-corasick-debug", "/ci/*", "/.travis.yml", "/appveyor.yml"]
592+autotests = false
593+description = "Fast multiple substring searching."
594+homepage = "https://github.com/BurntSushi/aho-corasick"
595+readme = "README.md"
596+keywords = ["string", "search", "text", "aho", "multi"]
597+categories = ["text-processing"]
598+license = "Unlicense/MIT"
599+repository = "https://github.com/BurntSushi/aho-corasick"
600+[profile.bench]
601+debug = true
602+
603+[profile.release]
604+debug = true
605+
606+[lib]
607+name = "aho_corasick"
608+[dependencies.memchr]
609+version = "2.4.0"
610+default-features = false
611+
612+[dev-dependencies]
613+
614+[features]
615+default = ["std"]
616+std = ["memchr/std"]
617diff --git a/vendor/aho-corasick/DESIGN.md b/vendor/aho-corasick/DESIGN.md
618new file mode 100644
619index 0000000..367e203
620--- /dev/null
621+++ b/vendor/aho-corasick/DESIGN.md
622@@ -0,0 +1,483 @@
623+This document describes the internal design of this crate, which is an object
624+lesson in what happens when you take a fairly simple old algorithm like
625+Aho-Corasick and make it fast and production ready.
626+
627+The target audience of this document is Rust programmers that have some
628+familiarity with string searching, however, one does not need to know the
629+Aho-Corasick algorithm in order to read this (it is explained below). One
630+should, however, know what a trie is. (If you don't, go read its Wikipedia
631+article.)
632+
633+The center-piece of this crate is an implementation of Aho-Corasick. On its
634+own, Aho-Corasick isn't that complicated. The complex pieces come from the
635+different variants of Aho-Corasick implemented in this crate. Specifically,
636+they are:
637+
638+* Aho-Corasick as an NFA, using dense transitions near the root with sparse
639+ transitions elsewhere.
640+* Aho-Corasick as a DFA. (An NFA is slower to search, but cheaper to construct
641+ and uses less memory.)
642+ * A DFA with pre-multiplied state identifiers. This saves a multiplication
643+ instruction in the core search loop.
644+ * A DFA with equivalence classes of bytes as the alphabet, instead of the
645+ traditional 256-byte alphabet. This shrinks the size of the DFA in memory,
646+ but adds an extra lookup in the core search loop to map the input byte to
647+ an equivalent class.
648+* The option to choose how state identifiers are represented, via one of
649+ u8, u16, u32, u64 or usize. This permits creating compact automatons when
650+ matching a small number of patterns.
651+* Supporting "standard" match semantics, along with its overlapping variant,
652+ in addition to leftmost-first and leftmost-longest semantics. The "standard"
653+ semantics are typically what you see in a textbook description of
654+ Aho-Corasick. However, Aho-Corasick is also useful as an optimization in
655+ regex engines, which often use leftmost-first or leftmost-longest semantics.
656+ Thus, it is useful to implement those semantics here. The "standard" and
657+ "leftmost" search algorithms are subtly different, and also require slightly
658+ different construction algorithms.
659+* Support for ASCII case insensitive matching.
660+* Support for accelerating searches when the patterns all start with a small
661+ number of fixed bytes. Or alternatively, when the patterns all contain a
662+ small number of rare bytes. (Searching for these bytes uses SIMD vectorized
663+ code courtesy of `memchr`.)
664+* Transparent support for alternative SIMD vectorized search routines for
665+ smaller number of literals, such as the Teddy algorithm. We called these
666+ "packed" search routines because they use SIMD. They can often be an order of
667+ magnitude faster than just Aho-Corasick, but don't scale as well.
668+* Support for searching streams. This can reuse most of the underlying code,
669+ but does require careful buffering support.
670+* Support for anchored searches, which permit efficient `is_prefix` checks for
671+ a large number of patterns.
672+
673+When you combine all of this together along with trying to make everything as
674+fast as possible, what you end up with is enitrely too much code with too much
675+`unsafe`. Alas, I was not smart enough to figure out how to reduce it. Instead,
676+we will explain it.
677+
678+
679+# Basics
680+
681+The fundamental problem this crate is trying to solve is to determine the
682+occurrences of possibly many patterns in a haystack. The naive way to solve
683+this is to look for a match for each pattern at each position in the haystack:
684+
685+ for i in 0..haystack.len():
686+ for p in patterns.iter():
687+ if haystack[i..].starts_with(p.bytes()):
688+ return Match(p.id(), i, i + p.bytes().len())
689+
690+Those four lines are effectively all this crate does. The problem with those
691+four lines is that they are very slow, especially when you're searching for a
692+large number of patterns.
693+
694+While there are many different algorithms available to solve this, a popular
695+one is Aho-Corasick. It's a common solution because it's not too hard to
696+implement, scales quite well even when searching for thousands of patterns and
697+is generally pretty fast. Aho-Corasick does well here because, regardless of
698+the number of patterns you're searching for, it always visits each byte in the
699+haystack exactly once. This means, generally speaking, adding more patterns to
700+an Aho-Corasick automaton does not make it slower. (Strictly speaking, however,
701+this is not true, since a larger automaton will make less effective use of the
702+CPU's cache.)
703+
704+Aho-Corasick can be succinctly described as a trie with state transitions
705+between some of the nodes that efficiently instruct the search algorithm to
706+try matching alternative keys in the automaton. The trick is that these state
707+transitions are arranged such that each byte of input needs to be inspected
708+only once. These state transitions are typically called "failure transitions,"
709+because they instruct the searcher (the thing traversing the automaton while
710+reading from the haystack) what to do when a byte in the haystack does not
711+correspond to a valid transition in the current state of the trie.
712+
713+More formally, a failure transition points to a state in the automaton that may
714+lead to a match whose prefix is a proper suffix of the path traversed through
715+the trie so far. (If no such proper suffix exists, then the failure transition
716+points back to the start state of the trie, effectively restarting the search.)
717+This is perhaps simpler to explain pictorally. For example, let's say we built
718+an Aho-Corasick automaton with the following patterns: 'abcd' and 'cef'. The
719+trie looks like this:
720+
721+ a - S1 - b - S2 - c - S3 - d - S4*
722+ /
723+ S0 - c - S5 - e - S6 - f - S7*
724+
725+where states marked with a `*` are match states (meaning, the search algorithm
726+should stop and report a match to the caller).
727+
728+So given this trie, it should be somewhat straight-forward to see how it can
729+be used to determine whether any particular haystack *starts* with either
730+`abcd` or `cef`. It's easy to express this in code:
731+
732+ fn has_prefix(trie: &Trie, haystack: &[u8]) -> bool {
733+ let mut state_id = trie.start();
734+ // If the empty pattern is in trie, then state_id is a match state.
735+ if trie.is_match(state_id) {
736+ return true;
737+ }
738+ for (i, &b) in haystack.iter().enumerate() {
739+ state_id = match trie.next_state(state_id, b) {
740+ Some(id) => id,
741+ // If there was no transition for this state and byte, then we know
742+ // the haystack does not start with one of the patterns in our trie.
743+ None => return false,
744+ };
745+ if trie.is_match(state_id) {
746+ return true;
747+ }
748+ }
749+ false
750+ }
751+
752+And that's pretty much it. All we do is move through the trie starting with the
753+bytes at the beginning of the haystack. If we find ourselves in a position
754+where we can't move, or if we've looked through the entire haystack without
755+seeing a match state, then we know the haystack does not start with any of the
756+patterns in the trie.
757+
758+The meat of the Aho-Corasick algorithm is in how we add failure transitions to
759+our trie to keep searching efficient. Specifically, it permits us to not only
760+check whether a haystack *starts* with any one of a number of patterns, but
761+rather, whether the haystack contains any of a number of patterns *anywhere* in
762+the haystack.
763+
764+As mentioned before, failure transitions connect a proper suffix of the path
765+traversed through the trie before, with a path that leads to a match that has a
766+prefix corresponding to that proper suffix. So in our case, for patterns `abcd`
767+and `cef`, with a haystack `abcef`, we want to transition to state `S5` (from
768+the diagram above) from `S3` upon seeing that the byte following `c` is not
769+`d`. Namely, the proper suffix in this example is `c`, which is a prefix of
770+`cef`. So the modified diagram looks like this:
771+
772+
773+ a - S1 - b - S2 - c - S3 - d - S4*
774+ / /
775+ / ----------------
776+ / /
777+ S0 - c - S5 - e - S6 - f - S7*
778+
779+One thing that isn't shown in this diagram is that *all* states have a failure
780+transition, but only `S3` has a *non-trivial* failure transition. That is, all
781+other states have a failure transition back to the start state. So if our
782+haystack was `abzabcd`, then the searcher would transition back to `S0` after
783+seeing `z`, which effectively restarts the search. (Because there is no pattern
784+in our trie that has a prefix of `bz` or `z`.)
785+
786+The code for traversing this *automaton* or *finite state machine* (it is no
787+longer just a trie) is not that much different from the `has_prefix` code
788+above:
789+
790+ fn contains(fsm: &FiniteStateMachine, haystack: &[u8]) -> bool {
791+ let mut state_id = fsm.start();
792+ // If the empty pattern is in fsm, then state_id is a match state.
793+ if fsm.is_match(state_id) {
794+ return true;
795+ }
796+ for (i, &b) in haystack.iter().enumerate() {
797+ // While the diagram above doesn't show this, we may wind up needing
798+ // to follow multiple failure transitions before we land on a state
799+ // in which we can advance. Therefore, when searching for the next
800+ // state, we need to loop until we don't see a failure transition.
801+ //
802+ // This loop terminates because the start state has no empty
803+ // transitions. Every transition from the start state either points to
804+ // another state, or loops back to the start state.
805+ loop {
806+ match fsm.next_state(state_id, b) {
807+ Some(id) => {
808+ state_id = id;
809+ break;
810+ }
811+ // Unlike our code above, if there was no transition for this
812+ // state, then we don't quit. Instead, we look for this state's
813+ // failure transition and follow that instead.
814+ None => {
815+ state_id = fsm.next_fail_state(state_id);
816+ }
817+ };
818+ }
819+ if fsm.is_match(state_id) {
820+ return true;
821+ }
822+ }
823+ false
824+ }
825+
826+Other than the complication around traversing failure transitions, this code
827+is still roughly "traverse the automaton with bytes from the haystack, and quit
828+when a match is seen."
829+
830+And that concludes our section on the basics. While we didn't go deep into
831+how the automaton is built (see `src/nfa.rs`, which has detailed comments about
832+that), the basic structure of Aho-Corasick should be reasonably clear.
833+
834+
835+# NFAs and DFAs
836+
837+There are generally two types of finite automata: non-deterministic finite
838+automata (NFA) and deterministic finite automata (DFA). The difference between
839+them is, principally, that an NFA can be in multiple states at once. This is
840+typically accomplished by things called _epsilon_ transitions, where one could
841+move to a new state without consuming any bytes from the input. (The other
842+mechanism by which NFAs can be in more than one state is where the same byte in
843+a particular state transitions to multiple distinct states.) In contrast, a DFA
844+can only ever be in one state at a time. A DFA has no epsilon transitions, and
845+for any given state, a byte transitions to at most one other state.
846+
847+By this formulation, the Aho-Corasick automaton described in the previous
848+section is an NFA. This is because failure transitions are, effectively,
849+epsilon transitions. That is, whenever the automaton is in state `S`, it is
850+actually in the set of states that are reachable by recursively following
851+failure transitions from `S`. (This means that, for example, the start state
852+is always active since the start state is reachable via failure transitions
853+from any state in the automaton.)
854+
855+NFAs have a lot of nice properties. They tend to be easier to construct, and
856+also tend to use less memory. However, their primary downside is that they are
857+typically slower to execute. For example, the code above showing how to search
858+with an Aho-Corasick automaton needs to potentially iterate through many
859+failure transitions for every byte of input. While this is a fairly small
860+amount of overhead, this can add up, especially if the automaton has a lot of
861+overlapping patterns with a lot of failure transitions.
862+
863+A DFA's search code, by contrast, looks like this:
864+
865+ fn contains(dfa: &DFA, haystack: &[u8]) -> bool {
866+ let mut state_id = dfa.start();
867+ // If the empty pattern is in dfa, then state_id is a match state.
868+ if dfa.is_match(state_id) {
869+ return true;
870+ }
871+ for (i, &b) in haystack.iter().enumerate() {
872+ // An Aho-Corasick DFA *never* has a missing state that requires
873+ // failure transitions to be followed. One byte of input advances the
874+ // automaton by one state. Always.
875+ state_id = trie.next_state(state_id, b);
876+ if fsm.is_match(state_id) {
877+ return true;
878+ }
879+ }
880+ false
881+ }
882+
883+The search logic here is much simpler than for the NFA, and this tends to
884+translate into significant performance benefits as well, since there's a lot
885+less work being done for each byte in the haystack. How is this accomplished?
886+It's done by pre-following all failure transitions for all states for all bytes
887+in the alphabet, and then building a single state transition table. Building
888+this DFA can be much more costly than building the NFA, and use much more
889+memory, but the better performance can be worth it.
890+
891+Users of this crate can actually choose between using an NFA or a DFA. By
892+default, an NFA is used, because it typically strikes the best balance between
893+space usage and search performance. But the DFA option is available for cases
894+where a little extra memory and upfront time building the automaton is okay.
895+For example, the `AhoCorasick::auto_configure` and
896+`AhoCorasickBuilder::auto_configure` methods will enable the DFA setting if
897+there are a small number of patterns.
898+
899+
900+# More DFA tricks
901+
902+As described in the previous section, one of the downsides of using a DFA
903+is that is uses more memory and can take longer to build. One small way of
904+mitigating these concerns is to map the alphabet used by the automaton into
905+a smaller space. Typically, the alphabet of a DFA has 256 elements in it:
906+one element for each possible value that fits into a byte. However, in many
907+cases, one does not need the full alphabet. For example, if all patterns in an
908+Aho-Corasick automaton are ASCII letters, then this only uses up 52 distinct
909+bytes. As far as the automaton is concerned, the rest of the 204 bytes are
910+indistinguishable from one another: they will never disrciminate between a
911+match or a non-match. Therefore, in cases like that, the alphabet can be shrunk
912+to just 53 elements. One for each ASCII letter, and then another to serve as a
913+placeholder for every other unused byte.
914+
915+In practice, this library doesn't quite compute the optimal set of equivalence
916+classes, but it's close enough in most cases. The key idea is that this then
917+allows the transition table for the DFA to be potentially much smaller. The
918+downside of doing this, however, is that since the transition table is defined
919+in terms of this smaller alphabet space, every byte in the haystack must be
920+re-mapped to this smaller space. This requires an additional 256-byte table.
921+In practice, this can lead to a small search time hit, but it can be difficult
922+to measure. Moreover, it can sometimes lead to faster search times for bigger
923+automata, since it could be difference between more parts of the automaton
924+staying in the CPU cache or not.
925+
926+One other trick for DFAs employed by this crate is the notion of premultiplying
927+state identifiers. Specifically, the normal way to compute the next transition
928+in a DFA is via the following (assuming that the transition table is laid out
929+sequentially in memory, in row-major order, where the rows are states):
930+
931+ next_state_id = dfa.transitions[current_state_id * 256 + current_byte]
932+
933+However, since the value `256` is a fixed constant, we can actually premultiply
934+the state identifiers in the table when we build the table initially. Then, the
935+next transition computation simply becomes:
936+
937+ next_state_id = dfa.transitions[current_state_id + current_byte]
938+
939+This doesn't seem like much, but when this is being executed for every byte of
940+input that you're searching, saving that extra multiplication instruction can
941+add up.
942+
943+The same optimization works even when equivalence classes are enabled, as
944+described above. The only difference is that the premultiplication is by the
945+total number of equivalence classes instead of 256.
946+
947+There isn't much downside to premultiplying state identifiers, other than the
948+fact that you may need to choose a bigger integer representation than you would
949+otherwise. For example, if you don't premultiply state identifiers, then an
950+automaton that uses `u8` as a state identifier can hold up to 256 states.
951+However, if they are premultiplied, then it can only hold up to
952+`floor(256 / len(alphabet))` states. Thus premultiplication impacts how compact
953+your DFA can be. In practice, it's pretty rare to use `u8` as a state
954+identifier, so premultiplication is usually a good thing to do.
955+
956+Both equivalence classes and premultiplication are tuneable parameters via the
957+`AhoCorasickBuilder` type, and both are enabled by default.
958+
959+
960+# Match semantics
961+
962+One of the more interesting things about this implementation of Aho-Corasick
963+that (as far as this author knows) separates it from other implementations, is
964+that it natively supports leftmost-first and leftmost-longest match semantics.
965+Briefly, match semantics refer to the decision procedure by which searching
966+will disambiguate matches when there are multiple to choose from:
967+
968+* **standard** match semantics emits matches as soon as they are detected by
969+ the automaton. This is typically equivalent to the textbook non-overlapping
970+ formulation of Aho-Corasick.
971+* **leftmost-first** match semantics means that 1) the next match is the match
972+ starting at the leftmost position and 2) among multiple matches starting at
973+ the same leftmost position, the match corresponding to the pattern provided
974+ first by the caller is reported.
975+* **leftmost-longest** is like leftmost-first, except when there are multiple
976+ matches starting at the same leftmost position, the pattern corresponding to
977+ the longest match is returned.
978+
979+(The crate API documentation discusses these differences, with examples, in
980+more depth on the `MatchKind` type.)
981+
982+The reason why supporting these match semantics is important is because it
983+gives the user more control over the match procedure. For example,
984+leftmost-first permits users to implement match priority by simply putting the
985+higher priority patterns first. Leftmost-longest, on the other hand, permits
986+finding the longest possible match, which might be useful when trying to find
987+words matching a dictionary. Additionally, regex engines often want to use
988+Aho-Corasick as an optimization when searching for an alternation of literals.
989+In order to preserve correct match semantics, regex engines typically can't use
990+the standard textbook definition directly, since regex engines will implement
991+either leftmost-first (Perl-like) or leftmost-longest (POSIX) match semantics.
992+
993+Supporting leftmost semantics requires a couple key changes:
994+
995+* Constructing the Aho-Corasick automaton changes a bit in both how the trie is
996+ constructed and how failure transitions are found. Namely, only a subset of
997+ the failure transitions are added. Specifically, only the failure transitions
998+ that either do not occur after a match or do occur after a match but preserve
999+ that match are kept. (More details on this can be found in `src/nfa.rs`.)
1000+* The search algorithm changes slightly. Since we are looking for the leftmost
1001+ match, we cannot quit as soon as a match is detected. Instead, after a match
1002+ is detected, we must keep searching until either the end of the input or
1003+ until a dead state is seen. (Dead states are not used for standard match
1004+ semantics. Dead states mean that searching should stop after a match has been
1005+ found.)
1006+
1007+Other implementations of Aho-Corasick do support leftmost match semantics, but
1008+they do it with more overhead at search time, or even worse, with a queue of
1009+matches and sophisticated hijinks to disambiguate the matches. While our
1010+construction algorithm becomes a bit more complicated, the correct match
1011+semantics fall out from the structure of the automaton itself.
1012+
1013+
1014+# Overlapping matches
1015+
1016+One of the nice properties of an Aho-Corasick automaton is that it can report
1017+all possible matches, even when they overlap with one another. In this mode,
1018+the match semantics don't matter, since all possible matches are reported.
1019+Overlapping searches work just like regular searches, except the state
1020+identifier at which the previous search left off is carried over to the next
1021+search, so that it can pick up where it left off. If there are additional
1022+matches at that state, then they are reported before resuming the search.
1023+
1024+Enabling leftmost-first or leftmost-longest match semantics causes the
1025+automaton to use a subset of all failure transitions, which means that
1026+overlapping searches cannot be used. Therefore, if leftmost match semantics are
1027+used, attempting to do an overlapping search will panic. Thus, to get
1028+overlapping searches, the caller must use the default standard match semantics.
1029+This behavior was chosen because there are only two alternatives, which were
1030+deemed worse:
1031+
1032+* Compile two automatons internally, one for standard semantics and one for
1033+ the semantics requested by the caller (if not standard).
1034+* Create a new type, distinct from the `AhoCorasick` type, which has different
1035+ capabilities based on the configuration options.
1036+
1037+The first is untenable because of the amount of memory used by the automaton.
1038+The second increases the complexity of the API too much by adding too many
1039+types that do similar things. It is conceptually much simpler to keep all
1040+searching isolated to a single type. Callers may query whether the automaton
1041+supports overlapping searches via the `AhoCorasick::supports_overlapping`
1042+method.
1043+
1044+
1045+# Stream searching
1046+
1047+Since Aho-Corasick is an automaton, it is possible to do partial searches on
1048+partial parts of the haystack, and then resume that search on subsequent pieces
1049+of the haystack. This is useful when the haystack you're trying to search is
1050+not stored contiguous in memory, or if one does not want to read the entire
1051+haystack into memory at once.
1052+
1053+Currently, only standard semantics are supported for stream searching. This is
1054+some of the more complicated code in this crate, and is something I would very
1055+much like to improve. In particular, it currently has the restriction that it
1056+must buffer at least enough of the haystack in memory in order to fit the
1057+longest possible match. The difficulty in getting stream searching right is
1058+that the implementation choices (such as the buffer size) often impact what the
1059+API looks like and what it's allowed to do.
1060+
1061+
1062+# Prefilters
1063+
1064+In some cases, Aho-Corasick is not the fastest way to find matches containing
1065+multiple patterns. Sometimes, the search can be accelerated using highly
1066+optimized SIMD routines. For example, consider searching the following
1067+patterns:
1068+
1069+ Sherlock
1070+ Moriarty
1071+ Watson
1072+
1073+It is plausible that it would be much faster to quickly look for occurrences of
1074+the leading bytes, `S`, `M` or `W`, before trying to start searching via the
1075+automaton. Indeed, this is exactly what this crate will do.
1076+
1077+When there are more than three distinct starting bytes, then this crate will
1078+look for three distinct bytes occurring at any position in the patterns, while
1079+preferring bytes that are heuristically determined to be rare over others. For
1080+example:
1081+
1082+ Abuzz
1083+ Sanchez
1084+ Vasquez
1085+ Topaz
1086+ Waltz
1087+
1088+Here, we have more than 3 distinct starting bytes, but all of the patterns
1089+contain `z`, which is typically a rare byte. In this case, the prefilter will
1090+scan for `z`, back up a bit, and then execute the Aho-Corasick automaton.
1091+
1092+If all of that fails, then a packed multiple substring algorithm will be
1093+attempted. Currently, the only algorithm available for this is Teddy, but more
1094+may be added in the future. Teddy is unlike the above prefilters in that it
1095+confirms its own matches, so when Teddy is active, it might not be necessary
1096+for Aho-Corasick to run at all. (See `Automaton::leftmost_find_at_no_state_imp`
1097+in `src/automaton.rs`.) However, the current Teddy implementation only works
1098+in `x86_64` and when SSSE3 or AVX2 are available, and moreover, only works
1099+_well_ when there are a small number of patterns (say, less than 100). Teddy
1100+also requires the haystack to be of a certain length (more than 16-34 bytes).
1101+When the haystack is shorter than that, Rabin-Karp is used instead. (See
1102+`src/packed/rabinkarp.rs`.)
1103+
1104+There is a more thorough description of Teddy at
1105+[`src/packed/teddy/README.md`](src/packed/teddy/README.md).
1106diff --git a/vendor/aho-corasick/LICENSE-MIT b/vendor/aho-corasick/LICENSE-MIT
1107new file mode 100644
1108index 0000000..3b0a5dc
1109--- /dev/null
1110+++ b/vendor/aho-corasick/LICENSE-MIT
1111@@ -0,0 +1,21 @@
1112+The MIT License (MIT)
1113+
1114+Copyright (c) 2015 Andrew Gallant
1115+
1116+Permission is hereby granted, free of charge, to any person obtaining a copy
1117+of this software and associated documentation files (the "Software"), to deal
1118+in the Software without restriction, including without limitation the rights
1119+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1120+copies of the Software, and to permit persons to whom the Software is
1121+furnished to do so, subject to the following conditions:
1122+
1123+The above copyright notice and this permission notice shall be included in
1124+all copies or substantial portions of the Software.
1125+
1126+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1127+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1128+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1129+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1130+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1131+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1132+THE SOFTWARE.
1133diff --git a/vendor/aho-corasick/README.md b/vendor/aho-corasick/README.md
1134new file mode 100644
1135index 0000000..cd43051
1136--- /dev/null
1137+++ b/vendor/aho-corasick/README.md
1138@@ -0,0 +1,181 @@
1139+aho-corasick
1140+============
1141+A library for finding occurrences of many patterns at once with SIMD
1142+acceleration in some cases. This library provides multiple pattern
1143+search principally through an implementation of the
1144+[Aho-Corasick algorithm](https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm),
1145+which builds a finite state machine for executing searches in linear time.
1146+Features include case insensitive matching, overlapping matches, fast searching
1147+via SIMD and optional full DFA construction and search & replace in streams.
1148+
1149+[![Build status](https://github.com/BurntSushi/aho-corasick/workflows/ci/badge.svg)](https://github.com/BurntSushi/aho-corasick/actions)
1150+[![](http://meritbadge.herokuapp.com/aho-corasick)](https://crates.io/crates/aho-corasick)
1151+
1152+Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).
1153+
1154+
1155+### Documentation
1156+
1157+https://docs.rs/aho-corasick
1158+
1159+
1160+### Usage
1161+
1162+Add this to your `Cargo.toml`:
1163+
1164+```toml
1165+[dependencies]
1166+aho-corasick = "0.7"
1167+```
1168+
1169+
1170+### Example: basic searching
1171+
1172+This example shows how to search for occurrences of multiple patterns
1173+simultaneously. Each match includes the pattern that matched along with the
1174+byte offsets of the match.
1175+
1176+```rust
1177+use aho_corasick::AhoCorasick;
1178+
1179+let patterns = &["apple", "maple", "Snapple"];
1180+let haystack = "Nobody likes maple in their apple flavored Snapple.";
1181+
1182+let ac = AhoCorasick::new(patterns);
1183+let mut matches = vec![];
1184+for mat in ac.find_iter(haystack) {
1185+ matches.push((mat.pattern(), mat.start(), mat.end()));
1186+}
1187+assert_eq!(matches, vec![
1188+ (1, 13, 18),
1189+ (0, 28, 33),
1190+ (2, 43, 50),
1191+]);
1192+```
1193+
1194+
1195+### Example: case insensitivity
1196+
1197+This is like the previous example, but matches `Snapple` case insensitively
1198+using `AhoCorasickBuilder`:
1199+
1200+```rust
1201+use aho_corasick::AhoCorasickBuilder;
1202+
1203+let patterns = &["apple", "maple", "snapple"];
1204+let haystack = "Nobody likes maple in their apple flavored Snapple.";
1205+
1206+let ac = AhoCorasickBuilder::new()
1207+ .ascii_case_insensitive(true)
1208+ .build(patterns);
1209+let mut matches = vec![];
1210+for mat in ac.find_iter(haystack) {
1211+ matches.push((mat.pattern(), mat.start(), mat.end()));
1212+}
1213+assert_eq!(matches, vec![
1214+ (1, 13, 18),
1215+ (0, 28, 33),
1216+ (2, 43, 50),
1217+]);
1218+```
1219+
1220+
1221+### Example: replacing matches in a stream
1222+
1223+This example shows how to execute a search and replace on a stream without
1224+loading the entire stream into memory first.
1225+
1226+```rust
1227+use aho_corasick::AhoCorasick;
1228+
1229+let patterns = &["fox", "brown", "quick"];
1230+let replace_with = &["sloth", "grey", "slow"];
1231+
1232+// In a real example, these might be `std::fs::File`s instead. All you need to
1233+// do is supply a pair of `std::io::Read` and `std::io::Write` implementations.
1234+let rdr = "The quick brown fox.";
1235+let mut wtr = vec![];
1236+
1237+let ac = AhoCorasick::new(patterns);
1238+ac.stream_replace_all(rdr.as_bytes(), &mut wtr, replace_with)
1239+ .expect("stream_replace_all failed");
1240+assert_eq!(b"The slow grey sloth.".to_vec(), wtr);
1241+```
1242+
1243+
1244+### Example: finding the leftmost first match
1245+
1246+In the textbook description of Aho-Corasick, its formulation is typically
1247+structured such that it reports all possible matches, even when they overlap
1248+with another. In many cases, overlapping matches may not be desired, such as
1249+the case of finding all successive non-overlapping matches like you might with
1250+a standard regular expression.
1251+
1252+Unfortunately the "obvious" way to modify the Aho-Corasick algorithm to do
1253+this doesn't always work in the expected way, since it will report matches as
1254+soon as they are seen. For example, consider matching the regex `Samwise|Sam`
1255+against the text `Samwise`. Most regex engines (that are Perl-like, or
1256+non-POSIX) will report `Samwise` as a match, but the standard Aho-Corasick
1257+algorithm modified for reporting non-overlapping matches will report `Sam`.
1258+
1259+A novel contribution of this library is the ability to change the match
1260+semantics of Aho-Corasick (without additional search time overhead) such that
1261+`Samwise` is reported instead. For example, here's the standard approach:
1262+
1263+```rust
1264+use aho_corasick::AhoCorasick;
1265+
1266+let patterns = &["Samwise", "Sam"];
1267+let haystack = "Samwise";
1268+
1269+let ac = AhoCorasick::new(patterns);
1270+let mat = ac.find(haystack).expect("should have a match");
1271+assert_eq!("Sam", &haystack[mat.start()..mat.end()]);
1272+```
1273+
1274+And now here's the leftmost-first version, which matches how a Perl-like
1275+regex will work:
1276+
1277+```rust
1278+use aho_corasick::{AhoCorasickBuilder, MatchKind};
1279+
1280+let patterns = &["Samwise", "Sam"];
1281+let haystack = "Samwise";
1282+
1283+let ac = AhoCorasickBuilder::new()
1284+ .match_kind(MatchKind::LeftmostFirst)
1285+ .build(patterns);
1286+let mat = ac.find(haystack).expect("should have a match");
1287+assert_eq!("Samwise", &haystack[mat.start()..mat.end()]);
1288+```
1289+
1290+In addition to leftmost-first semantics, this library also supports
1291+leftmost-longest semantics, which match the POSIX behavior of a regular
1292+expression alternation. See `MatchKind` in the docs for more details.
1293+
1294+
1295+### Minimum Rust version policy
1296+
1297+This crate's minimum supported `rustc` version is `1.41.1`.
1298+
1299+The current policy is that the minimum Rust version required to use this crate
1300+can be increased in minor version updates. For example, if `crate 1.0` requires
1301+Rust 1.20.0, then `crate 1.0.z` for all values of `z` will also require Rust
1302+1.20.0 or newer. However, `crate 1.y` for `y > 0` may require a newer minimum
1303+version of Rust.
1304+
1305+In general, this crate will be conservative with respect to the minimum
1306+supported version of Rust.
1307+
1308+
1309+### Future work
1310+
1311+Here are some plans for the future:
1312+
1313+* Assuming the current API is sufficient, I'd like to commit to it and release
1314+ a `1.0` version of this crate some time in the next 6-12 months.
1315+* Support stream searching with leftmost match semantics. Currently, only
1316+ standard match semantics are supported. Getting this right seems possible,
1317+ but is tricky since the match state needs to be propagated through multiple
1318+ searches. (With standard semantics, as soon as a match is seen the search
1319+ ends.)
1320diff --git a/vendor/aho-corasick/UNLICENSE b/vendor/aho-corasick/UNLICENSE
1321new file mode 100644
1322index 0000000..68a49da
1323--- /dev/null
1324+++ b/vendor/aho-corasick/UNLICENSE
1325@@ -0,0 +1,24 @@
1326+This is free and unencumbered software released into the public domain.
1327+
1328+Anyone is free to copy, modify, publish, use, compile, sell, or
1329+distribute this software, either in source code form or as a compiled
1330+binary, for any purpose, commercial or non-commercial, and by any
1331+means.
1332+
1333+In jurisdictions that recognize copyright laws, the author or authors
1334+of this software dedicate any and all copyright interest in the
1335+software to the public domain. We make this dedication for the benefit
1336+of the public at large and to the detriment of our heirs and
1337+successors. We intend this dedication to be an overt act of
1338+relinquishment in perpetuity of all present and future rights to this
1339+software under copyright law.
1340+
1341+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1342+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1343+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
1344+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
1345+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1346+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1347+OTHER DEALINGS IN THE SOFTWARE.
1348+
1349+For more information, please refer to <http://unlicense.org/>
1350diff --git a/vendor/aho-corasick/rustfmt.toml b/vendor/aho-corasick/rustfmt.toml
1351new file mode 100644
1352index 0000000..aa37a21
1353--- /dev/null
1354+++ b/vendor/aho-corasick/rustfmt.toml
1355@@ -0,0 +1,2 @@
1356+max_width = 79
1357+use_small_heuristics = "max"
1358diff --git a/vendor/aho-corasick/src/ahocorasick.rs b/vendor/aho-corasick/src/ahocorasick.rs
1359new file mode 100644
1360index 0000000..2b1aa5c
1361--- /dev/null
1362+++ b/vendor/aho-corasick/src/ahocorasick.rs
1363@@ -0,0 +1,2143 @@
1364+use std::io;
1365+
1366+use crate::automaton::Automaton;
1367+use crate::buffer::Buffer;
1368+use crate::dfa::{self, DFA};
1369+use crate::error::Result;
1370+use crate::nfa::{self, NFA};
1371+use crate::packed;
1372+use crate::prefilter::{Prefilter, PrefilterState};
1373+use crate::state_id::StateID;
1374+use crate::Match;
1375+
1376+/// An automaton for searching multiple strings in linear time.
1377+///
1378+/// The `AhoCorasick` type supports a few basic ways of constructing an
1379+/// automaton, including
1380+/// [`AhoCorasick::new`](struct.AhoCorasick.html#method.new)
1381+/// and
1382+/// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured).
1383+/// However, there are a fair number of configurable options that can be set
1384+/// by using
1385+/// [`AhoCorasickBuilder`](struct.AhoCorasickBuilder.html)
1386+/// instead. Such options include, but are not limited to, how matches are
1387+/// determined, simple case insensitivity, whether to use a DFA or not and
1388+/// various knobs for controlling the space-vs-time trade offs taken when
1389+/// building the automaton.
1390+///
1391+/// If you aren't sure where to start, try beginning with
1392+/// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured).
1393+///
1394+/// # Resource usage
1395+///
1396+/// Aho-Corasick automatons are always constructed in `O(p)` time, where `p`
1397+/// is the combined length of all patterns being searched. With that said,
1398+/// building an automaton can be fairly costly because of high constant
1399+/// factors, particularly when enabling the
1400+/// [DFA](struct.AhoCorasickBuilder.html#method.dfa)
1401+/// option (which is disabled by default). For this reason, it's generally a
1402+/// good idea to build an automaton once and reuse it as much as possible.
1403+///
1404+/// Aho-Corasick automatons can also use a fair bit of memory. To get a
1405+/// concrete idea of how much memory is being used, try using the
1406+/// [`AhoCorasick::heap_bytes`](struct.AhoCorasick.html#method.heap_bytes)
1407+/// method.
1408+///
1409+/// # Examples
1410+///
1411+/// This example shows how to search for occurrences of multiple patterns
1412+/// simultaneously in a case insensitive fashion. Each match includes the
1413+/// pattern that matched along with the byte offsets of the match.
1414+///
1415+/// ```
1416+/// use aho_corasick::AhoCorasickBuilder;
1417+///
1418+/// let patterns = &["apple", "maple", "snapple"];
1419+/// let haystack = "Nobody likes maple in their apple flavored Snapple.";
1420+///
1421+/// let ac = AhoCorasickBuilder::new()
1422+/// .ascii_case_insensitive(true)
1423+/// .build(patterns);
1424+/// let mut matches = vec![];
1425+/// for mat in ac.find_iter(haystack) {
1426+/// matches.push((mat.pattern(), mat.start(), mat.end()));
1427+/// }
1428+/// assert_eq!(matches, vec![
1429+/// (1, 13, 18),
1430+/// (0, 28, 33),
1431+/// (2, 43, 50),
1432+/// ]);
1433+/// ```
1434+///
1435+/// This example shows how to replace matches with some other string:
1436+///
1437+/// ```
1438+/// use aho_corasick::AhoCorasick;
1439+///
1440+/// let patterns = &["fox", "brown", "quick"];
1441+/// let haystack = "The quick brown fox.";
1442+/// let replace_with = &["sloth", "grey", "slow"];
1443+///
1444+/// let ac = AhoCorasick::new(patterns);
1445+/// let result = ac.replace_all(haystack, replace_with);
1446+/// assert_eq!(result, "The slow grey sloth.");
1447+/// ```
1448+#[derive(Clone, Debug)]
1449+pub struct AhoCorasick<S: StateID = usize> {
1450+ imp: Imp<S>,
1451+ match_kind: MatchKind,
1452+}
1453+
1454+impl AhoCorasick {
1455+ /// Create a new Aho-Corasick automaton using the default configuration.
1456+ ///
1457+ /// The default configuration optimizes for less space usage, but at the
1458+ /// expense of longer search times. To change the configuration, use
1459+ /// [`AhoCorasickBuilder`](struct.AhoCorasickBuilder.html)
1460+ /// for fine-grained control, or
1461+ /// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured)
1462+ /// for automatic configuration if you aren't sure which settings to pick.
1463+ ///
1464+ /// This uses the default
1465+ /// [`MatchKind::Standard`](enum.MatchKind.html#variant.Standard)
1466+ /// match semantics, which reports a match as soon as it is found. This
1467+ /// corresponds to the standard match semantics supported by textbook
1468+ /// descriptions of the Aho-Corasick algorithm.
1469+ ///
1470+ /// # Examples
1471+ ///
1472+ /// Basic usage:
1473+ ///
1474+ /// ```
1475+ /// use aho_corasick::AhoCorasick;
1476+ ///
1477+ /// let ac = AhoCorasick::new(&[
1478+ /// "foo", "bar", "baz",
1479+ /// ]);
1480+ /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
1481+ /// ```
1482+ pub fn new<I, P>(patterns: I) -> AhoCorasick
1483+ where
1484+ I: IntoIterator<Item = P>,
1485+ P: AsRef<[u8]>,
1486+ {
1487+ AhoCorasickBuilder::new().build(patterns)
1488+ }
1489+
1490+ /// Build an Aho-Corasick automaton with an automatically determined
1491+ /// configuration.
1492+ ///
1493+ /// Specifically, this requires a slice of patterns instead of an iterator
1494+ /// since the configuration is determined by looking at the patterns before
1495+ /// constructing the automaton. The idea here is to balance space and time
1496+ /// automatically. That is, when searching a small number of patterns, this
1497+ /// will attempt to use the fastest possible configuration since the total
1498+ /// space required will be small anyway. As the number of patterns grows,
1499+ /// this will fall back to slower configurations that use less space.
1500+ ///
1501+ /// If you want auto configuration but with match semantics different from
1502+ /// the default `MatchKind::Standard`, then use
1503+ /// [`AhoCorasickBuilder::auto_configure`](struct.AhoCorasickBuilder.html#method.auto_configure).
1504+ ///
1505+ /// # Examples
1506+ ///
1507+ /// Basic usage is just like `new`, except you must provide a slice:
1508+ ///
1509+ /// ```
1510+ /// use aho_corasick::AhoCorasick;
1511+ ///
1512+ /// let ac = AhoCorasick::new_auto_configured(&[
1513+ /// "foo", "bar", "baz",
1514+ /// ]);
1515+ /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
1516+ /// ```
1517+ pub fn new_auto_configured<B>(patterns: &[B]) -> AhoCorasick
1518+ where
1519+ B: AsRef<[u8]>,
1520+ {
1521+ AhoCorasickBuilder::new().auto_configure(patterns).build(patterns)
1522+ }
1523+}
1524+
1525+impl<S: StateID> AhoCorasick<S> {
1526+ /// Returns true if and only if this automaton matches the haystack at any
1527+ /// position.
1528+ ///
1529+ /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
1530+ /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
1531+ /// `&[u8]` itself.
1532+ ///
1533+ /// # Examples
1534+ ///
1535+ /// Basic usage:
1536+ ///
1537+ /// ```
1538+ /// use aho_corasick::AhoCorasick;
1539+ ///
1540+ /// let ac = AhoCorasick::new(&[
1541+ /// "foo", "bar", "quux", "baz",
1542+ /// ]);
1543+ /// assert!(ac.is_match("xxx bar xxx"));
1544+ /// assert!(!ac.is_match("xxx qux xxx"));
1545+ /// ```
1546+ pub fn is_match<B: AsRef<[u8]>>(&self, haystack: B) -> bool {
1547+ self.earliest_find(haystack).is_some()
1548+ }
1549+
1550+ /// Returns the location of the first detected match in `haystack`.
1551+ ///
1552+ /// This method has the same behavior regardless of the
1553+ /// [`MatchKind`](enum.MatchKind.html)
1554+ /// of this automaton.
1555+ ///
1556+ /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
1557+ /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
1558+ /// `&[u8]` itself.
1559+ ///
1560+ /// # Examples
1561+ ///
1562+ /// Basic usage:
1563+ ///
1564+ /// ```
1565+ /// use aho_corasick::AhoCorasick;
1566+ ///
1567+ /// let ac = AhoCorasick::new(&[
1568+ /// "abc", "b",
1569+ /// ]);
1570+ /// let mat = ac.earliest_find("abcd").expect("should have match");
1571+ /// assert_eq!(1, mat.pattern());
1572+ /// assert_eq!((1, 2), (mat.start(), mat.end()));
1573+ /// ```
1574+ pub fn earliest_find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> {
1575+ let mut prestate = PrefilterState::new(self.max_pattern_len());
1576+ let mut start = self.imp.start_state();
1577+ self.imp.earliest_find_at(
1578+ &mut prestate,
1579+ haystack.as_ref(),
1580+ 0,
1581+ &mut start,
1582+ )
1583+ }
1584+
1585+ /// Returns the location of the first match according to the match
1586+ /// semantics that this automaton was constructed with.
1587+ ///
1588+ /// When using `MatchKind::Standard`, this corresponds precisely to the
1589+ /// same behavior as
1590+ /// [`earliest_find`](struct.AhoCorasick.html#method.earliest_find).
1591+ /// Otherwise, match semantics correspond to either
1592+ /// [leftmost-first](enum.MatchKind.html#variant.LeftmostFirst)
1593+ /// or
1594+ /// [leftmost-longest](enum.MatchKind.html#variant.LeftmostLongest).
1595+ ///
1596+ /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
1597+ /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
1598+ /// `&[u8]` itself.
1599+ ///
1600+ /// # Examples
1601+ ///
1602+ /// Basic usage, with standard semantics:
1603+ ///
1604+ /// ```
1605+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1606+ ///
1607+ /// let patterns = &["b", "abc", "abcd"];
1608+ /// let haystack = "abcd";
1609+ ///
1610+ /// let ac = AhoCorasickBuilder::new()
1611+ /// .match_kind(MatchKind::Standard) // default, not necessary
1612+ /// .build(patterns);
1613+ /// let mat = ac.find(haystack).expect("should have a match");
1614+ /// assert_eq!("b", &haystack[mat.start()..mat.end()]);
1615+ /// ```
1616+ ///
1617+ /// Now with leftmost-first semantics:
1618+ ///
1619+ /// ```
1620+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1621+ ///
1622+ /// let patterns = &["b", "abc", "abcd"];
1623+ /// let haystack = "abcd";
1624+ ///
1625+ /// let ac = AhoCorasickBuilder::new()
1626+ /// .match_kind(MatchKind::LeftmostFirst)
1627+ /// .build(patterns);
1628+ /// let mat = ac.find(haystack).expect("should have a match");
1629+ /// assert_eq!("abc", &haystack[mat.start()..mat.end()]);
1630+ /// ```
1631+ ///
1632+ /// And finally, leftmost-longest semantics:
1633+ ///
1634+ /// ```
1635+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1636+ ///
1637+ /// let patterns = &["b", "abc", "abcd"];
1638+ /// let haystack = "abcd";
1639+ ///
1640+ /// let ac = AhoCorasickBuilder::new()
1641+ /// .match_kind(MatchKind::LeftmostLongest)
1642+ /// .build(patterns);
1643+ /// let mat = ac.find(haystack).expect("should have a match");
1644+ /// assert_eq!("abcd", &haystack[mat.start()..mat.end()]);
1645+ /// ```
1646+ pub fn find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> {
1647+ let mut prestate = PrefilterState::new(self.max_pattern_len());
1648+ self.imp.find_at_no_state(&mut prestate, haystack.as_ref(), 0)
1649+ }
1650+
1651+ /// Returns an iterator of non-overlapping matches, using the match
1652+ /// semantics that this automaton was constructed with.
1653+ ///
1654+ /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
1655+ /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
1656+ /// `&[u8]` itself.
1657+ ///
1658+ /// # Examples
1659+ ///
1660+ /// Basic usage, with standard semantics:
1661+ ///
1662+ /// ```
1663+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1664+ ///
1665+ /// let patterns = &["append", "appendage", "app"];
1666+ /// let haystack = "append the app to the appendage";
1667+ ///
1668+ /// let ac = AhoCorasickBuilder::new()
1669+ /// .match_kind(MatchKind::Standard) // default, not necessary
1670+ /// .build(patterns);
1671+ /// let matches: Vec<usize> = ac
1672+ /// .find_iter(haystack)
1673+ /// .map(|mat| mat.pattern())
1674+ /// .collect();
1675+ /// assert_eq!(vec![2, 2, 2], matches);
1676+ /// ```
1677+ ///
1678+ /// Now with leftmost-first semantics:
1679+ ///
1680+ /// ```
1681+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1682+ ///
1683+ /// let patterns = &["append", "appendage", "app"];
1684+ /// let haystack = "append the app to the appendage";
1685+ ///
1686+ /// let ac = AhoCorasickBuilder::new()
1687+ /// .match_kind(MatchKind::LeftmostFirst)
1688+ /// .build(patterns);
1689+ /// let matches: Vec<usize> = ac
1690+ /// .find_iter(haystack)
1691+ /// .map(|mat| mat.pattern())
1692+ /// .collect();
1693+ /// assert_eq!(vec![0, 2, 0], matches);
1694+ /// ```
1695+ ///
1696+ /// And finally, leftmost-longest semantics:
1697+ ///
1698+ /// ```
1699+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1700+ ///
1701+ /// let patterns = &["append", "appendage", "app"];
1702+ /// let haystack = "append the app to the appendage";
1703+ ///
1704+ /// let ac = AhoCorasickBuilder::new()
1705+ /// .match_kind(MatchKind::LeftmostLongest)
1706+ /// .build(patterns);
1707+ /// let matches: Vec<usize> = ac
1708+ /// .find_iter(haystack)
1709+ /// .map(|mat| mat.pattern())
1710+ /// .collect();
1711+ /// assert_eq!(vec![0, 2, 1], matches);
1712+ /// ```
1713+ pub fn find_iter<'a, 'b, B: ?Sized + AsRef<[u8]>>(
1714+ &'a self,
1715+ haystack: &'b B,
1716+ ) -> FindIter<'a, 'b, S> {
1717+ FindIter::new(self, haystack.as_ref())
1718+ }
1719+
1720+ /// Returns an iterator of overlapping matches in the given `haystack`.
1721+ ///
1722+ /// Overlapping matches can _only_ be detected using
1723+ /// `MatchKind::Standard` semantics. If this automaton was constructed with
1724+ /// leftmost semantics, then this method will panic. To determine whether
1725+ /// this will panic at runtime, use the
1726+ /// [`AhoCorasick::supports_overlapping`](struct.AhoCorasick.html#method.supports_overlapping)
1727+ /// method.
1728+ ///
1729+ /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
1730+ /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
1731+ /// `&[u8]` itself.
1732+ ///
1733+ /// # Panics
1734+ ///
1735+ /// This panics when `AhoCorasick::supports_overlapping` returns `false`.
1736+ /// That is, this panics when this automaton's match semantics are not
1737+ /// `MatchKind::Standard`.
1738+ ///
1739+ /// # Examples
1740+ ///
1741+ /// Basic usage, with standard semantics:
1742+ ///
1743+ /// ```
1744+ /// use aho_corasick::AhoCorasick;
1745+ ///
1746+ /// let patterns = &["append", "appendage", "app"];
1747+ /// let haystack = "append the app to the appendage";
1748+ ///
1749+ /// let ac = AhoCorasick::new(patterns);
1750+ /// let matches: Vec<usize> = ac
1751+ /// .find_overlapping_iter(haystack)
1752+ /// .map(|mat| mat.pattern())
1753+ /// .collect();
1754+ /// assert_eq!(vec![2, 0, 2, 2, 0, 1], matches);
1755+ /// ```
1756+ pub fn find_overlapping_iter<'a, 'b, B: ?Sized + AsRef<[u8]>>(
1757+ &'a self,
1758+ haystack: &'b B,
1759+ ) -> FindOverlappingIter<'a, 'b, S> {
1760+ FindOverlappingIter::new(self, haystack.as_ref())
1761+ }
1762+
1763+ /// Replace all matches with a corresponding value in the `replace_with`
1764+ /// slice given. Matches correspond to the same matches as reported by
1765+ /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
1766+ ///
1767+ /// Replacements are determined by the index of the matching pattern.
1768+ /// For example, if the pattern with index `2` is found, then it is
1769+ /// replaced by `replace_with[2]`.
1770+ ///
1771+ /// # Panics
1772+ ///
1773+ /// This panics when `replace_with.len()` does not equal the total number
1774+ /// of patterns that are matched by this automaton.
1775+ ///
1776+ /// # Examples
1777+ ///
1778+ /// Basic usage:
1779+ ///
1780+ /// ```
1781+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1782+ ///
1783+ /// let patterns = &["append", "appendage", "app"];
1784+ /// let haystack = "append the app to the appendage";
1785+ ///
1786+ /// let ac = AhoCorasickBuilder::new()
1787+ /// .match_kind(MatchKind::LeftmostFirst)
1788+ /// .build(patterns);
1789+ /// let result = ac.replace_all(haystack, &["x", "y", "z"]);
1790+ /// assert_eq!("x the z to the xage", result);
1791+ /// ```
1792+ pub fn replace_all<B>(&self, haystack: &str, replace_with: &[B]) -> String
1793+ where
1794+ B: AsRef<str>,
1795+ {
1796+ assert_eq!(
1797+ replace_with.len(),
1798+ self.pattern_count(),
1799+ "replace_all requires a replacement for every pattern \
1800+ in the automaton"
1801+ );
1802+ let mut dst = String::with_capacity(haystack.len());
1803+ self.replace_all_with(haystack, &mut dst, |mat, _, dst| {
1804+ dst.push_str(replace_with[mat.pattern()].as_ref());
1805+ true
1806+ });
1807+ dst
1808+ }
1809+
1810+ /// Replace all matches using raw bytes with a corresponding value in the
1811+ /// `replace_with` slice given. Matches correspond to the same matches as
1812+ /// reported by [`find_iter`](struct.AhoCorasick.html#method.find_iter).
1813+ ///
1814+ /// Replacements are determined by the index of the matching pattern.
1815+ /// For example, if the pattern with index `2` is found, then it is
1816+ /// replaced by `replace_with[2]`.
1817+ ///
1818+ /// # Panics
1819+ ///
1820+ /// This panics when `replace_with.len()` does not equal the total number
1821+ /// of patterns that are matched by this automaton.
1822+ ///
1823+ /// # Examples
1824+ ///
1825+ /// Basic usage:
1826+ ///
1827+ /// ```
1828+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1829+ ///
1830+ /// let patterns = &["append", "appendage", "app"];
1831+ /// let haystack = b"append the app to the appendage";
1832+ ///
1833+ /// let ac = AhoCorasickBuilder::new()
1834+ /// .match_kind(MatchKind::LeftmostFirst)
1835+ /// .build(patterns);
1836+ /// let result = ac.replace_all_bytes(haystack, &["x", "y", "z"]);
1837+ /// assert_eq!(b"x the z to the xage".to_vec(), result);
1838+ /// ```
1839+ pub fn replace_all_bytes<B>(
1840+ &self,
1841+ haystack: &[u8],
1842+ replace_with: &[B],
1843+ ) -> Vec<u8>
1844+ where
1845+ B: AsRef<[u8]>,
1846+ {
1847+ assert_eq!(
1848+ replace_with.len(),
1849+ self.pattern_count(),
1850+ "replace_all_bytes requires a replacement for every pattern \
1851+ in the automaton"
1852+ );
1853+ let mut dst = Vec::with_capacity(haystack.len());
1854+ self.replace_all_with_bytes(haystack, &mut dst, |mat, _, dst| {
1855+ dst.extend(replace_with[mat.pattern()].as_ref());
1856+ true
1857+ });
1858+ dst
1859+ }
1860+
1861+ /// Replace all matches using a closure called on each match.
1862+ /// Matches correspond to the same matches as reported by
1863+ /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
1864+ ///
1865+ /// The closure accepts three parameters: the match found, the text of
1866+ /// the match and a string buffer with which to write the replaced text
1867+ /// (if any). If the closure returns `true`, then it continues to the next
1868+ /// match. If the closure returns `false`, then searching is stopped.
1869+ ///
1870+ /// # Examples
1871+ ///
1872+ /// Basic usage:
1873+ ///
1874+ /// ```
1875+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1876+ ///
1877+ /// let patterns = &["append", "appendage", "app"];
1878+ /// let haystack = "append the app to the appendage";
1879+ ///
1880+ /// let ac = AhoCorasickBuilder::new()
1881+ /// .match_kind(MatchKind::LeftmostFirst)
1882+ /// .build(patterns);
1883+ /// let mut result = String::new();
1884+ /// ac.replace_all_with(haystack, &mut result, |mat, _, dst| {
1885+ /// dst.push_str(&mat.pattern().to_string());
1886+ /// true
1887+ /// });
1888+ /// assert_eq!("0 the 2 to the 0age", result);
1889+ /// ```
1890+ ///
1891+ /// Stopping the replacement by returning `false` (continued from the
1892+ /// example above):
1893+ ///
1894+ /// ```
1895+ /// # use aho_corasick::{AhoCorasickBuilder, MatchKind};
1896+ /// # let patterns = &["append", "appendage", "app"];
1897+ /// # let haystack = "append the app to the appendage";
1898+ /// # let ac = AhoCorasickBuilder::new()
1899+ /// # .match_kind(MatchKind::LeftmostFirst)
1900+ /// # .build(patterns);
1901+ /// let mut result = String::new();
1902+ /// ac.replace_all_with(haystack, &mut result, |mat, _, dst| {
1903+ /// dst.push_str(&mat.pattern().to_string());
1904+ /// mat.pattern() != 2
1905+ /// });
1906+ /// assert_eq!("0 the 2 to the appendage", result);
1907+ /// ```
1908+ pub fn replace_all_with<F>(
1909+ &self,
1910+ haystack: &str,
1911+ dst: &mut String,
1912+ mut replace_with: F,
1913+ ) where
1914+ F: FnMut(&Match, &str, &mut String) -> bool,
1915+ {
1916+ let mut last_match = 0;
1917+ for mat in self.find_iter(haystack) {
1918+ dst.push_str(&haystack[last_match..mat.start()]);
1919+ last_match = mat.end();
1920+ if !replace_with(&mat, &haystack[mat.start()..mat.end()], dst) {
1921+ break;
1922+ };
1923+ }
1924+ dst.push_str(&haystack[last_match..]);
1925+ }
1926+
1927+ /// Replace all matches using raw bytes with a closure called on each
1928+ /// match. Matches correspond to the same matches as reported by
1929+ /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
1930+ ///
1931+ /// The closure accepts three parameters: the match found, the text of
1932+ /// the match and a byte buffer with which to write the replaced text
1933+ /// (if any). If the closure returns `true`, then it continues to the next
1934+ /// match. If the closure returns `false`, then searching is stopped.
1935+ ///
1936+ /// # Examples
1937+ ///
1938+ /// Basic usage:
1939+ ///
1940+ /// ```
1941+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
1942+ ///
1943+ /// let patterns = &["append", "appendage", "app"];
1944+ /// let haystack = b"append the app to the appendage";
1945+ ///
1946+ /// let ac = AhoCorasickBuilder::new()
1947+ /// .match_kind(MatchKind::LeftmostFirst)
1948+ /// .build(patterns);
1949+ /// let mut result = vec![];
1950+ /// ac.replace_all_with_bytes(haystack, &mut result, |mat, _, dst| {
1951+ /// dst.extend(mat.pattern().to_string().bytes());
1952+ /// true
1953+ /// });
1954+ /// assert_eq!(b"0 the 2 to the 0age".to_vec(), result);
1955+ /// ```
1956+ ///
1957+ /// Stopping the replacement by returning `false` (continued from the
1958+ /// example above):
1959+ ///
1960+ /// ```
1961+ /// # use aho_corasick::{AhoCorasickBuilder, MatchKind};
1962+ /// # let patterns = &["append", "appendage", "app"];
1963+ /// # let haystack = b"append the app to the appendage";
1964+ /// # let ac = AhoCorasickBuilder::new()
1965+ /// # .match_kind(MatchKind::LeftmostFirst)
1966+ /// # .build(patterns);
1967+ /// let mut result = vec![];
1968+ /// ac.replace_all_with_bytes(haystack, &mut result, |mat, _, dst| {
1969+ /// dst.extend(mat.pattern().to_string().bytes());
1970+ /// mat.pattern() != 2
1971+ /// });
1972+ /// assert_eq!(b"0 the 2 to the appendage".to_vec(), result);
1973+ /// ```
1974+ pub fn replace_all_with_bytes<F>(
1975+ &self,
1976+ haystack: &[u8],
1977+ dst: &mut Vec<u8>,
1978+ mut replace_with: F,
1979+ ) where
1980+ F: FnMut(&Match, &[u8], &mut Vec<u8>) -> bool,
1981+ {
1982+ let mut last_match = 0;
1983+ for mat in self.find_iter(haystack) {
1984+ dst.extend(&haystack[last_match..mat.start()]);
1985+ last_match = mat.end();
1986+ if !replace_with(&mat, &haystack[mat.start()..mat.end()], dst) {
1987+ break;
1988+ };
1989+ }
1990+ dst.extend(&haystack[last_match..]);
1991+ }
1992+
1993+ /// Returns an iterator of non-overlapping matches in the given
1994+ /// stream. Matches correspond to the same matches as reported by
1995+ /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
1996+ ///
1997+ /// The matches yielded by this iterator use absolute position offsets in
1998+ /// the stream given, where the first byte has index `0`. Matches are
1999+ /// yieled until the stream is exhausted.
2000+ ///
2001+ /// Each item yielded by the iterator is an `io::Result<Match>`, where an
2002+ /// error is yielded if there was a problem reading from the reader given.
2003+ ///
2004+ /// When searching a stream, an internal buffer is used. Therefore, callers
2005+ /// should avoiding providing a buffered reader, if possible.
2006+ ///
2007+ /// Searching a stream requires that the automaton was built with
2008+ /// `MatchKind::Standard` semantics. If this automaton was constructed
2009+ /// with leftmost semantics, then this method will panic. To determine
2010+ /// whether this will panic at runtime, use the
2011+ /// [`AhoCorasick::supports_stream`](struct.AhoCorasick.html#method.supports_stream)
2012+ /// method.
2013+ ///
2014+ /// # Memory usage
2015+ ///
2016+ /// In general, searching streams will use a constant amount of memory for
2017+ /// its internal buffer. The one requirement is that the internal buffer
2018+ /// must be at least the size of the longest possible match. In most use
2019+ /// cases, the default buffer size will be much larger than any individual
2020+ /// match.
2021+ ///
2022+ /// # Panics
2023+ ///
2024+ /// This panics when `AhoCorasick::supports_stream` returns `false`.
2025+ /// That is, this panics when this automaton's match semantics are not
2026+ /// `MatchKind::Standard`. This restriction may be lifted in the future.
2027+ ///
2028+ /// # Examples
2029+ ///
2030+ /// Basic usage:
2031+ ///
2032+ /// ```
2033+ /// use aho_corasick::AhoCorasick;
2034+ ///
2035+ /// # fn example() -> Result<(), ::std::io::Error> {
2036+ /// let patterns = &["append", "appendage", "app"];
2037+ /// let haystack = "append the app to the appendage";
2038+ ///
2039+ /// let ac = AhoCorasick::new(patterns);
2040+ /// let mut matches = vec![];
2041+ /// for result in ac.stream_find_iter(haystack.as_bytes()) {
2042+ /// let mat = result?;
2043+ /// matches.push(mat.pattern());
2044+ /// }
2045+ /// assert_eq!(vec![2, 2, 2], matches);
2046+ /// # Ok(()) }; example().unwrap()
2047+ /// ```
2048+ pub fn stream_find_iter<'a, R: io::Read>(
2049+ &'a self,
2050+ rdr: R,
2051+ ) -> StreamFindIter<'a, R, S> {
2052+ StreamFindIter::new(self, rdr)
2053+ }
2054+
2055+ /// Search for and replace all matches of this automaton in
2056+ /// the given reader, and write the replacements to the given
2057+ /// writer. Matches correspond to the same matches as reported by
2058+ /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
2059+ ///
2060+ /// Replacements are determined by the index of the matching pattern.
2061+ /// For example, if the pattern with index `2` is found, then it is
2062+ /// replaced by `replace_with[2]`.
2063+ ///
2064+ /// After all matches are replaced, the writer is _not_ flushed.
2065+ ///
2066+ /// If there was a problem reading from the given reader or writing to the
2067+ /// given writer, then the corresponding `io::Error` is returned and all
2068+ /// replacement is stopped.
2069+ ///
2070+ /// When searching a stream, an internal buffer is used. Therefore, callers
2071+ /// should avoiding providing a buffered reader, if possible. However,
2072+ /// callers may want to provide a buffered writer.
2073+ ///
2074+ /// Searching a stream requires that the automaton was built with
2075+ /// `MatchKind::Standard` semantics. If this automaton was constructed
2076+ /// with leftmost semantics, then this method will panic. To determine
2077+ /// whether this will panic at runtime, use the
2078+ /// [`AhoCorasick::supports_stream`](struct.AhoCorasick.html#method.supports_stream)
2079+ /// method.
2080+ ///
2081+ /// # Memory usage
2082+ ///
2083+ /// In general, searching streams will use a constant amount of memory for
2084+ /// its internal buffer. The one requirement is that the internal buffer
2085+ /// must be at least the size of the longest possible match. In most use
2086+ /// cases, the default buffer size will be much larger than any individual
2087+ /// match.
2088+ ///
2089+ /// # Panics
2090+ ///
2091+ /// This panics when `AhoCorasick::supports_stream` returns `false`.
2092+ /// That is, this panics when this automaton's match semantics are not
2093+ /// `MatchKind::Standard`. This restriction may be lifted in the future.
2094+ ///
2095+ /// # Examples
2096+ ///
2097+ /// Basic usage:
2098+ ///
2099+ /// ```
2100+ /// use aho_corasick::AhoCorasick;
2101+ ///
2102+ /// # fn example() -> Result<(), ::std::io::Error> {
2103+ /// let patterns = &["fox", "brown", "quick"];
2104+ /// let haystack = "The quick brown fox.";
2105+ /// let replace_with = &["sloth", "grey", "slow"];
2106+ ///
2107+ /// let ac = AhoCorasick::new(patterns);
2108+ /// let mut result = vec![];
2109+ /// ac.stream_replace_all(haystack.as_bytes(), &mut result, replace_with)?;
2110+ /// assert_eq!(b"The slow grey sloth.".to_vec(), result);
2111+ /// # Ok(()) }; example().unwrap()
2112+ /// ```
2113+ pub fn stream_replace_all<R, W, B>(
2114+ &self,
2115+ rdr: R,
2116+ wtr: W,
2117+ replace_with: &[B],
2118+ ) -> io::Result<()>
2119+ where
2120+ R: io::Read,
2121+ W: io::Write,
2122+ B: AsRef<[u8]>,
2123+ {
2124+ assert_eq!(
2125+ replace_with.len(),
2126+ self.pattern_count(),
2127+ "stream_replace_all requires a replacement for every pattern \
2128+ in the automaton"
2129+ );
2130+ self.stream_replace_all_with(rdr, wtr, |mat, _, wtr| {
2131+ wtr.write_all(replace_with[mat.pattern()].as_ref())
2132+ })
2133+ }
2134+
2135+ /// Search the given reader and replace all matches of this automaton
2136+ /// using the given closure. The result is written to the given
2137+ /// writer. Matches correspond to the same matches as reported by
2138+ /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
2139+ ///
2140+ /// The closure accepts three parameters: the match found, the text of
2141+ /// the match and the writer with which to write the replaced text (if any).
2142+ ///
2143+ /// After all matches are replaced, the writer is _not_ flushed.
2144+ ///
2145+ /// If there was a problem reading from the given reader or writing to the
2146+ /// given writer, then the corresponding `io::Error` is returned and all
2147+ /// replacement is stopped.
2148+ ///
2149+ /// When searching a stream, an internal buffer is used. Therefore, callers
2150+ /// should avoiding providing a buffered reader, if possible. However,
2151+ /// callers may want to provide a buffered writer.
2152+ ///
2153+ /// Searching a stream requires that the automaton was built with
2154+ /// `MatchKind::Standard` semantics. If this automaton was constructed
2155+ /// with leftmost semantics, then this method will panic. To determine
2156+ /// whether this will panic at runtime, use the
2157+ /// [`AhoCorasick::supports_stream`](struct.AhoCorasick.html#method.supports_stream)
2158+ /// method.
2159+ ///
2160+ /// # Memory usage
2161+ ///
2162+ /// In general, searching streams will use a constant amount of memory for
2163+ /// its internal buffer. The one requirement is that the internal buffer
2164+ /// must be at least the size of the longest possible match. In most use
2165+ /// cases, the default buffer size will be much larger than any individual
2166+ /// match.
2167+ ///
2168+ /// # Panics
2169+ ///
2170+ /// This panics when `AhoCorasick::supports_stream` returns `false`.
2171+ /// That is, this panics when this automaton's match semantics are not
2172+ /// `MatchKind::Standard`. This restriction may be lifted in the future.
2173+ ///
2174+ /// # Examples
2175+ ///
2176+ /// Basic usage:
2177+ ///
2178+ /// ```
2179+ /// use std::io::Write;
2180+ /// use aho_corasick::AhoCorasick;
2181+ ///
2182+ /// # fn example() -> Result<(), ::std::io::Error> {
2183+ /// let patterns = &["fox", "brown", "quick"];
2184+ /// let haystack = "The quick brown fox.";
2185+ ///
2186+ /// let ac = AhoCorasick::new(patterns);
2187+ /// let mut result = vec![];
2188+ /// ac.stream_replace_all_with(
2189+ /// haystack.as_bytes(),
2190+ /// &mut result,
2191+ /// |mat, _, wtr| {
2192+ /// wtr.write_all(mat.pattern().to_string().as_bytes())
2193+ /// },
2194+ /// )?;
2195+ /// assert_eq!(b"The 2 1 0.".to_vec(), result);
2196+ /// # Ok(()) }; example().unwrap()
2197+ /// ```
2198+ pub fn stream_replace_all_with<R, W, F>(
2199+ &self,
2200+ rdr: R,
2201+ mut wtr: W,
2202+ mut replace_with: F,
2203+ ) -> io::Result<()>
2204+ where
2205+ R: io::Read,
2206+ W: io::Write,
2207+ F: FnMut(&Match, &[u8], &mut W) -> io::Result<()>,
2208+ {
2209+ let mut it = StreamChunkIter::new(self, rdr);
2210+ while let Some(result) = it.next() {
2211+ let chunk = result?;
2212+ match chunk {
2213+ StreamChunk::NonMatch { bytes, .. } => {
2214+ wtr.write_all(bytes)?;
2215+ }
2216+ StreamChunk::Match { bytes, mat } => {
2217+ replace_with(&mat, bytes, &mut wtr)?;
2218+ }
2219+ }
2220+ }
2221+ Ok(())
2222+ }
2223+
2224+ /// Returns the match kind used by this automaton.
2225+ ///
2226+ /// # Examples
2227+ ///
2228+ /// Basic usage:
2229+ ///
2230+ /// ```
2231+ /// use aho_corasick::{AhoCorasick, MatchKind};
2232+ ///
2233+ /// let ac = AhoCorasick::new(&[
2234+ /// "foo", "bar", "quux", "baz",
2235+ /// ]);
2236+ /// assert_eq!(&MatchKind::Standard, ac.match_kind());
2237+ /// ```
2238+ pub fn match_kind(&self) -> &MatchKind {
2239+ self.imp.match_kind()
2240+ }
2241+
2242+ /// Returns the length of the longest pattern matched by this automaton.
2243+ ///
2244+ /// # Examples
2245+ ///
2246+ /// Basic usage:
2247+ ///
2248+ /// ```
2249+ /// use aho_corasick::AhoCorasick;
2250+ ///
2251+ /// let ac = AhoCorasick::new(&[
2252+ /// "foo", "bar", "quux", "baz",
2253+ /// ]);
2254+ /// assert_eq!(4, ac.max_pattern_len());
2255+ /// ```
2256+ pub fn max_pattern_len(&self) -> usize {
2257+ self.imp.max_pattern_len()
2258+ }
2259+
2260+ /// Return the total number of patterns matched by this automaton.
2261+ ///
2262+ /// This includes patterns that may never participate in a match. For
2263+ /// example, if
2264+ /// [`MatchKind::LeftmostFirst`](enum.MatchKind.html#variant.LeftmostFirst)
2265+ /// match semantics are used, and the patterns `Sam` and `Samwise` were
2266+ /// used to build the automaton, then `Samwise` can never participate in a
2267+ /// match because `Sam` will always take priority.
2268+ ///
2269+ /// # Examples
2270+ ///
2271+ /// Basic usage:
2272+ ///
2273+ /// ```
2274+ /// use aho_corasick::AhoCorasick;
2275+ ///
2276+ /// let ac = AhoCorasick::new(&[
2277+ /// "foo", "bar", "baz",
2278+ /// ]);
2279+ /// assert_eq!(3, ac.pattern_count());
2280+ /// ```
2281+ pub fn pattern_count(&self) -> usize {
2282+ self.imp.pattern_count()
2283+ }
2284+
2285+ /// Returns true if and only if this automaton supports reporting
2286+ /// overlapping matches.
2287+ ///
2288+ /// If this returns false and overlapping matches are requested, then it
2289+ /// will result in a panic.
2290+ ///
2291+ /// Since leftmost matching is inherently incompatible with overlapping
2292+ /// matches, only
2293+ /// [`MatchKind::Standard`](enum.MatchKind.html#variant.Standard)
2294+ /// supports overlapping matches. This is unlikely to change in the future.
2295+ ///
2296+ /// # Examples
2297+ ///
2298+ /// Basic usage:
2299+ ///
2300+ /// ```
2301+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
2302+ ///
2303+ /// let ac = AhoCorasickBuilder::new()
2304+ /// .match_kind(MatchKind::Standard)
2305+ /// .build(&["foo", "bar", "baz"]);
2306+ /// assert!(ac.supports_overlapping());
2307+ ///
2308+ /// let ac = AhoCorasickBuilder::new()
2309+ /// .match_kind(MatchKind::LeftmostFirst)
2310+ /// .build(&["foo", "bar", "baz"]);
2311+ /// assert!(!ac.supports_overlapping());
2312+ /// ```
2313+ pub fn supports_overlapping(&self) -> bool {
2314+ self.match_kind.supports_overlapping()
2315+ }
2316+
2317+ /// Returns true if and only if this automaton supports stream searching.
2318+ ///
2319+ /// If this returns false and stream searching (or replacing) is attempted,
2320+ /// then it will result in a panic.
2321+ ///
2322+ /// Currently, only
2323+ /// [`MatchKind::Standard`](enum.MatchKind.html#variant.Standard)
2324+ /// supports streaming. This may be expanded in the future.
2325+ ///
2326+ /// # Examples
2327+ ///
2328+ /// Basic usage:
2329+ ///
2330+ /// ```
2331+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
2332+ ///
2333+ /// let ac = AhoCorasickBuilder::new()
2334+ /// .match_kind(MatchKind::Standard)
2335+ /// .build(&["foo", "bar", "baz"]);
2336+ /// assert!(ac.supports_stream());
2337+ ///
2338+ /// let ac = AhoCorasickBuilder::new()
2339+ /// .match_kind(MatchKind::LeftmostFirst)
2340+ /// .build(&["foo", "bar", "baz"]);
2341+ /// assert!(!ac.supports_stream());
2342+ /// ```
2343+ pub fn supports_stream(&self) -> bool {
2344+ self.match_kind.supports_stream()
2345+ }
2346+
2347+ /// Returns the approximate total amount of heap used by this automaton, in
2348+ /// units of bytes.
2349+ ///
2350+ /// # Examples
2351+ ///
2352+ /// This example shows the difference in heap usage between a few
2353+ /// configurations:
2354+ ///
2355+ /// ```ignore
2356+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
2357+ ///
2358+ /// let ac = AhoCorasickBuilder::new()
2359+ /// .dfa(false) // default
2360+ /// .build(&["foo", "bar", "baz"]);
2361+ /// assert_eq!(10_336, ac.heap_bytes());
2362+ ///
2363+ /// let ac = AhoCorasickBuilder::new()
2364+ /// .dfa(false) // default
2365+ /// .ascii_case_insensitive(true)
2366+ /// .build(&["foo", "bar", "baz"]);
2367+ /// assert_eq!(10_384, ac.heap_bytes());
2368+ ///
2369+ /// let ac = AhoCorasickBuilder::new()
2370+ /// .dfa(true)
2371+ /// .ascii_case_insensitive(true)
2372+ /// .build(&["foo", "bar", "baz"]);
2373+ /// assert_eq!(1_248, ac.heap_bytes());
2374+ /// ```
2375+ pub fn heap_bytes(&self) -> usize {
2376+ match self.imp {
2377+ Imp::NFA(ref nfa) => nfa.heap_bytes(),
2378+ Imp::DFA(ref dfa) => dfa.heap_bytes(),
2379+ }
2380+ }
2381+}
2382+
2383+/// The internal implementation of Aho-Corasick, which is either an NFA or
2384+/// a DFA. The NFA is slower but uses less memory. The DFA is faster but uses
2385+/// more memory.
2386+#[derive(Clone, Debug)]
2387+enum Imp<S: StateID> {
2388+ NFA(NFA<S>),
2389+ DFA(DFA<S>),
2390+}
2391+
2392+impl<S: StateID> Imp<S> {
2393+ /// Returns the type of match semantics implemented by this automaton.
2394+ fn match_kind(&self) -> &MatchKind {
2395+ match *self {
2396+ Imp::NFA(ref nfa) => nfa.match_kind(),
2397+ Imp::DFA(ref dfa) => dfa.match_kind(),
2398+ }
2399+ }
2400+
2401+ /// Returns the identifier of the start state.
2402+ fn start_state(&self) -> S {
2403+ match *self {
2404+ Imp::NFA(ref nfa) => nfa.start_state(),
2405+ Imp::DFA(ref dfa) => dfa.start_state(),
2406+ }
2407+ }
2408+
2409+ /// The length, in bytes, of the longest pattern in this automaton. This
2410+ /// information is useful for maintaining correct buffer sizes when
2411+ /// searching on streams.
2412+ fn max_pattern_len(&self) -> usize {
2413+ match *self {
2414+ Imp::NFA(ref nfa) => nfa.max_pattern_len(),
2415+ Imp::DFA(ref dfa) => dfa.max_pattern_len(),
2416+ }
2417+ }
2418+
2419+ /// The total number of patterns added to this automaton. This includes
2420+ /// patterns that may never match. The maximum matching pattern that can be
2421+ /// reported is exactly one less than this number.
2422+ fn pattern_count(&self) -> usize {
2423+ match *self {
2424+ Imp::NFA(ref nfa) => nfa.pattern_count(),
2425+ Imp::DFA(ref dfa) => dfa.pattern_count(),
2426+ }
2427+ }
2428+
2429+ /// Returns the prefilter object, if one exists, for the underlying
2430+ /// automaton.
2431+ fn prefilter(&self) -> Option<&dyn Prefilter> {
2432+ match *self {
2433+ Imp::NFA(ref nfa) => nfa.prefilter(),
2434+ Imp::DFA(ref dfa) => dfa.prefilter(),
2435+ }
2436+ }
2437+
2438+ /// Returns true if and only if we should attempt to use a prefilter.
2439+ fn use_prefilter(&self) -> bool {
2440+ let p = match self.prefilter() {
2441+ None => return false,
2442+ Some(p) => p,
2443+ };
2444+ !p.looks_for_non_start_of_match()
2445+ }
2446+
2447+ #[inline(always)]
2448+ fn overlapping_find_at(
2449+ &self,
2450+ prestate: &mut PrefilterState,
2451+ haystack: &[u8],
2452+ at: usize,
2453+ state_id: &mut S,
2454+ match_index: &mut usize,
2455+ ) -> Option<Match> {
2456+ match *self {
2457+ Imp::NFA(ref nfa) => nfa.overlapping_find_at(
2458+ prestate,
2459+ haystack,
2460+ at,
2461+ state_id,
2462+ match_index,
2463+ ),
2464+ Imp::DFA(ref dfa) => dfa.overlapping_find_at(
2465+ prestate,
2466+ haystack,
2467+ at,
2468+ state_id,
2469+ match_index,
2470+ ),
2471+ }
2472+ }
2473+
2474+ #[inline(always)]
2475+ fn earliest_find_at(
2476+ &self,
2477+ prestate: &mut PrefilterState,
2478+ haystack: &[u8],
2479+ at: usize,
2480+ state_id: &mut S,
2481+ ) -> Option<Match> {
2482+ match *self {
2483+ Imp::NFA(ref nfa) => {
2484+ nfa.earliest_find_at(prestate, haystack, at, state_id)
2485+ }
2486+ Imp::DFA(ref dfa) => {
2487+ dfa.earliest_find_at(prestate, haystack, at, state_id)
2488+ }
2489+ }
2490+ }
2491+
2492+ #[inline(always)]
2493+ fn find_at_no_state(
2494+ &self,
2495+ prestate: &mut PrefilterState,
2496+ haystack: &[u8],
2497+ at: usize,
2498+ ) -> Option<Match> {
2499+ match *self {
2500+ Imp::NFA(ref nfa) => nfa.find_at_no_state(prestate, haystack, at),
2501+ Imp::DFA(ref dfa) => dfa.find_at_no_state(prestate, haystack, at),
2502+ }
2503+ }
2504+}
2505+
2506+/// An iterator of non-overlapping matches in a particular haystack.
2507+///
2508+/// This iterator yields matches according to the
2509+/// [`MatchKind`](enum.MatchKind.html)
2510+/// used by this automaton.
2511+///
2512+/// This iterator is constructed via the
2513+/// [`AhoCorasick::find_iter`](struct.AhoCorasick.html#method.find_iter)
2514+/// method.
2515+///
2516+/// The type variable `S` refers to the representation used for state
2517+/// identifiers. (By default, this is `usize`.)
2518+///
2519+/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
2520+///
2521+/// The lifetime `'b` refers to the lifetime of the haystack being searched.
2522+#[derive(Debug)]
2523+pub struct FindIter<'a, 'b, S: StateID> {
2524+ fsm: &'a Imp<S>,
2525+ prestate: PrefilterState,
2526+ haystack: &'b [u8],
2527+ pos: usize,
2528+}
2529+
2530+impl<'a, 'b, S: StateID> FindIter<'a, 'b, S> {
2531+ fn new(ac: &'a AhoCorasick<S>, haystack: &'b [u8]) -> FindIter<'a, 'b, S> {
2532+ let prestate = PrefilterState::new(ac.max_pattern_len());
2533+ FindIter { fsm: &ac.imp, prestate, haystack, pos: 0 }
2534+ }
2535+}
2536+
2537+impl<'a, 'b, S: StateID> Iterator for FindIter<'a, 'b, S> {
2538+ type Item = Match;
2539+
2540+ fn next(&mut self) -> Option<Match> {
2541+ if self.pos > self.haystack.len() {
2542+ return None;
2543+ }
2544+ let result = self.fsm.find_at_no_state(
2545+ &mut self.prestate,
2546+ self.haystack,
2547+ self.pos,
2548+ );
2549+ let mat = match result {
2550+ None => return None,
2551+ Some(mat) => mat,
2552+ };
2553+ if mat.end() == self.pos {
2554+ // If the automaton can match the empty string and if we found an
2555+ // empty match, then we need to forcefully move the position.
2556+ self.pos += 1;
2557+ } else {
2558+ self.pos = mat.end();
2559+ }
2560+ Some(mat)
2561+ }
2562+}
2563+
2564+/// An iterator of overlapping matches in a particular haystack.
2565+///
2566+/// This iterator will report all possible matches in a particular haystack,
2567+/// even when the matches overlap.
2568+///
2569+/// This iterator is constructed via the
2570+/// [`AhoCorasick::find_overlapping_iter`](struct.AhoCorasick.html#method.find_overlapping_iter)
2571+/// method.
2572+///
2573+/// The type variable `S` refers to the representation used for state
2574+/// identifiers. (By default, this is `usize`.)
2575+///
2576+/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
2577+///
2578+/// The lifetime `'b` refers to the lifetime of the haystack being searched.
2579+#[derive(Debug)]
2580+pub struct FindOverlappingIter<'a, 'b, S: StateID> {
2581+ fsm: &'a Imp<S>,
2582+ prestate: PrefilterState,
2583+ haystack: &'b [u8],
2584+ pos: usize,
2585+ last_match_end: usize,
2586+ state_id: S,
2587+ match_index: usize,
2588+}
2589+
2590+impl<'a, 'b, S: StateID> FindOverlappingIter<'a, 'b, S> {
2591+ fn new(
2592+ ac: &'a AhoCorasick<S>,
2593+ haystack: &'b [u8],
2594+ ) -> FindOverlappingIter<'a, 'b, S> {
2595+ assert!(
2596+ ac.supports_overlapping(),
2597+ "automaton does not support overlapping searches"
2598+ );
2599+ let prestate = PrefilterState::new(ac.max_pattern_len());
2600+ FindOverlappingIter {
2601+ fsm: &ac.imp,
2602+ prestate,
2603+ haystack,
2604+ pos: 0,
2605+ last_match_end: 0,
2606+ state_id: ac.imp.start_state(),
2607+ match_index: 0,
2608+ }
2609+ }
2610+}
2611+
2612+impl<'a, 'b, S: StateID> Iterator for FindOverlappingIter<'a, 'b, S> {
2613+ type Item = Match;
2614+
2615+ fn next(&mut self) -> Option<Match> {
2616+ let result = self.fsm.overlapping_find_at(
2617+ &mut self.prestate,
2618+ self.haystack,
2619+ self.pos,
2620+ &mut self.state_id,
2621+ &mut self.match_index,
2622+ );
2623+ match result {
2624+ None => return None,
2625+ Some(m) => {
2626+ self.pos = m.end();
2627+ Some(m)
2628+ }
2629+ }
2630+ }
2631+}
2632+
2633+/// An iterator that reports Aho-Corasick matches in a stream.
2634+///
2635+/// This iterator yields elements of type `io::Result<Match>`, where an error
2636+/// is reported if there was a problem reading from the underlying stream.
2637+/// The iterator terminates only when the underlying stream reaches `EOF`.
2638+///
2639+/// This iterator is constructed via the
2640+/// [`AhoCorasick::stream_find_iter`](struct.AhoCorasick.html#method.stream_find_iter)
2641+/// method.
2642+///
2643+/// The type variable `R` refers to the `io::Read` stream that is being read
2644+/// from.
2645+///
2646+/// The type variable `S` refers to the representation used for state
2647+/// identifiers. (By default, this is `usize`.)
2648+///
2649+/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
2650+#[derive(Debug)]
2651+pub struct StreamFindIter<'a, R, S: StateID> {
2652+ it: StreamChunkIter<'a, R, S>,
2653+}
2654+
2655+impl<'a, R: io::Read, S: StateID> StreamFindIter<'a, R, S> {
2656+ fn new(ac: &'a AhoCorasick<S>, rdr: R) -> StreamFindIter<'a, R, S> {
2657+ StreamFindIter { it: StreamChunkIter::new(ac, rdr) }
2658+ }
2659+}
2660+
2661+impl<'a, R: io::Read, S: StateID> Iterator for StreamFindIter<'a, R, S> {
2662+ type Item = io::Result<Match>;
2663+
2664+ fn next(&mut self) -> Option<io::Result<Match>> {
2665+ loop {
2666+ match self.it.next() {
2667+ None => return None,
2668+ Some(Err(err)) => return Some(Err(err)),
2669+ Some(Ok(StreamChunk::NonMatch { .. })) => {}
2670+ Some(Ok(StreamChunk::Match { mat, .. })) => {
2671+ return Some(Ok(mat));
2672+ }
2673+ }
2674+ }
2675+ }
2676+}
2677+
2678+/// An iterator over chunks in an underlying reader. Each chunk either
2679+/// corresponds to non-matching bytes or matching bytes, but all bytes from
2680+/// the underlying reader are reported in sequence. There may be an arbitrary
2681+/// number of non-matching chunks before seeing a matching chunk.
2682+///
2683+/// N.B. This does not actually implement Iterator because we need to borrow
2684+/// from the underlying reader. But conceptually, it's still an iterator.
2685+#[derive(Debug)]
2686+struct StreamChunkIter<'a, R, S: StateID> {
2687+ /// The AC automaton.
2688+ fsm: &'a Imp<S>,
2689+ /// State associated with this automaton's prefilter. It is a heuristic
2690+ /// for stopping the prefilter if it's deemed ineffective.
2691+ prestate: PrefilterState,
2692+ /// The source of bytes we read from.
2693+ rdr: R,
2694+ /// A fixed size buffer. This is what we actually search. There are some
2695+ /// invariants around the buffer's size, namely, it must be big enough to
2696+ /// contain the longest possible match.
2697+ buf: Buffer,
2698+ /// The ID of the FSM state we're currently in.
2699+ state_id: S,
2700+ /// The current position at which to start the next search in `buf`.
2701+ search_pos: usize,
2702+ /// The absolute position of `search_pos`, where `0` corresponds to the
2703+ /// position of the first byte read from `rdr`.
2704+ absolute_pos: usize,
2705+ /// The ending position of the last StreamChunk that was returned to the
2706+ /// caller. This position is used to determine whether we need to emit
2707+ /// non-matching bytes before emitting a match.
2708+ report_pos: usize,
2709+ /// A match that should be reported on the next call.
2710+ pending_match: Option<Match>,
2711+ /// Enabled only when the automaton can match the empty string. When
2712+ /// enabled, we need to execute one final search after consuming the
2713+ /// reader to find the trailing empty match.
2714+ has_empty_match_at_end: bool,
2715+}
2716+
2717+/// A single chunk yielded by the stream chunk iterator.
2718+///
2719+/// The `'r` lifetime refers to the lifetime of the stream chunk iterator.
2720+#[derive(Debug)]
2721+enum StreamChunk<'r> {
2722+ /// A chunk that does not contain any matches.
2723+ NonMatch { bytes: &'r [u8], start: usize },
2724+ /// A chunk that precisely contains a match.
2725+ Match { bytes: &'r [u8], mat: Match },
2726+}
2727+
2728+impl<'a, R: io::Read, S: StateID> StreamChunkIter<'a, R, S> {
2729+ fn new(ac: &'a AhoCorasick<S>, rdr: R) -> StreamChunkIter<'a, R, S> {
2730+ assert!(
2731+ ac.supports_stream(),
2732+ "stream searching is only supported for Standard match semantics"
2733+ );
2734+
2735+ let prestate = if ac.imp.use_prefilter() {
2736+ PrefilterState::new(ac.max_pattern_len())
2737+ } else {
2738+ PrefilterState::disabled()
2739+ };
2740+ let buf = Buffer::new(ac.imp.max_pattern_len());
2741+ let state_id = ac.imp.start_state();
2742+ StreamChunkIter {
2743+ fsm: &ac.imp,
2744+ prestate,
2745+ rdr,
2746+ buf,
2747+ state_id,
2748+ absolute_pos: 0,
2749+ report_pos: 0,
2750+ search_pos: 0,
2751+ pending_match: None,
2752+ has_empty_match_at_end: ac.is_match(""),
2753+ }
2754+ }
2755+
2756+ fn next<'r>(&'r mut self) -> Option<io::Result<StreamChunk<'r>>> {
2757+ loop {
2758+ if let Some(mut mat) = self.pending_match.take() {
2759+ let bytes = &self.buf.buffer()[mat.start()..mat.end()];
2760+ self.report_pos = mat.end();
2761+ mat = mat.increment(self.absolute_pos);
2762+ return Some(Ok(StreamChunk::Match { bytes, mat }));
2763+ }
2764+ if self.search_pos >= self.buf.len() {
2765+ if let Some(end) = self.unreported() {
2766+ let bytes = &self.buf.buffer()[self.report_pos..end];
2767+ let start = self.absolute_pos + self.report_pos;
2768+ self.report_pos = end;
2769+ return Some(Ok(StreamChunk::NonMatch { bytes, start }));
2770+ }
2771+ if self.buf.len() >= self.buf.min_buffer_len() {
2772+ // This is the point at which we roll our buffer, which we
2773+ // only do if our buffer has at least the minimum amount of
2774+ // bytes in it. Before rolling, we update our various
2775+ // positions to be consistent with the buffer after it has
2776+ // been rolled.
2777+
2778+ self.report_pos -=
2779+ self.buf.len() - self.buf.min_buffer_len();
2780+ self.absolute_pos +=
2781+ self.search_pos - self.buf.min_buffer_len();
2782+ self.search_pos = self.buf.min_buffer_len();
2783+ self.buf.roll();
2784+ }
2785+ match self.buf.fill(&mut self.rdr) {
2786+ Err(err) => return Some(Err(err)),
2787+ Ok(false) => {
2788+ // We've hit EOF, but if there are still some
2789+ // unreported bytes remaining, return them now.
2790+ if self.report_pos < self.buf.len() {
2791+ let bytes = &self.buf.buffer()[self.report_pos..];
2792+ let start = self.absolute_pos + self.report_pos;
2793+ self.report_pos = self.buf.len();
2794+
2795+ let chunk = StreamChunk::NonMatch { bytes, start };
2796+ return Some(Ok(chunk));
2797+ } else {
2798+ // We've reported everything, but there might still
2799+ // be a match at the very last position.
2800+ if !self.has_empty_match_at_end {
2801+ return None;
2802+ }
2803+ // fallthrough for another search to get trailing
2804+ // empty matches
2805+ self.has_empty_match_at_end = false;
2806+ }
2807+ }
2808+ Ok(true) => {}
2809+ }
2810+ }
2811+ let result = self.fsm.earliest_find_at(
2812+ &mut self.prestate,
2813+ self.buf.buffer(),
2814+ self.search_pos,
2815+ &mut self.state_id,
2816+ );
2817+ match result {
2818+ None => {
2819+ self.search_pos = self.buf.len();
2820+ }
2821+ Some(mat) => {
2822+ self.state_id = self.fsm.start_state();
2823+ if mat.end() == self.search_pos {
2824+ // If the automaton can match the empty string and if
2825+ // we found an empty match, then we need to forcefully
2826+ // move the position.
2827+ self.search_pos += 1;
2828+ } else {
2829+ self.search_pos = mat.end();
2830+ }
2831+ self.pending_match = Some(mat.clone());
2832+ if self.report_pos < mat.start() {
2833+ let bytes =
2834+ &self.buf.buffer()[self.report_pos..mat.start()];
2835+ let start = self.absolute_pos + self.report_pos;
2836+ self.report_pos = mat.start();
2837+
2838+ let chunk = StreamChunk::NonMatch { bytes, start };
2839+ return Some(Ok(chunk));
2840+ }
2841+ }
2842+ }
2843+ }
2844+ }
2845+
2846+ fn unreported(&self) -> Option<usize> {
2847+ let end = self.search_pos.saturating_sub(self.buf.min_buffer_len());
2848+ if self.report_pos < end {
2849+ Some(end)
2850+ } else {
2851+ None
2852+ }
2853+ }
2854+}
2855+
2856+/// A builder for configuring an Aho-Corasick automaton.
2857+#[derive(Clone, Debug)]
2858+pub struct AhoCorasickBuilder {
2859+ nfa_builder: nfa::Builder,
2860+ dfa_builder: dfa::Builder,
2861+ dfa: bool,
2862+}
2863+
2864+impl Default for AhoCorasickBuilder {
2865+ fn default() -> AhoCorasickBuilder {
2866+ AhoCorasickBuilder::new()
2867+ }
2868+}
2869+
2870+impl AhoCorasickBuilder {
2871+ /// Create a new builder for configuring an Aho-Corasick automaton.
2872+ ///
2873+ /// If you don't need fine grained configuration or aren't sure which knobs
2874+ /// to set, try using
2875+ /// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured)
2876+ /// instead.
2877+ pub fn new() -> AhoCorasickBuilder {
2878+ AhoCorasickBuilder {
2879+ nfa_builder: nfa::Builder::new(),
2880+ dfa_builder: dfa::Builder::new(),
2881+ dfa: false,
2882+ }
2883+ }
2884+
2885+ /// Build an Aho-Corasick automaton using the configuration set on this
2886+ /// builder.
2887+ ///
2888+ /// A builder may be reused to create more automatons.
2889+ ///
2890+ /// This method will use the default for representing internal state
2891+ /// identifiers, which is `usize`. This guarantees that building the
2892+ /// automaton will succeed and is generally a good default, but can make
2893+ /// the size of the automaton 2-8 times bigger than it needs to be,
2894+ /// depending on your target platform.
2895+ ///
2896+ /// # Examples
2897+ ///
2898+ /// Basic usage:
2899+ ///
2900+ /// ```
2901+ /// use aho_corasick::AhoCorasickBuilder;
2902+ ///
2903+ /// let patterns = &["foo", "bar", "baz"];
2904+ /// let ac = AhoCorasickBuilder::new()
2905+ /// .build(patterns);
2906+ /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
2907+ /// ```
2908+ pub fn build<I, P>(&self, patterns: I) -> AhoCorasick
2909+ where
2910+ I: IntoIterator<Item = P>,
2911+ P: AsRef<[u8]>,
2912+ {
2913+ // The builder only returns an error if the chosen state ID
2914+ // representation is too small to fit all of the given patterns. In
2915+ // this case, since we fix the representation to usize, it will always
2916+ // work because it's impossible to overflow usize since the underlying
2917+ // storage would OOM long before that happens.
2918+ self.build_with_size::<usize, I, P>(patterns)
2919+ .expect("usize state ID type should always work")
2920+ }
2921+
2922+ /// Build an Aho-Corasick automaton using the configuration set on this
2923+ /// builder with a specific state identifier representation. This only has
2924+ /// an effect when the `dfa` option is enabled.
2925+ ///
2926+ /// Generally, the choices for a state identifier representation are
2927+ /// `u8`, `u16`, `u32`, `u64` or `usize`, with `usize` being the default.
2928+ /// The advantage of choosing a smaller state identifier representation
2929+ /// is that the automaton produced will be smaller. This might be
2930+ /// beneficial for just generally using less space, or might even allow it
2931+ /// to fit more of the automaton in your CPU's cache, leading to overall
2932+ /// better search performance.
2933+ ///
2934+ /// Unlike the standard `build` method, this can report an error if the
2935+ /// state identifier representation cannot support the size of the
2936+ /// automaton.
2937+ ///
2938+ /// Note that the state identifier representation is determined by the
2939+ /// `S` type variable. This requires a type hint of some sort, either
2940+ /// by specifying the return type or using the turbofish, e.g.,
2941+ /// `build_with_size::<u16, _, _>(...)`.
2942+ ///
2943+ /// # Examples
2944+ ///
2945+ /// Basic usage:
2946+ ///
2947+ /// ```
2948+ /// use aho_corasick::{AhoCorasick, AhoCorasickBuilder};
2949+ ///
2950+ /// # fn example() -> Result<(), ::aho_corasick::Error> {
2951+ /// let patterns = &["foo", "bar", "baz"];
2952+ /// let ac: AhoCorasick<u8> = AhoCorasickBuilder::new()
2953+ /// .build_with_size(patterns)?;
2954+ /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
2955+ /// # Ok(()) }; example().unwrap()
2956+ /// ```
2957+ ///
2958+ /// Or alternatively, with turbofish:
2959+ ///
2960+ /// ```
2961+ /// use aho_corasick::AhoCorasickBuilder;
2962+ ///
2963+ /// # fn example() -> Result<(), ::aho_corasick::Error> {
2964+ /// let patterns = &["foo", "bar", "baz"];
2965+ /// let ac = AhoCorasickBuilder::new()
2966+ /// .build_with_size::<u8, _, _>(patterns)?;
2967+ /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
2968+ /// # Ok(()) }; example().unwrap()
2969+ /// ```
2970+ pub fn build_with_size<S, I, P>(
2971+ &self,
2972+ patterns: I,
2973+ ) -> Result<AhoCorasick<S>>
2974+ where
2975+ S: StateID,
2976+ I: IntoIterator<Item = P>,
2977+ P: AsRef<[u8]>,
2978+ {
2979+ let nfa = self.nfa_builder.build(patterns)?;
2980+ let match_kind = nfa.match_kind().clone();
2981+ let imp = if self.dfa {
2982+ let dfa = self.dfa_builder.build(&nfa)?;
2983+ Imp::DFA(dfa)
2984+ } else {
2985+ Imp::NFA(nfa)
2986+ };
2987+ Ok(AhoCorasick { imp, match_kind })
2988+ }
2989+
2990+ /// Automatically configure the settings on this builder according to the
2991+ /// patterns that will be used to construct the automaton.
2992+ ///
2993+ /// The idea here is to balance space and time automatically. That is, when
2994+ /// searching a small number of patterns, this will attempt to use the
2995+ /// fastest possible configuration since the total space required will be
2996+ /// small anyway. As the number of patterns grows, this will fall back to
2997+ /// slower configurations that use less space.
2998+ ///
2999+ /// This is guaranteed to never set `match_kind`, but any other option may
3000+ /// be overridden.
3001+ ///
3002+ /// # Examples
3003+ ///
3004+ /// Basic usage:
3005+ ///
3006+ /// ```
3007+ /// use aho_corasick::AhoCorasickBuilder;
3008+ ///
3009+ /// let patterns = &["foo", "bar", "baz"];
3010+ /// let ac = AhoCorasickBuilder::new()
3011+ /// .auto_configure(patterns)
3012+ /// .build(patterns);
3013+ /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
3014+ /// ```
3015+ pub fn auto_configure<B: AsRef<[u8]>>(
3016+ &mut self,
3017+ patterns: &[B],
3018+ ) -> &mut AhoCorasickBuilder {
3019+ // N.B. Currently we only use the length of `patterns` to make a
3020+ // decision here, and could therefore ask for an `ExactSizeIterator`
3021+ // instead. But it's conceivable that we might adapt this to look at
3022+ // the total number of bytes, which would requires a second pass.
3023+ //
3024+ // The logic here is fairly rudimentary at the moment, but probably
3025+ // OK. The idea here is to use the fastest thing possible for a small
3026+ // number of patterns. That is, a DFA with no byte classes, since byte
3027+ // classes require an extra indirection for every byte searched. With a
3028+ // moderate number of patterns, we still want a DFA, but save on both
3029+ // space and compilation time by enabling byte classes. Finally, fall
3030+ // back to the slower but smaller NFA.
3031+ if patterns.len() <= 100 {
3032+ // N.B. Using byte classes can actually be faster by improving
3033+ // locality, but this only really applies for multi-megabyte
3034+ // automata (i.e., automata that don't fit in your CPU's cache).
3035+ self.dfa(true);
3036+ } else if patterns.len() <= 5000 {
3037+ self.dfa(true);
3038+ }
3039+ self
3040+ }
3041+
3042+ /// Set the desired match semantics.
3043+ ///
3044+ /// The default is `MatchKind::Standard`, which corresponds to the match
3045+ /// semantics supported by the standard textbook description of the
3046+ /// Aho-Corasick algorithm. Namely, matches are reported as soon as they
3047+ /// are found. Moreover, this is the only way to get overlapping matches
3048+ /// or do stream searching.
3049+ ///
3050+ /// The other kinds of match semantics that are supported are
3051+ /// `MatchKind::LeftmostFirst` and `MatchKind::LeftmostLongest`. The former
3052+ /// corresponds to the match you would get if you were to try to match
3053+ /// each pattern at each position in the haystack in the same order that
3054+ /// you give to the automaton. That is, it returns the leftmost match
3055+ /// corresponding the earliest pattern given to the automaton. The latter
3056+ /// corresponds to finding the longest possible match among all leftmost
3057+ /// matches.
3058+ ///
3059+ /// For more details on match semantics, see the
3060+ /// [documentation for `MatchKind`](enum.MatchKind.html).
3061+ ///
3062+ /// # Examples
3063+ ///
3064+ /// In these examples, we demonstrate the differences between match
3065+ /// semantics for a particular set of patterns in a specific order:
3066+ /// `b`, `abc`, `abcd`.
3067+ ///
3068+ /// Standard semantics:
3069+ ///
3070+ /// ```
3071+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
3072+ ///
3073+ /// let patterns = &["b", "abc", "abcd"];
3074+ /// let haystack = "abcd";
3075+ ///
3076+ /// let ac = AhoCorasickBuilder::new()
3077+ /// .match_kind(MatchKind::Standard) // default, not necessary
3078+ /// .build(patterns);
3079+ /// let mat = ac.find(haystack).expect("should have a match");
3080+ /// assert_eq!("b", &haystack[mat.start()..mat.end()]);
3081+ /// ```
3082+ ///
3083+ /// Leftmost-first semantics:
3084+ ///
3085+ /// ```
3086+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
3087+ ///
3088+ /// let patterns = &["b", "abc", "abcd"];
3089+ /// let haystack = "abcd";
3090+ ///
3091+ /// let ac = AhoCorasickBuilder::new()
3092+ /// .match_kind(MatchKind::LeftmostFirst)
3093+ /// .build(patterns);
3094+ /// let mat = ac.find(haystack).expect("should have a match");
3095+ /// assert_eq!("abc", &haystack[mat.start()..mat.end()]);
3096+ /// ```
3097+ ///
3098+ /// Leftmost-longest semantics:
3099+ ///
3100+ /// ```
3101+ /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
3102+ ///
3103+ /// let patterns = &["b", "abc", "abcd"];
3104+ /// let haystack = "abcd";
3105+ ///
3106+ /// let ac = AhoCorasickBuilder::new()
3107+ /// .match_kind(MatchKind::LeftmostLongest)
3108+ /// .build(patterns);
3109+ /// let mat = ac.find(haystack).expect("should have a match");
3110+ /// assert_eq!("abcd", &haystack[mat.start()..mat.end()]);
3111+ /// ```
3112+ pub fn match_kind(&mut self, kind: MatchKind) -> &mut AhoCorasickBuilder {
3113+ self.nfa_builder.match_kind(kind);
3114+ self
3115+ }
3116+
3117+ /// Enable anchored mode, which requires all matches to start at the
3118+ /// first position in a haystack.
3119+ ///
3120+ /// This option is disabled by default.
3121+ ///
3122+ /// # Examples
3123+ ///
3124+ /// Basic usage:
3125+ ///
3126+ /// ```
3127+ /// use aho_corasick::AhoCorasickBuilder;
3128+ ///
3129+ /// let patterns = &["foo", "bar"];
3130+ /// let haystack = "foobar";
3131+ ///
3132+ /// let ac = AhoCorasickBuilder::new()
3133+ /// .anchored(true)
3134+ /// .build(patterns);
3135+ /// assert_eq!(1, ac.find_iter(haystack).count());
3136+ /// ```
3137+ ///
3138+ /// When searching for overlapping matches, all matches that start at
3139+ /// the beginning of a haystack will be reported:
3140+ ///
3141+ /// ```
3142+ /// use aho_corasick::AhoCorasickBuilder;
3143+ ///
3144+ /// let patterns = &["foo", "foofoo"];
3145+ /// let haystack = "foofoo";
3146+ ///
3147+ /// let ac = AhoCorasickBuilder::new()
3148+ /// .anchored(true)
3149+ /// .build(patterns);
3150+ /// assert_eq!(2, ac.find_overlapping_iter(haystack).count());
3151+ /// // A non-anchored search would return 3 matches.
3152+ /// ```
3153+ pub fn anchored(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
3154+ self.nfa_builder.anchored(yes);
3155+ self
3156+ }
3157+
3158+ /// Enable ASCII-aware case insensitive matching.
3159+ ///
3160+ /// When this option is enabled, searching will be performed without
3161+ /// respect to case for ASCII letters (`a-z` and `A-Z`) only.
3162+ ///
3163+ /// Enabling this option does not change the search algorithm, but it may
3164+ /// increase the size of the automaton.
3165+ ///
3166+ /// **NOTE:** In the future, support for full Unicode case insensitivity
3167+ /// may be added, but ASCII case insensitivity is comparatively much
3168+ /// simpler to add.
3169+ ///
3170+ /// # Examples
3171+ ///
3172+ /// Basic usage:
3173+ ///
3174+ /// ```
3175+ /// use aho_corasick::AhoCorasickBuilder;
3176+ ///
3177+ /// let patterns = &["FOO", "bAr", "BaZ"];
3178+ /// let haystack = "foo bar baz";
3179+ ///
3180+ /// let ac = AhoCorasickBuilder::new()
3181+ /// .ascii_case_insensitive(true)
3182+ /// .build(patterns);
3183+ /// assert_eq!(3, ac.find_iter(haystack).count());
3184+ /// ```
3185+ pub fn ascii_case_insensitive(
3186+ &mut self,
3187+ yes: bool,
3188+ ) -> &mut AhoCorasickBuilder {
3189+ self.nfa_builder.ascii_case_insensitive(yes);
3190+ self
3191+ }
3192+
3193+ /// Set the limit on how many NFA states use a dense representation for
3194+ /// their transitions.
3195+ ///
3196+ /// A dense representation uses more space, but supports faster access to
3197+ /// transitions at search time. Thus, this setting permits the control of a
3198+ /// space vs time trade off when using the NFA variant of Aho-Corasick.
3199+ ///
3200+ /// This limit is expressed in terms of the depth of a state, i.e., the
3201+ /// number of transitions from the starting state of the NFA. The idea is
3202+ /// that most of the time searching will be spent near the starting state
3203+ /// of the automaton, so states near the start state should use a dense
3204+ /// representation. States further away from the start state would then use
3205+ /// a sparse representation, which uses less space but is slower to access
3206+ /// transitions at search time.
3207+ ///
3208+ /// By default, this is set to a low but non-zero number.
3209+ ///
3210+ /// This setting has no effect if the `dfa` option is enabled.
3211+ pub fn dense_depth(&mut self, depth: usize) -> &mut AhoCorasickBuilder {
3212+ self.nfa_builder.dense_depth(depth);
3213+ self
3214+ }
3215+
3216+ /// Compile the standard Aho-Corasick automaton into a deterministic finite
3217+ /// automaton (DFA).
3218+ ///
3219+ /// When this is disabled (which is the default), then a non-deterministic
3220+ /// finite automaton (NFA) is used instead.
3221+ ///
3222+ /// The main benefit to a DFA is that it can execute searches more quickly
3223+ /// than a NFA (perhaps 2-4 times as fast). The main drawback is that the
3224+ /// DFA uses more space and can take much longer to build.
3225+ ///
3226+ /// Enabling this option does not change the time complexity for
3227+ /// constructing the Aho-Corasick automaton (which is `O(p)` where
3228+ /// `p` is the total number of patterns being compiled). Enabling this
3229+ /// option does however reduce the time complexity of non-overlapping
3230+ /// searches from `O(n + p)` to `O(n)`, where `n` is the length of the
3231+ /// haystack.
3232+ ///
3233+ /// In general, it's a good idea to enable this if you're searching a
3234+ /// small number of fairly short patterns (~1000), or if you want the
3235+ /// fastest possible search without regard to compilation time or space
3236+ /// usage.
3237+ pub fn dfa(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
3238+ self.dfa = yes;
3239+ self
3240+ }
3241+
3242+ /// Enable heuristic prefilter optimizations.
3243+ ///
3244+ /// When enabled, searching will attempt to quickly skip to match
3245+ /// candidates using specialized literal search routines. A prefilter
3246+ /// cannot always be used, and is generally treated as a heuristic. It
3247+ /// can be useful to disable this if the prefilter is observed to be
3248+ /// sub-optimal for a particular workload.
3249+ ///
3250+ /// This is enabled by default.
3251+ pub fn prefilter(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
3252+ self.nfa_builder.prefilter(yes);
3253+ self
3254+ }
3255+
3256+ /// Shrink the size of the transition alphabet by mapping bytes to their
3257+ /// equivalence classes. This only has an effect when the `dfa` option is
3258+ /// enabled.
3259+ ///
3260+ /// When enabled, each a DFA will use a map from all possible bytes
3261+ /// to their corresponding equivalence class. Each equivalence class
3262+ /// represents a set of bytes that does not discriminate between a match
3263+ /// and a non-match in the DFA. For example, the patterns `bar` and `baz`
3264+ /// have at least five equivalence classes: singleton sets of `b`, `a`, `r`
3265+ /// and `z`, and a final set that contains every other byte.
3266+ ///
3267+ /// The advantage of this map is that the size of the transition table can
3268+ /// be reduced drastically from `#states * 256 * sizeof(id)` to
3269+ /// `#states * k * sizeof(id)` where `k` is the number of equivalence
3270+ /// classes. As a result, total space usage can decrease substantially.
3271+ /// Moreover, since a smaller alphabet is used, compilation becomes faster
3272+ /// as well.
3273+ ///
3274+ /// The disadvantage of this map is that every byte searched must be
3275+ /// passed through this map before it can be used to determine the next
3276+ /// transition. This has a small match time performance cost. However, if
3277+ /// the DFA is otherwise very large without byte classes, then using byte
3278+ /// classes can greatly improve memory locality and thus lead to better
3279+ /// overall performance.
3280+ ///
3281+ /// This option is enabled by default.
3282+ #[deprecated(
3283+ since = "0.7.16",
3284+ note = "not carrying its weight, will be always enabled, see: https://github.com/BurntSushi/aho-corasick/issues/57"
3285+ )]
3286+ pub fn byte_classes(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
3287+ self.dfa_builder.byte_classes(yes);
3288+ self
3289+ }
3290+
3291+ /// Premultiply state identifiers in the transition table. This only has
3292+ /// an effect when the `dfa` option is enabled.
3293+ ///
3294+ /// When enabled, state identifiers are premultiplied to point to their
3295+ /// corresponding row in the transition table. That is, given the `i`th
3296+ /// state, its corresponding premultiplied identifier is `i * k` where `k`
3297+ /// is the alphabet size of the automaton. (The alphabet size is at most
3298+ /// 256, but is in practice smaller if byte classes is enabled.)
3299+ ///
3300+ /// When state identifiers are not premultiplied, then the identifier of
3301+ /// the `i`th state is `i`.
3302+ ///
3303+ /// The advantage of premultiplying state identifiers is that is saves a
3304+ /// multiplication instruction per byte when searching with a DFA. This has
3305+ /// been observed to lead to a 20% performance benefit in micro-benchmarks.
3306+ ///
3307+ /// The primary disadvantage of premultiplying state identifiers is
3308+ /// that they require a larger integer size to represent. For example,
3309+ /// if the DFA has 200 states, then its premultiplied form requires 16
3310+ /// bits to represent every possible state identifier, where as its
3311+ /// non-premultiplied form only requires 8 bits.
3312+ ///
3313+ /// This option is enabled by default.
3314+ #[deprecated(
3315+ since = "0.7.16",
3316+ note = "not carrying its weight, will be always enabled, see: https://github.com/BurntSushi/aho-corasick/issues/57"
3317+ )]
3318+ pub fn premultiply(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
3319+ self.dfa_builder.premultiply(yes);
3320+ self
3321+ }
3322+}
3323+
3324+/// A knob for controlling the match semantics of an Aho-Corasick automaton.
3325+///
3326+/// There are two generally different ways that Aho-Corasick automatons can
3327+/// report matches. The first way is the "standard" approach that results from
3328+/// implementing most textbook explanations of Aho-Corasick. The second way is
3329+/// to report only the leftmost non-overlapping matches. The leftmost approach
3330+/// is in turn split into two different ways of resolving ambiguous matches:
3331+/// leftmost-first and leftmost-longest.
3332+///
3333+/// The `Standard` match kind is the default and is the only one that supports
3334+/// overlapping matches and stream searching. (Trying to find overlapping
3335+/// or streaming matches using leftmost match semantics will result in a
3336+/// panic.) The `Standard` match kind will report matches as they are seen.
3337+/// When searching for overlapping matches, then all possible matches are
3338+/// reported. When searching for non-overlapping matches, the first match seen
3339+/// is reported. For example, for non-overlapping matches, given the patterns
3340+/// `abcd` and `b` and the subject string `abcdef`, only a match for `b` is
3341+/// reported since it is detected first. The `abcd` match is never reported
3342+/// since it overlaps with the `b` match.
3343+///
3344+/// In contrast, the leftmost match kind always prefers the leftmost match
3345+/// among all possible matches. Given the same example as above with `abcd` and
3346+/// `b` as patterns and `abcdef` as the subject string, the leftmost match is
3347+/// `abcd` since it begins before the `b` match, even though the `b` match is
3348+/// detected before the `abcd` match. In this case, the `b` match is not
3349+/// reported at all since it overlaps with the `abcd` match.
3350+///
3351+/// The difference between leftmost-first and leftmost-longest is in how they
3352+/// resolve ambiguous matches when there are multiple leftmost matches to
3353+/// choose from. Leftmost-first always chooses the pattern that was provided
3354+/// earliest, where as leftmost-longest always chooses the longest matching
3355+/// pattern. For example, given the patterns `a` and `ab` and the subject
3356+/// string `ab`, the leftmost-first match is `a` but the leftmost-longest match
3357+/// is `ab`. Conversely, if the patterns were given in reverse order, i.e.,
3358+/// `ab` and `a`, then both the leftmost-first and leftmost-longest matches
3359+/// would be `ab`. Stated differently, the leftmost-first match depends on the
3360+/// order in which the patterns were given to the Aho-Corasick automaton.
3361+/// Because of that, when leftmost-first matching is used, if a pattern `A`
3362+/// that appears before a pattern `B` is a prefix of `B`, then it is impossible
3363+/// to ever observe a match of `B`.
3364+///
3365+/// If you're not sure which match kind to pick, then stick with the standard
3366+/// kind, which is the default. In particular, if you need overlapping or
3367+/// streaming matches, then you _must_ use the standard kind. The leftmost
3368+/// kinds are useful in specific circumstances. For example, leftmost-first can
3369+/// be very useful as a way to implement match priority based on the order of
3370+/// patterns given and leftmost-longest can be useful for dictionary searching
3371+/// such that only the longest matching words are reported.
3372+///
3373+/// # Relationship with regular expression alternations
3374+///
3375+/// Understanding match semantics can be a little tricky, and one easy way
3376+/// to conceptualize non-overlapping matches from an Aho-Corasick automaton
3377+/// is to think about them as a simple alternation of literals in a regular
3378+/// expression. For example, let's say we wanted to match the strings
3379+/// `Sam` and `Samwise`, which would turn into the regex `Sam|Samwise`. It
3380+/// turns out that regular expression engines have two different ways of
3381+/// matching this alternation. The first way, leftmost-longest, is commonly
3382+/// found in POSIX compatible implementations of regular expressions (such as
3383+/// `grep`). The second way, leftmost-first, is commonly found in backtracking
3384+/// implementations such as Perl. (Some regex engines, such as RE2 and Rust's
3385+/// regex engine do not use backtracking, but still implement leftmost-first
3386+/// semantics in an effort to match the behavior of dominant backtracking
3387+/// regex engines such as those found in Perl, Ruby, Python, Javascript and
3388+/// PHP.)
3389+///
3390+/// That is, when matching `Sam|Samwise` against `Samwise`, a POSIX regex
3391+/// will match `Samwise` because it is the longest possible match, but a
3392+/// Perl-like regex will match `Sam` since it appears earlier in the
3393+/// alternation. Indeed, the regex `Sam|Samwise` in a Perl-like regex engine
3394+/// will never match `Samwise` since `Sam` will always have higher priority.
3395+/// Conversely, matching the regex `Samwise|Sam` against `Samwise` will lead to
3396+/// a match of `Samwise` in both POSIX and Perl-like regexes since `Samwise` is
3397+/// still longest match, but it also appears earlier than `Sam`.
3398+///
3399+/// The "standard" match semantics of Aho-Corasick generally don't correspond
3400+/// to the match semantics of any large group of regex implementations, so
3401+/// there's no direct analogy that can be made here. Standard match semantics
3402+/// are generally useful for overlapping matches, or if you just want to see
3403+/// matches as they are detected.
3404+///
3405+/// The main conclusion to draw from this section is that the match semantics
3406+/// can be tweaked to precisely match either Perl-like regex alternations or
3407+/// POSIX regex alternations.
3408+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
3409+pub enum MatchKind {
3410+ /// Use standard match semantics, which support overlapping matches. When
3411+ /// used with non-overlapping matches, matches are reported as they are
3412+ /// seen.
3413+ Standard,
3414+ /// Use leftmost-first match semantics, which reports leftmost matches.
3415+ /// When there are multiple possible leftmost matches, the match
3416+ /// corresponding to the pattern that appeared earlier when constructing
3417+ /// the automaton is reported.
3418+ ///
3419+ /// This does **not** support overlapping matches or stream searching. If
3420+ /// this match kind is used, attempting to find overlapping matches or
3421+ /// stream matches will panic.
3422+ LeftmostFirst,
3423+ /// Use leftmost-longest match semantics, which reports leftmost matches.
3424+ /// When there are multiple possible leftmost matches, the longest match
3425+ /// is chosen.
3426+ ///
3427+ /// This does **not** support overlapping matches or stream searching. If
3428+ /// this match kind is used, attempting to find overlapping matches or
3429+ /// stream matches will panic.
3430+ LeftmostLongest,
3431+ /// Hints that destructuring should not be exhaustive.
3432+ ///
3433+ /// This enum may grow additional variants, so this makes sure clients
3434+ /// don't count on exhaustive matching. (Otherwise, adding a new variant
3435+ /// could break existing code.)
3436+ #[doc(hidden)]
3437+ __Nonexhaustive,
3438+}
3439+
3440+/// The default match kind is `MatchKind::Standard`.
3441+impl Default for MatchKind {
3442+ fn default() -> MatchKind {
3443+ MatchKind::Standard
3444+ }
3445+}
3446+
3447+impl MatchKind {
3448+ fn supports_overlapping(&self) -> bool {
3449+ self.is_standard()
3450+ }
3451+
3452+ fn supports_stream(&self) -> bool {
3453+ // TODO: It may be possible to support this. It's hard.
3454+ //
3455+ // See: https://github.com/rust-lang/regex/issues/425#issuecomment-471367838
3456+ self.is_standard()
3457+ }
3458+
3459+ pub(crate) fn is_standard(&self) -> bool {
3460+ *self == MatchKind::Standard
3461+ }
3462+
3463+ pub(crate) fn is_leftmost(&self) -> bool {
3464+ *self == MatchKind::LeftmostFirst
3465+ || *self == MatchKind::LeftmostLongest
3466+ }
3467+
3468+ pub(crate) fn is_leftmost_first(&self) -> bool {
3469+ *self == MatchKind::LeftmostFirst
3470+ }
3471+
3472+ /// Convert this match kind into a packed match kind. If this match kind
3473+ /// corresponds to standard semantics, then this returns None, since
3474+ /// packed searching does not support standard semantics.
3475+ pub(crate) fn as_packed(&self) -> Option<packed::MatchKind> {
3476+ match *self {
3477+ MatchKind::Standard => None,
3478+ MatchKind::LeftmostFirst => Some(packed::MatchKind::LeftmostFirst),
3479+ MatchKind::LeftmostLongest => {
3480+ Some(packed::MatchKind::LeftmostLongest)
3481+ }
3482+ MatchKind::__Nonexhaustive => unreachable!(),
3483+ }
3484+ }
3485+}
3486+
3487+#[cfg(test)]
3488+mod tests {
3489+ use super::*;
3490+
3491+ #[test]
3492+ fn oibits() {
3493+ use std::panic::{RefUnwindSafe, UnwindSafe};
3494+
3495+ fn assert_send<T: Send>() {}
3496+ fn assert_sync<T: Sync>() {}
3497+ fn assert_unwind_safe<T: RefUnwindSafe + UnwindSafe>() {}
3498+
3499+ assert_send::<AhoCorasick>();
3500+ assert_sync::<AhoCorasick>();
3501+ assert_unwind_safe::<AhoCorasick>();
3502+ assert_send::<AhoCorasickBuilder>();
3503+ assert_sync::<AhoCorasickBuilder>();
3504+ assert_unwind_safe::<AhoCorasickBuilder>();
3505+ }
3506+}
3507diff --git a/vendor/aho-corasick/src/automaton.rs b/vendor/aho-corasick/src/automaton.rs
3508new file mode 100644
3509index 0000000..b971bf3
3510--- /dev/null
3511+++ b/vendor/aho-corasick/src/automaton.rs
3512@@ -0,0 +1,573 @@
3513+use crate::ahocorasick::MatchKind;
3514+use crate::prefilter::{self, Candidate, Prefilter, PrefilterState};
3515+use crate::state_id::{dead_id, fail_id, StateID};
3516+use crate::Match;
3517+
3518+// NOTE: This trait essentially started as a copy of the same trait from from
3519+// regex-automata, with some wording changed since we use this trait for
3520+// NFAs in addition to DFAs in this crate. Additionally, we do not export
3521+// this trait. It's only used internally to reduce code duplication. The
3522+// regex-automata crate needs to expose it because its Regex type is generic
3523+// over implementations of this trait. In this crate, we encapsulate everything
3524+// behind the AhoCorasick type.
3525+//
3526+// This trait is a bit of a mess, but it's not quite clear how to fix it.
3527+// Basically, there are several competing concerns:
3528+//
3529+// * We need performance, so everything effectively needs to get monomorphized.
3530+// * There are several variations on searching Aho-Corasick automatons:
3531+// overlapping, standard and leftmost. Overlapping and standard are somewhat
3532+// combined together below, but there is no real way to combine standard with
3533+// leftmost. Namely, leftmost requires continuing a search even after a match
3534+// is found, in order to correctly disambiguate a match.
3535+// * On top of that, *sometimes* callers want to know which state the automaton
3536+// is in after searching. This is principally useful for overlapping and
3537+// stream searches. However, when callers don't care about this, we really
3538+// do not want to be forced to compute it, since it sometimes requires extra
3539+// work. Thus, there are effectively two copies of leftmost searching: one
3540+// for tracking the state ID and one that doesn't. We should ideally do the
3541+// same for standard searching, but my sanity stopped me.
3542+
3543+// SAFETY RATIONALE: Previously, the code below went to some length to remove
3544+// all bounds checks. This generally produced tighter assembly and lead to
3545+// 20-50% improvements in micro-benchmarks on corpora made up of random
3546+// characters. This somewhat makes sense, since the branch predictor is going
3547+// to be at its worse on random text.
3548+//
3549+// However, using the aho-corasick-debug tool and manually benchmarking
3550+// different inputs, the code *with* bounds checks actually wound up being
3551+// slightly faster:
3552+//
3553+// $ cat input
3554+// Sherlock Holmes
3555+// John Watson
3556+// Professor Moriarty
3557+// Irene Adler
3558+// Mary Watson
3559+//
3560+// $ aho-corasick-debug-safe \
3561+// input OpenSubtitles2018.raw.sample.en --kind leftmost-first --dfa
3562+// pattern read time: 32.824µs
3563+// automaton build time: 444.687µs
3564+// automaton heap usage: 72392 bytes
3565+// match count: 639
3566+// count time: 1.809961702s
3567+//
3568+// $ aho-corasick-debug-master \
3569+// input OpenSubtitles2018.raw.sample.en --kind leftmost-first --dfa
3570+// pattern read time: 31.425µs
3571+// automaton build time: 317.434µs
3572+// automaton heap usage: 72392 bytes
3573+// match count: 639
3574+// count time: 2.059157705s
3575+//
3576+// I was able to reproduce this result on two different machines (an i5 and
3577+// an i7). Therefore, we go the route of safe code for now.
3578+
3579+/// A trait describing the interface of an Aho-Corasick finite state machine.
3580+///
3581+/// Every automaton has exactly one fail state, one dead state and exactly one
3582+/// start state. Generally, these correspond to the first, second and third
3583+/// states, respectively. The failure state is always treated as a sentinel.
3584+/// That is, no correct Aho-Corasick automaton will ever transition into the
3585+/// fail state. The dead state, however, can be transitioned into, but only
3586+/// when leftmost-first or leftmost-longest match semantics are enabled and
3587+/// only when at least one match has been observed.
3588+///
3589+/// Every automaton also has one or more match states, such that
3590+/// `Automaton::is_match_state(id)` returns `true` if and only if `id`
3591+/// corresponds to a match state.
3592+pub trait Automaton {
3593+ /// The representation used for state identifiers in this automaton.
3594+ ///
3595+ /// Typically, this is one of `u8`, `u16`, `u32`, `u64` or `usize`.
3596+ type ID: StateID;
3597+
3598+ /// The type of matching that should be done.
3599+ fn match_kind(&self) -> &MatchKind;
3600+
3601+ /// Returns true if and only if this automaton uses anchored searches.
3602+ fn anchored(&self) -> bool;
3603+
3604+ /// An optional prefilter for quickly skipping to the next candidate match.
3605+ /// A prefilter must report at least every match, although it may report
3606+ /// positions that do not correspond to a match. That is, it must not allow
3607+ /// false negatives, but can allow false positives.
3608+ ///
3609+ /// Currently, a prefilter only runs when the automaton is in the start
3610+ /// state. That is, the position reported by a prefilter should always
3611+ /// correspond to the start of a potential match.
3612+ fn prefilter(&self) -> Option<&dyn Prefilter>;
3613+
3614+ /// Return the identifier of this automaton's start state.
3615+ fn start_state(&self) -> Self::ID;
3616+
3617+ /// Returns true if and only if the given state identifier refers to a
3618+ /// valid state.
3619+ fn is_valid(&self, id: Self::ID) -> bool;
3620+
3621+ /// Returns true if and only if the given identifier corresponds to a match
3622+ /// state.
3623+ ///
3624+ /// The state ID given must be valid, or else implementors may panic.
3625+ fn is_match_state(&self, id: Self::ID) -> bool;
3626+
3627+ /// Returns true if and only if the given identifier corresponds to a state
3628+ /// that is either the dead state or a match state.
3629+ ///
3630+ /// Depending on the implementation of the automaton, this routine can
3631+ /// be used to save a branch in the core matching loop. Nevertheless,
3632+ /// `is_match_state(id) || id == dead_id()` is always a valid
3633+ /// implementation. Indeed, this is the default implementation.
3634+ ///
3635+ /// The state ID given must be valid, or else implementors may panic.
3636+ fn is_match_or_dead_state(&self, id: Self::ID) -> bool {
3637+ id == dead_id() || self.is_match_state(id)
3638+ }
3639+
3640+ /// If the given state is a match state, return the match corresponding
3641+ /// to the given match index. `end` must be the ending position of the
3642+ /// detected match. If no match exists or if `match_index` exceeds the
3643+ /// number of matches in this state, then `None` is returned.
3644+ ///
3645+ /// The state ID given must be valid, or else implementors may panic.
3646+ ///
3647+ /// If the given state ID is correct and if the `match_index` is less than
3648+ /// the number of matches for that state, then this is guaranteed to return
3649+ /// a match.
3650+ fn get_match(
3651+ &self,
3652+ id: Self::ID,
3653+ match_index: usize,
3654+ end: usize,
3655+ ) -> Option<Match>;
3656+
3657+ /// Returns the number of matches for the given state. If the given state
3658+ /// is not a match state, then this returns 0.
3659+ ///
3660+ /// The state ID given must be valid, or else implementors must panic.
3661+ fn match_count(&self, id: Self::ID) -> usize;
3662+
3663+ /// Given the current state that this automaton is in and the next input
3664+ /// byte, this method returns the identifier of the next state. The
3665+ /// identifier returned must always be valid and may never correspond to
3666+ /// the fail state. The returned identifier may, however, point to the
3667+ /// dead state.
3668+ ///
3669+ /// This is not safe so that implementors may look up the next state
3670+ /// without memory safety checks such as bounds checks. As such, callers
3671+ /// must ensure that the given identifier corresponds to a valid automaton
3672+ /// state. Implementors must, in turn, ensure that this routine is safe for
3673+ /// all valid state identifiers and for all possible `u8` values.
3674+ fn next_state(&self, current: Self::ID, input: u8) -> Self::ID;
3675+
3676+ /// Like next_state, but debug_asserts that the underlying
3677+ /// implementation never returns a `fail_id()` for the next state.
3678+ fn next_state_no_fail(&self, current: Self::ID, input: u8) -> Self::ID {
3679+ let next = self.next_state(current, input);
3680+ // We should never see a transition to the failure state.
3681+ debug_assert!(
3682+ next != fail_id(),
3683+ "automaton should never return fail_id for next state"
3684+ );
3685+ next
3686+ }
3687+
3688+ /// Execute a search using standard match semantics.
3689+ ///
3690+ /// This can be used even when the automaton was constructed with leftmost
3691+ /// match semantics when you want to find the earliest possible match. This
3692+ /// can also be used as part of an overlapping search implementation.
3693+ ///
3694+ /// N.B. This does not report a match if `state_id` is given as a matching
3695+ /// state. As such, this should not be used directly.
3696+ #[inline(always)]
3697+ fn standard_find_at(
3698+ &self,
3699+ prestate: &mut PrefilterState,
3700+ haystack: &[u8],
3701+ at: usize,
3702+ state_id: &mut Self::ID,
3703+ ) -> Option<Match> {
3704+ if let Some(pre) = self.prefilter() {
3705+ self.standard_find_at_imp(
3706+ prestate,
3707+ Some(pre),
3708+ haystack,
3709+ at,
3710+ state_id,
3711+ )
3712+ } else {
3713+ self.standard_find_at_imp(prestate, None, haystack, at, state_id)
3714+ }
3715+ }
3716+
3717+ // It's important for this to always be inlined. Namely, its only caller
3718+ // is standard_find_at, and the inlining should remove the case analysis
3719+ // for prefilter scanning when there is no prefilter available.
3720+ #[inline(always)]
3721+ fn standard_find_at_imp(
3722+ &self,
3723+ prestate: &mut PrefilterState,
3724+ prefilter: Option<&dyn Prefilter>,
3725+ haystack: &[u8],
3726+ mut at: usize,
3727+ state_id: &mut Self::ID,
3728+ ) -> Option<Match> {
3729+ while at < haystack.len() {
3730+ if let Some(pre) = prefilter {
3731+ if prestate.is_effective(at) && *state_id == self.start_state()
3732+ {
3733+ let c = prefilter::next(prestate, pre, haystack, at)
3734+ .into_option();
3735+ match c {
3736+ None => return None,
3737+ Some(i) => {
3738+ at = i;
3739+ }
3740+ }
3741+ }
3742+ }
3743+ // CORRECTNESS: next_state is correct for all possible u8 values,
3744+ // so the only thing we're concerned about is the validity of
3745+ // `state_id`. `state_id` either comes from the caller (in which
3746+ // case, we assume it is correct), or it comes from the return
3747+ // value of next_state, which is guaranteed to be correct.
3748+ *state_id = self.next_state_no_fail(*state_id, haystack[at]);
3749+ at += 1;
3750+ // This routine always quits immediately after seeing a
3751+ // match, and since dead states can only come after seeing
3752+ // a match, seeing a dead state here is impossible. (Unless
3753+ // we have an anchored automaton, in which case, dead states
3754+ // are used to stop a search.)
3755+ debug_assert!(
3756+ *state_id != dead_id() || self.anchored(),
3757+ "standard find should never see a dead state"
3758+ );
3759+
3760+ if self.is_match_or_dead_state(*state_id) {
3761+ return if *state_id == dead_id() {
3762+ None
3763+ } else {
3764+ self.get_match(*state_id, 0, at)
3765+ };
3766+ }
3767+ }
3768+ None
3769+ }
3770+
3771+ /// Execute a search using leftmost (either first or longest) match
3772+ /// semantics.
3773+ ///
3774+ /// The principle difference between searching with standard semantics and
3775+ /// searching with leftmost semantics is that leftmost searching will
3776+ /// continue searching even after a match has been found. Once a match
3777+ /// is found, the search does not stop until either the haystack has been
3778+ /// exhausted or a dead state is observed in the automaton. (Dead states
3779+ /// only exist in automatons constructed with leftmost semantics.) That is,
3780+ /// we rely on the construction of the automaton to tell us when to quit.
3781+ #[inline(never)]
3782+ fn leftmost_find_at(
3783+ &self,
3784+ prestate: &mut PrefilterState,
3785+ haystack: &[u8],
3786+ at: usize,
3787+ state_id: &mut Self::ID,
3788+ ) -> Option<Match> {
3789+ if let Some(pre) = self.prefilter() {
3790+ self.leftmost_find_at_imp(
3791+ prestate,
3792+ Some(pre),
3793+ haystack,
3794+ at,
3795+ state_id,
3796+ )
3797+ } else {
3798+ self.leftmost_find_at_imp(prestate, None, haystack, at, state_id)
3799+ }
3800+ }
3801+
3802+ // It's important for this to always be inlined. Namely, its only caller
3803+ // is leftmost_find_at, and the inlining should remove the case analysis
3804+ // for prefilter scanning when there is no prefilter available.
3805+ #[inline(always)]
3806+ fn leftmost_find_at_imp(
3807+ &self,
3808+ prestate: &mut PrefilterState,
3809+ prefilter: Option<&dyn Prefilter>,
3810+ haystack: &[u8],
3811+ mut at: usize,
3812+ state_id: &mut Self::ID,
3813+ ) -> Option<Match> {
3814+ debug_assert!(self.match_kind().is_leftmost());
3815+ if self.anchored() && at > 0 && *state_id == self.start_state() {
3816+ return None;
3817+ }
3818+ let mut last_match = self.get_match(*state_id, 0, at);
3819+ while at < haystack.len() {
3820+ if let Some(pre) = prefilter {
3821+ if prestate.is_effective(at) && *state_id == self.start_state()
3822+ {
3823+ let c = prefilter::next(prestate, pre, haystack, at)
3824+ .into_option();
3825+ match c {
3826+ None => return None,
3827+ Some(i) => {
3828+ at = i;
3829+ }
3830+ }
3831+ }
3832+ }
3833+ // CORRECTNESS: next_state is correct for all possible u8 values,
3834+ // so the only thing we're concerned about is the validity of
3835+ // `state_id`. `state_id` either comes from the caller (in which
3836+ // case, we assume it is correct), or it comes from the return
3837+ // value of next_state, which is guaranteed to be correct.
3838+ *state_id = self.next_state_no_fail(*state_id, haystack[at]);
3839+ at += 1;
3840+ if self.is_match_or_dead_state(*state_id) {
3841+ if *state_id == dead_id() {
3842+ // The only way to enter into a dead state is if a match
3843+ // has been found, so we assert as much. This is different
3844+ // from normal automata, where you might enter a dead state
3845+ // if you know a subsequent match will never be found
3846+ // (regardless of whether a match has already been found).
3847+ // For Aho-Corasick, it is built so that we can match at
3848+ // any position, so the possibility of a match always
3849+ // exists.
3850+ //
3851+ // (Unless we have an anchored automaton, in which case,
3852+ // dead states are used to stop a search.)
3853+ debug_assert!(
3854+ last_match.is_some() || self.anchored(),
3855+ "failure state should only be seen after match"
3856+ );
3857+ return last_match;
3858+ }
3859+ last_match = self.get_match(*state_id, 0, at);
3860+ }
3861+ }
3862+ last_match
3863+ }
3864+
3865+ /// This is like leftmost_find_at, but does not need to track a caller
3866+ /// provided state id. In other words, the only output of this routine is a
3867+ /// match, if one exists.
3868+ ///
3869+ /// It is regrettable that we need to effectively copy a chunk of
3870+ /// implementation twice, but when we don't need to track the state ID, we
3871+ /// can allow the prefilter to report matches immediately without having
3872+ /// to re-confirm them with the automaton. The re-confirmation step is
3873+ /// necessary in leftmost_find_at because tracing through the automaton is
3874+ /// the only way to correctly set the state ID. (Perhaps an alternative
3875+ /// would be to keep a map from pattern ID to matching state ID, but that
3876+ /// complicates the code and still doesn't permit us to defer to the
3877+ /// prefilter entirely when possible.)
3878+ ///
3879+ /// I did try a few things to avoid the code duplication here, but nothing
3880+ /// optimized as well as this approach. (In microbenchmarks, there was
3881+ /// about a 25% difference.)
3882+ #[inline(never)]
3883+ fn leftmost_find_at_no_state(
3884+ &self,
3885+ prestate: &mut PrefilterState,
3886+ haystack: &[u8],
3887+ at: usize,
3888+ ) -> Option<Match> {
3889+ if let Some(pre) = self.prefilter() {
3890+ self.leftmost_find_at_no_state_imp(
3891+ prestate,
3892+ Some(pre),
3893+ haystack,
3894+ at,
3895+ )
3896+ } else {
3897+ self.leftmost_find_at_no_state_imp(prestate, None, haystack, at)
3898+ }
3899+ }
3900+
3901+ // It's important for this to always be inlined. Namely, its only caller
3902+ // is leftmost_find_at_no_state, and the inlining should remove the case
3903+ // analysis for prefilter scanning when there is no prefilter available.
3904+ #[inline(always)]
3905+ fn leftmost_find_at_no_state_imp(
3906+ &self,
3907+ prestate: &mut PrefilterState,
3908+ prefilter: Option<&dyn Prefilter>,
3909+ haystack: &[u8],
3910+ mut at: usize,
3911+ ) -> Option<Match> {
3912+ debug_assert!(self.match_kind().is_leftmost());
3913+ if self.anchored() && at > 0 {
3914+ return None;
3915+ }
3916+ // If our prefilter handles confirmation of matches 100% of the
3917+ // time, and since we don't need to track state IDs, we can avoid
3918+ // Aho-Corasick completely.
3919+ if let Some(pre) = prefilter {
3920+ // We should never have a prefilter during an anchored search.
3921+ debug_assert!(!self.anchored());
3922+ if !pre.reports_false_positives() {
3923+ return match pre.next_candidate(prestate, haystack, at) {
3924+ Candidate::None => None,
3925+ Candidate::Match(m) => Some(m),
3926+ Candidate::PossibleStartOfMatch(_) => unreachable!(),
3927+ };
3928+ }
3929+ }
3930+
3931+ let mut state_id = self.start_state();
3932+ let mut last_match = self.get_match(state_id, 0, at);
3933+ while at < haystack.len() {
3934+ if let Some(pre) = prefilter {
3935+ if prestate.is_effective(at) && state_id == self.start_state()
3936+ {
3937+ match prefilter::next(prestate, pre, haystack, at) {
3938+ Candidate::None => return None,
3939+ // Since we aren't tracking a state ID, we can
3940+ // quit early once we know we have a match.
3941+ Candidate::Match(m) => return Some(m),
3942+ Candidate::PossibleStartOfMatch(i) => {
3943+ at = i;
3944+ }
3945+ }
3946+ }
3947+ }
3948+ // CORRECTNESS: next_state is correct for all possible u8 values,
3949+ // so the only thing we're concerned about is the validity of
3950+ // `state_id`. `state_id` either comes from the caller (in which
3951+ // case, we assume it is correct), or it comes from the return
3952+ // value of next_state, which is guaranteed to be correct.
3953+ state_id = self.next_state_no_fail(state_id, haystack[at]);
3954+ at += 1;
3955+ if self.is_match_or_dead_state(state_id) {
3956+ if state_id == dead_id() {
3957+ // The only way to enter into a dead state is if a
3958+ // match has been found, so we assert as much. This
3959+ // is different from normal automata, where you might
3960+ // enter a dead state if you know a subsequent match
3961+ // will never be found (regardless of whether a match
3962+ // has already been found). For Aho-Corasick, it is
3963+ // built so that we can match at any position, so the
3964+ // possibility of a match always exists.
3965+ //
3966+ // (Unless we have an anchored automaton, in which
3967+ // case, dead states are used to stop a search.)
3968+ debug_assert!(
3969+ last_match.is_some() || self.anchored(),
3970+ "failure state should only be seen after match"
3971+ );
3972+ return last_match;
3973+ }
3974+ last_match = self.get_match(state_id, 0, at);
3975+ }
3976+ }
3977+ last_match
3978+ }
3979+
3980+ /// Execute an overlapping search.
3981+ ///
3982+ /// When executing an overlapping match, the previous state ID in addition
3983+ /// to the previous match index should be given. If there are more matches
3984+ /// at the given state, then the match is reported and the given index is
3985+ /// incremented.
3986+ #[inline(always)]
3987+ fn overlapping_find_at(
3988+ &self,
3989+ prestate: &mut PrefilterState,
3990+ haystack: &[u8],
3991+ at: usize,
3992+ state_id: &mut Self::ID,
3993+ match_index: &mut usize,
3994+ ) -> Option<Match> {
3995+ if self.anchored() && at > 0 && *state_id == self.start_state() {
3996+ return None;
3997+ }
3998+
3999+ let match_count = self.match_count(*state_id);
4000+ if *match_index < match_count {
4001+ // This is guaranteed to return a match since
4002+ // match_index < match_count.
4003+ let result = self.get_match(*state_id, *match_index, at);
4004+ debug_assert!(result.is_some(), "must be a match");
4005+ *match_index += 1;
4006+ return result;
4007+ }
4008+
4009+ *match_index = 0;
4010+ match self.standard_find_at(prestate, haystack, at, state_id) {
4011+ None => None,
4012+ Some(m) => {
4013+ *match_index = 1;
4014+ Some(m)
4015+ }
4016+ }
4017+ }
4018+
4019+ /// Return the earliest match found. This returns as soon as we know that
4020+ /// we have a match. As such, this does not necessarily correspond to the
4021+ /// leftmost starting match, but rather, the leftmost position at which a
4022+ /// match ends.
4023+ #[inline(always)]
4024+ fn earliest_find_at(
4025+ &self,
4026+ prestate: &mut PrefilterState,
4027+ haystack: &[u8],
4028+ at: usize,
4029+ state_id: &mut Self::ID,
4030+ ) -> Option<Match> {
4031+ if *state_id == self.start_state() {
4032+ if self.anchored() && at > 0 {
4033+ return None;
4034+ }
4035+ if let Some(m) = self.get_match(*state_id, 0, at) {
4036+ return Some(m);
4037+ }
4038+ }
4039+ self.standard_find_at(prestate, haystack, at, state_id)
4040+ }
4041+
4042+ /// A convenience function for finding the next match according to the
4043+ /// match semantics of this automaton. For standard match semantics, this
4044+ /// finds the earliest match. Otherwise, the leftmost match is found.
4045+ #[inline(always)]
4046+ fn find_at(
4047+ &self,
4048+ prestate: &mut PrefilterState,
4049+ haystack: &[u8],
4050+ at: usize,
4051+ state_id: &mut Self::ID,
4052+ ) -> Option<Match> {
4053+ match *self.match_kind() {
4054+ MatchKind::Standard => {
4055+ self.earliest_find_at(prestate, haystack, at, state_id)
4056+ }
4057+ MatchKind::LeftmostFirst | MatchKind::LeftmostLongest => {
4058+ self.leftmost_find_at(prestate, haystack, at, state_id)
4059+ }
4060+ MatchKind::__Nonexhaustive => unreachable!(),
4061+ }
4062+ }
4063+
4064+ /// Like find_at, but does not track state identifiers. This permits some
4065+ /// optimizations when a prefilter that confirms its own matches is
4066+ /// present.
4067+ #[inline(always)]
4068+ fn find_at_no_state(
4069+ &self,
4070+ prestate: &mut PrefilterState,
4071+ haystack: &[u8],
4072+ at: usize,
4073+ ) -> Option<Match> {
4074+ match *self.match_kind() {
4075+ MatchKind::Standard => {
4076+ let mut state = self.start_state();
4077+ self.earliest_find_at(prestate, haystack, at, &mut state)
4078+ }
4079+ MatchKind::LeftmostFirst | MatchKind::LeftmostLongest => {
4080+ self.leftmost_find_at_no_state(prestate, haystack, at)
4081+ }
4082+ MatchKind::__Nonexhaustive => unreachable!(),
4083+ }
4084+ }
4085+}
4086diff --git a/vendor/aho-corasick/src/buffer.rs b/vendor/aho-corasick/src/buffer.rs
4087new file mode 100644
4088index 0000000..e7339eb
4089--- /dev/null
4090+++ b/vendor/aho-corasick/src/buffer.rs
4091@@ -0,0 +1,132 @@
4092+use std::cmp;
4093+use std::io;
4094+use std::ptr;
4095+
4096+/// The default buffer capacity that we use for the stream buffer.
4097+const DEFAULT_BUFFER_CAPACITY: usize = 8 * (1 << 10); // 8 KB
4098+
4099+/// A fairly simple roll buffer for supporting stream searches.
4100+///
4101+/// This buffer acts as a temporary place to store a fixed amount of data when
4102+/// reading from a stream. Its central purpose is to allow "rolling" some
4103+/// suffix of the data to the beginning of the buffer before refilling it with
4104+/// more data from the stream. For example, let's say we are trying to match
4105+/// "foobar" on a stream. When we report the match, we'd like to not only
4106+/// report the correct offsets at which the match occurs, but also the matching
4107+/// bytes themselves. So let's say our stream is a file with the following
4108+/// contents: `test test foobar test test`. Now assume that we happen to read
4109+/// the aforementioned file in two chunks: `test test foo` and `bar test test`.
4110+/// Naively, it would not be possible to report a single contiguous `foobar`
4111+/// match, but this roll buffer allows us to do that. Namely, after the second
4112+/// read, the contents of the buffer should be `st foobar test test`, where the
4113+/// search should ultimately resume immediately after `foo`. (The prefix `st `
4114+/// is included because the roll buffer saves N bytes at the end of the buffer,
4115+/// where N is the maximum possible length of a match.)
4116+///
4117+/// A lot of the logic for dealing with this is unfortunately split out between
4118+/// this roll buffer and the `StreamChunkIter`.
4119+#[derive(Debug)]
4120+pub struct Buffer {
4121+ /// The raw buffer contents. This has a fixed size and never increases.
4122+ buf: Vec<u8>,
4123+ /// The minimum size of the buffer, which is equivalent to the maximum
4124+ /// possible length of a match. This corresponds to the amount that we
4125+ /// roll
4126+ min: usize,
4127+ /// The end of the contents of this buffer.
4128+ end: usize,
4129+}
4130+
4131+impl Buffer {
4132+ /// Create a new buffer for stream searching. The minimum buffer length
4133+ /// given should be the size of the maximum possible match length.
4134+ pub fn new(min_buffer_len: usize) -> Buffer {
4135+ let min = cmp::max(1, min_buffer_len);
4136+ // The minimum buffer amount is also the amount that we roll our
4137+ // buffer in order to support incremental searching. To this end,
4138+ // our actual capacity needs to be at least 1 byte bigger than our
4139+ // minimum amount, otherwise we won't have any overlap. In actuality,
4140+ // we want our buffer to be a bit bigger than that for performance
4141+ // reasons, so we set a lower bound of `8 * min`.
4142+ //
4143+ // TODO: It would be good to find a way to test the streaming
4144+ // implementation with the minimal buffer size. For now, we just
4145+ // uncomment out the next line and comment out the subsequent line.
4146+ // let capacity = 1 + min;
4147+ let capacity = cmp::max(min * 8, DEFAULT_BUFFER_CAPACITY);
4148+ Buffer { buf: vec![0; capacity], min, end: 0 }
4149+ }
4150+
4151+ /// Return the contents of this buffer.
4152+ #[inline]
4153+ pub fn buffer(&self) -> &[u8] {
4154+ &self.buf[..self.end]
4155+ }
4156+
4157+ /// Return the minimum size of the buffer. The only way a buffer may be
4158+ /// smaller than this is if the stream itself contains less than the
4159+ /// minimum buffer amount.
4160+ #[inline]
4161+ pub fn min_buffer_len(&self) -> usize {
4162+ self.min
4163+ }
4164+
4165+ /// Return the total length of the contents in the buffer.
4166+ #[inline]
4167+ pub fn len(&self) -> usize {
4168+ self.end
4169+ }
4170+
4171+ /// Return all free capacity in this buffer.
4172+ fn free_buffer(&mut self) -> &mut [u8] {
4173+ &mut self.buf[self.end..]
4174+ }
4175+
4176+ /// Refill the contents of this buffer by reading as much as possible into
4177+ /// this buffer's free capacity. If no more bytes could be read, then this
4178+ /// returns false. Otherwise, this reads until it has filled the buffer
4179+ /// past the minimum amount.
4180+ pub fn fill<R: io::Read>(&mut self, mut rdr: R) -> io::Result<bool> {
4181+ let mut readany = false;
4182+ loop {
4183+ let readlen = rdr.read(self.free_buffer())?;
4184+ if readlen == 0 {
4185+ return Ok(readany);
4186+ }
4187+ readany = true;
4188+ self.end += readlen;
4189+ if self.len() >= self.min {
4190+ return Ok(true);
4191+ }
4192+ }
4193+ }
4194+
4195+ /// Roll the contents of the buffer so that the suffix of this buffer is
4196+ /// moved to the front and all other contents are dropped. The size of the
4197+ /// suffix corresponds precisely to the minimum buffer length.
4198+ ///
4199+ /// This should only be called when the entire contents of this buffer have
4200+ /// been searched.
4201+ pub fn roll(&mut self) {
4202+ let roll_start = self
4203+ .end
4204+ .checked_sub(self.min)
4205+ .expect("buffer capacity should be bigger than minimum amount");
4206+ let roll_len = self.min;
4207+
4208+ assert!(roll_start + roll_len <= self.end);
4209+ unsafe {
4210+ // SAFETY: A buffer contains Copy data, so there's no problem
4211+ // moving it around. Safety also depends on our indices being in
4212+ // bounds, which they always should be, given the assert above.
4213+ //
4214+ // TODO: Switch to [T]::copy_within once our MSRV is high enough.
4215+ ptr::copy(
4216+ self.buf[roll_start..].as_ptr(),
4217+ self.buf.as_mut_ptr(),
4218+ roll_len,
4219+ );
4220+ }
4221+ self.end = roll_len;
4222+ }
4223+}
4224diff --git a/vendor/aho-corasick/src/byte_frequencies.rs b/vendor/aho-corasick/src/byte_frequencies.rs
4225new file mode 100644
4226index 0000000..c313b62
4227--- /dev/null
4228+++ b/vendor/aho-corasick/src/byte_frequencies.rs
4229@@ -0,0 +1,258 @@
4230+pub const BYTE_FREQUENCIES: [u8; 256] = [
4231+ 55, // '\x00'
4232+ 52, // '\x01'
4233+ 51, // '\x02'
4234+ 50, // '\x03'
4235+ 49, // '\x04'
4236+ 48, // '\x05'
4237+ 47, // '\x06'
4238+ 46, // '\x07'
4239+ 45, // '\x08'
4240+ 103, // '\t'
4241+ 242, // '\n'
4242+ 66, // '\x0b'
4243+ 67, // '\x0c'
4244+ 229, // '\r'
4245+ 44, // '\x0e'
4246+ 43, // '\x0f'
4247+ 42, // '\x10'
4248+ 41, // '\x11'
4249+ 40, // '\x12'
4250+ 39, // '\x13'
4251+ 38, // '\x14'
4252+ 37, // '\x15'
4253+ 36, // '\x16'
4254+ 35, // '\x17'
4255+ 34, // '\x18'
4256+ 33, // '\x19'
4257+ 56, // '\x1a'
4258+ 32, // '\x1b'
4259+ 31, // '\x1c'
4260+ 30, // '\x1d'
4261+ 29, // '\x1e'
4262+ 28, // '\x1f'
4263+ 255, // ' '
4264+ 148, // '!'
4265+ 164, // '"'
4266+ 149, // '#'
4267+ 136, // '$'
4268+ 160, // '%'
4269+ 155, // '&'
4270+ 173, // "'"
4271+ 221, // '('
4272+ 222, // ')'
4273+ 134, // '*'
4274+ 122, // '+'
4275+ 232, // ','
4276+ 202, // '-'
4277+ 215, // '.'
4278+ 224, // '/'
4279+ 208, // '0'
4280+ 220, // '1'
4281+ 204, // '2'
4282+ 187, // '3'
4283+ 183, // '4'
4284+ 179, // '5'
4285+ 177, // '6'
4286+ 168, // '7'
4287+ 178, // '8'
4288+ 200, // '9'
4289+ 226, // ':'
4290+ 195, // ';'
4291+ 154, // '<'
4292+ 184, // '='
4293+ 174, // '>'
4294+ 126, // '?'
4295+ 120, // '@'
4296+ 191, // 'A'
4297+ 157, // 'B'
4298+ 194, // 'C'
4299+ 170, // 'D'
4300+ 189, // 'E'
4301+ 162, // 'F'
4302+ 161, // 'G'
4303+ 150, // 'H'
4304+ 193, // 'I'
4305+ 142, // 'J'
4306+ 137, // 'K'
4307+ 171, // 'L'
4308+ 176, // 'M'
4309+ 185, // 'N'
4310+ 167, // 'O'
4311+ 186, // 'P'
4312+ 112, // 'Q'
4313+ 175, // 'R'
4314+ 192, // 'S'
4315+ 188, // 'T'
4316+ 156, // 'U'
4317+ 140, // 'V'
4318+ 143, // 'W'
4319+ 123, // 'X'
4320+ 133, // 'Y'
4321+ 128, // 'Z'
4322+ 147, // '['
4323+ 138, // '\\'
4324+ 146, // ']'
4325+ 114, // '^'
4326+ 223, // '_'
4327+ 151, // '`'
4328+ 249, // 'a'
4329+ 216, // 'b'
4330+ 238, // 'c'
4331+ 236, // 'd'
4332+ 253, // 'e'
4333+ 227, // 'f'
4334+ 218, // 'g'
4335+ 230, // 'h'
4336+ 247, // 'i'
4337+ 135, // 'j'
4338+ 180, // 'k'
4339+ 241, // 'l'
4340+ 233, // 'm'
4341+ 246, // 'n'
4342+ 244, // 'o'
4343+ 231, // 'p'
4344+ 139, // 'q'
4345+ 245, // 'r'
4346+ 243, // 's'
4347+ 251, // 't'
4348+ 235, // 'u'
4349+ 201, // 'v'
4350+ 196, // 'w'
4351+ 240, // 'x'
4352+ 214, // 'y'
4353+ 152, // 'z'
4354+ 182, // '{'
4355+ 205, // '|'
4356+ 181, // '}'
4357+ 127, // '~'
4358+ 27, // '\x7f'
4359+ 212, // '\x80'
4360+ 211, // '\x81'
4361+ 210, // '\x82'
4362+ 213, // '\x83'
4363+ 228, // '\x84'
4364+ 197, // '\x85'
4365+ 169, // '\x86'
4366+ 159, // '\x87'
4367+ 131, // '\x88'
4368+ 172, // '\x89'
4369+ 105, // '\x8a'
4370+ 80, // '\x8b'
4371+ 98, // '\x8c'
4372+ 96, // '\x8d'
4373+ 97, // '\x8e'
4374+ 81, // '\x8f'
4375+ 207, // '\x90'
4376+ 145, // '\x91'
4377+ 116, // '\x92'
4378+ 115, // '\x93'
4379+ 144, // '\x94'
4380+ 130, // '\x95'
4381+ 153, // '\x96'
4382+ 121, // '\x97'
4383+ 107, // '\x98'
4384+ 132, // '\x99'
4385+ 109, // '\x9a'
4386+ 110, // '\x9b'
4387+ 124, // '\x9c'
4388+ 111, // '\x9d'
4389+ 82, // '\x9e'
4390+ 108, // '\x9f'
4391+ 118, // '\xa0'
4392+ 141, // '¡'
4393+ 113, // '¢'
4394+ 129, // '£'
4395+ 119, // '¤'
4396+ 125, // '¥'
4397+ 165, // '¦'
4398+ 117, // '§'
4399+ 92, // '¨'
4400+ 106, // '©'
4401+ 83, // 'ª'
4402+ 72, // '«'
4403+ 99, // '¬'
4404+ 93, // '\xad'
4405+ 65, // '®'
4406+ 79, // '¯'
4407+ 166, // '°'
4408+ 237, // '±'
4409+ 163, // '²'
4410+ 199, // '³'
4411+ 190, // '´'
4412+ 225, // 'µ'
4413+ 209, // '¶'
4414+ 203, // '·'
4415+ 198, // '¸'
4416+ 217, // '¹'
4417+ 219, // 'º'
4418+ 206, // '»'
4419+ 234, // '¼'
4420+ 248, // '½'
4421+ 158, // '¾'
4422+ 239, // '¿'
4423+ 255, // 'À'
4424+ 255, // 'Á'
4425+ 255, // 'Â'
4426+ 255, // 'Ã'
4427+ 255, // 'Ä'
4428+ 255, // 'Å'
4429+ 255, // 'Æ'
4430+ 255, // 'Ç'
4431+ 255, // 'È'
4432+ 255, // 'É'
4433+ 255, // 'Ê'
4434+ 255, // 'Ë'
4435+ 255, // 'Ì'
4436+ 255, // 'Í'
4437+ 255, // 'Î'
4438+ 255, // 'Ï'
4439+ 255, // 'Ð'
4440+ 255, // 'Ñ'
4441+ 255, // 'Ò'
4442+ 255, // 'Ó'
4443+ 255, // 'Ô'
4444+ 255, // 'Õ'
4445+ 255, // 'Ö'
4446+ 255, // '×'
4447+ 255, // 'Ø'
4448+ 255, // 'Ù'
4449+ 255, // 'Ú'
4450+ 255, // 'Û'
4451+ 255, // 'Ü'
4452+ 255, // 'Ý'
4453+ 255, // 'Þ'
4454+ 255, // 'ß'
4455+ 255, // 'à'
4456+ 255, // 'á'
4457+ 255, // 'â'
4458+ 255, // 'ã'
4459+ 255, // 'ä'
4460+ 255, // 'å'
4461+ 255, // 'æ'
4462+ 255, // 'ç'
4463+ 255, // 'è'
4464+ 255, // 'é'
4465+ 255, // 'ê'
4466+ 255, // 'ë'
4467+ 255, // 'ì'
4468+ 255, // 'í'
4469+ 255, // 'î'
4470+ 255, // 'ï'
4471+ 255, // 'ð'
4472+ 255, // 'ñ'
4473+ 255, // 'ò'
4474+ 255, // 'ó'
4475+ 255, // 'ô'
4476+ 255, // 'õ'
4477+ 255, // 'ö'
4478+ 255, // '÷'
4479+ 255, // 'ø'
4480+ 255, // 'ù'
4481+ 255, // 'ú'
4482+ 255, // 'û'
4483+ 255, // 'ü'
4484+ 255, // 'ý'
4485+ 255, // 'þ'
4486+ 255, // 'ÿ'
4487+];
4488diff --git a/vendor/aho-corasick/src/classes.rs b/vendor/aho-corasick/src/classes.rs
4489new file mode 100644
4490index 0000000..f84ae21
4491--- /dev/null
4492+++ b/vendor/aho-corasick/src/classes.rs
4493@@ -0,0 +1,238 @@
4494+use std::fmt;
4495+
4496+/// A representation of byte oriented equivalence classes.
4497+///
4498+/// This is used in an FSM to reduce the size of the transition table. This can
4499+/// have a particularly large impact not only on the total size of an FSM, but
4500+/// also on compile times.
4501+#[derive(Clone, Copy)]
4502+pub struct ByteClasses([u8; 256]);
4503+
4504+impl ByteClasses {
4505+ /// Creates a new set of equivalence classes where all bytes are mapped to
4506+ /// the same class.
4507+ pub fn empty() -> ByteClasses {
4508+ ByteClasses([0; 256])
4509+ }
4510+
4511+ /// Creates a new set of equivalence classes where each byte belongs to
4512+ /// its own equivalence class.
4513+ pub fn singletons() -> ByteClasses {
4514+ let mut classes = ByteClasses::empty();
4515+ for i in 0..256 {
4516+ classes.set(i as u8, i as u8);
4517+ }
4518+ classes
4519+ }
4520+
4521+ /// Set the equivalence class for the given byte.
4522+ #[inline]
4523+ pub fn set(&mut self, byte: u8, class: u8) {
4524+ self.0[byte as usize] = class;
4525+ }
4526+
4527+ /// Get the equivalence class for the given byte.
4528+ #[inline]
4529+ pub fn get(&self, byte: u8) -> u8 {
4530+ // SAFETY: This is safe because all dense transitions have
4531+ // exactly 256 elements, so all u8 values are valid indices.
4532+ self.0[byte as usize]
4533+ }
4534+
4535+ /// Return the total number of elements in the alphabet represented by
4536+ /// these equivalence classes. Equivalently, this returns the total number
4537+ /// of equivalence classes.
4538+ #[inline]
4539+ pub fn alphabet_len(&self) -> usize {
4540+ self.0[255] as usize + 1
4541+ }
4542+
4543+ /// Returns true if and only if every byte in this class maps to its own
4544+ /// equivalence class. Equivalently, there are 256 equivalence classes
4545+ /// and each class contains exactly one byte.
4546+ #[inline]
4547+ pub fn is_singleton(&self) -> bool {
4548+ self.alphabet_len() == 256
4549+ }
4550+
4551+ /// Returns an iterator over a sequence of representative bytes from each
4552+ /// equivalence class. Namely, this yields exactly N items, where N is
4553+ /// equivalent to the number of equivalence classes. Each item is an
4554+ /// arbitrary byte drawn from each equivalence class.
4555+ ///
4556+ /// This is useful when one is determinizing an NFA and the NFA's alphabet
4557+ /// hasn't been converted to equivalence classes yet. Picking an arbitrary
4558+ /// byte from each equivalence class then permits a full exploration of
4559+ /// the NFA instead of using every possible byte value.
4560+ pub fn representatives(&self) -> ByteClassRepresentatives<'_> {
4561+ ByteClassRepresentatives { classes: self, byte: 0, last_class: None }
4562+ }
4563+
4564+ /// Returns all of the bytes in the given equivalence class.
4565+ ///
4566+ /// The second element in the tuple indicates the number of elements in
4567+ /// the array.
4568+ fn elements(&self, equiv: u8) -> ([u8; 256], usize) {
4569+ let (mut array, mut len) = ([0; 256], 0);
4570+ for b in 0..256 {
4571+ if self.get(b as u8) == equiv {
4572+ array[len] = b as u8;
4573+ len += 1;
4574+ }
4575+ }
4576+ (array, len)
4577+ }
4578+}
4579+
4580+impl fmt::Debug for ByteClasses {
4581+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4582+ if self.is_singleton() {
4583+ write!(f, "ByteClasses({{singletons}})")
4584+ } else {
4585+ write!(f, "ByteClasses(")?;
4586+ for equiv in 0..self.alphabet_len() {
4587+ let (members, len) = self.elements(equiv as u8);
4588+ write!(f, " {} => {:?}", equiv, &members[..len])?;
4589+ }
4590+ write!(f, ")")
4591+ }
4592+ }
4593+}
4594+
4595+/// An iterator over representative bytes from each equivalence class.
4596+#[derive(Debug)]
4597+pub struct ByteClassRepresentatives<'a> {
4598+ classes: &'a ByteClasses,
4599+ byte: usize,
4600+ last_class: Option<u8>,
4601+}
4602+
4603+impl<'a> Iterator for ByteClassRepresentatives<'a> {
4604+ type Item = u8;
4605+
4606+ fn next(&mut self) -> Option<u8> {
4607+ while self.byte < 256 {
4608+ let byte = self.byte as u8;
4609+ let class = self.classes.get(byte);
4610+ self.byte += 1;
4611+
4612+ if self.last_class != Some(class) {
4613+ self.last_class = Some(class);
4614+ return Some(byte);
4615+ }
4616+ }
4617+ None
4618+ }
4619+}
4620+
4621+/// A byte class builder keeps track of an *approximation* of equivalence
4622+/// classes of bytes during NFA construction. That is, every byte in an
4623+/// equivalence class cannot discriminate between a match and a non-match.
4624+///
4625+/// For example, in the literals `abc` and `xyz`, the bytes [\x00-`], [d-w]
4626+/// and [{-\xFF] never discriminate between a match and a non-match, precisely
4627+/// because they never occur in the literals anywhere.
4628+///
4629+/// Note though that this does not necessarily compute the minimal set of
4630+/// equivalence classes. For example, in the literals above, the byte ranges
4631+/// [\x00-`], [d-w] and [{-\xFF] are all treated as distinct equivalence
4632+/// classes even though they could be treated a single class. The reason for
4633+/// this is implementation complexity. In the future, we should endeavor to
4634+/// compute the minimal equivalence classes since they can have a rather large
4635+/// impact on the size of the DFA.
4636+///
4637+/// The representation here is 256 booleans, all initially set to false. Each
4638+/// boolean maps to its corresponding byte based on position. A `true` value
4639+/// indicates the end of an equivalence class, where its corresponding byte
4640+/// and all of the bytes corresponding to all previous contiguous `false`
4641+/// values are in the same equivalence class.
4642+///
4643+/// This particular representation only permits contiguous ranges of bytes to
4644+/// be in the same equivalence class, which means that we can never discover
4645+/// the true minimal set of equivalence classes.
4646+#[derive(Debug)]
4647+pub struct ByteClassBuilder(Vec<bool>);
4648+
4649+impl ByteClassBuilder {
4650+ /// Create a new builder of byte classes where all bytes are part of the
4651+ /// same equivalence class.
4652+ pub fn new() -> ByteClassBuilder {
4653+ ByteClassBuilder(vec![false; 256])
4654+ }
4655+
4656+ /// Indicate the the range of byte given (inclusive) can discriminate a
4657+ /// match between it and all other bytes outside of the range.
4658+ pub fn set_range(&mut self, start: u8, end: u8) {
4659+ debug_assert!(start <= end);
4660+ if start > 0 {
4661+ self.0[start as usize - 1] = true;
4662+ }
4663+ self.0[end as usize] = true;
4664+ }
4665+
4666+ /// Build byte classes that map all byte values to their corresponding
4667+ /// equivalence class. The last mapping indicates the largest equivalence
4668+ /// class identifier (which is never bigger than 255).
4669+ pub fn build(&self) -> ByteClasses {
4670+ let mut classes = ByteClasses::empty();
4671+ let mut class = 0u8;
4672+ let mut i = 0;
4673+ loop {
4674+ classes.set(i as u8, class as u8);
4675+ if i >= 255 {
4676+ break;
4677+ }
4678+ if self.0[i] {
4679+ class = class.checked_add(1).unwrap();
4680+ }
4681+ i += 1;
4682+ }
4683+ classes
4684+ }
4685+}
4686+
4687+#[cfg(test)]
4688+mod tests {
4689+ use super::*;
4690+
4691+ #[test]
4692+ fn byte_classes() {
4693+ let mut set = ByteClassBuilder::new();
4694+ set.set_range(b'a', b'z');
4695+
4696+ let classes = set.build();
4697+ assert_eq!(classes.get(0), 0);
4698+ assert_eq!(classes.get(1), 0);
4699+ assert_eq!(classes.get(2), 0);
4700+ assert_eq!(classes.get(b'a' - 1), 0);
4701+ assert_eq!(classes.get(b'a'), 1);
4702+ assert_eq!(classes.get(b'm'), 1);
4703+ assert_eq!(classes.get(b'z'), 1);
4704+ assert_eq!(classes.get(b'z' + 1), 2);
4705+ assert_eq!(classes.get(254), 2);
4706+ assert_eq!(classes.get(255), 2);
4707+
4708+ let mut set = ByteClassBuilder::new();
4709+ set.set_range(0, 2);
4710+ set.set_range(4, 6);
4711+ let classes = set.build();
4712+ assert_eq!(classes.get(0), 0);
4713+ assert_eq!(classes.get(1), 0);
4714+ assert_eq!(classes.get(2), 0);
4715+ assert_eq!(classes.get(3), 1);
4716+ assert_eq!(classes.get(4), 2);
4717+ assert_eq!(classes.get(5), 2);
4718+ assert_eq!(classes.get(6), 2);
4719+ assert_eq!(classes.get(7), 3);
4720+ assert_eq!(classes.get(255), 3);
4721+ }
4722+
4723+ #[test]
4724+ fn full_byte_classes() {
4725+ let mut set = ByteClassBuilder::new();
4726+ for i in 0..256u16 {
4727+ set.set_range(i as u8, i as u8);
4728+ }
4729+ assert_eq!(set.build().alphabet_len(), 256);
4730+ }
4731+}
4732diff --git a/vendor/aho-corasick/src/dfa.rs b/vendor/aho-corasick/src/dfa.rs
4733new file mode 100644
4734index 0000000..a03a254
4735--- /dev/null
4736+++ b/vendor/aho-corasick/src/dfa.rs
4737@@ -0,0 +1,713 @@
4738+use std::mem::size_of;
4739+
4740+use crate::ahocorasick::MatchKind;
4741+use crate::automaton::Automaton;
4742+use crate::classes::ByteClasses;
4743+use crate::error::Result;
4744+use crate::nfa::{PatternID, PatternLength, NFA};
4745+use crate::prefilter::{Prefilter, PrefilterObj, PrefilterState};
4746+use crate::state_id::{dead_id, fail_id, premultiply_overflow_error, StateID};
4747+use crate::Match;
4748+
4749+#[derive(Clone, Debug)]
4750+pub enum DFA<S> {
4751+ Standard(Standard<S>),
4752+ ByteClass(ByteClass<S>),
4753+ Premultiplied(Premultiplied<S>),
4754+ PremultipliedByteClass(PremultipliedByteClass<S>),
4755+}
4756+
4757+impl<S: StateID> DFA<S> {
4758+ fn repr(&self) -> &Repr<S> {
4759+ match *self {
4760+ DFA::Standard(ref dfa) => dfa.repr(),
4761+ DFA::ByteClass(ref dfa) => dfa.repr(),
4762+ DFA::Premultiplied(ref dfa) => dfa.repr(),
4763+ DFA::PremultipliedByteClass(ref dfa) => dfa.repr(),
4764+ }
4765+ }
4766+
4767+ pub fn match_kind(&self) -> &MatchKind {
4768+ &self.repr().match_kind
4769+ }
4770+
4771+ pub fn heap_bytes(&self) -> usize {
4772+ self.repr().heap_bytes
4773+ }
4774+
4775+ pub fn max_pattern_len(&self) -> usize {
4776+ self.repr().max_pattern_len
4777+ }
4778+
4779+ pub fn pattern_count(&self) -> usize {
4780+ self.repr().pattern_count
4781+ }
4782+
4783+ pub fn prefilter(&self) -> Option<&dyn Prefilter> {
4784+ self.repr().prefilter.as_ref().map(|p| p.as_ref())
4785+ }
4786+
4787+ pub fn start_state(&self) -> S {
4788+ self.repr().start_id
4789+ }
4790+
4791+ #[inline(always)]
4792+ pub fn overlapping_find_at(
4793+ &self,
4794+ prestate: &mut PrefilterState,
4795+ haystack: &[u8],
4796+ at: usize,
4797+ state_id: &mut S,
4798+ match_index: &mut usize,
4799+ ) -> Option<Match> {
4800+ match *self {
4801+ DFA::Standard(ref dfa) => dfa.overlapping_find_at(
4802+ prestate,
4803+ haystack,
4804+ at,
4805+ state_id,
4806+ match_index,
4807+ ),
4808+ DFA::ByteClass(ref dfa) => dfa.overlapping_find_at(
4809+ prestate,
4810+ haystack,
4811+ at,
4812+ state_id,
4813+ match_index,
4814+ ),
4815+ DFA::Premultiplied(ref dfa) => dfa.overlapping_find_at(
4816+ prestate,
4817+ haystack,
4818+ at,
4819+ state_id,
4820+ match_index,
4821+ ),
4822+ DFA::PremultipliedByteClass(ref dfa) => dfa.overlapping_find_at(
4823+ prestate,
4824+ haystack,
4825+ at,
4826+ state_id,
4827+ match_index,
4828+ ),
4829+ }
4830+ }
4831+
4832+ #[inline(always)]
4833+ pub fn earliest_find_at(
4834+ &self,
4835+ prestate: &mut PrefilterState,
4836+ haystack: &[u8],
4837+ at: usize,
4838+ state_id: &mut S,
4839+ ) -> Option<Match> {
4840+ match *self {
4841+ DFA::Standard(ref dfa) => {
4842+ dfa.earliest_find_at(prestate, haystack, at, state_id)
4843+ }
4844+ DFA::ByteClass(ref dfa) => {
4845+ dfa.earliest_find_at(prestate, haystack, at, state_id)
4846+ }
4847+ DFA::Premultiplied(ref dfa) => {
4848+ dfa.earliest_find_at(prestate, haystack, at, state_id)
4849+ }
4850+ DFA::PremultipliedByteClass(ref dfa) => {
4851+ dfa.earliest_find_at(prestate, haystack, at, state_id)
4852+ }
4853+ }
4854+ }
4855+
4856+ #[inline(always)]
4857+ pub fn find_at_no_state(
4858+ &self,
4859+ prestate: &mut PrefilterState,
4860+ haystack: &[u8],
4861+ at: usize,
4862+ ) -> Option<Match> {
4863+ match *self {
4864+ DFA::Standard(ref dfa) => {
4865+ dfa.find_at_no_state(prestate, haystack, at)
4866+ }
4867+ DFA::ByteClass(ref dfa) => {
4868+ dfa.find_at_no_state(prestate, haystack, at)
4869+ }
4870+ DFA::Premultiplied(ref dfa) => {
4871+ dfa.find_at_no_state(prestate, haystack, at)
4872+ }
4873+ DFA::PremultipliedByteClass(ref dfa) => {
4874+ dfa.find_at_no_state(prestate, haystack, at)
4875+ }
4876+ }
4877+ }
4878+}
4879+
4880+#[derive(Clone, Debug)]
4881+pub struct Standard<S>(Repr<S>);
4882+
4883+impl<S: StateID> Standard<S> {
4884+ fn repr(&self) -> &Repr<S> {
4885+ &self.0
4886+ }
4887+}
4888+
4889+impl<S: StateID> Automaton for Standard<S> {
4890+ type ID = S;
4891+
4892+ fn match_kind(&self) -> &MatchKind {
4893+ &self.repr().match_kind
4894+ }
4895+
4896+ fn anchored(&self) -> bool {
4897+ self.repr().anchored
4898+ }
4899+
4900+ fn prefilter(&self) -> Option<&dyn Prefilter> {
4901+ self.repr().prefilter.as_ref().map(|p| p.as_ref())
4902+ }
4903+
4904+ fn start_state(&self) -> S {
4905+ self.repr().start_id
4906+ }
4907+
4908+ fn is_valid(&self, id: S) -> bool {
4909+ id.to_usize() < self.repr().state_count
4910+ }
4911+
4912+ fn is_match_state(&self, id: S) -> bool {
4913+ self.repr().is_match_state(id)
4914+ }
4915+
4916+ fn is_match_or_dead_state(&self, id: S) -> bool {
4917+ self.repr().is_match_or_dead_state(id)
4918+ }
4919+
4920+ fn get_match(
4921+ &self,
4922+ id: S,
4923+ match_index: usize,
4924+ end: usize,
4925+ ) -> Option<Match> {
4926+ self.repr().get_match(id, match_index, end)
4927+ }
4928+
4929+ fn match_count(&self, id: S) -> usize {
4930+ self.repr().match_count(id)
4931+ }
4932+
4933+ fn next_state(&self, current: S, input: u8) -> S {
4934+ let o = current.to_usize() * 256 + input as usize;
4935+ self.repr().trans[o]
4936+ }
4937+}
4938+
4939+#[derive(Clone, Debug)]
4940+pub struct ByteClass<S>(Repr<S>);
4941+
4942+impl<S: StateID> ByteClass<S> {
4943+ fn repr(&self) -> &Repr<S> {
4944+ &self.0
4945+ }
4946+}
4947+
4948+impl<S: StateID> Automaton for ByteClass<S> {
4949+ type ID = S;
4950+
4951+ fn match_kind(&self) -> &MatchKind {
4952+ &self.repr().match_kind
4953+ }
4954+
4955+ fn anchored(&self) -> bool {
4956+ self.repr().anchored
4957+ }
4958+
4959+ fn prefilter(&self) -> Option<&dyn Prefilter> {
4960+ self.repr().prefilter.as_ref().map(|p| p.as_ref())
4961+ }
4962+
4963+ fn start_state(&self) -> S {
4964+ self.repr().start_id
4965+ }
4966+
4967+ fn is_valid(&self, id: S) -> bool {
4968+ id.to_usize() < self.repr().state_count
4969+ }
4970+
4971+ fn is_match_state(&self, id: S) -> bool {
4972+ self.repr().is_match_state(id)
4973+ }
4974+
4975+ fn is_match_or_dead_state(&self, id: S) -> bool {
4976+ self.repr().is_match_or_dead_state(id)
4977+ }
4978+
4979+ fn get_match(
4980+ &self,
4981+ id: S,
4982+ match_index: usize,
4983+ end: usize,
4984+ ) -> Option<Match> {
4985+ self.repr().get_match(id, match_index, end)
4986+ }
4987+
4988+ fn match_count(&self, id: S) -> usize {
4989+ self.repr().match_count(id)
4990+ }
4991+
4992+ fn next_state(&self, current: S, input: u8) -> S {
4993+ let alphabet_len = self.repr().byte_classes.alphabet_len();
4994+ let input = self.repr().byte_classes.get(input);
4995+ let o = current.to_usize() * alphabet_len + input as usize;
4996+ self.repr().trans[o]
4997+ }
4998+}
4999+
5000+#[derive(Clone, Debug)]
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches