Vendored dependencies for cargo-vet, part 3/3

Bug: 292125255
Change-Id: Iac971a694114096efef5b86357e65b7470c5f236
diff --git a/android/vendor/aho-corasick-0.7.18/.cargo-checksum.json b/android/vendor/aho-corasick-0.7.18/.cargo-checksum.json
new file mode 100644
index 0000000..ec143d7
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/.cargo-checksum.json
@@ -0,0 +1 @@
+{"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"}
\ No newline at end of file
diff --git a/android/vendor/aho-corasick-0.7.18/COPYING b/android/vendor/aho-corasick-0.7.18/COPYING
new file mode 100644
index 0000000..bb9c20a
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/COPYING
@@ -0,0 +1,3 @@
+This project is dual-licensed under the Unlicense and MIT licenses.
+
+You may use this code under the terms of either license.
diff --git a/android/vendor/aho-corasick-0.7.18/Cargo.toml b/android/vendor/aho-corasick-0.7.18/Cargo.toml
new file mode 100644
index 0000000..62b5f7e
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/Cargo.toml
@@ -0,0 +1,43 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "aho-corasick"
+version = "0.7.18"
+authors = ["Andrew Gallant <jamslam@gmail.com>"]
+exclude = ["/aho-corasick-debug", "/ci/*", "/.travis.yml", "/appveyor.yml"]
+autotests = false
+description = "Fast multiple substring searching."
+homepage = "https://github.com/BurntSushi/aho-corasick"
+readme = "README.md"
+keywords = ["string", "search", "text", "aho", "multi"]
+categories = ["text-processing"]
+license = "Unlicense/MIT"
+repository = "https://github.com/BurntSushi/aho-corasick"
+[profile.bench]
+debug = true
+
+[profile.release]
+debug = true
+
+[lib]
+name = "aho_corasick"
+[dependencies.memchr]
+version = "2.4.0"
+default-features = false
+
+[dev-dependencies]
+
+[features]
+default = ["std"]
+std = ["memchr/std"]
diff --git a/android/vendor/aho-corasick-0.7.18/DESIGN.md b/android/vendor/aho-corasick-0.7.18/DESIGN.md
new file mode 100644
index 0000000..367e203
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/DESIGN.md
@@ -0,0 +1,483 @@
+This document describes the internal design of this crate, which is an object
+lesson in what happens when you take a fairly simple old algorithm like
+Aho-Corasick and make it fast and production ready.
+
+The target audience of this document is Rust programmers that have some
+familiarity with string searching, however, one does not need to know the
+Aho-Corasick algorithm in order to read this (it is explained below). One
+should, however, know what a trie is. (If you don't, go read its Wikipedia
+article.)
+
+The center-piece of this crate is an implementation of Aho-Corasick. On its
+own, Aho-Corasick isn't that complicated. The complex pieces come from the
+different variants of Aho-Corasick implemented in this crate. Specifically,
+they are:
+
+* Aho-Corasick as an NFA, using dense transitions near the root with sparse
+  transitions elsewhere.
+* Aho-Corasick as a DFA. (An NFA is slower to search, but cheaper to construct
+  and uses less memory.)
+  * A DFA with pre-multiplied state identifiers. This saves a multiplication
+    instruction in the core search loop.
+  * A DFA with equivalence classes of bytes as the alphabet, instead of the
+    traditional 256-byte alphabet. This shrinks the size of the DFA in memory,
+    but adds an extra lookup in the core search loop to map the input byte to
+    an equivalent class.
+* The option to choose how state identifiers are represented, via one of
+  u8, u16, u32, u64 or usize. This permits creating compact automatons when
+  matching a small number of patterns.
+* Supporting "standard" match semantics, along with its overlapping variant,
+  in addition to leftmost-first and leftmost-longest semantics. The "standard"
+  semantics are typically what you see in a textbook description of
+  Aho-Corasick. However, Aho-Corasick is also useful as an optimization in
+  regex engines, which often use leftmost-first or leftmost-longest semantics.
+  Thus, it is useful to implement those semantics here. The "standard" and
+  "leftmost" search algorithms are subtly different, and also require slightly
+  different construction algorithms.
+* Support for ASCII case insensitive matching.
+* Support for accelerating searches when the patterns all start with a small
+  number of fixed bytes. Or alternatively, when the  patterns all contain a
+  small number of rare bytes. (Searching for these bytes uses SIMD vectorized
+  code courtesy of `memchr`.)
+* Transparent support for alternative SIMD vectorized search routines for
+  smaller number of literals, such as the Teddy algorithm. We called these
+  "packed" search routines because they use SIMD. They can often be an order of
+  magnitude faster than just Aho-Corasick, but don't scale as well.
+* Support for searching streams. This can reuse most of the underlying code,
+  but does require careful buffering support.
+* Support for anchored searches, which permit efficient `is_prefix` checks for
+  a large number of patterns.
+
+When you combine all of this together along with trying to make everything as
+fast as possible, what you end up with is enitrely too much code with too much
+`unsafe`. Alas, I was not smart enough to figure out how to reduce it. Instead,
+we will explain it.
+
+
+# Basics
+
+The fundamental problem this crate is trying to solve is to determine the
+occurrences of possibly many patterns in a haystack. The naive way to solve
+this is to look for a match for each pattern at each position in the haystack:
+
+    for i in 0..haystack.len():
+      for p in patterns.iter():
+        if haystack[i..].starts_with(p.bytes()):
+          return Match(p.id(), i, i + p.bytes().len())
+
+Those four lines are effectively all this crate does. The problem with those
+four lines is that they are very slow, especially when you're searching for a
+large number of patterns.
+
+While there are many different algorithms available to solve this, a popular
+one is Aho-Corasick. It's a common solution because it's not too hard to
+implement, scales quite well even when searching for thousands of patterns and
+is generally pretty fast. Aho-Corasick does well here because, regardless of
+the number of patterns you're searching for, it always visits each byte in the
+haystack exactly once. This means, generally speaking, adding more patterns to
+an Aho-Corasick automaton does not make it slower. (Strictly speaking, however,
+this is not true, since a larger automaton will make less effective use of the
+CPU's cache.)
+
+Aho-Corasick can be succinctly described as a trie with state transitions
+between some of the nodes that efficiently instruct the search algorithm to
+try matching alternative keys in the automaton. The trick is that these state
+transitions are arranged such that each byte of input needs to be inspected
+only once. These state transitions are typically called "failure transitions,"
+because they instruct the searcher (the thing traversing the automaton while
+reading from the haystack) what to do when a byte in the haystack does not
+correspond to a valid transition in the current state of the trie.
+
+More formally, a failure transition points to a state in the automaton that may
+lead to a match whose prefix is a proper suffix of the path traversed through
+the trie so far. (If no such proper suffix exists, then the failure transition
+points back to the start state of the trie, effectively restarting the search.)
+This is perhaps simpler to explain pictorally. For example, let's say we built
+an Aho-Corasick automaton with the following patterns: 'abcd' and 'cef'. The
+trie looks like this:
+
+         a - S1 - b - S2 - c - S3 - d - S4*
+        /
+    S0 - c - S5 - e - S6 - f - S7*
+
+where states marked with a `*` are match states (meaning, the search algorithm
+should stop and report a match to the caller).
+
+So given this trie, it should be somewhat straight-forward to see how it can
+be used to determine whether any particular haystack *starts* with either
+`abcd` or `cef`. It's easy to express this in code:
+
+    fn has_prefix(trie: &Trie, haystack: &[u8]) -> bool {
+      let mut state_id = trie.start();
+      // If the empty pattern is in trie, then state_id is a match state.
+      if trie.is_match(state_id) {
+        return true;
+      }
+      for (i, &b) in haystack.iter().enumerate() {
+        state_id = match trie.next_state(state_id, b) {
+          Some(id) => id,
+          // If there was no transition for this state and byte, then we know
+          // the haystack does not start with one of the patterns in our trie.
+          None => return false,
+        };
+        if trie.is_match(state_id) {
+          return true;
+        }
+      }
+      false
+    }
+
+And that's pretty much it. All we do is move through the trie starting with the
+bytes at the beginning of the haystack. If we find ourselves in a position
+where we can't move, or if we've looked through the entire haystack without
+seeing a match state, then we know the haystack does not start with any of the
+patterns in the trie.
+
+The meat of the Aho-Corasick algorithm is in how we add failure transitions to
+our trie to keep searching efficient. Specifically, it permits us to not only
+check whether a haystack *starts* with any one of a number of patterns, but
+rather, whether the haystack contains any of a number of patterns *anywhere* in
+the haystack.
+
+As mentioned before, failure transitions connect a proper suffix of the path
+traversed through the trie before, with a path that leads to a match that has a
+prefix corresponding to that proper suffix. So in our case, for patterns `abcd`
+and `cef`, with a haystack `abcef`, we want to transition to state `S5` (from
+the diagram above) from `S3` upon seeing that the byte following `c` is not
+`d`. Namely, the proper suffix in this example is `c`, which is a prefix of
+`cef`. So the modified diagram looks like this:
+
+
+         a - S1 - b - S2 - c - S3 - d - S4*
+        /                      /
+       /       ----------------
+      /       /
+    S0 - c - S5 - e - S6 - f - S7*
+
+One thing that isn't shown in this diagram is that *all* states have a failure
+transition, but only `S3` has a *non-trivial* failure transition. That is, all
+other states have a failure transition back to the start state. So if our
+haystack was `abzabcd`, then the searcher would transition back to `S0` after
+seeing `z`, which effectively restarts the search. (Because there is no pattern
+in our trie that has a prefix of `bz` or `z`.)
+
+The code for traversing this *automaton* or *finite state machine* (it is no
+longer just a trie) is not that much different from the `has_prefix` code
+above:
+
+    fn contains(fsm: &FiniteStateMachine, haystack: &[u8]) -> bool {
+      let mut state_id = fsm.start();
+      // If the empty pattern is in fsm, then state_id is a match state.
+      if fsm.is_match(state_id) {
+        return true;
+      }
+      for (i, &b) in haystack.iter().enumerate() {
+        // While the diagram above doesn't show this, we may wind up needing
+        // to follow multiple failure transitions before we land on a state
+        // in which we can advance. Therefore, when searching for the next
+        // state, we need to loop until we don't see a failure transition.
+        //
+        // This loop terminates because the start state has no empty
+        // transitions. Every transition from the start state either points to
+        // another state, or loops back to the start state.
+        loop {
+          match fsm.next_state(state_id, b) {
+            Some(id) => {
+              state_id = id;
+              break;
+            }
+            // Unlike our code above, if there was no transition for this
+            // state, then we don't quit. Instead, we look for this state's
+            // failure transition and follow that instead.
+            None => {
+              state_id = fsm.next_fail_state(state_id);
+            }
+          };
+        }
+        if fsm.is_match(state_id) {
+          return true;
+        }
+      }
+      false
+    }
+
+Other than the complication around traversing failure transitions, this code
+is still roughly "traverse the automaton with bytes from the haystack, and quit
+when a match is seen."
+
+And that concludes our section on the basics. While we didn't go deep into
+how the automaton is built (see `src/nfa.rs`, which has detailed comments about
+that), the basic structure of Aho-Corasick should be reasonably clear.
+
+
+# NFAs and DFAs
+
+There are generally two types of finite automata: non-deterministic finite
+automata (NFA) and deterministic finite automata (DFA). The difference between
+them is, principally, that an NFA can be in multiple states at once. This is
+typically accomplished by things called _epsilon_ transitions, where one could
+move to a new state without consuming any bytes from the input. (The other
+mechanism by which NFAs can be in more than one state is where the same byte in
+a particular state transitions to multiple distinct states.) In contrast, a DFA
+can only ever be in one state at a time. A DFA has no epsilon transitions, and
+for any given state, a byte transitions to at most one other state.
+
+By this formulation, the Aho-Corasick automaton described in the previous
+section is an NFA. This is because failure transitions are, effectively,
+epsilon transitions. That is, whenever the automaton is in state `S`, it is
+actually in the set of states that are reachable by recursively following
+failure transitions from `S`. (This means that, for example, the start state
+is always active since the start state is reachable via failure transitions
+from any state in the automaton.)
+
+NFAs have a lot of nice properties. They tend to be easier to construct, and
+also tend to use less memory. However, their primary downside is that they are
+typically slower to execute. For example, the code above showing how to search
+with an Aho-Corasick automaton needs to potentially iterate through many
+failure transitions for every byte of input. While this is a fairly small
+amount of overhead, this can add up, especially if the automaton has a lot of
+overlapping patterns with a lot of failure transitions.
+
+A DFA's search code, by contrast, looks like this:
+
+    fn contains(dfa: &DFA, haystack: &[u8]) -> bool {
+      let mut state_id = dfa.start();
+      // If the empty pattern is in dfa, then state_id is a match state.
+      if dfa.is_match(state_id) {
+        return true;
+      }
+      for (i, &b) in haystack.iter().enumerate() {
+        // An Aho-Corasick DFA *never* has a missing state that requires
+        // failure transitions to be followed. One byte of input advances the
+        // automaton by one state. Always.
+        state_id = trie.next_state(state_id, b);
+        if fsm.is_match(state_id) {
+          return true;
+        }
+      }
+      false
+    }
+
+The search logic here is much simpler than for the NFA, and this tends to
+translate into significant performance benefits as well, since there's a lot
+less work being done for each byte in the haystack. How is this accomplished?
+It's done by pre-following all failure transitions for all states for all bytes
+in the alphabet, and then building a single state transition table. Building
+this DFA can be much more costly than building the NFA, and use much more
+memory, but the better performance can be worth it.
+
+Users of this crate can actually choose between using an NFA or a DFA. By
+default, an NFA is used, because it typically strikes the best balance between
+space usage and search performance. But the DFA option is available for cases
+where a little extra memory and upfront time building the automaton is okay.
+For example, the `AhoCorasick::auto_configure` and
+`AhoCorasickBuilder::auto_configure` methods will enable the DFA setting if
+there are a small number of patterns.
+
+
+# More DFA tricks
+
+As described in the previous section, one of the downsides of using a DFA
+is that is uses more memory and can take longer to build. One small way of
+mitigating these concerns is to map the alphabet used by the automaton into
+a smaller space. Typically, the alphabet of a DFA has 256 elements in it:
+one element for each possible value that fits into a byte. However, in many
+cases, one does not need the full alphabet. For example, if all patterns in an
+Aho-Corasick automaton are ASCII letters, then this only uses up 52 distinct
+bytes. As far as the automaton is concerned, the rest of the 204 bytes are
+indistinguishable from one another: they will never disrciminate between a
+match or a non-match. Therefore, in cases like that, the alphabet can be shrunk
+to just 53 elements. One for each ASCII letter, and then another to serve as a
+placeholder for every other unused byte.
+
+In practice, this library doesn't quite compute the optimal set of equivalence
+classes, but it's close enough in most cases. The key idea is that this then
+allows the transition table for the DFA to be potentially much smaller. The
+downside of doing this, however, is that since the transition table is defined
+in terms of this smaller alphabet space, every byte in the haystack must be
+re-mapped to this smaller space. This requires an additional 256-byte table.
+In practice, this can lead to a small search time hit, but it can be difficult
+to measure. Moreover, it can sometimes lead to faster search times for bigger
+automata, since it could be difference between more parts of the automaton
+staying in the CPU cache or not.
+
+One other trick for DFAs employed by this crate is the notion of premultiplying
+state identifiers. Specifically, the normal way to compute the next transition
+in a DFA is via the following (assuming that the transition table is laid out
+sequentially in memory, in row-major order, where the rows are states):
+
+    next_state_id = dfa.transitions[current_state_id * 256 + current_byte]
+
+However, since the value `256` is a fixed constant, we can actually premultiply
+the state identifiers in the table when we build the table initially. Then, the
+next transition computation simply becomes:
+
+    next_state_id = dfa.transitions[current_state_id + current_byte]
+
+This doesn't seem like much, but when this is being executed for every byte of
+input that you're searching, saving that extra multiplication instruction can
+add up.
+
+The same optimization works even when equivalence classes are enabled, as
+described above. The only difference is that the premultiplication is by the
+total number of equivalence classes instead of 256.
+
+There isn't much downside to premultiplying state identifiers, other than the
+fact that you may need to choose a bigger integer representation than you would
+otherwise. For example, if you don't premultiply state identifiers, then an
+automaton that uses `u8` as a state identifier can hold up to 256 states.
+However, if they are premultiplied, then it can only hold up to
+`floor(256 / len(alphabet))` states. Thus premultiplication impacts how compact
+your DFA can be. In practice, it's pretty rare to use `u8` as a state
+identifier, so premultiplication is usually a good thing to do.
+
+Both equivalence classes and premultiplication are tuneable parameters via the
+`AhoCorasickBuilder` type, and both are enabled by default.
+
+
+# Match semantics
+
+One of the more interesting things about this implementation of Aho-Corasick
+that (as far as this author knows) separates it from other implementations, is
+that it natively supports leftmost-first and leftmost-longest match semantics.
+Briefly, match semantics refer to the decision procedure by which searching
+will disambiguate matches when there are multiple to choose from:
+
+* **standard** match semantics emits matches as soon as they are detected by
+  the automaton. This is typically equivalent to the textbook non-overlapping
+  formulation of Aho-Corasick.
+* **leftmost-first** match semantics means that 1) the next match is the match
+  starting at the leftmost position and 2) among multiple matches starting at
+  the same leftmost position, the match corresponding to the pattern provided
+  first by the caller is reported.
+* **leftmost-longest** is like leftmost-first, except when there are multiple
+  matches starting at the same leftmost position, the pattern corresponding to
+  the longest match is returned.
+
+(The crate API documentation discusses these differences, with examples, in
+more depth on the `MatchKind` type.)
+
+The reason why supporting these match semantics is important is because it
+gives the user more control over the match procedure. For example,
+leftmost-first permits users to implement match priority by simply putting the
+higher priority patterns first. Leftmost-longest, on the other hand, permits
+finding the longest possible match, which might be useful when trying to find
+words matching a dictionary. Additionally, regex engines often want to use
+Aho-Corasick as an optimization when searching for an alternation of literals.
+In order to preserve correct match semantics, regex engines typically can't use
+the standard textbook definition directly, since regex engines will implement
+either leftmost-first (Perl-like) or leftmost-longest (POSIX) match semantics.
+
+Supporting leftmost semantics requires a couple key changes:
+
+* Constructing the Aho-Corasick automaton changes a bit in both how the trie is
+  constructed and how failure transitions are found. Namely, only a subset of
+  the failure transitions are added. Specifically, only the failure transitions
+  that either do not occur after a match or do occur after a match but preserve
+  that match are kept. (More details on this can be found in `src/nfa.rs`.)
+* The search algorithm changes slightly. Since we are looking for the leftmost
+  match, we cannot quit as soon as a match is detected. Instead, after a match
+  is detected, we must keep searching until either the end of the input or
+  until a dead state is seen. (Dead states are not used for standard match
+  semantics. Dead states mean that searching should stop after a match has been
+  found.)
+
+Other implementations of Aho-Corasick do support leftmost match semantics, but
+they do it with more overhead at search time, or even worse, with a queue of
+matches and sophisticated hijinks to disambiguate the matches. While our
+construction algorithm becomes a bit more complicated, the correct match
+semantics fall out from the structure of the automaton itself.
+
+
+# Overlapping matches
+
+One of the nice properties of an Aho-Corasick automaton is that it can report
+all possible matches, even when they overlap with one another. In this mode,
+the match semantics don't matter, since all possible matches are reported.
+Overlapping searches work just like regular searches, except the state
+identifier at which the previous search left off is carried over to the next
+search, so that it can pick up where it left off. If there are additional
+matches at that state, then they are reported before resuming the search.
+
+Enabling leftmost-first or leftmost-longest match semantics causes the
+automaton to use a subset of all failure transitions, which means that
+overlapping searches cannot be used. Therefore, if leftmost match semantics are
+used, attempting to do an overlapping search will panic. Thus, to get
+overlapping searches, the caller must use the default standard match semantics.
+This behavior was chosen because there are only two alternatives, which were
+deemed worse:
+
+* Compile two automatons internally, one for standard semantics and one for
+  the semantics requested by the caller (if not standard).
+* Create a new type, distinct from the `AhoCorasick` type, which has different
+  capabilities based on the configuration options.
+
+The first is untenable because of the amount of memory used by the automaton.
+The second increases the complexity of the API too much by adding too many
+types that do similar things. It is conceptually much simpler to keep all
+searching isolated to a single type. Callers may query whether the automaton
+supports overlapping searches via the `AhoCorasick::supports_overlapping`
+method.
+
+
+# Stream searching
+
+Since Aho-Corasick is an automaton, it is possible to do partial searches on
+partial parts of the haystack, and then resume that search on subsequent pieces
+of the haystack. This is useful when the haystack you're trying to search is
+not stored contiguous in memory, or if one does not want to read the entire
+haystack into memory at once.
+
+Currently, only standard semantics are supported for stream searching. This is
+some of the more complicated code in this crate, and is something I would very
+much like to improve. In particular, it currently has the restriction that it
+must buffer at least enough of the haystack in memory in order to fit the
+longest possible match. The difficulty in getting stream searching right is
+that the implementation choices (such as the buffer size) often impact what the
+API looks like and what it's allowed to do.
+
+
+# Prefilters
+
+In some cases, Aho-Corasick is not the fastest way to find matches containing
+multiple patterns. Sometimes, the search can be accelerated using highly
+optimized SIMD routines. For example, consider searching the following
+patterns:
+
+    Sherlock
+    Moriarty
+    Watson
+
+It is plausible that it would be much faster to quickly look for occurrences of
+the leading bytes, `S`, `M` or `W`, before trying to start searching via the
+automaton. Indeed, this is exactly what this crate will do.
+
+When there are more than three distinct starting bytes, then this crate will
+look for three distinct bytes occurring at any position in the patterns, while
+preferring bytes that are heuristically determined to be rare over others. For
+example:
+
+    Abuzz
+    Sanchez
+    Vasquez
+    Topaz
+    Waltz
+
+Here, we have more than 3 distinct starting bytes, but all of the patterns
+contain `z`, which is typically a rare byte. In this case, the prefilter will
+scan for `z`, back up a bit, and then execute the Aho-Corasick automaton.
+
+If all of that fails, then a packed multiple substring algorithm will be
+attempted. Currently, the only algorithm available for this is Teddy, but more
+may be added in the future. Teddy is unlike the above prefilters in that it
+confirms its own matches, so when Teddy is active, it might not be necessary
+for Aho-Corasick to run at all. (See `Automaton::leftmost_find_at_no_state_imp`
+in `src/automaton.rs`.) However, the current Teddy implementation only works
+in `x86_64` and when SSSE3 or AVX2 are available, and moreover, only works
+_well_ when there are a small number of patterns (say, less than 100). Teddy
+also requires the haystack to be of a certain length (more than 16-34 bytes).
+When the haystack is shorter than that, Rabin-Karp is used instead. (See
+`src/packed/rabinkarp.rs`.)
+
+There is a more thorough description of Teddy at
+[`src/packed/teddy/README.md`](src/packed/teddy/README.md).
diff --git a/android/vendor/aho-corasick-0.7.18/LICENSE-MIT b/android/vendor/aho-corasick-0.7.18/LICENSE-MIT
new file mode 100644
index 0000000..3b0a5dc
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/LICENSE-MIT
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Andrew Gallant
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/android/vendor/aho-corasick-0.7.18/README.md b/android/vendor/aho-corasick-0.7.18/README.md
new file mode 100644
index 0000000..cd43051
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/README.md
@@ -0,0 +1,181 @@
+aho-corasick
+============
+A library for finding occurrences of many patterns at once with SIMD
+acceleration in some cases. This library provides multiple pattern
+search principally through an implementation of the
+[Aho-Corasick algorithm](https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm),
+which builds a finite state machine for executing searches in linear time.
+Features include case insensitive matching, overlapping matches, fast searching
+via SIMD and optional full DFA construction and search & replace in streams.
+
+[![Build status](https://github.com/BurntSushi/aho-corasick/workflows/ci/badge.svg)](https://github.com/BurntSushi/aho-corasick/actions)
+[![](http://meritbadge.herokuapp.com/aho-corasick)](https://crates.io/crates/aho-corasick)
+
+Dual-licensed under MIT or the [UNLICENSE](http://unlicense.org).
+
+
+### Documentation
+
+https://docs.rs/aho-corasick
+
+
+### Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+aho-corasick = "0.7"
+```
+
+
+### Example: basic searching
+
+This example shows how to search for occurrences of multiple patterns
+simultaneously. Each match includes the pattern that matched along with the
+byte offsets of the match.
+
+```rust
+use aho_corasick::AhoCorasick;
+
+let patterns = &["apple", "maple", "Snapple"];
+let haystack = "Nobody likes maple in their apple flavored Snapple.";
+
+let ac = AhoCorasick::new(patterns);
+let mut matches = vec![];
+for mat in ac.find_iter(haystack) {
+    matches.push((mat.pattern(), mat.start(), mat.end()));
+}
+assert_eq!(matches, vec![
+    (1, 13, 18),
+    (0, 28, 33),
+    (2, 43, 50),
+]);
+```
+
+
+### Example: case insensitivity
+
+This is like the previous example, but matches `Snapple` case insensitively
+using `AhoCorasickBuilder`:
+
+```rust
+use aho_corasick::AhoCorasickBuilder;
+
+let patterns = &["apple", "maple", "snapple"];
+let haystack = "Nobody likes maple in their apple flavored Snapple.";
+
+let ac = AhoCorasickBuilder::new()
+    .ascii_case_insensitive(true)
+    .build(patterns);
+let mut matches = vec![];
+for mat in ac.find_iter(haystack) {
+    matches.push((mat.pattern(), mat.start(), mat.end()));
+}
+assert_eq!(matches, vec![
+    (1, 13, 18),
+    (0, 28, 33),
+    (2, 43, 50),
+]);
+```
+
+
+### Example: replacing matches in a stream
+
+This example shows how to execute a search and replace on a stream without
+loading the entire stream into memory first.
+
+```rust
+use aho_corasick::AhoCorasick;
+
+let patterns = &["fox", "brown", "quick"];
+let replace_with = &["sloth", "grey", "slow"];
+
+// In a real example, these might be `std::fs::File`s instead. All you need to
+// do is supply a pair of `std::io::Read` and `std::io::Write` implementations.
+let rdr = "The quick brown fox.";
+let mut wtr = vec![];
+
+let ac = AhoCorasick::new(patterns);
+ac.stream_replace_all(rdr.as_bytes(), &mut wtr, replace_with)
+    .expect("stream_replace_all failed");
+assert_eq!(b"The slow grey sloth.".to_vec(), wtr);
+```
+
+
+### Example: finding the leftmost first match
+
+In the textbook description of Aho-Corasick, its formulation is typically
+structured such that it reports all possible matches, even when they overlap
+with another. In many cases, overlapping matches may not be desired, such as
+the case of finding all successive non-overlapping matches like you might with
+a standard regular expression.
+
+Unfortunately the "obvious" way to modify the Aho-Corasick algorithm to do
+this doesn't always work in the expected way, since it will report matches as
+soon as they are seen. For example, consider matching the regex `Samwise|Sam`
+against the text `Samwise`. Most regex engines (that are Perl-like, or
+non-POSIX) will report `Samwise` as a match, but the standard Aho-Corasick
+algorithm modified for reporting non-overlapping matches will report `Sam`.
+
+A novel contribution of this library is the ability to change the match
+semantics of Aho-Corasick (without additional search time overhead) such that
+`Samwise` is reported instead. For example, here's the standard approach:
+
+```rust
+use aho_corasick::AhoCorasick;
+
+let patterns = &["Samwise", "Sam"];
+let haystack = "Samwise";
+
+let ac = AhoCorasick::new(patterns);
+let mat = ac.find(haystack).expect("should have a match");
+assert_eq!("Sam", &haystack[mat.start()..mat.end()]);
+```
+
+And now here's the leftmost-first version, which matches how a Perl-like
+regex will work:
+
+```rust
+use aho_corasick::{AhoCorasickBuilder, MatchKind};
+
+let patterns = &["Samwise", "Sam"];
+let haystack = "Samwise";
+
+let ac = AhoCorasickBuilder::new()
+    .match_kind(MatchKind::LeftmostFirst)
+    .build(patterns);
+let mat = ac.find(haystack).expect("should have a match");
+assert_eq!("Samwise", &haystack[mat.start()..mat.end()]);
+```
+
+In addition to leftmost-first semantics, this library also supports
+leftmost-longest semantics, which match the POSIX behavior of a regular
+expression alternation. See `MatchKind` in the docs for more details.
+
+
+### Minimum Rust version policy
+
+This crate's minimum supported `rustc` version is `1.41.1`.
+
+The current policy is that the minimum Rust version required to use this crate
+can be increased in minor version updates. For example, if `crate 1.0` requires
+Rust 1.20.0, then `crate 1.0.z` for all values of `z` will also require Rust
+1.20.0 or newer. However, `crate 1.y` for `y > 0` may require a newer minimum
+version of Rust.
+
+In general, this crate will be conservative with respect to the minimum
+supported version of Rust.
+
+
+### Future work
+
+Here are some plans for the future:
+
+* Assuming the current API is sufficient, I'd like to commit to it and release
+  a `1.0` version of this crate some time in the next 6-12 months.
+* Support stream searching with leftmost match semantics. Currently, only
+  standard match semantics are supported. Getting this right seems possible,
+  but is tricky since the match state needs to be propagated through multiple
+  searches. (With standard semantics, as soon as a match is seen the search
+  ends.)
diff --git a/android/vendor/aho-corasick-0.7.18/UNLICENSE b/android/vendor/aho-corasick-0.7.18/UNLICENSE
new file mode 100644
index 0000000..68a49da
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/UNLICENSE
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
diff --git a/android/vendor/aho-corasick-0.7.18/rustfmt.toml b/android/vendor/aho-corasick-0.7.18/rustfmt.toml
new file mode 100644
index 0000000..aa37a21
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/rustfmt.toml
@@ -0,0 +1,2 @@
+max_width = 79
+use_small_heuristics = "max"
diff --git a/android/vendor/aho-corasick-0.7.18/src/ahocorasick.rs b/android/vendor/aho-corasick-0.7.18/src/ahocorasick.rs
new file mode 100644
index 0000000..2b1aa5c
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/ahocorasick.rs
@@ -0,0 +1,2143 @@
+use std::io;
+
+use crate::automaton::Automaton;
+use crate::buffer::Buffer;
+use crate::dfa::{self, DFA};
+use crate::error::Result;
+use crate::nfa::{self, NFA};
+use crate::packed;
+use crate::prefilter::{Prefilter, PrefilterState};
+use crate::state_id::StateID;
+use crate::Match;
+
+/// An automaton for searching multiple strings in linear time.
+///
+/// The `AhoCorasick` type supports a few basic ways of constructing an
+/// automaton, including
+/// [`AhoCorasick::new`](struct.AhoCorasick.html#method.new)
+/// and
+/// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured).
+/// However, there are a fair number of configurable options that can be set
+/// by using
+/// [`AhoCorasickBuilder`](struct.AhoCorasickBuilder.html)
+/// instead. Such options include, but are not limited to, how matches are
+/// determined, simple case insensitivity, whether to use a DFA or not and
+/// various knobs for controlling the space-vs-time trade offs taken when
+/// building the automaton.
+///
+/// If you aren't sure where to start, try beginning with
+/// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured).
+///
+/// # Resource usage
+///
+/// Aho-Corasick automatons are always constructed in `O(p)` time, where `p`
+/// is the combined length of all patterns being searched. With that said,
+/// building an automaton can be fairly costly because of high constant
+/// factors, particularly when enabling the
+/// [DFA](struct.AhoCorasickBuilder.html#method.dfa)
+/// option (which is disabled by default). For this reason, it's generally a
+/// good idea to build an automaton once and reuse it as much as possible.
+///
+/// Aho-Corasick automatons can also use a fair bit of memory. To get a
+/// concrete idea of how much memory is being used, try using the
+/// [`AhoCorasick::heap_bytes`](struct.AhoCorasick.html#method.heap_bytes)
+/// method.
+///
+/// # Examples
+///
+/// This example shows how to search for occurrences of multiple patterns
+/// simultaneously in a case insensitive fashion. Each match includes the
+/// pattern that matched along with the byte offsets of the match.
+///
+/// ```
+/// use aho_corasick::AhoCorasickBuilder;
+///
+/// let patterns = &["apple", "maple", "snapple"];
+/// let haystack = "Nobody likes maple in their apple flavored Snapple.";
+///
+/// let ac = AhoCorasickBuilder::new()
+///     .ascii_case_insensitive(true)
+///     .build(patterns);
+/// let mut matches = vec![];
+/// for mat in ac.find_iter(haystack) {
+///     matches.push((mat.pattern(), mat.start(), mat.end()));
+/// }
+/// assert_eq!(matches, vec![
+///     (1, 13, 18),
+///     (0, 28, 33),
+///     (2, 43, 50),
+/// ]);
+/// ```
+///
+/// This example shows how to replace matches with some other string:
+///
+/// ```
+/// use aho_corasick::AhoCorasick;
+///
+/// let patterns = &["fox", "brown", "quick"];
+/// let haystack = "The quick brown fox.";
+/// let replace_with = &["sloth", "grey", "slow"];
+///
+/// let ac = AhoCorasick::new(patterns);
+/// let result = ac.replace_all(haystack, replace_with);
+/// assert_eq!(result, "The slow grey sloth.");
+/// ```
+#[derive(Clone, Debug)]
+pub struct AhoCorasick<S: StateID = usize> {
+    imp: Imp<S>,
+    match_kind: MatchKind,
+}
+
+impl AhoCorasick {
+    /// Create a new Aho-Corasick automaton using the default configuration.
+    ///
+    /// The default configuration optimizes for less space usage, but at the
+    /// expense of longer search times. To change the configuration, use
+    /// [`AhoCorasickBuilder`](struct.AhoCorasickBuilder.html)
+    /// for fine-grained control, or
+    /// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured)
+    /// for automatic configuration if you aren't sure which settings to pick.
+    ///
+    /// This uses the default
+    /// [`MatchKind::Standard`](enum.MatchKind.html#variant.Standard)
+    /// match semantics, which reports a match as soon as it is found. This
+    /// corresponds to the standard match semantics supported by textbook
+    /// descriptions of the Aho-Corasick algorithm.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let ac = AhoCorasick::new(&[
+    ///     "foo", "bar", "baz",
+    /// ]);
+    /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
+    /// ```
+    pub fn new<I, P>(patterns: I) -> AhoCorasick
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        AhoCorasickBuilder::new().build(patterns)
+    }
+
+    /// Build an Aho-Corasick automaton with an automatically determined
+    /// configuration.
+    ///
+    /// Specifically, this requires a slice of patterns instead of an iterator
+    /// since the configuration is determined by looking at the patterns before
+    /// constructing the automaton. The idea here is to balance space and time
+    /// automatically. That is, when searching a small number of patterns, this
+    /// will attempt to use the fastest possible configuration since the total
+    /// space required will be small anyway. As the number of patterns grows,
+    /// this will fall back to slower configurations that use less space.
+    ///
+    /// If you want auto configuration but with match semantics different from
+    /// the default `MatchKind::Standard`, then use
+    /// [`AhoCorasickBuilder::auto_configure`](struct.AhoCorasickBuilder.html#method.auto_configure).
+    ///
+    /// # Examples
+    ///
+    /// Basic usage is just like `new`, except you must provide a slice:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let ac = AhoCorasick::new_auto_configured(&[
+    ///     "foo", "bar", "baz",
+    /// ]);
+    /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
+    /// ```
+    pub fn new_auto_configured<B>(patterns: &[B]) -> AhoCorasick
+    where
+        B: AsRef<[u8]>,
+    {
+        AhoCorasickBuilder::new().auto_configure(patterns).build(patterns)
+    }
+}
+
+impl<S: StateID> AhoCorasick<S> {
+    /// Returns true if and only if this automaton matches the haystack at any
+    /// position.
+    ///
+    /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
+    /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
+    /// `&[u8]` itself.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let ac = AhoCorasick::new(&[
+    ///     "foo", "bar", "quux", "baz",
+    /// ]);
+    /// assert!(ac.is_match("xxx bar xxx"));
+    /// assert!(!ac.is_match("xxx qux xxx"));
+    /// ```
+    pub fn is_match<B: AsRef<[u8]>>(&self, haystack: B) -> bool {
+        self.earliest_find(haystack).is_some()
+    }
+
+    /// Returns the location of the first detected match in `haystack`.
+    ///
+    /// This method has the same behavior regardless of the
+    /// [`MatchKind`](enum.MatchKind.html)
+    /// of this automaton.
+    ///
+    /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
+    /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
+    /// `&[u8]` itself.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let ac = AhoCorasick::new(&[
+    ///     "abc", "b",
+    /// ]);
+    /// let mat = ac.earliest_find("abcd").expect("should have match");
+    /// assert_eq!(1, mat.pattern());
+    /// assert_eq!((1, 2), (mat.start(), mat.end()));
+    /// ```
+    pub fn earliest_find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> {
+        let mut prestate = PrefilterState::new(self.max_pattern_len());
+        let mut start = self.imp.start_state();
+        self.imp.earliest_find_at(
+            &mut prestate,
+            haystack.as_ref(),
+            0,
+            &mut start,
+        )
+    }
+
+    /// Returns the location of the first match according to the match
+    /// semantics that this automaton was constructed with.
+    ///
+    /// When using `MatchKind::Standard`, this corresponds precisely to the
+    /// same behavior as
+    /// [`earliest_find`](struct.AhoCorasick.html#method.earliest_find).
+    /// Otherwise, match semantics correspond to either
+    /// [leftmost-first](enum.MatchKind.html#variant.LeftmostFirst)
+    /// or
+    /// [leftmost-longest](enum.MatchKind.html#variant.LeftmostLongest).
+    ///
+    /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
+    /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
+    /// `&[u8]` itself.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage, with standard semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["b", "abc", "abcd"];
+    /// let haystack = "abcd";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::Standard) // default, not necessary
+    ///     .build(patterns);
+    /// let mat = ac.find(haystack).expect("should have a match");
+    /// assert_eq!("b", &haystack[mat.start()..mat.end()]);
+    /// ```
+    ///
+    /// Now with leftmost-first semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["b", "abc", "abcd"];
+    /// let haystack = "abcd";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let mat = ac.find(haystack).expect("should have a match");
+    /// assert_eq!("abc", &haystack[mat.start()..mat.end()]);
+    /// ```
+    ///
+    /// And finally, leftmost-longest semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["b", "abc", "abcd"];
+    /// let haystack = "abcd";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostLongest)
+    ///     .build(patterns);
+    /// let mat = ac.find(haystack).expect("should have a match");
+    /// assert_eq!("abcd", &haystack[mat.start()..mat.end()]);
+    /// ```
+    pub fn find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> {
+        let mut prestate = PrefilterState::new(self.max_pattern_len());
+        self.imp.find_at_no_state(&mut prestate, haystack.as_ref(), 0)
+    }
+
+    /// Returns an iterator of non-overlapping matches, using the match
+    /// semantics that this automaton was constructed with.
+    ///
+    /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
+    /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
+    /// `&[u8]` itself.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage, with standard semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::Standard) // default, not necessary
+    ///     .build(patterns);
+    /// let matches: Vec<usize> = ac
+    ///     .find_iter(haystack)
+    ///     .map(|mat| mat.pattern())
+    ///     .collect();
+    /// assert_eq!(vec![2, 2, 2], matches);
+    /// ```
+    ///
+    /// Now with leftmost-first semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let matches: Vec<usize> = ac
+    ///     .find_iter(haystack)
+    ///     .map(|mat| mat.pattern())
+    ///     .collect();
+    /// assert_eq!(vec![0, 2, 0], matches);
+    /// ```
+    ///
+    /// And finally, leftmost-longest semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostLongest)
+    ///     .build(patterns);
+    /// let matches: Vec<usize> = ac
+    ///     .find_iter(haystack)
+    ///     .map(|mat| mat.pattern())
+    ///     .collect();
+    /// assert_eq!(vec![0, 2, 1], matches);
+    /// ```
+    pub fn find_iter<'a, 'b, B: ?Sized + AsRef<[u8]>>(
+        &'a self,
+        haystack: &'b B,
+    ) -> FindIter<'a, 'b, S> {
+        FindIter::new(self, haystack.as_ref())
+    }
+
+    /// Returns an iterator of overlapping matches in the given `haystack`.
+    ///
+    /// Overlapping matches can _only_ be detected using
+    /// `MatchKind::Standard` semantics. If this automaton was constructed with
+    /// leftmost semantics, then this method will panic. To determine whether
+    /// this will panic at runtime, use the
+    /// [`AhoCorasick::supports_overlapping`](struct.AhoCorasick.html#method.supports_overlapping)
+    /// method.
+    ///
+    /// `haystack` may be any type that is cheaply convertible to a `&[u8]`.
+    /// This includes, but is not limited to, `String`, `&str`, `Vec<u8>`, and
+    /// `&[u8]` itself.
+    ///
+    /// # Panics
+    ///
+    /// This panics when `AhoCorasick::supports_overlapping` returns `false`.
+    /// That is, this panics when this automaton's match semantics are not
+    /// `MatchKind::Standard`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage, with standard semantics:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasick::new(patterns);
+    /// let matches: Vec<usize> = ac
+    ///     .find_overlapping_iter(haystack)
+    ///     .map(|mat| mat.pattern())
+    ///     .collect();
+    /// assert_eq!(vec![2, 0, 2, 2, 0, 1], matches);
+    /// ```
+    pub fn find_overlapping_iter<'a, 'b, B: ?Sized + AsRef<[u8]>>(
+        &'a self,
+        haystack: &'b B,
+    ) -> FindOverlappingIter<'a, 'b, S> {
+        FindOverlappingIter::new(self, haystack.as_ref())
+    }
+
+    /// Replace all matches with a corresponding value in the `replace_with`
+    /// slice given. Matches correspond to the same matches as reported by
+    /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// Replacements are determined by the index of the matching pattern.
+    /// For example, if the pattern with index `2` is found, then it is
+    /// replaced by `replace_with[2]`.
+    ///
+    /// # Panics
+    ///
+    /// This panics when `replace_with.len()` does not equal the total number
+    /// of patterns that are matched by this automaton.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let result = ac.replace_all(haystack, &["x", "y", "z"]);
+    /// assert_eq!("x the z to the xage", result);
+    /// ```
+    pub fn replace_all<B>(&self, haystack: &str, replace_with: &[B]) -> String
+    where
+        B: AsRef<str>,
+    {
+        assert_eq!(
+            replace_with.len(),
+            self.pattern_count(),
+            "replace_all requires a replacement for every pattern \
+             in the automaton"
+        );
+        let mut dst = String::with_capacity(haystack.len());
+        self.replace_all_with(haystack, &mut dst, |mat, _, dst| {
+            dst.push_str(replace_with[mat.pattern()].as_ref());
+            true
+        });
+        dst
+    }
+
+    /// Replace all matches using raw bytes with a corresponding value in the
+    /// `replace_with` slice given. Matches correspond to the same matches as
+    /// reported by [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// Replacements are determined by the index of the matching pattern.
+    /// For example, if the pattern with index `2` is found, then it is
+    /// replaced by `replace_with[2]`.
+    ///
+    /// # Panics
+    ///
+    /// This panics when `replace_with.len()` does not equal the total number
+    /// of patterns that are matched by this automaton.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = b"append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let result = ac.replace_all_bytes(haystack, &["x", "y", "z"]);
+    /// assert_eq!(b"x the z to the xage".to_vec(), result);
+    /// ```
+    pub fn replace_all_bytes<B>(
+        &self,
+        haystack: &[u8],
+        replace_with: &[B],
+    ) -> Vec<u8>
+    where
+        B: AsRef<[u8]>,
+    {
+        assert_eq!(
+            replace_with.len(),
+            self.pattern_count(),
+            "replace_all_bytes requires a replacement for every pattern \
+             in the automaton"
+        );
+        let mut dst = Vec::with_capacity(haystack.len());
+        self.replace_all_with_bytes(haystack, &mut dst, |mat, _, dst| {
+            dst.extend(replace_with[mat.pattern()].as_ref());
+            true
+        });
+        dst
+    }
+
+    /// Replace all matches using a closure called on each match.
+    /// Matches correspond to the same matches as reported by
+    /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// The closure accepts three parameters: the match found, the text of
+    /// the match and a string buffer with which to write the replaced text
+    /// (if any). If the closure returns `true`, then it continues to the next
+    /// match. If the closure returns `false`, then searching is stopped.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let mut result = String::new();
+    /// ac.replace_all_with(haystack, &mut result, |mat, _, dst| {
+    ///     dst.push_str(&mat.pattern().to_string());
+    ///     true
+    /// });
+    /// assert_eq!("0 the 2 to the 0age", result);
+    /// ```
+    ///
+    /// Stopping the replacement by returning `false` (continued from the
+    /// example above):
+    ///
+    /// ```
+    /// # use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    /// # let patterns = &["append", "appendage", "app"];
+    /// # let haystack = "append the app to the appendage";
+    /// # let ac = AhoCorasickBuilder::new()
+    /// #    .match_kind(MatchKind::LeftmostFirst)
+    /// #    .build(patterns);
+    /// let mut result = String::new();
+    /// ac.replace_all_with(haystack, &mut result, |mat, _, dst| {
+    ///     dst.push_str(&mat.pattern().to_string());
+    ///     mat.pattern() != 2
+    /// });
+    /// assert_eq!("0 the 2 to the appendage", result);
+    /// ```
+    pub fn replace_all_with<F>(
+        &self,
+        haystack: &str,
+        dst: &mut String,
+        mut replace_with: F,
+    ) where
+        F: FnMut(&Match, &str, &mut String) -> bool,
+    {
+        let mut last_match = 0;
+        for mat in self.find_iter(haystack) {
+            dst.push_str(&haystack[last_match..mat.start()]);
+            last_match = mat.end();
+            if !replace_with(&mat, &haystack[mat.start()..mat.end()], dst) {
+                break;
+            };
+        }
+        dst.push_str(&haystack[last_match..]);
+    }
+
+    /// Replace all matches using raw bytes with a closure called on each
+    /// match. Matches correspond to the same matches as reported by
+    /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// The closure accepts three parameters: the match found, the text of
+    /// the match and a byte buffer with which to write the replaced text
+    /// (if any). If the closure returns `true`, then it continues to the next
+    /// match. If the closure returns `false`, then searching is stopped.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = b"append the app to the appendage";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let mut result = vec![];
+    /// ac.replace_all_with_bytes(haystack, &mut result, |mat, _, dst| {
+    ///     dst.extend(mat.pattern().to_string().bytes());
+    ///     true
+    /// });
+    /// assert_eq!(b"0 the 2 to the 0age".to_vec(), result);
+    /// ```
+    ///
+    /// Stopping the replacement by returning `false` (continued from the
+    /// example above):
+    ///
+    /// ```
+    /// # use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    /// # let patterns = &["append", "appendage", "app"];
+    /// # let haystack = b"append the app to the appendage";
+    /// # let ac = AhoCorasickBuilder::new()
+    /// #    .match_kind(MatchKind::LeftmostFirst)
+    /// #    .build(patterns);
+    /// let mut result = vec![];
+    /// ac.replace_all_with_bytes(haystack, &mut result, |mat, _, dst| {
+    ///     dst.extend(mat.pattern().to_string().bytes());
+    ///     mat.pattern() != 2
+    /// });
+    /// assert_eq!(b"0 the 2 to the appendage".to_vec(), result);
+    /// ```
+    pub fn replace_all_with_bytes<F>(
+        &self,
+        haystack: &[u8],
+        dst: &mut Vec<u8>,
+        mut replace_with: F,
+    ) where
+        F: FnMut(&Match, &[u8], &mut Vec<u8>) -> bool,
+    {
+        let mut last_match = 0;
+        for mat in self.find_iter(haystack) {
+            dst.extend(&haystack[last_match..mat.start()]);
+            last_match = mat.end();
+            if !replace_with(&mat, &haystack[mat.start()..mat.end()], dst) {
+                break;
+            };
+        }
+        dst.extend(&haystack[last_match..]);
+    }
+
+    /// Returns an iterator of non-overlapping matches in the given
+    /// stream. Matches correspond to the same matches as reported by
+    /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// The matches yielded by this iterator use absolute position offsets in
+    /// the stream given, where the first byte has index `0`. Matches are
+    /// yieled until the stream is exhausted.
+    ///
+    /// Each item yielded by the iterator is an `io::Result<Match>`, where an
+    /// error is yielded if there was a problem reading from the reader given.
+    ///
+    /// When searching a stream, an internal buffer is used. Therefore, callers
+    /// should avoiding providing a buffered reader, if possible.
+    ///
+    /// Searching a stream requires that the automaton was built with
+    /// `MatchKind::Standard` semantics. If this automaton was constructed
+    /// with leftmost semantics, then this method will panic. To determine
+    /// whether this will panic at runtime, use the
+    /// [`AhoCorasick::supports_stream`](struct.AhoCorasick.html#method.supports_stream)
+    /// method.
+    ///
+    /// # Memory usage
+    ///
+    /// In general, searching streams will use a constant amount of memory for
+    /// its internal buffer. The one requirement is that the internal buffer
+    /// must be at least the size of the longest possible match. In most use
+    /// cases, the default buffer size will be much larger than any individual
+    /// match.
+    ///
+    /// # Panics
+    ///
+    /// This panics when `AhoCorasick::supports_stream` returns `false`.
+    /// That is, this panics when this automaton's match semantics are not
+    /// `MatchKind::Standard`. This restriction may be lifted in the future.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// # fn example() -> Result<(), ::std::io::Error> {
+    /// let patterns = &["append", "appendage", "app"];
+    /// let haystack = "append the app to the appendage";
+    ///
+    /// let ac = AhoCorasick::new(patterns);
+    /// let mut matches = vec![];
+    /// for result in ac.stream_find_iter(haystack.as_bytes()) {
+    ///     let mat = result?;
+    ///     matches.push(mat.pattern());
+    /// }
+    /// assert_eq!(vec![2, 2, 2], matches);
+    /// # Ok(()) }; example().unwrap()
+    /// ```
+    pub fn stream_find_iter<'a, R: io::Read>(
+        &'a self,
+        rdr: R,
+    ) -> StreamFindIter<'a, R, S> {
+        StreamFindIter::new(self, rdr)
+    }
+
+    /// Search for and replace all matches of this automaton in
+    /// the given reader, and write the replacements to the given
+    /// writer. Matches correspond to the same matches as reported by
+    /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// Replacements are determined by the index of the matching pattern.
+    /// For example, if the pattern with index `2` is found, then it is
+    /// replaced by `replace_with[2]`.
+    ///
+    /// After all matches are replaced, the writer is _not_ flushed.
+    ///
+    /// If there was a problem reading from the given reader or writing to the
+    /// given writer, then the corresponding `io::Error` is returned and all
+    /// replacement is stopped.
+    ///
+    /// When searching a stream, an internal buffer is used. Therefore, callers
+    /// should avoiding providing a buffered reader, if possible. However,
+    /// callers may want to provide a buffered writer.
+    ///
+    /// Searching a stream requires that the automaton was built with
+    /// `MatchKind::Standard` semantics. If this automaton was constructed
+    /// with leftmost semantics, then this method will panic. To determine
+    /// whether this will panic at runtime, use the
+    /// [`AhoCorasick::supports_stream`](struct.AhoCorasick.html#method.supports_stream)
+    /// method.
+    ///
+    /// # Memory usage
+    ///
+    /// In general, searching streams will use a constant amount of memory for
+    /// its internal buffer. The one requirement is that the internal buffer
+    /// must be at least the size of the longest possible match. In most use
+    /// cases, the default buffer size will be much larger than any individual
+    /// match.
+    ///
+    /// # Panics
+    ///
+    /// This panics when `AhoCorasick::supports_stream` returns `false`.
+    /// That is, this panics when this automaton's match semantics are not
+    /// `MatchKind::Standard`. This restriction may be lifted in the future.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// # fn example() -> Result<(), ::std::io::Error> {
+    /// let patterns = &["fox", "brown", "quick"];
+    /// let haystack = "The quick brown fox.";
+    /// let replace_with = &["sloth", "grey", "slow"];
+    ///
+    /// let ac = AhoCorasick::new(patterns);
+    /// let mut result = vec![];
+    /// ac.stream_replace_all(haystack.as_bytes(), &mut result, replace_with)?;
+    /// assert_eq!(b"The slow grey sloth.".to_vec(), result);
+    /// # Ok(()) }; example().unwrap()
+    /// ```
+    pub fn stream_replace_all<R, W, B>(
+        &self,
+        rdr: R,
+        wtr: W,
+        replace_with: &[B],
+    ) -> io::Result<()>
+    where
+        R: io::Read,
+        W: io::Write,
+        B: AsRef<[u8]>,
+    {
+        assert_eq!(
+            replace_with.len(),
+            self.pattern_count(),
+            "stream_replace_all requires a replacement for every pattern \
+             in the automaton"
+        );
+        self.stream_replace_all_with(rdr, wtr, |mat, _, wtr| {
+            wtr.write_all(replace_with[mat.pattern()].as_ref())
+        })
+    }
+
+    /// Search the given reader and replace all matches of this automaton
+    /// using the given closure. The result is written to the given
+    /// writer. Matches correspond to the same matches as reported by
+    /// [`find_iter`](struct.AhoCorasick.html#method.find_iter).
+    ///
+    /// The closure accepts three parameters: the match found, the text of
+    /// the match and the writer with which to write the replaced text (if any).
+    ///
+    /// After all matches are replaced, the writer is _not_ flushed.
+    ///
+    /// If there was a problem reading from the given reader or writing to the
+    /// given writer, then the corresponding `io::Error` is returned and all
+    /// replacement is stopped.
+    ///
+    /// When searching a stream, an internal buffer is used. Therefore, callers
+    /// should avoiding providing a buffered reader, if possible. However,
+    /// callers may want to provide a buffered writer.
+    ///
+    /// Searching a stream requires that the automaton was built with
+    /// `MatchKind::Standard` semantics. If this automaton was constructed
+    /// with leftmost semantics, then this method will panic. To determine
+    /// whether this will panic at runtime, use the
+    /// [`AhoCorasick::supports_stream`](struct.AhoCorasick.html#method.supports_stream)
+    /// method.
+    ///
+    /// # Memory usage
+    ///
+    /// In general, searching streams will use a constant amount of memory for
+    /// its internal buffer. The one requirement is that the internal buffer
+    /// must be at least the size of the longest possible match. In most use
+    /// cases, the default buffer size will be much larger than any individual
+    /// match.
+    ///
+    /// # Panics
+    ///
+    /// This panics when `AhoCorasick::supports_stream` returns `false`.
+    /// That is, this panics when this automaton's match semantics are not
+    /// `MatchKind::Standard`. This restriction may be lifted in the future.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use std::io::Write;
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// # fn example() -> Result<(), ::std::io::Error> {
+    /// let patterns = &["fox", "brown", "quick"];
+    /// let haystack = "The quick brown fox.";
+    ///
+    /// let ac = AhoCorasick::new(patterns);
+    /// let mut result = vec![];
+    /// ac.stream_replace_all_with(
+    ///     haystack.as_bytes(),
+    ///     &mut result,
+    ///     |mat, _, wtr| {
+    ///         wtr.write_all(mat.pattern().to_string().as_bytes())
+    ///     },
+    /// )?;
+    /// assert_eq!(b"The 2 1 0.".to_vec(), result);
+    /// # Ok(()) }; example().unwrap()
+    /// ```
+    pub fn stream_replace_all_with<R, W, F>(
+        &self,
+        rdr: R,
+        mut wtr: W,
+        mut replace_with: F,
+    ) -> io::Result<()>
+    where
+        R: io::Read,
+        W: io::Write,
+        F: FnMut(&Match, &[u8], &mut W) -> io::Result<()>,
+    {
+        let mut it = StreamChunkIter::new(self, rdr);
+        while let Some(result) = it.next() {
+            let chunk = result?;
+            match chunk {
+                StreamChunk::NonMatch { bytes, .. } => {
+                    wtr.write_all(bytes)?;
+                }
+                StreamChunk::Match { bytes, mat } => {
+                    replace_with(&mat, bytes, &mut wtr)?;
+                }
+            }
+        }
+        Ok(())
+    }
+
+    /// Returns the match kind used by this automaton.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasick, MatchKind};
+    ///
+    /// let ac = AhoCorasick::new(&[
+    ///     "foo", "bar", "quux", "baz",
+    /// ]);
+    /// assert_eq!(&MatchKind::Standard, ac.match_kind());
+    /// ```
+    pub fn match_kind(&self) -> &MatchKind {
+        self.imp.match_kind()
+    }
+
+    /// Returns the length of the longest pattern matched by this automaton.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let ac = AhoCorasick::new(&[
+    ///     "foo", "bar", "quux", "baz",
+    /// ]);
+    /// assert_eq!(4, ac.max_pattern_len());
+    /// ```
+    pub fn max_pattern_len(&self) -> usize {
+        self.imp.max_pattern_len()
+    }
+
+    /// Return the total number of patterns matched by this automaton.
+    ///
+    /// This includes patterns that may never participate in a match. For
+    /// example, if
+    /// [`MatchKind::LeftmostFirst`](enum.MatchKind.html#variant.LeftmostFirst)
+    /// match semantics are used, and the patterns `Sam` and `Samwise` were
+    /// used to build the automaton, then `Samwise` can never participate in a
+    /// match because `Sam` will always take priority.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasick;
+    ///
+    /// let ac = AhoCorasick::new(&[
+    ///     "foo", "bar", "baz",
+    /// ]);
+    /// assert_eq!(3, ac.pattern_count());
+    /// ```
+    pub fn pattern_count(&self) -> usize {
+        self.imp.pattern_count()
+    }
+
+    /// Returns true if and only if this automaton supports reporting
+    /// overlapping matches.
+    ///
+    /// If this returns false and overlapping matches are requested, then it
+    /// will result in a panic.
+    ///
+    /// Since leftmost matching is inherently incompatible with overlapping
+    /// matches, only
+    /// [`MatchKind::Standard`](enum.MatchKind.html#variant.Standard)
+    /// supports overlapping matches. This is unlikely to change in the future.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::Standard)
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert!(ac.supports_overlapping());
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert!(!ac.supports_overlapping());
+    /// ```
+    pub fn supports_overlapping(&self) -> bool {
+        self.match_kind.supports_overlapping()
+    }
+
+    /// Returns true if and only if this automaton supports stream searching.
+    ///
+    /// If this returns false and stream searching (or replacing) is attempted,
+    /// then it will result in a panic.
+    ///
+    /// Currently, only
+    /// [`MatchKind::Standard`](enum.MatchKind.html#variant.Standard)
+    /// supports streaming. This may be expanded in the future.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::Standard)
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert!(ac.supports_stream());
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert!(!ac.supports_stream());
+    /// ```
+    pub fn supports_stream(&self) -> bool {
+        self.match_kind.supports_stream()
+    }
+
+    /// Returns the approximate total amount of heap used by this automaton, in
+    /// units of bytes.
+    ///
+    /// # Examples
+    ///
+    /// This example shows the difference in heap usage between a few
+    /// configurations:
+    ///
+    /// ```ignore
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .dfa(false) // default
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert_eq!(10_336, ac.heap_bytes());
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .dfa(false) // default
+    ///     .ascii_case_insensitive(true)
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert_eq!(10_384, ac.heap_bytes());
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .dfa(true)
+    ///     .ascii_case_insensitive(true)
+    ///     .build(&["foo", "bar", "baz"]);
+    /// assert_eq!(1_248, ac.heap_bytes());
+    /// ```
+    pub fn heap_bytes(&self) -> usize {
+        match self.imp {
+            Imp::NFA(ref nfa) => nfa.heap_bytes(),
+            Imp::DFA(ref dfa) => dfa.heap_bytes(),
+        }
+    }
+}
+
+/// The internal implementation of Aho-Corasick, which is either an NFA or
+/// a DFA. The NFA is slower but uses less memory. The DFA is faster but uses
+/// more memory.
+#[derive(Clone, Debug)]
+enum Imp<S: StateID> {
+    NFA(NFA<S>),
+    DFA(DFA<S>),
+}
+
+impl<S: StateID> Imp<S> {
+    /// Returns the type of match semantics implemented by this automaton.
+    fn match_kind(&self) -> &MatchKind {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.match_kind(),
+            Imp::DFA(ref dfa) => dfa.match_kind(),
+        }
+    }
+
+    /// Returns the identifier of the start state.
+    fn start_state(&self) -> S {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.start_state(),
+            Imp::DFA(ref dfa) => dfa.start_state(),
+        }
+    }
+
+    /// The length, in bytes, of the longest pattern in this automaton. This
+    /// information is useful for maintaining correct buffer sizes when
+    /// searching on streams.
+    fn max_pattern_len(&self) -> usize {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.max_pattern_len(),
+            Imp::DFA(ref dfa) => dfa.max_pattern_len(),
+        }
+    }
+
+    /// The total number of patterns added to this automaton. This includes
+    /// patterns that may never match. The maximum matching pattern that can be
+    /// reported is exactly one less than this number.
+    fn pattern_count(&self) -> usize {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.pattern_count(),
+            Imp::DFA(ref dfa) => dfa.pattern_count(),
+        }
+    }
+
+    /// Returns the prefilter object, if one exists, for the underlying
+    /// automaton.
+    fn prefilter(&self) -> Option<&dyn Prefilter> {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.prefilter(),
+            Imp::DFA(ref dfa) => dfa.prefilter(),
+        }
+    }
+
+    /// Returns true if and only if we should attempt to use a prefilter.
+    fn use_prefilter(&self) -> bool {
+        let p = match self.prefilter() {
+            None => return false,
+            Some(p) => p,
+        };
+        !p.looks_for_non_start_of_match()
+    }
+
+    #[inline(always)]
+    fn overlapping_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut S,
+        match_index: &mut usize,
+    ) -> Option<Match> {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.overlapping_find_at(
+                prestate,
+                haystack,
+                at,
+                state_id,
+                match_index,
+            ),
+            Imp::DFA(ref dfa) => dfa.overlapping_find_at(
+                prestate,
+                haystack,
+                at,
+                state_id,
+                match_index,
+            ),
+        }
+    }
+
+    #[inline(always)]
+    fn earliest_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut S,
+    ) -> Option<Match> {
+        match *self {
+            Imp::NFA(ref nfa) => {
+                nfa.earliest_find_at(prestate, haystack, at, state_id)
+            }
+            Imp::DFA(ref dfa) => {
+                dfa.earliest_find_at(prestate, haystack, at, state_id)
+            }
+        }
+    }
+
+    #[inline(always)]
+    fn find_at_no_state(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Option<Match> {
+        match *self {
+            Imp::NFA(ref nfa) => nfa.find_at_no_state(prestate, haystack, at),
+            Imp::DFA(ref dfa) => dfa.find_at_no_state(prestate, haystack, at),
+        }
+    }
+}
+
+/// An iterator of non-overlapping matches in a particular haystack.
+///
+/// This iterator yields matches according to the
+/// [`MatchKind`](enum.MatchKind.html)
+/// used by this automaton.
+///
+/// This iterator is constructed via the
+/// [`AhoCorasick::find_iter`](struct.AhoCorasick.html#method.find_iter)
+/// method.
+///
+/// The type variable `S` refers to the representation used for state
+/// identifiers. (By default, this is `usize`.)
+///
+/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
+///
+/// The lifetime `'b` refers to the lifetime of the haystack being searched.
+#[derive(Debug)]
+pub struct FindIter<'a, 'b, S: StateID> {
+    fsm: &'a Imp<S>,
+    prestate: PrefilterState,
+    haystack: &'b [u8],
+    pos: usize,
+}
+
+impl<'a, 'b, S: StateID> FindIter<'a, 'b, S> {
+    fn new(ac: &'a AhoCorasick<S>, haystack: &'b [u8]) -> FindIter<'a, 'b, S> {
+        let prestate = PrefilterState::new(ac.max_pattern_len());
+        FindIter { fsm: &ac.imp, prestate, haystack, pos: 0 }
+    }
+}
+
+impl<'a, 'b, S: StateID> Iterator for FindIter<'a, 'b, S> {
+    type Item = Match;
+
+    fn next(&mut self) -> Option<Match> {
+        if self.pos > self.haystack.len() {
+            return None;
+        }
+        let result = self.fsm.find_at_no_state(
+            &mut self.prestate,
+            self.haystack,
+            self.pos,
+        );
+        let mat = match result {
+            None => return None,
+            Some(mat) => mat,
+        };
+        if mat.end() == self.pos {
+            // If the automaton can match the empty string and if we found an
+            // empty match, then we need to forcefully move the position.
+            self.pos += 1;
+        } else {
+            self.pos = mat.end();
+        }
+        Some(mat)
+    }
+}
+
+/// An iterator of overlapping matches in a particular haystack.
+///
+/// This iterator will report all possible matches in a particular haystack,
+/// even when the matches overlap.
+///
+/// This iterator is constructed via the
+/// [`AhoCorasick::find_overlapping_iter`](struct.AhoCorasick.html#method.find_overlapping_iter)
+/// method.
+///
+/// The type variable `S` refers to the representation used for state
+/// identifiers. (By default, this is `usize`.)
+///
+/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
+///
+/// The lifetime `'b` refers to the lifetime of the haystack being searched.
+#[derive(Debug)]
+pub struct FindOverlappingIter<'a, 'b, S: StateID> {
+    fsm: &'a Imp<S>,
+    prestate: PrefilterState,
+    haystack: &'b [u8],
+    pos: usize,
+    last_match_end: usize,
+    state_id: S,
+    match_index: usize,
+}
+
+impl<'a, 'b, S: StateID> FindOverlappingIter<'a, 'b, S> {
+    fn new(
+        ac: &'a AhoCorasick<S>,
+        haystack: &'b [u8],
+    ) -> FindOverlappingIter<'a, 'b, S> {
+        assert!(
+            ac.supports_overlapping(),
+            "automaton does not support overlapping searches"
+        );
+        let prestate = PrefilterState::new(ac.max_pattern_len());
+        FindOverlappingIter {
+            fsm: &ac.imp,
+            prestate,
+            haystack,
+            pos: 0,
+            last_match_end: 0,
+            state_id: ac.imp.start_state(),
+            match_index: 0,
+        }
+    }
+}
+
+impl<'a, 'b, S: StateID> Iterator for FindOverlappingIter<'a, 'b, S> {
+    type Item = Match;
+
+    fn next(&mut self) -> Option<Match> {
+        let result = self.fsm.overlapping_find_at(
+            &mut self.prestate,
+            self.haystack,
+            self.pos,
+            &mut self.state_id,
+            &mut self.match_index,
+        );
+        match result {
+            None => return None,
+            Some(m) => {
+                self.pos = m.end();
+                Some(m)
+            }
+        }
+    }
+}
+
+/// An iterator that reports Aho-Corasick matches in a stream.
+///
+/// This iterator yields elements of type `io::Result<Match>`, where an error
+/// is reported if there was a problem reading from the underlying stream.
+/// The iterator terminates only when the underlying stream reaches `EOF`.
+///
+/// This iterator is constructed via the
+/// [`AhoCorasick::stream_find_iter`](struct.AhoCorasick.html#method.stream_find_iter)
+/// method.
+///
+/// The type variable `R` refers to the `io::Read` stream that is being read
+/// from.
+///
+/// The type variable `S` refers to the representation used for state
+/// identifiers. (By default, this is `usize`.)
+///
+/// The lifetime `'a` refers to the lifetime of the `AhoCorasick` automaton.
+#[derive(Debug)]
+pub struct StreamFindIter<'a, R, S: StateID> {
+    it: StreamChunkIter<'a, R, S>,
+}
+
+impl<'a, R: io::Read, S: StateID> StreamFindIter<'a, R, S> {
+    fn new(ac: &'a AhoCorasick<S>, rdr: R) -> StreamFindIter<'a, R, S> {
+        StreamFindIter { it: StreamChunkIter::new(ac, rdr) }
+    }
+}
+
+impl<'a, R: io::Read, S: StateID> Iterator for StreamFindIter<'a, R, S> {
+    type Item = io::Result<Match>;
+
+    fn next(&mut self) -> Option<io::Result<Match>> {
+        loop {
+            match self.it.next() {
+                None => return None,
+                Some(Err(err)) => return Some(Err(err)),
+                Some(Ok(StreamChunk::NonMatch { .. })) => {}
+                Some(Ok(StreamChunk::Match { mat, .. })) => {
+                    return Some(Ok(mat));
+                }
+            }
+        }
+    }
+}
+
+/// An iterator over chunks in an underlying reader. Each chunk either
+/// corresponds to non-matching bytes or matching bytes, but all bytes from
+/// the underlying reader are reported in sequence. There may be an arbitrary
+/// number of non-matching chunks before seeing a matching chunk.
+///
+/// N.B. This does not actually implement Iterator because we need to borrow
+/// from the underlying reader. But conceptually, it's still an iterator.
+#[derive(Debug)]
+struct StreamChunkIter<'a, R, S: StateID> {
+    /// The AC automaton.
+    fsm: &'a Imp<S>,
+    /// State associated with this automaton's prefilter. It is a heuristic
+    /// for stopping the prefilter if it's deemed ineffective.
+    prestate: PrefilterState,
+    /// The source of bytes we read from.
+    rdr: R,
+    /// A fixed size buffer. This is what we actually search. There are some
+    /// invariants around the buffer's size, namely, it must be big enough to
+    /// contain the longest possible match.
+    buf: Buffer,
+    /// The ID of the FSM state we're currently in.
+    state_id: S,
+    /// The current position at which to start the next search in `buf`.
+    search_pos: usize,
+    /// The absolute position of `search_pos`, where `0` corresponds to the
+    /// position of the first byte read from `rdr`.
+    absolute_pos: usize,
+    /// The ending position of the last StreamChunk that was returned to the
+    /// caller. This position is used to determine whether we need to emit
+    /// non-matching bytes before emitting a match.
+    report_pos: usize,
+    /// A match that should be reported on the next call.
+    pending_match: Option<Match>,
+    /// Enabled only when the automaton can match the empty string. When
+    /// enabled, we need to execute one final search after consuming the
+    /// reader to find the trailing empty match.
+    has_empty_match_at_end: bool,
+}
+
+/// A single chunk yielded by the stream chunk iterator.
+///
+/// The `'r` lifetime refers to the lifetime of the stream chunk iterator.
+#[derive(Debug)]
+enum StreamChunk<'r> {
+    /// A chunk that does not contain any matches.
+    NonMatch { bytes: &'r [u8], start: usize },
+    /// A chunk that precisely contains a match.
+    Match { bytes: &'r [u8], mat: Match },
+}
+
+impl<'a, R: io::Read, S: StateID> StreamChunkIter<'a, R, S> {
+    fn new(ac: &'a AhoCorasick<S>, rdr: R) -> StreamChunkIter<'a, R, S> {
+        assert!(
+            ac.supports_stream(),
+            "stream searching is only supported for Standard match semantics"
+        );
+
+        let prestate = if ac.imp.use_prefilter() {
+            PrefilterState::new(ac.max_pattern_len())
+        } else {
+            PrefilterState::disabled()
+        };
+        let buf = Buffer::new(ac.imp.max_pattern_len());
+        let state_id = ac.imp.start_state();
+        StreamChunkIter {
+            fsm: &ac.imp,
+            prestate,
+            rdr,
+            buf,
+            state_id,
+            absolute_pos: 0,
+            report_pos: 0,
+            search_pos: 0,
+            pending_match: None,
+            has_empty_match_at_end: ac.is_match(""),
+        }
+    }
+
+    fn next<'r>(&'r mut self) -> Option<io::Result<StreamChunk<'r>>> {
+        loop {
+            if let Some(mut mat) = self.pending_match.take() {
+                let bytes = &self.buf.buffer()[mat.start()..mat.end()];
+                self.report_pos = mat.end();
+                mat = mat.increment(self.absolute_pos);
+                return Some(Ok(StreamChunk::Match { bytes, mat }));
+            }
+            if self.search_pos >= self.buf.len() {
+                if let Some(end) = self.unreported() {
+                    let bytes = &self.buf.buffer()[self.report_pos..end];
+                    let start = self.absolute_pos + self.report_pos;
+                    self.report_pos = end;
+                    return Some(Ok(StreamChunk::NonMatch { bytes, start }));
+                }
+                if self.buf.len() >= self.buf.min_buffer_len() {
+                    // This is the point at which we roll our buffer, which we
+                    // only do if our buffer has at least the minimum amount of
+                    // bytes in it. Before rolling, we update our various
+                    // positions to be consistent with the buffer after it has
+                    // been rolled.
+
+                    self.report_pos -=
+                        self.buf.len() - self.buf.min_buffer_len();
+                    self.absolute_pos +=
+                        self.search_pos - self.buf.min_buffer_len();
+                    self.search_pos = self.buf.min_buffer_len();
+                    self.buf.roll();
+                }
+                match self.buf.fill(&mut self.rdr) {
+                    Err(err) => return Some(Err(err)),
+                    Ok(false) => {
+                        // We've hit EOF, but if there are still some
+                        // unreported bytes remaining, return them now.
+                        if self.report_pos < self.buf.len() {
+                            let bytes = &self.buf.buffer()[self.report_pos..];
+                            let start = self.absolute_pos + self.report_pos;
+                            self.report_pos = self.buf.len();
+
+                            let chunk = StreamChunk::NonMatch { bytes, start };
+                            return Some(Ok(chunk));
+                        } else {
+                            // We've reported everything, but there might still
+                            // be a match at the very last position.
+                            if !self.has_empty_match_at_end {
+                                return None;
+                            }
+                            // fallthrough for another search to get trailing
+                            // empty matches
+                            self.has_empty_match_at_end = false;
+                        }
+                    }
+                    Ok(true) => {}
+                }
+            }
+            let result = self.fsm.earliest_find_at(
+                &mut self.prestate,
+                self.buf.buffer(),
+                self.search_pos,
+                &mut self.state_id,
+            );
+            match result {
+                None => {
+                    self.search_pos = self.buf.len();
+                }
+                Some(mat) => {
+                    self.state_id = self.fsm.start_state();
+                    if mat.end() == self.search_pos {
+                        // If the automaton can match the empty string and if
+                        // we found an empty match, then we need to forcefully
+                        // move the position.
+                        self.search_pos += 1;
+                    } else {
+                        self.search_pos = mat.end();
+                    }
+                    self.pending_match = Some(mat.clone());
+                    if self.report_pos < mat.start() {
+                        let bytes =
+                            &self.buf.buffer()[self.report_pos..mat.start()];
+                        let start = self.absolute_pos + self.report_pos;
+                        self.report_pos = mat.start();
+
+                        let chunk = StreamChunk::NonMatch { bytes, start };
+                        return Some(Ok(chunk));
+                    }
+                }
+            }
+        }
+    }
+
+    fn unreported(&self) -> Option<usize> {
+        let end = self.search_pos.saturating_sub(self.buf.min_buffer_len());
+        if self.report_pos < end {
+            Some(end)
+        } else {
+            None
+        }
+    }
+}
+
+/// A builder for configuring an Aho-Corasick automaton.
+#[derive(Clone, Debug)]
+pub struct AhoCorasickBuilder {
+    nfa_builder: nfa::Builder,
+    dfa_builder: dfa::Builder,
+    dfa: bool,
+}
+
+impl Default for AhoCorasickBuilder {
+    fn default() -> AhoCorasickBuilder {
+        AhoCorasickBuilder::new()
+    }
+}
+
+impl AhoCorasickBuilder {
+    /// Create a new builder for configuring an Aho-Corasick automaton.
+    ///
+    /// If you don't need fine grained configuration or aren't sure which knobs
+    /// to set, try using
+    /// [`AhoCorasick::new_auto_configured`](struct.AhoCorasick.html#method.new_auto_configured)
+    /// instead.
+    pub fn new() -> AhoCorasickBuilder {
+        AhoCorasickBuilder {
+            nfa_builder: nfa::Builder::new(),
+            dfa_builder: dfa::Builder::new(),
+            dfa: false,
+        }
+    }
+
+    /// Build an Aho-Corasick automaton using the configuration set on this
+    /// builder.
+    ///
+    /// A builder may be reused to create more automatons.
+    ///
+    /// This method will use the default for representing internal state
+    /// identifiers, which is `usize`. This guarantees that building the
+    /// automaton will succeed and is generally a good default, but can make
+    /// the size of the automaton 2-8 times bigger than it needs to be,
+    /// depending on your target platform.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasickBuilder;
+    ///
+    /// let patterns = &["foo", "bar", "baz"];
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .build(patterns);
+    /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
+    /// ```
+    pub fn build<I, P>(&self, patterns: I) -> AhoCorasick
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        // The builder only returns an error if the chosen state ID
+        // representation is too small to fit all of the given patterns. In
+        // this case, since we fix the representation to usize, it will always
+        // work because it's impossible to overflow usize since the underlying
+        // storage would OOM long before that happens.
+        self.build_with_size::<usize, I, P>(patterns)
+            .expect("usize state ID type should always work")
+    }
+
+    /// Build an Aho-Corasick automaton using the configuration set on this
+    /// builder with a specific state identifier representation. This only has
+    /// an effect when the `dfa` option is enabled.
+    ///
+    /// Generally, the choices for a state identifier representation are
+    /// `u8`, `u16`, `u32`, `u64` or `usize`, with `usize` being the default.
+    /// The advantage of choosing a smaller state identifier representation
+    /// is that the automaton produced will be smaller. This might be
+    /// beneficial for just generally using less space, or might even allow it
+    /// to fit more of the automaton in your CPU's cache, leading to overall
+    /// better search performance.
+    ///
+    /// Unlike the standard `build` method, this can report an error if the
+    /// state identifier representation cannot support the size of the
+    /// automaton.
+    ///
+    /// Note that the state identifier representation is determined by the
+    /// `S` type variable. This requires a type hint of some sort, either
+    /// by specifying the return type or using the turbofish, e.g.,
+    /// `build_with_size::<u16, _, _>(...)`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasick, AhoCorasickBuilder};
+    ///
+    /// # fn example() -> Result<(), ::aho_corasick::Error> {
+    /// let patterns = &["foo", "bar", "baz"];
+    /// let ac: AhoCorasick<u8> = AhoCorasickBuilder::new()
+    ///     .build_with_size(patterns)?;
+    /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
+    /// # Ok(()) }; example().unwrap()
+    /// ```
+    ///
+    /// Or alternatively, with turbofish:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasickBuilder;
+    ///
+    /// # fn example() -> Result<(), ::aho_corasick::Error> {
+    /// let patterns = &["foo", "bar", "baz"];
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .build_with_size::<u8, _, _>(patterns)?;
+    /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
+    /// # Ok(()) }; example().unwrap()
+    /// ```
+    pub fn build_with_size<S, I, P>(
+        &self,
+        patterns: I,
+    ) -> Result<AhoCorasick<S>>
+    where
+        S: StateID,
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        let nfa = self.nfa_builder.build(patterns)?;
+        let match_kind = nfa.match_kind().clone();
+        let imp = if self.dfa {
+            let dfa = self.dfa_builder.build(&nfa)?;
+            Imp::DFA(dfa)
+        } else {
+            Imp::NFA(nfa)
+        };
+        Ok(AhoCorasick { imp, match_kind })
+    }
+
+    /// Automatically configure the settings on this builder according to the
+    /// patterns that will be used to construct the automaton.
+    ///
+    /// The idea here is to balance space and time automatically. That is, when
+    /// searching a small number of patterns, this will attempt to use the
+    /// fastest possible configuration since the total space required will be
+    /// small anyway. As the number of patterns grows, this will fall back to
+    /// slower configurations that use less space.
+    ///
+    /// This is guaranteed to never set `match_kind`, but any other option may
+    /// be overridden.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasickBuilder;
+    ///
+    /// let patterns = &["foo", "bar", "baz"];
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .auto_configure(patterns)
+    ///     .build(patterns);
+    /// assert_eq!(Some(1), ac.find("xxx bar xxx").map(|m| m.pattern()));
+    /// ```
+    pub fn auto_configure<B: AsRef<[u8]>>(
+        &mut self,
+        patterns: &[B],
+    ) -> &mut AhoCorasickBuilder {
+        // N.B. Currently we only use the length of `patterns` to make a
+        // decision here, and could therefore ask for an `ExactSizeIterator`
+        // instead. But it's conceivable that we might adapt this to look at
+        // the total number of bytes, which would requires a second pass.
+        //
+        // The logic here is fairly rudimentary at the moment, but probably
+        // OK. The idea here is to use the fastest thing possible for a small
+        // number of patterns. That is, a DFA with no byte classes, since byte
+        // classes require an extra indirection for every byte searched. With a
+        // moderate number of patterns, we still want a DFA, but save on both
+        // space and compilation time by enabling byte classes. Finally, fall
+        // back to the slower but smaller NFA.
+        if patterns.len() <= 100 {
+            // N.B. Using byte classes can actually be faster by improving
+            // locality, but this only really applies for multi-megabyte
+            // automata (i.e., automata that don't fit in your CPU's cache).
+            self.dfa(true);
+        } else if patterns.len() <= 5000 {
+            self.dfa(true);
+        }
+        self
+    }
+
+    /// Set the desired match semantics.
+    ///
+    /// The default is `MatchKind::Standard`, which corresponds to the match
+    /// semantics supported by the standard textbook description of the
+    /// Aho-Corasick algorithm. Namely, matches are reported as soon as they
+    /// are found. Moreover, this is the only way to get overlapping matches
+    /// or do stream searching.
+    ///
+    /// The other kinds of match semantics that are supported are
+    /// `MatchKind::LeftmostFirst` and `MatchKind::LeftmostLongest`. The former
+    /// corresponds to the match you would get if you were to try to match
+    /// each pattern at each position in the haystack in the same order that
+    /// you give to the automaton. That is, it returns the leftmost match
+    /// corresponding the earliest pattern given to the automaton. The latter
+    /// corresponds to finding the longest possible match among all leftmost
+    /// matches.
+    ///
+    /// For more details on match semantics, see the
+    /// [documentation for `MatchKind`](enum.MatchKind.html).
+    ///
+    /// # Examples
+    ///
+    /// In these examples, we demonstrate the differences between match
+    /// semantics for a particular set of patterns in a specific order:
+    /// `b`, `abc`, `abcd`.
+    ///
+    /// Standard semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["b", "abc", "abcd"];
+    /// let haystack = "abcd";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::Standard) // default, not necessary
+    ///     .build(patterns);
+    /// let mat = ac.find(haystack).expect("should have a match");
+    /// assert_eq!("b", &haystack[mat.start()..mat.end()]);
+    /// ```
+    ///
+    /// Leftmost-first semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["b", "abc", "abcd"];
+    /// let haystack = "abcd";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostFirst)
+    ///     .build(patterns);
+    /// let mat = ac.find(haystack).expect("should have a match");
+    /// assert_eq!("abc", &haystack[mat.start()..mat.end()]);
+    /// ```
+    ///
+    /// Leftmost-longest semantics:
+    ///
+    /// ```
+    /// use aho_corasick::{AhoCorasickBuilder, MatchKind};
+    ///
+    /// let patterns = &["b", "abc", "abcd"];
+    /// let haystack = "abcd";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .match_kind(MatchKind::LeftmostLongest)
+    ///     .build(patterns);
+    /// let mat = ac.find(haystack).expect("should have a match");
+    /// assert_eq!("abcd", &haystack[mat.start()..mat.end()]);
+    /// ```
+    pub fn match_kind(&mut self, kind: MatchKind) -> &mut AhoCorasickBuilder {
+        self.nfa_builder.match_kind(kind);
+        self
+    }
+
+    /// Enable anchored mode, which requires all matches to start at the
+    /// first position in a haystack.
+    ///
+    /// This option is disabled by default.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasickBuilder;
+    ///
+    /// let patterns = &["foo", "bar"];
+    /// let haystack = "foobar";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .anchored(true)
+    ///     .build(patterns);
+    /// assert_eq!(1, ac.find_iter(haystack).count());
+    /// ```
+    ///
+    /// When searching for overlapping matches, all matches that start at
+    /// the beginning of a haystack will be reported:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasickBuilder;
+    ///
+    /// let patterns = &["foo", "foofoo"];
+    /// let haystack = "foofoo";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .anchored(true)
+    ///     .build(patterns);
+    /// assert_eq!(2, ac.find_overlapping_iter(haystack).count());
+    /// // A non-anchored search would return 3 matches.
+    /// ```
+    pub fn anchored(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
+        self.nfa_builder.anchored(yes);
+        self
+    }
+
+    /// Enable ASCII-aware case insensitive matching.
+    ///
+    /// When this option is enabled, searching will be performed without
+    /// respect to case for ASCII letters (`a-z` and `A-Z`) only.
+    ///
+    /// Enabling this option does not change the search algorithm, but it may
+    /// increase the size of the automaton.
+    ///
+    /// **NOTE:** In the future, support for full Unicode case insensitivity
+    /// may be added, but ASCII case insensitivity is comparatively much
+    /// simpler to add.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::AhoCorasickBuilder;
+    ///
+    /// let patterns = &["FOO", "bAr", "BaZ"];
+    /// let haystack = "foo bar baz";
+    ///
+    /// let ac = AhoCorasickBuilder::new()
+    ///     .ascii_case_insensitive(true)
+    ///     .build(patterns);
+    /// assert_eq!(3, ac.find_iter(haystack).count());
+    /// ```
+    pub fn ascii_case_insensitive(
+        &mut self,
+        yes: bool,
+    ) -> &mut AhoCorasickBuilder {
+        self.nfa_builder.ascii_case_insensitive(yes);
+        self
+    }
+
+    /// Set the limit on how many NFA states use a dense representation for
+    /// their transitions.
+    ///
+    /// A dense representation uses more space, but supports faster access to
+    /// transitions at search time. Thus, this setting permits the control of a
+    /// space vs time trade off when using the NFA variant of Aho-Corasick.
+    ///
+    /// This limit is expressed in terms of the depth of a state, i.e., the
+    /// number of transitions from the starting state of the NFA. The idea is
+    /// that most of the time searching will be spent near the starting state
+    /// of the automaton, so states near the start state should use a dense
+    /// representation. States further away from the start state would then use
+    /// a sparse representation, which uses less space but is slower to access
+    /// transitions at search time.
+    ///
+    /// By default, this is set to a low but non-zero number.
+    ///
+    /// This setting has no effect if the `dfa` option is enabled.
+    pub fn dense_depth(&mut self, depth: usize) -> &mut AhoCorasickBuilder {
+        self.nfa_builder.dense_depth(depth);
+        self
+    }
+
+    /// Compile the standard Aho-Corasick automaton into a deterministic finite
+    /// automaton (DFA).
+    ///
+    /// When this is disabled (which is the default), then a non-deterministic
+    /// finite automaton (NFA) is used instead.
+    ///
+    /// The main benefit to a DFA is that it can execute searches more quickly
+    /// than a NFA (perhaps 2-4 times as fast). The main drawback is that the
+    /// DFA uses more space and can take much longer to build.
+    ///
+    /// Enabling this option does not change the time complexity for
+    /// constructing the Aho-Corasick automaton (which is `O(p)` where
+    /// `p` is the total number of patterns being compiled). Enabling this
+    /// option does however reduce the time complexity of non-overlapping
+    /// searches from `O(n + p)` to `O(n)`, where `n` is the length of the
+    /// haystack.
+    ///
+    /// In general, it's a good idea to enable this if you're searching a
+    /// small number of fairly short patterns (~1000), or if you want the
+    /// fastest possible search without regard to compilation time or space
+    /// usage.
+    pub fn dfa(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
+        self.dfa = yes;
+        self
+    }
+
+    /// Enable heuristic prefilter optimizations.
+    ///
+    /// When enabled, searching will attempt to quickly skip to match
+    /// candidates using specialized literal search routines. A prefilter
+    /// cannot always be used, and is generally treated as a heuristic. It
+    /// can be useful to disable this if the prefilter is observed to be
+    /// sub-optimal for a particular workload.
+    ///
+    /// This is enabled by default.
+    pub fn prefilter(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
+        self.nfa_builder.prefilter(yes);
+        self
+    }
+
+    /// Shrink the size of the transition alphabet by mapping bytes to their
+    /// equivalence classes. This only has an effect when the `dfa` option is
+    /// enabled.
+    ///
+    /// When enabled, each a DFA will use a map from all possible bytes
+    /// to their corresponding equivalence class. Each equivalence class
+    /// represents a set of bytes that does not discriminate between a match
+    /// and a non-match in the DFA. For example, the patterns `bar` and `baz`
+    /// have at least five equivalence classes: singleton sets of `b`, `a`, `r`
+    /// and `z`, and a final set that contains every other byte.
+    ///
+    /// The advantage of this map is that the size of the transition table can
+    /// be reduced drastically from `#states * 256 * sizeof(id)` to
+    /// `#states * k * sizeof(id)` where `k` is the number of equivalence
+    /// classes. As a result, total space usage can decrease substantially.
+    /// Moreover, since a smaller alphabet is used, compilation becomes faster
+    /// as well.
+    ///
+    /// The disadvantage of this map is that every byte searched must be
+    /// passed through this map before it can be used to determine the next
+    /// transition. This has a small match time performance cost. However, if
+    /// the DFA is otherwise very large without byte classes, then using byte
+    /// classes can greatly improve memory locality and thus lead to better
+    /// overall performance.
+    ///
+    /// This option is enabled by default.
+    #[deprecated(
+        since = "0.7.16",
+        note = "not carrying its weight, will be always enabled, see: https://github.com/BurntSushi/aho-corasick/issues/57"
+    )]
+    pub fn byte_classes(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
+        self.dfa_builder.byte_classes(yes);
+        self
+    }
+
+    /// Premultiply state identifiers in the transition table. This only has
+    /// an effect when the `dfa` option is enabled.
+    ///
+    /// When enabled, state identifiers are premultiplied to point to their
+    /// corresponding row in the transition table. That is, given the `i`th
+    /// state, its corresponding premultiplied identifier is `i * k` where `k`
+    /// is the alphabet size of the automaton. (The alphabet size is at most
+    /// 256, but is in practice smaller if byte classes is enabled.)
+    ///
+    /// When state identifiers are not premultiplied, then the identifier of
+    /// the `i`th state is `i`.
+    ///
+    /// The advantage of premultiplying state identifiers is that is saves a
+    /// multiplication instruction per byte when searching with a DFA. This has
+    /// been observed to lead to a 20% performance benefit in micro-benchmarks.
+    ///
+    /// The primary disadvantage of premultiplying state identifiers is
+    /// that they require a larger integer size to represent. For example,
+    /// if the DFA has 200 states, then its premultiplied form requires 16
+    /// bits to represent every possible state identifier, where as its
+    /// non-premultiplied form only requires 8 bits.
+    ///
+    /// This option is enabled by default.
+    #[deprecated(
+        since = "0.7.16",
+        note = "not carrying its weight, will be always enabled, see: https://github.com/BurntSushi/aho-corasick/issues/57"
+    )]
+    pub fn premultiply(&mut self, yes: bool) -> &mut AhoCorasickBuilder {
+        self.dfa_builder.premultiply(yes);
+        self
+    }
+}
+
+/// A knob for controlling the match semantics of an Aho-Corasick automaton.
+///
+/// There are two generally different ways that Aho-Corasick automatons can
+/// report matches. The first way is the "standard" approach that results from
+/// implementing most textbook explanations of Aho-Corasick. The second way is
+/// to report only the leftmost non-overlapping matches. The leftmost approach
+/// is in turn split into two different ways of resolving ambiguous matches:
+/// leftmost-first and leftmost-longest.
+///
+/// The `Standard` match kind is the default and is the only one that supports
+/// overlapping matches and stream searching. (Trying to find overlapping
+/// or streaming matches using leftmost match semantics will result in a
+/// panic.) The `Standard` match kind will report matches as they are seen.
+/// When searching for overlapping matches, then all possible matches are
+/// reported. When searching for non-overlapping matches, the first match seen
+/// is reported. For example, for non-overlapping matches, given the patterns
+/// `abcd` and `b` and the subject string `abcdef`, only a match for `b` is
+/// reported since it is detected first. The `abcd` match is never reported
+/// since it overlaps with the `b` match.
+///
+/// In contrast, the leftmost match kind always prefers the leftmost match
+/// among all possible matches. Given the same example as above with `abcd` and
+/// `b` as patterns and `abcdef` as the subject string, the leftmost match is
+/// `abcd` since it begins before the `b` match, even though the `b` match is
+/// detected before the `abcd` match. In this case, the `b` match is not
+/// reported at all since it overlaps with the `abcd` match.
+///
+/// The difference between leftmost-first and leftmost-longest is in how they
+/// resolve ambiguous matches when there are multiple leftmost matches to
+/// choose from. Leftmost-first always chooses the pattern that was provided
+/// earliest, where as leftmost-longest always chooses the longest matching
+/// pattern. For example, given the patterns `a` and `ab` and the subject
+/// string `ab`, the leftmost-first match is `a` but the leftmost-longest match
+/// is `ab`. Conversely, if the patterns were given in reverse order, i.e.,
+/// `ab` and `a`, then both the leftmost-first and leftmost-longest matches
+/// would be `ab`. Stated differently, the leftmost-first match depends on the
+/// order in which the patterns were given to the Aho-Corasick automaton.
+/// Because of that, when leftmost-first matching is used, if a pattern `A`
+/// that appears before a pattern `B` is a prefix of `B`, then it is impossible
+/// to ever observe a match of `B`.
+///
+/// If you're not sure which match kind to pick, then stick with the standard
+/// kind, which is the default. In particular, if you need overlapping or
+/// streaming matches, then you _must_ use the standard kind. The leftmost
+/// kinds are useful in specific circumstances. For example, leftmost-first can
+/// be very useful as a way to implement match priority based on the order of
+/// patterns given and leftmost-longest can be useful for dictionary searching
+/// such that only the longest matching words are reported.
+///
+/// # Relationship with regular expression alternations
+///
+/// Understanding match semantics can be a little tricky, and one easy way
+/// to conceptualize non-overlapping matches from an Aho-Corasick automaton
+/// is to think about them as a simple alternation of literals in a regular
+/// expression. For example, let's say we wanted to match the strings
+/// `Sam` and `Samwise`, which would turn into the regex `Sam|Samwise`. It
+/// turns out that regular expression engines have two different ways of
+/// matching this alternation. The first way, leftmost-longest, is commonly
+/// found in POSIX compatible implementations of regular expressions (such as
+/// `grep`). The second way, leftmost-first, is commonly found in backtracking
+/// implementations such as Perl. (Some regex engines, such as RE2 and Rust's
+/// regex engine do not use backtracking, but still implement leftmost-first
+/// semantics in an effort to match the behavior of dominant backtracking
+/// regex engines such as those found in Perl, Ruby, Python, Javascript and
+/// PHP.)
+///
+/// That is, when matching `Sam|Samwise` against `Samwise`, a POSIX regex
+/// will match `Samwise` because it is the longest possible match, but a
+/// Perl-like regex will match `Sam` since it appears earlier in the
+/// alternation. Indeed, the regex `Sam|Samwise` in a Perl-like regex engine
+/// will never match `Samwise` since `Sam` will always have higher priority.
+/// Conversely, matching the regex `Samwise|Sam` against `Samwise` will lead to
+/// a match of `Samwise` in both POSIX and Perl-like regexes since `Samwise` is
+/// still longest match, but it also appears earlier than `Sam`.
+///
+/// The "standard" match semantics of Aho-Corasick generally don't correspond
+/// to the match semantics of any large group of regex implementations, so
+/// there's no direct analogy that can be made here. Standard match semantics
+/// are generally useful for overlapping matches, or if you just want to see
+/// matches as they are detected.
+///
+/// The main conclusion to draw from this section is that the match semantics
+/// can be tweaked to precisely match either Perl-like regex alternations or
+/// POSIX regex alternations.
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub enum MatchKind {
+    /// Use standard match semantics, which support overlapping matches. When
+    /// used with non-overlapping matches, matches are reported as they are
+    /// seen.
+    Standard,
+    /// Use leftmost-first match semantics, which reports leftmost matches.
+    /// When there are multiple possible leftmost matches, the match
+    /// corresponding to the pattern that appeared earlier when constructing
+    /// the automaton is reported.
+    ///
+    /// This does **not** support overlapping matches or stream searching. If
+    /// this match kind is used, attempting to find overlapping matches or
+    /// stream matches will panic.
+    LeftmostFirst,
+    /// Use leftmost-longest match semantics, which reports leftmost matches.
+    /// When there are multiple possible leftmost matches, the longest match
+    /// is chosen.
+    ///
+    /// This does **not** support overlapping matches or stream searching. If
+    /// this match kind is used, attempting to find overlapping matches or
+    /// stream matches will panic.
+    LeftmostLongest,
+    /// Hints that destructuring should not be exhaustive.
+    ///
+    /// This enum may grow additional variants, so this makes sure clients
+    /// don't count on exhaustive matching. (Otherwise, adding a new variant
+    /// could break existing code.)
+    #[doc(hidden)]
+    __Nonexhaustive,
+}
+
+/// The default match kind is `MatchKind::Standard`.
+impl Default for MatchKind {
+    fn default() -> MatchKind {
+        MatchKind::Standard
+    }
+}
+
+impl MatchKind {
+    fn supports_overlapping(&self) -> bool {
+        self.is_standard()
+    }
+
+    fn supports_stream(&self) -> bool {
+        // TODO: It may be possible to support this. It's hard.
+        //
+        // See: https://github.com/rust-lang/regex/issues/425#issuecomment-471367838
+        self.is_standard()
+    }
+
+    pub(crate) fn is_standard(&self) -> bool {
+        *self == MatchKind::Standard
+    }
+
+    pub(crate) fn is_leftmost(&self) -> bool {
+        *self == MatchKind::LeftmostFirst
+            || *self == MatchKind::LeftmostLongest
+    }
+
+    pub(crate) fn is_leftmost_first(&self) -> bool {
+        *self == MatchKind::LeftmostFirst
+    }
+
+    /// Convert this match kind into a packed match kind. If this match kind
+    /// corresponds to standard semantics, then this returns None, since
+    /// packed searching does not support standard semantics.
+    pub(crate) fn as_packed(&self) -> Option<packed::MatchKind> {
+        match *self {
+            MatchKind::Standard => None,
+            MatchKind::LeftmostFirst => Some(packed::MatchKind::LeftmostFirst),
+            MatchKind::LeftmostLongest => {
+                Some(packed::MatchKind::LeftmostLongest)
+            }
+            MatchKind::__Nonexhaustive => unreachable!(),
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn oibits() {
+        use std::panic::{RefUnwindSafe, UnwindSafe};
+
+        fn assert_send<T: Send>() {}
+        fn assert_sync<T: Sync>() {}
+        fn assert_unwind_safe<T: RefUnwindSafe + UnwindSafe>() {}
+
+        assert_send::<AhoCorasick>();
+        assert_sync::<AhoCorasick>();
+        assert_unwind_safe::<AhoCorasick>();
+        assert_send::<AhoCorasickBuilder>();
+        assert_sync::<AhoCorasickBuilder>();
+        assert_unwind_safe::<AhoCorasickBuilder>();
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/automaton.rs b/android/vendor/aho-corasick-0.7.18/src/automaton.rs
new file mode 100644
index 0000000..b971bf3
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/automaton.rs
@@ -0,0 +1,573 @@
+use crate::ahocorasick::MatchKind;
+use crate::prefilter::{self, Candidate, Prefilter, PrefilterState};
+use crate::state_id::{dead_id, fail_id, StateID};
+use crate::Match;
+
+// NOTE: This trait essentially started as a copy of the same trait from from
+// regex-automata, with some wording changed since we use this trait for
+// NFAs in addition to DFAs in this crate. Additionally, we do not export
+// this trait. It's only used internally to reduce code duplication. The
+// regex-automata crate needs to expose it because its Regex type is generic
+// over implementations of this trait. In this crate, we encapsulate everything
+// behind the AhoCorasick type.
+//
+// This trait is a bit of a mess, but it's not quite clear how to fix it.
+// Basically, there are several competing concerns:
+//
+// * We need performance, so everything effectively needs to get monomorphized.
+// * There are several variations on searching Aho-Corasick automatons:
+//   overlapping, standard and leftmost. Overlapping and standard are somewhat
+//   combined together below, but there is no real way to combine standard with
+//   leftmost. Namely, leftmost requires continuing a search even after a match
+//   is found, in order to correctly disambiguate a match.
+// * On top of that, *sometimes* callers want to know which state the automaton
+//   is in after searching. This is principally useful for overlapping and
+//   stream searches. However, when callers don't care about this, we really
+//   do not want to be forced to compute it, since it sometimes requires extra
+//   work. Thus, there are effectively two copies of leftmost searching: one
+//   for tracking the state ID and one that doesn't. We should ideally do the
+//   same for standard searching, but my sanity stopped me.
+
+// SAFETY RATIONALE: Previously, the code below went to some length to remove
+// all bounds checks. This generally produced tighter assembly and lead to
+// 20-50% improvements in micro-benchmarks on corpora made up of random
+// characters. This somewhat makes sense, since the branch predictor is going
+// to be at its worse on random text.
+//
+// However, using the aho-corasick-debug tool and manually benchmarking
+// different inputs, the code *with* bounds checks actually wound up being
+// slightly faster:
+//
+//     $ cat input
+//     Sherlock Holmes
+//     John Watson
+//     Professor Moriarty
+//     Irene Adler
+//     Mary Watson
+//
+//     $ aho-corasick-debug-safe \
+//         input OpenSubtitles2018.raw.sample.en --kind leftmost-first --dfa
+//     pattern read time: 32.824µs
+//     automaton build time: 444.687µs
+//     automaton heap usage: 72392 bytes
+//     match count: 639
+//     count time: 1.809961702s
+//
+//     $ aho-corasick-debug-master \
+//         input OpenSubtitles2018.raw.sample.en --kind leftmost-first --dfa
+//     pattern read time: 31.425µs
+//     automaton build time: 317.434µs
+//     automaton heap usage: 72392 bytes
+//     match count: 639
+//     count time: 2.059157705s
+//
+// I was able to reproduce this result on two different machines (an i5 and
+// an i7). Therefore, we go the route of safe code for now.
+
+/// A trait describing the interface of an Aho-Corasick finite state machine.
+///
+/// Every automaton has exactly one fail state, one dead state and exactly one
+/// start state. Generally, these correspond to the first, second and third
+/// states, respectively. The failure state is always treated as a sentinel.
+/// That is, no correct Aho-Corasick automaton will ever transition into the
+/// fail state. The dead state, however, can be transitioned into, but only
+/// when leftmost-first or leftmost-longest match semantics are enabled and
+/// only when at least one match has been observed.
+///
+/// Every automaton also has one or more match states, such that
+/// `Automaton::is_match_state(id)` returns `true` if and only if `id`
+/// corresponds to a match state.
+pub trait Automaton {
+    /// The representation used for state identifiers in this automaton.
+    ///
+    /// Typically, this is one of `u8`, `u16`, `u32`, `u64` or `usize`.
+    type ID: StateID;
+
+    /// The type of matching that should be done.
+    fn match_kind(&self) -> &MatchKind;
+
+    /// Returns true if and only if this automaton uses anchored searches.
+    fn anchored(&self) -> bool;
+
+    /// An optional prefilter for quickly skipping to the next candidate match.
+    /// A prefilter must report at least every match, although it may report
+    /// positions that do not correspond to a match. That is, it must not allow
+    /// false negatives, but can allow false positives.
+    ///
+    /// Currently, a prefilter only runs when the automaton is in the start
+    /// state. That is, the position reported by a prefilter should always
+    /// correspond to the start of a potential match.
+    fn prefilter(&self) -> Option<&dyn Prefilter>;
+
+    /// Return the identifier of this automaton's start state.
+    fn start_state(&self) -> Self::ID;
+
+    /// Returns true if and only if the given state identifier refers to a
+    /// valid state.
+    fn is_valid(&self, id: Self::ID) -> bool;
+
+    /// Returns true if and only if the given identifier corresponds to a match
+    /// state.
+    ///
+    /// The state ID given must be valid, or else implementors may panic.
+    fn is_match_state(&self, id: Self::ID) -> bool;
+
+    /// Returns true if and only if the given identifier corresponds to a state
+    /// that is either the dead state or a match state.
+    ///
+    /// Depending on the implementation of the automaton, this routine can
+    /// be used to save a branch in the core matching loop. Nevertheless,
+    /// `is_match_state(id) || id == dead_id()` is always a valid
+    /// implementation. Indeed, this is the default implementation.
+    ///
+    /// The state ID given must be valid, or else implementors may panic.
+    fn is_match_or_dead_state(&self, id: Self::ID) -> bool {
+        id == dead_id() || self.is_match_state(id)
+    }
+
+    /// If the given state is a match state, return the match corresponding
+    /// to the given match index. `end` must be the ending position of the
+    /// detected match. If no match exists or if `match_index` exceeds the
+    /// number of matches in this state, then `None` is returned.
+    ///
+    /// The state ID given must be valid, or else implementors may panic.
+    ///
+    /// If the given state ID is correct and if the `match_index` is less than
+    /// the number of matches for that state, then this is guaranteed to return
+    /// a match.
+    fn get_match(
+        &self,
+        id: Self::ID,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match>;
+
+    /// Returns the number of matches for the given state. If the given state
+    /// is not a match state, then this returns 0.
+    ///
+    /// The state ID given must be valid, or else implementors must panic.
+    fn match_count(&self, id: Self::ID) -> usize;
+
+    /// Given the current state that this automaton is in and the next input
+    /// byte, this method returns the identifier of the next state. The
+    /// identifier returned must always be valid and may never correspond to
+    /// the fail state. The returned identifier may, however, point to the
+    /// dead state.
+    ///
+    /// This is not safe so that implementors may look up the next state
+    /// without memory safety checks such as bounds checks. As such, callers
+    /// must ensure that the given identifier corresponds to a valid automaton
+    /// state. Implementors must, in turn, ensure that this routine is safe for
+    /// all valid state identifiers and for all possible `u8` values.
+    fn next_state(&self, current: Self::ID, input: u8) -> Self::ID;
+
+    /// Like next_state, but debug_asserts that the underlying
+    /// implementation never returns a `fail_id()` for the next state.
+    fn next_state_no_fail(&self, current: Self::ID, input: u8) -> Self::ID {
+        let next = self.next_state(current, input);
+        // We should never see a transition to the failure state.
+        debug_assert!(
+            next != fail_id(),
+            "automaton should never return fail_id for next state"
+        );
+        next
+    }
+
+    /// Execute a search using standard match semantics.
+    ///
+    /// This can be used even when the automaton was constructed with leftmost
+    /// match semantics when you want to find the earliest possible match. This
+    /// can also be used as part of an overlapping search implementation.
+    ///
+    /// N.B. This does not report a match if `state_id` is given as a matching
+    /// state. As such, this should not be used directly.
+    #[inline(always)]
+    fn standard_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut Self::ID,
+    ) -> Option<Match> {
+        if let Some(pre) = self.prefilter() {
+            self.standard_find_at_imp(
+                prestate,
+                Some(pre),
+                haystack,
+                at,
+                state_id,
+            )
+        } else {
+            self.standard_find_at_imp(prestate, None, haystack, at, state_id)
+        }
+    }
+
+    // It's important for this to always be inlined. Namely, its only caller
+    // is standard_find_at, and the inlining should remove the case analysis
+    // for prefilter scanning when there is no prefilter available.
+    #[inline(always)]
+    fn standard_find_at_imp(
+        &self,
+        prestate: &mut PrefilterState,
+        prefilter: Option<&dyn Prefilter>,
+        haystack: &[u8],
+        mut at: usize,
+        state_id: &mut Self::ID,
+    ) -> Option<Match> {
+        while at < haystack.len() {
+            if let Some(pre) = prefilter {
+                if prestate.is_effective(at) && *state_id == self.start_state()
+                {
+                    let c = prefilter::next(prestate, pre, haystack, at)
+                        .into_option();
+                    match c {
+                        None => return None,
+                        Some(i) => {
+                            at = i;
+                        }
+                    }
+                }
+            }
+            // CORRECTNESS: next_state is correct for all possible u8 values,
+            // so the only thing we're concerned about is the validity of
+            // `state_id`. `state_id` either comes from the caller (in which
+            // case, we assume it is correct), or it comes from the return
+            // value of next_state, which is guaranteed to be correct.
+            *state_id = self.next_state_no_fail(*state_id, haystack[at]);
+            at += 1;
+            // This routine always quits immediately after seeing a
+            // match, and since dead states can only come after seeing
+            // a match, seeing a dead state here is impossible. (Unless
+            // we have an anchored automaton, in which case, dead states
+            // are used to stop a search.)
+            debug_assert!(
+                *state_id != dead_id() || self.anchored(),
+                "standard find should never see a dead state"
+            );
+
+            if self.is_match_or_dead_state(*state_id) {
+                return if *state_id == dead_id() {
+                    None
+                } else {
+                    self.get_match(*state_id, 0, at)
+                };
+            }
+        }
+        None
+    }
+
+    /// Execute a search using leftmost (either first or longest) match
+    /// semantics.
+    ///
+    /// The principle difference between searching with standard semantics and
+    /// searching with leftmost semantics is that leftmost searching will
+    /// continue searching even after a match has been found. Once a match
+    /// is found, the search does not stop until either the haystack has been
+    /// exhausted or a dead state is observed in the automaton. (Dead states
+    /// only exist in automatons constructed with leftmost semantics.) That is,
+    /// we rely on the construction of the automaton to tell us when to quit.
+    #[inline(never)]
+    fn leftmost_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut Self::ID,
+    ) -> Option<Match> {
+        if let Some(pre) = self.prefilter() {
+            self.leftmost_find_at_imp(
+                prestate,
+                Some(pre),
+                haystack,
+                at,
+                state_id,
+            )
+        } else {
+            self.leftmost_find_at_imp(prestate, None, haystack, at, state_id)
+        }
+    }
+
+    // It's important for this to always be inlined. Namely, its only caller
+    // is leftmost_find_at, and the inlining should remove the case analysis
+    // for prefilter scanning when there is no prefilter available.
+    #[inline(always)]
+    fn leftmost_find_at_imp(
+        &self,
+        prestate: &mut PrefilterState,
+        prefilter: Option<&dyn Prefilter>,
+        haystack: &[u8],
+        mut at: usize,
+        state_id: &mut Self::ID,
+    ) -> Option<Match> {
+        debug_assert!(self.match_kind().is_leftmost());
+        if self.anchored() && at > 0 && *state_id == self.start_state() {
+            return None;
+        }
+        let mut last_match = self.get_match(*state_id, 0, at);
+        while at < haystack.len() {
+            if let Some(pre) = prefilter {
+                if prestate.is_effective(at) && *state_id == self.start_state()
+                {
+                    let c = prefilter::next(prestate, pre, haystack, at)
+                        .into_option();
+                    match c {
+                        None => return None,
+                        Some(i) => {
+                            at = i;
+                        }
+                    }
+                }
+            }
+            // CORRECTNESS: next_state is correct for all possible u8 values,
+            // so the only thing we're concerned about is the validity of
+            // `state_id`. `state_id` either comes from the caller (in which
+            // case, we assume it is correct), or it comes from the return
+            // value of next_state, which is guaranteed to be correct.
+            *state_id = self.next_state_no_fail(*state_id, haystack[at]);
+            at += 1;
+            if self.is_match_or_dead_state(*state_id) {
+                if *state_id == dead_id() {
+                    // The only way to enter into a dead state is if a match
+                    // has been found, so we assert as much. This is different
+                    // from normal automata, where you might enter a dead state
+                    // if you know a subsequent match will never be found
+                    // (regardless of whether a match has already been found).
+                    // For Aho-Corasick, it is built so that we can match at
+                    // any position, so the possibility of a match always
+                    // exists.
+                    //
+                    // (Unless we have an anchored automaton, in which case,
+                    // dead states are used to stop a search.)
+                    debug_assert!(
+                        last_match.is_some() || self.anchored(),
+                        "failure state should only be seen after match"
+                    );
+                    return last_match;
+                }
+                last_match = self.get_match(*state_id, 0, at);
+            }
+        }
+        last_match
+    }
+
+    /// This is like leftmost_find_at, but does not need to track a caller
+    /// provided state id. In other words, the only output of this routine is a
+    /// match, if one exists.
+    ///
+    /// It is regrettable that we need to effectively copy a chunk of
+    /// implementation twice, but when we don't need to track the state ID, we
+    /// can allow the prefilter to report matches immediately without having
+    /// to re-confirm them with the automaton. The re-confirmation step is
+    /// necessary in leftmost_find_at because tracing through the automaton is
+    /// the only way to correctly set the state ID. (Perhaps an alternative
+    /// would be to keep a map from pattern ID to matching state ID, but that
+    /// complicates the code and still doesn't permit us to defer to the
+    /// prefilter entirely when possible.)
+    ///
+    /// I did try a few things to avoid the code duplication here, but nothing
+    /// optimized as well as this approach. (In microbenchmarks, there was
+    /// about a 25% difference.)
+    #[inline(never)]
+    fn leftmost_find_at_no_state(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Option<Match> {
+        if let Some(pre) = self.prefilter() {
+            self.leftmost_find_at_no_state_imp(
+                prestate,
+                Some(pre),
+                haystack,
+                at,
+            )
+        } else {
+            self.leftmost_find_at_no_state_imp(prestate, None, haystack, at)
+        }
+    }
+
+    // It's important for this to always be inlined. Namely, its only caller
+    // is leftmost_find_at_no_state, and the inlining should remove the case
+    // analysis for prefilter scanning when there is no prefilter available.
+    #[inline(always)]
+    fn leftmost_find_at_no_state_imp(
+        &self,
+        prestate: &mut PrefilterState,
+        prefilter: Option<&dyn Prefilter>,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(self.match_kind().is_leftmost());
+        if self.anchored() && at > 0 {
+            return None;
+        }
+        // If our prefilter handles confirmation of matches 100% of the
+        // time, and since we don't need to track state IDs, we can avoid
+        // Aho-Corasick completely.
+        if let Some(pre) = prefilter {
+            // We should never have a prefilter during an anchored search.
+            debug_assert!(!self.anchored());
+            if !pre.reports_false_positives() {
+                return match pre.next_candidate(prestate, haystack, at) {
+                    Candidate::None => None,
+                    Candidate::Match(m) => Some(m),
+                    Candidate::PossibleStartOfMatch(_) => unreachable!(),
+                };
+            }
+        }
+
+        let mut state_id = self.start_state();
+        let mut last_match = self.get_match(state_id, 0, at);
+        while at < haystack.len() {
+            if let Some(pre) = prefilter {
+                if prestate.is_effective(at) && state_id == self.start_state()
+                {
+                    match prefilter::next(prestate, pre, haystack, at) {
+                        Candidate::None => return None,
+                        // Since we aren't tracking a state ID, we can
+                        // quit early once we know we have a match.
+                        Candidate::Match(m) => return Some(m),
+                        Candidate::PossibleStartOfMatch(i) => {
+                            at = i;
+                        }
+                    }
+                }
+            }
+            // CORRECTNESS: next_state is correct for all possible u8 values,
+            // so the only thing we're concerned about is the validity of
+            // `state_id`. `state_id` either comes from the caller (in which
+            // case, we assume it is correct), or it comes from the return
+            // value of next_state, which is guaranteed to be correct.
+            state_id = self.next_state_no_fail(state_id, haystack[at]);
+            at += 1;
+            if self.is_match_or_dead_state(state_id) {
+                if state_id == dead_id() {
+                    // The only way to enter into a dead state is if a
+                    // match has been found, so we assert as much. This
+                    // is different from normal automata, where you might
+                    // enter a dead state if you know a subsequent match
+                    // will never be found (regardless of whether a match
+                    // has already been found). For Aho-Corasick, it is
+                    // built so that we can match at any position, so the
+                    // possibility of a match always exists.
+                    //
+                    // (Unless we have an anchored automaton, in which
+                    // case, dead states are used to stop a search.)
+                    debug_assert!(
+                        last_match.is_some() || self.anchored(),
+                        "failure state should only be seen after match"
+                    );
+                    return last_match;
+                }
+                last_match = self.get_match(state_id, 0, at);
+            }
+        }
+        last_match
+    }
+
+    /// Execute an overlapping search.
+    ///
+    /// When executing an overlapping match, the previous state ID in addition
+    /// to the previous match index should be given. If there are more matches
+    /// at the given state, then the match is reported and the given index is
+    /// incremented.
+    #[inline(always)]
+    fn overlapping_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut Self::ID,
+        match_index: &mut usize,
+    ) -> Option<Match> {
+        if self.anchored() && at > 0 && *state_id == self.start_state() {
+            return None;
+        }
+
+        let match_count = self.match_count(*state_id);
+        if *match_index < match_count {
+            // This is guaranteed to return a match since
+            // match_index < match_count.
+            let result = self.get_match(*state_id, *match_index, at);
+            debug_assert!(result.is_some(), "must be a match");
+            *match_index += 1;
+            return result;
+        }
+
+        *match_index = 0;
+        match self.standard_find_at(prestate, haystack, at, state_id) {
+            None => None,
+            Some(m) => {
+                *match_index = 1;
+                Some(m)
+            }
+        }
+    }
+
+    /// Return the earliest match found. This returns as soon as we know that
+    /// we have a match. As such, this does not necessarily correspond to the
+    /// leftmost starting match, but rather, the leftmost position at which a
+    /// match ends.
+    #[inline(always)]
+    fn earliest_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut Self::ID,
+    ) -> Option<Match> {
+        if *state_id == self.start_state() {
+            if self.anchored() && at > 0 {
+                return None;
+            }
+            if let Some(m) = self.get_match(*state_id, 0, at) {
+                return Some(m);
+            }
+        }
+        self.standard_find_at(prestate, haystack, at, state_id)
+    }
+
+    /// A convenience function for finding the next match according to the
+    /// match semantics of this automaton. For standard match semantics, this
+    /// finds the earliest match. Otherwise, the leftmost match is found.
+    #[inline(always)]
+    fn find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut Self::ID,
+    ) -> Option<Match> {
+        match *self.match_kind() {
+            MatchKind::Standard => {
+                self.earliest_find_at(prestate, haystack, at, state_id)
+            }
+            MatchKind::LeftmostFirst | MatchKind::LeftmostLongest => {
+                self.leftmost_find_at(prestate, haystack, at, state_id)
+            }
+            MatchKind::__Nonexhaustive => unreachable!(),
+        }
+    }
+
+    /// Like find_at, but does not track state identifiers. This permits some
+    /// optimizations when a prefilter that confirms its own matches is
+    /// present.
+    #[inline(always)]
+    fn find_at_no_state(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Option<Match> {
+        match *self.match_kind() {
+            MatchKind::Standard => {
+                let mut state = self.start_state();
+                self.earliest_find_at(prestate, haystack, at, &mut state)
+            }
+            MatchKind::LeftmostFirst | MatchKind::LeftmostLongest => {
+                self.leftmost_find_at_no_state(prestate, haystack, at)
+            }
+            MatchKind::__Nonexhaustive => unreachable!(),
+        }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/buffer.rs b/android/vendor/aho-corasick-0.7.18/src/buffer.rs
new file mode 100644
index 0000000..e7339eb
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/buffer.rs
@@ -0,0 +1,132 @@
+use std::cmp;
+use std::io;
+use std::ptr;
+
+/// The default buffer capacity that we use for the stream buffer.
+const DEFAULT_BUFFER_CAPACITY: usize = 8 * (1 << 10); // 8 KB
+
+/// A fairly simple roll buffer for supporting stream searches.
+///
+/// This buffer acts as a temporary place to store a fixed amount of data when
+/// reading from a stream. Its central purpose is to allow "rolling" some
+/// suffix of the data to the beginning of the buffer before refilling it with
+/// more data from the stream. For example, let's say we are trying to match
+/// "foobar" on a stream. When we report the match, we'd like to not only
+/// report the correct offsets at which the match occurs, but also the matching
+/// bytes themselves. So let's say our stream is a file with the following
+/// contents: `test test foobar test test`. Now assume that we happen to read
+/// the aforementioned file in two chunks: `test test foo` and `bar test test`.
+/// Naively, it would not be possible to report a single contiguous `foobar`
+/// match, but this roll buffer allows us to do that. Namely, after the second
+/// read, the contents of the buffer should be `st foobar test test`, where the
+/// search should ultimately resume immediately after `foo`. (The prefix `st `
+/// is included because the roll buffer saves N bytes at the end of the buffer,
+/// where N is the maximum possible length of a match.)
+///
+/// A lot of the logic for dealing with this is unfortunately split out between
+/// this roll buffer and the `StreamChunkIter`.
+#[derive(Debug)]
+pub struct Buffer {
+    /// The raw buffer contents. This has a fixed size and never increases.
+    buf: Vec<u8>,
+    /// The minimum size of the buffer, which is equivalent to the maximum
+    /// possible length of a match. This corresponds to the amount that we
+    /// roll
+    min: usize,
+    /// The end of the contents of this buffer.
+    end: usize,
+}
+
+impl Buffer {
+    /// Create a new buffer for stream searching. The minimum buffer length
+    /// given should be the size of the maximum possible match length.
+    pub fn new(min_buffer_len: usize) -> Buffer {
+        let min = cmp::max(1, min_buffer_len);
+        // The minimum buffer amount is also the amount that we roll our
+        // buffer in order to support incremental searching. To this end,
+        // our actual capacity needs to be at least 1 byte bigger than our
+        // minimum amount, otherwise we won't have any overlap. In actuality,
+        // we want our buffer to be a bit bigger than that for performance
+        // reasons, so we set a lower bound of `8 * min`.
+        //
+        // TODO: It would be good to find a way to test the streaming
+        // implementation with the minimal buffer size. For now, we just
+        // uncomment out the next line and comment out the subsequent line.
+        // let capacity = 1 + min;
+        let capacity = cmp::max(min * 8, DEFAULT_BUFFER_CAPACITY);
+        Buffer { buf: vec![0; capacity], min, end: 0 }
+    }
+
+    /// Return the contents of this buffer.
+    #[inline]
+    pub fn buffer(&self) -> &[u8] {
+        &self.buf[..self.end]
+    }
+
+    /// Return the minimum size of the buffer. The only way a buffer may be
+    /// smaller than this is if the stream itself contains less than the
+    /// minimum buffer amount.
+    #[inline]
+    pub fn min_buffer_len(&self) -> usize {
+        self.min
+    }
+
+    /// Return the total length of the contents in the buffer.
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.end
+    }
+
+    /// Return all free capacity in this buffer.
+    fn free_buffer(&mut self) -> &mut [u8] {
+        &mut self.buf[self.end..]
+    }
+
+    /// Refill the contents of this buffer by reading as much as possible into
+    /// this buffer's free capacity. If no more bytes could be read, then this
+    /// returns false. Otherwise, this reads until it has filled the buffer
+    /// past the minimum amount.
+    pub fn fill<R: io::Read>(&mut self, mut rdr: R) -> io::Result<bool> {
+        let mut readany = false;
+        loop {
+            let readlen = rdr.read(self.free_buffer())?;
+            if readlen == 0 {
+                return Ok(readany);
+            }
+            readany = true;
+            self.end += readlen;
+            if self.len() >= self.min {
+                return Ok(true);
+            }
+        }
+    }
+
+    /// Roll the contents of the buffer so that the suffix of this buffer is
+    /// moved to the front and all other contents are dropped. The size of the
+    /// suffix corresponds precisely to the minimum buffer length.
+    ///
+    /// This should only be called when the entire contents of this buffer have
+    /// been searched.
+    pub fn roll(&mut self) {
+        let roll_start = self
+            .end
+            .checked_sub(self.min)
+            .expect("buffer capacity should be bigger than minimum amount");
+        let roll_len = self.min;
+
+        assert!(roll_start + roll_len <= self.end);
+        unsafe {
+            // SAFETY: A buffer contains Copy data, so there's no problem
+            // moving it around. Safety also depends on our indices being in
+            // bounds, which they always should be, given the assert above.
+            //
+            // TODO: Switch to [T]::copy_within once our MSRV is high enough.
+            ptr::copy(
+                self.buf[roll_start..].as_ptr(),
+                self.buf.as_mut_ptr(),
+                roll_len,
+            );
+        }
+        self.end = roll_len;
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/byte_frequencies.rs b/android/vendor/aho-corasick-0.7.18/src/byte_frequencies.rs
new file mode 100644
index 0000000..c313b62
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/byte_frequencies.rs
@@ -0,0 +1,258 @@
+pub const BYTE_FREQUENCIES: [u8; 256] = [
+    55,  // '\x00'
+    52,  // '\x01'
+    51,  // '\x02'
+    50,  // '\x03'
+    49,  // '\x04'
+    48,  // '\x05'
+    47,  // '\x06'
+    46,  // '\x07'
+    45,  // '\x08'
+    103, // '\t'
+    242, // '\n'
+    66,  // '\x0b'
+    67,  // '\x0c'
+    229, // '\r'
+    44,  // '\x0e'
+    43,  // '\x0f'
+    42,  // '\x10'
+    41,  // '\x11'
+    40,  // '\x12'
+    39,  // '\x13'
+    38,  // '\x14'
+    37,  // '\x15'
+    36,  // '\x16'
+    35,  // '\x17'
+    34,  // '\x18'
+    33,  // '\x19'
+    56,  // '\x1a'
+    32,  // '\x1b'
+    31,  // '\x1c'
+    30,  // '\x1d'
+    29,  // '\x1e'
+    28,  // '\x1f'
+    255, // ' '
+    148, // '!'
+    164, // '"'
+    149, // '#'
+    136, // '$'
+    160, // '%'
+    155, // '&'
+    173, // "'"
+    221, // '('
+    222, // ')'
+    134, // '*'
+    122, // '+'
+    232, // ','
+    202, // '-'
+    215, // '.'
+    224, // '/'
+    208, // '0'
+    220, // '1'
+    204, // '2'
+    187, // '3'
+    183, // '4'
+    179, // '5'
+    177, // '6'
+    168, // '7'
+    178, // '8'
+    200, // '9'
+    226, // ':'
+    195, // ';'
+    154, // '<'
+    184, // '='
+    174, // '>'
+    126, // '?'
+    120, // '@'
+    191, // 'A'
+    157, // 'B'
+    194, // 'C'
+    170, // 'D'
+    189, // 'E'
+    162, // 'F'
+    161, // 'G'
+    150, // 'H'
+    193, // 'I'
+    142, // 'J'
+    137, // 'K'
+    171, // 'L'
+    176, // 'M'
+    185, // 'N'
+    167, // 'O'
+    186, // 'P'
+    112, // 'Q'
+    175, // 'R'
+    192, // 'S'
+    188, // 'T'
+    156, // 'U'
+    140, // 'V'
+    143, // 'W'
+    123, // 'X'
+    133, // 'Y'
+    128, // 'Z'
+    147, // '['
+    138, // '\\'
+    146, // ']'
+    114, // '^'
+    223, // '_'
+    151, // '`'
+    249, // 'a'
+    216, // 'b'
+    238, // 'c'
+    236, // 'd'
+    253, // 'e'
+    227, // 'f'
+    218, // 'g'
+    230, // 'h'
+    247, // 'i'
+    135, // 'j'
+    180, // 'k'
+    241, // 'l'
+    233, // 'm'
+    246, // 'n'
+    244, // 'o'
+    231, // 'p'
+    139, // 'q'
+    245, // 'r'
+    243, // 's'
+    251, // 't'
+    235, // 'u'
+    201, // 'v'
+    196, // 'w'
+    240, // 'x'
+    214, // 'y'
+    152, // 'z'
+    182, // '{'
+    205, // '|'
+    181, // '}'
+    127, // '~'
+    27,  // '\x7f'
+    212, // '\x80'
+    211, // '\x81'
+    210, // '\x82'
+    213, // '\x83'
+    228, // '\x84'
+    197, // '\x85'
+    169, // '\x86'
+    159, // '\x87'
+    131, // '\x88'
+    172, // '\x89'
+    105, // '\x8a'
+    80,  // '\x8b'
+    98,  // '\x8c'
+    96,  // '\x8d'
+    97,  // '\x8e'
+    81,  // '\x8f'
+    207, // '\x90'
+    145, // '\x91'
+    116, // '\x92'
+    115, // '\x93'
+    144, // '\x94'
+    130, // '\x95'
+    153, // '\x96'
+    121, // '\x97'
+    107, // '\x98'
+    132, // '\x99'
+    109, // '\x9a'
+    110, // '\x9b'
+    124, // '\x9c'
+    111, // '\x9d'
+    82,  // '\x9e'
+    108, // '\x9f'
+    118, // '\xa0'
+    141, // '¡'
+    113, // '¢'
+    129, // '£'
+    119, // '¤'
+    125, // '¥'
+    165, // '¦'
+    117, // '§'
+    92,  // '¨'
+    106, // '©'
+    83,  // 'ª'
+    72,  // '«'
+    99,  // '¬'
+    93,  // '\xad'
+    65,  // '®'
+    79,  // '¯'
+    166, // '°'
+    237, // '±'
+    163, // '²'
+    199, // '³'
+    190, // '´'
+    225, // 'µ'
+    209, // '¶'
+    203, // '·'
+    198, // '¸'
+    217, // '¹'
+    219, // 'º'
+    206, // '»'
+    234, // '¼'
+    248, // '½'
+    158, // '¾'
+    239, // '¿'
+    255, // 'À'
+    255, // 'Á'
+    255, // 'Â'
+    255, // 'Ã'
+    255, // 'Ä'
+    255, // 'Å'
+    255, // 'Æ'
+    255, // 'Ç'
+    255, // 'È'
+    255, // 'É'
+    255, // 'Ê'
+    255, // 'Ë'
+    255, // 'Ì'
+    255, // 'Í'
+    255, // 'Î'
+    255, // 'Ï'
+    255, // 'Ð'
+    255, // 'Ñ'
+    255, // 'Ò'
+    255, // 'Ó'
+    255, // 'Ô'
+    255, // 'Õ'
+    255, // 'Ö'
+    255, // '×'
+    255, // 'Ø'
+    255, // 'Ù'
+    255, // 'Ú'
+    255, // 'Û'
+    255, // 'Ü'
+    255, // 'Ý'
+    255, // 'Þ'
+    255, // 'ß'
+    255, // 'à'
+    255, // 'á'
+    255, // 'â'
+    255, // 'ã'
+    255, // 'ä'
+    255, // 'å'
+    255, // 'æ'
+    255, // 'ç'
+    255, // 'è'
+    255, // 'é'
+    255, // 'ê'
+    255, // 'ë'
+    255, // 'ì'
+    255, // 'í'
+    255, // 'î'
+    255, // 'ï'
+    255, // 'ð'
+    255, // 'ñ'
+    255, // 'ò'
+    255, // 'ó'
+    255, // 'ô'
+    255, // 'õ'
+    255, // 'ö'
+    255, // '÷'
+    255, // 'ø'
+    255, // 'ù'
+    255, // 'ú'
+    255, // 'û'
+    255, // 'ü'
+    255, // 'ý'
+    255, // 'þ'
+    255, // 'ÿ'
+];
diff --git a/android/vendor/aho-corasick-0.7.18/src/classes.rs b/android/vendor/aho-corasick-0.7.18/src/classes.rs
new file mode 100644
index 0000000..f84ae21
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/classes.rs
@@ -0,0 +1,238 @@
+use std::fmt;
+
+/// A representation of byte oriented equivalence classes.
+///
+/// This is used in an FSM to reduce the size of the transition table. This can
+/// have a particularly large impact not only on the total size of an FSM, but
+/// also on compile times.
+#[derive(Clone, Copy)]
+pub struct ByteClasses([u8; 256]);
+
+impl ByteClasses {
+    /// Creates a new set of equivalence classes where all bytes are mapped to
+    /// the same class.
+    pub fn empty() -> ByteClasses {
+        ByteClasses([0; 256])
+    }
+
+    /// Creates a new set of equivalence classes where each byte belongs to
+    /// its own equivalence class.
+    pub fn singletons() -> ByteClasses {
+        let mut classes = ByteClasses::empty();
+        for i in 0..256 {
+            classes.set(i as u8, i as u8);
+        }
+        classes
+    }
+
+    /// Set the equivalence class for the given byte.
+    #[inline]
+    pub fn set(&mut self, byte: u8, class: u8) {
+        self.0[byte as usize] = class;
+    }
+
+    /// Get the equivalence class for the given byte.
+    #[inline]
+    pub fn get(&self, byte: u8) -> u8 {
+        // SAFETY: This is safe because all dense transitions have
+        // exactly 256 elements, so all u8 values are valid indices.
+        self.0[byte as usize]
+    }
+
+    /// Return the total number of elements in the alphabet represented by
+    /// these equivalence classes. Equivalently, this returns the total number
+    /// of equivalence classes.
+    #[inline]
+    pub fn alphabet_len(&self) -> usize {
+        self.0[255] as usize + 1
+    }
+
+    /// Returns true if and only if every byte in this class maps to its own
+    /// equivalence class. Equivalently, there are 256 equivalence classes
+    /// and each class contains exactly one byte.
+    #[inline]
+    pub fn is_singleton(&self) -> bool {
+        self.alphabet_len() == 256
+    }
+
+    /// Returns an iterator over a sequence of representative bytes from each
+    /// equivalence class. Namely, this yields exactly N items, where N is
+    /// equivalent to the number of equivalence classes. Each item is an
+    /// arbitrary byte drawn from each equivalence class.
+    ///
+    /// This is useful when one is determinizing an NFA and the NFA's alphabet
+    /// hasn't been converted to equivalence classes yet. Picking an arbitrary
+    /// byte from each equivalence class then permits a full exploration of
+    /// the NFA instead of using every possible byte value.
+    pub fn representatives(&self) -> ByteClassRepresentatives<'_> {
+        ByteClassRepresentatives { classes: self, byte: 0, last_class: None }
+    }
+
+    /// Returns all of the bytes in the given equivalence class.
+    ///
+    /// The second element in the tuple indicates the number of elements in
+    /// the array.
+    fn elements(&self, equiv: u8) -> ([u8; 256], usize) {
+        let (mut array, mut len) = ([0; 256], 0);
+        for b in 0..256 {
+            if self.get(b as u8) == equiv {
+                array[len] = b as u8;
+                len += 1;
+            }
+        }
+        (array, len)
+    }
+}
+
+impl fmt::Debug for ByteClasses {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        if self.is_singleton() {
+            write!(f, "ByteClasses({{singletons}})")
+        } else {
+            write!(f, "ByteClasses(")?;
+            for equiv in 0..self.alphabet_len() {
+                let (members, len) = self.elements(equiv as u8);
+                write!(f, " {} => {:?}", equiv, &members[..len])?;
+            }
+            write!(f, ")")
+        }
+    }
+}
+
+/// An iterator over representative bytes from each equivalence class.
+#[derive(Debug)]
+pub struct ByteClassRepresentatives<'a> {
+    classes: &'a ByteClasses,
+    byte: usize,
+    last_class: Option<u8>,
+}
+
+impl<'a> Iterator for ByteClassRepresentatives<'a> {
+    type Item = u8;
+
+    fn next(&mut self) -> Option<u8> {
+        while self.byte < 256 {
+            let byte = self.byte as u8;
+            let class = self.classes.get(byte);
+            self.byte += 1;
+
+            if self.last_class != Some(class) {
+                self.last_class = Some(class);
+                return Some(byte);
+            }
+        }
+        None
+    }
+}
+
+/// A byte class builder keeps track of an *approximation* of equivalence
+/// classes of bytes during NFA construction. That is, every byte in an
+/// equivalence class cannot discriminate between a match and a non-match.
+///
+/// For example, in the literals `abc` and `xyz`, the bytes [\x00-`], [d-w]
+/// and [{-\xFF] never discriminate between a match and a non-match, precisely
+/// because they never occur in the literals anywhere.
+///
+/// Note though that this does not necessarily compute the minimal set of
+/// equivalence classes. For example, in the literals above, the byte ranges
+/// [\x00-`], [d-w] and [{-\xFF] are all treated as distinct equivalence
+/// classes even though they could be treated a single class. The reason for
+/// this is implementation complexity. In the future, we should endeavor to
+/// compute the minimal equivalence classes since they can have a rather large
+/// impact on the size of the DFA.
+///
+/// The representation here is 256 booleans, all initially set to false. Each
+/// boolean maps to its corresponding byte based on position. A `true` value
+/// indicates the end of an equivalence class, where its corresponding byte
+/// and all of the bytes corresponding to all previous contiguous `false`
+/// values are in the same equivalence class.
+///
+/// This particular representation only permits contiguous ranges of bytes to
+/// be in the same equivalence class, which means that we can never discover
+/// the true minimal set of equivalence classes.
+#[derive(Debug)]
+pub struct ByteClassBuilder(Vec<bool>);
+
+impl ByteClassBuilder {
+    /// Create a new builder of byte classes where all bytes are part of the
+    /// same equivalence class.
+    pub fn new() -> ByteClassBuilder {
+        ByteClassBuilder(vec![false; 256])
+    }
+
+    /// Indicate the the range of byte given (inclusive) can discriminate a
+    /// match between it and all other bytes outside of the range.
+    pub fn set_range(&mut self, start: u8, end: u8) {
+        debug_assert!(start <= end);
+        if start > 0 {
+            self.0[start as usize - 1] = true;
+        }
+        self.0[end as usize] = true;
+    }
+
+    /// Build byte classes that map all byte values to their corresponding
+    /// equivalence class. The last mapping indicates the largest equivalence
+    /// class identifier (which is never bigger than 255).
+    pub fn build(&self) -> ByteClasses {
+        let mut classes = ByteClasses::empty();
+        let mut class = 0u8;
+        let mut i = 0;
+        loop {
+            classes.set(i as u8, class as u8);
+            if i >= 255 {
+                break;
+            }
+            if self.0[i] {
+                class = class.checked_add(1).unwrap();
+            }
+            i += 1;
+        }
+        classes
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn byte_classes() {
+        let mut set = ByteClassBuilder::new();
+        set.set_range(b'a', b'z');
+
+        let classes = set.build();
+        assert_eq!(classes.get(0), 0);
+        assert_eq!(classes.get(1), 0);
+        assert_eq!(classes.get(2), 0);
+        assert_eq!(classes.get(b'a' - 1), 0);
+        assert_eq!(classes.get(b'a'), 1);
+        assert_eq!(classes.get(b'm'), 1);
+        assert_eq!(classes.get(b'z'), 1);
+        assert_eq!(classes.get(b'z' + 1), 2);
+        assert_eq!(classes.get(254), 2);
+        assert_eq!(classes.get(255), 2);
+
+        let mut set = ByteClassBuilder::new();
+        set.set_range(0, 2);
+        set.set_range(4, 6);
+        let classes = set.build();
+        assert_eq!(classes.get(0), 0);
+        assert_eq!(classes.get(1), 0);
+        assert_eq!(classes.get(2), 0);
+        assert_eq!(classes.get(3), 1);
+        assert_eq!(classes.get(4), 2);
+        assert_eq!(classes.get(5), 2);
+        assert_eq!(classes.get(6), 2);
+        assert_eq!(classes.get(7), 3);
+        assert_eq!(classes.get(255), 3);
+    }
+
+    #[test]
+    fn full_byte_classes() {
+        let mut set = ByteClassBuilder::new();
+        for i in 0..256u16 {
+            set.set_range(i as u8, i as u8);
+        }
+        assert_eq!(set.build().alphabet_len(), 256);
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/dfa.rs b/android/vendor/aho-corasick-0.7.18/src/dfa.rs
new file mode 100644
index 0000000..a03a254
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/dfa.rs
@@ -0,0 +1,713 @@
+use std::mem::size_of;
+
+use crate::ahocorasick::MatchKind;
+use crate::automaton::Automaton;
+use crate::classes::ByteClasses;
+use crate::error::Result;
+use crate::nfa::{PatternID, PatternLength, NFA};
+use crate::prefilter::{Prefilter, PrefilterObj, PrefilterState};
+use crate::state_id::{dead_id, fail_id, premultiply_overflow_error, StateID};
+use crate::Match;
+
+#[derive(Clone, Debug)]
+pub enum DFA<S> {
+    Standard(Standard<S>),
+    ByteClass(ByteClass<S>),
+    Premultiplied(Premultiplied<S>),
+    PremultipliedByteClass(PremultipliedByteClass<S>),
+}
+
+impl<S: StateID> DFA<S> {
+    fn repr(&self) -> &Repr<S> {
+        match *self {
+            DFA::Standard(ref dfa) => dfa.repr(),
+            DFA::ByteClass(ref dfa) => dfa.repr(),
+            DFA::Premultiplied(ref dfa) => dfa.repr(),
+            DFA::PremultipliedByteClass(ref dfa) => dfa.repr(),
+        }
+    }
+
+    pub fn match_kind(&self) -> &MatchKind {
+        &self.repr().match_kind
+    }
+
+    pub fn heap_bytes(&self) -> usize {
+        self.repr().heap_bytes
+    }
+
+    pub fn max_pattern_len(&self) -> usize {
+        self.repr().max_pattern_len
+    }
+
+    pub fn pattern_count(&self) -> usize {
+        self.repr().pattern_count
+    }
+
+    pub fn prefilter(&self) -> Option<&dyn Prefilter> {
+        self.repr().prefilter.as_ref().map(|p| p.as_ref())
+    }
+
+    pub fn start_state(&self) -> S {
+        self.repr().start_id
+    }
+
+    #[inline(always)]
+    pub fn overlapping_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut S,
+        match_index: &mut usize,
+    ) -> Option<Match> {
+        match *self {
+            DFA::Standard(ref dfa) => dfa.overlapping_find_at(
+                prestate,
+                haystack,
+                at,
+                state_id,
+                match_index,
+            ),
+            DFA::ByteClass(ref dfa) => dfa.overlapping_find_at(
+                prestate,
+                haystack,
+                at,
+                state_id,
+                match_index,
+            ),
+            DFA::Premultiplied(ref dfa) => dfa.overlapping_find_at(
+                prestate,
+                haystack,
+                at,
+                state_id,
+                match_index,
+            ),
+            DFA::PremultipliedByteClass(ref dfa) => dfa.overlapping_find_at(
+                prestate,
+                haystack,
+                at,
+                state_id,
+                match_index,
+            ),
+        }
+    }
+
+    #[inline(always)]
+    pub fn earliest_find_at(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+        state_id: &mut S,
+    ) -> Option<Match> {
+        match *self {
+            DFA::Standard(ref dfa) => {
+                dfa.earliest_find_at(prestate, haystack, at, state_id)
+            }
+            DFA::ByteClass(ref dfa) => {
+                dfa.earliest_find_at(prestate, haystack, at, state_id)
+            }
+            DFA::Premultiplied(ref dfa) => {
+                dfa.earliest_find_at(prestate, haystack, at, state_id)
+            }
+            DFA::PremultipliedByteClass(ref dfa) => {
+                dfa.earliest_find_at(prestate, haystack, at, state_id)
+            }
+        }
+    }
+
+    #[inline(always)]
+    pub fn find_at_no_state(
+        &self,
+        prestate: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Option<Match> {
+        match *self {
+            DFA::Standard(ref dfa) => {
+                dfa.find_at_no_state(prestate, haystack, at)
+            }
+            DFA::ByteClass(ref dfa) => {
+                dfa.find_at_no_state(prestate, haystack, at)
+            }
+            DFA::Premultiplied(ref dfa) => {
+                dfa.find_at_no_state(prestate, haystack, at)
+            }
+            DFA::PremultipliedByteClass(ref dfa) => {
+                dfa.find_at_no_state(prestate, haystack, at)
+            }
+        }
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct Standard<S>(Repr<S>);
+
+impl<S: StateID> Standard<S> {
+    fn repr(&self) -> &Repr<S> {
+        &self.0
+    }
+}
+
+impl<S: StateID> Automaton for Standard<S> {
+    type ID = S;
+
+    fn match_kind(&self) -> &MatchKind {
+        &self.repr().match_kind
+    }
+
+    fn anchored(&self) -> bool {
+        self.repr().anchored
+    }
+
+    fn prefilter(&self) -> Option<&dyn Prefilter> {
+        self.repr().prefilter.as_ref().map(|p| p.as_ref())
+    }
+
+    fn start_state(&self) -> S {
+        self.repr().start_id
+    }
+
+    fn is_valid(&self, id: S) -> bool {
+        id.to_usize() < self.repr().state_count
+    }
+
+    fn is_match_state(&self, id: S) -> bool {
+        self.repr().is_match_state(id)
+    }
+
+    fn is_match_or_dead_state(&self, id: S) -> bool {
+        self.repr().is_match_or_dead_state(id)
+    }
+
+    fn get_match(
+        &self,
+        id: S,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match> {
+        self.repr().get_match(id, match_index, end)
+    }
+
+    fn match_count(&self, id: S) -> usize {
+        self.repr().match_count(id)
+    }
+
+    fn next_state(&self, current: S, input: u8) -> S {
+        let o = current.to_usize() * 256 + input as usize;
+        self.repr().trans[o]
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct ByteClass<S>(Repr<S>);
+
+impl<S: StateID> ByteClass<S> {
+    fn repr(&self) -> &Repr<S> {
+        &self.0
+    }
+}
+
+impl<S: StateID> Automaton for ByteClass<S> {
+    type ID = S;
+
+    fn match_kind(&self) -> &MatchKind {
+        &self.repr().match_kind
+    }
+
+    fn anchored(&self) -> bool {
+        self.repr().anchored
+    }
+
+    fn prefilter(&self) -> Option<&dyn Prefilter> {
+        self.repr().prefilter.as_ref().map(|p| p.as_ref())
+    }
+
+    fn start_state(&self) -> S {
+        self.repr().start_id
+    }
+
+    fn is_valid(&self, id: S) -> bool {
+        id.to_usize() < self.repr().state_count
+    }
+
+    fn is_match_state(&self, id: S) -> bool {
+        self.repr().is_match_state(id)
+    }
+
+    fn is_match_or_dead_state(&self, id: S) -> bool {
+        self.repr().is_match_or_dead_state(id)
+    }
+
+    fn get_match(
+        &self,
+        id: S,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match> {
+        self.repr().get_match(id, match_index, end)
+    }
+
+    fn match_count(&self, id: S) -> usize {
+        self.repr().match_count(id)
+    }
+
+    fn next_state(&self, current: S, input: u8) -> S {
+        let alphabet_len = self.repr().byte_classes.alphabet_len();
+        let input = self.repr().byte_classes.get(input);
+        let o = current.to_usize() * alphabet_len + input as usize;
+        self.repr().trans[o]
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct Premultiplied<S>(Repr<S>);
+
+impl<S: StateID> Premultiplied<S> {
+    fn repr(&self) -> &Repr<S> {
+        &self.0
+    }
+}
+
+impl<S: StateID> Automaton for Premultiplied<S> {
+    type ID = S;
+
+    fn match_kind(&self) -> &MatchKind {
+        &self.repr().match_kind
+    }
+
+    fn anchored(&self) -> bool {
+        self.repr().anchored
+    }
+
+    fn prefilter(&self) -> Option<&dyn Prefilter> {
+        self.repr().prefilter.as_ref().map(|p| p.as_ref())
+    }
+
+    fn start_state(&self) -> S {
+        self.repr().start_id
+    }
+
+    fn is_valid(&self, id: S) -> bool {
+        (id.to_usize() / 256) < self.repr().state_count
+    }
+
+    fn is_match_state(&self, id: S) -> bool {
+        self.repr().is_match_state(id)
+    }
+
+    fn is_match_or_dead_state(&self, id: S) -> bool {
+        self.repr().is_match_or_dead_state(id)
+    }
+
+    fn get_match(
+        &self,
+        id: S,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match> {
+        if id > self.repr().max_match {
+            return None;
+        }
+        self.repr()
+            .matches
+            .get(id.to_usize() / 256)
+            .and_then(|m| m.get(match_index))
+            .map(|&(id, len)| Match { pattern: id, len, end })
+    }
+
+    fn match_count(&self, id: S) -> usize {
+        let o = id.to_usize() / 256;
+        self.repr().matches[o].len()
+    }
+
+    fn next_state(&self, current: S, input: u8) -> S {
+        let o = current.to_usize() + input as usize;
+        self.repr().trans[o]
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct PremultipliedByteClass<S>(Repr<S>);
+
+impl<S: StateID> PremultipliedByteClass<S> {
+    fn repr(&self) -> &Repr<S> {
+        &self.0
+    }
+}
+
+impl<S: StateID> Automaton for PremultipliedByteClass<S> {
+    type ID = S;
+
+    fn match_kind(&self) -> &MatchKind {
+        &self.repr().match_kind
+    }
+
+    fn anchored(&self) -> bool {
+        self.repr().anchored
+    }
+
+    fn prefilter(&self) -> Option<&dyn Prefilter> {
+        self.repr().prefilter.as_ref().map(|p| p.as_ref())
+    }
+
+    fn start_state(&self) -> S {
+        self.repr().start_id
+    }
+
+    fn is_valid(&self, id: S) -> bool {
+        (id.to_usize() / self.repr().alphabet_len()) < self.repr().state_count
+    }
+
+    fn is_match_state(&self, id: S) -> bool {
+        self.repr().is_match_state(id)
+    }
+
+    fn is_match_or_dead_state(&self, id: S) -> bool {
+        self.repr().is_match_or_dead_state(id)
+    }
+
+    fn get_match(
+        &self,
+        id: S,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match> {
+        if id > self.repr().max_match {
+            return None;
+        }
+        self.repr()
+            .matches
+            .get(id.to_usize() / self.repr().alphabet_len())
+            .and_then(|m| m.get(match_index))
+            .map(|&(id, len)| Match { pattern: id, len, end })
+    }
+
+    fn match_count(&self, id: S) -> usize {
+        let o = id.to_usize() / self.repr().alphabet_len();
+        self.repr().matches[o].len()
+    }
+
+    fn next_state(&self, current: S, input: u8) -> S {
+        let input = self.repr().byte_classes.get(input);
+        let o = current.to_usize() + input as usize;
+        self.repr().trans[o]
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct Repr<S> {
+    match_kind: MatchKind,
+    anchored: bool,
+    premultiplied: bool,
+    start_id: S,
+    /// The length, in bytes, of the longest pattern in this automaton. This
+    /// information is useful for keeping correct buffer sizes when searching
+    /// on streams.
+    max_pattern_len: usize,
+    /// The total number of patterns added to this automaton. This includes
+    /// patterns that may never match.
+    pattern_count: usize,
+    state_count: usize,
+    max_match: S,
+    /// The number of bytes of heap used by this NFA's transition table.
+    heap_bytes: usize,
+    /// A prefilter for quickly detecting candidate matchs, if pertinent.
+    prefilter: Option<PrefilterObj>,
+    byte_classes: ByteClasses,
+    trans: Vec<S>,
+    matches: Vec<Vec<(PatternID, PatternLength)>>,
+}
+
+impl<S: StateID> Repr<S> {
+    /// Returns the total alphabet size for this DFA.
+    ///
+    /// If byte classes are enabled, then this corresponds to the number of
+    /// equivalence classes. If they are disabled, then this is always 256.
+    fn alphabet_len(&self) -> usize {
+        self.byte_classes.alphabet_len()
+    }
+
+    /// Returns true only if the given state is a match state.
+    fn is_match_state(&self, id: S) -> bool {
+        id <= self.max_match && id > dead_id()
+    }
+
+    /// Returns true only if the given state is either a dead state or a match
+    /// state.
+    fn is_match_or_dead_state(&self, id: S) -> bool {
+        id <= self.max_match
+    }
+
+    /// Get the ith match for the given state, where the end position of a
+    /// match was found at `end`.
+    ///
+    /// # Panics
+    ///
+    /// The caller must ensure that the given state identifier is valid,
+    /// otherwise this may panic. The `match_index` need not be valid. That is,
+    /// if the given state has no matches then this returns `None`.
+    fn get_match(
+        &self,
+        id: S,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match> {
+        if id > self.max_match {
+            return None;
+        }
+        self.matches
+            .get(id.to_usize())
+            .and_then(|m| m.get(match_index))
+            .map(|&(id, len)| Match { pattern: id, len, end })
+    }
+
+    /// Return the total number of matches for the given state.
+    ///
+    /// # Panics
+    ///
+    /// The caller must ensure that the given identifier is valid, or else
+    /// this panics.
+    fn match_count(&self, id: S) -> usize {
+        self.matches[id.to_usize()].len()
+    }
+
+    /// Get the next state given `from` as the current state and `byte` as the
+    /// current input byte.
+    fn next_state(&self, from: S, byte: u8) -> S {
+        let alphabet_len = self.alphabet_len();
+        let byte = self.byte_classes.get(byte);
+        self.trans[from.to_usize() * alphabet_len + byte as usize]
+    }
+
+    /// Set the `byte` transition for the `from` state to point to `to`.
+    fn set_next_state(&mut self, from: S, byte: u8, to: S) {
+        let alphabet_len = self.alphabet_len();
+        let byte = self.byte_classes.get(byte);
+        self.trans[from.to_usize() * alphabet_len + byte as usize] = to;
+    }
+
+    /// Swap the given states in place.
+    fn swap_states(&mut self, id1: S, id2: S) {
+        assert!(!self.premultiplied, "can't swap states in premultiplied DFA");
+
+        let o1 = id1.to_usize() * self.alphabet_len();
+        let o2 = id2.to_usize() * self.alphabet_len();
+        for b in 0..self.alphabet_len() {
+            self.trans.swap(o1 + b, o2 + b);
+        }
+        self.matches.swap(id1.to_usize(), id2.to_usize());
+    }
+
+    /// This routine shuffles all match states in this DFA to the beginning
+    /// of the DFA such that every non-match state appears after every match
+    /// state. (With one exception: the special fail and dead states remain as
+    /// the first two states.)
+    ///
+    /// The purpose of doing this shuffling is to avoid an extra conditional
+    /// in the search loop, and in particular, detecting whether a state is a
+    /// match or not does not need to access any memory.
+    ///
+    /// This updates `self.max_match` to point to the last matching state as
+    /// well as `self.start` if the starting state was moved.
+    fn shuffle_match_states(&mut self) {
+        assert!(
+            !self.premultiplied,
+            "cannot shuffle match states of premultiplied DFA"
+        );
+
+        if self.state_count <= 1 {
+            return;
+        }
+
+        let mut first_non_match = self.start_id.to_usize();
+        while first_non_match < self.state_count
+            && self.matches[first_non_match].len() > 0
+        {
+            first_non_match += 1;
+        }
+
+        let mut swaps: Vec<S> = vec![fail_id(); self.state_count];
+        let mut cur = self.state_count - 1;
+        while cur > first_non_match {
+            if self.matches[cur].len() > 0 {
+                self.swap_states(
+                    S::from_usize(cur),
+                    S::from_usize(first_non_match),
+                );
+                swaps[cur] = S::from_usize(first_non_match);
+                swaps[first_non_match] = S::from_usize(cur);
+
+                first_non_match += 1;
+                while first_non_match < cur
+                    && self.matches[first_non_match].len() > 0
+                {
+                    first_non_match += 1;
+                }
+            }
+            cur -= 1;
+        }
+        for id in (0..self.state_count).map(S::from_usize) {
+            let alphabet_len = self.alphabet_len();
+            let offset = id.to_usize() * alphabet_len;
+            for next in &mut self.trans[offset..offset + alphabet_len] {
+                if swaps[next.to_usize()] != fail_id() {
+                    *next = swaps[next.to_usize()];
+                }
+            }
+        }
+        if swaps[self.start_id.to_usize()] != fail_id() {
+            self.start_id = swaps[self.start_id.to_usize()];
+        }
+        self.max_match = S::from_usize(first_non_match - 1);
+    }
+
+    fn premultiply(&mut self) -> Result<()> {
+        if self.premultiplied || self.state_count <= 1 {
+            return Ok(());
+        }
+
+        let alpha_len = self.alphabet_len();
+        premultiply_overflow_error(
+            S::from_usize(self.state_count - 1),
+            alpha_len,
+        )?;
+
+        for id in (2..self.state_count).map(S::from_usize) {
+            let offset = id.to_usize() * alpha_len;
+            for next in &mut self.trans[offset..offset + alpha_len] {
+                if *next == dead_id() {
+                    continue;
+                }
+                *next = S::from_usize(next.to_usize() * alpha_len);
+            }
+        }
+        self.premultiplied = true;
+        self.start_id = S::from_usize(self.start_id.to_usize() * alpha_len);
+        self.max_match = S::from_usize(self.max_match.to_usize() * alpha_len);
+        Ok(())
+    }
+
+    /// Computes the total amount of heap used by this NFA in bytes.
+    fn calculate_size(&mut self) {
+        let mut size = (self.trans.len() * size_of::<S>())
+            + (self.matches.len()
+                * size_of::<Vec<(PatternID, PatternLength)>>());
+        for state_matches in &self.matches {
+            size +=
+                state_matches.len() * size_of::<(PatternID, PatternLength)>();
+        }
+        size += self.prefilter.as_ref().map_or(0, |p| p.as_ref().heap_bytes());
+        self.heap_bytes = size;
+    }
+}
+
+/// A builder for configuring the determinization of an NFA into a DFA.
+#[derive(Clone, Debug)]
+pub struct Builder {
+    premultiply: bool,
+    byte_classes: bool,
+}
+
+impl Builder {
+    /// Create a new builder for a DFA.
+    pub fn new() -> Builder {
+        Builder { premultiply: true, byte_classes: true }
+    }
+
+    /// Build a DFA from the given NFA.
+    ///
+    /// This returns an error if the state identifiers exceed their
+    /// representation size. This can only happen when state ids are
+    /// premultiplied (which is enabled by default).
+    pub fn build<S: StateID>(&self, nfa: &NFA<S>) -> Result<DFA<S>> {
+        let byte_classes = if self.byte_classes {
+            nfa.byte_classes().clone()
+        } else {
+            ByteClasses::singletons()
+        };
+        let alphabet_len = byte_classes.alphabet_len();
+        let trans = vec![fail_id(); alphabet_len * nfa.state_len()];
+        let matches = vec![vec![]; nfa.state_len()];
+        let mut repr = Repr {
+            match_kind: nfa.match_kind().clone(),
+            anchored: nfa.anchored(),
+            premultiplied: false,
+            start_id: nfa.start_state(),
+            max_pattern_len: nfa.max_pattern_len(),
+            pattern_count: nfa.pattern_count(),
+            state_count: nfa.state_len(),
+            max_match: fail_id(),
+            heap_bytes: 0,
+            prefilter: nfa.prefilter_obj().map(|p| p.clone()),
+            byte_classes: byte_classes.clone(),
+            trans,
+            matches,
+        };
+        for id in (0..nfa.state_len()).map(S::from_usize) {
+            repr.matches[id.to_usize()].extend_from_slice(nfa.matches(id));
+
+            let fail = nfa.failure_transition(id);
+            nfa.iter_all_transitions(&byte_classes, id, |b, mut next| {
+                if next == fail_id() {
+                    next = nfa_next_state_memoized(nfa, &repr, id, fail, b);
+                }
+                repr.set_next_state(id, b, next);
+            });
+        }
+        repr.shuffle_match_states();
+        repr.calculate_size();
+        if self.premultiply {
+            repr.premultiply()?;
+            if byte_classes.is_singleton() {
+                Ok(DFA::Premultiplied(Premultiplied(repr)))
+            } else {
+                Ok(DFA::PremultipliedByteClass(PremultipliedByteClass(repr)))
+            }
+        } else {
+            if byte_classes.is_singleton() {
+                Ok(DFA::Standard(Standard(repr)))
+            } else {
+                Ok(DFA::ByteClass(ByteClass(repr)))
+            }
+        }
+    }
+
+    /// Whether to use byte classes or in the DFA.
+    pub fn byte_classes(&mut self, yes: bool) -> &mut Builder {
+        self.byte_classes = yes;
+        self
+    }
+
+    /// Whether to premultiply state identifier in the DFA.
+    pub fn premultiply(&mut self, yes: bool) -> &mut Builder {
+        self.premultiply = yes;
+        self
+    }
+}
+
+/// This returns the next NFA transition (including resolving failure
+/// transitions), except once it sees a state id less than the id of the DFA
+/// state that is currently being populated, then we no longer need to follow
+/// failure transitions and can instead query the pre-computed state id from
+/// the DFA itself.
+///
+/// In general, this should only be called when a failure transition is seen.
+fn nfa_next_state_memoized<S: StateID>(
+    nfa: &NFA<S>,
+    dfa: &Repr<S>,
+    populating: S,
+    mut current: S,
+    input: u8,
+) -> S {
+    loop {
+        if current < populating {
+            return dfa.next_state(current, input);
+        }
+        let next = nfa.next_state(current, input);
+        if next != fail_id() {
+            return next;
+        }
+        current = nfa.failure_transition(current);
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/error.rs b/android/vendor/aho-corasick-0.7.18/src/error.rs
new file mode 100644
index 0000000..a57a777
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/error.rs
@@ -0,0 +1,101 @@
+use std::error;
+use std::fmt;
+use std::result;
+
+pub type Result<T> = result::Result<T, Error>;
+
+/// An error that occurred during the construction of an Aho-Corasick
+/// automaton.
+#[derive(Clone, Debug)]
+pub struct Error {
+    kind: ErrorKind,
+}
+
+/// The kind of error that occurred.
+#[derive(Clone, Debug)]
+pub enum ErrorKind {
+    /// An error that occurs when constructing an automaton would require the
+    /// use of a state ID that overflows the chosen state ID representation.
+    /// For example, if one is using `u8` for state IDs and builds a DFA with
+    /// 257 states, then the last state's ID will be `256` which cannot be
+    /// represented with `u8`.
+    StateIDOverflow {
+        /// The maximum possible state ID.
+        max: usize,
+    },
+    /// An error that occurs when premultiplication of state IDs is requested
+    /// when constructing an Aho-Corasick DFA, but doing so would overflow the
+    /// chosen state ID representation.
+    ///
+    /// When `max == requested_max`, then the state ID would overflow `usize`.
+    PremultiplyOverflow {
+        /// The maximum possible state id.
+        max: usize,
+        /// The maximum ID required by premultiplication.
+        requested_max: usize,
+    },
+}
+
+impl Error {
+    /// Return the kind of this error.
+    pub fn kind(&self) -> &ErrorKind {
+        &self.kind
+    }
+
+    pub(crate) fn state_id_overflow(max: usize) -> Error {
+        Error { kind: ErrorKind::StateIDOverflow { max } }
+    }
+
+    pub(crate) fn premultiply_overflow(
+        max: usize,
+        requested_max: usize,
+    ) -> Error {
+        Error { kind: ErrorKind::PremultiplyOverflow { max, requested_max } }
+    }
+}
+
+impl error::Error for Error {
+    fn description(&self) -> &str {
+        match self.kind {
+            ErrorKind::StateIDOverflow { .. } => {
+                "state id representation too small"
+            }
+            ErrorKind::PremultiplyOverflow { .. } => {
+                "state id representation too small for premultiplication"
+            }
+        }
+    }
+}
+
+impl fmt::Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self.kind {
+            ErrorKind::StateIDOverflow { max } => write!(
+                f,
+                "building the automaton failed because it required \
+                 building more states that can be identified, where the \
+                 maximum ID for the chosen representation is {}",
+                max,
+            ),
+            ErrorKind::PremultiplyOverflow { max, requested_max } => {
+                if max == requested_max {
+                    write!(
+                        f,
+                        "premultiplication of states requires the ability to \
+                         represent a state ID greater than what can fit on \
+                         this platform's usize, which is {}",
+                        ::std::usize::MAX,
+                    )
+                } else {
+                    write!(
+                        f,
+                        "premultiplication of states requires the ability to \
+                         represent at least a state ID of {}, but the chosen \
+                         representation only permits a maximum state ID of {}",
+                        requested_max, max,
+                    )
+                }
+            }
+        }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/lib.rs b/android/vendor/aho-corasick-0.7.18/src/lib.rs
new file mode 100644
index 0000000..9a3d084
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/lib.rs
@@ -0,0 +1,297 @@
+/*!
+A library for finding occurrences of many patterns at once. This library
+provides multiple pattern search principally through an implementation of the
+[Aho-Corasick algorithm](https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm),
+which builds a fast finite state machine for executing searches in linear time.
+
+Additionally, this library provides a number of configuration options for
+building the automaton that permit controlling the space versus time trade
+off. Other features include simple ASCII case insensitive matching, finding
+overlapping matches, replacements, searching streams and even searching and
+replacing text in streams.
+
+Finally, unlike all other (known) Aho-Corasick implementations, this one
+supports enabling
+[leftmost-first](enum.MatchKind.html#variant.LeftmostFirst)
+or
+[leftmost-longest](enum.MatchKind.html#variant.LeftmostFirst)
+match semantics, using a (seemingly) novel alternative construction algorithm.
+For more details on what match semantics means, see the
+[`MatchKind`](enum.MatchKind.html)
+type.
+
+# Overview
+
+This section gives a brief overview of the primary types in this crate:
+
+* [`AhoCorasick`](struct.AhoCorasick.html) is the primary type and represents
+  an Aho-Corasick automaton. This is the type you use to execute searches.
+* [`AhoCorasickBuilder`](struct.AhoCorasickBuilder.html) can be used to build
+  an Aho-Corasick automaton, and supports configuring a number of options.
+* [`Match`](struct.Match.html) represents a single match reported by an
+  Aho-Corasick automaton. Each match has two pieces of information: the pattern
+  that matched and the start and end byte offsets corresponding to the position
+  in the haystack at which it matched.
+
+Additionally, the [`packed`](packed/index.html) sub-module contains a lower
+level API for using fast vectorized routines for finding a small number of
+patterns in a haystack.
+
+# Example: basic searching
+
+This example shows how to search for occurrences of multiple patterns
+simultaneously. Each match includes the pattern that matched along with the
+byte offsets of the match.
+
+```
+use aho_corasick::AhoCorasick;
+
+let patterns = &["apple", "maple", "Snapple"];
+let haystack = "Nobody likes maple in their apple flavored Snapple.";
+
+let ac = AhoCorasick::new(patterns);
+let mut matches = vec![];
+for mat in ac.find_iter(haystack) {
+    matches.push((mat.pattern(), mat.start(), mat.end()));
+}
+assert_eq!(matches, vec![
+    (1, 13, 18),
+    (0, 28, 33),
+    (2, 43, 50),
+]);
+```
+
+# Example: case insensitivity
+
+This is like the previous example, but matches `Snapple` case insensitively
+using `AhoCorasickBuilder`:
+
+```
+use aho_corasick::AhoCorasickBuilder;
+
+let patterns = &["apple", "maple", "snapple"];
+let haystack = "Nobody likes maple in their apple flavored Snapple.";
+
+let ac = AhoCorasickBuilder::new()
+    .ascii_case_insensitive(true)
+    .build(patterns);
+let mut matches = vec![];
+for mat in ac.find_iter(haystack) {
+    matches.push((mat.pattern(), mat.start(), mat.end()));
+}
+assert_eq!(matches, vec![
+    (1, 13, 18),
+    (0, 28, 33),
+    (2, 43, 50),
+]);
+```
+
+# Example: replacing matches in a stream
+
+This example shows how to execute a search and replace on a stream without
+loading the entire stream into memory first.
+
+```
+use aho_corasick::AhoCorasick;
+
+# fn example() -> Result<(), ::std::io::Error> {
+let patterns = &["fox", "brown", "quick"];
+let replace_with = &["sloth", "grey", "slow"];
+
+// In a real example, these might be `std::fs::File`s instead. All you need to
+// do is supply a pair of `std::io::Read` and `std::io::Write` implementations.
+let rdr = "The quick brown fox.";
+let mut wtr = vec![];
+
+let ac = AhoCorasick::new(patterns);
+ac.stream_replace_all(rdr.as_bytes(), &mut wtr, replace_with)?;
+assert_eq!(b"The slow grey sloth.".to_vec(), wtr);
+# Ok(()) }; example().unwrap()
+```
+
+# Example: finding the leftmost first match
+
+In the textbook description of Aho-Corasick, its formulation is typically
+structured such that it reports all possible matches, even when they overlap
+with another. In many cases, overlapping matches may not be desired, such as
+the case of finding all successive non-overlapping matches like you might with
+a standard regular expression.
+
+Unfortunately the "obvious" way to modify the Aho-Corasick algorithm to do
+this doesn't always work in the expected way, since it will report matches as
+soon as they are seen. For example, consider matching the regex `Samwise|Sam`
+against the text `Samwise`. Most regex engines (that are Perl-like, or
+non-POSIX) will report `Samwise` as a match, but the standard Aho-Corasick
+algorithm modified for reporting non-overlapping matches will report `Sam`.
+
+A novel contribution of this library is the ability to change the match
+semantics of Aho-Corasick (without additional search time overhead) such that
+`Samwise` is reported instead. For example, here's the standard approach:
+
+```
+use aho_corasick::AhoCorasick;
+
+let patterns = &["Samwise", "Sam"];
+let haystack = "Samwise";
+
+let ac = AhoCorasick::new(patterns);
+let mat = ac.find(haystack).expect("should have a match");
+assert_eq!("Sam", &haystack[mat.start()..mat.end()]);
+```
+
+And now here's the leftmost-first version, which matches how a Perl-like
+regex will work:
+
+```
+use aho_corasick::{AhoCorasickBuilder, MatchKind};
+
+let patterns = &["Samwise", "Sam"];
+let haystack = "Samwise";
+
+let ac = AhoCorasickBuilder::new()
+    .match_kind(MatchKind::LeftmostFirst)
+    .build(patterns);
+let mat = ac.find(haystack).expect("should have a match");
+assert_eq!("Samwise", &haystack[mat.start()..mat.end()]);
+```
+
+In addition to leftmost-first semantics, this library also supports
+leftmost-longest semantics, which match the POSIX behavior of a regular
+expression alternation. See
+[`MatchKind`](enum.MatchKind.html)
+for more details.
+
+# Prefilters
+
+While an Aho-Corasick automaton can perform admirably when compared to more
+naive solutions, it is generally slower than more specialized algorithms that
+are accelerated using vector instructions such as SIMD.
+
+For that reason, this library will internally use a "prefilter" to attempt
+to accelerate searches when possible. Currently, this library has several
+different algorithms it might use depending on the patterns provided. Once the
+number of patterns gets too big, prefilters are no longer used.
+
+While a prefilter is generally good to have on by default since it works
+well in the common case, it can lead to less predictable or even sub-optimal
+performance in some cases. For that reason, prefilters can be explicitly
+disabled via
+[`AhoCorasickBuilder::prefilter`](struct.AhoCorasickBuilder.html#method.prefilter).
+*/
+
+#![deny(missing_docs)]
+
+// We can never be truly no_std, but we could be alloc-only some day, so
+// require the std feature for now.
+#[cfg(not(feature = "std"))]
+compile_error!("`std` feature is currently required to build this crate");
+
+// #[cfg(doctest)]
+// #[macro_use]
+// extern crate doc_comment;
+
+// #[cfg(doctest)]
+// doctest!("../README.md");
+
+pub use crate::ahocorasick::{
+    AhoCorasick, AhoCorasickBuilder, FindIter, FindOverlappingIter, MatchKind,
+    StreamFindIter,
+};
+pub use crate::error::{Error, ErrorKind};
+pub use crate::state_id::StateID;
+
+mod ahocorasick;
+mod automaton;
+mod buffer;
+mod byte_frequencies;
+mod classes;
+mod dfa;
+mod error;
+mod nfa;
+pub mod packed;
+mod prefilter;
+mod state_id;
+#[cfg(test)]
+mod tests;
+
+/// A representation of a match reported by an Aho-Corasick automaton.
+///
+/// A match has two essential pieces of information: the identifier of the
+/// pattern that matched, along with the start and end offsets of the match
+/// in the haystack.
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```
+/// use aho_corasick::AhoCorasick;
+///
+/// let ac = AhoCorasick::new(&[
+///     "foo", "bar", "baz",
+/// ]);
+/// let mat = ac.find("xxx bar xxx").expect("should have a match");
+/// assert_eq!(1, mat.pattern());
+/// assert_eq!(4, mat.start());
+/// assert_eq!(7, mat.end());
+/// ```
+#[derive(Clone, Debug, Eq, Hash, PartialEq)]
+pub struct Match {
+    /// The pattern id.
+    pattern: usize,
+    /// The length of this match, such that the starting position of the match
+    /// is `end - len`.
+    ///
+    /// We use length here because, other than the pattern id, the only
+    /// information about each pattern that the automaton stores is its length.
+    /// So using the length here is just a bit more natural. But it isn't
+    /// technically required.
+    len: usize,
+    /// The end offset of the match, exclusive.
+    end: usize,
+}
+
+impl Match {
+    /// Returns the identifier of the pattern that matched.
+    ///
+    /// The identifier of a pattern is derived from the position in which it
+    /// was originally inserted into the corresponding automaton. The first
+    /// pattern has identifier `0`, and each subsequent pattern is `1`, `2`
+    /// and so on.
+    #[inline]
+    pub fn pattern(&self) -> usize {
+        self.pattern
+    }
+
+    /// The starting position of the match.
+    #[inline]
+    pub fn start(&self) -> usize {
+        self.end - self.len
+    }
+
+    /// The ending position of the match.
+    #[inline]
+    pub fn end(&self) -> usize {
+        self.end
+    }
+
+    /// Returns true if and only if this match is empty. That is, when
+    /// `start() == end()`.
+    ///
+    /// An empty match can only be returned when the empty string was among
+    /// the patterns used to build the Aho-Corasick automaton.
+    #[inline]
+    pub fn is_empty(&self) -> bool {
+        self.len == 0
+    }
+
+    #[inline]
+    fn increment(&self, by: usize) -> Match {
+        Match { pattern: self.pattern, len: self.len, end: self.end + by }
+    }
+
+    #[inline]
+    fn from_span(id: usize, start: usize, end: usize) -> Match {
+        Match { pattern: id, len: end - start, end }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/nfa.rs b/android/vendor/aho-corasick-0.7.18/src/nfa.rs
new file mode 100644
index 0000000..e29bb27
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/nfa.rs
@@ -0,0 +1,1377 @@
+use std::cmp;
+use std::collections::{BTreeSet, VecDeque};
+use std::fmt;
+use std::mem::size_of;
+use std::ops::{Index, IndexMut};
+
+use crate::ahocorasick::MatchKind;
+use crate::automaton::Automaton;
+use crate::classes::{ByteClassBuilder, ByteClasses};
+use crate::error::Result;
+use crate::prefilter::{self, opposite_ascii_case, Prefilter, PrefilterObj};
+use crate::state_id::{dead_id, fail_id, usize_to_state_id, StateID};
+use crate::Match;
+
+/// The identifier for a pattern, which is simply the position of the pattern
+/// in the sequence of patterns given by the caller.
+pub type PatternID = usize;
+
+/// The length of a pattern, in bytes.
+pub type PatternLength = usize;
+
+/// An Aho-Corasick automaton, represented as an NFA.
+///
+/// This is the classical formulation of Aho-Corasick, which involves building
+/// up a prefix trie of a given set of patterns, and then wiring up failure
+/// transitions between states in order to guarantee linear time matching. The
+/// standard formulation is, technically, an NFA because of these failure
+/// transitions. That is, one can see them as enabling the automaton to be in
+/// multiple states at once. Indeed, during search, it is possible to check
+/// the transitions on multiple states for a single input byte.
+///
+/// This particular implementation not only supports the standard style of
+/// matching, but also provides a mode for choosing leftmost-first or
+/// leftmost-longest match semantics. When a leftmost mode is chosen, some
+/// failure transitions that would otherwise be added are elided. See
+/// the documentation of `MatchKind` for more details and examples on how the
+/// match semantics may differ.
+///
+/// If one wants a DFA, then it is necessary to first build an NFA and convert
+/// it into a DFA. Note, however, that because we've constrained ourselves to
+/// matching literal patterns, this does not need to use subset construction
+/// for determinization. Instead, the DFA has at most a number of states
+/// equivalent to the number of NFA states. The only real difference between
+/// them is that all failure transitions are followed and pre-computed. This
+/// uses much more memory, but also executes searches more quickly.
+#[derive(Clone)]
+pub struct NFA<S> {
+    /// The match semantics built into this NFA.
+    match_kind: MatchKind,
+    /// The start state id as an index into `states`.
+    start_id: S,
+    /// The length, in bytes, of the longest pattern in this automaton. This
+    /// information is useful for keeping correct buffer sizes when searching
+    /// on streams.
+    max_pattern_len: usize,
+    /// The total number of patterns added to this automaton, including
+    /// patterns that may never be matched.
+    pattern_count: usize,
+    /// The number of bytes of heap used by this NFA's transition table.
+    heap_bytes: usize,
+    /// A prefilter for quickly skipping to candidate matches, if pertinent.
+    prefilter: Option<PrefilterObj>,
+    /// Whether this automaton anchors all matches to the start of input.
+    anchored: bool,
+    /// A set of equivalence classes in terms of bytes. We compute this while
+    /// building the NFA, but don't use it in the NFA's states. Instead, we
+    /// use this for building the DFA. We store it on the NFA since it's easy
+    /// to compute while visiting the the patterns.
+    byte_classes: ByteClasses,
+    /// A set of states. Each state defines its own transitions, a fail
+    /// transition and a set of indices corresponding to matches.
+    ///
+    /// The first state is always the fail state, which is used only as a
+    /// sentinel. Namely, in the final NFA, no transition into the fail state
+    /// exists. (Well, they do, but they aren't followed. Instead, the state's
+    /// failure transition is followed.)
+    ///
+    /// The second state (index 1) is always the dead state. Dead states are
+    /// in every automaton, but only used when leftmost-{first,longest} match
+    /// semantics are enabled. Specifically, they instruct search to stop
+    /// at specific points in order to report the correct match location. In
+    /// the standard Aho-Corasick construction, there are no transitions to
+    /// the dead state.
+    ///
+    /// The third state (index 2) is generally intended to be the starting or
+    /// "root" state.
+    states: Vec<State<S>>,
+}
+
+impl<S: StateID> NFA<S> {
+    /// Returns the equivalence classes of bytes found while constructing
+    /// this NFA.
+    ///
+    /// Note that the NFA doesn't actually make use of these equivalence
+    /// classes. Instead, these are useful for building the DFA when desired.
+    pub fn byte_classes(&self) -> &ByteClasses {
+        &self.byte_classes
+    }
+
+    /// Returns a prefilter, if one exists.
+    pub fn prefilter_obj(&self) -> Option<&PrefilterObj> {
+        self.prefilter.as_ref()
+    }
+
+    /// Returns the total number of heap bytes used by this NFA's transition
+    /// table.
+    pub fn heap_bytes(&self) -> usize {
+        self.heap_bytes
+            + self.prefilter.as_ref().map_or(0, |p| p.as_ref().heap_bytes())
+    }
+
+    /// Return the length of the longest pattern in this automaton.
+    pub fn max_pattern_len(&self) -> usize {
+        self.max_pattern_len
+    }
+
+    /// Return the total number of patterns added to this automaton.
+    pub fn pattern_count(&self) -> usize {
+        self.pattern_count
+    }
+
+    /// Returns the total number of states in this NFA.
+    pub fn state_len(&self) -> usize {
+        self.states.len()
+    }
+
+    /// Returns the matches for the given state.
+    pub fn matches(&self, id: S) -> &[(PatternID, PatternLength)] {
+        &self.states[id.to_usize()].matches
+    }
+
+    /// Returns an iterator over all transitions in the given state according
+    /// to the given equivalence classes, including transitions to `fail_id()`.
+    /// The number of transitions returned is always equivalent to the number
+    /// of equivalence classes.
+    pub fn iter_all_transitions<F: FnMut(u8, S)>(
+        &self,
+        byte_classes: &ByteClasses,
+        id: S,
+        f: F,
+    ) {
+        self.states[id.to_usize()].trans.iter_all(byte_classes, f);
+    }
+
+    /// Returns the failure transition for the given state.
+    pub fn failure_transition(&self, id: S) -> S {
+        self.states[id.to_usize()].fail
+    }
+
+    /// Returns the next state for the given state and input byte.
+    ///
+    /// Note that this does not follow failure transitions. As such, the id
+    /// returned may be `fail_id`.
+    pub fn next_state(&self, current: S, input: u8) -> S {
+        self.states[current.to_usize()].next_state(input)
+    }
+
+    fn state(&self, id: S) -> &State<S> {
+        &self.states[id.to_usize()]
+    }
+
+    fn state_mut(&mut self, id: S) -> &mut State<S> {
+        &mut self.states[id.to_usize()]
+    }
+
+    fn start(&self) -> &State<S> {
+        self.state(self.start_id)
+    }
+
+    fn start_mut(&mut self) -> &mut State<S> {
+        let id = self.start_id;
+        self.state_mut(id)
+    }
+
+    fn iter_transitions_mut(&mut self, id: S) -> IterTransitionsMut<'_, S> {
+        IterTransitionsMut::new(self, id)
+    }
+
+    fn copy_matches(&mut self, src: S, dst: S) {
+        let (src, dst) =
+            get_two_mut(&mut self.states, src.to_usize(), dst.to_usize());
+        dst.matches.extend_from_slice(&src.matches);
+    }
+
+    fn copy_empty_matches(&mut self, dst: S) {
+        let start_id = self.start_id;
+        self.copy_matches(start_id, dst);
+    }
+
+    fn add_dense_state(&mut self, depth: usize) -> Result<S> {
+        let trans = Transitions::Dense(Dense::new());
+        let id = usize_to_state_id(self.states.len())?;
+        self.states.push(State {
+            trans,
+            // Anchored automatons do not have any failure transitions.
+            fail: if self.anchored { dead_id() } else { self.start_id },
+            depth,
+            matches: vec![],
+        });
+        Ok(id)
+    }
+
+    fn add_sparse_state(&mut self, depth: usize) -> Result<S> {
+        let trans = Transitions::Sparse(vec![]);
+        let id = usize_to_state_id(self.states.len())?;
+        self.states.push(State {
+            trans,
+            // Anchored automatons do not have any failure transitions.
+            fail: if self.anchored { dead_id() } else { self.start_id },
+            depth,
+            matches: vec![],
+        });
+        Ok(id)
+    }
+}
+
+impl<S: StateID> Automaton for NFA<S> {
+    type ID = S;
+
+    fn match_kind(&self) -> &MatchKind {
+        &self.match_kind
+    }
+
+    fn anchored(&self) -> bool {
+        self.anchored
+    }
+
+    fn prefilter(&self) -> Option<&dyn Prefilter> {
+        self.prefilter.as_ref().map(|p| p.as_ref())
+    }
+
+    fn start_state(&self) -> S {
+        self.start_id
+    }
+
+    fn is_valid(&self, id: S) -> bool {
+        id.to_usize() < self.states.len()
+    }
+
+    fn is_match_state(&self, id: S) -> bool {
+        self.states[id.to_usize()].is_match()
+    }
+
+    fn get_match(
+        &self,
+        id: S,
+        match_index: usize,
+        end: usize,
+    ) -> Option<Match> {
+        let state = match self.states.get(id.to_usize()) {
+            None => return None,
+            Some(state) => state,
+        };
+        state.matches.get(match_index).map(|&(id, len)| Match {
+            pattern: id,
+            len,
+            end,
+        })
+    }
+
+    fn match_count(&self, id: S) -> usize {
+        self.states[id.to_usize()].matches.len()
+    }
+
+    fn next_state(&self, mut current: S, input: u8) -> S {
+        // This terminates since:
+        //
+        // 1. `State.fail` never points to fail_id().
+        // 2. All `State.fail` values point to a state closer to `start`.
+        // 3. The start state has no transitions to fail_id().
+        loop {
+            let state = &self.states[current.to_usize()];
+            let next = state.next_state(input);
+            if next != fail_id() {
+                return next;
+            }
+            current = state.fail;
+        }
+    }
+}
+
+/// A representation of an NFA state for an Aho-Corasick automaton.
+///
+/// It contains the transitions to the next state, a failure transition for
+/// cases where there exists no other transition for the current input byte,
+/// the matches implied by visiting this state (if any) and the depth of this
+/// state. The depth of a state is simply the distance from it to the start
+/// state in the automaton, where the depth of the start state is 0.
+#[derive(Clone, Debug)]
+pub struct State<S> {
+    trans: Transitions<S>,
+    fail: S,
+    matches: Vec<(PatternID, PatternLength)>,
+    // TODO: Strictly speaking, this isn't needed for searching. It's only
+    // used when building an NFA that supports leftmost match semantics. We
+    // could drop this from the state and dynamically build a map only when
+    // computing failure transitions, but it's not clear which is better.
+    // Benchmark this.
+    depth: usize,
+}
+
+impl<S: StateID> State<S> {
+    fn heap_bytes(&self) -> usize {
+        self.trans.heap_bytes()
+            + (self.matches.len() * size_of::<(PatternID, PatternLength)>())
+    }
+
+    fn add_match(&mut self, i: PatternID, len: PatternLength) {
+        self.matches.push((i, len));
+    }
+
+    fn is_match(&self) -> bool {
+        !self.matches.is_empty()
+    }
+
+    fn get_longest_match_len(&self) -> Option<usize> {
+        // Why is this true? Because the first match in any matching state
+        // will always correspond to the match added to it during trie
+        // construction (since when we copy matches due to failure transitions,
+        // we always append them). Therefore, it follows that the first match
+        // must always be longest since any subsequent match must be from a
+        // failure transition, and a failure transition by construction points
+        // to a proper suffix. A proper suffix is, by definition, smaller.
+        self.matches.get(0).map(|&(_, len)| len)
+    }
+
+    fn next_state(&self, input: u8) -> S {
+        self.trans.next_state(input)
+    }
+
+    fn set_next_state(&mut self, input: u8, next: S) {
+        self.trans.set_next_state(input, next);
+    }
+}
+
+/// Represents the transitions for a single dense state.
+///
+/// The primary purpose here is to encapsulate index access. Namely, since a
+/// dense representation always contains 256 elements, all values of `u8` are
+/// valid indices.
+#[derive(Clone, Debug)]
+struct Dense<S>(Vec<S>);
+
+impl<S> Dense<S>
+where
+    S: StateID,
+{
+    fn new() -> Self {
+        Dense(vec![fail_id(); 256])
+    }
+
+    #[inline]
+    fn len(&self) -> usize {
+        self.0.len()
+    }
+}
+
+impl<S> Index<u8> for Dense<S> {
+    type Output = S;
+
+    #[inline]
+    fn index(&self, i: u8) -> &S {
+        // SAFETY: This is safe because all dense transitions have
+        // exactly 256 elements, so all u8 values are valid indices.
+        &self.0[i as usize]
+    }
+}
+
+impl<S> IndexMut<u8> for Dense<S> {
+    #[inline]
+    fn index_mut(&mut self, i: u8) -> &mut S {
+        // SAFETY: This is safe because all dense transitions have
+        // exactly 256 elements, so all u8 values are valid indices.
+        &mut self.0[i as usize]
+    }
+}
+
+/// A representation of transitions in an NFA.
+///
+/// Transitions have either a sparse representation, which is slower for
+/// lookups but uses less memory, or a dense representation, which is faster
+/// for lookups but uses more memory. In the sparse representation, the absence
+/// of a state implies a transition to `fail_id()`. Transitions to `dead_id()`
+/// are still explicitly represented.
+///
+/// For the NFA, by default, we use a dense representation for transitions for
+/// states close to the start state because it's likely these are the states
+/// that will be most frequently visited.
+#[derive(Clone, Debug)]
+enum Transitions<S> {
+    Sparse(Vec<(u8, S)>),
+    Dense(Dense<S>),
+}
+
+impl<S: StateID> Transitions<S> {
+    fn heap_bytes(&self) -> usize {
+        match *self {
+            Transitions::Sparse(ref sparse) => {
+                sparse.len() * size_of::<(u8, S)>()
+            }
+            Transitions::Dense(ref dense) => dense.len() * size_of::<S>(),
+        }
+    }
+
+    fn next_state(&self, input: u8) -> S {
+        match *self {
+            Transitions::Sparse(ref sparse) => {
+                for &(b, id) in sparse {
+                    if b == input {
+                        return id;
+                    }
+                }
+                fail_id()
+            }
+            Transitions::Dense(ref dense) => dense[input],
+        }
+    }
+
+    fn set_next_state(&mut self, input: u8, next: S) {
+        match *self {
+            Transitions::Sparse(ref mut sparse) => {
+                match sparse.binary_search_by_key(&input, |&(b, _)| b) {
+                    Ok(i) => sparse[i] = (input, next),
+                    Err(i) => sparse.insert(i, (input, next)),
+                }
+            }
+            Transitions::Dense(ref mut dense) => {
+                dense[input] = next;
+            }
+        }
+    }
+
+    /// Iterate over transitions in this state while skipping over transitions
+    /// to `fail_id()`.
+    fn iter<F: FnMut(u8, S)>(&self, mut f: F) {
+        match *self {
+            Transitions::Sparse(ref sparse) => {
+                for &(b, id) in sparse {
+                    f(b, id);
+                }
+            }
+            Transitions::Dense(ref dense) => {
+                for b in AllBytesIter::new() {
+                    let id = dense[b];
+                    if id != fail_id() {
+                        f(b, id);
+                    }
+                }
+            }
+        }
+    }
+
+    /// Iterate over all transitions in this state according to the given
+    /// equivalence classes, including transitions to `fail_id()`.
+    fn iter_all<F: FnMut(u8, S)>(&self, classes: &ByteClasses, mut f: F) {
+        if classes.is_singleton() {
+            match *self {
+                Transitions::Sparse(ref sparse) => {
+                    sparse_iter(sparse, f);
+                }
+                Transitions::Dense(ref dense) => {
+                    for b in AllBytesIter::new() {
+                        f(b, dense[b]);
+                    }
+                }
+            }
+        } else {
+            // In this case, we only want to yield a single byte for each
+            // equivalence class.
+            match *self {
+                Transitions::Sparse(ref sparse) => {
+                    let mut last_class = None;
+                    sparse_iter(sparse, |b, next| {
+                        let class = classes.get(b);
+                        if last_class != Some(class) {
+                            last_class = Some(class);
+                            f(b, next);
+                        }
+                    })
+                }
+                Transitions::Dense(ref dense) => {
+                    for b in classes.representatives() {
+                        f(b, dense[b]);
+                    }
+                }
+            }
+        }
+    }
+}
+
+/// Iterator over transitions in a state, skipping transitions to `fail_id()`.
+///
+/// This abstracts over the representation of NFA transitions, which may be
+/// either in a sparse or dense representation.
+///
+/// This somewhat idiosyncratically borrows the NFA mutably, so that when one
+/// is iterating over transitions, the caller can still mutate the NFA. This
+/// is useful when creating failure transitions.
+#[derive(Debug)]
+struct IterTransitionsMut<'a, S: StateID> {
+    nfa: &'a mut NFA<S>,
+    state_id: S,
+    cur: usize,
+}
+
+impl<'a, S: StateID> IterTransitionsMut<'a, S> {
+    fn new(nfa: &'a mut NFA<S>, state_id: S) -> IterTransitionsMut<'a, S> {
+        IterTransitionsMut { nfa, state_id, cur: 0 }
+    }
+
+    fn nfa(&mut self) -> &mut NFA<S> {
+        self.nfa
+    }
+}
+
+impl<'a, S: StateID> Iterator for IterTransitionsMut<'a, S> {
+    type Item = (u8, S);
+
+    fn next(&mut self) -> Option<(u8, S)> {
+        match self.nfa.states[self.state_id.to_usize()].trans {
+            Transitions::Sparse(ref sparse) => {
+                if self.cur >= sparse.len() {
+                    return None;
+                }
+                let i = self.cur;
+                self.cur += 1;
+                Some(sparse[i])
+            }
+            Transitions::Dense(ref dense) => {
+                while self.cur < dense.len() {
+                    // There are always exactly 255 transitions in dense repr.
+                    debug_assert!(self.cur < 256);
+
+                    let b = self.cur as u8;
+                    let id = dense[b];
+                    self.cur += 1;
+                    if id != fail_id() {
+                        return Some((b, id));
+                    }
+                }
+                None
+            }
+        }
+    }
+}
+
+/// A simple builder for configuring the NFA construction of Aho-Corasick.
+#[derive(Clone, Debug)]
+pub struct Builder {
+    dense_depth: usize,
+    match_kind: MatchKind,
+    prefilter: bool,
+    anchored: bool,
+    ascii_case_insensitive: bool,
+}
+
+impl Default for Builder {
+    fn default() -> Builder {
+        Builder {
+            dense_depth: 2,
+            match_kind: MatchKind::default(),
+            prefilter: true,
+            anchored: false,
+            ascii_case_insensitive: false,
+        }
+    }
+}
+
+impl Builder {
+    pub fn new() -> Builder {
+        Builder::default()
+    }
+
+    pub fn build<I, P, S: StateID>(&self, patterns: I) -> Result<NFA<S>>
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        Compiler::new(self)?.compile(patterns)
+    }
+
+    pub fn match_kind(&mut self, kind: MatchKind) -> &mut Builder {
+        self.match_kind = kind;
+        self
+    }
+
+    pub fn dense_depth(&mut self, depth: usize) -> &mut Builder {
+        self.dense_depth = depth;
+        self
+    }
+
+    pub fn prefilter(&mut self, yes: bool) -> &mut Builder {
+        self.prefilter = yes;
+        self
+    }
+
+    pub fn anchored(&mut self, yes: bool) -> &mut Builder {
+        self.anchored = yes;
+        self
+    }
+
+    pub fn ascii_case_insensitive(&mut self, yes: bool) -> &mut Builder {
+        self.ascii_case_insensitive = yes;
+        self
+    }
+}
+
+/// A compiler uses a builder configuration and builds up the NFA formulation
+/// of an Aho-Corasick automaton. This roughly corresponds to the standard
+/// formulation described in textbooks.
+#[derive(Debug)]
+struct Compiler<'a, S: StateID> {
+    builder: &'a Builder,
+    prefilter: prefilter::Builder,
+    nfa: NFA<S>,
+    byte_classes: ByteClassBuilder,
+}
+
+impl<'a, S: StateID> Compiler<'a, S> {
+    fn new(builder: &'a Builder) -> Result<Compiler<'a, S>> {
+        Ok(Compiler {
+            builder,
+            prefilter: prefilter::Builder::new(builder.match_kind)
+                .ascii_case_insensitive(builder.ascii_case_insensitive),
+            nfa: NFA {
+                match_kind: builder.match_kind,
+                start_id: usize_to_state_id(2)?,
+                max_pattern_len: 0,
+                pattern_count: 0,
+                heap_bytes: 0,
+                prefilter: None,
+                anchored: builder.anchored,
+                byte_classes: ByteClasses::singletons(),
+                states: vec![],
+            },
+            byte_classes: ByteClassBuilder::new(),
+        })
+    }
+
+    fn compile<I, P>(mut self, patterns: I) -> Result<NFA<S>>
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        self.add_state(0)?; // the fail state, which is never entered
+        self.add_state(0)?; // the dead state, only used for leftmost
+        self.add_state(0)?; // the start state
+        self.build_trie(patterns)?;
+        self.add_start_state_loop();
+        self.add_dead_state_loop();
+        if !self.builder.anchored {
+            if self.match_kind().is_leftmost() {
+                self.fill_failure_transitions_leftmost();
+            } else {
+                self.fill_failure_transitions_standard();
+            }
+        }
+        self.close_start_state_loop();
+        self.nfa.byte_classes = self.byte_classes.build();
+        if !self.builder.anchored {
+            self.nfa.prefilter = self.prefilter.build();
+        }
+        self.calculate_size();
+        Ok(self.nfa)
+    }
+
+    /// This sets up the initial prefix trie that makes up the Aho-Corasick
+    /// automaton. Effectively, it creates the basic structure of the
+    /// automaton, where every pattern given has a path from the start state to
+    /// the end of the pattern.
+    fn build_trie<I, P>(&mut self, patterns: I) -> Result<()>
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        'PATTERNS: for (pati, pat) in patterns.into_iter().enumerate() {
+            let pat = pat.as_ref();
+            self.nfa.max_pattern_len =
+                cmp::max(self.nfa.max_pattern_len, pat.len());
+            self.nfa.pattern_count += 1;
+
+            let mut prev = self.nfa.start_id;
+            let mut saw_match = false;
+            for (depth, &b) in pat.iter().enumerate() {
+                // When leftmost-first match semantics are requested, we
+                // specifically stop adding patterns when a previously added
+                // pattern is a prefix of it. We avoid adding it because
+                // leftmost-first semantics imply that the pattern can never
+                // match. This is not just an optimization to save space! It
+                // is necessary for correctness. In fact, this is the only
+                // difference in the automaton between the implementations for
+                // leftmost-first and leftmost-longest.
+                saw_match = saw_match || self.nfa.state(prev).is_match();
+                if self.builder.match_kind.is_leftmost_first() && saw_match {
+                    // Skip to the next pattern immediately. This avoids
+                    // incorrectly adding a match after this loop terminates.
+                    continue 'PATTERNS;
+                }
+
+                // Add this byte to our equivalence classes. We don't use these
+                // for NFA construction. These are instead used only if we're
+                // building a DFA. They would technically be useful for the
+                // NFA, but it would require a second pass over the patterns.
+                self.byte_classes.set_range(b, b);
+                if self.builder.ascii_case_insensitive {
+                    let b = opposite_ascii_case(b);
+                    self.byte_classes.set_range(b, b);
+                }
+
+                // If the transition from prev using the current byte already
+                // exists, then just move through it. Otherwise, add a new
+                // state. We track the depth here so that we can determine
+                // how to represent transitions. States near the start state
+                // use a dense representation that uses more memory but is
+                // faster. Other states use a sparse representation that uses
+                // less memory but is slower.
+                let next = self.nfa.state(prev).next_state(b);
+                if next != fail_id() {
+                    prev = next;
+                } else {
+                    let next = self.add_state(depth + 1)?;
+                    self.nfa.state_mut(prev).set_next_state(b, next);
+                    if self.builder.ascii_case_insensitive {
+                        let b = opposite_ascii_case(b);
+                        self.nfa.state_mut(prev).set_next_state(b, next);
+                    }
+                    prev = next;
+                }
+            }
+            // Once the pattern has been added, log the match in the final
+            // state that it reached.
+            self.nfa.state_mut(prev).add_match(pati, pat.len());
+            // ... and hand it to the prefilter builder, if applicable.
+            if self.builder.prefilter {
+                self.prefilter.add(pat);
+            }
+        }
+        Ok(())
+    }
+
+    /// This routine creates failure transitions according to the standard
+    /// textbook formulation of the Aho-Corasick algorithm.
+    ///
+    /// Building failure transitions is the most interesting part of building
+    /// the Aho-Corasick automaton, because they are what allow searches to
+    /// be performed in linear time. Specifically, a failure transition is
+    /// a single transition associated with each state that points back to
+    /// the longest proper suffix of the pattern being searched. The failure
+    /// transition is followed whenever there exists no transition on the
+    /// current state for the current input byte. If there is no other proper
+    /// suffix, then the failure transition points back to the starting state.
+    ///
+    /// For example, let's say we built an Aho-Corasick automaton with the
+    /// following patterns: 'abcd' and 'cef'. The trie looks like this:
+    ///
+    /// ```ignore
+    ///          a - S1 - b - S2 - c - S3 - d - S4*
+    ///         /
+    ///     S0 - c - S5 - e - S6 - f - S7*
+    /// ```
+    ///
+    /// At this point, it should be fairly straight-forward to see how this
+    /// trie can be used in a simplistic way. At any given position in the
+    /// text we're searching (called the "subject" string), all we need to do
+    /// is follow the transitions in the trie by consuming one transition for
+    /// each byte in the subject string. If we reach a match state, then we can
+    /// report that location as a match.
+    ///
+    /// The trick comes when searching a subject string like 'abcef'. We'll
+    /// initially follow the transition from S0 to S1 and wind up in S3 after
+    /// observng the 'c' byte. At this point, the next byte is 'e' but state
+    /// S3 has no transition for 'e', so the search fails. We then would need
+    /// to restart the search at the next position in 'abcef', which
+    /// corresponds to 'b'. The match would fail, but the next search starting
+    /// at 'c' would finally succeed. The problem with this approach is that
+    /// we wind up searching the subject string potentially many times. In
+    /// effect, this makes the algorithm have worst case `O(n * m)` complexity,
+    /// where `n ~ len(subject)` and `m ~ len(all patterns)`. We would instead
+    /// like to achieve a `O(n + m)` worst case complexity.
+    ///
+    /// This is where failure transitions come in. Instead of dying at S3 in
+    /// the first search, the automaton can instruct the search to move to
+    /// another part of the automaton that corresponds to a suffix of what
+    /// we've seen so far. Recall that we've seen 'abc' in the subject string,
+    /// and the automaton does indeed have a non-empty suffix, 'c', that could
+    /// potentially lead to another match. Thus, the actual Aho-Corasick
+    /// automaton for our patterns in this case looks like this:
+    ///
+    /// ```ignore
+    ///          a - S1 - b - S2 - c - S3 - d - S4*
+    ///         /                      /
+    ///        /       ----------------
+    ///       /       /
+    ///     S0 - c - S5 - e - S6 - f - S7*
+    /// ```
+    ///
+    /// That is, we have a failure transition from S3 to S5, which is followed
+    /// exactly in cases when we are in state S3 but see any byte other than
+    /// 'd' (that is, we've "failed" to find a match in this portion of our
+    /// trie). We know we can transition back to S5 because we've already seen
+    /// a 'c' byte, so we don't need to re-scan it. We can then pick back up
+    /// with the search starting at S5 and complete our match.
+    ///
+    /// Adding failure transitions to a trie is fairly simple, but subtle. The
+    /// key issue is that you might have multiple failure transition that you
+    /// need to follow. For example, look at the trie for the patterns
+    /// 'abcd', 'b', 'bcd' and 'cd':
+    ///
+    /// ```ignore
+    ///        - a - S1 - b - S2 - c - S3 - d - S4*
+    ///       /
+    ///     S0 - b - S5* - c - S6 - d - S7*
+    ///       \
+    ///        - c - S8 - d - S9*
+    /// ```
+    ///
+    /// The failure transitions for this trie are defined from S2 to S5,
+    /// S3 to S6 and S6 to S8. Moreover, state S2 needs to track that it
+    /// corresponds to a match, since its failure transition to S5 is itself
+    /// a match state.
+    ///
+    /// Perhaps simplest way to think about adding these failure transitions
+    /// is recursively. That is, if you know the failure transitions for every
+    /// possible previous state that could be visited (e.g., when computing the
+    /// failure transition for S3, you already know the failure transitions
+    /// for S0, S1 and S2), then you can simply follow the failure transition
+    /// of the previous state and check whether the incoming transition is
+    /// defined after following the failure transition.
+    ///
+    /// For example, when determining the failure state for S3, by our
+    /// assumptions, we already know that there is a failure transition from
+    /// S2 (the previous state) to S5. So we follow that transition and check
+    /// whether the transition connecting S2 to S3 is defined. Indeed, it is,
+    /// as there is a transition from S5 to S6 for the byte 'c'. If no such
+    /// transition existed, we could keep following the failure transitions
+    /// until we reach the start state, which is the failure transition for
+    /// every state that has no corresponding proper suffix.
+    ///
+    /// We don't actually use recursion to implement this, but instead, use a
+    /// breadth first search of the automaton. Our base case is the start
+    /// state, whose failure transition is just a transition to itself.
+    fn fill_failure_transitions_standard(&mut self) {
+        // Initialize the queue for breadth first search with all transitions
+        // out of the start state. We handle the start state specially because
+        // we only want to follow non-self transitions. If we followed self
+        // transitions, then this would never terminate.
+        let mut queue = VecDeque::new();
+        let mut seen = self.queued_set();
+        for b in AllBytesIter::new() {
+            let next = self.nfa.start().next_state(b);
+            if next != self.nfa.start_id {
+                if !seen.contains(next) {
+                    queue.push_back(next);
+                    seen.insert(next);
+                }
+            }
+        }
+        while let Some(id) = queue.pop_front() {
+            let mut it = self.nfa.iter_transitions_mut(id);
+            while let Some((b, next)) = it.next() {
+                if seen.contains(next) {
+                    // The only way to visit a duplicate state in a transition
+                    // list is when ASCII case insensitivity is enabled. In
+                    // this case, we want to skip it since it's redundant work.
+                    // But it would also end up duplicating matches, which
+                    // results in reporting duplicate matches in some cases.
+                    // See the 'acasei010' regression test.
+                    continue;
+                }
+                queue.push_back(next);
+                seen.insert(next);
+
+                let mut fail = it.nfa().state(id).fail;
+                while it.nfa().state(fail).next_state(b) == fail_id() {
+                    fail = it.nfa().state(fail).fail;
+                }
+                fail = it.nfa().state(fail).next_state(b);
+                it.nfa().state_mut(next).fail = fail;
+                it.nfa().copy_matches(fail, next);
+            }
+            // If the start state is a match state, then this automaton can
+            // match the empty string. This implies all states are match states
+            // since every position matches the empty string, so copy the
+            // matches from the start state to every state. Strictly speaking,
+            // this is only necessary for overlapping matches since each
+            // non-empty non-start match state needs to report empty matches
+            // in addition to its own. For the non-overlapping case, such
+            // states only report the first match, which is never empty since
+            // it isn't a start state.
+            it.nfa().copy_empty_matches(id);
+        }
+    }
+
+    /// This routine is just like fill_failure_transitions_standard, except
+    /// it adds failure transitions in a way that preserves leftmost match
+    /// semantics (for both leftmost-first and leftmost-longest).
+    ///
+    /// The algorithms are so similar that it would be possible to write it
+    /// generically. But doing so without overhead would require a bit of
+    /// ceremony, so we just copy it and add in the extra leftmost logic.
+    /// Moreover, the standard algorithm above is so simple that it feels like
+    /// a crime to disturb it.
+    ///
+    /// In effect, this proceeds just like the standard approach, but we
+    /// specifically add only a subset of all failure transitions. Namely, we
+    /// only add failure transitions that either do not occur after a match
+    /// or failure transitions that do occur after a match but preserve the
+    /// match. The comments in the implementation below should help.
+    ///
+    /// N.B. The only differences in the automaton between leftmost-first and
+    /// leftmost-longest are in trie construction. Otherwise, both have exactly
+    /// the same set of failure transitions. leftmost-longest adds everything
+    /// to the trie, where as leftmost-first skips any patterns for which there
+    /// exists a prefix of it that was added earlier.
+    ///
+    /// N.B. I came up with this algorithm on my own, and after scouring all of
+    /// the other AC implementations I know of (Perl, Snort, many on GitHub).
+    /// I couldn't find any that implement leftmost semantics like this.
+    /// Perl of course needs leftmost-first semantics, but they implement it
+    /// with a seeming hack at *search* time instead of encoding it into the
+    /// automaton. There are also a couple Java libraries that support leftmost
+    /// longest semantics, but they do it by building a queue of matches at
+    /// search time, which is even worse than what Perl is doing. ---AG
+    fn fill_failure_transitions_leftmost(&mut self) {
+        /// Represents an item in our queue of states to process.
+        ///
+        /// Fundamentally, this queue serves the same purpose as the queue
+        /// for filling failure transitions using the standard formulation.
+        /// In the leftmost case, though, we need to track a bit more
+        /// information. See comments below.
+        #[derive(Clone, Copy, Debug)]
+        struct QueuedState<S> {
+            /// The id of the state to visit.
+            id: S,
+            /// The depth at which the first match was observed in the path
+            /// to this state. Note that this corresponds to the depth at
+            /// which the beginning of the match was detected. If no match
+            /// has been seen, then this is None.
+            match_at_depth: Option<usize>,
+        }
+
+        impl<S: StateID> QueuedState<S> {
+            /// Create a queued state corresponding to the given NFA's start
+            /// state.
+            fn start(nfa: &NFA<S>) -> QueuedState<S> {
+                let match_at_depth =
+                    if nfa.start().is_match() { Some(0) } else { None };
+                QueuedState { id: nfa.start_id, match_at_depth }
+            }
+
+            /// Return the next state to queue up. The given id must be a state
+            /// corresponding to a single transition from this queued state.
+            fn next_queued_state(
+                &self,
+                nfa: &NFA<S>,
+                id: S,
+            ) -> QueuedState<S> {
+                let match_at_depth = self.next_match_at_depth(nfa, id);
+                QueuedState { id, match_at_depth }
+            }
+
+            /// Return the earliest depth at which a match has occurred for
+            /// the given state. The given state must correspond to a single
+            /// transition from this queued state.
+            fn next_match_at_depth(
+                &self,
+                nfa: &NFA<S>,
+                next: S,
+            ) -> Option<usize> {
+                // This is a little tricky. If the previous state has already
+                // seen a match or if `next` isn't a match state, then nothing
+                // needs to change since a later state cannot find an earlier
+                // match.
+                match self.match_at_depth {
+                    Some(x) => return Some(x),
+                    None if nfa.state(next).is_match() => {}
+                    None => return None,
+                }
+                let depth = nfa.state(next).depth
+                    - nfa.state(next).get_longest_match_len().unwrap()
+                    + 1;
+                Some(depth)
+            }
+        }
+
+        // Initialize the queue for breadth first search with all transitions
+        // out of the start state. We handle the start state specially because
+        // we only want to follow non-self transitions. If we followed self
+        // transitions, then this would never terminate.
+        let mut queue: VecDeque<QueuedState<S>> = VecDeque::new();
+        let mut seen = self.queued_set();
+        let start = QueuedState::start(&self.nfa);
+        for b in AllBytesIter::new() {
+            let next_id = self.nfa.start().next_state(b);
+            if next_id != start.id {
+                let next = start.next_queued_state(&self.nfa, next_id);
+                if !seen.contains(next.id) {
+                    queue.push_back(next);
+                    seen.insert(next.id);
+                }
+                // If a state immediately following the start state is a match
+                // state, then we never want to follow its failure transition
+                // since the failure transition necessarily leads back to the
+                // start state, which we never want to do for leftmost matching
+                // after a match has been found.
+                //
+                // N.B. This is a special case of the more general handling
+                // found below.
+                if self.nfa.state(next_id).is_match() {
+                    self.nfa.state_mut(next_id).fail = dead_id();
+                }
+            }
+        }
+        while let Some(item) = queue.pop_front() {
+            let mut any_trans = false;
+            let mut it = self.nfa.iter_transitions_mut(item.id);
+            while let Some((b, next_id)) = it.next() {
+                any_trans = true;
+
+                // Queue up the next state.
+                let next = item.next_queued_state(it.nfa(), next_id);
+                if seen.contains(next.id) {
+                    // The only way to visit a duplicate state in a transition
+                    // list is when ASCII case insensitivity is enabled. In
+                    // this case, we want to skip it since it's redundant work.
+                    // But it would also end up duplicating matches, which
+                    // results in reporting duplicate matches in some cases.
+                    // See the 'acasei010' regression test.
+                    continue;
+                }
+                queue.push_back(next);
+                seen.insert(next.id);
+
+                // Find the failure state for next. Same as standard.
+                let mut fail = it.nfa().state(item.id).fail;
+                while it.nfa().state(fail).next_state(b) == fail_id() {
+                    fail = it.nfa().state(fail).fail;
+                }
+                fail = it.nfa().state(fail).next_state(b);
+
+                // This is the key difference from the standard formulation.
+                // Namely, if we've seen a match, then we only want a failure
+                // transition if the failure transition preserves the match
+                // we've seen. In general, this is not true of all failure
+                // transitions since they can point back to any suffix of what
+                // we've seen so far. Instead, we only want to point back to
+                // suffixes that contain any match we've seen.
+                //
+                // We achieve this by comparing the depth of the failure
+                // transition with the number of states between this state
+                // and the beginning of the earliest match detected. If the
+                // depth of the failure state is smaller than this difference,
+                // then it cannot contain the match. If it's bigger or equal
+                // to the difference, then it necessarily includes the match
+                // we've seen since all failure transitions correspond to a
+                // suffix.
+                //
+                // If we've determined that we don't want the failure
+                // transition, then we set this state's failure transition to
+                // the dead state. In other words, when a search hits this
+                // state, it will not continue and correctly stop. (N.B. A
+                // dead state is different than a fail state. A dead state
+                // MUST be preceded by a match and acts as a sentinel to search
+                // routines to terminate.)
+                //
+                // Understanding this is tricky, and it took me several days
+                // to think through this and get it right. If you want to grok
+                // it, then I'd recommend: 1) switch the implementation to
+                // always use the standard algorithm for filling in failure
+                // transitions, 2) run the test suite and 3) examine the test
+                // failures. Write out the automatons for them and try to work
+                // backwards by figuring out which failure transitions should
+                // be removed. You should arrive at the same rule used below.
+                if let Some(match_depth) = next.match_at_depth {
+                    let fail_depth = it.nfa().state(fail).depth;
+                    let next_depth = it.nfa().state(next.id).depth;
+                    if next_depth - match_depth + 1 > fail_depth {
+                        it.nfa().state_mut(next.id).fail = dead_id();
+                        continue;
+                    }
+                    assert_ne!(
+                        start.id,
+                        it.nfa().state(next.id).fail,
+                        "states that are match states or follow match \
+                         states should never have a failure transition \
+                         back to the start state in leftmost searching",
+                    );
+                }
+                it.nfa().state_mut(next.id).fail = fail;
+                it.nfa().copy_matches(fail, next.id);
+            }
+            // If there are no transitions for this state and if it's a match
+            // state, then we must set its failure transition to the dead
+            // state since we never want it to restart the search.
+            if !any_trans && it.nfa().state(item.id).is_match() {
+                it.nfa().state_mut(item.id).fail = dead_id();
+            }
+            // We don't need to copy empty matches from the start state here
+            // because that's only necessary for overlapping matches and
+            // leftmost match kinds don't support overlapping matches.
+        }
+    }
+
+    /// Returns a set that tracked queued states.
+    ///
+    /// This is only necessary when ASCII case insensitivity is enabled, since
+    /// it is the only way to visit the same state twice. Otherwise, this
+    /// returns an inert set that nevers adds anything and always reports
+    /// `false` for every member test.
+    fn queued_set(&self) -> QueuedSet<S> {
+        if self.builder.ascii_case_insensitive {
+            QueuedSet::active()
+        } else {
+            QueuedSet::inert()
+        }
+    }
+
+    /// Set the failure transitions on the start state to loop back to the
+    /// start state. This effectively permits the Aho-Corasick automaton to
+    /// match at any position. This is also required for finding the next
+    /// state to terminate, namely, finding the next state should never return
+    /// a fail_id.
+    ///
+    /// This must be done after building the initial trie, since trie
+    /// construction depends on transitions to `fail_id` to determine whether a
+    /// state already exists or not.
+    fn add_start_state_loop(&mut self) {
+        let start_id = self.nfa.start_id;
+        let start = self.nfa.start_mut();
+        for b in AllBytesIter::new() {
+            if start.next_state(b) == fail_id() {
+                start.set_next_state(b, start_id);
+            }
+        }
+    }
+
+    /// Remove the start state loop by rewriting any transitions on the start
+    /// state back to the start state with transitions to the dead state.
+    ///
+    /// The loop is only closed when two conditions are met: the start state
+    /// is a match state and the match kind is leftmost-first or
+    /// leftmost-longest. (Alternatively, if this is an anchored automaton,
+    /// then the start state is always closed, regardless of aforementioned
+    /// conditions.)
+    ///
+    /// The reason for this is that under leftmost semantics, a start state
+    /// that is also a match implies that we should never restart the search
+    /// process. We allow normal transitions out of the start state, but if
+    /// none exist, we transition to the dead state, which signals that
+    /// searching should stop.
+    fn close_start_state_loop(&mut self) {
+        if self.builder.anchored
+            || (self.match_kind().is_leftmost() && self.nfa.start().is_match())
+        {
+            let start_id = self.nfa.start_id;
+            let start = self.nfa.start_mut();
+            for b in AllBytesIter::new() {
+                if start.next_state(b) == start_id {
+                    start.set_next_state(b, dead_id());
+                }
+            }
+        }
+    }
+
+    /// Sets all transitions on the dead state to point back to the dead state.
+    /// Normally, missing transitions map back to the failure state, but the
+    /// point of the dead state is to act as a sink that can never be escaped.
+    fn add_dead_state_loop(&mut self) {
+        let dead = self.nfa.state_mut(dead_id());
+        for b in AllBytesIter::new() {
+            dead.set_next_state(b, dead_id());
+        }
+    }
+
+    /// Computes the total amount of heap used by this NFA in bytes.
+    fn calculate_size(&mut self) {
+        let mut size = 0;
+        for state in &self.nfa.states {
+            size += state.heap_bytes();
+        }
+        self.nfa.heap_bytes = size;
+    }
+
+    /// Add a new state to the underlying NFA with the given depth. The depth
+    /// is used to determine how to represent the transitions.
+    ///
+    /// If adding the new state would overflow the chosen state ID
+    /// representation, then this returns an error.
+    fn add_state(&mut self, depth: usize) -> Result<S> {
+        if depth < self.builder.dense_depth {
+            self.nfa.add_dense_state(depth)
+        } else {
+            self.nfa.add_sparse_state(depth)
+        }
+    }
+
+    /// Returns the match kind configured on the underlying builder.
+    fn match_kind(&self) -> MatchKind {
+        self.builder.match_kind
+    }
+}
+
+/// A set of state identifiers used to avoid revisiting the same state multiple
+/// times when filling in failure transitions.
+///
+/// This set has an "inert" and an "active" mode. When inert, the set never
+/// stores anything and always returns `false` for every member test. This is
+/// useful to avoid the performance and memory overhead of maintaining this
+/// set when it is not needed.
+#[derive(Debug)]
+struct QueuedSet<S> {
+    set: Option<BTreeSet<S>>,
+}
+
+impl<S: StateID> QueuedSet<S> {
+    /// Return an inert set that returns `false` for every state ID membership
+    /// test.
+    fn inert() -> QueuedSet<S> {
+        QueuedSet { set: None }
+    }
+
+    /// Return an active set that tracks state ID membership.
+    fn active() -> QueuedSet<S> {
+        QueuedSet { set: Some(BTreeSet::new()) }
+    }
+
+    /// Inserts the given state ID into this set. (If the set is inert, then
+    /// this is a no-op.)
+    fn insert(&mut self, state_id: S) {
+        if let Some(ref mut set) = self.set {
+            set.insert(state_id);
+        }
+    }
+
+    /// Returns true if and only if the given state ID is in this set. If the
+    /// set is inert, this always returns false.
+    fn contains(&self, state_id: S) -> bool {
+        match self.set {
+            None => false,
+            Some(ref set) => set.contains(&state_id),
+        }
+    }
+}
+
+/// An iterator over every byte value.
+///
+/// We use this instead of (0..256).map(|b| b as u8) because this optimizes
+/// better in debug builds.
+///
+/// We also use this instead of 0..=255 because we're targeting Rust 1.24 and
+/// inclusive range syntax was stabilized in Rust 1.26. We can get rid of this
+/// once our MSRV is Rust 1.26 or newer.
+#[derive(Debug)]
+struct AllBytesIter(u16);
+
+impl AllBytesIter {
+    fn new() -> AllBytesIter {
+        AllBytesIter(0)
+    }
+}
+
+impl Iterator for AllBytesIter {
+    type Item = u8;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.0 >= 256 {
+            None
+        } else {
+            let b = self.0 as u8;
+            self.0 += 1;
+            Some(b)
+        }
+    }
+}
+
+impl<S: StateID> fmt::Debug for NFA<S> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        writeln!(f, "NFA(")?;
+        writeln!(f, "match_kind: {:?}", self.match_kind)?;
+        writeln!(f, "prefilter: {:?}", self.prefilter)?;
+        writeln!(f, "{}", "-".repeat(79))?;
+        for (id, s) in self.states.iter().enumerate() {
+            let mut trans = vec![];
+            s.trans.iter(|byte, next| {
+                // The start state has a bunch of uninteresting transitions
+                // back into itself. It's questionable to hide them since they
+                // are critical to understanding the automaton, but they are
+                // very noisy without better formatting for contiugous ranges
+                // to the same state.
+                if id == self.start_id.to_usize() && next == self.start_id {
+                    return;
+                }
+                // Similarly, the dead state has a bunch of uninteresting
+                // transitions too.
+                if id == dead_id() {
+                    return;
+                }
+                trans.push(format!("{} => {}", escape(byte), next.to_usize()));
+            });
+            writeln!(f, "{:04}: {}", id, trans.join(", "))?;
+
+            let matches: Vec<String> = s
+                .matches
+                .iter()
+                .map(|&(pattern_id, _)| pattern_id.to_string())
+                .collect();
+            writeln!(f, "  matches: {}", matches.join(", "))?;
+            writeln!(f, "     fail: {}", s.fail.to_usize())?;
+            writeln!(f, "    depth: {}", s.depth)?;
+        }
+        writeln!(f, "{}", "-".repeat(79))?;
+        writeln!(f, ")")?;
+        Ok(())
+    }
+}
+
+/// Iterate over all possible byte transitions given a sparse set.
+fn sparse_iter<S: StateID, F: FnMut(u8, S)>(trans: &[(u8, S)], mut f: F) {
+    let mut byte = 0u16;
+    for &(b, id) in trans {
+        while byte < (b as u16) {
+            f(byte as u8, fail_id());
+            byte += 1;
+        }
+        f(b, id);
+        byte += 1;
+    }
+    for b in byte..256 {
+        f(b as u8, fail_id());
+    }
+}
+
+/// Safely return two mutable borrows to two different locations in the given
+/// slice.
+///
+/// This panics if i == j.
+fn get_two_mut<T>(xs: &mut [T], i: usize, j: usize) -> (&mut T, &mut T) {
+    assert!(i != j, "{} must not be equal to {}", i, j);
+    if i < j {
+        let (before, after) = xs.split_at_mut(j);
+        (&mut before[i], &mut after[0])
+    } else {
+        let (before, after) = xs.split_at_mut(i);
+        (&mut after[0], &mut before[j])
+    }
+}
+
+/// Return the given byte as its escaped string form.
+fn escape(b: u8) -> String {
+    use std::ascii;
+
+    String::from_utf8(ascii::escape_default(b).collect::<Vec<_>>()).unwrap()
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn scratch() {
+        let nfa: NFA<usize> = Builder::new()
+            .dense_depth(0)
+            // .match_kind(MatchKind::LeftmostShortest)
+            // .match_kind(MatchKind::LeftmostLongest)
+            .match_kind(MatchKind::LeftmostFirst)
+            // .build(&["abcd", "ce", "b"])
+            // .build(&["ab", "bc"])
+            // .build(&["b", "bcd", "ce"])
+            // .build(&["abc", "bx"])
+            // .build(&["abc", "bd", "ab"])
+            // .build(&["abcdefghi", "hz", "abcdefgh"])
+            // .build(&["abcd", "bce", "b"])
+            .build(&["abcdefg", "bcde", "bcdef"])
+            .unwrap();
+        println!("{:?}", nfa);
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/api.rs b/android/vendor/aho-corasick-0.7.18/src/packed/api.rs
new file mode 100644
index 0000000..c15ae3f
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/api.rs
@@ -0,0 +1,632 @@
+use std::u16;
+
+use crate::packed::pattern::Patterns;
+use crate::packed::rabinkarp::RabinKarp;
+use crate::packed::teddy::{self, Teddy};
+use crate::Match;
+
+/// This is a limit placed on the total number of patterns we're willing to try
+/// and match at once. As more sophisticated algorithms are added, this number
+/// may be increased.
+const PATTERN_LIMIT: usize = 128;
+
+/// A knob for controlling the match semantics of a packed multiple string
+/// searcher.
+///
+/// This differs from the
+/// [`MatchKind`](../enum.MatchKind.html)
+/// type in the top-level crate module in that it doesn't support
+/// "standard" match semantics, and instead only supports leftmost-first or
+/// leftmost-longest. Namely, "standard" semantics cannot be easily supported
+/// by packed searchers.
+///
+/// For more information on the distinction between leftmost-first and
+/// leftmost-longest, see the docs on the top-level `MatchKind` type.
+///
+/// Unlike the top-level `MatchKind` type, the default match semantics for this
+/// type are leftmost-first.
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub enum MatchKind {
+    /// Use leftmost-first match semantics, which reports leftmost matches.
+    /// When there are multiple possible leftmost matches, the match
+    /// corresponding to the pattern that appeared earlier when constructing
+    /// the automaton is reported.
+    ///
+    /// This is the default.
+    LeftmostFirst,
+    /// Use leftmost-longest match semantics, which reports leftmost matches.
+    /// When there are multiple possible leftmost matches, the longest match
+    /// is chosen.
+    LeftmostLongest,
+    /// Hints that destructuring should not be exhaustive.
+    ///
+    /// This enum may grow additional variants, so this makes sure clients
+    /// don't count on exhaustive matching. (Otherwise, adding a new variant
+    /// could break existing code.)
+    #[doc(hidden)]
+    __Nonexhaustive,
+}
+
+impl Default for MatchKind {
+    fn default() -> MatchKind {
+        MatchKind::LeftmostFirst
+    }
+}
+
+/// The configuration for a packed multiple pattern searcher.
+///
+/// The configuration is currently limited only to being able to select the
+/// match semantics (leftmost-first or leftmost-longest) of a searcher. In the
+/// future, more knobs may be made available.
+///
+/// A configuration produces a [`packed::Builder`](struct.Builder.html), which
+/// in turn can be used to construct a
+/// [`packed::Searcher`](struct.Searcher.html) for searching.
+///
+/// # Example
+///
+/// This example shows how to use leftmost-longest semantics instead of the
+/// default (leftmost-first).
+///
+/// ```
+/// use aho_corasick::packed::{Config, MatchKind};
+///
+/// # fn example() -> Option<()> {
+/// let searcher = Config::new()
+///     .match_kind(MatchKind::LeftmostLongest)
+///     .builder()
+///     .add("foo")
+///     .add("foobar")
+///     .build()?;
+/// let matches: Vec<usize> = searcher
+///     .find_iter("foobar")
+///     .map(|mat| mat.pattern())
+///     .collect();
+/// assert_eq!(vec![1], matches);
+/// # Some(()) }
+/// # if cfg!(target_arch = "x86_64") {
+/// #     example().unwrap()
+/// # } else {
+/// #     assert!(example().is_none());
+/// # }
+/// ```
+#[derive(Clone, Debug)]
+pub struct Config {
+    kind: MatchKind,
+    force: Option<ForceAlgorithm>,
+    force_teddy_fat: Option<bool>,
+    force_avx: Option<bool>,
+}
+
+/// An internal option for forcing the use of a particular packed algorithm.
+///
+/// When an algorithm is forced, if a searcher could not be constructed for it,
+/// then no searcher will be returned even if an alternative algorithm would
+/// work.
+#[derive(Clone, Debug)]
+enum ForceAlgorithm {
+    Teddy,
+    RabinKarp,
+}
+
+impl Default for Config {
+    fn default() -> Config {
+        Config::new()
+    }
+}
+
+impl Config {
+    /// Create a new default configuration. A default configuration uses
+    /// leftmost-first match semantics.
+    pub fn new() -> Config {
+        Config {
+            kind: MatchKind::LeftmostFirst,
+            force: None,
+            force_teddy_fat: None,
+            force_avx: None,
+        }
+    }
+
+    /// Create a packed builder from this configuration. The builder can be
+    /// used to accumulate patterns and create a
+    /// [`Searcher`](struct.Searcher.html)
+    /// from them.
+    pub fn builder(&self) -> Builder {
+        Builder::from_config(self.clone())
+    }
+
+    /// Set the match semantics for this configuration.
+    pub fn match_kind(&mut self, kind: MatchKind) -> &mut Config {
+        self.kind = kind;
+        self
+    }
+
+    /// An undocumented method for forcing the use of the Teddy algorithm.
+    ///
+    /// This is only exposed for more precise testing and benchmarks. Callers
+    /// should not use it as it is not part of the API stability guarantees of
+    /// this crate.
+    #[doc(hidden)]
+    pub fn force_teddy(&mut self, yes: bool) -> &mut Config {
+        if yes {
+            self.force = Some(ForceAlgorithm::Teddy);
+        } else {
+            self.force = None;
+        }
+        self
+    }
+
+    /// An undocumented method for forcing the use of the Fat Teddy algorithm.
+    ///
+    /// This is only exposed for more precise testing and benchmarks. Callers
+    /// should not use it as it is not part of the API stability guarantees of
+    /// this crate.
+    #[doc(hidden)]
+    pub fn force_teddy_fat(&mut self, yes: Option<bool>) -> &mut Config {
+        self.force_teddy_fat = yes;
+        self
+    }
+
+    /// An undocumented method for forcing the use of SSE (`Some(false)`) or
+    /// AVX (`Some(true)`) algorithms.
+    ///
+    /// This is only exposed for more precise testing and benchmarks. Callers
+    /// should not use it as it is not part of the API stability guarantees of
+    /// this crate.
+    #[doc(hidden)]
+    pub fn force_avx(&mut self, yes: Option<bool>) -> &mut Config {
+        self.force_avx = yes;
+        self
+    }
+
+    /// An undocumented method for forcing the use of the Rabin-Karp algorithm.
+    ///
+    /// This is only exposed for more precise testing and benchmarks. Callers
+    /// should not use it as it is not part of the API stability guarantees of
+    /// this crate.
+    #[doc(hidden)]
+    pub fn force_rabin_karp(&mut self, yes: bool) -> &mut Config {
+        if yes {
+            self.force = Some(ForceAlgorithm::RabinKarp);
+        } else {
+            self.force = None;
+        }
+        self
+    }
+}
+
+/// A builder for constructing a packed searcher from a collection of patterns.
+///
+/// # Example
+///
+/// This example shows how to use a builder to construct a searcher. By
+/// default, leftmost-first match semantics are used.
+///
+/// ```
+/// use aho_corasick::packed::{Builder, MatchKind};
+///
+/// # fn example() -> Option<()> {
+/// let searcher = Builder::new()
+///     .add("foobar")
+///     .add("foo")
+///     .build()?;
+/// let matches: Vec<usize> = searcher
+///     .find_iter("foobar")
+///     .map(|mat| mat.pattern())
+///     .collect();
+/// assert_eq!(vec![0], matches);
+/// # Some(()) }
+/// # if cfg!(target_arch = "x86_64") {
+/// #     example().unwrap()
+/// # } else {
+/// #     assert!(example().is_none());
+/// # }
+/// ```
+#[derive(Clone, Debug)]
+pub struct Builder {
+    /// The configuration of this builder and subsequent matcher.
+    config: Config,
+    /// Set to true if the builder detects that a matcher cannot be built.
+    inert: bool,
+    /// The patterns provided by the caller.
+    patterns: Patterns,
+}
+
+impl Builder {
+    /// Create a new builder for constructing a multi-pattern searcher. This
+    /// constructor uses the default configuration.
+    pub fn new() -> Builder {
+        Builder::from_config(Config::new())
+    }
+
+    fn from_config(config: Config) -> Builder {
+        Builder { config, inert: false, patterns: Patterns::new() }
+    }
+
+    /// Build a searcher from the patterns added to this builder so far.
+    pub fn build(&self) -> Option<Searcher> {
+        if self.inert || self.patterns.is_empty() {
+            return None;
+        }
+        let mut patterns = self.patterns.clone();
+        patterns.set_match_kind(self.config.kind);
+        let rabinkarp = RabinKarp::new(&patterns);
+        // Effectively, we only want to return a searcher if we can use Teddy,
+        // since Teddy is our only fast packed searcher at the moment.
+        // Rabin-Karp is only used when searching haystacks smaller than what
+        // Teddy can support. Thus, the only way to get a Rabin-Karp searcher
+        // is to force it using undocumented APIs (for tests/benchmarks).
+        let (search_kind, minimum_len) = match self.config.force {
+            None | Some(ForceAlgorithm::Teddy) => {
+                let teddy = match self.build_teddy(&patterns) {
+                    None => return None,
+                    Some(teddy) => teddy,
+                };
+                let minimum_len = teddy.minimum_len();
+                (SearchKind::Teddy(teddy), minimum_len)
+            }
+            Some(ForceAlgorithm::RabinKarp) => (SearchKind::RabinKarp, 0),
+        };
+        Some(Searcher {
+            config: self.config.clone(),
+            patterns,
+            rabinkarp,
+            search_kind,
+            minimum_len,
+        })
+    }
+
+    fn build_teddy(&self, patterns: &Patterns) -> Option<Teddy> {
+        teddy::Builder::new()
+            .avx(self.config.force_avx)
+            .fat(self.config.force_teddy_fat)
+            .build(&patterns)
+    }
+
+    /// Add the given pattern to this set to match.
+    ///
+    /// The order in which patterns are added is significant. Namely, when
+    /// using leftmost-first match semantics, then when multiple patterns can
+    /// match at a particular location, the pattern that was added first is
+    /// used as the match.
+    ///
+    /// If the number of patterns added exceeds the amount supported by packed
+    /// searchers, then the builder will stop accumulating patterns and render
+    /// itself inert. At this point, constructing a searcher will always return
+    /// `None`.
+    pub fn add<P: AsRef<[u8]>>(&mut self, pattern: P) -> &mut Builder {
+        if self.inert {
+            return self;
+        } else if self.patterns.len() >= PATTERN_LIMIT {
+            self.inert = true;
+            self.patterns.reset();
+            return self;
+        }
+        // Just in case PATTERN_LIMIT increases beyond u16::MAX.
+        assert!(self.patterns.len() <= u16::MAX as usize);
+
+        let pattern = pattern.as_ref();
+        if pattern.is_empty() {
+            self.inert = true;
+            self.patterns.reset();
+            return self;
+        }
+        self.patterns.add(pattern);
+        self
+    }
+
+    /// Add the given iterator of patterns to this set to match.
+    ///
+    /// The iterator must yield elements that can be converted into a `&[u8]`.
+    ///
+    /// The order in which patterns are added is significant. Namely, when
+    /// using leftmost-first match semantics, then when multiple patterns can
+    /// match at a particular location, the pattern that was added first is
+    /// used as the match.
+    ///
+    /// If the number of patterns added exceeds the amount supported by packed
+    /// searchers, then the builder will stop accumulating patterns and render
+    /// itself inert. At this point, constructing a searcher will always return
+    /// `None`.
+    pub fn extend<I, P>(&mut self, patterns: I) -> &mut Builder
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        for p in patterns {
+            self.add(p);
+        }
+        self
+    }
+}
+
+impl Default for Builder {
+    fn default() -> Builder {
+        Builder::new()
+    }
+}
+
+/// A packed searcher for quickly finding occurrences of multiple patterns.
+///
+/// If callers need more flexible construction, or if one wants to change the
+/// match semantics (either leftmost-first or leftmost-longest), then one can
+/// use the [`Config`](struct.Config.html) and/or
+/// [`Builder`](struct.Builder.html) types for more fine grained control.
+///
+/// # Example
+///
+/// This example shows how to create a searcher from an iterator of patterns.
+/// By default, leftmost-first match semantics are used.
+///
+/// ```
+/// use aho_corasick::packed::{MatchKind, Searcher};
+///
+/// # fn example() -> Option<()> {
+/// let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+/// let matches: Vec<usize> = searcher
+///     .find_iter("foobar")
+///     .map(|mat| mat.pattern())
+///     .collect();
+/// assert_eq!(vec![0], matches);
+/// # Some(()) }
+/// # if cfg!(target_arch = "x86_64") {
+/// #     example().unwrap()
+/// # } else {
+/// #     assert!(example().is_none());
+/// # }
+/// ```
+#[derive(Clone, Debug)]
+pub struct Searcher {
+    config: Config,
+    patterns: Patterns,
+    rabinkarp: RabinKarp,
+    search_kind: SearchKind,
+    minimum_len: usize,
+}
+
+#[derive(Clone, Debug)]
+enum SearchKind {
+    Teddy(Teddy),
+    RabinKarp,
+}
+
+impl Searcher {
+    /// A convenience function for constructing a searcher from an iterator
+    /// of things that can be converted to a `&[u8]`.
+    ///
+    /// If a searcher could not be constructed (either because of an
+    /// unsupported CPU or because there are too many patterns), then `None`
+    /// is returned.
+    ///
+    /// # Example
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::packed::{MatchKind, Searcher};
+    ///
+    /// # fn example() -> Option<()> {
+    /// let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+    /// let matches: Vec<usize> = searcher
+    ///     .find_iter("foobar")
+    ///     .map(|mat| mat.pattern())
+    ///     .collect();
+    /// assert_eq!(vec![0], matches);
+    /// # Some(()) }
+    /// # if cfg!(target_arch = "x86_64") {
+    /// #     example().unwrap()
+    /// # } else {
+    /// #     assert!(example().is_none());
+    /// # }
+    /// ```
+    pub fn new<I, P>(patterns: I) -> Option<Searcher>
+    where
+        I: IntoIterator<Item = P>,
+        P: AsRef<[u8]>,
+    {
+        Builder::new().extend(patterns).build()
+    }
+
+    /// Return the first occurrence of any of the patterns in this searcher,
+    /// according to its match semantics, in the given haystack. The `Match`
+    /// returned will include the identifier of the pattern that matched, which
+    /// corresponds to the index of the pattern (starting from `0`) in which it
+    /// was added.
+    ///
+    /// # Example
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::packed::{MatchKind, Searcher};
+    ///
+    /// # fn example() -> Option<()> {
+    /// let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+    /// let mat = searcher.find("foobar")?;
+    /// assert_eq!(0, mat.pattern());
+    /// assert_eq!(0, mat.start());
+    /// assert_eq!(6, mat.end());
+    /// # Some(()) }
+    /// # if cfg!(target_arch = "x86_64") {
+    /// #     example().unwrap()
+    /// # } else {
+    /// #     assert!(example().is_none());
+    /// # }
+    /// ```
+    pub fn find<B: AsRef<[u8]>>(&self, haystack: B) -> Option<Match> {
+        self.find_at(haystack, 0)
+    }
+
+    /// Return the first occurrence of any of the patterns in this searcher,
+    /// according to its match semantics, in the given haystack starting from
+    /// the given position.
+    ///
+    /// The `Match` returned will include the identifier of the pattern that
+    /// matched, which corresponds to the index of the pattern (starting from
+    /// `0`) in which it was added. The offsets in the `Match` will be relative
+    /// to the start of `haystack` (and not `at`).
+    ///
+    /// # Example
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::packed::{MatchKind, Searcher};
+    ///
+    /// # fn example() -> Option<()> {
+    /// let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+    /// let mat = searcher.find_at("foofoobar", 3)?;
+    /// assert_eq!(0, mat.pattern());
+    /// assert_eq!(3, mat.start());
+    /// assert_eq!(9, mat.end());
+    /// # Some(()) }
+    /// # if cfg!(target_arch = "x86_64") {
+    /// #     example().unwrap()
+    /// # } else {
+    /// #     assert!(example().is_none());
+    /// # }
+    /// ```
+    pub fn find_at<B: AsRef<[u8]>>(
+        &self,
+        haystack: B,
+        at: usize,
+    ) -> Option<Match> {
+        let haystack = haystack.as_ref();
+        match self.search_kind {
+            SearchKind::Teddy(ref teddy) => {
+                if haystack[at..].len() < teddy.minimum_len() {
+                    return self.slow_at(haystack, at);
+                }
+                teddy.find_at(&self.patterns, haystack, at)
+            }
+            SearchKind::RabinKarp => {
+                self.rabinkarp.find_at(&self.patterns, haystack, at)
+            }
+        }
+    }
+
+    /// Return an iterator of non-overlapping occurrences of the patterns in
+    /// this searcher, according to its match semantics, in the given haystack.
+    ///
+    /// # Example
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::packed::{MatchKind, Searcher};
+    ///
+    /// # fn example() -> Option<()> {
+    /// let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+    /// let matches: Vec<usize> = searcher
+    ///     .find_iter("foobar fooba foofoo")
+    ///     .map(|mat| mat.pattern())
+    ///     .collect();
+    /// assert_eq!(vec![0, 1, 1, 1], matches);
+    /// # Some(()) }
+    /// # if cfg!(target_arch = "x86_64") {
+    /// #     example().unwrap()
+    /// # } else {
+    /// #     assert!(example().is_none());
+    /// # }
+    /// ```
+    pub fn find_iter<'a, 'b, B: ?Sized + AsRef<[u8]>>(
+        &'a self,
+        haystack: &'b B,
+    ) -> FindIter<'a, 'b> {
+        FindIter { searcher: self, haystack: haystack.as_ref(), at: 0 }
+    }
+
+    /// Returns the match kind used by this packed searcher.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use aho_corasick::packed::{MatchKind, Searcher};
+    ///
+    /// # fn example() -> Option<()> {
+    /// let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+    /// // leftmost-first is the default.
+    /// assert_eq!(&MatchKind::LeftmostFirst, searcher.match_kind());
+    /// # Some(()) }
+    /// # if cfg!(target_arch = "x86_64") {
+    /// #     example().unwrap()
+    /// # } else {
+    /// #     assert!(example().is_none());
+    /// # }
+    /// ```
+    pub fn match_kind(&self) -> &MatchKind {
+        self.patterns.match_kind()
+    }
+
+    /// Returns the minimum length of a haystack that is required in order for
+    /// packed searching to be effective.
+    ///
+    /// In some cases, the underlying packed searcher may not be able to search
+    /// very short haystacks. When that occurs, the implementation will defer
+    /// to a slower non-packed searcher (which is still generally faster than
+    /// Aho-Corasick for a small number of patterns). However, callers may
+    /// want to avoid ever using the slower variant, which one can do by
+    /// never passing a haystack shorter than the minimum length returned by
+    /// this method.
+    pub fn minimum_len(&self) -> usize {
+        self.minimum_len
+    }
+
+    /// Returns the approximate total amount of heap used by this searcher, in
+    /// units of bytes.
+    pub fn heap_bytes(&self) -> usize {
+        self.patterns.heap_bytes()
+            + self.rabinkarp.heap_bytes()
+            + self.search_kind.heap_bytes()
+    }
+
+    /// Use a slow (non-packed) searcher.
+    ///
+    /// This is useful when a packed searcher could be constructed, but could
+    /// not be used to search a specific haystack. For example, if Teddy was
+    /// built but the haystack is smaller than ~34 bytes, then Teddy might not
+    /// be able to run.
+    fn slow_at(&self, haystack: &[u8], at: usize) -> Option<Match> {
+        self.rabinkarp.find_at(&self.patterns, haystack, at)
+    }
+}
+
+impl SearchKind {
+    fn heap_bytes(&self) -> usize {
+        match *self {
+            SearchKind::Teddy(ref ted) => ted.heap_bytes(),
+            SearchKind::RabinKarp => 0,
+        }
+    }
+}
+
+/// An iterator over non-overlapping matches from a packed searcher.
+///
+/// The lifetime `'s` refers to the lifetime of the underlying
+/// [`Searcher`](struct.Searcher.html), while the lifetime `'h` refers to the
+/// lifetime of the haystack being searched.
+#[derive(Debug)]
+pub struct FindIter<'s, 'h> {
+    searcher: &'s Searcher,
+    haystack: &'h [u8],
+    at: usize,
+}
+
+impl<'s, 'h> Iterator for FindIter<'s, 'h> {
+    type Item = Match;
+
+    fn next(&mut self) -> Option<Match> {
+        if self.at > self.haystack.len() {
+            return None;
+        }
+        match self.searcher.find_at(&self.haystack, self.at) {
+            None => None,
+            Some(c) => {
+                self.at = c.end;
+                Some(c)
+            }
+        }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/mod.rs b/android/vendor/aho-corasick-0.7.18/src/packed/mod.rs
new file mode 100644
index 0000000..25a7966
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/mod.rs
@@ -0,0 +1,117 @@
+/*!
+A lower level API for packed multiple substring search, principally for a small
+number of patterns.
+
+This sub-module provides vectorized routines for quickly finding matches of a
+small number of patterns. In general, users of this crate shouldn't need to
+interface with this module directory, as the primary
+[`AhoCorasick`](../struct.AhoCorasick.html)
+searcher will use these routines automatically as a prefilter when applicable.
+However, in some cases, callers may want to bypass the Aho-Corasick machinery
+entirely and use this vectorized searcher directly.
+
+# Overview
+
+The primary types in this sub-module are:
+
+* [`Searcher`](struct.Searcher.html) executes the actual search algorithm to
+  report matches in a haystack.
+* [`Builder`](struct.Builder.html) accumulates patterns incrementally and can
+  construct a `Searcher`.
+* [`Config`](struct.Config.html) permits tuning the searcher, and itself will
+  produce a `Builder` (which can then be used to build a `Searcher`).
+  Currently, the only tuneable knob are the match semantics, but this may be
+  expanded in the future.
+
+# Examples
+
+This example shows how to create a searcher from an iterator of patterns.
+By default, leftmost-first match semantics are used. (See the top-level
+[`MatchKind`](../enum.MatchKind.html) type for more details about match
+semantics, which apply similarly to packed substring search.)
+
+```
+use aho_corasick::packed::{MatchKind, Searcher};
+
+# fn example() -> Option<()> {
+let searcher = Searcher::new(["foobar", "foo"].iter().cloned())?;
+let matches: Vec<usize> = searcher
+    .find_iter("foobar")
+    .map(|mat| mat.pattern())
+    .collect();
+assert_eq!(vec![0], matches);
+# Some(()) }
+# if cfg!(target_arch = "x86_64") {
+#     example().unwrap()
+# } else {
+#     assert!(example().is_none());
+# }
+```
+
+This example shows how to use [`Config`](struct.Config.html) to change the
+match semantics to leftmost-longest:
+
+```
+use aho_corasick::packed::{Config, MatchKind};
+
+# fn example() -> Option<()> {
+let searcher = Config::new()
+    .match_kind(MatchKind::LeftmostLongest)
+    .builder()
+    .add("foo")
+    .add("foobar")
+    .build()?;
+let matches: Vec<usize> = searcher
+    .find_iter("foobar")
+    .map(|mat| mat.pattern())
+    .collect();
+assert_eq!(vec![1], matches);
+# Some(()) }
+# if cfg!(target_arch = "x86_64") {
+#     example().unwrap()
+# } else {
+#     assert!(example().is_none());
+# }
+```
+
+# Packed substring searching
+
+Packed substring searching refers to the use of SIMD (Single Instruction,
+Multiple Data) to accelerate the detection of matches in a haystack. Unlike
+conventional algorithms, such as Aho-Corasick, SIMD algorithms for substring
+search tend to do better with a small number of patterns, where as Aho-Corasick
+generally maintains reasonably consistent performance regardless of the number
+of patterns you give it. Because of this, the vectorized searcher in this
+sub-module cannot be used as a general purpose searcher, since building the
+searcher may fail. However, in exchange, when searching for a small number of
+patterns, searching can be quite a bit faster than Aho-Corasick (sometimes by
+an order of magnitude).
+
+The key take away here is that constructing a searcher from a list of patterns
+is a fallible operation. While the precise conditions under which building a
+searcher can fail is specifically an implementation detail, here are some
+common reasons:
+
+* Too many patterns were given. Typically, the limit is on the order of 100 or
+  so, but this limit may fluctuate based on available CPU features.
+* The available packed algorithms require CPU features that aren't available.
+  For example, currently, this crate only provides packed algorithms for
+  `x86_64`. Therefore, constructing a packed searcher on any other target
+  (e.g., ARM) will always fail.
+* Zero patterns were given, or one of the patterns given was empty. Packed
+  searchers require at least one pattern and that all patterns are non-empty.
+* Something else about the nature of the patterns (typically based on
+  heuristics) suggests that a packed searcher would perform very poorly, so
+  no searcher is built.
+*/
+
+pub use crate::packed::api::{Builder, Config, FindIter, MatchKind, Searcher};
+
+mod api;
+mod pattern;
+mod rabinkarp;
+mod teddy;
+#[cfg(test)]
+mod tests;
+#[cfg(target_arch = "x86_64")]
+mod vector;
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/pattern.rs b/android/vendor/aho-corasick-0.7.18/src/packed/pattern.rs
new file mode 100644
index 0000000..f4c6756
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/pattern.rs
@@ -0,0 +1,318 @@
+use std::cmp;
+use std::fmt;
+use std::mem;
+use std::u16;
+use std::usize;
+
+use crate::packed::api::MatchKind;
+
+/// The type used for representing a pattern identifier.
+///
+/// We don't use `usize` here because our packed searchers don't scale to
+/// huge numbers of patterns, so we keep things a bit smaller.
+pub type PatternID = u16;
+
+/// A non-empty collection of non-empty patterns to search for.
+///
+/// This collection of patterns is what is passed around to both execute
+/// searches and to construct the searchers themselves. Namely, this permits
+/// searches to avoid copying all of the patterns, and allows us to keep only
+/// one copy throughout all packed searchers.
+///
+/// Note that this collection is not a set. The same pattern can appear more
+/// than once.
+#[derive(Clone, Debug)]
+pub struct Patterns {
+    /// The match semantics supported by this collection of patterns.
+    ///
+    /// The match semantics determines the order of the iterator over patterns.
+    /// For leftmost-first, patterns are provided in the same order as were
+    /// provided by the caller. For leftmost-longest, patterns are provided in
+    /// descending order of length, with ties broken by the order in which they
+    /// were provided by the caller.
+    kind: MatchKind,
+    /// The collection of patterns, indexed by their identifier.
+    by_id: Vec<Vec<u8>>,
+    /// The order of patterns defined for iteration, given by pattern
+    /// identifiers. The order of `by_id` and `order` is always the same for
+    /// leftmost-first semantics, but may be different for leftmost-longest
+    /// semantics.
+    order: Vec<PatternID>,
+    /// The length of the smallest pattern, in bytes.
+    minimum_len: usize,
+    /// The largest pattern identifier. This should always be equivalent to
+    /// the number of patterns minus one in this collection.
+    max_pattern_id: PatternID,
+    /// The total number of pattern bytes across the entire collection. This
+    /// is used for reporting total heap usage in constant time.
+    total_pattern_bytes: usize,
+}
+
+impl Patterns {
+    /// Create a new collection of patterns for the given match semantics. The
+    /// ID of each pattern is the index of the pattern at which it occurs in
+    /// the `by_id` slice.
+    ///
+    /// If any of the patterns in the slice given are empty, then this panics.
+    /// Similarly, if the number of patterns given is zero, then this also
+    /// panics.
+    pub fn new() -> Patterns {
+        Patterns {
+            kind: MatchKind::default(),
+            by_id: vec![],
+            order: vec![],
+            minimum_len: usize::MAX,
+            max_pattern_id: 0,
+            total_pattern_bytes: 0,
+        }
+    }
+
+    /// Add a pattern to this collection.
+    ///
+    /// This panics if the pattern given is empty.
+    pub fn add(&mut self, bytes: &[u8]) {
+        assert!(!bytes.is_empty());
+        assert!(self.by_id.len() <= u16::MAX as usize);
+
+        let id = self.by_id.len() as u16;
+        self.max_pattern_id = id;
+        self.order.push(id);
+        self.by_id.push(bytes.to_vec());
+        self.minimum_len = cmp::min(self.minimum_len, bytes.len());
+        self.total_pattern_bytes += bytes.len();
+    }
+
+    /// Set the match kind semantics for this collection of patterns.
+    ///
+    /// If the kind is not set, then the default is leftmost-first.
+    pub fn set_match_kind(&mut self, kind: MatchKind) {
+        match kind {
+            MatchKind::LeftmostFirst => {
+                self.order.sort();
+            }
+            MatchKind::LeftmostLongest => {
+                let (order, by_id) = (&mut self.order, &mut self.by_id);
+                order.sort_by(|&id1, &id2| {
+                    by_id[id1 as usize]
+                        .len()
+                        .cmp(&by_id[id2 as usize].len())
+                        .reverse()
+                });
+            }
+            MatchKind::__Nonexhaustive => unreachable!(),
+        }
+    }
+
+    /// Return the number of patterns in this collection.
+    ///
+    /// This is guaranteed to be greater than zero.
+    pub fn len(&self) -> usize {
+        self.by_id.len()
+    }
+
+    /// Returns true if and only if this collection of patterns is empty.
+    pub fn is_empty(&self) -> bool {
+        self.len() == 0
+    }
+
+    /// Returns the approximate total amount of heap used by these patterns, in
+    /// units of bytes.
+    pub fn heap_bytes(&self) -> usize {
+        self.order.len() * mem::size_of::<PatternID>()
+            + self.by_id.len() * mem::size_of::<Vec<u8>>()
+            + self.total_pattern_bytes
+    }
+
+    /// Clears all heap memory associated with this collection of patterns and
+    /// resets all state such that it is a valid empty collection.
+    pub fn reset(&mut self) {
+        self.kind = MatchKind::default();
+        self.by_id.clear();
+        self.order.clear();
+        self.minimum_len = usize::MAX;
+        self.max_pattern_id = 0;
+    }
+
+    /// Return the maximum pattern identifier in this collection. This can be
+    /// useful in searchers for ensuring that the collection of patterns they
+    /// are provided at search time and at build time have the same size.
+    pub fn max_pattern_id(&self) -> PatternID {
+        assert_eq!((self.max_pattern_id + 1) as usize, self.len());
+        self.max_pattern_id
+    }
+
+    /// Returns the length, in bytes, of the smallest pattern.
+    ///
+    /// This is guaranteed to be at least one.
+    pub fn minimum_len(&self) -> usize {
+        self.minimum_len
+    }
+
+    /// Returns the match semantics used by these patterns.
+    pub fn match_kind(&self) -> &MatchKind {
+        &self.kind
+    }
+
+    /// Return the pattern with the given identifier. If such a pattern does
+    /// not exist, then this panics.
+    pub fn get(&self, id: PatternID) -> Pattern<'_> {
+        Pattern(&self.by_id[id as usize])
+    }
+
+    /// Return the pattern with the given identifier without performing bounds
+    /// checks.
+    ///
+    /// # Safety
+    ///
+    /// Callers must ensure that a pattern with the given identifier exists
+    /// before using this method.
+    #[cfg(target_arch = "x86_64")]
+    pub unsafe fn get_unchecked(&self, id: PatternID) -> Pattern<'_> {
+        Pattern(self.by_id.get_unchecked(id as usize))
+    }
+
+    /// Return an iterator over all the patterns in this collection, in the
+    /// order in which they should be matched.
+    ///
+    /// Specifically, in a naive multi-pattern matcher, the following is
+    /// guaranteed to satisfy the match semantics of this collection of
+    /// patterns:
+    ///
+    /// ```ignore
+    /// for i in 0..haystack.len():
+    ///   for p in patterns.iter():
+    ///     if haystack[i..].starts_with(p.bytes()):
+    ///       return Match(p.id(), i, i + p.bytes().len())
+    /// ```
+    ///
+    /// Namely, among the patterns in a collection, if they are matched in
+    /// the order provided by this iterator, then the result is guaranteed
+    /// to satisfy the correct match semantics. (Either leftmost-first or
+    /// leftmost-longest.)
+    pub fn iter(&self) -> PatternIter<'_> {
+        PatternIter { patterns: self, i: 0 }
+    }
+}
+
+/// An iterator over the patterns in the `Patterns` collection.
+///
+/// The order of the patterns provided by this iterator is consistent with the
+/// match semantics of the originating collection of patterns.
+///
+/// The lifetime `'p` corresponds to the lifetime of the collection of patterns
+/// this is iterating over.
+#[derive(Debug)]
+pub struct PatternIter<'p> {
+    patterns: &'p Patterns,
+    i: usize,
+}
+
+impl<'p> Iterator for PatternIter<'p> {
+    type Item = (PatternID, Pattern<'p>);
+
+    fn next(&mut self) -> Option<(PatternID, Pattern<'p>)> {
+        if self.i >= self.patterns.len() {
+            return None;
+        }
+        let id = self.patterns.order[self.i];
+        let p = self.patterns.get(id);
+        self.i += 1;
+        Some((id, p))
+    }
+}
+
+/// A pattern that is used in packed searching.
+#[derive(Clone)]
+pub struct Pattern<'a>(&'a [u8]);
+
+impl<'a> fmt::Debug for Pattern<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("Pattern")
+            .field("lit", &String::from_utf8_lossy(&self.0))
+            .finish()
+    }
+}
+
+impl<'p> Pattern<'p> {
+    /// Returns the length of this pattern, in bytes.
+    pub fn len(&self) -> usize {
+        self.0.len()
+    }
+
+    /// Returns the bytes of this pattern.
+    pub fn bytes(&self) -> &[u8] {
+        &self.0
+    }
+
+    /// Returns the first `len` low nybbles from this pattern. If this pattern
+    /// is shorter than `len`, then this panics.
+    #[cfg(target_arch = "x86_64")]
+    pub fn low_nybbles(&self, len: usize) -> Vec<u8> {
+        let mut nybs = vec![];
+        for &b in self.bytes().iter().take(len) {
+            nybs.push(b & 0xF);
+        }
+        nybs
+    }
+
+    /// Returns true if this pattern is a prefix of the given bytes.
+    #[inline(always)]
+    pub fn is_prefix(&self, bytes: &[u8]) -> bool {
+        self.len() <= bytes.len() && self.equals(&bytes[..self.len()])
+    }
+
+    /// Returns true if and only if this pattern equals the given bytes.
+    #[inline(always)]
+    pub fn equals(&self, bytes: &[u8]) -> bool {
+        // Why not just use memcmp for this? Well, memcmp requires calling out
+        // to libc, and this routine is called in fairly hot code paths. Other
+        // than just calling out to libc, it also seems to result in worse
+        // codegen. By rolling our own memcpy in pure Rust, it seems to appear
+        // more friendly to the optimizer.
+        //
+        // This results in an improvement in just about every benchmark. Some
+        // smaller than others, but in some cases, up to 30% faster.
+
+        if self.len() != bytes.len() {
+            return false;
+        }
+        if self.len() < 8 {
+            for (&b1, &b2) in self.bytes().iter().zip(bytes) {
+                if b1 != b2 {
+                    return false;
+                }
+            }
+            return true;
+        }
+        // When we have 8 or more bytes to compare, then proceed in chunks of
+        // 8 at a time using unaligned loads.
+        let mut p1 = self.bytes().as_ptr();
+        let mut p2 = bytes.as_ptr();
+        let p1end = self.bytes()[self.len() - 8..].as_ptr();
+        let p2end = bytes[bytes.len() - 8..].as_ptr();
+        // SAFETY: Via the conditional above, we know that both `p1` and `p2`
+        // have the same length, so `p1 < p1end` implies that `p2 < p2end`.
+        // Thus, derefencing both `p1` and `p2` in the loop below is safe.
+        //
+        // Moreover, we set `p1end` and `p2end` to be 8 bytes before the actual
+        // end of of `p1` and `p2`. Thus, the final dereference outside of the
+        // loop is guaranteed to be valid.
+        //
+        // Finally, we needn't worry about 64-bit alignment here, since we
+        // do unaligned loads.
+        unsafe {
+            while p1 < p1end {
+                let v1 = (p1 as *const u64).read_unaligned();
+                let v2 = (p2 as *const u64).read_unaligned();
+                if v1 != v2 {
+                    return false;
+                }
+                p1 = p1.add(8);
+                p2 = p2.add(8);
+            }
+            let v1 = (p1end as *const u64).read_unaligned();
+            let v2 = (p2end as *const u64).read_unaligned();
+            v1 == v2
+        }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/rabinkarp.rs b/android/vendor/aho-corasick-0.7.18/src/packed/rabinkarp.rs
new file mode 100644
index 0000000..fa6b1e3
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/rabinkarp.rs
@@ -0,0 +1,185 @@
+use std::mem;
+
+use crate::packed::pattern::{PatternID, Patterns};
+use crate::Match;
+
+/// The type of the rolling hash used in the Rabin-Karp algorithm.
+type Hash = usize;
+
+/// The number of buckets to store our patterns in. We don't want this to be
+/// too big in order to avoid wasting memory, but we don't want it to be too
+/// small either to avoid spending too much time confirming literals.
+///
+/// The number of buckets MUST be a power of two. Otherwise, determining the
+/// bucket from a hash will slow down the code considerably. Using a power
+/// of two means `hash % NUM_BUCKETS` can compile down to a simple `and`
+/// instruction.
+const NUM_BUCKETS: usize = 64;
+
+/// An implementation of the Rabin-Karp algorithm. The main idea of this
+/// algorithm is to maintain a rolling hash as it moves through the input, and
+/// then check whether that hash corresponds to the same hash for any of the
+/// patterns we're looking for.
+///
+/// A draw back of naively scaling Rabin-Karp to multiple patterns is that
+/// it requires all of the patterns to be the same length, which in turn
+/// corresponds to the number of bytes to hash. We adapt this to work for
+/// multiple patterns of varying size by fixing the number of bytes to hash
+/// to be the length of the smallest pattern. We also split the patterns into
+/// several buckets to hopefully make the confirmation step faster.
+///
+/// Wikipedia has a decent explanation, if a bit heavy on the theory:
+/// https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm
+///
+/// But ESMAJ provides something a bit more concrete:
+/// http://www-igm.univ-mlv.fr/~lecroq/string/node5.html
+#[derive(Clone, Debug)]
+pub struct RabinKarp {
+    /// The order of patterns in each bucket is significant. Namely, they are
+    /// arranged such that the first one to match is the correct match. This
+    /// may not necessarily correspond to the order provided by the caller.
+    /// For example, if leftmost-longest semantics are used, then the patterns
+    /// are sorted by their length in descending order. If leftmost-first
+    /// semantics are used, then the patterns are sorted by their pattern ID
+    /// in ascending order (which corresponds to the caller's order).
+    buckets: Vec<Vec<(Hash, PatternID)>>,
+    /// The length of the hashing window. Generally, this corresponds to the
+    /// length of the smallest pattern.
+    hash_len: usize,
+    /// The factor to subtract out of a hash before updating it with a new
+    /// byte.
+    hash_2pow: usize,
+    /// The maximum identifier of a pattern. This is used as a sanity check
+    /// to ensure that the patterns provided by the caller are the same as
+    /// the patterns that were used to compile the matcher. This sanity check
+    /// possibly permits safely eliminating bounds checks regardless of what
+    /// patterns are provided by the caller.
+    ///
+    /// (Currently, we don't use this to elide bounds checks since it doesn't
+    /// result in a measurable performance improvement, but we do use it for
+    /// better failure modes.)
+    max_pattern_id: PatternID,
+}
+
+impl RabinKarp {
+    /// Compile a new Rabin-Karp matcher from the patterns given.
+    ///
+    /// This panics if any of the patterns in the collection are empty, or if
+    /// the collection is itself empty.
+    pub fn new(patterns: &Patterns) -> RabinKarp {
+        assert!(patterns.len() >= 1);
+        let hash_len = patterns.minimum_len();
+        assert!(hash_len >= 1);
+
+        let mut hash_2pow = 1usize;
+        for _ in 1..hash_len {
+            hash_2pow = hash_2pow.wrapping_shl(1);
+        }
+
+        let mut rk = RabinKarp {
+            buckets: vec![vec![]; NUM_BUCKETS],
+            hash_len,
+            hash_2pow,
+            max_pattern_id: patterns.max_pattern_id(),
+        };
+        for (id, pat) in patterns.iter() {
+            let hash = rk.hash(&pat.bytes()[..rk.hash_len]);
+            let bucket = hash % NUM_BUCKETS;
+            rk.buckets[bucket].push((hash, id));
+        }
+        rk
+    }
+
+    /// Return the first matching pattern in the given haystack, begining the
+    /// search at `at`.
+    pub fn find_at(
+        &self,
+        patterns: &Patterns,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        assert_eq!(NUM_BUCKETS, self.buckets.len());
+        assert_eq!(
+            self.max_pattern_id,
+            patterns.max_pattern_id(),
+            "Rabin-Karp must be called with same patterns it was built with",
+        );
+
+        if at + self.hash_len > haystack.len() {
+            return None;
+        }
+        let mut hash = self.hash(&haystack[at..at + self.hash_len]);
+        loop {
+            let bucket = &self.buckets[hash % NUM_BUCKETS];
+            for &(phash, pid) in bucket {
+                if phash == hash {
+                    if let Some(c) = self.verify(patterns, pid, haystack, at) {
+                        return Some(c);
+                    }
+                }
+            }
+            if at + self.hash_len >= haystack.len() {
+                return None;
+            }
+            hash = self.update_hash(
+                hash,
+                haystack[at],
+                haystack[at + self.hash_len],
+            );
+            at += 1;
+        }
+    }
+
+    /// Returns the approximate total amount of heap used by this searcher, in
+    /// units of bytes.
+    pub fn heap_bytes(&self) -> usize {
+        let num_patterns = self.max_pattern_id as usize + 1;
+        self.buckets.len() * mem::size_of::<Vec<(Hash, PatternID)>>()
+            + num_patterns * mem::size_of::<(Hash, PatternID)>()
+    }
+
+    /// Verify whether the pattern with the given id matches at
+    /// `haystack[at..]`.
+    ///
+    /// We tag this function as `cold` because it helps improve codegen.
+    /// Intuitively, it would seem like inlining it would be better. However,
+    /// the only time this is called and a match is not found is when there
+    /// there is a hash collision, or when a prefix of a pattern matches but
+    /// the entire pattern doesn't match. This is hopefully fairly rare, and
+    /// if it does occur a lot, it's going to be slow no matter what we do.
+    #[cold]
+    fn verify(
+        &self,
+        patterns: &Patterns,
+        id: PatternID,
+        haystack: &[u8],
+        at: usize,
+    ) -> Option<Match> {
+        let pat = patterns.get(id);
+        if pat.is_prefix(&haystack[at..]) {
+            Some(Match::from_span(id as usize, at, at + pat.len()))
+        } else {
+            None
+        }
+    }
+
+    /// Hash the given bytes.
+    fn hash(&self, bytes: &[u8]) -> Hash {
+        assert_eq!(self.hash_len, bytes.len());
+
+        let mut hash = 0usize;
+        for &b in bytes {
+            hash = hash.wrapping_shl(1).wrapping_add(b as usize);
+        }
+        hash
+    }
+
+    /// Update the hash given based on removing `old_byte` at the beginning
+    /// of some byte string, and appending `new_byte` to the end of that same
+    /// byte string.
+    fn update_hash(&self, prev: Hash, old_byte: u8, new_byte: u8) -> Hash {
+        prev.wrapping_sub((old_byte as usize).wrapping_mul(self.hash_2pow))
+            .wrapping_shl(1)
+            .wrapping_add(new_byte as usize)
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/teddy/README.md b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/README.md
new file mode 100644
index 0000000..0c42383
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/README.md
@@ -0,0 +1,386 @@
+Teddy is a simd accelerated multiple substring matching algorithm. The name
+and the core ideas in the algorithm were learned from the [Hyperscan][1_u]
+project. The implementation in this repository was mostly motivated for use in
+accelerating regex searches by searching for small sets of required literals
+extracted from the regex.
+
+
+# Background
+
+The key idea of Teddy is to do *packed* substring matching. In the literature,
+packed substring matching is the idea of examining multiple bytes in a haystack
+at a time to detect matches. Implementations of, for example, memchr (which
+detects matches of a single byte) have been doing this for years. Only
+recently, with the introduction of various SIMD instructions, has this been
+extended to substring matching. The PCMPESTRI instruction (and its relatives),
+for example, implements substring matching in hardware. It is, however, limited
+to substrings of length 16 bytes or fewer, but this restriction is fine in a
+regex engine, since we rarely care about the performance difference between
+searching for a 16 byte literal and a 16 + N literal; 16 is already long
+enough. The key downside of the PCMPESTRI instruction, on current (2016) CPUs
+at least, is its latency and throughput. As a result, it is often faster to
+do substring search with a Boyer-Moore (or Two-Way) variant and a well placed
+memchr to quickly skip through the haystack.
+
+There are fewer results from the literature on packed substring matching,
+and even fewer for packed multiple substring matching. Ben-Kiki et al. [2]
+describes use of PCMPESTRI for substring matching, but is mostly theoretical
+and hand-waves performance. There is other theoretical work done by Bille [3]
+as well.
+
+The rest of the work in the field, as far as I'm aware, is by Faro and Kulekci
+and is generally focused on multiple pattern search. Their first paper [4a]
+introduces the concept of a fingerprint, which is computed for every block of
+N bytes in every pattern. The haystack is then scanned N bytes at a time and
+a fingerprint is computed in the same way it was computed for blocks in the
+patterns. If the fingerprint corresponds to one that was found in a pattern,
+then a verification step follows to confirm that one of the substrings with the
+corresponding fingerprint actually matches at the current location. Various
+implementation tricks are employed to make sure the fingerprint lookup is fast;
+typically by truncating the fingerprint. (This may, of course, provoke more
+steps in the verification process, so a balance must be struck.)
+
+The main downside of [4a] is that the minimum substring length is 32 bytes,
+presumably because of how the algorithm uses certain SIMD instructions. This
+essentially makes it useless for general purpose regex matching, where a small
+number of short patterns is far more likely.
+
+Faro and Kulekci published another paper [4b] that is conceptually very similar
+to [4a]. The key difference is that it uses the CRC32 instruction (introduced
+as part of SSE 4.2) to compute fingerprint values. This also enables the
+algorithm to work effectively on substrings as short as 7 bytes with 4 byte
+windows. 7 bytes is unfortunately still too long. The window could be
+technically shrunk to 2 bytes, thereby reducing minimum length to 3, but the
+small window size ends up negating most performance benefits—and it's likely
+the common case in a general purpose regex engine.
+
+Faro and Kulekci also published [4c] that appears to be intended as a
+replacement to using PCMPESTRI. In particular, it is specifically motivated by
+the high throughput/latency time of PCMPESTRI and therefore chooses other SIMD
+instructions that are faster. While this approach works for short substrings,
+I personally couldn't see a way to generalize it to multiple substring search.
+
+Faro and Kulekci have another paper [4d] that I haven't been able to read
+because it is behind a paywall.
+
+
+# Teddy
+
+Finally, we get to Teddy. If the above literature review is complete, then it
+appears that Teddy is a novel algorithm. More than that, in my experience, it
+completely blows away the competition for short substrings, which is exactly
+what we want in a general purpose regex engine. Again, the algorithm appears
+to be developed by the authors of [Hyperscan][1_u]. Hyperscan was open sourced
+late 2015, and no earlier history could be found. Therefore, tracking the exact
+provenance of the algorithm with respect to the published literature seems
+difficult.
+
+At a high level, Teddy works somewhat similarly to the fingerprint algorithms
+published by Faro and Kulekci, but Teddy does it in a way that scales a bit
+better. Namely:
+
+1. Teddy's core algorithm scans the haystack in 16 (for SSE, or 32 for AVX)
+   byte chunks. 16 (or 32) is significant because it corresponds to the number
+   of bytes in a SIMD vector.
+2. Bitwise operations are performed on each chunk to discover if any region of
+   it matches a set of precomputed fingerprints from the patterns. If there are
+   matches, then a verification step is performed. In this implementation, our
+   verification step is naive. This can be improved upon.
+
+The details to make this work are quite clever. First, we must choose how to
+pick our fingerprints. In Hyperscan's implementation, I *believe* they use the
+last N bytes of each substring, where N must be at least the minimum length of
+any substring in the set being searched. In this implementation, we use the
+first N bytes of each substring. (The tradeoffs between these choices aren't
+yet clear to me.) We then must figure out how to quickly test whether an
+occurrence of any fingerprint from the set of patterns appears in a 16 byte
+block from the haystack. To keep things simple, let's assume N = 1 and examine
+some examples to motivate the approach. Here are our patterns:
+
+```ignore
+foo
+bar
+baz
+```
+
+The corresponding fingerprints, for N = 1, are `f`, `b` and `b`. Now let's set
+our 16 byte block to:
+
+```ignore
+bat cat foo bump
+xxxxxxxxxxxxxxxx
+```
+
+To cut to the chase, Teddy works by using bitsets. In particular, Teddy creates
+a mask that allows us to quickly compute membership of a fingerprint in a 16
+byte block that also tells which pattern the fingerprint corresponds to. In
+this case, our fingerprint is a single byte, so an appropriate abstraction is
+a map from a single byte to a list of patterns that contain that fingerprint:
+
+```ignore
+f |--> foo
+b |--> bar, baz
+```
+
+Now, all we need to do is figure out how to represent this map in vector space
+and use normal SIMD operations to perform a lookup. The first simplification
+we can make is to represent our patterns as bit fields occupying a single
+byte. This is important, because a single SIMD vector can store 16 bytes.
+
+```ignore
+f |--> 00000001
+b |--> 00000010, 00000100
+```
+
+How do we perform lookup though? It turns out that SSSE3 introduced a very cool
+instruction called PSHUFB. The instruction takes two SIMD vectors, `A` and `B`,
+and returns a third vector `C`. All vectors are treated as 16 8-bit integers.
+`C` is formed by `C[i] = A[B[i]]`. (This is a bit of a simplification, but true
+for the purposes of this algorithm. For full details, see [Intel's Intrinsics
+Guide][5_u].) This essentially lets us use the values in `B` to lookup values
+in `A`.
+
+If we could somehow cause `B` to contain our 16 byte block from the haystack,
+and if `A` could contain our bitmasks, then we'd end up with something like
+this for `A`:
+
+```ignore
+    0x00 0x01 ... 0x62      ... 0x66      ... 0xFF
+A = 0    0        00000110      00000001      0
+```
+
+And if `B` contains our window from our haystack, we could use shuffle to take
+the values from `B` and use them to look up our bitsets in `A`. But of course,
+we can't do this because `A` in the above example contains 256 bytes, which
+is much larger than the size of a SIMD vector.
+
+Nybbles to the rescue! A nybble is 4 bits. Instead of one mask to hold all of
+our bitsets, we can use two masks, where one mask corresponds to the lower four
+bits of our fingerprint and the other mask corresponds to the upper four bits.
+So our map now looks like:
+
+```ignore
+'f' & 0xF = 0x6 |--> 00000001
+'f' >> 4  = 0x6 |--> 00000111
+'b' & 0xF = 0x2 |--> 00000110
+'b' >> 4  = 0x6 |--> 00000111
+```
+
+Notice that the bitsets for each nybble correspond to the union of all
+fingerprints that contain that nybble. For example, both `f` and `b` have the
+same upper 4 bits but differ on the lower 4 bits. Putting this together, we
+have `A0`, `A1` and `B`, where `A0` is our mask for the lower nybble, `A1` is
+our mask for the upper nybble and `B` is our 16 byte block from the haystack:
+
+```ignore
+      0x00 0x01 0x02      0x03 ... 0x06      ... 0xF
+A0 =  0    0    00000110  0        00000001      0
+A1 =  0    0    0         0        00000111      0
+B  =  b    a    t         _        t             p
+B  =  0x62 0x61 0x74      0x20     0x74          0x70
+```
+
+But of course, we can't use `B` with `PSHUFB` yet, since its values are 8 bits,
+and we need indexes that are at most 4 bits (corresponding to one of 16
+values). We can apply the same transformation to split `B` into lower and upper
+nybbles as we did `A`. As before, `B0` corresponds to the lower nybbles and
+`B1` corresponds to the upper nybbles:
+
+```ignore
+     b   a   t   _   c   a   t   _   f   o   o   _   b   u   m   p
+B0 = 0x2 0x1 0x4 0x0 0x3 0x1 0x4 0x0 0x6 0xF 0xF 0x0 0x2 0x5 0xD 0x0
+B1 = 0x6 0x6 0x7 0x2 0x6 0x6 0x7 0x2 0x6 0x6 0x6 0x2 0x6 0x7 0x6 0x7
+```
+
+And now we have a nice correspondence. `B0` can index `A0` and `B1` can index
+`A1`. Here's what we get when we apply `C0 = PSHUFB(A0, B0)`:
+
+```ignore
+     b         a        ... f         o         ... p
+     A0[0x2]   A0[0x1]      A0[0x6]   A0[0xF]       A0[0x0]
+C0 = 00000110  0            00000001  0             0
+```
+
+And `C1 = PSHUFB(A1, B1)`:
+
+```ignore
+     b         a        ... f         o        ... p
+     A1[0x6]   A1[0x6]      A1[0x6]   A1[0x6]      A1[0x7]
+C1 = 00000111  00000111     00000111  00000111     0
+```
+
+Notice how neither one of `C0` or `C1` is guaranteed to report fully correct
+results all on its own. For example, `C1` claims that `b` is a fingerprint for
+the pattern `foo` (since `A1[0x6] = 00000111`), and that `o` is a fingerprint
+for all of our patterns. But if we combined `C0` and `C1` with an `AND`
+operation:
+
+```ignore
+     b         a        ... f         o        ... p
+C  = 00000110  0            00000001  0            0
+```
+
+Then we now have that `C[i]` contains a bitset corresponding to the matching
+fingerprints in a haystack's 16 byte block, where `i` is the `ith` byte in that
+block.
+
+Once we have that, we can look for the position of the least significant bit
+in `C`. (Least significant because we only target `x86_64` here, which is
+always little endian. Thus, the least significant bytes correspond to bytes
+in our haystack at a lower address.) That position, modulo `8`, gives us
+the pattern that the fingerprint matches. That position, integer divided by
+`8`, also gives us the byte offset that the fingerprint occurs in inside the
+16 byte haystack block. Using those two pieces of information, we can run a
+verification procedure that tries to match all substrings containing that
+fingerprint at that position in the haystack.
+
+
+# Implementation notes
+
+The problem with the algorithm as described above is that it uses a single byte
+for a fingerprint. This will work well if the fingerprints are rare in the
+haystack (e.g., capital letters or special characters in normal English text),
+but if the fingerprints are common, you'll wind up spending too much time in
+the verification step, which effectively negates the performance benefits of
+scanning 16 bytes at a time. Remember, the key to the performance of this
+algorithm is to do as little work as possible per 16 (or 32) bytes.
+
+This algorithm can be extrapolated in a relatively straight-forward way to use
+larger fingerprints. That is, instead of a single byte prefix, we might use a
+two or three byte prefix. The implementation here implements N = {1, 2, 3}
+and always picks the largest N possible. The rationale is that the bigger the
+fingerprint, the fewer verification steps we'll do. Of course, if N is too
+large, then we'll end up doing too much on each step.
+
+The way to extend it is:
+
+1. Add a mask for each byte in the fingerprint. (Remember that each mask is
+   composed of two SIMD vectors.) This results in a value of `C` for each byte
+   in the fingerprint while searching.
+2. When testing each 16 (or 32) byte block, each value of `C` must be shifted
+   so that they are aligned. Once aligned, they should all be `AND`'d together.
+   This will give you only the bitsets corresponding to the full match of the
+   fingerprint. To do this, one needs to save the last byte (for N=2) or last
+   two bytes (for N=3) from the previous iteration, and then line them up with
+   the first one or two bytes of the next iteration.
+
+## Verification
+
+Verification generally follows the procedure outlined above. The tricky parts
+are in the right formulation of operations to get our bits out of our vectors.
+We have a limited set of operations available to us on SIMD vectors as 128-bit
+or 256-bit numbers, so we wind up needing to rip out 2 (or 4) 64-bit integers
+from our vectors, and then run our verification step on each of those. The
+verification step looks at the least significant bit set, and from its
+position, we can derive the byte offset and bucket. (Again, as described
+above.) Once we know the bucket, we do a fairly naive exhaustive search for
+every literal in that bucket. (Hyperscan is a bit smarter here and uses a hash
+table, but I haven't had time to thoroughly explore that. A few initial
+half-hearted attempts resulted in worse performance.)
+
+## AVX
+
+The AVX version of Teddy extrapolates almost perfectly from the SSE version.
+The only hickup is that PALIGNR is used to align chunks in the 16-bit version,
+and there is no equivalent instruction in AVX. AVX does have VPALIGNR, but it
+only works within 128-bit lanes. So there's a bit of tomfoolery to get around
+this by shuffling the vectors before calling VPALIGNR.
+
+The only other aspect to AVX is that since our masks are still fundamentally
+16-bytes (0x0-0xF), they are duplicated to 32-bytes, so that they can apply to
+32-byte chunks.
+
+## Fat Teddy
+
+In the version of Teddy described above, 8 buckets are used to group patterns
+that we want to search for. However, when AVX is available, we can extend the
+number of buckets to 16 by permitting each byte in our masks to use 16-bits
+instead of 8-bits to represent the buckets it belongs to. (This variant is also
+in Hyperscan.) However, what we give up is the ability to scan 32 bytes at a
+time, even though we're using AVX. Instead, we have to scan 16 bytes at a time.
+What we gain, though, is (hopefully) less work in our verification routine.
+It patterns are more spread out across more buckets, then there should overall
+be fewer false positives. In general, Fat Teddy permits us to grow our capacity
+a bit and search for more literals before Teddy gets overwhelmed.
+
+The tricky part of Fat Teddy is in how we adjust our masks and our verification
+procedure. For the masks, we simply represent the first 8 buckets in each of
+the low 16 bytes, and then the second 8 buckets in each of the high 16 bytes.
+Then, in the search loop, instead of loading 32 bytes from the haystack, we
+load the same 16 bytes from the haystack into both the low and high 16 byte
+portions of our 256-bit vector. So for example, a mask might look like this:
+
+    bits:   00100001 00000000 ... 11000000 00000000 00000001 ... 00000000
+    byte:      31       30           16       15       14            0
+    offset:    15       14           0        15       14            0
+    buckets:  8-15     8-15         8-15      0-7      0-7           0-7
+
+Where `byte` is the position in the vector (higher numbers corresponding to
+more significant bits), `offset` is the corresponding position in the haystack
+chunk, and `buckets` corresponds to the bucket assignments for that particular
+byte.
+
+In particular, notice that the bucket assignments for offset `0` are spread
+out between bytes `0` and `16`. This works well for the chunk-by-chunk search
+procedure, but verification really wants to process all bucket assignments for
+each offset at once. Otherwise, we might wind up finding a match at offset
+`1` in one the first 8 buckets, when we really should have reported a match
+at offset `0` in one of the second 8 buckets. (Because we want the leftmost
+match.)
+
+Thus, for verification, we rearrange the above vector such that it is a
+sequence of 16-bit integers, where the least significant 16-bit integer
+corresponds to all of the bucket assignments for offset `0`. So with the
+above vector, the least significant 16-bit integer would be
+
+    11000000 000000
+
+which was taken from bytes `16` and `0`. Then the verification step pretty much
+runs as described, except with 16 buckets instead of 8.
+
+
+# References
+
+- **[1]** [Hyperscan on GitHub](https://github.com/01org/hyperscan),
+    [webpage](https://01.org/hyperscan)
+- **[2a]** Ben-Kiki, O., Bille, P., Breslauer, D., Gasieniec, L., Grossi, R.,
+    & Weimann, O. (2011).
+    _Optimal packed string matching_.
+    In LIPIcs-Leibniz International Proceedings in Informatics (Vol. 13).
+    Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik.
+    DOI: 10.4230/LIPIcs.FSTTCS.2011.423.
+    [PDF](http://drops.dagstuhl.de/opus/volltexte/2011/3355/pdf/37.pdf).
+- **[2b]** Ben-Kiki, O., Bille, P., Breslauer, D., Ga̧sieniec, L., Grossi, R.,
+    & Weimann, O. (2014).
+    _Towards optimal packed string matching_.
+    Theoretical Computer Science, 525, 111-129.
+    DOI: 10.1016/j.tcs.2013.06.013.
+    [PDF](http://www.cs.haifa.ac.il/~oren/Publications/bpsm.pdf).
+- **[3]** Bille, P. (2011).
+    _Fast searching in packed strings_.
+    Journal of Discrete Algorithms, 9(1), 49-56.
+    DOI: 10.1016/j.jda.2010.09.003.
+    [PDF](http://www.sciencedirect.com/science/article/pii/S1570866710000353).
+- **[4a]** Faro, S., & Külekci, M. O. (2012, October).
+    _Fast multiple string matching using streaming SIMD extensions technology_.
+    In String Processing and Information Retrieval (pp. 217-228).
+    Springer Berlin Heidelberg.
+    DOI: 10.1007/978-3-642-34109-0_23.
+    [PDF](http://www.dmi.unict.it/~faro/papers/conference/faro32.pdf).
+- **[4b]** Faro, S., & Külekci, M. O. (2013, September).
+    _Towards a Very Fast Multiple String Matching Algorithm for Short Patterns_.
+    In Stringology (pp. 78-91).
+    [PDF](http://www.dmi.unict.it/~faro/papers/conference/faro36.pdf).
+- **[4c]** Faro, S., & Külekci, M. O. (2013, January).
+    _Fast packed string matching for short patterns_.
+    In Proceedings of the Meeting on Algorithm Engineering & Expermiments
+    (pp. 113-121).
+    Society for Industrial and Applied Mathematics.
+    [PDF](http://arxiv.org/pdf/1209.6449.pdf).
+- **[4d]** Faro, S., & Külekci, M. O. (2014).
+    _Fast and flexible packed string matching_.
+    Journal of Discrete Algorithms, 28, 61-72.
+    DOI: 10.1016/j.jda.2014.07.003.
+
+[1_u]: https://github.com/01org/hyperscan
+[5_u]: https://software.intel.com/sites/landingpage/IntrinsicsGuide
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/teddy/compile.rs b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/compile.rs
new file mode 100644
index 0000000..741cb69
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/compile.rs
@@ -0,0 +1,414 @@
+// See the README in this directory for an explanation of the Teddy algorithm.
+
+use std::cmp;
+use std::collections::BTreeMap;
+use std::fmt;
+
+use crate::packed::pattern::{PatternID, Patterns};
+use crate::packed::teddy::Teddy;
+
+/// A builder for constructing a Teddy matcher.
+///
+/// The builder primarily permits fine grained configuration of the Teddy
+/// matcher. Most options are made only available for testing/benchmarking
+/// purposes. In reality, options are automatically determined by the nature
+/// and number of patterns given to the builder.
+#[derive(Clone, Debug)]
+pub struct Builder {
+    /// When none, this is automatically determined. Otherwise, `false` means
+    /// slim Teddy is used (8 buckets) and `true` means fat Teddy is used
+    /// (16 buckets). Fat Teddy requires AVX2, so if that CPU feature isn't
+    /// available and Fat Teddy was requested, no matcher will be built.
+    fat: Option<bool>,
+    /// When none, this is automatically determined. Otherwise, `false` means
+    /// that 128-bit vectors will be used (up to SSSE3 instructions) where as
+    /// `true` means that 256-bit vectors will be used. As with `fat`, if
+    /// 256-bit vectors are requested and they aren't available, then a
+    /// searcher will not be built.
+    avx: Option<bool>,
+}
+
+impl Default for Builder {
+    fn default() -> Builder {
+        Builder::new()
+    }
+}
+
+impl Builder {
+    /// Create a new builder for configuring a Teddy matcher.
+    pub fn new() -> Builder {
+        Builder { fat: None, avx: None }
+    }
+
+    /// Build a matcher for the set of patterns given. If a matcher could not
+    /// be built, then `None` is returned.
+    ///
+    /// Generally, a matcher isn't built if the necessary CPU features aren't
+    /// available, an unsupported target or if the searcher is believed to be
+    /// slower than standard techniques (i.e., if there are too many literals).
+    pub fn build(&self, patterns: &Patterns) -> Option<Teddy> {
+        self.build_imp(patterns)
+    }
+
+    /// Require the use of Fat (true) or Slim (false) Teddy. Fat Teddy uses
+    /// 16 buckets where as Slim Teddy uses 8 buckets. More buckets are useful
+    /// for a larger set of literals.
+    ///
+    /// `None` is the default, which results in an automatic selection based
+    /// on the number of literals and available CPU features.
+    pub fn fat(&mut self, yes: Option<bool>) -> &mut Builder {
+        self.fat = yes;
+        self
+    }
+
+    /// Request the use of 256-bit vectors (true) or 128-bit vectors (false).
+    /// Generally, a larger vector size is better since it either permits
+    /// matching more patterns or matching more bytes in the haystack at once.
+    ///
+    /// `None` is the default, which results in an automatic selection based on
+    /// the number of literals and available CPU features.
+    pub fn avx(&mut self, yes: Option<bool>) -> &mut Builder {
+        self.avx = yes;
+        self
+    }
+
+    fn build_imp(&self, patterns: &Patterns) -> Option<Teddy> {
+        use crate::packed::teddy::runtime;
+
+        // Most of the logic here is just about selecting the optimal settings,
+        // or perhaps even rejecting construction altogether. The choices
+        // we have are: fat (avx only) or not, ssse3 or avx2, and how many
+        // patterns we allow ourselves to search. Additionally, for testing
+        // and benchmarking, we permit callers to try to "force" a setting,
+        // and if the setting isn't allowed (e.g., forcing AVX when AVX isn't
+        // available), then we bail and return nothing.
+
+        if patterns.len() > 64 {
+            return None;
+        }
+        let has_ssse3 = is_x86_feature_detected!("ssse3");
+        let has_avx = is_x86_feature_detected!("avx2");
+        let avx = if self.avx == Some(true) {
+            if !has_avx {
+                return None;
+            }
+            true
+        } else if self.avx == Some(false) {
+            if !has_ssse3 {
+                return None;
+            }
+            false
+        } else if !has_ssse3 && !has_avx {
+            return None;
+        } else {
+            has_avx
+        };
+        let fat = match self.fat {
+            None => avx && patterns.len() > 32,
+            Some(false) => false,
+            Some(true) if !avx => return None,
+            Some(true) => true,
+        };
+
+        let mut compiler = Compiler::new(patterns, fat);
+        compiler.compile();
+        let Compiler { buckets, masks, .. } = compiler;
+        // SAFETY: It is required that the builder only produce Teddy matchers
+        // that are allowed to run on the current CPU, since we later assume
+        // that the presence of (for example) TeddySlim1Mask256 means it is
+        // safe to call functions marked with the `avx2` target feature.
+        match (masks.len(), avx, fat) {
+            (1, false, _) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddySlim1Mask128(
+                    runtime::TeddySlim1Mask128 {
+                        mask1: runtime::Mask128::new(masks[0]),
+                    },
+                ),
+            }),
+            (1, true, false) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddySlim1Mask256(
+                    runtime::TeddySlim1Mask256 {
+                        mask1: runtime::Mask256::new(masks[0]),
+                    },
+                ),
+            }),
+            (1, true, true) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddyFat1Mask256(
+                    runtime::TeddyFat1Mask256 {
+                        mask1: runtime::Mask256::new(masks[0]),
+                    },
+                ),
+            }),
+            (2, false, _) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddySlim2Mask128(
+                    runtime::TeddySlim2Mask128 {
+                        mask1: runtime::Mask128::new(masks[0]),
+                        mask2: runtime::Mask128::new(masks[1]),
+                    },
+                ),
+            }),
+            (2, true, false) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddySlim2Mask256(
+                    runtime::TeddySlim2Mask256 {
+                        mask1: runtime::Mask256::new(masks[0]),
+                        mask2: runtime::Mask256::new(masks[1]),
+                    },
+                ),
+            }),
+            (2, true, true) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddyFat2Mask256(
+                    runtime::TeddyFat2Mask256 {
+                        mask1: runtime::Mask256::new(masks[0]),
+                        mask2: runtime::Mask256::new(masks[1]),
+                    },
+                ),
+            }),
+            (3, false, _) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddySlim3Mask128(
+                    runtime::TeddySlim3Mask128 {
+                        mask1: runtime::Mask128::new(masks[0]),
+                        mask2: runtime::Mask128::new(masks[1]),
+                        mask3: runtime::Mask128::new(masks[2]),
+                    },
+                ),
+            }),
+            (3, true, false) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddySlim3Mask256(
+                    runtime::TeddySlim3Mask256 {
+                        mask1: runtime::Mask256::new(masks[0]),
+                        mask2: runtime::Mask256::new(masks[1]),
+                        mask3: runtime::Mask256::new(masks[2]),
+                    },
+                ),
+            }),
+            (3, true, true) => Some(Teddy {
+                buckets,
+                max_pattern_id: patterns.max_pattern_id(),
+                exec: runtime::Exec::TeddyFat3Mask256(
+                    runtime::TeddyFat3Mask256 {
+                        mask1: runtime::Mask256::new(masks[0]),
+                        mask2: runtime::Mask256::new(masks[1]),
+                        mask3: runtime::Mask256::new(masks[2]),
+                    },
+                ),
+            }),
+            _ => unreachable!(),
+        }
+    }
+}
+
+/// A compiler is in charge of allocating patterns into buckets and generating
+/// the masks necessary for searching.
+#[derive(Clone)]
+struct Compiler<'p> {
+    patterns: &'p Patterns,
+    buckets: Vec<Vec<PatternID>>,
+    masks: Vec<Mask>,
+}
+
+impl<'p> Compiler<'p> {
+    /// Create a new Teddy compiler for the given patterns. If `fat` is true,
+    /// then 16 buckets will be used instead of 8.
+    ///
+    /// This panics if any of the patterns given are empty.
+    fn new(patterns: &'p Patterns, fat: bool) -> Compiler<'p> {
+        let mask_len = cmp::min(3, patterns.minimum_len());
+        assert!(1 <= mask_len && mask_len <= 3);
+
+        Compiler {
+            patterns,
+            buckets: vec![vec![]; if fat { 16 } else { 8 }],
+            masks: vec![Mask::default(); mask_len],
+        }
+    }
+
+    /// Compile the patterns in this compiler into buckets and masks.
+    fn compile(&mut self) {
+        let mut lonibble_to_bucket: BTreeMap<Vec<u8>, usize> = BTreeMap::new();
+        for (id, pattern) in self.patterns.iter() {
+            // We try to be slightly clever in how we assign patterns into
+            // buckets. Generally speaking, we want patterns with the same
+            // prefix to be in the same bucket, since it minimizes the amount
+            // of time we spend churning through buckets in the verification
+            // step.
+            //
+            // So we could assign patterns with the same N-prefix (where N
+            // is the size of the mask, which is one of {1, 2, 3}) to the
+            // same bucket. However, case insensitive searches are fairly
+            // common, so we'd for example, ideally want to treat `abc` and
+            // `ABC` as if they shared the same prefix. ASCII has the nice
+            // property that the lower 4 bits of A and a are the same, so we
+            // therefore group patterns with the same low-nybbe-N-prefix into
+            // the same bucket.
+            //
+            // MOREOVER, this is actually necessary for correctness! In
+            // particular, by grouping patterns with the same prefix into the
+            // same bucket, we ensure that we preserve correct leftmost-first
+            // and leftmost-longest match semantics. In addition to the fact
+            // that `patterns.iter()` iterates in the correct order, this
+            // guarantees that all possible ambiguous matches will occur in
+            // the same bucket. The verification routine could be adjusted to
+            // support correct leftmost match semantics regardless of bucket
+            // allocation, but that results in a performance hit. It's much
+            // nicer to be able to just stop as soon as a match is found.
+            let lonybs = pattern.low_nybbles(self.masks.len());
+            if let Some(&bucket) = lonibble_to_bucket.get(&lonybs) {
+                self.buckets[bucket].push(id);
+            } else {
+                // N.B. We assign buckets in reverse because it shouldn't have
+                // any influence on performance, but it does make it harder to
+                // get leftmost match semantics accidentally correct.
+                let bucket = (self.buckets.len() - 1)
+                    - (id as usize % self.buckets.len());
+                self.buckets[bucket].push(id);
+                lonibble_to_bucket.insert(lonybs, bucket);
+            }
+        }
+        for (bucket_index, bucket) in self.buckets.iter().enumerate() {
+            for &pat_id in bucket {
+                let pat = self.patterns.get(pat_id);
+                for (i, mask) in self.masks.iter_mut().enumerate() {
+                    if self.buckets.len() == 8 {
+                        mask.add_slim(bucket_index as u8, pat.bytes()[i]);
+                    } else {
+                        mask.add_fat(bucket_index as u8, pat.bytes()[i]);
+                    }
+                }
+            }
+        }
+    }
+}
+
+impl<'p> fmt::Debug for Compiler<'p> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut buckets = vec![vec![]; self.buckets.len()];
+        for (i, bucket) in self.buckets.iter().enumerate() {
+            for &patid in bucket {
+                buckets[i].push(self.patterns.get(patid));
+            }
+        }
+        f.debug_struct("Compiler")
+            .field("buckets", &buckets)
+            .field("masks", &self.masks)
+            .finish()
+    }
+}
+
+/// Mask represents the low and high nybble masks that will be used during
+/// search. Each mask is 32 bytes wide, although only the first 16 bytes are
+/// used for the SSSE3 runtime.
+///
+/// Each byte in the mask corresponds to a 8-bit bitset, where bit `i` is set
+/// if and only if the corresponding nybble is in the ith bucket. The index of
+/// the byte (0-15, inclusive) corresponds to the nybble.
+///
+/// Each mask is used as the target of a shuffle, where the indices for the
+/// shuffle are taken from the haystack. AND'ing the shuffles for both the
+/// low and high masks together also results in 8-bit bitsets, but where bit
+/// `i` is set if and only if the correspond *byte* is in the ith bucket.
+///
+/// During compilation, masks are just arrays. But during search, these masks
+/// are represented as 128-bit or 256-bit vectors.
+///
+/// (See the README is this directory for more details.)
+#[derive(Clone, Copy, Default)]
+pub struct Mask {
+    lo: [u8; 32],
+    hi: [u8; 32],
+}
+
+impl Mask {
+    /// Update this mask by adding the given byte to the given bucket. The
+    /// given bucket must be in the range 0-7.
+    ///
+    /// This is for "slim" Teddy, where there are only 8 buckets.
+    fn add_slim(&mut self, bucket: u8, byte: u8) {
+        assert!(bucket < 8);
+
+        let byte_lo = (byte & 0xF) as usize;
+        let byte_hi = ((byte >> 4) & 0xF) as usize;
+        // When using 256-bit vectors, we need to set this bucket assignment in
+        // the low and high 128-bit portions of the mask. This allows us to
+        // process 32 bytes at a time. Namely, AVX2 shuffles operate on each
+        // of the 128-bit lanes, rather than the full 256-bit vector at once.
+        self.lo[byte_lo] |= 1 << bucket;
+        self.lo[byte_lo + 16] |= 1 << bucket;
+        self.hi[byte_hi] |= 1 << bucket;
+        self.hi[byte_hi + 16] |= 1 << bucket;
+    }
+
+    /// Update this mask by adding the given byte to the given bucket. The
+    /// given bucket must be in the range 0-15.
+    ///
+    /// This is for "fat" Teddy, where there are 16 buckets.
+    fn add_fat(&mut self, bucket: u8, byte: u8) {
+        assert!(bucket < 16);
+
+        let byte_lo = (byte & 0xF) as usize;
+        let byte_hi = ((byte >> 4) & 0xF) as usize;
+        // Unlike slim teddy, fat teddy only works with AVX2. For fat teddy,
+        // the high 128 bits of our mask correspond to buckets 8-15, while the
+        // low 128 bits correspond to buckets 0-7.
+        if bucket < 8 {
+            self.lo[byte_lo] |= 1 << bucket;
+            self.hi[byte_hi] |= 1 << bucket;
+        } else {
+            self.lo[byte_lo + 16] |= 1 << (bucket % 8);
+            self.hi[byte_hi + 16] |= 1 << (bucket % 8);
+        }
+    }
+
+    /// Return the low 128 bits of the low-nybble mask.
+    pub fn lo128(&self) -> [u8; 16] {
+        let mut tmp = [0; 16];
+        tmp.copy_from_slice(&self.lo[..16]);
+        tmp
+    }
+
+    /// Return the full low-nybble mask.
+    pub fn lo256(&self) -> [u8; 32] {
+        self.lo
+    }
+
+    /// Return the low 128 bits of the high-nybble mask.
+    pub fn hi128(&self) -> [u8; 16] {
+        let mut tmp = [0; 16];
+        tmp.copy_from_slice(&self.hi[..16]);
+        tmp
+    }
+
+    /// Return the full high-nybble mask.
+    pub fn hi256(&self) -> [u8; 32] {
+        self.hi
+    }
+}
+
+impl fmt::Debug for Mask {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let (mut parts_lo, mut parts_hi) = (vec![], vec![]);
+        for i in 0..32 {
+            parts_lo.push(format!("{:02}: {:08b}", i, self.lo[i]));
+            parts_hi.push(format!("{:02}: {:08b}", i, self.hi[i]));
+        }
+        f.debug_struct("Mask")
+            .field("lo", &parts_lo)
+            .field("hi", &parts_hi)
+            .finish()
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/teddy/mod.rs b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/mod.rs
new file mode 100644
index 0000000..3268cdf
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/mod.rs
@@ -0,0 +1,62 @@
+#[cfg(target_arch = "x86_64")]
+pub use crate::packed::teddy::compile::Builder;
+#[cfg(not(target_arch = "x86_64"))]
+pub use crate::packed::teddy::fallback::Builder;
+#[cfg(not(target_arch = "x86_64"))]
+pub use crate::packed::teddy::fallback::Teddy;
+#[cfg(target_arch = "x86_64")]
+pub use crate::packed::teddy::runtime::Teddy;
+
+#[cfg(target_arch = "x86_64")]
+mod compile;
+#[cfg(target_arch = "x86_64")]
+mod runtime;
+
+#[cfg(not(target_arch = "x86_64"))]
+mod fallback {
+    use crate::packed::pattern::Patterns;
+    use crate::Match;
+
+    #[derive(Clone, Debug, Default)]
+    pub struct Builder(());
+
+    impl Builder {
+        pub fn new() -> Builder {
+            Builder(())
+        }
+
+        pub fn build(&self, _: &Patterns) -> Option<Teddy> {
+            None
+        }
+
+        pub fn fat(&mut self, _: Option<bool>) -> &mut Builder {
+            self
+        }
+
+        pub fn avx(&mut self, _: Option<bool>) -> &mut Builder {
+            self
+        }
+    }
+
+    #[derive(Clone, Debug)]
+    pub struct Teddy(());
+
+    impl Teddy {
+        pub fn find_at(
+            &self,
+            _: &Patterns,
+            _: &[u8],
+            _: usize,
+        ) -> Option<Match> {
+            None
+        }
+
+        pub fn minimum_len(&self) -> usize {
+            0
+        }
+
+        pub fn heap_bytes(&self) -> usize {
+            0
+        }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/teddy/runtime.rs b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/runtime.rs
new file mode 100644
index 0000000..0d96913
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/teddy/runtime.rs
@@ -0,0 +1,1204 @@
+// See the README in this directory for an explanation of the Teddy algorithm.
+// It is strongly recommended to peruse the README before trying to grok this
+// code, as its use of SIMD is pretty opaque, although I tried to add comments
+// where appropriate.
+//
+// Moreover, while there is a lot of code in this file, most of it is
+// repeated variants of the same thing. Specifically, there are three Teddy
+// variants: Slim 128-bit Teddy (8 buckets), Slim 256-bit Teddy (8 buckets)
+// and Fat 256-bit Teddy (16 buckets). For each variant, there are three
+// implementations, corresponding to mask lengths of 1, 2 and 3. Bringing it to
+// a total of nine variants. Each one is structured roughly the same:
+//
+//     while at <= len(haystack) - CHUNK_SIZE:
+//         let candidate = find_candidate_in_chunk(haystack, at)
+//         if not all zeroes(candidate):
+//             if match = verify(haystack, at, candidate):
+//                 return match
+//
+// For the most part, this remains unchanged. The parts that vary are the
+// verification routine (for slim vs fat Teddy) and the candidate extraction
+// (based on the number of masks).
+//
+// In the code below, a "candidate" corresponds to a single vector with 8-bit
+// lanes. Each lane is itself an 8-bit bitset, where the ith bit is set in the
+// jth lane if and only if the byte occurring at position `j` is in the
+// bucket `i` (where the `j`th position is the position in the current window
+// of the haystack, which is always 16 or 32 bytes). Note to be careful here:
+// the ith bit and the jth lane correspond to the least significant bits of the
+// vector. So when visualizing how the current window of bytes is stored in a
+// vector, you often need to flip it around. For example, the text `abcd` in a
+// 4-byte vector would look like this:
+//
+//     01100100 01100011 01100010 01100001
+//         d        c        b        a
+//
+// When the mask length is 1, then finding the candidate is pretty straight
+// forward: you just apply the shuffle indices (from the haystack window) to
+// the masks, and then AND them together, as described in the README. But for
+// masks of length 2 and 3, you need to keep a little state. Specifically,
+// you need to store the final 1 (for mask length 2) or 2 (for mask length 3)
+// bytes of the candidate for use when searching the next window. This is for
+// handling matches that span two windows.
+//
+// With respect to the repeated code, it would likely be possible to reduce
+// the number of copies of code below using polymorphism, but I find this
+// formulation clearer instead of needing to reason through generics. However,
+// I admit, there may be a simpler generic construction that I'm missing.
+//
+// All variants are fairly heavily tested in src/packed/tests.rs.
+
+use std::arch::x86_64::*;
+use std::mem;
+
+use crate::packed::pattern::{PatternID, Patterns};
+use crate::packed::teddy::compile;
+use crate::packed::vector::*;
+use crate::Match;
+
+/// The Teddy runtime.
+///
+/// A Teddy runtime can be used to quickly search for occurrences of one or
+/// more patterns. While it does not scale to an arbitrary number of patterns
+/// like Aho-Corasick, it does find occurrences for a small set of patterns
+/// much more quickly than Aho-Corasick.
+///
+/// Teddy cannot run on small haystacks below a certain size, which is
+/// dependent on the type of matcher used. This size can be queried via the
+/// `minimum_len` method. Violating this will result in a panic.
+///
+/// Finally, when callers use a Teddy runtime, they must provide precisely the
+/// patterns used to construct the Teddy matcher. Violating this will result
+/// in either a panic or incorrect results, but will never sacrifice memory
+/// safety.
+#[derive(Clone, Debug)]
+pub struct Teddy {
+    /// The allocation of patterns in buckets. This only contains the IDs of
+    /// patterns. In order to do full verification, callers must provide the
+    /// actual patterns when using Teddy.
+    pub buckets: Vec<Vec<PatternID>>,
+    /// The maximum identifier of a pattern. This is used as a sanity check to
+    /// ensure that the patterns provided by the caller are the same as the
+    /// patterns that were used to compile the matcher. This sanity check
+    /// permits safely eliminating bounds checks regardless of what patterns
+    /// are provided by the caller.
+    ///
+    /// Note that users of the aho-corasick crate cannot get this wrong. Only
+    /// code internal to this crate can get it wrong, since neither `Patterns`
+    /// type nor the Teddy runtime are public API items.
+    pub max_pattern_id: PatternID,
+    /// The actual runtime to use.
+    pub exec: Exec,
+}
+
+impl Teddy {
+    /// Return the first occurrence of a match in the given haystack after or
+    /// starting at `at`.
+    ///
+    /// The patterns provided must be precisely the same patterns given to the
+    /// Teddy builder, otherwise this may panic or produce incorrect results.
+    ///
+    /// All matches are consistent with the match semantics (leftmost-first or
+    /// leftmost-longest) set on `pats`.
+    pub fn find_at(
+        &self,
+        pats: &Patterns,
+        haystack: &[u8],
+        at: usize,
+    ) -> Option<Match> {
+        // This assert is a bit subtle, but it's an important guarantee.
+        // Namely, if the maximum pattern ID seen by Teddy is the same as the
+        // one in the patterns given, then we are guaranteed that every pattern
+        // ID in all Teddy buckets are valid indices into `pats`. While this
+        // is nominally true, there is no guarantee that callers provide the
+        // same `pats` to both the Teddy builder and the searcher, which would
+        // otherwise make `find_at` unsafe to call. But this assert lets us
+        // keep this routine safe and eliminate an important bounds check in
+        // verification.
+        assert_eq!(
+            self.max_pattern_id,
+            pats.max_pattern_id(),
+            "teddy must be called with same patterns it was built with",
+        );
+        // SAFETY: The haystack must have at least a minimum number of bytes
+        // for Teddy to be able to work. The minimum number varies depending on
+        // which matcher is used below. If this is violated, then it's possible
+        // for searching to do out-of-bounds writes.
+        assert!(haystack[at..].len() >= self.minimum_len());
+        // SAFETY: The various Teddy matchers are always safe to call because
+        // the Teddy builder guarantees that a particular Exec variant is
+        // built only when it can be run the current CPU. That is, the Teddy
+        // builder will not produce a Exec::TeddySlim1Mask256 unless AVX2 is
+        // enabled. That is, our dynamic CPU feature detection is performed
+        // once in the builder, and we rely on the type system to avoid needing
+        // to do it again.
+        unsafe {
+            match self.exec {
+                Exec::TeddySlim1Mask128(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddySlim1Mask256(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddyFat1Mask256(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddySlim2Mask128(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddySlim2Mask256(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddyFat2Mask256(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddySlim3Mask128(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddySlim3Mask256(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+                Exec::TeddyFat3Mask256(ref e) => {
+                    e.find_at(pats, self, haystack, at)
+                }
+            }
+        }
+    }
+
+    /// Returns the minimum length of a haystack that must be provided by
+    /// callers to this Teddy searcher. Providing a haystack shorter than this
+    /// will result in a panic, but will never violate memory safety.
+    pub fn minimum_len(&self) -> usize {
+        // SAFETY: These values must be correct in order to ensure safety.
+        // The Teddy runtime assumes their haystacks have at least these
+        // lengths. Violating this will sacrifice memory safety.
+        match self.exec {
+            Exec::TeddySlim1Mask128(_) => 16,
+            Exec::TeddySlim1Mask256(_) => 32,
+            Exec::TeddyFat1Mask256(_) => 16,
+            Exec::TeddySlim2Mask128(_) => 17,
+            Exec::TeddySlim2Mask256(_) => 33,
+            Exec::TeddyFat2Mask256(_) => 17,
+            Exec::TeddySlim3Mask128(_) => 18,
+            Exec::TeddySlim3Mask256(_) => 34,
+            Exec::TeddyFat3Mask256(_) => 34,
+        }
+    }
+
+    /// Returns the approximate total amount of heap used by this searcher, in
+    /// units of bytes.
+    pub fn heap_bytes(&self) -> usize {
+        let num_patterns = self.max_pattern_id as usize + 1;
+        self.buckets.len() * mem::size_of::<Vec<PatternID>>()
+            + num_patterns * mem::size_of::<PatternID>()
+    }
+
+    /// Runs the verification routine for Slim 128-bit Teddy.
+    ///
+    /// The candidate given should be a collection of 8-bit bitsets (one bitset
+    /// per lane), where the ith bit is set in the jth lane if and only if the
+    /// byte occurring at `at + j` in `haystack` is in the bucket `i`.
+    ///
+    /// This is not safe to call unless the SSSE3 target feature is enabled.
+    /// The `target_feature` attribute is not applied since this function is
+    /// always forcefully inlined.
+    #[inline(always)]
+    unsafe fn verify128(
+        &self,
+        pats: &Patterns,
+        haystack: &[u8],
+        at: usize,
+        cand: __m128i,
+    ) -> Option<Match> {
+        debug_assert!(!is_all_zeroes128(cand));
+        debug_assert_eq!(8, self.buckets.len());
+
+        // Convert the candidate into 64-bit chunks, and then verify each of
+        // those chunks.
+        let parts = unpack64x128(cand);
+        for (i, &part) in parts.iter().enumerate() {
+            let pos = at + i * 8;
+            if let Some(m) = self.verify64(pats, 8, haystack, pos, part) {
+                return Some(m);
+            }
+        }
+        None
+    }
+
+    /// Runs the verification routine for Slim 256-bit Teddy.
+    ///
+    /// The candidate given should be a collection of 8-bit bitsets (one bitset
+    /// per lane), where the ith bit is set in the jth lane if and only if the
+    /// byte occurring at `at + j` in `haystack` is in the bucket `i`.
+    ///
+    /// This is not safe to call unless the AVX2 target feature is enabled.
+    /// The `target_feature` attribute is not applied since this function is
+    /// always forcefully inlined.
+    #[inline(always)]
+    unsafe fn verify256(
+        &self,
+        pats: &Patterns,
+        haystack: &[u8],
+        at: usize,
+        cand: __m256i,
+    ) -> Option<Match> {
+        debug_assert!(!is_all_zeroes256(cand));
+        debug_assert_eq!(8, self.buckets.len());
+
+        // Convert the candidate into 64-bit chunks, and then verify each of
+        // those chunks.
+        let parts = unpack64x256(cand);
+        for (i, &part) in parts.iter().enumerate() {
+            let pos = at + i * 8;
+            if let Some(m) = self.verify64(pats, 8, haystack, pos, part) {
+                return Some(m);
+            }
+        }
+        None
+    }
+
+    /// Runs the verification routine for Fat 256-bit Teddy.
+    ///
+    /// The candidate given should be a collection of 8-bit bitsets (one bitset
+    /// per lane), where the ith bit is set in the jth lane if and only if the
+    /// byte occurring at `at + (j < 16 ? j : j - 16)` in `haystack` is in the
+    /// bucket `j < 16 ? i : i + 8`.
+    ///
+    /// This is not safe to call unless the AVX2 target feature is enabled.
+    /// The `target_feature` attribute is not applied since this function is
+    /// always forcefully inlined.
+    #[inline(always)]
+    unsafe fn verify_fat256(
+        &self,
+        pats: &Patterns,
+        haystack: &[u8],
+        at: usize,
+        cand: __m256i,
+    ) -> Option<Match> {
+        debug_assert!(!is_all_zeroes256(cand));
+        debug_assert_eq!(16, self.buckets.len());
+
+        // This is a bit tricky, but we basically want to convert our
+        // candidate, which looks like this
+        //
+        //     a31 a30 ... a17 a16 a15 a14 ... a01 a00
+        //
+        // where each a(i) is an 8-bit bitset corresponding to the activated
+        // buckets, to this
+        //
+        //     a31 a15 a30 a14 a29 a13 ... a18 a02 a17 a01 a16 a00
+        //
+        // Namely, for Fat Teddy, the high 128-bits of the candidate correspond
+        // to the same bytes in the haystack in the low 128-bits (so we only
+        // scan 16 bytes at a time), but are for buckets 8-15 instead of 0-7.
+        //
+        // The verification routine wants to look at all potentially matching
+        // buckets before moving on to the next lane. So for example, both
+        // a16 and a00 both correspond to the first byte in our window; a00
+        // contains buckets 0-7 and a16 contains buckets 8-15. Specifically,
+        // a16 should be checked before a01. So the transformation shown above
+        // allows us to use our normal verification procedure with one small
+        // change: we treat each bitset as 16 bits instead of 8 bits.
+
+        // Swap the 128-bit lanes in the candidate vector.
+        let swap = _mm256_permute4x64_epi64(cand, 0x4E);
+        // Interleave the bytes from the low 128-bit lanes, starting with
+        // cand first.
+        let r1 = _mm256_unpacklo_epi8(cand, swap);
+        // Interleave the bytes from the high 128-bit lanes, starting with
+        // cand first.
+        let r2 = _mm256_unpackhi_epi8(cand, swap);
+        // Now just take the 2 low 64-bit integers from both r1 and r2. We
+        // can drop the high 64-bit integers because they are a mirror image
+        // of the low 64-bit integers. All we care about are the low 128-bit
+        // lanes of r1 and r2. Combined, they contain all our 16-bit bitsets
+        // laid out in the desired order, as described above.
+        let parts = unpacklo64x256(r1, r2);
+        for (i, &part) in parts.iter().enumerate() {
+            let pos = at + i * 4;
+            if let Some(m) = self.verify64(pats, 16, haystack, pos, part) {
+                return Some(m);
+            }
+        }
+        None
+    }
+
+    /// Verify whether there are any matches starting at or after `at` in the
+    /// given `haystack`. The candidate given should correspond to either 8-bit
+    /// (for 8 buckets) or 16-bit (16 buckets) bitsets.
+    #[inline(always)]
+    fn verify64(
+        &self,
+        pats: &Patterns,
+        bucket_count: usize,
+        haystack: &[u8],
+        at: usize,
+        mut cand: u64,
+    ) -> Option<Match> {
+        // N.B. While the bucket count is known from self.buckets.len(),
+        // requiring it as a parameter makes it easier for the optimizer to
+        // know its value, and thus produce more efficient codegen.
+        debug_assert!(bucket_count == 8 || bucket_count == 16);
+        while cand != 0 {
+            let bit = cand.trailing_zeros() as usize;
+            cand &= !(1 << bit);
+
+            let at = at + (bit / bucket_count);
+            let bucket = bit % bucket_count;
+            if let Some(m) = self.verify_bucket(pats, haystack, bucket, at) {
+                return Some(m);
+            }
+        }
+        None
+    }
+
+    /// Verify whether there are any matches starting at `at` in the given
+    /// `haystack` corresponding only to patterns in the given bucket.
+    #[inline(always)]
+    fn verify_bucket(
+        &self,
+        pats: &Patterns,
+        haystack: &[u8],
+        bucket: usize,
+        at: usize,
+    ) -> Option<Match> {
+        // Forcing this function to not inline and be "cold" seems to help
+        // the codegen for Teddy overall. Interestingly, this is good for a
+        // 16% boost in the sherlock/packed/teddy/name/alt1 benchmark (among
+        // others). Overall, this seems like a problem with codegen, since
+        // creating the Match itself is a very small amount of code.
+        #[cold]
+        #[inline(never)]
+        fn match_from_span(
+            pati: PatternID,
+            start: usize,
+            end: usize,
+        ) -> Match {
+            Match::from_span(pati as usize, start, end)
+        }
+
+        // N.B. The bounds check for this bucket lookup *should* be elided
+        // since we assert the number of buckets in each `find_at` routine,
+        // and the compiler can prove that the `% 8` (or `% 16`) in callers
+        // of this routine will always be in bounds.
+        for &pati in &self.buckets[bucket] {
+            // SAFETY: This is safe because we are guaranteed that every
+            // index in a Teddy bucket is a valid index into `pats`. This
+            // guarantee is upheld by the assert checking `max_pattern_id` in
+            // the beginning of `find_at` above.
+            //
+            // This explicit bounds check elision is (amazingly) good for a
+            // 25-50% boost in some benchmarks, particularly ones with a lot
+            // of short literals.
+            let pat = unsafe { pats.get_unchecked(pati) };
+            if pat.is_prefix(&haystack[at..]) {
+                return Some(match_from_span(pati, at, at + pat.len()));
+            }
+        }
+        None
+    }
+}
+
+/// Exec represents the different search strategies supported by the Teddy
+/// runtime.
+///
+/// This enum is an important safety abstraction. Namely, callers should only
+/// construct a variant in this enum if it is safe to execute its corresponding
+/// target features on the current CPU. The 128-bit searchers require SSSE3,
+/// while the 256-bit searchers require AVX2.
+#[derive(Clone, Debug)]
+pub enum Exec {
+    TeddySlim1Mask128(TeddySlim1Mask128),
+    TeddySlim1Mask256(TeddySlim1Mask256),
+    TeddyFat1Mask256(TeddyFat1Mask256),
+    TeddySlim2Mask128(TeddySlim2Mask128),
+    TeddySlim2Mask256(TeddySlim2Mask256),
+    TeddyFat2Mask256(TeddyFat2Mask256),
+    TeddySlim3Mask128(TeddySlim3Mask128),
+    TeddySlim3Mask256(TeddySlim3Mask256),
+    TeddyFat3Mask256(TeddyFat3Mask256),
+}
+
+// Most of the code below remains undocumented because they are effectively
+// repeated versions of themselves. The general structure is described in the
+// README and in the comments above.
+
+#[derive(Clone, Debug)]
+pub struct TeddySlim1Mask128 {
+    pub mask1: Mask128,
+}
+
+impl TeddySlim1Mask128 {
+    #[target_feature(enable = "ssse3")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(8, teddy.buckets.len());
+
+        let len = haystack.len();
+        while at <= len - 16 {
+            let c = self.candidate(haystack, at);
+            if !is_all_zeroes128(c) {
+                if let Some(m) = teddy.verify128(pats, haystack, at, c) {
+                    return Some(m);
+                }
+            }
+            at += 16;
+        }
+        if at < len {
+            at = len - 16;
+            let c = self.candidate(haystack, at);
+            if !is_all_zeroes128(c) {
+                if let Some(m) = teddy.verify128(pats, haystack, at, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(&self, haystack: &[u8], at: usize) -> __m128i {
+        debug_assert!(haystack[at..].len() >= 16);
+
+        let chunk = loadu128(haystack, at);
+        members1m128(chunk, self.mask1)
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddySlim1Mask256 {
+    pub mask1: Mask256,
+}
+
+impl TeddySlim1Mask256 {
+    #[target_feature(enable = "avx2")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(8, teddy.buckets.len());
+
+        let len = haystack.len();
+        while at <= len - 32 {
+            let c = self.candidate(haystack, at);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify256(pats, haystack, at, c) {
+                    return Some(m);
+                }
+            }
+            at += 32;
+        }
+        if at < len {
+            at = len - 32;
+            let c = self.candidate(haystack, at);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify256(pats, haystack, at, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(&self, haystack: &[u8], at: usize) -> __m256i {
+        debug_assert!(haystack[at..].len() >= 32);
+
+        let chunk = loadu256(haystack, at);
+        members1m256(chunk, self.mask1)
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddyFat1Mask256 {
+    pub mask1: Mask256,
+}
+
+impl TeddyFat1Mask256 {
+    #[target_feature(enable = "avx2")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(16, teddy.buckets.len());
+
+        let len = haystack.len();
+        while at <= len - 16 {
+            let c = self.candidate(haystack, at);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify_fat256(pats, haystack, at, c) {
+                    return Some(m);
+                }
+            }
+            at += 16;
+        }
+        if at < len {
+            at = len - 16;
+            let c = self.candidate(haystack, at);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify_fat256(pats, haystack, at, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(&self, haystack: &[u8], at: usize) -> __m256i {
+        debug_assert!(haystack[at..].len() >= 16);
+
+        let chunk = _mm256_broadcastsi128_si256(loadu128(haystack, at));
+        members1m256(chunk, self.mask1)
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddySlim2Mask128 {
+    pub mask1: Mask128,
+    pub mask2: Mask128,
+}
+
+impl TeddySlim2Mask128 {
+    #[target_feature(enable = "ssse3")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(8, teddy.buckets.len());
+
+        at += 1;
+        let len = haystack.len();
+        let mut prev0 = ones128();
+        while at <= len - 16 {
+            let c = self.candidate(haystack, at, &mut prev0);
+            if !is_all_zeroes128(c) {
+                if let Some(m) = teddy.verify128(pats, haystack, at - 1, c) {
+                    return Some(m);
+                }
+            }
+            at += 16;
+        }
+        if at < len {
+            at = len - 16;
+            prev0 = ones128();
+
+            let c = self.candidate(haystack, at, &mut prev0);
+            if !is_all_zeroes128(c) {
+                if let Some(m) = teddy.verify128(pats, haystack, at - 1, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(
+        &self,
+        haystack: &[u8],
+        at: usize,
+        prev0: &mut __m128i,
+    ) -> __m128i {
+        debug_assert!(haystack[at..].len() >= 16);
+
+        let chunk = loadu128(haystack, at);
+        let (res0, res1) = members2m128(chunk, self.mask1, self.mask2);
+        let res0prev0 = _mm_alignr_epi8(res0, *prev0, 15);
+        _mm_and_si128(res0prev0, res1)
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddySlim2Mask256 {
+    pub mask1: Mask256,
+    pub mask2: Mask256,
+}
+
+impl TeddySlim2Mask256 {
+    #[target_feature(enable = "avx2")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(8, teddy.buckets.len());
+
+        at += 1;
+        let len = haystack.len();
+        let mut prev0 = ones256();
+        while at <= len - 32 {
+            let c = self.candidate(haystack, at, &mut prev0);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify256(pats, haystack, at - 1, c) {
+                    return Some(m);
+                }
+            }
+            at += 32;
+        }
+        if at < len {
+            at = len - 32;
+            prev0 = ones256();
+
+            let c = self.candidate(haystack, at, &mut prev0);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify256(pats, haystack, at - 1, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(
+        &self,
+        haystack: &[u8],
+        at: usize,
+        prev0: &mut __m256i,
+    ) -> __m256i {
+        debug_assert!(haystack[at..].len() >= 32);
+
+        let chunk = loadu256(haystack, at);
+        let (res0, res1) = members2m256(chunk, self.mask1, self.mask2);
+        let res0prev0 = alignr256_15(res0, *prev0);
+        let res = _mm256_and_si256(res0prev0, res1);
+        *prev0 = res0;
+        res
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddyFat2Mask256 {
+    pub mask1: Mask256,
+    pub mask2: Mask256,
+}
+
+impl TeddyFat2Mask256 {
+    #[target_feature(enable = "avx2")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(16, teddy.buckets.len());
+
+        at += 1;
+        let len = haystack.len();
+        let mut prev0 = ones256();
+        while at <= len - 16 {
+            let c = self.candidate(haystack, at, &mut prev0);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify_fat256(pats, haystack, at - 1, c)
+                {
+                    return Some(m);
+                }
+            }
+            at += 16;
+        }
+        if at < len {
+            at = len - 16;
+            prev0 = ones256();
+
+            let c = self.candidate(haystack, at, &mut prev0);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify_fat256(pats, haystack, at - 1, c)
+                {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(
+        &self,
+        haystack: &[u8],
+        at: usize,
+        prev0: &mut __m256i,
+    ) -> __m256i {
+        debug_assert!(haystack[at..].len() >= 16);
+
+        let chunk = _mm256_broadcastsi128_si256(loadu128(haystack, at));
+        let (res0, res1) = members2m256(chunk, self.mask1, self.mask2);
+        let res0prev0 = _mm256_alignr_epi8(res0, *prev0, 15);
+        let res = _mm256_and_si256(res0prev0, res1);
+        *prev0 = res0;
+        res
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddySlim3Mask128 {
+    pub mask1: Mask128,
+    pub mask2: Mask128,
+    pub mask3: Mask128,
+}
+
+impl TeddySlim3Mask128 {
+    #[target_feature(enable = "ssse3")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(8, teddy.buckets.len());
+
+        at += 2;
+        let len = haystack.len();
+        let (mut prev0, mut prev1) = (ones128(), ones128());
+        while at <= len - 16 {
+            let c = self.candidate(haystack, at, &mut prev0, &mut prev1);
+            if !is_all_zeroes128(c) {
+                if let Some(m) = teddy.verify128(pats, haystack, at - 2, c) {
+                    return Some(m);
+                }
+            }
+            at += 16;
+        }
+        if at < len {
+            at = len - 16;
+            prev0 = ones128();
+            prev1 = ones128();
+
+            let c = self.candidate(haystack, at, &mut prev0, &mut prev1);
+            if !is_all_zeroes128(c) {
+                if let Some(m) = teddy.verify128(pats, haystack, at - 2, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(
+        &self,
+        haystack: &[u8],
+        at: usize,
+        prev0: &mut __m128i,
+        prev1: &mut __m128i,
+    ) -> __m128i {
+        debug_assert!(haystack[at..].len() >= 16);
+
+        let chunk = loadu128(haystack, at);
+        let (res0, res1, res2) =
+            members3m128(chunk, self.mask1, self.mask2, self.mask3);
+        let res0prev0 = _mm_alignr_epi8(res0, *prev0, 14);
+        let res1prev1 = _mm_alignr_epi8(res1, *prev1, 15);
+        let res = _mm_and_si128(_mm_and_si128(res0prev0, res1prev1), res2);
+        *prev0 = res0;
+        *prev1 = res1;
+        res
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddySlim3Mask256 {
+    pub mask1: Mask256,
+    pub mask2: Mask256,
+    pub mask3: Mask256,
+}
+
+impl TeddySlim3Mask256 {
+    #[target_feature(enable = "avx2")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(8, teddy.buckets.len());
+
+        at += 2;
+        let len = haystack.len();
+        let (mut prev0, mut prev1) = (ones256(), ones256());
+        while at <= len - 32 {
+            let c = self.candidate(haystack, at, &mut prev0, &mut prev1);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify256(pats, haystack, at - 2, c) {
+                    return Some(m);
+                }
+            }
+            at += 32;
+        }
+        if at < len {
+            at = len - 32;
+            prev0 = ones256();
+            prev1 = ones256();
+
+            let c = self.candidate(haystack, at, &mut prev0, &mut prev1);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify256(pats, haystack, at - 2, c) {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(
+        &self,
+        haystack: &[u8],
+        at: usize,
+        prev0: &mut __m256i,
+        prev1: &mut __m256i,
+    ) -> __m256i {
+        debug_assert!(haystack[at..].len() >= 32);
+
+        let chunk = loadu256(haystack, at);
+        let (res0, res1, res2) =
+            members3m256(chunk, self.mask1, self.mask2, self.mask3);
+        let res0prev0 = alignr256_14(res0, *prev0);
+        let res1prev1 = alignr256_15(res1, *prev1);
+        let res =
+            _mm256_and_si256(_mm256_and_si256(res0prev0, res1prev1), res2);
+        *prev0 = res0;
+        *prev1 = res1;
+        res
+    }
+}
+
+#[derive(Clone, Debug)]
+pub struct TeddyFat3Mask256 {
+    pub mask1: Mask256,
+    pub mask2: Mask256,
+    pub mask3: Mask256,
+}
+
+impl TeddyFat3Mask256 {
+    #[target_feature(enable = "avx2")]
+    unsafe fn find_at(
+        &self,
+        pats: &Patterns,
+        teddy: &Teddy,
+        haystack: &[u8],
+        mut at: usize,
+    ) -> Option<Match> {
+        debug_assert!(haystack[at..].len() >= teddy.minimum_len());
+        // This assert helps eliminate bounds checks for bucket lookups in
+        // Teddy::verify_bucket, which has a small (3-4%) performance boost.
+        assert_eq!(16, teddy.buckets.len());
+
+        at += 2;
+        let len = haystack.len();
+        let (mut prev0, mut prev1) = (ones256(), ones256());
+        while at <= len - 16 {
+            let c = self.candidate(haystack, at, &mut prev0, &mut prev1);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify_fat256(pats, haystack, at - 2, c)
+                {
+                    return Some(m);
+                }
+            }
+            at += 16;
+        }
+        if at < len {
+            at = len - 16;
+            prev0 = ones256();
+            prev1 = ones256();
+
+            let c = self.candidate(haystack, at, &mut prev0, &mut prev1);
+            if !is_all_zeroes256(c) {
+                if let Some(m) = teddy.verify_fat256(pats, haystack, at - 2, c)
+                {
+                    return Some(m);
+                }
+            }
+        }
+        None
+    }
+
+    #[inline(always)]
+    unsafe fn candidate(
+        &self,
+        haystack: &[u8],
+        at: usize,
+        prev0: &mut __m256i,
+        prev1: &mut __m256i,
+    ) -> __m256i {
+        debug_assert!(haystack[at..].len() >= 16);
+
+        let chunk = _mm256_broadcastsi128_si256(loadu128(haystack, at));
+        let (res0, res1, res2) =
+            members3m256(chunk, self.mask1, self.mask2, self.mask3);
+        let res0prev0 = _mm256_alignr_epi8(res0, *prev0, 14);
+        let res1prev1 = _mm256_alignr_epi8(res1, *prev1, 15);
+        let res =
+            _mm256_and_si256(_mm256_and_si256(res0prev0, res1prev1), res2);
+        *prev0 = res0;
+        *prev1 = res1;
+        res
+    }
+}
+
+/// A 128-bit mask for the low and high nybbles in a set of patterns. Each
+/// lane `j` corresponds to a bitset where the `i`th bit is set if and only if
+/// the nybble `j` is in the bucket `i` at a particular position.
+#[derive(Clone, Copy, Debug)]
+pub struct Mask128 {
+    lo: __m128i,
+    hi: __m128i,
+}
+
+impl Mask128 {
+    /// Create a new SIMD mask from the mask produced by the Teddy builder.
+    pub fn new(mask: compile::Mask) -> Mask128 {
+        // SAFETY: This is safe since [u8; 16] has the same representation
+        // as __m128i.
+        unsafe {
+            Mask128 {
+                lo: mem::transmute(mask.lo128()),
+                hi: mem::transmute(mask.hi128()),
+            }
+        }
+    }
+}
+
+/// A 256-bit mask for the low and high nybbles in a set of patterns. Each
+/// lane `j` corresponds to a bitset where the `i`th bit is set if and only if
+/// the nybble `j` is in the bucket `i` at a particular position.
+///
+/// This is slightly tweaked dependending on whether Slim or Fat Teddy is being
+/// used. For Slim Teddy, the bitsets in the lower 128-bits are the same as
+/// the bitsets in the higher 128-bits, so that we can search 32 bytes at a
+/// time. (Remember, the nybbles in the haystack are used as indices into these
+/// masks, and 256-bit shuffles only operate on 128-bit lanes.)
+///
+/// For Fat Teddy, the bitsets are not repeated, but instead, the high 128
+/// bits correspond to buckets 8-15. So that a bitset `00100010` has buckets
+/// 1 and 5 set if it's in the lower 128 bits, but has buckets 9 and 13 set
+/// if it's in the higher 128 bits.
+#[derive(Clone, Copy, Debug)]
+pub struct Mask256 {
+    lo: __m256i,
+    hi: __m256i,
+}
+
+impl Mask256 {
+    /// Create a new SIMD mask from the mask produced by the Teddy builder.
+    pub fn new(mask: compile::Mask) -> Mask256 {
+        // SAFETY: This is safe since [u8; 32] has the same representation
+        // as __m256i.
+        unsafe {
+            Mask256 {
+                lo: mem::transmute(mask.lo256()),
+                hi: mem::transmute(mask.hi256()),
+            }
+        }
+    }
+}
+
+// The "members" routines below are responsible for taking a chunk of bytes,
+// a number of nybble masks and returning the result of using the masks to
+// lookup bytes in the chunk. The results of the high and low nybble masks are
+// AND'ed together, such that each candidate returned is a vector, with byte
+// sized lanes, and where each lane is an 8-bit bitset corresponding to the
+// buckets that contain the corresponding byte.
+//
+// In the case of masks of length greater than 1, callers will need to keep
+// the results from the previous haystack's window, and then shift the vectors
+// so that they all line up. Then they can be AND'ed together.
+
+/// Return a candidate for Slim 128-bit Teddy, where `chunk` corresponds to a
+/// 16-byte window of the haystack (where the least significant byte
+/// corresponds to the start of the window), and `mask1` corresponds to a
+/// low/high mask for the first byte of all patterns that are being searched.
+#[target_feature(enable = "ssse3")]
+unsafe fn members1m128(chunk: __m128i, mask1: Mask128) -> __m128i {
+    let lomask = _mm_set1_epi8(0xF);
+    let hlo = _mm_and_si128(chunk, lomask);
+    let hhi = _mm_and_si128(_mm_srli_epi16(chunk, 4), lomask);
+    _mm_and_si128(
+        _mm_shuffle_epi8(mask1.lo, hlo),
+        _mm_shuffle_epi8(mask1.hi, hhi),
+    )
+}
+
+/// Return a candidate for Slim 256-bit Teddy, where `chunk` corresponds to a
+/// 32-byte window of the haystack (where the least significant byte
+/// corresponds to the start of the window), and `mask1` corresponds to a
+/// low/high mask for the first byte of all patterns that are being searched.
+///
+/// Note that this can also be used for Fat Teddy, where the high 128 bits in
+/// `chunk` is the same as the low 128 bits, which corresponds to a 16 byte
+/// window in the haystack.
+#[target_feature(enable = "avx2")]
+unsafe fn members1m256(chunk: __m256i, mask1: Mask256) -> __m256i {
+    let lomask = _mm256_set1_epi8(0xF);
+    let hlo = _mm256_and_si256(chunk, lomask);
+    let hhi = _mm256_and_si256(_mm256_srli_epi16(chunk, 4), lomask);
+    _mm256_and_si256(
+        _mm256_shuffle_epi8(mask1.lo, hlo),
+        _mm256_shuffle_epi8(mask1.hi, hhi),
+    )
+}
+
+/// Return candidates for Slim 128-bit Teddy, where `chunk` corresponds
+/// to a 16-byte window of the haystack (where the least significant byte
+/// corresponds to the start of the window), and the masks correspond to a
+/// low/high mask for the first and second bytes of all patterns that are being
+/// searched. The vectors returned correspond to candidates for the first and
+/// second bytes in the patterns represented by the masks.
+#[target_feature(enable = "ssse3")]
+unsafe fn members2m128(
+    chunk: __m128i,
+    mask1: Mask128,
+    mask2: Mask128,
+) -> (__m128i, __m128i) {
+    let lomask = _mm_set1_epi8(0xF);
+    let hlo = _mm_and_si128(chunk, lomask);
+    let hhi = _mm_and_si128(_mm_srli_epi16(chunk, 4), lomask);
+    let res0 = _mm_and_si128(
+        _mm_shuffle_epi8(mask1.lo, hlo),
+        _mm_shuffle_epi8(mask1.hi, hhi),
+    );
+    let res1 = _mm_and_si128(
+        _mm_shuffle_epi8(mask2.lo, hlo),
+        _mm_shuffle_epi8(mask2.hi, hhi),
+    );
+    (res0, res1)
+}
+
+/// Return candidates for Slim 256-bit Teddy, where `chunk` corresponds
+/// to a 32-byte window of the haystack (where the least significant byte
+/// corresponds to the start of the window), and the masks correspond to a
+/// low/high mask for the first and second bytes of all patterns that are being
+/// searched. The vectors returned correspond to candidates for the first and
+/// second bytes in the patterns represented by the masks.
+///
+/// Note that this can also be used for Fat Teddy, where the high 128 bits in
+/// `chunk` is the same as the low 128 bits, which corresponds to a 16 byte
+/// window in the haystack.
+#[target_feature(enable = "avx2")]
+unsafe fn members2m256(
+    chunk: __m256i,
+    mask1: Mask256,
+    mask2: Mask256,
+) -> (__m256i, __m256i) {
+    let lomask = _mm256_set1_epi8(0xF);
+    let hlo = _mm256_and_si256(chunk, lomask);
+    let hhi = _mm256_and_si256(_mm256_srli_epi16(chunk, 4), lomask);
+    let res0 = _mm256_and_si256(
+        _mm256_shuffle_epi8(mask1.lo, hlo),
+        _mm256_shuffle_epi8(mask1.hi, hhi),
+    );
+    let res1 = _mm256_and_si256(
+        _mm256_shuffle_epi8(mask2.lo, hlo),
+        _mm256_shuffle_epi8(mask2.hi, hhi),
+    );
+    (res0, res1)
+}
+
+/// Return candidates for Slim 128-bit Teddy, where `chunk` corresponds
+/// to a 16-byte window of the haystack (where the least significant byte
+/// corresponds to the start of the window), and the masks correspond to a
+/// low/high mask for the first, second and third bytes of all patterns that
+/// are being searched. The vectors returned correspond to candidates for the
+/// first, second and third bytes in the patterns represented by the masks.
+#[target_feature(enable = "ssse3")]
+unsafe fn members3m128(
+    chunk: __m128i,
+    mask1: Mask128,
+    mask2: Mask128,
+    mask3: Mask128,
+) -> (__m128i, __m128i, __m128i) {
+    let lomask = _mm_set1_epi8(0xF);
+    let hlo = _mm_and_si128(chunk, lomask);
+    let hhi = _mm_and_si128(_mm_srli_epi16(chunk, 4), lomask);
+    let res0 = _mm_and_si128(
+        _mm_shuffle_epi8(mask1.lo, hlo),
+        _mm_shuffle_epi8(mask1.hi, hhi),
+    );
+    let res1 = _mm_and_si128(
+        _mm_shuffle_epi8(mask2.lo, hlo),
+        _mm_shuffle_epi8(mask2.hi, hhi),
+    );
+    let res2 = _mm_and_si128(
+        _mm_shuffle_epi8(mask3.lo, hlo),
+        _mm_shuffle_epi8(mask3.hi, hhi),
+    );
+    (res0, res1, res2)
+}
+
+/// Return candidates for Slim 256-bit Teddy, where `chunk` corresponds
+/// to a 32-byte window of the haystack (where the least significant byte
+/// corresponds to the start of the window), and the masks correspond to a
+/// low/high mask for the first, second and third bytes of all patterns that
+/// are being searched. The vectors returned correspond to candidates for the
+/// first, second and third bytes in the patterns represented by the masks.
+///
+/// Note that this can also be used for Fat Teddy, where the high 128 bits in
+/// `chunk` is the same as the low 128 bits, which corresponds to a 16 byte
+/// window in the haystack.
+#[target_feature(enable = "avx2")]
+unsafe fn members3m256(
+    chunk: __m256i,
+    mask1: Mask256,
+    mask2: Mask256,
+    mask3: Mask256,
+) -> (__m256i, __m256i, __m256i) {
+    let lomask = _mm256_set1_epi8(0xF);
+    let hlo = _mm256_and_si256(chunk, lomask);
+    let hhi = _mm256_and_si256(_mm256_srli_epi16(chunk, 4), lomask);
+    let res0 = _mm256_and_si256(
+        _mm256_shuffle_epi8(mask1.lo, hlo),
+        _mm256_shuffle_epi8(mask1.hi, hhi),
+    );
+    let res1 = _mm256_and_si256(
+        _mm256_shuffle_epi8(mask2.lo, hlo),
+        _mm256_shuffle_epi8(mask2.hi, hhi),
+    );
+    let res2 = _mm256_and_si256(
+        _mm256_shuffle_epi8(mask3.lo, hlo),
+        _mm256_shuffle_epi8(mask3.hi, hhi),
+    );
+    (res0, res1, res2)
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/tests.rs b/android/vendor/aho-corasick-0.7.18/src/packed/tests.rs
new file mode 100644
index 0000000..91410cb
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/tests.rs
@@ -0,0 +1,568 @@
+use std::collections::HashMap;
+use std::usize;
+
+use crate::packed::{Config, MatchKind};
+use crate::Match;
+
+/// A description of a single test against a multi-pattern searcher.
+///
+/// A single test may not necessarily pass on every configuration of a
+/// searcher. The tests are categorized and grouped appropriately below.
+#[derive(Clone, Debug, Eq, PartialEq)]
+struct SearchTest {
+    /// The name of this test, for debugging.
+    name: &'static str,
+    /// The patterns to search for.
+    patterns: &'static [&'static str],
+    /// The text to search.
+    haystack: &'static str,
+    /// Each match is a triple of (pattern_index, start, end), where
+    /// pattern_index is an index into `patterns` and `start`/`end` are indices
+    /// into `haystack`.
+    matches: &'static [(usize, usize, usize)],
+}
+
+struct SearchTestOwned {
+    offset: usize,
+    name: String,
+    patterns: Vec<String>,
+    haystack: String,
+    matches: Vec<(usize, usize, usize)>,
+}
+
+impl SearchTest {
+    fn variations(&self) -> Vec<SearchTestOwned> {
+        let mut tests = vec![];
+        for i in 0..=260 {
+            tests.push(self.offset_prefix(i));
+            tests.push(self.offset_suffix(i));
+            tests.push(self.offset_both(i));
+        }
+        tests
+    }
+
+    fn offset_both(&self, off: usize) -> SearchTestOwned {
+        SearchTestOwned {
+            offset: off,
+            name: self.name.to_string(),
+            patterns: self.patterns.iter().map(|s| s.to_string()).collect(),
+            haystack: format!(
+                "{}{}{}",
+                "Z".repeat(off),
+                self.haystack,
+                "Z".repeat(off)
+            ),
+            matches: self
+                .matches
+                .iter()
+                .map(|&(id, s, e)| (id, s + off, e + off))
+                .collect(),
+        }
+    }
+
+    fn offset_prefix(&self, off: usize) -> SearchTestOwned {
+        SearchTestOwned {
+            offset: off,
+            name: self.name.to_string(),
+            patterns: self.patterns.iter().map(|s| s.to_string()).collect(),
+            haystack: format!("{}{}", "Z".repeat(off), self.haystack),
+            matches: self
+                .matches
+                .iter()
+                .map(|&(id, s, e)| (id, s + off, e + off))
+                .collect(),
+        }
+    }
+
+    fn offset_suffix(&self, off: usize) -> SearchTestOwned {
+        SearchTestOwned {
+            offset: off,
+            name: self.name.to_string(),
+            patterns: self.patterns.iter().map(|s| s.to_string()).collect(),
+            haystack: format!("{}{}", self.haystack, "Z".repeat(off)),
+            matches: self.matches.to_vec(),
+        }
+    }
+
+    // fn to_owned(&self) -> SearchTestOwned {
+    // SearchTestOwned {
+    // name: self.name.to_string(),
+    // patterns: self.patterns.iter().map(|s| s.to_string()).collect(),
+    // haystack: self.haystack.to_string(),
+    // matches: self.matches.iter().cloned().collect(),
+    // }
+    // }
+}
+
+/// Short-hand constructor for SearchTest. We use it a lot below.
+macro_rules! t {
+    ($name:ident, $patterns:expr, $haystack:expr, $matches:expr) => {
+        SearchTest {
+            name: stringify!($name),
+            patterns: $patterns,
+            haystack: $haystack,
+            matches: $matches,
+        }
+    };
+}
+
+/// A collection of test groups.
+type TestCollection = &'static [&'static [SearchTest]];
+
+// Define several collections corresponding to the different type of match
+// semantics supported. These collections have some overlap, but each
+// collection should have some tests that no other collection has.
+
+/// Tests for leftmost-first match semantics.
+const PACKED_LEFTMOST_FIRST: TestCollection =
+    &[BASICS, LEFTMOST, LEFTMOST_FIRST, REGRESSION, TEDDY];
+
+/// Tests for leftmost-longest match semantics.
+const PACKED_LEFTMOST_LONGEST: TestCollection =
+    &[BASICS, LEFTMOST, LEFTMOST_LONGEST, REGRESSION, TEDDY];
+
+// Now define the individual tests that make up the collections above.
+
+/// A collection of tests for the that should always be true regardless of
+/// match semantics. That is, all combinations of leftmost-{first, longest}
+/// should produce the same answer.
+const BASICS: &'static [SearchTest] = &[
+    t!(basic001, &["a"], "", &[]),
+    t!(basic010, &["a"], "a", &[(0, 0, 1)]),
+    t!(basic020, &["a"], "aa", &[(0, 0, 1), (0, 1, 2)]),
+    t!(basic030, &["a"], "aaa", &[(0, 0, 1), (0, 1, 2), (0, 2, 3)]),
+    t!(basic040, &["a"], "aba", &[(0, 0, 1), (0, 2, 3)]),
+    t!(basic050, &["a"], "bba", &[(0, 2, 3)]),
+    t!(basic060, &["a"], "bbb", &[]),
+    t!(basic070, &["a"], "bababbbba", &[(0, 1, 2), (0, 3, 4), (0, 8, 9)]),
+    t!(basic100, &["aa"], "", &[]),
+    t!(basic110, &["aa"], "aa", &[(0, 0, 2)]),
+    t!(basic120, &["aa"], "aabbaa", &[(0, 0, 2), (0, 4, 6)]),
+    t!(basic130, &["aa"], "abbab", &[]),
+    t!(basic140, &["aa"], "abbabaa", &[(0, 5, 7)]),
+    t!(basic150, &["aaa"], "aaa", &[(0, 0, 3)]),
+    t!(basic200, &["abc"], "abc", &[(0, 0, 3)]),
+    t!(basic210, &["abc"], "zazabzabcz", &[(0, 6, 9)]),
+    t!(basic220, &["abc"], "zazabczabcz", &[(0, 3, 6), (0, 7, 10)]),
+    t!(basic300, &["a", "b"], "", &[]),
+    t!(basic310, &["a", "b"], "z", &[]),
+    t!(basic320, &["a", "b"], "b", &[(1, 0, 1)]),
+    t!(basic330, &["a", "b"], "a", &[(0, 0, 1)]),
+    t!(
+        basic340,
+        &["a", "b"],
+        "abba",
+        &[(0, 0, 1), (1, 1, 2), (1, 2, 3), (0, 3, 4),]
+    ),
+    t!(
+        basic350,
+        &["b", "a"],
+        "abba",
+        &[(1, 0, 1), (0, 1, 2), (0, 2, 3), (1, 3, 4),]
+    ),
+    t!(basic360, &["abc", "bc"], "xbc", &[(1, 1, 3),]),
+    t!(basic400, &["foo", "bar"], "", &[]),
+    t!(basic410, &["foo", "bar"], "foobar", &[(0, 0, 3), (1, 3, 6),]),
+    t!(basic420, &["foo", "bar"], "barfoo", &[(1, 0, 3), (0, 3, 6),]),
+    t!(basic430, &["foo", "bar"], "foofoo", &[(0, 0, 3), (0, 3, 6),]),
+    t!(basic440, &["foo", "bar"], "barbar", &[(1, 0, 3), (1, 3, 6),]),
+    t!(basic450, &["foo", "bar"], "bafofoo", &[(0, 4, 7),]),
+    t!(basic460, &["bar", "foo"], "bafofoo", &[(1, 4, 7),]),
+    t!(basic470, &["foo", "bar"], "fobabar", &[(1, 4, 7),]),
+    t!(basic480, &["bar", "foo"], "fobabar", &[(0, 4, 7),]),
+    t!(basic700, &["yabcdef", "abcdezghi"], "yabcdefghi", &[(0, 0, 7),]),
+    t!(basic710, &["yabcdef", "abcdezghi"], "yabcdezghi", &[(1, 1, 10),]),
+    t!(
+        basic720,
+        &["yabcdef", "bcdeyabc", "abcdezghi"],
+        "yabcdezghi",
+        &[(2, 1, 10),]
+    ),
+    t!(basic810, &["abcd", "bcd", "cd"], "abcd", &[(0, 0, 4),]),
+    t!(basic820, &["bcd", "cd", "abcd"], "abcd", &[(2, 0, 4),]),
+    t!(basic830, &["abc", "bc"], "zazabcz", &[(0, 3, 6),]),
+    t!(
+        basic840,
+        &["ab", "ba"],
+        "abababa",
+        &[(0, 0, 2), (0, 2, 4), (0, 4, 6),]
+    ),
+    t!(basic850, &["foo", "foo"], "foobarfoo", &[(0, 0, 3), (0, 6, 9),]),
+];
+
+/// Tests for leftmost match semantics. These should pass for both
+/// leftmost-first and leftmost-longest match kinds. Stated differently, among
+/// ambiguous matches, the longest match and the match that appeared first when
+/// constructing the automaton should always be the same.
+const LEFTMOST: &'static [SearchTest] = &[
+    t!(leftmost000, &["ab", "ab"], "abcd", &[(0, 0, 2)]),
+    t!(leftmost030, &["a", "ab"], "aa", &[(0, 0, 1), (0, 1, 2)]),
+    t!(leftmost031, &["ab", "a"], "aa", &[(1, 0, 1), (1, 1, 2)]),
+    t!(leftmost032, &["ab", "a"], "xayabbbz", &[(1, 1, 2), (0, 3, 5)]),
+    t!(leftmost300, &["abcd", "bce", "b"], "abce", &[(1, 1, 4)]),
+    t!(leftmost310, &["abcd", "ce", "bc"], "abce", &[(2, 1, 3)]),
+    t!(leftmost320, &["abcd", "bce", "ce", "b"], "abce", &[(1, 1, 4)]),
+    t!(leftmost330, &["abcd", "bce", "cz", "bc"], "abcz", &[(3, 1, 3)]),
+    t!(leftmost340, &["bce", "cz", "bc"], "bcz", &[(2, 0, 2)]),
+    t!(leftmost350, &["abc", "bd", "ab"], "abd", &[(2, 0, 2)]),
+    t!(
+        leftmost360,
+        &["abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(2, 0, 8),]
+    ),
+    t!(
+        leftmost370,
+        &["abcdefghi", "cde", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        leftmost380,
+        &["abcdefghi", "hz", "abcdefgh", "a"],
+        "abcdefghz",
+        &[(2, 0, 8),]
+    ),
+    t!(
+        leftmost390,
+        &["b", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        leftmost400,
+        &["h", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        leftmost410,
+        &["z", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8), (0, 8, 9),]
+    ),
+];
+
+/// Tests for non-overlapping leftmost-first match semantics. These tests
+/// should generally be specific to leftmost-first, which means they should
+/// generally fail under leftmost-longest semantics.
+const LEFTMOST_FIRST: &'static [SearchTest] = &[
+    t!(leftfirst000, &["ab", "abcd"], "abcd", &[(0, 0, 2)]),
+    t!(leftfirst020, &["abcd", "ab"], "abcd", &[(0, 0, 4)]),
+    t!(leftfirst030, &["ab", "ab"], "abcd", &[(0, 0, 2)]),
+    t!(leftfirst040, &["a", "ab"], "xayabbbz", &[(0, 1, 2), (0, 3, 4)]),
+    t!(leftfirst100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[(1, 1, 5)]),
+    t!(leftfirst110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[(1, 1, 6)]),
+    t!(leftfirst300, &["abcd", "b", "bce"], "abce", &[(1, 1, 2)]),
+    t!(
+        leftfirst310,
+        &["abcd", "b", "bce", "ce"],
+        "abce",
+        &[(1, 1, 2), (3, 2, 4),]
+    ),
+    t!(
+        leftfirst320,
+        &["a", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(0, 0, 1), (2, 7, 9),]
+    ),
+    t!(leftfirst330, &["a", "abab"], "abab", &[(0, 0, 1), (0, 2, 3)]),
+    t!(
+        leftfirst340,
+        &["abcdef", "x", "x", "x", "x", "x", "x", "abcde"],
+        "abcdef",
+        &[(0, 0, 6)]
+    ),
+];
+
+/// Tests for non-overlapping leftmost-longest match semantics. These tests
+/// should generally be specific to leftmost-longest, which means they should
+/// generally fail under leftmost-first semantics.
+const LEFTMOST_LONGEST: &'static [SearchTest] = &[
+    t!(leftlong000, &["ab", "abcd"], "abcd", &[(1, 0, 4)]),
+    t!(leftlong010, &["abcd", "bcd", "cd", "b"], "abcd", &[(0, 0, 4),]),
+    t!(leftlong040, &["a", "ab"], "a", &[(0, 0, 1)]),
+    t!(leftlong050, &["a", "ab"], "ab", &[(1, 0, 2)]),
+    t!(leftlong060, &["ab", "a"], "a", &[(1, 0, 1)]),
+    t!(leftlong070, &["ab", "a"], "ab", &[(0, 0, 2)]),
+    t!(leftlong100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[(2, 1, 6)]),
+    t!(leftlong110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[(1, 1, 6)]),
+    t!(leftlong300, &["abcd", "b", "bce"], "abce", &[(2, 1, 4)]),
+    t!(
+        leftlong310,
+        &["a", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(leftlong320, &["a", "abab"], "abab", &[(1, 0, 4)]),
+    t!(leftlong330, &["abcd", "b", "ce"], "abce", &[(1, 1, 2), (2, 2, 4),]),
+    t!(leftlong340, &["a", "ab"], "xayabbbz", &[(0, 1, 2), (1, 3, 5)]),
+];
+
+/// Regression tests that are applied to all combinations.
+///
+/// If regression tests are needed for specific match semantics, then add them
+/// to the appropriate group above.
+const REGRESSION: &'static [SearchTest] = &[
+    t!(regression010, &["inf", "ind"], "infind", &[(0, 0, 3), (1, 3, 6),]),
+    t!(regression020, &["ind", "inf"], "infind", &[(1, 0, 3), (0, 3, 6),]),
+    t!(
+        regression030,
+        &["libcore/", "libstd/"],
+        "libcore/char/methods.rs",
+        &[(0, 0, 8),]
+    ),
+    t!(
+        regression040,
+        &["libstd/", "libcore/"],
+        "libcore/char/methods.rs",
+        &[(1, 0, 8),]
+    ),
+    t!(
+        regression050,
+        &["\x00\x00\x01", "\x00\x00\x00"],
+        "\x00\x00\x00",
+        &[(1, 0, 3),]
+    ),
+    t!(
+        regression060,
+        &["\x00\x00\x00", "\x00\x00\x01"],
+        "\x00\x00\x00",
+        &[(0, 0, 3),]
+    ),
+];
+
+const TEDDY: &'static [SearchTest] = &[
+    t!(
+        teddy010,
+        &["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"],
+        "abcdefghijk",
+        &[
+            (0, 0, 1),
+            (1, 1, 2),
+            (2, 2, 3),
+            (3, 3, 4),
+            (4, 4, 5),
+            (5, 5, 6),
+            (6, 6, 7),
+            (7, 7, 8),
+            (8, 8, 9),
+            (9, 9, 10),
+            (10, 10, 11)
+        ]
+    ),
+    t!(
+        teddy020,
+        &["ab", "bc", "cd", "de", "ef", "fg", "gh", "hi", "ij", "jk", "kl"],
+        "abcdefghijk",
+        &[(0, 0, 2), (2, 2, 4), (4, 4, 6), (6, 6, 8), (8, 8, 10),]
+    ),
+    t!(
+        teddy030,
+        &["abc"],
+        "abcdefghijklmnopqrstuvwxyzabcdefghijk",
+        &[(0, 0, 3), (0, 26, 29)]
+    ),
+];
+
+// Now define a test for each combination of things above that we want to run.
+// Since there are a few different combinations for each collection of tests,
+// we define a couple of macros to avoid repetition drudgery. The testconfig
+// macro constructs the automaton from a given match kind, and runs the search
+// tests one-by-one over the given collection. The `with` parameter allows one
+// to configure the config with additional parameters. The testcombo macro
+// invokes testconfig in precisely this way: it sets up several tests where
+// each one turns a different knob on Config.
+
+macro_rules! testconfig {
+    ($name:ident, $collection:expr, $with:expr) => {
+        #[test]
+        fn $name() {
+            run_search_tests($collection, |test| {
+                let mut config = Config::new();
+                $with(&mut config);
+                config
+                    .builder()
+                    .extend(test.patterns.iter().map(|p| p.as_bytes()))
+                    .build()
+                    .unwrap()
+                    .find_iter(&test.haystack)
+                    .collect()
+            });
+        }
+    };
+}
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_default_leftmost_first,
+    PACKED_LEFTMOST_FIRST,
+    |_: &mut Config| {}
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_default_leftmost_longest,
+    PACKED_LEFTMOST_LONGEST,
+    |c: &mut Config| {
+        c.match_kind(MatchKind::LeftmostLongest);
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_leftmost_first,
+    PACKED_LEFTMOST_FIRST,
+    |c: &mut Config| {
+        c.force_teddy(true);
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_leftmost_longest,
+    PACKED_LEFTMOST_LONGEST,
+    |c: &mut Config| {
+        c.force_teddy(true).match_kind(MatchKind::LeftmostLongest);
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_ssse3_leftmost_first,
+    PACKED_LEFTMOST_FIRST,
+    |c: &mut Config| {
+        c.force_teddy(true);
+        if is_x86_feature_detected!("ssse3") {
+            c.force_avx(Some(false));
+        }
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_ssse3_leftmost_longest,
+    PACKED_LEFTMOST_LONGEST,
+    |c: &mut Config| {
+        c.force_teddy(true).match_kind(MatchKind::LeftmostLongest);
+        if is_x86_feature_detected!("ssse3") {
+            c.force_avx(Some(false));
+        }
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_avx2_leftmost_first,
+    PACKED_LEFTMOST_FIRST,
+    |c: &mut Config| {
+        c.force_teddy(true);
+        if is_x86_feature_detected!("avx2") {
+            c.force_avx(Some(true));
+        }
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_avx2_leftmost_longest,
+    PACKED_LEFTMOST_LONGEST,
+    |c: &mut Config| {
+        c.force_teddy(true).match_kind(MatchKind::LeftmostLongest);
+        if is_x86_feature_detected!("avx2") {
+            c.force_avx(Some(true));
+        }
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_fat_leftmost_first,
+    PACKED_LEFTMOST_FIRST,
+    |c: &mut Config| {
+        c.force_teddy(true);
+        if is_x86_feature_detected!("avx2") {
+            c.force_teddy_fat(Some(true));
+        }
+    }
+);
+
+#[cfg(target_arch = "x86_64")]
+testconfig!(
+    search_teddy_fat_leftmost_longest,
+    PACKED_LEFTMOST_LONGEST,
+    |c: &mut Config| {
+        c.force_teddy(true).match_kind(MatchKind::LeftmostLongest);
+        if is_x86_feature_detected!("avx2") {
+            c.force_teddy_fat(Some(true));
+        }
+    }
+);
+
+testconfig!(
+    search_rabinkarp_leftmost_first,
+    PACKED_LEFTMOST_FIRST,
+    |c: &mut Config| {
+        c.force_rabin_karp(true);
+    }
+);
+
+testconfig!(
+    search_rabinkarp_leftmost_longest,
+    PACKED_LEFTMOST_LONGEST,
+    |c: &mut Config| {
+        c.force_rabin_karp(true).match_kind(MatchKind::LeftmostLongest);
+    }
+);
+
+#[test]
+fn search_tests_have_unique_names() {
+    let assert = |constname, tests: &[SearchTest]| {
+        let mut seen = HashMap::new(); // map from test name to position
+        for (i, test) in tests.iter().enumerate() {
+            if !seen.contains_key(test.name) {
+                seen.insert(test.name, i);
+            } else {
+                let last = seen[test.name];
+                panic!(
+                    "{} tests have duplicate names at positions {} and {}",
+                    constname, last, i
+                );
+            }
+        }
+    };
+    assert("BASICS", BASICS);
+    assert("LEFTMOST", LEFTMOST);
+    assert("LEFTMOST_FIRST", LEFTMOST_FIRST);
+    assert("LEFTMOST_LONGEST", LEFTMOST_LONGEST);
+    assert("REGRESSION", REGRESSION);
+    assert("TEDDY", TEDDY);
+}
+
+fn run_search_tests<F: FnMut(&SearchTestOwned) -> Vec<Match>>(
+    which: TestCollection,
+    mut f: F,
+) {
+    let get_match_triples =
+        |matches: Vec<Match>| -> Vec<(usize, usize, usize)> {
+            matches
+                .into_iter()
+                .map(|m| (m.pattern(), m.start(), m.end()))
+                .collect()
+        };
+    for &tests in which {
+        for spec in tests {
+            for test in spec.variations() {
+                assert_eq!(
+                    test.matches,
+                    get_match_triples(f(&test)).as_slice(),
+                    "test: {}, patterns: {:?}, haystack: {:?}, offset: {:?}",
+                    test.name,
+                    test.patterns,
+                    test.haystack,
+                    test.offset,
+                );
+            }
+        }
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/packed/vector.rs b/android/vendor/aho-corasick-0.7.18/src/packed/vector.rs
new file mode 100644
index 0000000..ca6c2b0
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/packed/vector.rs
@@ -0,0 +1,181 @@
+// This file contains a set of fairly generic utility functions when working
+// with SIMD vectors.
+//
+// SAFETY: All of the routines below are unsafe to call because they assume
+// the necessary CPU target features in order to use particular vendor
+// intrinsics. Calling these routines when the underlying CPU does not support
+// the appropriate target features is NOT safe. Callers must ensure this
+// themselves.
+//
+// Note that it may not look like this safety invariant is being upheld when
+// these routines are called. Namely, the CPU feature check is typically pretty
+// far away from when these routines are used. Instead, we rely on the fact
+// that certain types serve as a guaranteed receipt that pertinent target
+// features are enabled. For example, the only way TeddySlim3Mask256 can be
+// constructed is if the AVX2 CPU feature is available. Thus, any code running
+// inside of TeddySlim3Mask256 can use any of the functions below without any
+// additional checks: its very existence *is* the check.
+
+use std::arch::x86_64::*;
+
+/// Shift `a` to the left by two bytes (removing its two most significant
+/// bytes), and concatenate it with the the two most significant bytes of `b`.
+#[target_feature(enable = "avx2")]
+pub unsafe fn alignr256_14(a: __m256i, b: __m256i) -> __m256i {
+    // Credit goes to jneem for figuring this out:
+    // https://github.com/jneem/teddy/blob/9ab5e899ad6ef6911aecd3cf1033f1abe6e1f66c/src/x86/teddy_simd.rs#L145-L184
+    //
+    // TL;DR avx2's PALIGNR instruction is actually just two 128-bit PALIGNR
+    // instructions, which is not what we want, so we need to do some extra
+    // shuffling.
+
+    // This permute gives us the low 16 bytes of a concatenated with the high
+    // 16 bytes of b, in order of most significant to least significant. So
+    // `v = a[15:0] b[31:16]`.
+    let v = _mm256_permute2x128_si256(b, a, 0x21);
+    // This effectively does this (where we deal in terms of byte-indexing
+    // and byte-shifting, and use inclusive ranges):
+    //
+    //   ret[15:0]  := ((a[15:0] << 16) | v[15:0]) >> 14
+    //               = ((a[15:0] << 16) | b[31:16]) >> 14
+    //   ret[31:16] := ((a[31:16] << 16) | v[31:16]) >> 14
+    //               = ((a[31:16] << 16) | a[15:0]) >> 14
+    //
+    // Which therefore results in:
+    //
+    //   ret[31:0]  := a[29:16] a[15:14] a[13:0] b[31:30]
+    //
+    // The end result is that we've effectively done this:
+    //
+    //   (a << 2) | (b >> 30)
+    //
+    // When `A` and `B` are strings---where the beginning of the string is in
+    // the least significant bits---we effectively result in the following
+    // semantic operation:
+    //
+    //   (A >> 2) | (B << 30)
+    //
+    // The reversal being attributed to the fact that we are in little-endian.
+    _mm256_alignr_epi8(a, v, 14)
+}
+
+/// Shift `a` to the left by one byte (removing its most significant byte), and
+/// concatenate it with the the most significant byte of `b`.
+#[target_feature(enable = "avx2")]
+pub unsafe fn alignr256_15(a: __m256i, b: __m256i) -> __m256i {
+    // For explanation, see alignr256_14.
+    let v = _mm256_permute2x128_si256(b, a, 0x21);
+    _mm256_alignr_epi8(a, v, 15)
+}
+
+/// Unpack the given 128-bit vector into its 64-bit components. The first
+/// element of the array returned corresponds to the least significant 64-bit
+/// lane in `a`.
+#[target_feature(enable = "ssse3")]
+pub unsafe fn unpack64x128(a: __m128i) -> [u64; 2] {
+    [
+        _mm_cvtsi128_si64(a) as u64,
+        _mm_cvtsi128_si64(_mm_srli_si128(a, 8)) as u64,
+    ]
+}
+
+/// Unpack the given 256-bit vector into its 64-bit components. The first
+/// element of the array returned corresponds to the least significant 64-bit
+/// lane in `a`.
+#[target_feature(enable = "avx2")]
+pub unsafe fn unpack64x256(a: __m256i) -> [u64; 4] {
+    // Using transmute here is precisely equivalent, but actually slower. It's
+    // not quite clear why.
+    let lo = _mm256_extracti128_si256(a, 0);
+    let hi = _mm256_extracti128_si256(a, 1);
+    [
+        _mm_cvtsi128_si64(lo) as u64,
+        _mm_cvtsi128_si64(_mm_srli_si128(lo, 8)) as u64,
+        _mm_cvtsi128_si64(hi) as u64,
+        _mm_cvtsi128_si64(_mm_srli_si128(hi, 8)) as u64,
+    ]
+}
+
+/// Unpack the low 128-bits of `a` and `b`, and return them as 4 64-bit
+/// integers.
+///
+/// More precisely, if a = a4 a3 a2 a1 and b = b4 b3 b2 b1, where each element
+/// is a 64-bit integer and a1/b1 correspond to the least significant 64 bits,
+/// then the return value is `b2 b1 a2 a1`.
+#[target_feature(enable = "avx2")]
+pub unsafe fn unpacklo64x256(a: __m256i, b: __m256i) -> [u64; 4] {
+    let lo = _mm256_castsi256_si128(a);
+    let hi = _mm256_castsi256_si128(b);
+    [
+        _mm_cvtsi128_si64(lo) as u64,
+        _mm_cvtsi128_si64(_mm_srli_si128(lo, 8)) as u64,
+        _mm_cvtsi128_si64(hi) as u64,
+        _mm_cvtsi128_si64(_mm_srli_si128(hi, 8)) as u64,
+    ]
+}
+
+/// Returns true if and only if all bits in the given 128-bit vector are 0.
+#[target_feature(enable = "ssse3")]
+pub unsafe fn is_all_zeroes128(a: __m128i) -> bool {
+    let cmp = _mm_cmpeq_epi8(a, zeroes128());
+    _mm_movemask_epi8(cmp) as u32 == 0xFFFF
+}
+
+/// Returns true if and only if all bits in the given 256-bit vector are 0.
+#[target_feature(enable = "avx2")]
+pub unsafe fn is_all_zeroes256(a: __m256i) -> bool {
+    let cmp = _mm256_cmpeq_epi8(a, zeroes256());
+    _mm256_movemask_epi8(cmp) as u32 == 0xFFFFFFFF
+}
+
+/// Load a 128-bit vector from slice at the given position. The slice does
+/// not need to be unaligned.
+///
+/// Since this code assumes little-endian (there is no big-endian x86), the
+/// bytes starting in `slice[at..]` will be at the least significant bits of
+/// the returned vector. This is important for the surrounding code, since for
+/// example, shifting the resulting vector right is equivalent to logically
+/// shifting the bytes in `slice` left.
+#[target_feature(enable = "sse2")]
+pub unsafe fn loadu128(slice: &[u8], at: usize) -> __m128i {
+    let ptr = slice.get_unchecked(at..).as_ptr();
+    _mm_loadu_si128(ptr as *const u8 as *const __m128i)
+}
+
+/// Load a 256-bit vector from slice at the given position. The slice does
+/// not need to be unaligned.
+///
+/// Since this code assumes little-endian (there is no big-endian x86), the
+/// bytes starting in `slice[at..]` will be at the least significant bits of
+/// the returned vector. This is important for the surrounding code, since for
+/// example, shifting the resulting vector right is equivalent to logically
+/// shifting the bytes in `slice` left.
+#[target_feature(enable = "avx2")]
+pub unsafe fn loadu256(slice: &[u8], at: usize) -> __m256i {
+    let ptr = slice.get_unchecked(at..).as_ptr();
+    _mm256_loadu_si256(ptr as *const u8 as *const __m256i)
+}
+
+/// Returns a 128-bit vector with all bits set to 0.
+#[target_feature(enable = "sse2")]
+pub unsafe fn zeroes128() -> __m128i {
+    _mm_set1_epi8(0)
+}
+
+/// Returns a 256-bit vector with all bits set to 0.
+#[target_feature(enable = "avx2")]
+pub unsafe fn zeroes256() -> __m256i {
+    _mm256_set1_epi8(0)
+}
+
+/// Returns a 128-bit vector with all bits set to 1.
+#[target_feature(enable = "sse2")]
+pub unsafe fn ones128() -> __m128i {
+    _mm_set1_epi8(0xFF as u8 as i8)
+}
+
+/// Returns a 256-bit vector with all bits set to 1.
+#[target_feature(enable = "avx2")]
+pub unsafe fn ones256() -> __m256i {
+    _mm256_set1_epi8(0xFF as u8 as i8)
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/prefilter.rs b/android/vendor/aho-corasick-0.7.18/src/prefilter.rs
new file mode 100644
index 0000000..ef81411
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/prefilter.rs
@@ -0,0 +1,1057 @@
+use std::cmp;
+use std::fmt;
+use std::panic::{RefUnwindSafe, UnwindSafe};
+use std::u8;
+
+use memchr::{memchr, memchr2, memchr3};
+
+use crate::ahocorasick::MatchKind;
+use crate::packed;
+use crate::Match;
+
+/// A candidate is the result of running a prefilter on a haystack at a
+/// particular position. The result is either no match, a confirmed match or
+/// a possible match.
+///
+/// When no match is returned, the prefilter is guaranteeing that no possible
+/// match can be found in the haystack, and the caller may trust this. That is,
+/// all correct prefilters must never report false negatives.
+///
+/// In some cases, a prefilter can confirm a match very quickly, in which case,
+/// the caller may use this to stop what it's doing and report the match. In
+/// this case, prefilter implementations must never report a false positive.
+/// In other cases, the prefilter can only report a potential match, in which
+/// case the callers must attempt to confirm the match. In this case, prefilter
+/// implementations are permitted to return false positives.
+#[derive(Clone, Debug)]
+pub enum Candidate {
+    None,
+    Match(Match),
+    PossibleStartOfMatch(usize),
+}
+
+impl Candidate {
+    /// Convert this candidate into an option. This is useful when callers
+    /// do not distinguish between true positives and false positives (i.e.,
+    /// the caller must always confirm the match in order to update some other
+    /// state).
+    pub fn into_option(self) -> Option<usize> {
+        match self {
+            Candidate::None => None,
+            Candidate::Match(ref m) => Some(m.start()),
+            Candidate::PossibleStartOfMatch(start) => Some(start),
+        }
+    }
+}
+
+/// A prefilter describes the behavior of fast literal scanners for quickly
+/// skipping past bytes in the haystack that we know cannot possibly
+/// participate in a match.
+pub trait Prefilter:
+    Send + Sync + RefUnwindSafe + UnwindSafe + fmt::Debug
+{
+    /// Returns the next possible match candidate. This may yield false
+    /// positives, so callers must confirm a match starting at the position
+    /// returned. This, however, must never produce false negatives. That is,
+    /// this must, at minimum, return the starting position of the next match
+    /// in the given haystack after or at the given position.
+    fn next_candidate(
+        &self,
+        state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate;
+
+    /// A method for cloning a prefilter, to work-around the fact that Clone
+    /// is not object-safe.
+    fn clone_prefilter(&self) -> Box<dyn Prefilter>;
+
+    /// Returns the approximate total amount of heap used by this prefilter, in
+    /// units of bytes.
+    fn heap_bytes(&self) -> usize;
+
+    /// Returns true if and only if this prefilter never returns false
+    /// positives. This is useful for completely avoiding the automaton
+    /// when the prefilter can quickly confirm its own matches.
+    ///
+    /// By default, this returns true, which is conservative; it is always
+    /// correct to return `true`. Returning `false` here and reporting a false
+    /// positive will result in incorrect searches.
+    fn reports_false_positives(&self) -> bool {
+        true
+    }
+
+    /// Returns true if and only if this prefilter may look for a non-starting
+    /// position of a match.
+    ///
+    /// This is useful in a streaming context where prefilters that don't look
+    /// for a starting position of a match can be quite difficult to deal with.
+    ///
+    /// This returns false by default.
+    fn looks_for_non_start_of_match(&self) -> bool {
+        false
+    }
+}
+
+impl<'a, P: Prefilter + ?Sized> Prefilter for &'a P {
+    #[inline]
+    fn next_candidate(
+        &self,
+        state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        (**self).next_candidate(state, haystack, at)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        (**self).clone_prefilter()
+    }
+
+    fn heap_bytes(&self) -> usize {
+        (**self).heap_bytes()
+    }
+
+    fn reports_false_positives(&self) -> bool {
+        (**self).reports_false_positives()
+    }
+}
+
+/// A convenience object for representing any type that implements Prefilter
+/// and is cloneable.
+#[derive(Debug)]
+pub struct PrefilterObj(Box<dyn Prefilter>);
+
+impl Clone for PrefilterObj {
+    fn clone(&self) -> Self {
+        PrefilterObj(self.0.clone_prefilter())
+    }
+}
+
+impl PrefilterObj {
+    /// Create a new prefilter object.
+    pub fn new<T: Prefilter + 'static>(t: T) -> PrefilterObj {
+        PrefilterObj(Box::new(t))
+    }
+
+    /// Return the underlying prefilter trait object.
+    pub fn as_ref(&self) -> &dyn Prefilter {
+        &*self.0
+    }
+}
+
+/// PrefilterState tracks state associated with the effectiveness of a
+/// prefilter. It is used to track how many bytes, on average, are skipped by
+/// the prefilter. If this average dips below a certain threshold over time,
+/// then the state renders the prefilter inert and stops using it.
+///
+/// A prefilter state should be created for each search. (Where creating an
+/// iterator via, e.g., `find_iter`, is treated as a single search.)
+#[derive(Clone, Debug)]
+pub struct PrefilterState {
+    /// The number of skips that has been executed.
+    skips: usize,
+    /// The total number of bytes that have been skipped.
+    skipped: usize,
+    /// The maximum length of a match. This is used to help determine how many
+    /// bytes on average should be skipped in order for a prefilter to be
+    /// effective.
+    max_match_len: usize,
+    /// Once this heuristic has been deemed permanently ineffective, it will be
+    /// inert throughout the rest of its lifetime. This serves as a cheap way
+    /// to check inertness.
+    inert: bool,
+    /// The last (absolute) position at which a prefilter scanned to.
+    /// Prefilters can use this position to determine whether to re-scan or
+    /// not.
+    ///
+    /// Unlike other things that impact effectiveness, this is a fleeting
+    /// condition. That is, a prefilter can be considered ineffective if it is
+    /// at a position before `last_scan_at`, but can become effective again
+    /// once the search moves past `last_scan_at`.
+    ///
+    /// The utility of this is to both avoid additional overhead from calling
+    /// the prefilter and to avoid quadratic behavior. This ensures that a
+    /// prefilter will scan any particular byte at most once. (Note that some
+    /// prefilters, like the start-byte prefilter, do not need to use this
+    /// field at all, since it only looks for starting bytes.)
+    last_scan_at: usize,
+}
+
+impl PrefilterState {
+    /// The minimum number of skip attempts to try before considering whether
+    /// a prefilter is effective or not.
+    const MIN_SKIPS: usize = 40;
+
+    /// The minimum amount of bytes that skipping must average, expressed as a
+    /// factor of the multiple of the length of a possible match.
+    ///
+    /// That is, after MIN_SKIPS have occurred, if the average number of bytes
+    /// skipped ever falls below MIN_AVG_FACTOR * max-match-length, then the
+    /// prefilter outed to be rendered inert.
+    const MIN_AVG_FACTOR: usize = 2;
+
+    /// Create a fresh prefilter state.
+    pub fn new(max_match_len: usize) -> PrefilterState {
+        PrefilterState {
+            skips: 0,
+            skipped: 0,
+            max_match_len,
+            inert: false,
+            last_scan_at: 0,
+        }
+    }
+
+    /// Create a prefilter state that always disables the prefilter.
+    pub fn disabled() -> PrefilterState {
+        PrefilterState {
+            skips: 0,
+            skipped: 0,
+            max_match_len: 0,
+            inert: true,
+            last_scan_at: 0,
+        }
+    }
+
+    /// Update this state with the number of bytes skipped on the last
+    /// invocation of the prefilter.
+    #[inline]
+    fn update_skipped_bytes(&mut self, skipped: usize) {
+        self.skips += 1;
+        self.skipped += skipped;
+    }
+
+    /// Updates the position at which the last scan stopped. This may be
+    /// greater than the position of the last candidate reported. For example,
+    /// searching for the "rare" byte `z` in `abczdef` for the pattern `abcz`
+    /// will report a candidate at position `0`, but the end of its last scan
+    /// will be at position `3`.
+    ///
+    /// This position factors into the effectiveness of this prefilter. If the
+    /// current position is less than the last position at which a scan ended,
+    /// then the prefilter should not be re-run until the search moves past
+    /// that position.
+    #[inline]
+    fn update_at(&mut self, at: usize) {
+        if at > self.last_scan_at {
+            self.last_scan_at = at;
+        }
+    }
+
+    /// Return true if and only if this state indicates that a prefilter is
+    /// still effective.
+    ///
+    /// The given pos should correspond to the current starting position of the
+    /// search.
+    #[inline]
+    pub fn is_effective(&mut self, at: usize) -> bool {
+        if self.inert {
+            return false;
+        }
+        if at < self.last_scan_at {
+            return false;
+        }
+        if self.skips < PrefilterState::MIN_SKIPS {
+            return true;
+        }
+
+        let min_avg = PrefilterState::MIN_AVG_FACTOR * self.max_match_len;
+        if self.skipped >= min_avg * self.skips {
+            return true;
+        }
+
+        // We're inert.
+        self.inert = true;
+        false
+    }
+}
+
+/// A builder for constructing the best possible prefilter. When constructed,
+/// this builder will heuristically select the best prefilter it can build,
+/// if any, and discard the rest.
+#[derive(Debug)]
+pub struct Builder {
+    count: usize,
+    ascii_case_insensitive: bool,
+    start_bytes: StartBytesBuilder,
+    rare_bytes: RareBytesBuilder,
+    packed: Option<packed::Builder>,
+}
+
+impl Builder {
+    /// Create a new builder for constructing the best possible prefilter.
+    pub fn new(kind: MatchKind) -> Builder {
+        let pbuilder = kind
+            .as_packed()
+            .map(|kind| packed::Config::new().match_kind(kind).builder());
+        Builder {
+            count: 0,
+            ascii_case_insensitive: false,
+            start_bytes: StartBytesBuilder::new(),
+            rare_bytes: RareBytesBuilder::new(),
+            packed: pbuilder,
+        }
+    }
+
+    /// Enable ASCII case insensitivity. When set, byte strings added to this
+    /// builder will be interpreted without respect to ASCII case.
+    pub fn ascii_case_insensitive(mut self, yes: bool) -> Builder {
+        self.ascii_case_insensitive = yes;
+        self.start_bytes = self.start_bytes.ascii_case_insensitive(yes);
+        self.rare_bytes = self.rare_bytes.ascii_case_insensitive(yes);
+        self
+    }
+
+    /// Return a prefilter suitable for quickly finding potential matches.
+    ///
+    /// All patterns added to an Aho-Corasick automaton should be added to this
+    /// builder before attempting to construct the prefilter.
+    pub fn build(&self) -> Option<PrefilterObj> {
+        // match (self.start_bytes.build(), self.rare_bytes.build()) {
+        match (self.start_bytes.build(), self.rare_bytes.build()) {
+            // If we could build both start and rare prefilters, then there are
+            // a few cases in which we'd want to use the start-byte prefilter
+            // over the rare-byte prefilter, since the former has lower
+            // overhead.
+            (prestart @ Some(_), prerare @ Some(_)) => {
+                // If the start-byte prefilter can scan for a smaller number
+                // of bytes than the rare-byte prefilter, then it's probably
+                // faster.
+                let has_fewer_bytes =
+                    self.start_bytes.count < self.rare_bytes.count;
+                // Otherwise, if the combined frequency rank of the detected
+                // bytes in the start-byte prefilter is "close" to the combined
+                // frequency rank of the rare-byte prefilter, then we pick
+                // the start-byte prefilter even if the rare-byte prefilter
+                // heuristically searches for rare bytes. This is because the
+                // rare-byte prefilter has higher constant costs, so we tend to
+                // prefer the start-byte prefilter when we can.
+                let has_rarer_bytes =
+                    self.start_bytes.rank_sum <= self.rare_bytes.rank_sum + 50;
+                if has_fewer_bytes || has_rarer_bytes {
+                    prestart
+                } else {
+                    prerare
+                }
+            }
+            (prestart @ Some(_), None) => prestart,
+            (None, prerare @ Some(_)) => prerare,
+            (None, None) if self.ascii_case_insensitive => None,
+            (None, None) => self
+                .packed
+                .as_ref()
+                .and_then(|b| b.build())
+                .map(|s| PrefilterObj::new(Packed(s))),
+        }
+    }
+
+    /// Add a literal string to this prefilter builder.
+    pub fn add(&mut self, bytes: &[u8]) {
+        self.count += 1;
+        self.start_bytes.add(bytes);
+        self.rare_bytes.add(bytes);
+        if let Some(ref mut pbuilder) = self.packed {
+            pbuilder.add(bytes);
+        }
+    }
+}
+
+/// A type that wraps a packed searcher and implements the `Prefilter`
+/// interface.
+#[derive(Clone, Debug)]
+struct Packed(packed::Searcher);
+
+impl Prefilter for Packed {
+    fn next_candidate(
+        &self,
+        _state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        self.0.find_at(haystack, at).map_or(Candidate::None, Candidate::Match)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        self.0.heap_bytes()
+    }
+
+    fn reports_false_positives(&self) -> bool {
+        false
+    }
+}
+
+/// A builder for constructing a rare byte prefilter.
+///
+/// A rare byte prefilter attempts to pick out a small set of rare bytes that
+/// occurr in the patterns, and then quickly scan to matches of those rare
+/// bytes.
+#[derive(Clone, Debug)]
+struct RareBytesBuilder {
+    /// Whether this prefilter should account for ASCII case insensitivity or
+    /// not.
+    ascii_case_insensitive: bool,
+    /// A set of rare bytes, indexed by byte value.
+    rare_set: ByteSet,
+    /// A set of byte offsets associated with bytes in a pattern. An entry
+    /// corresponds to a particular bytes (its index) and is only non-zero if
+    /// the byte occurred at an offset greater than 0 in at least one pattern.
+    ///
+    /// If a byte's offset is not representable in 8 bits, then the rare bytes
+    /// prefilter becomes inert.
+    byte_offsets: RareByteOffsets,
+    /// Whether this is available as a prefilter or not. This can be set to
+    /// false during construction if a condition is seen that invalidates the
+    /// use of the rare-byte prefilter.
+    available: bool,
+    /// The number of bytes set to an active value in `byte_offsets`.
+    count: usize,
+    /// The sum of frequency ranks for the rare bytes detected. This is
+    /// intended to give a heuristic notion of how rare the bytes are.
+    rank_sum: u16,
+}
+
+/// A set of bytes.
+#[derive(Clone, Copy)]
+struct ByteSet([bool; 256]);
+
+impl ByteSet {
+    fn empty() -> ByteSet {
+        ByteSet([false; 256])
+    }
+
+    fn insert(&mut self, b: u8) -> bool {
+        let new = !self.contains(b);
+        self.0[b as usize] = true;
+        new
+    }
+
+    fn contains(&self, b: u8) -> bool {
+        self.0[b as usize]
+    }
+}
+
+impl fmt::Debug for ByteSet {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut bytes = vec![];
+        for b in 0..=255 {
+            if self.contains(b) {
+                bytes.push(b);
+            }
+        }
+        f.debug_struct("ByteSet").field("set", &bytes).finish()
+    }
+}
+
+/// A set of byte offsets, keyed by byte.
+#[derive(Clone, Copy)]
+struct RareByteOffsets {
+    /// Each entry corresponds to the maximum offset of the corresponding
+    /// byte across all patterns seen.
+    set: [RareByteOffset; 256],
+}
+
+impl RareByteOffsets {
+    /// Create a new empty set of rare byte offsets.
+    pub fn empty() -> RareByteOffsets {
+        RareByteOffsets { set: [RareByteOffset::default(); 256] }
+    }
+
+    /// Add the given offset for the given byte to this set. If the offset is
+    /// greater than the existing offset, then it overwrites the previous
+    /// value and returns false. If there is no previous value set, then this
+    /// sets it and returns true.
+    pub fn set(&mut self, byte: u8, off: RareByteOffset) {
+        self.set[byte as usize].max =
+            cmp::max(self.set[byte as usize].max, off.max);
+    }
+}
+
+impl fmt::Debug for RareByteOffsets {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut offsets = vec![];
+        for off in self.set.iter() {
+            if off.max > 0 {
+                offsets.push(off);
+            }
+        }
+        f.debug_struct("RareByteOffsets").field("set", &offsets).finish()
+    }
+}
+
+/// Offsets associated with an occurrence of a "rare" byte in any of the
+/// patterns used to construct a single Aho-Corasick automaton.
+#[derive(Clone, Copy, Debug)]
+struct RareByteOffset {
+    /// The maximum offset at which a particular byte occurs from the start
+    /// of any pattern. This is used as a shift amount. That is, when an
+    /// occurrence of this byte is found, the candidate position reported by
+    /// the prefilter is `position_of_byte - max`, such that the automaton
+    /// will begin its search at a position that is guaranteed to observe a
+    /// match.
+    ///
+    /// To avoid accidentally quadratic behavior, a prefilter is considered
+    /// ineffective when it is asked to start scanning from a position that it
+    /// has already scanned past.
+    ///
+    /// Using a `u8` here means that if we ever see a pattern that's longer
+    /// than 255 bytes, then the entire rare byte prefilter is disabled.
+    max: u8,
+}
+
+impl Default for RareByteOffset {
+    fn default() -> RareByteOffset {
+        RareByteOffset { max: 0 }
+    }
+}
+
+impl RareByteOffset {
+    /// Create a new rare byte offset. If the given offset is too big, then
+    /// None is returned. In that case, callers should render the rare bytes
+    /// prefilter inert.
+    fn new(max: usize) -> Option<RareByteOffset> {
+        if max > u8::MAX as usize {
+            None
+        } else {
+            Some(RareByteOffset { max: max as u8 })
+        }
+    }
+}
+
+impl RareBytesBuilder {
+    /// Create a new builder for constructing a rare byte prefilter.
+    fn new() -> RareBytesBuilder {
+        RareBytesBuilder {
+            ascii_case_insensitive: false,
+            rare_set: ByteSet::empty(),
+            byte_offsets: RareByteOffsets::empty(),
+            available: true,
+            count: 0,
+            rank_sum: 0,
+        }
+    }
+
+    /// Enable ASCII case insensitivity. When set, byte strings added to this
+    /// builder will be interpreted without respect to ASCII case.
+    fn ascii_case_insensitive(mut self, yes: bool) -> RareBytesBuilder {
+        self.ascii_case_insensitive = yes;
+        self
+    }
+
+    /// Build the rare bytes prefilter.
+    ///
+    /// If there are more than 3 distinct starting bytes, or if heuristics
+    /// otherwise determine that this prefilter should not be used, then `None`
+    /// is returned.
+    fn build(&self) -> Option<PrefilterObj> {
+        if !self.available || self.count > 3 {
+            return None;
+        }
+        let (mut bytes, mut len) = ([0; 3], 0);
+        for b in 0..=255 {
+            if self.rare_set.contains(b) {
+                bytes[len] = b as u8;
+                len += 1;
+            }
+        }
+        match len {
+            0 => None,
+            1 => Some(PrefilterObj::new(RareBytesOne {
+                byte1: bytes[0],
+                offset: self.byte_offsets.set[bytes[0] as usize],
+            })),
+            2 => Some(PrefilterObj::new(RareBytesTwo {
+                offsets: self.byte_offsets,
+                byte1: bytes[0],
+                byte2: bytes[1],
+            })),
+            3 => Some(PrefilterObj::new(RareBytesThree {
+                offsets: self.byte_offsets,
+                byte1: bytes[0],
+                byte2: bytes[1],
+                byte3: bytes[2],
+            })),
+            _ => unreachable!(),
+        }
+    }
+
+    /// Add a byte string to this builder.
+    ///
+    /// All patterns added to an Aho-Corasick automaton should be added to this
+    /// builder before attempting to construct the prefilter.
+    fn add(&mut self, bytes: &[u8]) {
+        // If we've already given up, then do nothing.
+        if !self.available {
+            return;
+        }
+        // If we've already blown our budget, then don't waste time looking
+        // for more rare bytes.
+        if self.count > 3 {
+            self.available = false;
+            return;
+        }
+        // If the pattern is too long, then our offset table is bunk, so
+        // give up.
+        if bytes.len() >= 256 {
+            self.available = false;
+            return;
+        }
+        let mut rarest = match bytes.get(0) {
+            None => return,
+            Some(&b) => (b, freq_rank(b)),
+        };
+        // The idea here is to look for the rarest byte in each pattern, and
+        // add that to our set. As a special exception, if we see a byte that
+        // we've already added, then we immediately stop and choose that byte,
+        // even if there's another rare byte in the pattern. This helps us
+        // apply the rare byte optimization in more cases by attempting to pick
+        // bytes that are in common between patterns. So for example, if we
+        // were searching for `Sherlock` and `lockjaw`, then this would pick
+        // `k` for both patterns, resulting in the use of `memchr` instead of
+        // `memchr2` for `k` and `j`.
+        let mut found = false;
+        for (pos, &b) in bytes.iter().enumerate() {
+            self.set_offset(pos, b);
+            if found {
+                continue;
+            }
+            if self.rare_set.contains(b) {
+                found = true;
+                continue;
+            }
+            let rank = freq_rank(b);
+            if rank < rarest.1 {
+                rarest = (b, rank);
+            }
+        }
+        if !found {
+            self.add_rare_byte(rarest.0);
+        }
+    }
+
+    fn set_offset(&mut self, pos: usize, byte: u8) {
+        // This unwrap is OK because pos is never bigger than our max.
+        let offset = RareByteOffset::new(pos).unwrap();
+        self.byte_offsets.set(byte, offset);
+        if self.ascii_case_insensitive {
+            self.byte_offsets.set(opposite_ascii_case(byte), offset);
+        }
+    }
+
+    fn add_rare_byte(&mut self, byte: u8) {
+        self.add_one_rare_byte(byte);
+        if self.ascii_case_insensitive {
+            self.add_one_rare_byte(opposite_ascii_case(byte));
+        }
+    }
+
+    fn add_one_rare_byte(&mut self, byte: u8) {
+        if self.rare_set.insert(byte) {
+            self.count += 1;
+            self.rank_sum += freq_rank(byte) as u16;
+        }
+    }
+}
+
+/// A prefilter for scanning for a single "rare" byte.
+#[derive(Clone, Debug)]
+struct RareBytesOne {
+    byte1: u8,
+    offset: RareByteOffset,
+}
+
+impl Prefilter for RareBytesOne {
+    fn next_candidate(
+        &self,
+        state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        memchr(self.byte1, &haystack[at..])
+            .map(|i| {
+                let pos = at + i;
+                state.last_scan_at = pos;
+                cmp::max(at, pos.saturating_sub(self.offset.max as usize))
+            })
+            .map_or(Candidate::None, Candidate::PossibleStartOfMatch)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        0
+    }
+
+    fn looks_for_non_start_of_match(&self) -> bool {
+        // TODO: It should be possible to use a rare byte prefilter in a
+        // streaming context. The main problem is that we usually assume that
+        // if a prefilter has scanned some text and not found anything, then no
+        // match *starts* in that text. This doesn't matter in non-streaming
+        // contexts, but in a streaming context, if we're looking for a byte
+        // that doesn't start at the beginning of a match and don't find it,
+        // then it's still possible for a match to start at the end of the
+        // current buffer content. In order to fix this, the streaming searcher
+        // would need to become aware of prefilters that do this and use the
+        // appropriate offset in various places. It is quite a delicate change
+        // and probably shouldn't be attempted until streaming search has a
+        // better testing strategy. In particular, we'd really like to be able
+        // to vary the buffer size to force strange cases that occur at the
+        // edge of the buffer. If we make the buffer size minimal, then these
+        // cases occur more frequently and easier.
+        //
+        // This is also a bummer because this means that if the prefilter
+        // builder chose a rare byte prefilter, then a streaming search won't
+        // use any prefilter at all because the builder doesn't know how it's
+        // going to be used. Assuming we don't make streaming search aware of
+        // these special types of prefilters as described above, we could fix
+        // this by building a "backup" prefilter that could be used when the
+        // rare byte prefilter could not. But that's a bandaide. Sigh.
+        true
+    }
+}
+
+/// A prefilter for scanning for two "rare" bytes.
+#[derive(Clone, Debug)]
+struct RareBytesTwo {
+    offsets: RareByteOffsets,
+    byte1: u8,
+    byte2: u8,
+}
+
+impl Prefilter for RareBytesTwo {
+    fn next_candidate(
+        &self,
+        state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        memchr2(self.byte1, self.byte2, &haystack[at..])
+            .map(|i| {
+                let pos = at + i;
+                state.update_at(pos);
+                let offset = self.offsets.set[haystack[pos] as usize].max;
+                cmp::max(at, pos.saturating_sub(offset as usize))
+            })
+            .map_or(Candidate::None, Candidate::PossibleStartOfMatch)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        0
+    }
+
+    fn looks_for_non_start_of_match(&self) -> bool {
+        // TODO: See Prefilter impl for RareBytesOne.
+        true
+    }
+}
+
+/// A prefilter for scanning for three "rare" bytes.
+#[derive(Clone, Debug)]
+struct RareBytesThree {
+    offsets: RareByteOffsets,
+    byte1: u8,
+    byte2: u8,
+    byte3: u8,
+}
+
+impl Prefilter for RareBytesThree {
+    fn next_candidate(
+        &self,
+        state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        memchr3(self.byte1, self.byte2, self.byte3, &haystack[at..])
+            .map(|i| {
+                let pos = at + i;
+                state.update_at(pos);
+                let offset = self.offsets.set[haystack[pos] as usize].max;
+                cmp::max(at, pos.saturating_sub(offset as usize))
+            })
+            .map_or(Candidate::None, Candidate::PossibleStartOfMatch)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        0
+    }
+
+    fn looks_for_non_start_of_match(&self) -> bool {
+        // TODO: See Prefilter impl for RareBytesOne.
+        true
+    }
+}
+
+/// A builder for constructing a starting byte prefilter.
+///
+/// A starting byte prefilter is a simplistic prefilter that looks for possible
+/// matches by reporting all positions corresponding to a particular byte. This
+/// generally only takes affect when there are at most 3 distinct possible
+/// starting bytes. e.g., the patterns `foo`, `bar`, and `baz` have two
+/// distinct starting bytes (`f` and `b`), and this prefilter returns all
+/// occurrences of either `f` or `b`.
+///
+/// In some cases, a heuristic frequency analysis may determine that it would
+/// be better not to use this prefilter even when there are 3 or fewer distinct
+/// starting bytes.
+#[derive(Clone, Debug)]
+struct StartBytesBuilder {
+    /// Whether this prefilter should account for ASCII case insensitivity or
+    /// not.
+    ascii_case_insensitive: bool,
+    /// The set of starting bytes observed.
+    byteset: Vec<bool>,
+    /// The number of bytes set to true in `byteset`.
+    count: usize,
+    /// The sum of frequency ranks for the rare bytes detected. This is
+    /// intended to give a heuristic notion of how rare the bytes are.
+    rank_sum: u16,
+}
+
+impl StartBytesBuilder {
+    /// Create a new builder for constructing a start byte prefilter.
+    fn new() -> StartBytesBuilder {
+        StartBytesBuilder {
+            ascii_case_insensitive: false,
+            byteset: vec![false; 256],
+            count: 0,
+            rank_sum: 0,
+        }
+    }
+
+    /// Enable ASCII case insensitivity. When set, byte strings added to this
+    /// builder will be interpreted without respect to ASCII case.
+    fn ascii_case_insensitive(mut self, yes: bool) -> StartBytesBuilder {
+        self.ascii_case_insensitive = yes;
+        self
+    }
+
+    /// Build the starting bytes prefilter.
+    ///
+    /// If there are more than 3 distinct starting bytes, or if heuristics
+    /// otherwise determine that this prefilter should not be used, then `None`
+    /// is returned.
+    fn build(&self) -> Option<PrefilterObj> {
+        if self.count > 3 {
+            return None;
+        }
+        let (mut bytes, mut len) = ([0; 3], 0);
+        for b in 0..256 {
+            if !self.byteset[b] {
+                continue;
+            }
+            // We don't handle non-ASCII bytes for now. Getting non-ASCII
+            // bytes right is trickier, since we generally don't want to put
+            // a leading UTF-8 code unit into a prefilter that isn't ASCII,
+            // since they can frequently. Instead, it would be better to use a
+            // continuation byte, but this requires more sophisticated analysis
+            // of the automaton and a richer prefilter API.
+            if b > 0x7F {
+                return None;
+            }
+            bytes[len] = b as u8;
+            len += 1;
+        }
+        match len {
+            0 => None,
+            1 => Some(PrefilterObj::new(StartBytesOne { byte1: bytes[0] })),
+            2 => Some(PrefilterObj::new(StartBytesTwo {
+                byte1: bytes[0],
+                byte2: bytes[1],
+            })),
+            3 => Some(PrefilterObj::new(StartBytesThree {
+                byte1: bytes[0],
+                byte2: bytes[1],
+                byte3: bytes[2],
+            })),
+            _ => unreachable!(),
+        }
+    }
+
+    /// Add a byte string to this builder.
+    ///
+    /// All patterns added to an Aho-Corasick automaton should be added to this
+    /// builder before attempting to construct the prefilter.
+    fn add(&mut self, bytes: &[u8]) {
+        if self.count > 3 {
+            return;
+        }
+        if let Some(&byte) = bytes.get(0) {
+            self.add_one_byte(byte);
+            if self.ascii_case_insensitive {
+                self.add_one_byte(opposite_ascii_case(byte));
+            }
+        }
+    }
+
+    fn add_one_byte(&mut self, byte: u8) {
+        if !self.byteset[byte as usize] {
+            self.byteset[byte as usize] = true;
+            self.count += 1;
+            self.rank_sum += freq_rank(byte) as u16;
+        }
+    }
+}
+
+/// A prefilter for scanning for a single starting byte.
+#[derive(Clone, Debug)]
+struct StartBytesOne {
+    byte1: u8,
+}
+
+impl Prefilter for StartBytesOne {
+    fn next_candidate(
+        &self,
+        _state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        memchr(self.byte1, &haystack[at..])
+            .map(|i| at + i)
+            .map_or(Candidate::None, Candidate::PossibleStartOfMatch)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        0
+    }
+}
+
+/// A prefilter for scanning for two starting bytes.
+#[derive(Clone, Debug)]
+struct StartBytesTwo {
+    byte1: u8,
+    byte2: u8,
+}
+
+impl Prefilter for StartBytesTwo {
+    fn next_candidate(
+        &self,
+        _state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        memchr2(self.byte1, self.byte2, &haystack[at..])
+            .map(|i| at + i)
+            .map_or(Candidate::None, Candidate::PossibleStartOfMatch)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        0
+    }
+}
+
+/// A prefilter for scanning for three starting bytes.
+#[derive(Clone, Debug)]
+struct StartBytesThree {
+    byte1: u8,
+    byte2: u8,
+    byte3: u8,
+}
+
+impl Prefilter for StartBytesThree {
+    fn next_candidate(
+        &self,
+        _state: &mut PrefilterState,
+        haystack: &[u8],
+        at: usize,
+    ) -> Candidate {
+        memchr3(self.byte1, self.byte2, self.byte3, &haystack[at..])
+            .map(|i| at + i)
+            .map_or(Candidate::None, Candidate::PossibleStartOfMatch)
+    }
+
+    fn clone_prefilter(&self) -> Box<dyn Prefilter> {
+        Box::new(self.clone())
+    }
+
+    fn heap_bytes(&self) -> usize {
+        0
+    }
+}
+
+/// Return the next candidate reported by the given prefilter while
+/// simultaneously updating the given prestate.
+///
+/// The caller is responsible for checking the prestate before deciding whether
+/// to initiate a search.
+#[inline]
+pub fn next<P: Prefilter>(
+    prestate: &mut PrefilterState,
+    prefilter: P,
+    haystack: &[u8],
+    at: usize,
+) -> Candidate {
+    let cand = prefilter.next_candidate(prestate, haystack, at);
+    match cand {
+        Candidate::None => {
+            prestate.update_skipped_bytes(haystack.len() - at);
+        }
+        Candidate::Match(ref m) => {
+            prestate.update_skipped_bytes(m.start() - at);
+        }
+        Candidate::PossibleStartOfMatch(i) => {
+            prestate.update_skipped_bytes(i - at);
+        }
+    }
+    cand
+}
+
+/// If the given byte is an ASCII letter, then return it in the opposite case.
+/// e.g., Given `b'A'`, this returns `b'a'`, and given `b'a'`, this returns
+/// `b'A'`. If a non-ASCII letter is given, then the given byte is returned.
+pub fn opposite_ascii_case(b: u8) -> u8 {
+    if b'A' <= b && b <= b'Z' {
+        b.to_ascii_lowercase()
+    } else if b'a' <= b && b <= b'z' {
+        b.to_ascii_uppercase()
+    } else {
+        b
+    }
+}
+
+/// Return the frequency rank of the given byte. The higher the rank, the more
+/// common the byte (heuristically speaking).
+fn freq_rank(b: u8) -> u8 {
+    use crate::byte_frequencies::BYTE_FREQUENCIES;
+    BYTE_FREQUENCIES[b as usize]
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn scratch() {
+        let mut b = Builder::new(MatchKind::LeftmostFirst);
+        b.add(b"Sherlock");
+        b.add(b"locjaw");
+        // b.add(b"Sherlock");
+        // b.add(b"Holmes");
+        // b.add(b"Watson");
+        // b.add("Шерлок Холмс".as_bytes());
+        // b.add("Джон Уотсон".as_bytes());
+
+        let s = b.build().unwrap();
+        println!("{:?}", s);
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/state_id.rs b/android/vendor/aho-corasick-0.7.18/src/state_id.rs
new file mode 100644
index 0000000..8973806
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/state_id.rs
@@ -0,0 +1,192 @@
+use std::fmt::Debug;
+use std::hash::Hash;
+
+use crate::error::{Error, Result};
+
+// NOTE: Most of this code was copied from regex-automata, but without the
+// (de)serialization specific stuff.
+
+/// Check that the premultiplication of the given state identifier can
+/// fit into the representation indicated by `S`. If it cannot, or if it
+/// overflows `usize` itself, then an error is returned.
+pub fn premultiply_overflow_error<S: StateID>(
+    last_state: S,
+    alphabet_len: usize,
+) -> Result<()> {
+    let requested = match last_state.to_usize().checked_mul(alphabet_len) {
+        Some(requested) => requested,
+        None => return Err(Error::premultiply_overflow(0, 0)),
+    };
+    if requested > S::max_id() {
+        return Err(Error::premultiply_overflow(S::max_id(), requested));
+    }
+    Ok(())
+}
+
+/// Convert the given `usize` to the chosen state identifier
+/// representation. If the given value cannot fit in the chosen
+/// representation, then an error is returned.
+pub fn usize_to_state_id<S: StateID>(value: usize) -> Result<S> {
+    if value > S::max_id() {
+        Err(Error::state_id_overflow(S::max_id()))
+    } else {
+        Ok(S::from_usize(value))
+    }
+}
+
+/// Return the unique identifier for an automaton's fail state in the chosen
+/// representation indicated by `S`.
+pub fn fail_id<S: StateID>() -> S {
+    S::from_usize(0)
+}
+
+/// Return the unique identifier for an automaton's fail state in the chosen
+/// representation indicated by `S`.
+pub fn dead_id<S: StateID>() -> S {
+    S::from_usize(1)
+}
+
+mod private {
+    /// Sealed stops crates other than aho-corasick from implementing any
+    /// traits that use it.
+    pub trait Sealed {}
+    impl Sealed for u8 {}
+    impl Sealed for u16 {}
+    impl Sealed for u32 {}
+    impl Sealed for u64 {}
+    impl Sealed for usize {}
+}
+
+/// A trait describing the representation of an automaton's state identifier.
+///
+/// The purpose of this trait is to safely express both the possible state
+/// identifier representations that can be used in an automaton and to convert
+/// between state identifier representations and types that can be used to
+/// efficiently index memory (such as `usize`).
+///
+/// In general, one should not need to implement this trait explicitly. Indeed,
+/// for now, this trait is sealed such that it cannot be implemented by any
+/// other type. In particular, this crate provides implementations for `u8`,
+/// `u16`, `u32`, `u64` and `usize`. (`u32` and `u64` are only provided for
+/// targets that can represent all corresponding values in a `usize`.)
+pub trait StateID:
+    private::Sealed
+    + Clone
+    + Copy
+    + Debug
+    + Eq
+    + Hash
+    + PartialEq
+    + PartialOrd
+    + Ord
+{
+    /// Convert from a `usize` to this implementation's representation.
+    ///
+    /// Implementors may assume that `n <= Self::max_id`. That is, implementors
+    /// do not need to check whether `n` can fit inside this implementation's
+    /// representation.
+    fn from_usize(n: usize) -> Self;
+
+    /// Convert this implementation's representation to a `usize`.
+    ///
+    /// Implementors must not return a `usize` value greater than
+    /// `Self::max_id` and must not permit overflow when converting between the
+    /// implementor's representation and `usize`. In general, the preferred
+    /// way for implementors to achieve this is to simply not provide
+    /// implementations of `StateID` that cannot fit into the target platform's
+    /// `usize`.
+    fn to_usize(self) -> usize;
+
+    /// Return the maximum state identifier supported by this representation.
+    ///
+    /// Implementors must return a correct bound. Doing otherwise may result
+    /// in unspecified behavior (but will not violate memory safety).
+    fn max_id() -> usize;
+}
+
+impl StateID for usize {
+    #[inline]
+    fn from_usize(n: usize) -> usize {
+        n
+    }
+
+    #[inline]
+    fn to_usize(self) -> usize {
+        self
+    }
+
+    #[inline]
+    fn max_id() -> usize {
+        ::std::usize::MAX
+    }
+}
+
+impl StateID for u8 {
+    #[inline]
+    fn from_usize(n: usize) -> u8 {
+        n as u8
+    }
+
+    #[inline]
+    fn to_usize(self) -> usize {
+        self as usize
+    }
+
+    #[inline]
+    fn max_id() -> usize {
+        ::std::u8::MAX as usize
+    }
+}
+
+impl StateID for u16 {
+    #[inline]
+    fn from_usize(n: usize) -> u16 {
+        n as u16
+    }
+
+    #[inline]
+    fn to_usize(self) -> usize {
+        self as usize
+    }
+
+    #[inline]
+    fn max_id() -> usize {
+        ::std::u16::MAX as usize
+    }
+}
+
+#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
+impl StateID for u32 {
+    #[inline]
+    fn from_usize(n: usize) -> u32 {
+        n as u32
+    }
+
+    #[inline]
+    fn to_usize(self) -> usize {
+        self as usize
+    }
+
+    #[inline]
+    fn max_id() -> usize {
+        ::std::u32::MAX as usize
+    }
+}
+
+#[cfg(target_pointer_width = "64")]
+impl StateID for u64 {
+    #[inline]
+    fn from_usize(n: usize) -> u64 {
+        n as u64
+    }
+
+    #[inline]
+    fn to_usize(self) -> usize {
+        self as usize
+    }
+
+    #[inline]
+    fn max_id() -> usize {
+        ::std::u64::MAX as usize
+    }
+}
diff --git a/android/vendor/aho-corasick-0.7.18/src/tests.rs b/android/vendor/aho-corasick-0.7.18/src/tests.rs
new file mode 100644
index 0000000..25c0d5f
--- /dev/null
+++ b/android/vendor/aho-corasick-0.7.18/src/tests.rs
@@ -0,0 +1,1252 @@
+use std::collections::HashMap;
+use std::io;
+use std::usize;
+
+use crate::{AhoCorasickBuilder, Match, MatchKind};
+
+/// A description of a single test against an Aho-Corasick automaton.
+///
+/// A single test may not necessarily pass on every configuration of an
+/// Aho-Corasick automaton. The tests are categorized and grouped appropriately
+/// below.
+#[derive(Clone, Debug, Eq, PartialEq)]
+struct SearchTest {
+    /// The name of this test, for debugging.
+    name: &'static str,
+    /// The patterns to search for.
+    patterns: &'static [&'static str],
+    /// The text to search.
+    haystack: &'static str,
+    /// Each match is a triple of (pattern_index, start, end), where
+    /// pattern_index is an index into `patterns` and `start`/`end` are indices
+    /// into `haystack`.
+    matches: &'static [(usize, usize, usize)],
+}
+
+/// Short-hand constructor for SearchTest. We use it a lot below.
+macro_rules! t {
+    ($name:ident, $patterns:expr, $haystack:expr, $matches:expr) => {
+        SearchTest {
+            name: stringify!($name),
+            patterns: $patterns,
+            haystack: $haystack,
+            matches: $matches,
+        }
+    };
+}
+
+/// A collection of test groups.
+type TestCollection = &'static [&'static [SearchTest]];
+
+// Define several collections corresponding to the different type of match
+// semantics supported by Aho-Corasick. These collections have some overlap,
+// but each collection should have some tests that no other collection has.
+
+/// Tests for Aho-Corasick's standard non-overlapping match semantics.
+const AC_STANDARD_NON_OVERLAPPING: TestCollection =
+    &[BASICS, NON_OVERLAPPING, STANDARD, REGRESSION];
+
+/// Tests for Aho-Corasick's anchored standard non-overlapping match semantics.
+const AC_STANDARD_ANCHORED_NON_OVERLAPPING: TestCollection =
+    &[ANCHORED_BASICS, ANCHORED_NON_OVERLAPPING, STANDARD_ANCHORED];
+
+/// Tests for Aho-Corasick's standard overlapping match semantics.
+const AC_STANDARD_OVERLAPPING: TestCollection =
+    &[BASICS, OVERLAPPING, REGRESSION];
+
+/// Tests for Aho-Corasick's anchored standard overlapping match semantics.
+const AC_STANDARD_ANCHORED_OVERLAPPING: TestCollection =
+    &[ANCHORED_BASICS, ANCHORED_OVERLAPPING];
+
+/// Tests for Aho-Corasick's leftmost-first match semantics.
+const AC_LEFTMOST_FIRST: TestCollection =
+    &[BASICS, NON_OVERLAPPING, LEFTMOST, LEFTMOST_FIRST, REGRESSION];
+
+/// Tests for Aho-Corasick's anchored leftmost-first match semantics.
+const AC_LEFTMOST_FIRST_ANCHORED: TestCollection = &[
+    ANCHORED_BASICS,
+    ANCHORED_NON_OVERLAPPING,
+    ANCHORED_LEFTMOST,
+    ANCHORED_LEFTMOST_FIRST,
+];
+
+/// Tests for Aho-Corasick's leftmost-longest match semantics.
+const AC_LEFTMOST_LONGEST: TestCollection =
+    &[BASICS, NON_OVERLAPPING, LEFTMOST, LEFTMOST_LONGEST, REGRESSION];
+
+/// Tests for Aho-Corasick's anchored leftmost-longest match semantics.
+const AC_LEFTMOST_LONGEST_ANCHORED: TestCollection = &[
+    ANCHORED_BASICS,
+    ANCHORED_NON_OVERLAPPING,
+    ANCHORED_LEFTMOST,
+    ANCHORED_LEFTMOST_LONGEST,
+];
+
+// Now define the individual tests that make up the collections above.
+
+/// A collection of tests for the Aho-Corasick algorithm that should always be
+/// true regardless of match semantics. That is, all combinations of
+/// leftmost-{shortest, first, longest} x {overlapping, non-overlapping}
+/// should produce the same answer.
+const BASICS: &'static [SearchTest] = &[
+    t!(basic000, &[], "", &[]),
+    t!(basic001, &["a"], "", &[]),
+    t!(basic010, &["a"], "a", &[(0, 0, 1)]),
+    t!(basic020, &["a"], "aa", &[(0, 0, 1), (0, 1, 2)]),
+    t!(basic030, &["a"], "aaa", &[(0, 0, 1), (0, 1, 2), (0, 2, 3)]),
+    t!(basic040, &["a"], "aba", &[(0, 0, 1), (0, 2, 3)]),
+    t!(basic050, &["a"], "bba", &[(0, 2, 3)]),
+    t!(basic060, &["a"], "bbb", &[]),
+    t!(basic070, &["a"], "bababbbba", &[(0, 1, 2), (0, 3, 4), (0, 8, 9)]),
+    t!(basic100, &["aa"], "", &[]),
+    t!(basic110, &["aa"], "aa", &[(0, 0, 2)]),
+    t!(basic120, &["aa"], "aabbaa", &[(0, 0, 2), (0, 4, 6)]),
+    t!(basic130, &["aa"], "abbab", &[]),
+    t!(basic140, &["aa"], "abbabaa", &[(0, 5, 7)]),
+    t!(basic200, &["abc"], "abc", &[(0, 0, 3)]),
+    t!(basic210, &["abc"], "zazabzabcz", &[(0, 6, 9)]),
+    t!(basic220, &["abc"], "zazabczabcz", &[(0, 3, 6), (0, 7, 10)]),
+    t!(basic300, &["a", "b"], "", &[]),
+    t!(basic310, &["a", "b"], "z", &[]),
+    t!(basic320, &["a", "b"], "b", &[(1, 0, 1)]),
+    t!(basic330, &["a", "b"], "a", &[(0, 0, 1)]),
+    t!(
+        basic340,
+        &["a", "b"],
+        "abba",
+        &[(0, 0, 1), (1, 1, 2), (1, 2, 3), (0, 3, 4),]
+    ),
+    t!(
+        basic350,
+        &["b", "a"],
+        "abba",
+        &[(1, 0, 1), (0, 1, 2), (0, 2, 3), (1, 3, 4),]
+    ),
+    t!(basic360, &["abc", "bc"], "xbc", &[(1, 1, 3),]),
+    t!(basic400, &["foo", "bar"], "", &[]),
+    t!(basic410, &["foo", "bar"], "foobar", &[(0, 0, 3), (1, 3, 6),]),
+    t!(basic420, &["foo", "bar"], "barfoo", &[(1, 0, 3), (0, 3, 6),]),
+    t!(basic430, &["foo", "bar"], "foofoo", &[(0, 0, 3), (0, 3, 6),]),
+    t!(basic440, &["foo", "bar"], "barbar", &[(1, 0, 3), (1, 3, 6),]),
+    t!(basic450, &["foo", "bar"], "bafofoo", &[(0, 4, 7),]),
+    t!(basic460, &["bar", "foo"], "bafofoo", &[(1, 4, 7),]),
+    t!(basic470, &["foo", "bar"], "fobabar", &[(1, 4, 7),]),
+    t!(basic480, &["bar", "foo"], "fobabar", &[(0, 4, 7),]),
+    t!(basic600, &[""], "", &[(0, 0, 0)]),
+    t!(basic610, &[""], "a", &[(0, 0, 0), (0, 1, 1)]),
+    t!(basic620, &[""], "abc", &[(0, 0, 0), (0, 1, 1), (0, 2, 2), (0, 3, 3)]),
+    t!(basic700, &["yabcdef", "abcdezghi"], "yabcdefghi", &[(0, 0, 7),]),
+    t!(basic710, &["yabcdef", "abcdezghi"], "yabcdezghi", &[(1, 1, 10),]),
+    t!(
+        basic720,
+        &["yabcdef", "bcdeyabc", "abcdezghi"],
+        "yabcdezghi",
+        &[(2, 1, 10),]
+    ),
+];
+
+/// A collection of *anchored* tests for the Aho-Corasick algorithm that should
+/// always be true regardless of match semantics. That is, all combinations of
+/// leftmost-{shortest, first, longest} x {overlapping, non-overlapping} should
+/// produce the same answer.
+const ANCHORED_BASICS: &'static [SearchTest] = &[
+    t!(abasic000, &[], "", &[]),
+    t!(abasic010, &[""], "", &[(0, 0, 0)]),
+    t!(abasic020, &[""], "a", &[(0, 0, 0)]),
+    t!(abasic030, &[""], "abc", &[(0, 0, 0)]),
+    t!(abasic100, &["a"], "a", &[(0, 0, 1)]),
+    t!(abasic110, &["a"], "aa", &[(0, 0, 1)]),
+    t!(abasic120, &["a", "b"], "ab", &[(0, 0, 1)]),
+    t!(abasic130, &["a", "b"], "ba", &[(1, 0, 1)]),
+    t!(abasic140, &["foo", "foofoo"], "foo", &[(0, 0, 3)]),
+    t!(abasic150, &["foofoo", "foo"], "foo", &[(1, 0, 3)]),
+];
+
+/// Tests for non-overlapping standard match semantics.
+///
+/// These tests generally shouldn't pass for leftmost-{first,longest}, although
+/// some do in order to write clearer tests. For example, standard000 will
+/// pass with leftmost-first semantics, but standard010 will not. We write
+/// both to emphasize how the match semantics work.
+const STANDARD: &'static [SearchTest] = &[
+    t!(standard000, &["ab", "abcd"], "abcd", &[(0, 0, 2)]),
+    t!(standard010, &["abcd", "ab"], "abcd", &[(1, 0, 2)]),
+    t!(standard020, &["abcd", "ab", "abc"], "abcd", &[(1, 0, 2)]),
+    t!(standard030, &["abcd", "abc", "ab"], "abcd", &[(2, 0, 2)]),
+    t!(standard040, &["a", ""], "a", &[(1, 0, 0), (1, 1, 1)]),
+    t!(
+        standard400,
+        &["abcd", "bcd", "cd", "b"],
+        "abcd",
+        &[(3, 1, 2), (2, 2, 4),]
+    ),
+    t!(standard410, &["", "a"], "a", &[(0, 0, 0), (0, 1, 1),]),
+    t!(standard420, &["", "a"], "aa", &[(0, 0, 0), (0, 1, 1), (0, 2, 2),]),
+    t!(standard430, &["", "a", ""], "a", &[(0, 0, 0), (0, 1, 1),]),
+    t!(standard440, &["a", "", ""], "a", &[(1, 0, 0), (1, 1, 1),]),
+    t!(standard450, &["", "", "a"], "a", &[(0, 0, 0), (0, 1, 1),]),
+];
+
+/// Like STANDARD, but for anchored searches.
+const STANDARD_ANCHORED: &'static [SearchTest] = &[
+    t!(astandard000, &["ab", "abcd"], "abcd", &[(0, 0, 2)]),
+    t!(astandard010, &["abcd", "ab"], "abcd", &[(1, 0, 2)]),
+    t!(astandard020, &["abcd", "ab", "abc"], "abcd", &[(1, 0, 2)]),
+    t!(astandard030, &["abcd", "abc", "ab"], "abcd", &[(2, 0, 2)]),
+    t!(astandard040, &["a", ""], "a", &[(1, 0, 0)]),
+    t!(astandard050, &["abcd", "bcd", "cd", "b"], "abcd", &[(0, 0, 4)]),
+    t!(astandard410, &["", "a"], "a", &[(0, 0, 0)]),
+    t!(astandard420, &["", "a"], "aa", &[(0, 0, 0)]),
+    t!(astandard430, &["", "a", ""], "a", &[(0, 0, 0)]),
+    t!(astandard440, &["a", "", ""], "a", &[(1, 0, 0)]),
+    t!(astandard450, &["", "", "a"], "a", &[(0, 0, 0)]),
+];
+
+/// Tests for non-overlapping leftmost match semantics. These should pass for
+/// both leftmost-first and leftmost-longest match kinds. Stated differently,
+/// among ambiguous matches, the longest match and the match that appeared
+/// first when constructing the automaton should always be the same.
+const LEFTMOST: &'static [SearchTest] = &[
+    t!(leftmost000, &["ab", "ab"], "abcd", &[(0, 0, 2)]),
+    t!(leftmost010, &["a", ""], "a", &[(0, 0, 1), (1, 1, 1)]),
+    t!(leftmost020, &["", ""], "a", &[(0, 0, 0), (0, 1, 1)]),
+    t!(leftmost030, &["a", "ab"], "aa", &[(0, 0, 1), (0, 1, 2)]),
+    t!(leftmost031, &["ab", "a"], "aa", &[(1, 0, 1), (1, 1, 2)]),
+    t!(leftmost032, &["ab", "a"], "xayabbbz", &[(1, 1, 2), (0, 3, 5)]),
+    t!(leftmost300, &["abcd", "bce", "b"], "abce", &[(1, 1, 4)]),
+    t!(leftmost310, &["abcd", "ce", "bc"], "abce", &[(2, 1, 3)]),
+    t!(leftmost320, &["abcd", "bce", "ce", "b"], "abce", &[(1, 1, 4)]),
+    t!(leftmost330, &["abcd", "bce", "cz", "bc"], "abcz", &[(3, 1, 3)]),
+    t!(leftmost340, &["bce", "cz", "bc"], "bcz", &[(2, 0, 2)]),
+    t!(leftmost350, &["abc", "bd", "ab"], "abd", &[(2, 0, 2)]),
+    t!(
+        leftmost360,
+        &["abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(2, 0, 8),]
+    ),
+    t!(
+        leftmost370,
+        &["abcdefghi", "cde", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        leftmost380,
+        &["abcdefghi", "hz", "abcdefgh", "a"],
+        "abcdefghz",
+        &[(2, 0, 8),]
+    ),
+    t!(
+        leftmost390,
+        &["b", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        leftmost400,
+        &["h", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        leftmost410,
+        &["z", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8), (0, 8, 9),]
+    ),
+];
+
+/// Like LEFTMOST, but for anchored searches.
+const ANCHORED_LEFTMOST: &'static [SearchTest] = &[
+    t!(aleftmost000, &["ab", "ab"], "abcd", &[(0, 0, 2)]),
+    t!(aleftmost010, &["a", ""], "a", &[(0, 0, 1)]),
+    t!(aleftmost020, &["", ""], "a", &[(0, 0, 0)]),
+    t!(aleftmost030, &["a", "ab"], "aa", &[(0, 0, 1)]),
+    t!(aleftmost031, &["ab", "a"], "aa", &[(1, 0, 1)]),
+    t!(aleftmost032, &["ab", "a"], "xayabbbz", &[]),
+    t!(aleftmost300, &["abcd", "bce", "b"], "abce", &[]),
+    t!(aleftmost310, &["abcd", "ce", "bc"], "abce", &[]),
+    t!(aleftmost320, &["abcd", "bce", "ce", "b"], "abce", &[]),
+    t!(aleftmost330, &["abcd", "bce", "cz", "bc"], "abcz", &[]),
+    t!(aleftmost340, &["bce", "cz", "bc"], "bcz", &[(2, 0, 2)]),
+    t!(aleftmost350, &["abc", "bd", "ab"], "abd", &[(2, 0, 2)]),
+    t!(
+        aleftmost360,
+        &["abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(2, 0, 8),]
+    ),
+    t!(
+        aleftmost370,
+        &["abcdefghi", "cde", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        aleftmost380,
+        &["abcdefghi", "hz", "abcdefgh", "a"],
+        "abcdefghz",
+        &[(2, 0, 8),]
+    ),
+    t!(
+        aleftmost390,
+        &["b", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        aleftmost400,
+        &["h", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(
+        aleftmost410,
+        &["z", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8)]
+    ),
+];
+
+/// Tests for non-overlapping leftmost-first match semantics. These tests
+/// should generally be specific to leftmost-first, which means they should
+/// generally fail under leftmost-longest semantics.
+const LEFTMOST_FIRST: &'static [SearchTest] = &[
+    t!(leftfirst000, &["ab", "abcd"], "abcd", &[(0, 0, 2)]),
+    t!(leftfirst010, &["", "a"], "a", &[(0, 0, 0), (0, 1, 1)]),
+    t!(leftfirst011, &["", "a", ""], "a", &[(0, 0, 0), (0, 1, 1),]),
+    t!(leftfirst012, &["a", "", ""], "a", &[(0, 0, 1), (1, 1, 1),]),
+    t!(leftfirst013, &["", "", "a"], "a", &[(0, 0, 0), (0, 1, 1),]),
+    t!(leftfirst020, &["abcd", "ab"], "abcd", &[(0, 0, 4)]),
+    t!(leftfirst030, &["ab", "ab"], "abcd", &[(0, 0, 2)]),
+    t!(leftfirst040, &["a", "ab"], "xayabbbz", &[(0, 1, 2), (0, 3, 4)]),
+    t!(leftfirst100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[(1, 1, 5)]),
+    t!(leftfirst110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[(1, 1, 6)]),
+    t!(leftfirst300, &["abcd", "b", "bce"], "abce", &[(1, 1, 2)]),
+    t!(
+        leftfirst310,
+        &["abcd", "b", "bce", "ce"],
+        "abce",
+        &[(1, 1, 2), (3, 2, 4),]
+    ),
+    t!(
+        leftfirst320,
+        &["a", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(0, 0, 1), (2, 7, 9),]
+    ),
+    t!(leftfirst330, &["a", "abab"], "abab", &[(0, 0, 1), (0, 2, 3)]),
+];
+
+/// Like LEFTMOST_FIRST, but for anchored searches.
+const ANCHORED_LEFTMOST_FIRST: &'static [SearchTest] = &[
+    t!(aleftfirst000, &["ab", "abcd"], "abcd", &[(0, 0, 2)]),
+    t!(aleftfirst010, &["", "a"], "a", &[(0, 0, 0)]),
+    t!(aleftfirst011, &["", "a", ""], "a", &[(0, 0, 0)]),
+    t!(aleftfirst012, &["a", "", ""], "a", &[(0, 0, 1)]),
+    t!(aleftfirst013, &["", "", "a"], "a", &[(0, 0, 0)]),
+    t!(aleftfirst020, &["abcd", "ab"], "abcd", &[(0, 0, 4)]),
+    t!(aleftfirst030, &["ab", "ab"], "abcd", &[(0, 0, 2)]),
+    t!(aleftfirst040, &["a", "ab"], "xayabbbz", &[]),
+    t!(aleftfirst100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[]),
+    t!(aleftfirst110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[]),
+    t!(aleftfirst300, &["abcd", "b", "bce"], "abce", &[]),
+    t!(aleftfirst310, &["abcd", "b", "bce", "ce"], "abce", &[]),
+    t!(
+        aleftfirst320,
+        &["a", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(0, 0, 1)]
+    ),
+    t!(aleftfirst330, &["a", "abab"], "abab", &[(0, 0, 1)]),
+];
+
+/// Tests for non-overlapping leftmost-longest match semantics. These tests
+/// should generally be specific to leftmost-longest, which means they should
+/// generally fail under leftmost-first semantics.
+const LEFTMOST_LONGEST: &'static [SearchTest] = &[
+    t!(leftlong000, &["ab", "abcd"], "abcd", &[(1, 0, 4)]),
+    t!(leftlong010, &["abcd", "bcd", "cd", "b"], "abcd", &[(0, 0, 4),]),
+    t!(leftlong020, &["", "a"], "a", &[(1, 0, 1), (0, 1, 1),]),
+    t!(leftlong021, &["", "a", ""], "a", &[(1, 0, 1), (0, 1, 1),]),
+    t!(leftlong022, &["a", "", ""], "a", &[(0, 0, 1), (1, 1, 1),]),
+    t!(leftlong023, &["", "", "a"], "a", &[(2, 0, 1), (0, 1, 1),]),
+    t!(leftlong030, &["", "a"], "aa", &[(1, 0, 1), (1, 1, 2), (0, 2, 2),]),
+    t!(leftlong040, &["a", "ab"], "a", &[(0, 0, 1)]),
+    t!(leftlong050, &["a", "ab"], "ab", &[(1, 0, 2)]),
+    t!(leftlong060, &["ab", "a"], "a", &[(1, 0, 1)]),
+    t!(leftlong070, &["ab", "a"], "ab", &[(0, 0, 2)]),
+    t!(leftlong100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[(2, 1, 6)]),
+    t!(leftlong110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[(1, 1, 6)]),
+    t!(leftlong300, &["abcd", "b", "bce"], "abce", &[(2, 1, 4)]),
+    t!(
+        leftlong310,
+        &["a", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(leftlong320, &["a", "abab"], "abab", &[(1, 0, 4)]),
+    t!(leftlong330, &["abcd", "b", "ce"], "abce", &[(1, 1, 2), (2, 2, 4),]),
+    t!(leftlong340, &["a", "ab"], "xayabbbz", &[(0, 1, 2), (1, 3, 5)]),
+];
+
+/// Like LEFTMOST_LONGEST, but for anchored searches.
+const ANCHORED_LEFTMOST_LONGEST: &'static [SearchTest] = &[
+    t!(aleftlong000, &["ab", "abcd"], "abcd", &[(1, 0, 4)]),
+    t!(aleftlong010, &["abcd", "bcd", "cd", "b"], "abcd", &[(0, 0, 4),]),
+    t!(aleftlong020, &["", "a"], "a", &[(1, 0, 1)]),
+    t!(aleftlong021, &["", "a", ""], "a", &[(1, 0, 1)]),
+    t!(aleftlong022, &["a", "", ""], "a", &[(0, 0, 1)]),
+    t!(aleftlong023, &["", "", "a"], "a", &[(2, 0, 1)]),
+    t!(aleftlong030, &["", "a"], "aa", &[(1, 0, 1)]),
+    t!(aleftlong040, &["a", "ab"], "a", &[(0, 0, 1)]),
+    t!(aleftlong050, &["a", "ab"], "ab", &[(1, 0, 2)]),
+    t!(aleftlong060, &["ab", "a"], "a", &[(1, 0, 1)]),
+    t!(aleftlong070, &["ab", "a"], "ab", &[(0, 0, 2)]),
+    t!(aleftlong100, &["abcdefg", "bcde", "bcdef"], "abcdef", &[]),
+    t!(aleftlong110, &["abcdefg", "bcdef", "bcde"], "abcdef", &[]),
+    t!(aleftlong300, &["abcd", "b", "bce"], "abce", &[]),
+    t!(
+        aleftlong310,
+        &["a", "abcdefghi", "hz", "abcdefgh"],
+        "abcdefghz",
+        &[(3, 0, 8),]
+    ),
+    t!(aleftlong320, &["a", "abab"], "abab", &[(1, 0, 4)]),
+    t!(aleftlong330, &["abcd", "b", "ce"], "abce", &[]),
+    t!(aleftlong340, &["a", "ab"], "xayabbbz", &[]),
+];
+
+/// Tests for non-overlapping match semantics.
+///
+/// Generally these tests shouldn't pass when using overlapping semantics.
+/// These should pass for both standard and leftmost match semantics.
+const NON_OVERLAPPING: &'static [SearchTest] = &[
+    t!(nover010, &["abcd", "bcd", "cd"], "abcd", &[(0, 0, 4),]),
+    t!(nover020, &["bcd", "cd", "abcd"], "abcd", &[(2, 0, 4),]),
+    t!(nover030, &["abc", "bc"], "zazabcz", &[(0, 3, 6),]),
+    t!(
+        nover100,
+        &["ab", "ba"],
+        "abababa",
+        &[(0, 0, 2), (0, 2, 4), (0, 4, 6),]
+    ),
+    t!(nover200, &["foo", "foo"], "foobarfoo", &[(0, 0, 3), (0, 6, 9),]),
+    t!(nover300, &["", ""], "", &[(0, 0, 0),]),
+    t!(nover310, &["", ""], "a", &[(0, 0, 0), (0, 1, 1),]),
+];
+
+/// Like NON_OVERLAPPING, but for anchored searches.
+const ANCHORED_NON_OVERLAPPING: &'static [SearchTest] = &[
+    t!(anover010, &["abcd", "bcd", "cd"], "abcd", &[(0, 0, 4),]),
+    t!(anover020, &["bcd", "cd", "abcd"], "abcd", &[(2, 0, 4),]),
+    t!(anover030, &["abc", "bc"], "zazabcz", &[]),
+    t!(anover100, &["ab", "ba"], "abababa", &[(0, 0, 2)]),
+    t!(anover200, &["foo", "foo"], "foobarfoo", &[(0, 0, 3)]),
+    t!(anover300, &["", ""], "", &[(0, 0, 0),]),
+    t!(anover310, &["", ""], "a", &[(0, 0, 0)]),
+];
+
+/// Tests for overlapping match semantics.
+///
+/// This only supports standard match semantics, since leftmost-{first,longest}
+/// do not support overlapping matches.
+const OVERLAPPING: &'static [SearchTest] = &[
+    t!(
+        over000,
+        &["abcd", "bcd", "cd", "b"],
+        "abcd",
+        &[(3, 1, 2), (0, 0, 4), (1, 1, 4), (2, 2, 4),]
+    ),
+    t!(
+        over010,
+        &["bcd", "cd", "b", "abcd"],
+        "abcd",
+        &[(2, 1, 2), (3, 0, 4), (0, 1, 4), (1, 2, 4),]
+    ),
+    t!(
+        over020,
+        &["abcd", "bcd", "cd"],
+        "abcd",
+        &[(0, 0, 4), (1, 1, 4), (2, 2, 4),]
+    ),
+    t!(
+        over030,
+        &["bcd", "abcd", "cd"],
+        "abcd",
+        &[(1, 0, 4), (0, 1, 4), (2, 2, 4),]
+    ),
+    t!(
+        over040,
+        &["bcd", "cd", "abcd"],
+        "abcd",
+        &[(2, 0, 4), (0, 1, 4), (1, 2, 4),]
+    ),
+    t!(over050, &["abc", "bc"], "zazabcz", &[(0, 3, 6), (1, 4, 6),]),
+    t!(
+        over100,
+        &["ab", "ba"],
+        "abababa",
+        &[(0, 0, 2), (1, 1, 3), (0, 2, 4), (1, 3, 5), (0, 4, 6), (1, 5, 7),]
+    ),
+    t!(
+        over200,
+        &["foo", "foo"],
+        "foobarfoo",
+        &[(0, 0, 3), (1, 0, 3), (0, 6, 9), (1, 6, 9),]
+    ),
+    t!(over300, &["", ""], "", &[(0, 0, 0), (1, 0, 0),]),
+    t!(
+        over310,
+        &["", ""],
+        "a",
+        &[(0, 0, 0), (1, 0, 0), (0, 1, 1), (1, 1, 1),]
+    ),
+    t!(over320, &["", "a"], "a", &[(0, 0, 0), (1, 0, 1), (0, 1, 1),]),
+    t!(
+        over330,
+        &["", "a", ""],
+        "a",
+        &[(0, 0, 0), (2, 0, 0), (1, 0, 1), (0, 1, 1), (2, 1, 1),]
+    ),
+    t!(
+        over340,
+        &["a", "", ""],
+        "a",
+        &[(1, 0, 0), (2, 0, 0), (0, 0, 1), (1, 1, 1), (2, 1, 1),]
+    ),
+    t!(
+        over350,
+        &["", "", "a"],
+        "a",
+        &[(0, 0, 0), (1, 0, 0), (2, 0, 1), (0, 1, 1), (1, 1, 1),]
+    ),
+    t!(
+        over360,
+        &["foo", "foofoo"],
+        "foofoo",
+        &[(0, 0, 3), (1, 0, 6), (0, 3, 6)]
+    ),
+];
+
+/// Like OVERLAPPING, but for anchored searches.
+const ANCHORED_OVERLAPPING: &'static [SearchTest] = &[
+    t!(aover000, &["abcd", "bcd", "cd", "b"], "abcd", &[(0, 0, 4)]),
+    t!(aover010, &["bcd", "cd", "b", "abcd"], "abcd", &[(3, 0, 4)]),
+    t!(aover020, &["abcd", "bcd", "cd"], "abcd", &[(0, 0, 4)]),
+    t!(aover030, &["bcd", "abcd", "cd"], "abcd", &[(1, 0, 4)]),
+    t!(aover040, &["bcd", "cd", "abcd"], "abcd", &[(2, 0, 4)]),
+    t!(aover050, &["abc", "bc"], "zazabcz", &[]),
+    t!(aover100, &["ab", "ba"], "abababa", &[(0, 0, 2)]),
+    t!(aover200, &["foo", "foo"], "foobarfoo", &[(0, 0, 3), (1, 0, 3)]),
+    t!(aover300, &["", ""], "", &[(0, 0, 0), (1, 0, 0),]),
+    t!(aover310, &["", ""], "a", &[(0, 0, 0), (1, 0, 0)]),
+    t!(aover320, &["", "a"], "a", &[(0, 0, 0), (1, 0, 1)]),
+    t!(aover330, &["", "a", ""], "a", &[(0, 0, 0), (2, 0, 0), (1, 0, 1)]),
+    t!(aover340, &["a", "", ""], "a", &[(1, 0, 0), (2, 0, 0), (0, 0, 1)]),
+    t!(aover350, &["", "", "a"], "a", &[(0, 0, 0), (1, 0, 0), (2, 0, 1)]),
+    t!(aover360, &["foo", "foofoo"], "foofoo", &[(0, 0, 3), (1, 0, 6)]),
+];
+
+/// Tests for ASCII case insensitivity.
+///
+/// These tests should all have the same behavior regardless of match semantics
+/// or whether the search is overlapping.
+const ASCII_CASE_INSENSITIVE: &'static [SearchTest] = &[
+    t!(acasei000, &["a"], "A", &[(0, 0, 1)]),
+    t!(acasei010, &["Samwise"], "SAMWISE", &[(0, 0, 7)]),
+    t!(acasei011, &["Samwise"], "SAMWISE.abcd", &[(0, 0, 7)]),
+    t!(acasei020, &["fOoBaR"], "quux foobar baz", &[(0, 5, 11)]),
+];
+
+/// Like ASCII_CASE_INSENSITIVE, but specifically for non-overlapping tests.
+const ASCII_CASE_INSENSITIVE_NON_OVERLAPPING: &'static [SearchTest] = &[
+    t!(acasei000, &["foo", "FOO"], "fOo", &[(0, 0, 3)]),
+    t!(acasei000, &["FOO", "foo"], "fOo", &[(0, 0, 3)]),
+    t!(acasei010, &["abc", "def"], "abcdef", &[(0, 0, 3), (1, 3, 6)]),
+];
+
+/// Like ASCII_CASE_INSENSITIVE, but specifically for overlapping tests.
+const ASCII_CASE_INSENSITIVE_OVERLAPPING: &'static [SearchTest] = &[
+    t!(acasei000, &["foo", "FOO"], "fOo", &[(0, 0, 3), (1, 0, 3)]),
+    t!(acasei001, &["FOO", "foo"], "fOo", &[(0, 0, 3), (1, 0, 3)]),
+    // This is a regression test from:
+    // https://github.com/BurntSushi/aho-corasick/issues/68
+    // Previously, it was reporting a duplicate (1, 3, 6) match.
+    t!(
+        acasei010,
+        &["abc", "def", "abcdef"],
+        "abcdef",
+        &[(0, 0, 3), (2, 0, 6), (1, 3, 6)]
+    ),
+];
+
+/// Regression tests that are applied to all Aho-Corasick combinations.
+///
+/// If regression tests are needed for specific match semantics, then add them
+/// to the appropriate group above.
+const REGRESSION: &'static [SearchTest] = &[
+    t!(regression010, &["inf", "ind"], "infind", &[(0, 0, 3), (1, 3, 6),]),
+    t!(regression020, &["ind", "inf"], "infind", &[(1, 0, 3), (0, 3, 6),]),
+    t!(
+        regression030,
+        &["libcore/", "libstd/"],
+        "libcore/char/methods.rs",
+        &[(0, 0, 8),]
+    ),
+    t!(
+        regression040,
+        &["libstd/", "libcore/"],
+        "libcore/char/methods.rs",
+        &[(1, 0, 8),]
+    ),
+    t!(
+        regression050,
+        &["\x00\x00\x01", "\x00\x00\x00"],
+        "\x00\x00\x00",
+        &[(1, 0, 3),]
+    ),
+    t!(
+        regression060,
+        &["\x00\x00\x00", "\x00\x00\x01"],
+        "\x00\x00\x00",
+        &[(0, 0, 3),]
+    ),
+];
+
+// Now define a test for each combination of things above that we want to run.
+// Since there are a few different combinations for each collection of tests,
+// we define a couple of macros to avoid repetition drudgery. The testconfig
+// macro constructs the automaton from a given match kind, and runs the search
+// tests one-by-one over the given collection. The `with` parameter allows one
+// to configure the builder with additional parameters. The testcombo macro
+// invokes testconfig in precisely this way: it sets up several tests where
+// each one turns a different knob on AhoCorasickBuilder.
+
+macro_rules! testconfig {
+    (overlapping, $name:ident, $collection:expr, $kind:ident, $with:expr) => {
+        #[test]
+        fn $name() {
+            run_search_tests($collection, |test| {
+                let mut builder = AhoCorasickBuilder::new();
+                $with(&mut builder);
+                builder
+                    .match_kind(MatchKind::$kind)
+                    .build(test.patterns)
+                    .find_overlapping_iter(test.haystack)
+                    .collect()
+            });
+        }
+    };
+    (stream, $name:ident, $collection:expr, $kind:ident, $with:expr) => {
+        #[test]
+        fn $name() {
+            run_search_tests($collection, |test| {
+                let buf =
+                    io::BufReader::with_capacity(1, test.haystack.as_bytes());
+                let mut builder = AhoCorasickBuilder::new();
+                $with(&mut builder);
+                builder
+                    .match_kind(MatchKind::$kind)
+                    .build(test.patterns)
+                    .stream_find_iter(buf)
+                    .map(|result| result.unwrap())
+                    .collect()
+            });
+        }
+    };
+    ($name:ident, $collection:expr, $kind:ident, $with:expr) => {
+        #[test]
+        fn $name() {
+            run_search_tests($collection, |test| {
+                let mut builder = AhoCorasickBuilder::new();
+                $with(&mut builder);
+                builder
+                    .match_kind(MatchKind::$kind)
+                    .build(test.patterns)
+                    .find_iter(test.haystack)
+                    .collect()
+            });
+        }
+    };
+}
+
+macro_rules! testcombo {
+    ($name:ident, $collection:expr, $kind:ident) => {
+        mod $name {
+            use super::*;
+
+            testconfig!(nfa_default, $collection, $kind, |_| ());
+            testconfig!(
+                nfa_no_prefilter,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.prefilter(false);
+                }
+            );
+            testconfig!(
+                nfa_all_sparse,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.dense_depth(0);
+                }
+            );
+            testconfig!(
+                nfa_all_dense,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.dense_depth(usize::MAX);
+                }
+            );
+            testconfig!(
+                dfa_default,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.dfa(true);
+                }
+            );
+            testconfig!(
+                dfa_no_prefilter,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.dfa(true).prefilter(false);
+                }
+            );
+            testconfig!(
+                dfa_all_sparse,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.dfa(true).dense_depth(0);
+                }
+            );
+            testconfig!(
+                dfa_all_dense,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    b.dfa(true).dense_depth(usize::MAX);
+                }
+            );
+            testconfig!(
+                dfa_no_byte_class,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    // TODO: remove tests when option is removed.
+                    #[allow(deprecated)]
+                    b.dfa(true).byte_classes(false);
+                }
+            );
+            testconfig!(
+                dfa_no_premultiply,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    // TODO: remove tests when option is removed.
+                    #[allow(deprecated)]
+                    b.dfa(true).premultiply(false);
+                }
+            );
+            testconfig!(
+                dfa_no_byte_class_no_premultiply,
+                $collection,
+                $kind,
+                |b: &mut AhoCorasickBuilder| {
+                    // TODO: remove tests when options are removed.
+                    #[allow(deprecated)]
+                    b.dfa(true).byte_classes(false).premultiply(false);
+                }
+            );
+        }
+    };
+}
+
+// Write out the combinations.
+testcombo!(search_leftmost_longest, AC_LEFTMOST_LONGEST, LeftmostLongest);
+testcombo!(search_leftmost_first, AC_LEFTMOST_FIRST, LeftmostFirst);
+testcombo!(
+    search_standard_nonoverlapping,
+    AC_STANDARD_NON_OVERLAPPING,
+    Standard
+);
+
+// Write out the overlapping combo by hand since there is only one of them.
+testconfig!(
+    overlapping,
+    search_standard_overlapping_nfa_default,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |_| ()
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_nfa_all_sparse,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.dense_depth(0);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_nfa_all_dense,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.dense_depth(usize::MAX);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_dfa_default,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.dfa(true);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_dfa_all_sparse,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.dfa(true).dense_depth(0);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_dfa_all_dense,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.dfa(true).dense_depth(usize::MAX);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_dfa_no_byte_class,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        // TODO: remove tests when option is removed.
+        #[allow(deprecated)]
+        b.dfa(true).byte_classes(false);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_dfa_no_premultiply,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        // TODO: remove tests when option is removed.
+        #[allow(deprecated)]
+        b.dfa(true).premultiply(false);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_overlapping_dfa_no_byte_class_no_premultiply,
+    AC_STANDARD_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        // TODO: remove tests when options are removed.
+        #[allow(deprecated)]
+        b.dfa(true).byte_classes(false).premultiply(false);
+    }
+);
+
+// Also write out tests manually for streams, since we only test the standard
+// match semantics. We also don't bother testing different automaton
+// configurations, since those are well covered by tests above.
+testconfig!(
+    stream,
+    search_standard_stream_nfa_default,
+    AC_STANDARD_NON_OVERLAPPING,
+    Standard,
+    |_| ()
+);
+testconfig!(
+    stream,
+    search_standard_stream_dfa_default,
+    AC_STANDARD_NON_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.dfa(true);
+    }
+);
+
+// Same thing for anchored searches. Write them out manually.
+testconfig!(
+    search_standard_anchored_nfa_default,
+    AC_STANDARD_ANCHORED_NON_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true);
+    }
+);
+testconfig!(
+    search_standard_anchored_dfa_default,
+    AC_STANDARD_ANCHORED_NON_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true).dfa(true);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_anchored_overlapping_nfa_default,
+    AC_STANDARD_ANCHORED_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true);
+    }
+);
+testconfig!(
+    overlapping,
+    search_standard_anchored_overlapping_dfa_default,
+    AC_STANDARD_ANCHORED_OVERLAPPING,
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true).dfa(true);
+    }
+);
+testconfig!(
+    search_leftmost_first_anchored_nfa_default,
+    AC_LEFTMOST_FIRST_ANCHORED,
+    LeftmostFirst,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true);
+    }
+);
+testconfig!(
+    search_leftmost_first_anchored_dfa_default,
+    AC_LEFTMOST_FIRST_ANCHORED,
+    LeftmostFirst,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true).dfa(true);
+    }
+);
+testconfig!(
+    search_leftmost_longest_anchored_nfa_default,
+    AC_LEFTMOST_LONGEST_ANCHORED,
+    LeftmostLongest,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true);
+    }
+);
+testconfig!(
+    search_leftmost_longest_anchored_dfa_default,
+    AC_LEFTMOST_LONGEST_ANCHORED,
+    LeftmostLongest,
+    |b: &mut AhoCorasickBuilder| {
+        b.anchored(true).dfa(true);
+    }
+);
+
+// And also write out the test combinations for ASCII case insensitivity.
+testconfig!(
+    acasei_standard_nfa_default,
+    &[ASCII_CASE_INSENSITIVE],
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.prefilter(false).ascii_case_insensitive(true);
+    }
+);
+testconfig!(
+    acasei_standard_dfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_NON_OVERLAPPING],
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true).dfa(true);
+    }
+);
+testconfig!(
+    overlapping,
+    acasei_standard_overlapping_nfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_OVERLAPPING],
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true);
+    }
+);
+testconfig!(
+    overlapping,
+    acasei_standard_overlapping_dfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_OVERLAPPING],
+    Standard,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true).dfa(true);
+    }
+);
+testconfig!(
+    acasei_leftmost_first_nfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_NON_OVERLAPPING],
+    LeftmostFirst,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true);
+    }
+);
+testconfig!(
+    acasei_leftmost_first_dfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_NON_OVERLAPPING],
+    LeftmostFirst,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true).dfa(true);
+    }
+);
+testconfig!(
+    acasei_leftmost_longest_nfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_NON_OVERLAPPING],
+    LeftmostLongest,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true);
+    }
+);
+testconfig!(
+    acasei_leftmost_longest_dfa_default,
+    &[ASCII_CASE_INSENSITIVE, ASCII_CASE_INSENSITIVE_NON_OVERLAPPING],
+    LeftmostLongest,
+    |b: &mut AhoCorasickBuilder| {
+        b.ascii_case_insensitive(true).dfa(true);
+    }
+);
+
+fn run_search_tests<F: FnMut(&SearchTest) -> Vec<Match>>(
+    which: TestCollection,
+    mut f: F,
+) {
+    let get_match_triples =
+        |matches: Vec<Match>| -> Vec<(usize, usize, usize)> {
+            matches
+                .into_iter()
+                .map(|m| (m.pattern(), m.start(), m.end()))
+                .collect()
+        };
+    for &tests in which {
+        for test in tests {
+            assert_eq!(
+                test.matches,
+                get_match_triples(f(&test)).as_slice(),
+                "test: {}, patterns: {:?}, haystack: {:?}",
+                test.name,
+                test.patterns,
+                test.haystack
+            );
+        }
+    }
+}
+
+#[test]
+fn search_tests_have_unique_names() {
+    let assert = |constname, tests: &[SearchTest]| {
+        let mut seen = HashMap::new(); // map from test name to position
+        for (i, test) in tests.iter().enumerate() {
+            if !seen.contains_key(test.name) {
+                seen.insert(test.name, i);
+            } else {
+                let last = seen[test.name];
+                panic!(
+                    "{} tests have duplicate names at positions {} and {}",
+                    constname, last, i
+                );
+            }
+        }
+    };
+    assert("BASICS", BASICS);
+    assert("STANDARD", STANDARD);
+    assert("LEFTMOST", LEFTMOST);
+    assert("LEFTMOST_FIRST", LEFTMOST_FIRST);
+    assert("LEFTMOST_LONGEST", LEFTMOST_LONGEST);
+    assert("NON_OVERLAPPING", NON_OVERLAPPING);
+    assert("OVERLAPPING", OVERLAPPING);
+    assert("REGRESSION", REGRESSION);
+}
+
+#[test]
+#[should_panic]
+fn stream_not_allowed_leftmost_first() {
+    let fsm = AhoCorasickBuilder::new()
+        .match_kind(MatchKind::LeftmostFirst)
+        .build(None::<String>);
+    assert_eq!(fsm.stream_find_iter(&b""[..]).count(), 0);
+}
+
+#[test]
+#[should_panic]
+fn stream_not_allowed_leftmost_longest() {
+    let fsm = AhoCorasickBuilder::new()
+        .match_kind(MatchKind::LeftmostLongest)
+        .build(None::<String>);
+    assert_eq!(fsm.stream_find_iter(&b""[..]).count(), 0);
+}
+
+#[test]
+#[should_panic]
+fn overlapping_not_allowed_leftmost_first() {
+    let fsm = AhoCorasickBuilder::new()
+        .match_kind(MatchKind::LeftmostFirst)
+        .build(None::<String>);
+    assert_eq!(fsm.find_overlapping_iter("").count(), 0);
+}
+
+#[test]
+#[should_panic]
+fn overlapping_not_allowed_leftmost_longest() {
+    let fsm = AhoCorasickBuilder::new()
+        .match_kind(MatchKind::LeftmostLongest)
+        .build(None::<String>);
+    assert_eq!(fsm.find_overlapping_iter("").count(), 0);
+}
+
+#[test]
+fn state_id_too_small() {
+    let mut patterns = vec![];
+    for c1 in (b'a'..b'z').map(|b| b as char) {
+        for c2 in (b'a'..b'z').map(|b| b as char) {
+            for c3 in (b'a'..b'z').map(|b| b as char) {
+                patterns.push(format!("{}{}{}", c1, c2, c3));
+            }
+        }
+    }
+    let result =
+        AhoCorasickBuilder::new().build_with_size::<u8, _, _>(&patterns);
+    assert!(result.is_err());
+}
+
+// See: https://github.com/BurntSushi/aho-corasick/issues/44
+//
+// In short, this test ensures that enabling ASCII case insensitivity does not
+// visit an exponential number of states when filling in failure transitions.
+#[test]
+fn regression_ascii_case_insensitive_no_exponential() {
+    let ac = AhoCorasickBuilder::new()
+        .ascii_case_insensitive(true)
+        .build(&["Tsubaki House-Triple Shot Vol01校花三姐妹"]);
+    assert!(ac.find("").is_none());
+}
+
+// See: https://github.com/BurntSushi/aho-corasick/issues/53
+//
+// This test ensures that the rare byte prefilter works in a particular corner
+// case. In particular, the shift offset detected for '/' in the patterns below
+// was incorrect, leading to a false negative.
+#[test]
+fn regression_rare_byte_prefilter() {
+    use crate::AhoCorasick;
+
+    let ac = AhoCorasick::new_auto_configured(&["ab/j/", "x/"]);
+    assert!(ac.is_match("ab/j/"));
+}
+
+#[test]
+fn regression_case_insensitive_prefilter() {
+    use crate::AhoCorasickBuilder;
+
+    for c in b'a'..b'z' {
+        for c2 in b'a'..b'z' {
+            let c = c as char;
+            let c2 = c2 as char;
+            let needle = format!("{}{}", c, c2).to_lowercase();
+            let haystack = needle.to_uppercase();
+            let ac = AhoCorasickBuilder::new()
+                .ascii_case_insensitive(true)
+                .prefilter(true)
+                .build(&[&needle]);
+            assert_eq!(
+                1,
+                ac.find_iter(&haystack).count(),
+                "failed to find {:?} in {:?}\n\nautomaton:\n{:?}",
+                needle,
+                haystack,
+                ac,
+            );
+        }
+    }
+}
+
+// See: https://github.com/BurntSushi/aho-corasick/issues/64
+//
+// This occurs when the rare byte prefilter is active.
+#[test]
+fn regression_stream_rare_byte_prefilter() {
+    use std::io::Read;
+
+    // NOTE: The test only fails if this ends with j.
+    const MAGIC: [u8; 5] = *b"1234j";
+
+    // NOTE: The test fails for value in 8188..=8191 These value put the string
+    // to search accross two call to read because the buffer size is 8192 by
+    // default.
+    const BEGIN: usize = 8191;
+
+    /// This is just a structure that implements Reader. The reader
+    /// implementation will simulate a file filled with 0, except for the MAGIC
+    /// string at offset BEGIN.
+    #[derive(Default)]
+    struct R {
+        read: usize,
+    }
+
+    impl Read for R {
+        fn read(&mut self, buf: &mut [u8]) -> ::std::io::Result<usize> {
+            //dbg!(buf.len());
+            if self.read > 100000 {
+                return Ok(0);
+            }
+            let mut from = 0;
+            if self.read < BEGIN {
+                from = buf.len().min(BEGIN - self.read);
+                for x in 0..from {
+                    buf[x] = 0;
+                }
+                self.read += from;
+            }
+            if self.read >= BEGIN && self.read <= BEGIN + MAGIC.len() {
+                let to = buf.len().min(BEGIN + MAGIC.len() - self.read + from);
+                if to > from {
+                    buf[from..to].copy_from_slice(
+                        &MAGIC
+                            [self.read - BEGIN..self.read - BEGIN + to - from],
+                    );
+                    self.read += to - from;
+                    from = to;
+                }
+            }
+            for x in from..buf.len() {
+                buf[x] = 0;
+                self.read += 1;
+            }
+            Ok(buf.len())
+        }
+    }
+
+    fn run() -> ::std::io::Result<()> {
+        let aut = AhoCorasickBuilder::new().build(&[&MAGIC]);
+
+        // While reading from a vector, it works:
+        let mut buf = vec![];
+        R::default().read_to_end(&mut buf)?;
+        let from_whole = aut.find_iter(&buf).next().unwrap().start();
+
+        //But using stream_find_iter fails!
+        let mut file = R::default();
+        let begin = aut
+            .stream_find_iter(&mut file)
+            .next()
+            .expect("NOT FOUND!!!!")? // Panic here
+            .start();
+        assert_eq!(from_whole, begin);
+        Ok(())
+    }
+
+    run().unwrap()
+}
diff --git a/android/vendor/ansi_term-0.12.1/.cargo-checksum.json b/android/vendor/ansi_term-0.12.1/.cargo-checksum.json
new file mode 100644
index 0000000..ee41459
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.lock":"31bb7b361278d99a00595cbd916c444e6fd193b5f0b1ea0cf2d9454440739501","Cargo.toml":"4ca681d6949661455ac88541ffa68ebc7db50cb2b6e9a2134e6d0687da4997c3","LICENCE":"2762990c7fbba9d550802a2593c1d857dcd52596bb0f9f192a97e9a7ac5f4f9e","README.md":"8d983e1bb3cc99724010d9073a5be6452cd49bd57a877525fd0a5dd41e6591d5","examples/256_colours.rs":"5f2845068bc2d93cff4a61f18ffa44fbbbc91be771dfd686d537d343f37041da","examples/basic_colours.rs":"d610795f3743d10d90ec4e5ab32cc09fb16640896cecd2f93fca434a0920397c","examples/rgb_colours.rs":"8399e5131e959a56c932036b790e601fb4ad658856112daf87f933889b443f2c","src/ansi.rs":"988fb87936064fa006fcc9474ac62099c8d6e98d38bb80cec2cd864066482a08","src/debug.rs":"61343f8bf13695020102c033aeaacd9ccd3ec830eacbf9011127e61829451d20","src/difference.rs":"9b4b8f91c72932bfda262abdceff0ec124a5a8dd27d07bd4d2e5e7889135c6c9","src/display.rs":"c04f2397d1d1d86a5e2188c2840c505cb0baeaf9706a88d4bbe56eadc67811b9","src/lib.rs":"b85df4b9b8832cda777db049efa2ec84b9847438fa3feaf8540e597ce2532a47","src/style.rs":"1042fc973f5ea8bbb2a2faec334aad530520b53edc9b3296174ae38c1060490b","src/util.rs":"07c127f732887573a1c9126fc0288e13e7a8f1f803513b95e50aac2905171b0d","src/windows.rs":"7ce7dd6738b9728fcd3908c284b6f29a9bdfb34af761b4c7385cf7e3e1b20e64","src/write.rs":"c9ec03764ad1ecea8b680243c9cafc5e70919fcea7500cc18246ffd8f6bb4b33"},"package":"d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"}
\ No newline at end of file
diff --git a/android/vendor/ansi_term-0.12.1/Cargo.lock b/android/vendor/ansi_term-0.12.1/Cargo.lock
new file mode 100644
index 0000000..b210045
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/Cargo.lock
@@ -0,0 +1,168 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "aho-corasick"
+version = "0.7.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "ansi_term"
+version = "0.12.1"
+dependencies = [
+ "doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "doc-comment"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "itoa"
+version = "0.4.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "memchr"
+version = "2.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "proc-macro2"
+version = "0.4.30"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "quote"
+version = "0.6.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "regex"
+version = "1.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "ryu"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "serde"
+version = "1.0.94"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.94"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "syn"
+version = "0.15.39"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "thread_local"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "unicode-xid"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[metadata]
+"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
+"checksum doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "923dea538cea0aa3025e8685b20d6ee21ef99c4f77e954a30febbaac5ec73a97"
+"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
+"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
+"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
+"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
+"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26"
+"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f"
+"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997"
+"checksum serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "076a696fdea89c19d3baed462576b8f6d663064414b5c793642da8dfeb99475b"
+"checksum serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "ef45eb79d6463b22f5f9e16d283798b7c0175ba6050bc25c1a946c122727fe7b"
+"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704"
+"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c"
+"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
+"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
+"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
+"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/android/vendor/ansi_term-0.12.1/Cargo.toml b/android/vendor/ansi_term-0.12.1/Cargo.toml
new file mode 100644
index 0000000..0e5feba
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/Cargo.toml
@@ -0,0 +1,43 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "ansi_term"
+version = "0.12.1"
+authors = ["ogham@bsago.me", "Ryan Scheel (Havvy) <ryan.havvy@gmail.com>", "Josh Triplett <josh@joshtriplett.org>"]
+description = "Library for ANSI terminal colours and styles (bold, underline)"
+homepage = "https://github.com/ogham/rust-ansi-term"
+documentation = "https://docs.rs/ansi_term"
+readme = "README.md"
+license = "MIT"
+repository = "https://github.com/ogham/rust-ansi-term"
+
+[lib]
+name = "ansi_term"
+[dependencies.serde]
+version = "1.0.90"
+features = ["derive"]
+optional = true
+[dev-dependencies.doc-comment]
+version = "0.3"
+
+[dev-dependencies.regex]
+version = "1.1.9"
+
+[dev-dependencies.serde_json]
+version = "1.0.39"
+
+[features]
+derive_serde_style = ["serde"]
+[target."cfg(target_os=\"windows\")".dependencies.winapi]
+version = "0.3.4"
+features = ["consoleapi", "errhandlingapi", "fileapi", "handleapi", "processenv"]
diff --git a/android/vendor/ansi_term-0.12.1/LICENCE b/android/vendor/ansi_term-0.12.1/LICENCE
new file mode 100644
index 0000000..3228cc9
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/LICENCE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Benjamin Sago
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/android/vendor/ansi_term-0.12.1/README.md b/android/vendor/ansi_term-0.12.1/README.md
new file mode 100644
index 0000000..30d52ab
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/README.md
@@ -0,0 +1,183 @@
+# rust-ansi-term [![ansi-term on crates.io](http://meritbadge.herokuapp.com/ansi-term)](https://crates.io/crates/ansi_term) [![Build status](https://img.shields.io/travis/ogham/rust-ansi-term/master.svg?style=flat)](https://travis-ci.org/ogham/rust-ansi-term) [![Build status](https://img.shields.io/appveyor/ci/ogham/rust-ansi-term/master.svg?style=flat&logo=AppVeyor&logoColor=silver)](https://ci.appveyor.com/project/ogham/rust-ansi-term) [![Coverage status](https://coveralls.io/repos/ogham/rust-ansi-term/badge.svg?branch=master&service=github)](https://coveralls.io/github/ogham/rust-ansi-term?branch=master)
+
+This is a library for controlling colours and formatting, such as red bold text or blue underlined text, on ANSI terminals.
+
+### [View the Rustdoc](https://docs.rs/ansi_term/)
+
+
+# Installation
+
+This crate works with [Cargo](http://crates.io). Add the following to your `Cargo.toml` dependencies section:
+
+```toml
+[dependencies]
+ansi_term = "0.12"
+```
+
+
+## Basic usage
+
+There are three main types in this crate that you need to be concerned with: `ANSIString`, `Style`, and `Colour`.
+
+A `Style` holds stylistic information: foreground and background colours, whether the text should be bold, or blinking, or other properties.
+The `Colour` enum represents the available colours.
+And an `ANSIString` is a string paired with a `Style`.
+
+`Color` is also available as an alias to `Colour`.
+
+To format a string, call the `paint` method on a `Style` or a `Colour`, passing in the string you want to format as the argument.
+For example, here’s how to get some red text:
+
+```rust
+use ansi_term::Colour::Red;
+
+println!("This is in red: {}", Red.paint("a red string"));
+```
+
+It’s important to note that the `paint` method does *not* actually return a string with the ANSI control characters surrounding it.
+Instead, it returns an `ANSIString` value that has a `Display` implementation that, when formatted, returns the characters.
+This allows strings to be printed with a minimum of `String` allocations being performed behind the scenes.
+
+If you *do* want to get at the escape codes, then you can convert the `ANSIString` to a string as you would any other `Display` value:
+
+```rust
+use ansi_term::Colour::Red;
+
+let red_string = Red.paint("a red string").to_string();
+```
+
+**Note for Windows 10 users:** On Windows 10, the application must enable ANSI support first:
+
+```rust,ignore
+let enabled = ansi_term::enable_ansi_support();
+```
+
+## Bold, underline, background, and other styles
+
+For anything more complex than plain foreground colour changes, you need to construct `Style` values themselves, rather than beginning with a `Colour`.
+You can do this by chaining methods based on a new `Style`, created with `Style::new()`.
+Each method creates a new style that has that specific property set.
+For example:
+
+```rust
+use ansi_term::Style;
+
+println!("How about some {} and {}?",
+         Style::new().bold().paint("bold"),
+         Style::new().underline().paint("underline"));
+```
+
+For brevity, these methods have also been implemented for `Colour` values, so you can give your styles a foreground colour without having to begin with an empty `Style` value:
+
+```rust
+use ansi_term::Colour::{Blue, Yellow};
+
+println!("Demonstrating {} and {}!",
+         Blue.bold().paint("blue bold"),
+         Yellow.underline().paint("yellow underline"));
+
+println!("Yellow on blue: {}", Yellow.on(Blue).paint("wow!"));
+```
+
+The complete list of styles you can use are:
+`bold`, `dimmed`, `italic`, `underline`, `blink`, `reverse`, `hidden`, and `on` for background colours.
+
+In some cases, you may find it easier to change the foreground on an existing `Style` rather than starting from the appropriate `Colour`.
+You can do this using the `fg` method:
+
+```rust
+use ansi_term::Style;
+use ansi_term::Colour::{Blue, Cyan, Yellow};
+
+println!("Yellow on blue: {}", Style::new().on(Blue).fg(Yellow).paint("yow!"));
+println!("Also yellow on blue: {}", Cyan.on(Blue).fg(Yellow).paint("zow!"));
+```
+
+You can turn a `Colour` into a `Style` with the `normal` method.
+This will produce the exact same `ANSIString` as if you just used the `paint` method on the `Colour` directly, but it’s useful in certain cases: for example, you may have a method that returns `Styles`, and need to represent both the “red bold” and “red, but not bold” styles with values of the same type. The `Style` struct also has a `Default` implementation if you want to have a style with *nothing* set.
+
+```rust
+use ansi_term::Style;
+use ansi_term::Colour::Red;
+
+Red.normal().paint("yet another red string");
+Style::default().paint("a completely regular string");
+```
+
+
+## Extended colours
+
+You can access the extended range of 256 colours by using the `Colour::Fixed` variant, which takes an argument of the colour number to use.
+This can be included wherever you would use a `Colour`:
+
+```rust
+use ansi_term::Colour::Fixed;
+
+Fixed(134).paint("A sort of light purple");
+Fixed(221).on(Fixed(124)).paint("Mustard in the ketchup");
+```
+
+The first sixteen of these values are the same as the normal and bold standard colour variants.
+There’s nothing stopping you from using these as `Fixed` colours instead, but there’s nothing to be gained by doing so either.
+
+You can also access full 24-bit colour by using the `Colour::RGB` variant, which takes separate `u8` arguments for red, green, and blue:
+
+```rust
+use ansi_term::Colour::RGB;
+
+RGB(70, 130, 180).paint("Steel blue");
+```
+
+## Combining successive coloured strings
+
+The benefit of writing ANSI escape codes to the terminal is that they *stack*: you do not need to end every coloured string with a reset code if the text that follows it is of a similar style.
+For example, if you want to have some blue text followed by some blue bold text, it’s possible to send the ANSI code for blue, followed by the ANSI code for bold, and finishing with a reset code without having to have an extra one between the two strings.
+
+This crate can optimise the ANSI codes that get printed in situations like this, making life easier for your terminal renderer.
+The `ANSIStrings` struct takes a slice of several `ANSIString` values, and will iterate over each of them, printing only the codes for the styles that need to be updated as part of its formatting routine.
+
+The following code snippet uses this to enclose a binary number displayed in red bold text inside some red, but not bold, brackets:
+
+```rust
+use ansi_term::Colour::Red;
+use ansi_term::{ANSIString, ANSIStrings};
+
+let some_value = format!("{:b}", 42);
+let strings: &[ANSIString<'static>] = &[
+    Red.paint("["),
+    Red.bold().paint(some_value),
+    Red.paint("]"),
+];
+
+println!("Value: {}", ANSIStrings(strings));
+```
+
+There are several things to note here.
+Firstly, the `paint` method can take *either* an owned `String` or a borrowed `&str`.
+Internally, an `ANSIString` holds a copy-on-write (`Cow`) string value to deal with both owned and borrowed strings at the same time.
+This is used here to display a `String`, the result of the `format!` call, using the same mechanism as some statically-available `&str` slices.
+Secondly, that the `ANSIStrings` value works in the same way as its singular counterpart, with a `Display` implementation that only performs the formatting when required.
+
+## Byte strings
+
+This library also supports formatting `[u8]` byte strings; this supports applications working with text in an unknown encoding.
+`Style` and `Colour` support painting `[u8]` values, resulting in an `ANSIByteString`.
+This type does not implement `Display`, as it may not contain UTF-8, but it does provide a method `write_to` to write the result to any value that implements `Write`:
+
+```rust
+use ansi_term::Colour::Green;
+
+Green.paint("user data".as_bytes()).write_to(&mut std::io::stdout()).unwrap();
+```
+
+Similarly, the type `ANSIByteStrings` supports writing a list of `ANSIByteString` values with minimal escape sequences:
+
+```rust
+use ansi_term::Colour::Green;
+use ansi_term::ANSIByteStrings;
+
+ANSIByteStrings(&[
+    Green.paint("user data 1\n".as_bytes()),
+    Green.bold().paint("user data 2\n".as_bytes()),
+]).write_to(&mut std::io::stdout()).unwrap();
+```
diff --git a/android/vendor/ansi_term-0.12.1/examples/256_colours.rs b/android/vendor/ansi_term-0.12.1/examples/256_colours.rs
new file mode 100644
index 0000000..92fe2f1
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/examples/256_colours.rs
@@ -0,0 +1,73 @@
+extern crate ansi_term;
+use ansi_term::Colour;
+
+// This example prints out the 256 colours.
+// They're arranged like this:
+//
+// - 0 to 8 are the eight standard colours.
+// - 9 to 15 are the eight bold colours.
+// - 16 to 231 are six blocks of six-by-six colour squares.
+// - 232 to 255 are shades of grey.
+
+fn main() {
+
+    // First two lines
+    for c in 0..8 {
+        glow(c, c != 0);
+        print!(" ");
+    }
+    print!("\n");
+    for c in 8..16 {
+        glow(c, c != 8);
+        print!(" ");
+    }
+    print!("\n\n");
+
+    // Six lines of the first three squares
+    for row in 0..6 {
+        for square in 0..3 {
+            for column in 0..6 {
+                glow(16 + square * 36 + row * 6 + column, row >= 3);
+                print!(" ");
+            }
+
+            print!("  ");
+        }
+
+        print!("\n");
+    }
+    print!("\n");
+
+    // Six more lines of the other three squares
+    for row in 0..6 {
+        for square in 0..3 {
+            for column in 0..6 {
+                glow(124 + square * 36 + row * 6 + column, row >= 3);
+                print!(" ");
+            }
+
+            print!("  ");
+        }
+
+        print!("\n");
+    }
+    print!("\n");
+
+    // The last greyscale lines
+    for c in 232..=243 {
+        glow(c, false);
+        print!(" ");
+    }
+    print!("\n");
+    for c in 244..=255 {
+        glow(c, true);
+        print!(" ");
+    }
+    print!("\n");
+}
+
+fn glow(c: u8, light_bg: bool) {
+    let base = if light_bg { Colour::Black } else { Colour::White };
+    let style = base.on(Colour::Fixed(c));
+    print!("{}", style.paint(&format!(" {:3} ", c)));
+}
diff --git a/android/vendor/ansi_term-0.12.1/examples/basic_colours.rs b/android/vendor/ansi_term-0.12.1/examples/basic_colours.rs
new file mode 100644
index 0000000..ba88156
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/examples/basic_colours.rs
@@ -0,0 +1,18 @@
+extern crate ansi_term;
+use ansi_term::{Style, Colour::*};
+
+// This example prints out the 16 basic colours.
+
+fn main() {
+    let normal = Style::default();
+
+    println!("{} {}", normal.paint("Normal"), normal.bold().paint("bold"));
+    println!("{} {}", Black.paint("Black"),   Black.bold().paint("bold"));
+    println!("{} {}", Red.paint("Red"),       Red.bold().paint("bold"));
+    println!("{} {}", Green.paint("Green"),   Green.bold().paint("bold"));
+    println!("{} {}", Yellow.paint("Yellow"), Yellow.bold().paint("bold"));
+    println!("{} {}", Blue.paint("Blue"),     Blue.bold().paint("bold"));
+    println!("{} {}", Purple.paint("Purple"), Purple.bold().paint("bold"));
+    println!("{} {}", Cyan.paint("Cyan"),     Cyan.bold().paint("bold"));
+    println!("{} {}", White.paint("White"),   White.bold().paint("bold"));
+}
diff --git a/android/vendor/ansi_term-0.12.1/examples/rgb_colours.rs b/android/vendor/ansi_term-0.12.1/examples/rgb_colours.rs
new file mode 100644
index 0000000..fd2cc7a
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/examples/rgb_colours.rs
@@ -0,0 +1,23 @@
+extern crate ansi_term;
+use ansi_term::{Style, Colour};
+
+// This example prints out a colour gradient in a grid by calculating each
+// character’s red, green, and blue components, and using 24-bit colour codes
+// to display them.
+
+const WIDTH:  i32 = 80;
+const HEIGHT: i32 = 24;
+
+fn main() {
+    for row in 0 .. HEIGHT {
+        for col in 0 .. WIDTH {
+            let r = (row * 255 / HEIGHT) as u8;
+            let g = (col * 255 / WIDTH) as u8;
+            let b = 128;
+
+            print!("{}", Style::default().on(Colour::RGB(r, g, b)).paint(" "));
+        }
+
+        print!("\n");
+    }
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/ansi.rs b/android/vendor/ansi_term-0.12.1/src/ansi.rs
new file mode 100644
index 0000000..aaf2152
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/ansi.rs
@@ -0,0 +1,374 @@
+use style::{Colour, Style};
+
+use std::fmt;
+
+use write::AnyWrite;
+
+
+// ---- generating ANSI codes ----
+
+impl Style {
+
+    /// Write any bytes that go *before* a piece of text to the given writer.
+    fn write_prefix<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> {
+
+        // If there are actually no styles here, then don’t write *any* codes
+        // as the prefix. An empty ANSI code may not affect the terminal
+        // output at all, but a user may just want a code-free string.
+        if self.is_plain() {
+            return Ok(());
+        }
+
+        // Write the codes’ prefix, then write numbers, separated by
+        // semicolons, for each text style we want to apply.
+        write!(f, "\x1B[")?;
+        let mut written_anything = false;
+
+        {
+            let mut write_char = |c| {
+                if written_anything { write!(f, ";")?; }
+                written_anything = true;
+                write!(f, "{}", c)?;
+                Ok(())
+            };
+
+            if self.is_bold           { write_char('1')? }
+            if self.is_dimmed         { write_char('2')? }
+            if self.is_italic         { write_char('3')? }
+            if self.is_underline      { write_char('4')? }
+            if self.is_blink          { write_char('5')? }
+            if self.is_reverse        { write_char('7')? }
+            if self.is_hidden         { write_char('8')? }
+            if self.is_strikethrough  { write_char('9')? }
+        }
+
+        // The foreground and background colours, if specified, need to be
+        // handled specially because the number codes are more complicated.
+        // (see `write_background_code` and `write_foreground_code`)
+        if let Some(bg) = self.background {
+            if written_anything { write!(f, ";")?; }
+            written_anything = true;
+            bg.write_background_code(f)?;
+        }
+
+        if let Some(fg) = self.foreground {
+            if written_anything { write!(f, ";")?; }
+            fg.write_foreground_code(f)?;
+        }
+
+        // All the codes end with an `m`, because reasons.
+        write!(f, "m")?;
+
+        Ok(())
+    }
+
+    /// Write any bytes that go *after* a piece of text to the given writer.
+    fn write_suffix<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> {
+        if self.is_plain() {
+            Ok(())
+        }
+        else {
+            write!(f, "{}", RESET)
+        }
+    }
+}
+
+
+/// The code to send to reset all styles and return to `Style::default()`.
+pub static RESET: &str = "\x1B[0m";
+
+
+
+impl Colour {
+    fn write_foreground_code<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> {
+        match *self {
+            Colour::Black      => write!(f, "30"),
+            Colour::Red        => write!(f, "31"),
+            Colour::Green      => write!(f, "32"),
+            Colour::Yellow     => write!(f, "33"),
+            Colour::Blue       => write!(f, "34"),
+            Colour::Purple     => write!(f, "35"),
+            Colour::Cyan       => write!(f, "36"),
+            Colour::White      => write!(f, "37"),
+            Colour::Fixed(num) => write!(f, "38;5;{}", &num),
+            Colour::RGB(r,g,b) => write!(f, "38;2;{};{};{}", &r, &g, &b),
+        }
+    }
+
+    fn write_background_code<W: AnyWrite + ?Sized>(&self, f: &mut W) -> Result<(), W::Error> {
+        match *self {
+            Colour::Black      => write!(f, "40"),
+            Colour::Red        => write!(f, "41"),
+            Colour::Green      => write!(f, "42"),
+            Colour::Yellow     => write!(f, "43"),
+            Colour::Blue       => write!(f, "44"),
+            Colour::Purple     => write!(f, "45"),
+            Colour::Cyan       => write!(f, "46"),
+            Colour::White      => write!(f, "47"),
+            Colour::Fixed(num) => write!(f, "48;5;{}", &num),
+            Colour::RGB(r,g,b) => write!(f, "48;2;{};{};{}", &r, &g, &b),
+        }
+    }
+}
+
+
+/// Like `ANSIString`, but only displays the style prefix.
+///
+/// This type implements the `Display` trait, meaning it can be written to a
+/// `std::fmt` formatting without doing any extra allocation, and written to a
+/// string with the `.to_string()` method. For examples, see
+/// [`Style::prefix`](struct.Style.html#method.prefix).
+#[derive(Clone, Copy, Debug)]
+pub struct Prefix(Style);
+
+/// Like `ANSIString`, but only displays the difference between two
+/// styles.
+///
+/// This type implements the `Display` trait, meaning it can be written to a
+/// `std::fmt` formatting without doing any extra allocation, and written to a
+/// string with the `.to_string()` method. For examples, see
+/// [`Style::infix`](struct.Style.html#method.infix).
+#[derive(Clone, Copy, Debug)]
+pub struct Infix(Style, Style);
+
+/// Like `ANSIString`, but only displays the style suffix.
+///
+/// This type implements the `Display` trait, meaning it can be written to a
+/// `std::fmt` formatting without doing any extra allocation, and written to a
+/// string with the `.to_string()` method. For examples, see
+/// [`Style::suffix`](struct.Style.html#method.suffix).
+#[derive(Clone, Copy, Debug)]
+pub struct Suffix(Style);
+
+
+impl Style {
+
+    /// The prefix bytes for this style. These are the bytes that tell the
+    /// terminal to use a different colour or font style.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::{Style, Colour::Blue};
+    ///
+    /// let style = Style::default().bold();
+    /// assert_eq!("\x1b[1m",
+    ///            style.prefix().to_string());
+    ///
+    /// let style = Blue.bold();
+    /// assert_eq!("\x1b[1;34m",
+    ///            style.prefix().to_string());
+    ///
+    /// let style = Style::default();
+    /// assert_eq!("",
+    ///            style.prefix().to_string());
+    /// ```
+    pub fn prefix(self) -> Prefix {
+        Prefix(self)
+    }
+
+    /// The infix bytes between this style and `next` style. These are the bytes
+    /// that tell the terminal to change the style to `next`. These may include
+    /// a reset followed by the next colour and style, depending on the two styles.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::{Style, Colour::Green};
+    ///
+    /// let style = Style::default().bold();
+    /// assert_eq!("\x1b[32m",
+    ///            style.infix(Green.bold()).to_string());
+    ///
+    /// let style = Green.normal();
+    /// assert_eq!("\x1b[1m",
+    ///            style.infix(Green.bold()).to_string());
+    ///
+    /// let style = Style::default();
+    /// assert_eq!("",
+    ///            style.infix(style).to_string());
+    /// ```
+    pub fn infix(self, next: Style) -> Infix {
+        Infix(self, next)
+    }
+
+    /// The suffix for this style. These are the bytes that tell the terminal
+    /// to reset back to its normal colour and font style.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::{Style, Colour::Green};
+    ///
+    /// let style = Style::default().bold();
+    /// assert_eq!("\x1b[0m",
+    ///            style.suffix().to_string());
+    ///
+    /// let style = Green.normal().bold();
+    /// assert_eq!("\x1b[0m",
+    ///            style.suffix().to_string());
+    ///
+    /// let style = Style::default();
+    /// assert_eq!("",
+    ///            style.suffix().to_string());
+    /// ```
+    pub fn suffix(self) -> Suffix {
+        Suffix(self)
+    }
+}
+
+
+impl Colour {
+
+    /// The prefix bytes for this colour as a `Style`. These are the bytes
+    /// that tell the terminal to use a different colour or font style.
+    ///
+    /// See also [`Style::prefix`](struct.Style.html#method.prefix).
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour::Green;
+    ///
+    /// assert_eq!("\x1b[0m",
+    ///            Green.suffix().to_string());
+    /// ```
+    pub fn prefix(self) -> Prefix {
+        Prefix(self.normal())
+    }
+
+    /// The infix bytes between this colour and `next` colour. These are the bytes
+    /// that tell the terminal to use the `next` colour, or to do nothing if
+    /// the two colours are equal.
+    ///
+    /// See also [`Style::infix`](struct.Style.html#method.infix).
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour::{Red, Yellow};
+    ///
+    /// assert_eq!("\x1b[33m",
+    ///            Red.infix(Yellow).to_string());
+    /// ```
+    pub fn infix(self, next: Colour) -> Infix {
+        Infix(self.normal(), next.normal())
+    }
+
+    /// The suffix for this colour as a `Style`. These are the bytes that
+    /// tell the terminal to reset back to its normal colour and font style.
+    ///
+    /// See also [`Style::suffix`](struct.Style.html#method.suffix).
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour::Purple;
+    ///
+    /// assert_eq!("\x1b[0m",
+    ///            Purple.suffix().to_string());
+    /// ```
+    pub fn suffix(self) -> Suffix {
+        Suffix(self.normal())
+    }
+}
+
+
+impl fmt::Display for Prefix {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let f: &mut fmt::Write = f;
+        self.0.write_prefix(f)
+    }
+}
+
+
+impl fmt::Display for Infix {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        use difference::Difference;
+
+        match Difference::between(&self.0, &self.1) {
+            Difference::ExtraStyles(style) => {
+                let f: &mut fmt::Write = f;
+                style.write_prefix(f)
+            },
+            Difference::Reset => {
+                let f: &mut fmt::Write = f;
+                write!(f, "{}{}", RESET, self.1.prefix())
+            },
+            Difference::NoDifference => {
+                Ok(())   // nothing to write
+            },
+        }
+    }
+}
+
+
+impl fmt::Display for Suffix {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let f: &mut fmt::Write = f;
+        self.0.write_suffix(f)
+    }
+}
+
+
+
+#[cfg(test)]
+mod test {
+    use style::Style;
+    use style::Colour::*;
+
+    macro_rules! test {
+        ($name: ident: $style: expr; $input: expr => $result: expr) => {
+            #[test]
+            fn $name() {
+                assert_eq!($style.paint($input).to_string(), $result.to_string());
+
+                let mut v = Vec::new();
+                $style.paint($input.as_bytes()).write_to(&mut v).unwrap();
+                assert_eq!(v.as_slice(), $result.as_bytes());
+            }
+        };
+    }
+
+    test!(plain:                 Style::default();                  "text/plain" => "text/plain");
+    test!(red:                   Red;                               "hi" => "\x1B[31mhi\x1B[0m");
+    test!(black:                 Black.normal();                    "hi" => "\x1B[30mhi\x1B[0m");
+    test!(yellow_bold:           Yellow.bold();                     "hi" => "\x1B[1;33mhi\x1B[0m");
+    test!(yellow_bold_2:         Yellow.normal().bold();            "hi" => "\x1B[1;33mhi\x1B[0m");
+    test!(blue_underline:        Blue.underline();                  "hi" => "\x1B[4;34mhi\x1B[0m");
+    test!(green_bold_ul:         Green.bold().underline();          "hi" => "\x1B[1;4;32mhi\x1B[0m");
+    test!(green_bold_ul_2:       Green.underline().bold();          "hi" => "\x1B[1;4;32mhi\x1B[0m");
+    test!(purple_on_white:       Purple.on(White);                  "hi" => "\x1B[47;35mhi\x1B[0m");
+    test!(purple_on_white_2:     Purple.normal().on(White);         "hi" => "\x1B[47;35mhi\x1B[0m");
+    test!(yellow_on_blue:        Style::new().on(Blue).fg(Yellow);  "hi" => "\x1B[44;33mhi\x1B[0m");
+    test!(yellow_on_blue_2:      Cyan.on(Blue).fg(Yellow);          "hi" => "\x1B[44;33mhi\x1B[0m");
+    test!(cyan_bold_on_white:    Cyan.bold().on(White);             "hi" => "\x1B[1;47;36mhi\x1B[0m");
+    test!(cyan_ul_on_white:      Cyan.underline().on(White);        "hi" => "\x1B[4;47;36mhi\x1B[0m");
+    test!(cyan_bold_ul_on_white: Cyan.bold().underline().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m");
+    test!(cyan_ul_bold_on_white: Cyan.underline().bold().on(White); "hi" => "\x1B[1;4;47;36mhi\x1B[0m");
+    test!(fixed:                 Fixed(100);                        "hi" => "\x1B[38;5;100mhi\x1B[0m");
+    test!(fixed_on_purple:       Fixed(100).on(Purple);             "hi" => "\x1B[45;38;5;100mhi\x1B[0m");
+    test!(fixed_on_fixed:        Fixed(100).on(Fixed(200));         "hi" => "\x1B[48;5;200;38;5;100mhi\x1B[0m");
+    test!(rgb:                   RGB(70,130,180);                   "hi" => "\x1B[38;2;70;130;180mhi\x1B[0m");
+    test!(rgb_on_blue:           RGB(70,130,180).on(Blue);          "hi" => "\x1B[44;38;2;70;130;180mhi\x1B[0m");
+    test!(blue_on_rgb:           Blue.on(RGB(70,130,180));          "hi" => "\x1B[48;2;70;130;180;34mhi\x1B[0m");
+    test!(rgb_on_rgb:            RGB(70,130,180).on(RGB(5,10,15));  "hi" => "\x1B[48;2;5;10;15;38;2;70;130;180mhi\x1B[0m");
+    test!(bold:                  Style::new().bold();               "hi" => "\x1B[1mhi\x1B[0m");
+    test!(underline:             Style::new().underline();          "hi" => "\x1B[4mhi\x1B[0m");
+    test!(bunderline:            Style::new().bold().underline();   "hi" => "\x1B[1;4mhi\x1B[0m");
+    test!(dimmed:                Style::new().dimmed();             "hi" => "\x1B[2mhi\x1B[0m");
+    test!(italic:                Style::new().italic();             "hi" => "\x1B[3mhi\x1B[0m");
+    test!(blink:                 Style::new().blink();              "hi" => "\x1B[5mhi\x1B[0m");
+    test!(reverse:               Style::new().reverse();            "hi" => "\x1B[7mhi\x1B[0m");
+    test!(hidden:                Style::new().hidden();             "hi" => "\x1B[8mhi\x1B[0m");
+    test!(stricken:              Style::new().strikethrough();      "hi" => "\x1B[9mhi\x1B[0m");
+
+    #[test]
+    fn test_infix() {
+        assert_eq!(Style::new().dimmed().infix(Style::new()).to_string(), "\x1B[0m");
+        assert_eq!(White.dimmed().infix(White.normal()).to_string(), "\x1B[0m\x1B[37m");
+        assert_eq!(White.normal().infix(White.bold()).to_string(), "\x1B[1m");
+        assert_eq!(White.normal().infix(Blue.normal()).to_string(), "\x1B[34m");
+        assert_eq!(Blue.bold().infix(Blue.bold()).to_string(), "");
+    }
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/debug.rs b/android/vendor/ansi_term-0.12.1/src/debug.rs
new file mode 100644
index 0000000..4877323
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/debug.rs
@@ -0,0 +1,134 @@
+use std::fmt;
+
+use style::Style;
+
+/// Styles have a special `Debug` implementation that only shows the fields that
+/// are set. Fields that haven’t been touched aren’t included in the output.
+///
+/// This behaviour gets bypassed when using the alternate formatting mode
+/// `format!("{:#?}")`.
+///
+///     use ansi_term::Colour::{Red, Blue};
+///     assert_eq!("Style { fg(Red), on(Blue), bold, italic }",
+///                format!("{:?}", Red.on(Blue).bold().italic()));
+impl fmt::Debug for Style {
+    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+        if fmt.alternate() {
+            fmt.debug_struct("Style")
+               .field("foreground",    &self.foreground)
+               .field("background",    &self.background)
+               .field("blink",         &self.is_blink)
+               .field("bold",          &self.is_bold)
+               .field("dimmed",        &self.is_dimmed)
+               .field("hidden",        &self.is_hidden)
+               .field("italic",        &self.is_italic)
+               .field("reverse",       &self.is_reverse)
+               .field("strikethrough", &self.is_strikethrough)
+               .field("underline",     &self.is_underline)
+               .finish()
+        }
+        else if self.is_plain() {
+            fmt.write_str("Style {}")
+        }
+        else {
+            fmt.write_str("Style { ")?;
+
+            let mut written_anything = false;
+
+            if let Some(fg) = self.foreground {
+                if written_anything { fmt.write_str(", ")? }
+                written_anything = true;
+                write!(fmt, "fg({:?})", fg)?
+            }
+
+            if let Some(bg) = self.background {
+                if written_anything { fmt.write_str(", ")? }
+                written_anything = true;
+                write!(fmt, "on({:?})", bg)?
+            }
+
+            {
+                let mut write_flag = |name| {
+                    if written_anything { fmt.write_str(", ")? }
+                    written_anything = true;
+                    fmt.write_str(name)
+                };
+
+                if self.is_blink          { write_flag("blink")? }
+                if self.is_bold           { write_flag("bold")? }
+                if self.is_dimmed         { write_flag("dimmed")? }
+                if self.is_hidden         { write_flag("hidden")? }
+                if self.is_italic         { write_flag("italic")? }
+                if self.is_reverse        { write_flag("reverse")? }
+                if self.is_strikethrough  { write_flag("strikethrough")? }
+                if self.is_underline      { write_flag("underline")? }
+            }
+
+            write!(fmt, " }}")
+        }
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use style::Colour::*;
+    use style::Style;
+
+    fn style() -> Style {
+        Style::new()
+    }
+
+    macro_rules! test {
+        ($name: ident: $obj: expr => $result: expr) => {
+            #[test]
+            fn $name() {
+                assert_eq!($result, format!("{:?}", $obj));
+            }
+        };
+    }
+
+    test!(empty:   style()                  => "Style {}");
+    test!(bold:    style().bold()           => "Style { bold }");
+    test!(italic:  style().italic()         => "Style { italic }");
+    test!(both:    style().bold().italic()  => "Style { bold, italic }");
+
+    test!(red:     Red.normal()                     => "Style { fg(Red) }");
+    test!(redblue: Red.normal().on(RGB(3, 2, 4))    => "Style { fg(Red), on(RGB(3, 2, 4)) }");
+
+    test!(everything:
+            Red.on(Blue).blink().bold().dimmed().hidden().italic().reverse().strikethrough().underline() =>
+            "Style { fg(Red), on(Blue), blink, bold, dimmed, hidden, italic, reverse, strikethrough, underline }");
+
+    #[test]
+    fn long_and_detailed() {
+        extern crate regex;
+        let expected_debug = "Style { fg(Blue), bold }";
+        let expected_pretty_repat = r##"(?x)
+        Style\s+\{\s+
+            foreground:\s+Some\(\s+
+                Blue,?\s+
+            \),\s+
+            background:\s+None,\s+
+            blink:\s+false,\s+
+            bold:\s+true,\s+
+            dimmed:\s+false,\s+
+            hidden:\s+false,\s+
+            italic:\s+false,\s+
+            reverse:\s+false,\s+
+            strikethrough:\s+
+            false,\s+
+            underline:\s+false,?\s+
+            \}"##;
+        let re = regex::Regex::new(expected_pretty_repat).unwrap();
+
+        let style = Blue.bold();
+        let style_fmt_debug = format!("{:?}", style);
+        let style_fmt_pretty = format!("{:#?}", style);
+        println!("style_fmt_debug:\n{}", style_fmt_debug);
+        println!("style_fmt_pretty:\n{}", style_fmt_pretty);
+
+        assert_eq!(expected_debug, style_fmt_debug);
+        assert!(re.is_match(&style_fmt_pretty));
+    }
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/difference.rs b/android/vendor/ansi_term-0.12.1/src/difference.rs
new file mode 100644
index 0000000..b0de07f
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/difference.rs
@@ -0,0 +1,179 @@
+use super::Style;
+
+
+/// When printing out one coloured string followed by another, use one of
+/// these rules to figure out which *extra* control codes need to be sent.
+#[derive(PartialEq, Clone, Copy, Debug)]
+pub enum Difference {
+
+    /// Print out the control codes specified by this style to end up looking
+    /// like the second string's styles.
+    ExtraStyles(Style),
+
+    /// Converting between these two is impossible, so just send a reset
+    /// command and then the second string's styles.
+    Reset,
+
+    /// The before style is exactly the same as the after style, so no further
+    /// control codes need to be printed.
+    NoDifference,
+}
+
+
+impl Difference {
+
+    /// Compute the 'style difference' required to turn an existing style into
+    /// the given, second style.
+    ///
+    /// For example, to turn green text into green bold text, it's redundant
+    /// to write a reset command then a second green+bold command, instead of
+    /// just writing one bold command. This method should see that both styles
+    /// use the foreground colour green, and reduce it to a single command.
+    ///
+    /// This method returns an enum value because it's not actually always
+    /// possible to turn one style into another: for example, text could be
+    /// made bold and underlined, but you can't remove the bold property
+    /// without also removing the underline property. So when this has to
+    /// happen, this function returns None, meaning that the entire set of
+    /// styles should be reset and begun again.
+    pub fn between(first: &Style, next: &Style) -> Difference {
+        use self::Difference::*;
+
+        // XXX(Havvy): This algorithm is kind of hard to replicate without
+        // having the Plain/Foreground enum variants, so I'm just leaving
+        // it commented out for now, and defaulting to Reset.
+
+        if first == next {
+            return NoDifference;
+        }
+
+        // Cannot un-bold, so must Reset.
+        if first.is_bold && !next.is_bold {
+            return Reset;
+        }
+
+        if first.is_dimmed && !next.is_dimmed {
+            return Reset;
+        }
+
+        if first.is_italic && !next.is_italic {
+            return Reset;
+        }
+
+        // Cannot un-underline, so must Reset.
+        if first.is_underline && !next.is_underline {
+            return Reset;
+        }
+
+        if first.is_blink && !next.is_blink {
+            return Reset;
+        }
+
+        if first.is_reverse && !next.is_reverse {
+            return Reset;
+        }
+
+        if first.is_hidden && !next.is_hidden {
+            return Reset;
+        }
+
+        if first.is_strikethrough && !next.is_strikethrough {
+            return Reset;
+        }
+
+        // Cannot go from foreground to no foreground, so must Reset.
+        if first.foreground.is_some() && next.foreground.is_none() {
+            return Reset;
+        }
+
+        // Cannot go from background to no background, so must Reset.
+        if first.background.is_some() && next.background.is_none() {
+            return Reset;
+        }
+
+        let mut extra_styles = Style::default();
+
+        if first.is_bold != next.is_bold {
+            extra_styles.is_bold = true;
+        }
+
+        if first.is_dimmed != next.is_dimmed {
+            extra_styles.is_dimmed = true;
+        }
+
+        if first.is_italic != next.is_italic {
+            extra_styles.is_italic = true;
+        }
+
+        if first.is_underline != next.is_underline {
+            extra_styles.is_underline = true;
+        }
+
+        if first.is_blink != next.is_blink {
+            extra_styles.is_blink = true;
+        }
+
+        if first.is_reverse != next.is_reverse {
+            extra_styles.is_reverse = true;
+        }
+
+        if first.is_hidden != next.is_hidden {
+            extra_styles.is_hidden = true;
+        }
+
+        if first.is_strikethrough != next.is_strikethrough {
+            extra_styles.is_strikethrough = true;
+        }
+
+        if first.foreground != next.foreground {
+            extra_styles.foreground = next.foreground;
+        }
+
+        if first.background != next.background {
+            extra_styles.background = next.background;
+        }
+
+        ExtraStyles(extra_styles)
+    }
+}
+
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use super::Difference::*;
+    use style::Colour::*;
+    use style::Style;
+
+    fn style() -> Style {
+        Style::new()
+    }
+
+    macro_rules! test {
+        ($name: ident: $first: expr; $next: expr => $result: expr) => {
+            #[test]
+            fn $name() {
+                assert_eq!($result, Difference::between(&$first, &$next));
+            }
+        };
+    }
+
+    test!(nothing:    Green.normal(); Green.normal()  => NoDifference);
+    test!(uppercase:  Green.normal(); Green.bold()    => ExtraStyles(style().bold()));
+    test!(lowercase:  Green.bold();   Green.normal()  => Reset);
+    test!(nothing2:   Green.bold();   Green.bold()    => NoDifference);
+
+    test!(colour_change: Red.normal(); Blue.normal() => ExtraStyles(Blue.normal()));
+
+    test!(addition_of_blink:          style(); style().blink()          => ExtraStyles(style().blink()));
+    test!(addition_of_dimmed:         style(); style().dimmed()         => ExtraStyles(style().dimmed()));
+    test!(addition_of_hidden:         style(); style().hidden()         => ExtraStyles(style().hidden()));
+    test!(addition_of_reverse:        style(); style().reverse()        => ExtraStyles(style().reverse()));
+    test!(addition_of_strikethrough:  style(); style().strikethrough()  => ExtraStyles(style().strikethrough()));
+
+    test!(removal_of_strikethrough:   style().strikethrough(); style()  => Reset);
+    test!(removal_of_reverse:         style().reverse();       style()  => Reset);
+    test!(removal_of_hidden:          style().hidden();        style()  => Reset);
+    test!(removal_of_dimmed:          style().dimmed();        style()  => Reset);
+    test!(removal_of_blink:           style().blink();         style()  => Reset);
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/display.rs b/android/vendor/ansi_term-0.12.1/src/display.rs
new file mode 100644
index 0000000..17c54f0
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/display.rs
@@ -0,0 +1,296 @@
+use std::borrow::Cow;
+use std::fmt;
+use std::io;
+use std::ops::Deref;
+
+use ansi::RESET;
+use difference::Difference;
+use style::{Style, Colour};
+use write::AnyWrite;
+
+
+/// An `ANSIGenericString` includes a generic string type and a `Style` to
+/// display that string.  `ANSIString` and `ANSIByteString` are aliases for
+/// this type on `str` and `\[u8]`, respectively.
+#[derive(PartialEq, Debug)]
+pub struct ANSIGenericString<'a, S: 'a + ToOwned + ?Sized>
+where <S as ToOwned>::Owned: fmt::Debug {
+    style: Style,
+    string: Cow<'a, S>,
+}
+
+
+/// Cloning an `ANSIGenericString` will clone its underlying string.
+///
+/// # Examples
+///
+/// ```
+/// use ansi_term::ANSIString;
+///
+/// let plain_string = ANSIString::from("a plain string");
+/// let clone_string = plain_string.clone();
+/// assert_eq!(clone_string, plain_string);
+/// ```
+impl<'a, S: 'a + ToOwned + ?Sized> Clone for ANSIGenericString<'a, S>
+where <S as ToOwned>::Owned: fmt::Debug {
+    fn clone(&self) -> ANSIGenericString<'a, S> {
+        ANSIGenericString {
+            style: self.style,
+            string: self.string.clone(),
+        }
+    }
+}
+
+// You might think that the hand-written Clone impl above is the same as the
+// one that gets generated with #[derive]. But it’s not *quite* the same!
+//
+// `str` is not Clone, and the derived Clone implementation puts a Clone
+// constraint on the S type parameter (generated using --pretty=expanded):
+//
+//                  ↓_________________↓
+//     impl <'a, S: ::std::clone::Clone + 'a + ToOwned + ?Sized> ::std::clone::Clone
+//     for ANSIGenericString<'a, S> where
+//     <S as ToOwned>::Owned: fmt::Debug { ... }
+//
+// This resulted in compile errors when you tried to derive Clone on a type
+// that used it:
+//
+//     #[derive(PartialEq, Debug, Clone, Default)]
+//     pub struct TextCellContents(Vec<ANSIString<'static>>);
+//                                 ^^^^^^^^^^^^^^^^^^^^^^^^^
+//     error[E0277]: the trait `std::clone::Clone` is not implemented for `str`
+//
+// The hand-written impl above can ignore that constraint and still compile.
+
+
+
+/// An ANSI String is a string coupled with the `Style` to display it
+/// in a terminal.
+///
+/// Although not technically a string itself, it can be turned into
+/// one with the `to_string` method.
+///
+/// # Examples
+///
+/// ```
+/// use ansi_term::ANSIString;
+/// use ansi_term::Colour::Red;
+///
+/// let red_string = Red.paint("a red string");
+/// println!("{}", red_string);
+/// ```
+///
+/// ```
+/// use ansi_term::ANSIString;
+///
+/// let plain_string = ANSIString::from("a plain string");
+/// assert_eq!(&*plain_string, "a plain string");
+/// ```
+pub type ANSIString<'a> = ANSIGenericString<'a, str>;
+
+/// An `ANSIByteString` represents a formatted series of bytes.  Use
+/// `ANSIByteString` when styling text with an unknown encoding.
+pub type ANSIByteString<'a> = ANSIGenericString<'a, [u8]>;
+
+impl<'a, I, S: 'a + ToOwned + ?Sized> From<I> for ANSIGenericString<'a, S>
+where I: Into<Cow<'a, S>>,
+      <S as ToOwned>::Owned: fmt::Debug {
+    fn from(input: I) -> ANSIGenericString<'a, S> {
+        ANSIGenericString {
+            string: input.into(),
+            style:  Style::default(),
+        }
+    }
+}
+
+impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericString<'a, S>
+    where <S as ToOwned>::Owned: fmt::Debug {
+
+    /// Directly access the style
+    pub fn style_ref(&self) -> &Style {
+        &self.style
+    }
+
+    /// Directly access the style mutably
+    pub fn style_ref_mut(&mut self) -> &mut Style {
+        &mut self.style
+    }
+}
+
+impl<'a, S: 'a + ToOwned + ?Sized> Deref for ANSIGenericString<'a, S>
+where <S as ToOwned>::Owned: fmt::Debug {
+    type Target = S;
+
+    fn deref(&self) -> &S {
+        self.string.deref()
+    }
+}
+
+
+/// A set of `ANSIGenericString`s collected together, in order to be
+/// written with a minimum of control characters.
+#[derive(Debug, PartialEq)]
+pub struct ANSIGenericStrings<'a, S: 'a + ToOwned + ?Sized>
+    (pub &'a [ANSIGenericString<'a, S>])
+    where <S as ToOwned>::Owned: fmt::Debug, S: PartialEq;
+
+/// A set of `ANSIString`s collected together, in order to be written with a
+/// minimum of control characters.
+pub type ANSIStrings<'a> = ANSIGenericStrings<'a, str>;
+
+/// A function to construct an `ANSIStrings` instance.
+#[allow(non_snake_case)]
+pub fn ANSIStrings<'a>(arg: &'a [ANSIString<'a>]) -> ANSIStrings<'a> {
+    ANSIGenericStrings(arg)
+}
+
+/// A set of `ANSIByteString`s collected together, in order to be
+/// written with a minimum of control characters.
+pub type ANSIByteStrings<'a> = ANSIGenericStrings<'a, [u8]>;
+
+/// A function to construct an `ANSIByteStrings` instance.
+#[allow(non_snake_case)]
+pub fn ANSIByteStrings<'a>(arg: &'a [ANSIByteString<'a>]) -> ANSIByteStrings<'a> {
+    ANSIGenericStrings(arg)
+}
+
+
+// ---- paint functions ----
+
+impl Style {
+
+    /// Paints the given text with this colour, returning an ANSI string.
+    #[must_use]
+    pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> ANSIGenericString<'a, S>
+    where I: Into<Cow<'a, S>>,
+          <S as ToOwned>::Owned: fmt::Debug {
+        ANSIGenericString {
+            string: input.into(),
+            style:  self,
+        }
+    }
+}
+
+
+impl Colour {
+
+    /// Paints the given text with this colour, returning an ANSI string.
+    /// This is a short-cut so you don’t have to use `Blue.normal()` just
+    /// to get blue text.
+    ///
+    /// ```
+    /// use ansi_term::Colour::Blue;
+    /// println!("{}", Blue.paint("da ba dee"));
+    /// ```
+    #[must_use]
+    pub fn paint<'a, I, S: 'a + ToOwned + ?Sized>(self, input: I) -> ANSIGenericString<'a, S>
+    where I: Into<Cow<'a, S>>,
+          <S as ToOwned>::Owned: fmt::Debug {
+        ANSIGenericString {
+            string: input.into(),
+            style:  self.normal(),
+        }
+    }
+}
+
+
+// ---- writers for individual ANSI strings ----
+
+impl<'a> fmt::Display for ANSIString<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let w: &mut fmt::Write = f;
+        self.write_to_any(w)
+    }
+}
+
+impl<'a> ANSIByteString<'a> {
+    /// Write an `ANSIByteString` to an `io::Write`.  This writes the escape
+    /// sequences for the associated `Style` around the bytes.
+    pub fn write_to<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
+        let w: &mut io::Write = w;
+        self.write_to_any(w)
+    }
+}
+
+impl<'a, S: 'a + ToOwned + ?Sized> ANSIGenericString<'a, S>
+where <S as ToOwned>::Owned: fmt::Debug, &'a S: AsRef<[u8]> {
+    fn write_to_any<W: AnyWrite<wstr=S> + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> {
+        write!(w, "{}", self.style.prefix())?;
+        w.write_str(self.string.as_ref())?;
+        write!(w, "{}", self.style.suffix())
+    }
+}
+
+
+// ---- writers for combined ANSI strings ----
+
+impl<'a> fmt::Display for ANSIStrings<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let f: &mut fmt::Write = f;
+        self.write_to_any(f)
+    }
+}
+
+impl<'a> ANSIByteStrings<'a> {
+    /// Write `ANSIByteStrings` to an `io::Write`.  This writes the minimal
+    /// escape sequences for the associated `Style`s around each set of
+    /// bytes.
+    pub fn write_to<W: io::Write>(&self, w: &mut W) -> io::Result<()> {
+        let w: &mut io::Write = w;
+        self.write_to_any(w)
+    }
+}
+
+impl<'a, S: 'a + ToOwned + ?Sized + PartialEq> ANSIGenericStrings<'a, S>
+where <S as ToOwned>::Owned: fmt::Debug, &'a S: AsRef<[u8]> {
+    fn write_to_any<W: AnyWrite<wstr=S> + ?Sized>(&self, w: &mut W) -> Result<(), W::Error> {
+        use self::Difference::*;
+
+        let first = match self.0.first() {
+            None => return Ok(()),
+            Some(f) => f,
+        };
+
+        write!(w, "{}", first.style.prefix())?;
+        w.write_str(first.string.as_ref())?;
+
+        for window in self.0.windows(2) {
+            match Difference::between(&window[0].style, &window[1].style) {
+                ExtraStyles(style) => write!(w, "{}", style.prefix())?,
+                Reset              => write!(w, "{}{}", RESET, window[1].style.prefix())?,
+                NoDifference       => {/* Do nothing! */},
+            }
+
+            w.write_str(&window[1].string)?;
+        }
+
+        // Write the final reset string after all of the ANSIStrings have been
+        // written, *except* if the last one has no styles, because it would
+        // have already been written by this point.
+        if let Some(last) = self.0.last() {
+            if !last.style.is_plain() {
+                write!(w, "{}", RESET)?;
+            }
+        }
+
+        Ok(())
+    }
+}
+
+
+// ---- tests ----
+
+#[cfg(test)]
+mod tests {
+    pub use super::super::ANSIStrings;
+    pub use style::Style;
+    pub use style::Colour::*;
+
+    #[test]
+    fn no_control_codes_for_plain() {
+        let one = Style::default().paint("one");
+        let two = Style::default().paint("two");
+        let output = format!("{}", ANSIStrings( &[ one, two ] ));
+        assert_eq!(&*output, "onetwo");
+    }
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/lib.rs b/android/vendor/ansi_term-0.12.1/src/lib.rs
new file mode 100644
index 0000000..2d2f83a
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/lib.rs
@@ -0,0 +1,271 @@
+//! This is a library for controlling colours and formatting, such as
+//! red bold text or blue underlined text, on ANSI terminals.
+//!
+//!
+//! ## Basic usage
+//!
+//! There are three main types in this crate that you need to be
+//! concerned with: [`ANSIString`], [`Style`], and [`Colour`].
+//!
+//! A `Style` holds stylistic information: foreground and background colours,
+//! whether the text should be bold, or blinking, or other properties. The
+//! [`Colour`] enum represents the available colours. And an [`ANSIString`] is a
+//! string paired with a [`Style`].
+//!
+//! [`Color`] is also available as an alias to `Colour`.
+//!
+//! To format a string, call the `paint` method on a `Style` or a `Colour`,
+//! passing in the string you want to format as the argument. For example,
+//! here’s how to get some red text:
+//!
+//! ```
+//! use ansi_term::Colour::Red;
+//!
+//! println!("This is in red: {}", Red.paint("a red string"));
+//! ```
+//!
+//! It’s important to note that the `paint` method does *not* actually return a
+//! string with the ANSI control characters surrounding it. Instead, it returns
+//! an [`ANSIString`] value that has a [`Display`] implementation that, when
+//! formatted, returns the characters. This allows strings to be printed with a
+//! minimum of [`String`] allocations being performed behind the scenes.
+//!
+//! If you *do* want to get at the escape codes, then you can convert the
+//! [`ANSIString`] to a string as you would any other `Display` value:
+//!
+//! ```
+//! use ansi_term::Colour::Red;
+//!
+//! let red_string = Red.paint("a red string").to_string();
+//! ```
+//!
+//!
+//! ## Bold, underline, background, and other styles
+//!
+//! For anything more complex than plain foreground colour changes, you need to
+//! construct `Style` values themselves, rather than beginning with a `Colour`.
+//! You can do this by chaining methods based on a new `Style`, created with
+//! [`Style::new()`]. Each method creates a new style that has that specific
+//! property set. For example:
+//!
+//! ```
+//! use ansi_term::Style;
+//!
+//! println!("How about some {} and {}?",
+//!          Style::new().bold().paint("bold"),
+//!          Style::new().underline().paint("underline"));
+//! ```
+//!
+//! For brevity, these methods have also been implemented for `Colour` values,
+//! so you can give your styles a foreground colour without having to begin with
+//! an empty `Style` value:
+//!
+//! ```
+//! use ansi_term::Colour::{Blue, Yellow};
+//!
+//! println!("Demonstrating {} and {}!",
+//!          Blue.bold().paint("blue bold"),
+//!          Yellow.underline().paint("yellow underline"));
+//!
+//! println!("Yellow on blue: {}", Yellow.on(Blue).paint("wow!"));
+//! ```
+//!
+//! The complete list of styles you can use are: [`bold`], [`dimmed`], [`italic`],
+//! [`underline`], [`blink`], [`reverse`], [`hidden`], [`strikethrough`], and [`on`] for
+//! background colours.
+//!
+//! In some cases, you may find it easier to change the foreground on an
+//! existing `Style` rather than starting from the appropriate `Colour`.
+//! You can do this using the [`fg`] method:
+//!
+//! ```
+//! use ansi_term::Style;
+//! use ansi_term::Colour::{Blue, Cyan, Yellow};
+//!
+//! println!("Yellow on blue: {}", Style::new().on(Blue).fg(Yellow).paint("yow!"));
+//! println!("Also yellow on blue: {}", Cyan.on(Blue).fg(Yellow).paint("zow!"));
+//! ```
+//!
+//! You can turn a `Colour` into a `Style` with the [`normal`] method.
+//! This will produce the exact same `ANSIString` as if you just used the
+//! `paint` method on the `Colour` directly, but it’s useful in certain cases:
+//! for example, you may have a method that returns `Styles`, and need to
+//! represent both the “red bold” and “red, but not bold” styles with values of
+//! the same type. The `Style` struct also has a [`Default`] implementation if you
+//! want to have a style with *nothing* set.
+//!
+//! ```
+//! use ansi_term::Style;
+//! use ansi_term::Colour::Red;
+//!
+//! Red.normal().paint("yet another red string");
+//! Style::default().paint("a completely regular string");
+//! ```
+//!
+//!
+//! ## Extended colours
+//!
+//! You can access the extended range of 256 colours by using the `Colour::Fixed`
+//! variant, which takes an argument of the colour number to use. This can be
+//! included wherever you would use a `Colour`:
+//!
+//! ```
+//! use ansi_term::Colour::Fixed;
+//!
+//! Fixed(134).paint("A sort of light purple");
+//! Fixed(221).on(Fixed(124)).paint("Mustard in the ketchup");
+//! ```
+//!
+//! The first sixteen of these values are the same as the normal and bold
+//! standard colour variants. There’s nothing stopping you from using these as
+//! `Fixed` colours instead, but there’s nothing to be gained by doing so
+//! either.
+//!
+//! You can also access full 24-bit colour by using the `Colour::RGB` variant,
+//! which takes separate `u8` arguments for red, green, and blue:
+//!
+//! ```
+//! use ansi_term::Colour::RGB;
+//!
+//! RGB(70, 130, 180).paint("Steel blue");
+//! ```
+//!
+//! ## Combining successive coloured strings
+//!
+//! The benefit of writing ANSI escape codes to the terminal is that they
+//! *stack*: you do not need to end every coloured string with a reset code if
+//! the text that follows it is of a similar style. For example, if you want to
+//! have some blue text followed by some blue bold text, it’s possible to send
+//! the ANSI code for blue, followed by the ANSI code for bold, and finishing
+//! with a reset code without having to have an extra one between the two
+//! strings.
+//!
+//! This crate can optimise the ANSI codes that get printed in situations like
+//! this, making life easier for your terminal renderer. The [`ANSIStrings`]
+//! type takes a slice of several [`ANSIString`] values, and will iterate over
+//! each of them, printing only the codes for the styles that need to be updated
+//! as part of its formatting routine.
+//!
+//! The following code snippet uses this to enclose a binary number displayed in
+//! red bold text inside some red, but not bold, brackets:
+//!
+//! ```
+//! use ansi_term::Colour::Red;
+//! use ansi_term::{ANSIString, ANSIStrings};
+//!
+//! let some_value = format!("{:b}", 42);
+//! let strings: &[ANSIString<'static>] = &[
+//!     Red.paint("["),
+//!     Red.bold().paint(some_value),
+//!     Red.paint("]"),
+//! ];
+//!
+//! println!("Value: {}", ANSIStrings(strings));
+//! ```
+//!
+//! There are several things to note here. Firstly, the [`paint`] method can take
+//! *either* an owned [`String`] or a borrowed [`&str`]. Internally, an [`ANSIString`]
+//! holds a copy-on-write ([`Cow`]) string value to deal with both owned and
+//! borrowed strings at the same time. This is used here to display a `String`,
+//! the result of the `format!` call, using the same mechanism as some
+//! statically-available `&str` slices. Secondly, that the [`ANSIStrings`] value
+//! works in the same way as its singular counterpart, with a [`Display`]
+//! implementation that only performs the formatting when required.
+//!
+//! ## Byte strings
+//!
+//! This library also supports formatting `\[u8]` byte strings; this supports
+//! applications working with text in an unknown encoding.  [`Style`] and
+//! [`Colour`] support painting `\[u8]` values, resulting in an [`ANSIByteString`].
+//! This type does not implement [`Display`], as it may not contain UTF-8, but
+//! it does provide a method [`write_to`] to write the result to any value that
+//! implements [`Write`]:
+//!
+//! ```
+//! use ansi_term::Colour::Green;
+//!
+//! Green.paint("user data".as_bytes()).write_to(&mut std::io::stdout()).unwrap();
+//! ```
+//!
+//! Similarly, the type [`ANSIByteStrings`] supports writing a list of
+//! [`ANSIByteString`] values with minimal escape sequences:
+//!
+//! ```
+//! use ansi_term::Colour::Green;
+//! use ansi_term::ANSIByteStrings;
+//!
+//! ANSIByteStrings(&[
+//!     Green.paint("user data 1\n".as_bytes()),
+//!     Green.bold().paint("user data 2\n".as_bytes()),
+//! ]).write_to(&mut std::io::stdout()).unwrap();
+//! ```
+//!
+//! [`Cow`]: https://doc.rust-lang.org/std/borrow/enum.Cow.html
+//! [`Display`]: https://doc.rust-lang.org/std/fmt/trait.Display.html
+//! [`Default`]: https://doc.rust-lang.org/std/default/trait.Default.html
+//! [`String`]: https://doc.rust-lang.org/std/string/struct.String.html
+//! [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
+//! [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+//! [`Style`]: struct.Style.html
+//! [`Style::new()`]: struct.Style.html#method.new
+//! [`Color`]: enum.Color.html
+//! [`Colour`]: enum.Colour.html
+//! [`ANSIString`]: type.ANSIString.html
+//! [`ANSIStrings`]: type.ANSIStrings.html
+//! [`ANSIByteString`]: type.ANSIByteString.html
+//! [`ANSIByteStrings`]: type.ANSIByteStrings.html
+//! [`write_to`]: type.ANSIByteString.html#method.write_to
+//! [`paint`]: type.ANSIByteString.html#method.write_to
+//! [`normal`]: enum.Colour.html#method.normal
+//!
+//! [`bold`]: struct.Style.html#method.bold
+//! [`dimmed`]: struct.Style.html#method.dimmed
+//! [`italic`]: struct.Style.html#method.italic
+//! [`underline`]: struct.Style.html#method.underline
+//! [`blink`]: struct.Style.html#method.blink
+//! [`reverse`]: struct.Style.html#method.reverse
+//! [`hidden`]: struct.Style.html#method.hidden
+//! [`strikethrough`]: struct.Style.html#method.strikethrough
+//! [`fg`]: struct.Style.html#method.fg
+//! [`on`]: struct.Style.html#method.on
+
+#![crate_name = "ansi_term"]
+#![crate_type = "rlib"]
+#![crate_type = "dylib"]
+
+#![warn(missing_copy_implementations)]
+#![warn(missing_docs)]
+#![warn(trivial_casts, trivial_numeric_casts)]
+#![warn(unused_extern_crates, unused_qualifications)]
+
+#[cfg(target_os="windows")]
+extern crate winapi;
+#[cfg(test)]
+#[macro_use]
+extern crate doc_comment;
+
+#[cfg(test)]
+doctest!("../README.md");
+
+mod ansi;
+pub use ansi::{Prefix, Infix, Suffix};
+
+mod style;
+pub use style::{Colour, Style};
+
+/// Color is a type alias for `Colour`.
+pub use Colour as Color;
+
+mod difference;
+mod display;
+pub use display::*;
+
+mod write;
+
+mod windows;
+pub use windows::*;
+
+mod util;
+pub use util::*;
+
+mod debug;
diff --git a/android/vendor/ansi_term-0.12.1/src/style.rs b/android/vendor/ansi_term-0.12.1/src/style.rs
new file mode 100644
index 0000000..1bee4d9
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/style.rs
@@ -0,0 +1,521 @@
+/// A style is a collection of properties that can format a string
+/// using ANSI escape codes.
+///
+/// # Examples
+///
+/// ```
+/// use ansi_term::{Style, Colour};
+///
+/// let style = Style::new().bold().on(Colour::Black);
+/// println!("{}", style.paint("Bold on black"));
+/// ```
+#[derive(PartialEq, Clone, Copy)]
+#[cfg_attr(feature = "derive_serde_style", derive(serde::Deserialize, serde::Serialize))]
+pub struct Style {
+
+    /// The style's foreground colour, if it has one.
+    pub foreground: Option<Colour>,
+
+    /// The style's background colour, if it has one.
+    pub background: Option<Colour>,
+
+    /// Whether this style is bold.
+    pub is_bold: bool,
+
+    /// Whether this style is dimmed.
+    pub is_dimmed: bool,
+
+    /// Whether this style is italic.
+    pub is_italic: bool,
+
+    /// Whether this style is underlined.
+    pub is_underline: bool,
+
+    /// Whether this style is blinking.
+    pub is_blink: bool,
+
+    /// Whether this style has reverse colours.
+    pub is_reverse: bool,
+
+    /// Whether this style is hidden.
+    pub is_hidden: bool,
+
+    /// Whether this style is struckthrough.
+    pub is_strikethrough: bool
+}
+
+impl Style {
+
+    /// Creates a new Style with no properties set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new();
+    /// println!("{}", style.paint("hi"));
+    /// ```
+    pub fn new() -> Style {
+        Style::default()
+    }
+
+    /// Returns a `Style` with the bold property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().bold();
+    /// println!("{}", style.paint("hey"));
+    /// ```
+    pub fn bold(&self) -> Style {
+        Style { is_bold: true, .. *self }
+    }
+
+    /// Returns a `Style` with the dimmed property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().dimmed();
+    /// println!("{}", style.paint("sup"));
+    /// ```
+    pub fn dimmed(&self) -> Style {
+        Style { is_dimmed: true, .. *self }
+    }
+
+    /// Returns a `Style` with the italic property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().italic();
+    /// println!("{}", style.paint("greetings"));
+    /// ```
+    pub fn italic(&self) -> Style {
+        Style { is_italic: true, .. *self }
+    }
+
+    /// Returns a `Style` with the underline property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().underline();
+    /// println!("{}", style.paint("salutations"));
+    /// ```
+    pub fn underline(&self) -> Style {
+        Style { is_underline: true, .. *self }
+    }
+
+    /// Returns a `Style` with the blink property set.
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().blink();
+    /// println!("{}", style.paint("wazzup"));
+    /// ```
+    pub fn blink(&self) -> Style {
+        Style { is_blink: true, .. *self }
+    }
+
+    /// Returns a `Style` with the reverse property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().reverse();
+    /// println!("{}", style.paint("aloha"));
+    /// ```
+    pub fn reverse(&self) -> Style {
+        Style { is_reverse: true, .. *self }
+    }
+
+    /// Returns a `Style` with the hidden property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().hidden();
+    /// println!("{}", style.paint("ahoy"));
+    /// ```
+    pub fn hidden(&self) -> Style {
+        Style { is_hidden: true, .. *self }
+    }
+
+    /// Returns a `Style` with the strikethrough property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// let style = Style::new().strikethrough();
+    /// println!("{}", style.paint("yo"));
+    /// ```
+    pub fn strikethrough(&self) -> Style {
+        Style { is_strikethrough: true, .. *self }
+    }
+
+    /// Returns a `Style` with the foreground colour property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::{Style, Colour};
+    ///
+    /// let style = Style::new().fg(Colour::Yellow);
+    /// println!("{}", style.paint("hi"));
+    /// ```
+    pub fn fg(&self, foreground: Colour) -> Style {
+        Style { foreground: Some(foreground), .. *self }
+    }
+
+    /// Returns a `Style` with the background colour property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::{Style, Colour};
+    ///
+    /// let style = Style::new().on(Colour::Blue);
+    /// println!("{}", style.paint("eyyyy"));
+    /// ```
+    pub fn on(&self, background: Colour) -> Style {
+        Style { background: Some(background), .. *self }
+    }
+
+    /// Return true if this `Style` has no actual styles, and can be written
+    /// without any control characters.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    ///
+    /// assert_eq!(true,  Style::default().is_plain());
+    /// assert_eq!(false, Style::default().bold().is_plain());
+    /// ```
+    pub fn is_plain(self) -> bool {
+        self == Style::default()
+    }
+}
+
+impl Default for Style {
+
+    /// Returns a style with *no* properties set. Formatting text using this
+    /// style returns the exact same text.
+    ///
+    /// ```
+    /// use ansi_term::Style;
+    /// assert_eq!(None,  Style::default().foreground);
+    /// assert_eq!(None,  Style::default().background);
+    /// assert_eq!(false, Style::default().is_bold);
+    /// assert_eq!("txt", Style::default().paint("txt").to_string());
+    /// ```
+    fn default() -> Style {
+        Style {
+            foreground: None,
+            background: None,
+            is_bold: false,
+            is_dimmed: false,
+            is_italic: false,
+            is_underline: false,
+            is_blink: false,
+            is_reverse: false,
+            is_hidden: false,
+            is_strikethrough: false,
+        }
+    }
+}
+
+
+// ---- colours ----
+
+/// A colour is one specific type of ANSI escape code, and can refer
+/// to either the foreground or background colour.
+///
+/// These use the standard numeric sequences.
+/// See <http://invisible-island.net/xterm/ctlseqs/ctlseqs.html>
+#[derive(PartialEq, Clone, Copy, Debug)]
+#[cfg_attr(feature = "derive_serde_style", derive(serde::Deserialize, serde::Serialize))]
+pub enum Colour {
+
+    /// Colour #0 (foreground code `30`, background code `40`).
+    ///
+    /// This is not necessarily the background colour, and using it as one may
+    /// render the text hard to read on terminals with dark backgrounds.
+    Black,
+
+    /// Colour #1 (foreground code `31`, background code `41`).
+    Red,
+
+    /// Colour #2 (foreground code `32`, background code `42`).
+    Green,
+
+    /// Colour #3 (foreground code `33`, background code `43`).
+    Yellow,
+
+    /// Colour #4 (foreground code `34`, background code `44`).
+    Blue,
+
+    /// Colour #5 (foreground code `35`, background code `45`).
+    Purple,
+
+    /// Colour #6 (foreground code `36`, background code `46`).
+    Cyan,
+
+    /// Colour #7 (foreground code `37`, background code `47`).
+    ///
+    /// As above, this is not necessarily the foreground colour, and may be
+    /// hard to read on terminals with light backgrounds.
+    White,
+
+    /// A colour number from 0 to 255, for use in 256-colour terminal
+    /// environments.
+    ///
+    /// - Colours 0 to 7 are the `Black` to `White` variants respectively.
+    ///   These colours can usually be changed in the terminal emulator.
+    /// - Colours 8 to 15 are brighter versions of the eight colours above.
+    ///   These can also usually be changed in the terminal emulator, or it
+    ///   could be configured to use the original colours and show the text in
+    ///   bold instead. It varies depending on the program.
+    /// - Colours 16 to 231 contain several palettes of bright colours,
+    ///   arranged in six squares measuring six by six each.
+    /// - Colours 232 to 255 are shades of grey from black to white.
+    ///
+    /// It might make more sense to look at a [colour chart][cc].
+    ///
+    /// [cc]: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
+    Fixed(u8),
+
+    /// A 24-bit RGB color, as specified by ISO-8613-3.
+    RGB(u8, u8, u8),
+}
+
+
+impl Colour {
+
+    /// Returns a `Style` with the foreground colour set to this colour.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Red.normal();
+    /// println!("{}", style.paint("hi"));
+    /// ```
+    pub fn normal(self) -> Style {
+        Style { foreground: Some(self), .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// bold property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Green.bold();
+    /// println!("{}", style.paint("hey"));
+    /// ```
+    pub fn bold(self) -> Style {
+        Style { foreground: Some(self), is_bold: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// dimmed property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Yellow.dimmed();
+    /// println!("{}", style.paint("sup"));
+    /// ```
+    pub fn dimmed(self) -> Style {
+        Style { foreground: Some(self), is_dimmed: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// italic property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Blue.italic();
+    /// println!("{}", style.paint("greetings"));
+    /// ```
+    pub fn italic(self) -> Style {
+        Style { foreground: Some(self), is_italic: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// underline property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Purple.underline();
+    /// println!("{}", style.paint("salutations"));
+    /// ```
+    pub fn underline(self) -> Style {
+        Style { foreground: Some(self), is_underline: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// blink property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Cyan.blink();
+    /// println!("{}", style.paint("wazzup"));
+    /// ```
+    pub fn blink(self) -> Style {
+        Style { foreground: Some(self), is_blink: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// reverse property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Black.reverse();
+    /// println!("{}", style.paint("aloha"));
+    /// ```
+    pub fn reverse(self) -> Style {
+        Style { foreground: Some(self), is_reverse: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// hidden property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::White.hidden();
+    /// println!("{}", style.paint("ahoy"));
+    /// ```
+    pub fn hidden(self) -> Style {
+        Style { foreground: Some(self), is_hidden: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// strikethrough property set.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::Fixed(244).strikethrough();
+    /// println!("{}", style.paint("yo"));
+    /// ```
+    pub fn strikethrough(self) -> Style {
+        Style { foreground: Some(self), is_strikethrough: true, .. Style::default() }
+    }
+
+    /// Returns a `Style` with the foreground colour set to this colour and the
+    /// background colour property set to the given colour.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use ansi_term::Colour;
+    ///
+    /// let style = Colour::RGB(31, 31, 31).on(Colour::White);
+    /// println!("{}", style.paint("eyyyy"));
+    /// ```
+    pub fn on(self, background: Colour) -> Style {
+        Style { foreground: Some(self), background: Some(background), .. Style::default() }
+    }
+}
+
+impl From<Colour> for Style {
+
+    /// You can turn a `Colour` into a `Style` with the foreground colour set
+    /// with the `From` trait.
+    ///
+    /// ```
+    /// use ansi_term::{Style, Colour};
+    /// let green_foreground = Style::default().fg(Colour::Green);
+    /// assert_eq!(green_foreground, Colour::Green.normal());
+    /// assert_eq!(green_foreground, Colour::Green.into());
+    /// assert_eq!(green_foreground, Style::from(Colour::Green));
+    /// ```
+    fn from(colour: Colour) -> Style {
+        colour.normal()
+    }
+}
+
+#[cfg(test)]
+#[cfg(feature = "derive_serde_style")]
+mod serde_json_tests {
+    use super::{Style, Colour};
+
+    #[test]
+    fn colour_serialization() {
+
+        let colours = &[
+            Colour::Red,
+            Colour::Blue,
+            Colour::RGB(123, 123, 123),
+            Colour::Fixed(255),
+        ];
+
+        assert_eq!(serde_json::to_string(&colours).unwrap(), String::from("[\"Red\",\"Blue\",{\"RGB\":[123,123,123]},{\"Fixed\":255}]"));
+    }
+
+    #[test]
+    fn colour_deserialization() {
+        let colours = &[
+            Colour::Red,
+            Colour::Blue,
+            Colour::RGB(123, 123, 123),
+            Colour::Fixed(255),
+        ];
+
+        for colour in colours.into_iter() {
+            let serialized = serde_json::to_string(&colour).unwrap();
+            let deserialized: Colour = serde_json::from_str(&serialized).unwrap();
+
+            assert_eq!(colour, &deserialized);
+        }
+    }
+
+    #[test]
+    fn style_serialization() {
+        let style = Style::default();
+
+        assert_eq!(serde_json::to_string(&style).unwrap(), "{\"foreground\":null,\"background\":null,\"is_bold\":false,\"is_dimmed\":false,\"is_italic\":false,\"is_underline\":false,\"is_blink\":false,\"is_reverse\":false,\"is_hidden\":false,\"is_strikethrough\":false}".to_string());
+    }
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/util.rs b/android/vendor/ansi_term-0.12.1/src/util.rs
new file mode 100644
index 0000000..ba0f12a
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/util.rs
@@ -0,0 +1,81 @@
+use display::*;
+use std::ops::Deref;
+
+/// Return a substring of the given ANSIStrings sequence, while keeping the formatting.
+pub fn sub_string<'a>(start: usize, len: usize, strs: &ANSIStrings<'a>) -> Vec<ANSIString<'static>> {
+    let mut vec = Vec::new();
+    let mut pos = start;
+    let mut len_rem = len;
+
+    for i in strs.0.iter() {
+        let fragment = i.deref();
+        let frag_len = fragment.len();
+        if pos >= frag_len {
+            pos -= frag_len;
+            continue;
+        }
+        if len_rem <= 0 {
+            break;
+        }
+
+        let end = pos + len_rem;
+        let pos_end = if end >= frag_len { frag_len } else { end };
+
+        vec.push(i.style_ref().paint(String::from(&fragment[pos..pos_end])));
+
+        if end <= frag_len {
+            break;
+        }
+
+        len_rem -= pos_end - pos;
+        pos = 0;
+    }
+
+    vec
+}
+
+/// Return a concatenated copy of `strs` without the formatting, as an allocated `String`.
+pub fn unstyle(strs: &ANSIStrings) -> String {
+    let mut s = String::new();
+
+    for i in strs.0.iter() {
+        s += &i.deref();
+    }
+
+    s
+}
+
+/// Return the unstyled length of ANSIStrings. This is equaivalent to `unstyle(strs).len()`.
+pub fn unstyled_len(strs: &ANSIStrings) -> usize {
+    let mut l = 0;
+    for i in strs.0.iter() {
+        l += i.deref().len();
+    }
+    l
+}
+
+#[cfg(test)]
+mod test {
+    use Colour::*;
+    use display::*;
+    use super::*;
+
+    #[test]
+    fn test() {
+        let l = [
+            Black.paint("first"),
+            Red.paint("-second"),
+            White.paint("-third"),
+        ];
+        let a = ANSIStrings(&l);
+        assert_eq!(unstyle(&a), "first-second-third");
+        assert_eq!(unstyled_len(&a), 18);
+
+        let l2 = [
+            Black.paint("st"),
+            Red.paint("-second"),
+            White.paint("-t"),
+        ];
+        assert_eq!(sub_string(3, 11, &a).as_slice(), &l2);
+    }
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/windows.rs b/android/vendor/ansi_term-0.12.1/src/windows.rs
new file mode 100644
index 0000000..fcf02ec
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/windows.rs
@@ -0,0 +1,61 @@
+/// Enables ANSI code support on Windows 10.
+///
+/// This uses Windows API calls to alter the properties of the console that
+/// the program is running in.
+///
+/// https://msdn.microsoft.com/en-us/library/windows/desktop/mt638032(v=vs.85).aspx
+///
+/// Returns a `Result` with the Windows error code if unsuccessful.
+#[cfg(windows)]
+pub fn enable_ansi_support() -> Result<(), u32> {
+    // ref: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#EXAMPLE_OF_ENABLING_VIRTUAL_TERMINAL_PROCESSING @@ https://archive.is/L7wRJ#76%
+
+    use std::ffi::OsStr;
+    use std::iter::once;
+    use std::os::windows::ffi::OsStrExt;
+    use std::ptr::null_mut;
+    use winapi::um::consoleapi::{GetConsoleMode, SetConsoleMode};
+    use winapi::um::errhandlingapi::GetLastError;
+    use winapi::um::fileapi::{CreateFileW, OPEN_EXISTING};
+    use winapi::um::handleapi::INVALID_HANDLE_VALUE;
+    use winapi::um::winnt::{FILE_SHARE_WRITE, GENERIC_READ, GENERIC_WRITE};
+
+    const ENABLE_VIRTUAL_TERMINAL_PROCESSING: u32 = 0x0004;
+
+    unsafe {
+        // ref: https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew
+        // Using `CreateFileW("CONOUT$", ...)` to retrieve the console handle works correctly even if STDOUT and/or STDERR are redirected
+        let console_out_name: Vec<u16> = OsStr::new("CONOUT$").encode_wide().chain(once(0)).collect();
+        let console_handle = CreateFileW(
+            console_out_name.as_ptr(),
+            GENERIC_READ | GENERIC_WRITE,
+            FILE_SHARE_WRITE,
+            null_mut(),
+            OPEN_EXISTING,
+            0,
+            null_mut(),
+        );
+        if console_handle == INVALID_HANDLE_VALUE
+        {
+            return Err(GetLastError());
+        }
+
+        // ref: https://docs.microsoft.com/en-us/windows/console/getconsolemode
+        let mut console_mode: u32 = 0;
+        if 0 == GetConsoleMode(console_handle, &mut console_mode)
+        {
+            return Err(GetLastError());
+        }
+
+        // VT processing not already enabled?
+        if console_mode & ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0 {
+            // https://docs.microsoft.com/en-us/windows/console/setconsolemode
+            if 0 == SetConsoleMode(console_handle, console_mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+            {
+                return Err(GetLastError());
+            }
+        }
+    }
+
+    return Ok(());
+}
diff --git a/android/vendor/ansi_term-0.12.1/src/write.rs b/android/vendor/ansi_term-0.12.1/src/write.rs
new file mode 100644
index 0000000..65a64fe
--- /dev/null
+++ b/android/vendor/ansi_term-0.12.1/src/write.rs
@@ -0,0 +1,40 @@
+use std::fmt;
+use std::io;
+
+
+pub trait AnyWrite {
+    type wstr: ?Sized;
+    type Error;
+
+    fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error>;
+
+    fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error>;
+}
+
+
+impl<'a> AnyWrite for fmt::Write + 'a {
+    type wstr = str;
+    type Error = fmt::Error;
+
+    fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> {
+        fmt::Write::write_fmt(self, fmt)
+    }
+
+    fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error> {
+        fmt::Write::write_str(self, s)
+    }
+}
+
+
+impl<'a> AnyWrite for io::Write + 'a {
+    type wstr = [u8];
+    type Error = io::Error;
+
+    fn write_fmt(&mut self, fmt: fmt::Arguments) -> Result<(), Self::Error> {
+        io::Write::write_fmt(self, fmt)
+    }
+
+    fn write_str(&mut self, s: &Self::wstr) -> Result<(), Self::Error> {
+        io::Write::write_all(self, s)
+    }
+}
diff --git a/android/vendor/atty-0.2.14/.cargo-checksum.json b/android/vendor/atty-0.2.14/.cargo-checksum.json
new file mode 100644
index 0000000..a68b85b
--- /dev/null
+++ b/android/vendor/atty-0.2.14/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"70db121262d72acc472ad1a90b78c42de570820e65b566c6b9339b62e636d572","Cargo.lock":"6868f02a96413bcba37a06f01c6bf87e6331dea9461681a47a561cec6acd2546","Cargo.toml":"3af88a07af6a4adb84373fc3cd4920884b0b12b338cdb55ef598fd512ee1a790","LICENSE":"99fa95ba4e4cdaf71c27d73260ea069fc4515b3d02fde3020c5b562280006cbc","README.md":"e559a69c0b2bd20bffcede64fd548df6c671b0d1504613c5e3e5d884d759caea","examples/atty.rs":"1551387a71474d9ac1b5153231f884e9e05213badcfaa3494ad2cb7ea958374a","rustfmt.toml":"8e6ea1bcb79c505490034020c98e9b472f4ac4113f245bae90f5e1217b1ec65a","src/lib.rs":"d5abf6a54e8c496c486572bdc91eef10480f6ad126c4287f039df5feff7a9bbb"},"package":"d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"}
\ No newline at end of file
diff --git a/android/vendor/atty-0.2.14/CHANGELOG.md b/android/vendor/atty-0.2.14/CHANGELOG.md
new file mode 100644
index 0000000..4e9673f
--- /dev/null
+++ b/android/vendor/atty-0.2.14/CHANGELOG.md
@@ -0,0 +1,73 @@
+# 0.2.14
+
+* add support for [RustyHermit](https://github.com/hermitcore/libhermit-rs), a Rust-based unikernel [#41](https://github.com/softprops/atty/pull/41)
+
+# 0.2.13
+
+* support older versions of rust that do now support 2018 edition
+
+# 0.2.12
+
+* Redox is now in the unix family so redox cfg is no longer needed [#35](https://github.com/softprops/atty/pull/35)
+
+# 0.2.11
+
+* fix msys detection with `winapi@0.3.5` [#28](https://github.com/softprops/atty/pull/28)
+
+# 0.2.10
+
+* fix wasm regression [#27](https://github.com/softprops/atty/pull/27)
+
+# 0.2.9
+
+* Fix fix pty detection [#25](https://github.com/softprops/atty/pull/25)
+
+# 0.2.8
+
+* Fix an inverted condition on MinGW [#22](https://github.com/softprops/atty/pull/22)
+
+# 0.2.7
+
+* Change `||` to `&&` for whether MSYS is a tty [#24](https://github.com/softprops/atty/pull/24/)
+
+# 0.2.6
+
+* updated winapi dependency to [0.3](https://retep998.github.io/blog/winapi-0.3/) [#18](https://github.com/softprops/atty/pull/18)
+
+# 0.2.5
+
+* added support for Wasm compile targets [#17](https://github.com/softprops/atty/pull/17)
+
+# 0.2.4
+
+* added support for Wasm compile targets [#17](https://github.com/softprops/atty/pull/17)
+
+# 0.2.3
+
+* added support for Redox OS [#14](https://github.com/softprops/atty/pull/14)
+
+# 0.2.2
+
+* use target specific dependencies [#11](https://github.com/softprops/atty/pull/11)
+* Add tty detection for MSYS terminals [#12](https://github.com/softprops/atty/pull/12)
+
+# 0.2.1
+
+* fix windows bug
+
+# 0.2.0
+
+* support for various stream types
+
+# 0.1.2
+
+* windows support (with automated testing)
+* automated code coverage
+
+# 0.1.1
+
+* bumped libc dep from `0.1` to `0.2`
+
+# 0.1.0
+
+* initial release
diff --git a/android/vendor/atty-0.2.14/Cargo.lock b/android/vendor/atty-0.2.14/Cargo.lock
new file mode 100644
index 0000000..8dc13c8
--- /dev/null
+++ b/android/vendor/atty-0.2.14/Cargo.lock
@@ -0,0 +1,49 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "atty"
+version = "0.2.14"
+dependencies = [
+ "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.1.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.66"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi"
+version = "0.3.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[metadata]
+"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
+"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
+"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3"
+"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/android/vendor/atty-0.2.14/Cargo.toml b/android/vendor/atty-0.2.14/Cargo.toml
new file mode 100644
index 0000000..d6bf2d0
--- /dev/null
+++ b/android/vendor/atty-0.2.14/Cargo.toml
@@ -0,0 +1,34 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "atty"
+version = "0.2.14"
+authors = ["softprops <d.tangren@gmail.com>"]
+exclude = ["/.travis.yml", "/appveyor.yml"]
+description = "A simple interface for querying atty"
+homepage = "https://github.com/softprops/atty"
+documentation = "http://softprops.github.io/atty"
+readme = "README.md"
+keywords = ["terminal", "tty", "isatty"]
+license = "MIT"
+repository = "https://github.com/softprops/atty"
+[target."cfg(target_os = \"hermit\")".dependencies.hermit-abi]
+version = "0.1.6"
+[target."cfg(unix)".dependencies.libc]
+version = "0.2"
+default-features = false
+[target."cfg(windows)".dependencies.winapi]
+version = "0.3"
+features = ["consoleapi", "processenv", "minwinbase", "minwindef", "winbase"]
+[badges.travis-ci]
+repository = "softprops/atty"
diff --git a/android/vendor/atty-0.2.14/LICENSE b/android/vendor/atty-0.2.14/LICENSE
new file mode 100644
index 0000000..b9da76b
--- /dev/null
+++ b/android/vendor/atty-0.2.14/LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2015-2019 Doug Tangren
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/atty-0.2.14/README.md b/android/vendor/atty-0.2.14/README.md
new file mode 100644
index 0000000..cd85593
--- /dev/null
+++ b/android/vendor/atty-0.2.14/README.md
@@ -0,0 +1,74 @@
+# atty
+
+[![Build Status](https://travis-ci.org/softprops/atty.svg?branch=master)](https://travis-ci.org/softprops/atty) [![Build status](https://ci.appveyor.com/api/projects/status/geggrsnsjsuse8cv?svg=true)](https://ci.appveyor.com/project/softprops/atty) [![Coverage Status](https://coveralls.io/repos/softprops/atty/badge.svg?branch=master&service=github)](https://coveralls.io/github/softprops/atty?branch=master) [![crates.io](https://img.shields.io/crates/v/atty.svg)](https://crates.io/crates/atty) [![Released API docs](https://docs.rs/atty/badge.svg)](http://docs.rs/atty) [![Master API docs](https://img.shields.io/badge/docs-master-green.svg)](https://softprops.github.io/atty)
+
+> are you or are you not a tty?
+
+
+## install
+
+Add the following to your `Cargo.toml`
+
+```toml
+[dependencies]
+atty = "0.2"
+```
+
+## usage
+
+```rust
+use atty::Stream;
+
+fn main() {
+  if atty::is(Stream::Stdout) {
+    println!("I'm a terminal");
+  } else {
+    println!("I'm not");
+  }
+}
+```
+
+## testing
+
+This library has been unit tested on both unix and windows platforms (via appveyor).
+
+
+A simple example program is provided in this repo to test various tty's. By default.
+
+It prints
+
+```bash
+$ cargo run --example atty
+stdout? true
+stderr? true
+stdin? true
+```
+
+To test std in, pipe some text to the program
+
+```bash
+$ echo "test" | cargo run --example atty
+stdout? true
+stderr? true
+stdin? false
+```
+
+To test std out, pipe the program to something
+
+```bash
+$ cargo run --example atty | grep std
+stdout? false
+stderr? true
+stdin? true
+```
+
+To test std err, pipe the program to something redirecting std err
+
+```bash
+$ cargo run --example atty 2>&1 | grep std
+stdout? false
+stderr? false
+stdin? true
+```
+
+Doug Tangren (softprops) 2015-2019
diff --git a/android/vendor/atty-0.2.14/examples/atty.rs b/android/vendor/atty-0.2.14/examples/atty.rs
new file mode 100644
index 0000000..3b3635e
--- /dev/null
+++ b/android/vendor/atty-0.2.14/examples/atty.rs
@@ -0,0 +1,9 @@
+extern crate atty;
+
+use atty::{is, Stream};
+
+fn main() {
+    println!("stdout? {}", is(Stream::Stdout));
+    println!("stderr? {}", is(Stream::Stderr));
+    println!("stdin? {}", is(Stream::Stdin));
+}
diff --git a/android/vendor/atty-0.2.14/rustfmt.toml b/android/vendor/atty-0.2.14/rustfmt.toml
new file mode 100644
index 0000000..899a094
--- /dev/null
+++ b/android/vendor/atty-0.2.14/rustfmt.toml
@@ -0,0 +1,4 @@
+# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#fn_args_layout
+fn_args_layout = "Vertical"
+# https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#merge_imports
+merge_imports = true
\ No newline at end of file
diff --git a/android/vendor/atty-0.2.14/src/lib.rs b/android/vendor/atty-0.2.14/src/lib.rs
new file mode 100644
index 0000000..501cad6
--- /dev/null
+++ b/android/vendor/atty-0.2.14/src/lib.rs
@@ -0,0 +1,210 @@
+//! atty is a simple utility that answers one question
+//! > is this a tty?
+//!
+//! usage is just as simple
+//!
+//! ```
+//! if atty::is(atty::Stream::Stdout) {
+//!   println!("i'm a tty")
+//! }
+//! ```
+//!
+//! ```
+//! if atty::isnt(atty::Stream::Stdout) {
+//!   println!("i'm not a tty")
+//! }
+//! ```
+
+#![cfg_attr(unix, no_std)]
+
+#[cfg(unix)]
+extern crate libc;
+#[cfg(windows)]
+extern crate winapi;
+
+#[cfg(windows)]
+use winapi::shared::minwindef::DWORD;
+#[cfg(windows)]
+use winapi::shared::ntdef::WCHAR;
+
+/// possible stream sources
+#[derive(Clone, Copy, Debug)]
+pub enum Stream {
+    Stdout,
+    Stderr,
+    Stdin,
+}
+
+/// returns true if this is a tty
+#[cfg(all(unix, not(target_arch = "wasm32")))]
+pub fn is(stream: Stream) -> bool {
+    extern crate libc;
+
+    let fd = match stream {
+        Stream::Stdout => libc::STDOUT_FILENO,
+        Stream::Stderr => libc::STDERR_FILENO,
+        Stream::Stdin => libc::STDIN_FILENO,
+    };
+    unsafe { libc::isatty(fd) != 0 }
+}
+
+/// returns true if this is a tty
+#[cfg(target_os = "hermit")]
+pub fn is(stream: Stream) -> bool {
+    extern crate hermit_abi;
+
+    let fd = match stream {
+        Stream::Stdout => hermit_abi::STDOUT_FILENO,
+        Stream::Stderr => hermit_abi::STDERR_FILENO,
+        Stream::Stdin => hermit_abi::STDIN_FILENO,
+    };
+    hermit_abi::isatty(fd)
+}
+
+/// returns true if this is a tty
+#[cfg(windows)]
+pub fn is(stream: Stream) -> bool {
+    use winapi::um::winbase::{
+        STD_ERROR_HANDLE as STD_ERROR, STD_INPUT_HANDLE as STD_INPUT,
+        STD_OUTPUT_HANDLE as STD_OUTPUT,
+    };
+
+    let (fd, others) = match stream {
+        Stream::Stdin => (STD_INPUT, [STD_ERROR, STD_OUTPUT]),
+        Stream::Stderr => (STD_ERROR, [STD_INPUT, STD_OUTPUT]),
+        Stream::Stdout => (STD_OUTPUT, [STD_INPUT, STD_ERROR]),
+    };
+    if unsafe { console_on_any(&[fd]) } {
+        // False positives aren't possible. If we got a console then
+        // we definitely have a tty on stdin.
+        return true;
+    }
+
+    // At this point, we *could* have a false negative. We can determine that
+    // this is true negative if we can detect the presence of a console on
+    // any of the other streams. If another stream has a console, then we know
+    // we're in a Windows console and can therefore trust the negative.
+    if unsafe { console_on_any(&others) } {
+        return false;
+    }
+
+    // Otherwise, we fall back to a very strange msys hack to see if we can
+    // sneakily detect the presence of a tty.
+    unsafe { msys_tty_on(fd) }
+}
+
+/// returns true if this is _not_ a tty
+pub fn isnt(stream: Stream) -> bool {
+    !is(stream)
+}
+
+/// Returns true if any of the given fds are on a console.
+#[cfg(windows)]
+unsafe fn console_on_any(fds: &[DWORD]) -> bool {
+    use winapi::um::{consoleapi::GetConsoleMode, processenv::GetStdHandle};
+
+    for &fd in fds {
+        let mut out = 0;
+        let handle = GetStdHandle(fd);
+        if GetConsoleMode(handle, &mut out) != 0 {
+            return true;
+        }
+    }
+    false
+}
+
+/// Returns true if there is an MSYS tty on the given handle.
+#[cfg(windows)]
+unsafe fn msys_tty_on(fd: DWORD) -> bool {
+    use std::{mem, slice};
+
+    use winapi::{
+        ctypes::c_void,
+        shared::minwindef::MAX_PATH,
+        um::{
+            fileapi::FILE_NAME_INFO, minwinbase::FileNameInfo, processenv::GetStdHandle,
+            winbase::GetFileInformationByHandleEx,
+        },
+    };
+
+    let size = mem::size_of::<FILE_NAME_INFO>();
+    let mut name_info_bytes = vec![0u8; size + MAX_PATH * mem::size_of::<WCHAR>()];
+    let res = GetFileInformationByHandleEx(
+        GetStdHandle(fd),
+        FileNameInfo,
+        &mut *name_info_bytes as *mut _ as *mut c_void,
+        name_info_bytes.len() as u32,
+    );
+    if res == 0 {
+        return false;
+    }
+    let name_info: &FILE_NAME_INFO = &*(name_info_bytes.as_ptr() as *const FILE_NAME_INFO);
+    let s = slice::from_raw_parts(
+        name_info.FileName.as_ptr(),
+        name_info.FileNameLength as usize / 2,
+    );
+    let name = String::from_utf16_lossy(s);
+    // This checks whether 'pty' exists in the file name, which indicates that
+    // a pseudo-terminal is attached. To mitigate against false positives
+    // (e.g., an actual file name that contains 'pty'), we also require that
+    // either the strings 'msys-' or 'cygwin-' are in the file name as well.)
+    let is_msys = name.contains("msys-") || name.contains("cygwin-");
+    let is_pty = name.contains("-pty");
+    is_msys && is_pty
+}
+
+/// returns true if this is a tty
+#[cfg(target_arch = "wasm32")]
+pub fn is(_stream: Stream) -> bool {
+    false
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{is, Stream};
+
+    #[test]
+    #[cfg(windows)]
+    fn is_err() {
+        // appveyor pipes its output
+        assert!(!is(Stream::Stderr))
+    }
+
+    #[test]
+    #[cfg(windows)]
+    fn is_out() {
+        // appveyor pipes its output
+        assert!(!is(Stream::Stdout))
+    }
+
+    #[test]
+    #[cfg(windows)]
+    fn is_in() {
+        assert!(is(Stream::Stdin))
+    }
+
+    #[test]
+    #[cfg(unix)]
+    fn is_err() {
+        assert!(is(Stream::Stderr))
+    }
+
+    #[test]
+    #[cfg(unix)]
+    fn is_out() {
+        assert!(is(Stream::Stdout))
+    }
+
+    #[test]
+    #[cfg(target_os = "macos")]
+    fn is_in() {
+        // macos on travis seems to pipe its input
+        assert!(is(Stream::Stdin))
+    }
+
+    #[test]
+    #[cfg(all(not(target_os = "macos"), unix))]
+    fn is_in() {
+        assert!(is(Stream::Stdin))
+    }
+}
diff --git a/android/vendor/bitflags-1.3.2/.cargo-checksum.json b/android/vendor/bitflags-1.3.2/.cargo-checksum.json
new file mode 100644
index 0000000..7e8d470
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"d362fc1fccaaf4d421bcf0fe8b80ddb4f625dade0c1ee52d08bd0b95509a49d1","CODE_OF_CONDUCT.md":"42634d0f6d922f49857175af991802822f7f920487aefa2ee250a50d12251a66","Cargo.toml":"87aced7532a7974eb37ab5fe6037f0abafc36d6b2d74891ecd2bf2f14f50d11e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"baa8604f8afb34fd93b9c79729daafb884dedcaf34023e4af8ad037d916061fd","src/example_generated.rs":"e43eb59e90f317f38d436670a6067d2fd9eb35fb319fe716184e4a04e24ed1b2","src/lib.rs":"e6477688535ee326d27238aeedc9cb4320ac35b9d17a4deda09e0587b0ccdbd4","tests/basic.rs":"146f1cbf6279bc609242cd3349f29cb21b41294f5e4921875f5ec95bd83529a2","tests/compile-fail/impls/copy.rs":"b791371237ddc75a7c04d2130e03b462c9c00a80dca08bd45aa97433d9c0d13a","tests/compile-fail/impls/copy.stderr.beta":"77d83484ce221d4b6ff2f7de843929a452d779fcfff428122710dd8218c298e3","tests/compile-fail/impls/eq.rs":"0cee8b9e07d537890e0189710293b53972d0fab63c09366f33c391065afafa99","tests/compile-fail/impls/eq.stderr.beta":"381fc6143d45ce76d7cecc47aa59cb69fe5e79c0b60a4a85d5c6163b400b3cc7","tests/compile-fail/non_integer_base/all_defined.rs":"95e14cad9e94560262f2862c3c01865ac30369b69da1001b0e7285cb55e6cb75","tests/compile-fail/non_integer_base/all_defined.stderr.beta":"1760739a276690903bb03844025587d37939f5dfcbfab309db3c86f32bdbf748","tests/compile-fail/non_integer_base/all_missing.rs":"b3d9da619d23213731ba2581aa7999c796c3c79aaf4f0ee6b11ceec08a11537f","tests/compile-fail/non_integer_base/all_missing.stderr.beta":"37e102290d3867e175b21976be798939f294efb17580d5b51e7b17b590d55132","tests/compile-fail/visibility/private_field.rs":"38e4d3fe6471829360d12c8d09b097f6a21aa93fb51eac3b215d96bdae23316b","tests/compile-fail/visibility/private_field.stderr.beta":"5aa24a3ebb39326f31927721c5017b8beb66c3e501fb865a3fa814c9763bfa0f","tests/compile-fail/visibility/private_flags.rs":"2ce4235802aa4e9c96c4e77d9e31d8401ef58dcda4741325184f0764ab1fe393","tests/compile-fail/visibility/private_flags.stderr.beta":"f3eb9f7baf2689258f3519ff7ee5c6ec3c237264ebcfe63f40c40f2023e5022f","tests/compile-fail/visibility/pub_const.rs":"8f813a97ac518c5ea8ac65b184101912452384afaf7b8d6c5e62f8370eca3c0a","tests/compile-fail/visibility/pub_const.stderr.beta":"823976ae1794d7f5372e2ec9aabba497e7bb88004722904c38da342ed98e8962","tests/compile-pass/impls/convert.rs":"88fe80bfb9cd5779f0e1d92c9ec02a8b6bb67e334c07f2309e9c0ba5ef776eb0","tests/compile-pass/impls/default.rs":"c508f9a461691f44b45142fa5ad599f02326e1de4c0cbca6c0593f4652eba109","tests/compile-pass/impls/inherent_methods.rs":"ecc26388e9a394bfa7a5bb69a5d621ab3d4d1e53f28f657bb8e78fe79f437913","tests/compile-pass/redefinition/core.rs":"ff5b6e72f87acc6ebb12405d3c0f6e3fa62e669933656a454bb63b30ea44179c","tests/compile-pass/redefinition/stringify.rs":"1edbce42b900c14425d7ffa14e83e165ebe452d7dccd8c0a8a821bdec64f5c93","tests/compile-pass/repr/c.rs":"6fda17f7c2edfcd155314579e83d0fc8a16209e400f1f9a5ca77bd9a799041f2","tests/compile-pass/repr/transparent.rs":"6cdc87a2137d8a4e0c8ce9b6cba83c82255f8ea125951bf614418685600489ce","tests/compile-pass/visibility/bits_field.rs":"1f3e5ba5a047440066a9f6bf7b7af33f5b06f6b1da3dd9af6886168199a7ea0a","tests/compile-pass/visibility/pub_in.rs":"e95312ff60966d42ec4bc00225507895a9b8ec24056ce6a9edd9145be35d730f","tests/compile.rs":"f27c67a7dd183ca30efea1b6e0880e3469a6dd63b92b1fd711c082df182c9eec"},"package":"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"}
\ No newline at end of file
diff --git a/android/vendor/bitflags-1.3.2/CHANGELOG.md b/android/vendor/bitflags-1.3.2/CHANGELOG.md
new file mode 100644
index 0000000..12fea16
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/CHANGELOG.md
@@ -0,0 +1,206 @@
+# 1.3.2
+
+- Allow `non_snake_case` in generated flags types ([#256])
+
+[#252]: https://github.com/bitflags/bitflags/pull/256
+
+# 1.3.1
+
+- Revert unconditional `#[repr(transparent)]` ([#252])
+
+[#252]: https://github.com/bitflags/bitflags/pull/252
+
+# 1.3.0 (yanked)
+
+- Add `#[repr(transparent)]` ([#187])
+
+- End `empty` doc comment with full stop ([#202])
+
+- Fix typo in crate root docs ([#206])
+
+- Document from_bits_unchecked unsafety ([#207])
+
+- Let `is_all` ignore extra bits ([#211])
+
+- Allows empty flag definition ([#225])
+
+- Making crate accessible from std ([#227])
+
+- Make `from_bits` a const fn ([#229])
+
+- Allow multiple bitflags structs in one macro invocation ([#235])
+
+- Add named functions to perform set operations ([#244])
+
+- Fix typos in method docs ([#245])
+
+- Modernization of the `bitflags` macro to take advantage of newer features and 2018 idioms ([#246])
+
+- Fix regression (in an unreleased feature) and simplify tests ([#247])
+
+- Use `Self` and fix bug when overriding `stringify!` ([#249])
+
+[#187]: https://github.com/bitflags/bitflags/pull/187
+[#202]: https://github.com/bitflags/bitflags/pull/202
+[#206]: https://github.com/bitflags/bitflags/pull/206
+[#207]: https://github.com/bitflags/bitflags/pull/207
+[#211]: https://github.com/bitflags/bitflags/pull/211
+[#225]: https://github.com/bitflags/bitflags/pull/225
+[#227]: https://github.com/bitflags/bitflags/pull/227
+[#229]: https://github.com/bitflags/bitflags/pull/229
+[#235]: https://github.com/bitflags/bitflags/pull/235
+[#244]: https://github.com/bitflags/bitflags/pull/244
+[#245]: https://github.com/bitflags/bitflags/pull/245
+[#246]: https://github.com/bitflags/bitflags/pull/246
+[#247]: https://github.com/bitflags/bitflags/pull/247
+[#249]: https://github.com/bitflags/bitflags/pull/249
+
+# 1.2.1
+
+- Remove extraneous `#[inline]` attributes ([#194])
+
+[#194]: https://github.com/bitflags/bitflags/pull/194
+
+# 1.2.0
+
+- Fix typo: {Lower, Upper}Exp - {Lower, Upper}Hex ([#183])
+
+- Add support for "unknown" bits ([#188])
+
+[#183]: https://github.com/rust-lang-nursery/bitflags/pull/183
+[#188]: https://github.com/rust-lang-nursery/bitflags/pull/188
+
+# 1.1.0
+
+This is a re-release of `1.0.5`, which was yanked due to a bug in the RLS.
+
+# 1.0.5
+
+- Use compiletest_rs flags supported by stable toolchain ([#171])
+
+- Put the user provided attributes first ([#173])
+
+- Make bitflags methods `const` on newer compilers ([#175])
+
+[#171]: https://github.com/rust-lang-nursery/bitflags/pull/171
+[#173]: https://github.com/rust-lang-nursery/bitflags/pull/173
+[#175]: https://github.com/rust-lang-nursery/bitflags/pull/175
+
+# 1.0.4
+
+- Support Rust 2018 style macro imports ([#165])
+
+  ```rust
+  use bitflags::bitflags;
+  ```
+
+[#165]: https://github.com/rust-lang-nursery/bitflags/pull/165
+
+# 1.0.3
+
+- Improve zero value flag handling and documentation ([#157])
+
+[#157]: https://github.com/rust-lang-nursery/bitflags/pull/157
+
+# 1.0.2
+
+- 30% improvement in compile time of bitflags crate ([#156])
+
+- Documentation improvements ([#153])
+
+- Implementation cleanup ([#149])
+
+[#156]: https://github.com/rust-lang-nursery/bitflags/pull/156
+[#153]: https://github.com/rust-lang-nursery/bitflags/pull/153
+[#149]: https://github.com/rust-lang-nursery/bitflags/pull/149
+
+# 1.0.1
+- Add support for `pub(restricted)` specifier on the bitflags struct ([#135])
+- Optimize performance of `all()` when called from a separate crate ([#136])
+
+[#135]: https://github.com/rust-lang-nursery/bitflags/pull/135
+[#136]: https://github.com/rust-lang-nursery/bitflags/pull/136
+
+# 1.0.0
+- **[breaking change]** Macro now generates [associated constants](https://doc.rust-lang.org/reference/items.html#associated-constants) ([#24])
+
+- **[breaking change]** Minimum supported version is Rust **1.20**, due to usage of associated constants
+
+- After being broken in 0.9, the `#[deprecated]` attribute is now supported again ([#112])
+
+- Other improvements to unit tests and documentation ([#106] and [#115])
+
+[#24]: https://github.com/rust-lang-nursery/bitflags/pull/24
+[#106]: https://github.com/rust-lang-nursery/bitflags/pull/106
+[#112]: https://github.com/rust-lang-nursery/bitflags/pull/112
+[#115]: https://github.com/rust-lang-nursery/bitflags/pull/115
+
+## How to update your code to use associated constants
+Assuming the following structure definition:
+```rust
+bitflags! {
+  struct Something: u8 {
+     const FOO = 0b01,
+     const BAR = 0b10
+  }
+}
+```
+In 0.9 and older you could do:
+```rust
+let x = FOO.bits | BAR.bits;
+```
+Now you must use:
+```rust
+let x = Something::FOO.bits | Something::BAR.bits;
+```
+
+# 0.9.1
+- Fix the implementation of `Formatting` traits when other formatting traits were present in scope ([#105])
+
+[#105]: https://github.com/rust-lang-nursery/bitflags/pull/105
+
+# 0.9.0
+- **[breaking change]** Use struct keyword instead of flags to define bitflag types ([#84])
+
+- **[breaking change]** Terminate const items with semicolons instead of commas ([#87])
+
+- Implement the `Hex`, `Octal`, and `Binary` formatting traits ([#86])
+
+- Printing an empty flag value with the `Debug` trait now prints "(empty)" instead of nothing ([#85])
+
+- The `bitflags!` macro can now be used inside of a fn body, to define a type local to that function ([#74])
+
+[#74]: https://github.com/rust-lang-nursery/bitflags/pull/74
+[#84]: https://github.com/rust-lang-nursery/bitflags/pull/84
+[#85]: https://github.com/rust-lang-nursery/bitflags/pull/85
+[#86]: https://github.com/rust-lang-nursery/bitflags/pull/86
+[#87]: https://github.com/rust-lang-nursery/bitflags/pull/87
+
+# 0.8.2
+- Update feature flag used when building bitflags as a dependency of the Rust toolchain
+
+# 0.8.1
+- Allow bitflags to be used as a dependency of the Rust toolchain
+
+# 0.8.0
+- Add support for the experimental `i128` and `u128` integer types ([#57])
+- Add set method: `flags.set(SOME_FLAG, true)` or `flags.set(SOME_FLAG, false)` ([#55])
+  This may break code that defines its own set method
+
+[#55]: https://github.com/rust-lang-nursery/bitflags/pull/55
+[#57]: https://github.com/rust-lang-nursery/bitflags/pull/57
+
+# 0.7.1
+*(yanked)*
+
+# 0.7.0
+- Implement the Extend trait ([#49])
+- Allow definitions inside the `bitflags!` macro to refer to items imported from other modules ([#51])
+
+[#49]: https://github.com/rust-lang-nursery/bitflags/pull/49
+[#51]: https://github.com/rust-lang-nursery/bitflags/pull/51
+
+# 0.6.0
+- The `no_std` feature was removed as it is now the default
+- The `assignment_operators` feature was remove as it is now enabled by default
+- Some clippy suggestions have been applied
diff --git a/android/vendor/bitflags-1.3.2/CODE_OF_CONDUCT.md b/android/vendor/bitflags-1.3.2/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..f7add90
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/CODE_OF_CONDUCT.md
@@ -0,0 +1,73 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+education, socio-economic status, nationality, personal appearance, race,
+religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+  advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+  address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+  professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at coc@senaite.org. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
\ No newline at end of file
diff --git a/android/vendor/bitflags-1.3.2/Cargo.toml b/android/vendor/bitflags-1.3.2/Cargo.toml
new file mode 100644
index 0000000..9d54c72
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/Cargo.toml
@@ -0,0 +1,58 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "bitflags"
+version = "1.3.2"
+authors = ["The Rust Project Developers"]
+exclude = ["bors.toml"]
+description = "A macro to generate structures which behave like bitflags.\n"
+homepage = "https://github.com/bitflags/bitflags"
+documentation = "https://docs.rs/bitflags"
+readme = "README.md"
+keywords = ["bit", "bitmask", "bitflags", "flags"]
+categories = ["no-std"]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/bitflags/bitflags"
+[package.metadata.docs.rs]
+features = ["example_generated"]
+[dependencies.compiler_builtins]
+version = "0.1.2"
+optional = true
+
+[dependencies.core]
+version = "1.0.0"
+optional = true
+package = "rustc-std-workspace-core"
+[dev-dependencies.rustversion]
+version = "1.0"
+
+[dev-dependencies.serde]
+version = "1.0"
+
+[dev-dependencies.serde_derive]
+version = "1.0"
+
+[dev-dependencies.serde_json]
+version = "1.0"
+
+[dev-dependencies.trybuild]
+version = "1.0"
+
+[dev-dependencies.walkdir]
+version = "2.3"
+
+[features]
+default = []
+example_generated = []
+rustc-dep-of-std = ["core", "compiler_builtins"]
diff --git a/android/vendor/bitflags-1.3.2/LICENSE-APACHE b/android/vendor/bitflags-1.3.2/LICENSE-APACHE
new file mode 100644
index 0000000..16fe87b
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/bitflags-1.3.2/LICENSE-MIT b/android/vendor/bitflags-1.3.2/LICENSE-MIT
new file mode 100644
index 0000000..39d4bdb
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/bitflags-1.3.2/README.md b/android/vendor/bitflags-1.3.2/README.md
new file mode 100644
index 0000000..0da0f85
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/README.md
@@ -0,0 +1,32 @@
+bitflags
+========
+
+[![Rust](https://github.com/bitflags/bitflags/workflows/Rust/badge.svg)](https://github.com/bitflags/bitflags/actions)
+[![Join the chat at https://gitter.im/bitflags/Lobby](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bitflags/Lobby?utm_source=badge&utm_medium=badge&utm_content=badge)
+[![Latest version](https://img.shields.io/crates/v/bitflags.svg)](https://crates.io/crates/bitflags)
+[![Documentation](https://docs.rs/bitflags/badge.svg)](https://docs.rs/bitflags)
+![License](https://img.shields.io/crates/l/bitflags.svg)
+
+A Rust macro to generate structures which behave like a set of bitflags
+
+- [Documentation](https://docs.rs/bitflags)
+- [Release notes](https://github.com/bitflags/bitflags/releases)
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+bitflags = "1.3"
+```
+
+and this to your source code:
+
+```rust
+use bitflags::bitflags;
+```
+
+## Rust Version Support
+
+The minimum supported Rust version is 1.46 due to use of associated constants and const functions.
diff --git a/android/vendor/bitflags-1.3.2/src/example_generated.rs b/android/vendor/bitflags-1.3.2/src/example_generated.rs
new file mode 100644
index 0000000..cf188d9
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/src/example_generated.rs
@@ -0,0 +1,14 @@
+//! This module shows an example of code generated by the macro. **IT MUST NOT BE USED OUTSIDE THIS
+//! CRATE**.
+
+bitflags! {
+    /// This is the same `Flags` struct defined in the [crate level example](../index.html#example).
+    /// Note that this struct is just for documentation purposes only, it must not be used outside
+    /// this crate.
+    pub struct Flags: u32 {
+        const A = 0b00000001;
+        const B = 0b00000010;
+        const C = 0b00000100;
+        const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+    }
+}
diff --git a/android/vendor/bitflags-1.3.2/src/lib.rs b/android/vendor/bitflags-1.3.2/src/lib.rs
new file mode 100644
index 0000000..935e432
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/src/lib.rs
@@ -0,0 +1,1729 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! A typesafe bitmask flag generator useful for sets of C-style bitmask flags.
+//! It can be used for creating typesafe wrappers around C APIs.
+//!
+//! The `bitflags!` macro generates `struct`s that manage a set of flags. The
+//! flags should only be defined for integer types, otherwise unexpected type
+//! errors may occur at compile time.
+//!
+//! # Example
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!         const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let e1 = Flags::A | Flags::C;
+//!     let e2 = Flags::B | Flags::C;
+//!     assert_eq!((e1 | e2), Flags::ABC);   // union
+//!     assert_eq!((e1 & e2), Flags::C);     // intersection
+//!     assert_eq!((e1 - e2), Flags::A);     // set difference
+//!     assert_eq!(!e2, Flags::A);           // set complement
+//! }
+//! ```
+//!
+//! See [`example_generated::Flags`](./example_generated/struct.Flags.html) for documentation of code
+//! generated by the above `bitflags!` expansion.
+//!
+//! The generated `struct`s can also be extended with type and trait
+//! implementations:
+//!
+//! ```
+//! use std::fmt;
+//!
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!     }
+//! }
+//!
+//! impl Flags {
+//!     pub fn clear(&mut self) {
+//!         self.bits = 0;  // The `bits` field can be accessed from within the
+//!                         // same module where the `bitflags!` macro was invoked.
+//!     }
+//! }
+//!
+//! impl fmt::Display for Flags {
+//!     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+//!         write!(f, "hi!")
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let mut flags = Flags::A | Flags::B;
+//!     flags.clear();
+//!     assert!(flags.is_empty());
+//!     assert_eq!(format!("{}", flags), "hi!");
+//!     assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
+//!     assert_eq!(format!("{:?}", Flags::B), "B");
+//! }
+//! ```
+//!
+//! # Visibility
+//!
+//! The generated structs and their associated flag constants are not exported
+//! out of the current module by default. A definition can be exported out of
+//! the current module by adding `pub` before `struct`:
+//!
+//! ```
+//! mod example {
+//!     use bitflags::bitflags;
+//!
+//!     bitflags! {
+//!         pub struct Flags1: u32 {
+//!             const A = 0b00000001;
+//!         }
+//!
+//! #       pub
+//!         struct Flags2: u32 {
+//!             const B = 0b00000010;
+//!         }
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let flag1 = example::Flags1::A;
+//!     let flag2 = example::Flags2::B; // error: const `B` is private
+//! }
+//! ```
+//!
+//! # Attributes
+//!
+//! Attributes can be attached to the generated `struct`s by placing them
+//! before the `struct` keyword.
+//!
+//! ## Representations
+//!
+//! It's valid to add a `#[repr(C)]` or `#[repr(transparent)]` attribute to a type
+//! generated by `bitflags!`. In these cases, the type is guaranteed to be a newtype.
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     #[repr(transparent)]
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!     }
+//! }
+//! ```
+//!
+//! # Trait implementations
+//!
+//! The `Copy`, `Clone`, `PartialEq`, `Eq`, `PartialOrd`, `Ord` and `Hash`
+//! traits are automatically derived for the `struct`s using the `derive` attribute.
+//! Additional traits can be derived by providing an explicit `derive`
+//! attribute on `struct`.
+//!
+//! The `Extend` and `FromIterator` traits are implemented for the `struct`s,
+//! too: `Extend` adds the union of the instances of the `struct` iterated over,
+//! while `FromIterator` calculates the union.
+//!
+//! The `Binary`, `Debug`, `LowerHex`, `Octal` and `UpperHex` traits are also
+//! implemented by displaying the bits value of the internal struct.
+//!
+//! ## Operators
+//!
+//! The following operator traits are implemented for the generated `struct`s:
+//!
+//! - `BitOr` and `BitOrAssign`: union
+//! - `BitAnd` and `BitAndAssign`: intersection
+//! - `BitXor` and `BitXorAssign`: toggle
+//! - `Sub` and `SubAssign`: set difference
+//! - `Not`: set complement
+//!
+//! # Methods
+//!
+//! The following methods are defined for the generated `struct`s:
+//!
+//! - `empty`: an empty set of flags
+//! - `all`: the set of all defined flags
+//! - `bits`: the raw value of the flags currently stored
+//! - `from_bits`: convert from underlying bit representation, unless that
+//!                representation contains bits that do not correspond to a
+//!                defined flag
+//! - `from_bits_truncate`: convert from underlying bit representation, dropping
+//!                         any bits that do not correspond to defined flags
+//! - `from_bits_unchecked`: convert from underlying bit representation, keeping
+//!                          all bits (even those not corresponding to defined
+//!                          flags)
+//! - `is_empty`: `true` if no flags are currently stored
+//! - `is_all`: `true` if currently set flags exactly equal all defined flags
+//! - `intersects`: `true` if there are flags common to both `self` and `other`
+//! - `contains`: `true` if all of the flags in `other` are contained within `self`
+//! - `insert`: inserts the specified flags in-place
+//! - `remove`: removes the specified flags in-place
+//! - `toggle`: the specified flags will be inserted if not present, and removed
+//!             if they are.
+//! - `set`: inserts or removes the specified flags depending on the passed value
+//! - `intersection`: returns a new set of flags, containing only the flags present
+//!                   in both `self` and `other` (the argument to the function).
+//! - `union`: returns a new set of flags, containing any flags present in
+//!            either `self` or `other` (the argument to the function).
+//! - `difference`: returns a new set of flags, containing all flags present in
+//!                 `self` without any of the flags present in `other` (the
+//!                 argument to the function).
+//! - `symmetric_difference`: returns a new set of flags, containing all flags
+//!                           present in either `self` or `other` (the argument
+//!                           to the function), but not both.
+//! - `complement`: returns a new set of flags, containing all flags which are
+//!                 not set in `self`, but which are allowed for this type.
+//!
+//! ## Default
+//!
+//! The `Default` trait is not automatically implemented for the generated structs.
+//!
+//! If your default value is equal to `0` (which is the same value as calling `empty()`
+//! on the generated struct), you can simply derive `Default`:
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     // Results in default value with bits: 0
+//!     #[derive(Default)]
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let derived_default: Flags = Default::default();
+//!     assert_eq!(derived_default.bits(), 0);
+//! }
+//! ```
+//!
+//! If your default value is not equal to `0` you need to implement `Default` yourself:
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const A = 0b00000001;
+//!         const B = 0b00000010;
+//!         const C = 0b00000100;
+//!     }
+//! }
+//!
+//! // explicit `Default` implementation
+//! impl Default for Flags {
+//!     fn default() -> Flags {
+//!         Flags::A | Flags::C
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let implemented_default: Flags = Default::default();
+//!     assert_eq!(implemented_default, (Flags::A | Flags::C));
+//! }
+//! ```
+//!
+//! # Zero Flags
+//!
+//! Flags with a value equal to zero will have some strange behavior that one should be aware of.
+//!
+//! ```
+//! use bitflags::bitflags;
+//!
+//! bitflags! {
+//!     struct Flags: u32 {
+//!         const NONE = 0b00000000;
+//!         const SOME = 0b00000001;
+//!     }
+//! }
+//!
+//! fn main() {
+//!     let empty = Flags::empty();
+//!     let none = Flags::NONE;
+//!     let some = Flags::SOME;
+//!
+//!     // Zero flags are treated as always present
+//!     assert!(empty.contains(Flags::NONE));
+//!     assert!(none.contains(Flags::NONE));
+//!     assert!(some.contains(Flags::NONE));
+//!
+//!     // Zero flags will be ignored when testing for emptiness
+//!     assert!(none.is_empty());
+//! }
+//! ```
+//!
+//! Users should generally avoid defining a flag with a value of zero.
+
+#![cfg_attr(not(test), no_std)]
+#![doc(html_root_url = "https://docs.rs/bitflags/1.3.2")]
+
+#[doc(hidden)]
+pub extern crate core as _core;
+
+/// The macro used to generate the flag structures.
+///
+/// See the [crate level docs](../bitflags/index.html) for complete documentation.
+///
+/// # Example
+///
+/// ```
+/// use bitflags::bitflags;
+///
+/// bitflags! {
+///     struct Flags: u32 {
+///         const A = 0b00000001;
+///         const B = 0b00000010;
+///         const C = 0b00000100;
+///         const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+///     }
+/// }
+///
+/// fn main() {
+///     let e1 = Flags::A | Flags::C;
+///     let e2 = Flags::B | Flags::C;
+///     assert_eq!((e1 | e2), Flags::ABC);   // union
+///     assert_eq!((e1 & e2), Flags::C);     // intersection
+///     assert_eq!((e1 - e2), Flags::A);     // set difference
+///     assert_eq!(!e2, Flags::A);           // set complement
+/// }
+/// ```
+///
+/// The generated `struct`s can also be extended with type and trait
+/// implementations:
+///
+/// ```
+/// use std::fmt;
+///
+/// use bitflags::bitflags;
+///
+/// bitflags! {
+///     struct Flags: u32 {
+///         const A = 0b00000001;
+///         const B = 0b00000010;
+///     }
+/// }
+///
+/// impl Flags {
+///     pub fn clear(&mut self) {
+///         self.bits = 0;  // The `bits` field can be accessed from within the
+///                         // same module where the `bitflags!` macro was invoked.
+///     }
+/// }
+///
+/// impl fmt::Display for Flags {
+///     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+///         write!(f, "hi!")
+///     }
+/// }
+///
+/// fn main() {
+///     let mut flags = Flags::A | Flags::B;
+///     flags.clear();
+///     assert!(flags.is_empty());
+///     assert_eq!(format!("{}", flags), "hi!");
+///     assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
+///     assert_eq!(format!("{:?}", Flags::B), "B");
+/// }
+/// ```
+#[macro_export(local_inner_macros)]
+macro_rules! bitflags {
+    (
+        $(#[$outer:meta])*
+        $vis:vis struct $BitFlags:ident: $T:ty {
+            $(
+                $(#[$inner:ident $($args:tt)*])*
+                const $Flag:ident = $value:expr;
+            )*
+        }
+
+        $($t:tt)*
+    ) => {
+        $(#[$outer])*
+        #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
+        $vis struct $BitFlags {
+            bits: $T,
+        }
+
+        __impl_bitflags! {
+            $BitFlags: $T {
+                $(
+                    $(#[$inner $($args)*])*
+                    $Flag = $value;
+                )*
+            }
+        }
+
+        bitflags! {
+            $($t)*
+        }
+    };
+    () => {};
+}
+
+// A helper macro to implement the `all` function.
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_all_bitflags {
+    (
+        $BitFlags:ident: $T:ty {
+            $(
+                $(#[$attr:ident $($args:tt)*])*
+                $Flag:ident = $value:expr;
+            )+
+        }
+    ) => {
+        // See `Debug::fmt` for why this approach is taken.
+        #[allow(non_snake_case)]
+        trait __BitFlags {
+            $(
+                const $Flag: $T = 0;
+            )+
+        }
+        #[allow(non_snake_case)]
+        impl __BitFlags for $BitFlags {
+            $(
+                __impl_bitflags! {
+                    #[allow(deprecated)]
+                    $(? #[$attr $($args)*])*
+                    const $Flag: $T = Self::$Flag.bits;
+                }
+            )+
+        }
+        Self { bits: $(<Self as __BitFlags>::$Flag)|+ }
+    };
+    (
+        $BitFlags:ident: $T:ty { }
+    ) => {
+        Self { bits: 0 }
+    };
+}
+
+#[macro_export(local_inner_macros)]
+#[doc(hidden)]
+macro_rules! __impl_bitflags {
+    (
+        $BitFlags:ident: $T:ty {
+            $(
+                $(#[$attr:ident $($args:tt)*])*
+                $Flag:ident = $value:expr;
+            )*
+        }
+    ) => {
+        impl $crate::_core::fmt::Debug for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                // This convoluted approach is to handle #[cfg]-based flag
+                // omission correctly. For example it needs to support:
+                //
+                //    #[cfg(unix)] const A: Flag = /* ... */;
+                //    #[cfg(windows)] const B: Flag = /* ... */;
+
+                // Unconditionally define a check for every flag, even disabled
+                // ones.
+                #[allow(non_snake_case)]
+                trait __BitFlags {
+                    $(
+                        #[inline]
+                        fn $Flag(&self) -> bool { false }
+                    )*
+                }
+
+                // Conditionally override the check for just those flags that
+                // are not #[cfg]ed away.
+                #[allow(non_snake_case)]
+                impl __BitFlags for $BitFlags {
+                    $(
+                        __impl_bitflags! {
+                            #[allow(deprecated)]
+                            #[inline]
+                            $(? #[$attr $($args)*])*
+                            fn $Flag(&self) -> bool {
+                                if Self::$Flag.bits == 0 && self.bits != 0 {
+                                    false
+                                } else {
+                                    self.bits & Self::$Flag.bits == Self::$Flag.bits
+                                }
+                            }
+                        }
+                    )*
+                }
+
+                let mut first = true;
+                $(
+                    if <Self as __BitFlags>::$Flag(self) {
+                        if !first {
+                            f.write_str(" | ")?;
+                        }
+                        first = false;
+                        f.write_str($crate::_core::stringify!($Flag))?;
+                    }
+                )*
+                let extra_bits = self.bits & !Self::all().bits();
+                if extra_bits != 0 {
+                    if !first {
+                        f.write_str(" | ")?;
+                    }
+                    first = false;
+                    f.write_str("0x")?;
+                    $crate::_core::fmt::LowerHex::fmt(&extra_bits, f)?;
+                }
+                if first {
+                    f.write_str("(empty)")?;
+                }
+                Ok(())
+            }
+        }
+        impl $crate::_core::fmt::Binary for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::Binary::fmt(&self.bits, f)
+            }
+        }
+        impl $crate::_core::fmt::Octal for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::Octal::fmt(&self.bits, f)
+            }
+        }
+        impl $crate::_core::fmt::LowerHex for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::LowerHex::fmt(&self.bits, f)
+            }
+        }
+        impl $crate::_core::fmt::UpperHex for $BitFlags {
+            fn fmt(&self, f: &mut $crate::_core::fmt::Formatter) -> $crate::_core::fmt::Result {
+                $crate::_core::fmt::UpperHex::fmt(&self.bits, f)
+            }
+        }
+
+        #[allow(dead_code)]
+        impl $BitFlags {
+            $(
+                $(#[$attr $($args)*])*
+                pub const $Flag: Self = Self { bits: $value };
+            )*
+
+            /// Returns an empty set of flags.
+            #[inline]
+            pub const fn empty() -> Self {
+                Self { bits: 0 }
+            }
+
+            /// Returns the set containing all flags.
+            #[inline]
+            pub const fn all() -> Self {
+                __impl_all_bitflags! {
+                    $BitFlags: $T {
+                        $(
+                            $(#[$attr $($args)*])*
+                            $Flag = $value;
+                        )*
+                    }
+                }
+            }
+
+            /// Returns the raw value of the flags currently stored.
+            #[inline]
+            pub const fn bits(&self) -> $T {
+                self.bits
+            }
+
+            /// Convert from underlying bit representation, unless that
+            /// representation contains bits that do not correspond to a flag.
+            #[inline]
+            pub const fn from_bits(bits: $T) -> $crate::_core::option::Option<Self> {
+                if (bits & !Self::all().bits()) == 0 {
+                    $crate::_core::option::Option::Some(Self { bits })
+                } else {
+                    $crate::_core::option::Option::None
+                }
+            }
+
+            /// Convert from underlying bit representation, dropping any bits
+            /// that do not correspond to flags.
+            #[inline]
+            pub const fn from_bits_truncate(bits: $T) -> Self {
+                Self { bits: bits & Self::all().bits }
+            }
+
+            /// Convert from underlying bit representation, preserving all
+            /// bits (even those not corresponding to a defined flag).
+            ///
+            /// # Safety
+            ///
+            /// The caller of the `bitflags!` macro can chose to allow or
+            /// disallow extra bits for their bitflags type.
+            ///
+            /// The caller of `from_bits_unchecked()` has to ensure that
+            /// all bits correspond to a defined flag or that extra bits
+            /// are valid for this bitflags type.
+            #[inline]
+            pub const unsafe fn from_bits_unchecked(bits: $T) -> Self {
+                Self { bits }
+            }
+
+            /// Returns `true` if no flags are currently stored.
+            #[inline]
+            pub const fn is_empty(&self) -> bool {
+                self.bits() == Self::empty().bits()
+            }
+
+            /// Returns `true` if all flags are currently set.
+            #[inline]
+            pub const fn is_all(&self) -> bool {
+                Self::all().bits | self.bits == self.bits
+            }
+
+            /// Returns `true` if there are flags common to both `self` and `other`.
+            #[inline]
+            pub const fn intersects(&self, other: Self) -> bool {
+                !(Self { bits: self.bits & other.bits}).is_empty()
+            }
+
+            /// Returns `true` if all of the flags in `other` are contained within `self`.
+            #[inline]
+            pub const fn contains(&self, other: Self) -> bool {
+                (self.bits & other.bits) == other.bits
+            }
+
+            /// Inserts the specified flags in-place.
+            #[inline]
+            pub fn insert(&mut self, other: Self) {
+                self.bits |= other.bits;
+            }
+
+            /// Removes the specified flags in-place.
+            #[inline]
+            pub fn remove(&mut self, other: Self) {
+                self.bits &= !other.bits;
+            }
+
+            /// Toggles the specified flags in-place.
+            #[inline]
+            pub fn toggle(&mut self, other: Self) {
+                self.bits ^= other.bits;
+            }
+
+            /// Inserts or removes the specified flags depending on the passed value.
+            #[inline]
+            pub fn set(&mut self, other: Self, value: bool) {
+                if value {
+                    self.insert(other);
+                } else {
+                    self.remove(other);
+                }
+            }
+
+            /// Returns the intersection between the flags in `self` and
+            /// `other`.
+            ///
+            /// Specifically, the returned set contains only the flags which are
+            /// present in *both* `self` *and* `other`.
+            ///
+            /// This is equivalent to using the `&` operator (e.g.
+            /// [`ops::BitAnd`]), as in `flags & other`.
+            ///
+            /// [`ops::BitAnd`]: https://doc.rust-lang.org/std/ops/trait.BitAnd.html
+            #[inline]
+            #[must_use]
+            pub const fn intersection(self, other: Self) -> Self {
+                Self { bits: self.bits & other.bits }
+            }
+
+            /// Returns the union of between the flags in `self` and `other`.
+            ///
+            /// Specifically, the returned set contains all flags which are
+            /// present in *either* `self` *or* `other`, including any which are
+            /// present in both (see [`Self::symmetric_difference`] if that
+            /// is undesirable).
+            ///
+            /// This is equivalent to using the `|` operator (e.g.
+            /// [`ops::BitOr`]), as in `flags | other`.
+            ///
+            /// [`ops::BitOr`]: https://doc.rust-lang.org/std/ops/trait.BitOr.html
+            #[inline]
+            #[must_use]
+            pub const fn union(self, other: Self) -> Self {
+                Self { bits: self.bits | other.bits }
+            }
+
+            /// Returns the difference between the flags in `self` and `other`.
+            ///
+            /// Specifically, the returned set contains all flags present in
+            /// `self`, except for the ones present in `other`.
+            ///
+            /// It is also conceptually equivalent to the "bit-clear" operation:
+            /// `flags & !other` (and this syntax is also supported).
+            ///
+            /// This is equivalent to using the `-` operator (e.g.
+            /// [`ops::Sub`]), as in `flags - other`.
+            ///
+            /// [`ops::Sub`]: https://doc.rust-lang.org/std/ops/trait.Sub.html
+            #[inline]
+            #[must_use]
+            pub const fn difference(self, other: Self) -> Self {
+                Self { bits: self.bits & !other.bits }
+            }
+
+            /// Returns the [symmetric difference][sym-diff] between the flags
+            /// in `self` and `other`.
+            ///
+            /// Specifically, the returned set contains the flags present which
+            /// are present in `self` or `other`, but that are not present in
+            /// both. Equivalently, it contains the flags present in *exactly
+            /// one* of the sets `self` and `other`.
+            ///
+            /// This is equivalent to using the `^` operator (e.g.
+            /// [`ops::BitXor`]), as in `flags ^ other`.
+            ///
+            /// [sym-diff]: https://en.wikipedia.org/wiki/Symmetric_difference
+            /// [`ops::BitXor`]: https://doc.rust-lang.org/std/ops/trait.BitXor.html
+            #[inline]
+            #[must_use]
+            pub const fn symmetric_difference(self, other: Self) -> Self {
+                Self { bits: self.bits ^ other.bits }
+            }
+
+            /// Returns the complement of this set of flags.
+            ///
+            /// Specifically, the returned set contains all the flags which are
+            /// not set in `self`, but which are allowed for this type.
+            ///
+            /// Alternatively, it can be thought of as the set difference
+            /// between [`Self::all()`] and `self` (e.g. `Self::all() - self`)
+            ///
+            /// This is equivalent to using the `!` operator (e.g.
+            /// [`ops::Not`]), as in `!flags`.
+            ///
+            /// [`Self::all()`]: Self::all
+            /// [`ops::Not`]: https://doc.rust-lang.org/std/ops/trait.Not.html
+            #[inline]
+            #[must_use]
+            pub const fn complement(self) -> Self {
+                Self::from_bits_truncate(!self.bits)
+            }
+
+        }
+
+        impl $crate::_core::ops::BitOr for $BitFlags {
+            type Output = Self;
+
+            /// Returns the union of the two sets of flags.
+            #[inline]
+            fn bitor(self, other: $BitFlags) -> Self {
+                Self { bits: self.bits | other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::BitOrAssign for $BitFlags {
+            /// Adds the set of flags.
+            #[inline]
+            fn bitor_assign(&mut self, other: Self) {
+                self.bits |= other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::BitXor for $BitFlags {
+            type Output = Self;
+
+            /// Returns the left flags, but with all the right flags toggled.
+            #[inline]
+            fn bitxor(self, other: Self) -> Self {
+                Self { bits: self.bits ^ other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::BitXorAssign for $BitFlags {
+            /// Toggles the set of flags.
+            #[inline]
+            fn bitxor_assign(&mut self, other: Self) {
+                self.bits ^= other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::BitAnd for $BitFlags {
+            type Output = Self;
+
+            /// Returns the intersection between the two sets of flags.
+            #[inline]
+            fn bitand(self, other: Self) -> Self {
+                Self { bits: self.bits & other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::BitAndAssign for $BitFlags {
+            /// Disables all flags disabled in the set.
+            #[inline]
+            fn bitand_assign(&mut self, other: Self) {
+                self.bits &= other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::Sub for $BitFlags {
+            type Output = Self;
+
+            /// Returns the set difference of the two sets of flags.
+            #[inline]
+            fn sub(self, other: Self) -> Self {
+                Self { bits: self.bits & !other.bits }
+            }
+        }
+
+        impl $crate::_core::ops::SubAssign for $BitFlags {
+            /// Disables all flags enabled in the set.
+            #[inline]
+            fn sub_assign(&mut self, other: Self) {
+                self.bits &= !other.bits;
+            }
+        }
+
+        impl $crate::_core::ops::Not for $BitFlags {
+            type Output = Self;
+
+            /// Returns the complement of this set of flags.
+            #[inline]
+            fn not(self) -> Self {
+                Self { bits: !self.bits } & Self::all()
+            }
+        }
+
+        impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags {
+            fn extend<T: $crate::_core::iter::IntoIterator<Item=Self>>(&mut self, iterator: T) {
+                for item in iterator {
+                    self.insert(item)
+                }
+            }
+        }
+
+        impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags {
+            fn from_iter<T: $crate::_core::iter::IntoIterator<Item=Self>>(iterator: T) -> Self {
+                let mut result = Self::empty();
+                result.extend(iterator);
+                result
+            }
+        }
+    };
+
+    // Every attribute that the user writes on a const is applied to the
+    // corresponding const that we generate, but within the implementation of
+    // Debug and all() we want to ignore everything but #[cfg] attributes. In
+    // particular, including a #[deprecated] attribute on those items would fail
+    // to compile.
+    // https://github.com/bitflags/bitflags/issues/109
+    //
+    // Input:
+    //
+    //     ? #[cfg(feature = "advanced")]
+    //     ? #[deprecated(note = "Use something else.")]
+    //     ? #[doc = r"High quality documentation."]
+    //     fn f() -> i32 { /* ... */ }
+    //
+    // Output:
+    //
+    //     #[cfg(feature = "advanced")]
+    //     fn f() -> i32 { /* ... */ }
+    (
+        $(#[$filtered:meta])*
+        ? #[cfg $($cfgargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        fn $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            #[cfg $($cfgargs)*]
+            $(? #[$rest $($restargs)*])*
+            fn $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        // $next != `cfg`
+        ? #[$next:ident $($nextargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        fn $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            // $next filtered out
+            $(? #[$rest $($restargs)*])*
+            fn $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        fn $($item:tt)*
+    ) => {
+        $(#[$filtered])*
+        fn $($item)*
+    };
+
+    // Every attribute that the user writes on a const is applied to the
+    // corresponding const that we generate, but within the implementation of
+    // Debug and all() we want to ignore everything but #[cfg] attributes. In
+    // particular, including a #[deprecated] attribute on those items would fail
+    // to compile.
+    // https://github.com/bitflags/bitflags/issues/109
+    //
+    // const version
+    //
+    // Input:
+    //
+    //     ? #[cfg(feature = "advanced")]
+    //     ? #[deprecated(note = "Use something else.")]
+    //     ? #[doc = r"High quality documentation."]
+    //     const f: i32 { /* ... */ }
+    //
+    // Output:
+    //
+    //     #[cfg(feature = "advanced")]
+    //     const f: i32 { /* ... */ }
+    (
+        $(#[$filtered:meta])*
+        ? #[cfg $($cfgargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        const $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            #[cfg $($cfgargs)*]
+            $(? #[$rest $($restargs)*])*
+            const $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        // $next != `cfg`
+        ? #[$next:ident $($nextargs:tt)*]
+        $(? #[$rest:ident $($restargs:tt)*])*
+        const $($item:tt)*
+    ) => {
+        __impl_bitflags! {
+            $(#[$filtered])*
+            // $next filtered out
+            $(? #[$rest $($restargs)*])*
+            const $($item)*
+        }
+    };
+    (
+        $(#[$filtered:meta])*
+        const $($item:tt)*
+    ) => {
+        $(#[$filtered])*
+        const $($item)*
+    };
+}
+
+#[cfg(feature = "example_generated")]
+pub mod example_generated;
+
+#[cfg(test)]
+mod tests {
+    use std::collections::hash_map::DefaultHasher;
+    use std::hash::{Hash, Hasher};
+
+    bitflags! {
+        #[doc = "> The first principle is that you must not fool yourself — and"]
+        #[doc = "> you are the easiest person to fool."]
+        #[doc = "> "]
+        #[doc = "> - Richard Feynman"]
+        #[derive(Default)]
+        struct Flags: u32 {
+            const A = 0b00000001;
+            #[doc = "<pcwalton> macros are way better at generating code than trans is"]
+            const B = 0b00000010;
+            const C = 0b00000100;
+            #[doc = "* cmr bed"]
+            #[doc = "* strcat table"]
+            #[doc = "<strcat> wait what?"]
+            const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+        }
+
+        struct _CfgFlags: u32 {
+            #[cfg(unix)]
+            const _CFG_A = 0b01;
+            #[cfg(windows)]
+            const _CFG_B = 0b01;
+            #[cfg(unix)]
+            const _CFG_C = Self::_CFG_A.bits | 0b10;
+        }
+
+        struct AnotherSetOfFlags: i8 {
+            const ANOTHER_FLAG = -1_i8;
+        }
+
+        struct LongFlags: u32 {
+            const LONG_A = 0b1111111111111111;
+        }
+    }
+
+    bitflags! {
+        struct EmptyFlags: u32 {
+        }
+    }
+
+    #[test]
+    fn test_bits() {
+        assert_eq!(Flags::empty().bits(), 0b00000000);
+        assert_eq!(Flags::A.bits(), 0b00000001);
+        assert_eq!(Flags::ABC.bits(), 0b00000111);
+
+        assert_eq!(AnotherSetOfFlags::empty().bits(), 0b00);
+        assert_eq!(AnotherSetOfFlags::ANOTHER_FLAG.bits(), !0_i8);
+
+        assert_eq!(EmptyFlags::empty().bits(), 0b00000000);
+    }
+
+    #[test]
+    fn test_from_bits() {
+        assert_eq!(Flags::from_bits(0), Some(Flags::empty()));
+        assert_eq!(Flags::from_bits(0b1), Some(Flags::A));
+        assert_eq!(Flags::from_bits(0b10), Some(Flags::B));
+        assert_eq!(Flags::from_bits(0b11), Some(Flags::A | Flags::B));
+        assert_eq!(Flags::from_bits(0b1000), None);
+
+        assert_eq!(
+            AnotherSetOfFlags::from_bits(!0_i8),
+            Some(AnotherSetOfFlags::ANOTHER_FLAG)
+        );
+
+        assert_eq!(EmptyFlags::from_bits(0), Some(EmptyFlags::empty()));
+        assert_eq!(EmptyFlags::from_bits(0b1), None);
+    }
+
+    #[test]
+    fn test_from_bits_truncate() {
+        assert_eq!(Flags::from_bits_truncate(0), Flags::empty());
+        assert_eq!(Flags::from_bits_truncate(0b1), Flags::A);
+        assert_eq!(Flags::from_bits_truncate(0b10), Flags::B);
+        assert_eq!(Flags::from_bits_truncate(0b11), (Flags::A | Flags::B));
+        assert_eq!(Flags::from_bits_truncate(0b1000), Flags::empty());
+        assert_eq!(Flags::from_bits_truncate(0b1001), Flags::A);
+
+        assert_eq!(
+            AnotherSetOfFlags::from_bits_truncate(0_i8),
+            AnotherSetOfFlags::empty()
+        );
+
+        assert_eq!(EmptyFlags::from_bits_truncate(0), EmptyFlags::empty());
+        assert_eq!(EmptyFlags::from_bits_truncate(0b1), EmptyFlags::empty());
+    }
+
+    #[test]
+    fn test_from_bits_unchecked() {
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        assert_eq!(unsafe { Flags::from_bits_unchecked(0) }, Flags::empty());
+        assert_eq!(unsafe { Flags::from_bits_unchecked(0b1) }, Flags::A);
+        assert_eq!(unsafe { Flags::from_bits_unchecked(0b10) }, Flags::B);
+
+        assert_eq!(
+            unsafe { Flags::from_bits_unchecked(0b11) },
+            (Flags::A | Flags::B)
+        );
+        assert_eq!(
+            unsafe { Flags::from_bits_unchecked(0b1000) },
+            (extra | Flags::empty())
+        );
+        assert_eq!(
+            unsafe { Flags::from_bits_unchecked(0b1001) },
+            (extra | Flags::A)
+        );
+
+        let extra = unsafe { EmptyFlags::from_bits_unchecked(0b1000) };
+        assert_eq!(
+            unsafe { EmptyFlags::from_bits_unchecked(0b1000) },
+            (extra | EmptyFlags::empty())
+        );
+    }
+
+    #[test]
+    fn test_is_empty() {
+        assert!(Flags::empty().is_empty());
+        assert!(!Flags::A.is_empty());
+        assert!(!Flags::ABC.is_empty());
+
+        assert!(!AnotherSetOfFlags::ANOTHER_FLAG.is_empty());
+
+        assert!(EmptyFlags::empty().is_empty());
+        assert!(EmptyFlags::all().is_empty());
+    }
+
+    #[test]
+    fn test_is_all() {
+        assert!(Flags::all().is_all());
+        assert!(!Flags::A.is_all());
+        assert!(Flags::ABC.is_all());
+
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        assert!(!extra.is_all());
+        assert!(!(Flags::A | extra).is_all());
+        assert!((Flags::ABC | extra).is_all());
+
+        assert!(AnotherSetOfFlags::ANOTHER_FLAG.is_all());
+
+        assert!(EmptyFlags::all().is_all());
+        assert!(EmptyFlags::empty().is_all());
+    }
+
+    #[test]
+    fn test_two_empties_do_not_intersect() {
+        let e1 = Flags::empty();
+        let e2 = Flags::empty();
+        assert!(!e1.intersects(e2));
+
+        assert!(AnotherSetOfFlags::ANOTHER_FLAG.intersects(AnotherSetOfFlags::ANOTHER_FLAG));
+    }
+
+    #[test]
+    fn test_empty_does_not_intersect_with_full() {
+        let e1 = Flags::empty();
+        let e2 = Flags::ABC;
+        assert!(!e1.intersects(e2));
+    }
+
+    #[test]
+    fn test_disjoint_intersects() {
+        let e1 = Flags::A;
+        let e2 = Flags::B;
+        assert!(!e1.intersects(e2));
+    }
+
+    #[test]
+    fn test_overlapping_intersects() {
+        let e1 = Flags::A;
+        let e2 = Flags::A | Flags::B;
+        assert!(e1.intersects(e2));
+    }
+
+    #[test]
+    fn test_contains() {
+        let e1 = Flags::A;
+        let e2 = Flags::A | Flags::B;
+        assert!(!e1.contains(e2));
+        assert!(e2.contains(e1));
+        assert!(Flags::ABC.contains(e2));
+
+        assert!(AnotherSetOfFlags::ANOTHER_FLAG.contains(AnotherSetOfFlags::ANOTHER_FLAG));
+
+        assert!(EmptyFlags::empty().contains(EmptyFlags::empty()));
+    }
+
+    #[test]
+    fn test_insert() {
+        let mut e1 = Flags::A;
+        let e2 = Flags::A | Flags::B;
+        e1.insert(e2);
+        assert_eq!(e1, e2);
+
+        let mut e3 = AnotherSetOfFlags::empty();
+        e3.insert(AnotherSetOfFlags::ANOTHER_FLAG);
+        assert_eq!(e3, AnotherSetOfFlags::ANOTHER_FLAG);
+    }
+
+    #[test]
+    fn test_remove() {
+        let mut e1 = Flags::A | Flags::B;
+        let e2 = Flags::A | Flags::C;
+        e1.remove(e2);
+        assert_eq!(e1, Flags::B);
+
+        let mut e3 = AnotherSetOfFlags::ANOTHER_FLAG;
+        e3.remove(AnotherSetOfFlags::ANOTHER_FLAG);
+        assert_eq!(e3, AnotherSetOfFlags::empty());
+    }
+
+    #[test]
+    fn test_operators() {
+        let e1 = Flags::A | Flags::C;
+        let e2 = Flags::B | Flags::C;
+        assert_eq!((e1 | e2), Flags::ABC); // union
+        assert_eq!((e1 & e2), Flags::C); // intersection
+        assert_eq!((e1 - e2), Flags::A); // set difference
+        assert_eq!(!e2, Flags::A); // set complement
+        assert_eq!(e1 ^ e2, Flags::A | Flags::B); // toggle
+        let mut e3 = e1;
+        e3.toggle(e2);
+        assert_eq!(e3, Flags::A | Flags::B);
+
+        let mut m4 = AnotherSetOfFlags::empty();
+        m4.toggle(AnotherSetOfFlags::empty());
+        assert_eq!(m4, AnotherSetOfFlags::empty());
+    }
+
+    #[test]
+    fn test_operators_unchecked() {
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        let e1 = Flags::A | Flags::C | extra;
+        let e2 = Flags::B | Flags::C;
+        assert_eq!((e1 | e2), (Flags::ABC | extra)); // union
+        assert_eq!((e1 & e2), Flags::C); // intersection
+        assert_eq!((e1 - e2), (Flags::A | extra)); // set difference
+        assert_eq!(!e2, Flags::A); // set complement
+        assert_eq!(!e1, Flags::B); // set complement
+        assert_eq!(e1 ^ e2, Flags::A | Flags::B | extra); // toggle
+        let mut e3 = e1;
+        e3.toggle(e2);
+        assert_eq!(e3, Flags::A | Flags::B | extra);
+    }
+
+    #[test]
+    fn test_set_ops_basic() {
+        let ab = Flags::A.union(Flags::B);
+        let ac = Flags::A.union(Flags::C);
+        let bc = Flags::B.union(Flags::C);
+        assert_eq!(ab.bits, 0b011);
+        assert_eq!(bc.bits, 0b110);
+        assert_eq!(ac.bits, 0b101);
+
+        assert_eq!(ab, Flags::B.union(Flags::A));
+        assert_eq!(ac, Flags::C.union(Flags::A));
+        assert_eq!(bc, Flags::C.union(Flags::B));
+
+        assert_eq!(ac, Flags::A | Flags::C);
+        assert_eq!(bc, Flags::B | Flags::C);
+        assert_eq!(ab.union(bc), Flags::ABC);
+
+        assert_eq!(ac, Flags::A | Flags::C);
+        assert_eq!(bc, Flags::B | Flags::C);
+
+        assert_eq!(ac.union(bc), ac | bc);
+        assert_eq!(ac.union(bc), Flags::ABC);
+        assert_eq!(bc.union(ac), Flags::ABC);
+
+        assert_eq!(ac.intersection(bc), ac & bc);
+        assert_eq!(ac.intersection(bc), Flags::C);
+        assert_eq!(bc.intersection(ac), Flags::C);
+
+        assert_eq!(ac.difference(bc), ac - bc);
+        assert_eq!(bc.difference(ac), bc - ac);
+        assert_eq!(ac.difference(bc), Flags::A);
+        assert_eq!(bc.difference(ac), Flags::B);
+
+        assert_eq!(bc.complement(), !bc);
+        assert_eq!(bc.complement(), Flags::A);
+        assert_eq!(ac.symmetric_difference(bc), Flags::A.union(Flags::B));
+        assert_eq!(bc.symmetric_difference(ac), Flags::A.union(Flags::B));
+    }
+
+    #[test]
+    fn test_set_ops_const() {
+        // These just test that these compile and don't cause use-site panics
+        // (would be possible if we had some sort of UB)
+        const INTERSECT: Flags = Flags::all().intersection(Flags::C);
+        const UNION: Flags = Flags::A.union(Flags::C);
+        const DIFFERENCE: Flags = Flags::all().difference(Flags::A);
+        const COMPLEMENT: Flags = Flags::C.complement();
+        const SYM_DIFFERENCE: Flags = UNION.symmetric_difference(DIFFERENCE);
+        assert_eq!(INTERSECT, Flags::C);
+        assert_eq!(UNION, Flags::A | Flags::C);
+        assert_eq!(DIFFERENCE, Flags::all() - Flags::A);
+        assert_eq!(COMPLEMENT, !Flags::C);
+        assert_eq!(SYM_DIFFERENCE, (Flags::A | Flags::C) ^ (Flags::all() - Flags::A));
+    }
+
+    #[test]
+    fn test_set_ops_unchecked() {
+        let extra = unsafe { Flags::from_bits_unchecked(0b1000) };
+        let e1 = Flags::A.union(Flags::C).union(extra);
+        let e2 = Flags::B.union(Flags::C);
+        assert_eq!(e1.bits, 0b1101);
+        assert_eq!(e1.union(e2), (Flags::ABC | extra));
+        assert_eq!(e1.intersection(e2), Flags::C);
+        assert_eq!(e1.difference(e2), Flags::A | extra);
+        assert_eq!(e2.difference(e1), Flags::B);
+        assert_eq!(e2.complement(), Flags::A);
+        assert_eq!(e1.complement(), Flags::B);
+        assert_eq!(e1.symmetric_difference(e2), Flags::A | Flags::B | extra); // toggle
+    }
+
+    #[test]
+    fn test_set_ops_exhaustive() {
+        // Define a flag that contains gaps to help exercise edge-cases,
+        // especially around "unknown" flags (e.g. ones outside of `all()`
+        // `from_bits_unchecked`).
+        // - when lhs and rhs both have different sets of unknown flags.
+        // - unknown flags at both ends, and in the middle
+        // - cases with "gaps".
+        bitflags! {
+            struct Test: u16 {
+                // Intentionally no `A`
+                const B = 0b000000010;
+                // Intentionally no `C`
+                const D = 0b000001000;
+                const E = 0b000010000;
+                const F = 0b000100000;
+                const G = 0b001000000;
+                // Intentionally no `H`
+                const I = 0b100000000;
+            }
+        }
+        let iter_test_flags =
+            || (0..=0b111_1111_1111).map(|bits| unsafe { Test::from_bits_unchecked(bits) });
+
+        for a in iter_test_flags() {
+            assert_eq!(
+                a.complement(),
+                Test::from_bits_truncate(!a.bits),
+                "wrong result: !({:?})",
+                a,
+            );
+            assert_eq!(a.complement(), !a, "named != op: !({:?})", a);
+            for b in iter_test_flags() {
+                // Check that the named operations produce the expected bitwise
+                // values.
+                assert_eq!(
+                    a.union(b).bits,
+                    a.bits | b.bits,
+                    "wrong result: `{:?}` | `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.intersection(b).bits,
+                    a.bits & b.bits,
+                    "wrong result: `{:?}` & `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.symmetric_difference(b).bits,
+                    a.bits ^ b.bits,
+                    "wrong result: `{:?}` ^ `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.difference(b).bits,
+                    a.bits & !b.bits,
+                    "wrong result: `{:?}` - `{:?}`",
+                    a,
+                    b,
+                );
+                // Note: Difference is checked as both `a - b` and `b - a`
+                assert_eq!(
+                    b.difference(a).bits,
+                    b.bits & !a.bits,
+                    "wrong result: `{:?}` - `{:?}`",
+                    b,
+                    a,
+                );
+                // Check that the named set operations are equivalent to the
+                // bitwise equivalents
+                assert_eq!(a.union(b), a | b, "named != op: `{:?}` | `{:?}`", a, b,);
+                assert_eq!(
+                    a.intersection(b),
+                    a & b,
+                    "named != op: `{:?}` & `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.symmetric_difference(b),
+                    a ^ b,
+                    "named != op: `{:?}` ^ `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(a.difference(b), a - b, "named != op: `{:?}` - `{:?}`", a, b,);
+                // Note: Difference is checked as both `a - b` and `b - a`
+                assert_eq!(b.difference(a), b - a, "named != op: `{:?}` - `{:?}`", b, a,);
+                // Verify that the operations which should be symmetric are
+                // actually symmetric.
+                assert_eq!(a.union(b), b.union(a), "asymmetry: `{:?}` | `{:?}`", a, b,);
+                assert_eq!(
+                    a.intersection(b),
+                    b.intersection(a),
+                    "asymmetry: `{:?}` & `{:?}`",
+                    a,
+                    b,
+                );
+                assert_eq!(
+                    a.symmetric_difference(b),
+                    b.symmetric_difference(a),
+                    "asymmetry: `{:?}` ^ `{:?}`",
+                    a,
+                    b,
+                );
+            }
+        }
+    }
+
+    #[test]
+    fn test_set() {
+        let mut e1 = Flags::A | Flags::C;
+        e1.set(Flags::B, true);
+        e1.set(Flags::C, false);
+
+        assert_eq!(e1, Flags::A | Flags::B);
+    }
+
+    #[test]
+    fn test_assignment_operators() {
+        let mut m1 = Flags::empty();
+        let e1 = Flags::A | Flags::C;
+        // union
+        m1 |= Flags::A;
+        assert_eq!(m1, Flags::A);
+        // intersection
+        m1 &= e1;
+        assert_eq!(m1, Flags::A);
+        // set difference
+        m1 -= m1;
+        assert_eq!(m1, Flags::empty());
+        // toggle
+        m1 ^= e1;
+        assert_eq!(m1, e1);
+    }
+
+    #[test]
+    fn test_const_fn() {
+        const _M1: Flags = Flags::empty();
+
+        const M2: Flags = Flags::A;
+        assert_eq!(M2, Flags::A);
+
+        const M3: Flags = Flags::C;
+        assert_eq!(M3, Flags::C);
+    }
+
+    #[test]
+    fn test_extend() {
+        let mut flags;
+
+        flags = Flags::empty();
+        flags.extend([].iter().cloned());
+        assert_eq!(flags, Flags::empty());
+
+        flags = Flags::empty();
+        flags.extend([Flags::A, Flags::B].iter().cloned());
+        assert_eq!(flags, Flags::A | Flags::B);
+
+        flags = Flags::A;
+        flags.extend([Flags::A, Flags::B].iter().cloned());
+        assert_eq!(flags, Flags::A | Flags::B);
+
+        flags = Flags::B;
+        flags.extend([Flags::A, Flags::ABC].iter().cloned());
+        assert_eq!(flags, Flags::ABC);
+    }
+
+    #[test]
+    fn test_from_iterator() {
+        assert_eq!([].iter().cloned().collect::<Flags>(), Flags::empty());
+        assert_eq!(
+            [Flags::A, Flags::B].iter().cloned().collect::<Flags>(),
+            Flags::A | Flags::B
+        );
+        assert_eq!(
+            [Flags::A, Flags::ABC].iter().cloned().collect::<Flags>(),
+            Flags::ABC
+        );
+    }
+
+    #[test]
+    fn test_lt() {
+        let mut a = Flags::empty();
+        let mut b = Flags::empty();
+
+        assert!(!(a < b) && !(b < a));
+        b = Flags::B;
+        assert!(a < b);
+        a = Flags::C;
+        assert!(!(a < b) && b < a);
+        b = Flags::C | Flags::B;
+        assert!(a < b);
+    }
+
+    #[test]
+    fn test_ord() {
+        let mut a = Flags::empty();
+        let mut b = Flags::empty();
+
+        assert!(a <= b && a >= b);
+        a = Flags::A;
+        assert!(a > b && a >= b);
+        assert!(b < a && b <= a);
+        b = Flags::B;
+        assert!(b > a && b >= a);
+        assert!(a < b && a <= b);
+    }
+
+    fn hash<T: Hash>(t: &T) -> u64 {
+        let mut s = DefaultHasher::new();
+        t.hash(&mut s);
+        s.finish()
+    }
+
+    #[test]
+    fn test_hash() {
+        let mut x = Flags::empty();
+        let mut y = Flags::empty();
+        assert_eq!(hash(&x), hash(&y));
+        x = Flags::all();
+        y = Flags::ABC;
+        assert_eq!(hash(&x), hash(&y));
+    }
+
+    #[test]
+    fn test_default() {
+        assert_eq!(Flags::empty(), Flags::default());
+    }
+
+    #[test]
+    fn test_debug() {
+        assert_eq!(format!("{:?}", Flags::A | Flags::B), "A | B");
+        assert_eq!(format!("{:?}", Flags::empty()), "(empty)");
+        assert_eq!(format!("{:?}", Flags::ABC), "A | B | C | ABC");
+        let extra = unsafe { Flags::from_bits_unchecked(0xb8) };
+        assert_eq!(format!("{:?}", extra), "0xb8");
+        assert_eq!(format!("{:?}", Flags::A | extra), "A | 0xb8");
+
+        assert_eq!(
+            format!("{:?}", Flags::ABC | extra),
+            "A | B | C | ABC | 0xb8"
+        );
+
+        assert_eq!(format!("{:?}", EmptyFlags::empty()), "(empty)");
+    }
+
+    #[test]
+    fn test_binary() {
+        assert_eq!(format!("{:b}", Flags::ABC), "111");
+        assert_eq!(format!("{:#b}", Flags::ABC), "0b111");
+        let extra = unsafe { Flags::from_bits_unchecked(0b1010000) };
+        assert_eq!(format!("{:b}", Flags::ABC | extra), "1010111");
+        assert_eq!(format!("{:#b}", Flags::ABC | extra), "0b1010111");
+    }
+
+    #[test]
+    fn test_octal() {
+        assert_eq!(format!("{:o}", LongFlags::LONG_A), "177777");
+        assert_eq!(format!("{:#o}", LongFlags::LONG_A), "0o177777");
+        let extra = unsafe { LongFlags::from_bits_unchecked(0o5000000) };
+        assert_eq!(format!("{:o}", LongFlags::LONG_A | extra), "5177777");
+        assert_eq!(format!("{:#o}", LongFlags::LONG_A | extra), "0o5177777");
+    }
+
+    #[test]
+    fn test_lowerhex() {
+        assert_eq!(format!("{:x}", LongFlags::LONG_A), "ffff");
+        assert_eq!(format!("{:#x}", LongFlags::LONG_A), "0xffff");
+        let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) };
+        assert_eq!(format!("{:x}", LongFlags::LONG_A | extra), "e0ffff");
+        assert_eq!(format!("{:#x}", LongFlags::LONG_A | extra), "0xe0ffff");
+    }
+
+    #[test]
+    fn test_upperhex() {
+        assert_eq!(format!("{:X}", LongFlags::LONG_A), "FFFF");
+        assert_eq!(format!("{:#X}", LongFlags::LONG_A), "0xFFFF");
+        let extra = unsafe { LongFlags::from_bits_unchecked(0xe00000) };
+        assert_eq!(format!("{:X}", LongFlags::LONG_A | extra), "E0FFFF");
+        assert_eq!(format!("{:#X}", LongFlags::LONG_A | extra), "0xE0FFFF");
+    }
+
+    mod submodule {
+        bitflags! {
+            pub struct PublicFlags: i8 {
+                const X = 0;
+            }
+
+            struct PrivateFlags: i8 {
+                const Y = 0;
+            }
+        }
+
+        #[test]
+        fn test_private() {
+            let _ = PrivateFlags::Y;
+        }
+    }
+
+    #[test]
+    fn test_public() {
+        let _ = submodule::PublicFlags::X;
+    }
+
+    mod t1 {
+        mod foo {
+            pub type Bar = i32;
+        }
+
+        bitflags! {
+            /// baz
+            struct Flags: foo::Bar {
+                const A = 0b00000001;
+                #[cfg(foo)]
+                const B = 0b00000010;
+                #[cfg(foo)]
+                const C = 0b00000010;
+            }
+        }
+    }
+
+    #[test]
+    fn test_in_function() {
+        bitflags! {
+           struct Flags: u8 {
+                const A = 1;
+                #[cfg(any())] // false
+                const B = 2;
+            }
+        }
+        assert_eq!(Flags::all(), Flags::A);
+        assert_eq!(format!("{:?}", Flags::A), "A");
+    }
+
+    #[test]
+    fn test_deprecated() {
+        bitflags! {
+            pub struct TestFlags: u32 {
+                #[deprecated(note = "Use something else.")]
+                const ONE = 1;
+            }
+        }
+    }
+
+    #[test]
+    fn test_pub_crate() {
+        mod module {
+            bitflags! {
+                pub (crate) struct Test: u8 {
+                    const FOO = 1;
+                }
+            }
+        }
+
+        assert_eq!(module::Test::FOO.bits(), 1);
+    }
+
+    #[test]
+    fn test_pub_in_module() {
+        mod module {
+            mod submodule {
+                bitflags! {
+                    // `pub (in super)` means only the module `module` will
+                    // be able to access this.
+                    pub (in super) struct Test: u8 {
+                        const FOO = 1;
+                    }
+                }
+            }
+
+            mod test {
+                // Note: due to `pub (in super)`,
+                // this cannot be accessed directly by the testing code.
+                pub(super) fn value() -> u8 {
+                    super::submodule::Test::FOO.bits()
+                }
+            }
+
+            pub fn value() -> u8 {
+                test::value()
+            }
+        }
+
+        assert_eq!(module::value(), 1)
+    }
+
+    #[test]
+    fn test_zero_value_flags() {
+        bitflags! {
+            struct Flags: u32 {
+                const NONE = 0b0;
+                const SOME = 0b1;
+            }
+        }
+
+        assert!(Flags::empty().contains(Flags::NONE));
+        assert!(Flags::SOME.contains(Flags::NONE));
+        assert!(Flags::NONE.is_empty());
+
+        assert_eq!(format!("{:?}", Flags::empty()), "NONE");
+        assert_eq!(format!("{:?}", Flags::SOME), "SOME");
+    }
+
+    #[test]
+    fn test_empty_bitflags() {
+        bitflags! {}
+    }
+
+    #[test]
+    fn test_u128_bitflags() {
+        bitflags! {
+            struct Flags128: u128 {
+                const A = 0x0000_0000_0000_0000_0000_0000_0000_0001;
+                const B = 0x0000_0000_0000_1000_0000_0000_0000_0000;
+                const C = 0x8000_0000_0000_0000_0000_0000_0000_0000;
+                const ABC = Self::A.bits | Self::B.bits | Self::C.bits;
+            }
+        }
+
+        assert_eq!(Flags128::ABC, Flags128::A | Flags128::B | Flags128::C);
+        assert_eq!(Flags128::A.bits, 0x0000_0000_0000_0000_0000_0000_0000_0001);
+        assert_eq!(Flags128::B.bits, 0x0000_0000_0000_1000_0000_0000_0000_0000);
+        assert_eq!(Flags128::C.bits, 0x8000_0000_0000_0000_0000_0000_0000_0000);
+        assert_eq!(
+            Flags128::ABC.bits,
+            0x8000_0000_0000_1000_0000_0000_0000_0001
+        );
+        assert_eq!(format!("{:?}", Flags128::A), "A");
+        assert_eq!(format!("{:?}", Flags128::B), "B");
+        assert_eq!(format!("{:?}", Flags128::C), "C");
+        assert_eq!(format!("{:?}", Flags128::ABC), "A | B | C | ABC");
+    }
+
+    #[test]
+    fn test_serde_bitflags_serialize() {
+        let flags = SerdeFlags::A | SerdeFlags::B;
+
+        let serialized = serde_json::to_string(&flags).unwrap();
+
+        assert_eq!(serialized, r#"{"bits":3}"#);
+    }
+
+    #[test]
+    fn test_serde_bitflags_deserialize() {
+        let deserialized: SerdeFlags = serde_json::from_str(r#"{"bits":12}"#).unwrap();
+
+        let expected = SerdeFlags::C | SerdeFlags::D;
+
+        assert_eq!(deserialized.bits, expected.bits);
+    }
+
+    #[test]
+    fn test_serde_bitflags_roundtrip() {
+        let flags = SerdeFlags::A | SerdeFlags::B;
+
+        let deserialized: SerdeFlags = serde_json::from_str(&serde_json::to_string(&flags).unwrap()).unwrap();
+
+        assert_eq!(deserialized.bits, flags.bits);
+    }
+
+    bitflags! {
+        #[derive(serde::Serialize, serde::Deserialize)]
+        struct SerdeFlags: u32 {
+            const A = 1;
+            const B = 2;
+            const C = 4;
+            const D = 8;
+        }
+    }
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/basic.rs b/android/vendor/bitflags-1.3.2/tests/basic.rs
new file mode 100644
index 0000000..73a52be
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/basic.rs
@@ -0,0 +1,20 @@
+#![no_std]
+
+use bitflags::bitflags;
+
+bitflags! {
+    /// baz
+    struct Flags: u32 {
+        const A = 0b00000001;
+        #[doc = "bar"]
+        const B = 0b00000010;
+        const C = 0b00000100;
+        #[doc = "foo"]
+        const ABC = Flags::A.bits | Flags::B.bits | Flags::C.bits;
+    }
+}
+
+#[test]
+fn basic() {
+    assert_eq!(Flags::ABC, Flags::A | Flags::B | Flags::C);
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.rs
new file mode 100644
index 0000000..38f4822
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.rs
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[derive(Clone, Copy)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta
new file mode 100644
index 0000000..0c13aa5
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/copy.stderr.beta
@@ -0,0 +1,27 @@
+error[E0119]: conflicting implementations of trait `std::clone::Clone` for type `Flags`
+ --> $DIR/copy.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(Clone, Copy)]
+  | |              ----- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::marker::Copy` for type `Flags`
+ --> $DIR/copy.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(Clone, Copy)]
+  | |                     ---- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.rs
new file mode 100644
index 0000000..4abbd63
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.rs
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[derive(PartialEq, Eq)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta
new file mode 100644
index 0000000..8a1a3b4
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/impls/eq.stderr.beta
@@ -0,0 +1,55 @@
+error[E0119]: conflicting implementations of trait `std::cmp::PartialEq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |              --------- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::cmp::Eq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |                         -- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::marker::StructuralPartialEq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |              --------- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0119]: conflicting implementations of trait `std::marker::StructuralEq` for type `Flags`
+ --> $DIR/eq.rs:3:1
+  |
+3 | / bitflags! {
+4 | |     #[derive(PartialEq, Eq)]
+  | |                         -- first implementation here
+5 | |     struct Flags: u32 {
+6 | |         const A = 0b00000001;
+7 | |     }
+8 | | }
+  | |_^ conflicting implementation for `Flags`
+  |
+  = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs
new file mode 100644
index 0000000..c2856b1
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.rs
@@ -0,0 +1,123 @@
+use std::{
+    fmt::{
+        self,
+        Debug,
+        Display,
+        LowerHex,
+        UpperHex,
+        Octal,
+        Binary,
+    },
+    ops::{
+        BitAnd,
+        BitOr,
+        BitXor,
+        BitAndAssign,
+        BitOrAssign,
+        BitXorAssign,
+        Not,
+    },
+};
+
+use bitflags::bitflags;
+
+// Ideally we'd actually want this to work, but currently need something like `num`'s `Zero`
+// With some design work it could be made possible
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
+struct MyInt(u8);
+
+impl BitAnd for MyInt {
+    type Output = Self;
+
+    fn bitand(self, other: Self) -> Self {
+        MyInt(self.0 & other.0)
+    }
+}
+
+impl BitOr for MyInt {
+    type Output = Self;
+
+    fn bitor(self, other: Self) -> Self {
+        MyInt(self.0 | other.0)
+    }
+}
+
+impl BitXor for MyInt {
+    type Output = Self;
+
+    fn bitxor(self, other: Self) -> Self {
+        MyInt(self.0 ^ other.0)
+    }
+}
+
+impl BitAndAssign for MyInt {
+    fn bitand_assign(&mut self, other: Self) {
+        self.0 &= other.0
+    }
+}
+
+impl BitOrAssign for MyInt {
+    fn bitor_assign(&mut self, other: Self) {
+        self.0 |= other.0
+    }
+}
+
+impl BitXorAssign for MyInt {
+    fn bitxor_assign(&mut self, other: Self) {
+        self.0 ^= other.0
+    }
+}
+
+impl Debug for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Debug::fmt(&self.0, f)
+    }
+}
+
+impl Display for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Display::fmt(&self.0, f)
+    }
+}
+
+impl LowerHex for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        LowerHex::fmt(&self.0, f)
+    }
+}
+
+impl UpperHex for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        UpperHex::fmt(&self.0, f)
+    }
+}
+
+impl Octal for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Octal::fmt(&self.0, f)
+    }
+}
+
+impl Binary for MyInt {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        Binary::fmt(&self.0, f)
+    }
+}
+
+impl Not for MyInt {
+    type Output = MyInt;
+
+    fn not(self) -> Self {
+        MyInt(!self.0)
+    }
+}
+
+bitflags! {
+    struct Flags128: MyInt {
+        const A = MyInt(0b0000_0001u8);
+        const B = MyInt(0b0000_0010u8);
+        const C = MyInt(0b0000_0100u8);
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta
new file mode 100644
index 0000000..1f0fb5c
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_defined.stderr.beta
@@ -0,0 +1,27 @@
+error[E0308]: mismatched types
+   --> $DIR/all_defined.rs:115:1
+    |
+115 | / bitflags! {
+116 | |     struct Flags128: MyInt {
+117 | |         const A = MyInt(0b0000_0001u8);
+118 | |         const B = MyInt(0b0000_0010u8);
+119 | |         const C = MyInt(0b0000_0100u8);
+120 | |     }
+121 | | }
+    | |_^ expected struct `MyInt`, found integer
+    |
+    = note: this error originates in the macro `__impl_all_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0308]: mismatched types
+   --> $DIR/all_defined.rs:115:1
+    |
+115 | / bitflags! {
+116 | |     struct Flags128: MyInt {
+117 | |         const A = MyInt(0b0000_0001u8);
+118 | |         const B = MyInt(0b0000_0010u8);
+119 | |         const C = MyInt(0b0000_0100u8);
+120 | |     }
+121 | | }
+    | |_^ expected struct `MyInt`, found integer
+    |
+    = note: this error originates in the macro `__impl_bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs
new file mode 100644
index 0000000..fff6b2c
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.rs
@@ -0,0 +1,13 @@
+use bitflags::bitflags;
+
+struct MyInt(u8);
+
+bitflags! {
+    struct Flags128: MyInt {
+        const A = MyInt(0b0000_0001);
+        const B = MyInt(0b0000_0010);
+        const C = MyInt(0b0000_0100);
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta
new file mode 100644
index 0000000..ee95f83
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/non_integer_base/all_missing.stderr.beta
@@ -0,0 +1,13 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+  --> $DIR/all_missing.rs:5:1
+   |
+5  | / bitflags! {
+6  | |     struct Flags128: MyInt {
+7  | |         const A = MyInt(0b0000_0001);
+8  | |         const B = MyInt(0b0000_0010);
+9  | |         const C = MyInt(0b0000_0100);
+10 | |     }
+11 | | }
+   | |_^ this field does not implement `Copy`
+   |
+   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs
new file mode 100644
index 0000000..a6a3912
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.rs
@@ -0,0 +1,13 @@
+mod example {
+    use bitflags::bitflags;
+
+    bitflags! {
+        pub struct Flags1: u32 {
+            const FLAG_A = 0b00000001;
+        }
+    }
+}
+
+fn main() {
+    let flag1 = example::Flags1::FLAG_A.bits;
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta
new file mode 100644
index 0000000..58a0466
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_field.stderr.beta
@@ -0,0 +1,10 @@
+error[E0616]: field `bits` of struct `Flags1` is private
+  --> $DIR/private_field.rs:12:41
+   |
+12 |     let flag1 = example::Flags1::FLAG_A.bits;
+   |                                         ^^^^ private field
+   |
+help: a method `bits` also exists, call it with parentheses
+   |
+12 |     let flag1 = example::Flags1::FLAG_A.bits();
+   |                                             ^^
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs
new file mode 100644
index 0000000..85a5b18
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.rs
@@ -0,0 +1,18 @@
+mod example {
+    use bitflags::bitflags;
+
+    bitflags! {
+        pub struct Flags1: u32 {
+            const FLAG_A = 0b00000001;
+        }
+
+        struct Flags2: u32 {
+            const FLAG_B = 0b00000010;
+        }
+    }
+}
+
+fn main() {
+    let flag1 = example::Flags1::FLAG_A;
+    let flag2 = example::Flags2::FLAG_B;
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta
new file mode 100644
index 0000000..d23f832
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/private_flags.stderr.beta
@@ -0,0 +1,18 @@
+error[E0603]: struct `Flags2` is private
+  --> $DIR/private_flags.rs:17:26
+   |
+17 |     let flag2 = example::Flags2::FLAG_B;
+   |                          ^^^^^^ private struct
+   |
+note: the struct `Flags2` is defined here
+  --> $DIR/private_flags.rs:4:5
+   |
+4  | /     bitflags! {
+5  | |         pub struct Flags1: u32 {
+6  | |             const FLAG_A = 0b00000001;
+7  | |         }
+...  |
+11 | |         }
+12 | |     }
+   | |_____^
+   = note: this error originates in the macro `bitflags` (in Nightly builds, run with -Z macro-backtrace for more info)
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs
new file mode 100644
index 0000000..b90f0ce
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.rs
@@ -0,0 +1,9 @@
+use bitflags::bitflags;
+
+bitflags! {
+    pub struct Flags1: u32 {
+        pub const FLAG_A = 0b00000001;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta
new file mode 100644
index 0000000..b01122c
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-fail/visibility/pub_const.stderr.beta
@@ -0,0 +1,5 @@
+error: no rules expected the token `pub`
+ --> $DIR/pub_const.rs:5:9
+  |
+5 |         pub const FLAG_A = 0b00000001;
+  |         ^^^ no rules expected this token in macro call
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/convert.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/convert.rs
new file mode 100644
index 0000000..1f02982
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/convert.rs
@@ -0,0 +1,17 @@
+use bitflags::bitflags;
+
+bitflags! {
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+impl From<u32> for Flags {
+    fn from(v: u32) -> Flags {
+        Flags::from_bits_truncate(v)
+    }
+}
+
+fn main() {
+
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/default.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/default.rs
new file mode 100644
index 0000000..a97b653
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/default.rs
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[derive(Default)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs
new file mode 100644
index 0000000..3052c46
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/impls/inherent_methods.rs
@@ -0,0 +1,15 @@
+use bitflags::bitflags;
+
+bitflags! {
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+impl Flags {
+    pub fn new() -> Flags {
+        Flags::A
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs
new file mode 100644
index 0000000..4754921
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/core.rs
@@ -0,0 +1,14 @@
+use bitflags::bitflags;
+
+// Checks for possible errors caused by overriding names used by `bitflags!` internally.
+
+mod core {}
+mod _core {}
+
+bitflags! {
+    struct Test: u8 {
+        const A = 1;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs
new file mode 100644
index 0000000..b04f2f6
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/redefinition/stringify.rs
@@ -0,0 +1,19 @@
+use bitflags::bitflags;
+
+// Checks for possible errors caused by overriding names used by `bitflags!` internally.
+
+#[allow(unused_macros)]
+macro_rules! stringify {
+    ($($t:tt)*) => { "..." };
+}
+
+bitflags! {
+    struct Test: u8 {
+        const A = 1;
+    }
+}
+
+fn main() {
+    // Just make sure we don't call the redefined `stringify` macro
+    assert_eq!(format!("{:?}", Test::A), "A");
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/repr/c.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/repr/c.rs
new file mode 100644
index 0000000..6feba36
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/repr/c.rs
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[repr(C)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs
new file mode 100644
index 0000000..e38db4d
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/repr/transparent.rs
@@ -0,0 +1,10 @@
+use bitflags::bitflags;
+
+bitflags! {
+    #[repr(transparent)]
+    struct Flags: u32 {
+        const A = 0b00000001;
+    }
+}
+
+fn main() {}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs
new file mode 100644
index 0000000..33a7967
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/visibility/bits_field.rs
@@ -0,0 +1,11 @@
+use bitflags::bitflags;
+
+bitflags! {
+    pub struct Flags1: u32 {
+        const FLAG_A = 0b00000001;
+    }
+}
+
+fn main() {
+    assert_eq!(0b00000001, Flags1::FLAG_A.bits);
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs b/android/vendor/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs
new file mode 100644
index 0000000..c11050e
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile-pass/visibility/pub_in.rs
@@ -0,0 +1,19 @@
+mod a {
+    mod b {
+        use bitflags::bitflags;
+
+        bitflags! {
+            pub(in crate::a) struct Flags: u32 {
+                const FLAG_A = 0b00000001;
+            }
+        }
+    }
+
+    pub fn flags() -> u32 {
+        b::Flags::FLAG_A.bits()
+    }
+}
+
+fn main() {
+    assert_eq!(0b00000001, a::flags());
+}
diff --git a/android/vendor/bitflags-1.3.2/tests/compile.rs b/android/vendor/bitflags-1.3.2/tests/compile.rs
new file mode 100644
index 0000000..ed02d01
--- /dev/null
+++ b/android/vendor/bitflags-1.3.2/tests/compile.rs
@@ -0,0 +1,63 @@
+use std::{
+    fs,
+    ffi::OsStr,
+    io,
+    path::Path,
+};
+
+use walkdir::WalkDir;
+
+#[test]
+fn fail() {
+    prepare_stderr_files("tests/compile-fail").unwrap();
+
+    let t = trybuild::TestCases::new();
+    t.compile_fail("tests/compile-fail/**/*.rs");
+}
+
+#[test]
+fn pass() {
+    let t = trybuild::TestCases::new();
+    t.pass("tests/compile-pass/**/*.rs");
+}
+
+// Compiler messages may change between versions
+// We don't want to have to track these too closely for `bitflags`, but
+// having some message to check makes sure user-facing errors are sensical.
+// 
+// The approach we use is to run the test on all compilers, but only check stderr
+// output on beta (which is the next stable release). We do this by default ignoring
+// any `.stderr` files in the `compile-fail` directory, and copying `.stderr.beta` files
+// when we happen to be running on a beta compiler.
+fn prepare_stderr_files(path: impl AsRef<Path>) -> io::Result<()> {
+    for entry in WalkDir::new(path) {
+        let entry = entry?;
+
+        if entry.path().extension().and_then(OsStr::to_str) == Some("beta") {
+            let renamed = entry.path().with_extension("");
+
+            // Unconditionally remove a corresponding `.stderr` file for a `.stderr.beta`
+            // file if it exists. On `beta` compilers, we'll recreate it. On other compilers,
+            // we don't want to end up checking it anyways.
+            if renamed.exists() {
+                fs::remove_file(&renamed)?;
+            }
+
+            rename_beta_stderr(entry.path(), renamed)?;
+        }
+    }
+
+    Ok(())
+}
+
+#[rustversion::beta]
+fn rename_beta_stderr(from: impl AsRef<Path>, to: impl AsRef<Path>) -> io::Result<()> {
+    fs::copy(from, to)?;
+
+    Ok(())
+}
+
+#[rustversion::not(beta)]
+fn rename_beta_stderr(_: impl AsRef<Path>, _: impl AsRef<Path>) -> io::Result<()> {
+    Ok(())
+}
diff --git a/android/vendor/bumpalo-3.10.0/.cargo-checksum.json b/android/vendor/bumpalo-3.10.0/.cargo-checksum.json
new file mode 100644
index 0000000..8c1b8d1
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"506ba9e82e7d0354739d7ea9a051fd8e77e0a2842b25063d97d72c84f73b5620","Cargo.toml":"ef3049ea38d9acf8d7a1b3a72fb559548232e5e4562fde190e29530d1caff9f2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"65f94e99ddaf4f5d1782a6dae23f35d4293a9a01444a13135a6887017d353cee","README.md":"1b8b798489668a6053520f90534a795ba73e33928022d10d364dfd8f8df7b5a3","src/alloc.rs":"ab0f23fa11c26efdd8f0596ebdf0e3faa75d097881fb59639b0fb23340c106bc","src/boxed.rs":"8a54f74527691012a1416e7e65ae1dc9f9f4711afd252704a7222b04cce60194","src/collections/collect_in.rs":"0588a4ff3967a4323abb4218bbd615af4b123639ab4fae9130c6590c258b3d15","src/collections/mod.rs":"d58dc46eb4f9fcdde574f09bc5b8646f53e42d49c169561d98e0c23e5b36848a","src/collections/raw_vec.rs":"a4eebed2bd81a039e4f120f1e4230585b8f3bbb42c27f79af28d0c05ee7b6866","src/collections/str/lossy.rs":"c5d62b16e01071e2a574ae41ef6693ad12f1e6c786c5d38f7a13ebd6cb23c088","src/collections/str/mod.rs":"d82a8bd417fbf52a589d89a16ea2a0ac4f6ac920c3976ab1f5b6ac0c8493c4f2","src/collections/string.rs":"7719005ca29d6031c7bf06ebcfd94ea27891da1aadd797ca45aadff598d2b7ee","src/collections/vec.rs":"7a757c495e4688a8db8482105206338e86df0ea2774765382091a36602cf3638","src/lib.rs":"72d2f350246d7365b893f40bc106c6bdd6bb2dbb1fc836d6e04f6d76ca2c282f"},"package":"37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"}
\ No newline at end of file
diff --git a/android/vendor/bumpalo-3.10.0/CHANGELOG.md b/android/vendor/bumpalo-3.10.0/CHANGELOG.md
new file mode 100644
index 0000000..51fe053
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/CHANGELOG.md
@@ -0,0 +1,605 @@
+## Unreleased
+
+Released YYYY-MM-DD.
+
+### Added
+
+* TODO (or remove section if none)
+
+### Changed
+
+* TODO (or remove section if none)
+
+### Deprecated
+
+* TODO (or remove section if none)
+
+### Removed
+
+* TODO (or remove section if none)
+
+### Fixed
+
+* TODO (or remove section if none)
+
+### Security
+
+* TODO (or remove section if none)
+
+--------------------------------------------------------------------------------
+
+## 3.10.0
+
+Released 2022-06-01.
+
+### Added
+
+* Implement `bumpalo::collections::FromIteratorIn` for `Option` and `Result`,
+  just like `core` does for `FromIterator`.
+* Implement `bumpalo::collections::FromIteratorIn` for `bumpalo::boxed::Box<'a,
+  [T]>`.
+* Added running tests under MIRI in CI for additional confidence in unsafe code.
+* Publicly exposed `bumpalo::collections::Vec::drain_filter` since the
+  corresponding `std::vec::Vec` method has stabilized.
+
+### Changed
+
+* `Bump::new` will not allocate a backing chunk until the first allocation
+  inside the bump arena now.
+
+### Fixed
+
+* Properly account for alignment changes when growing or shrinking an existing
+  allocation.
+* Removed all internal integer-to-pointer casts, to play better with UB checkers
+  like MIRI.
+
+--------------------------------------------------------------------------------
+
+## 3.9.1
+
+Released 2022-01-06.
+
+### Fixed
+
+* Fixed link to logo in docs and README.md
+
+--------------------------------------------------------------------------------
+
+## 3.9.0
+
+Released 2022-01-05.
+
+### Changed
+
+* The minimum supported Rust version (MSRV) has been raised to Rust 1.54.0.
+
+* `bumpalo::collections::Vec<T>` implements relevant traits for all arrays of
+  any size `N` via const generics. Previously, it was just arrays up to length
+  32. Similar for `bumpalo::boxed::Box<[T; N]>`.
+
+--------------------------------------------------------------------------------
+
+## 3.8.0
+
+Released 2021-10-19.
+
+### Added
+
+* Added the `CollectIn` and `FromIteratorIn` traits to make building a
+  collection from an iterator easier. These new traits live in the
+  `bumpalo::collections` module and are implemented by
+  `bumpalo::collections::{String,Vec}`.
+
+* Added the `Bump::iter_allocated_chunks_raw` method, which is an `unsafe`, raw
+  version of `Bump::iter_allocated_chunks`. The new method does not take an
+  exclusive borrow of the `Bump` and yields raw pointer-and-length pairs for
+  each chunk in the bump. It is the caller's responsibility to ensure that no
+  allocation happens in the `Bump` while iterating over chunks and that there
+  are no active borrows of allocated data if they want to turn any
+  pointer-and-length pairs into slices.
+
+--------------------------------------------------------------------------------
+
+## 3.7.1
+
+Released 2021-09-17.
+
+### Changed
+
+* The packaged crate uploaded to crates.io when `bumpalo` is published is now
+  smaller, thanks to excluding unnecessary files.
+
+--------------------------------------------------------------------------------
+
+## 3.7.0
+
+Released 2020-05-28.
+
+### Added
+
+* Added `Borrow` and `BorrowMut` trait implementations for
+  `bumpalo::collections::Vec` and
+  `bumpalo::collections::String`. [#108](https://github.com/fitzgen/bumpalo/pull/108)
+
+### Changed
+
+* When allocating a new chunk fails, don't immediately give up. Instead, try
+  allocating a chunk that is half that size, and if that fails, then try half of
+  *that* size, etc until either we successfully allocate a chunk or we fail to
+  allocate the minimum chunk size and then finally give
+  up. [#111](https://github.com/fitzgen/bumpalo/pull/111)
+
+--------------------------------------------------------------------------------
+
+## 3.6.1
+
+Released 2020-02-18.
+
+### Added
+
+* Improved performance of `Bump`'s `Allocator::grow_zeroed` trait method
+  implementation. [#99](https://github.com/fitzgen/bumpalo/pull/99)
+
+--------------------------------------------------------------------------------
+
+## 3.6.0
+
+Released 2020-01-29.
+
+### Added
+
+* Added a few new flavors of allocation:
+
+  * `try_alloc` for fallible, by-value allocation
+
+  * `try_alloc_with` for fallible allocation with an infallible initializer
+    function
+
+  * `alloc_try_with` for infallible allocation with a fallible initializer
+    function
+
+  * `try_alloc_try_with` method for fallible allocation with a fallible
+    initializer function
+
+  We already have infallible, by-value allocation (`alloc`) and infallible
+  allocation with an infallible initializer (`alloc_with`). With these new
+  methods, we now have every combination covered.
+
+  Thanks to [Tamme Schichler](https://github.com/Tamschi) for contributing these
+  methods!
+
+--------------------------------------------------------------------------------
+
+## 3.5.0
+
+Released 2020-01-22.
+
+### Added
+
+* Added experimental, unstable support for the unstable, nightly Rust
+  `allocator_api` feature.
+
+  The `allocator_api` feature defines an `Allocator` trait and exposes custom
+  allocators for `std` types. Bumpalo has a matching `allocator_api` cargo
+  feature to enable implementing `Allocator` and using `Bump` with `std`
+  collections.
+
+  First, enable the `allocator_api` feature in your `Cargo.toml`:
+
+  ```toml
+  [dependencies]
+  bumpalo = { version = "3.5", features = ["allocator_api"] }
+  ```
+
+  Next, enable the `allocator_api` nightly Rust feature in your `src/lib.rs` or `src/main.rs`:
+
+  ```rust
+  # #[cfg(feature = "allocator_api")]
+  # {
+  #![feature(allocator_api)]
+  # }
+  ```
+
+  Finally, use `std` collections with `Bump`, so that their internal heap
+  allocations are made within the given bump arena:
+
+  ```
+  # #![cfg_attr(feature = "allocator_api", feature(allocator_api))]
+  # #[cfg(feature = "allocator_api")]
+  # {
+  #![feature(allocator_api)]
+  use bumpalo::Bump;
+
+  // Create a new bump arena.
+  let bump = Bump::new();
+
+  // Create a `Vec` whose elements are allocated within the bump arena.
+  let mut v = Vec::new_in(&bump);
+  v.push(0);
+  v.push(1);
+  v.push(2);
+  # }
+  ```
+
+  I'm very excited to see custom allocators in `std` coming along! Thanks to
+  Arthur Gautier for implementing support for the `allocator_api` feature for
+  Bumpalo.
+
+--------------------------------------------------------------------------------
+
+## 3.4.0
+
+Released 2020-06-01.
+
+### Added
+
+* Added the `bumpalo::boxed::Box<T>` type. It is an owned pointer referencing a
+  bump-allocated value, and it runs `T`'s `Drop` implementation on the
+  referenced value when dropped. This type can be used by enabling the `"boxed"`
+  cargo feature flag.
+
+--------------------------------------------------------------------------------
+
+## 3.3.0
+
+Released 2020-05-13.
+
+### Added
+
+* Added fallible allocation methods to `Bump`: `try_new`, `try_with_capacity`,
+  and `try_alloc_layout`.
+
+* Added `Bump::chunk_capacity`
+
+* Added `bumpalo::collections::Vec::try_reserve[_exact]`
+
+--------------------------------------------------------------------------------
+
+## 3.2.1
+
+Released 2020-03-24.
+
+### Security
+
+* When `realloc`ing, if we allocate new space, we need to copy the old
+  allocation's bytes into the new space. There are `old_size` number of bytes in
+  the old allocation, but we were accidentally copying `new_size` number of
+  bytes, which could lead to copying bytes into the realloc'd space from past
+  the chunk that we're bump allocating out of, from unknown memory.
+
+  If an attacker can cause `realloc`s, and can read the `realoc`ed data back,
+  this could allow them to read things from other regions of memory that they
+  shouldn't be able to. For example, if some crypto keys happened to live in
+  memory right after a chunk we were bump allocating out of, this could allow
+  the attacker to read the crypto keys.
+
+  Beyond just fixing the bug and adding a regression test, I've also taken two
+  additional steps:
+
+  1. While we were already running the testsuite under `valgrind` in CI, because
+     `valgrind` exits with the same code that the program did, if there are
+     invalid reads/writes that happen not to trigger a segfault, the program can
+     still exit OK and we will be none the wiser. I've enabled the
+     `--error-exitcode=1` flag for `valgrind` in CI so that tests eagerly fail
+     in these scenarios.
+
+  2. I've written a quickcheck test to exercise `realloc`. Without the bug fix
+     in this patch, this quickcheck immediately triggers invalid reads when run
+     under `valgrind`. We didn't previously have quickchecks that exercised
+     `realloc` because `realloc` isn't publicly exposed directly, and instead
+     can only be indirectly called. This new quickcheck test exercises `realloc`
+     via `bumpalo::collections::Vec::resize` and
+     `bumpalo::collections::Vec::shrink_to_fit` calls.
+
+  This bug was introduced in version 3.0.0.
+
+  See [#69](https://github.com/fitzgen/bumpalo/issues/69) for details.
+
+--------------------------------------------------------------------------------
+
+## 3.2.0
+
+Released 2020-02-07.
+
+### Added
+
+* Added the `bumpalo::collections::Vec::into_bump_slice_mut` method to turn a
+  `bumpalo::collections::Vec<'bump, T>` into a `&'bump mut [T]`.
+
+--------------------------------------------------------------------------------
+
+## 3.1.2
+
+Released 2020-01-07.
+
+### Fixed
+
+* The `bumpalo::collections::format!` macro did not used to accept a trailing
+  comma like `format!(in bump; "{}", 1,)`, but it does now.
+
+--------------------------------------------------------------------------------
+
+## 3.1.1
+
+Released 2020-01-03.
+
+### Fixed
+
+* The `bumpalo::collections::vec!` macro did not used to accept a trailing
+  comma like `vec![in bump; 1, 2,]`, but it does now.
+
+--------------------------------------------------------------------------------
+
+## 3.1.0
+
+Released 2019-12-27.
+
+### Added
+
+* Added the `Bump::allocated_bytes` diagnostic method for counting the total
+  number of bytes a `Bump` has allocated.
+
+--------------------------------------------------------------------------------
+
+# 3.0.0
+
+Released 2019-12-20.
+
+## Added
+
+* Added `Bump::alloc_str` for copying string slices into a `Bump`.
+
+* Added `Bump::alloc_slice_copy` and `Bump::alloc_slice_clone` for copying or
+  cloning slices into a `Bump`.
+
+* Added `Bump::alloc_slice_fill_iter` for allocating a slice in the `Bump` from
+  an iterator.
+
+* Added `Bump::alloc_slice_fill_copy` and `Bump::alloc_slice_fill_clone` for
+  creating slices of length `n` that are filled with copies or clones of an
+  initial element.
+
+* Added `Bump::alloc_slice_fill_default` for creating slices of length `n` with
+  the element type's default instance.
+
+* Added `Bump::alloc_slice_fill_with` for creating slices of length `n` whose
+  elements are initialized with a function or closure.
+
+* Added `Bump::iter_allocated_chunks` as a replacement for the old
+  `Bump::each_allocated_chunk`. The `iter_allocated_chunks` version returns an
+  iterator, which is more idiomatic than its old, callback-taking counterpart.
+  Additionally, `iter_allocated_chunks` exposes the chunks as `MaybeUninit`s
+  instead of slices, which makes it usable in more situations without triggering
+  undefined behavior. See also the note about bump direction in the "changed"
+  section; if you're iterating chunks, you're likely affected by that change!
+
+* Added `Bump::with_capacity` so that you can pre-allocate a chunk with the
+  requested space.
+
+### Changed
+
+* **BREAKING:** The direction we allocate within a chunk has changed. It used to
+  be "upwards", from low addresses within a chunk towards high addresses. It is
+  now "downwards", from high addresses towards lower addresses.
+
+  Additionally, the order in which we iterate over allocated chunks has changed!
+  We used to iterate over chunks from oldest chunk to youngest chunk, and now we
+  do the opposite: the youngest chunks are iterated over first, and the oldest
+  chunks are iterated over last.
+
+  If you were using `Bump::each_allocated_chunk` to iterate over data that you
+  had previously allocated, and *you want to iterate in order of
+  oldest-to-youngest allocation*, you need to reverse the chunks iterator and
+  also reverse the order in which you loop through the data within a chunk!
+
+  For example, if you had this code:
+
+  ```rust
+  unsafe {
+      bump.each_allocated_chunk(|chunk| {
+          for byte in chunk {
+              // Touch each byte in oldest-to-youngest allocation order...
+          }
+      });
+  }
+  ```
+
+  It should become this code:
+
+  ```rust
+  let mut chunks: Vec<_> = bump.iter_allocated_chunks().collect();
+  chunks.reverse();
+  for chunk in chunks {
+      for byte in chunk.iter().rev() {
+          let byte = unsafe { byte.assume_init() };
+          // Touch each byte in oldest-to-youngest allocation order...
+      }
+  }
+  ```
+
+  The good news is that this change yielded a *speed up in allocation throughput
+  of 3-19%!*
+
+  See https://github.com/fitzgen/bumpalo/pull/37 and
+  https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html for details.
+
+* **BREAKING:** The `collections` cargo feature is no longer on by default. You
+  must explicitly turn it on if you intend to use the `bumpalo::collections`
+  module.
+
+* `Bump::reset` will now retain only the last allocated chunk (the biggest),
+  rather than only the first allocated chunk (the smallest). This should enable
+  `Bump` to better adapt to workload sizes and quickly reach a steady state
+  where new chunks are not requested from the global allocator.
+
+### Removed
+
+* The `Bump::each_allocated_chunk` method is removed in favor of
+  `Bump::iter_allocated_chunks`. Note that its safety requirements for reading
+  from the allocated chunks are slightly different from the old
+  `each_allocated_chunk`: only up to 16-byte alignment is supported now. If you
+  allocate anything with greater alignment than that into the bump arena, there
+  might be uninitilized padding inserted in the chunks, and therefore it is no
+  longer safe to read them via `MaybeUninit::assume_init`. See also the note
+  about bump direction in the "changed" section; if you're iterating chunks,
+  you're likely affected by that change!
+
+* The `std` cargo feature has been removed, since this crate is now always
+  no-std.
+
+## Fixed
+
+* Fixed a bug involving potential integer overflows with large requested
+  allocation sizes.
+
+--------------------------------------------------------------------------------
+
+# 2.6.0
+
+Released 2019-08-19.
+
+* Implement `Send` for `Bump`.
+
+--------------------------------------------------------------------------------
+
+# 2.5.0
+
+Released 2019-07-01.
+
+* Add `alloc_slice_copy` and `alloc_slice_clone` methods that allocate space for
+  slices and either copy (with bound `T: Copy`) or clone (with bound `T: Clone`)
+  the provided slice's data into the newly allocated space.
+
+--------------------------------------------------------------------------------
+
+# 2.4.3
+
+Released 2019-05-20.
+
+* Fixed a bug where chunks were always deallocated with the default chunk
+  layout, not the layout that the chunk was actually allocated with (i.e. if we
+  started growing largers chunks with larger layouts, we would deallocate those
+  chunks with an incorrect layout).
+
+--------------------------------------------------------------------------------
+
+# 2.4.2
+
+Released 2019-05-17.
+
+* Added an implementation `Default` for `Bump`.
+* Made it so that if bump allocation within a chunk overflows, we still try to
+  allocate a new chunk to bump out of for the requested allocation. This can
+  avoid some OOMs in scenarios where the chunk we are currently allocating out
+  of is very near the high end of the address space, and there is still
+  available address space lower down for new chunks.
+
+--------------------------------------------------------------------------------
+
+# 2.4.1
+
+Released 2019-04-19.
+
+* Added readme metadata to Cargo.toml so it shows up on crates.io
+
+--------------------------------------------------------------------------------
+
+# 2.4.0
+
+Released 2019-04-19.
+
+* Added support for `realloc`ing in-place when the pointer being `realloc`ed is
+  the last allocation made from the bump arena. This should speed up various
+  `String`, `Vec`, and `format!` operations in many cases.
+
+--------------------------------------------------------------------------------
+
+# 2.3.0
+
+Released 2019-03-26.
+
+* Add the `alloc_with` method, that (usually) avoids stack-allocating the
+  allocated value and then moving it into the bump arena. This avoids potential
+  stack overflows in release mode when allocating very large objects, and also
+  some `memcpy` calls. This is similar to the `copyless` crate. Read [the
+  `alloc_with` doc comments][alloc-with-doc-comments] and [the original issue
+  proposing this API][issue-proposing-alloc-with] for more.
+
+[alloc-with-doc-comments]: https://github.com/fitzgen/bumpalo/blob/9f47aee8a6839ba65c073b9ad5372aacbbd02352/src/lib.rs#L436-L475
+[issue-proposing-alloc-with]: https://github.com/fitzgen/bumpalo/issues/10
+
+--------------------------------------------------------------------------------
+
+# 2.2.2
+
+Released 2019-03-18.
+
+* Fix a regression from 2.2.1 where chunks were not always aligned to the chunk
+  footer's alignment.
+
+--------------------------------------------------------------------------------
+
+# 2.2.1
+
+Released 2019-03-18.
+
+* Fix a regression in 2.2.0 where newly allocated bump chunks could fail to have
+  capacity for a large requested bump allocation in some corner cases.
+
+--------------------------------------------------------------------------------
+
+# 2.2.0
+
+Released 2019-03-15.
+
+* Chunks in an arena now start out small, and double in size as more chunks are
+  requested.
+
+--------------------------------------------------------------------------------
+
+# 2.1.0
+
+Released 2019-02-12.
+
+* Added the `into_bump_slice` method on `bumpalo::collections::Vec<T>`.
+
+--------------------------------------------------------------------------------
+
+# 2.0.0
+
+Released 2019-02-11.
+
+* Removed the `BumpAllocSafe` trait.
+* Correctly detect overflows from large allocations and panic.
+
+--------------------------------------------------------------------------------
+
+# 1.2.0
+
+Released 2019-01-15.
+
+* Fixed an overly-aggressive `debug_assert!` that had false positives.
+* Ported to Rust 2018 edition.
+
+--------------------------------------------------------------------------------
+
+# 1.1.0
+
+Released 2018-11-28.
+
+* Added the `collections` module, which contains ports of `std`'s collection
+  types that are compatible with backing their storage in `Bump` arenas.
+* Lifted the limits on size and alignment of allocations.
+
+--------------------------------------------------------------------------------
+
+# 1.0.2
+
+--------------------------------------------------------------------------------
+
+# 1.0.1
+
+--------------------------------------------------------------------------------
+
+# 1.0.0
diff --git a/android/vendor/bumpalo-3.10.0/Cargo.toml b/android/vendor/bumpalo-3.10.0/Cargo.toml
new file mode 100644
index 0000000..50cbc50
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/Cargo.toml
@@ -0,0 +1,66 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "bumpalo"
+version = "3.10.0"
+authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
+exclude = [
+    "/.github/*",
+    "/benches",
+    "/tests",
+    "valgrind.supp",
+    "bumpalo.png",
+]
+description = "A fast bump allocation arena for Rust."
+documentation = "https://docs.rs/bumpalo"
+readme = "README.md"
+categories = [
+    "memory-management",
+    "rust-patterns",
+    "no-std",
+]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/fitzgen/bumpalo"
+
+[package.metadata.docs.rs]
+all-features = true
+
+[lib]
+path = "src/lib.rs"
+bench = false
+
+[[test]]
+name = "try_alloc"
+path = "tests/try_alloc.rs"
+harness = false
+
+[[bench]]
+name = "benches"
+path = "benches/benches.rs"
+harness = false
+required-features = ["collections"]
+
+[dev-dependencies.criterion]
+version = "0.3.0"
+
+[dev-dependencies.quickcheck]
+version = "0.9.0"
+
+[dev-dependencies.rand]
+version = "0.7"
+
+[features]
+allocator_api = []
+boxed = []
+collections = []
+default = []
diff --git a/android/vendor/bumpalo-3.10.0/LICENSE-APACHE b/android/vendor/bumpalo-3.10.0/LICENSE-APACHE
new file mode 100644
index 0000000..16fe87b
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/bumpalo-3.10.0/LICENSE-MIT b/android/vendor/bumpalo-3.10.0/LICENSE-MIT
new file mode 100644
index 0000000..bac6fb9
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2019 Nick Fitzgerald
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/bumpalo-3.10.0/README.md b/android/vendor/bumpalo-3.10.0/README.md
new file mode 100644
index 0000000..9a69bdb
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/README.md
@@ -0,0 +1,214 @@
+# `bumpalo`
+
+**A fast bump allocation arena for Rust.**
+
+[![](https://docs.rs/bumpalo/badge.svg)](https://docs.rs/bumpalo/)
+[![](https://img.shields.io/crates/v/bumpalo.svg)](https://crates.io/crates/bumpalo)
+[![](https://img.shields.io/crates/d/bumpalo.svg)](https://crates.io/crates/bumpalo)
+[![Build Status](https://github.com/fitzgen/bumpalo/workflows/Rust/badge.svg)](https://github.com/fitzgen/bumpalo/actions?query=workflow%3ARust)
+
+![](https://github.com/fitzgen/bumpalo/raw/main/bumpalo.png)
+
+### Bump Allocation
+
+Bump allocation is a fast, but limited approach to allocation. We have a chunk
+of memory, and we maintain a pointer within that memory. Whenever we allocate an
+object, we do a quick check that we have enough capacity left in our chunk to
+allocate the object and then update the pointer by the object's size. *That's
+it!*
+
+The disadvantage of bump allocation is that there is no general way to
+deallocate individual objects or reclaim the memory region for a
+no-longer-in-use object.
+
+These trade offs make bump allocation well-suited for *phase-oriented*
+allocations. That is, a group of objects that will all be allocated during the
+same program phase, used, and then can all be deallocated together as a group.
+
+### Deallocation en Masse, but no `Drop`
+
+To deallocate all the objects in the arena at once, we can simply reset the bump
+pointer back to the start of the arena's memory chunk. This makes mass
+deallocation *extremely* fast, but allocated objects' [`Drop`] implementations are
+not invoked.
+
+> **However:** [`bumpalo::boxed::Box<T>`][box] can be used to wrap
+> `T` values allocated in the `Bump` arena, and calls `T`'s `Drop`
+> implementation when the `Box<T>` wrapper goes out of scope. This is similar to
+> how [`std::boxed::Box`] works, except without deallocating its backing memory.
+
+[`Drop`]: https://doc.rust-lang.org/std/ops/trait.Drop.html
+[box]: https://docs.rs/bumpalo/latest/bumpalo/boxed/struct.Box.html
+[`std::boxed::Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html
+
+### What happens when the memory chunk is full?
+
+This implementation will allocate a new memory chunk from the global allocator
+and then start bump allocating into this new memory chunk.
+
+### Example
+
+```rust
+use bumpalo::Bump;
+use std::u64;
+
+struct Doggo {
+    cuteness: u64,
+    age: u8,
+    scritches_required: bool,
+}
+
+// Create a new arena to bump allocate into.
+let bump = Bump::new();
+
+// Allocate values into the arena.
+let scooter = bump.alloc(Doggo {
+    cuteness: u64::max_value(),
+    age: 8,
+    scritches_required: true,
+});
+
+// Exclusive, mutable references to the just-allocated value are returned.
+assert!(scooter.scritches_required);
+scooter.age += 1;
+```
+
+### Collections
+
+When the `"collections"` cargo feature is enabled, a fork of some of the `std`
+library's collections are available in the [`collections`] module. These
+collection types are modified to allocate their space inside `bumpalo::Bump`
+arenas.
+
+[`collections`]: https://docs.rs/bumpalo/latest/bumpalo/collections/index.html
+
+```rust
+#[cfg(feature = "collections")]
+{
+    use bumpalo::{Bump, collections::Vec};
+
+    // Create a new bump arena.
+    let bump = Bump::new();
+
+    // Create a vector of integers whose storage is backed by the bump arena. The
+    // vector cannot outlive its backing arena, and this property is enforced with
+    // Rust's lifetime rules.
+    let mut v = Vec::new_in(&bump);
+
+    // Push a bunch of integers onto `v`!
+    for i in 0..100 {
+        v.push(i);
+    }
+}
+```
+
+Eventually [all `std` collection types will be parameterized by an
+allocator](https://github.com/rust-lang/rust/issues/42774) and we can remove
+this `collections` module and use the `std` versions.
+
+For unstable, nightly-only support for custom allocators in `std`, see the
+`allocator_api` section below.
+
+### `bumpalo::boxed::Box`
+
+When the `"boxed"` cargo feature is enabled, a fork of `std::boxed::Box`
+is available in the `boxed` module. This `Box` type is modified to allocate its
+space inside `bumpalo::Bump` arenas.
+
+**A `Box<T>` runs `T`'s drop implementation when the `Box<T>` is dropped.** You
+can use this to work around the fact that `Bump` does not drop values allocated
+in its space itself.
+
+```rust
+#[cfg(feature = "boxed")]
+{
+    use bumpalo::{Bump, boxed::Box};
+    use std::sync::atomic::{AtomicUsize, Ordering};
+
+    static NUM_DROPPED: AtomicUsize = AtomicUsize::new(0);
+
+    struct CountDrops;
+
+    impl Drop for CountDrops {
+        fn drop(&mut self) {
+            NUM_DROPPED.fetch_add(1, Ordering::SeqCst);
+        }
+    }
+
+    // Create a new bump arena.
+    let bump = Bump::new();
+
+    // Create a `CountDrops` inside the bump arena.
+    let mut c = Box::new_in(CountDrops, &bump);
+
+    // No `CountDrops` have been dropped yet.
+    assert_eq!(NUM_DROPPED.load(Ordering::SeqCst), 0);
+
+    // Drop our `Box<CountDrops>`.
+    drop(c);
+
+    // Its `Drop` implementation was run, and so `NUM_DROPS` has been incremented.
+    assert_eq!(NUM_DROPPED.load(Ordering::SeqCst), 1);
+}
+```
+
+### `#![no_std]` Support
+
+Bumpalo is a `no_std` crate. It depends only on the `alloc` and `core` crates.
+
+### Thread support
+
+The `Bump` is `!Sync`, which makes it hard to use in certain situations around threads ‒ for
+example in `rayon`.
+
+The [`bumpalo-herd`](https://crates.io/crates/bumpalo-herd) crate provides a pool of `Bump`
+allocators for use in such situations.
+
+### Nightly Rust `allocator_api` Support
+
+The unstable, nightly-only Rust `allocator_api` feature defines an [`Allocator`]
+trait and exposes custom allocators for `std` types. Bumpalo has a matching
+`allocator_api` cargo feature to enable implementing `Allocator` and using
+`Bump` with `std` collections. Note that, as `feature(allocator_api)` is
+unstable and only in nightly Rust, Bumpalo's matching `allocator_api` cargo
+feature should be considered unstable, and will not follow the semver
+conventions that the rest of the crate does.
+
+First, enable the `allocator_api` feature in your `Cargo.toml`:
+
+```toml
+[dependencies]
+bumpalo = { version = "3.9", features = ["allocator_api"] }
+```
+
+Next, enable the `allocator_api` nightly Rust feature in your `src/lib.rs` or `src/main.rs`:
+
+```rust,ignore
+#![feature(allocator_api)]
+```
+
+Finally, use `std` collections with `Bump`, so that their internal heap
+allocations are made within the given bump arena:
+
+```rust,ignore
+use bumpalo::Bump;
+
+// Create a new bump arena.
+let bump = Bump::new();
+
+// Create a `Vec` whose elements are allocated within the bump arena.
+let mut v = Vec::new_in(&bump);
+v.push(0);
+v.push(1);
+v.push(2);
+```
+
+[`Allocator`]: https://doc.rust-lang.org/std/alloc/trait.Allocator.html
+
+#### Minimum Supported Rust Version (MSRV)
+
+This crate is guaranteed to compile on stable Rust **1.54** and up. It might
+compile with older versions but that may change in any new patch release.
+
+We reserve the right to increment the MSRV on minor releases, however we will strive
+to only do it deliberately and for good reasons.
diff --git a/android/vendor/bumpalo-3.10.0/src/alloc.rs b/android/vendor/bumpalo-3.10.0/src/alloc.rs
new file mode 100644
index 0000000..0bcc21f
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/alloc.rs
@@ -0,0 +1,794 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(unstable_name_collisions)]
+#![allow(dead_code)]
+#![allow(deprecated)]
+
+//! Memory allocation APIs
+
+use core::cmp;
+use core::fmt;
+use core::mem;
+use core::ptr::{self, NonNull};
+use core::usize;
+
+pub use core::alloc::{Layout, LayoutErr};
+
+fn new_layout_err() -> LayoutErr {
+    Layout::from_size_align(1, 3).unwrap_err()
+}
+
+pub fn handle_alloc_error(layout: Layout) -> ! {
+    panic!("encountered allocation error: {:?}", layout)
+}
+
+pub trait UnstableLayoutMethods {
+    fn padding_needed_for(&self, align: usize) -> usize;
+    fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr>;
+    fn array<T>(n: usize) -> Result<Layout, LayoutErr>;
+}
+
+impl UnstableLayoutMethods for Layout {
+    fn padding_needed_for(&self, align: usize) -> usize {
+        let len = self.size();
+
+        // Rounded up value is:
+        //   len_rounded_up = (len + align - 1) & !(align - 1);
+        // and then we return the padding difference: `len_rounded_up - len`.
+        //
+        // We use modular arithmetic throughout:
+        //
+        // 1. align is guaranteed to be > 0, so align - 1 is always
+        //    valid.
+        //
+        // 2. `len + align - 1` can overflow by at most `align - 1`,
+        //    so the &-mask with `!(align - 1)` will ensure that in the
+        //    case of overflow, `len_rounded_up` will itself be 0.
+        //    Thus the returned padding, when added to `len`, yields 0,
+        //    which trivially satisfies the alignment `align`.
+        //
+        // (Of course, attempts to allocate blocks of memory whose
+        // size and padding overflow in the above manner should cause
+        // the allocator to yield an error anyway.)
+
+        let len_rounded_up = len.wrapping_add(align).wrapping_sub(1) & !align.wrapping_sub(1);
+        len_rounded_up.wrapping_sub(len)
+    }
+
+    fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutErr> {
+        let padded_size = self
+            .size()
+            .checked_add(self.padding_needed_for(self.align()))
+            .ok_or_else(new_layout_err)?;
+        let alloc_size = padded_size.checked_mul(n).ok_or_else(new_layout_err)?;
+
+        unsafe {
+            // self.align is already known to be valid and alloc_size has been
+            // padded already.
+            Ok((
+                Layout::from_size_align_unchecked(alloc_size, self.align()),
+                padded_size,
+            ))
+        }
+    }
+
+    fn array<T>(n: usize) -> Result<Layout, LayoutErr> {
+        Layout::new::<T>().repeat(n).map(|(k, offs)| {
+            debug_assert!(offs == mem::size_of::<T>());
+            k
+        })
+    }
+}
+
+/// Represents the combination of a starting address and
+/// a total capacity of the returned block.
+// #[unstable(feature = "allocator_api", issue = "32838")]
+#[derive(Debug)]
+pub struct Excess(pub NonNull<u8>, pub usize);
+
+fn size_align<T>() -> (usize, usize) {
+    (mem::size_of::<T>(), mem::align_of::<T>())
+}
+
+/// The `AllocErr` error indicates an allocation failure
+/// that may be due to resource exhaustion or to
+/// something wrong when combining the given input arguments with this
+/// allocator.
+// #[unstable(feature = "allocator_api", issue = "32838")]
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub struct AllocErr;
+
+// (we need this for downstream impl of trait Error)
+// #[unstable(feature = "allocator_api", issue = "32838")]
+impl fmt::Display for AllocErr {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str("memory allocation failed")
+    }
+}
+
+/// The `CannotReallocInPlace` error is used when `grow_in_place` or
+/// `shrink_in_place` were unable to reuse the given memory block for
+/// a requested layout.
+// #[unstable(feature = "allocator_api", issue = "32838")]
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub struct CannotReallocInPlace;
+
+// #[unstable(feature = "allocator_api", issue = "32838")]
+impl CannotReallocInPlace {
+    pub fn description(&self) -> &str {
+        "cannot reallocate allocator's memory in place"
+    }
+}
+
+// (we need this for downstream impl of trait Error)
+// #[unstable(feature = "allocator_api", issue = "32838")]
+impl fmt::Display for CannotReallocInPlace {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        write!(f, "{}", self.description())
+    }
+}
+
+/// An implementation of `Alloc` can allocate, reallocate, and
+/// deallocate arbitrary blocks of data described via `Layout`.
+///
+/// Some of the methods require that a memory block be *currently
+/// allocated* via an allocator. This means that:
+///
+/// * the starting address for that memory block was previously
+///   returned by a previous call to an allocation method (`alloc`,
+///   `alloc_zeroed`, `alloc_excess`, `alloc_one`, `alloc_array`) or
+///   reallocation method (`realloc`, `realloc_excess`, or
+///   `realloc_array`), and
+///
+/// * the memory block has not been subsequently deallocated, where
+///   blocks are deallocated either by being passed to a deallocation
+///   method (`dealloc`, `dealloc_one`, `dealloc_array`) or by being
+///   passed to a reallocation method (see above) that returns `Ok`.
+///
+/// A note regarding zero-sized types and zero-sized layouts: many
+/// methods in the `Alloc` trait state that allocation requests
+/// must be non-zero size, or else undefined behavior can result.
+///
+/// * However, some higher-level allocation methods (`alloc_one`,
+///   `alloc_array`) are well-defined on zero-sized types and can
+///   optionally support them: it is left up to the implementor
+///   whether to return `Err`, or to return `Ok` with some pointer.
+///
+/// * If an `Alloc` implementation chooses to return `Ok` in this
+///   case (i.e. the pointer denotes a zero-sized inaccessible block)
+///   then that returned pointer must be considered "currently
+///   allocated". On such an allocator, *all* methods that take
+///   currently-allocated pointers as inputs must accept these
+///   zero-sized pointers, *without* causing undefined behavior.
+///
+/// * In other words, if a zero-sized pointer can flow out of an
+///   allocator, then that allocator must likewise accept that pointer
+///   flowing back into its deallocation and reallocation methods.
+///
+/// Some of the methods require that a layout *fit* a memory block.
+/// What it means for a layout to "fit" a memory block means (or
+/// equivalently, for a memory block to "fit" a layout) is that the
+/// following two conditions must hold:
+///
+/// 1. The block's starting address must be aligned to `layout.align()`.
+///
+/// 2. The block's size must fall in the range `[use_min, use_max]`, where:
+///
+///    * `use_min` is `self.usable_size(layout).0`, and
+///
+///    * `use_max` is the capacity that was (or would have been)
+///      returned when (if) the block was allocated via a call to
+///      `alloc_excess` or `realloc_excess`.
+///
+/// Note that:
+///
+///  * the size of the layout most recently used to allocate the block
+///    is guaranteed to be in the range `[use_min, use_max]`, and
+///
+///  * a lower-bound on `use_max` can be safely approximated by a call to
+///    `usable_size`.
+///
+///  * if a layout `k` fits a memory block (denoted by `ptr`)
+///    currently allocated via an allocator `a`, then it is legal to
+///    use that layout to deallocate it, i.e. `a.dealloc(ptr, k);`.
+///
+/// # Unsafety
+///
+/// The `Alloc` trait is an `unsafe` trait for a number of reasons, and
+/// implementors must ensure that they adhere to these contracts:
+///
+/// * Pointers returned from allocation functions must point to valid memory and
+///   retain their validity until at least the instance of `Alloc` is dropped
+///   itself.
+///
+/// * `Layout` queries and calculations in general must be correct. Callers of
+///   this trait are allowed to rely on the contracts defined on each method,
+///   and implementors must ensure such contracts remain true.
+///
+/// Note that this list may get tweaked over time as clarifications are made in
+/// the future.
+// #[unstable(feature = "allocator_api", issue = "32838")]
+pub unsafe trait Alloc {
+    // (Note: some existing allocators have unspecified but well-defined
+    // behavior in response to a zero size allocation request ;
+    // e.g. in C, `malloc` of 0 will either return a null pointer or a
+    // unique pointer, but will not have arbitrary undefined
+    // behavior.
+    // However in jemalloc for example,
+    // `mallocx(0)` is documented as undefined behavior.)
+
+    /// Returns a pointer meeting the size and alignment guarantees of
+    /// `layout`.
+    ///
+    /// If this method returns an `Ok(addr)`, then the `addr` returned
+    /// will be non-null address pointing to a block of storage
+    /// suitable for holding an instance of `layout`.
+    ///
+    /// The returned block of storage may or may not have its contents
+    /// initialized. (Extension subtraits might restrict this
+    /// behavior, e.g. to ensure initialization to particular sets of
+    /// bit patterns.)
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure that `layout` has non-zero size.
+    ///
+    /// (Extension subtraits might provide more specific bounds on
+    /// behavior, e.g. guarantee a sentinel address or a null pointer
+    /// in response to a zero-size allocation request.)
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `layout` does not meet allocator's size or alignment
+    /// constraints.
+    ///
+    /// Implementations are encouraged to return `Err` on memory
+    /// exhaustion rather than panicking or aborting, but this is not
+    /// a strict requirement. (Specifically: it is *legal* to
+    /// implement this trait atop an underlying native allocation
+    /// library that aborts on memory exhaustion.)
+    ///
+    /// Clients wishing to abort computation in response to an
+    /// allocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr>;
+
+    /// Deallocate the memory referenced by `ptr`.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure all of the following:
+    ///
+    /// * `ptr` must denote a block of memory currently allocated via
+    ///   this allocator,
+    ///
+    /// * `layout` must *fit* that block of memory,
+    ///
+    /// * In addition to fitting the block of memory `layout`, the
+    ///   alignment of the `layout` must match the alignment used
+    ///   to allocate that block of memory.
+    unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout);
+
+    // == ALLOCATOR-SPECIFIC QUANTITIES AND LIMITS ==
+    // usable_size
+
+    /// Returns bounds on the guaranteed usable size of a successful
+    /// allocation created with the specified `layout`.
+    ///
+    /// In particular, if one has a memory block allocated via a given
+    /// allocator `a` and layout `k` where `a.usable_size(k)` returns
+    /// `(l, u)`, then one can pass that block to `a.dealloc()` with a
+    /// layout in the size range [l, u].
+    ///
+    /// (All implementors of `usable_size` must ensure that
+    /// `l <= k.size() <= u`)
+    ///
+    /// Both the lower- and upper-bounds (`l` and `u` respectively)
+    /// are provided, because an allocator based on size classes could
+    /// misbehave if one attempts to deallocate a block without
+    /// providing a correct value for its size (i.e., one within the
+    /// range `[l, u]`).
+    ///
+    /// Clients who wish to make use of excess capacity are encouraged
+    /// to use the `alloc_excess` and `realloc_excess` instead, as
+    /// this method is constrained to report conservative values that
+    /// serve as valid bounds for *all possible* allocation method
+    /// calls.
+    ///
+    /// However, for clients that do not wish to track the capacity
+    /// returned by `alloc_excess` locally, this method is likely to
+    /// produce useful results.
+    #[inline]
+    fn usable_size(&self, layout: &Layout) -> (usize, usize) {
+        (layout.size(), layout.size())
+    }
+
+    // == METHODS FOR MEMORY REUSE ==
+    // realloc. alloc_excess, realloc_excess
+
+    /// Returns a pointer suitable for holding data described by
+    /// a new layout with `layout`’s alignment and a size given
+    /// by `new_size`. To
+    /// accomplish this, this may extend or shrink the allocation
+    /// referenced by `ptr` to fit the new layout.
+    ///
+    /// If this returns `Ok`, then ownership of the memory block
+    /// referenced by `ptr` has been transferred to this
+    /// allocator. The memory may or may not have been freed, and
+    /// should be considered unusable (unless of course it was
+    /// transferred back to the caller again via the return value of
+    /// this method).
+    ///
+    /// If this method returns `Err`, then ownership of the memory
+    /// block has not been transferred to this allocator, and the
+    /// contents of the memory block are unaltered.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure all of the following:
+    ///
+    /// * `ptr` must be currently allocated via this allocator,
+    ///
+    /// * `layout` must *fit* the `ptr` (see above). (The `new_size`
+    ///   argument need not fit it.)
+    ///
+    /// * `new_size` must be greater than zero.
+    ///
+    /// * `new_size`, when rounded up to the nearest multiple of `layout.align()`,
+    ///   must not overflow (i.e. the rounded value must be less than `usize::MAX`).
+    ///
+    /// (Extension subtraits might provide more specific bounds on
+    /// behavior, e.g. guarantee a sentinel address or a null pointer
+    /// in response to a zero-size allocation request.)
+    ///
+    /// # Errors
+    ///
+    /// Returns `Err` only if the new layout
+    /// does not meet the allocator's size
+    /// and alignment constraints of the allocator, or if reallocation
+    /// otherwise fails.
+    ///
+    /// Implementations are encouraged to return `Err` on memory
+    /// exhaustion rather than panicking or aborting, but this is not
+    /// a strict requirement. (Specifically: it is *legal* to
+    /// implement this trait atop an underlying native allocation
+    /// library that aborts on memory exhaustion.)
+    ///
+    /// Clients wishing to abort computation in response to a
+    /// reallocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    unsafe fn realloc(
+        &mut self,
+        ptr: NonNull<u8>,
+        layout: Layout,
+        new_size: usize,
+    ) -> Result<NonNull<u8>, AllocErr> {
+        let old_size = layout.size();
+
+        if new_size >= old_size {
+            if let Ok(()) = self.grow_in_place(ptr, layout, new_size) {
+                return Ok(ptr);
+            }
+        } else if new_size < old_size {
+            if let Ok(()) = self.shrink_in_place(ptr, layout, new_size) {
+                return Ok(ptr);
+            }
+        }
+
+        // otherwise, fall back on alloc + copy + dealloc.
+        let new_layout = Layout::from_size_align_unchecked(new_size, layout.align());
+        let result = self.alloc(new_layout);
+        if let Ok(new_ptr) = result {
+            ptr::copy_nonoverlapping(ptr.as_ptr(), new_ptr.as_ptr(), cmp::min(old_size, new_size));
+            self.dealloc(ptr, layout);
+        }
+        result
+    }
+
+    /// Behaves like `alloc`, but also ensures that the contents
+    /// are set to zero before being returned.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe for the same reasons that `alloc` is.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `layout` does not meet allocator's size or alignment
+    /// constraints, just as in `alloc`.
+    ///
+    /// Clients wishing to abort computation in response to an
+    /// allocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
+        let size = layout.size();
+        let p = self.alloc(layout);
+        if let Ok(p) = p {
+            ptr::write_bytes(p.as_ptr(), 0, size);
+        }
+        p
+    }
+
+    /// Behaves like `alloc`, but also returns the whole size of
+    /// the returned block. For some `layout` inputs, like arrays, this
+    /// may include extra storage usable for additional data.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe for the same reasons that `alloc` is.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `layout` does not meet allocator's size or alignment
+    /// constraints, just as in `alloc`.
+    ///
+    /// Clients wishing to abort computation in response to an
+    /// allocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    unsafe fn alloc_excess(&mut self, layout: Layout) -> Result<Excess, AllocErr> {
+        let usable_size = self.usable_size(&layout);
+        self.alloc(layout).map(|p| Excess(p, usable_size.1))
+    }
+
+    /// Behaves like `realloc`, but also returns the whole size of
+    /// the returned block. For some `layout` inputs, like arrays, this
+    /// may include extra storage usable for additional data.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe for the same reasons that `realloc` is.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `layout` does not meet allocator's size or alignment
+    /// constraints, just as in `realloc`.
+    ///
+    /// Clients wishing to abort computation in response to a
+    /// reallocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    unsafe fn realloc_excess(
+        &mut self,
+        ptr: NonNull<u8>,
+        layout: Layout,
+        new_size: usize,
+    ) -> Result<Excess, AllocErr> {
+        let new_layout = Layout::from_size_align_unchecked(new_size, layout.align());
+        let usable_size = self.usable_size(&new_layout);
+        self.realloc(ptr, layout, new_size)
+            .map(|p| Excess(p, usable_size.1))
+    }
+
+    /// Attempts to extend the allocation referenced by `ptr` to fit `new_size`.
+    ///
+    /// If this returns `Ok`, then the allocator has asserted that the
+    /// memory block referenced by `ptr` now fits `new_size`, and thus can
+    /// be used to carry data of a layout of that size and same alignment as
+    /// `layout`. (The allocator is allowed to
+    /// expend effort to accomplish this, such as extending the memory block to
+    /// include successor blocks, or virtual memory tricks.)
+    ///
+    /// Regardless of what this method returns, ownership of the
+    /// memory block referenced by `ptr` has not been transferred, and
+    /// the contents of the memory block are unaltered.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure all of the following:
+    ///
+    /// * `ptr` must be currently allocated via this allocator,
+    ///
+    /// * `layout` must *fit* the `ptr` (see above); note the
+    ///   `new_size` argument need not fit it,
+    ///
+    /// * `new_size` must not be less than `layout.size()`,
+    ///
+    /// # Errors
+    ///
+    /// Returns `Err(CannotReallocInPlace)` when the allocator is
+    /// unable to assert that the memory block referenced by `ptr`
+    /// could fit `layout`.
+    ///
+    /// Note that one cannot pass `CannotReallocInPlace` to the `handle_alloc_error`
+    /// function; clients are expected either to be able to recover from
+    /// `grow_in_place` failures without aborting, or to fall back on
+    /// another reallocation method before resorting to an abort.
+    unsafe fn grow_in_place(
+        &mut self,
+        ptr: NonNull<u8>,
+        layout: Layout,
+        new_size: usize,
+    ) -> Result<(), CannotReallocInPlace> {
+        let _ = ptr; // this default implementation doesn't care about the actual address.
+        debug_assert!(new_size >= layout.size());
+        let (_l, u) = self.usable_size(&layout);
+        // _l <= layout.size()                       [guaranteed by usable_size()]
+        //       layout.size() <= new_layout.size()  [required by this method]
+        if new_size <= u {
+            Ok(())
+        } else {
+            Err(CannotReallocInPlace)
+        }
+    }
+
+    /// Attempts to shrink the allocation referenced by `ptr` to fit `new_size`.
+    ///
+    /// If this returns `Ok`, then the allocator has asserted that the
+    /// memory block referenced by `ptr` now fits `new_size`, and
+    /// thus can only be used to carry data of that smaller
+    /// layout. (The allocator is allowed to take advantage of this,
+    /// carving off portions of the block for reuse elsewhere.) The
+    /// truncated contents of the block within the smaller layout are
+    /// unaltered, and ownership of block has not been transferred.
+    ///
+    /// If this returns `Err`, then the memory block is considered to
+    /// still represent the original (larger) `layout`. None of the
+    /// block has been carved off for reuse elsewhere, ownership of
+    /// the memory block has not been transferred, and the contents of
+    /// the memory block are unaltered.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure all of the following:
+    ///
+    /// * `ptr` must be currently allocated via this allocator,
+    ///
+    /// * `layout` must *fit* the `ptr` (see above); note the
+    ///   `new_size` argument need not fit it,
+    ///
+    /// * `new_size` must not be greater than `layout.size()`
+    ///   (and must be greater than zero),
+    ///
+    /// # Errors
+    ///
+    /// Returns `Err(CannotReallocInPlace)` when the allocator is
+    /// unable to assert that the memory block referenced by `ptr`
+    /// could fit `layout`.
+    ///
+    /// Note that one cannot pass `CannotReallocInPlace` to the `handle_alloc_error`
+    /// function; clients are expected either to be able to recover from
+    /// `shrink_in_place` failures without aborting, or to fall back
+    /// on another reallocation method before resorting to an abort.
+    unsafe fn shrink_in_place(
+        &mut self,
+        ptr: NonNull<u8>,
+        layout: Layout,
+        new_size: usize,
+    ) -> Result<(), CannotReallocInPlace> {
+        let _ = ptr; // this default implementation doesn't care about the actual address.
+        debug_assert!(new_size <= layout.size());
+        let (l, _u) = self.usable_size(&layout);
+        //                      layout.size() <= _u  [guaranteed by usable_size()]
+        // new_layout.size() <= layout.size()        [required by this method]
+        if l <= new_size {
+            Ok(())
+        } else {
+            Err(CannotReallocInPlace)
+        }
+    }
+
+    // == COMMON USAGE PATTERNS ==
+    // alloc_one, dealloc_one, alloc_array, realloc_array. dealloc_array
+
+    /// Allocates a block suitable for holding an instance of `T`.
+    ///
+    /// Captures a common usage pattern for allocators.
+    ///
+    /// The returned block is suitable for passing to the
+    /// `alloc`/`realloc` methods of this allocator.
+    ///
+    /// Note to implementors: If this returns `Ok(ptr)`, then `ptr`
+    /// must be considered "currently allocated" and must be
+    /// acceptable input to methods such as `realloc` or `dealloc`,
+    /// *even if* `T` is a zero-sized type. In other words, if your
+    /// `Alloc` implementation overrides this method in a manner
+    /// that can return a zero-sized `ptr`, then all reallocation and
+    /// deallocation methods need to be similarly overridden to accept
+    /// such values as input.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `T` does not meet allocator's size or alignment constraints.
+    ///
+    /// For zero-sized `T`, may return either of `Ok` or `Err`, but
+    /// will *not* yield undefined behavior.
+    ///
+    /// Clients wishing to abort computation in response to an
+    /// allocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    fn alloc_one<T>(&mut self) -> Result<NonNull<T>, AllocErr>
+    where
+        Self: Sized,
+    {
+        let k = Layout::new::<T>();
+        if k.size() > 0 {
+            unsafe { self.alloc(k).map(|p| p.cast()) }
+        } else {
+            Err(AllocErr)
+        }
+    }
+
+    /// Deallocates a block suitable for holding an instance of `T`.
+    ///
+    /// The given block must have been produced by this allocator,
+    /// and must be suitable for storing a `T` (in terms of alignment
+    /// as well as minimum and maximum size); otherwise yields
+    /// undefined behavior.
+    ///
+    /// Captures a common usage pattern for allocators.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure both:
+    ///
+    /// * `ptr` must denote a block of memory currently allocated via this allocator
+    ///
+    /// * the layout of `T` must *fit* that block of memory.
+    unsafe fn dealloc_one<T>(&mut self, ptr: NonNull<T>)
+    where
+        Self: Sized,
+    {
+        let k = Layout::new::<T>();
+        if k.size() > 0 {
+            self.dealloc(ptr.cast(), k);
+        }
+    }
+
+    /// Allocates a block suitable for holding `n` instances of `T`.
+    ///
+    /// Captures a common usage pattern for allocators.
+    ///
+    /// The returned block is suitable for passing to the
+    /// `alloc`/`realloc` methods of this allocator.
+    ///
+    /// Note to implementors: If this returns `Ok(ptr)`, then `ptr`
+    /// must be considered "currently allocated" and must be
+    /// acceptable input to methods such as `realloc` or `dealloc`,
+    /// *even if* `T` is a zero-sized type. In other words, if your
+    /// `Alloc` implementation overrides this method in a manner
+    /// that can return a zero-sized `ptr`, then all reallocation and
+    /// deallocation methods need to be similarly overridden to accept
+    /// such values as input.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `[T; n]` does not meet allocator's size or alignment
+    /// constraints.
+    ///
+    /// For zero-sized `T` or `n == 0`, may return either of `Ok` or
+    /// `Err`, but will *not* yield undefined behavior.
+    ///
+    /// Always returns `Err` on arithmetic overflow.
+    ///
+    /// Clients wishing to abort computation in response to an
+    /// allocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    fn alloc_array<T>(&mut self, n: usize) -> Result<NonNull<T>, AllocErr>
+    where
+        Self: Sized,
+    {
+        match Layout::array::<T>(n) {
+            Ok(layout) if layout.size() > 0 => unsafe { self.alloc(layout).map(|p| p.cast()) },
+            _ => Err(AllocErr),
+        }
+    }
+
+    /// Reallocates a block previously suitable for holding `n_old`
+    /// instances of `T`, returning a block suitable for holding
+    /// `n_new` instances of `T`.
+    ///
+    /// Captures a common usage pattern for allocators.
+    ///
+    /// The returned block is suitable for passing to the
+    /// `alloc`/`realloc` methods of this allocator.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure all of the following:
+    ///
+    /// * `ptr` must be currently allocated via this allocator,
+    ///
+    /// * the layout of `[T; n_old]` must *fit* that block of memory.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either memory is exhausted or
+    /// `[T; n_new]` does not meet allocator's size or alignment
+    /// constraints.
+    ///
+    /// For zero-sized `T` or `n_new == 0`, may return either of `Ok` or
+    /// `Err`, but will *not* yield undefined behavior.
+    ///
+    /// Always returns `Err` on arithmetic overflow.
+    ///
+    /// Clients wishing to abort computation in response to a
+    /// reallocation error are encouraged to call the [`handle_alloc_error`] function,
+    /// rather than directly invoking `panic!` or similar.
+    ///
+    /// [`handle_alloc_error`]: ../../alloc/alloc/fn.handle_alloc_error.html
+    unsafe fn realloc_array<T>(
+        &mut self,
+        ptr: NonNull<T>,
+        n_old: usize,
+        n_new: usize,
+    ) -> Result<NonNull<T>, AllocErr>
+    where
+        Self: Sized,
+    {
+        match (Layout::array::<T>(n_old), Layout::array::<T>(n_new)) {
+            (Ok(ref k_old), Ok(ref k_new)) if k_old.size() > 0 && k_new.size() > 0 => {
+                debug_assert!(k_old.align() == k_new.align());
+                self.realloc(ptr.cast(), k_old.clone(), k_new.size())
+                    .map(NonNull::cast)
+            }
+            _ => Err(AllocErr),
+        }
+    }
+
+    /// Deallocates a block suitable for holding `n` instances of `T`.
+    ///
+    /// Captures a common usage pattern for allocators.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because undefined behavior can result
+    /// if the caller does not ensure both:
+    ///
+    /// * `ptr` must denote a block of memory currently allocated via this allocator
+    ///
+    /// * the layout of `[T; n]` must *fit* that block of memory.
+    ///
+    /// # Errors
+    ///
+    /// Returning `Err` indicates that either `[T; n]` or the given
+    /// memory block does not meet allocator's size or alignment
+    /// constraints.
+    ///
+    /// Always returns `Err` on arithmetic overflow.
+    unsafe fn dealloc_array<T>(&mut self, ptr: NonNull<T>, n: usize) -> Result<(), AllocErr>
+    where
+        Self: Sized,
+    {
+        match Layout::array::<T>(n) {
+            Ok(k) if k.size() > 0 => {
+                self.dealloc(ptr.cast(), k);
+                Ok(())
+            }
+            _ => Err(AllocErr),
+        }
+    }
+}
diff --git a/android/vendor/bumpalo-3.10.0/src/boxed.rs b/android/vendor/bumpalo-3.10.0/src/boxed.rs
new file mode 100644
index 0000000..63e693e
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/boxed.rs
@@ -0,0 +1,666 @@
+//! A pointer type for bump allocation.
+//!
+//! [`Box<'a, T>`] provides the simplest form of
+//! bump allocation in `bumpalo`. Boxes provide ownership for this allocation, and
+//! drop their contents when they go out of scope.
+//!
+//! # Examples
+//!
+//! Move a value from the stack to the heap by creating a [`Box`]:
+//!
+//! ```
+//! use bumpalo::{Bump, boxed::Box};
+//!
+//! let b = Bump::new();
+//!
+//! let val: u8 = 5;
+//! let boxed: Box<u8> = Box::new_in(val, &b);
+//! ```
+//!
+//! Move a value from a [`Box`] back to the stack by [dereferencing]:
+//!
+//! ```
+//! use bumpalo::{Bump, boxed::Box};
+//!
+//! let b = Bump::new();
+//!
+//! let boxed: Box<u8> = Box::new_in(5, &b);
+//! let val: u8 = *boxed;
+//! ```
+//!
+//! Running [`Drop`] implementations on bump-allocated values:
+//!
+//! ```
+//! use bumpalo::{Bump, boxed::Box};
+//! use std::sync::atomic::{AtomicUsize, Ordering};
+//!
+//! static NUM_DROPPED: AtomicUsize = AtomicUsize::new(0);
+//!
+//! struct CountDrops;
+//!
+//! impl Drop for CountDrops {
+//!     fn drop(&mut self) {
+//!         NUM_DROPPED.fetch_add(1, Ordering::SeqCst);
+//!     }
+//! }
+//!
+//! // Create a new bump arena.
+//! let bump = Bump::new();
+//!
+//! // Create a `CountDrops` inside the bump arena.
+//! let mut c = Box::new_in(CountDrops, &bump);
+//!
+//! // No `CountDrops` have been dropped yet.
+//! assert_eq!(NUM_DROPPED.load(Ordering::SeqCst), 0);
+//!
+//! // Drop our `Box<CountDrops>`.
+//! drop(c);
+//!
+//! // Its `Drop` implementation was run, and so `NUM_DROPS` has been incremented.
+//! assert_eq!(NUM_DROPPED.load(Ordering::SeqCst), 1);
+//! ```
+//!
+//! Creating a recursive data structure:
+//!
+//! ```
+//! use bumpalo::{Bump, boxed::Box};
+//!
+//! let b = Bump::new();
+//!
+//! #[derive(Debug)]
+//! enum List<'a, T> {
+//!     Cons(T, Box<'a, List<'a, T>>),
+//!     Nil,
+//! }
+//!
+//! let list: List<i32> = List::Cons(1, Box::new_in(List::Cons(2, Box::new_in(List::Nil, &b)), &b));
+//! println!("{:?}", list);
+//! ```
+//!
+//! This will print `Cons(1, Cons(2, Nil))`.
+//!
+//! Recursive structures must be boxed, because if the definition of `Cons`
+//! looked like this:
+//!
+//! ```compile_fail,E0072
+//! # enum List<T> {
+//! Cons(T, List<T>),
+//! # }
+//! ```
+//!
+//! It wouldn't work. This is because the size of a `List` depends on how many
+//! elements are in the list, and so we don't know how much memory to allocate
+//! for a `Cons`. By introducing a [`Box<'a, T>`], which has a defined size, we know how
+//! big `Cons` needs to be.
+//!
+//! # Memory layout
+//!
+//! For non-zero-sized values, a [`Box`] will use the provided [`Bump`] allocator for
+//! its allocation. It is valid to convert both ways between a [`Box`] and a
+//! pointer allocated with the [`Bump`] allocator, given that the
+//! [`Layout`] used with the allocator is correct for the type. More precisely,
+//! a `value: *mut T` that has been allocated with the [`Bump`] allocator
+//! with `Layout::for_value(&*value)` may be converted into a box using
+//! [`Box::<T>::from_raw(value)`]. Conversely, the memory backing a `value: *mut
+//! T` obtained from [`Box::<T>::into_raw`] will be deallocated by the
+//! [`Bump`] allocator with [`Layout::for_value(&*value)`].
+//!
+//! Note that roundtrip `Box::from_raw(Box::into_raw(b))` looses the lifetime bound to the
+//! [`Bump`] immutable borrow which guarantees that the allocator will not be reset
+//! and memory will not be freed.
+//!
+//! [dereferencing]: https://doc.rust-lang.org/std/ops/trait.Deref.html
+//! [`Box`]: struct.Box.html
+//! [`Box<'a, T>`]: struct.Box.html
+//! [`Box::<T>::from_raw(value)`]: struct.Box.html#method.from_raw
+//! [`Box::<T>::into_raw`]: struct.Box.html#method.into_raw
+//! [`Bump`]: ../struct.Bump.html
+//! [`Drop`]: https://doc.rust-lang.org/std/ops/trait.Drop.html
+//! [`Layout`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html
+//! [`Layout::for_value(&*value)`]: https://doc.rust-lang.org/std/alloc/struct.Layout.html#method.for_value
+
+use {
+    crate::Bump,
+    {
+        core::{
+            any::Any,
+            borrow,
+            cmp::Ordering,
+            convert::TryFrom,
+            future::Future,
+            hash::{Hash, Hasher},
+            iter::FusedIterator,
+            mem,
+            ops::{Deref, DerefMut},
+            pin::Pin,
+            task::{Context, Poll},
+        },
+        core_alloc::fmt,
+    },
+};
+
+/// An owned pointer to a bump-allocated `T` value, that runs `Drop`
+/// implementations.
+///
+/// See the [module-level documentation][crate::boxed] for more details.
+#[repr(transparent)]
+pub struct Box<'a, T: ?Sized>(&'a mut T);
+
+impl<'a, T> Box<'a, T> {
+    /// Allocates memory on the heap and then places `x` into it.
+    ///
+    /// This doesn't actually allocate if `T` is zero-sized.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, boxed::Box};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let five = Box::new_in(5, &b);
+    /// ```
+    #[inline(always)]
+    pub fn new_in(x: T, a: &'a Bump) -> Box<'a, T> {
+        Box(a.alloc(x))
+    }
+
+    /// Constructs a new `Pin<Box<T>>`. If `T` does not implement `Unpin`, then
+    /// `x` will be pinned in memory and unable to be moved.
+    #[inline(always)]
+    pub fn pin_in(x: T, a: &'a Bump) -> Pin<Box<'a, T>> {
+        Box(a.alloc(x)).into()
+    }
+}
+
+impl<'a, T: ?Sized> Box<'a, T> {
+    /// Constructs a box from a raw pointer.
+    ///
+    /// After calling this function, the raw pointer is owned by the
+    /// resulting `Box`. Specifically, the `Box` destructor will call
+    /// the destructor of `T` and free the allocated memory. For this
+    /// to be safe, the memory must have been allocated in accordance
+    /// with the memory layout used by `Box` .
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because improper use may lead to
+    /// memory problems. For example, a double-free may occur if the
+    /// function is called twice on the same raw pointer.
+    ///
+    /// # Examples
+    ///
+    /// Recreate a `Box` which was previously converted to a raw pointer
+    /// using [`Box::into_raw`]:
+    /// ```
+    /// use bumpalo::{Bump, boxed::Box};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let x = Box::new_in(5, &b);
+    /// let ptr = Box::into_raw(x);
+    /// let x = unsafe { Box::from_raw(ptr) }; // Note that new `x`'s lifetime is unbound. It must be bound to the `b` immutable borrow before `b` is reset.
+    /// ```
+    /// Manually create a `Box` from scratch by using the bump allocator:
+    /// ```
+    /// use std::alloc::{alloc, Layout};
+    /// use bumpalo::{Bump, boxed::Box};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// unsafe {
+    ///     let ptr = b.alloc_layout(Layout::new::<i32>()).as_ptr() as *mut i32;
+    ///     *ptr = 5;
+    ///     let x = Box::from_raw(ptr); // Note that `x`'s lifetime is unbound. It must be bound to the `b` immutable borrow before `b` is reset.
+    /// }
+    /// ```
+    #[inline]
+    pub unsafe fn from_raw(raw: *mut T) -> Self {
+        Box(&mut *raw)
+    }
+
+    /// Consumes the `Box`, returning a wrapped raw pointer.
+    ///
+    /// The pointer will be properly aligned and non-null.
+    ///
+    /// After calling this function, the caller is responsible for the
+    /// value previously managed by the `Box`. In particular, the
+    /// caller should properly destroy `T`. The easiest way to
+    /// do this is to convert the raw pointer back into a `Box` with the
+    /// [`Box::from_raw`] function, allowing the `Box` destructor to perform
+    /// the cleanup.
+    ///
+    /// Note: this is an associated function, which means that you have
+    /// to call it as `Box::into_raw(b)` instead of `b.into_raw()`. This
+    /// is so that there is no conflict with a method on the inner type.
+    ///
+    /// # Examples
+    ///
+    /// Converting the raw pointer back into a `Box` with [`Box::from_raw`]
+    /// for automatic cleanup:
+    /// ```
+    /// use bumpalo::{Bump, boxed::Box};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let x = Box::new_in(String::from("Hello"), &b);
+    /// let ptr = Box::into_raw(x);
+    /// let x = unsafe { Box::from_raw(ptr) }; // Note that new `x`'s lifetime is unbound. It must be bound to the `b` immutable borrow before `b` is reset.
+    /// ```
+    /// Manual cleanup by explicitly running the destructor:
+    /// ```
+    /// use std::ptr;
+    /// use bumpalo::{Bump, boxed::Box};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut x = Box::new_in(String::from("Hello"), &b);
+    /// let p = Box::into_raw(x);
+    /// unsafe {
+    ///     ptr::drop_in_place(p);
+    /// }
+    /// ```
+    #[inline]
+    pub fn into_raw(b: Box<'a, T>) -> *mut T {
+        let ptr = b.0 as *mut T;
+        mem::forget(b);
+        ptr
+    }
+
+    /// Consumes and leaks the `Box`, returning a mutable reference,
+    /// `&'a mut T`. Note that the type `T` must outlive the chosen lifetime
+    /// `'a`. If the type has only static references, or none at all, then this
+    /// may be chosen to be `'static`.
+    ///
+    /// This function is mainly useful for data that lives for the remainder of
+    /// the program's life. Dropping the returned reference will cause a memory
+    /// leak. If this is not acceptable, the reference should first be wrapped
+    /// with the [`Box::from_raw`] function producing a `Box`. This `Box` can
+    /// then be dropped which will properly destroy `T` and release the
+    /// allocated memory.
+    ///
+    /// Note: this is an associated function, which means that you have
+    /// to call it as `Box::leak(b)` instead of `b.leak()`. This
+    /// is so that there is no conflict with a method on the inner type.
+    ///
+    /// # Examples
+    ///
+    /// Simple usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, boxed::Box};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let x = Box::new_in(41, &b);
+    /// let reference: &mut usize = Box::leak(x);
+    /// *reference += 1;
+    /// assert_eq!(*reference, 42);
+    /// ```
+    ///
+    ///```
+    /// # #[cfg(feature = "collections")]
+    /// # {
+    /// use bumpalo::{Bump, boxed::Box, vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let x = vec![in &b; 1, 2, 3].into_boxed_slice();
+    /// let reference = Box::leak(x);
+    /// reference[0] = 4;
+    /// assert_eq!(*reference, [4, 2, 3]);
+    /// # }
+    ///```
+    #[inline]
+    pub fn leak(b: Box<'a, T>) -> &'a mut T {
+        unsafe { &mut *Box::into_raw(b) }
+    }
+}
+
+impl<'a, T: ?Sized> Drop for Box<'a, T> {
+    fn drop(&mut self) {
+        unsafe {
+            // `Box` owns value of `T`, but not memory behind it.
+            core::ptr::drop_in_place(self.0);
+        }
+    }
+}
+
+impl<'a, T> Default for Box<'a, [T]> {
+    fn default() -> Box<'a, [T]> {
+        // It should be OK to `drop_in_place` empty slice of anything.
+        Box(&mut [])
+    }
+}
+
+impl<'a> Default for Box<'a, str> {
+    fn default() -> Box<'a, str> {
+        // Empty slice is valid string.
+        // It should be OK to `drop_in_place` empty str.
+        unsafe { Box::from_raw(Box::into_raw(Box::<[u8]>::default()) as *mut str) }
+    }
+}
+
+impl<'a, 'b, T: ?Sized + PartialEq> PartialEq<Box<'b, T>> for Box<'a, T> {
+    #[inline]
+    fn eq(&self, other: &Box<'b, T>) -> bool {
+        PartialEq::eq(&**self, &**other)
+    }
+    #[inline]
+    fn ne(&self, other: &Box<'b, T>) -> bool {
+        PartialEq::ne(&**self, &**other)
+    }
+}
+
+impl<'a, 'b, T: ?Sized + PartialOrd> PartialOrd<Box<'b, T>> for Box<'a, T> {
+    #[inline]
+    fn partial_cmp(&self, other: &Box<'b, T>) -> Option<Ordering> {
+        PartialOrd::partial_cmp(&**self, &**other)
+    }
+    #[inline]
+    fn lt(&self, other: &Box<'b, T>) -> bool {
+        PartialOrd::lt(&**self, &**other)
+    }
+    #[inline]
+    fn le(&self, other: &Box<'b, T>) -> bool {
+        PartialOrd::le(&**self, &**other)
+    }
+    #[inline]
+    fn ge(&self, other: &Box<'b, T>) -> bool {
+        PartialOrd::ge(&**self, &**other)
+    }
+    #[inline]
+    fn gt(&self, other: &Box<'b, T>) -> bool {
+        PartialOrd::gt(&**self, &**other)
+    }
+}
+
+impl<'a, T: ?Sized + Ord> Ord for Box<'a, T> {
+    #[inline]
+    fn cmp(&self, other: &Box<'a, T>) -> Ordering {
+        Ord::cmp(&**self, &**other)
+    }
+}
+
+impl<'a, T: ?Sized + Eq> Eq for Box<'a, T> {}
+
+impl<'a, T: ?Sized + Hash> Hash for Box<'a, T> {
+    fn hash<H: Hasher>(&self, state: &mut H) {
+        (**self).hash(state);
+    }
+}
+
+impl<'a, T: ?Sized + Hasher> Hasher for Box<'a, T> {
+    fn finish(&self) -> u64 {
+        (**self).finish()
+    }
+    fn write(&mut self, bytes: &[u8]) {
+        (**self).write(bytes)
+    }
+    fn write_u8(&mut self, i: u8) {
+        (**self).write_u8(i)
+    }
+    fn write_u16(&mut self, i: u16) {
+        (**self).write_u16(i)
+    }
+    fn write_u32(&mut self, i: u32) {
+        (**self).write_u32(i)
+    }
+    fn write_u64(&mut self, i: u64) {
+        (**self).write_u64(i)
+    }
+    fn write_u128(&mut self, i: u128) {
+        (**self).write_u128(i)
+    }
+    fn write_usize(&mut self, i: usize) {
+        (**self).write_usize(i)
+    }
+    fn write_i8(&mut self, i: i8) {
+        (**self).write_i8(i)
+    }
+    fn write_i16(&mut self, i: i16) {
+        (**self).write_i16(i)
+    }
+    fn write_i32(&mut self, i: i32) {
+        (**self).write_i32(i)
+    }
+    fn write_i64(&mut self, i: i64) {
+        (**self).write_i64(i)
+    }
+    fn write_i128(&mut self, i: i128) {
+        (**self).write_i128(i)
+    }
+    fn write_isize(&mut self, i: isize) {
+        (**self).write_isize(i)
+    }
+}
+
+impl<'a, T: ?Sized> From<Box<'a, T>> for Pin<Box<'a, T>> {
+    /// Converts a `Box<T>` into a `Pin<Box<T>>`.
+    ///
+    /// This conversion does not allocate on the heap and happens in place.
+    fn from(boxed: Box<'a, T>) -> Self {
+        // It's not possible to move or replace the insides of a `Pin<Box<T>>`
+        // when `T: !Unpin`,  so it's safe to pin it directly without any
+        // additional requirements.
+        unsafe { Pin::new_unchecked(boxed) }
+    }
+}
+
+impl<'a> Box<'a, dyn Any> {
+    #[inline]
+    /// Attempt to downcast the box to a concrete type.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::any::Any;
+    ///
+    /// fn print_if_string(value: Box<dyn Any>) {
+    ///     if let Ok(string) = value.downcast::<String>() {
+    ///         println!("String ({}): {}", string.len(), string);
+    ///     }
+    /// }
+    ///
+    /// let my_string = "Hello World".to_string();
+    /// print_if_string(Box::new(my_string));
+    /// print_if_string(Box::new(0i8));
+    /// ```
+    pub fn downcast<T: Any>(self) -> Result<Box<'a, T>, Box<'a, dyn Any>> {
+        if self.is::<T>() {
+            unsafe {
+                let raw: *mut dyn Any = Box::into_raw(self);
+                Ok(Box::from_raw(raw as *mut T))
+            }
+        } else {
+            Err(self)
+        }
+    }
+}
+
+impl<'a> Box<'a, dyn Any + Send> {
+    #[inline]
+    /// Attempt to downcast the box to a concrete type.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::any::Any;
+    ///
+    /// fn print_if_string(value: Box<dyn Any + Send>) {
+    ///     if let Ok(string) = value.downcast::<String>() {
+    ///         println!("String ({}): {}", string.len(), string);
+    ///     }
+    /// }
+    ///
+    /// let my_string = "Hello World".to_string();
+    /// print_if_string(Box::new(my_string));
+    /// print_if_string(Box::new(0i8));
+    /// ```
+    pub fn downcast<T: Any>(self) -> Result<Box<'a, T>, Box<'a, dyn Any + Send>> {
+        if self.is::<T>() {
+            unsafe {
+                let raw: *mut (dyn Any + Send) = Box::into_raw(self);
+                Ok(Box::from_raw(raw as *mut T))
+            }
+        } else {
+            Err(self)
+        }
+    }
+}
+
+impl<'a, T: fmt::Display + ?Sized> fmt::Display for Box<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        fmt::Display::fmt(&**self, f)
+    }
+}
+
+impl<'a, T: fmt::Debug + ?Sized> fmt::Debug for Box<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        fmt::Debug::fmt(&**self, f)
+    }
+}
+
+impl<'a, T: ?Sized> fmt::Pointer for Box<'a, T> {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        // It's not possible to extract the inner Uniq directly from the Box,
+        // instead we cast it to a *const which aliases the Unique
+        let ptr: *const T = &**self;
+        fmt::Pointer::fmt(&ptr, f)
+    }
+}
+
+impl<'a, T: ?Sized> Deref for Box<'a, T> {
+    type Target = T;
+
+    fn deref(&self) -> &T {
+        &*self.0
+    }
+}
+
+impl<'a, T: ?Sized> DerefMut for Box<'a, T> {
+    fn deref_mut(&mut self) -> &mut T {
+        self.0
+    }
+}
+
+impl<'a, I: Iterator + ?Sized> Iterator for Box<'a, I> {
+    type Item = I::Item;
+    fn next(&mut self) -> Option<I::Item> {
+        (**self).next()
+    }
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (**self).size_hint()
+    }
+    fn nth(&mut self, n: usize) -> Option<I::Item> {
+        (**self).nth(n)
+    }
+    fn last(self) -> Option<I::Item> {
+        #[inline]
+        fn some<T>(_: Option<T>, x: T) -> Option<T> {
+            Some(x)
+        }
+        self.fold(None, some)
+    }
+}
+
+impl<'a, I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<'a, I> {
+    fn next_back(&mut self) -> Option<I::Item> {
+        (**self).next_back()
+    }
+    fn nth_back(&mut self, n: usize) -> Option<I::Item> {
+        (**self).nth_back(n)
+    }
+}
+impl<'a, I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<'a, I> {
+    fn len(&self) -> usize {
+        (**self).len()
+    }
+}
+
+impl<'a, I: FusedIterator + ?Sized> FusedIterator for Box<'a, I> {}
+
+#[cfg(feature = "collections")]
+impl<'a, A> Box<'a, [A]> {
+    /// Creates a value from an iterator.
+    /// This method is an adapted version of [`FromIterator::from_iter`][from_iter].
+    /// It cannot be made as that trait implementation given different signature.
+    ///
+    /// [from_iter]: https://doc.rust-lang.org/std/iter/trait.FromIterator.html#tymethod.from_iter
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    /// ```
+    /// use bumpalo::{Bump, boxed::Box, vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let five_fives = std::iter::repeat(5).take(5);
+    /// let slice = Box::from_iter_in(five_fives, &b);
+    /// assert_eq!(vec![in &b; 5, 5, 5, 5, 5], &*slice);
+    /// ```
+    pub fn from_iter_in<T: IntoIterator<Item = A>>(iter: T, a: &'a Bump) -> Self {
+        use crate::collections::Vec;
+        let mut vec = Vec::new_in(a);
+        vec.extend(iter);
+        vec.into_boxed_slice()
+    }
+}
+
+impl<'a, T: ?Sized> borrow::Borrow<T> for Box<'a, T> {
+    fn borrow(&self) -> &T {
+        &**self
+    }
+}
+
+impl<'a, T: ?Sized> borrow::BorrowMut<T> for Box<'a, T> {
+    fn borrow_mut(&mut self) -> &mut T {
+        &mut **self
+    }
+}
+
+impl<'a, T: ?Sized> AsRef<T> for Box<'a, T> {
+    fn as_ref(&self) -> &T {
+        &**self
+    }
+}
+
+impl<'a, T: ?Sized> AsMut<T> for Box<'a, T> {
+    fn as_mut(&mut self) -> &mut T {
+        &mut **self
+    }
+}
+
+impl<'a, T: ?Sized> Unpin for Box<'a, T> {}
+
+impl<'a, F: ?Sized + Future + Unpin> Future for Box<'a, F> {
+    type Output = F::Output;
+
+    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
+        F::poll(Pin::new(&mut *self), cx)
+    }
+}
+
+/// This impl replaces unsize coercion.
+impl<'a, T, const N: usize> From<Box<'a, [T; N]>> for Box<'a, [T]> {
+    fn from(mut arr: Box<'a, [T; N]>) -> Box<'a, [T]> {
+        let ptr = core::ptr::slice_from_raw_parts_mut(arr.as_mut_ptr(), N);
+        mem::forget(arr);
+        unsafe { Box::from_raw(ptr) }
+    }
+}
+
+/// This impl replaces unsize coercion.
+impl<'a, T, const N: usize> TryFrom<Box<'a, [T]>> for Box<'a, [T; N]> {
+    type Error = Box<'a, [T]>;
+    fn try_from(mut slice: Box<'a, [T]>) -> Result<Box<'a, [T; N]>, Box<'a, [T]>> {
+        if slice.len() == N {
+            let ptr = slice.as_mut_ptr() as *mut [T; N];
+            mem::forget(slice);
+            Ok(unsafe { Box::from_raw(ptr) })
+        } else {
+            Err(slice)
+        }
+    }
+}
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/collect_in.rs b/android/vendor/bumpalo-3.10.0/src/collections/collect_in.rs
new file mode 100644
index 0000000..3e1adea
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/collect_in.rs
@@ -0,0 +1,152 @@
+#[cfg(feature = "boxed")]
+use crate::boxed::Box;
+use crate::collections::{String, Vec};
+use crate::Bump;
+
+/// A trait for types that support being constructed from an iterator, parameterized by an allocator.
+pub trait FromIteratorIn<A> {
+    /// The allocator type
+    type Alloc;
+
+    /// Similar to [`FromIterator::from_iter`][from_iter], but with a given allocator.
+    ///
+    /// [from_iter]: https://doc.rust-lang.org/std/iter/trait.FromIterator.html#tymethod.from_iter
+    ///
+    /// ```
+    /// # use bumpalo::collections::{FromIteratorIn, Vec};
+    /// # use bumpalo::Bump;
+    /// #
+    /// let five_fives = std::iter::repeat(5).take(5);
+    /// let bump = Bump::new();
+    ///
+    /// let v = Vec::from_iter_in(five_fives, &bump);
+    ///
+    /// assert_eq!(v, [5, 5, 5, 5, 5]);
+    /// ```
+    fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
+    where
+        I: IntoIterator<Item = A>;
+}
+
+#[cfg(feature = "boxed")]
+impl<'bump, T> FromIteratorIn<T> for Box<'bump, [T]> {
+    type Alloc = &'bump Bump;
+
+    fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
+    where
+        I: IntoIterator<Item = T>,
+    {
+        Box::from_iter_in(iter, alloc)
+    }
+}
+
+impl<'bump, T> FromIteratorIn<T> for Vec<'bump, T> {
+    type Alloc = &'bump Bump;
+
+    fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
+    where
+        I: IntoIterator<Item = T>,
+    {
+        Vec::from_iter_in(iter, alloc)
+    }
+}
+
+impl<T, V: FromIteratorIn<T>> FromIteratorIn<Option<T>> for Option<V> {
+    type Alloc = V::Alloc;
+    fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
+    where
+        I: IntoIterator<Item = Option<T>>,
+    {
+        iter.into_iter()
+            .map(|x| x.ok_or(()))
+            .collect_in::<Result<_, _>>(alloc)
+            .ok()
+    }
+}
+
+impl<T, E, V: FromIteratorIn<T>> FromIteratorIn<Result<T, E>> for Result<V, E> {
+    type Alloc = V::Alloc;
+    /// Takes each element in the `Iterator`: if it is an `Err`, no further
+    /// elements are taken, and the `Err` is returned. Should no `Err` occur, a
+    /// container with the values of each `Result` is returned.
+    ///
+    /// Here is an example which increments every integer in a vector,
+    /// checking for overflow:
+    ///
+    /// ```
+    /// # use bumpalo::collections::{FromIteratorIn, CollectIn, Vec, String};
+    /// # use bumpalo::Bump;
+    /// #
+    /// let bump = Bump::new();
+    ///
+    /// let v = vec![1, 2, u32::MAX];
+    /// let res: Result<Vec<u32>, &'static str> = v.iter().take(2).map(|x: &u32|
+    ///     x.checked_add(1).ok_or("Overflow!")
+    /// ).collect_in(&bump);
+    /// assert_eq!(res, Ok(bumpalo::vec![in &bump; 2, 3]));
+    ///
+    /// let res: Result<Vec<u32>, &'static str> = v.iter().map(|x: &u32|
+    ///     x.checked_add(1).ok_or("Overflow!")
+    /// ).collect_in(&bump);
+    /// assert_eq!(res, Err("Overflow!"));
+    /// ```
+    fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
+    where
+        I: IntoIterator<Item = Result<T, E>>,
+    {
+        let mut iter = iter.into_iter();
+        let mut error = None;
+        let container = core::iter::from_fn(|| match iter.next() {
+            Some(Ok(x)) => Some(x),
+            Some(Err(e)) => {
+                error = Some(e);
+                None
+            }
+            None => None,
+        })
+        .collect_in(alloc);
+
+        match error {
+            Some(e) => Err(e),
+            None => Ok(container),
+        }
+    }
+}
+
+impl<'bump> FromIteratorIn<char> for String<'bump> {
+    type Alloc = &'bump Bump;
+
+    fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
+    where
+        I: IntoIterator<Item = char>,
+    {
+        String::from_iter_in(iter, alloc)
+    }
+}
+
+/// Extension trait for iterators, in order to allow allocator-parameterized collections to be constructed more easily.
+pub trait CollectIn: Iterator + Sized {
+    /// Collect all items from an iterator, into a collection parameterized by an allocator.
+    /// Similar to [`Iterator::collect`][collect].
+    ///
+    /// [collect]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect
+    ///
+    /// ```
+    /// # use bumpalo::collections::{FromIteratorIn, CollectIn, Vec, String};
+    /// # use bumpalo::Bump;
+    /// #
+    /// let bump = Bump::new();
+    ///
+    /// let str = "hello, world!".to_owned();
+    /// let bump_str: String = str.chars().collect_in(&bump);
+    /// assert_eq!(&bump_str, &str);
+    ///
+    /// let nums: Vec<i32> = (0..=3).collect_in::<Vec<_>>(&bump);
+    /// assert_eq!(&nums, &[0,1,2,3]);
+    /// ```
+    fn collect_in<C: FromIteratorIn<Self::Item>>(self, alloc: C::Alloc) -> C {
+        C::from_iter_in(self, alloc)
+    }
+}
+
+impl<I: Iterator> CollectIn for I {}
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/mod.rs b/android/vendor/bumpalo-3.10.0/src/collections/mod.rs
new file mode 100644
index 0000000..218636c
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/mod.rs
@@ -0,0 +1,93 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Collection types that allocate inside a [`Bump`] arena.
+//!
+//! [`Bump`]: ../struct.Bump.html
+
+#![allow(deprecated)]
+
+mod raw_vec;
+
+pub mod vec;
+pub use self::vec::Vec;
+
+mod str;
+pub mod string;
+pub use self::string::String;
+
+mod collect_in;
+pub use collect_in::{CollectIn, FromIteratorIn};
+
+// pub mod binary_heap;
+// mod btree;
+// pub mod linked_list;
+// pub mod vec_deque;
+
+// pub mod btree_map {
+//     //! A map based on a B-Tree.
+//     pub use super::btree::map::*;
+// }
+
+// pub mod btree_set {
+//     //! A set based on a B-Tree.
+//     pub use super::btree::set::*;
+// }
+
+// #[doc(no_inline)]
+// pub use self::binary_heap::BinaryHeap;
+
+// #[doc(no_inline)]
+// pub use self::btree_map::BTreeMap;
+
+// #[doc(no_inline)]
+// pub use self::btree_set::BTreeSet;
+
+// #[doc(no_inline)]
+// pub use self::linked_list::LinkedList;
+
+// #[doc(no_inline)]
+// pub use self::vec_deque::VecDeque;
+
+use crate::alloc::{AllocErr, LayoutErr};
+
+/// Augments `AllocErr` with a `CapacityOverflow` variant.
+#[derive(Clone, PartialEq, Eq, Debug)]
+// #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
+pub enum CollectionAllocErr {
+    /// Error due to the computed capacity exceeding the collection's maximum
+    /// (usually `isize::MAX` bytes).
+    CapacityOverflow,
+    /// Error due to the allocator (see the documentation for the [`AllocErr`] type).
+    AllocErr,
+}
+
+// #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
+impl From<AllocErr> for CollectionAllocErr {
+    #[inline]
+    fn from(AllocErr: AllocErr) -> Self {
+        CollectionAllocErr::AllocErr
+    }
+}
+
+// #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
+impl From<LayoutErr> for CollectionAllocErr {
+    #[inline]
+    fn from(_: LayoutErr) -> Self {
+        CollectionAllocErr::CapacityOverflow
+    }
+}
+
+// /// An intermediate trait for specialization of `Extend`.
+// #[doc(hidden)]
+// trait SpecExtend<I: IntoIterator> {
+//     /// Extends `self` with the contents of the given iterator.
+//     fn spec_extend(&mut self, iter: I);
+// }
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/raw_vec.rs b/android/vendor/bumpalo-3.10.0/src/collections/raw_vec.rs
new file mode 100644
index 0000000..4620867
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/raw_vec.rs
@@ -0,0 +1,735 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![allow(unstable_name_collisions)]
+#![allow(dead_code)]
+
+use crate::Bump;
+
+use core::cmp;
+use core::mem;
+use core::ptr::{self, NonNull};
+
+use crate::alloc::{handle_alloc_error, Alloc, Layout, UnstableLayoutMethods};
+use crate::collections::CollectionAllocErr;
+use crate::collections::CollectionAllocErr::*;
+// use boxed::Box;
+
+/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
+/// a buffer of memory on the heap without having to worry about all the corner cases
+/// involved. This type is excellent for building your own data structures like Vec and VecDeque.
+/// In particular:
+///
+/// * Produces Unique::empty() on zero-sized types
+/// * Produces Unique::empty() on zero-length allocations
+/// * Catches all overflows in capacity computations (promotes them to "capacity overflow" panics)
+/// * Guards against 32-bit systems allocating more than isize::MAX bytes
+/// * Guards against overflowing your length
+/// * Aborts on OOM
+/// * Avoids freeing Unique::empty()
+/// * Contains a ptr::Unique and thus endows the user with all related benefits
+///
+/// This type does not in anyway inspect the memory that it manages. When dropped it *will*
+/// free its memory, but it *won't* try to Drop its contents. It is up to the user of RawVec
+/// to handle the actual things *stored* inside of a RawVec.
+///
+/// Note that a RawVec always forces its capacity to be usize::MAX for zero-sized types.
+/// This enables you to use capacity growing logic catch the overflows in your length
+/// that might occur with zero-sized types.
+///
+/// However this means that you need to be careful when round-tripping this type
+/// with a `Box<[T]>`: `cap()` won't yield the len. However `with_capacity`,
+/// `shrink_to_fit`, and `from_box` will actually set RawVec's private capacity
+/// field. This allows zero-sized types to not be special-cased by consumers of
+/// this type.
+#[allow(missing_debug_implementations)]
+pub struct RawVec<'a, T> {
+    ptr: NonNull<T>,
+    cap: usize,
+    a: &'a Bump,
+}
+
+impl<'a, T> RawVec<'a, T> {
+    /// Like `new` but parameterized over the choice of allocator for
+    /// the returned RawVec.
+    pub fn new_in(a: &'a Bump) -> Self {
+        // !0 is usize::MAX. This branch should be stripped at compile time.
+        // FIXME(mark-i-m): use this line when `if`s are allowed in `const`
+        //let cap = if mem::size_of::<T>() == 0 { !0 } else { 0 };
+
+        // Unique::empty() doubles as "unallocated" and "zero-sized allocation"
+        RawVec {
+            ptr: unsafe { NonNull::new_unchecked(mem::align_of::<T>() as *mut T) },
+            // FIXME(mark-i-m): use `cap` when ifs are allowed in const
+            cap: [0, !0][(mem::size_of::<T>() == 0) as usize],
+            a,
+        }
+    }
+
+    /// Like `with_capacity` but parameterized over the choice of
+    /// allocator for the returned RawVec.
+    #[inline]
+    pub fn with_capacity_in(cap: usize, a: &'a Bump) -> Self {
+        RawVec::allocate_in(cap, false, a)
+    }
+
+    /// Like `with_capacity_zeroed` but parameterized over the choice
+    /// of allocator for the returned RawVec.
+    #[inline]
+    pub fn with_capacity_zeroed_in(cap: usize, a: &'a Bump) -> Self {
+        RawVec::allocate_in(cap, true, a)
+    }
+
+    fn allocate_in(cap: usize, zeroed: bool, mut a: &'a Bump) -> Self {
+        unsafe {
+            let elem_size = mem::size_of::<T>();
+
+            let alloc_size = cap
+                .checked_mul(elem_size)
+                .unwrap_or_else(|| capacity_overflow());
+            alloc_guard(alloc_size).unwrap_or_else(|_| capacity_overflow());
+
+            // handles ZSTs and `cap = 0` alike
+            let ptr = if alloc_size == 0 {
+                NonNull::<T>::dangling()
+            } else {
+                let align = mem::align_of::<T>();
+                let layout = Layout::from_size_align(alloc_size, align).unwrap();
+                let result = if zeroed {
+                    a.alloc_zeroed(layout)
+                } else {
+                    Alloc::alloc(&mut a, layout)
+                };
+                match result {
+                    Ok(ptr) => ptr.cast(),
+                    Err(_) => handle_alloc_error(layout),
+                }
+            };
+
+            RawVec { ptr, cap, a }
+        }
+    }
+}
+
+impl<'a, T> RawVec<'a, T> {
+    /// Reconstitutes a RawVec from a pointer, capacity, and allocator.
+    ///
+    /// # Undefined Behavior
+    ///
+    /// The ptr must be allocated (via the given allocator `a`), and with the given capacity. The
+    /// capacity cannot exceed `isize::MAX` (only a concern on 32-bit systems).
+    /// If the ptr and capacity come from a RawVec created via `a`, then this is guaranteed.
+    pub unsafe fn from_raw_parts_in(ptr: *mut T, cap: usize, a: &'a Bump) -> Self {
+        RawVec {
+            ptr: NonNull::new_unchecked(ptr),
+            cap,
+            a,
+        }
+    }
+}
+
+impl<'a, T> RawVec<'a, T> {
+    /// Gets a raw pointer to the start of the allocation. Note that this is
+    /// Unique::empty() if `cap = 0` or T is zero-sized. In the former case, you must
+    /// be careful.
+    pub fn ptr(&self) -> *mut T {
+        self.ptr.as_ptr()
+    }
+
+    /// Gets the capacity of the allocation.
+    ///
+    /// This will always be `usize::MAX` if `T` is zero-sized.
+    #[inline(always)]
+    pub fn cap(&self) -> usize {
+        if mem::size_of::<T>() == 0 {
+            !0
+        } else {
+            self.cap
+        }
+    }
+
+    /// Returns a shared reference to the allocator backing this RawVec.
+    pub fn bump(&self) -> &'a Bump {
+        self.a
+    }
+
+    fn current_layout(&self) -> Option<Layout> {
+        if self.cap == 0 {
+            None
+        } else {
+            // We have an allocated chunk of memory, so we can bypass runtime
+            // checks to get our current layout.
+            unsafe {
+                let align = mem::align_of::<T>();
+                let size = mem::size_of::<T>() * self.cap;
+                Some(Layout::from_size_align_unchecked(size, align))
+            }
+        }
+    }
+
+    /// Doubles the size of the type's backing allocation. This is common enough
+    /// to want to do that it's easiest to just have a dedicated method. Slightly
+    /// more efficient logic can be provided for this than the general case.
+    ///
+    /// This function is ideal for when pushing elements one-at-a-time because
+    /// you don't need to incur the costs of the more general computations
+    /// reserve needs to do to guard against overflow. You do however need to
+    /// manually check if your `len == cap`.
+    ///
+    /// # Panics
+    ///
+    /// * Panics if T is zero-sized on the assumption that you managed to exhaust
+    ///   all `usize::MAX` slots in your imaginary buffer.
+    /// * Panics on 32-bit platforms if the requested capacity exceeds
+    ///   `isize::MAX` bytes.
+    ///
+    /// # Aborts
+    ///
+    /// Aborts on OOM
+    ///
+    /// # Examples
+    ///
+    /// ```ignore
+    /// # #![feature(alloc, raw_vec_internals)]
+    /// # extern crate alloc;
+    /// # use std::ptr;
+    /// # use alloc::raw_vec::RawVec;
+    /// struct MyVec<T> {
+    ///     buf: RawVec<T>,
+    ///     len: usize,
+    /// }
+    ///
+    /// impl<T> MyVec<T> {
+    ///     pub fn push(&mut self, elem: T) {
+    ///         if self.len == self.buf.cap() { self.buf.double(); }
+    ///         // double would have aborted or panicked if the len exceeded
+    ///         // `isize::MAX` so this is safe to do unchecked now.
+    ///         unsafe {
+    ///             ptr::write(self.buf.ptr().add(self.len), elem);
+    ///         }
+    ///         self.len += 1;
+    ///     }
+    /// }
+    /// # fn main() {
+    /// #   let mut vec = MyVec { buf: RawVec::new(), len: 0 };
+    /// #   vec.push(1);
+    /// # }
+    /// ```
+    #[inline(never)]
+    #[cold]
+    pub fn double(&mut self) {
+        unsafe {
+            let elem_size = mem::size_of::<T>();
+
+            // since we set the capacity to usize::MAX when elem_size is
+            // 0, getting to here necessarily means the RawVec is overfull.
+            assert!(elem_size != 0, "capacity overflow");
+
+            let (new_cap, uniq) = match self.current_layout() {
+                Some(cur) => {
+                    // Since we guarantee that we never allocate more than
+                    // isize::MAX bytes, `elem_size * self.cap <= isize::MAX` as
+                    // a precondition, so this can't overflow. Additionally the
+                    // alignment will never be too large as to "not be
+                    // satisfiable", so `Layout::from_size_align` will always
+                    // return `Some`.
+                    //
+                    // tl;dr; we bypass runtime checks due to dynamic assertions
+                    // in this module, allowing us to use
+                    // `from_size_align_unchecked`.
+                    let new_cap = 2 * self.cap;
+                    let new_size = new_cap * elem_size;
+                    alloc_guard(new_size).unwrap_or_else(|_| capacity_overflow());
+                    let ptr_res = self.a.realloc(self.ptr.cast(), cur, new_size);
+                    match ptr_res {
+                        Ok(ptr) => (new_cap, ptr.cast()),
+                        Err(_) => handle_alloc_error(Layout::from_size_align_unchecked(
+                            new_size,
+                            cur.align(),
+                        )),
+                    }
+                }
+                None => {
+                    // skip to 4 because tiny Vec's are dumb; but not if that
+                    // would cause overflow
+                    let new_cap = if elem_size > (!0) / 8 { 1 } else { 4 };
+                    match self.a.alloc_array::<T>(new_cap) {
+                        Ok(ptr) => (new_cap, ptr),
+                        Err(_) => handle_alloc_error(Layout::array::<T>(new_cap).unwrap()),
+                    }
+                }
+            };
+            self.ptr = uniq;
+            self.cap = new_cap;
+        }
+    }
+
+    /// Attempts to double the size of the type's backing allocation in place. This is common
+    /// enough to want to do that it's easiest to just have a dedicated method. Slightly
+    /// more efficient logic can be provided for this than the general case.
+    ///
+    /// Returns true if the reallocation attempt has succeeded, or false otherwise.
+    ///
+    /// # Panics
+    ///
+    /// * Panics if T is zero-sized on the assumption that you managed to exhaust
+    ///   all `usize::MAX` slots in your imaginary buffer.
+    /// * Panics on 32-bit platforms if the requested capacity exceeds
+    ///   `isize::MAX` bytes.
+    #[inline(never)]
+    #[cold]
+    pub fn double_in_place(&mut self) -> bool {
+        unsafe {
+            let elem_size = mem::size_of::<T>();
+            let old_layout = match self.current_layout() {
+                Some(layout) => layout,
+                None => return false, // nothing to double
+            };
+
+            // since we set the capacity to usize::MAX when elem_size is
+            // 0, getting to here necessarily means the RawVec is overfull.
+            assert!(elem_size != 0, "capacity overflow");
+
+            // Since we guarantee that we never allocate more than isize::MAX
+            // bytes, `elem_size * self.cap <= isize::MAX` as a precondition, so
+            // this can't overflow.
+            //
+            // Similarly like with `double` above we can go straight to
+            // `Layout::from_size_align_unchecked` as we know this won't
+            // overflow and the alignment is sufficiently small.
+            let new_cap = 2 * self.cap;
+            let new_size = new_cap * elem_size;
+            alloc_guard(new_size).unwrap_or_else(|_| capacity_overflow());
+            match self.a.grow_in_place(self.ptr.cast(), old_layout, new_size) {
+                Ok(_) => {
+                    // We can't directly divide `size`.
+                    self.cap = new_cap;
+                    true
+                }
+                Err(_) => false,
+            }
+        }
+    }
+
+    /// The same as `reserve_exact`, but returns on errors instead of panicking or aborting.
+    pub fn try_reserve_exact(
+        &mut self,
+        used_cap: usize,
+        needed_extra_cap: usize,
+    ) -> Result<(), CollectionAllocErr> {
+        self.reserve_internal(used_cap, needed_extra_cap, Fallible, Exact)
+    }
+
+    /// Ensures that the buffer contains at least enough space to hold
+    /// `used_cap + needed_extra_cap` elements. If it doesn't already,
+    /// will reallocate the minimum possible amount of memory necessary.
+    /// Generally this will be exactly the amount of memory necessary,
+    /// but in principle the allocator is free to give back more than
+    /// we asked for.
+    ///
+    /// If `used_cap` exceeds `self.cap()`, this may fail to actually allocate
+    /// the requested space. This is not really unsafe, but the unsafe
+    /// code *you* write that relies on the behavior of this function may break.
+    ///
+    /// # Panics
+    ///
+    /// * Panics if the requested capacity exceeds `usize::MAX` bytes.
+    /// * Panics on 32-bit platforms if the requested capacity exceeds
+    ///   `isize::MAX` bytes.
+    ///
+    /// # Aborts
+    ///
+    /// Aborts on OOM
+    pub fn reserve_exact(&mut self, used_cap: usize, needed_extra_cap: usize) {
+        match self.reserve_internal(used_cap, needed_extra_cap, Infallible, Exact) {
+            Err(CapacityOverflow) => capacity_overflow(),
+            Err(AllocErr) => unreachable!(),
+            Ok(()) => { /* yay */ }
+        }
+    }
+
+    /// Calculates the buffer's new size given that it'll hold `used_cap +
+    /// needed_extra_cap` elements. This logic is used in amortized reserve methods.
+    /// Returns `(new_capacity, new_alloc_size)`.
+    fn amortized_new_size(
+        &self,
+        used_cap: usize,
+        needed_extra_cap: usize,
+    ) -> Result<usize, CollectionAllocErr> {
+        // Nothing we can really do about these checks :(
+        let required_cap = used_cap
+            .checked_add(needed_extra_cap)
+            .ok_or(CapacityOverflow)?;
+        // Cannot overflow, because `cap <= isize::MAX`, and type of `cap` is `usize`.
+        let double_cap = self.cap * 2;
+        // `double_cap` guarantees exponential growth.
+        Ok(cmp::max(double_cap, required_cap))
+    }
+
+    /// The same as `reserve`, but returns on errors instead of panicking or aborting.
+    pub fn try_reserve(
+        &mut self,
+        used_cap: usize,
+        needed_extra_cap: usize,
+    ) -> Result<(), CollectionAllocErr> {
+        self.reserve_internal(used_cap, needed_extra_cap, Fallible, Amortized)
+    }
+
+    /// Ensures that the buffer contains at least enough space to hold
+    /// `used_cap + needed_extra_cap` elements. If it doesn't already have
+    /// enough capacity, will reallocate enough space plus comfortable slack
+    /// space to get amortized `O(1)` behavior. Will limit this behavior
+    /// if it would needlessly cause itself to panic.
+    ///
+    /// If `used_cap` exceeds `self.cap()`, this may fail to actually allocate
+    /// the requested space. This is not really unsafe, but the unsafe
+    /// code *you* write that relies on the behavior of this function may break.
+    ///
+    /// This is ideal for implementing a bulk-push operation like `extend`.
+    ///
+    /// # Panics
+    ///
+    /// * Panics if the requested capacity exceeds `usize::MAX` bytes.
+    /// * Panics on 32-bit platforms if the requested capacity exceeds
+    ///   `isize::MAX` bytes.
+    ///
+    /// # Aborts
+    ///
+    /// Aborts on OOM
+    ///
+    /// # Examples
+    ///
+    /// ```ignore
+    /// # #![feature(alloc, raw_vec_internals)]
+    /// # extern crate alloc;
+    /// # use std::ptr;
+    /// # use alloc::raw_vec::RawVec;
+    /// struct MyVec<T> {
+    ///     buf: RawVec<T>,
+    ///     len: usize,
+    /// }
+    ///
+    /// impl<T: Clone> MyVec<T> {
+    ///     pub fn push_all(&mut self, elems: &[T]) {
+    ///         self.buf.reserve(self.len, elems.len());
+    ///         // reserve would have aborted or panicked if the len exceeded
+    ///         // `isize::MAX` so this is safe to do unchecked now.
+    ///         for x in elems {
+    ///             unsafe {
+    ///                 ptr::write(self.buf.ptr().add(self.len), x.clone());
+    ///             }
+    ///             self.len += 1;
+    ///         }
+    ///     }
+    /// }
+    /// # fn main() {
+    /// #   let mut vector = MyVec { buf: RawVec::new(), len: 0 };
+    /// #   vector.push_all(&[1, 3, 5, 7, 9]);
+    /// # }
+    /// ```
+    pub fn reserve(&mut self, used_cap: usize, needed_extra_cap: usize) {
+        match self.reserve_internal(used_cap, needed_extra_cap, Infallible, Amortized) {
+            Err(CapacityOverflow) => capacity_overflow(),
+            Err(AllocErr) => unreachable!(),
+            Ok(()) => { /* yay */ }
+        }
+    }
+    /// Attempts to ensure that the buffer contains at least enough space to hold
+    /// `used_cap + needed_extra_cap` elements. If it doesn't already have
+    /// enough capacity, will reallocate in place enough space plus comfortable slack
+    /// space to get amortized `O(1)` behavior. Will limit this behaviour
+    /// if it would needlessly cause itself to panic.
+    ///
+    /// If `used_cap` exceeds `self.cap()`, this may fail to actually allocate
+    /// the requested space. This is not really unsafe, but the unsafe
+    /// code *you* write that relies on the behavior of this function may break.
+    ///
+    /// Returns true if the reallocation attempt has succeeded, or false otherwise.
+    ///
+    /// # Panics
+    ///
+    /// * Panics if the requested capacity exceeds `usize::MAX` bytes.
+    /// * Panics on 32-bit platforms if the requested capacity exceeds
+    ///   `isize::MAX` bytes.
+    pub fn reserve_in_place(&mut self, used_cap: usize, needed_extra_cap: usize) -> bool {
+        unsafe {
+            // NOTE: we don't early branch on ZSTs here because we want this
+            // to actually catch "asking for more than usize::MAX" in that case.
+            // If we make it past the first branch then we are guaranteed to
+            // panic.
+
+            // Don't actually need any more capacity. If the current `cap` is 0, we can't
+            // reallocate in place.
+            // Wrapping in case they give a bad `used_cap`
+            let old_layout = match self.current_layout() {
+                Some(layout) => layout,
+                None => return false,
+            };
+            if self.cap().wrapping_sub(used_cap) >= needed_extra_cap {
+                return false;
+            }
+
+            let new_cap = self
+                .amortized_new_size(used_cap, needed_extra_cap)
+                .unwrap_or_else(|_| capacity_overflow());
+
+            // Here, `cap < used_cap + needed_extra_cap <= new_cap`
+            // (regardless of whether `self.cap - used_cap` wrapped).
+            // Therefore we can safely call grow_in_place.
+
+            let new_layout = Layout::new::<T>().repeat(new_cap).unwrap().0;
+            // FIXME: may crash and burn on over-reserve
+            alloc_guard(new_layout.size()).unwrap_or_else(|_| capacity_overflow());
+            match self
+                .a
+                .grow_in_place(self.ptr.cast(), old_layout, new_layout.size())
+            {
+                Ok(_) => {
+                    self.cap = new_cap;
+                    true
+                }
+                Err(_) => false,
+            }
+        }
+    }
+
+    /// Shrinks the allocation down to the specified amount. If the given amount
+    /// is 0, actually completely deallocates.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the given amount is *larger* than the current capacity.
+    ///
+    /// # Aborts
+    ///
+    /// Aborts on OOM.
+    pub fn shrink_to_fit(&mut self, amount: usize) {
+        let elem_size = mem::size_of::<T>();
+
+        // Set the `cap` because they might be about to promote to a `Box<[T]>`
+        if elem_size == 0 {
+            self.cap = amount;
+            return;
+        }
+
+        // This check is my waterloo; it's the only thing Vec wouldn't have to do.
+        assert!(self.cap >= amount, "Tried to shrink to a larger capacity");
+
+        if amount == 0 {
+            // We want to create a new zero-length vector within the
+            // same allocator.  We use ptr::write to avoid an
+            // erroneous attempt to drop the contents, and we use
+            // ptr::read to sidestep condition against destructuring
+            // types that implement Drop.
+
+            unsafe {
+                let a = self.a;
+                self.dealloc_buffer();
+                ptr::write(self, RawVec::new_in(a));
+            }
+        } else if self.cap != amount {
+            unsafe {
+                // We know here that our `amount` is greater than zero. This
+                // implies, via the assert above, that capacity is also greater
+                // than zero, which means that we've got a current layout that
+                // "fits"
+                //
+                // We also know that `self.cap` is greater than `amount`, and
+                // consequently we don't need runtime checks for creating either
+                // layout
+                let old_size = elem_size * self.cap;
+                let new_size = elem_size * amount;
+                let align = mem::align_of::<T>();
+                let old_layout = Layout::from_size_align_unchecked(old_size, align);
+                match self.a.realloc(self.ptr.cast(), old_layout, new_size) {
+                    Ok(p) => self.ptr = p.cast(),
+                    Err(_) => {
+                        handle_alloc_error(Layout::from_size_align_unchecked(new_size, align))
+                    }
+                }
+            }
+            self.cap = amount;
+        }
+    }
+}
+
+#[cfg(feature = "boxed")]
+impl<'a, T> RawVec<'a, T> {
+    /// Converts the entire buffer into `Box<[T]>`.
+    ///
+    /// Note that this will correctly reconstitute any `cap` changes
+    /// that may have been performed. (See description of type for details.)
+    ///
+    /// # Undefined Behavior
+    ///
+    /// All elements of `RawVec<T>` must be initialized. Notice that
+    /// the rules around uninitialized boxed values are not finalized yet,
+    /// but until they are, it is advisable to avoid them.
+    pub unsafe fn into_box(self) -> crate::boxed::Box<'a, [T]> {
+        use crate::boxed::Box;
+
+        // NOTE: not calling `cap()` here; actually using the real `cap` field!
+        let slice = core::slice::from_raw_parts_mut(self.ptr(), self.cap);
+        let output: Box<'a, [T]> = Box::from_raw(slice);
+        mem::forget(self);
+        output
+    }
+}
+
+enum Fallibility {
+    Fallible,
+    Infallible,
+}
+
+use self::Fallibility::*;
+
+enum ReserveStrategy {
+    Exact,
+    Amortized,
+}
+
+use self::ReserveStrategy::*;
+
+impl<'a, T> RawVec<'a, T> {
+    fn reserve_internal(
+        &mut self,
+        used_cap: usize,
+        needed_extra_cap: usize,
+        fallibility: Fallibility,
+        strategy: ReserveStrategy,
+    ) -> Result<(), CollectionAllocErr> {
+        unsafe {
+            use crate::AllocErr;
+
+            // NOTE: we don't early branch on ZSTs here because we want this
+            // to actually catch "asking for more than usize::MAX" in that case.
+            // If we make it past the first branch then we are guaranteed to
+            // panic.
+
+            // Don't actually need any more capacity.
+            // Wrapping in case they gave a bad `used_cap`.
+            if self.cap().wrapping_sub(used_cap) >= needed_extra_cap {
+                return Ok(());
+            }
+
+            // Nothing we can really do about these checks :(
+            let new_cap = match strategy {
+                Exact => used_cap
+                    .checked_add(needed_extra_cap)
+                    .ok_or(CapacityOverflow)?,
+                Amortized => self.amortized_new_size(used_cap, needed_extra_cap)?,
+            };
+            let new_layout = Layout::array::<T>(new_cap).map_err(|_| CapacityOverflow)?;
+
+            alloc_guard(new_layout.size())?;
+
+            let res = match self.current_layout() {
+                Some(layout) => {
+                    debug_assert!(new_layout.align() == layout.align());
+                    self.a.realloc(self.ptr.cast(), layout, new_layout.size())
+                }
+                None => Alloc::alloc(&mut self.a, new_layout),
+            };
+
+            if let (Err(AllocErr), Infallible) = (&res, fallibility) {
+                handle_alloc_error(new_layout);
+            }
+
+            self.ptr = res?.cast();
+            self.cap = new_cap;
+
+            Ok(())
+        }
+    }
+}
+
+impl<'a, T> RawVec<'a, T> {
+    /// Frees the memory owned by the RawVec *without* trying to Drop its contents.
+    pub unsafe fn dealloc_buffer(&mut self) {
+        let elem_size = mem::size_of::<T>();
+        if elem_size != 0 {
+            if let Some(layout) = self.current_layout() {
+                self.a.dealloc(self.ptr.cast(), layout);
+            }
+        }
+    }
+}
+
+impl<'a, T> Drop for RawVec<'a, T> {
+    /// Frees the memory owned by the RawVec *without* trying to Drop its contents.
+    fn drop(&mut self) {
+        unsafe {
+            self.dealloc_buffer();
+        }
+    }
+}
+
+// We need to guarantee the following:
+// * We don't ever allocate `> isize::MAX` byte-size objects
+// * We don't overflow `usize::MAX` and actually allocate too little
+//
+// On 64-bit we just need to check for overflow since trying to allocate
+// `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add
+// an extra guard for this in case we're running on a platform which can use
+// all 4GB in user-space. e.g. PAE or x32
+
+#[inline]
+fn alloc_guard(alloc_size: usize) -> Result<(), CollectionAllocErr> {
+    if mem::size_of::<usize>() < 8 && alloc_size > ::core::isize::MAX as usize {
+        Err(CapacityOverflow)
+    } else {
+        Ok(())
+    }
+}
+
+// One central function responsible for reporting capacity overflows. This'll
+// ensure that the code generation related to these panics is minimal as there's
+// only one location which panics rather than a bunch throughout the module.
+fn capacity_overflow() -> ! {
+    panic!("capacity overflow")
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn reserve_does_not_overallocate() {
+        let bump = Bump::new();
+        {
+            let mut v: RawVec<u32> = RawVec::new_in(&bump);
+            // First `reserve` allocates like `reserve_exact`
+            v.reserve(0, 9);
+            assert_eq!(9, v.cap());
+        }
+
+        {
+            let mut v: RawVec<u32> = RawVec::new_in(&bump);
+            v.reserve(0, 7);
+            assert_eq!(7, v.cap());
+            // 97 if more than double of 7, so `reserve` should work
+            // like `reserve_exact`.
+            v.reserve(7, 90);
+            assert_eq!(97, v.cap());
+        }
+
+        {
+            let mut v: RawVec<u32> = RawVec::new_in(&bump);
+            v.reserve(0, 12);
+            assert_eq!(12, v.cap());
+            v.reserve(12, 3);
+            // 3 is less than half of 12, so `reserve` must grow
+            // exponentially. At the time of writing this test grow
+            // factor is 2, so new capacity is 24, however, grow factor
+            // of 1.5 is OK too. Hence `>= 18` in assert.
+            assert!(v.cap() >= 12 + 12 / 2);
+        }
+    }
+}
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/str/lossy.rs b/android/vendor/bumpalo-3.10.0/src/collections/str/lossy.rs
new file mode 100644
index 0000000..b1012a4
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/str/lossy.rs
@@ -0,0 +1,209 @@
+// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use crate::collections::str as core_str;
+use core::char;
+use core::fmt;
+use core::fmt::Write;
+use core::str;
+
+/// Lossy UTF-8 string.
+pub struct Utf8Lossy<'a> {
+    bytes: &'a [u8],
+}
+
+impl<'a> Utf8Lossy<'a> {
+    pub fn from_bytes(bytes: &'a [u8]) -> Utf8Lossy<'a> {
+        Utf8Lossy { bytes }
+    }
+
+    pub fn chunks(&self) -> Utf8LossyChunksIter<'a> {
+        Utf8LossyChunksIter {
+            source: &self.bytes,
+        }
+    }
+}
+
+/// Iterator over lossy UTF-8 string
+#[allow(missing_debug_implementations)]
+pub struct Utf8LossyChunksIter<'a> {
+    source: &'a [u8],
+}
+
+#[derive(PartialEq, Eq, Debug)]
+pub struct Utf8LossyChunk<'a> {
+    /// Sequence of valid chars.
+    /// Can be empty between broken UTF-8 chars.
+    pub valid: &'a str,
+    /// Single broken char, empty if none.
+    /// Empty iff iterator item is last.
+    pub broken: &'a [u8],
+}
+
+impl<'a> Iterator for Utf8LossyChunksIter<'a> {
+    type Item = Utf8LossyChunk<'a>;
+
+    fn next(&mut self) -> Option<Utf8LossyChunk<'a>> {
+        if self.source.is_empty() {
+            return None;
+        }
+
+        const TAG_CONT_U8: u8 = 128;
+        fn unsafe_get(xs: &[u8], i: usize) -> u8 {
+            unsafe { *xs.get_unchecked(i) }
+        }
+        fn safe_get(xs: &[u8], i: usize) -> u8 {
+            if i >= xs.len() {
+                0
+            } else {
+                unsafe_get(xs, i)
+            }
+        }
+
+        let mut i = 0;
+        while i < self.source.len() {
+            let i_ = i;
+
+            let byte = unsafe_get(self.source, i);
+            i += 1;
+
+            if byte < 128 {
+            } else {
+                let w = core_str::utf8_char_width(byte);
+
+                macro_rules! error {
+                    () => {{
+                        unsafe {
+                            let r = Utf8LossyChunk {
+                                valid: str::from_utf8_unchecked(&self.source[0..i_]),
+                                broken: &self.source[i_..i],
+                            };
+                            self.source = &self.source[i..];
+                            return Some(r);
+                        }
+                    }};
+                }
+
+                match w {
+                    2 => {
+                        if safe_get(self.source, i) & 192 != TAG_CONT_U8 {
+                            error!();
+                        }
+                        i += 1;
+                    }
+                    3 => {
+                        match (byte, safe_get(self.source, i)) {
+                            (0xE0, 0xA0..=0xBF) => (),
+                            (0xE1..=0xEC, 0x80..=0xBF) => (),
+                            (0xED, 0x80..=0x9F) => (),
+                            (0xEE..=0xEF, 0x80..=0xBF) => (),
+                            _ => {
+                                error!();
+                            }
+                        }
+                        i += 1;
+                        if safe_get(self.source, i) & 192 != TAG_CONT_U8 {
+                            error!();
+                        }
+                        i += 1;
+                    }
+                    4 => {
+                        match (byte, safe_get(self.source, i)) {
+                            (0xF0, 0x90..=0xBF) => (),
+                            (0xF1..=0xF3, 0x80..=0xBF) => (),
+                            (0xF4, 0x80..=0x8F) => (),
+                            _ => {
+                                error!();
+                            }
+                        }
+                        i += 1;
+                        if safe_get(self.source, i) & 192 != TAG_CONT_U8 {
+                            error!();
+                        }
+                        i += 1;
+                        if safe_get(self.source, i) & 192 != TAG_CONT_U8 {
+                            error!();
+                        }
+                        i += 1;
+                    }
+                    _ => {
+                        error!();
+                    }
+                }
+            }
+        }
+
+        let r = Utf8LossyChunk {
+            valid: unsafe { str::from_utf8_unchecked(self.source) },
+            broken: &[],
+        };
+        self.source = &[];
+        Some(r)
+    }
+}
+
+impl<'a> fmt::Display for Utf8Lossy<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        // If we're the empty string then our iterator won't actually yield
+        // anything, so perform the formatting manually
+        if self.bytes.is_empty() {
+            return "".fmt(f);
+        }
+
+        for Utf8LossyChunk { valid, broken } in self.chunks() {
+            // If we successfully decoded the whole chunk as a valid string then
+            // we can return a direct formatting of the string which will also
+            // respect various formatting flags if possible.
+            if valid.len() == self.bytes.len() {
+                assert!(broken.is_empty());
+                return valid.fmt(f);
+            }
+
+            f.write_str(valid)?;
+            if !broken.is_empty() {
+                f.write_char(char::REPLACEMENT_CHARACTER)?;
+            }
+        }
+        Ok(())
+    }
+}
+
+impl<'a> fmt::Debug for Utf8Lossy<'a> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_char('"')?;
+
+        for Utf8LossyChunk { valid, broken } in self.chunks() {
+            // Valid part.
+            // Here we partially parse UTF-8 again which is suboptimal.
+            {
+                let mut from = 0;
+                for (i, c) in valid.char_indices() {
+                    let esc = c.escape_debug();
+                    // If char needs escaping, flush backlog so far and write, else skip
+                    if esc.len() != 1 {
+                        f.write_str(&valid[from..i])?;
+                        for c in esc {
+                            f.write_char(c)?;
+                        }
+                        from = i + c.len_utf8();
+                    }
+                }
+                f.write_str(&valid[from..])?;
+            }
+
+            // Broken parts of string as hex escape.
+            for &b in broken {
+                write!(f, "\\x{:02x}", b)?;
+            }
+        }
+
+        f.write_char('"')
+    }
+}
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/str/mod.rs b/android/vendor/bumpalo-3.10.0/src/collections/str/mod.rs
new file mode 100644
index 0000000..29f4c6b
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/str/mod.rs
@@ -0,0 +1,43 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! String manipulation
+//!
+//! For more details, see std::str
+
+#[allow(missing_docs)]
+pub mod lossy;
+
+// https://tools.ietf.org/html/rfc3629
+#[rustfmt::skip]
+static UTF8_CHAR_WIDTH: [u8; 256] = [
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3F
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5F
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBF
+0,0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDF
+3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEF
+4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0, // 0xFF
+];
+
+/// Given a first byte, determines how many bytes are in this UTF-8 character.
+#[inline]
+pub fn utf8_char_width(b: u8) -> usize {
+    UTF8_CHAR_WIDTH[b as usize] as usize
+}
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/string.rs b/android/vendor/bumpalo-3.10.0/src/collections/string.rs
new file mode 100644
index 0000000..2bc99fd
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/string.rs
@@ -0,0 +1,2121 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! A UTF-8 encoded, growable string.
+//!
+//! This module contains the [`String`] type and several error types that may
+//! result from working with [`String`]s.
+//!
+//! This module is a fork of the [`std::string`] module, that uses a bump allocator.
+//!
+//! [`std::string`]: https://doc.rust-lang.org/std/string/index.html
+//!
+//! # Examples
+//!
+//! You can create a new [`String`] from a string literal with [`String::from_str_in`]:
+//!
+//! ```
+//! use bumpalo::{Bump, collections::String};
+//!
+//! let b = Bump::new();
+//!
+//! let s = String::from_str_in("world", &b);
+//! ```
+//!
+//! [`String`]: struct.String.html
+//! [`String::from_str_in`]: struct.String.html#method.from_str_in
+//!
+//! If you have a vector of valid UTF-8 bytes, you can make a [`String`] out of
+//! it. You can do the reverse too.
+//!
+//! ```
+//! use bumpalo::{Bump, collections::String};
+//!
+//! let b = Bump::new();
+//!
+//! let sparkle_heart = bumpalo::vec![in &b; 240, 159, 146, 150];
+//!
+//! // We know these bytes are valid, so we'll use `unwrap()`.
+//! let sparkle_heart = String::from_utf8(sparkle_heart).unwrap();
+//!
+//! assert_eq!("💖", sparkle_heart);
+//!
+//! let bytes = sparkle_heart.into_bytes();
+//!
+//! assert_eq!(bytes, [240, 159, 146, 150]);
+//! ```
+
+use crate::collections::str::lossy;
+use crate::collections::vec::Vec;
+use crate::Bump;
+use core::borrow::{Borrow, BorrowMut};
+use core::char::decode_utf16;
+use core::fmt;
+use core::hash;
+use core::iter::FusedIterator;
+use core::mem;
+use core::ops::Bound::{Excluded, Included, Unbounded};
+use core::ops::{self, Add, AddAssign, Index, IndexMut, RangeBounds};
+use core::ptr;
+use core::str::{self, Chars, Utf8Error};
+use core_alloc::borrow::Cow;
+
+/// Like the [`format!`] macro, but for creating [`bumpalo::collections::String`]s.
+///
+/// [`format!`]: https://doc.rust-lang.org/std/macro.format.html
+/// [`bumpalo::collections::String`]: collections/string/struct.String.html
+///
+/// # Examples
+///
+/// ```
+/// use bumpalo::Bump;
+///
+/// let b = Bump::new();
+///
+/// let who = "World";
+/// let s = bumpalo::format!(in &b, "Hello, {}!", who);
+/// assert_eq!(s, "Hello, World!")
+/// ```
+#[macro_export]
+macro_rules! format {
+    ( in $bump:expr, $fmt:expr, $($args:expr),* ) => {{
+        use $crate::core_alloc::fmt::Write;
+        let bump = $bump;
+        let mut s = $crate::collections::String::new_in(bump);
+        let _ = write!(&mut s, $fmt, $($args),*);
+        s
+    }};
+
+    ( in $bump:expr, $fmt:expr, $($args:expr,)* ) => {
+        $crate::format!(in $bump, $fmt, $($args),*)
+    };
+}
+
+/// A UTF-8 encoded, growable string.
+///
+/// The `String` type is the most common string type that has ownership over the
+/// contents of the string. It has a close relationship with its borrowed
+/// counterpart, the primitive [`str`].
+///
+/// [`str`]: https://doc.rust-lang.org/std/primitive.str.html
+///
+/// # Examples
+///
+/// You can create a `String` from a literal string with [`String::from_str_in`]:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// let hello = String::from_str_in("Hello, world!", &b);
+/// ```
+///
+/// You can append a [`char`] to a `String` with the [`push`] method, and
+/// append a [`&str`] with the [`push_str`] method:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// let mut hello = String::from_str_in("Hello, ", &b);
+///
+/// hello.push('w');
+/// hello.push_str("orld!");
+/// ```
+///
+/// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+/// [`push`]: #method.push
+/// [`push_str`]: #method.push_str
+///
+/// If you have a vector of UTF-8 bytes, you can create a `String` from it with
+/// the [`from_utf8`] method:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// // some bytes, in a vector
+/// let sparkle_heart = bumpalo::vec![in &b; 240, 159, 146, 150];
+///
+/// // We know these bytes are valid, so we'll use `unwrap()`.
+/// let sparkle_heart = String::from_utf8(sparkle_heart).unwrap();
+///
+/// assert_eq!("💖", sparkle_heart);
+/// ```
+///
+/// [`from_utf8`]: #method.from_utf8
+///
+/// # Deref
+///
+/// `String`s implement <code>[`Deref`]<Target = [`str`]></code>, and so inherit all of [`str`]'s
+/// methods. In addition, this means that you can pass a `String` to a
+/// function which takes a [`&str`] by using an ampersand (`&`):
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// fn takes_str(s: &str) { }
+///
+/// let s = String::from_str_in("Hello", &b);
+///
+/// takes_str(&s);
+/// ```
+///
+/// This will create a [`&str`] from the `String` and pass it in. This
+/// conversion is very inexpensive, and so generally, functions will accept
+/// [`&str`]s as arguments unless they need a `String` for some specific
+/// reason.
+///
+/// In certain cases Rust doesn't have enough information to make this
+/// conversion, known as [`Deref`] coercion. In the following example a string
+/// slice [`&'a str`][`&str`] implements the trait `TraitExample`, and the function
+/// `example_func` takes anything that implements the trait. In this case Rust
+/// would need to make two implicit conversions, which Rust doesn't have the
+/// means to do. For that reason, the following example will not compile.
+///
+/// ```compile_fail,E0277
+/// use bumpalo::{Bump, collections::String};
+///
+/// trait TraitExample {}
+///
+/// impl<'a> TraitExample for &'a str {}
+///
+/// fn example_func<A: TraitExample>(example_arg: A) {}
+///
+/// let b = Bump::new();
+/// let example_string = String::from_str_in("example_string", &b);
+/// example_func(&example_string);
+/// ```
+///
+/// There are two options that would work instead. The first would be to
+/// change the line `example_func(&example_string);` to
+/// `example_func(example_string.as_str());`, using the method [`as_str()`]
+/// to explicitly extract the string slice containing the string. The second
+/// way changes `example_func(&example_string);` to
+/// `example_func(&*example_string);`. In this case we are dereferencing a
+/// `String` to a [`str`][`&str`], then referencing the [`str`][`&str`] back to
+/// [`&str`]. The second way is more idiomatic, however both work to do the
+/// conversion explicitly rather than relying on the implicit conversion.
+///
+/// # Representation
+///
+/// A `String` is made up of three components: a pointer to some bytes, a
+/// length, and a capacity. The pointer points to an internal buffer `String`
+/// uses to store its data. The length is the number of bytes currently stored
+/// in the buffer, and the capacity is the size of the buffer in bytes. As such,
+/// the length will always be less than or equal to the capacity.
+///
+/// This buffer is always stored on the heap.
+///
+/// You can look at these with the [`as_ptr`], [`len`], and [`capacity`]
+/// methods:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+/// use std::mem;
+///
+/// let b = Bump::new();
+///
+/// let story = String::from_str_in("Once upon a time...", &b);
+///
+/// let ptr = story.as_ptr();
+/// let len = story.len();
+/// let capacity = story.capacity();
+///
+/// // story has nineteen bytes
+/// assert_eq!(19, len);
+///
+/// // Now that we have our parts, we throw the story away.
+/// mem::forget(story);
+///
+/// // We can re-build a String out of ptr, len, and capacity. This is all
+/// // unsafe because we are responsible for making sure the components are
+/// // valid:
+/// let s = unsafe { String::from_raw_parts_in(ptr as *mut _, len, capacity, &b) } ;
+///
+/// assert_eq!(String::from_str_in("Once upon a time...", &b), s);
+/// ```
+///
+/// [`as_ptr`]: https://doc.rust-lang.org/std/primitive.str.html#method.as_ptr
+/// [`len`]: #method.len
+/// [`capacity`]: #method.capacity
+///
+/// If a `String` has enough capacity, adding elements to it will not
+/// re-allocate. For example, consider this program:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// let mut s = String::new_in(&b);
+///
+/// println!("{}", s.capacity());
+///
+/// for _ in 0..5 {
+///     s.push_str("hello");
+///     println!("{}", s.capacity());
+/// }
+/// ```
+///
+/// This will output the following:
+///
+/// ```text
+/// 0
+/// 5
+/// 10
+/// 20
+/// 20
+/// 40
+/// ```
+///
+/// At first, we have no memory allocated at all, but as we append to the
+/// string, it increases its capacity appropriately. If we instead use the
+/// [`with_capacity_in`] method to allocate the correct capacity initially:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// let mut s = String::with_capacity_in(25, &b);
+///
+/// println!("{}", s.capacity());
+///
+/// for _ in 0..5 {
+///     s.push_str("hello");
+///     println!("{}", s.capacity());
+/// }
+/// ```
+///
+/// [`with_capacity_in`]: #method.with_capacity_in
+///
+/// We end up with a different output:
+///
+/// ```text
+/// 25
+/// 25
+/// 25
+/// 25
+/// 25
+/// 25
+/// ```
+///
+/// Here, there's no need to allocate more memory inside the loop.
+///
+/// [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
+/// [`Deref`]: https://doc.rust-lang.org/std/ops/trait.Deref.html
+/// [`as_str()`]: struct.String.html#method.as_str
+#[derive(PartialOrd, Eq, Ord)]
+pub struct String<'bump> {
+    vec: Vec<'bump, u8>,
+}
+
+/// A possible error value when converting a `String` from a UTF-8 byte vector.
+///
+/// This type is the error type for the [`from_utf8`] method on [`String`]. It
+/// is designed in such a way to carefully avoid reallocations: the
+/// [`into_bytes`] method will give back the byte vector that was used in the
+/// conversion attempt.
+///
+/// [`from_utf8`]: struct.String.html#method.from_utf8
+/// [`String`]: struct.String.html
+/// [`into_bytes`]: struct.FromUtf8Error.html#method.into_bytes
+///
+/// The [`Utf8Error`] type provided by [`std::str`] represents an error that may
+/// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's
+/// an analogue to `FromUtf8Error`, and you can get one from a `FromUtf8Error`
+/// through the [`utf8_error`] method.
+///
+/// [`Utf8Error`]: https://doc.rust-lang.org/std/str/struct.Utf8Error.html
+/// [`std::str`]: https://doc.rust-lang.org/std/str/index.html
+/// [`u8`]: https://doc.rust-lang.org/std/primitive.u8.html
+/// [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
+/// [`utf8_error`]: #method.utf8_error
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// // some invalid bytes, in a vector
+/// let bytes = bumpalo::vec![in &b; 0, 159];
+///
+/// let value = String::from_utf8(bytes);
+///
+/// assert!(value.is_err());
+/// assert_eq!(bumpalo::vec![in &b; 0, 159], value.unwrap_err().into_bytes());
+/// ```
+#[derive(Debug)]
+pub struct FromUtf8Error<'bump> {
+    bytes: Vec<'bump, u8>,
+    error: Utf8Error,
+}
+
+/// A possible error value when converting a `String` from a UTF-16 byte slice.
+///
+/// This type is the error type for the [`from_utf16_in`] method on [`String`].
+///
+/// [`from_utf16_in`]: struct.String.html#method.from_utf16_in
+/// [`String`]: struct.String.html
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let b = Bump::new();
+///
+/// // 𝄞mu<invalid>ic
+/// let v = &[0xD834, 0xDD1E, 0x006d, 0x0075, 0xD800, 0x0069, 0x0063];
+///
+/// assert!(String::from_utf16_in(v, &b).is_err());
+/// ```
+#[derive(Debug)]
+pub struct FromUtf16Error(());
+
+impl<'bump> String<'bump> {
+    /// Creates a new empty `String`.
+    ///
+    /// Given that the `String` is empty, this will not allocate any initial
+    /// buffer. While that means that this initial operation is very
+    /// inexpensive, it may cause excessive allocation later when you add
+    /// data. If you have an idea of how much data the `String` will hold,
+    /// consider the [`with_capacity_in`] method to prevent excessive
+    /// re-allocation.
+    ///
+    /// [`with_capacity_in`]: #method.with_capacity_in
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::new_in(&b);
+    /// ```
+    #[inline]
+    pub fn new_in(bump: &'bump Bump) -> String<'bump> {
+        String {
+            vec: Vec::new_in(bump),
+        }
+    }
+
+    /// Creates a new empty `String` with a particular capacity.
+    ///
+    /// `String`s have an internal buffer to hold their data. The capacity is
+    /// the length of that buffer, and can be queried with the [`capacity`]
+    /// method. This method creates an empty `String`, but one with an initial
+    /// buffer that can hold `capacity` bytes. This is useful when you may be
+    /// appending a bunch of data to the `String`, reducing the number of
+    /// reallocations it needs to do.
+    ///
+    /// [`capacity`]: #method.capacity
+    ///
+    /// If the given capacity is `0`, no allocation will occur, and this method
+    /// is identical to the [`new_in`] method.
+    ///
+    /// [`new_in`]: #method.new
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::with_capacity_in(10, &b);
+    ///
+    /// // The String contains no chars, even though it has capacity for more
+    /// assert_eq!(s.len(), 0);
+    ///
+    /// // These are all done without reallocating...
+    /// let cap = s.capacity();
+    /// for _ in 0..10 {
+    ///     s.push('a');
+    /// }
+    ///
+    /// assert_eq!(s.capacity(), cap);
+    ///
+    /// // ...but this may make the vector reallocate
+    /// s.push('a');
+    /// ```
+    #[inline]
+    pub fn with_capacity_in(capacity: usize, bump: &'bump Bump) -> String<'bump> {
+        String {
+            vec: Vec::with_capacity_in(capacity, bump),
+        }
+    }
+
+    /// Converts a vector of bytes to a `String`.
+    ///
+    /// A string (`String`) is made of bytes ([`u8`]), and a vector of bytes
+    /// ([`Vec<u8>`]) is made of bytes, so this function converts between the
+    /// two. Not all byte slices are valid `String`s, however: `String`
+    /// requires that it is valid UTF-8. `from_utf8()` checks to ensure that
+    /// the bytes are valid UTF-8, and then does the conversion.
+    ///
+    /// If you are sure that the byte slice is valid UTF-8, and you don't want
+    /// to incur the overhead of the validity check, there is an unsafe version
+    /// of this function, [`from_utf8_unchecked`], which has the same behavior
+    /// but skips the check.
+    ///
+    /// This method will take care to not copy the vector, for efficiency's
+    /// sake.
+    ///
+    /// If you need a [`&str`] instead of a `String`, consider
+    /// [`str::from_utf8`].
+    ///
+    /// The inverse of this method is [`into_bytes`].
+    ///
+    /// # Errors
+    ///
+    /// Returns [`Err`] if the slice is not UTF-8 with a description as to why the
+    /// provided bytes are not UTF-8. The vector you moved in is also included.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some bytes, in a vector
+    /// let sparkle_heart = bumpalo::vec![in &b; 240, 159, 146, 150];
+    ///
+    /// // We know these bytes are valid, so we'll use `unwrap()`.
+    /// let sparkle_heart = String::from_utf8(sparkle_heart).unwrap();
+    ///
+    /// assert_eq!("💖", sparkle_heart);
+    /// ```
+    ///
+    /// Incorrect bytes:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some invalid bytes, in a vector
+    /// let sparkle_heart = bumpalo::vec![in &b; 0, 159, 146, 150];
+    ///
+    /// assert!(String::from_utf8(sparkle_heart).is_err());
+    /// ```
+    ///
+    /// See the docs for [`FromUtf8Error`] for more details on what you can do
+    /// with this error.
+    ///
+    /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked
+    /// [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
+    /// [`u8`]: https://doc.rust-lang.org/std/primitive.u8.html
+    /// [`Vec<u8>`]: ../vec/struct.Vec.html
+    /// [`str::from_utf8`]: https://doc.rust-lang.org/std/str/fn.from_utf8.html
+    /// [`into_bytes`]: struct.String.html#method.into_bytes
+    /// [`FromUtf8Error`]: struct.FromUtf8Error.html
+    /// [`Err`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err
+    #[inline]
+    pub fn from_utf8(vec: Vec<'bump, u8>) -> Result<String<'bump>, FromUtf8Error<'bump>> {
+        match str::from_utf8(&vec) {
+            Ok(..) => Ok(String { vec }),
+            Err(e) => Err(FromUtf8Error {
+                bytes: vec,
+                error: e,
+            }),
+        }
+    }
+
+    /// Converts a slice of bytes to a string, including invalid characters.
+    ///
+    /// Strings are made of bytes ([`u8`]), and a slice of bytes
+    /// ([`&[u8]`][slice]) is made of bytes, so this function converts
+    /// between the two. Not all byte slices are valid strings, however: strings
+    /// are required to be valid UTF-8. During this conversion,
+    /// `from_utf8_lossy_in()` will replace any invalid UTF-8 sequences with
+    /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], which looks like this: �
+    ///
+    /// [`u8`]: https://doc.rust-lang.org/std/primitive.u8.html
+    /// [slice]: https://doc.rust-lang.org/std/primitive.slice.html
+    /// [U+FFFD]: https://doc.rust-lang.org/std/char/constant.REPLACEMENT_CHARACTER.html
+    ///
+    /// If you are sure that the byte slice is valid UTF-8, and you don't want
+    /// to incur the overhead of the conversion, there is an unsafe version
+    /// of this function, [`from_utf8_unchecked`], which has the same behavior
+    /// but skips the checks.
+    ///
+    /// [`from_utf8_unchecked`]: struct.String.html#method.from_utf8_unchecked
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{collections::String, Bump, vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some bytes, in a vector
+    /// let sparkle_heart = bumpalo::vec![in &b; 240, 159, 146, 150];
+    ///
+    /// let sparkle_heart = String::from_utf8_lossy_in(&sparkle_heart, &b);
+    ///
+    /// assert_eq!("💖", sparkle_heart);
+    /// ```
+    ///
+    /// Incorrect bytes:
+    ///
+    /// ```
+    /// use bumpalo::{collections::String, Bump, vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some invalid bytes
+    /// let input = b"Hello \xF0\x90\x80World";
+    /// let output = String::from_utf8_lossy_in(input, &b);
+    ///
+    /// assert_eq!("Hello �World", output);
+    /// ```
+    pub fn from_utf8_lossy_in(v: &[u8], bump: &'bump Bump) -> String<'bump> {
+        let mut iter = lossy::Utf8Lossy::from_bytes(v).chunks();
+
+        let (first_valid, first_broken) = if let Some(chunk) = iter.next() {
+            let lossy::Utf8LossyChunk { valid, broken } = chunk;
+            if valid.len() == v.len() {
+                debug_assert!(broken.is_empty());
+                unsafe {
+                    return String::from_utf8_unchecked(Vec::from_iter_in(v.iter().cloned(), bump));
+                }
+            }
+            (valid, broken)
+        } else {
+            return String::from_str_in("", bump);
+        };
+
+        const REPLACEMENT: &str = "\u{FFFD}";
+
+        let mut res = String::with_capacity_in(v.len(), bump);
+        res.push_str(first_valid);
+        if !first_broken.is_empty() {
+            res.push_str(REPLACEMENT);
+        }
+
+        for lossy::Utf8LossyChunk { valid, broken } in iter {
+            res.push_str(valid);
+            if !broken.is_empty() {
+                res.push_str(REPLACEMENT);
+            }
+        }
+
+        res
+    }
+
+    /// Decode a UTF-16 encoded slice `v` into a `String`, returning [`Err`]
+    /// if `v` contains any invalid data.
+    ///
+    /// [`Err`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // 𝄞music
+    /// let v = &[0xD834, 0xDD1E, 0x006d, 0x0075, 0x0073, 0x0069, 0x0063];
+    /// assert_eq!(String::from_str_in("𝄞music", &b), String::from_utf16_in(v, &b).unwrap());
+    ///
+    /// // 𝄞mu<invalid>ic
+    /// let v = &[0xD834, 0xDD1E, 0x006d, 0x0075, 0xD800, 0x0069, 0x0063];
+    /// assert!(String::from_utf16_in(v, &b).is_err());
+    /// ```
+    pub fn from_utf16_in(v: &[u16], bump: &'bump Bump) -> Result<String<'bump>, FromUtf16Error> {
+        let mut ret = String::with_capacity_in(v.len(), bump);
+        for c in decode_utf16(v.iter().cloned()) {
+            if let Ok(c) = c {
+                ret.push(c);
+            } else {
+                return Err(FromUtf16Error(()));
+            }
+        }
+        Ok(ret)
+    }
+
+    /// Construct a new `String<'bump>` from a string slice.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::from_str_in("hello", &b);
+    /// assert_eq!(s, "hello");
+    /// ```
+    pub fn from_str_in(s: &str, bump: &'bump Bump) -> String<'bump> {
+        let mut t = String::with_capacity_in(s.len(), bump);
+        t.push_str(s);
+        t
+    }
+
+    /// Construct a new `String<'bump>` from an iterator of `char`s.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::from_iter_in(['h', 'e', 'l', 'l', 'o'].iter().cloned(), &b);
+    /// assert_eq!(s, "hello");
+    /// ```
+    pub fn from_iter_in<I: IntoIterator<Item = char>>(iter: I, bump: &'bump Bump) -> String<'bump> {
+        let mut s = String::new_in(bump);
+        for c in iter {
+            s.push(c);
+        }
+        s
+    }
+
+    /// Creates a new `String` from a length, capacity, and pointer.
+    ///
+    /// # Safety
+    ///
+    /// This is highly unsafe, due to the number of invariants that aren't
+    /// checked:
+    ///
+    /// * The memory at `ptr` needs to have been previously allocated by the
+    ///   same allocator the standard library uses.
+    /// * `length` needs to be less than or equal to `capacity`.
+    /// * `capacity` needs to be the correct value.
+    ///
+    /// Violating these may cause problems like corrupting the allocator's
+    /// internal data structures.
+    ///
+    /// The ownership of `ptr` is effectively transferred to the
+    /// `String` which may then deallocate, reallocate or change the
+    /// contents of memory pointed to by the pointer at will. Ensure
+    /// that nothing else uses the pointer after calling this
+    /// function.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    /// use std::mem;
+    ///
+    /// let b = Bump::new();
+    ///
+    /// unsafe {
+    ///     let s = String::from_str_in("hello", &b);
+    ///     let ptr = s.as_ptr();
+    ///     let len = s.len();
+    ///     let capacity = s.capacity();
+    ///
+    ///     mem::forget(s);
+    ///
+    ///     let s = String::from_raw_parts_in(ptr as *mut _, len, capacity, &b);
+    ///
+    ///     assert_eq!(s, "hello");
+    /// }
+    /// ```
+    #[inline]
+    pub unsafe fn from_raw_parts_in(
+        buf: *mut u8,
+        length: usize,
+        capacity: usize,
+        bump: &'bump Bump,
+    ) -> String<'bump> {
+        String {
+            vec: Vec::from_raw_parts_in(buf, length, capacity, bump),
+        }
+    }
+
+    /// Converts a vector of bytes to a `String` without checking that the
+    /// string contains valid UTF-8.
+    ///
+    /// See the safe version, [`from_utf8`], for more details.
+    ///
+    /// [`from_utf8`]: struct.String.html#method.from_utf8
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because it does not check that the bytes passed
+    /// to it are valid UTF-8. If this constraint is violated, it may cause
+    /// memory unsafety issues with future users of the `String`,
+    /// as it is assumed that `String`s are valid UTF-8.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some bytes, in a vector
+    /// let sparkle_heart = bumpalo::vec![in &b; 240, 159, 146, 150];
+    ///
+    /// let sparkle_heart = unsafe {
+    ///     String::from_utf8_unchecked(sparkle_heart)
+    /// };
+    ///
+    /// assert_eq!("💖", sparkle_heart);
+    /// ```
+    #[inline]
+    pub unsafe fn from_utf8_unchecked(bytes: Vec<'bump, u8>) -> String<'bump> {
+        String { vec: bytes }
+    }
+
+    /// Converts a `String` into a byte vector.
+    ///
+    /// This consumes the `String`, so we do not need to copy its contents.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::from_str_in("hello", &b);
+    ///
+    /// assert_eq!(s.into_bytes(), [104, 101, 108, 108, 111]);
+    /// ```
+    #[inline]
+    pub fn into_bytes(self) -> Vec<'bump, u8> {
+        self.vec
+    }
+
+    /// Convert this `String<'bump>` into a `&'bump str`. This is analogous to
+    /// [`std::string::String::into_boxed_str`][into_boxed_str].
+    ///
+    /// [into_boxed_str]: https://doc.rust-lang.org/std/string/struct.String.html#method.into_boxed_str
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::from_str_in("foo", &b);
+    ///
+    /// assert_eq!(s.into_bump_str(), "foo");
+    /// ```
+    pub fn into_bump_str(self) -> &'bump str {
+        let s = unsafe {
+            let s = self.as_str();
+            mem::transmute(s)
+        };
+        mem::forget(self);
+        s
+    }
+
+    /// Extracts a string slice containing the entire `String`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::from_str_in("foo", &b);
+    ///
+    /// assert_eq!("foo", s.as_str());
+    /// ```
+    #[inline]
+    pub fn as_str(&self) -> &str {
+        self
+    }
+
+    /// Converts a `String` into a mutable string slice.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("foobar", &b);
+    /// let s_mut_str = s.as_mut_str();
+    ///
+    /// s_mut_str.make_ascii_uppercase();
+    ///
+    /// assert_eq!("FOOBAR", s_mut_str);
+    /// ```
+    #[inline]
+    pub fn as_mut_str(&mut self) -> &mut str {
+        self
+    }
+
+    /// Appends a given string slice onto the end of this `String`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("foo", &b);
+    ///
+    /// s.push_str("bar");
+    ///
+    /// assert_eq!("foobar", s);
+    /// ```
+    #[inline]
+    pub fn push_str(&mut self, string: &str) {
+        self.vec.extend_from_slice(string.as_bytes())
+    }
+
+    /// Returns this `String`'s capacity, in bytes.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::with_capacity_in(10, &b);
+    ///
+    /// assert!(s.capacity() >= 10);
+    /// ```
+    #[inline]
+    pub fn capacity(&self) -> usize {
+        self.vec.capacity()
+    }
+
+    /// Ensures that this `String`'s capacity is at least `additional` bytes
+    /// larger than its length.
+    ///
+    /// The capacity may be increased by more than `additional` bytes if it
+    /// chooses, to prevent frequent reallocations.
+    ///
+    /// If you do not want this "at least" behavior, see the [`reserve_exact`]
+    /// method.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows [`usize`].
+    ///
+    /// [`reserve_exact`]: struct.String.html#method.reserve_exact
+    /// [`usize`]: https://doc.rust-lang.org/std/primitive.usize.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::new_in(&b);
+    ///
+    /// s.reserve(10);
+    ///
+    /// assert!(s.capacity() >= 10);
+    /// ```
+    ///
+    /// This may not actually increase the capacity:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::with_capacity_in(10, &b);
+    /// s.push('a');
+    /// s.push('b');
+    ///
+    /// // s now has a length of 2 and a capacity of 10
+    /// assert_eq!(2, s.len());
+    /// assert_eq!(10, s.capacity());
+    ///
+    /// // Since we already have an extra 8 capacity, calling this...
+    /// s.reserve(8);
+    ///
+    /// // ... doesn't actually increase.
+    /// assert_eq!(10, s.capacity());
+    /// ```
+    #[inline]
+    pub fn reserve(&mut self, additional: usize) {
+        self.vec.reserve(additional)
+    }
+
+    /// Ensures that this `String`'s capacity is `additional` bytes
+    /// larger than its length.
+    ///
+    /// Consider using the [`reserve`] method unless you absolutely know
+    /// better than the allocator.
+    ///
+    /// [`reserve`]: #method.reserve
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows `usize`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::new_in(&b);
+    ///
+    /// s.reserve_exact(10);
+    ///
+    /// assert!(s.capacity() >= 10);
+    /// ```
+    ///
+    /// This may not actually increase the capacity:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::with_capacity_in(10, &b);
+    /// s.push('a');
+    /// s.push('b');
+    ///
+    /// // s now has a length of 2 and a capacity of 10
+    /// assert_eq!(2, s.len());
+    /// assert_eq!(10, s.capacity());
+    ///
+    /// // Since we already have an extra 8 capacity, calling this...
+    /// s.reserve_exact(8);
+    ///
+    /// // ... doesn't actually increase.
+    /// assert_eq!(10, s.capacity());
+    /// ```
+    #[inline]
+    pub fn reserve_exact(&mut self, additional: usize) {
+        self.vec.reserve_exact(additional)
+    }
+
+    /// Shrinks the capacity of this `String` to match its length.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("foo", &b);
+    ///
+    /// s.reserve(100);
+    /// assert!(s.capacity() >= 100);
+    ///
+    /// s.shrink_to_fit();
+    /// assert_eq!(3, s.capacity());
+    /// ```
+    #[inline]
+    pub fn shrink_to_fit(&mut self) {
+        self.vec.shrink_to_fit()
+    }
+
+    /// Appends the given [`char`] to the end of this `String`.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("abc", &b);
+    ///
+    /// s.push('1');
+    /// s.push('2');
+    /// s.push('3');
+    ///
+    /// assert_eq!("abc123", s);
+    /// ```
+    #[inline]
+    pub fn push(&mut self, ch: char) {
+        match ch.len_utf8() {
+            1 => self.vec.push(ch as u8),
+            _ => self
+                .vec
+                .extend_from_slice(ch.encode_utf8(&mut [0; 4]).as_bytes()),
+        }
+    }
+
+    /// Returns a byte slice of this `String`'s contents.
+    ///
+    /// The inverse of this method is [`from_utf8`].
+    ///
+    /// [`from_utf8`]: #method.from_utf8
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let s = String::from_str_in("hello", &b);
+    ///
+    /// assert_eq!(&[104, 101, 108, 108, 111], s.as_bytes());
+    /// ```
+    #[inline]
+    pub fn as_bytes(&self) -> &[u8] {
+        &self.vec
+    }
+
+    /// Shortens this `String` to the specified length.
+    ///
+    /// If `new_len` is greater than the string's current length, this has no
+    /// effect.
+    ///
+    /// Note that this method has no effect on the allocated capacity
+    /// of the string.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `new_len` does not lie on a [`char`] boundary.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("hello", &b);
+    ///
+    /// s.truncate(2);
+    ///
+    /// assert_eq!("he", s);
+    /// ```
+    #[inline]
+    pub fn truncate(&mut self, new_len: usize) {
+        if new_len <= self.len() {
+            assert!(self.is_char_boundary(new_len));
+            self.vec.truncate(new_len)
+        }
+    }
+
+    /// Removes the last character from the string buffer and returns it.
+    ///
+    /// Returns [`None`] if this `String` is empty.
+    ///
+    /// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("foo", &b);
+    ///
+    /// assert_eq!(s.pop(), Some('o'));
+    /// assert_eq!(s.pop(), Some('o'));
+    /// assert_eq!(s.pop(), Some('f'));
+    ///
+    /// assert_eq!(s.pop(), None);
+    /// ```
+    #[inline]
+    pub fn pop(&mut self) -> Option<char> {
+        let ch = self.chars().rev().next()?;
+        let newlen = self.len() - ch.len_utf8();
+        unsafe {
+            self.vec.set_len(newlen);
+        }
+        Some(ch)
+    }
+
+    /// Removes a [`char`] from this `String` at a byte position and returns it.
+    ///
+    /// This is an `O(n)` operation, as it requires copying every element in the
+    /// buffer.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `idx` is larger than or equal to the `String`'s length,
+    /// or if it does not lie on a [`char`] boundary.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("foo", &b);
+    ///
+    /// assert_eq!(s.remove(0), 'f');
+    /// assert_eq!(s.remove(1), 'o');
+    /// assert_eq!(s.remove(0), 'o');
+    /// ```
+    #[inline]
+    pub fn remove(&mut self, idx: usize) -> char {
+        let ch = match self[idx..].chars().next() {
+            Some(ch) => ch,
+            None => panic!("cannot remove a char from the end of a string"),
+        };
+
+        let next = idx + ch.len_utf8();
+        let len = self.len();
+        unsafe {
+            ptr::copy(
+                self.vec.as_ptr().add(next),
+                self.vec.as_mut_ptr().add(idx),
+                len - next,
+            );
+            self.vec.set_len(len - (next - idx));
+        }
+        ch
+    }
+
+    /// Retains only the characters specified by the predicate.
+    ///
+    /// In other words, remove all characters `c` such that `f(c)` returns `false`.
+    /// This method operates in place and preserves the order of the retained
+    /// characters.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("f_o_ob_ar", &b);
+    ///
+    /// s.retain(|c| c != '_');
+    ///
+    /// assert_eq!(s, "foobar");
+    /// ```
+    #[inline]
+    pub fn retain<F>(&mut self, mut f: F)
+    where
+        F: FnMut(char) -> bool,
+    {
+        let len = self.len();
+        let mut del_bytes = 0;
+        let mut idx = 0;
+
+        while idx < len {
+            let ch = unsafe { self.get_unchecked(idx..len).chars().next().unwrap() };
+            let ch_len = ch.len_utf8();
+
+            if !f(ch) {
+                del_bytes += ch_len;
+            } else if del_bytes > 0 {
+                unsafe {
+                    ptr::copy(
+                        self.vec.as_ptr().add(idx),
+                        self.vec.as_mut_ptr().add(idx - del_bytes),
+                        ch_len,
+                    );
+                }
+            }
+
+            // Point idx to the next char
+            idx += ch_len;
+        }
+
+        if del_bytes > 0 {
+            unsafe {
+                self.vec.set_len(len - del_bytes);
+            }
+        }
+    }
+
+    /// Inserts a character into this `String` at a byte position.
+    ///
+    /// This is an `O(n)` operation as it requires copying every element in the
+    /// buffer.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `idx` is larger than the `String`'s length, or if it does not
+    /// lie on a [`char`] boundary.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::with_capacity_in(3, &b);
+    ///
+    /// s.insert(0, 'f');
+    /// s.insert(1, 'o');
+    /// s.insert(2, 'o');
+    ///
+    /// assert_eq!("foo", s);
+    /// ```
+    #[inline]
+    pub fn insert(&mut self, idx: usize, ch: char) {
+        assert!(self.is_char_boundary(idx));
+        let mut bits = [0; 4];
+        let bits = ch.encode_utf8(&mut bits).as_bytes();
+
+        unsafe {
+            self.insert_bytes(idx, bits);
+        }
+    }
+
+    unsafe fn insert_bytes(&mut self, idx: usize, bytes: &[u8]) {
+        let len = self.len();
+        let amt = bytes.len();
+        self.vec.reserve(amt);
+
+        ptr::copy(
+            self.vec.as_ptr().add(idx),
+            self.vec.as_mut_ptr().add(idx + amt),
+            len - idx,
+        );
+        ptr::copy(bytes.as_ptr(), self.vec.as_mut_ptr().add(idx), amt);
+        self.vec.set_len(len + amt);
+    }
+
+    /// Inserts a string slice into this `String` at a byte position.
+    ///
+    /// This is an `O(n)` operation as it requires copying every element in the
+    /// buffer.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `idx` is larger than the `String`'s length, or if it does not
+    /// lie on a [`char`] boundary.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("bar", &b);
+    ///
+    /// s.insert_str(0, "foo");
+    ///
+    /// assert_eq!("foobar", s);
+    /// ```
+    #[inline]
+    pub fn insert_str(&mut self, idx: usize, string: &str) {
+        assert!(self.is_char_boundary(idx));
+
+        unsafe {
+            self.insert_bytes(idx, string.as_bytes());
+        }
+    }
+
+    /// Returns a mutable reference to the contents of this `String`.
+    ///
+    /// # Safety
+    ///
+    /// This function is unsafe because the returned `&mut Vec` allows writing
+    /// bytes which are not valid UTF-8. If this constraint is violated, using
+    /// the original `String` after dropping the `&mut Vec` may violate memory
+    /// safety, as it is assumed that `String`s are valid UTF-8.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("hello", &b);
+    ///
+    /// unsafe {
+    ///     let vec = s.as_mut_vec();
+    ///     assert_eq!(vec, &[104, 101, 108, 108, 111]);
+    ///
+    ///     vec.reverse();
+    /// }
+    /// assert_eq!(s, "olleh");
+    /// ```
+    #[inline]
+    pub unsafe fn as_mut_vec(&mut self) -> &mut Vec<'bump, u8> {
+        &mut self.vec
+    }
+
+    /// Returns the length of this `String`, in bytes.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let a = String::from_str_in("foo", &b);
+    ///
+    /// assert_eq!(a.len(), 3);
+    /// ```
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.vec.len()
+    }
+
+    /// Returns `true` if this `String` has a length of zero.
+    ///
+    /// Returns `false` otherwise.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = String::new_in(&b);
+    /// assert!(v.is_empty());
+    ///
+    /// v.push('a');
+    /// assert!(!v.is_empty());
+    /// ```
+    #[inline]
+    pub fn is_empty(&self) -> bool {
+        self.len() == 0
+    }
+
+    /// Splits the string into two at the given index.
+    ///
+    /// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
+    /// the returned `String` contains bytes `[at, len)`. `at` must be on the
+    /// boundary of a UTF-8 code point.
+    ///
+    /// Note that the capacity of `self` does not change.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `at` is not on a UTF-8 code point boundary, or if it is beyond the last
+    /// code point of the string.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut hello = String::from_str_in("Hello, World!", &b);
+    /// let world = hello.split_off(7);
+    /// assert_eq!(hello, "Hello, ");
+    /// assert_eq!(world, "World!");
+    /// ```
+    #[inline]
+    pub fn split_off(&mut self, at: usize) -> String<'bump> {
+        assert!(self.is_char_boundary(at));
+        let other = self.vec.split_off(at);
+        unsafe { String::from_utf8_unchecked(other) }
+    }
+
+    /// Truncates this `String`, removing all contents.
+    ///
+    /// While this means the `String` will have a length of zero, it does not
+    /// touch its capacity.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("foo", &b);
+    ///
+    /// s.clear();
+    ///
+    /// assert!(s.is_empty());
+    /// assert_eq!(0, s.len());
+    /// assert_eq!(3, s.capacity());
+    /// ```
+    #[inline]
+    pub fn clear(&mut self) {
+        self.vec.clear()
+    }
+
+    /// Creates a draining iterator that removes the specified range in the `String`
+    /// and yields the removed `chars`.
+    ///
+    /// Note: The element range is removed even if the iterator is not
+    /// consumed until the end.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the starting point or end point do not lie on a [`char`]
+    /// boundary, or if they're out of bounds.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("α is alpha, β is beta", &b);
+    /// let beta_offset = s.find('β').unwrap_or(s.len());
+    ///
+    /// // Remove the range up until the β from the string
+    /// let t = String::from_iter_in(s.drain(..beta_offset), &b);
+    /// assert_eq!(t, "α is alpha, ");
+    /// assert_eq!(s, "β is beta");
+    ///
+    /// // A full range clears the string
+    /// s.drain(..);
+    /// assert_eq!(s, "");
+    /// ```
+    pub fn drain<'a, R>(&'a mut self, range: R) -> Drain<'a, 'bump>
+    where
+        R: RangeBounds<usize>,
+    {
+        // Memory safety
+        //
+        // The String version of Drain does not have the memory safety issues
+        // of the vector version. The data is just plain bytes.
+        // Because the range removal happens in Drop, if the Drain iterator is leaked,
+        // the removal will not happen.
+        let len = self.len();
+        let start = match range.start_bound() {
+            Included(&n) => n,
+            Excluded(&n) => n + 1,
+            Unbounded => 0,
+        };
+        let end = match range.end_bound() {
+            Included(&n) => n + 1,
+            Excluded(&n) => n,
+            Unbounded => len,
+        };
+
+        // Take out two simultaneous borrows. The &mut String won't be accessed
+        // until iteration is over, in Drop.
+        let self_ptr = self as *mut _;
+        // slicing does the appropriate bounds checks
+        let chars_iter = self[start..end].chars();
+
+        Drain {
+            start,
+            end,
+            iter: chars_iter,
+            string: self_ptr,
+        }
+    }
+
+    /// Removes the specified range in the string,
+    /// and replaces it with the given string.
+    /// The given string doesn't need to be the same length as the range.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the starting point or end point do not lie on a [`char`]
+    /// boundary, or if they're out of bounds.
+    ///
+    /// [`char`]: https://doc.rust-lang.org/std/primitive.char.html
+    /// [`Vec::splice`]: ../vec/struct.Vec.html#method.splice
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut s = String::from_str_in("α is alpha, β is beta", &b);
+    /// let beta_offset = s.find('β').unwrap_or(s.len());
+    ///
+    /// // Replace the range up until the β from the string
+    /// s.replace_range(..beta_offset, "Α is capital alpha; ");
+    /// assert_eq!(s, "Α is capital alpha; β is beta");
+    /// ```
+    pub fn replace_range<R>(&mut self, range: R, replace_with: &str)
+    where
+        R: RangeBounds<usize>,
+    {
+        // Memory safety
+        //
+        // Replace_range does not have the memory safety issues of a vector Splice.
+        // of the vector version. The data is just plain bytes.
+
+        match range.start_bound() {
+            Included(&n) => assert!(self.is_char_boundary(n)),
+            Excluded(&n) => assert!(self.is_char_boundary(n + 1)),
+            Unbounded => {}
+        };
+        match range.end_bound() {
+            Included(&n) => assert!(self.is_char_boundary(n + 1)),
+            Excluded(&n) => assert!(self.is_char_boundary(n)),
+            Unbounded => {}
+        };
+
+        unsafe { self.as_mut_vec() }.splice(range, replace_with.bytes());
+    }
+}
+
+impl<'bump> FromUtf8Error<'bump> {
+    /// Returns a slice of bytes that were attempted to convert to a `String`.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some invalid bytes, in a vector
+    /// let bytes = bumpalo::vec![in &b; 0, 159];
+    ///
+    /// let value = String::from_utf8(bytes);
+    ///
+    /// assert_eq!(&[0, 159], value.unwrap_err().as_bytes());
+    /// ```
+    pub fn as_bytes(&self) -> &[u8] {
+        &self.bytes[..]
+    }
+
+    /// Returns the bytes that were attempted to convert to a `String`.
+    ///
+    /// This method is carefully constructed to avoid allocation. It will
+    /// consume the error, moving out the bytes, so that a copy of the bytes
+    /// does not need to be made.
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some invalid bytes, in a vector
+    /// let bytes = bumpalo::vec![in &b; 0, 159];
+    ///
+    /// let value = String::from_utf8(bytes);
+    ///
+    /// assert_eq!(bumpalo::vec![in &b; 0, 159], value.unwrap_err().into_bytes());
+    /// ```
+    pub fn into_bytes(self) -> Vec<'bump, u8> {
+        self.bytes
+    }
+
+    /// Fetch a `Utf8Error` to get more details about the conversion failure.
+    ///
+    /// The [`Utf8Error`] type provided by [`std::str`] represents an error that may
+    /// occur when converting a slice of [`u8`]s to a [`&str`]. In this sense, it's
+    /// an analogue to `FromUtf8Error`. See its documentation for more details
+    /// on using it.
+    ///
+    /// [`Utf8Error`]: https://doc.rust-lang.org/std/str/struct.Utf8Error.html
+    /// [`std::str`]: https://doc.rust-lang.org/std/str/index.html
+    /// [`u8`]: https://doc.rust-lang.org/std/primitive.u8.html
+    /// [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
+    ///
+    /// # Examples
+    ///
+    /// Basic usage:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::String};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// // some invalid bytes, in a vector
+    /// let bytes = bumpalo::vec![in &b; 0, 159];
+    ///
+    /// let error = String::from_utf8(bytes).unwrap_err().utf8_error();
+    ///
+    /// // the first byte is invalid here
+    /// assert_eq!(1, error.valid_up_to());
+    /// ```
+    pub fn utf8_error(&self) -> Utf8Error {
+        self.error
+    }
+}
+
+impl<'bump> fmt::Display for FromUtf8Error<'bump> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&self.error, f)
+    }
+}
+
+impl fmt::Display for FromUtf16Error {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt("invalid utf-16: lone surrogate found", f)
+    }
+}
+
+impl<'bump> Clone for String<'bump> {
+    fn clone(&self) -> Self {
+        String {
+            vec: self.vec.clone(),
+        }
+    }
+
+    fn clone_from(&mut self, source: &Self) {
+        self.vec.clone_from(&source.vec);
+    }
+}
+
+impl<'bump> Extend<char> for String<'bump> {
+    fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I) {
+        let iterator = iter.into_iter();
+        let (lower_bound, _) = iterator.size_hint();
+        self.reserve(lower_bound);
+        for ch in iterator {
+            self.push(ch)
+        }
+    }
+}
+
+impl<'a, 'bump> Extend<&'a char> for String<'bump> {
+    fn extend<I: IntoIterator<Item = &'a char>>(&mut self, iter: I) {
+        self.extend(iter.into_iter().cloned());
+    }
+}
+
+impl<'a, 'bump> Extend<&'a str> for String<'bump> {
+    fn extend<I: IntoIterator<Item = &'a str>>(&mut self, iter: I) {
+        for s in iter {
+            self.push_str(s)
+        }
+    }
+}
+
+impl<'bump> Extend<String<'bump>> for String<'bump> {
+    fn extend<I: IntoIterator<Item = String<'bump>>>(&mut self, iter: I) {
+        for s in iter {
+            self.push_str(&s)
+        }
+    }
+}
+
+impl<'bump> Extend<core_alloc::string::String> for String<'bump> {
+    fn extend<I: IntoIterator<Item = core_alloc::string::String>>(&mut self, iter: I) {
+        for s in iter {
+            self.push_str(&s)
+        }
+    }
+}
+
+impl<'a, 'bump> Extend<Cow<'a, str>> for String<'bump> {
+    fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I) {
+        for s in iter {
+            self.push_str(&s)
+        }
+    }
+}
+
+impl<'bump> PartialEq for String<'bump> {
+    #[inline]
+    fn eq(&self, other: &String) -> bool {
+        PartialEq::eq(&self[..], &other[..])
+    }
+}
+
+macro_rules! impl_eq {
+    ($lhs:ty, $rhs: ty) => {
+        impl<'a, 'bump> PartialEq<$rhs> for $lhs {
+            #[inline]
+            fn eq(&self, other: &$rhs) -> bool {
+                PartialEq::eq(&self[..], &other[..])
+            }
+        }
+
+        impl<'a, 'b, 'bump> PartialEq<$lhs> for $rhs {
+            #[inline]
+            fn eq(&self, other: &$lhs) -> bool {
+                PartialEq::eq(&self[..], &other[..])
+            }
+        }
+    };
+}
+
+impl_eq! { String<'bump>, str }
+impl_eq! { String<'bump>, &'a str }
+impl_eq! { Cow<'a, str>, String<'bump> }
+impl_eq! { core_alloc::string::String, String<'bump> }
+
+impl<'bump> fmt::Display for String<'bump> {
+    #[inline]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&**self, f)
+    }
+}
+
+impl<'bump> fmt::Debug for String<'bump> {
+    #[inline]
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Debug::fmt(&**self, f)
+    }
+}
+
+impl<'bump> hash::Hash for String<'bump> {
+    #[inline]
+    fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
+        (**self).hash(hasher)
+    }
+}
+
+/// Implements the `+` operator for concatenating two strings.
+///
+/// This consumes the `String<'bump>` on the left-hand side and re-uses its buffer (growing it if
+/// necessary). This is done to avoid allocating a new `String<'bump>` and copying the entire contents on
+/// every operation, which would lead to `O(n^2)` running time when building an `n`-byte string by
+/// repeated concatenation.
+///
+/// The string on the right-hand side is only borrowed; its contents are copied into the returned
+/// `String<'bump>`.
+///
+/// # Examples
+///
+/// Concatenating two `String<'bump>`s takes the first by value and borrows the second:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let bump = Bump::new();
+///
+/// let a = String::from_str_in("hello", &bump);
+/// let b = String::from_str_in(" world", &bump);
+/// let c = a + &b;
+/// // `a` is moved and can no longer be used here.
+/// ```
+///
+/// If you want to keep using the first `String`, you can clone it and append to the clone instead:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let bump = Bump::new();
+///
+/// let a = String::from_str_in("hello", &bump);
+/// let b = String::from_str_in(" world", &bump);
+/// let c = a.clone() + &b;
+/// // `a` is still valid here.
+/// ```
+///
+/// Concatenating `&str` slices can be done by converting the first to a `String`:
+///
+/// ```
+/// use bumpalo::{Bump, collections::String};
+///
+/// let bump = Bump::new();
+///
+/// let a = "hello";
+/// let b = " world";
+/// let c = String::from_str_in(a, &bump) + b;
+/// ```
+impl<'a, 'bump> Add<&'a str> for String<'bump> {
+    type Output = String<'bump>;
+
+    #[inline]
+    fn add(mut self, other: &str) -> String<'bump> {
+        self.push_str(other);
+        self
+    }
+}
+
+/// Implements the `+=` operator for appending to a `String<'bump>`.
+///
+/// This has the same behavior as the [`push_str`][String::push_str] method.
+impl<'a, 'bump> AddAssign<&'a str> for String<'bump> {
+    #[inline]
+    fn add_assign(&mut self, other: &str) {
+        self.push_str(other);
+    }
+}
+
+impl<'bump> ops::Index<ops::Range<usize>> for String<'bump> {
+    type Output = str;
+
+    #[inline]
+    fn index(&self, index: ops::Range<usize>) -> &str {
+        &self[..][index]
+    }
+}
+impl<'bump> ops::Index<ops::RangeTo<usize>> for String<'bump> {
+    type Output = str;
+
+    #[inline]
+    fn index(&self, index: ops::RangeTo<usize>) -> &str {
+        &self[..][index]
+    }
+}
+impl<'bump> ops::Index<ops::RangeFrom<usize>> for String<'bump> {
+    type Output = str;
+
+    #[inline]
+    fn index(&self, index: ops::RangeFrom<usize>) -> &str {
+        &self[..][index]
+    }
+}
+impl<'bump> ops::Index<ops::RangeFull> for String<'bump> {
+    type Output = str;
+
+    #[inline]
+    fn index(&self, _index: ops::RangeFull) -> &str {
+        unsafe { str::from_utf8_unchecked(&self.vec) }
+    }
+}
+impl<'bump> ops::Index<ops::RangeInclusive<usize>> for String<'bump> {
+    type Output = str;
+
+    #[inline]
+    fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
+        Index::index(&**self, index)
+    }
+}
+impl<'bump> ops::Index<ops::RangeToInclusive<usize>> for String<'bump> {
+    type Output = str;
+
+    #[inline]
+    fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
+        Index::index(&**self, index)
+    }
+}
+
+impl<'bump> ops::IndexMut<ops::Range<usize>> for String<'bump> {
+    #[inline]
+    fn index_mut(&mut self, index: ops::Range<usize>) -> &mut str {
+        &mut self[..][index]
+    }
+}
+impl<'bump> ops::IndexMut<ops::RangeTo<usize>> for String<'bump> {
+    #[inline]
+    fn index_mut(&mut self, index: ops::RangeTo<usize>) -> &mut str {
+        &mut self[..][index]
+    }
+}
+impl<'bump> ops::IndexMut<ops::RangeFrom<usize>> for String<'bump> {
+    #[inline]
+    fn index_mut(&mut self, index: ops::RangeFrom<usize>) -> &mut str {
+        &mut self[..][index]
+    }
+}
+impl<'bump> ops::IndexMut<ops::RangeFull> for String<'bump> {
+    #[inline]
+    fn index_mut(&mut self, _index: ops::RangeFull) -> &mut str {
+        unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
+    }
+}
+impl<'bump> ops::IndexMut<ops::RangeInclusive<usize>> for String<'bump> {
+    #[inline]
+    fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
+        IndexMut::index_mut(&mut **self, index)
+    }
+}
+impl<'bump> ops::IndexMut<ops::RangeToInclusive<usize>> for String<'bump> {
+    #[inline]
+    fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
+        IndexMut::index_mut(&mut **self, index)
+    }
+}
+
+impl<'bump> ops::Deref for String<'bump> {
+    type Target = str;
+
+    #[inline]
+    fn deref(&self) -> &str {
+        unsafe { str::from_utf8_unchecked(&self.vec) }
+    }
+}
+
+impl<'bump> ops::DerefMut for String<'bump> {
+    #[inline]
+    fn deref_mut(&mut self) -> &mut str {
+        unsafe { str::from_utf8_unchecked_mut(&mut *self.vec) }
+    }
+}
+
+impl<'bump> AsRef<str> for String<'bump> {
+    #[inline]
+    fn as_ref(&self) -> &str {
+        self
+    }
+}
+
+impl<'bump> AsRef<[u8]> for String<'bump> {
+    #[inline]
+    fn as_ref(&self) -> &[u8] {
+        self.as_bytes()
+    }
+}
+
+impl<'bump> fmt::Write for String<'bump> {
+    #[inline]
+    fn write_str(&mut self, s: &str) -> fmt::Result {
+        self.push_str(s);
+        Ok(())
+    }
+
+    #[inline]
+    fn write_char(&mut self, c: char) -> fmt::Result {
+        self.push(c);
+        Ok(())
+    }
+}
+
+impl<'bump> Borrow<str> for String<'bump> {
+    #[inline]
+    fn borrow(&self) -> &str {
+        &self[..]
+    }
+}
+
+impl<'bump> BorrowMut<str> for String<'bump> {
+    #[inline]
+    fn borrow_mut(&mut self) -> &mut str {
+        &mut self[..]
+    }
+}
+
+/// A draining iterator for `String`.
+///
+/// This struct is created by the [`String::drain`] method. See its
+/// documentation for more information.
+pub struct Drain<'a, 'bump> {
+    /// Will be used as &'a mut String in the destructor
+    string: *mut String<'bump>,
+    /// Start of part to remove
+    start: usize,
+    /// End of part to remove
+    end: usize,
+    /// Current remaining range to remove
+    iter: Chars<'a>,
+}
+
+impl<'a, 'bump> fmt::Debug for Drain<'a, 'bump> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.pad("Drain { .. }")
+    }
+}
+
+unsafe impl<'a, 'bump> Sync for Drain<'a, 'bump> {}
+unsafe impl<'a, 'bump> Send for Drain<'a, 'bump> {}
+
+impl<'a, 'bump> Drop for Drain<'a, 'bump> {
+    fn drop(&mut self) {
+        unsafe {
+            // Use Vec::drain. "Reaffirm" the bounds checks to avoid
+            // panic code being inserted again.
+            let self_vec = (*self.string).as_mut_vec();
+            if self.start <= self.end && self.end <= self_vec.len() {
+                self_vec.drain(self.start..self.end);
+            }
+        }
+    }
+}
+
+impl<'a, 'bump> Iterator for Drain<'a, 'bump> {
+    type Item = char;
+
+    #[inline]
+    fn next(&mut self) -> Option<char> {
+        self.iter.next()
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.iter.size_hint()
+    }
+}
+
+impl<'a, 'bump> DoubleEndedIterator for Drain<'a, 'bump> {
+    #[inline]
+    fn next_back(&mut self) -> Option<char> {
+        self.iter.next_back()
+    }
+}
+
+impl<'a, 'bump> FusedIterator for Drain<'a, 'bump> {}
diff --git a/android/vendor/bumpalo-3.10.0/src/collections/vec.rs b/android/vendor/bumpalo-3.10.0/src/collections/vec.rs
new file mode 100644
index 0000000..a025c9f
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/collections/vec.rs
@@ -0,0 +1,2494 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! A contiguous growable array type with heap-allocated contents, written
+//! [`Vec<'bump, T>`].
+//!
+//! Vectors have `O(1)` indexing, amortized `O(1)` push (to the end) and
+//! `O(1)` pop (from the end).
+//!
+//! This module is a fork of the [`std::vec`] module, that uses a bump allocator.
+//!
+//! [`std::vec`]: https://doc.rust-lang.org/std/vec/index.html
+//!
+//! # Examples
+//!
+//! You can explicitly create a [`Vec<'bump, T>`] with [`new_in`]:
+//!
+//! ```
+//! use bumpalo::{Bump, collections::Vec};
+//!
+//! let b = Bump::new();
+//! let v: Vec<i32> = Vec::new_in(&b);
+//! ```
+//!
+//! ... or by using the [`vec!`] macro:
+//!
+//! ```
+//! use bumpalo::{Bump, collections::Vec};
+//!
+//! let b = Bump::new();
+//!
+//! let v: Vec<i32> = bumpalo::vec![in &b];
+//!
+//! let v = bumpalo::vec![in &b; 1, 2, 3, 4, 5];
+//!
+//! let v = bumpalo::vec![in &b; 0; 10]; // ten zeroes
+//! ```
+//!
+//! You can [`push`] values onto the end of a vector (which will grow the vector
+//! as needed):
+//!
+//! ```
+//! use bumpalo::{Bump, collections::Vec};
+//!
+//! let b = Bump::new();
+//!
+//! let mut v = bumpalo::vec![in &b; 1, 2];
+//!
+//! v.push(3);
+//! ```
+//!
+//! Popping values works in much the same way:
+//!
+//! ```
+//! use bumpalo::{Bump, collections::Vec};
+//!
+//! let b = Bump::new();
+//!
+//! let mut v = bumpalo::vec![in &b; 1, 2];
+//!
+//! assert_eq!(v.pop(), Some(2));
+//! ```
+//!
+//! Vectors also support indexing (through the [`Index`] and [`IndexMut`] traits):
+//!
+//! ```
+//! use bumpalo::{Bump, collections::Vec};
+//!
+//! let b = Bump::new();
+//!
+//! let mut v = bumpalo::vec![in &b; 1, 2, 3];
+//! assert_eq!(v[2], 3);
+//! v[1] += 5;
+//! assert_eq!(v, [1, 7, 3]);
+//! ```
+//!
+//! [`Vec<'bump, T>`]: struct.Vec.html
+//! [`new_in`]: struct.Vec.html#method.new_in
+//! [`push`]: struct.Vec.html#method.push
+//! [`Index`]: https://doc.rust-lang.org/std/ops/trait.Index.html
+//! [`IndexMut`]: https://doc.rust-lang.org/std/ops/trait.IndexMut.html
+//! [`vec!`]: ../../macro.vec.html
+
+use super::raw_vec::RawVec;
+use crate::collections::CollectionAllocErr;
+use crate::Bump;
+use core::borrow::{Borrow, BorrowMut};
+use core::cmp::Ordering;
+use core::fmt;
+use core::hash::{self, Hash};
+use core::iter::FusedIterator;
+use core::marker::PhantomData;
+use core::mem;
+use core::ops;
+use core::ops::Bound::{Excluded, Included, Unbounded};
+use core::ops::{Index, IndexMut, RangeBounds};
+use core::ptr;
+use core::ptr::NonNull;
+use core::slice;
+
+unsafe fn arith_offset<T>(p: *const T, offset: isize) -> *const T {
+    p.offset(offset)
+}
+
+fn partition_dedup_by<T, F>(s: &mut [T], mut same_bucket: F) -> (&mut [T], &mut [T])
+where
+    F: FnMut(&mut T, &mut T) -> bool,
+{
+    // Although we have a mutable reference to `s`, we cannot make
+    // *arbitrary* changes. The `same_bucket` calls could panic, so we
+    // must ensure that the slice is in a valid state at all times.
+    //
+    // The way that we handle this is by using swaps; we iterate
+    // over all the elements, swapping as we go so that at the end
+    // the elements we wish to keep are in the front, and those we
+    // wish to reject are at the back. We can then split the slice.
+    // This operation is still O(n).
+    //
+    // Example: We start in this state, where `r` represents "next
+    // read" and `w` represents "next_write`.
+    //
+    //           r
+    //     +---+---+---+---+---+---+
+    //     | 0 | 1 | 1 | 2 | 3 | 3 |
+    //     +---+---+---+---+---+---+
+    //           w
+    //
+    // Comparing s[r] against s[w-1], this is not a duplicate, so
+    // we swap s[r] and s[w] (no effect as r==w) and then increment both
+    // r and w, leaving us with:
+    //
+    //               r
+    //     +---+---+---+---+---+---+
+    //     | 0 | 1 | 1 | 2 | 3 | 3 |
+    //     +---+---+---+---+---+---+
+    //               w
+    //
+    // Comparing s[r] against s[w-1], this value is a duplicate,
+    // so we increment `r` but leave everything else unchanged:
+    //
+    //                   r
+    //     +---+---+---+---+---+---+
+    //     | 0 | 1 | 1 | 2 | 3 | 3 |
+    //     +---+---+---+---+---+---+
+    //               w
+    //
+    // Comparing s[r] against s[w-1], this is not a duplicate,
+    // so swap s[r] and s[w] and advance r and w:
+    //
+    //                       r
+    //     +---+---+---+---+---+---+
+    //     | 0 | 1 | 2 | 1 | 3 | 3 |
+    //     +---+---+---+---+---+---+
+    //                   w
+    //
+    // Not a duplicate, repeat:
+    //
+    //                           r
+    //     +---+---+---+---+---+---+
+    //     | 0 | 1 | 2 | 3 | 1 | 3 |
+    //     +---+---+---+---+---+---+
+    //                       w
+    //
+    // Duplicate, advance r. End of slice. Split at w.
+
+    let len = s.len();
+    if len <= 1 {
+        return (s, &mut []);
+    }
+
+    let ptr = s.as_mut_ptr();
+    let mut next_read: usize = 1;
+    let mut next_write: usize = 1;
+
+    unsafe {
+        // Avoid bounds checks by using raw pointers.
+        while next_read < len {
+            let ptr_read = ptr.add(next_read);
+            let prev_ptr_write = ptr.add(next_write - 1);
+            if !same_bucket(&mut *ptr_read, &mut *prev_ptr_write) {
+                if next_read != next_write {
+                    let ptr_write = prev_ptr_write.offset(1);
+                    mem::swap(&mut *ptr_read, &mut *ptr_write);
+                }
+                next_write += 1;
+            }
+            next_read += 1;
+        }
+    }
+
+    s.split_at_mut(next_write)
+}
+
+unsafe fn offset_from<T>(p: *const T, origin: *const T) -> isize
+where
+    T: Sized,
+{
+    let pointee_size = mem::size_of::<T>();
+    assert!(0 < pointee_size && pointee_size <= isize::max_value() as usize);
+
+    // This is the same sequence that Clang emits for pointer subtraction.
+    // It can be neither `nsw` nor `nuw` because the input is treated as
+    // unsigned but then the output is treated as signed, so neither works.
+    let d = isize::wrapping_sub(p as _, origin as _);
+    d / (pointee_size as isize)
+}
+
+/// Creates a [`Vec`] containing the arguments.
+///
+/// `vec!` allows `Vec`s to be defined with the same syntax as array expressions.
+/// There are two forms of this macro:
+///
+/// - Create a [`Vec`] containing a given list of elements:
+///
+/// ```
+/// use bumpalo::Bump;
+///
+/// let b = Bump::new();
+/// let v = bumpalo::vec![in &b; 1, 2, 3];
+/// assert_eq!(v, [1, 2, 3]);
+/// ```
+///
+/// - Create a [`Vec`] from a given element and size:
+///
+/// ```
+/// use bumpalo::Bump;
+///
+/// let b = Bump::new();
+/// let v = bumpalo::vec![in &b; 1; 3];
+/// assert_eq!(v, [1, 1, 1]);
+/// ```
+///
+/// Note that unlike array expressions, this syntax supports all elements
+/// which implement [`Clone`] and the number of elements doesn't have to be
+/// a constant.
+///
+/// This will use `clone` to duplicate an expression, so one should be careful
+/// using this with types having a non-standard `Clone` implementation. For
+/// example, `bumpalo::vec![in &bump; Rc::new(1); 5]` will create a vector of five references
+/// to the same boxed integer value, not five references pointing to independently
+/// boxed integers.
+///
+/// [`Vec`]: collections/vec/struct.Vec.html
+/// [`Clone`]: https://doc.rust-lang.org/std/clone/trait.Clone.html
+#[macro_export]
+macro_rules! vec {
+    (in $bump:expr; $elem:expr; $n:expr) => {{
+        let n = $n;
+        let mut v = $crate::collections::Vec::with_capacity_in(n, $bump);
+        if n > 0 {
+            let elem = $elem;
+            for _ in 0..n - 1 {
+                v.push(elem.clone());
+            }
+            v.push(elem);
+        }
+        v
+    }};
+    (in $bump:expr) => { $crate::collections::Vec::new_in($bump) };
+    (in $bump:expr; $($x:expr),*) => {{
+        let mut v = $crate::collections::Vec::new_in($bump);
+        $( v.push($x); )*
+        v
+    }};
+    (in $bump:expr; $($x:expr,)*) => (bumpalo::vec![in $bump; $($x),*])
+}
+
+/// A contiguous growable array type, written `Vec<'bump, T>` but pronounced 'vector'.
+///
+/// # Examples
+///
+/// ```
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// let b = Bump::new();
+///
+/// let mut vec = Vec::new_in(&b);
+/// vec.push(1);
+/// vec.push(2);
+///
+/// assert_eq!(vec.len(), 2);
+/// assert_eq!(vec[0], 1);
+///
+/// assert_eq!(vec.pop(), Some(2));
+/// assert_eq!(vec.len(), 1);
+///
+/// vec[0] = 7;
+/// assert_eq!(vec[0], 7);
+///
+/// vec.extend([1, 2, 3].iter().cloned());
+///
+/// for x in &vec {
+///     println!("{}", x);
+/// }
+/// assert_eq!(vec, [7, 1, 2, 3]);
+/// ```
+///
+/// The [`vec!`] macro is provided to make initialization more convenient:
+///
+/// ```
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// let b = Bump::new();
+///
+/// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+/// vec.push(4);
+/// assert_eq!(vec, [1, 2, 3, 4]);
+/// ```
+///
+/// It can also initialize each element of a `Vec<'bump, T>` with a given value.
+/// This may be more efficient than performing allocation and initialization
+/// in separate steps, especially when initializing a vector of zeros:
+///
+/// ```
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// let b = Bump::new();
+///
+/// let vec = bumpalo::vec![in &b; 0; 5];
+/// assert_eq!(vec, [0, 0, 0, 0, 0]);
+///
+/// // The following is equivalent, but potentially slower:
+/// let mut vec1 = Vec::with_capacity_in(5, &b);
+/// vec1.resize(5, 0);
+/// ```
+///
+/// Use a `Vec<'bump, T>` as an efficient stack:
+///
+/// ```
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// let b = Bump::new();
+///
+/// let mut stack = Vec::new_in(&b);
+///
+/// stack.push(1);
+/// stack.push(2);
+/// stack.push(3);
+///
+/// while let Some(top) = stack.pop() {
+///     // Prints 3, 2, 1
+///     println!("{}", top);
+/// }
+/// ```
+///
+/// # Indexing
+///
+/// The `Vec` type allows to access values by index, because it implements the
+/// [`Index`] trait. An example will be more explicit:
+///
+/// ```
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// let b = Bump::new();
+///
+/// let v = bumpalo::vec![in &b; 0, 2, 4, 6];
+/// println!("{}", v[1]); // it will display '2'
+/// ```
+///
+/// However be careful: if you try to access an index which isn't in the `Vec`,
+/// your software will panic! You cannot do this:
+///
+/// ```should_panic
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// let b = Bump::new();
+///
+/// let v = bumpalo::vec![in &b; 0, 2, 4, 6];
+/// println!("{}", v[6]); // it will panic!
+/// ```
+///
+/// In conclusion: always check if the index you want to get really exists
+/// before doing it.
+///
+/// # Slicing
+///
+/// A `Vec` can be mutable. Slices, on the other hand, are read-only objects.
+/// To get a slice, use `&`. Example:
+///
+/// ```
+/// use bumpalo::{Bump, collections::Vec};
+///
+/// fn read_slice(slice: &[usize]) {
+///     // ...
+/// }
+///
+/// let b = Bump::new();
+///
+/// let v = bumpalo::vec![in &b; 0, 1];
+/// read_slice(&v);
+///
+/// // ... and that's all!
+/// // you can also do it like this:
+/// let x : &[usize] = &v;
+/// ```
+///
+/// In Rust, it's more common to pass slices as arguments rather than vectors
+/// when you just want to provide a read access. The same goes for [`String`] and
+/// [`&str`].
+///
+/// # Capacity and reallocation
+///
+/// The capacity of a vector is the amount of space allocated for any future
+/// elements that will be added onto the vector. This is not to be confused with
+/// the *length* of a vector, which specifies the number of actual elements
+/// within the vector. If a vector's length exceeds its capacity, its capacity
+/// will automatically be increased, but its elements will have to be
+/// reallocated.
+///
+/// For example, a vector with capacity 10 and length 0 would be an empty vector
+/// with space for 10 more elements. Pushing 10 or fewer elements onto the
+/// vector will not change its capacity or cause reallocation to occur. However,
+/// if the vector's length is increased to 11, it will have to reallocate, which
+/// can be slow. For this reason, it is recommended to use [`Vec::with_capacity_in`]
+/// whenever possible to specify how big the vector is expected to get.
+///
+/// # Guarantees
+///
+/// Due to its incredibly fundamental nature, `Vec` makes a lot of guarantees
+/// about its design. This ensures that it's as low-overhead as possible in
+/// the general case, and can be correctly manipulated in primitive ways
+/// by unsafe code. Note that these guarantees refer to an unqualified `Vec<'bump, T>`.
+/// If additional type parameters are added (e.g. to support custom allocators),
+/// overriding their defaults may change the behavior.
+///
+/// Most fundamentally, `Vec` is and always will be a (pointer, capacity, length)
+/// triplet. No more, no less. The order of these fields is completely
+/// unspecified, and you should use the appropriate methods to modify these.
+/// The pointer will never be null, so this type is null-pointer-optimized.
+///
+/// However, the pointer may not actually point to allocated memory. In particular,
+/// if you construct a `Vec` with capacity 0 via [`Vec::new_in`], [`bumpalo::vec![in bump]`][`vec!`],
+/// [`Vec::with_capacity_in(0)`][`Vec::with_capacity_in`], or by calling [`shrink_to_fit`]
+/// on an empty Vec, it will not allocate memory. Similarly, if you store zero-sized
+/// types inside a `Vec`, it will not allocate space for them. *Note that in this case
+/// the `Vec` may not report a [`capacity`] of 0*. `Vec` will allocate if and only
+/// if <code>[`mem::size_of::<T>`]\() * capacity() > 0</code>. In general, `Vec`'s allocation
+/// details are very subtle &mdash; if you intend to allocate memory using a `Vec`
+/// and use it for something else (either to pass to unsafe code, or to build your
+/// own memory-backed collection), be sure to deallocate this memory by using
+/// `from_raw_parts` to recover the `Vec` and then dropping it.
+///
+/// If a `Vec` *has* allocated memory, then the memory it points to is
+/// in the [`Bump`] arena used to construct it, and its
+/// pointer points to [`len`] initialized, contiguous elements in order (what
+/// you would see if you coerced it to a slice), followed by <code>[`capacity`] -
+/// [`len`]</code> logically uninitialized, contiguous elements.
+///
+/// `Vec` will never perform a "small optimization" where elements are actually
+/// stored on the stack for two reasons:
+///
+/// * It would make it more difficult for unsafe code to correctly manipulate
+///   a `Vec`. The contents of a `Vec` wouldn't have a stable address if it were
+///   only moved, and it would be more difficult to determine if a `Vec` had
+///   actually allocated memory.
+///
+/// * It would penalize the general case, incurring an additional branch
+///   on every access.
+///
+/// `Vec` will never automatically shrink itself, even if completely empty. This
+/// ensures no unnecessary allocations or deallocations occur. Emptying a `Vec`
+/// and then filling it back up to the same [`len`] should incur no calls to
+/// the allocator. If you wish to free up unused memory, use
+/// [`shrink_to_fit`][`shrink_to_fit`].
+///
+/// [`push`] and [`insert`] will never (re)allocate if the reported capacity is
+/// sufficient. [`push`] and [`insert`] *will* (re)allocate if
+/// <code>[`len`] == [`capacity`]</code>. That is, the reported capacity is completely
+/// accurate, and can be relied on. It can even be used to manually free the memory
+/// allocated by a `Vec` if desired. Bulk insertion methods *may* reallocate, even
+/// when not necessary.
+///
+/// `Vec` does not guarantee any particular growth strategy when reallocating
+/// when full, nor when [`reserve`] is called. The current strategy is basic
+/// and it may prove desirable to use a non-constant growth factor. Whatever
+/// strategy is used will of course guarantee `O(1)` amortized [`push`].
+///
+/// `bumpalo::vec![in bump; x; n]`, `bumpalo::vec![in bump; a, b, c, d]`, and
+/// [`Vec::with_capacity_in(n)`][`Vec::with_capacity_in`], will all produce a
+/// `Vec` with exactly the requested capacity. If <code>[`len`] == [`capacity`]</code>, (as
+/// is the case for the [`vec!`] macro), then a `Vec<'bump, T>` can be converted
+/// to and from a [`Box<[T]>`][owned slice] without reallocating or moving the
+/// elements.
+///
+/// `Vec` will not specifically overwrite any data that is removed from it,
+/// but also won't specifically preserve it. Its uninitialized memory is
+/// scratch space that it may use however it wants. It will generally just do
+/// whatever is most efficient or otherwise easy to implement. Do not rely on
+/// removed data to be erased for security purposes. Even if you drop a `Vec`, its
+/// buffer may simply be reused by another `Vec`. Even if you zero a `Vec`'s memory
+/// first, that may not actually happen because the optimizer does not consider
+/// this a side-effect that must be preserved. There is one case which we will
+/// not break, however: using `unsafe` code to write to the excess capacity,
+/// and then increasing the length to match, is always valid.
+///
+/// `Vec` does not currently guarantee the order in which elements are dropped.
+/// The order has changed in the past and may change again.
+///
+/// [`vec!`]: ../../macro.vec.html
+/// [`Index`]: https://doc.rust-lang.org/std/ops/trait.Index.html
+/// [`String`]: ../string/struct.String.html
+/// [`&str`]: https://doc.rust-lang.org/std/primitive.str.html
+/// [`Vec::with_capacity_in`]: struct.Vec.html#method.with_capacity_in
+/// [`Vec::new_in`]: struct.Vec.html#method.new_in
+/// [`shrink_to_fit`]: struct.Vec.html#method.shrink_to_fit
+/// [`capacity`]: struct.Vec.html#method.capacity
+/// [`mem::size_of::<T>`]: https://doc.rust-lang.org/std/mem/fn.size_of.html
+/// [`len`]: struct.Vec.html#method.len
+/// [`push`]: struct.Vec.html#method.push
+/// [`insert`]: struct.Vec.html#method.insert
+/// [`reserve`]: struct.Vec.html#method.reserve
+/// [owned slice]: https://doc.rust-lang.org/std/boxed/struct.Box.html
+pub struct Vec<'bump, T: 'bump> {
+    buf: RawVec<'bump, T>,
+    len: usize,
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Inherent methods
+////////////////////////////////////////////////////////////////////////////////
+
+impl<'bump, T: 'bump> Vec<'bump, T> {
+    /// Constructs a new, empty `Vec<'bump, T>`.
+    ///
+    /// The vector will not allocate until elements are pushed onto it.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # #![allow(unused_mut)]
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let mut vec: Vec<i32> = Vec::new_in(&b);
+    /// ```
+    #[inline]
+    pub fn new_in(bump: &'bump Bump) -> Vec<'bump, T> {
+        Vec {
+            buf: RawVec::new_in(bump),
+            len: 0,
+        }
+    }
+
+    /// Constructs a new, empty `Vec<'bump, T>` with the specified capacity.
+    ///
+    /// The vector will be able to hold exactly `capacity` elements without
+    /// reallocating. If `capacity` is 0, the vector will not allocate.
+    ///
+    /// It is important to note that although the returned vector has the
+    /// *capacity* specified, the vector will have a zero *length*. For an
+    /// explanation of the difference between length and capacity, see
+    /// *[Capacity and reallocation]*.
+    ///
+    /// [Capacity and reallocation]: #capacity-and-reallocation
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = Vec::with_capacity_in(10, &b);
+    ///
+    /// // The vector contains no items, even though it has capacity for more
+    /// assert_eq!(vec.len(), 0);
+    ///
+    /// // These are all done without reallocating...
+    /// for i in 0..10 {
+    ///     vec.push(i);
+    /// }
+    ///
+    /// // ...but this may make the vector reallocate
+    /// vec.push(11);
+    /// ```
+    #[inline]
+    pub fn with_capacity_in(capacity: usize, bump: &'bump Bump) -> Vec<'bump, T> {
+        Vec {
+            buf: RawVec::with_capacity_in(capacity, bump),
+            len: 0,
+        }
+    }
+
+    /// Construct a new `Vec` from the given iterator's items.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    /// use std::iter;
+    ///
+    /// let b = Bump::new();
+    /// let v = Vec::from_iter_in(iter::repeat(7).take(3), &b);
+    /// assert_eq!(v, [7, 7, 7]);
+    /// ```
+    pub fn from_iter_in<I: IntoIterator<Item = T>>(iter: I, bump: &'bump Bump) -> Vec<'bump, T> {
+        let mut v = Vec::new_in(bump);
+        v.extend(iter);
+        v
+    }
+
+    /// Creates a `Vec<'bump, T>` directly from the raw components of another vector.
+    ///
+    /// # Safety
+    ///
+    /// This is highly unsafe, due to the number of invariants that aren't
+    /// checked:
+    ///
+    /// * `ptr` needs to have been previously allocated via [`String`]/`Vec<'bump, T>`
+    ///   (at least, it's highly likely to be incorrect if it wasn't).
+    /// * `ptr`'s `T` needs to have the same size and alignment as it was allocated with.
+    /// * `length` needs to be less than or equal to `capacity`.
+    /// * `capacity` needs to be the capacity that the pointer was allocated with.
+    ///
+    /// Violating these may cause problems like corrupting the allocator's
+    /// internal data structures. For example it is **not** safe
+    /// to build a `Vec<u8>` from a pointer to a C `char` array and a `size_t`.
+    ///
+    /// The ownership of `ptr` is effectively transferred to the
+    /// `Vec<'bump, T>` which may then deallocate, reallocate or change the
+    /// contents of memory pointed to by the pointer at will. Ensure
+    /// that nothing else uses the pointer after calling this
+    /// function.
+    ///
+    /// [`String`]: ../string/struct.String.html
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// use std::ptr;
+    /// use std::mem;
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = bumpalo::vec![in &b; 1, 2, 3];
+    ///
+    /// // Pull out the various important pieces of information about `v`
+    /// let p = v.as_mut_ptr();
+    /// let len = v.len();
+    /// let cap = v.capacity();
+    ///
+    /// unsafe {
+    ///     // Cast `v` into the void: no destructor run, so we are in
+    ///     // complete control of the allocation to which `p` points.
+    ///     mem::forget(v);
+    ///
+    ///     // Overwrite memory with 4, 5, 6
+    ///     for i in 0..len as isize {
+    ///         ptr::write(p.offset(i), 4 + i);
+    ///     }
+    ///
+    ///     // Put everything back together into a Vec
+    ///     let rebuilt = Vec::from_raw_parts_in(p, len, cap, &b);
+    ///     assert_eq!(rebuilt, [4, 5, 6]);
+    /// }
+    /// ```
+    pub unsafe fn from_raw_parts_in(
+        ptr: *mut T,
+        length: usize,
+        capacity: usize,
+        bump: &'bump Bump,
+    ) -> Vec<'bump, T> {
+        Vec {
+            buf: RawVec::from_raw_parts_in(ptr, capacity, bump),
+            len: length,
+        }
+    }
+
+    /// Returns the number of elements the vector can hold without
+    /// reallocating.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let vec: Vec<i32> = Vec::with_capacity_in(10, &b);
+    /// assert_eq!(vec.capacity(), 10);
+    /// ```
+    #[inline]
+    pub fn capacity(&self) -> usize {
+        self.buf.cap()
+    }
+
+    /// Reserves capacity for at least `additional` more elements to be inserted
+    /// in the given `Vec<'bump, T>`. The collection may reserve more space to avoid
+    /// frequent reallocations. After calling `reserve`, capacity will be
+    /// greater than or equal to `self.len() + additional`. Does nothing if
+    /// capacity is already sufficient.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows `usize`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let mut vec = bumpalo::vec![in &b; 1];
+    /// vec.reserve(10);
+    /// assert!(vec.capacity() >= 11);
+    /// ```
+    pub fn reserve(&mut self, additional: usize) {
+        self.buf.reserve(self.len, additional);
+    }
+
+    /// Reserves the minimum capacity for exactly `additional` more elements to
+    /// be inserted in the given `Vec<'bump, T>`. After calling `reserve_exact`,
+    /// capacity will be greater than or equal to `self.len() + additional`.
+    /// Does nothing if the capacity is already sufficient.
+    ///
+    /// Note that the allocator may give the collection more space than it
+    /// requests. Therefore capacity can not be relied upon to be precisely
+    /// minimal. Prefer `reserve` if future insertions are expected.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows `usize`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let mut vec = bumpalo::vec![in &b; 1];
+    /// vec.reserve_exact(10);
+    /// assert!(vec.capacity() >= 11);
+    /// ```
+    pub fn reserve_exact(&mut self, additional: usize) {
+        self.buf.reserve_exact(self.len, additional);
+    }
+
+    /// Attempts to reserve capacity for at least `additional` more elements to be inserted
+    /// in the given `Vec<'bump, T>`. The collection may reserve more space to avoid
+    /// frequent reallocations. After calling `try_reserve`, capacity will be
+    /// greater than or equal to `self.len() + additional`. Does nothing if
+    /// capacity is already sufficient.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows `usize`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let mut vec = bumpalo::vec![in &b; 1];
+    /// vec.try_reserve(10).unwrap();
+    /// assert!(vec.capacity() >= 11);
+    /// ```
+    pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
+        self.buf.try_reserve(self.len, additional)
+    }
+
+    /// Attempts to reserve the minimum capacity for exactly `additional` more elements to
+    /// be inserted in the given `Vec<'bump, T>`. After calling `try_reserve_exact`,
+    /// capacity will be greater than or equal to `self.len() + additional`.
+    /// Does nothing if the capacity is already sufficient.
+    ///
+    /// Note that the allocator may give the collection more space than it
+    /// requests. Therefore capacity can not be relied upon to be precisely
+    /// minimal. Prefer `try_reserve` if future insertions are expected.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows `usize`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let mut vec = bumpalo::vec![in &b; 1];
+    /// vec.try_reserve_exact(10).unwrap();
+    /// assert!(vec.capacity() >= 11);
+    /// ```
+    pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> {
+        self.buf.try_reserve_exact(self.len, additional)
+    }
+
+    /// Shrinks the capacity of the vector as much as possible.
+    ///
+    /// It will drop down as close as possible to the length but the allocator
+    /// may still inform the vector that there is space for a few more elements.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = Vec::with_capacity_in(10, &b);
+    /// vec.extend([1, 2, 3].iter().cloned());
+    /// assert_eq!(vec.capacity(), 10);
+    /// vec.shrink_to_fit();
+    /// assert!(vec.capacity() >= 3);
+    /// ```
+    pub fn shrink_to_fit(&mut self) {
+        if self.capacity() != self.len {
+            self.buf.shrink_to_fit(self.len);
+        }
+    }
+
+    /// Converts the vector into `&'bump [T]`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let v = bumpalo::vec![in &b; 1, 2, 3];
+    ///
+    /// let slice = v.into_bump_slice();
+    /// assert_eq!(slice, [1, 2, 3]);
+    /// ```
+    pub fn into_bump_slice(self) -> &'bump [T] {
+        unsafe {
+            let ptr = self.as_ptr();
+            let len = self.len();
+            mem::forget(self);
+            slice::from_raw_parts(ptr, len)
+        }
+    }
+
+    /// Converts the vector into `&'bump mut [T]`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    /// let v = bumpalo::vec![in &b; 1, 2, 3];
+    ///
+    /// let mut slice = v.into_bump_slice_mut();
+    ///
+    /// slice[0] = 3;
+    /// slice[2] = 1;
+    ///
+    /// assert_eq!(slice, [3, 2, 1]);
+    /// ```
+    pub fn into_bump_slice_mut(mut self) -> &'bump mut [T] {
+        let ptr = self.as_mut_ptr();
+        let len = self.len();
+        mem::forget(self);
+
+        unsafe { slice::from_raw_parts_mut(ptr, len) }
+    }
+
+    /// Shortens the vector, keeping the first `len` elements and dropping
+    /// the rest.
+    ///
+    /// If `len` is greater than the vector's current length, this has no
+    /// effect.
+    ///
+    /// The [`drain`] method can emulate `truncate`, but causes the excess
+    /// elements to be returned instead of dropped.
+    ///
+    /// Note that this method has no effect on the allocated capacity
+    /// of the vector.
+    ///
+    /// # Examples
+    ///
+    /// Truncating a five element vector to two elements:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3, 4, 5];
+    /// vec.truncate(2);
+    /// assert_eq!(vec, [1, 2]);
+    /// ```
+    ///
+    /// No truncation occurs when `len` is greater than the vector's current
+    /// length:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+    /// vec.truncate(8);
+    /// assert_eq!(vec, [1, 2, 3]);
+    /// ```
+    ///
+    /// Truncating when `len == 0` is equivalent to calling the [`clear`]
+    /// method.
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+    /// vec.truncate(0);
+    /// assert_eq!(vec, []);
+    /// ```
+    ///
+    /// [`clear`]: #method.clear
+    /// [`drain`]: #method.drain
+    pub fn truncate(&mut self, len: usize) {
+        let current_len = self.len;
+        unsafe {
+            let mut ptr = self.as_mut_ptr().add(self.len);
+            // Set the final length at the end, keeping in mind that
+            // dropping an element might panic. Works around a missed
+            // optimization, as seen in the following issue:
+            // https://github.com/rust-lang/rust/issues/51802
+            let mut local_len = SetLenOnDrop::new(&mut self.len);
+
+            // drop any extra elements
+            for _ in len..current_len {
+                local_len.decrement_len(1);
+                ptr = ptr.offset(-1);
+                ptr::drop_in_place(ptr);
+            }
+        }
+    }
+
+    /// Extracts a slice containing the entire vector.
+    ///
+    /// Equivalent to `&s[..]`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    /// use std::io::{self, Write};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let buffer = bumpalo::vec![in &b; 1, 2, 3, 5, 8];
+    /// io::sink().write(buffer.as_slice()).unwrap();
+    /// ```
+    #[inline]
+    pub fn as_slice(&self) -> &[T] {
+        self
+    }
+
+    /// Extracts a mutable slice of the entire vector.
+    ///
+    /// Equivalent to `&mut s[..]`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    /// use std::io::{self, Read};
+    ///
+    /// let b = Bump::new();
+    /// let mut buffer = bumpalo::vec![in &b; 0; 3];
+    /// io::repeat(0b101).read_exact(buffer.as_mut_slice()).unwrap();
+    /// ```
+    #[inline]
+    pub fn as_mut_slice(&mut self) -> &mut [T] {
+        self
+    }
+
+    /// Sets the length of a vector.
+    ///
+    /// This will explicitly set the size of the vector, without actually
+    /// modifying its buffers, so it is up to the caller to ensure that the
+    /// vector is actually the specified size.
+    ///
+    /// # Safety
+    ///
+    /// - `new_len` must be less than or equal to [`capacity()`].
+    /// - The elements at `old_len..new_len` must be initialized.
+    ///
+    /// [`capacity()`]: struct.Vec.html#method.capacity
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// use std::ptr;
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 'r', 'u', 's', 't'];
+    ///
+    /// unsafe {
+    ///     ptr::drop_in_place(&mut vec[3]);
+    ///     vec.set_len(3);
+    /// }
+    /// assert_eq!(vec, ['r', 'u', 's']);
+    /// ```
+    ///
+    /// In this example, there is a memory leak since the memory locations
+    /// owned by the inner vectors were not freed prior to the `set_len` call:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b;
+    ///                             bumpalo::vec![in &b; 1, 0, 0],
+    ///                             bumpalo::vec![in &b; 0, 1, 0],
+    ///                             bumpalo::vec![in &b; 0, 0, 1]];
+    /// unsafe {
+    ///     vec.set_len(0);
+    /// }
+    /// ```
+    ///
+    /// In this example, the vector gets expanded from zero to four items
+    /// without any memory allocations occurring, resulting in vector
+    /// values of unallocated memory:
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec: Vec<char> = Vec::new_in(&b);
+    ///
+    /// unsafe {
+    ///     vec.set_len(4);
+    /// }
+    /// ```
+    #[inline]
+    pub unsafe fn set_len(&mut self, new_len: usize) {
+        self.len = new_len;
+    }
+
+    /// Removes an element from the vector and returns it.
+    ///
+    /// The removed element is replaced by the last element of the vector.
+    ///
+    /// This does not preserve ordering, but is O(1).
+    ///
+    /// # Panics
+    ///
+    /// Panics if `index` is out of bounds.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = bumpalo::vec![in &b; "foo", "bar", "baz", "qux"];
+    ///
+    /// assert_eq!(v.swap_remove(1), "bar");
+    /// assert_eq!(v, ["foo", "qux", "baz"]);
+    ///
+    /// assert_eq!(v.swap_remove(0), "foo");
+    /// assert_eq!(v, ["baz", "qux"]);
+    /// ```
+    #[inline]
+    pub fn swap_remove(&mut self, index: usize) -> T {
+        unsafe {
+            // We replace self[index] with the last element. Note that if the
+            // bounds check on hole succeeds there must be a last element (which
+            // can be self[index] itself).
+            let hole: *mut T = &mut self[index];
+            let last = ptr::read(self.get_unchecked(self.len - 1));
+            self.len -= 1;
+            ptr::replace(hole, last)
+        }
+    }
+
+    /// Inserts an element at position `index` within the vector, shifting all
+    /// elements after it to the right.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `index > len`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+    /// vec.insert(1, 4);
+    /// assert_eq!(vec, [1, 4, 2, 3]);
+    /// vec.insert(4, 5);
+    /// assert_eq!(vec, [1, 4, 2, 3, 5]);
+    /// ```
+    pub fn insert(&mut self, index: usize, element: T) {
+        let len = self.len();
+        assert!(index <= len);
+
+        // space for the new element
+        if len == self.buf.cap() {
+            self.reserve(1);
+        }
+
+        unsafe {
+            // infallible
+            // The spot to put the new value
+            {
+                let p = self.as_mut_ptr().add(index);
+                // Shift everything over to make space. (Duplicating the
+                // `index`th element into two consecutive places.)
+                ptr::copy(p, p.offset(1), len - index);
+                // Write it in, overwriting the first copy of the `index`th
+                // element.
+                ptr::write(p, element);
+            }
+            self.set_len(len + 1);
+        }
+    }
+
+    /// Removes and returns the element at position `index` within the vector,
+    /// shifting all elements after it to the left.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `index` is out of bounds.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = bumpalo::vec![in &b; 1, 2, 3];
+    /// assert_eq!(v.remove(1), 2);
+    /// assert_eq!(v, [1, 3]);
+    /// ```
+    pub fn remove(&mut self, index: usize) -> T {
+        let len = self.len();
+        assert!(index < len);
+        unsafe {
+            // infallible
+            let ret;
+            {
+                // the place we are taking from.
+                let ptr = self.as_mut_ptr().add(index);
+                // copy it out, unsafely having a copy of the value on
+                // the stack and in the vector at the same time.
+                ret = ptr::read(ptr);
+
+                // Shift everything down to fill in that spot.
+                ptr::copy(ptr.offset(1), ptr, len - index - 1);
+            }
+            self.set_len(len - 1);
+            ret
+        }
+    }
+
+    /// Retains only the elements specified by the predicate.
+    ///
+    /// In other words, remove all elements `e` such that `f(&e)` returns `false`.
+    /// This method operates in place and preserves the order of the retained
+    /// elements.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3, 4];
+    /// vec.retain(|&x| x % 2 == 0);
+    /// assert_eq!(vec, [2, 4]);
+    /// ```
+    pub fn retain<F>(&mut self, mut f: F)
+    where
+        F: FnMut(&T) -> bool,
+    {
+        self.drain_filter(|x| !f(x));
+    }
+
+    /// Creates an iterator that removes the elements in the vector
+    /// for which the predicate returns `true` and yields the removed items.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::Bump;
+    /// use bumpalo::collections::{CollectIn, Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut numbers = bumpalo::vec![in &b; 1, 2, 3, 4, 5];
+    ///
+    /// let evens: Vec<_> = numbers.drain_filter(|x| *x % 2 == 0).collect_in(&b);
+    ///
+    /// assert_eq!(numbers, &[1, 3, 5]);
+    /// assert_eq!(evens, &[2, 4]);
+    /// ```
+    pub fn drain_filter<'a, F>(&'a mut self, filter: F) -> DrainFilter<'a, 'bump, T, F>
+    where
+        F: FnMut(&mut T) -> bool,
+    {
+        let old_len = self.len();
+
+        // Guard against us getting leaked (leak amplification)
+        unsafe {
+            self.set_len(0);
+        }
+
+        DrainFilter {
+            vec: self,
+            idx: 0,
+            del: 0,
+            old_len,
+            pred: filter,
+        }
+    }
+
+    /// Removes all but the first of consecutive elements in the vector that resolve to the same
+    /// key.
+    ///
+    /// If the vector is sorted, this removes all duplicates.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 10, 20, 21, 30, 20];
+    ///
+    /// vec.dedup_by_key(|i| *i / 10);
+    ///
+    /// assert_eq!(vec, [10, 20, 30, 20]);
+    /// ```
+    #[inline]
+    pub fn dedup_by_key<F, K>(&mut self, mut key: F)
+    where
+        F: FnMut(&mut T) -> K,
+        K: PartialEq,
+    {
+        self.dedup_by(|a, b| key(a) == key(b))
+    }
+
+    /// Removes all but the first of consecutive elements in the vector satisfying a given equality
+    /// relation.
+    ///
+    /// The `same_bucket` function is passed references to two elements from the vector and
+    /// must determine if the elements compare equal. The elements are passed in opposite order
+    /// from their order in the slice, so if `same_bucket(a, b)` returns `true`, `a` is removed.
+    ///
+    /// If the vector is sorted, this removes all duplicates.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; "foo", "bar", "Bar", "baz", "bar"];
+    ///
+    /// vec.dedup_by(|a, b| a.eq_ignore_ascii_case(b));
+    ///
+    /// assert_eq!(vec, ["foo", "bar", "baz", "bar"]);
+    /// ```
+    pub fn dedup_by<F>(&mut self, same_bucket: F)
+    where
+        F: FnMut(&mut T, &mut T) -> bool,
+    {
+        let len = {
+            let (dedup, _) = partition_dedup_by(self.as_mut_slice(), same_bucket);
+            dedup.len()
+        };
+        self.truncate(len);
+    }
+
+    /// Appends an element to the back of a vector.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the number of elements in the vector overflows a `usize`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2];
+    /// vec.push(3);
+    /// assert_eq!(vec, [1, 2, 3]);
+    /// ```
+    #[inline]
+    pub fn push(&mut self, value: T) {
+        // This will panic or abort if we would allocate > isize::MAX bytes
+        // or if the length increment would overflow for zero-sized types.
+        if self.len == self.buf.cap() {
+            self.reserve(1);
+        }
+        unsafe {
+            let end = self.buf.ptr().add(self.len);
+            ptr::write(end, value);
+            self.len += 1;
+        }
+    }
+
+    /// Removes the last element from a vector and returns it, or [`None`] if it
+    /// is empty.
+    ///
+    /// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+    /// assert_eq!(vec.pop(), Some(3));
+    /// assert_eq!(vec, [1, 2]);
+    /// ```
+    #[inline]
+    pub fn pop(&mut self) -> Option<T> {
+        if self.len == 0 {
+            None
+        } else {
+            unsafe {
+                self.len -= 1;
+                Some(ptr::read(self.get_unchecked(self.len())))
+            }
+        }
+    }
+
+    /// Moves all the elements of `other` into `Self`, leaving `other` empty.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the number of elements in the vector overflows a `usize`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+    /// let mut vec2 = bumpalo::vec![in &b; 4, 5, 6];
+    /// vec.append(&mut vec2);
+    /// assert_eq!(vec, [1, 2, 3, 4, 5, 6]);
+    /// assert_eq!(vec2, []);
+    /// ```
+    #[inline]
+    pub fn append(&mut self, other: &mut Self) {
+        unsafe {
+            self.append_elements(other.as_slice() as _);
+            other.set_len(0);
+        }
+    }
+
+    /// Appends elements to `Self` from other buffer.
+    #[inline]
+    unsafe fn append_elements(&mut self, other: *const [T]) {
+        let count = (*other).len();
+        self.reserve(count);
+        let len = self.len();
+        ptr::copy_nonoverlapping(other as *const T, self.get_unchecked_mut(len), count);
+        self.len += count;
+    }
+
+    /// Creates a draining iterator that removes the specified range in the vector
+    /// and yields the removed items.
+    ///
+    /// Note 1: The element range is removed even if the iterator is only
+    /// partially consumed or not consumed at all.
+    ///
+    /// Note 2: It is unspecified how many elements are removed from the vector
+    /// if the `Drain` value is leaked.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the starting point is greater than the end point or if
+    /// the end point is greater than the length of the vector.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::Bump;
+    /// use bumpalo::collections::{CollectIn, Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = bumpalo::vec![in &b; 1, 2, 3];
+    ///
+    /// let u: Vec<_> = v.drain(1..).collect_in(&b);
+    ///
+    /// assert_eq!(v, &[1]);
+    /// assert_eq!(u, &[2, 3]);
+    ///
+    /// // A full range clears the vector
+    /// v.drain(..);
+    /// assert_eq!(v, &[]);
+    /// ```
+    pub fn drain<R>(&mut self, range: R) -> Drain<T>
+    where
+        R: RangeBounds<usize>,
+    {
+        // Memory safety
+        //
+        // When the Drain is first created, it shortens the length of
+        // the source vector to make sure no uninitialized or moved-from elements
+        // are accessible at all if the Drain's destructor never gets to run.
+        //
+        // Drain will ptr::read out the values to remove.
+        // When finished, remaining tail of the vec is copied back to cover
+        // the hole, and the vector length is restored to the new length.
+        //
+        let len = self.len();
+        let start = match range.start_bound() {
+            Included(&n) => n,
+            Excluded(&n) => n + 1,
+            Unbounded => 0,
+        };
+        let end = match range.end_bound() {
+            Included(&n) => n + 1,
+            Excluded(&n) => n,
+            Unbounded => len,
+        };
+        assert!(start <= end);
+        assert!(end <= len);
+
+        unsafe {
+            // set self.vec length's to start, to be safe in case Drain is leaked
+            self.set_len(start);
+            // Use the borrow in the IterMut to indicate borrowing behavior of the
+            // whole Drain iterator (like &mut T).
+            let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().add(start), end - start);
+            Drain {
+                tail_start: end,
+                tail_len: len - end,
+                iter: range_slice.iter(),
+                vec: NonNull::from(self),
+            }
+        }
+    }
+
+    /// Clears the vector, removing all values.
+    ///
+    /// Note that this method has no effect on the allocated capacity
+    /// of the vector.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = bumpalo::vec![in &b; 1, 2, 3];
+    ///
+    /// v.clear();
+    ///
+    /// assert!(v.is_empty());
+    /// ```
+    #[inline]
+    pub fn clear(&mut self) {
+        self.truncate(0)
+    }
+
+    /// Returns the number of elements in the vector, also referred to
+    /// as its 'length'.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let a = bumpalo::vec![in &b; 1, 2, 3];
+    /// assert_eq!(a.len(), 3);
+    /// ```
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.len
+    }
+
+    /// Returns `true` if the vector contains no elements.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = Vec::new_in(&b);
+    /// assert!(v.is_empty());
+    ///
+    /// v.push(1);
+    /// assert!(!v.is_empty());
+    /// ```
+    pub fn is_empty(&self) -> bool {
+        self.len() == 0
+    }
+
+    /// Splits the collection into two at the given index.
+    ///
+    /// Returns a newly allocated vector. `self` contains elements `[0, at)`,
+    /// and the returned vector contains elements `[at, len)`.
+    ///
+    /// Note that the capacity of `self` does not change.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3];
+    /// let vec2 = vec.split_off(1);
+    /// assert_eq!(vec, [1]);
+    /// assert_eq!(vec2, [2, 3]);
+    /// ```
+    #[inline]
+    pub fn split_off(&mut self, at: usize) -> Self {
+        assert!(at <= self.len(), "`at` out of bounds");
+
+        let other_len = self.len - at;
+        let mut other = Vec::with_capacity_in(other_len, self.buf.bump());
+
+        // Unsafely `set_len` and copy items to `other`.
+        unsafe {
+            self.set_len(at);
+            other.set_len(other_len);
+
+            ptr::copy_nonoverlapping(self.as_ptr().add(at), other.as_mut_ptr(), other.len());
+        }
+        other
+    }
+}
+
+#[cfg(feature = "boxed")]
+impl<'bump, T> Vec<'bump, T> {
+    /// Converts the vector into [`Box<[T]>`][owned slice].
+    ///
+    /// Note that this will drop any excess capacity.
+    ///
+    /// [owned slice]: ../../boxed/struct.Box.html
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec, vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let v = vec![in &b; 1, 2, 3];
+    ///
+    /// let slice = v.into_boxed_slice();
+    /// ```
+    pub fn into_boxed_slice(mut self) -> crate::boxed::Box<'bump, [T]> {
+        use crate::boxed::Box;
+
+        // Unlike `alloc::vec::Vec` shrinking here isn't necessary as `bumpalo::boxed::Box` doesn't own memory.
+        unsafe {
+            let slice = slice::from_raw_parts_mut(self.as_mut_ptr(), self.len);
+            let output: Box<'bump, [T]> = Box::from_raw(slice);
+            mem::forget(self);
+            output
+        }
+    }
+}
+
+impl<'bump, T: 'bump + Clone> Vec<'bump, T> {
+    /// Resizes the `Vec` in-place so that `len` is equal to `new_len`.
+    ///
+    /// If `new_len` is greater than `len`, the `Vec` is extended by the
+    /// difference, with each additional slot filled with `value`.
+    /// If `new_len` is less than `len`, the `Vec` is simply truncated.
+    ///
+    /// This method requires [`Clone`] to be able clone the passed value. If
+    /// you need more flexibility (or want to rely on [`Default`] instead of
+    /// [`Clone`]), use [`resize_with`].
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; "hello"];
+    /// vec.resize(3, "world");
+    /// assert_eq!(vec, ["hello", "world", "world"]);
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 3, 4];
+    /// vec.resize(2, 0);
+    /// assert_eq!(vec, [1, 2]);
+    /// ```
+    ///
+    /// [`Clone`]: https://doc.rust-lang.org/std/clone/trait.Clone.html
+    /// [`Default`]: https://doc.rust-lang.org/std/default/trait.Default.html
+    /// [`resize_with`]: #method.resize_with
+    pub fn resize(&mut self, new_len: usize, value: T) {
+        let len = self.len();
+
+        if new_len > len {
+            self.extend_with(new_len - len, ExtendElement(value))
+        } else {
+            self.truncate(new_len);
+        }
+    }
+
+    /// Clones and appends all elements in a slice to the `Vec`.
+    ///
+    /// Iterates over the slice `other`, clones each element, and then appends
+    /// it to this `Vec`. The `other` vector is traversed in-order.
+    ///
+    /// Note that this function is same as [`extend`] except that it is
+    /// specialized to work with slices instead. If and when Rust gets
+    /// specialization this function will likely be deprecated (but still
+    /// available).
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1];
+    /// vec.extend_from_slice(&[2, 3, 4]);
+    /// assert_eq!(vec, [1, 2, 3, 4]);
+    /// ```
+    ///
+    /// [`extend`]: #method.extend
+    pub fn extend_from_slice(&mut self, other: &[T]) {
+        self.extend(other.iter().cloned())
+    }
+}
+
+// This code generalises `extend_with_{element,default}`.
+trait ExtendWith<T> {
+    fn next(&mut self) -> T;
+    fn last(self) -> T;
+}
+
+struct ExtendElement<T>(T);
+impl<T: Clone> ExtendWith<T> for ExtendElement<T> {
+    fn next(&mut self) -> T {
+        self.0.clone()
+    }
+    fn last(self) -> T {
+        self.0
+    }
+}
+
+impl<'bump, T: 'bump> Vec<'bump, T> {
+    /// Extend the vector by `n` values, using the given generator.
+    fn extend_with<E: ExtendWith<T>>(&mut self, n: usize, mut value: E) {
+        self.reserve(n);
+
+        unsafe {
+            let mut ptr = self.as_mut_ptr().add(self.len());
+            // Use SetLenOnDrop to work around bug where compiler
+            // may not realize the store through `ptr` through self.set_len()
+            // don't alias.
+            let mut local_len = SetLenOnDrop::new(&mut self.len);
+
+            // Write all elements except the last one
+            for _ in 1..n {
+                ptr::write(ptr, value.next());
+                ptr = ptr.offset(1);
+                // Increment the length in every step in case next() panics
+                local_len.increment_len(1);
+            }
+
+            if n > 0 {
+                // We can write the last element directly without cloning needlessly
+                ptr::write(ptr, value.last());
+                local_len.increment_len(1);
+            }
+
+            // len set by scope guard
+        }
+    }
+}
+
+// Set the length of the vec when the `SetLenOnDrop` value goes out of scope.
+//
+// The idea is: The length field in SetLenOnDrop is a local variable
+// that the optimizer will see does not alias with any stores through the Vec's data
+// pointer. This is a workaround for alias analysis issue #32155
+struct SetLenOnDrop<'a> {
+    len: &'a mut usize,
+    local_len: usize,
+}
+
+impl<'a> SetLenOnDrop<'a> {
+    #[inline]
+    fn new(len: &'a mut usize) -> Self {
+        SetLenOnDrop {
+            local_len: *len,
+            len,
+        }
+    }
+
+    #[inline]
+    fn increment_len(&mut self, increment: usize) {
+        self.local_len += increment;
+    }
+
+    #[inline]
+    fn decrement_len(&mut self, decrement: usize) {
+        self.local_len -= decrement;
+    }
+}
+
+impl<'a> Drop for SetLenOnDrop<'a> {
+    #[inline]
+    fn drop(&mut self) {
+        *self.len = self.local_len;
+    }
+}
+
+impl<'bump, T: 'bump + PartialEq> Vec<'bump, T> {
+    /// Removes consecutive repeated elements in the vector according to the
+    /// [`PartialEq`] trait implementation.
+    ///
+    /// If the vector is sorted, this removes all duplicates.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut vec = bumpalo::vec![in &b; 1, 2, 2, 3, 2];
+    ///
+    /// vec.dedup();
+    ///
+    /// assert_eq!(vec, [1, 2, 3, 2]);
+    /// ```
+    #[inline]
+    pub fn dedup(&mut self) {
+        self.dedup_by(|a, b| a == b)
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Common trait implementations for Vec
+////////////////////////////////////////////////////////////////////////////////
+
+impl<'bump, T: 'bump + Clone> Clone for Vec<'bump, T> {
+    #[cfg(not(test))]
+    fn clone(&self) -> Vec<'bump, T> {
+        let mut v = Vec::with_capacity_in(self.len(), self.buf.bump());
+        v.extend(self.iter().cloned());
+        v
+    }
+
+    // HACK(japaric): with cfg(test) the inherent `[T]::to_vec` method, which is
+    // required for this method definition, is not available. Instead use the
+    // `slice::to_vec`  function which is only available with cfg(test)
+    // NB see the slice::hack module in slice.rs for more information
+    #[cfg(test)]
+    fn clone(&self) -> Vec<'bump, T> {
+        let mut v = Vec::new_in(self.buf.bump());
+        v.extend(self.iter().cloned());
+        v
+    }
+}
+
+impl<'bump, T: 'bump + Hash> Hash for Vec<'bump, T> {
+    #[inline]
+    fn hash<H: hash::Hasher>(&self, state: &mut H) {
+        Hash::hash(&**self, state)
+    }
+}
+
+impl<'bump, T, I> Index<I> for Vec<'bump, T>
+where
+    I: ::core::slice::SliceIndex<[T]>,
+{
+    type Output = I::Output;
+
+    #[inline]
+    fn index(&self, index: I) -> &Self::Output {
+        Index::index(&**self, index)
+    }
+}
+
+impl<'bump, T, I> IndexMut<I> for Vec<'bump, T>
+where
+    I: ::core::slice::SliceIndex<[T]>,
+{
+    #[inline]
+    fn index_mut(&mut self, index: I) -> &mut Self::Output {
+        IndexMut::index_mut(&mut **self, index)
+    }
+}
+
+impl<'bump, T: 'bump> ops::Deref for Vec<'bump, T> {
+    type Target = [T];
+
+    fn deref(&self) -> &[T] {
+        unsafe {
+            let p = self.buf.ptr();
+            // assume(!p.is_null());
+            slice::from_raw_parts(p, self.len)
+        }
+    }
+}
+
+impl<'bump, T: 'bump> ops::DerefMut for Vec<'bump, T> {
+    fn deref_mut(&mut self) -> &mut [T] {
+        unsafe {
+            let ptr = self.buf.ptr();
+            // assume(!ptr.is_null());
+            slice::from_raw_parts_mut(ptr, self.len)
+        }
+    }
+}
+
+impl<'bump, T: 'bump> IntoIterator for Vec<'bump, T> {
+    type Item = T;
+    type IntoIter = IntoIter<T>;
+
+    /// Creates a consuming iterator, that is, one that moves each value out of
+    /// the vector (from start to end). The vector cannot be used after calling
+    /// this.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let v = bumpalo::vec![in &b; "a".to_string(), "b".to_string()];
+    /// for s in v.into_iter() {
+    ///     // s has type String, not &String
+    ///     println!("{}", s);
+    /// }
+    /// ```
+    #[inline]
+    fn into_iter(mut self) -> IntoIter<T> {
+        unsafe {
+            let begin = self.as_mut_ptr();
+            // assume(!begin.is_null());
+            let end = if mem::size_of::<T>() == 0 {
+                arith_offset(begin as *const i8, self.len() as isize) as *const T
+            } else {
+                begin.add(self.len()) as *const T
+            };
+            mem::forget(self);
+            IntoIter {
+                phantom: PhantomData,
+                ptr: begin,
+                end,
+            }
+        }
+    }
+}
+
+impl<'a, 'bump, T> IntoIterator for &'a Vec<'bump, T> {
+    type Item = &'a T;
+    type IntoIter = slice::Iter<'a, T>;
+
+    fn into_iter(self) -> slice::Iter<'a, T> {
+        self.iter()
+    }
+}
+
+impl<'a, 'bump, T> IntoIterator for &'a mut Vec<'bump, T> {
+    type Item = &'a mut T;
+    type IntoIter = slice::IterMut<'a, T>;
+
+    fn into_iter(self) -> slice::IterMut<'a, T> {
+        self.iter_mut()
+    }
+}
+
+impl<'bump, T: 'bump> Extend<T> for Vec<'bump, T> {
+    #[inline]
+    fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
+        let iter = iter.into_iter();
+        self.reserve(iter.size_hint().0);
+
+        for t in iter {
+            self.push(t);
+        }
+    }
+}
+
+impl<'bump, T: 'bump> Vec<'bump, T> {
+    /// Creates a splicing iterator that replaces the specified range in the vector
+    /// with the given `replace_with` iterator and yields the removed items.
+    /// `replace_with` does not need to be the same length as `range`.
+    ///
+    /// Note 1: The element range is removed even if the iterator is not
+    /// consumed until the end.
+    ///
+    /// Note 2: It is unspecified how many elements are removed from the vector,
+    /// if the `Splice` value is leaked.
+    ///
+    /// Note 3: The input iterator `replace_with` is only consumed
+    /// when the `Splice` value is dropped.
+    ///
+    /// Note 4: This is optimal if:
+    ///
+    /// * The tail (elements in the vector after `range`) is empty,
+    /// * or `replace_with` yields fewer elements than `range`’s length
+    /// * or the lower bound of its `size_hint()` is exact.
+    ///
+    /// Otherwise, a temporary vector is allocated and the tail is moved twice.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the starting point is greater than the end point or if
+    /// the end point is greater than the length of the vector.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let mut v = bumpalo::vec![in &b; 1, 2, 3];
+    /// let new = [7, 8];
+    /// let u: Vec<_> = Vec::from_iter_in(v.splice(..2, new.iter().cloned()), &b);
+    /// assert_eq!(v, &[7, 8, 3]);
+    /// assert_eq!(u, &[1, 2]);
+    /// ```
+    #[inline]
+    pub fn splice<R, I>(&mut self, range: R, replace_with: I) -> Splice<I::IntoIter>
+    where
+        R: RangeBounds<usize>,
+        I: IntoIterator<Item = T>,
+    {
+        Splice {
+            drain: self.drain(range),
+            replace_with: replace_with.into_iter(),
+        }
+    }
+}
+
+/// Extend implementation that copies elements out of references before pushing them onto the Vec.
+///
+/// This implementation is specialized for slice iterators, where it uses [`copy_from_slice`] to
+/// append the entire slice at once.
+///
+/// [`copy_from_slice`]: https://doc.rust-lang.org/std/primitive.slice.html#method.copy_from_slice
+impl<'a, 'bump, T: 'a + Copy> Extend<&'a T> for Vec<'bump, T> {
+    fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I) {
+        self.extend(iter.into_iter().cloned())
+    }
+}
+
+macro_rules! __impl_slice_eq1 {
+    ($Lhs: ty, $Rhs: ty) => {
+        __impl_slice_eq1! { $Lhs, $Rhs, Sized }
+    };
+    ($Lhs: ty, $Rhs: ty, $Bound: ident) => {
+        impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs
+        where
+            A: PartialEq<B>,
+        {
+            #[inline]
+            fn eq(&self, other: &$Rhs) -> bool {
+                self[..] == other[..]
+            }
+        }
+    };
+}
+
+__impl_slice_eq1! { Vec<'a, A>, Vec<'b, B> }
+__impl_slice_eq1! { Vec<'a, A>, &'b [B] }
+__impl_slice_eq1! { Vec<'a, A>, &'b mut [B] }
+// __impl_slice_eq1! { Cow<'a, [A]>, Vec<'b, B>, Clone }
+
+macro_rules! __impl_slice_eq1_array {
+    ($Lhs: ty, $Rhs: ty) => {
+        impl<'a, 'b, A, B, const N: usize> PartialEq<$Rhs> for $Lhs
+        where
+            A: PartialEq<B>,
+        {
+            #[inline]
+            fn eq(&self, other: &$Rhs) -> bool {
+                self[..] == other[..]
+            }
+        }
+    };
+}
+
+__impl_slice_eq1_array! { Vec<'a, A>, [B; N] }
+__impl_slice_eq1_array! { Vec<'a, A>, &'b [B; N] }
+__impl_slice_eq1_array! { Vec<'a, A>, &'b mut [B; N] }
+
+/// Implements comparison of vectors, lexicographically.
+impl<'bump, T: 'bump + PartialOrd> PartialOrd for Vec<'bump, T> {
+    #[inline]
+    fn partial_cmp(&self, other: &Vec<'bump, T>) -> Option<Ordering> {
+        PartialOrd::partial_cmp(&**self, &**other)
+    }
+}
+
+impl<'bump, T: 'bump + Eq> Eq for Vec<'bump, T> {}
+
+/// Implements ordering of vectors, lexicographically.
+impl<'bump, T: 'bump + Ord> Ord for Vec<'bump, T> {
+    #[inline]
+    fn cmp(&self, other: &Vec<'bump, T>) -> Ordering {
+        Ord::cmp(&**self, &**other)
+    }
+}
+
+impl<'bump, T: 'bump + fmt::Debug> fmt::Debug for Vec<'bump, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Debug::fmt(&**self, f)
+    }
+}
+
+impl<'bump, T: 'bump> AsRef<Vec<'bump, T>> for Vec<'bump, T> {
+    fn as_ref(&self) -> &Vec<'bump, T> {
+        self
+    }
+}
+
+impl<'bump, T: 'bump> AsMut<Vec<'bump, T>> for Vec<'bump, T> {
+    fn as_mut(&mut self) -> &mut Vec<'bump, T> {
+        self
+    }
+}
+
+impl<'bump, T: 'bump> AsRef<[T]> for Vec<'bump, T> {
+    fn as_ref(&self) -> &[T] {
+        self
+    }
+}
+
+impl<'bump, T: 'bump> AsMut<[T]> for Vec<'bump, T> {
+    fn as_mut(&mut self) -> &mut [T] {
+        self
+    }
+}
+
+#[cfg(feature = "boxed")]
+impl<'bump, T: 'bump> From<Vec<'bump, T>> for crate::boxed::Box<'bump, [T]> {
+    fn from(v: Vec<'bump, T>) -> crate::boxed::Box<'bump, [T]> {
+        v.into_boxed_slice()
+    }
+}
+
+impl<'bump, T: 'bump> Borrow<[T]> for Vec<'bump, T> {
+    #[inline]
+    fn borrow(&self) -> &[T] {
+        &self[..]
+    }
+}
+
+impl<'bump, T: 'bump> BorrowMut<[T]> for Vec<'bump, T> {
+    #[inline]
+    fn borrow_mut(&mut self) -> &mut [T] {
+        &mut self[..]
+    }
+}
+
+impl<'bump, T> Drop for Vec<'bump, T> {
+    fn drop(&mut self) {
+        unsafe {
+            // use drop for [T]
+            // use a raw slice to refer to the elements of the vector as weakest necessary type;
+            // could avoid questions of validity in certain cases
+            ptr::drop_in_place(ptr::slice_from_raw_parts_mut(self.as_mut_ptr(), self.len))
+        }
+        // RawVec handles deallocation
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Clone-on-write
+////////////////////////////////////////////////////////////////////////////////
+
+// impl<'a, 'bump, T: Clone> From<Vec<'bump, T>> for Cow<'a, [T]> {
+//     fn from(v: Vec<'bump, T>) -> Cow<'a, [T]> {
+//         Cow::Owned(v)
+//     }
+// }
+
+// impl<'a, 'bump, T: Clone> From<&'a Vec<'bump, T>> for Cow<'a, [T]> {
+//     fn from(v: &'a Vec<'bump, T>) -> Cow<'a, [T]> {
+//         Cow::Borrowed(v.as_slice())
+//     }
+// }
+
+////////////////////////////////////////////////////////////////////////////////
+// Iterators
+////////////////////////////////////////////////////////////////////////////////
+
+/// An iterator that moves out of a vector.
+///
+/// This `struct` is created by the [`Vec::into_iter`] method
+/// (provided by the [`IntoIterator`] trait).
+///
+/// [`IntoIterator`]: https://doc.rust-lang.org/std/iter/trait.IntoIterator.html
+pub struct IntoIter<T> {
+    phantom: PhantomData<T>,
+    ptr: *const T,
+    end: *const T,
+}
+
+impl<T: fmt::Debug> fmt::Debug for IntoIter<T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("IntoIter").field(&self.as_slice()).finish()
+    }
+}
+
+impl<'bump, T: 'bump> IntoIter<T> {
+    /// Returns the remaining items of this iterator as a slice.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let vec = bumpalo::vec![in &b; 'a', 'b', 'c'];
+    /// let mut into_iter = vec.into_iter();
+    /// assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
+    /// let _ = into_iter.next().unwrap();
+    /// assert_eq!(into_iter.as_slice(), &['b', 'c']);
+    /// ```
+    pub fn as_slice(&self) -> &[T] {
+        unsafe { slice::from_raw_parts(self.ptr, self.len()) }
+    }
+
+    /// Returns the remaining items of this iterator as a mutable slice.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bumpalo::{Bump, collections::Vec};
+    ///
+    /// let b = Bump::new();
+    ///
+    /// let vec = bumpalo::vec![in &b; 'a', 'b', 'c'];
+    /// let mut into_iter = vec.into_iter();
+    /// assert_eq!(into_iter.as_slice(), &['a', 'b', 'c']);
+    /// into_iter.as_mut_slice()[2] = 'z';
+    /// assert_eq!(into_iter.next().unwrap(), 'a');
+    /// assert_eq!(into_iter.next().unwrap(), 'b');
+    /// assert_eq!(into_iter.next().unwrap(), 'z');
+    /// ```
+    pub fn as_mut_slice(&mut self) -> &mut [T] {
+        unsafe { slice::from_raw_parts_mut(self.ptr as *mut T, self.len()) }
+    }
+}
+
+unsafe impl<T: Send> Send for IntoIter<T> {}
+unsafe impl<T: Sync> Sync for IntoIter<T> {}
+
+impl<'bump, T: 'bump> Iterator for IntoIter<T> {
+    type Item = T;
+
+    #[inline]
+    fn next(&mut self) -> Option<T> {
+        unsafe {
+            if self.ptr as *const _ == self.end {
+                None
+            } else if mem::size_of::<T>() == 0 {
+                // purposefully don't use 'ptr.offset' because for
+                // vectors with 0-size elements this would return the
+                // same pointer.
+                self.ptr = arith_offset(self.ptr as *const i8, 1) as *mut T;
+
+                // Make up a value of this ZST.
+                Some(mem::zeroed())
+            } else {
+                let old = self.ptr;
+                self.ptr = self.ptr.offset(1);
+
+                Some(ptr::read(old))
+            }
+        }
+    }
+
+    #[inline]
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        let exact = if mem::size_of::<T>() == 0 {
+            (self.end as usize).wrapping_sub(self.ptr as usize)
+        } else {
+            unsafe { offset_from(self.end, self.ptr) as usize }
+        };
+        (exact, Some(exact))
+    }
+
+    #[inline]
+    fn count(self) -> usize {
+        self.len()
+    }
+}
+
+impl<'bump, T: 'bump> DoubleEndedIterator for IntoIter<T> {
+    #[inline]
+    fn next_back(&mut self) -> Option<T> {
+        unsafe {
+            if self.end == self.ptr {
+                None
+            } else if mem::size_of::<T>() == 0 {
+                // See above for why 'ptr.offset' isn't used
+                self.end = arith_offset(self.end as *const i8, -1) as *mut T;
+
+                // Make up a value of this ZST.
+                Some(mem::zeroed())
+            } else {
+                self.end = self.end.offset(-1);
+
+                Some(ptr::read(self.end))
+            }
+        }
+    }
+}
+
+impl<'bump, T: 'bump> ExactSizeIterator for IntoIter<T> {}
+
+impl<'bump, T: 'bump> FusedIterator for IntoIter<T> {}
+
+/// A draining iterator for `Vec<'bump, T>`.
+///
+/// This `struct` is created by the [`Vec::drain`] method.
+pub struct Drain<'a, 'bump, T: 'a + 'bump> {
+    /// Index of tail to preserve
+    tail_start: usize,
+    /// Length of tail
+    tail_len: usize,
+    /// Current remaining range to remove
+    iter: slice::Iter<'a, T>,
+    vec: NonNull<Vec<'bump, T>>,
+}
+
+impl<'a, 'bump, T: 'a + 'bump + fmt::Debug> fmt::Debug for Drain<'a, 'bump, T> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.debug_tuple("Drain").field(&self.iter.as_slice()).finish()
+    }
+}
+
+unsafe impl<'a, 'bump, T: Sync> Sync for Drain<'a, 'bump, T> {}
+unsafe impl<'a, 'bump, T: Send> Send for Drain<'a, 'bump, T> {}
+
+impl<'a, 'bump, T> Iterator for Drain<'a, 'bump, T> {
+    type Item = T;
+
+    #[inline]
+    fn next(&mut self) -> Option<T> {
+        self.iter
+            .next()
+            .map(|elt| unsafe { ptr::read(elt as *const _) })
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.iter.size_hint()
+    }
+}
+
+impl<'a, 'bump, T> DoubleEndedIterator for Drain<'a, 'bump, T> {
+    #[inline]
+    fn next_back(&mut self) -> Option<T> {
+        self.iter
+            .next_back()
+            .map(|elt| unsafe { ptr::read(elt as *const _) })
+    }
+}
+
+impl<'a, 'bump, T> Drop for Drain<'a, 'bump, T> {
+    fn drop(&mut self) {
+        // exhaust self first
+        self.for_each(drop);
+
+        if self.tail_len > 0 {
+            unsafe {
+                let source_vec = self.vec.as_mut();
+                // memmove back untouched tail, update to new length
+                let start = source_vec.len();
+                let tail = self.tail_start;
+                if tail != start {
+                    let src = source_vec.as_ptr().add(tail);
+                    let dst = source_vec.as_mut_ptr().add(start);
+                    ptr::copy(src, dst, self.tail_len);
+                }
+                source_vec.set_len(start + self.tail_len);
+            }
+        }
+    }
+}
+
+impl<'a, 'bump, T> ExactSizeIterator for Drain<'a, 'bump, T> {}
+
+impl<'a, 'bump, T> FusedIterator for Drain<'a, 'bump, T> {}
+
+/// A splicing iterator for `Vec`.
+///
+/// This struct is created by the [`Vec::splice`] method. See its
+/// documentation for more information.
+#[derive(Debug)]
+pub struct Splice<'a, 'bump, I: Iterator + 'a + 'bump> {
+    drain: Drain<'a, 'bump, I::Item>,
+    replace_with: I,
+}
+
+impl<'a, 'bump, I: Iterator> Iterator for Splice<'a, 'bump, I> {
+    type Item = I::Item;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        self.drain.next()
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.drain.size_hint()
+    }
+}
+
+impl<'a, 'bump, I: Iterator> DoubleEndedIterator for Splice<'a, 'bump, I> {
+    fn next_back(&mut self) -> Option<Self::Item> {
+        self.drain.next_back()
+    }
+}
+
+impl<'a, 'bump, I: Iterator> ExactSizeIterator for Splice<'a, 'bump, I> {}
+
+impl<'a, 'bump, I: Iterator> Drop for Splice<'a, 'bump, I> {
+    fn drop(&mut self) {
+        self.drain.by_ref().for_each(drop);
+
+        unsafe {
+            if self.drain.tail_len == 0 {
+                self.drain.vec.as_mut().extend(self.replace_with.by_ref());
+                return;
+            }
+
+            // First fill the range left by drain().
+            if !self.drain.fill(&mut self.replace_with) {
+                return;
+            }
+
+            // There may be more elements. Use the lower bound as an estimate.
+            // FIXME: Is the upper bound a better guess? Or something else?
+            let (lower_bound, _upper_bound) = self.replace_with.size_hint();
+            if lower_bound > 0 {
+                self.drain.move_tail(lower_bound);
+                if !self.drain.fill(&mut self.replace_with) {
+                    return;
+                }
+            }
+
+            // Collect any remaining elements.
+            // This is a zero-length vector which does not allocate if `lower_bound` was exact.
+            let mut collected = Vec::new_in(self.drain.vec.as_ref().buf.bump());
+            collected.extend(self.replace_with.by_ref());
+            let mut collected = collected.into_iter();
+            // Now we have an exact count.
+            if collected.len() > 0 {
+                self.drain.move_tail(collected.len());
+                let filled = self.drain.fill(&mut collected);
+                debug_assert!(filled);
+                debug_assert_eq!(collected.len(), 0);
+            }
+        }
+        // Let `Drain::drop` move the tail back if necessary and restore `vec.len`.
+    }
+}
+
+/// Private helper methods for `Splice::drop`
+impl<'a, 'bump, T> Drain<'a, 'bump, T> {
+    /// The range from `self.vec.len` to `self.tail_start` contains elements
+    /// that have been moved out.
+    /// Fill that range as much as possible with new elements from the `replace_with` iterator.
+    /// Return whether we filled the entire range. (`replace_with.next()` didn’t return `None`.)
+    unsafe fn fill<I: Iterator<Item = T>>(&mut self, replace_with: &mut I) -> bool {
+        let vec = self.vec.as_mut();
+        let range_start = vec.len;
+        let range_end = self.tail_start;
+        let range_slice =
+            slice::from_raw_parts_mut(vec.as_mut_ptr().add(range_start), range_end - range_start);
+
+        for place in range_slice {
+            if let Some(new_item) = replace_with.next() {
+                ptr::write(place, new_item);
+                vec.len += 1;
+            } else {
+                return false;
+            }
+        }
+        true
+    }
+
+    /// Make room for inserting more elements before the tail.
+    unsafe fn move_tail(&mut self, extra_capacity: usize) {
+        let vec = self.vec.as_mut();
+        let used_capacity = self.tail_start + self.tail_len;
+        vec.buf.reserve(used_capacity, extra_capacity);
+
+        let new_tail_start = self.tail_start + extra_capacity;
+        let src = vec.as_ptr().add(self.tail_start);
+        let dst = vec.as_mut_ptr().add(new_tail_start);
+        ptr::copy(src, dst, self.tail_len);
+        self.tail_start = new_tail_start;
+    }
+}
+
+/// An iterator produced by calling [`Vec::drain_filter`].
+#[derive(Debug)]
+pub struct DrainFilter<'a, 'bump: 'a, T: 'a + 'bump, F>
+where
+    F: FnMut(&mut T) -> bool,
+{
+    vec: &'a mut Vec<'bump, T>,
+    idx: usize,
+    del: usize,
+    old_len: usize,
+    pred: F,
+}
+
+impl<'a, 'bump, T, F> Iterator for DrainFilter<'a, 'bump, T, F>
+where
+    F: FnMut(&mut T) -> bool,
+{
+    type Item = T;
+
+    fn next(&mut self) -> Option<T> {
+        unsafe {
+            while self.idx != self.old_len {
+                let i = self.idx;
+                self.idx += 1;
+                let v = slice::from_raw_parts_mut(self.vec.as_mut_ptr(), self.old_len);
+                if (self.pred)(&mut v[i]) {
+                    self.del += 1;
+                    return Some(ptr::read(&v[i]));
+                } else if self.del > 0 {
+                    let del = self.del;
+                    let src: *const T = &v[i];
+                    let dst: *mut T = &mut v[i - del];
+                    // This is safe because self.vec has length 0
+                    // thus its elements will not have Drop::drop
+                    // called on them in the event of a panic.
+                    ptr::copy_nonoverlapping(src, dst, 1);
+                }
+            }
+            None
+        }
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (0, Some(self.old_len - self.idx))
+    }
+}
+
+impl<'a, 'bump, T, F> Drop for DrainFilter<'a, 'bump, T, F>
+where
+    F: FnMut(&mut T) -> bool,
+{
+    fn drop(&mut self) {
+        self.for_each(drop);
+        unsafe {
+            self.vec.set_len(self.old_len - self.del);
+        }
+    }
+}
diff --git a/android/vendor/bumpalo-3.10.0/src/lib.rs b/android/vendor/bumpalo-3.10.0/src/lib.rs
new file mode 100644
index 0000000..2feb8b8
--- /dev/null
+++ b/android/vendor/bumpalo-3.10.0/src/lib.rs
@@ -0,0 +1,1849 @@
+#![doc = include_str!("../README.md")]
+#![deny(missing_debug_implementations)]
+#![deny(missing_docs)]
+#![no_std]
+#![cfg_attr(
+    feature = "allocator_api",
+    feature(allocator_api, nonnull_slice_from_raw_parts)
+)]
+
+#[doc(hidden)]
+pub extern crate alloc as core_alloc;
+
+#[cfg(feature = "boxed")]
+pub mod boxed;
+#[cfg(feature = "collections")]
+pub mod collections;
+
+mod alloc;
+
+use core::cell::Cell;
+use core::fmt::Display;
+use core::iter;
+use core::marker::PhantomData;
+use core::mem;
+use core::ptr::{self, NonNull};
+use core::slice;
+use core::str;
+use core_alloc::alloc::{alloc, dealloc, Layout};
+#[cfg(feature = "allocator_api")]
+use core_alloc::alloc::{AllocError, Allocator};
+
+pub use alloc::AllocErr;
+
+/// An error returned from [`Bump::try_alloc_try_with`].
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub enum AllocOrInitError<E> {
+    /// Indicates that the initial allocation failed.
+    Alloc(AllocErr),
+    /// Indicates that the initializer failed with the contained error after
+    /// allocation.
+    ///
+    /// It is possible but not guaranteed that the allocated memory has been
+    /// released back to the allocator at this point.
+    Init(E),
+}
+impl<E> From<AllocErr> for AllocOrInitError<E> {
+    fn from(e: AllocErr) -> Self {
+        Self::Alloc(e)
+    }
+}
+impl<E: Display> Display for AllocOrInitError<E> {
+    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
+        match self {
+            AllocOrInitError::Alloc(err) => err.fmt(f),
+            AllocOrInitError::Init(err) => write!(f, "initialization failed: {}", err),
+        }
+    }
+}
+
+/// An arena to bump allocate into.
+///
+/// ## No `Drop`s
+///
+/// Objects that are bump-allocated will never have their [`Drop`] implementation
+/// called &mdash; unless you do it manually yourself. This makes it relatively
+/// easy to leak memory or other resources.
+///
+/// If you have a type which internally manages
+///
+/// * an allocation from the global heap (e.g. [`Vec<T>`]),
+/// * open file descriptors (e.g. [`std::fs::File`]), or
+/// * any other resource that must be cleaned up (e.g. an `mmap`)
+///
+/// and relies on its `Drop` implementation to clean up the internal resource,
+/// then if you allocate that type with a `Bump`, you need to find a new way to
+/// clean up after it yourself.
+///
+/// Potential solutions are:
+///
+/// * Using [`bumpalo::boxed::Box::new_in`] instead of [`Bump::alloc`], that
+///   will drop wrapped values similarly to [`std::boxed::Box`]. Note that this
+///   requires enabling the `"boxed"` Cargo feature for this crate. **This is
+///   often the easiest solution.**
+///
+/// * Calling [`drop_in_place`][drop_in_place] or using
+///   [`std::mem::ManuallyDrop`][manuallydrop] to manually drop these types.
+///
+/// * Using [`bumpalo::collections::Vec`] instead of [`std::vec::Vec`].
+///
+/// * Avoiding allocating these problematic types within a `Bump`.
+///
+/// Note that not calling `Drop` is memory safe! Destructors are never
+/// guaranteed to run in Rust, you can't rely on them for enforcing memory
+/// safety.
+///
+/// [`Drop`]: https://doc.rust-lang.org/std/ops/trait.Drop.html
+/// [`Vec<T>`]: https://doc.rust-lang.org/std/vec/struct.Vec.html
+/// [`std::fs::File`]: https://doc.rust-lang.org/std/fs/struct.File.html
+/// [drop_in_place]: https://doc.rust-lang.org/std/ptr/fn.drop_in_place.html
+/// [manuallydrop]: https://doc.rust-lang.org/std/mem/struct.ManuallyDrop.html
+/// [`bumpalo::collections::Vec`]: collections/vec/struct.Vec.html
+/// [`std::vec::Vec`]: https://doc.rust-lang.org/std/vec/struct.Vec.html
+/// [`bumpalo::boxed::Box::new_in`]: boxed/struct.Box.html#method.new_in
+/// [`std::boxed::Box`]: https://doc.rust-lang.org/std/boxed/struct.Box.html
+///
+/// ## Example
+///
+/// ```
+/// use bumpalo::Bump;
+///
+/// // Create a new bump arena.
+/// let bump = Bump::new();
+///
+/// // Allocate values into the arena.
+/// let forty_two = bump.alloc(42);
+/// assert_eq!(*forty_two, 42);
+///
+/// // Mutable references are returned from allocation.
+/// let mut s = bump.alloc("bumpalo");
+/// *s = "the bump allocator; and also is a buffalo";
+/// ```
+///
+/// ## Allocation Methods Come in Many Flavors
+///
+/// There are various allocation methods on `Bump`, the simplest being
+/// [`alloc`][Bump::alloc]. The others exist to satisfy some combination of
+/// fallible allocation and initialization. The allocation methods are
+/// summarized in the following table:
+///
+/// <table>
+///   <thead>
+///     <tr>
+///       <th></th>
+///       <th>Infallible Allocation</th>
+///       <th>Fallible Allocation</th>
+///     </tr>
+///   </thead>
+///     <tr>
+///       <th>By Value</th>
+///       <td><a href="#method.alloc"><code>alloc</code></a></td>
+///       <td><a href="#method.try_alloc"><code>try_alloc</code></a></td>
+///     </tr>
+///     <tr>
+///       <th>Infallible Initializer Function</th>
+///       <td><a href="#method.alloc_with"><code>alloc_with</code></a></td>
+///       <td><a href="#method.try_alloc_with"><code>try_alloc_with</code></a></td>
+///     </tr>
+///     <tr>
+///       <th>Fallible Initializer Function</th>
+///       <td><a href="#method.alloc_try_with"><code>alloc_try_with</code></a></td>
+///       <td><a href="#method.try_alloc_try_with"><code>try_alloc_try_with</code></a></td>
+///     </tr>
+///   <tbody>
+///   </tbody>
+/// </table>
+///
+/// ### Fallible Allocation: The `try_alloc_` Method Prefix
+///
+/// These allocation methods let you recover from out-of-memory (OOM)
+/// scenarioes, rather than raising a panic on OOM.
+///
+/// ```
+/// use bumpalo::Bump;
+///
+/// let bump = Bump::new();
+///
+/// match bump.try_alloc(MyStruct {
+///     // ...
+/// }) {
+///     Ok(my_struct) => {
+///         // Allocation succeeded.
+///     }
+///     Err(e) => {
+///         // Out of memory.
+///     }
+/// }
+///
+/// struct MyStruct {
+///     // ...
+/// }
+/// ```
+///
+/// ### Initializer Functions: The `_with` Method Suffix
+///
+/// Calling one of the generic `…alloc(x)` methods is essentially equivalent to
+/// the matching [`…alloc_with(|| x)`](?search=alloc_with). However if you use
+/// `…alloc_with`, then the closure will not be invoked until after allocating
+/// space for storing `x` on the heap.
+///
+/// This can be useful in certain edge-cases related to compiler optimizations.
+/// When evaluating for example `bump.alloc(x)`, semantically `x` is first put
+/// on the stack and then moved onto the heap. In some cases, the compiler is
+/// able to optimize this into constructing `x` directly on the heap, however
+/// in many cases it does not.
+///
+/// The `…alloc_with` functions try to help the compiler be smarter. In most
+/// cases doing for example `bump.try_alloc_with(|| x)` on release mode will be
+/// enough to help the compiler realize that this optimization is valid and
+/// to construct `x` directly onto the heap.
+///
+/// #### Warning
+///
+/// These functions critically depend on compiler optimizations to achieve their
+/// desired effect. This means that it is not an effective tool when compiling
+/// without optimizations on.
+///
+/// Even when optimizations are on, these functions do not **guarantee** that
+/// the value is constructed on the heap. To the best of our knowledge no such
+/// guarantee can be made in stable Rust as of 1.54.
+///
+/// ### Fallible Initialization: The `_try_with` Method Suffix
+///
+/// The generic [`…alloc_try_with(|| x)`](?search=_try_with) methods behave
+/// like the purely `_with` suffixed methods explained above. However, they
+/// allow for fallible initialization by accepting a closure that returns a
+/// [`Result`] and will attempt to undo the initial allocation if this closure
+/// returns [`Err`].
+///
+/// #### Warning
+///
+/// If the inner closure returns [`Ok`], space for the entire [`Result`] remains
+/// allocated inside `self`. This can be a problem especially if the [`Err`]
+/// variant is larger, but even otherwise there may be overhead for the
+/// [`Result`]'s discriminant.
+///
+/// <p><details><summary>Undoing the allocation in the <code>Err</code> case
+/// always fails if <code>f</code> successfully made any additional allocations
+/// in <code>self</code>.</summary>
+///
+/// For example, the following will always leak also space for the [`Result`]
+/// into this `Bump`, even though the inner reference isn't kept and the [`Err`]
+/// payload is returned semantically by value:
+///
+/// ```rust
+/// let bump = bumpalo::Bump::new();
+///
+/// let r: Result<&mut [u8; 1000], ()> = bump.alloc_try_with(|| {
+///     let _ = bump.alloc(0_u8);
+///     Err(())
+/// });
+///
+/// assert!(r.is_err());
+/// ```
+///
+///</details></p>
+///
+/// Since [`Err`] payloads are first placed on the heap and then moved to the
+/// stack, `bump.…alloc_try_with(|| x)?` is likely to execute more slowly than
+/// the matching `bump.…alloc(x?)` in case of initialization failure. If this
+/// happens frequently, using the plain un-suffixed method may perform better.
+///
+/// [`Result`]: https://doc.rust-lang.org/std/result/enum.Result.html
+/// [`Ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Ok
+/// [`Err`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err
+#[derive(Debug)]
+pub struct Bump {
+    // The current chunk we are bump allocating within.
+    current_chunk_footer: Cell<NonNull<ChunkFooter>>,
+}
+
+#[repr(C)]
+#[derive(Debug)]
+struct ChunkFooter {
+    // Pointer to the start of this chunk allocation. This footer is always at
+    // the end of the chunk.
+    data: NonNull<u8>,
+
+    // The layout of this chunk's allocation.
+    layout: Layout,
+
+    // Link to the previous chunk.
+    //
+    // Note that the last node in the `prev` linked list is the canonical empty
+    // chunk, whose `prev` link points to itself.
+    prev: Cell<NonNull<ChunkFooter>>,
+
+    // Bump allocation finger that is always in the range `self.data..=self`.
+    ptr: Cell<NonNull<u8>>,
+}
+
+/// A wrapper type for the canonical, statically allocated empty chunk.
+///
+/// For the canonical empty chunk to be `static`, its type must be `Sync`, which
+/// is the purpose of this wrapper type. This is safe because the empty chunk is
+/// immutable and never actually modified.
+#[repr(transparent)]
+struct EmptyChunkFooter(ChunkFooter);
+
+unsafe impl Sync for EmptyChunkFooter {}
+
+static EMPTY_CHUNK: EmptyChunkFooter = EmptyChunkFooter(ChunkFooter {
+    // This chunk is empty (except the foot itself).
+    layout: Layout::new::<ChunkFooter>(),
+
+    // The start of the (empty) allocatable region for this chunk is itself.
+    data: unsafe { NonNull::new_unchecked(&EMPTY_CHUNK as *const EmptyChunkFooter as *mut u8) },
+
+    // The end of the (empty) allocatable region for this chunk is also itself.
+    ptr: Cell::new(unsafe {
+        NonNull::new_unchecked(&EMPTY_CHUNK as *const EmptyChunkFooter as *mut u8)
+    }),
+
+    // Invariant: the last chunk footer in all `ChunkFooter::prev` linked lists
+    // is the empty chunk footer, whose `prev` points to itself.
+    prev: Cell::new(unsafe {
+        NonNull::new_unchecked(&EMPTY_CHUNK as *const EmptyChunkFooter as *mut ChunkFooter)
+    }),
+});
+
+impl EmptyChunkFooter {
+    fn get(&'static self) -> NonNull<ChunkFooter> {
+        unsafe { NonNull::new_unchecked(&self.0 as *const ChunkFooter as *mut ChunkFooter) }
+    }
+}
+
+impl ChunkFooter {
+    // Returns the start and length of the currently allocated region of this
+    // chunk.
+    fn as_raw_parts(&self) -> (*const u8, usize) {
+        let data = self.data.as_ptr() as *const u8;
+        let ptr = self.ptr.get().as_ptr() as *const u8;
+        debug_assert!(data <= ptr);
+        debug_assert!(ptr <= self as *const ChunkFooter as *const u8);
+        let len = unsafe { (self as *const ChunkFooter as *const u8).offset_from(ptr) as usize };
+        (ptr, len)
+    }
+
+    /// Is this chunk the last empty chunk?
+    fn is_empty(&self) -> bool {
+        ptr::eq(self, EMPTY_CHUNK.get().as_ptr())
+    }
+}
+
+impl Default for Bump {
+    fn default() -> Bump {
+        Bump::new()
+    }
+}
+
+impl Drop for Bump {
+    fn drop(&mut self) {
+        unsafe {
+            dealloc_chunk_list(self.current_chunk_footer.get());
+        }
+    }
+}
+
+#[inline]
+unsafe fn dealloc_chunk_list(mut footer: NonNull<ChunkFooter>) {
+    while !footer.as_ref().is_empty() {
+        let f = footer;
+        footer = f.as_ref().prev.get();
+        dealloc(f.as_ref().data.as_ptr(), f.as_ref().layout);
+    }
+}
+
+// `Bump`s are safe to send between threads because nothing aliases its owned
+// chunks until you start allocating from it. But by the time you allocate from
+// it, the returned references to allocations borrow the `Bump` and therefore
+// prevent sending the `Bump` across threads until the borrows end.
+unsafe impl Send for Bump {}
+
+#[inline]
+pub(crate) fn round_up_to(n: usize, divisor: usize) -> Option<usize> {
+    debug_assert!(divisor > 0);
+    debug_assert!(divisor.is_power_of_two());
+    Some(n.checked_add(divisor - 1)? & !(divisor - 1))
+}
+
+#[inline]
+pub(crate) fn round_down_to(n: usize, divisor: usize) -> usize {
+    debug_assert!(divisor > 0);
+    debug_assert!(divisor.is_power_of_two());
+    n & !(divisor - 1)
+}
+
+// After this point, we try to hit page boundaries instead of powers of 2
+const PAGE_STRATEGY_CUTOFF: usize = 0x1000;
+
+// We only support alignments of up to 16 bytes for iter_allocated_chunks.
+const SUPPORTED_ITER_ALIGNMENT: usize = 16;
+const CHUNK_ALIGN: usize = SUPPORTED_ITER_ALIGNMENT;
+const FOOTER_SIZE: usize = mem::size_of::<ChunkFooter>();
+
+// Assert that ChunkFooter is at most the supported alignment. This will give a compile time error if it is not the case
+const _FOOTER_ALIGN_ASSERTION: bool = mem::align_of::<ChunkFooter>() <= CHUNK_ALIGN;
+const _: [(); _FOOTER_ALIGN_ASSERTION as usize] = [()];
+
+// Maximum typical overhead per allocation imposed by allocators.
+const MALLOC_OVERHEAD: usize = 16;
+
+// This is the overhead from malloc, footer and alignment. For instance, if
+// we want to request a chunk of memory that has at least X bytes usable for
+// allocations (where X is aligned to CHUNK_ALIGN), then we expect that the
+// after adding a footer, malloc overhead and alignment, the chunk of memory
+// the allocator actually sets aside for us is X+OVERHEAD rounded up to the
+// nearest suitable size boundary.
+const OVERHEAD: usize = (MALLOC_OVERHEAD + FOOTER_SIZE + (CHUNK_ALIGN - 1)) & !(CHUNK_ALIGN - 1);
+
+// Choose a relatively small default initial chunk size, since we double chunk
+// sizes as we grow bump arenas to amortize costs of hitting the global
+// allocator.
+const FIRST_ALLOCATION_GOAL: usize = 1 << 9;
+
+// The actual size of the first allocation is going to be a bit smaller
+// than the goal. We need to make room for the footer, and we also need
+// take the alignment into account.
+const DEFAULT_CHUNK_SIZE_WITHOUT_FOOTER: usize = FIRST_ALLOCATION_GOAL - OVERHEAD;
+
+/// Wrapper around `Layout::from_size_align` that adds debug assertions.
+#[inline]
+unsafe fn layout_from_size_align(size: usize, align: usize) -> Layout {
+    if cfg!(debug_assertions) {
+        Layout::from_size_align(size, align).unwrap()
+    } else {
+        Layout::from_size_align_unchecked(size, align)
+    }
+}
+
+#[inline(never)]
+fn allocation_size_overflow<T>() -> T {
+    panic!("requested allocation size overflowed")
+}
+
+impl Bump {
+    /// Construct a new arena to bump allocate into.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// # let _ = bump;
+    /// ```
+    pub fn new() -> Bump {
+        Self::with_capacity(0)
+    }
+
+    /// Attempt to construct a new arena to bump allocate into.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::try_new();
+    /// # let _ = bump.unwrap();
+    /// ```
+    pub fn try_new() -> Result<Bump, AllocErr> {
+        Bump::try_with_capacity(0)
+    }
+
+    /// Construct a new arena with the specified byte capacity to bump allocate into.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::with_capacity(100);
+    /// # let _ = bump;
+    /// ```
+    pub fn with_capacity(capacity: usize) -> Bump {
+        Bump::try_with_capacity(capacity).unwrap_or_else(|_| oom())
+    }
+
+    /// Attempt to construct a new arena with the specified byte capacity to bump allocate into.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::try_with_capacity(100);
+    /// # let _ = bump.unwrap();
+    /// ```
+    pub fn try_with_capacity(capacity: usize) -> Result<Self, AllocErr> {
+        if capacity == 0 {
+            return Ok(Bump {
+                current_chunk_footer: Cell::new(EMPTY_CHUNK.get()),
+            });
+        }
+
+        let chunk_footer = Self::new_chunk(
+            None,
+            unsafe { layout_from_size_align(capacity, 1) },
+            EMPTY_CHUNK.get(),
+        )
+        .ok_or(AllocErr)?;
+
+        Ok(Bump {
+            current_chunk_footer: Cell::new(chunk_footer),
+        })
+    }
+
+    /// Allocate a new chunk and return its initialized footer.
+    ///
+    /// If given, `layouts` is a tuple of the current chunk size and the
+    /// layout of the allocation request that triggered us to fall back to
+    /// allocating a new chunk of memory.
+    fn new_chunk(
+        new_size_without_footer: Option<usize>,
+        requested_layout: Layout,
+        prev: NonNull<ChunkFooter>,
+    ) -> Option<NonNull<ChunkFooter>> {
+        unsafe {
+            let mut new_size_without_footer =
+                new_size_without_footer.unwrap_or(DEFAULT_CHUNK_SIZE_WITHOUT_FOOTER);
+
+            // We want to have CHUNK_ALIGN or better alignment
+            let mut align = CHUNK_ALIGN;
+
+            // If we already know we need to fulfill some request,
+            // make sure we allocate at least enough to satisfy it
+            align = align.max(requested_layout.align());
+            let requested_size = round_up_to(requested_layout.size(), align)
+                .unwrap_or_else(allocation_size_overflow);
+            new_size_without_footer = new_size_without_footer.max(requested_size);
+
+            // We want our allocations to play nice with the memory allocator,
+            // and waste as little memory as possible.
+            // For small allocations, this means that the entire allocation
+            // including the chunk footer and mallocs internal overhead is
+            // as close to a power of two as we can go without going over.
+            // For larger allocations, we only need to get close to a page
+            // boundary without going over.
+            if new_size_without_footer < PAGE_STRATEGY_CUTOFF {
+                new_size_without_footer =
+                    (new_size_without_footer + OVERHEAD).next_power_of_two() - OVERHEAD;
+            } else {
+                new_size_without_footer =
+                    round_up_to(new_size_without_footer + OVERHEAD, 0x1000)? - OVERHEAD;
+            }
+
+            debug_assert_eq!(align % CHUNK_ALIGN, 0);
+            debug_assert_eq!(new_size_without_footer % CHUNK_ALIGN, 0);
+            let size = new_size_without_footer
+                .checked_add(FOOTER_SIZE)
+                .unwrap_or_else(allocation_size_overflow);
+            let layout = layout_from_size_align(size, align);
+
+            debug_assert!(size >= requested_layout.size());
+
+            let data = alloc(layout);
+            let data = NonNull::new(data)?;
+
+            // The `ChunkFooter` is at the end of the chunk.
+            let footer_ptr = data.as_ptr().add(new_size_without_footer);
+            debug_assert_eq!((data.as_ptr() as usize) % align, 0);
+            debug_assert_eq!(footer_ptr as usize % CHUNK_ALIGN, 0);
+            let footer_ptr = footer_ptr as *mut ChunkFooter;
+
+            // The bump pointer is initialized to the end of the range we will
+            // bump out of.
+            let ptr = Cell::new(NonNull::new_unchecked(footer_ptr as *mut u8));
+
+            ptr::write(
+                footer_ptr,
+                ChunkFooter {
+                    data,
+                    layout,
+                    prev: Cell::new(prev),
+                    ptr,
+                },
+            );
+
+            Some(NonNull::new_unchecked(footer_ptr))
+        }
+    }
+
+    /// Reset this bump allocator.
+    ///
+    /// Performs mass deallocation on everything allocated in this arena by
+    /// resetting the pointer into the underlying chunk of memory to the start
+    /// of the chunk. Does not run any `Drop` implementations on deallocated
+    /// objects; see [the top-level documentation](struct.Bump.html) for details.
+    ///
+    /// If this arena has allocated multiple chunks to bump allocate into, then
+    /// the excess chunks are returned to the global allocator.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let mut bump = bumpalo::Bump::new();
+    ///
+    /// // Allocate a bunch of things.
+    /// {
+    ///     for i in 0..100 {
+    ///         bump.alloc(i);
+    ///     }
+    /// }
+    ///
+    /// // Reset the arena.
+    /// bump.reset();
+    ///
+    /// // Allocate some new things in the space previously occupied by the
+    /// // original things.
+    /// for j in 200..400 {
+    ///     bump.alloc(j);
+    /// }
+    ///```
+    pub fn reset(&mut self) {
+        // Takes `&mut self` so `self` must be unique and there can't be any
+        // borrows active that would get invalidated by resetting.
+        unsafe {
+            if self.current_chunk_footer.get().as_ref().is_empty() {
+                return;
+            }
+
+            let cur_chunk = self.current_chunk_footer.get();
+
+            // Deallocate all chunks except the current one
+            let prev_chunk = cur_chunk.as_ref().prev.replace(EMPTY_CHUNK.get());
+            dealloc_chunk_list(prev_chunk);
+
+            // Reset the bump finger to the end of the chunk.
+            cur_chunk.as_ref().ptr.set(cur_chunk.cast());
+
+            debug_assert!(
+                self.current_chunk_footer
+                    .get()
+                    .as_ref()
+                    .prev
+                    .get()
+                    .as_ref()
+                    .is_empty(),
+                "We should only have a single chunk"
+            );
+            debug_assert_eq!(
+                self.current_chunk_footer.get().as_ref().ptr.get(),
+                self.current_chunk_footer.get().cast(),
+                "Our chunk's bump finger should be reset to the start of its allocation"
+            );
+        }
+    }
+
+    /// Allocate an object in this `Bump` and return an exclusive reference to
+    /// it.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for `T` fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc("hello");
+    /// assert_eq!(*x, "hello");
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc<T>(&self, val: T) -> &mut T {
+        self.alloc_with(|| val)
+    }
+
+    /// Try to allocate an object in this `Bump` and return an exclusive
+    /// reference to it.
+    ///
+    /// ## Errors
+    ///
+    /// Errors if reserving space for `T` fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.try_alloc("hello");
+    /// assert_eq!(x, Ok(&mut "hello"));
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn try_alloc<T>(&self, val: T) -> Result<&mut T, AllocErr> {
+        self.try_alloc_with(|| val)
+    }
+
+    /// Pre-allocate space for an object in this `Bump`, initializes it using
+    /// the closure, then returns an exclusive reference to it.
+    ///
+    /// See [The `_with` Method Suffix](#initializer-functions-the-_with-method-suffix) for a
+    /// discussion on the differences between the `_with` suffixed methods and
+    /// those methods without it, their performance characteristics, and when
+    /// you might or might not choose a `_with` suffixed method.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for `T` fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc_with(|| "hello");
+    /// assert_eq!(*x, "hello");
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_with<F, T>(&self, f: F) -> &mut T
+    where
+        F: FnOnce() -> T,
+    {
+        #[inline(always)]
+        unsafe fn inner_writer<T, F>(ptr: *mut T, f: F)
+        where
+            F: FnOnce() -> T,
+        {
+            // This function is translated as:
+            // - allocate space for a T on the stack
+            // - call f() with the return value being put onto this stack space
+            // - memcpy from the stack to the heap
+            //
+            // Ideally we want LLVM to always realize that doing a stack
+            // allocation is unnecessary and optimize the code so it writes
+            // directly into the heap instead. It seems we get it to realize
+            // this most consistently if we put this critical line into it's
+            // own function instead of inlining it into the surrounding code.
+            ptr::write(ptr, f())
+        }
+
+        let layout = Layout::new::<T>();
+
+        unsafe {
+            let p = self.alloc_layout(layout);
+            let p = p.as_ptr() as *mut T;
+            inner_writer(p, f);
+            &mut *p
+        }
+    }
+
+    /// Tries to pre-allocate space for an object in this `Bump`, initializes
+    /// it using the closure, then returns an exclusive reference to it.
+    ///
+    /// See [The `_with` Method Suffix](#initializer-functions-the-_with-method-suffix) for a
+    /// discussion on the differences between the `_with` suffixed methods and
+    /// those methods without it, their performance characteristics, and when
+    /// you might or might not choose a `_with` suffixed method.
+    ///
+    /// ## Errors
+    ///
+    /// Errors if reserving space for `T` fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.try_alloc_with(|| "hello");
+    /// assert_eq!(x, Ok(&mut "hello"));
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn try_alloc_with<F, T>(&self, f: F) -> Result<&mut T, AllocErr>
+    where
+        F: FnOnce() -> T,
+    {
+        #[inline(always)]
+        unsafe fn inner_writer<T, F>(ptr: *mut T, f: F)
+        where
+            F: FnOnce() -> T,
+        {
+            // This function is translated as:
+            // - allocate space for a T on the stack
+            // - call f() with the return value being put onto this stack space
+            // - memcpy from the stack to the heap
+            //
+            // Ideally we want LLVM to always realize that doing a stack
+            // allocation is unnecessary and optimize the code so it writes
+            // directly into the heap instead. It seems we get it to realize
+            // this most consistently if we put this critical line into it's
+            // own function instead of inlining it into the surrounding code.
+            ptr::write(ptr, f())
+        }
+
+        //SAFETY: Self-contained:
+        // `p` is allocated for `T` and then a `T` is written.
+        let layout = Layout::new::<T>();
+        let p = self.try_alloc_layout(layout)?;
+        let p = p.as_ptr() as *mut T;
+
+        unsafe {
+            inner_writer(p, f);
+            Ok(&mut *p)
+        }
+    }
+
+    /// Pre-allocates space for a [`Result`] in this `Bump`, initializes it using
+    /// the closure, then returns an exclusive reference to its `T` if [`Ok`].
+    ///
+    /// Iff the allocation fails, the closure is not run.
+    ///
+    /// Iff [`Err`], an allocator rewind is *attempted* and the `E` instance is
+    /// moved out of the allocator to be consumed or dropped as normal.
+    ///
+    /// See [The `_with` Method Suffix](#initializer-functions-the-_with-method-suffix) for a
+    /// discussion on the differences between the `_with` suffixed methods and
+    /// those methods without it, their performance characteristics, and when
+    /// you might or might not choose a `_with` suffixed method.
+    ///
+    /// For caveats specific to fallible initialization, see
+    /// [The `_try_with` Method Suffix](#fallible-initialization-the-_try_with-method-suffix).
+    ///
+    /// [`Result`]: https://doc.rust-lang.org/std/result/enum.Result.html
+    /// [`Ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Ok
+    /// [`Err`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err
+    ///
+    /// ## Errors
+    ///
+    /// Iff the allocation succeeds but `f` fails, that error is forwarded by value.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for `Result<T, E>` fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc_try_with(|| Ok("hello"))?;
+    /// assert_eq!(*x, "hello");
+    /// # Result::<_, ()>::Ok(())
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_try_with<F, T, E>(&self, f: F) -> Result<&mut T, E>
+    where
+        F: FnOnce() -> Result<T, E>,
+    {
+        let rewind_footer = self.current_chunk_footer.get();
+        let rewind_ptr = unsafe { rewind_footer.as_ref() }.ptr.get();
+        let mut inner_result_ptr = NonNull::from(self.alloc_with(f));
+        let inner_result_address = inner_result_ptr.as_ptr() as usize;
+        match unsafe { inner_result_ptr.as_mut() } {
+            Ok(t) => Ok(unsafe {
+                //SAFETY:
+                // The `&mut Result<T, E>` returned by `alloc_with` may be
+                // lifetime-limited by `E`, but the derived `&mut T` still has
+                // the same validity as in `alloc_with` since the error variant
+                // is already ruled out here.
+
+                // We could conditionally truncate the allocation here, but
+                // since it grows backwards, it seems unlikely that we'd get
+                // any more than the `Result`'s discriminant this way, if
+                // anything at all.
+                &mut *(t as *mut _)
+            }),
+            Err(e) => unsafe {
+                // If this result was the last allocation in this arena, we can
+                // reclaim its space. In fact, sometimes we can do even better
+                // than simply calling `dealloc` on the result pointer: we can
+                // reclaim any alignment padding we might have added (which
+                // `dealloc` cannot do) if we didn't allocate a new chunk for
+                // this result.
+                if self.is_last_allocation(NonNull::new_unchecked(inner_result_address as *mut _)) {
+                    let current_footer_p = self.current_chunk_footer.get();
+                    let current_ptr = &current_footer_p.as_ref().ptr;
+                    if current_footer_p == rewind_footer {
+                        // It's still the same chunk, so reset the bump pointer
+                        // to its original value upon entry to this method
+                        // (reclaiming any alignment padding we may have
+                        // added).
+                        current_ptr.set(rewind_ptr);
+                    } else {
+                        // We allocated a new chunk for this result.
+                        //
+                        // We know the result is the only allocation in this
+                        // chunk: Any additional allocations since the start of
+                        // this method could only have happened when running
+                        // the initializer function, which is called *after*
+                        // reserving space for this result. Therefore, since we
+                        // already determined via the check above that this
+                        // result was the last allocation, there must not have
+                        // been any other allocations, and this result is the
+                        // only allocation in this chunk.
+                        //
+                        // Because this is the only allocation in this chunk,
+                        // we can reset the chunk's bump finger to the start of
+                        // the chunk.
+                        current_ptr.set(current_footer_p.as_ref().data);
+                    }
+                }
+                //SAFETY:
+                // As we received `E` semantically by value from `f`, we can
+                // just copy that value here as long as we avoid a double-drop
+                // (which can't happen as any specific references to the `E`'s
+                // data in `self` are destroyed when this function returns).
+                //
+                // The order between this and the deallocation doesn't matter
+                // because `Self: !Sync`.
+                Err(ptr::read(e as *const _))
+            },
+        }
+    }
+
+    /// Tries to pre-allocates space for a [`Result`] in this `Bump`,
+    /// initializes it using the closure, then returns an exclusive reference
+    /// to its `T` if all [`Ok`].
+    ///
+    /// Iff the allocation fails, the closure is not run.
+    ///
+    /// Iff the closure returns [`Err`], an allocator rewind is *attempted* and
+    /// the `E` instance is moved out of the allocator to be consumed or dropped
+    /// as normal.
+    ///
+    /// See [The `_with` Method Suffix](#initializer-functions-the-_with-method-suffix) for a
+    /// discussion on the differences between the `_with` suffixed methods and
+    /// those methods without it, their performance characteristics, and when
+    /// you might or might not choose a `_with` suffixed method.
+    ///
+    /// For caveats specific to fallible initialization, see
+    /// [The `_try_with` Method Suffix](#fallible-initialization-the-_try_with-method-suffix).
+    ///
+    /// [`Result`]: https://doc.rust-lang.org/std/result/enum.Result.html
+    /// [`Ok`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Ok
+    /// [`Err`]: https://doc.rust-lang.org/std/result/enum.Result.html#variant.Err
+    ///
+    /// ## Errors
+    ///
+    /// Errors with the [`Alloc`](`AllocOrInitError::Alloc`) variant iff
+    /// reserving space for `Result<T, E>` fails.
+    ///
+    /// Iff the allocation succeeds but `f` fails, that error is forwarded by
+    /// value inside the [`Init`](`AllocOrInitError::Init`) variant.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.try_alloc_try_with(|| Ok("hello"))?;
+    /// assert_eq!(*x, "hello");
+    /// # Result::<_, bumpalo::AllocOrInitError<()>>::Ok(())
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn try_alloc_try_with<F, T, E>(&self, f: F) -> Result<&mut T, AllocOrInitError<E>>
+    where
+        F: FnOnce() -> Result<T, E>,
+    {
+        let rewind_footer = self.current_chunk_footer.get();
+        let rewind_ptr = unsafe { rewind_footer.as_ref() }.ptr.get();
+        let mut inner_result_ptr = NonNull::from(self.try_alloc_with(f)?);
+        let inner_result_address = inner_result_ptr.as_ptr() as usize;
+        match unsafe { inner_result_ptr.as_mut() } {
+            Ok(t) => Ok(unsafe {
+                //SAFETY:
+                // The `&mut Result<T, E>` returned by `alloc_with` may be
+                // lifetime-limited by `E`, but the derived `&mut T` still has
+                // the same validity as in `alloc_with` since the error variant
+                // is already ruled out here.
+
+                // We could conditionally truncate the allocation here, but
+                // since it grows backwards, it seems unlikely that we'd get
+                // any more than the `Result`'s discriminant this way, if
+                // anything at all.
+                &mut *(t as *mut _)
+            }),
+            Err(e) => unsafe {
+                // If this result was the last allocation in this arena, we can
+                // reclaim its space. In fact, sometimes we can do even better
+                // than simply calling `dealloc` on the result pointer: we can
+                // reclaim any alignment padding we might have added (which
+                // `dealloc` cannot do) if we didn't allocate a new chunk for
+                // this result.
+                if self.is_last_allocation(NonNull::new_unchecked(inner_result_address as *mut _)) {
+                    let current_footer_p = self.current_chunk_footer.get();
+                    let current_ptr = &current_footer_p.as_ref().ptr;
+                    if current_footer_p == rewind_footer {
+                        // It's still the same chunk, so reset the bump pointer
+                        // to its original value upon entry to this method
+                        // (reclaiming any alignment padding we may have
+                        // added).
+                        current_ptr.set(rewind_ptr);
+                    } else {
+                        // We allocated a new chunk for this result.
+                        //
+                        // We know the result is the only allocation in this
+                        // chunk: Any additional allocations since the start of
+                        // this method could only have happened when running
+                        // the initializer function, which is called *after*
+                        // reserving space for this result. Therefore, since we
+                        // already determined via the check above that this
+                        // result was the last allocation, there must not have
+                        // been any other allocations, and this result is the
+                        // only allocation in this chunk.
+                        //
+                        // Because this is the only allocation in this chunk,
+                        // we can reset the chunk's bump finger to the start of
+                        // the chunk.
+                        current_ptr.set(current_footer_p.as_ref().data);
+                    }
+                }
+                //SAFETY:
+                // As we received `E` semantically by value from `f`, we can
+                // just copy that value here as long as we avoid a double-drop
+                // (which can't happen as any specific references to the `E`'s
+                // data in `self` are destroyed when this function returns).
+                //
+                // The order between this and the deallocation doesn't matter
+                // because `Self: !Sync`.
+                Err(AllocOrInitError::Init(ptr::read(e as *const _)))
+            },
+        }
+    }
+
+    /// `Copy` a slice into this `Bump` and return an exclusive reference to
+    /// the copy.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc_slice_copy(&[1, 2, 3]);
+    /// assert_eq!(x, &[1, 2, 3]);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_copy<T>(&self, src: &[T]) -> &mut [T]
+    where
+        T: Copy,
+    {
+        let layout = Layout::for_value(src);
+        let dst = self.alloc_layout(layout).cast::<T>();
+
+        unsafe {
+            ptr::copy_nonoverlapping(src.as_ptr(), dst.as_ptr(), src.len());
+            slice::from_raw_parts_mut(dst.as_ptr(), src.len())
+        }
+    }
+
+    /// `Clone` a slice into this `Bump` and return an exclusive reference to
+    /// the clone. Prefer [`alloc_slice_copy`](#method.alloc_slice_copy) if `T` is `Copy`.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// #[derive(Clone, Debug, Eq, PartialEq)]
+    /// struct Sheep {
+    ///     name: String,
+    /// }
+    ///
+    /// let originals = [
+    ///     Sheep { name: "Alice".into() },
+    ///     Sheep { name: "Bob".into() },
+    ///     Sheep { name: "Cathy".into() },
+    /// ];
+    ///
+    /// let bump = bumpalo::Bump::new();
+    /// let clones = bump.alloc_slice_clone(&originals);
+    /// assert_eq!(originals, clones);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_clone<T>(&self, src: &[T]) -> &mut [T]
+    where
+        T: Clone,
+    {
+        let layout = Layout::for_value(src);
+        let dst = self.alloc_layout(layout).cast::<T>();
+
+        unsafe {
+            for (i, val) in src.iter().cloned().enumerate() {
+                ptr::write(dst.as_ptr().add(i), val);
+            }
+
+            slice::from_raw_parts_mut(dst.as_ptr(), src.len())
+        }
+    }
+
+    /// `Copy` a string slice into this `Bump` and return an exclusive reference to it.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the string fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let hello = bump.alloc_str("hello world");
+    /// assert_eq!("hello world", hello);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_str(&self, src: &str) -> &mut str {
+        let buffer = self.alloc_slice_copy(src.as_bytes());
+        unsafe {
+            // This is OK, because it already came in as str, so it is guaranteed to be utf8
+            str::from_utf8_unchecked_mut(buffer)
+        }
+    }
+
+    /// Allocates a new slice of size `len` into this `Bump` and returns an
+    /// exclusive reference to the copy.
+    ///
+    /// The elements of the slice are initialized using the supplied closure.
+    /// The closure argument is the position in the slice.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc_slice_fill_with(5, |i| 5 * (i + 1));
+    /// assert_eq!(x, &[5, 10, 15, 20, 25]);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_fill_with<T, F>(&self, len: usize, mut f: F) -> &mut [T]
+    where
+        F: FnMut(usize) -> T,
+    {
+        let layout = Layout::array::<T>(len).unwrap_or_else(|_| oom());
+        let dst = self.alloc_layout(layout).cast::<T>();
+
+        unsafe {
+            for i in 0..len {
+                ptr::write(dst.as_ptr().add(i), f(i));
+            }
+
+            let result = slice::from_raw_parts_mut(dst.as_ptr(), len);
+            debug_assert_eq!(Layout::for_value(result), layout);
+            result
+        }
+    }
+
+    /// Allocates a new slice of size `len` into this `Bump` and returns an
+    /// exclusive reference to the copy.
+    ///
+    /// All elements of the slice are initialized to `value`.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc_slice_fill_copy(5, 42);
+    /// assert_eq!(x, &[42, 42, 42, 42, 42]);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_fill_copy<T: Copy>(&self, len: usize, value: T) -> &mut [T] {
+        self.alloc_slice_fill_with(len, |_| value)
+    }
+
+    /// Allocates a new slice of size `len` slice into this `Bump` and return an
+    /// exclusive reference to the copy.
+    ///
+    /// All elements of the slice are initialized to `value.clone()`.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let s: String = "Hello Bump!".to_string();
+    /// let x: &[String] = bump.alloc_slice_fill_clone(2, &s);
+    /// assert_eq!(x.len(), 2);
+    /// assert_eq!(&x[0], &s);
+    /// assert_eq!(&x[1], &s);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_fill_clone<T: Clone>(&self, len: usize, value: &T) -> &mut [T] {
+        self.alloc_slice_fill_with(len, |_| value.clone())
+    }
+
+    /// Allocates a new slice of size `len` slice into this `Bump` and return an
+    /// exclusive reference to the copy.
+    ///
+    /// The elements are initialized using the supplied iterator.
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails, or if the supplied
+    /// iterator returns fewer elements than it promised.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x: &[i32] = bump.alloc_slice_fill_iter([2, 3, 5].iter().cloned().map(|i| i * i));
+    /// assert_eq!(x, [4, 9, 25]);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_fill_iter<T, I>(&self, iter: I) -> &mut [T]
+    where
+        I: IntoIterator<Item = T>,
+        I::IntoIter: ExactSizeIterator,
+    {
+        let mut iter = iter.into_iter();
+        self.alloc_slice_fill_with(iter.len(), |_| {
+            iter.next().expect("Iterator supplied too few elements")
+        })
+    }
+
+    /// Allocates a new slice of size `len` slice into this `Bump` and return an
+    /// exclusive reference to the copy.
+    ///
+    /// All elements of the slice are initialized to [`T::default()`].
+    ///
+    /// [`T::default()`]: https://doc.rust-lang.org/std/default/trait.Default.html#tymethod.default
+    ///
+    /// ## Panics
+    ///
+    /// Panics if reserving space for the slice fails.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let x = bump.alloc_slice_fill_default::<u32>(5);
+    /// assert_eq!(x, &[0, 0, 0, 0, 0]);
+    /// ```
+    #[inline(always)]
+    #[allow(clippy::mut_from_ref)]
+    pub fn alloc_slice_fill_default<T: Default>(&self, len: usize) -> &mut [T] {
+        self.alloc_slice_fill_with(len, |_| T::default())
+    }
+
+    /// Allocate space for an object with the given `Layout`.
+    ///
+    /// The returned pointer points at uninitialized memory, and should be
+    /// initialized with
+    /// [`std::ptr::write`](https://doc.rust-lang.org/std/ptr/fn.write.html).
+    ///
+    /// # Panics
+    ///
+    /// Panics if reserving space matching `layout` fails.
+    #[inline(always)]
+    pub fn alloc_layout(&self, layout: Layout) -> NonNull<u8> {
+        self.try_alloc_layout(layout).unwrap_or_else(|_| oom())
+    }
+
+    /// Attempts to allocate space for an object with the given `Layout` or else returns
+    /// an `Err`.
+    ///
+    /// The returned pointer points at uninitialized memory, and should be
+    /// initialized with
+    /// [`std::ptr::write`](https://doc.rust-lang.org/std/ptr/fn.write.html).
+    ///
+    /// # Errors
+    ///
+    /// Errors if reserving space matching `layout` fails.
+    #[inline(always)]
+    pub fn try_alloc_layout(&self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
+        if let Some(p) = self.try_alloc_layout_fast(layout) {
+            Ok(p)
+        } else {
+            self.alloc_layout_slow(layout).ok_or(AllocErr)
+        }
+    }
+
+    #[inline(always)]
+    fn try_alloc_layout_fast(&self, layout: Layout) -> Option<NonNull<u8>> {
+        // We don't need to check for ZSTs here since they will automatically
+        // be handled properly: the pointer will be bumped by zero bytes,
+        // modulo alignment. This keeps the fast path optimized for non-ZSTs,
+        // which are much more common.
+        unsafe {
+            let footer = self.current_chunk_footer.get();
+            let footer = footer.as_ref();
+            let ptr = footer.ptr.get().as_ptr();
+            let start = footer.data.as_ptr();
+            debug_assert!(start <= ptr);
+            debug_assert!(ptr as *const u8 <= footer as *const _ as *const u8);
+
+            if (ptr as usize) < layout.size() {
+                return None;
+            }
+
+            let ptr = ptr.wrapping_sub(layout.size());
+            let rem = ptr as usize % layout.align();
+            let aligned_ptr = ptr.wrapping_sub(rem);
+
+            if aligned_ptr >= start {
+                let aligned_ptr = NonNull::new_unchecked(aligned_ptr as *mut u8);
+                footer.ptr.set(aligned_ptr);
+                Some(aligned_ptr)
+            } else {
+                None
+            }
+        }
+    }
+
+    /// Gets the remaining capacity in the current chunk (in bytes).
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// use bumpalo::Bump;
+    ///
+    /// let bump = Bump::with_capacity(100);
+    ///
+    /// let capacity = bump.chunk_capacity();
+    /// assert!(capacity >= 100);
+    /// ```
+    pub fn chunk_capacity(&self) -> usize {
+        let current_footer = self.current_chunk_footer.get();
+        let current_footer = unsafe { current_footer.as_ref() };
+
+        current_footer as *const _ as usize - current_footer.data.as_ptr() as usize
+    }
+
+    /// Slow path allocation for when we need to allocate a new chunk from the
+    /// parent bump set because there isn't enough room in our current chunk.
+    #[inline(never)]
+    fn alloc_layout_slow(&self, layout: Layout) -> Option<NonNull<u8>> {
+        unsafe {
+            let size = layout.size();
+
+            // Get a new chunk from the global allocator.
+            let current_footer = self.current_chunk_footer.get();
+            let current_layout = current_footer.as_ref().layout;
+
+            // By default, we want our new chunk to be about twice as big
+            // as the previous chunk. If the global allocator refuses it,
+            // we try to divide it by half until it works or the requested
+            // size is smaller than the default footer size.
+            let min_new_chunk_size = layout.size().max(DEFAULT_CHUNK_SIZE_WITHOUT_FOOTER);
+            let mut base_size = (current_layout.size() - FOOTER_SIZE)
+                .checked_mul(2)?
+                .max(min_new_chunk_size);
+            let sizes = iter::from_fn(|| {
+                if base_size >= min_new_chunk_size {
+                    let size = base_size;
+                    base_size = base_size / 2;
+                    Some(size)
+                } else {
+                    None
+                }
+            });
+
+            let new_footer = sizes
+                .filter_map(|size| Bump::new_chunk(Some(size), layout, current_footer))
+                .next()?;
+
+            debug_assert_eq!(
+                new_footer.as_ref().data.as_ptr() as usize % layout.align(),
+                0
+            );
+
+            // Set the new chunk as our new current chunk.
+            self.current_chunk_footer.set(new_footer);
+
+            let new_footer = new_footer.as_ref();
+
+            // Move the bump ptr finger down to allocate room for `val`. We know
+            // this can't overflow because we successfully allocated a chunk of
+            // at least the requested size.
+            let mut ptr = new_footer.ptr.get().as_ptr().sub(size);
+            // Round the pointer down to the requested alignment.
+            ptr = ptr.sub(ptr as usize % layout.align());
+            debug_assert!(
+                ptr as *const _ <= new_footer,
+                "{:p} <= {:p}",
+                ptr,
+                new_footer
+            );
+            let ptr = NonNull::new_unchecked(ptr as *mut u8);
+            new_footer.ptr.set(ptr);
+
+            // Return a pointer to the freshly allocated region in this chunk.
+            Some(ptr)
+        }
+    }
+
+    /// Returns an iterator over each chunk of allocated memory that
+    /// this arena has bump allocated into.
+    ///
+    /// The chunks are returned ordered by allocation time, with the most
+    /// recently allocated chunk being returned first, and the least recently
+    /// allocated chunk being returned last.
+    ///
+    /// The values inside each chunk are also ordered by allocation time, with
+    /// the most recent allocation being earlier in the slice, and the least
+    /// recent allocation being towards the end of the slice.
+    ///
+    /// ## Safety
+    ///
+    /// Because this method takes `&mut self`, we know that the bump arena
+    /// reference is unique and therefore there aren't any active references to
+    /// any of the objects we've allocated in it either. This potential aliasing
+    /// of exclusive references is one common footgun for unsafe code that we
+    /// don't need to worry about here.
+    ///
+    /// However, there could be regions of uninitialized memory used as padding
+    /// between allocations, which is why this iterator has items of type
+    /// `[MaybeUninit<u8>]`, instead of simply `[u8]`.
+    ///
+    /// The only way to guarantee that there is no padding between allocations
+    /// or within allocated objects is if all of these properties hold:
+    ///
+    /// 1. Every object allocated in this arena has the same alignment,
+    ///    and that alignment is at most 16.
+    /// 2. Every object's size is a multiple of its alignment.
+    /// 3. None of the objects allocated in this arena contain any internal
+    ///    padding.
+    ///
+    /// If you want to use this `iter_allocated_chunks` method, it is *your*
+    /// responsibility to ensure that these properties hold before calling
+    /// `MaybeUninit::assume_init` or otherwise reading the returned values.
+    ///
+    /// Finally, you must also ensure that any values allocated into the bump
+    /// arena have not had their `Drop` implementations called on them,
+    /// e.g. after dropping a [`bumpalo::boxed::Box<T>`][crate::boxed::Box].
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let mut bump = bumpalo::Bump::new();
+    ///
+    /// // Allocate a bunch of `i32`s in this bump arena, potentially causing
+    /// // additional memory chunks to be reserved.
+    /// for i in 0..10000 {
+    ///     bump.alloc(i);
+    /// }
+    ///
+    /// // Iterate over each chunk we've bump allocated into. This is safe
+    /// // because we have only allocated `i32`s in this arena, which fulfills
+    /// // the above requirements.
+    /// for ch in bump.iter_allocated_chunks() {
+    ///     println!("Used a chunk that is {} bytes long", ch.len());
+    ///     println!("The first byte is {:?}", unsafe {
+    ///         ch[0].assume_init()
+    ///     });
+    /// }
+    ///
+    /// // Within a chunk, allocations are ordered from most recent to least
+    /// // recent. If we allocated 'a', then 'b', then 'c', when we iterate
+    /// // through the chunk's data, we get them in the order 'c', then 'b',
+    /// // then 'a'.
+    ///
+    /// bump.reset();
+    /// bump.alloc(b'a');
+    /// bump.alloc(b'b');
+    /// bump.alloc(b'c');
+    ///
+    /// assert_eq!(bump.iter_allocated_chunks().count(), 1);
+    /// let chunk = bump.iter_allocated_chunks().nth(0).unwrap();
+    /// assert_eq!(chunk.len(), 3);
+    ///
+    /// // Safe because we've only allocated `u8`s in this arena, which
+    /// // fulfills the above requirements.
+    /// unsafe {
+    ///     assert_eq!(chunk[0].assume_init(), b'c');
+    ///     assert_eq!(chunk[1].assume_init(), b'b');
+    ///     assert_eq!(chunk[2].assume_init(), b'a');
+    /// }
+    /// ```
+    pub fn iter_allocated_chunks(&mut self) -> ChunkIter<'_> {
+        // SAFE: Ensured by mutable borrow of `self`.
+        let raw = unsafe { self.iter_allocated_chunks_raw() };
+        ChunkIter {
+            raw,
+            bump: PhantomData,
+        }
+    }
+
+    /// Returns an iterator over raw pointers to chunks of allocated memory that
+    /// this arena has bump allocated into.
+    ///
+    /// This is an unsafe version of [`iter_allocated_chunks()`](Bump::iter_allocated_chunks),
+    /// with the caller responsible for safe usage of the returned pointers as
+    /// well as ensuring that the iterator is not invalidated by new
+    /// allocations.
+    ///
+    /// ## Safety
+    ///
+    /// Allocations from this arena must not be performed while the returned
+    /// iterator is alive. If reading the chunk data (or casting to a reference)
+    /// the caller must ensure that there exist no mutable references to
+    /// previously allocated data.
+    ///
+    /// In addition, all of the caveats when reading the chunk data from
+    /// [`iter_allocated_chunks()`](Bump::iter_allocated_chunks) still apply.
+    pub unsafe fn iter_allocated_chunks_raw(&self) -> ChunkRawIter<'_> {
+        ChunkRawIter {
+            footer: self.current_chunk_footer.get(),
+            bump: PhantomData,
+        }
+    }
+
+    /// Calculates the number of bytes currently allocated across all chunks in
+    /// this bump arena.
+    ///
+    /// If you allocate types of different alignments or types with
+    /// larger-than-typical alignment in the same arena, some padding
+    /// bytes might get allocated in the bump arena. Note that those padding
+    /// bytes will add to this method's resulting sum, so you cannot rely
+    /// on it only counting the sum of the sizes of the things
+    /// you've allocated in the arena.
+    ///
+    /// ## Example
+    ///
+    /// ```
+    /// let bump = bumpalo::Bump::new();
+    /// let _x = bump.alloc_slice_fill_default::<u32>(5);
+    /// let bytes = bump.allocated_bytes();
+    /// assert!(bytes >= core::mem::size_of::<u32>() * 5);
+    /// ```
+    pub fn allocated_bytes(&self) -> usize {
+        let mut footer = self.current_chunk_footer.get();
+
+        let mut bytes = 0;
+
+        unsafe {
+            while !footer.as_ref().is_empty() {
+                let foot = footer.as_ref();
+
+                let ptr = foot.ptr.get().as_ptr() as usize;
+                debug_assert!(ptr <= foot as *const _ as usize);
+
+                bytes += foot as *const _ as usize - ptr;
+
+                footer = foot.prev.get();
+            }
+        }
+
+        bytes
+    }
+
+    #[inline]
+    unsafe fn is_last_allocation(&self, ptr: NonNull<u8>) -> bool {
+        let footer = self.current_chunk_footer.get();
+        let footer = footer.as_ref();
+        footer.ptr.get() == ptr
+    }
+
+    #[inline]
+    unsafe fn dealloc(&self, ptr: NonNull<u8>, layout: Layout) {
+        // If the pointer is the last allocation we made, we can reuse the bytes,
+        // otherwise they are simply leaked -- at least until somebody calls reset().
+        if self.is_last_allocation(ptr) {
+            let ptr = NonNull::new_unchecked(ptr.as_ptr().add(layout.size()));
+            self.current_chunk_footer.get().as_ref().ptr.set(ptr);
+        }
+    }
+
+    #[inline]
+    unsafe fn shrink(
+        &self,
+        ptr: NonNull<u8>,
+        old_layout: Layout,
+        new_layout: Layout,
+    ) -> Result<NonNull<u8>, AllocErr> {
+        let old_size = old_layout.size();
+        let new_size = new_layout.size();
+        let align_is_compatible = old_layout.align() >= new_layout.align();
+
+        if !align_is_compatible {
+            return Err(AllocErr);
+        }
+
+        // This is how much space we would *actually* reclaim while satisfying
+        // the requested alignment.
+        let delta = round_down_to(old_size - new_size, new_layout.align());
+
+        if self.is_last_allocation(ptr)
+                // Only reclaim the excess space (which requires a copy) if it
+                // is worth it: we are actually going to recover "enough" space
+                // and we can do a non-overlapping copy.
+                && delta >= old_size / 2
+        {
+            let footer = self.current_chunk_footer.get();
+            let footer = footer.as_ref();
+
+            // NB: new_ptr is aligned, because ptr *has to* be aligned, and we
+            // made sure delta is aligned.
+            let new_ptr = NonNull::new_unchecked(footer.ptr.get().as_ptr().add(delta));
+            footer.ptr.set(new_ptr);
+
+            // NB: we know it is non-overlapping because of the size check
+            // in the `if` condition.
+            ptr::copy_nonoverlapping(ptr.as_ptr(), new_ptr.as_ptr(), new_size);
+
+            return Ok(new_ptr);
+        } else {
+            return Ok(ptr);
+        }
+    }
+
+    #[inline]
+    unsafe fn grow(
+        &self,
+        ptr: NonNull<u8>,
+        old_layout: Layout,
+        new_layout: Layout,
+    ) -> Result<NonNull<u8>, AllocErr> {
+        let old_size = old_layout.size();
+        let new_size = new_layout.size();
+        let align_is_compatible = old_layout.align() >= new_layout.align();
+
+        if align_is_compatible && self.is_last_allocation(ptr) {
+            // Try to allocate the delta size within this same block so we can
+            // reuse the currently allocated space.
+            let delta = new_size - old_size;
+            if let Some(p) =
+                self.try_alloc_layout_fast(layout_from_size_align(delta, old_layout.align()))
+            {
+                ptr::copy(ptr.as_ptr(), p.as_ptr(), old_size);
+                return Ok(p);
+            }
+        }
+
+        // Fallback: do a fresh allocation and copy the existing data into it.
+        let new_ptr = self.try_alloc_layout(new_layout)?;
+        ptr::copy_nonoverlapping(ptr.as_ptr(), new_ptr.as_ptr(), old_size);
+        Ok(new_ptr)
+    }
+}
+
+/// An iterator over each chunk of allocated memory that
+/// an arena has bump allocated into.
+///
+/// The chunks are returned ordered by allocation time, with the most recently
+/// allocated chunk being returned first.
+///
+/// The values inside each chunk are also ordered by allocation time, with the most
+/// recent allocation being earlier in the slice.
+///
+/// This struct is created by the [`iter_allocated_chunks`] method on
+/// [`Bump`]. See that function for a safety description regarding reading from the returned items.
+///
+/// [`Bump`]: struct.Bump.html
+/// [`iter_allocated_chunks`]: struct.Bump.html#method.iter_allocated_chunks
+#[derive(Debug)]
+pub struct ChunkIter<'a> {
+    raw: ChunkRawIter<'a>,
+    bump: PhantomData<&'a mut Bump>,
+}
+
+impl<'a> Iterator for ChunkIter<'a> {
+    type Item = &'a [mem::MaybeUninit<u8>];
+    fn next(&mut self) -> Option<&'a [mem::MaybeUninit<u8>]> {
+        unsafe {
+            let (ptr, len) = self.raw.next()?;
+            let slice = slice::from_raw_parts(ptr as *const mem::MaybeUninit<u8>, len);
+            Some(slice)
+        }
+    }
+}
+
+impl<'a> iter::FusedIterator for ChunkIter<'a> {}
+
+/// An iterator over raw pointers to chunks of allocated memory that this
+/// arena has bump allocated into.
+///
+/// See [`ChunkIter`] for details regarding the returned chunks.
+///
+/// This struct is created by the [`iter_allocated_chunks_raw`] method on
+/// [`Bump`]. See that function for a safety description regarding reading from
+/// the returned items.
+///
+/// [`Bump`]: struct.Bump.html
+/// [`iter_allocated_chunks_raw`]: struct.Bump.html#method.iter_allocated_chunks_raw
+#[derive(Debug)]
+pub struct ChunkRawIter<'a> {
+    footer: NonNull<ChunkFooter>,
+    bump: PhantomData<&'a Bump>,
+}
+
+impl Iterator for ChunkRawIter<'_> {
+    type Item = (*mut u8, usize);
+    fn next(&mut self) -> Option<(*mut u8, usize)> {
+        unsafe {
+            let foot = self.footer.as_ref();
+            if foot.is_empty() {
+                return None;
+            }
+            let (ptr, len) = foot.as_raw_parts();
+            self.footer = foot.prev.get();
+            Some((ptr as *mut u8, len))
+        }
+    }
+}
+
+impl iter::FusedIterator for ChunkRawIter<'_> {}
+
+#[inline(never)]
+#[cold]
+fn oom() -> ! {
+    panic!("out of memory")
+}
+
+unsafe impl<'a> alloc::Alloc for &'a Bump {
+    #[inline(always)]
+    unsafe fn alloc(&mut self, layout: Layout) -> Result<NonNull<u8>, AllocErr> {
+        self.try_alloc_layout(layout)
+    }
+
+    #[inline]
+    unsafe fn dealloc(&mut self, ptr: NonNull<u8>, layout: Layout) {
+        Bump::dealloc(self, ptr, layout)
+    }
+
+    #[inline]
+    unsafe fn realloc(
+        &mut self,
+        ptr: NonNull<u8>,
+        layout: Layout,
+        new_size: usize,
+    ) -> Result<NonNull<u8>, AllocErr> {
+        let old_size = layout.size();
+
+        if old_size == 0 {
+            return self.try_alloc_layout(layout);
+        }
+
+        let new_layout = layout_from_size_align(new_size, layout.align());
+        if new_size <= old_size {
+            self.shrink(ptr, layout, new_layout)
+        } else {
+            self.grow(ptr, layout, new_layout)
+        }
+    }
+}
+
+#[cfg(feature = "allocator_api")]
+unsafe impl<'a> Allocator for &'a Bump {
+    fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError> {
+        self.try_alloc_layout(layout)
+            .map(|p| NonNull::slice_from_raw_parts(p, layout.size()))
+            .map_err(|_| AllocError)
+    }
+
+    unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout) {
+        Bump::dealloc(self, ptr, layout)
+    }
+
+    unsafe fn shrink(
+        &self,
+        ptr: NonNull<u8>,
+        old_layout: Layout,
+        new_layout: Layout,
+    ) -> Result<NonNull<[u8]>, AllocError> {
+        Bump::shrink(self, ptr, old_layout, new_layout)
+            .map(|p| NonNull::slice_from_raw_parts(p, new_layout.size()))
+            .map_err(|_| AllocError)
+    }
+
+    unsafe fn grow(
+        &self,
+        ptr: NonNull<u8>,
+        old_layout: Layout,
+        new_layout: Layout,
+    ) -> Result<NonNull<[u8]>, AllocError> {
+        Bump::grow(self, ptr, old_layout, new_layout)
+            .map(|p| NonNull::slice_from_raw_parts(p, new_layout.size()))
+            .map_err(|_| AllocError)
+    }
+
+    unsafe fn grow_zeroed(
+        &self,
+        ptr: NonNull<u8>,
+        old_layout: Layout,
+        new_layout: Layout,
+    ) -> Result<NonNull<[u8]>, AllocError> {
+        let mut ptr = self.grow(ptr, old_layout, new_layout)?;
+        ptr.as_mut()[old_layout.size()..].fill(0);
+        Ok(ptr)
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn chunk_footer_is_five_words() {
+        assert_eq!(mem::size_of::<ChunkFooter>(), mem::size_of::<usize>() * 5);
+    }
+
+    #[test]
+    #[allow(clippy::cognitive_complexity)]
+    fn test_realloc() {
+        use crate::alloc::Alloc;
+
+        unsafe {
+            const CAPACITY: usize = 1024 - OVERHEAD;
+            let mut b = Bump::with_capacity(CAPACITY);
+
+            // `realloc` doesn't shrink allocations that aren't "worth it".
+            let layout = Layout::from_size_align(100, 1).unwrap();
+            let p = b.alloc_layout(layout);
+            let q = (&b).realloc(p, layout, 51).unwrap();
+            assert_eq!(p, q);
+            b.reset();
+
+            // `realloc` will shrink allocations that are "worth it".
+            let layout = Layout::from_size_align(100, 1).unwrap();
+            let p = b.alloc_layout(layout);
+            let q = (&b).realloc(p, layout, 50).unwrap();
+            assert!(p != q);
+            b.reset();
+
+            // `realloc` will reuse the last allocation when growing.
+            let layout = Layout::from_size_align(10, 1).unwrap();
+            let p = b.alloc_layout(layout);
+            let q = (&b).realloc(p, layout, 11).unwrap();
+            assert_eq!(q.as_ptr() as usize, p.as_ptr() as usize - 1);
+            b.reset();
+
+            // `realloc` will allocate a new chunk when growing the last
+            // allocation, if need be.
+            let layout = Layout::from_size_align(1, 1).unwrap();
+            let p = b.alloc_layout(layout);
+            let q = (&b).realloc(p, layout, CAPACITY + 1).unwrap();
+            assert!(q.as_ptr() as usize != p.as_ptr() as usize - CAPACITY);
+            b = Bump::with_capacity(CAPACITY);
+
+            // `realloc` will allocate and copy when reallocating anything that
+            // wasn't the last allocation.
+            let layout = Layout::from_size_align(1, 1).unwrap();
+            let p = b.alloc_layout(layout);
+            let _ = b.alloc_layout(layout);
+            let q = (&b).realloc(p, layout, 2).unwrap();
+            assert!(q.as_ptr() as usize != p.as_ptr() as usize - 1);
+            b.reset();
+        }
+    }
+
+    #[test]
+    fn invalid_read() {
+        use alloc::Alloc;
+
+        let mut b = &Bump::new();
+
+        unsafe {
+            let l1 = Layout::from_size_align(12000, 4).unwrap();
+            let p1 = Alloc::alloc(&mut b, l1).unwrap();
+
+            let l2 = Layout::from_size_align(1000, 4).unwrap();
+            Alloc::alloc(&mut b, l2).unwrap();
+
+            let p1 = b.realloc(p1, l1, 24000).unwrap();
+            let l3 = Layout::from_size_align(24000, 4).unwrap();
+            b.realloc(p1, l3, 48000).unwrap();
+        }
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/.cargo-checksum.json b/android/vendor/bytes-1.1.0/.cargo-checksum.json
new file mode 100644
index 0000000..3006806
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"3ae0ceffbd69f54380bb44fdaf82dd674015471875a8da55686718afc3e58bdd","Cargo.toml":"5e1c5c02693e7afe119c1f82caec24ad41f51ce3b6899393ebeb1769ff50f1ab","LICENSE":"45f522cacecb1023856e46df79ca625dfc550c94910078bd8aec6e02880b3d42","README.md":"b691d6e144eb133c181e869dc2f6a6eedbf76c4f832a9ecfbed5b9c560160c7f","benches/buf.rs":"f76240b8c8872185d831382216eb536b3e05b23913c815cd36edd5d903fbeaf7","benches/bytes.rs":"dc5289a9ce82be35e71ed5853ab33aa108a30460e481135f6058fe4d2f7dc15e","benches/bytes_mut.rs":"1326fe6224b26826228e02b4133151e756f38152c2d9cfe66adf83af76c3ec98","ci/miri.sh":"1f27dc786a0f1e930c1c8429b1d60d2e107ff6998ec8efd4674c78a5d0594dd7","ci/test-stable.sh":"57dd709bc25a20103ee85e24965566900817b2e603f067fb1251a5c03e4b1d93","ci/tsan.sh":"466b86b19225dd26c756cf2252cb1973f87a145642c99364b462ed7ceb55c7dd","src/buf/buf_impl.rs":"bdd9d5bc3318185ef1bea8d7c6a9dd3712ec297e0045fd84024f188c0ad96ac0","src/buf/buf_mut.rs":"d4387228d687414d0ad3eb2bd1c2f0fc84be8ec7d8746b95075f186b467293d4","src/buf/chain.rs":"d31989886d8ca01a9e3b42d6756391f5bdf8c102f83fa6dac51dd86312a91c14","src/buf/iter.rs":"49e9990a2303252ef7c66c2cc24459097dbbf4900c978453982ef513467bbf67","src/buf/limit.rs":"e005ba140b70f68654877c96b981a220477e415ff5c92438c1b0cb9bc866d872","src/buf/mod.rs":"19ff6fb7e19cba3884bc3f1a50ef20117dbc807f6d146ed355f42344a74fdf44","src/buf/reader.rs":"856c1e7129a1eceaa3c8f9ed4da8c3b5e1cc267eeffa99fa8f7c56c5ca7834d1","src/buf/take.rs":"a897e79bf579391227816973b2aa1f1d63614bd48bc029d9371f61607dcfa23f","src/buf/uninit_slice.rs":"0532041bf0128311eb6a2edbc4b720be30395882744dbc437874753fd8f249b4","src/buf/vec_deque.rs":"8d552c26ac6ce28a471f74c388e4749432e86b1d8f5a9759b9fc32a2549d395f","src/buf/writer.rs":"c92b5f8b9b42e2e784de474c987fe4ac50af4b5c51ac9548d19a54e8ac9ff521","src/bytes.rs":"f8d26a3de35977225abb4a416846f713f3ab2dc1215119bdac6b43ce4ef3fa0e","src/bytes_mut.rs":"6dab0856996c1bf07fd8786cf876a6c8c27df001ae78d23ba2d220d6d3ef9360","src/fmt/debug.rs":"19ebe7e5516e40ab712995f3ec2e0ba78ddfa905cce117e6d01e8eb330f3970a","src/fmt/hex.rs":"13755ec6f1b79923e1f1a05c51b179a38c03c40bb8ed2db0210e8901812e61e7","src/fmt/mod.rs":"176da4e359da99b8e5cf16e480cb7b978f574876827f1b9bb9c08da4d74ac0f5","src/lib.rs":"d8be90ade0cf78a30d73493086c109049d8ff442d69589a07f16480578eb4b17","src/loom.rs":"5dc97a5afce14875a66e44cbf0afa67e084c8b6b8c560bc14e7a70ef73aee96e","src/serde.rs":"3ecd7e828cd4c2b7db93c807cb1548fad209e674df493edf7cda69a7b04d405d","tests/test_buf.rs":"a04fb90644fcf0444092c49a4ca848bb0fd8b2ffeeebcb705eeea2de58560859","tests/test_buf_mut.rs":"5643866cd7b0967fb36053a1da73a23b26ffaa2746c05dca91e82df91aee7f81","tests/test_bytes.rs":"2349daa82fd079037ba4059273a8339fadf2a1d59ac2ce58e83269de6f133a0f","tests/test_bytes_odd_alloc.rs":"9a02cc9b1f09e2353554d9a33f6630250e6b5cf04faa00de3b9fecf247e65edb","tests/test_bytes_vec_alloc.rs":"2b686b6ab44f924e69d8270a4f256eb3626a3b4db8c1919b74bc422c10124899","tests/test_chain.rs":"69661c21b7257bf9c52792cb66d16f4dd5b62131381b8e6dbee1fb177433aec9","tests/test_debug.rs":"13299107172809e8cbbd823964ac9450cd0d6b6de79f2e6a2e0f44b9225a0593","tests/test_iter.rs":"c1f46823df26a90139645fd8728a03138edd95b2849dfec830452a80ddd9726d","tests/test_reader.rs":"bf83669d4e0960dad6aa47b46a9a454814fab626eb83572aba914c3d71618f43","tests/test_serde.rs":"2691f891796ba259de0ecf926de05c514f4912cc5fcd3e6a1591efbcd23ed4d0","tests/test_take.rs":"db01bf6855097f318336e90d12c0725a92cee426d330e477a6bd1d32dac34a27"},"package":"c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"}
\ No newline at end of file
diff --git a/android/vendor/bytes-1.1.0/CHANGELOG.md b/android/vendor/bytes-1.1.0/CHANGELOG.md
new file mode 100644
index 0000000..636d36b
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/CHANGELOG.md
@@ -0,0 +1,220 @@
+# 1.1.0 (August 25, 2021)
+
+### Added
+
+- `BufMut::put_bytes(self, val, cnt)` (#487)
+- Implement `From<Box<[u8]>>` for `Bytes` (#504)
+
+### Changed
+
+- Override `put_slice` for `&mut [u8]` (#483)
+- Panic on integer overflow in `Chain::remaining` (#482)
+- Add inline tags to `UninitSlice` methods (#443)
+- Override `copy_to_bytes` for Chain and Take (#481)
+- Keep capacity when unsplit on empty other buf (#502)
+
+### Documented
+
+- Clarify `BufMut` allocation guarantees (#501)
+- Clarify `BufMut::put_int` behavior (#486)
+- Clarify actions of `clear` and `truncate`. (#508)
+
+# 1.0.1 (January 11, 2021)
+
+### Changed
+- mark `Vec::put_slice` with `#[inline]` (#459)
+
+### Fixed
+- Fix deprecation warning (#457)
+- use `Box::into_raw` instead of `mem::forget`-in-disguise (#458)
+
+# 1.0.0 (December 22, 2020)
+
+### Changed
+- Rename `Buf`/`BufMut` methods `bytes()` and `bytes_mut()` to `chunk()` and `chunk_mut()` (#450)
+
+### Removed
+- remove unused Buf implementation. (#449)
+
+# 0.6.0 (October 21, 2020)
+
+API polish in preparation for a 1.0 release.
+
+### Changed
+- `BufMut` is now an `unsafe` trait (#432).
+- `BufMut::bytes_mut()` returns `&mut UninitSlice`, a type owned by `bytes` to
+  avoid undefined behavior (#433).
+- `Buf::copy_to_bytes(len)` replaces `Buf::into_bytes()` (#439).
+- `Buf`/`BufMut` utility methods are moved onto the trait and `*Ext` traits are
+  removed (#431).
+
+### Removed
+- `BufMut::bytes_vectored_mut()` (#430).
+- `new` methods on combinator types (#434).
+
+# 0.5.6 (July 13, 2020)
+
+- Improve `BytesMut` to reuse buffer when fully `advance`d.
+- Mark `BytesMut::{as_mut, set_len}` with `#[inline]`.
+- Relax synchronization when cloning in shared vtable of `Bytes`.
+- Move `loom` to `dev-dependencies`.
+
+# 0.5.5 (June 18, 2020)
+
+### Added
+- Allow using the `serde` feature in `no_std` environments (#385).
+
+### Fix
+- Fix `BufMut::advance_mut` to panic if advanced passed the capacity (#354)..
+- Fix `BytesMut::freeze` ignoring amount previously `advance`d (#352).
+
+# 0.5.4 (January 23, 2020)
+
+### Added
+- Make `Bytes::new` a `const fn`.
+- Add `From<BytesMut>` for `Bytes`.
+
+### Fix
+- Fix reversed arguments in `PartialOrd` for `Bytes`.
+- Fix `Bytes::truncate` losing original capacity when repr is an unshared `Vec`.
+- Fix `Bytes::from(Vec)` when allocator gave `Vec` a pointer with LSB set.
+- Fix panic in `Bytes::slice_ref` if argument is an empty slice.
+
+# 0.5.3 (December 12, 2019)
+
+### Added
+- `must_use` attributes to `split`, `split_off`, and `split_to` methods (#337).
+
+### Fix
+- Potential freeing of a null pointer in `Bytes` when constructed with an empty `Vec<u8>` (#341, #342).
+- Calling `Bytes::truncate` with a size large than the length will no longer clear the `Bytes` (#333).
+
+# 0.5.2 (November 27, 2019)
+
+### Added
+- `Limit` methods `into_inner`, `get_ref`, `get_mut`, `limit`, and `set_limit` (#325).
+
+# 0.5.1 (November 25, 2019)
+
+### Fix
+- Growth documentation for `BytesMut` (#321)
+
+# 0.5.0 (November 25, 2019)
+
+### Fix
+- Potential overflow in `copy_to_slice`
+
+### Changed
+- Increased minimum supported Rust version to 1.39.
+- `Bytes` is now a "trait object", allowing for custom allocation strategies (#298)
+- `BytesMut` implicitly grows internal storage. `remaining_mut()` returns
+  `usize::MAX` (#316).
+- `BufMut::bytes_mut` returns `&mut [MaybeUninit<u8>]` to reflect the unknown
+  initialization state (#305).
+- `Buf` / `BufMut` implementations for `&[u8]` and `&mut [u8]`
+  respectively (#261).
+- Move `Buf` / `BufMut` "extra" functions to an extension trait (#306).
+- `BufMutExt::limit` (#309).
+- `Bytes::slice` takes a `RangeBounds` argument (#265).
+- `Bytes::from_static` is now a `const fn` (#311).
+- A multitude of smaller performance optimizations.
+
+### Added
+- `no_std` support (#281).
+- `get_*`, `put_*`, `get_*_le`, and `put_*le` accessors for handling byte order.
+- `BorrowMut` implementation for `BytesMut` (#185).
+
+### Removed
+- `IntoBuf` (#288).
+- `Buf` implementation for `&str` (#301).
+- `byteorder` dependency (#280).
+- `iovec` dependency, use `std::IoSlice` instead (#263).
+- optional `either` dependency (#315).
+- optional `i128` feature -- now available on stable. (#276).
+
+# 0.4.12 (March 6, 2019)
+
+### Added
+- Implement `FromIterator<&'a u8>` for `BytesMut`/`Bytes` (#244).
+- Implement `Buf` for `VecDeque` (#249).
+
+# 0.4.11 (November 17, 2018)
+
+* Use raw pointers for potentially racy loads (#233).
+* Implement `BufRead` for `buf::Reader` (#232).
+* Documentation tweaks (#234).
+
+# 0.4.10 (September 4, 2018)
+
+* impl `Buf` and `BufMut` for `Either` (#225).
+* Add `Bytes::slice_ref` (#208).
+
+# 0.4.9 (July 12, 2018)
+
+* Add 128 bit number support behind a feature flag (#209).
+* Implement `IntoBuf` for `&mut [u8]`
+
+# 0.4.8 (May 25, 2018)
+
+* Fix panic in `BytesMut` `FromIterator` implementation.
+* Bytes: Recycle space when reserving space in vec mode (#197).
+* Bytes: Add resize fn (#203).
+
+# 0.4.7 (April 27, 2018)
+
+* Make `Buf` and `BufMut` usable as trait objects (#186).
+* impl BorrowMut for BytesMut (#185).
+* Improve accessor performance (#195).
+
+# 0.4.6 (Janary 8, 2018)
+
+* Implement FromIterator for Bytes/BytesMut (#148).
+* Add `advance` fn to Bytes/BytesMut (#166).
+* Add `unsplit` fn to `BytesMut` (#162, #173).
+* Improvements to Bytes split fns (#92).
+
+# 0.4.5 (August 12, 2017)
+
+* Fix range bug in `Take::bytes`
+* Misc performance improvements
+* Add extra `PartialEq` implementations.
+* Add `Bytes::with_capacity`
+* Implement `AsMut[u8]` for `BytesMut`
+
+# 0.4.4 (May 26, 2017)
+
+* Add serde support behind feature flag
+* Add `extend_from_slice` on `Bytes` and `BytesMut`
+* Add `truncate` and `clear` on `Bytes`
+* Misc additional std trait implementations
+* Misc performance improvements
+
+# 0.4.3 (April 30, 2017)
+
+* Fix Vec::advance_mut bug
+* Bump minimum Rust version to 1.15
+* Misc performance tweaks
+
+# 0.4.2 (April 5, 2017)
+
+* Misc performance tweaks
+* Improved `Debug` implementation for `Bytes`
+* Avoid some incorrect assert panics
+
+# 0.4.1 (March 15, 2017)
+
+* Expose `buf` module and have most types available from there vs. root.
+* Implement `IntoBuf` for `T: Buf`.
+* Add `FromBuf` and `Buf::collect`.
+* Add iterator adapter for `Buf`.
+* Add scatter/gather support to `Buf` and `BufMut`.
+* Add `Buf::chain`.
+* Reduce allocations on repeated calls to `BytesMut::reserve`.
+* Implement `Debug` for more types.
+* Remove `Source` in favor of `IntoBuf`.
+* Implement `Extend` for `BytesMut`.
+
+
+# 0.4.0 (February 24, 2017)
+
+* Initial release
diff --git a/android/vendor/bytes-1.1.0/Cargo.toml b/android/vendor/bytes-1.1.0/Cargo.toml
new file mode 100644
index 0000000..065f0f1
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/Cargo.toml
@@ -0,0 +1,38 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "bytes"
+version = "1.1.0"
+authors = ["Carl Lerche <me@carllerche.com>", "Sean McArthur <sean@seanmonstar.com>"]
+description = "Types and traits for working with bytes"
+readme = "README.md"
+keywords = ["buffers", "zero-copy", "io"]
+categories = ["network-programming", "data-structures"]
+license = "MIT"
+repository = "https://github.com/tokio-rs/bytes"
+[package.metadata.docs.rs]
+rustdoc-args = ["--cfg", "docsrs"]
+[dependencies.serde]
+version = "1.0.60"
+features = ["alloc"]
+optional = true
+default-features = false
+[dev-dependencies.serde_test]
+version = "1.0"
+
+[features]
+default = ["std"]
+std = []
+[target."cfg(loom)".dev-dependencies.loom]
+version = "0.5"
diff --git a/android/vendor/bytes-1.1.0/LICENSE b/android/vendor/bytes-1.1.0/LICENSE
new file mode 100644
index 0000000..58fb29a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/LICENSE
@@ -0,0 +1,25 @@
+Copyright (c) 2018 Carl Lerche
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/bytes-1.1.0/README.md b/android/vendor/bytes-1.1.0/README.md
new file mode 100644
index 0000000..468485d
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/README.md
@@ -0,0 +1,47 @@
+# Bytes
+
+A utility library for working with bytes.
+
+[![Crates.io][crates-badge]][crates-url]
+[![Build Status][ci-badge]][ci-url]
+
+[crates-badge]: https://img.shields.io/crates/v/bytes.svg
+[crates-url]: https://crates.io/crates/bytes
+[ci-badge]: https://github.com/tokio-rs/bytes/workflows/CI/badge.svg
+[ci-url]: https://github.com/tokio-rs/bytes/actions
+
+[Documentation](https://docs.rs/bytes)
+
+## Usage
+
+To use `bytes`, first add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+bytes = "1"
+```
+
+Next, add this to your crate:
+
+```rust
+use bytes::{Bytes, BytesMut, Buf, BufMut};
+```
+
+## Serde support
+
+Serde support is optional and disabled by default. To enable use the feature `serde`.
+
+```toml
+[dependencies]
+bytes = { version = "1", features = ["serde"] }
+```
+
+## License
+
+This project is licensed under the [MIT license](LICENSE).
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in `bytes` by you, shall be licensed as MIT, without any additional
+terms or conditions.
diff --git a/android/vendor/bytes-1.1.0/benches/buf.rs b/android/vendor/bytes-1.1.0/benches/buf.rs
new file mode 100644
index 0000000..6dc8516
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/benches/buf.rs
@@ -0,0 +1,186 @@
+#![feature(test)]
+#![warn(rust_2018_idioms)]
+
+extern crate test;
+
+use bytes::Buf;
+use test::Bencher;
+
+/// Dummy Buf implementation
+struct TestBuf {
+    buf: &'static [u8],
+    readlens: &'static [usize],
+    init_pos: usize,
+    pos: usize,
+    readlen_pos: usize,
+    readlen: usize,
+}
+impl TestBuf {
+    fn new(buf: &'static [u8], readlens: &'static [usize], init_pos: usize) -> TestBuf {
+        let mut buf = TestBuf {
+            buf,
+            readlens,
+            init_pos,
+            pos: 0,
+            readlen_pos: 0,
+            readlen: 0,
+        };
+        buf.reset();
+        buf
+    }
+    fn reset(&mut self) {
+        self.pos = self.init_pos;
+        self.readlen_pos = 0;
+        self.next_readlen();
+    }
+    /// Compute the length of the next read :
+    /// - use the next value specified in readlens (capped by remaining) if any
+    /// - else the remaining
+    fn next_readlen(&mut self) {
+        self.readlen = self.buf.len() - self.pos;
+        if let Some(readlen) = self.readlens.get(self.readlen_pos) {
+            self.readlen = std::cmp::min(self.readlen, *readlen);
+            self.readlen_pos += 1;
+        }
+    }
+}
+impl Buf for TestBuf {
+    fn remaining(&self) -> usize {
+        return self.buf.len() - self.pos;
+    }
+    fn advance(&mut self, cnt: usize) {
+        self.pos += cnt;
+        assert!(self.pos <= self.buf.len());
+        self.next_readlen();
+    }
+    fn chunk(&self) -> &[u8] {
+        if self.readlen == 0 {
+            Default::default()
+        } else {
+            &self.buf[self.pos..self.pos + self.readlen]
+        }
+    }
+}
+
+/// Dummy Buf implementation
+///  version with methods forced to not be inlined (to simulate costly calls)
+struct TestBufC {
+    inner: TestBuf,
+}
+impl TestBufC {
+    fn new(buf: &'static [u8], readlens: &'static [usize], init_pos: usize) -> TestBufC {
+        TestBufC {
+            inner: TestBuf::new(buf, readlens, init_pos),
+        }
+    }
+    fn reset(&mut self) {
+        self.inner.reset()
+    }
+}
+impl Buf for TestBufC {
+    #[inline(never)]
+    fn remaining(&self) -> usize {
+        self.inner.remaining()
+    }
+    #[inline(never)]
+    fn advance(&mut self, cnt: usize) {
+        self.inner.advance(cnt)
+    }
+    #[inline(never)]
+    fn chunk(&self) -> &[u8] {
+        self.inner.chunk()
+    }
+}
+
+macro_rules! bench {
+    ($fname:ident, testbuf $testbuf:ident $readlens:expr, $method:ident $(,$arg:expr)*) => (
+        #[bench]
+        fn $fname(b: &mut Bencher) {
+            let mut bufs = [
+                $testbuf::new(&[1u8; 8+0], $readlens, 0),
+                $testbuf::new(&[1u8; 8+1], $readlens, 1),
+                $testbuf::new(&[1u8; 8+2], $readlens, 2),
+                $testbuf::new(&[1u8; 8+3], $readlens, 3),
+                $testbuf::new(&[1u8; 8+4], $readlens, 4),
+                $testbuf::new(&[1u8; 8+5], $readlens, 5),
+                $testbuf::new(&[1u8; 8+6], $readlens, 6),
+                $testbuf::new(&[1u8; 8+7], $readlens, 7),
+            ];
+            b.iter(|| {
+                for i in 0..8 {
+                    bufs[i].reset();
+                    let buf: &mut dyn Buf =  &mut bufs[i]; // type erasure
+                    test::black_box(buf.$method($($arg,)*));
+                }
+            })
+        }
+    );
+    ($fname:ident, slice, $method:ident $(,$arg:expr)*) => (
+        #[bench]
+        fn $fname(b: &mut Bencher) {
+            // buf must be long enough for one read of 8 bytes starting at pos 7
+            let arr = [1u8; 8+7];
+            b.iter(|| {
+                for i in 0..8 {
+                    let mut buf = &arr[i..];
+                    let buf = &mut buf as &mut dyn Buf; // type erasure
+                    test::black_box(buf.$method($($arg,)*));
+                }
+            })
+        }
+    );
+    ($fname:ident, option) => (
+        #[bench]
+        fn $fname(b: &mut Bencher) {
+            let data = [1u8; 1];
+            b.iter(|| {
+                for _ in 0..8 {
+                    let mut buf = Some(data);
+                    let buf = &mut buf as &mut dyn Buf; // type erasure
+                    test::black_box(buf.get_u8());
+                }
+            })
+        }
+    );
+}
+
+macro_rules! bench_group {
+    ($method:ident $(,$arg:expr)*) => (
+        bench!(slice, slice, $method $(,$arg)*);
+        bench!(tbuf_1,        testbuf TestBuf  &[],  $method $(,$arg)*);
+        bench!(tbuf_1_costly, testbuf TestBufC &[],  $method $(,$arg)*);
+        bench!(tbuf_2,        testbuf TestBuf  &[1], $method $(,$arg)*);
+        bench!(tbuf_2_costly, testbuf TestBufC &[1], $method $(,$arg)*);
+        // bench!(tbuf_onebyone,        testbuf TestBuf  &[1,1,1,1,1,1,1,1], $method $(,$arg)*);
+        // bench!(tbuf_onebyone_costly, testbuf TestBufC &[1,1,1,1,1,1,1,1], $method $(,$arg)*);
+    );
+}
+
+mod get_u8 {
+    use super::*;
+    bench_group!(get_u8);
+}
+mod get_u16 {
+    use super::*;
+    bench_group!(get_u16);
+}
+mod get_u32 {
+    use super::*;
+    bench_group!(get_u32);
+}
+mod get_u64 {
+    use super::*;
+    bench_group!(get_u64);
+}
+mod get_f32 {
+    use super::*;
+    bench_group!(get_f32);
+}
+mod get_f64 {
+    use super::*;
+    bench_group!(get_f64);
+}
+mod get_uint24 {
+    use super::*;
+    bench_group!(get_uint, 3);
+}
diff --git a/android/vendor/bytes-1.1.0/benches/bytes.rs b/android/vendor/bytes-1.1.0/benches/bytes.rs
new file mode 100644
index 0000000..c5b8412
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/benches/bytes.rs
@@ -0,0 +1,119 @@
+#![feature(test)]
+#![warn(rust_2018_idioms)]
+
+extern crate test;
+
+use bytes::Bytes;
+use test::Bencher;
+
+#[bench]
+fn deref_unique(b: &mut Bencher) {
+    let buf = Bytes::from(vec![0; 1024]);
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&buf[..]);
+        }
+    })
+}
+
+#[bench]
+fn deref_shared(b: &mut Bencher) {
+    let buf = Bytes::from(vec![0; 1024]);
+    let _b2 = buf.clone();
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&buf[..]);
+        }
+    })
+}
+
+#[bench]
+fn deref_static(b: &mut Bencher) {
+    let buf = Bytes::from_static(b"hello world");
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&buf[..]);
+        }
+    })
+}
+
+#[bench]
+fn clone_static(b: &mut Bencher) {
+    let bytes =
+        Bytes::from_static("hello world 1234567890 and have a good byte 0987654321".as_bytes());
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&bytes.clone());
+        }
+    })
+}
+
+#[bench]
+fn clone_shared(b: &mut Bencher) {
+    let bytes = Bytes::from(b"hello world 1234567890 and have a good byte 0987654321".to_vec());
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&bytes.clone());
+        }
+    })
+}
+
+#[bench]
+fn clone_arc_vec(b: &mut Bencher) {
+    use std::sync::Arc;
+    let bytes = Arc::new(b"hello world 1234567890 and have a good byte 0987654321".to_vec());
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&bytes.clone());
+        }
+    })
+}
+
+#[bench]
+fn from_long_slice(b: &mut Bencher) {
+    let data = [0u8; 128];
+    b.bytes = data.len() as u64;
+    b.iter(|| {
+        let buf = Bytes::copy_from_slice(&data[..]);
+        test::black_box(buf);
+    })
+}
+
+#[bench]
+fn slice_empty(b: &mut Bencher) {
+    b.iter(|| {
+        let b = Bytes::from(vec![17; 1024]).clone();
+        for i in 0..1000 {
+            test::black_box(b.slice(i % 100..i % 100));
+        }
+    })
+}
+
+#[bench]
+fn slice_short_from_arc(b: &mut Bencher) {
+    b.iter(|| {
+        // `clone` is to convert to ARC
+        let b = Bytes::from(vec![17; 1024]).clone();
+        for i in 0..1000 {
+            test::black_box(b.slice(1..2 + i % 10));
+        }
+    })
+}
+
+#[bench]
+fn split_off_and_drop(b: &mut Bencher) {
+    b.iter(|| {
+        for _ in 0..1024 {
+            let v = vec![10; 200];
+            let mut b = Bytes::from(v);
+            test::black_box(b.split_off(100));
+            test::black_box(b);
+        }
+    })
+}
diff --git a/android/vendor/bytes-1.1.0/benches/bytes_mut.rs b/android/vendor/bytes-1.1.0/benches/bytes_mut.rs
new file mode 100644
index 0000000..b069436
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/benches/bytes_mut.rs
@@ -0,0 +1,266 @@
+#![feature(test)]
+#![warn(rust_2018_idioms)]
+
+extern crate test;
+
+use bytes::{BufMut, BytesMut};
+use test::Bencher;
+
+#[bench]
+fn alloc_small(b: &mut Bencher) {
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(BytesMut::with_capacity(12));
+        }
+    })
+}
+
+#[bench]
+fn alloc_mid(b: &mut Bencher) {
+    b.iter(|| {
+        test::black_box(BytesMut::with_capacity(128));
+    })
+}
+
+#[bench]
+fn alloc_big(b: &mut Bencher) {
+    b.iter(|| {
+        test::black_box(BytesMut::with_capacity(4096));
+    })
+}
+
+#[bench]
+fn deref_unique(b: &mut Bencher) {
+    let mut buf = BytesMut::with_capacity(4096);
+    buf.put(&[0u8; 1024][..]);
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&buf[..]);
+        }
+    })
+}
+
+#[bench]
+fn deref_unique_unroll(b: &mut Bencher) {
+    let mut buf = BytesMut::with_capacity(4096);
+    buf.put(&[0u8; 1024][..]);
+
+    b.iter(|| {
+        for _ in 0..128 {
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+            test::black_box(&buf[..]);
+        }
+    })
+}
+
+#[bench]
+fn deref_shared(b: &mut Bencher) {
+    let mut buf = BytesMut::with_capacity(4096);
+    buf.put(&[0u8; 1024][..]);
+    let _b2 = buf.split_off(1024);
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&buf[..]);
+        }
+    })
+}
+
+#[bench]
+fn deref_two(b: &mut Bencher) {
+    let mut buf1 = BytesMut::with_capacity(8);
+    buf1.put(&[0u8; 8][..]);
+
+    let mut buf2 = BytesMut::with_capacity(4096);
+    buf2.put(&[0u8; 1024][..]);
+
+    b.iter(|| {
+        for _ in 0..512 {
+            test::black_box(&buf1[..]);
+            test::black_box(&buf2[..]);
+        }
+    })
+}
+
+#[bench]
+fn clone_frozen(b: &mut Bencher) {
+    let bytes = BytesMut::from(&b"hello world 1234567890 and have a good byte 0987654321"[..])
+        .split()
+        .freeze();
+
+    b.iter(|| {
+        for _ in 0..1024 {
+            test::black_box(&bytes.clone());
+        }
+    })
+}
+
+#[bench]
+fn alloc_write_split_to_mid(b: &mut Bencher) {
+    b.iter(|| {
+        let mut buf = BytesMut::with_capacity(128);
+        buf.put_slice(&[0u8; 64]);
+        test::black_box(buf.split_to(64));
+    })
+}
+
+#[bench]
+fn drain_write_drain(b: &mut Bencher) {
+    let data = [0u8; 128];
+
+    b.iter(|| {
+        let mut buf = BytesMut::with_capacity(1024);
+        let mut parts = Vec::with_capacity(8);
+
+        for _ in 0..8 {
+            buf.put(&data[..]);
+            parts.push(buf.split_to(128));
+        }
+
+        test::black_box(parts);
+    })
+}
+
+#[bench]
+fn fmt_write(b: &mut Bencher) {
+    use std::fmt::Write;
+    let mut buf = BytesMut::with_capacity(128);
+    let s = "foo bar baz quux lorem ipsum dolor et";
+
+    b.bytes = s.len() as u64;
+    b.iter(|| {
+        let _ = write!(buf, "{}", s);
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    })
+}
+
+#[bench]
+fn bytes_mut_extend(b: &mut Bencher) {
+    let mut buf = BytesMut::with_capacity(256);
+    let data = [33u8; 32];
+
+    b.bytes = data.len() as u64 * 4;
+    b.iter(|| {
+        for _ in 0..4 {
+            buf.extend(&data);
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
+
+// BufMut for BytesMut vs Vec<u8>
+
+#[bench]
+fn put_slice_bytes_mut(b: &mut Bencher) {
+    let mut buf = BytesMut::with_capacity(256);
+    let data = [33u8; 32];
+
+    b.bytes = data.len() as u64 * 4;
+    b.iter(|| {
+        for _ in 0..4 {
+            buf.put_slice(&data);
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
+
+#[bench]
+fn put_u8_bytes_mut(b: &mut Bencher) {
+    let mut buf = BytesMut::with_capacity(256);
+    let cnt = 128;
+
+    b.bytes = cnt as u64;
+    b.iter(|| {
+        for _ in 0..cnt {
+            buf.put_u8(b'x');
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
+
+#[bench]
+fn put_slice_vec(b: &mut Bencher) {
+    let mut buf = Vec::<u8>::with_capacity(256);
+    let data = [33u8; 32];
+
+    b.bytes = data.len() as u64 * 4;
+    b.iter(|| {
+        for _ in 0..4 {
+            buf.put_slice(&data);
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
+
+#[bench]
+fn put_u8_vec(b: &mut Bencher) {
+    let mut buf = Vec::<u8>::with_capacity(256);
+    let cnt = 128;
+
+    b.bytes = cnt as u64;
+    b.iter(|| {
+        for _ in 0..cnt {
+            buf.put_u8(b'x');
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
+
+#[bench]
+fn put_slice_vec_extend(b: &mut Bencher) {
+    let mut buf = Vec::<u8>::with_capacity(256);
+    let data = [33u8; 32];
+
+    b.bytes = data.len() as u64 * 4;
+    b.iter(|| {
+        for _ in 0..4 {
+            buf.extend_from_slice(&data);
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
+
+#[bench]
+fn put_u8_vec_push(b: &mut Bencher) {
+    let mut buf = Vec::<u8>::with_capacity(256);
+    let cnt = 128;
+
+    b.bytes = cnt as u64;
+    b.iter(|| {
+        for _ in 0..cnt {
+            buf.push(b'x');
+        }
+        test::black_box(&buf);
+        unsafe {
+            buf.set_len(0);
+        }
+    });
+}
diff --git a/android/vendor/bytes-1.1.0/ci/miri.sh b/android/vendor/bytes-1.1.0/ci/miri.sh
new file mode 100755
index 0000000..88d2b6a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/ci/miri.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+
+MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
+echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
+rustup set profile minimal
+rustup default "$MIRI_NIGHTLY"
+rustup component add miri
+
+cargo miri test
+cargo miri test --target mips64-unknown-linux-gnuabi64
diff --git a/android/vendor/bytes-1.1.0/ci/test-stable.sh b/android/vendor/bytes-1.1.0/ci/test-stable.sh
new file mode 100644
index 0000000..4421f3a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/ci/test-stable.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -ex
+
+cmd="${1:-test}"
+
+# Install cargo-hack for feature flag test
+host=$(rustc -Vv | grep host | sed 's/host: //')
+curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-$host.tar.gz | tar xzf - -C ~/.cargo/bin
+
+# Run with each feature
+# * --each-feature includes both default/no-default features
+# * --optional-deps is needed for serde feature
+cargo hack "${cmd}" --each-feature --optional-deps
+# Run with all features
+cargo "${cmd}" --all-features
+
+cargo doc --no-deps --all-features
+
+if [[ "${RUST_VERSION}" == "nightly"* ]]; then
+    # Check benchmarks
+    cargo check --benches
+
+    # Check minimal versions
+    cargo clean
+    cargo update -Zminimal-versions
+    cargo check --all-features
+fi
diff --git a/android/vendor/bytes-1.1.0/ci/tsan.sh b/android/vendor/bytes-1.1.0/ci/tsan.sh
new file mode 100644
index 0000000..ca520bd
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/ci/tsan.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+set -ex
+
+export ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0"
+
+# Run address sanitizer
+RUSTFLAGS="-Z sanitizer=address" \
+cargo test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut
+
+# Run thread sanitizer
+RUSTFLAGS="-Z sanitizer=thread" \
+cargo -Zbuild-std test --target x86_64-unknown-linux-gnu --test test_bytes --test test_buf --test test_buf_mut
diff --git a/android/vendor/bytes-1.1.0/src/buf/buf_impl.rs b/android/vendor/bytes-1.1.0/src/buf/buf_impl.rs
new file mode 100644
index 0000000..a33c8a4
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/buf_impl.rs
@@ -0,0 +1,1074 @@
+#[cfg(feature = "std")]
+use crate::buf::{reader, Reader};
+use crate::buf::{take, Chain, Take};
+
+use core::{cmp, mem, ptr};
+
+#[cfg(feature = "std")]
+use std::io::IoSlice;
+
+use alloc::boxed::Box;
+
+macro_rules! buf_get_impl {
+    ($this:ident, $typ:tt::$conv:tt) => {{
+        const SIZE: usize = mem::size_of::<$typ>();
+        // try to convert directly from the bytes
+        // this Option<ret> trick is to avoid keeping a borrow on self
+        // when advance() is called (mut borrow) and to call bytes() only once
+        let ret = $this
+            .chunk()
+            .get(..SIZE)
+            .map(|src| unsafe { $typ::$conv(*(src as *const _ as *const [_; SIZE])) });
+
+        if let Some(ret) = ret {
+            // if the direct conversion was possible, advance and return
+            $this.advance(SIZE);
+            return ret;
+        } else {
+            // if not we copy the bytes in a temp buffer then convert
+            let mut buf = [0; SIZE];
+            $this.copy_to_slice(&mut buf); // (do the advance)
+            return $typ::$conv(buf);
+        }
+    }};
+    (le => $this:ident, $typ:tt, $len_to_read:expr) => {{
+        debug_assert!(mem::size_of::<$typ>() >= $len_to_read);
+
+        // The same trick as above does not improve the best case speed.
+        // It seems to be linked to the way the method is optimised by the compiler
+        let mut buf = [0; (mem::size_of::<$typ>())];
+        $this.copy_to_slice(&mut buf[..($len_to_read)]);
+        return $typ::from_le_bytes(buf);
+    }};
+    (be => $this:ident, $typ:tt, $len_to_read:expr) => {{
+        debug_assert!(mem::size_of::<$typ>() >= $len_to_read);
+
+        let mut buf = [0; (mem::size_of::<$typ>())];
+        $this.copy_to_slice(&mut buf[mem::size_of::<$typ>() - ($len_to_read)..]);
+        return $typ::from_be_bytes(buf);
+    }};
+}
+
+/// Read bytes from a buffer.
+///
+/// A buffer stores bytes in memory such that read operations are infallible.
+/// The underlying storage may or may not be in contiguous memory. A `Buf` value
+/// is a cursor into the buffer. Reading from `Buf` advances the cursor
+/// position. It can be thought of as an efficient `Iterator` for collections of
+/// bytes.
+///
+/// The simplest `Buf` is a `&[u8]`.
+///
+/// ```
+/// use bytes::Buf;
+///
+/// let mut buf = &b"hello world"[..];
+///
+/// assert_eq!(b'h', buf.get_u8());
+/// assert_eq!(b'e', buf.get_u8());
+/// assert_eq!(b'l', buf.get_u8());
+///
+/// let mut rest = [0; 8];
+/// buf.copy_to_slice(&mut rest);
+///
+/// assert_eq!(&rest[..], &b"lo world"[..]);
+/// ```
+pub trait Buf {
+    /// Returns the number of bytes between the current position and the end of
+    /// the buffer.
+    ///
+    /// This value is greater than or equal to the length of the slice returned
+    /// by `chunk()`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"hello world"[..];
+    ///
+    /// assert_eq!(buf.remaining(), 11);
+    ///
+    /// buf.get_u8();
+    ///
+    /// assert_eq!(buf.remaining(), 10);
+    /// ```
+    ///
+    /// # Implementer notes
+    ///
+    /// Implementations of `remaining` should ensure that the return value does
+    /// not change unless a call is made to `advance` or any other function that
+    /// is documented to change the `Buf`'s current position.
+    fn remaining(&self) -> usize;
+
+    /// Returns a slice starting at the current position and of length between 0
+    /// and `Buf::remaining()`. Note that this *can* return shorter slice (this allows
+    /// non-continuous internal representation).
+    ///
+    /// This is a lower level function. Most operations are done with other
+    /// functions.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"hello world"[..];
+    ///
+    /// assert_eq!(buf.chunk(), &b"hello world"[..]);
+    ///
+    /// buf.advance(6);
+    ///
+    /// assert_eq!(buf.chunk(), &b"world"[..]);
+    /// ```
+    ///
+    /// # Implementer notes
+    ///
+    /// This function should never panic. Once the end of the buffer is reached,
+    /// i.e., `Buf::remaining` returns 0, calls to `chunk()` should return an
+    /// empty slice.
+    // The `chunk` method was previously called `bytes`. This alias makes the rename
+    // more easily discoverable.
+    #[cfg_attr(docsrs, doc(alias = "bytes"))]
+    fn chunk(&self) -> &[u8];
+
+    /// Fills `dst` with potentially multiple slices starting at `self`'s
+    /// current position.
+    ///
+    /// If the `Buf` is backed by disjoint slices of bytes, `chunk_vectored` enables
+    /// fetching more than one slice at once. `dst` is a slice of `IoSlice`
+    /// references, enabling the slice to be directly used with [`writev`]
+    /// without any further conversion. The sum of the lengths of all the
+    /// buffers in `dst` will be less than or equal to `Buf::remaining()`.
+    ///
+    /// The entries in `dst` will be overwritten, but the data **contained** by
+    /// the slices **will not** be modified. If `chunk_vectored` does not fill every
+    /// entry in `dst`, then `dst` is guaranteed to contain all remaining slices
+    /// in `self.
+    ///
+    /// This is a lower level function. Most operations are done with other
+    /// functions.
+    ///
+    /// # Implementer notes
+    ///
+    /// This function should never panic. Once the end of the buffer is reached,
+    /// i.e., `Buf::remaining` returns 0, calls to `chunk_vectored` must return 0
+    /// without mutating `dst`.
+    ///
+    /// Implementations should also take care to properly handle being called
+    /// with `dst` being a zero length slice.
+    ///
+    /// [`writev`]: http://man7.org/linux/man-pages/man2/readv.2.html
+    #[cfg(feature = "std")]
+    fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize {
+        if dst.is_empty() {
+            return 0;
+        }
+
+        if self.has_remaining() {
+            dst[0] = IoSlice::new(self.chunk());
+            1
+        } else {
+            0
+        }
+    }
+
+    /// Advance the internal cursor of the Buf
+    ///
+    /// The next call to `chunk()` will return a slice starting `cnt` bytes
+    /// further into the underlying buffer.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"hello world"[..];
+    ///
+    /// assert_eq!(buf.chunk(), &b"hello world"[..]);
+    ///
+    /// buf.advance(6);
+    ///
+    /// assert_eq!(buf.chunk(), &b"world"[..]);
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function **may** panic if `cnt > self.remaining()`.
+    ///
+    /// # Implementer notes
+    ///
+    /// It is recommended for implementations of `advance` to panic if `cnt >
+    /// self.remaining()`. If the implementation does not panic, the call must
+    /// behave as if `cnt == self.remaining()`.
+    ///
+    /// A call with `cnt == 0` should never panic and be a no-op.
+    fn advance(&mut self, cnt: usize);
+
+    /// Returns true if there are any more bytes to consume
+    ///
+    /// This is equivalent to `self.remaining() != 0`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"a"[..];
+    ///
+    /// assert!(buf.has_remaining());
+    ///
+    /// buf.get_u8();
+    ///
+    /// assert!(!buf.has_remaining());
+    /// ```
+    fn has_remaining(&self) -> bool {
+        self.remaining() > 0
+    }
+
+    /// Copies bytes from `self` into `dst`.
+    ///
+    /// The cursor is advanced by the number of bytes copied. `self` must have
+    /// enough remaining bytes to fill `dst`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"hello world"[..];
+    /// let mut dst = [0; 5];
+    ///
+    /// buf.copy_to_slice(&mut dst);
+    /// assert_eq!(&b"hello"[..], &dst);
+    /// assert_eq!(6, buf.remaining());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if `self.remaining() < dst.len()`
+    fn copy_to_slice(&mut self, dst: &mut [u8]) {
+        let mut off = 0;
+
+        assert!(self.remaining() >= dst.len());
+
+        while off < dst.len() {
+            let cnt;
+
+            unsafe {
+                let src = self.chunk();
+                cnt = cmp::min(src.len(), dst.len() - off);
+
+                ptr::copy_nonoverlapping(src.as_ptr(), dst[off..].as_mut_ptr(), cnt);
+
+                off += cnt;
+            }
+
+            self.advance(cnt);
+        }
+    }
+
+    /// Gets an unsigned 8 bit integer from `self`.
+    ///
+    /// The current position is advanced by 1.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08 hello"[..];
+    /// assert_eq!(8, buf.get_u8());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is no more remaining data in `self`.
+    fn get_u8(&mut self) -> u8 {
+        assert!(self.remaining() >= 1);
+        let ret = self.chunk()[0];
+        self.advance(1);
+        ret
+    }
+
+    /// Gets a signed 8 bit integer from `self`.
+    ///
+    /// The current position is advanced by 1.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08 hello"[..];
+    /// assert_eq!(8, buf.get_i8());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is no more remaining data in `self`.
+    fn get_i8(&mut self) -> i8 {
+        assert!(self.remaining() >= 1);
+        let ret = self.chunk()[0] as i8;
+        self.advance(1);
+        ret
+    }
+
+    /// Gets an unsigned 16 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08\x09 hello"[..];
+    /// assert_eq!(0x0809, buf.get_u16());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u16(&mut self) -> u16 {
+        buf_get_impl!(self, u16::from_be_bytes);
+    }
+
+    /// Gets an unsigned 16 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x09\x08 hello"[..];
+    /// assert_eq!(0x0809, buf.get_u16_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u16_le(&mut self) -> u16 {
+        buf_get_impl!(self, u16::from_le_bytes);
+    }
+
+    /// Gets a signed 16 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08\x09 hello"[..];
+    /// assert_eq!(0x0809, buf.get_i16());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i16(&mut self) -> i16 {
+        buf_get_impl!(self, i16::from_be_bytes);
+    }
+
+    /// Gets a signed 16 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x09\x08 hello"[..];
+    /// assert_eq!(0x0809, buf.get_i16_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i16_le(&mut self) -> i16 {
+        buf_get_impl!(self, i16::from_le_bytes);
+    }
+
+    /// Gets an unsigned 32 bit integer from `self` in the big-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08\x09\xA0\xA1 hello"[..];
+    /// assert_eq!(0x0809A0A1, buf.get_u32());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u32(&mut self) -> u32 {
+        buf_get_impl!(self, u32::from_be_bytes);
+    }
+
+    /// Gets an unsigned 32 bit integer from `self` in the little-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\xA1\xA0\x09\x08 hello"[..];
+    /// assert_eq!(0x0809A0A1, buf.get_u32_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u32_le(&mut self) -> u32 {
+        buf_get_impl!(self, u32::from_le_bytes);
+    }
+
+    /// Gets a signed 32 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08\x09\xA0\xA1 hello"[..];
+    /// assert_eq!(0x0809A0A1, buf.get_i32());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i32(&mut self) -> i32 {
+        buf_get_impl!(self, i32::from_be_bytes);
+    }
+
+    /// Gets a signed 32 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\xA1\xA0\x09\x08 hello"[..];
+    /// assert_eq!(0x0809A0A1, buf.get_i32_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i32_le(&mut self) -> i32 {
+        buf_get_impl!(self, i32::from_le_bytes);
+    }
+
+    /// Gets an unsigned 64 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..];
+    /// assert_eq!(0x0102030405060708, buf.get_u64());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u64(&mut self) -> u64 {
+        buf_get_impl!(self, u64::from_be_bytes);
+    }
+
+    /// Gets an unsigned 64 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..];
+    /// assert_eq!(0x0102030405060708, buf.get_u64_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u64_le(&mut self) -> u64 {
+        buf_get_impl!(self, u64::from_le_bytes);
+    }
+
+    /// Gets a signed 64 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08 hello"[..];
+    /// assert_eq!(0x0102030405060708, buf.get_i64());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i64(&mut self) -> i64 {
+        buf_get_impl!(self, i64::from_be_bytes);
+    }
+
+    /// Gets a signed 64 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..];
+    /// assert_eq!(0x0102030405060708, buf.get_i64_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i64_le(&mut self) -> i64 {
+        buf_get_impl!(self, i64::from_le_bytes);
+    }
+
+    /// Gets an unsigned 128 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..];
+    /// assert_eq!(0x01020304050607080910111213141516, buf.get_u128());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u128(&mut self) -> u128 {
+        buf_get_impl!(self, u128::from_be_bytes);
+    }
+
+    /// Gets an unsigned 128 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..];
+    /// assert_eq!(0x01020304050607080910111213141516, buf.get_u128_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_u128_le(&mut self) -> u128 {
+        buf_get_impl!(self, u128::from_le_bytes);
+    }
+
+    /// Gets a signed 128 bit integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16 hello"[..];
+    /// assert_eq!(0x01020304050607080910111213141516, buf.get_i128());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i128(&mut self) -> i128 {
+        buf_get_impl!(self, i128::from_be_bytes);
+    }
+
+    /// Gets a signed 128 bit integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01 hello"[..];
+    /// assert_eq!(0x01020304050607080910111213141516, buf.get_i128_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_i128_le(&mut self) -> i128 {
+        buf_get_impl!(self, i128::from_le_bytes);
+    }
+
+    /// Gets an unsigned n-byte integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x01\x02\x03 hello"[..];
+    /// assert_eq!(0x010203, buf.get_uint(3));
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_uint(&mut self, nbytes: usize) -> u64 {
+        buf_get_impl!(be => self, u64, nbytes);
+    }
+
+    /// Gets an unsigned n-byte integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x03\x02\x01 hello"[..];
+    /// assert_eq!(0x010203, buf.get_uint_le(3));
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_uint_le(&mut self, nbytes: usize) -> u64 {
+        buf_get_impl!(le => self, u64, nbytes);
+    }
+
+    /// Gets a signed n-byte integer from `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x01\x02\x03 hello"[..];
+    /// assert_eq!(0x010203, buf.get_int(3));
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_int(&mut self, nbytes: usize) -> i64 {
+        buf_get_impl!(be => self, i64, nbytes);
+    }
+
+    /// Gets a signed n-byte integer from `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x03\x02\x01 hello"[..];
+    /// assert_eq!(0x010203, buf.get_int_le(3));
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_int_le(&mut self, nbytes: usize) -> i64 {
+        buf_get_impl!(le => self, i64, nbytes);
+    }
+
+    /// Gets an IEEE754 single-precision (4 bytes) floating point number from
+    /// `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x3F\x99\x99\x9A hello"[..];
+    /// assert_eq!(1.2f32, buf.get_f32());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_f32(&mut self) -> f32 {
+        f32::from_bits(Self::get_u32(self))
+    }
+
+    /// Gets an IEEE754 single-precision (4 bytes) floating point number from
+    /// `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x9A\x99\x99\x3F hello"[..];
+    /// assert_eq!(1.2f32, buf.get_f32_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_f32_le(&mut self) -> f32 {
+        f32::from_bits(Self::get_u32_le(self))
+    }
+
+    /// Gets an IEEE754 double-precision (8 bytes) floating point number from
+    /// `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x3F\xF3\x33\x33\x33\x33\x33\x33 hello"[..];
+    /// assert_eq!(1.2f64, buf.get_f64());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_f64(&mut self) -> f64 {
+        f64::from_bits(Self::get_u64(self))
+    }
+
+    /// Gets an IEEE754 double-precision (8 bytes) floating point number from
+    /// `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = &b"\x33\x33\x33\x33\x33\x33\xF3\x3F hello"[..];
+    /// assert_eq!(1.2f64, buf.get_f64_le());
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining data in `self`.
+    fn get_f64_le(&mut self) -> f64 {
+        f64::from_bits(Self::get_u64_le(self))
+    }
+
+    /// Consumes `len` bytes inside self and returns new instance of `Bytes`
+    /// with this data.
+    ///
+    /// This function may be optimized by the underlying type to avoid actual
+    /// copies. For example, `Bytes` implementation will do a shallow copy
+    /// (ref-count increment).
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let bytes = (&b"hello world"[..]).copy_to_bytes(5);
+    /// assert_eq!(&bytes[..], &b"hello"[..]);
+    /// ```
+    fn copy_to_bytes(&mut self, len: usize) -> crate::Bytes {
+        use super::BufMut;
+
+        assert!(len <= self.remaining(), "`len` greater than remaining");
+
+        let mut ret = crate::BytesMut::with_capacity(len);
+        ret.put(self.take(len));
+        ret.freeze()
+    }
+
+    /// Creates an adaptor which will read at most `limit` bytes from `self`.
+    ///
+    /// This function returns a new instance of `Buf` which will read at most
+    /// `limit` bytes.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::{Buf, BufMut};
+    ///
+    /// let mut buf = b"hello world"[..].take(5);
+    /// let mut dst = vec![];
+    ///
+    /// dst.put(&mut buf);
+    /// assert_eq!(dst, b"hello");
+    ///
+    /// let mut buf = buf.into_inner();
+    /// dst.clear();
+    /// dst.put(&mut buf);
+    /// assert_eq!(dst, b" world");
+    /// ```
+    fn take(self, limit: usize) -> Take<Self>
+    where
+        Self: Sized,
+    {
+        take::new(self, limit)
+    }
+
+    /// Creates an adaptor which will chain this buffer with another.
+    ///
+    /// The returned `Buf` instance will first consume all bytes from `self`.
+    /// Afterwards the output is equivalent to the output of next.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut chain = b"hello "[..].chain(&b"world"[..]);
+    ///
+    /// let full = chain.copy_to_bytes(11);
+    /// assert_eq!(full.chunk(), b"hello world");
+    /// ```
+    fn chain<U: Buf>(self, next: U) -> Chain<Self, U>
+    where
+        Self: Sized,
+    {
+        Chain::new(self, next)
+    }
+
+    /// Creates an adaptor which implements the `Read` trait for `self`.
+    ///
+    /// This function returns a new value which implements `Read` by adapting
+    /// the `Read` trait functions to the `Buf` trait functions. Given that
+    /// `Buf` operations are infallible, none of the `Read` functions will
+    /// return with `Err`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::{Bytes, Buf};
+    /// use std::io::Read;
+    ///
+    /// let buf = Bytes::from("hello world");
+    ///
+    /// let mut reader = buf.reader();
+    /// let mut dst = [0; 1024];
+    ///
+    /// let num = reader.read(&mut dst).unwrap();
+    ///
+    /// assert_eq!(11, num);
+    /// assert_eq!(&dst[..11], &b"hello world"[..]);
+    /// ```
+    #[cfg(feature = "std")]
+    fn reader(self) -> Reader<Self>
+    where
+        Self: Sized,
+    {
+        reader::new(self)
+    }
+}
+
+macro_rules! deref_forward_buf {
+    () => {
+        fn remaining(&self) -> usize {
+            (**self).remaining()
+        }
+
+        fn chunk(&self) -> &[u8] {
+            (**self).chunk()
+        }
+
+        #[cfg(feature = "std")]
+        fn chunks_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize {
+            (**self).chunks_vectored(dst)
+        }
+
+        fn advance(&mut self, cnt: usize) {
+            (**self).advance(cnt)
+        }
+
+        fn has_remaining(&self) -> bool {
+            (**self).has_remaining()
+        }
+
+        fn copy_to_slice(&mut self, dst: &mut [u8]) {
+            (**self).copy_to_slice(dst)
+        }
+
+        fn get_u8(&mut self) -> u8 {
+            (**self).get_u8()
+        }
+
+        fn get_i8(&mut self) -> i8 {
+            (**self).get_i8()
+        }
+
+        fn get_u16(&mut self) -> u16 {
+            (**self).get_u16()
+        }
+
+        fn get_u16_le(&mut self) -> u16 {
+            (**self).get_u16_le()
+        }
+
+        fn get_i16(&mut self) -> i16 {
+            (**self).get_i16()
+        }
+
+        fn get_i16_le(&mut self) -> i16 {
+            (**self).get_i16_le()
+        }
+
+        fn get_u32(&mut self) -> u32 {
+            (**self).get_u32()
+        }
+
+        fn get_u32_le(&mut self) -> u32 {
+            (**self).get_u32_le()
+        }
+
+        fn get_i32(&mut self) -> i32 {
+            (**self).get_i32()
+        }
+
+        fn get_i32_le(&mut self) -> i32 {
+            (**self).get_i32_le()
+        }
+
+        fn get_u64(&mut self) -> u64 {
+            (**self).get_u64()
+        }
+
+        fn get_u64_le(&mut self) -> u64 {
+            (**self).get_u64_le()
+        }
+
+        fn get_i64(&mut self) -> i64 {
+            (**self).get_i64()
+        }
+
+        fn get_i64_le(&mut self) -> i64 {
+            (**self).get_i64_le()
+        }
+
+        fn get_uint(&mut self, nbytes: usize) -> u64 {
+            (**self).get_uint(nbytes)
+        }
+
+        fn get_uint_le(&mut self, nbytes: usize) -> u64 {
+            (**self).get_uint_le(nbytes)
+        }
+
+        fn get_int(&mut self, nbytes: usize) -> i64 {
+            (**self).get_int(nbytes)
+        }
+
+        fn get_int_le(&mut self, nbytes: usize) -> i64 {
+            (**self).get_int_le(nbytes)
+        }
+
+        fn copy_to_bytes(&mut self, len: usize) -> crate::Bytes {
+            (**self).copy_to_bytes(len)
+        }
+    };
+}
+
+impl<T: Buf + ?Sized> Buf for &mut T {
+    deref_forward_buf!();
+}
+
+impl<T: Buf + ?Sized> Buf for Box<T> {
+    deref_forward_buf!();
+}
+
+impl Buf for &[u8] {
+    #[inline]
+    fn remaining(&self) -> usize {
+        self.len()
+    }
+
+    #[inline]
+    fn chunk(&self) -> &[u8] {
+        self
+    }
+
+    #[inline]
+    fn advance(&mut self, cnt: usize) {
+        *self = &self[cnt..];
+    }
+}
+
+#[cfg(feature = "std")]
+impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T> {
+    fn remaining(&self) -> usize {
+        let len = self.get_ref().as_ref().len();
+        let pos = self.position();
+
+        if pos >= len as u64 {
+            return 0;
+        }
+
+        len - pos as usize
+    }
+
+    fn chunk(&self) -> &[u8] {
+        let len = self.get_ref().as_ref().len();
+        let pos = self.position();
+
+        if pos >= len as u64 {
+            return &[];
+        }
+
+        &self.get_ref().as_ref()[pos as usize..]
+    }
+
+    fn advance(&mut self, cnt: usize) {
+        let pos = (self.position() as usize)
+            .checked_add(cnt)
+            .expect("overflow");
+
+        assert!(pos <= self.get_ref().as_ref().len());
+        self.set_position(pos as u64);
+    }
+}
+
+// The existence of this function makes the compiler catch if the Buf
+// trait is "object-safe" or not.
+fn _assert_trait_object(_b: &dyn Buf) {}
diff --git a/android/vendor/bytes-1.1.0/src/buf/buf_mut.rs b/android/vendor/bytes-1.1.0/src/buf/buf_mut.rs
new file mode 100644
index 0000000..4c2bd2c
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/buf_mut.rs
@@ -0,0 +1,1142 @@
+use crate::buf::{limit, Chain, Limit, UninitSlice};
+#[cfg(feature = "std")]
+use crate::buf::{writer, Writer};
+
+use core::{cmp, mem, ptr, usize};
+
+use alloc::{boxed::Box, vec::Vec};
+
+/// A trait for values that provide sequential write access to bytes.
+///
+/// Write bytes to a buffer
+///
+/// A buffer stores bytes in memory such that write operations are infallible.
+/// The underlying storage may or may not be in contiguous memory. A `BufMut`
+/// value is a cursor into the buffer. Writing to `BufMut` advances the cursor
+/// position.
+///
+/// The simplest `BufMut` is a `Vec<u8>`.
+///
+/// ```
+/// use bytes::BufMut;
+///
+/// let mut buf = vec![];
+///
+/// buf.put(&b"hello world"[..]);
+///
+/// assert_eq!(buf, b"hello world");
+/// ```
+pub unsafe trait BufMut {
+    /// Returns the number of bytes that can be written from the current
+    /// position until the end of the buffer is reached.
+    ///
+    /// This value is greater than or equal to the length of the slice returned
+    /// by `chunk_mut()`.
+    ///
+    /// Writing to a `BufMut` may involve allocating more memory on the fly.
+    /// Implementations may fail before reaching the number of bytes indicated
+    /// by this method if they encounter an allocation failure.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut dst = [0; 10];
+    /// let mut buf = &mut dst[..];
+    ///
+    /// let original_remaining = buf.remaining_mut();
+    /// buf.put(&b"hello"[..]);
+    ///
+    /// assert_eq!(original_remaining - 5, buf.remaining_mut());
+    /// ```
+    ///
+    /// # Implementer notes
+    ///
+    /// Implementations of `remaining_mut` should ensure that the return value
+    /// does not change unless a call is made to `advance_mut` or any other
+    /// function that is documented to change the `BufMut`'s current position.
+    fn remaining_mut(&self) -> usize;
+
+    /// Advance the internal cursor of the BufMut
+    ///
+    /// The next call to `chunk_mut` will return a slice starting `cnt` bytes
+    /// further into the underlying buffer.
+    ///
+    /// This function is unsafe because there is no guarantee that the bytes
+    /// being advanced past have been initialized.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = Vec::with_capacity(16);
+    ///
+    /// // Write some data
+    /// buf.chunk_mut()[0..2].copy_from_slice(b"he");
+    /// unsafe { buf.advance_mut(2) };
+    ///
+    /// // write more bytes
+    /// buf.chunk_mut()[0..3].copy_from_slice(b"llo");
+    ///
+    /// unsafe { buf.advance_mut(3); }
+    ///
+    /// assert_eq!(5, buf.len());
+    /// assert_eq!(buf, b"hello");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function **may** panic if `cnt > self.remaining_mut()`.
+    ///
+    /// # Implementer notes
+    ///
+    /// It is recommended for implementations of `advance_mut` to panic if
+    /// `cnt > self.remaining_mut()`. If the implementation does not panic,
+    /// the call must behave as if `cnt == self.remaining_mut()`.
+    ///
+    /// A call with `cnt == 0` should never panic and be a no-op.
+    unsafe fn advance_mut(&mut self, cnt: usize);
+
+    /// Returns true if there is space in `self` for more bytes.
+    ///
+    /// This is equivalent to `self.remaining_mut() != 0`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut dst = [0; 5];
+    /// let mut buf = &mut dst[..];
+    ///
+    /// assert!(buf.has_remaining_mut());
+    ///
+    /// buf.put(&b"hello"[..]);
+    ///
+    /// assert!(!buf.has_remaining_mut());
+    /// ```
+    fn has_remaining_mut(&self) -> bool {
+        self.remaining_mut() > 0
+    }
+
+    /// Returns a mutable slice starting at the current BufMut position and of
+    /// length between 0 and `BufMut::remaining_mut()`. Note that this *can* be shorter than the
+    /// whole remainder of the buffer (this allows non-continuous implementation).
+    ///
+    /// This is a lower level function. Most operations are done with other
+    /// functions.
+    ///
+    /// The returned byte slice may represent uninitialized memory.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = Vec::with_capacity(16);
+    ///
+    /// unsafe {
+    ///     // MaybeUninit::as_mut_ptr
+    ///     buf.chunk_mut()[0..].as_mut_ptr().write(b'h');
+    ///     buf.chunk_mut()[1..].as_mut_ptr().write(b'e');
+    ///
+    ///     buf.advance_mut(2);
+    ///
+    ///     buf.chunk_mut()[0..].as_mut_ptr().write(b'l');
+    ///     buf.chunk_mut()[1..].as_mut_ptr().write(b'l');
+    ///     buf.chunk_mut()[2..].as_mut_ptr().write(b'o');
+    ///
+    ///     buf.advance_mut(3);
+    /// }
+    ///
+    /// assert_eq!(5, buf.len());
+    /// assert_eq!(buf, b"hello");
+    /// ```
+    ///
+    /// # Implementer notes
+    ///
+    /// This function should never panic. `chunk_mut` should return an empty
+    /// slice **if and only if** `remaining_mut()` returns 0. In other words,
+    /// `chunk_mut()` returning an empty slice implies that `remaining_mut()` will
+    /// return 0 and `remaining_mut()` returning 0 implies that `chunk_mut()` will
+    /// return an empty slice.
+    ///
+    /// This function may trigger an out-of-memory abort if it tries to allocate
+    /// memory and fails to do so.
+    // The `chunk_mut` method was previously called `bytes_mut`. This alias makes the
+    // rename more easily discoverable.
+    #[cfg_attr(docsrs, doc(alias = "bytes_mut"))]
+    fn chunk_mut(&mut self) -> &mut UninitSlice;
+
+    /// Transfer bytes into `self` from `src` and advance the cursor by the
+    /// number of bytes written.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    ///
+    /// buf.put_u8(b'h');
+    /// buf.put(&b"ello"[..]);
+    /// buf.put(&b" world"[..]);
+    ///
+    /// assert_eq!(buf, b"hello world");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if `self` does not have enough capacity to contain `src`.
+    fn put<T: super::Buf>(&mut self, mut src: T)
+    where
+        Self: Sized,
+    {
+        assert!(self.remaining_mut() >= src.remaining());
+
+        while src.has_remaining() {
+            let l;
+
+            unsafe {
+                let s = src.chunk();
+                let d = self.chunk_mut();
+                l = cmp::min(s.len(), d.len());
+
+                ptr::copy_nonoverlapping(s.as_ptr(), d.as_mut_ptr() as *mut u8, l);
+            }
+
+            src.advance(l);
+            unsafe {
+                self.advance_mut(l);
+            }
+        }
+    }
+
+    /// Transfer bytes into `self` from `src` and advance the cursor by the
+    /// number of bytes written.
+    ///
+    /// `self` must have enough remaining capacity to contain all of `src`.
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut dst = [0; 6];
+    ///
+    /// {
+    ///     let mut buf = &mut dst[..];
+    ///     buf.put_slice(b"hello");
+    ///
+    ///     assert_eq!(1, buf.remaining_mut());
+    /// }
+    ///
+    /// assert_eq!(b"hello\0", &dst);
+    /// ```
+    fn put_slice(&mut self, src: &[u8]) {
+        let mut off = 0;
+
+        assert!(
+            self.remaining_mut() >= src.len(),
+            "buffer overflow; remaining = {}; src = {}",
+            self.remaining_mut(),
+            src.len()
+        );
+
+        while off < src.len() {
+            let cnt;
+
+            unsafe {
+                let dst = self.chunk_mut();
+                cnt = cmp::min(dst.len(), src.len() - off);
+
+                ptr::copy_nonoverlapping(src[off..].as_ptr(), dst.as_mut_ptr() as *mut u8, cnt);
+
+                off += cnt;
+            }
+
+            unsafe {
+                self.advance_mut(cnt);
+            }
+        }
+    }
+
+    /// Put `cnt` bytes `val` into `self`.
+    ///
+    /// Logically equivalent to calling `self.put_u8(val)` `cnt` times, but may work faster.
+    ///
+    /// `self` must have at least `cnt` remaining capacity.
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut dst = [0; 6];
+    ///
+    /// {
+    ///     let mut buf = &mut dst[..];
+    ///     buf.put_bytes(b'a', 4);
+    ///
+    ///     assert_eq!(2, buf.remaining_mut());
+    /// }
+    ///
+    /// assert_eq!(b"aaaa\0\0", &dst);
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_bytes(&mut self, val: u8, cnt: usize) {
+        for _ in 0..cnt {
+            self.put_u8(val);
+        }
+    }
+
+    /// Writes an unsigned 8 bit integer to `self`.
+    ///
+    /// The current position is advanced by 1.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u8(0x01);
+    /// assert_eq!(buf, b"\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u8(&mut self, n: u8) {
+        let src = [n];
+        self.put_slice(&src);
+    }
+
+    /// Writes a signed 8 bit integer to `self`.
+    ///
+    /// The current position is advanced by 1.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i8(0x01);
+    /// assert_eq!(buf, b"\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i8(&mut self, n: i8) {
+        let src = [n as u8];
+        self.put_slice(&src)
+    }
+
+    /// Writes an unsigned 16 bit integer to `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u16(0x0809);
+    /// assert_eq!(buf, b"\x08\x09");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u16(&mut self, n: u16) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes an unsigned 16 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u16_le(0x0809);
+    /// assert_eq!(buf, b"\x09\x08");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u16_le(&mut self, n: u16) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes a signed 16 bit integer to `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i16(0x0809);
+    /// assert_eq!(buf, b"\x08\x09");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i16(&mut self, n: i16) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes a signed 16 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 2.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i16_le(0x0809);
+    /// assert_eq!(buf, b"\x09\x08");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i16_le(&mut self, n: i16) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes an unsigned 32 bit integer to `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u32(0x0809A0A1);
+    /// assert_eq!(buf, b"\x08\x09\xA0\xA1");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u32(&mut self, n: u32) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes an unsigned 32 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u32_le(0x0809A0A1);
+    /// assert_eq!(buf, b"\xA1\xA0\x09\x08");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u32_le(&mut self, n: u32) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes a signed 32 bit integer to `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i32(0x0809A0A1);
+    /// assert_eq!(buf, b"\x08\x09\xA0\xA1");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i32(&mut self, n: i32) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes a signed 32 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i32_le(0x0809A0A1);
+    /// assert_eq!(buf, b"\xA1\xA0\x09\x08");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i32_le(&mut self, n: i32) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes an unsigned 64 bit integer to `self` in the big-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u64(0x0102030405060708);
+    /// assert_eq!(buf, b"\x01\x02\x03\x04\x05\x06\x07\x08");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u64(&mut self, n: u64) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes an unsigned 64 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u64_le(0x0102030405060708);
+    /// assert_eq!(buf, b"\x08\x07\x06\x05\x04\x03\x02\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u64_le(&mut self, n: u64) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes a signed 64 bit integer to `self` in the big-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i64(0x0102030405060708);
+    /// assert_eq!(buf, b"\x01\x02\x03\x04\x05\x06\x07\x08");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i64(&mut self, n: i64) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes a signed 64 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i64_le(0x0102030405060708);
+    /// assert_eq!(buf, b"\x08\x07\x06\x05\x04\x03\x02\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i64_le(&mut self, n: i64) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes an unsigned 128 bit integer to `self` in the big-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u128(0x01020304050607080910111213141516);
+    /// assert_eq!(buf, b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u128(&mut self, n: u128) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes an unsigned 128 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_u128_le(0x01020304050607080910111213141516);
+    /// assert_eq!(buf, b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_u128_le(&mut self, n: u128) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes a signed 128 bit integer to `self` in the big-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i128(0x01020304050607080910111213141516);
+    /// assert_eq!(buf, b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i128(&mut self, n: i128) {
+        self.put_slice(&n.to_be_bytes())
+    }
+
+    /// Writes a signed 128 bit integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 16.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_i128_le(0x01020304050607080910111213141516);
+    /// assert_eq!(buf, b"\x16\x15\x14\x13\x12\x11\x10\x09\x08\x07\x06\x05\x04\x03\x02\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_i128_le(&mut self, n: i128) {
+        self.put_slice(&n.to_le_bytes())
+    }
+
+    /// Writes an unsigned n-byte integer to `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_uint(0x010203, 3);
+    /// assert_eq!(buf, b"\x01\x02\x03");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_uint(&mut self, n: u64, nbytes: usize) {
+        self.put_slice(&n.to_be_bytes()[mem::size_of_val(&n) - nbytes..]);
+    }
+
+    /// Writes an unsigned n-byte integer to `self` in the little-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_uint_le(0x010203, 3);
+    /// assert_eq!(buf, b"\x03\x02\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_uint_le(&mut self, n: u64, nbytes: usize) {
+        self.put_slice(&n.to_le_bytes()[0..nbytes]);
+    }
+
+    /// Writes low `nbytes` of a signed integer to `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_int(0x0504010203, 3);
+    /// assert_eq!(buf, b"\x01\x02\x03");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self` or if `nbytes` is greater than 8.
+    fn put_int(&mut self, n: i64, nbytes: usize) {
+        self.put_slice(&n.to_be_bytes()[mem::size_of_val(&n) - nbytes..]);
+    }
+
+    /// Writes low `nbytes` of a signed integer to `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by `nbytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_int_le(0x0504010203, 3);
+    /// assert_eq!(buf, b"\x03\x02\x01");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self` or if `nbytes` is greater than 8.
+    fn put_int_le(&mut self, n: i64, nbytes: usize) {
+        self.put_slice(&n.to_le_bytes()[0..nbytes]);
+    }
+
+    /// Writes  an IEEE754 single-precision (4 bytes) floating point number to
+    /// `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_f32(1.2f32);
+    /// assert_eq!(buf, b"\x3F\x99\x99\x9A");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_f32(&mut self, n: f32) {
+        self.put_u32(n.to_bits());
+    }
+
+    /// Writes  an IEEE754 single-precision (4 bytes) floating point number to
+    /// `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 4.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_f32_le(1.2f32);
+    /// assert_eq!(buf, b"\x9A\x99\x99\x3F");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_f32_le(&mut self, n: f32) {
+        self.put_u32_le(n.to_bits());
+    }
+
+    /// Writes  an IEEE754 double-precision (8 bytes) floating point number to
+    /// `self` in big-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_f64(1.2f64);
+    /// assert_eq!(buf, b"\x3F\xF3\x33\x33\x33\x33\x33\x33");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_f64(&mut self, n: f64) {
+        self.put_u64(n.to_bits());
+    }
+
+    /// Writes  an IEEE754 double-precision (8 bytes) floating point number to
+    /// `self` in little-endian byte order.
+    ///
+    /// The current position is advanced by 8.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![];
+    /// buf.put_f64_le(1.2f64);
+    /// assert_eq!(buf, b"\x33\x33\x33\x33\x33\x33\xF3\x3F");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// This function panics if there is not enough remaining capacity in
+    /// `self`.
+    fn put_f64_le(&mut self, n: f64) {
+        self.put_u64_le(n.to_bits());
+    }
+
+    /// Creates an adaptor which can write at most `limit` bytes to `self`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let arr = &mut [0u8; 128][..];
+    /// assert_eq!(arr.remaining_mut(), 128);
+    ///
+    /// let dst = arr.limit(10);
+    /// assert_eq!(dst.remaining_mut(), 10);
+    /// ```
+    fn limit(self, limit: usize) -> Limit<Self>
+    where
+        Self: Sized,
+    {
+        limit::new(self, limit)
+    }
+
+    /// Creates an adaptor which implements the `Write` trait for `self`.
+    ///
+    /// This function returns a new value which implements `Write` by adapting
+    /// the `Write` trait functions to the `BufMut` trait functions. Given that
+    /// `BufMut` operations are infallible, none of the `Write` functions will
+    /// return with `Err`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    /// use std::io::Write;
+    ///
+    /// let mut buf = vec![].writer();
+    ///
+    /// let num = buf.write(&b"hello world"[..]).unwrap();
+    /// assert_eq!(11, num);
+    ///
+    /// let buf = buf.into_inner();
+    ///
+    /// assert_eq!(*buf, b"hello world"[..]);
+    /// ```
+    #[cfg(feature = "std")]
+    fn writer(self) -> Writer<Self>
+    where
+        Self: Sized,
+    {
+        writer::new(self)
+    }
+
+    /// Creates an adapter which will chain this buffer with another.
+    ///
+    /// The returned `BufMut` instance will first write to all bytes from
+    /// `self`. Afterwards, it will write to `next`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut a = [0u8; 5];
+    /// let mut b = [0u8; 6];
+    ///
+    /// let mut chain = (&mut a[..]).chain_mut(&mut b[..]);
+    ///
+    /// chain.put_slice(b"hello world");
+    ///
+    /// assert_eq!(&a[..], b"hello");
+    /// assert_eq!(&b[..], b" world");
+    /// ```
+    fn chain_mut<U: BufMut>(self, next: U) -> Chain<Self, U>
+    where
+        Self: Sized,
+    {
+        Chain::new(self, next)
+    }
+}
+
+macro_rules! deref_forward_bufmut {
+    () => {
+        fn remaining_mut(&self) -> usize {
+            (**self).remaining_mut()
+        }
+
+        fn chunk_mut(&mut self) -> &mut UninitSlice {
+            (**self).chunk_mut()
+        }
+
+        unsafe fn advance_mut(&mut self, cnt: usize) {
+            (**self).advance_mut(cnt)
+        }
+
+        fn put_slice(&mut self, src: &[u8]) {
+            (**self).put_slice(src)
+        }
+
+        fn put_u8(&mut self, n: u8) {
+            (**self).put_u8(n)
+        }
+
+        fn put_i8(&mut self, n: i8) {
+            (**self).put_i8(n)
+        }
+
+        fn put_u16(&mut self, n: u16) {
+            (**self).put_u16(n)
+        }
+
+        fn put_u16_le(&mut self, n: u16) {
+            (**self).put_u16_le(n)
+        }
+
+        fn put_i16(&mut self, n: i16) {
+            (**self).put_i16(n)
+        }
+
+        fn put_i16_le(&mut self, n: i16) {
+            (**self).put_i16_le(n)
+        }
+
+        fn put_u32(&mut self, n: u32) {
+            (**self).put_u32(n)
+        }
+
+        fn put_u32_le(&mut self, n: u32) {
+            (**self).put_u32_le(n)
+        }
+
+        fn put_i32(&mut self, n: i32) {
+            (**self).put_i32(n)
+        }
+
+        fn put_i32_le(&mut self, n: i32) {
+            (**self).put_i32_le(n)
+        }
+
+        fn put_u64(&mut self, n: u64) {
+            (**self).put_u64(n)
+        }
+
+        fn put_u64_le(&mut self, n: u64) {
+            (**self).put_u64_le(n)
+        }
+
+        fn put_i64(&mut self, n: i64) {
+            (**self).put_i64(n)
+        }
+
+        fn put_i64_le(&mut self, n: i64) {
+            (**self).put_i64_le(n)
+        }
+    };
+}
+
+unsafe impl<T: BufMut + ?Sized> BufMut for &mut T {
+    deref_forward_bufmut!();
+}
+
+unsafe impl<T: BufMut + ?Sized> BufMut for Box<T> {
+    deref_forward_bufmut!();
+}
+
+unsafe impl BufMut for &mut [u8] {
+    #[inline]
+    fn remaining_mut(&self) -> usize {
+        self.len()
+    }
+
+    #[inline]
+    fn chunk_mut(&mut self) -> &mut UninitSlice {
+        // UninitSlice is repr(transparent), so safe to transmute
+        unsafe { &mut *(*self as *mut [u8] as *mut _) }
+    }
+
+    #[inline]
+    unsafe fn advance_mut(&mut self, cnt: usize) {
+        // Lifetime dance taken from `impl Write for &mut [u8]`.
+        let (_, b) = core::mem::replace(self, &mut []).split_at_mut(cnt);
+        *self = b;
+    }
+
+    #[inline]
+    fn put_slice(&mut self, src: &[u8]) {
+        self[..src.len()].copy_from_slice(src);
+        unsafe {
+            self.advance_mut(src.len());
+        }
+    }
+
+    fn put_bytes(&mut self, val: u8, cnt: usize) {
+        assert!(self.remaining_mut() >= cnt);
+        unsafe {
+            ptr::write_bytes(self.as_mut_ptr(), val, cnt);
+            self.advance_mut(cnt);
+        }
+    }
+}
+
+unsafe impl BufMut for Vec<u8> {
+    #[inline]
+    fn remaining_mut(&self) -> usize {
+        // A vector can never have more than isize::MAX bytes
+        core::isize::MAX as usize - self.len()
+    }
+
+    #[inline]
+    unsafe fn advance_mut(&mut self, cnt: usize) {
+        let len = self.len();
+        let remaining = self.capacity() - len;
+
+        assert!(
+            cnt <= remaining,
+            "cannot advance past `remaining_mut`: {:?} <= {:?}",
+            cnt,
+            remaining
+        );
+
+        self.set_len(len + cnt);
+    }
+
+    #[inline]
+    fn chunk_mut(&mut self) -> &mut UninitSlice {
+        if self.capacity() == self.len() {
+            self.reserve(64); // Grow the vec
+        }
+
+        let cap = self.capacity();
+        let len = self.len();
+
+        let ptr = self.as_mut_ptr();
+        unsafe { &mut UninitSlice::from_raw_parts_mut(ptr, cap)[len..] }
+    }
+
+    // Specialize these methods so they can skip checking `remaining_mut`
+    // and `advance_mut`.
+    fn put<T: super::Buf>(&mut self, mut src: T)
+    where
+        Self: Sized,
+    {
+        // In case the src isn't contiguous, reserve upfront
+        self.reserve(src.remaining());
+
+        while src.has_remaining() {
+            let l;
+
+            // a block to contain the src.bytes() borrow
+            {
+                let s = src.chunk();
+                l = s.len();
+                self.extend_from_slice(s);
+            }
+
+            src.advance(l);
+        }
+    }
+
+    #[inline]
+    fn put_slice(&mut self, src: &[u8]) {
+        self.extend_from_slice(src);
+    }
+
+    fn put_bytes(&mut self, val: u8, cnt: usize) {
+        let new_len = self.len().checked_add(cnt).unwrap();
+        self.resize(new_len, val);
+    }
+}
+
+// The existence of this function makes the compiler catch if the BufMut
+// trait is "object-safe" or not.
+fn _assert_trait_object(_b: &dyn BufMut) {}
diff --git a/android/vendor/bytes-1.1.0/src/buf/chain.rs b/android/vendor/bytes-1.1.0/src/buf/chain.rs
new file mode 100644
index 0000000..9ce5f23
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/chain.rs
@@ -0,0 +1,243 @@
+use crate::buf::{IntoIter, UninitSlice};
+use crate::{Buf, BufMut, Bytes};
+
+#[cfg(feature = "std")]
+use std::io::IoSlice;
+
+/// A `Chain` sequences two buffers.
+///
+/// `Chain` is an adapter that links two underlying buffers and provides a
+/// continuous view across both buffers. It is able to sequence either immutable
+/// buffers ([`Buf`] values) or mutable buffers ([`BufMut`] values).
+///
+/// This struct is generally created by calling [`Buf::chain`]. Please see that
+/// function's documentation for more detail.
+///
+/// # Examples
+///
+/// ```
+/// use bytes::{Bytes, Buf};
+///
+/// let mut buf = (&b"hello "[..])
+///     .chain(&b"world"[..]);
+///
+/// let full: Bytes = buf.copy_to_bytes(11);
+/// assert_eq!(full[..], b"hello world"[..]);
+/// ```
+///
+/// [`Buf::chain`]: trait.Buf.html#method.chain
+/// [`Buf`]: trait.Buf.html
+/// [`BufMut`]: trait.BufMut.html
+#[derive(Debug)]
+pub struct Chain<T, U> {
+    a: T,
+    b: U,
+}
+
+impl<T, U> Chain<T, U> {
+    /// Creates a new `Chain` sequencing the provided values.
+    pub(crate) fn new(a: T, b: U) -> Chain<T, U> {
+        Chain { a, b }
+    }
+
+    /// Gets a reference to the first underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let buf = (&b"hello"[..])
+    ///     .chain(&b"world"[..]);
+    ///
+    /// assert_eq!(buf.first_ref()[..], b"hello"[..]);
+    /// ```
+    pub fn first_ref(&self) -> &T {
+        &self.a
+    }
+
+    /// Gets a mutable reference to the first underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = (&b"hello"[..])
+    ///     .chain(&b"world"[..]);
+    ///
+    /// buf.first_mut().advance(1);
+    ///
+    /// let full = buf.copy_to_bytes(9);
+    /// assert_eq!(full, b"elloworld"[..]);
+    /// ```
+    pub fn first_mut(&mut self) -> &mut T {
+        &mut self.a
+    }
+
+    /// Gets a reference to the last underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let buf = (&b"hello"[..])
+    ///     .chain(&b"world"[..]);
+    ///
+    /// assert_eq!(buf.last_ref()[..], b"world"[..]);
+    /// ```
+    pub fn last_ref(&self) -> &U {
+        &self.b
+    }
+
+    /// Gets a mutable reference to the last underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = (&b"hello "[..])
+    ///     .chain(&b"world"[..]);
+    ///
+    /// buf.last_mut().advance(1);
+    ///
+    /// let full = buf.copy_to_bytes(10);
+    /// assert_eq!(full, b"hello orld"[..]);
+    /// ```
+    pub fn last_mut(&mut self) -> &mut U {
+        &mut self.b
+    }
+
+    /// Consumes this `Chain`, returning the underlying values.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Buf;
+    ///
+    /// let chain = (&b"hello"[..])
+    ///     .chain(&b"world"[..]);
+    ///
+    /// let (first, last) = chain.into_inner();
+    /// assert_eq!(first[..], b"hello"[..]);
+    /// assert_eq!(last[..], b"world"[..]);
+    /// ```
+    pub fn into_inner(self) -> (T, U) {
+        (self.a, self.b)
+    }
+}
+
+impl<T, U> Buf for Chain<T, U>
+where
+    T: Buf,
+    U: Buf,
+{
+    fn remaining(&self) -> usize {
+        self.a.remaining().checked_add(self.b.remaining()).unwrap()
+    }
+
+    fn chunk(&self) -> &[u8] {
+        if self.a.has_remaining() {
+            self.a.chunk()
+        } else {
+            self.b.chunk()
+        }
+    }
+
+    fn advance(&mut self, mut cnt: usize) {
+        let a_rem = self.a.remaining();
+
+        if a_rem != 0 {
+            if a_rem >= cnt {
+                self.a.advance(cnt);
+                return;
+            }
+
+            // Consume what is left of a
+            self.a.advance(a_rem);
+
+            cnt -= a_rem;
+        }
+
+        self.b.advance(cnt);
+    }
+
+    #[cfg(feature = "std")]
+    fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize {
+        let mut n = self.a.chunks_vectored(dst);
+        n += self.b.chunks_vectored(&mut dst[n..]);
+        n
+    }
+
+    fn copy_to_bytes(&mut self, len: usize) -> Bytes {
+        let a_rem = self.a.remaining();
+        if a_rem >= len {
+            self.a.copy_to_bytes(len)
+        } else if a_rem == 0 {
+            self.b.copy_to_bytes(len)
+        } else {
+            assert!(
+                len - a_rem <= self.b.remaining(),
+                "`len` greater than remaining"
+            );
+            let mut ret = crate::BytesMut::with_capacity(len);
+            ret.put(&mut self.a);
+            ret.put((&mut self.b).take(len - a_rem));
+            ret.freeze()
+        }
+    }
+}
+
+unsafe impl<T, U> BufMut for Chain<T, U>
+where
+    T: BufMut,
+    U: BufMut,
+{
+    fn remaining_mut(&self) -> usize {
+        self.a
+            .remaining_mut()
+            .checked_add(self.b.remaining_mut())
+            .unwrap()
+    }
+
+    fn chunk_mut(&mut self) -> &mut UninitSlice {
+        if self.a.has_remaining_mut() {
+            self.a.chunk_mut()
+        } else {
+            self.b.chunk_mut()
+        }
+    }
+
+    unsafe fn advance_mut(&mut self, mut cnt: usize) {
+        let a_rem = self.a.remaining_mut();
+
+        if a_rem != 0 {
+            if a_rem >= cnt {
+                self.a.advance_mut(cnt);
+                return;
+            }
+
+            // Consume what is left of a
+            self.a.advance_mut(a_rem);
+
+            cnt -= a_rem;
+        }
+
+        self.b.advance_mut(cnt);
+    }
+}
+
+impl<T, U> IntoIterator for Chain<T, U>
+where
+    T: Buf,
+    U: Buf,
+{
+    type Item = u8;
+    type IntoIter = IntoIter<Chain<T, U>>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        IntoIter::new(self)
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/buf/iter.rs b/android/vendor/bytes-1.1.0/src/buf/iter.rs
new file mode 100644
index 0000000..8914a40
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/iter.rs
@@ -0,0 +1,132 @@
+use crate::Buf;
+
+/// Iterator over the bytes contained by the buffer.
+///
+/// This struct is created by the [`iter`] method on [`Buf`].
+///
+/// # Examples
+///
+/// Basic usage:
+///
+/// ```
+/// use bytes::Bytes;
+///
+/// let buf = Bytes::from(&b"abc"[..]);
+/// let mut iter = buf.into_iter();
+///
+/// assert_eq!(iter.next(), Some(b'a'));
+/// assert_eq!(iter.next(), Some(b'b'));
+/// assert_eq!(iter.next(), Some(b'c'));
+/// assert_eq!(iter.next(), None);
+/// ```
+///
+/// [`iter`]: trait.Buf.html#method.iter
+/// [`Buf`]: trait.Buf.html
+#[derive(Debug)]
+pub struct IntoIter<T> {
+    inner: T,
+}
+
+impl<T> IntoIter<T> {
+    /// Creates an iterator over the bytes contained by the buffer.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let buf = Bytes::from_static(b"abc");
+    /// let mut iter = buf.into_iter();
+    ///
+    /// assert_eq!(iter.next(), Some(b'a'));
+    /// assert_eq!(iter.next(), Some(b'b'));
+    /// assert_eq!(iter.next(), Some(b'c'));
+    /// assert_eq!(iter.next(), None);
+    /// ```
+    pub(crate) fn new(inner: T) -> IntoIter<T> {
+        IntoIter { inner }
+    }
+
+    /// Consumes this `IntoIter`, returning the underlying value.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::{Buf, Bytes};
+    ///
+    /// let buf = Bytes::from(&b"abc"[..]);
+    /// let mut iter = buf.into_iter();
+    ///
+    /// assert_eq!(iter.next(), Some(b'a'));
+    ///
+    /// let buf = iter.into_inner();
+    /// assert_eq!(2, buf.remaining());
+    /// ```
+    pub fn into_inner(self) -> T {
+        self.inner
+    }
+
+    /// Gets a reference to the underlying `Buf`.
+    ///
+    /// It is inadvisable to directly read from the underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::{Buf, Bytes};
+    ///
+    /// let buf = Bytes::from(&b"abc"[..]);
+    /// let mut iter = buf.into_iter();
+    ///
+    /// assert_eq!(iter.next(), Some(b'a'));
+    ///
+    /// assert_eq!(2, iter.get_ref().remaining());
+    /// ```
+    pub fn get_ref(&self) -> &T {
+        &self.inner
+    }
+
+    /// Gets a mutable reference to the underlying `Buf`.
+    ///
+    /// It is inadvisable to directly read from the underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::{Buf, BytesMut};
+    ///
+    /// let buf = BytesMut::from(&b"abc"[..]);
+    /// let mut iter = buf.into_iter();
+    ///
+    /// assert_eq!(iter.next(), Some(b'a'));
+    ///
+    /// iter.get_mut().advance(1);
+    ///
+    /// assert_eq!(iter.next(), Some(b'c'));
+    /// ```
+    pub fn get_mut(&mut self) -> &mut T {
+        &mut self.inner
+    }
+}
+
+impl<T: Buf> Iterator for IntoIter<T> {
+    type Item = u8;
+
+    fn next(&mut self) -> Option<u8> {
+        if !self.inner.has_remaining() {
+            return None;
+        }
+
+        let b = self.inner.chunk()[0];
+        self.inner.advance(1);
+
+        Some(b)
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        let rem = self.inner.remaining();
+        (rem, Some(rem))
+    }
+}
+
+impl<T: Buf> ExactSizeIterator for IntoIter<T> {}
diff --git a/android/vendor/bytes-1.1.0/src/buf/limit.rs b/android/vendor/bytes-1.1.0/src/buf/limit.rs
new file mode 100644
index 0000000..b422be5
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/limit.rs
@@ -0,0 +1,75 @@
+use crate::buf::UninitSlice;
+use crate::BufMut;
+
+use core::cmp;
+
+/// A `BufMut` adapter which limits the amount of bytes that can be written
+/// to an underlying buffer.
+#[derive(Debug)]
+pub struct Limit<T> {
+    inner: T,
+    limit: usize,
+}
+
+pub(super) fn new<T>(inner: T, limit: usize) -> Limit<T> {
+    Limit { inner, limit }
+}
+
+impl<T> Limit<T> {
+    /// Consumes this `Limit`, returning the underlying value.
+    pub fn into_inner(self) -> T {
+        self.inner
+    }
+
+    /// Gets a reference to the underlying `BufMut`.
+    ///
+    /// It is inadvisable to directly write to the underlying `BufMut`.
+    pub fn get_ref(&self) -> &T {
+        &self.inner
+    }
+
+    /// Gets a mutable reference to the underlying `BufMut`.
+    ///
+    /// It is inadvisable to directly write to the underlying `BufMut`.
+    pub fn get_mut(&mut self) -> &mut T {
+        &mut self.inner
+    }
+
+    /// Returns the maximum number of bytes that can be written
+    ///
+    /// # Note
+    ///
+    /// If the inner `BufMut` has fewer bytes than indicated by this method then
+    /// that is the actual number of available bytes.
+    pub fn limit(&self) -> usize {
+        self.limit
+    }
+
+    /// Sets the maximum number of bytes that can be written.
+    ///
+    /// # Note
+    ///
+    /// If the inner `BufMut` has fewer bytes than `lim` then that is the actual
+    /// number of available bytes.
+    pub fn set_limit(&mut self, lim: usize) {
+        self.limit = lim
+    }
+}
+
+unsafe impl<T: BufMut> BufMut for Limit<T> {
+    fn remaining_mut(&self) -> usize {
+        cmp::min(self.inner.remaining_mut(), self.limit)
+    }
+
+    fn chunk_mut(&mut self) -> &mut UninitSlice {
+        let bytes = self.inner.chunk_mut();
+        let end = cmp::min(bytes.len(), self.limit);
+        &mut bytes[..end]
+    }
+
+    unsafe fn advance_mut(&mut self, cnt: usize) {
+        assert!(cnt <= self.limit);
+        self.inner.advance_mut(cnt);
+        self.limit -= cnt;
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/buf/mod.rs b/android/vendor/bytes-1.1.0/src/buf/mod.rs
new file mode 100644
index 0000000..c4c0a57
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/mod.rs
@@ -0,0 +1,41 @@
+//! Utilities for working with buffers.
+//!
+//! A buffer is any structure that contains a sequence of bytes. The bytes may
+//! or may not be stored in contiguous memory. This module contains traits used
+//! to abstract over buffers as well as utilities for working with buffer types.
+//!
+//! # `Buf`, `BufMut`
+//!
+//! These are the two foundational traits for abstractly working with buffers.
+//! They can be thought as iterators for byte structures. They offer additional
+//! performance over `Iterator` by providing an API optimized for byte slices.
+//!
+//! See [`Buf`] and [`BufMut`] for more details.
+//!
+//! [rope]: https://en.wikipedia.org/wiki/Rope_(data_structure)
+//! [`Buf`]: trait.Buf.html
+//! [`BufMut`]: trait.BufMut.html
+
+mod buf_impl;
+mod buf_mut;
+mod chain;
+mod iter;
+mod limit;
+#[cfg(feature = "std")]
+mod reader;
+mod take;
+mod uninit_slice;
+mod vec_deque;
+#[cfg(feature = "std")]
+mod writer;
+
+pub use self::buf_impl::Buf;
+pub use self::buf_mut::BufMut;
+pub use self::chain::Chain;
+pub use self::iter::IntoIter;
+pub use self::limit::Limit;
+pub use self::take::Take;
+pub use self::uninit_slice::UninitSlice;
+
+#[cfg(feature = "std")]
+pub use self::{reader::Reader, writer::Writer};
diff --git a/android/vendor/bytes-1.1.0/src/buf/reader.rs b/android/vendor/bytes-1.1.0/src/buf/reader.rs
new file mode 100644
index 0000000..f2b4d98
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/reader.rs
@@ -0,0 +1,81 @@
+use crate::Buf;
+
+use std::{cmp, io};
+
+/// A `Buf` adapter which implements `io::Read` for the inner value.
+///
+/// This struct is generally created by calling `reader()` on `Buf`. See
+/// documentation of [`reader()`](trait.Buf.html#method.reader) for more
+/// details.
+#[derive(Debug)]
+pub struct Reader<B> {
+    buf: B,
+}
+
+pub fn new<B>(buf: B) -> Reader<B> {
+    Reader { buf }
+}
+
+impl<B: Buf> Reader<B> {
+    /// Gets a reference to the underlying `Buf`.
+    ///
+    /// It is inadvisable to directly read from the underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::Buf;
+    ///
+    /// let buf = b"hello world".reader();
+    ///
+    /// assert_eq!(b"hello world", buf.get_ref());
+    /// ```
+    pub fn get_ref(&self) -> &B {
+        &self.buf
+    }
+
+    /// Gets a mutable reference to the underlying `Buf`.
+    ///
+    /// It is inadvisable to directly read from the underlying `Buf`.
+    pub fn get_mut(&mut self) -> &mut B {
+        &mut self.buf
+    }
+
+    /// Consumes this `Reader`, returning the underlying value.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::Buf;
+    /// use std::io;
+    ///
+    /// let mut buf = b"hello world".reader();
+    /// let mut dst = vec![];
+    ///
+    /// io::copy(&mut buf, &mut dst).unwrap();
+    ///
+    /// let buf = buf.into_inner();
+    /// assert_eq!(0, buf.remaining());
+    /// ```
+    pub fn into_inner(self) -> B {
+        self.buf
+    }
+}
+
+impl<B: Buf + Sized> io::Read for Reader<B> {
+    fn read(&mut self, dst: &mut [u8]) -> io::Result<usize> {
+        let len = cmp::min(self.buf.remaining(), dst.len());
+
+        Buf::copy_to_slice(&mut self.buf, &mut dst[0..len]);
+        Ok(len)
+    }
+}
+
+impl<B: Buf + Sized> io::BufRead for Reader<B> {
+    fn fill_buf(&mut self) -> io::Result<&[u8]> {
+        Ok(self.buf.chunk())
+    }
+    fn consume(&mut self, amt: usize) {
+        self.buf.advance(amt)
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/buf/take.rs b/android/vendor/bytes-1.1.0/src/buf/take.rs
new file mode 100644
index 0000000..d3cb10a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/take.rs
@@ -0,0 +1,155 @@
+use crate::{Buf, Bytes};
+
+use core::cmp;
+
+/// A `Buf` adapter which limits the bytes read from an underlying buffer.
+///
+/// This struct is generally created by calling `take()` on `Buf`. See
+/// documentation of [`take()`](trait.Buf.html#method.take) for more details.
+#[derive(Debug)]
+pub struct Take<T> {
+    inner: T,
+    limit: usize,
+}
+
+pub fn new<T>(inner: T, limit: usize) -> Take<T> {
+    Take { inner, limit }
+}
+
+impl<T> Take<T> {
+    /// Consumes this `Take`, returning the underlying value.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::{Buf, BufMut};
+    ///
+    /// let mut buf = b"hello world".take(2);
+    /// let mut dst = vec![];
+    ///
+    /// dst.put(&mut buf);
+    /// assert_eq!(*dst, b"he"[..]);
+    ///
+    /// let mut buf = buf.into_inner();
+    ///
+    /// dst.clear();
+    /// dst.put(&mut buf);
+    /// assert_eq!(*dst, b"llo world"[..]);
+    /// ```
+    pub fn into_inner(self) -> T {
+        self.inner
+    }
+
+    /// Gets a reference to the underlying `Buf`.
+    ///
+    /// It is inadvisable to directly read from the underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::Buf;
+    ///
+    /// let buf = b"hello world".take(2);
+    ///
+    /// assert_eq!(11, buf.get_ref().remaining());
+    /// ```
+    pub fn get_ref(&self) -> &T {
+        &self.inner
+    }
+
+    /// Gets a mutable reference to the underlying `Buf`.
+    ///
+    /// It is inadvisable to directly read from the underlying `Buf`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::{Buf, BufMut};
+    ///
+    /// let mut buf = b"hello world".take(2);
+    /// let mut dst = vec![];
+    ///
+    /// buf.get_mut().advance(2);
+    ///
+    /// dst.put(&mut buf);
+    /// assert_eq!(*dst, b"ll"[..]);
+    /// ```
+    pub fn get_mut(&mut self) -> &mut T {
+        &mut self.inner
+    }
+
+    /// Returns the maximum number of bytes that can be read.
+    ///
+    /// # Note
+    ///
+    /// If the inner `Buf` has fewer bytes than indicated by this method then
+    /// that is the actual number of available bytes.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::Buf;
+    ///
+    /// let mut buf = b"hello world".take(2);
+    ///
+    /// assert_eq!(2, buf.limit());
+    /// assert_eq!(b'h', buf.get_u8());
+    /// assert_eq!(1, buf.limit());
+    /// ```
+    pub fn limit(&self) -> usize {
+        self.limit
+    }
+
+    /// Sets the maximum number of bytes that can be read.
+    ///
+    /// # Note
+    ///
+    /// If the inner `Buf` has fewer bytes than `lim` then that is the actual
+    /// number of available bytes.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::{Buf, BufMut};
+    ///
+    /// let mut buf = b"hello world".take(2);
+    /// let mut dst = vec![];
+    ///
+    /// dst.put(&mut buf);
+    /// assert_eq!(*dst, b"he"[..]);
+    ///
+    /// dst.clear();
+    ///
+    /// buf.set_limit(3);
+    /// dst.put(&mut buf);
+    /// assert_eq!(*dst, b"llo"[..]);
+    /// ```
+    pub fn set_limit(&mut self, lim: usize) {
+        self.limit = lim
+    }
+}
+
+impl<T: Buf> Buf for Take<T> {
+    fn remaining(&self) -> usize {
+        cmp::min(self.inner.remaining(), self.limit)
+    }
+
+    fn chunk(&self) -> &[u8] {
+        let bytes = self.inner.chunk();
+        &bytes[..cmp::min(bytes.len(), self.limit)]
+    }
+
+    fn advance(&mut self, cnt: usize) {
+        assert!(cnt <= self.limit);
+        self.inner.advance(cnt);
+        self.limit -= cnt;
+    }
+
+    fn copy_to_bytes(&mut self, len: usize) -> Bytes {
+        assert!(len <= self.remaining(), "`len` greater than remaining");
+
+        let r = self.inner.copy_to_bytes(len);
+        self.limit -= len;
+        r
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/buf/uninit_slice.rs b/android/vendor/bytes-1.1.0/src/buf/uninit_slice.rs
new file mode 100644
index 0000000..fb67c0a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/uninit_slice.rs
@@ -0,0 +1,183 @@
+use core::fmt;
+use core::mem::MaybeUninit;
+use core::ops::{
+    Index, IndexMut, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
+};
+
+/// Uninitialized byte slice.
+///
+/// Returned by `BufMut::chunk_mut()`, the referenced byte slice may be
+/// uninitialized. The wrapper provides safe access without introducing
+/// undefined behavior.
+///
+/// The safety invariants of this wrapper are:
+///
+///  1. Reading from an `UninitSlice` is undefined behavior.
+///  2. Writing uninitialized bytes to an `UninitSlice` is undefined behavior.
+///
+/// The difference between `&mut UninitSlice` and `&mut [MaybeUninit<u8>]` is
+/// that it is possible in safe code to write uninitialized bytes to an
+/// `&mut [MaybeUninit<u8>]`, which this type prohibits.
+#[repr(transparent)]
+pub struct UninitSlice([MaybeUninit<u8>]);
+
+impl UninitSlice {
+    /// Create a `&mut UninitSlice` from a pointer and a length.
+    ///
+    /// # Safety
+    ///
+    /// The caller must ensure that `ptr` references a valid memory region owned
+    /// by the caller representing a byte slice for the duration of `'a`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::buf::UninitSlice;
+    ///
+    /// let bytes = b"hello world".to_vec();
+    /// let ptr = bytes.as_ptr() as *mut _;
+    /// let len = bytes.len();
+    ///
+    /// let slice = unsafe { UninitSlice::from_raw_parts_mut(ptr, len) };
+    /// ```
+    #[inline]
+    pub unsafe fn from_raw_parts_mut<'a>(ptr: *mut u8, len: usize) -> &'a mut UninitSlice {
+        let maybe_init: &mut [MaybeUninit<u8>] =
+            core::slice::from_raw_parts_mut(ptr as *mut _, len);
+        &mut *(maybe_init as *mut [MaybeUninit<u8>] as *mut UninitSlice)
+    }
+
+    /// Write a single byte at the specified offset.
+    ///
+    /// # Panics
+    ///
+    /// The function panics if `index` is out of bounds.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::buf::UninitSlice;
+    ///
+    /// let mut data = [b'f', b'o', b'o'];
+    /// let slice = unsafe { UninitSlice::from_raw_parts_mut(data.as_mut_ptr(), 3) };
+    ///
+    /// slice.write_byte(0, b'b');
+    ///
+    /// assert_eq!(b"boo", &data[..]);
+    /// ```
+    #[inline]
+    pub fn write_byte(&mut self, index: usize, byte: u8) {
+        assert!(index < self.len());
+
+        unsafe { self[index..].as_mut_ptr().write(byte) }
+    }
+
+    /// Copies bytes  from `src` into `self`.
+    ///
+    /// The length of `src` must be the same as `self`.
+    ///
+    /// # Panics
+    ///
+    /// The function panics if `src` has a different length than `self`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::buf::UninitSlice;
+    ///
+    /// let mut data = [b'f', b'o', b'o'];
+    /// let slice = unsafe { UninitSlice::from_raw_parts_mut(data.as_mut_ptr(), 3) };
+    ///
+    /// slice.copy_from_slice(b"bar");
+    ///
+    /// assert_eq!(b"bar", &data[..]);
+    /// ```
+    #[inline]
+    pub fn copy_from_slice(&mut self, src: &[u8]) {
+        use core::ptr;
+
+        assert_eq!(self.len(), src.len());
+
+        unsafe {
+            ptr::copy_nonoverlapping(src.as_ptr(), self.as_mut_ptr(), self.len());
+        }
+    }
+
+    /// Return a raw pointer to the slice's buffer.
+    ///
+    /// # Safety
+    ///
+    /// The caller **must not** read from the referenced memory and **must not**
+    /// write **uninitialized** bytes to the slice either.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut data = [0, 1, 2];
+    /// let mut slice = &mut data[..];
+    /// let ptr = BufMut::chunk_mut(&mut slice).as_mut_ptr();
+    /// ```
+    #[inline]
+    pub fn as_mut_ptr(&mut self) -> *mut u8 {
+        self.0.as_mut_ptr() as *mut _
+    }
+
+    /// Returns the number of bytes in the slice.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BufMut;
+    ///
+    /// let mut data = [0, 1, 2];
+    /// let mut slice = &mut data[..];
+    /// let len = BufMut::chunk_mut(&mut slice).len();
+    ///
+    /// assert_eq!(len, 3);
+    /// ```
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.0.len()
+    }
+}
+
+impl fmt::Debug for UninitSlice {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
+        fmt.debug_struct("UninitSlice[...]").finish()
+    }
+}
+
+macro_rules! impl_index {
+    ($($t:ty),*) => {
+        $(
+            impl Index<$t> for UninitSlice {
+                type Output = UninitSlice;
+
+                #[inline]
+                fn index(&self, index: $t) -> &UninitSlice {
+                    let maybe_uninit: &[MaybeUninit<u8>] = &self.0[index];
+                    unsafe { &*(maybe_uninit as *const [MaybeUninit<u8>] as *const UninitSlice) }
+                }
+            }
+
+            impl IndexMut<$t> for UninitSlice {
+                #[inline]
+                fn index_mut(&mut self, index: $t) -> &mut UninitSlice {
+                    let maybe_uninit: &mut [MaybeUninit<u8>] = &mut self.0[index];
+                    unsafe { &mut *(maybe_uninit as *mut [MaybeUninit<u8>] as *mut UninitSlice) }
+                }
+            }
+        )*
+    };
+}
+
+impl_index!(
+    Range<usize>,
+    RangeFrom<usize>,
+    RangeFull,
+    RangeInclusive<usize>,
+    RangeTo<usize>,
+    RangeToInclusive<usize>
+);
diff --git a/android/vendor/bytes-1.1.0/src/buf/vec_deque.rs b/android/vendor/bytes-1.1.0/src/buf/vec_deque.rs
new file mode 100644
index 0000000..263167e
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/vec_deque.rs
@@ -0,0 +1,22 @@
+use alloc::collections::VecDeque;
+
+use super::Buf;
+
+impl Buf for VecDeque<u8> {
+    fn remaining(&self) -> usize {
+        self.len()
+    }
+
+    fn chunk(&self) -> &[u8] {
+        let (s1, s2) = self.as_slices();
+        if s1.is_empty() {
+            s2
+        } else {
+            s1
+        }
+    }
+
+    fn advance(&mut self, cnt: usize) {
+        self.drain(..cnt);
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/buf/writer.rs b/android/vendor/bytes-1.1.0/src/buf/writer.rs
new file mode 100644
index 0000000..261d7cd
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/buf/writer.rs
@@ -0,0 +1,88 @@
+use crate::BufMut;
+
+use std::{cmp, io};
+
+/// A `BufMut` adapter which implements `io::Write` for the inner value.
+///
+/// This struct is generally created by calling `writer()` on `BufMut`. See
+/// documentation of [`writer()`](trait.BufMut.html#method.writer) for more
+/// details.
+#[derive(Debug)]
+pub struct Writer<B> {
+    buf: B,
+}
+
+pub fn new<B>(buf: B) -> Writer<B> {
+    Writer { buf }
+}
+
+impl<B: BufMut> Writer<B> {
+    /// Gets a reference to the underlying `BufMut`.
+    ///
+    /// It is inadvisable to directly write to the underlying `BufMut`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::BufMut;
+    ///
+    /// let buf = Vec::with_capacity(1024).writer();
+    ///
+    /// assert_eq!(1024, buf.get_ref().capacity());
+    /// ```
+    pub fn get_ref(&self) -> &B {
+        &self.buf
+    }
+
+    /// Gets a mutable reference to the underlying `BufMut`.
+    ///
+    /// It is inadvisable to directly write to the underlying `BufMut`.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::BufMut;
+    ///
+    /// let mut buf = vec![].writer();
+    ///
+    /// buf.get_mut().reserve(1024);
+    ///
+    /// assert_eq!(1024, buf.get_ref().capacity());
+    /// ```
+    pub fn get_mut(&mut self) -> &mut B {
+        &mut self.buf
+    }
+
+    /// Consumes this `Writer`, returning the underlying value.
+    ///
+    /// # Examples
+    ///
+    /// ```rust
+    /// use bytes::BufMut;
+    /// use std::io;
+    ///
+    /// let mut buf = vec![].writer();
+    /// let mut src = &b"hello world"[..];
+    ///
+    /// io::copy(&mut src, &mut buf).unwrap();
+    ///
+    /// let buf = buf.into_inner();
+    /// assert_eq!(*buf, b"hello world"[..]);
+    /// ```
+    pub fn into_inner(self) -> B {
+        self.buf
+    }
+}
+
+impl<B: BufMut + Sized> io::Write for Writer<B> {
+    fn write(&mut self, src: &[u8]) -> io::Result<usize> {
+        let n = cmp::min(self.buf.remaining_mut(), src.len());
+
+        self.buf.put(&src[0..n]);
+        Ok(n)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        Ok(())
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/bytes.rs b/android/vendor/bytes-1.1.0/src/bytes.rs
new file mode 100644
index 0000000..d0be0d2
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/bytes.rs
@@ -0,0 +1,1144 @@
+use core::iter::FromIterator;
+use core::ops::{Deref, RangeBounds};
+use core::{cmp, fmt, hash, mem, ptr, slice, usize};
+
+use alloc::{borrow::Borrow, boxed::Box, string::String, vec::Vec};
+
+use crate::buf::IntoIter;
+#[allow(unused)]
+use crate::loom::sync::atomic::AtomicMut;
+use crate::loom::sync::atomic::{self, AtomicPtr, AtomicUsize, Ordering};
+use crate::Buf;
+
+/// A cheaply cloneable and sliceable chunk of contiguous memory.
+///
+/// `Bytes` is an efficient container for storing and operating on contiguous
+/// slices of memory. It is intended for use primarily in networking code, but
+/// could have applications elsewhere as well.
+///
+/// `Bytes` values facilitate zero-copy network programming by allowing multiple
+/// `Bytes` objects to point to the same underlying memory.
+///
+/// `Bytes` does not have a single implementation. It is an interface, whose
+/// exact behavior is implemented through dynamic dispatch in several underlying
+/// implementations of `Bytes`.
+///
+/// All `Bytes` implementations must fulfill the following requirements:
+/// - They are cheaply cloneable and thereby shareable between an unlimited amount
+///   of components, for example by modifying a reference count.
+/// - Instances can be sliced to refer to a subset of the the original buffer.
+///
+/// ```
+/// use bytes::Bytes;
+///
+/// let mut mem = Bytes::from("Hello world");
+/// let a = mem.slice(0..5);
+///
+/// assert_eq!(a, "Hello");
+///
+/// let b = mem.split_to(6);
+///
+/// assert_eq!(mem, "world");
+/// assert_eq!(b, "Hello ");
+/// ```
+///
+/// # Memory layout
+///
+/// The `Bytes` struct itself is fairly small, limited to 4 `usize` fields used
+/// to track information about which segment of the underlying memory the
+/// `Bytes` handle has access to.
+///
+/// `Bytes` keeps both a pointer to the shared state containing the full memory
+/// slice and a pointer to the start of the region visible by the handle.
+/// `Bytes` also tracks the length of its view into the memory.
+///
+/// # Sharing
+///
+/// `Bytes` contains a vtable, which allows implementations of `Bytes` to define
+/// how sharing/cloneing is implemented in detail.
+/// When `Bytes::clone()` is called, `Bytes` will call the vtable function for
+/// cloning the backing storage in order to share it behind between multiple
+/// `Bytes` instances.
+///
+/// For `Bytes` implementations which refer to constant memory (e.g. created
+/// via `Bytes::from_static()`) the cloning implementation will be a no-op.
+///
+/// For `Bytes` implementations which point to a reference counted shared storage
+/// (e.g. an `Arc<[u8]>`), sharing will be implemented by increasing the
+/// the reference count.
+///
+/// Due to this mechanism, multiple `Bytes` instances may point to the same
+/// shared memory region.
+/// Each `Bytes` instance can point to different sections within that
+/// memory region, and `Bytes` instances may or may not have overlapping views
+/// into the memory.
+///
+/// The following diagram visualizes a scenario where 2 `Bytes` instances make
+/// use of an `Arc`-based backing storage, and provide access to different views:
+///
+/// ```text
+///
+///    Arc ptrs                   +---------+
+///    ________________________ / | Bytes 2 |
+///   /                           +---------+
+///  /          +-----------+     |         |
+/// |_________/ |  Bytes 1  |     |         |
+/// |           +-----------+     |         |
+/// |           |           | ___/ data     | tail
+/// |      data |      tail |/              |
+/// v           v           v               v
+/// +-----+---------------------------------+-----+
+/// | Arc |     |           |               |     |
+/// +-----+---------------------------------+-----+
+/// ```
+pub struct Bytes {
+    ptr: *const u8,
+    len: usize,
+    // inlined "trait object"
+    data: AtomicPtr<()>,
+    vtable: &'static Vtable,
+}
+
+pub(crate) struct Vtable {
+    /// fn(data, ptr, len)
+    pub clone: unsafe fn(&AtomicPtr<()>, *const u8, usize) -> Bytes,
+    /// fn(data, ptr, len)
+    pub drop: unsafe fn(&mut AtomicPtr<()>, *const u8, usize),
+}
+
+impl Bytes {
+    /// Creates a new empty `Bytes`.
+    ///
+    /// This will not allocate and the returned `Bytes` handle will be empty.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let b = Bytes::new();
+    /// assert_eq!(&b[..], b"");
+    /// ```
+    #[inline]
+    #[cfg(not(all(loom, test)))]
+    pub const fn new() -> Bytes {
+        // Make it a named const to work around
+        // "unsizing casts are not allowed in const fn"
+        const EMPTY: &[u8] = &[];
+        Bytes::from_static(EMPTY)
+    }
+
+    #[cfg(all(loom, test))]
+    pub fn new() -> Bytes {
+        const EMPTY: &[u8] = &[];
+        Bytes::from_static(EMPTY)
+    }
+
+    /// Creates a new `Bytes` from a static slice.
+    ///
+    /// The returned `Bytes` will point directly to the static slice. There is
+    /// no allocating or copying.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let b = Bytes::from_static(b"hello");
+    /// assert_eq!(&b[..], b"hello");
+    /// ```
+    #[inline]
+    #[cfg(not(all(loom, test)))]
+    pub const fn from_static(bytes: &'static [u8]) -> Bytes {
+        Bytes {
+            ptr: bytes.as_ptr(),
+            len: bytes.len(),
+            data: AtomicPtr::new(ptr::null_mut()),
+            vtable: &STATIC_VTABLE,
+        }
+    }
+
+    #[cfg(all(loom, test))]
+    pub fn from_static(bytes: &'static [u8]) -> Bytes {
+        Bytes {
+            ptr: bytes.as_ptr(),
+            len: bytes.len(),
+            data: AtomicPtr::new(ptr::null_mut()),
+            vtable: &STATIC_VTABLE,
+        }
+    }
+
+    /// Returns the number of bytes contained in this `Bytes`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let b = Bytes::from(&b"hello"[..]);
+    /// assert_eq!(b.len(), 5);
+    /// ```
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.len
+    }
+
+    /// Returns true if the `Bytes` has a length of 0.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let b = Bytes::new();
+    /// assert!(b.is_empty());
+    /// ```
+    #[inline]
+    pub fn is_empty(&self) -> bool {
+        self.len == 0
+    }
+
+    /// Creates `Bytes` instance from slice, by copying it.
+    pub fn copy_from_slice(data: &[u8]) -> Self {
+        data.to_vec().into()
+    }
+
+    /// Returns a slice of self for the provided range.
+    ///
+    /// This will increment the reference count for the underlying memory and
+    /// return a new `Bytes` handle set to the slice.
+    ///
+    /// This operation is `O(1)`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let a = Bytes::from(&b"hello world"[..]);
+    /// let b = a.slice(2..5);
+    ///
+    /// assert_eq!(&b[..], b"llo");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Requires that `begin <= end` and `end <= self.len()`, otherwise slicing
+    /// will panic.
+    pub fn slice(&self, range: impl RangeBounds<usize>) -> Bytes {
+        use core::ops::Bound;
+
+        let len = self.len();
+
+        let begin = match range.start_bound() {
+            Bound::Included(&n) => n,
+            Bound::Excluded(&n) => n + 1,
+            Bound::Unbounded => 0,
+        };
+
+        let end = match range.end_bound() {
+            Bound::Included(&n) => n.checked_add(1).expect("out of range"),
+            Bound::Excluded(&n) => n,
+            Bound::Unbounded => len,
+        };
+
+        assert!(
+            begin <= end,
+            "range start must not be greater than end: {:?} <= {:?}",
+            begin,
+            end,
+        );
+        assert!(
+            end <= len,
+            "range end out of bounds: {:?} <= {:?}",
+            end,
+            len,
+        );
+
+        if end == begin {
+            return Bytes::new();
+        }
+
+        let mut ret = self.clone();
+
+        ret.len = end - begin;
+        ret.ptr = unsafe { ret.ptr.offset(begin as isize) };
+
+        ret
+    }
+
+    /// Returns a slice of self that is equivalent to the given `subset`.
+    ///
+    /// When processing a `Bytes` buffer with other tools, one often gets a
+    /// `&[u8]` which is in fact a slice of the `Bytes`, i.e. a subset of it.
+    /// This function turns that `&[u8]` into another `Bytes`, as if one had
+    /// called `self.slice()` with the offsets that correspond to `subset`.
+    ///
+    /// This operation is `O(1)`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let bytes = Bytes::from(&b"012345678"[..]);
+    /// let as_slice = bytes.as_ref();
+    /// let subset = &as_slice[2..6];
+    /// let subslice = bytes.slice_ref(&subset);
+    /// assert_eq!(&subslice[..], b"2345");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Requires that the given `sub` slice is in fact contained within the
+    /// `Bytes` buffer; otherwise this function will panic.
+    pub fn slice_ref(&self, subset: &[u8]) -> Bytes {
+        // Empty slice and empty Bytes may have their pointers reset
+        // so explicitly allow empty slice to be a subslice of any slice.
+        if subset.is_empty() {
+            return Bytes::new();
+        }
+
+        let bytes_p = self.as_ptr() as usize;
+        let bytes_len = self.len();
+
+        let sub_p = subset.as_ptr() as usize;
+        let sub_len = subset.len();
+
+        assert!(
+            sub_p >= bytes_p,
+            "subset pointer ({:p}) is smaller than self pointer ({:p})",
+            sub_p as *const u8,
+            bytes_p as *const u8,
+        );
+        assert!(
+            sub_p + sub_len <= bytes_p + bytes_len,
+            "subset is out of bounds: self = ({:p}, {}), subset = ({:p}, {})",
+            bytes_p as *const u8,
+            bytes_len,
+            sub_p as *const u8,
+            sub_len,
+        );
+
+        let sub_offset = sub_p - bytes_p;
+
+        self.slice(sub_offset..(sub_offset + sub_len))
+    }
+
+    /// Splits the bytes into two at the given index.
+    ///
+    /// Afterwards `self` contains elements `[0, at)`, and the returned `Bytes`
+    /// contains elements `[at, len)`.
+    ///
+    /// This is an `O(1)` operation that just increases the reference count and
+    /// sets a few indices.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let mut a = Bytes::from(&b"hello world"[..]);
+    /// let b = a.split_off(5);
+    ///
+    /// assert_eq!(&a[..], b"hello");
+    /// assert_eq!(&b[..], b" world");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    #[must_use = "consider Bytes::truncate if you don't need the other half"]
+    pub fn split_off(&mut self, at: usize) -> Bytes {
+        assert!(
+            at <= self.len(),
+            "split_off out of bounds: {:?} <= {:?}",
+            at,
+            self.len(),
+        );
+
+        if at == self.len() {
+            return Bytes::new();
+        }
+
+        if at == 0 {
+            return mem::replace(self, Bytes::new());
+        }
+
+        let mut ret = self.clone();
+
+        self.len = at;
+
+        unsafe { ret.inc_start(at) };
+
+        ret
+    }
+
+    /// Splits the bytes into two at the given index.
+    ///
+    /// Afterwards `self` contains elements `[at, len)`, and the returned
+    /// `Bytes` contains elements `[0, at)`.
+    ///
+    /// This is an `O(1)` operation that just increases the reference count and
+    /// sets a few indices.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let mut a = Bytes::from(&b"hello world"[..]);
+    /// let b = a.split_to(5);
+    ///
+    /// assert_eq!(&a[..], b" world");
+    /// assert_eq!(&b[..], b"hello");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    #[must_use = "consider Bytes::advance if you don't need the other half"]
+    pub fn split_to(&mut self, at: usize) -> Bytes {
+        assert!(
+            at <= self.len(),
+            "split_to out of bounds: {:?} <= {:?}",
+            at,
+            self.len(),
+        );
+
+        if at == self.len() {
+            return mem::replace(self, Bytes::new());
+        }
+
+        if at == 0 {
+            return Bytes::new();
+        }
+
+        let mut ret = self.clone();
+
+        unsafe { self.inc_start(at) };
+
+        ret.len = at;
+        ret
+    }
+
+    /// Shortens the buffer, keeping the first `len` bytes and dropping the
+    /// rest.
+    ///
+    /// If `len` is greater than the buffer's current length, this has no
+    /// effect.
+    ///
+    /// The [`split_off`] method can emulate `truncate`, but this causes the
+    /// excess bytes to be returned instead of dropped.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let mut buf = Bytes::from(&b"hello world"[..]);
+    /// buf.truncate(5);
+    /// assert_eq!(buf, b"hello"[..]);
+    /// ```
+    ///
+    /// [`split_off`]: #method.split_off
+    #[inline]
+    pub fn truncate(&mut self, len: usize) {
+        if len < self.len {
+            // The Vec "promotable" vtables do not store the capacity,
+            // so we cannot truncate while using this repr. We *have* to
+            // promote using `split_off` so the capacity can be stored.
+            if self.vtable as *const Vtable == &PROMOTABLE_EVEN_VTABLE
+                || self.vtable as *const Vtable == &PROMOTABLE_ODD_VTABLE
+            {
+                drop(self.split_off(len));
+            } else {
+                self.len = len;
+            }
+        }
+    }
+
+    /// Clears the buffer, removing all data.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::Bytes;
+    ///
+    /// let mut buf = Bytes::from(&b"hello world"[..]);
+    /// buf.clear();
+    /// assert!(buf.is_empty());
+    /// ```
+    #[inline]
+    pub fn clear(&mut self) {
+        self.truncate(0);
+    }
+
+    #[inline]
+    pub(crate) unsafe fn with_vtable(
+        ptr: *const u8,
+        len: usize,
+        data: AtomicPtr<()>,
+        vtable: &'static Vtable,
+    ) -> Bytes {
+        Bytes {
+            ptr,
+            len,
+            data,
+            vtable,
+        }
+    }
+
+    // private
+
+    #[inline]
+    fn as_slice(&self) -> &[u8] {
+        unsafe { slice::from_raw_parts(self.ptr, self.len) }
+    }
+
+    #[inline]
+    unsafe fn inc_start(&mut self, by: usize) {
+        // should already be asserted, but debug assert for tests
+        debug_assert!(self.len >= by, "internal: inc_start out of bounds");
+        self.len -= by;
+        self.ptr = self.ptr.offset(by as isize);
+    }
+}
+
+// Vtable must enforce this behavior
+unsafe impl Send for Bytes {}
+unsafe impl Sync for Bytes {}
+
+impl Drop for Bytes {
+    #[inline]
+    fn drop(&mut self) {
+        unsafe { (self.vtable.drop)(&mut self.data, self.ptr, self.len) }
+    }
+}
+
+impl Clone for Bytes {
+    #[inline]
+    fn clone(&self) -> Bytes {
+        unsafe { (self.vtable.clone)(&self.data, self.ptr, self.len) }
+    }
+}
+
+impl Buf for Bytes {
+    #[inline]
+    fn remaining(&self) -> usize {
+        self.len()
+    }
+
+    #[inline]
+    fn chunk(&self) -> &[u8] {
+        self.as_slice()
+    }
+
+    #[inline]
+    fn advance(&mut self, cnt: usize) {
+        assert!(
+            cnt <= self.len(),
+            "cannot advance past `remaining`: {:?} <= {:?}",
+            cnt,
+            self.len(),
+        );
+
+        unsafe {
+            self.inc_start(cnt);
+        }
+    }
+
+    fn copy_to_bytes(&mut self, len: usize) -> crate::Bytes {
+        if len == self.remaining() {
+            core::mem::replace(self, Bytes::new())
+        } else {
+            let ret = self.slice(..len);
+            self.advance(len);
+            ret
+        }
+    }
+}
+
+impl Deref for Bytes {
+    type Target = [u8];
+
+    #[inline]
+    fn deref(&self) -> &[u8] {
+        self.as_slice()
+    }
+}
+
+impl AsRef<[u8]> for Bytes {
+    #[inline]
+    fn as_ref(&self) -> &[u8] {
+        self.as_slice()
+    }
+}
+
+impl hash::Hash for Bytes {
+    fn hash<H>(&self, state: &mut H)
+    where
+        H: hash::Hasher,
+    {
+        self.as_slice().hash(state);
+    }
+}
+
+impl Borrow<[u8]> for Bytes {
+    fn borrow(&self) -> &[u8] {
+        self.as_slice()
+    }
+}
+
+impl IntoIterator for Bytes {
+    type Item = u8;
+    type IntoIter = IntoIter<Bytes>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        IntoIter::new(self)
+    }
+}
+
+impl<'a> IntoIterator for &'a Bytes {
+    type Item = &'a u8;
+    type IntoIter = core::slice::Iter<'a, u8>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        self.as_slice().into_iter()
+    }
+}
+
+impl FromIterator<u8> for Bytes {
+    fn from_iter<T: IntoIterator<Item = u8>>(into_iter: T) -> Self {
+        Vec::from_iter(into_iter).into()
+    }
+}
+
+// impl Eq
+
+impl PartialEq for Bytes {
+    fn eq(&self, other: &Bytes) -> bool {
+        self.as_slice() == other.as_slice()
+    }
+}
+
+impl PartialOrd for Bytes {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        self.as_slice().partial_cmp(other.as_slice())
+    }
+}
+
+impl Ord for Bytes {
+    fn cmp(&self, other: &Bytes) -> cmp::Ordering {
+        self.as_slice().cmp(other.as_slice())
+    }
+}
+
+impl Eq for Bytes {}
+
+impl PartialEq<[u8]> for Bytes {
+    fn eq(&self, other: &[u8]) -> bool {
+        self.as_slice() == other
+    }
+}
+
+impl PartialOrd<[u8]> for Bytes {
+    fn partial_cmp(&self, other: &[u8]) -> Option<cmp::Ordering> {
+        self.as_slice().partial_cmp(other)
+    }
+}
+
+impl PartialEq<Bytes> for [u8] {
+    fn eq(&self, other: &Bytes) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<Bytes> for [u8] {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other)
+    }
+}
+
+impl PartialEq<str> for Bytes {
+    fn eq(&self, other: &str) -> bool {
+        self.as_slice() == other.as_bytes()
+    }
+}
+
+impl PartialOrd<str> for Bytes {
+    fn partial_cmp(&self, other: &str) -> Option<cmp::Ordering> {
+        self.as_slice().partial_cmp(other.as_bytes())
+    }
+}
+
+impl PartialEq<Bytes> for str {
+    fn eq(&self, other: &Bytes) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<Bytes> for str {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other)
+    }
+}
+
+impl PartialEq<Vec<u8>> for Bytes {
+    fn eq(&self, other: &Vec<u8>) -> bool {
+        *self == &other[..]
+    }
+}
+
+impl PartialOrd<Vec<u8>> for Bytes {
+    fn partial_cmp(&self, other: &Vec<u8>) -> Option<cmp::Ordering> {
+        self.as_slice().partial_cmp(&other[..])
+    }
+}
+
+impl PartialEq<Bytes> for Vec<u8> {
+    fn eq(&self, other: &Bytes) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<Bytes> for Vec<u8> {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other)
+    }
+}
+
+impl PartialEq<String> for Bytes {
+    fn eq(&self, other: &String) -> bool {
+        *self == &other[..]
+    }
+}
+
+impl PartialOrd<String> for Bytes {
+    fn partial_cmp(&self, other: &String) -> Option<cmp::Ordering> {
+        self.as_slice().partial_cmp(other.as_bytes())
+    }
+}
+
+impl PartialEq<Bytes> for String {
+    fn eq(&self, other: &Bytes) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<Bytes> for String {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other)
+    }
+}
+
+impl PartialEq<Bytes> for &[u8] {
+    fn eq(&self, other: &Bytes) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<Bytes> for &[u8] {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other)
+    }
+}
+
+impl PartialEq<Bytes> for &str {
+    fn eq(&self, other: &Bytes) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<Bytes> for &str {
+    fn partial_cmp(&self, other: &Bytes) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other)
+    }
+}
+
+impl<'a, T: ?Sized> PartialEq<&'a T> for Bytes
+where
+    Bytes: PartialEq<T>,
+{
+    fn eq(&self, other: &&'a T) -> bool {
+        *self == **other
+    }
+}
+
+impl<'a, T: ?Sized> PartialOrd<&'a T> for Bytes
+where
+    Bytes: PartialOrd<T>,
+{
+    fn partial_cmp(&self, other: &&'a T) -> Option<cmp::Ordering> {
+        self.partial_cmp(&**other)
+    }
+}
+
+// impl From
+
+impl Default for Bytes {
+    #[inline]
+    fn default() -> Bytes {
+        Bytes::new()
+    }
+}
+
+impl From<&'static [u8]> for Bytes {
+    fn from(slice: &'static [u8]) -> Bytes {
+        Bytes::from_static(slice)
+    }
+}
+
+impl From<&'static str> for Bytes {
+    fn from(slice: &'static str) -> Bytes {
+        Bytes::from_static(slice.as_bytes())
+    }
+}
+
+impl From<Vec<u8>> for Bytes {
+    fn from(vec: Vec<u8>) -> Bytes {
+        let slice = vec.into_boxed_slice();
+        slice.into()
+    }
+}
+
+impl From<Box<[u8]>> for Bytes {
+    fn from(slice: Box<[u8]>) -> Bytes {
+        // Box<[u8]> doesn't contain a heap allocation for empty slices,
+        // so the pointer isn't aligned enough for the KIND_VEC stashing to
+        // work.
+        if slice.is_empty() {
+            return Bytes::new();
+        }
+
+        let len = slice.len();
+        let ptr = Box::into_raw(slice) as *mut u8;
+
+        if ptr as usize & 0x1 == 0 {
+            let data = ptr as usize | KIND_VEC;
+            Bytes {
+                ptr,
+                len,
+                data: AtomicPtr::new(data as *mut _),
+                vtable: &PROMOTABLE_EVEN_VTABLE,
+            }
+        } else {
+            Bytes {
+                ptr,
+                len,
+                data: AtomicPtr::new(ptr as *mut _),
+                vtable: &PROMOTABLE_ODD_VTABLE,
+            }
+        }
+    }
+}
+
+impl From<String> for Bytes {
+    fn from(s: String) -> Bytes {
+        Bytes::from(s.into_bytes())
+    }
+}
+
+// ===== impl Vtable =====
+
+impl fmt::Debug for Vtable {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("Vtable")
+            .field("clone", &(self.clone as *const ()))
+            .field("drop", &(self.drop as *const ()))
+            .finish()
+    }
+}
+
+// ===== impl StaticVtable =====
+
+const STATIC_VTABLE: Vtable = Vtable {
+    clone: static_clone,
+    drop: static_drop,
+};
+
+unsafe fn static_clone(_: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Bytes {
+    let slice = slice::from_raw_parts(ptr, len);
+    Bytes::from_static(slice)
+}
+
+unsafe fn static_drop(_: &mut AtomicPtr<()>, _: *const u8, _: usize) {
+    // nothing to drop for &'static [u8]
+}
+
+// ===== impl PromotableVtable =====
+
+static PROMOTABLE_EVEN_VTABLE: Vtable = Vtable {
+    clone: promotable_even_clone,
+    drop: promotable_even_drop,
+};
+
+static PROMOTABLE_ODD_VTABLE: Vtable = Vtable {
+    clone: promotable_odd_clone,
+    drop: promotable_odd_drop,
+};
+
+unsafe fn promotable_even_clone(data: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Bytes {
+    let shared = data.load(Ordering::Acquire);
+    let kind = shared as usize & KIND_MASK;
+
+    if kind == KIND_ARC {
+        shallow_clone_arc(shared as _, ptr, len)
+    } else {
+        debug_assert_eq!(kind, KIND_VEC);
+        let buf = (shared as usize & !KIND_MASK) as *mut u8;
+        shallow_clone_vec(data, shared, buf, ptr, len)
+    }
+}
+
+unsafe fn promotable_even_drop(data: &mut AtomicPtr<()>, ptr: *const u8, len: usize) {
+    data.with_mut(|shared| {
+        let shared = *shared;
+        let kind = shared as usize & KIND_MASK;
+
+        if kind == KIND_ARC {
+            release_shared(shared as *mut Shared);
+        } else {
+            debug_assert_eq!(kind, KIND_VEC);
+            let buf = (shared as usize & !KIND_MASK) as *mut u8;
+            drop(rebuild_boxed_slice(buf, ptr, len));
+        }
+    });
+}
+
+unsafe fn promotable_odd_clone(data: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Bytes {
+    let shared = data.load(Ordering::Acquire);
+    let kind = shared as usize & KIND_MASK;
+
+    if kind == KIND_ARC {
+        shallow_clone_arc(shared as _, ptr, len)
+    } else {
+        debug_assert_eq!(kind, KIND_VEC);
+        shallow_clone_vec(data, shared, shared as *mut u8, ptr, len)
+    }
+}
+
+unsafe fn promotable_odd_drop(data: &mut AtomicPtr<()>, ptr: *const u8, len: usize) {
+    data.with_mut(|shared| {
+        let shared = *shared;
+        let kind = shared as usize & KIND_MASK;
+
+        if kind == KIND_ARC {
+            release_shared(shared as *mut Shared);
+        } else {
+            debug_assert_eq!(kind, KIND_VEC);
+
+            drop(rebuild_boxed_slice(shared as *mut u8, ptr, len));
+        }
+    });
+}
+
+unsafe fn rebuild_boxed_slice(buf: *mut u8, offset: *const u8, len: usize) -> Box<[u8]> {
+    let cap = (offset as usize - buf as usize) + len;
+    Box::from_raw(slice::from_raw_parts_mut(buf, cap))
+}
+
+// ===== impl SharedVtable =====
+
+struct Shared {
+    // holds vec for drop, but otherwise doesnt access it
+    _vec: Vec<u8>,
+    ref_cnt: AtomicUsize,
+}
+
+// Assert that the alignment of `Shared` is divisible by 2.
+// This is a necessary invariant since we depend on allocating `Shared` a
+// shared object to implicitly carry the `KIND_ARC` flag in its pointer.
+// This flag is set when the LSB is 0.
+const _: [(); 0 - mem::align_of::<Shared>() % 2] = []; // Assert that the alignment of `Shared` is divisible by 2.
+
+static SHARED_VTABLE: Vtable = Vtable {
+    clone: shared_clone,
+    drop: shared_drop,
+};
+
+const KIND_ARC: usize = 0b0;
+const KIND_VEC: usize = 0b1;
+const KIND_MASK: usize = 0b1;
+
+unsafe fn shared_clone(data: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Bytes {
+    let shared = data.load(Ordering::Relaxed);
+    shallow_clone_arc(shared as _, ptr, len)
+}
+
+unsafe fn shared_drop(data: &mut AtomicPtr<()>, _ptr: *const u8, _len: usize) {
+    data.with_mut(|shared| {
+        release_shared(*shared as *mut Shared);
+    });
+}
+
+unsafe fn shallow_clone_arc(shared: *mut Shared, ptr: *const u8, len: usize) -> Bytes {
+    let old_size = (*shared).ref_cnt.fetch_add(1, Ordering::Relaxed);
+
+    if old_size > usize::MAX >> 1 {
+        crate::abort();
+    }
+
+    Bytes {
+        ptr,
+        len,
+        data: AtomicPtr::new(shared as _),
+        vtable: &SHARED_VTABLE,
+    }
+}
+
+#[cold]
+unsafe fn shallow_clone_vec(
+    atom: &AtomicPtr<()>,
+    ptr: *const (),
+    buf: *mut u8,
+    offset: *const u8,
+    len: usize,
+) -> Bytes {
+    // If  the buffer is still tracked in a `Vec<u8>`. It is time to
+    // promote the vec to an `Arc`. This could potentially be called
+    // concurrently, so some care must be taken.
+
+    // First, allocate a new `Shared` instance containing the
+    // `Vec` fields. It's important to note that `ptr`, `len`,
+    // and `cap` cannot be mutated without having `&mut self`.
+    // This means that these fields will not be concurrently
+    // updated and since the buffer hasn't been promoted to an
+    // `Arc`, those three fields still are the components of the
+    // vector.
+    let vec = rebuild_boxed_slice(buf, offset, len).into_vec();
+    let shared = Box::new(Shared {
+        _vec: vec,
+        // Initialize refcount to 2. One for this reference, and one
+        // for the new clone that will be returned from
+        // `shallow_clone`.
+        ref_cnt: AtomicUsize::new(2),
+    });
+
+    let shared = Box::into_raw(shared);
+
+    // The pointer should be aligned, so this assert should
+    // always succeed.
+    debug_assert!(
+        0 == (shared as usize & KIND_MASK),
+        "internal: Box<Shared> should have an aligned pointer",
+    );
+
+    // Try compare & swapping the pointer into the `arc` field.
+    // `Release` is used synchronize with other threads that
+    // will load the `arc` field.
+    //
+    // If the `compare_exchange` fails, then the thread lost the
+    // race to promote the buffer to shared. The `Acquire`
+    // ordering will synchronize with the `compare_exchange`
+    // that happened in the other thread and the `Shared`
+    // pointed to by `actual` will be visible.
+    match atom.compare_exchange(ptr as _, shared as _, Ordering::AcqRel, Ordering::Acquire) {
+        Ok(actual) => {
+            debug_assert!(actual as usize == ptr as usize);
+            // The upgrade was successful, the new handle can be
+            // returned.
+            Bytes {
+                ptr: offset,
+                len,
+                data: AtomicPtr::new(shared as _),
+                vtable: &SHARED_VTABLE,
+            }
+        }
+        Err(actual) => {
+            // The upgrade failed, a concurrent clone happened. Release
+            // the allocation that was made in this thread, it will not
+            // be needed.
+            let shared = Box::from_raw(shared);
+            mem::forget(*shared);
+
+            // Buffer already promoted to shared storage, so increment ref
+            // count.
+            shallow_clone_arc(actual as _, offset, len)
+        }
+    }
+}
+
+unsafe fn release_shared(ptr: *mut Shared) {
+    // `Shared` storage... follow the drop steps from Arc.
+    if (*ptr).ref_cnt.fetch_sub(1, Ordering::Release) != 1 {
+        return;
+    }
+
+    // This fence is needed to prevent reordering of use of the data and
+    // deletion of the data.  Because it is marked `Release`, the decreasing
+    // of the reference count synchronizes with this `Acquire` fence. This
+    // means that use of the data happens before decreasing the reference
+    // count, which happens before this fence, which happens before the
+    // deletion of the data.
+    //
+    // As explained in the [Boost documentation][1],
+    //
+    // > It is important to enforce any possible access to the object in one
+    // > thread (through an existing reference) to *happen before* deleting
+    // > the object in a different thread. This is achieved by a "release"
+    // > operation after dropping a reference (any access to the object
+    // > through this reference must obviously happened before), and an
+    // > "acquire" operation before deleting the object.
+    //
+    // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
+    atomic::fence(Ordering::Acquire);
+
+    // Drop the data
+    Box::from_raw(ptr);
+}
+
+// compile-fails
+
+/// ```compile_fail
+/// use bytes::Bytes;
+/// #[deny(unused_must_use)]
+/// {
+///     let mut b1 = Bytes::from("hello world");
+///     b1.split_to(6);
+/// }
+/// ```
+fn _split_to_must_use() {}
+
+/// ```compile_fail
+/// use bytes::Bytes;
+/// #[deny(unused_must_use)]
+/// {
+///     let mut b1 = Bytes::from("hello world");
+///     b1.split_off(6);
+/// }
+/// ```
+fn _split_off_must_use() {}
+
+// fuzz tests
+#[cfg(all(test, loom))]
+mod fuzz {
+    use loom::sync::Arc;
+    use loom::thread;
+
+    use super::Bytes;
+    #[test]
+    fn bytes_cloning_vec() {
+        loom::model(|| {
+            let a = Bytes::from(b"abcdefgh".to_vec());
+            let addr = a.as_ptr() as usize;
+
+            // test the Bytes::clone is Sync by putting it in an Arc
+            let a1 = Arc::new(a);
+            let a2 = a1.clone();
+
+            let t1 = thread::spawn(move || {
+                let b: Bytes = (*a1).clone();
+                assert_eq!(b.as_ptr() as usize, addr);
+            });
+
+            let t2 = thread::spawn(move || {
+                let b: Bytes = (*a2).clone();
+                assert_eq!(b.as_ptr() as usize, addr);
+            });
+
+            t1.join().unwrap();
+            t2.join().unwrap();
+        });
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/bytes_mut.rs b/android/vendor/bytes-1.1.0/src/bytes_mut.rs
new file mode 100644
index 0000000..147484d
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/bytes_mut.rs
@@ -0,0 +1,1598 @@
+use core::iter::{FromIterator, Iterator};
+use core::mem::{self, ManuallyDrop};
+use core::ops::{Deref, DerefMut};
+use core::ptr::{self, NonNull};
+use core::{cmp, fmt, hash, isize, slice, usize};
+
+use alloc::{
+    borrow::{Borrow, BorrowMut},
+    boxed::Box,
+    string::String,
+    vec::Vec,
+};
+
+use crate::buf::{IntoIter, UninitSlice};
+use crate::bytes::Vtable;
+#[allow(unused)]
+use crate::loom::sync::atomic::AtomicMut;
+use crate::loom::sync::atomic::{self, AtomicPtr, AtomicUsize, Ordering};
+use crate::{Buf, BufMut, Bytes};
+
+/// A unique reference to a contiguous slice of memory.
+///
+/// `BytesMut` represents a unique view into a potentially shared memory region.
+/// Given the uniqueness guarantee, owners of `BytesMut` handles are able to
+/// mutate the memory.
+///
+/// `BytesMut` can be thought of as containing a `buf: Arc<Vec<u8>>`, an offset
+/// into `buf`, a slice length, and a guarantee that no other `BytesMut` for the
+/// same `buf` overlaps with its slice. That guarantee means that a write lock
+/// is not required.
+///
+/// # Growth
+///
+/// `BytesMut`'s `BufMut` implementation will implicitly grow its buffer as
+/// necessary. However, explicitly reserving the required space up-front before
+/// a series of inserts will be more efficient.
+///
+/// # Examples
+///
+/// ```
+/// use bytes::{BytesMut, BufMut};
+///
+/// let mut buf = BytesMut::with_capacity(64);
+///
+/// buf.put_u8(b'h');
+/// buf.put_u8(b'e');
+/// buf.put(&b"llo"[..]);
+///
+/// assert_eq!(&buf[..], b"hello");
+///
+/// // Freeze the buffer so that it can be shared
+/// let a = buf.freeze();
+///
+/// // This does not allocate, instead `b` points to the same memory.
+/// let b = a.clone();
+///
+/// assert_eq!(&a[..], b"hello");
+/// assert_eq!(&b[..], b"hello");
+/// ```
+pub struct BytesMut {
+    ptr: NonNull<u8>,
+    len: usize,
+    cap: usize,
+    data: *mut Shared,
+}
+
+// Thread-safe reference-counted container for the shared storage. This mostly
+// the same as `core::sync::Arc` but without the weak counter. The ref counting
+// fns are based on the ones found in `std`.
+//
+// The main reason to use `Shared` instead of `core::sync::Arc` is that it ends
+// up making the overall code simpler and easier to reason about. This is due to
+// some of the logic around setting `Inner::arc` and other ways the `arc` field
+// is used. Using `Arc` ended up requiring a number of funky transmutes and
+// other shenanigans to make it work.
+struct Shared {
+    vec: Vec<u8>,
+    original_capacity_repr: usize,
+    ref_count: AtomicUsize,
+}
+
+// Buffer storage strategy flags.
+const KIND_ARC: usize = 0b0;
+const KIND_VEC: usize = 0b1;
+const KIND_MASK: usize = 0b1;
+
+// The max original capacity value. Any `Bytes` allocated with a greater initial
+// capacity will default to this.
+const MAX_ORIGINAL_CAPACITY_WIDTH: usize = 17;
+// The original capacity algorithm will not take effect unless the originally
+// allocated capacity was at least 1kb in size.
+const MIN_ORIGINAL_CAPACITY_WIDTH: usize = 10;
+// The original capacity is stored in powers of 2 starting at 1kb to a max of
+// 64kb. Representing it as such requires only 3 bits of storage.
+const ORIGINAL_CAPACITY_MASK: usize = 0b11100;
+const ORIGINAL_CAPACITY_OFFSET: usize = 2;
+
+// When the storage is in the `Vec` representation, the pointer can be advanced
+// at most this value. This is due to the amount of storage available to track
+// the offset is usize - number of KIND bits and number of ORIGINAL_CAPACITY
+// bits.
+const VEC_POS_OFFSET: usize = 5;
+const MAX_VEC_POS: usize = usize::MAX >> VEC_POS_OFFSET;
+const NOT_VEC_POS_MASK: usize = 0b11111;
+
+#[cfg(target_pointer_width = "64")]
+const PTR_WIDTH: usize = 64;
+#[cfg(target_pointer_width = "32")]
+const PTR_WIDTH: usize = 32;
+
+/*
+ *
+ * ===== BytesMut =====
+ *
+ */
+
+impl BytesMut {
+    /// Creates a new `BytesMut` with the specified capacity.
+    ///
+    /// The returned `BytesMut` will be able to hold at least `capacity` bytes
+    /// without reallocating.
+    ///
+    /// It is important to note that this function does not specify the length
+    /// of the returned `BytesMut`, but only the capacity.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::{BytesMut, BufMut};
+    ///
+    /// let mut bytes = BytesMut::with_capacity(64);
+    ///
+    /// // `bytes` contains no data, even though there is capacity
+    /// assert_eq!(bytes.len(), 0);
+    ///
+    /// bytes.put(&b"hello world"[..]);
+    ///
+    /// assert_eq!(&bytes[..], b"hello world");
+    /// ```
+    #[inline]
+    pub fn with_capacity(capacity: usize) -> BytesMut {
+        BytesMut::from_vec(Vec::with_capacity(capacity))
+    }
+
+    /// Creates a new `BytesMut` with default capacity.
+    ///
+    /// Resulting object has length 0 and unspecified capacity.
+    /// This function does not allocate.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::{BytesMut, BufMut};
+    ///
+    /// let mut bytes = BytesMut::new();
+    ///
+    /// assert_eq!(0, bytes.len());
+    ///
+    /// bytes.reserve(2);
+    /// bytes.put_slice(b"xy");
+    ///
+    /// assert_eq!(&b"xy"[..], &bytes[..]);
+    /// ```
+    #[inline]
+    pub fn new() -> BytesMut {
+        BytesMut::with_capacity(0)
+    }
+
+    /// Returns the number of bytes contained in this `BytesMut`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let b = BytesMut::from(&b"hello"[..]);
+    /// assert_eq!(b.len(), 5);
+    /// ```
+    #[inline]
+    pub fn len(&self) -> usize {
+        self.len
+    }
+
+    /// Returns true if the `BytesMut` has a length of 0.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let b = BytesMut::with_capacity(64);
+    /// assert!(b.is_empty());
+    /// ```
+    #[inline]
+    pub fn is_empty(&self) -> bool {
+        self.len == 0
+    }
+
+    /// Returns the number of bytes the `BytesMut` can hold without reallocating.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let b = BytesMut::with_capacity(64);
+    /// assert_eq!(b.capacity(), 64);
+    /// ```
+    #[inline]
+    pub fn capacity(&self) -> usize {
+        self.cap
+    }
+
+    /// Converts `self` into an immutable `Bytes`.
+    ///
+    /// The conversion is zero cost and is used to indicate that the slice
+    /// referenced by the handle will no longer be mutated. Once the conversion
+    /// is done, the handle can be cloned and shared across threads.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::{BytesMut, BufMut};
+    /// use std::thread;
+    ///
+    /// let mut b = BytesMut::with_capacity(64);
+    /// b.put(&b"hello world"[..]);
+    /// let b1 = b.freeze();
+    /// let b2 = b1.clone();
+    ///
+    /// let th = thread::spawn(move || {
+    ///     assert_eq!(&b1[..], b"hello world");
+    /// });
+    ///
+    /// assert_eq!(&b2[..], b"hello world");
+    /// th.join().unwrap();
+    /// ```
+    #[inline]
+    pub fn freeze(mut self) -> Bytes {
+        if self.kind() == KIND_VEC {
+            // Just re-use `Bytes` internal Vec vtable
+            unsafe {
+                let (off, _) = self.get_vec_pos();
+                let vec = rebuild_vec(self.ptr.as_ptr(), self.len, self.cap, off);
+                mem::forget(self);
+                let mut b: Bytes = vec.into();
+                b.advance(off);
+                b
+            }
+        } else {
+            debug_assert_eq!(self.kind(), KIND_ARC);
+
+            let ptr = self.ptr.as_ptr();
+            let len = self.len;
+            let data = AtomicPtr::new(self.data as _);
+            mem::forget(self);
+            unsafe { Bytes::with_vtable(ptr, len, data, &SHARED_VTABLE) }
+        }
+    }
+
+    /// Splits the bytes into two at the given index.
+    ///
+    /// Afterwards `self` contains elements `[0, at)`, and the returned
+    /// `BytesMut` contains elements `[at, capacity)`.
+    ///
+    /// This is an `O(1)` operation that just increases the reference count
+    /// and sets a few indices.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut a = BytesMut::from(&b"hello world"[..]);
+    /// let mut b = a.split_off(5);
+    ///
+    /// a[0] = b'j';
+    /// b[0] = b'!';
+    ///
+    /// assert_eq!(&a[..], b"jello");
+    /// assert_eq!(&b[..], b"!world");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if `at > capacity`.
+    #[must_use = "consider BytesMut::truncate if you don't need the other half"]
+    pub fn split_off(&mut self, at: usize) -> BytesMut {
+        assert!(
+            at <= self.capacity(),
+            "split_off out of bounds: {:?} <= {:?}",
+            at,
+            self.capacity(),
+        );
+        unsafe {
+            let mut other = self.shallow_clone();
+            other.set_start(at);
+            self.set_end(at);
+            other
+        }
+    }
+
+    /// Removes the bytes from the current view, returning them in a new
+    /// `BytesMut` handle.
+    ///
+    /// Afterwards, `self` will be empty, but will retain any additional
+    /// capacity that it had before the operation. This is identical to
+    /// `self.split_to(self.len())`.
+    ///
+    /// This is an `O(1)` operation that just increases the reference count and
+    /// sets a few indices.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::{BytesMut, BufMut};
+    ///
+    /// let mut buf = BytesMut::with_capacity(1024);
+    /// buf.put(&b"hello world"[..]);
+    ///
+    /// let other = buf.split();
+    ///
+    /// assert!(buf.is_empty());
+    /// assert_eq!(1013, buf.capacity());
+    ///
+    /// assert_eq!(other, b"hello world"[..]);
+    /// ```
+    #[must_use = "consider BytesMut::advance(len()) if you don't need the other half"]
+    pub fn split(&mut self) -> BytesMut {
+        let len = self.len();
+        self.split_to(len)
+    }
+
+    /// Splits the buffer into two at the given index.
+    ///
+    /// Afterwards `self` contains elements `[at, len)`, and the returned `BytesMut`
+    /// contains elements `[0, at)`.
+    ///
+    /// This is an `O(1)` operation that just increases the reference count and
+    /// sets a few indices.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut a = BytesMut::from(&b"hello world"[..]);
+    /// let mut b = a.split_to(5);
+    ///
+    /// a[0] = b'!';
+    /// b[0] = b'j';
+    ///
+    /// assert_eq!(&a[..], b"!world");
+    /// assert_eq!(&b[..], b"jello");
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if `at > len`.
+    #[must_use = "consider BytesMut::advance if you don't need the other half"]
+    pub fn split_to(&mut self, at: usize) -> BytesMut {
+        assert!(
+            at <= self.len(),
+            "split_to out of bounds: {:?} <= {:?}",
+            at,
+            self.len(),
+        );
+
+        unsafe {
+            let mut other = self.shallow_clone();
+            other.set_end(at);
+            self.set_start(at);
+            other
+        }
+    }
+
+    /// Shortens the buffer, keeping the first `len` bytes and dropping the
+    /// rest.
+    ///
+    /// If `len` is greater than the buffer's current length, this has no
+    /// effect.
+    ///
+    /// Existing underlying capacity is preserved.
+    ///
+    /// The [`split_off`] method can emulate `truncate`, but this causes the
+    /// excess bytes to be returned instead of dropped.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut buf = BytesMut::from(&b"hello world"[..]);
+    /// buf.truncate(5);
+    /// assert_eq!(buf, b"hello"[..]);
+    /// ```
+    ///
+    /// [`split_off`]: #method.split_off
+    pub fn truncate(&mut self, len: usize) {
+        if len <= self.len() {
+            unsafe {
+                self.set_len(len);
+            }
+        }
+    }
+
+    /// Clears the buffer, removing all data. Existing capacity is preserved.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut buf = BytesMut::from(&b"hello world"[..]);
+    /// buf.clear();
+    /// assert!(buf.is_empty());
+    /// ```
+    pub fn clear(&mut self) {
+        self.truncate(0);
+    }
+
+    /// Resizes the buffer so that `len` is equal to `new_len`.
+    ///
+    /// If `new_len` is greater than `len`, the buffer is extended by the
+    /// difference with each additional byte set to `value`. If `new_len` is
+    /// less than `len`, the buffer is simply truncated.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut buf = BytesMut::new();
+    ///
+    /// buf.resize(3, 0x1);
+    /// assert_eq!(&buf[..], &[0x1, 0x1, 0x1]);
+    ///
+    /// buf.resize(2, 0x2);
+    /// assert_eq!(&buf[..], &[0x1, 0x1]);
+    ///
+    /// buf.resize(4, 0x3);
+    /// assert_eq!(&buf[..], &[0x1, 0x1, 0x3, 0x3]);
+    /// ```
+    pub fn resize(&mut self, new_len: usize, value: u8) {
+        let len = self.len();
+        if new_len > len {
+            let additional = new_len - len;
+            self.reserve(additional);
+            unsafe {
+                let dst = self.chunk_mut().as_mut_ptr();
+                ptr::write_bytes(dst, value, additional);
+                self.set_len(new_len);
+            }
+        } else {
+            self.truncate(new_len);
+        }
+    }
+
+    /// Sets the length of the buffer.
+    ///
+    /// This will explicitly set the size of the buffer without actually
+    /// modifying the data, so it is up to the caller to ensure that the data
+    /// has been initialized.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut b = BytesMut::from(&b"hello world"[..]);
+    ///
+    /// unsafe {
+    ///     b.set_len(5);
+    /// }
+    ///
+    /// assert_eq!(&b[..], b"hello");
+    ///
+    /// unsafe {
+    ///     b.set_len(11);
+    /// }
+    ///
+    /// assert_eq!(&b[..], b"hello world");
+    /// ```
+    #[inline]
+    pub unsafe fn set_len(&mut self, len: usize) {
+        debug_assert!(len <= self.cap, "set_len out of bounds");
+        self.len = len;
+    }
+
+    /// Reserves capacity for at least `additional` more bytes to be inserted
+    /// into the given `BytesMut`.
+    ///
+    /// More than `additional` bytes may be reserved in order to avoid frequent
+    /// reallocations. A call to `reserve` may result in an allocation.
+    ///
+    /// Before allocating new buffer space, the function will attempt to reclaim
+    /// space in the existing buffer. If the current handle references a small
+    /// view in the original buffer and all other handles have been dropped,
+    /// and the requested capacity is less than or equal to the existing
+    /// buffer's capacity, then the current view will be copied to the front of
+    /// the buffer and the handle will take ownership of the full buffer.
+    ///
+    /// # Examples
+    ///
+    /// In the following example, a new buffer is allocated.
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut buf = BytesMut::from(&b"hello"[..]);
+    /// buf.reserve(64);
+    /// assert!(buf.capacity() >= 69);
+    /// ```
+    ///
+    /// In the following example, the existing buffer is reclaimed.
+    ///
+    /// ```
+    /// use bytes::{BytesMut, BufMut};
+    ///
+    /// let mut buf = BytesMut::with_capacity(128);
+    /// buf.put(&[0; 64][..]);
+    ///
+    /// let ptr = buf.as_ptr();
+    /// let other = buf.split();
+    ///
+    /// assert!(buf.is_empty());
+    /// assert_eq!(buf.capacity(), 64);
+    ///
+    /// drop(other);
+    /// buf.reserve(128);
+    ///
+    /// assert_eq!(buf.capacity(), 128);
+    /// assert_eq!(buf.as_ptr(), ptr);
+    /// ```
+    ///
+    /// # Panics
+    ///
+    /// Panics if the new capacity overflows `usize`.
+    #[inline]
+    pub fn reserve(&mut self, additional: usize) {
+        let len = self.len();
+        let rem = self.capacity() - len;
+
+        if additional <= rem {
+            // The handle can already store at least `additional` more bytes, so
+            // there is no further work needed to be done.
+            return;
+        }
+
+        self.reserve_inner(additional);
+    }
+
+    // In separate function to allow the short-circuits in `reserve` to
+    // be inline-able. Significant helps performance.
+    fn reserve_inner(&mut self, additional: usize) {
+        let len = self.len();
+        let kind = self.kind();
+
+        if kind == KIND_VEC {
+            // If there's enough free space before the start of the buffer, then
+            // just copy the data backwards and reuse the already-allocated
+            // space.
+            //
+            // Otherwise, since backed by a vector, use `Vec::reserve`
+            unsafe {
+                let (off, prev) = self.get_vec_pos();
+
+                // Only reuse space if we can satisfy the requested additional space.
+                if self.capacity() - self.len() + off >= additional {
+                    // There's space - reuse it
+                    //
+                    // Just move the pointer back to the start after copying
+                    // data back.
+                    let base_ptr = self.ptr.as_ptr().offset(-(off as isize));
+                    ptr::copy(self.ptr.as_ptr(), base_ptr, self.len);
+                    self.ptr = vptr(base_ptr);
+                    self.set_vec_pos(0, prev);
+
+                    // Length stays constant, but since we moved backwards we
+                    // can gain capacity back.
+                    self.cap += off;
+                } else {
+                    // No space - allocate more
+                    let mut v =
+                        ManuallyDrop::new(rebuild_vec(self.ptr.as_ptr(), self.len, self.cap, off));
+                    v.reserve(additional);
+
+                    // Update the info
+                    self.ptr = vptr(v.as_mut_ptr().offset(off as isize));
+                    self.len = v.len() - off;
+                    self.cap = v.capacity() - off;
+                }
+
+                return;
+            }
+        }
+
+        debug_assert_eq!(kind, KIND_ARC);
+        let shared: *mut Shared = self.data as _;
+
+        // Reserving involves abandoning the currently shared buffer and
+        // allocating a new vector with the requested capacity.
+        //
+        // Compute the new capacity
+        let mut new_cap = len.checked_add(additional).expect("overflow");
+
+        let original_capacity;
+        let original_capacity_repr;
+
+        unsafe {
+            original_capacity_repr = (*shared).original_capacity_repr;
+            original_capacity = original_capacity_from_repr(original_capacity_repr);
+
+            // First, try to reclaim the buffer. This is possible if the current
+            // handle is the only outstanding handle pointing to the buffer.
+            if (*shared).is_unique() {
+                // This is the only handle to the buffer. It can be reclaimed.
+                // However, before doing the work of copying data, check to make
+                // sure that the vector has enough capacity.
+                let v = &mut (*shared).vec;
+
+                if v.capacity() >= new_cap {
+                    // The capacity is sufficient, reclaim the buffer
+                    let ptr = v.as_mut_ptr();
+
+                    ptr::copy(self.ptr.as_ptr(), ptr, len);
+
+                    self.ptr = vptr(ptr);
+                    self.cap = v.capacity();
+
+                    return;
+                }
+
+                // The vector capacity is not sufficient. The reserve request is
+                // asking for more than the initial buffer capacity. Allocate more
+                // than requested if `new_cap` is not much bigger than the current
+                // capacity.
+                //
+                // There are some situations, using `reserve_exact` that the
+                // buffer capacity could be below `original_capacity`, so do a
+                // check.
+                let double = v.capacity().checked_shl(1).unwrap_or(new_cap);
+
+                new_cap = cmp::max(cmp::max(double, new_cap), original_capacity);
+            } else {
+                new_cap = cmp::max(new_cap, original_capacity);
+            }
+        }
+
+        // Create a new vector to store the data
+        let mut v = ManuallyDrop::new(Vec::with_capacity(new_cap));
+
+        // Copy the bytes
+        v.extend_from_slice(self.as_ref());
+
+        // Release the shared handle. This must be done *after* the bytes are
+        // copied.
+        unsafe { release_shared(shared) };
+
+        // Update self
+        let data = (original_capacity_repr << ORIGINAL_CAPACITY_OFFSET) | KIND_VEC;
+        self.data = data as _;
+        self.ptr = vptr(v.as_mut_ptr());
+        self.len = v.len();
+        self.cap = v.capacity();
+    }
+
+    /// Appends given bytes to this `BytesMut`.
+    ///
+    /// If this `BytesMut` object does not have enough capacity, it is resized
+    /// first.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut buf = BytesMut::with_capacity(0);
+    /// buf.extend_from_slice(b"aaabbb");
+    /// buf.extend_from_slice(b"cccddd");
+    ///
+    /// assert_eq!(b"aaabbbcccddd", &buf[..]);
+    /// ```
+    pub fn extend_from_slice(&mut self, extend: &[u8]) {
+        let cnt = extend.len();
+        self.reserve(cnt);
+
+        unsafe {
+            let dst = self.uninit_slice();
+            // Reserved above
+            debug_assert!(dst.len() >= cnt);
+
+            ptr::copy_nonoverlapping(extend.as_ptr(), dst.as_mut_ptr() as *mut u8, cnt);
+        }
+
+        unsafe {
+            self.advance_mut(cnt);
+        }
+    }
+
+    /// Absorbs a `BytesMut` that was previously split off.
+    ///
+    /// If the two `BytesMut` objects were previously contiguous, i.e., if
+    /// `other` was created by calling `split_off` on this `BytesMut`, then
+    /// this is an `O(1)` operation that just decreases a reference
+    /// count and sets a few indices. Otherwise this method degenerates to
+    /// `self.extend_from_slice(other.as_ref())`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use bytes::BytesMut;
+    ///
+    /// let mut buf = BytesMut::with_capacity(64);
+    /// buf.extend_from_slice(b"aaabbbcccddd");
+    ///
+    /// let split = buf.split_off(6);
+    /// assert_eq!(b"aaabbb", &buf[..]);
+    /// assert_eq!(b"cccddd", &split[..]);
+    ///
+    /// buf.unsplit(split);
+    /// assert_eq!(b"aaabbbcccddd", &buf[..]);
+    /// ```
+    pub fn unsplit(&mut self, other: BytesMut) {
+        if self.is_empty() {
+            *self = other;
+            return;
+        }
+
+        if let Err(other) = self.try_unsplit(other) {
+            self.extend_from_slice(other.as_ref());
+        }
+    }
+
+    // private
+
+    // For now, use a `Vec` to manage the memory for us, but we may want to
+    // change that in the future to some alternate allocator strategy.
+    //
+    // Thus, we don't expose an easy way to construct from a `Vec` since an
+    // internal change could make a simple pattern (`BytesMut::from(vec)`)
+    // suddenly a lot more expensive.
+    #[inline]
+    pub(crate) fn from_vec(mut vec: Vec<u8>) -> BytesMut {
+        let ptr = vptr(vec.as_mut_ptr());
+        let len = vec.len();
+        let cap = vec.capacity();
+        mem::forget(vec);
+
+        let original_capacity_repr = original_capacity_to_repr(cap);
+        let data = (original_capacity_repr << ORIGINAL_CAPACITY_OFFSET) | KIND_VEC;
+
+        BytesMut {
+            ptr,
+            len,
+            cap,
+            data: data as *mut _,
+        }
+    }
+
+    #[inline]
+    fn as_slice(&self) -> &[u8] {
+        unsafe { slice::from_raw_parts(self.ptr.as_ptr(), self.len) }
+    }
+
+    #[inline]
+    fn as_slice_mut(&mut self) -> &mut [u8] {
+        unsafe { slice::from_raw_parts_mut(self.ptr.as_ptr(), self.len) }
+    }
+
+    unsafe fn set_start(&mut self, start: usize) {
+        // Setting the start to 0 is a no-op, so return early if this is the
+        // case.
+        if start == 0 {
+            return;
+        }
+
+        debug_assert!(start <= self.cap, "internal: set_start out of bounds");
+
+        let kind = self.kind();
+
+        if kind == KIND_VEC {
+            // Setting the start when in vec representation is a little more
+            // complicated. First, we have to track how far ahead the
+            // "start" of the byte buffer from the beginning of the vec. We
+            // also have to ensure that we don't exceed the maximum shift.
+            let (mut pos, prev) = self.get_vec_pos();
+            pos += start;
+
+            if pos <= MAX_VEC_POS {
+                self.set_vec_pos(pos, prev);
+            } else {
+                // The repr must be upgraded to ARC. This will never happen
+                // on 64 bit systems and will only happen on 32 bit systems
+                // when shifting past 134,217,727 bytes. As such, we don't
+                // worry too much about performance here.
+                self.promote_to_shared(/*ref_count = */ 1);
+            }
+        }
+
+        // Updating the start of the view is setting `ptr` to point to the
+        // new start and updating the `len` field to reflect the new length
+        // of the view.
+        self.ptr = vptr(self.ptr.as_ptr().offset(start as isize));
+
+        if self.len >= start {
+            self.len -= start;
+        } else {
+            self.len = 0;
+        }
+
+        self.cap -= start;
+    }
+
+    unsafe fn set_end(&mut self, end: usize) {
+        debug_assert_eq!(self.kind(), KIND_ARC);
+        assert!(end <= self.cap, "set_end out of bounds");
+
+        self.cap = end;
+        self.len = cmp::min(self.len, end);
+    }
+
+    fn try_unsplit(&mut self, other: BytesMut) -> Result<(), BytesMut> {
+        if other.capacity() == 0 {
+            return Ok(());
+        }
+
+        let ptr = unsafe { self.ptr.as_ptr().offset(self.len as isize) };
+        if ptr == other.ptr.as_ptr()
+            && self.kind() == KIND_ARC
+            && other.kind() == KIND_ARC
+            && self.data == other.data
+        {
+            // Contiguous blocks, just combine directly
+            self.len += other.len;
+            self.cap += other.cap;
+            Ok(())
+        } else {
+            Err(other)
+        }
+    }
+
+    #[inline]
+    fn kind(&self) -> usize {
+        self.data as usize & KIND_MASK
+    }
+
+    unsafe fn promote_to_shared(&mut self, ref_cnt: usize) {
+        debug_assert_eq!(self.kind(), KIND_VEC);
+        debug_assert!(ref_cnt == 1 || ref_cnt == 2);
+
+        let original_capacity_repr =
+            (self.data as usize & ORIGINAL_CAPACITY_MASK) >> ORIGINAL_CAPACITY_OFFSET;
+
+        // The vec offset cannot be concurrently mutated, so there
+        // should be no danger reading it.
+        let off = (self.data as usize) >> VEC_POS_OFFSET;
+
+        // First, allocate a new `Shared` instance containing the
+        // `Vec` fields. It's important to note that `ptr`, `len`,
+        // and `cap` cannot be mutated without having `&mut self`.
+        // This means that these fields will not be concurrently
+        // updated and since the buffer hasn't been promoted to an
+        // `Arc`, those three fields still are the components of the
+        // vector.
+        let shared = Box::new(Shared {
+            vec: rebuild_vec(self.ptr.as_ptr(), self.len, self.cap, off),
+            original_capacity_repr,
+            ref_count: AtomicUsize::new(ref_cnt),
+        });
+
+        let shared = Box::into_raw(shared);
+
+        // The pointer should be aligned, so this assert should
+        // always succeed.
+        debug_assert_eq!(shared as usize & KIND_MASK, KIND_ARC);
+
+        self.data = shared as _;
+    }
+
+    /// Makes an exact shallow clone of `self`.
+    ///
+    /// The kind of `self` doesn't matter, but this is unsafe
+    /// because the clone will have the same offsets. You must
+    /// be sure the returned value to the user doesn't allow
+    /// two views into the same range.
+    #[inline]
+    unsafe fn shallow_clone(&mut self) -> BytesMut {
+        if self.kind() == KIND_ARC {
+            increment_shared(self.data);
+            ptr::read(self)
+        } else {
+            self.promote_to_shared(/*ref_count = */ 2);
+            ptr::read(self)
+        }
+    }
+
+    #[inline]
+    unsafe fn get_vec_pos(&mut self) -> (usize, usize) {
+        debug_assert_eq!(self.kind(), KIND_VEC);
+
+        let prev = self.data as usize;
+        (prev >> VEC_POS_OFFSET, prev)
+    }
+
+    #[inline]
+    unsafe fn set_vec_pos(&mut self, pos: usize, prev: usize) {
+        debug_assert_eq!(self.kind(), KIND_VEC);
+        debug_assert!(pos <= MAX_VEC_POS);
+
+        self.data = ((pos << VEC_POS_OFFSET) | (prev & NOT_VEC_POS_MASK)) as *mut _;
+    }
+
+    #[inline]
+    fn uninit_slice(&mut self) -> &mut UninitSlice {
+        unsafe {
+            let ptr = self.ptr.as_ptr().offset(self.len as isize);
+            let len = self.cap - self.len;
+
+            UninitSlice::from_raw_parts_mut(ptr, len)
+        }
+    }
+}
+
+impl Drop for BytesMut {
+    fn drop(&mut self) {
+        let kind = self.kind();
+
+        if kind == KIND_VEC {
+            unsafe {
+                let (off, _) = self.get_vec_pos();
+
+                // Vector storage, free the vector
+                let _ = rebuild_vec(self.ptr.as_ptr(), self.len, self.cap, off);
+            }
+        } else if kind == KIND_ARC {
+            unsafe { release_shared(self.data as _) };
+        }
+    }
+}
+
+impl Buf for BytesMut {
+    #[inline]
+    fn remaining(&self) -> usize {
+        self.len()
+    }
+
+    #[inline]
+    fn chunk(&self) -> &[u8] {
+        self.as_slice()
+    }
+
+    #[inline]
+    fn advance(&mut self, cnt: usize) {
+        assert!(
+            cnt <= self.remaining(),
+            "cannot advance past `remaining`: {:?} <= {:?}",
+            cnt,
+            self.remaining(),
+        );
+        unsafe {
+            self.set_start(cnt);
+        }
+    }
+
+    fn copy_to_bytes(&mut self, len: usize) -> crate::Bytes {
+        self.split_to(len).freeze()
+    }
+}
+
+unsafe impl BufMut for BytesMut {
+    #[inline]
+    fn remaining_mut(&self) -> usize {
+        usize::MAX - self.len()
+    }
+
+    #[inline]
+    unsafe fn advance_mut(&mut self, cnt: usize) {
+        let new_len = self.len() + cnt;
+        assert!(
+            new_len <= self.cap,
+            "new_len = {}; capacity = {}",
+            new_len,
+            self.cap
+        );
+        self.len = new_len;
+    }
+
+    #[inline]
+    fn chunk_mut(&mut self) -> &mut UninitSlice {
+        if self.capacity() == self.len() {
+            self.reserve(64);
+        }
+        self.uninit_slice()
+    }
+
+    // Specialize these methods so they can skip checking `remaining_mut`
+    // and `advance_mut`.
+
+    fn put<T: crate::Buf>(&mut self, mut src: T)
+    where
+        Self: Sized,
+    {
+        while src.has_remaining() {
+            let s = src.chunk();
+            let l = s.len();
+            self.extend_from_slice(s);
+            src.advance(l);
+        }
+    }
+
+    fn put_slice(&mut self, src: &[u8]) {
+        self.extend_from_slice(src);
+    }
+
+    fn put_bytes(&mut self, val: u8, cnt: usize) {
+        self.reserve(cnt);
+        unsafe {
+            let dst = self.uninit_slice();
+            // Reserved above
+            debug_assert!(dst.len() >= cnt);
+
+            ptr::write_bytes(dst.as_mut_ptr(), val, cnt);
+
+            self.advance_mut(cnt);
+        }
+    }
+}
+
+impl AsRef<[u8]> for BytesMut {
+    #[inline]
+    fn as_ref(&self) -> &[u8] {
+        self.as_slice()
+    }
+}
+
+impl Deref for BytesMut {
+    type Target = [u8];
+
+    #[inline]
+    fn deref(&self) -> &[u8] {
+        self.as_ref()
+    }
+}
+
+impl AsMut<[u8]> for BytesMut {
+    #[inline]
+    fn as_mut(&mut self) -> &mut [u8] {
+        self.as_slice_mut()
+    }
+}
+
+impl DerefMut for BytesMut {
+    #[inline]
+    fn deref_mut(&mut self) -> &mut [u8] {
+        self.as_mut()
+    }
+}
+
+impl<'a> From<&'a [u8]> for BytesMut {
+    fn from(src: &'a [u8]) -> BytesMut {
+        BytesMut::from_vec(src.to_vec())
+    }
+}
+
+impl<'a> From<&'a str> for BytesMut {
+    fn from(src: &'a str) -> BytesMut {
+        BytesMut::from(src.as_bytes())
+    }
+}
+
+impl From<BytesMut> for Bytes {
+    fn from(src: BytesMut) -> Bytes {
+        src.freeze()
+    }
+}
+
+impl PartialEq for BytesMut {
+    fn eq(&self, other: &BytesMut) -> bool {
+        self.as_slice() == other.as_slice()
+    }
+}
+
+impl PartialOrd for BytesMut {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        self.as_slice().partial_cmp(other.as_slice())
+    }
+}
+
+impl Ord for BytesMut {
+    fn cmp(&self, other: &BytesMut) -> cmp::Ordering {
+        self.as_slice().cmp(other.as_slice())
+    }
+}
+
+impl Eq for BytesMut {}
+
+impl Default for BytesMut {
+    #[inline]
+    fn default() -> BytesMut {
+        BytesMut::new()
+    }
+}
+
+impl hash::Hash for BytesMut {
+    fn hash<H>(&self, state: &mut H)
+    where
+        H: hash::Hasher,
+    {
+        let s: &[u8] = self.as_ref();
+        s.hash(state);
+    }
+}
+
+impl Borrow<[u8]> for BytesMut {
+    fn borrow(&self) -> &[u8] {
+        self.as_ref()
+    }
+}
+
+impl BorrowMut<[u8]> for BytesMut {
+    fn borrow_mut(&mut self) -> &mut [u8] {
+        self.as_mut()
+    }
+}
+
+impl fmt::Write for BytesMut {
+    #[inline]
+    fn write_str(&mut self, s: &str) -> fmt::Result {
+        if self.remaining_mut() >= s.len() {
+            self.put_slice(s.as_bytes());
+            Ok(())
+        } else {
+            Err(fmt::Error)
+        }
+    }
+
+    #[inline]
+    fn write_fmt(&mut self, args: fmt::Arguments<'_>) -> fmt::Result {
+        fmt::write(self, args)
+    }
+}
+
+impl Clone for BytesMut {
+    fn clone(&self) -> BytesMut {
+        BytesMut::from(&self[..])
+    }
+}
+
+impl IntoIterator for BytesMut {
+    type Item = u8;
+    type IntoIter = IntoIter<BytesMut>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        IntoIter::new(self)
+    }
+}
+
+impl<'a> IntoIterator for &'a BytesMut {
+    type Item = &'a u8;
+    type IntoIter = core::slice::Iter<'a, u8>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        self.as_ref().into_iter()
+    }
+}
+
+impl Extend<u8> for BytesMut {
+    fn extend<T>(&mut self, iter: T)
+    where
+        T: IntoIterator<Item = u8>,
+    {
+        let iter = iter.into_iter();
+
+        let (lower, _) = iter.size_hint();
+        self.reserve(lower);
+
+        // TODO: optimize
+        // 1. If self.kind() == KIND_VEC, use Vec::extend
+        // 2. Make `reserve` inline-able
+        for b in iter {
+            self.reserve(1);
+            self.put_u8(b);
+        }
+    }
+}
+
+impl<'a> Extend<&'a u8> for BytesMut {
+    fn extend<T>(&mut self, iter: T)
+    where
+        T: IntoIterator<Item = &'a u8>,
+    {
+        self.extend(iter.into_iter().map(|b| *b))
+    }
+}
+
+impl FromIterator<u8> for BytesMut {
+    fn from_iter<T: IntoIterator<Item = u8>>(into_iter: T) -> Self {
+        BytesMut::from_vec(Vec::from_iter(into_iter))
+    }
+}
+
+impl<'a> FromIterator<&'a u8> for BytesMut {
+    fn from_iter<T: IntoIterator<Item = &'a u8>>(into_iter: T) -> Self {
+        BytesMut::from_iter(into_iter.into_iter().map(|b| *b))
+    }
+}
+
+/*
+ *
+ * ===== Inner =====
+ *
+ */
+
+unsafe fn increment_shared(ptr: *mut Shared) {
+    let old_size = (*ptr).ref_count.fetch_add(1, Ordering::Relaxed);
+
+    if old_size > isize::MAX as usize {
+        crate::abort();
+    }
+}
+
+unsafe fn release_shared(ptr: *mut Shared) {
+    // `Shared` storage... follow the drop steps from Arc.
+    if (*ptr).ref_count.fetch_sub(1, Ordering::Release) != 1 {
+        return;
+    }
+
+    // This fence is needed to prevent reordering of use of the data and
+    // deletion of the data.  Because it is marked `Release`, the decreasing
+    // of the reference count synchronizes with this `Acquire` fence. This
+    // means that use of the data happens before decreasing the reference
+    // count, which happens before this fence, which happens before the
+    // deletion of the data.
+    //
+    // As explained in the [Boost documentation][1],
+    //
+    // > It is important to enforce any possible access to the object in one
+    // > thread (through an existing reference) to *happen before* deleting
+    // > the object in a different thread. This is achieved by a "release"
+    // > operation after dropping a reference (any access to the object
+    // > through this reference must obviously happened before), and an
+    // > "acquire" operation before deleting the object.
+    //
+    // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
+    atomic::fence(Ordering::Acquire);
+
+    // Drop the data
+    Box::from_raw(ptr);
+}
+
+impl Shared {
+    fn is_unique(&self) -> bool {
+        // The goal is to check if the current handle is the only handle
+        // that currently has access to the buffer. This is done by
+        // checking if the `ref_count` is currently 1.
+        //
+        // The `Acquire` ordering synchronizes with the `Release` as
+        // part of the `fetch_sub` in `release_shared`. The `fetch_sub`
+        // operation guarantees that any mutations done in other threads
+        // are ordered before the `ref_count` is decremented. As such,
+        // this `Acquire` will guarantee that those mutations are
+        // visible to the current thread.
+        self.ref_count.load(Ordering::Acquire) == 1
+    }
+}
+
+#[inline]
+fn original_capacity_to_repr(cap: usize) -> usize {
+    let width = PTR_WIDTH - ((cap >> MIN_ORIGINAL_CAPACITY_WIDTH).leading_zeros() as usize);
+    cmp::min(
+        width,
+        MAX_ORIGINAL_CAPACITY_WIDTH - MIN_ORIGINAL_CAPACITY_WIDTH,
+    )
+}
+
+fn original_capacity_from_repr(repr: usize) -> usize {
+    if repr == 0 {
+        return 0;
+    }
+
+    1 << (repr + (MIN_ORIGINAL_CAPACITY_WIDTH - 1))
+}
+
+/*
+#[test]
+fn test_original_capacity_to_repr() {
+    assert_eq!(original_capacity_to_repr(0), 0);
+
+    let max_width = 32;
+
+    for width in 1..(max_width + 1) {
+        let cap = 1 << width - 1;
+
+        let expected = if width < MIN_ORIGINAL_CAPACITY_WIDTH {
+            0
+        } else if width < MAX_ORIGINAL_CAPACITY_WIDTH {
+            width - MIN_ORIGINAL_CAPACITY_WIDTH
+        } else {
+            MAX_ORIGINAL_CAPACITY_WIDTH - MIN_ORIGINAL_CAPACITY_WIDTH
+        };
+
+        assert_eq!(original_capacity_to_repr(cap), expected);
+
+        if width > 1 {
+            assert_eq!(original_capacity_to_repr(cap + 1), expected);
+        }
+
+        //  MIN_ORIGINAL_CAPACITY_WIDTH must be bigger than 7 to pass tests below
+        if width == MIN_ORIGINAL_CAPACITY_WIDTH + 1 {
+            assert_eq!(original_capacity_to_repr(cap - 24), expected - 1);
+            assert_eq!(original_capacity_to_repr(cap + 76), expected);
+        } else if width == MIN_ORIGINAL_CAPACITY_WIDTH + 2 {
+            assert_eq!(original_capacity_to_repr(cap - 1), expected - 1);
+            assert_eq!(original_capacity_to_repr(cap - 48), expected - 1);
+        }
+    }
+}
+
+#[test]
+fn test_original_capacity_from_repr() {
+    assert_eq!(0, original_capacity_from_repr(0));
+
+    let min_cap = 1 << MIN_ORIGINAL_CAPACITY_WIDTH;
+
+    assert_eq!(min_cap, original_capacity_from_repr(1));
+    assert_eq!(min_cap * 2, original_capacity_from_repr(2));
+    assert_eq!(min_cap * 4, original_capacity_from_repr(3));
+    assert_eq!(min_cap * 8, original_capacity_from_repr(4));
+    assert_eq!(min_cap * 16, original_capacity_from_repr(5));
+    assert_eq!(min_cap * 32, original_capacity_from_repr(6));
+    assert_eq!(min_cap * 64, original_capacity_from_repr(7));
+}
+*/
+
+unsafe impl Send for BytesMut {}
+unsafe impl Sync for BytesMut {}
+
+/*
+ *
+ * ===== PartialEq / PartialOrd =====
+ *
+ */
+
+impl PartialEq<[u8]> for BytesMut {
+    fn eq(&self, other: &[u8]) -> bool {
+        &**self == other
+    }
+}
+
+impl PartialOrd<[u8]> for BytesMut {
+    fn partial_cmp(&self, other: &[u8]) -> Option<cmp::Ordering> {
+        (**self).partial_cmp(other)
+    }
+}
+
+impl PartialEq<BytesMut> for [u8] {
+    fn eq(&self, other: &BytesMut) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<BytesMut> for [u8] {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other)
+    }
+}
+
+impl PartialEq<str> for BytesMut {
+    fn eq(&self, other: &str) -> bool {
+        &**self == other.as_bytes()
+    }
+}
+
+impl PartialOrd<str> for BytesMut {
+    fn partial_cmp(&self, other: &str) -> Option<cmp::Ordering> {
+        (**self).partial_cmp(other.as_bytes())
+    }
+}
+
+impl PartialEq<BytesMut> for str {
+    fn eq(&self, other: &BytesMut) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<BytesMut> for str {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other)
+    }
+}
+
+impl PartialEq<Vec<u8>> for BytesMut {
+    fn eq(&self, other: &Vec<u8>) -> bool {
+        *self == &other[..]
+    }
+}
+
+impl PartialOrd<Vec<u8>> for BytesMut {
+    fn partial_cmp(&self, other: &Vec<u8>) -> Option<cmp::Ordering> {
+        (**self).partial_cmp(&other[..])
+    }
+}
+
+impl PartialEq<BytesMut> for Vec<u8> {
+    fn eq(&self, other: &BytesMut) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<BytesMut> for Vec<u8> {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        other.partial_cmp(self)
+    }
+}
+
+impl PartialEq<String> for BytesMut {
+    fn eq(&self, other: &String) -> bool {
+        *self == &other[..]
+    }
+}
+
+impl PartialOrd<String> for BytesMut {
+    fn partial_cmp(&self, other: &String) -> Option<cmp::Ordering> {
+        (**self).partial_cmp(other.as_bytes())
+    }
+}
+
+impl PartialEq<BytesMut> for String {
+    fn eq(&self, other: &BytesMut) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<BytesMut> for String {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self.as_bytes(), other)
+    }
+}
+
+impl<'a, T: ?Sized> PartialEq<&'a T> for BytesMut
+where
+    BytesMut: PartialEq<T>,
+{
+    fn eq(&self, other: &&'a T) -> bool {
+        *self == **other
+    }
+}
+
+impl<'a, T: ?Sized> PartialOrd<&'a T> for BytesMut
+where
+    BytesMut: PartialOrd<T>,
+{
+    fn partial_cmp(&self, other: &&'a T) -> Option<cmp::Ordering> {
+        self.partial_cmp(*other)
+    }
+}
+
+impl PartialEq<BytesMut> for &[u8] {
+    fn eq(&self, other: &BytesMut) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<BytesMut> for &[u8] {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        <[u8] as PartialOrd<[u8]>>::partial_cmp(self, other)
+    }
+}
+
+impl PartialEq<BytesMut> for &str {
+    fn eq(&self, other: &BytesMut) -> bool {
+        *other == *self
+    }
+}
+
+impl PartialOrd<BytesMut> for &str {
+    fn partial_cmp(&self, other: &BytesMut) -> Option<cmp::Ordering> {
+        other.partial_cmp(self)
+    }
+}
+
+impl PartialEq<BytesMut> for Bytes {
+    fn eq(&self, other: &BytesMut) -> bool {
+        &other[..] == &self[..]
+    }
+}
+
+impl PartialEq<Bytes> for BytesMut {
+    fn eq(&self, other: &Bytes) -> bool {
+        &other[..] == &self[..]
+    }
+}
+
+#[inline]
+fn vptr(ptr: *mut u8) -> NonNull<u8> {
+    if cfg!(debug_assertions) {
+        NonNull::new(ptr).expect("Vec pointer should be non-null")
+    } else {
+        unsafe { NonNull::new_unchecked(ptr) }
+    }
+}
+
+unsafe fn rebuild_vec(ptr: *mut u8, mut len: usize, mut cap: usize, off: usize) -> Vec<u8> {
+    let ptr = ptr.offset(-(off as isize));
+    len += off;
+    cap += off;
+
+    Vec::from_raw_parts(ptr, len, cap)
+}
+
+// ===== impl SharedVtable =====
+
+static SHARED_VTABLE: Vtable = Vtable {
+    clone: shared_v_clone,
+    drop: shared_v_drop,
+};
+
+unsafe fn shared_v_clone(data: &AtomicPtr<()>, ptr: *const u8, len: usize) -> Bytes {
+    let shared = data.load(Ordering::Relaxed) as *mut Shared;
+    increment_shared(shared);
+
+    let data = AtomicPtr::new(shared as _);
+    Bytes::with_vtable(ptr, len, data, &SHARED_VTABLE)
+}
+
+unsafe fn shared_v_drop(data: &mut AtomicPtr<()>, _ptr: *const u8, _len: usize) {
+    data.with_mut(|shared| {
+        release_shared(*shared as *mut Shared);
+    });
+}
+
+// compile-fails
+
+/// ```compile_fail
+/// use bytes::BytesMut;
+/// #[deny(unused_must_use)]
+/// {
+///     let mut b1 = BytesMut::from("hello world");
+///     b1.split_to(6);
+/// }
+/// ```
+fn _split_to_must_use() {}
+
+/// ```compile_fail
+/// use bytes::BytesMut;
+/// #[deny(unused_must_use)]
+/// {
+///     let mut b1 = BytesMut::from("hello world");
+///     b1.split_off(6);
+/// }
+/// ```
+fn _split_off_must_use() {}
+
+/// ```compile_fail
+/// use bytes::BytesMut;
+/// #[deny(unused_must_use)]
+/// {
+///     let mut b1 = BytesMut::from("hello world");
+///     b1.split();
+/// }
+/// ```
+fn _split_must_use() {}
+
+// fuzz tests
+#[cfg(all(test, loom))]
+mod fuzz {
+    use loom::sync::Arc;
+    use loom::thread;
+
+    use super::BytesMut;
+    use crate::Bytes;
+
+    #[test]
+    fn bytes_mut_cloning_frozen() {
+        loom::model(|| {
+            let a = BytesMut::from(&b"abcdefgh"[..]).split().freeze();
+            let addr = a.as_ptr() as usize;
+
+            // test the Bytes::clone is Sync by putting it in an Arc
+            let a1 = Arc::new(a);
+            let a2 = a1.clone();
+
+            let t1 = thread::spawn(move || {
+                let b: Bytes = (*a1).clone();
+                assert_eq!(b.as_ptr() as usize, addr);
+            });
+
+            let t2 = thread::spawn(move || {
+                let b: Bytes = (*a2).clone();
+                assert_eq!(b.as_ptr() as usize, addr);
+            });
+
+            t1.join().unwrap();
+            t2.join().unwrap();
+        });
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/fmt/debug.rs b/android/vendor/bytes-1.1.0/src/fmt/debug.rs
new file mode 100644
index 0000000..a854551
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/fmt/debug.rs
@@ -0,0 +1,49 @@
+use core::fmt::{Debug, Formatter, Result};
+
+use super::BytesRef;
+use crate::{Bytes, BytesMut};
+
+/// Alternative implementation of `std::fmt::Debug` for byte slice.
+///
+/// Standard `Debug` implementation for `[u8]` is comma separated
+/// list of numbers. Since large amount of byte strings are in fact
+/// ASCII strings or contain a lot of ASCII strings (e. g. HTTP),
+/// it is convenient to print strings as ASCII when possible.
+impl Debug for BytesRef<'_> {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+        write!(f, "b\"")?;
+        for &b in self.0 {
+            // https://doc.rust-lang.org/reference/tokens.html#byte-escapes
+            if b == b'\n' {
+                write!(f, "\\n")?;
+            } else if b == b'\r' {
+                write!(f, "\\r")?;
+            } else if b == b'\t' {
+                write!(f, "\\t")?;
+            } else if b == b'\\' || b == b'"' {
+                write!(f, "\\{}", b as char)?;
+            } else if b == b'\0' {
+                write!(f, "\\0")?;
+            // ASCII printable
+            } else if b >= 0x20 && b < 0x7f {
+                write!(f, "{}", b as char)?;
+            } else {
+                write!(f, "\\x{:02x}", b)?;
+            }
+        }
+        write!(f, "\"")?;
+        Ok(())
+    }
+}
+
+impl Debug for Bytes {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+        Debug::fmt(&BytesRef(&self.as_ref()), f)
+    }
+}
+
+impl Debug for BytesMut {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+        Debug::fmt(&BytesRef(&self.as_ref()), f)
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/fmt/hex.rs b/android/vendor/bytes-1.1.0/src/fmt/hex.rs
new file mode 100644
index 0000000..97a749a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/fmt/hex.rs
@@ -0,0 +1,37 @@
+use core::fmt::{Formatter, LowerHex, Result, UpperHex};
+
+use super::BytesRef;
+use crate::{Bytes, BytesMut};
+
+impl LowerHex for BytesRef<'_> {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+        for &b in self.0 {
+            write!(f, "{:02x}", b)?;
+        }
+        Ok(())
+    }
+}
+
+impl UpperHex for BytesRef<'_> {
+    fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+        for &b in self.0 {
+            write!(f, "{:02X}", b)?;
+        }
+        Ok(())
+    }
+}
+
+macro_rules! hex_impl {
+    ($tr:ident, $ty:ty) => {
+        impl $tr for $ty {
+            fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+                $tr::fmt(&BytesRef(self.as_ref()), f)
+            }
+        }
+    };
+}
+
+hex_impl!(LowerHex, Bytes);
+hex_impl!(LowerHex, BytesMut);
+hex_impl!(UpperHex, Bytes);
+hex_impl!(UpperHex, BytesMut);
diff --git a/android/vendor/bytes-1.1.0/src/fmt/mod.rs b/android/vendor/bytes-1.1.0/src/fmt/mod.rs
new file mode 100644
index 0000000..676d15f
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/fmt/mod.rs
@@ -0,0 +1,5 @@
+mod debug;
+mod hex;
+
+/// `BytesRef` is not a part of public API of bytes crate.
+struct BytesRef<'a>(&'a [u8]);
diff --git a/android/vendor/bytes-1.1.0/src/lib.rs b/android/vendor/bytes-1.1.0/src/lib.rs
new file mode 100644
index 0000000..706735e
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/lib.rs
@@ -0,0 +1,116 @@
+#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)]
+#![doc(test(
+    no_crate_inject,
+    attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables))
+))]
+#![no_std]
+
+//! Provides abstractions for working with bytes.
+//!
+//! The `bytes` crate provides an efficient byte buffer structure
+//! ([`Bytes`](struct.Bytes.html)) and traits for working with buffer
+//! implementations ([`Buf`], [`BufMut`]).
+//!
+//! [`Buf`]: trait.Buf.html
+//! [`BufMut`]: trait.BufMut.html
+//!
+//! # `Bytes`
+//!
+//! `Bytes` is an efficient container for storing and operating on contiguous
+//! slices of memory. It is intended for use primarily in networking code, but
+//! could have applications elsewhere as well.
+//!
+//! `Bytes` values facilitate zero-copy network programming by allowing multiple
+//! `Bytes` objects to point to the same underlying memory. This is managed by
+//! using a reference count to track when the memory is no longer needed and can
+//! be freed.
+//!
+//! A `Bytes` handle can be created directly from an existing byte store (such as `&[u8]`
+//! or `Vec<u8>`), but usually a `BytesMut` is used first and written to. For
+//! example:
+//!
+//! ```rust
+//! use bytes::{BytesMut, BufMut};
+//!
+//! let mut buf = BytesMut::with_capacity(1024);
+//! buf.put(&b"hello world"[..]);
+//! buf.put_u16(1234);
+//!
+//! let a = buf.split();
+//! assert_eq!(a, b"hello world\x04\xD2"[..]);
+//!
+//! buf.put(&b"goodbye world"[..]);
+//!
+//! let b = buf.split();
+//! assert_eq!(b, b"goodbye world"[..]);
+//!
+//! assert_eq!(buf.capacity(), 998);
+//! ```
+//!
+//! In the above example, only a single buffer of 1024 is allocated. The handles
+//! `a` and `b` will share the underlying buffer and maintain indices tracking
+//! the view into the buffer represented by the handle.
+//!
+//! See the [struct docs] for more details.
+//!
+//! [struct docs]: struct.Bytes.html
+//!
+//! # `Buf`, `BufMut`
+//!
+//! These two traits provide read and write access to buffers. The underlying
+//! storage may or may not be in contiguous memory. For example, `Bytes` is a
+//! buffer that guarantees contiguous memory, but a [rope] stores the bytes in
+//! disjoint chunks. `Buf` and `BufMut` maintain cursors tracking the current
+//! position in the underlying byte storage. When bytes are read or written, the
+//! cursor is advanced.
+//!
+//! [rope]: https://en.wikipedia.org/wiki/Rope_(data_structure)
+//!
+//! ## Relation with `Read` and `Write`
+//!
+//! At first glance, it may seem that `Buf` and `BufMut` overlap in
+//! functionality with `std::io::Read` and `std::io::Write`. However, they
+//! serve different purposes. A buffer is the value that is provided as an
+//! argument to `Read::read` and `Write::write`. `Read` and `Write` may then
+//! perform a syscall, which has the potential of failing. Operations on `Buf`
+//! and `BufMut` are infallible.
+
+extern crate alloc;
+
+#[cfg(feature = "std")]
+extern crate std;
+
+pub mod buf;
+pub use crate::buf::{Buf, BufMut};
+
+mod bytes;
+mod bytes_mut;
+mod fmt;
+mod loom;
+pub use crate::bytes::Bytes;
+pub use crate::bytes_mut::BytesMut;
+
+// Optional Serde support
+#[cfg(feature = "serde")]
+mod serde;
+
+#[inline(never)]
+#[cold]
+fn abort() -> ! {
+    #[cfg(feature = "std")]
+    {
+        std::process::abort();
+    }
+
+    #[cfg(not(feature = "std"))]
+    {
+        struct Abort;
+        impl Drop for Abort {
+            fn drop(&mut self) {
+                panic!();
+            }
+        }
+        let _a = Abort;
+        panic!("abort");
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/loom.rs b/android/vendor/bytes-1.1.0/src/loom.rs
new file mode 100644
index 0000000..1cae881
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/loom.rs
@@ -0,0 +1,30 @@
+#[cfg(not(all(test, loom)))]
+pub(crate) mod sync {
+    pub(crate) mod atomic {
+        pub(crate) use core::sync::atomic::{fence, AtomicPtr, AtomicUsize, Ordering};
+
+        pub(crate) trait AtomicMut<T> {
+            fn with_mut<F, R>(&mut self, f: F) -> R
+            where
+                F: FnOnce(&mut *mut T) -> R;
+        }
+
+        impl<T> AtomicMut<T> for AtomicPtr<T> {
+            fn with_mut<F, R>(&mut self, f: F) -> R
+            where
+                F: FnOnce(&mut *mut T) -> R,
+            {
+                f(self.get_mut())
+            }
+        }
+    }
+}
+
+#[cfg(all(test, loom))]
+pub(crate) mod sync {
+    pub(crate) mod atomic {
+        pub(crate) use loom::sync::atomic::{fence, AtomicPtr, AtomicUsize, Ordering};
+
+        pub(crate) trait AtomicMut<T> {}
+    }
+}
diff --git a/android/vendor/bytes-1.1.0/src/serde.rs b/android/vendor/bytes-1.1.0/src/serde.rs
new file mode 100644
index 0000000..0a5bd14
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/src/serde.rs
@@ -0,0 +1,89 @@
+use super::{Bytes, BytesMut};
+use alloc::string::String;
+use alloc::vec::Vec;
+use core::{cmp, fmt};
+use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
+
+macro_rules! serde_impl {
+    ($ty:ident, $visitor_ty:ident, $from_slice:ident, $from_vec:ident) => {
+        impl Serialize for $ty {
+            #[inline]
+            fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+            where
+                S: Serializer,
+            {
+                serializer.serialize_bytes(&self)
+            }
+        }
+
+        struct $visitor_ty;
+
+        impl<'de> de::Visitor<'de> for $visitor_ty {
+            type Value = $ty;
+
+            fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+                formatter.write_str("byte array")
+            }
+
+            #[inline]
+            fn visit_seq<V>(self, mut seq: V) -> Result<Self::Value, V::Error>
+            where
+                V: de::SeqAccess<'de>,
+            {
+                let len = cmp::min(seq.size_hint().unwrap_or(0), 4096);
+                let mut values: Vec<u8> = Vec::with_capacity(len);
+
+                while let Some(value) = seq.next_element()? {
+                    values.push(value);
+                }
+
+                Ok($ty::$from_vec(values))
+            }
+
+            #[inline]
+            fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E>
+            where
+                E: de::Error,
+            {
+                Ok($ty::$from_slice(v))
+            }
+
+            #[inline]
+            fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E>
+            where
+                E: de::Error,
+            {
+                Ok($ty::$from_vec(v))
+            }
+
+            #[inline]
+            fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
+            where
+                E: de::Error,
+            {
+                Ok($ty::$from_slice(v.as_bytes()))
+            }
+
+            #[inline]
+            fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
+            where
+                E: de::Error,
+            {
+                Ok($ty::$from_vec(v.into_bytes()))
+            }
+        }
+
+        impl<'de> Deserialize<'de> for $ty {
+            #[inline]
+            fn deserialize<D>(deserializer: D) -> Result<$ty, D::Error>
+            where
+                D: Deserializer<'de>,
+            {
+                deserializer.deserialize_byte_buf($visitor_ty)
+            }
+        }
+    };
+}
+
+serde_impl!(Bytes, BytesVisitor, copy_from_slice, from);
+serde_impl!(BytesMut, BytesMutVisitor, from, from_vec);
diff --git a/android/vendor/bytes-1.1.0/tests/test_buf.rs b/android/vendor/bytes-1.1.0/tests/test_buf.rs
new file mode 100644
index 0000000..fbad003
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_buf.rs
@@ -0,0 +1,120 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::Buf;
+#[cfg(feature = "std")]
+use std::io::IoSlice;
+
+#[test]
+fn test_fresh_cursor_vec() {
+    let mut buf = &b"hello"[..];
+
+    assert_eq!(buf.remaining(), 5);
+    assert_eq!(buf.chunk(), b"hello");
+
+    buf.advance(2);
+
+    assert_eq!(buf.remaining(), 3);
+    assert_eq!(buf.chunk(), b"llo");
+
+    buf.advance(3);
+
+    assert_eq!(buf.remaining(), 0);
+    assert_eq!(buf.chunk(), b"");
+}
+
+#[test]
+fn test_get_u8() {
+    let mut buf = &b"\x21zomg"[..];
+    assert_eq!(0x21, buf.get_u8());
+}
+
+#[test]
+fn test_get_u16() {
+    let mut buf = &b"\x21\x54zomg"[..];
+    assert_eq!(0x2154, buf.get_u16());
+    let mut buf = &b"\x21\x54zomg"[..];
+    assert_eq!(0x5421, buf.get_u16_le());
+}
+
+#[test]
+#[should_panic]
+fn test_get_u16_buffer_underflow() {
+    let mut buf = &b"\x21"[..];
+    buf.get_u16();
+}
+
+#[cfg(feature = "std")]
+#[test]
+fn test_bufs_vec() {
+    let buf = &b"hello world"[..];
+
+    let b1: &[u8] = &mut [];
+    let b2: &[u8] = &mut [];
+
+    let mut dst = [IoSlice::new(b1), IoSlice::new(b2)];
+
+    assert_eq!(1, buf.chunks_vectored(&mut dst[..]));
+}
+
+#[test]
+fn test_vec_deque() {
+    use std::collections::VecDeque;
+
+    let mut buffer: VecDeque<u8> = VecDeque::new();
+    buffer.extend(b"hello world");
+    assert_eq!(11, buffer.remaining());
+    assert_eq!(b"hello world", buffer.chunk());
+    buffer.advance(6);
+    assert_eq!(b"world", buffer.chunk());
+    buffer.extend(b" piece");
+    let mut out = [0; 11];
+    buffer.copy_to_slice(&mut out);
+    assert_eq!(b"world piece", &out[..]);
+}
+
+#[test]
+fn test_deref_buf_forwards() {
+    struct Special;
+
+    impl Buf for Special {
+        fn remaining(&self) -> usize {
+            unreachable!("remaining");
+        }
+
+        fn chunk(&self) -> &[u8] {
+            unreachable!("chunk");
+        }
+
+        fn advance(&mut self, _: usize) {
+            unreachable!("advance");
+        }
+
+        fn get_u8(&mut self) -> u8 {
+            // specialized!
+            b'x'
+        }
+    }
+
+    // these should all use the specialized method
+    assert_eq!(Special.get_u8(), b'x');
+    assert_eq!((&mut Special as &mut dyn Buf).get_u8(), b'x');
+    assert_eq!((Box::new(Special) as Box<dyn Buf>).get_u8(), b'x');
+    assert_eq!(Box::new(Special).get_u8(), b'x');
+}
+
+#[test]
+fn copy_to_bytes_less() {
+    let mut buf = &b"hello world"[..];
+
+    let bytes = buf.copy_to_bytes(5);
+    assert_eq!(bytes, &b"hello"[..]);
+    assert_eq!(buf, &b" world"[..])
+}
+
+#[test]
+#[should_panic]
+fn copy_to_bytes_overflow() {
+    let mut buf = &b"hello world"[..];
+
+    let _bytes = buf.copy_to_bytes(12);
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_buf_mut.rs b/android/vendor/bytes-1.1.0/tests/test_buf_mut.rs
new file mode 100644
index 0000000..53f4e86
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_buf_mut.rs
@@ -0,0 +1,178 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::buf::UninitSlice;
+use bytes::{BufMut, BytesMut};
+use core::fmt::Write;
+use core::usize;
+
+#[test]
+fn test_vec_as_mut_buf() {
+    let mut buf = Vec::with_capacity(64);
+
+    assert_eq!(buf.remaining_mut(), isize::MAX as usize);
+
+    assert!(buf.chunk_mut().len() >= 64);
+
+    buf.put(&b"zomg"[..]);
+
+    assert_eq!(&buf, b"zomg");
+
+    assert_eq!(buf.remaining_mut(), isize::MAX as usize - 4);
+    assert_eq!(buf.capacity(), 64);
+
+    for _ in 0..16 {
+        buf.put(&b"zomg"[..]);
+    }
+
+    assert_eq!(buf.len(), 68);
+}
+
+#[test]
+fn test_vec_put_bytes() {
+    let mut buf = Vec::new();
+    buf.push(17);
+    buf.put_bytes(19, 2);
+    assert_eq!([17, 19, 19], &buf[..]);
+}
+
+#[test]
+fn test_put_u8() {
+    let mut buf = Vec::with_capacity(8);
+    buf.put_u8(33);
+    assert_eq!(b"\x21", &buf[..]);
+}
+
+#[test]
+fn test_put_u16() {
+    let mut buf = Vec::with_capacity(8);
+    buf.put_u16(8532);
+    assert_eq!(b"\x21\x54", &buf[..]);
+
+    buf.clear();
+    buf.put_u16_le(8532);
+    assert_eq!(b"\x54\x21", &buf[..]);
+}
+
+#[test]
+fn test_put_int() {
+    let mut buf = Vec::with_capacity(8);
+    buf.put_int(0x1020304050607080, 3);
+    assert_eq!(b"\x60\x70\x80", &buf[..]);
+}
+
+#[test]
+#[should_panic]
+fn test_put_int_nbytes_overflow() {
+    let mut buf = Vec::with_capacity(8);
+    buf.put_int(0x1020304050607080, 9);
+}
+
+#[test]
+fn test_put_int_le() {
+    let mut buf = Vec::with_capacity(8);
+    buf.put_int_le(0x1020304050607080, 3);
+    assert_eq!(b"\x80\x70\x60", &buf[..]);
+}
+
+#[test]
+#[should_panic]
+fn test_put_int_le_nbytes_overflow() {
+    let mut buf = Vec::with_capacity(8);
+    buf.put_int_le(0x1020304050607080, 9);
+}
+
+#[test]
+#[should_panic(expected = "cannot advance")]
+fn test_vec_advance_mut() {
+    // Verify fix for #354
+    let mut buf = Vec::with_capacity(8);
+    unsafe {
+        buf.advance_mut(12);
+    }
+}
+
+#[test]
+fn test_clone() {
+    let mut buf = BytesMut::with_capacity(100);
+    buf.write_str("this is a test").unwrap();
+    let buf2 = buf.clone();
+
+    buf.write_str(" of our emergency broadcast system").unwrap();
+    assert!(buf != buf2);
+}
+
+#[test]
+fn test_mut_slice() {
+    let mut v = vec![0, 0, 0, 0];
+    let mut s = &mut v[..];
+    s.put_u32(42);
+
+    assert_eq!(s.len(), 0);
+    assert_eq!(&v, &[0, 0, 0, 42]);
+}
+
+#[test]
+fn test_slice_put_bytes() {
+    let mut v = [0, 0, 0, 0];
+    let mut s = &mut v[..];
+    s.put_u8(17);
+    s.put_bytes(19, 2);
+    assert_eq!(1, s.remaining_mut());
+    assert_eq!(&[17, 19, 19, 0], &v[..]);
+}
+
+#[test]
+fn test_deref_bufmut_forwards() {
+    struct Special;
+
+    unsafe impl BufMut for Special {
+        fn remaining_mut(&self) -> usize {
+            unreachable!("remaining_mut");
+        }
+
+        fn chunk_mut(&mut self) -> &mut UninitSlice {
+            unreachable!("chunk_mut");
+        }
+
+        unsafe fn advance_mut(&mut self, _: usize) {
+            unreachable!("advance");
+        }
+
+        fn put_u8(&mut self, _: u8) {
+            // specialized!
+        }
+    }
+
+    // these should all use the specialized method
+    Special.put_u8(b'x');
+    (&mut Special as &mut dyn BufMut).put_u8(b'x');
+    (Box::new(Special) as Box<dyn BufMut>).put_u8(b'x');
+    Box::new(Special).put_u8(b'x');
+}
+
+#[test]
+#[should_panic]
+fn write_byte_panics_if_out_of_bounds() {
+    let mut data = [b'b', b'a', b'r'];
+
+    let slice = unsafe { UninitSlice::from_raw_parts_mut(data.as_mut_ptr(), 3) };
+    slice.write_byte(4, b'f');
+}
+
+#[test]
+#[should_panic]
+fn copy_from_slice_panics_if_different_length_1() {
+    let mut data = [b'b', b'a', b'r'];
+
+    let slice = unsafe { UninitSlice::from_raw_parts_mut(data.as_mut_ptr(), 3) };
+    slice.copy_from_slice(b"a");
+}
+
+#[test]
+#[should_panic]
+fn copy_from_slice_panics_if_different_length_2() {
+    let mut data = [b'b', b'a', b'r'];
+
+    let slice = unsafe { UninitSlice::from_raw_parts_mut(data.as_mut_ptr(), 3) };
+    slice.copy_from_slice(b"abcd");
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_bytes.rs b/android/vendor/bytes-1.1.0/tests/test_bytes.rs
new file mode 100644
index 0000000..f0cae99
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_bytes.rs
@@ -0,0 +1,1004 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::{Buf, BufMut, Bytes, BytesMut};
+
+use std::usize;
+
+const LONG: &'static [u8] = b"mary had a little lamb, little lamb, little lamb";
+const SHORT: &'static [u8] = b"hello world";
+
+fn is_sync<T: Sync>() {}
+fn is_send<T: Send>() {}
+
+#[test]
+fn test_bounds() {
+    is_sync::<Bytes>();
+    is_sync::<BytesMut>();
+    is_send::<Bytes>();
+    is_send::<BytesMut>();
+}
+
+#[test]
+fn test_layout() {
+    use std::mem;
+
+    assert_eq!(
+        mem::size_of::<Bytes>(),
+        mem::size_of::<usize>() * 4,
+        "Bytes size should be 4 words",
+    );
+    assert_eq!(
+        mem::size_of::<BytesMut>(),
+        mem::size_of::<usize>() * 4,
+        "BytesMut should be 4 words",
+    );
+
+    assert_eq!(
+        mem::size_of::<Bytes>(),
+        mem::size_of::<Option<Bytes>>(),
+        "Bytes should be same size as Option<Bytes>",
+    );
+
+    assert_eq!(
+        mem::size_of::<BytesMut>(),
+        mem::size_of::<Option<BytesMut>>(),
+        "BytesMut should be same size as Option<BytesMut>",
+    );
+}
+
+#[test]
+fn from_slice() {
+    let a = Bytes::from(&b"abcdefgh"[..]);
+    assert_eq!(a, b"abcdefgh"[..]);
+    assert_eq!(a, &b"abcdefgh"[..]);
+    assert_eq!(a, Vec::from(&b"abcdefgh"[..]));
+    assert_eq!(b"abcdefgh"[..], a);
+    assert_eq!(&b"abcdefgh"[..], a);
+    assert_eq!(Vec::from(&b"abcdefgh"[..]), a);
+
+    let a = BytesMut::from(&b"abcdefgh"[..]);
+    assert_eq!(a, b"abcdefgh"[..]);
+    assert_eq!(a, &b"abcdefgh"[..]);
+    assert_eq!(a, Vec::from(&b"abcdefgh"[..]));
+    assert_eq!(b"abcdefgh"[..], a);
+    assert_eq!(&b"abcdefgh"[..], a);
+    assert_eq!(Vec::from(&b"abcdefgh"[..]), a);
+}
+
+#[test]
+fn fmt() {
+    let a = format!("{:?}", Bytes::from(&b"abcdefg"[..]));
+    let b = "b\"abcdefg\"";
+
+    assert_eq!(a, b);
+
+    let a = format!("{:?}", BytesMut::from(&b"abcdefg"[..]));
+    assert_eq!(a, b);
+}
+
+#[test]
+fn fmt_write() {
+    use std::fmt::Write;
+    use std::iter::FromIterator;
+    let s = String::from_iter((0..10).map(|_| "abcdefg"));
+
+    let mut a = BytesMut::with_capacity(64);
+    write!(a, "{}", &s[..64]).unwrap();
+    assert_eq!(a, s[..64].as_bytes());
+
+    let mut b = BytesMut::with_capacity(64);
+    write!(b, "{}", &s[..32]).unwrap();
+    write!(b, "{}", &s[32..64]).unwrap();
+    assert_eq!(b, s[..64].as_bytes());
+
+    let mut c = BytesMut::with_capacity(64);
+    write!(c, "{}", s).unwrap();
+    assert_eq!(c, s[..].as_bytes());
+}
+
+#[test]
+fn len() {
+    let a = Bytes::from(&b"abcdefg"[..]);
+    assert_eq!(a.len(), 7);
+
+    let a = BytesMut::from(&b"abcdefg"[..]);
+    assert_eq!(a.len(), 7);
+
+    let a = Bytes::from(&b""[..]);
+    assert!(a.is_empty());
+
+    let a = BytesMut::from(&b""[..]);
+    assert!(a.is_empty());
+}
+
+#[test]
+fn index() {
+    let a = Bytes::from(&b"hello world"[..]);
+    assert_eq!(a[0..5], *b"hello");
+}
+
+#[test]
+fn slice() {
+    let a = Bytes::from(&b"hello world"[..]);
+
+    let b = a.slice(3..5);
+    assert_eq!(b, b"lo"[..]);
+
+    let b = a.slice(0..0);
+    assert_eq!(b, b""[..]);
+
+    let b = a.slice(3..3);
+    assert_eq!(b, b""[..]);
+
+    let b = a.slice(a.len()..a.len());
+    assert_eq!(b, b""[..]);
+
+    let b = a.slice(..5);
+    assert_eq!(b, b"hello"[..]);
+
+    let b = a.slice(3..);
+    assert_eq!(b, b"lo world"[..]);
+}
+
+#[test]
+#[should_panic]
+fn slice_oob_1() {
+    let a = Bytes::from(&b"hello world"[..]);
+    a.slice(5..44);
+}
+
+#[test]
+#[should_panic]
+fn slice_oob_2() {
+    let a = Bytes::from(&b"hello world"[..]);
+    a.slice(44..49);
+}
+
+#[test]
+fn split_off() {
+    let mut hello = Bytes::from(&b"helloworld"[..]);
+    let world = hello.split_off(5);
+
+    assert_eq!(hello, &b"hello"[..]);
+    assert_eq!(world, &b"world"[..]);
+
+    let mut hello = BytesMut::from(&b"helloworld"[..]);
+    let world = hello.split_off(5);
+
+    assert_eq!(hello, &b"hello"[..]);
+    assert_eq!(world, &b"world"[..]);
+}
+
+#[test]
+#[should_panic]
+fn split_off_oob() {
+    let mut hello = Bytes::from(&b"helloworld"[..]);
+    let _ = hello.split_off(44);
+}
+
+#[test]
+fn split_off_uninitialized() {
+    let mut bytes = BytesMut::with_capacity(1024);
+    let other = bytes.split_off(128);
+
+    assert_eq!(bytes.len(), 0);
+    assert_eq!(bytes.capacity(), 128);
+
+    assert_eq!(other.len(), 0);
+    assert_eq!(other.capacity(), 896);
+}
+
+#[test]
+fn split_off_to_loop() {
+    let s = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
+    for i in 0..(s.len() + 1) {
+        {
+            let mut bytes = Bytes::from(&s[..]);
+            let off = bytes.split_off(i);
+            assert_eq!(i, bytes.len());
+            let mut sum = Vec::new();
+            sum.extend(bytes.iter());
+            sum.extend(off.iter());
+            assert_eq!(&s[..], &sum[..]);
+        }
+        {
+            let mut bytes = BytesMut::from(&s[..]);
+            let off = bytes.split_off(i);
+            assert_eq!(i, bytes.len());
+            let mut sum = Vec::new();
+            sum.extend(&bytes);
+            sum.extend(&off);
+            assert_eq!(&s[..], &sum[..]);
+        }
+        {
+            let mut bytes = Bytes::from(&s[..]);
+            let off = bytes.split_to(i);
+            assert_eq!(i, off.len());
+            let mut sum = Vec::new();
+            sum.extend(off.iter());
+            sum.extend(bytes.iter());
+            assert_eq!(&s[..], &sum[..]);
+        }
+        {
+            let mut bytes = BytesMut::from(&s[..]);
+            let off = bytes.split_to(i);
+            assert_eq!(i, off.len());
+            let mut sum = Vec::new();
+            sum.extend(&off);
+            sum.extend(&bytes);
+            assert_eq!(&s[..], &sum[..]);
+        }
+    }
+}
+
+#[test]
+fn split_to_1() {
+    // Static
+    let mut a = Bytes::from_static(SHORT);
+    let b = a.split_to(4);
+
+    assert_eq!(SHORT[4..], a);
+    assert_eq!(SHORT[..4], b);
+
+    // Allocated
+    let mut a = Bytes::copy_from_slice(LONG);
+    let b = a.split_to(4);
+
+    assert_eq!(LONG[4..], a);
+    assert_eq!(LONG[..4], b);
+
+    let mut a = Bytes::copy_from_slice(LONG);
+    let b = a.split_to(30);
+
+    assert_eq!(LONG[30..], a);
+    assert_eq!(LONG[..30], b);
+}
+
+#[test]
+fn split_to_2() {
+    let mut a = Bytes::from(LONG);
+    assert_eq!(LONG, a);
+
+    let b = a.split_to(1);
+
+    assert_eq!(LONG[1..], a);
+    drop(b);
+}
+
+#[test]
+#[should_panic]
+fn split_to_oob() {
+    let mut hello = Bytes::from(&b"helloworld"[..]);
+    let _ = hello.split_to(33);
+}
+
+#[test]
+#[should_panic]
+fn split_to_oob_mut() {
+    let mut hello = BytesMut::from(&b"helloworld"[..]);
+    let _ = hello.split_to(33);
+}
+
+#[test]
+#[should_panic]
+fn split_to_uninitialized() {
+    let mut bytes = BytesMut::with_capacity(1024);
+    let _other = bytes.split_to(128);
+}
+
+#[test]
+fn split_off_to_at_gt_len() {
+    fn make_bytes() -> Bytes {
+        let mut bytes = BytesMut::with_capacity(100);
+        bytes.put_slice(&[10, 20, 30, 40]);
+        bytes.freeze()
+    }
+
+    use std::panic;
+
+    let _ = make_bytes().split_to(4);
+    let _ = make_bytes().split_off(4);
+
+    assert!(panic::catch_unwind(move || {
+        let _ = make_bytes().split_to(5);
+    })
+    .is_err());
+
+    assert!(panic::catch_unwind(move || {
+        let _ = make_bytes().split_off(5);
+    })
+    .is_err());
+}
+
+#[test]
+fn truncate() {
+    let s = &b"helloworld"[..];
+    let mut hello = Bytes::from(s);
+    hello.truncate(15);
+    assert_eq!(hello, s);
+    hello.truncate(10);
+    assert_eq!(hello, s);
+    hello.truncate(5);
+    assert_eq!(hello, "hello");
+}
+
+#[test]
+fn freeze_clone_shared() {
+    let s = &b"abcdefgh"[..];
+    let b = BytesMut::from(s).split().freeze();
+    assert_eq!(b, s);
+    let c = b.clone();
+    assert_eq!(c, s);
+}
+
+#[test]
+fn freeze_clone_unique() {
+    let s = &b"abcdefgh"[..];
+    let b = BytesMut::from(s).freeze();
+    assert_eq!(b, s);
+    let c = b.clone();
+    assert_eq!(c, s);
+}
+
+#[test]
+fn freeze_after_advance() {
+    let s = &b"abcdefgh"[..];
+    let mut b = BytesMut::from(s);
+    b.advance(1);
+    assert_eq!(b, s[1..]);
+    let b = b.freeze();
+    // Verify fix for #352. Previously, freeze would ignore the start offset
+    // for BytesMuts in Vec mode.
+    assert_eq!(b, s[1..]);
+}
+
+#[test]
+fn freeze_after_advance_arc() {
+    let s = &b"abcdefgh"[..];
+    let mut b = BytesMut::from(s);
+    // Make b Arc
+    let _ = b.split_to(0);
+    b.advance(1);
+    assert_eq!(b, s[1..]);
+    let b = b.freeze();
+    assert_eq!(b, s[1..]);
+}
+
+#[test]
+fn freeze_after_split_to() {
+    let s = &b"abcdefgh"[..];
+    let mut b = BytesMut::from(s);
+    let _ = b.split_to(1);
+    assert_eq!(b, s[1..]);
+    let b = b.freeze();
+    assert_eq!(b, s[1..]);
+}
+
+#[test]
+fn freeze_after_truncate() {
+    let s = &b"abcdefgh"[..];
+    let mut b = BytesMut::from(s);
+    b.truncate(7);
+    assert_eq!(b, s[..7]);
+    let b = b.freeze();
+    assert_eq!(b, s[..7]);
+}
+
+#[test]
+fn freeze_after_truncate_arc() {
+    let s = &b"abcdefgh"[..];
+    let mut b = BytesMut::from(s);
+    // Make b Arc
+    let _ = b.split_to(0);
+    b.truncate(7);
+    assert_eq!(b, s[..7]);
+    let b = b.freeze();
+    assert_eq!(b, s[..7]);
+}
+
+#[test]
+fn freeze_after_split_off() {
+    let s = &b"abcdefgh"[..];
+    let mut b = BytesMut::from(s);
+    let _ = b.split_off(7);
+    assert_eq!(b, s[..7]);
+    let b = b.freeze();
+    assert_eq!(b, s[..7]);
+}
+
+#[test]
+fn fns_defined_for_bytes_mut() {
+    let mut bytes = BytesMut::from(&b"hello world"[..]);
+
+    bytes.as_ptr();
+    bytes.as_mut_ptr();
+
+    // Iterator
+    let v: Vec<u8> = bytes.as_ref().iter().cloned().collect();
+    assert_eq!(&v[..], bytes);
+}
+
+#[test]
+fn reserve_convert() {
+    // Vec -> Vec
+    let mut bytes = BytesMut::from(LONG);
+    bytes.reserve(64);
+    assert_eq!(bytes.capacity(), LONG.len() + 64);
+
+    // Arc -> Vec
+    let mut bytes = BytesMut::from(LONG);
+    let a = bytes.split_to(30);
+
+    bytes.reserve(128);
+    assert!(bytes.capacity() >= bytes.len() + 128);
+
+    drop(a);
+}
+
+#[test]
+fn reserve_growth() {
+    let mut bytes = BytesMut::with_capacity(64);
+    bytes.put("hello world".as_bytes());
+    let _ = bytes.split();
+
+    bytes.reserve(65);
+    assert_eq!(bytes.capacity(), 128);
+}
+
+#[test]
+fn reserve_allocates_at_least_original_capacity() {
+    let mut bytes = BytesMut::with_capacity(1024);
+
+    for i in 0..1020 {
+        bytes.put_u8(i as u8);
+    }
+
+    let _other = bytes.split();
+
+    bytes.reserve(16);
+    assert_eq!(bytes.capacity(), 1024);
+}
+
+#[test]
+#[cfg_attr(miri, ignore)] // Miri is too slow
+fn reserve_max_original_capacity_value() {
+    const SIZE: usize = 128 * 1024;
+
+    let mut bytes = BytesMut::with_capacity(SIZE);
+
+    for _ in 0..SIZE {
+        bytes.put_u8(0u8);
+    }
+
+    let _other = bytes.split();
+
+    bytes.reserve(16);
+    assert_eq!(bytes.capacity(), 64 * 1024);
+}
+
+#[test]
+fn reserve_vec_recycling() {
+    let mut bytes = BytesMut::with_capacity(16);
+    assert_eq!(bytes.capacity(), 16);
+    let addr = bytes.as_ptr() as usize;
+    bytes.put("0123456789012345".as_bytes());
+    assert_eq!(bytes.as_ptr() as usize, addr);
+    bytes.advance(10);
+    assert_eq!(bytes.capacity(), 6);
+    bytes.reserve(8);
+    assert_eq!(bytes.capacity(), 16);
+    assert_eq!(bytes.as_ptr() as usize, addr);
+}
+
+#[test]
+fn reserve_in_arc_unique_does_not_overallocate() {
+    let mut bytes = BytesMut::with_capacity(1000);
+    let _ = bytes.split();
+
+    // now bytes is Arc and refcount == 1
+
+    assert_eq!(1000, bytes.capacity());
+    bytes.reserve(2001);
+    assert_eq!(2001, bytes.capacity());
+}
+
+#[test]
+fn reserve_in_arc_unique_doubles() {
+    let mut bytes = BytesMut::with_capacity(1000);
+    let _ = bytes.split();
+
+    // now bytes is Arc and refcount == 1
+
+    assert_eq!(1000, bytes.capacity());
+    bytes.reserve(1001);
+    assert_eq!(2000, bytes.capacity());
+}
+
+#[test]
+fn reserve_in_arc_nonunique_does_not_overallocate() {
+    let mut bytes = BytesMut::with_capacity(1000);
+    let _copy = bytes.split();
+
+    // now bytes is Arc and refcount == 2
+
+    assert_eq!(1000, bytes.capacity());
+    bytes.reserve(2001);
+    assert_eq!(2001, bytes.capacity());
+}
+
+#[test]
+fn extend_mut() {
+    let mut bytes = BytesMut::with_capacity(0);
+    bytes.extend(LONG);
+    assert_eq!(*bytes, LONG[..]);
+}
+
+#[test]
+fn extend_from_slice_mut() {
+    for &i in &[3, 34] {
+        let mut bytes = BytesMut::new();
+        bytes.extend_from_slice(&LONG[..i]);
+        bytes.extend_from_slice(&LONG[i..]);
+        assert_eq!(LONG[..], *bytes);
+    }
+}
+
+#[test]
+fn extend_mut_without_size_hint() {
+    let mut bytes = BytesMut::with_capacity(0);
+    let mut long_iter = LONG.iter();
+
+    // Use iter::from_fn since it doesn't know a size_hint
+    bytes.extend(std::iter::from_fn(|| long_iter.next()));
+    assert_eq!(*bytes, LONG[..]);
+}
+
+#[test]
+fn from_static() {
+    let mut a = Bytes::from_static(b"ab");
+    let b = a.split_off(1);
+
+    assert_eq!(a, b"a"[..]);
+    assert_eq!(b, b"b"[..]);
+}
+
+#[test]
+fn advance_static() {
+    let mut a = Bytes::from_static(b"hello world");
+    a.advance(6);
+    assert_eq!(a, &b"world"[..]);
+}
+
+#[test]
+fn advance_vec() {
+    let mut a = Bytes::from(b"hello world boooo yah world zomg wat wat".to_vec());
+    a.advance(16);
+    assert_eq!(a, b"o yah world zomg wat wat"[..]);
+
+    a.advance(4);
+    assert_eq!(a, b"h world zomg wat wat"[..]);
+
+    a.advance(6);
+    assert_eq!(a, b"d zomg wat wat"[..]);
+}
+
+#[test]
+fn advance_bytes_mut() {
+    let mut a = BytesMut::from("hello world boooo yah world zomg wat wat");
+    a.advance(16);
+    assert_eq!(a, b"o yah world zomg wat wat"[..]);
+
+    a.advance(4);
+    assert_eq!(a, b"h world zomg wat wat"[..]);
+
+    // Reserve some space.
+    a.reserve(1024);
+    assert_eq!(a, b"h world zomg wat wat"[..]);
+
+    a.advance(6);
+    assert_eq!(a, b"d zomg wat wat"[..]);
+}
+
+#[test]
+#[should_panic]
+fn advance_past_len() {
+    let mut a = BytesMut::from("hello world");
+    a.advance(20);
+}
+
+#[test]
+// Only run these tests on little endian systems. CI uses qemu for testing
+// big endian... and qemu doesn't really support threading all that well.
+#[cfg(any(miri, target_endian = "little"))]
+fn stress() {
+    // Tests promoting a buffer from a vec -> shared in a concurrent situation
+    use std::sync::{Arc, Barrier};
+    use std::thread;
+
+    const THREADS: usize = 8;
+    const ITERS: usize = if cfg!(miri) { 100 } else { 1_000 };
+
+    for i in 0..ITERS {
+        let data = [i as u8; 256];
+        let buf = Arc::new(Bytes::copy_from_slice(&data[..]));
+
+        let barrier = Arc::new(Barrier::new(THREADS));
+        let mut joins = Vec::with_capacity(THREADS);
+
+        for _ in 0..THREADS {
+            let c = barrier.clone();
+            let buf = buf.clone();
+
+            joins.push(thread::spawn(move || {
+                c.wait();
+                let buf: Bytes = (*buf).clone();
+                drop(buf);
+            }));
+        }
+
+        for th in joins {
+            th.join().unwrap();
+        }
+
+        assert_eq!(*buf, data[..]);
+    }
+}
+
+#[test]
+fn partial_eq_bytesmut() {
+    let bytes = Bytes::from(&b"The quick red fox"[..]);
+    let bytesmut = BytesMut::from(&b"The quick red fox"[..]);
+    assert!(bytes == bytesmut);
+    assert!(bytesmut == bytes);
+    let bytes2 = Bytes::from(&b"Jumped over the lazy brown dog"[..]);
+    assert!(bytes2 != bytesmut);
+    assert!(bytesmut != bytes2);
+}
+
+/*
+#[test]
+fn bytes_unsplit_basic() {
+    let buf = Bytes::from(&b"aaabbbcccddd"[..]);
+
+    let splitted = buf.split_off(6);
+    assert_eq!(b"aaabbb", &buf[..]);
+    assert_eq!(b"cccddd", &splitted[..]);
+
+    buf.unsplit(splitted);
+    assert_eq!(b"aaabbbcccddd", &buf[..]);
+}
+
+#[test]
+fn bytes_unsplit_empty_other() {
+    let buf = Bytes::from(&b"aaabbbcccddd"[..]);
+
+    // empty other
+    let other = Bytes::new();
+
+    buf.unsplit(other);
+    assert_eq!(b"aaabbbcccddd", &buf[..]);
+}
+
+#[test]
+fn bytes_unsplit_empty_self() {
+    // empty self
+    let mut buf = Bytes::new();
+
+    let mut other = Bytes::with_capacity(64);
+    other.extend_from_slice(b"aaabbbcccddd");
+
+    buf.unsplit(other);
+    assert_eq!(b"aaabbbcccddd", &buf[..]);
+}
+
+#[test]
+fn bytes_unsplit_arc_different() {
+    let mut buf = Bytes::with_capacity(64);
+    buf.extend_from_slice(b"aaaabbbbeeee");
+
+    buf.split_off(8); //arc
+
+    let mut buf2 = Bytes::with_capacity(64);
+    buf2.extend_from_slice(b"ccccddddeeee");
+
+    buf2.split_off(8); //arc
+
+    buf.unsplit(buf2);
+    assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
+}
+
+#[test]
+fn bytes_unsplit_arc_non_contiguous() {
+    let mut buf = Bytes::with_capacity(64);
+    buf.extend_from_slice(b"aaaabbbbeeeeccccdddd");
+
+    let mut buf2 = buf.split_off(8); //arc
+
+    let buf3 = buf2.split_off(4); //arc
+
+    buf.unsplit(buf3);
+    assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
+}
+
+#[test]
+fn bytes_unsplit_two_split_offs() {
+    let mut buf = Bytes::with_capacity(64);
+    buf.extend_from_slice(b"aaaabbbbccccdddd");
+
+    let mut buf2 = buf.split_off(8); //arc
+    let buf3 = buf2.split_off(4); //arc
+
+    buf2.unsplit(buf3);
+    buf.unsplit(buf2);
+    assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
+}
+
+#[test]
+fn bytes_unsplit_overlapping_references() {
+    let mut buf = Bytes::with_capacity(64);
+    buf.extend_from_slice(b"abcdefghijklmnopqrstuvwxyz");
+    let mut buf0010 = buf.slice(0..10);
+    let buf1020 = buf.slice(10..20);
+    let buf0515 = buf.slice(5..15);
+    buf0010.unsplit(buf1020);
+    assert_eq!(b"abcdefghijklmnopqrst", &buf0010[..]);
+    assert_eq!(b"fghijklmno", &buf0515[..]);
+}
+*/
+
+#[test]
+fn bytes_mut_unsplit_basic() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aaabbbcccddd");
+
+    let splitted = buf.split_off(6);
+    assert_eq!(b"aaabbb", &buf[..]);
+    assert_eq!(b"cccddd", &splitted[..]);
+
+    buf.unsplit(splitted);
+    assert_eq!(b"aaabbbcccddd", &buf[..]);
+}
+
+#[test]
+fn bytes_mut_unsplit_empty_other() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aaabbbcccddd");
+
+    // empty other
+    let other = BytesMut::new();
+
+    buf.unsplit(other);
+    assert_eq!(b"aaabbbcccddd", &buf[..]);
+}
+
+#[test]
+fn bytes_mut_unsplit_empty_self() {
+    // empty self
+    let mut buf = BytesMut::new();
+
+    let mut other = BytesMut::with_capacity(64);
+    other.extend_from_slice(b"aaabbbcccddd");
+
+    buf.unsplit(other);
+    assert_eq!(b"aaabbbcccddd", &buf[..]);
+}
+
+#[test]
+fn bytes_mut_unsplit_other_keeps_capacity() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aabb");
+
+    // non empty other created "from" buf
+    let mut other = buf.split_off(buf.len());
+    other.extend_from_slice(b"ccddee");
+    buf.unsplit(other);
+
+    assert_eq!(buf.capacity(), 64);
+}
+
+#[test]
+fn bytes_mut_unsplit_empty_other_keeps_capacity() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aabbccddee");
+
+    // empty other created "from" buf
+    let other = buf.split_off(buf.len());
+    buf.unsplit(other);
+
+    assert_eq!(buf.capacity(), 64);
+}
+
+#[test]
+fn bytes_mut_unsplit_arc_different() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aaaabbbbeeee");
+
+    let _ = buf.split_off(8); //arc
+
+    let mut buf2 = BytesMut::with_capacity(64);
+    buf2.extend_from_slice(b"ccccddddeeee");
+
+    let _ = buf2.split_off(8); //arc
+
+    buf.unsplit(buf2);
+    assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
+}
+
+#[test]
+fn bytes_mut_unsplit_arc_non_contiguous() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aaaabbbbeeeeccccdddd");
+
+    let mut buf2 = buf.split_off(8); //arc
+
+    let buf3 = buf2.split_off(4); //arc
+
+    buf.unsplit(buf3);
+    assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
+}
+
+#[test]
+fn bytes_mut_unsplit_two_split_offs() {
+    let mut buf = BytesMut::with_capacity(64);
+    buf.extend_from_slice(b"aaaabbbbccccdddd");
+
+    let mut buf2 = buf.split_off(8); //arc
+    let buf3 = buf2.split_off(4); //arc
+
+    buf2.unsplit(buf3);
+    buf.unsplit(buf2);
+    assert_eq!(b"aaaabbbbccccdddd", &buf[..]);
+}
+
+#[test]
+fn from_iter_no_size_hint() {
+    use std::iter;
+
+    let mut expect = vec![];
+
+    let actual: Bytes = iter::repeat(b'x')
+        .scan(100, |cnt, item| {
+            if *cnt >= 1 {
+                *cnt -= 1;
+                expect.push(item);
+                Some(item)
+            } else {
+                None
+            }
+        })
+        .collect();
+
+    assert_eq!(&actual[..], &expect[..]);
+}
+
+fn test_slice_ref(bytes: &Bytes, start: usize, end: usize, expected: &[u8]) {
+    let slice = &(bytes.as_ref()[start..end]);
+    let sub = bytes.slice_ref(&slice);
+    assert_eq!(&sub[..], expected);
+}
+
+#[test]
+fn slice_ref_works() {
+    let bytes = Bytes::from(&b"012345678"[..]);
+
+    test_slice_ref(&bytes, 0, 0, b"");
+    test_slice_ref(&bytes, 0, 3, b"012");
+    test_slice_ref(&bytes, 2, 6, b"2345");
+    test_slice_ref(&bytes, 7, 9, b"78");
+    test_slice_ref(&bytes, 9, 9, b"");
+}
+
+#[test]
+fn slice_ref_empty() {
+    let bytes = Bytes::from(&b""[..]);
+    let slice = &(bytes.as_ref()[0..0]);
+
+    let sub = bytes.slice_ref(&slice);
+    assert_eq!(&sub[..], b"");
+}
+
+#[test]
+fn slice_ref_empty_subslice() {
+    let bytes = Bytes::from(&b"abcde"[..]);
+    let subbytes = bytes.slice(0..0);
+    let slice = &subbytes[..];
+    // The `slice` object is derived from the original `bytes` object
+    // so `slice_ref` should work.
+    assert_eq!(Bytes::new(), bytes.slice_ref(slice));
+}
+
+#[test]
+#[should_panic]
+fn slice_ref_catches_not_a_subset() {
+    let bytes = Bytes::from(&b"012345678"[..]);
+    let slice = &b"012345"[0..4];
+
+    bytes.slice_ref(slice);
+}
+
+#[test]
+fn slice_ref_not_an_empty_subset() {
+    let bytes = Bytes::from(&b"012345678"[..]);
+    let slice = &b""[0..0];
+
+    assert_eq!(Bytes::new(), bytes.slice_ref(slice));
+}
+
+#[test]
+fn empty_slice_ref_not_an_empty_subset() {
+    let bytes = Bytes::new();
+    let slice = &b"some other slice"[0..0];
+
+    assert_eq!(Bytes::new(), bytes.slice_ref(slice));
+}
+
+#[test]
+fn bytes_buf_mut_advance() {
+    let mut bytes = BytesMut::with_capacity(1024);
+
+    unsafe {
+        let ptr = bytes.chunk_mut().as_mut_ptr();
+        assert_eq!(1024, bytes.chunk_mut().len());
+
+        bytes.advance_mut(10);
+
+        let next = bytes.chunk_mut().as_mut_ptr();
+        assert_eq!(1024 - 10, bytes.chunk_mut().len());
+        assert_eq!(ptr.offset(10), next);
+
+        // advance to the end
+        bytes.advance_mut(1024 - 10);
+
+        // The buffer size is doubled
+        assert_eq!(1024, bytes.chunk_mut().len());
+    }
+}
+
+#[test]
+fn bytes_buf_mut_reuse_when_fully_consumed() {
+    use bytes::{Buf, BytesMut};
+    let mut buf = BytesMut::new();
+    buf.reserve(8192);
+    buf.extend_from_slice(&[0u8; 100][..]);
+
+    let p = &buf[0] as *const u8;
+    buf.advance(100);
+
+    buf.reserve(8192);
+    buf.extend_from_slice(b" ");
+
+    assert_eq!(&buf[0] as *const u8, p);
+}
+
+#[test]
+#[should_panic]
+fn bytes_reserve_overflow() {
+    let mut bytes = BytesMut::with_capacity(1024);
+    bytes.put_slice(b"hello world");
+
+    bytes.reserve(usize::MAX);
+}
+
+#[test]
+fn bytes_with_capacity_but_empty() {
+    // See https://github.com/tokio-rs/bytes/issues/340
+    let vec = Vec::with_capacity(1);
+    let _ = Bytes::from(vec);
+}
+
+#[test]
+fn bytes_put_bytes() {
+    let mut bytes = BytesMut::new();
+    bytes.put_u8(17);
+    bytes.put_bytes(19, 2);
+    assert_eq!([17, 19, 19], bytes.as_ref());
+}
+
+#[test]
+fn box_slice_empty() {
+    // See https://github.com/tokio-rs/bytes/issues/340
+    let empty: Box<[u8]> = Default::default();
+    let b = Bytes::from(empty);
+    assert!(b.is_empty());
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_bytes_odd_alloc.rs b/android/vendor/bytes-1.1.0/tests/test_bytes_odd_alloc.rs
new file mode 100644
index 0000000..04ba7c2
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_bytes_odd_alloc.rs
@@ -0,0 +1,69 @@
+//! Test using `Bytes` with an allocator that hands out "odd" pointers for
+//! vectors (pointers where the LSB is set).
+
+#![cfg(not(miri))] // Miri does not support custom allocators (also, Miri is "odd" by default with 50% chance)
+
+use std::alloc::{GlobalAlloc, Layout, System};
+use std::ptr;
+
+use bytes::Bytes;
+
+#[global_allocator]
+static ODD: Odd = Odd;
+
+struct Odd;
+
+unsafe impl GlobalAlloc for Odd {
+    unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
+        if layout.align() == 1 && layout.size() > 0 {
+            // Allocate slightly bigger so that we can offset the pointer by 1
+            let size = layout.size() + 1;
+            let new_layout = match Layout::from_size_align(size, 1) {
+                Ok(layout) => layout,
+                Err(_err) => return ptr::null_mut(),
+            };
+            let ptr = System.alloc(new_layout);
+            if !ptr.is_null() {
+                let ptr = ptr.offset(1);
+                ptr
+            } else {
+                ptr
+            }
+        } else {
+            System.alloc(layout)
+        }
+    }
+
+    unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
+        if layout.align() == 1 && layout.size() > 0 {
+            let size = layout.size() + 1;
+            let new_layout = match Layout::from_size_align(size, 1) {
+                Ok(layout) => layout,
+                Err(_err) => std::process::abort(),
+            };
+            System.dealloc(ptr.offset(-1), new_layout);
+        } else {
+            System.dealloc(ptr, layout);
+        }
+    }
+}
+
+#[test]
+fn sanity_check_odd_allocator() {
+    let vec = vec![33u8; 1024];
+    let p = vec.as_ptr() as usize;
+    assert!(p & 0x1 == 0x1, "{:#b}", p);
+}
+
+#[test]
+fn test_bytes_from_vec_drop() {
+    let vec = vec![33u8; 1024];
+    let _b = Bytes::from(vec);
+}
+
+#[test]
+fn test_bytes_clone_drop() {
+    let vec = vec![33u8; 1024];
+    let b1 = Bytes::from(vec);
+    let _b2 = b1.clone();
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_bytes_vec_alloc.rs b/android/vendor/bytes-1.1.0/tests/test_bytes_vec_alloc.rs
new file mode 100644
index 0000000..418a9cd
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_bytes_vec_alloc.rs
@@ -0,0 +1,79 @@
+use std::alloc::{GlobalAlloc, Layout, System};
+use std::{mem, ptr};
+
+use bytes::{Buf, Bytes};
+
+#[global_allocator]
+static LEDGER: Ledger = Ledger;
+
+struct Ledger;
+
+const USIZE_SIZE: usize = mem::size_of::<usize>();
+
+unsafe impl GlobalAlloc for Ledger {
+    unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
+        if layout.align() == 1 && layout.size() > 0 {
+            // Allocate extra space to stash a record of
+            // how much space there was.
+            let orig_size = layout.size();
+            let size = orig_size + USIZE_SIZE;
+            let new_layout = match Layout::from_size_align(size, 1) {
+                Ok(layout) => layout,
+                Err(_err) => return ptr::null_mut(),
+            };
+            let ptr = System.alloc(new_layout);
+            if !ptr.is_null() {
+                (ptr as *mut usize).write(orig_size);
+                let ptr = ptr.offset(USIZE_SIZE as isize);
+                ptr
+            } else {
+                ptr
+            }
+        } else {
+            System.alloc(layout)
+        }
+    }
+
+    unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
+        if layout.align() == 1 && layout.size() > 0 {
+            let off_ptr = (ptr as *mut usize).offset(-1);
+            let orig_size = off_ptr.read();
+            if orig_size != layout.size() {
+                panic!(
+                    "bad dealloc: alloc size was {}, dealloc size is {}",
+                    orig_size,
+                    layout.size()
+                );
+            }
+
+            let new_layout = match Layout::from_size_align(layout.size() + USIZE_SIZE, 1) {
+                Ok(layout) => layout,
+                Err(_err) => std::process::abort(),
+            };
+            System.dealloc(off_ptr as *mut u8, new_layout);
+        } else {
+            System.dealloc(ptr, layout);
+        }
+    }
+}
+#[test]
+fn test_bytes_advance() {
+    let mut bytes = Bytes::from(vec![10, 20, 30]);
+    bytes.advance(1);
+    drop(bytes);
+}
+
+#[test]
+fn test_bytes_truncate() {
+    let mut bytes = Bytes::from(vec![10, 20, 30]);
+    bytes.truncate(2);
+    drop(bytes);
+}
+
+#[test]
+fn test_bytes_truncate_and_advance() {
+    let mut bytes = Bytes::from(vec![10, 20, 30]);
+    bytes.truncate(2);
+    bytes.advance(1);
+    drop(bytes);
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_chain.rs b/android/vendor/bytes-1.1.0/tests/test_chain.rs
new file mode 100644
index 0000000..affaf7a
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_chain.rs
@@ -0,0 +1,155 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::{Buf, BufMut, Bytes};
+#[cfg(feature = "std")]
+use std::io::IoSlice;
+
+#[test]
+fn collect_two_bufs() {
+    let a = Bytes::from(&b"hello"[..]);
+    let b = Bytes::from(&b"world"[..]);
+
+    let res = a.chain(b).copy_to_bytes(10);
+    assert_eq!(res, &b"helloworld"[..]);
+}
+
+#[test]
+fn writing_chained() {
+    let mut a = [0u8; 64];
+    let mut b = [0u8; 64];
+
+    {
+        let mut buf = (&mut a[..]).chain_mut(&mut b[..]);
+
+        for i in 0u8..128 {
+            buf.put_u8(i);
+        }
+    }
+
+    for i in 0..64 {
+        let expect = i as u8;
+        assert_eq!(expect, a[i]);
+        assert_eq!(expect + 64, b[i]);
+    }
+}
+
+#[test]
+fn iterating_two_bufs() {
+    let a = Bytes::from(&b"hello"[..]);
+    let b = Bytes::from(&b"world"[..]);
+
+    let res: Vec<u8> = a.chain(b).into_iter().collect();
+    assert_eq!(res, &b"helloworld"[..]);
+}
+
+#[cfg(feature = "std")]
+#[test]
+fn vectored_read() {
+    let a = Bytes::from(&b"hello"[..]);
+    let b = Bytes::from(&b"world"[..]);
+
+    let mut buf = a.chain(b);
+
+    {
+        let b1: &[u8] = &mut [];
+        let b2: &[u8] = &mut [];
+        let b3: &[u8] = &mut [];
+        let b4: &[u8] = &mut [];
+        let mut iovecs = [
+            IoSlice::new(b1),
+            IoSlice::new(b2),
+            IoSlice::new(b3),
+            IoSlice::new(b4),
+        ];
+
+        assert_eq!(2, buf.chunks_vectored(&mut iovecs));
+        assert_eq!(iovecs[0][..], b"hello"[..]);
+        assert_eq!(iovecs[1][..], b"world"[..]);
+        assert_eq!(iovecs[2][..], b""[..]);
+        assert_eq!(iovecs[3][..], b""[..]);
+    }
+
+    buf.advance(2);
+
+    {
+        let b1: &[u8] = &mut [];
+        let b2: &[u8] = &mut [];
+        let b3: &[u8] = &mut [];
+        let b4: &[u8] = &mut [];
+        let mut iovecs = [
+            IoSlice::new(b1),
+            IoSlice::new(b2),
+            IoSlice::new(b3),
+            IoSlice::new(b4),
+        ];
+
+        assert_eq!(2, buf.chunks_vectored(&mut iovecs));
+        assert_eq!(iovecs[0][..], b"llo"[..]);
+        assert_eq!(iovecs[1][..], b"world"[..]);
+        assert_eq!(iovecs[2][..], b""[..]);
+        assert_eq!(iovecs[3][..], b""[..]);
+    }
+
+    buf.advance(3);
+
+    {
+        let b1: &[u8] = &mut [];
+        let b2: &[u8] = &mut [];
+        let b3: &[u8] = &mut [];
+        let b4: &[u8] = &mut [];
+        let mut iovecs = [
+            IoSlice::new(b1),
+            IoSlice::new(b2),
+            IoSlice::new(b3),
+            IoSlice::new(b4),
+        ];
+
+        assert_eq!(1, buf.chunks_vectored(&mut iovecs));
+        assert_eq!(iovecs[0][..], b"world"[..]);
+        assert_eq!(iovecs[1][..], b""[..]);
+        assert_eq!(iovecs[2][..], b""[..]);
+        assert_eq!(iovecs[3][..], b""[..]);
+    }
+
+    buf.advance(3);
+
+    {
+        let b1: &[u8] = &mut [];
+        let b2: &[u8] = &mut [];
+        let b3: &[u8] = &mut [];
+        let b4: &[u8] = &mut [];
+        let mut iovecs = [
+            IoSlice::new(b1),
+            IoSlice::new(b2),
+            IoSlice::new(b3),
+            IoSlice::new(b4),
+        ];
+
+        assert_eq!(1, buf.chunks_vectored(&mut iovecs));
+        assert_eq!(iovecs[0][..], b"ld"[..]);
+        assert_eq!(iovecs[1][..], b""[..]);
+        assert_eq!(iovecs[2][..], b""[..]);
+        assert_eq!(iovecs[3][..], b""[..]);
+    }
+}
+
+#[test]
+fn chain_get_bytes() {
+    let mut ab = Bytes::copy_from_slice(b"ab");
+    let mut cd = Bytes::copy_from_slice(b"cd");
+    let ab_ptr = ab.as_ptr();
+    let cd_ptr = cd.as_ptr();
+    let mut chain = (&mut ab).chain(&mut cd);
+    let a = chain.copy_to_bytes(1);
+    let bc = chain.copy_to_bytes(2);
+    let d = chain.copy_to_bytes(1);
+
+    assert_eq!(Bytes::copy_from_slice(b"a"), a);
+    assert_eq!(Bytes::copy_from_slice(b"bc"), bc);
+    assert_eq!(Bytes::copy_from_slice(b"d"), d);
+
+    // assert `get_bytes` did not allocate
+    assert_eq!(ab_ptr, a.as_ptr());
+    // assert `get_bytes` did not allocate
+    assert_eq!(cd_ptr.wrapping_offset(1), d.as_ptr());
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_debug.rs b/android/vendor/bytes-1.1.0/tests/test_debug.rs
new file mode 100644
index 0000000..08d2f25
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_debug.rs
@@ -0,0 +1,35 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::Bytes;
+
+#[test]
+fn fmt() {
+    let vec: Vec<_> = (0..0x100).map(|b| b as u8).collect();
+
+    let expected = "b\"\
+        \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07\
+        \\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f\
+        \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\
+        \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f\
+        \x20!\\\"#$%&'()*+,-./0123456789:;<=>?\
+        @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_\
+        `abcdefghijklmnopqrstuvwxyz{|}~\\x7f\
+        \\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\
+        \\x88\\x89\\x8a\\x8b\\x8c\\x8d\\x8e\\x8f\
+        \\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\
+        \\x98\\x99\\x9a\\x9b\\x9c\\x9d\\x9e\\x9f\
+        \\xa0\\xa1\\xa2\\xa3\\xa4\\xa5\\xa6\\xa7\
+        \\xa8\\xa9\\xaa\\xab\\xac\\xad\\xae\\xaf\
+        \\xb0\\xb1\\xb2\\xb3\\xb4\\xb5\\xb6\\xb7\
+        \\xb8\\xb9\\xba\\xbb\\xbc\\xbd\\xbe\\xbf\
+        \\xc0\\xc1\\xc2\\xc3\\xc4\\xc5\\xc6\\xc7\
+        \\xc8\\xc9\\xca\\xcb\\xcc\\xcd\\xce\\xcf\
+        \\xd0\\xd1\\xd2\\xd3\\xd4\\xd5\\xd6\\xd7\
+        \\xd8\\xd9\\xda\\xdb\\xdc\\xdd\\xde\\xdf\
+        \\xe0\\xe1\\xe2\\xe3\\xe4\\xe5\\xe6\\xe7\
+        \\xe8\\xe9\\xea\\xeb\\xec\\xed\\xee\\xef\
+        \\xf0\\xf1\\xf2\\xf3\\xf4\\xf5\\xf6\\xf7\
+        \\xf8\\xf9\\xfa\\xfb\\xfc\\xfd\\xfe\\xff\"";
+
+    assert_eq!(expected, format!("{:?}", Bytes::from(vec)));
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_iter.rs b/android/vendor/bytes-1.1.0/tests/test_iter.rs
new file mode 100644
index 0000000..a5bfddd
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_iter.rs
@@ -0,0 +1,21 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::Bytes;
+
+#[test]
+fn iter_len() {
+    let buf = Bytes::from_static(b"hello world");
+    let iter = buf.iter();
+
+    assert_eq!(iter.size_hint(), (11, Some(11)));
+    assert_eq!(iter.len(), 11);
+}
+
+#[test]
+fn empty_iter_len() {
+    let buf = Bytes::from_static(b"");
+    let iter = buf.iter();
+
+    assert_eq!(iter.size_hint(), (0, Some(0)));
+    assert_eq!(iter.len(), 0);
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_reader.rs b/android/vendor/bytes-1.1.0/tests/test_reader.rs
new file mode 100644
index 0000000..897aff6
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_reader.rs
@@ -0,0 +1,29 @@
+#![warn(rust_2018_idioms)]
+#![cfg(feature = "std")]
+
+use std::io::{BufRead, Read};
+
+use bytes::Buf;
+
+#[test]
+fn read() {
+    let buf1 = &b"hello "[..];
+    let buf2 = &b"world"[..];
+    let buf = Buf::chain(buf1, buf2); // Disambiguate with Read::chain
+    let mut buffer = Vec::new();
+    buf.reader().read_to_end(&mut buffer).unwrap();
+    assert_eq!(b"hello world", &buffer[..]);
+}
+
+#[test]
+fn buf_read() {
+    let buf1 = &b"hell"[..];
+    let buf2 = &b"o\nworld"[..];
+    let mut reader = Buf::chain(buf1, buf2).reader();
+    let mut line = String::new();
+    reader.read_line(&mut line).unwrap();
+    assert_eq!("hello\n", &line);
+    line.clear();
+    reader.read_line(&mut line).unwrap();
+    assert_eq!("world", &line);
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_serde.rs b/android/vendor/bytes-1.1.0/tests/test_serde.rs
new file mode 100644
index 0000000..cf4aeff
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_serde.rs
@@ -0,0 +1,20 @@
+#![cfg(feature = "serde")]
+#![warn(rust_2018_idioms)]
+
+use serde_test::{assert_tokens, Token};
+
+#[test]
+fn test_ser_de_empty() {
+    let b = bytes::Bytes::new();
+    assert_tokens(&b, &[Token::Bytes(b"")]);
+    let b = bytes::BytesMut::with_capacity(0);
+    assert_tokens(&b, &[Token::Bytes(b"")]);
+}
+
+#[test]
+fn test_ser_de() {
+    let b = bytes::Bytes::from(&b"bytes"[..]);
+    assert_tokens(&b, &[Token::Bytes(b"bytes")]);
+    let b = bytes::BytesMut::from(&b"bytes"[..]);
+    assert_tokens(&b, &[Token::Bytes(b"bytes")]);
+}
diff --git a/android/vendor/bytes-1.1.0/tests/test_take.rs b/android/vendor/bytes-1.1.0/tests/test_take.rs
new file mode 100644
index 0000000..51df91d
--- /dev/null
+++ b/android/vendor/bytes-1.1.0/tests/test_take.rs
@@ -0,0 +1,32 @@
+#![warn(rust_2018_idioms)]
+
+use bytes::buf::Buf;
+use bytes::Bytes;
+
+#[test]
+fn long_take() {
+    // Tests that get a take with a size greater than the buffer length will not
+    // overrun the buffer. Regression test for #138.
+    let buf = b"hello world".take(100);
+    assert_eq!(11, buf.remaining());
+    assert_eq!(b"hello world", buf.chunk());
+}
+
+#[test]
+fn take_copy_to_bytes() {
+    let mut abcd = Bytes::copy_from_slice(b"abcd");
+    let abcd_ptr = abcd.as_ptr();
+    let mut take = (&mut abcd).take(2);
+    let a = take.copy_to_bytes(1);
+    assert_eq!(Bytes::copy_from_slice(b"a"), a);
+    // assert `to_bytes` did not allocate
+    assert_eq!(abcd_ptr, a.as_ptr());
+    assert_eq!(Bytes::copy_from_slice(b"bcd"), abcd);
+}
+
+#[test]
+#[should_panic]
+fn take_copy_to_bytes_panics() {
+    let abcd = Bytes::copy_from_slice(b"abcd");
+    abcd.take(2).copy_to_bytes(3);
+}
diff --git a/android/vendor/clap-cargo-0.9.1/.cargo-checksum.json b/android/vendor/clap-cargo-0.9.1/.cargo-checksum.json
new file mode 100644
index 0000000..af4560c
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.lock":"d80486e11a23b55571cfbca6b938bc7baffebc5ce8c40699a5e2eee2c8cde0fe","Cargo.toml":"3b7542fd0e8541090b084cad752392a49346c95c7c2a3ba32c5bcc16ddaeda16","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"645d3370873b52f68751214d047eea61f517a3c4c1ca285c23fe1158d6bb2434","README.md":"9eefa2737388addc70d2758c45f8cff8ce826498aa079069b188282d97a4e3a0","examples/flags.rs":"4f9d14c2158bc4071283ba2782426474a62d196b7eb52a5ac20c5e906aa6e87a","src/features.rs":"482eda687e1385bc3b0b5836e752509ad982e75d1fcbb7ed8fc5a20d3df09e5d","src/lib.rs":"82792702632fcc59547385063af0ad48c0b32546ad14bf2f6a2139f0f1e84865","src/manifest.rs":"1207fd8dffb4c48369b76d63ba1ec1d11b83bdc9ea74b4049f856b4bf6385837","src/workspace.rs":"3d645a713d918be4308b12c2e5f804b0629a4e859f62882c788c71326f8898ef"},"package":"841b17c26cdae63b80cd9014f4fb779b761c388908bdf58e15223a08d65e9b08"}
\ No newline at end of file
diff --git a/android/vendor/clap-cargo-0.9.1/Cargo.lock b/android/vendor/clap-cargo-0.9.1/Cargo.lock
new file mode 100644
index 0000000..87c0731
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/Cargo.lock
@@ -0,0 +1,254 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "camino"
+version = "1.0.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "cargo-platform"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "cargo_metadata"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3abb7553d5b9b8421c6de7cb02606ff15e0c6eea7d8eadd75ef013fd636bec36"
+dependencies = [
+ "camino",
+ "cargo-platform",
+ "semver",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "clap"
+version = "3.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "190814073e85d238f31ff738fcb0bf6910cedeb73376c87cd69291028966fd83"
+dependencies = [
+ "bitflags",
+ "clap_derive",
+ "clap_lex",
+ "indexmap",
+ "once_cell",
+ "textwrap",
+]
+
+[[package]]
+name = "clap-cargo"
+version = "0.9.1"
+dependencies = [
+ "cargo_metadata",
+ "clap",
+ "doc-comment",
+]
+
+[[package]]
+name = "clap_derive"
+version = "3.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "759bf187376e1afa7b85b959e6a664a3e7a95203415dba952ad19139e798f902"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "clap_lex"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
+dependencies = [
+ "os_str_bytes",
+]
+
+[[package]]
+name = "doc-comment"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
+
+[[package]]
+name = "hashbrown"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3"
+
+[[package]]
+name = "heck"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
+
+[[package]]
+name = "indexmap"
+version = "1.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
+name = "itoa"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
+
+[[package]]
+name = "once_cell"
+version = "1.12.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
+
+[[package]]
+name = "os_str_bytes"
+version = "6.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa"
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.20"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "ryu"
+version = "1.0.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
+
+[[package]]
+name = "semver"
+version = "1.0.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1"
+dependencies = [
+ "serde",
+]
+
+[[package]]
+name = "serde"
+version = "1.0.137"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
+dependencies = [
+ "serde_derive",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.137"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.82"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
+dependencies = [
+ "itoa",
+ "ryu",
+ "serde",
+]
+
+[[package]]
+name = "syn"
+version = "1.0.98"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "textwrap"
+version = "0.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
+
+[[package]]
+name = "version_check"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
diff --git a/android/vendor/clap-cargo-0.9.1/Cargo.toml b/android/vendor/clap-cargo-0.9.1/Cargo.toml
new file mode 100644
index 0000000..2457823
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/Cargo.toml
@@ -0,0 +1,93 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2021"
+rust-version = "1.56.1"
+name = "clap-cargo"
+version = "0.9.1"
+authors = ["Ed Page <eopage@gmail.com>"]
+include = [
+    "src/**/*",
+    "Cargo.toml",
+    "LICENSE*",
+    "README.md",
+    "examples/**/*",
+]
+description = "Re-usable CLI flags for `cargo` plugins"
+documentation = "https://docs.rs/clap-cargo"
+readme = "README.md"
+keywords = ["cargo"]
+categories = ["development-tools::cargo-plugins"]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/crate-ci/clap-cargo"
+resolver = "2"
+
+[package.metadata.docs.rs]
+features = ["cargo_metadata"]
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+search = "Unreleased"
+replace = "{{version}}"
+min = 1
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+search = '\.\.\.HEAD'
+replace = "...{{tag_name}}"
+exactly = 1
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+search = "ReleaseDate"
+replace = "{{date}}"
+min = 1
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+search = "<!-- next-header -->"
+replace = """
+<!-- next-header -->
+## [Unreleased] - ReleaseDate
+"""
+exactly = 1
+
+[[package.metadata.release.pre-release-replacements]]
+file = "CHANGELOG.md"
+search = "<!-- next-url -->"
+replace = """
+<!-- next-url -->
+[Unreleased]: https://github.com/crate-ci/clap-cargo/compare/{{tag_name}}...HEAD"""
+exactly = 1
+
+[[package.metadata.release.pre-release-replacements]]
+file = "README.md"
+search = "clap-cargo = \"[0-9]+.[0-9]+.[0-9]+\""
+replace = "clap-cargo = \"{{version}}\""
+exactly = 1
+
+[dependencies.cargo_metadata]
+version = "0.15"
+optional = true
+
+[dependencies.clap]
+version = "3.0"
+features = [
+    "std",
+    "derive",
+]
+default-features = false
+
+[dependencies.doc-comment]
+version = "0.3"
+
+[features]
diff --git a/android/vendor/clap-cargo-0.9.1/LICENSE-APACHE b/android/vendor/clap-cargo-0.9.1/LICENSE-APACHE
new file mode 100644
index 0000000..8f71f43
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/LICENSE-APACHE
@@ -0,0 +1,202 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "{}"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright {yyyy} {name of copyright owner}
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/android/vendor/clap-cargo-0.9.1/LICENSE-MIT b/android/vendor/clap-cargo-0.9.1/LICENSE-MIT
new file mode 100644
index 0000000..22b8d4e
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/LICENSE-MIT
@@ -0,0 +1,19 @@
+Copyright (c) 2015 The assert_cli Developers
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/android/vendor/clap-cargo-0.9.1/README.md b/android/vendor/clap-cargo-0.9.1/README.md
new file mode 100644
index 0000000..86b11fa
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/README.md
@@ -0,0 +1,62 @@
+# clap-cargo
+
+> Re-usable CLI flags for `cargo` plugins
+
+[![codecov](https://codecov.io/gh/crate-ci/clap-cargo/branch/master/graph/badge.svg)](https://codecov.io/gh/crate-ci/clap-cargo)
+[![Documentation](https://img.shields.io/badge/docs-master-blue.svg)][Documentation]
+![License](https://img.shields.io/crates/l/clap-cargo.svg)
+[![Crates Status](https://img.shields.io/crates/v/clap-cargo.svg)](https://crates.io/crates/clap-cargo)
+
+## Install
+
+Add to your `Cargo.toml`:
+
+```toml
+[dependencies]
+clap-cargo = "0.9.1"
+```
+
+## Examples
+
+```rust
+// ...
+#[derive(Debug, clap::Parser)]
+struct Cli {
+    #[clap(flatten)]
+    manifest: clap_cargo::Manifest,
+    #[clap(flatten)]
+    workspace: clap_cargo::Workspace,
+    #[clap(flatten)]
+    features: clap_cargo::Features,
+}
+```
+
+## Relevant crates
+
+Other crates that might be useful for cargo plugins:
+* [escargot][escargot] for wrapping `cargo-build`, `carg-run`, `cargo-test`, etc.
+* [cargo_metadata][cargo_metadata] for getting crate information.
+* [clap-verbosity][clap-verbosity] for adding logging to your CLI.
+
+[escargot]: https://crates.io/crates/escargot
+[cargo_metadata]: https://crates.io/crates/cargo_metadata
+[clap-verbosity]: https://crates.io/crates/clap-verbosity-flag
+
+## License
+
+Licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally
+submitted for inclusion in the work by you, as defined in the Apache-2.0
+license, shall be dual licensed as above, without any additional terms or
+conditions.
+
+[Crates.io]: https://crates.io/crates/clap-cargo
+[Documentation]: https://docs.rs/clap-cargo
diff --git a/android/vendor/clap-cargo-0.9.1/examples/flags.rs b/android/vendor/clap-cargo-0.9.1/examples/flags.rs
new file mode 100644
index 0000000..a778778
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/examples/flags.rs
@@ -0,0 +1,16 @@
+use clap::Parser;
+
+#[derive(Debug, Parser)]
+struct Cli {
+    #[clap(flatten)]
+    manifest: clap_cargo::Manifest,
+    #[clap(flatten)]
+    workspace: clap_cargo::Workspace,
+    #[clap(flatten)]
+    features: clap_cargo::Features,
+}
+
+fn main() {
+    let args = Cli::parse();
+    println!("args = {:#?}", args);
+}
diff --git a/android/vendor/clap-cargo-0.9.1/src/features.rs b/android/vendor/clap-cargo-0.9.1/src/features.rs
new file mode 100644
index 0000000..7b09d9d
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/src/features.rs
@@ -0,0 +1,170 @@
+//! Cargo Feature Flags.
+
+#[derive(Default, Clone, Debug, PartialEq, Eq, clap::Args)]
+#[non_exhaustive]
+pub struct Features {
+    #[clap(long)]
+    /// Activate all available features
+    pub all_features: bool,
+    #[clap(long)]
+    /// Do not activate the `default` feature
+    pub no_default_features: bool,
+    #[clap(
+        short = 'F',
+        long,
+        require_value_delimiter = true,
+        value_delimiter = ' '
+    )]
+    /// Space-separated list of features to activate
+    pub features: Vec<String>,
+}
+
+#[cfg(feature = "cargo_metadata")]
+impl Features {
+    /// Forward these flags to the `cargo_metadata` crate.
+    ///
+    /// Note: Requires the features `cargo_metadata`.
+    pub fn forward_metadata<'m>(
+        &self,
+        meta: &'m mut cargo_metadata::MetadataCommand,
+    ) -> &'m mut cargo_metadata::MetadataCommand {
+        if self.all_features {
+            meta.features(cargo_metadata::CargoOpt::AllFeatures);
+        }
+        if self.no_default_features {
+            meta.features(cargo_metadata::CargoOpt::NoDefaultFeatures);
+        }
+        if !self.features.is_empty() {
+            meta.features(cargo_metadata::CargoOpt::SomeFeatures(
+                self.features.clone(),
+            ));
+        }
+        meta
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use clap::StructOpt;
+
+    #[test]
+    fn verify_app() {
+        #[derive(Debug, clap::StructOpt)]
+        struct Cli {
+            #[clap(flatten)]
+            features: Features,
+        }
+
+        use clap::CommandFactory;
+        Cli::command().debug_assert()
+    }
+
+    #[test]
+    fn parse_multiple_occurrences() {
+        #[derive(PartialEq, Eq, Debug, StructOpt)]
+        struct Args {
+            positional: Option<String>,
+            #[clap(flatten)]
+            features: Features,
+        }
+
+        assert_eq!(
+            Args {
+                positional: None,
+                features: Features {
+                    all_features: false,
+                    no_default_features: false,
+                    features: vec![]
+                }
+            },
+            Args::parse_from(&["test"])
+        );
+        assert_eq!(
+            Args {
+                positional: Some("foo".to_owned()),
+                features: Features {
+                    all_features: false,
+                    no_default_features: false,
+                    features: vec![]
+                }
+            },
+            Args::parse_from(&["test", "foo"])
+        );
+        assert_eq!(
+            Args {
+                positional: None,
+                features: Features {
+                    all_features: false,
+                    no_default_features: false,
+                    features: vec!["foo".to_owned()]
+                }
+            },
+            Args::parse_from(&["test", "--features", "foo"])
+        );
+        assert_eq!(
+            Args {
+                positional: None,
+                features: Features {
+                    all_features: false,
+                    no_default_features: false,
+                    features: vec!["foo".to_owned(), "bar".to_owned()]
+                }
+            },
+            Args::parse_from(&["test", "--features", "foo bar"])
+        );
+        assert_eq!(
+            Args {
+                positional: Some("baz".to_owned()),
+                features: Features {
+                    all_features: false,
+                    no_default_features: false,
+                    features: vec!["foo".to_owned(), "bar".to_owned()]
+                }
+            },
+            Args::parse_from(&["test", "--features", "foo bar", "baz"])
+        );
+        assert_eq!(
+            Args {
+                positional: Some("baz".to_owned()),
+                features: Features {
+                    all_features: false,
+                    no_default_features: false,
+                    features: vec!["foo".to_owned(), "bar".to_owned()]
+                }
+            },
+            Args::parse_from(&["test", "--features", "foo", "--features", "bar", "baz"])
+        );
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[test]
+    fn features_all() {
+        let mut metadata = cargo_metadata::MetadataCommand::new();
+        metadata.manifest_path("tests/fixtures/simple/Cargo.toml");
+
+        let features = Features {
+            all_features: true,
+            ..Default::default()
+        };
+        features.forward_metadata(&mut metadata);
+        metadata.exec().unwrap();
+        // TODO verify we forwarded correctly.
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[test]
+    fn features_none() {
+        let mut metadata = cargo_metadata::MetadataCommand::new();
+        metadata.manifest_path("tests/fixtures/simple/Cargo.toml");
+
+        let features = Features {
+            no_default_features: true,
+            ..Default::default()
+        };
+        features.forward_metadata(&mut metadata);
+        metadata.exec().unwrap();
+        // TODO verify we forwarded correctly.
+    }
+}
diff --git a/android/vendor/clap-cargo-0.9.1/src/lib.rs b/android/vendor/clap-cargo-0.9.1/src/lib.rs
new file mode 100644
index 0000000..947b609
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/src/lib.rs
@@ -0,0 +1,53 @@
+//! **clap-cargo**: Re-usable CLI flags for `cargo` plugins
+//!
+//! ## Install
+//!
+//! Add to your `Cargo.toml`:
+//!
+//! ```toml
+//! [dependencies]
+//! clap-cargo = "0.1"
+//! ```
+//!
+//! ## Examples
+//!
+//! ```rust
+//! // ...
+//! #[derive(Debug, clap::Parser)]
+//! struct Cli {
+//!     #[clap(flatten)]
+//!     manifest: clap_cargo::Manifest,
+//!     #[clap(flatten)]
+//!     workspace: clap_cargo::Workspace,
+//!     #[clap(flatten)]
+//!     features: clap_cargo::Features,
+//! }
+//! ```
+//!
+//! ## Relevant crates
+//!
+//! Other crates that might be useful for cargo plugins:
+//! * [escargot][escargot] for wrapping `cargo-build`, `carg-run`, `cargo-test`, etc.
+//! * [cargo_metadata][cargo_metadata] for getting crate information.
+//! * [clap-verbosity][clap-verbosity] for adding logging to your CLI.
+//!
+//! [escargot]: https://crates.io/crates/escargot
+//! [cargo_metadata]: https://crates.io/crates/cargo_metadata
+//! [clap-verbosity]: https://crates.io/crates/clap-verbosity-flag
+
+#![warn(missing_debug_implementations)]
+#![warn(unused_extern_crates)]
+
+mod features;
+mod manifest;
+mod workspace;
+
+pub use features::*;
+pub use manifest::*;
+pub use workspace::*;
+
+#[macro_use]
+extern crate doc_comment;
+doc_comment! {
+    include_str!("../README.md")
+}
diff --git a/android/vendor/clap-cargo-0.9.1/src/manifest.rs b/android/vendor/clap-cargo-0.9.1/src/manifest.rs
new file mode 100644
index 0000000..72b0e42
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/src/manifest.rs
@@ -0,0 +1,65 @@
+//! Cargo flag for selecting the relevant crate.
+
+use std::path;
+
+#[derive(Default, Clone, Debug, PartialEq, Eq, clap::Args)]
+#[non_exhaustive]
+pub struct Manifest {
+    #[clap(long, name = "PATH", parse(from_os_str))]
+    /// Path to Cargo.toml
+    pub manifest_path: Option<path::PathBuf>,
+}
+
+#[cfg(feature = "cargo_metadata")]
+impl Manifest {
+    /// Create a `cargo_metadata::MetadataCommand`
+    ///
+    /// Note: Requires the features `cargo_metadata`.
+    pub fn metadata(&self) -> cargo_metadata::MetadataCommand {
+        let mut c = cargo_metadata::MetadataCommand::new();
+        if let Some(ref manifest_path) = self.manifest_path {
+            c.manifest_path(manifest_path);
+        }
+        c
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    #[test]
+    fn verify_app() {
+        #[derive(Debug, clap::StructOpt)]
+        struct Cli {
+            #[clap(flatten)]
+            manifest: Manifest,
+        }
+
+        use clap::CommandFactory;
+        Cli::command().debug_assert()
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[test]
+    fn metadata_with_path() {
+        let manifest = Manifest {
+            manifest_path: Some(path::PathBuf::from("tests/fixtures/simple/Cargo.toml")),
+        };
+        let metadata = manifest.metadata();
+        metadata.exec().unwrap();
+        // TODO verify we forwarded correctly.
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[test]
+    fn metadata_without_path() {
+        let cwd = path::PathBuf::from("tests/fixtures/simple");
+        let manifest = Manifest {
+            manifest_path: None,
+        };
+        let mut metadata = manifest.metadata();
+        metadata.current_dir(cwd).exec().unwrap();
+        // TODO verify we forwarded correctly.
+    }
+}
diff --git a/android/vendor/clap-cargo-0.9.1/src/workspace.rs b/android/vendor/clap-cargo-0.9.1/src/workspace.rs
new file mode 100644
index 0000000..201f5c0
--- /dev/null
+++ b/android/vendor/clap-cargo-0.9.1/src/workspace.rs
@@ -0,0 +1,399 @@
+//! Cargo flags for selecting crates in a workspace.
+
+use std::collections;
+
+#[derive(Default, Clone, Debug, PartialEq, Eq, clap::Args)]
+#[non_exhaustive]
+pub struct Workspace {
+    #[clap(short, long, value_name = "SPEC")]
+    /// Package to process (see `cargo help pkgid`)
+    pub package: Vec<String>,
+    #[clap(long)]
+    /// Process all packages in the workspace
+    pub workspace: bool,
+    #[clap(long, hide_short_help(true), hide_long_help(true))]
+    /// Process all packages in the workspace
+    pub all: bool,
+    #[clap(long, value_name = "SPEC")]
+    /// Exclude packages from being processed
+    pub exclude: Vec<String>,
+}
+
+#[cfg(feature = "cargo_metadata")]
+impl Workspace {
+    /// Partition workspace members into those selected and those excluded.
+    ///
+    /// Notes:
+    /// - Requires the features `cargo_metadata`.
+    /// - Requires not calling `MetadataCommand::no_deps`
+    pub fn partition_packages<'m>(
+        &self,
+        meta: &'m cargo_metadata::Metadata,
+    ) -> (
+        Vec<&'m cargo_metadata::Package>,
+        Vec<&'m cargo_metadata::Package>,
+    ) {
+        let selection =
+            Packages::from_flags(self.workspace || self.all, &self.exclude, &self.package);
+        let workspace_members: collections::HashSet<_> = meta.workspace_members.iter().collect();
+        let base_ids: collections::HashSet<_> = match selection {
+            Packages::Default => {
+                // Deviating from cargo because Metadata doesn't have default members
+                let resolve = meta.resolve.as_ref().expect("no-deps is unsupported");
+                match &resolve.root {
+                    Some(root) => {
+                        let mut base_ids = collections::HashSet::new();
+                        base_ids.insert(root);
+                        base_ids
+                    }
+                    None => workspace_members,
+                }
+            }
+            Packages::All => workspace_members,
+            Packages::OptOut(_) => workspace_members, // Deviating from cargo by only checking workspace members
+            Packages::Packages(patterns) => {
+                meta.packages
+                    .iter()
+                    // Deviating from cargo by not supporting patterns
+                    // Deviating from cargo by only checking workspace members
+                    .filter(|p| workspace_members.contains(&p.id) && patterns.contains(&p.name))
+                    .map(|p| &p.id)
+                    .collect()
+            }
+        };
+
+        meta.packages
+            .iter()
+            // Deviating from cargo by not supporting patterns
+            .partition(|p| base_ids.contains(&p.id) && !self.exclude.contains(&p.name))
+    }
+}
+
+// See cargo's src/cargo/ops/cargo_compile.rs
+#[derive(Clone, PartialEq, Eq, Debug)]
+#[cfg(feature = "cargo_metadata")]
+#[allow(clippy::enum_variant_names)]
+enum Packages<'p> {
+    Default,
+    All,
+    OptOut(&'p [String]),
+    Packages(&'p [String]),
+}
+
+#[cfg(feature = "cargo_metadata")]
+impl<'p> Packages<'p> {
+    pub fn from_flags(all: bool, exclude: &'p [String], package: &'p [String]) -> Self {
+        match (all, exclude.len(), package.len()) {
+            (false, 0, 0) => Packages::Default,
+            (false, 0, _) => Packages::Packages(package),
+            (false, _, 0) => Packages::OptOut(exclude), // Deviating from cargo because we don't do error handling
+            (false, _, _) => Packages::Packages(package), // Deviating from cargo because we don't do error handling
+            (true, 0, _) => Packages::All,
+            (true, _, _) => Packages::OptOut(exclude),
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+
+    use clap::StructOpt;
+
+    #[test]
+    fn verify_app() {
+        #[derive(Debug, clap::StructOpt)]
+        struct Cli {
+            #[clap(flatten)]
+            workspace: Workspace,
+        }
+
+        use clap::CommandFactory;
+        Cli::command().debug_assert()
+    }
+
+    #[test]
+    fn parse_multiple_occurrences() {
+        #[derive(PartialEq, Eq, Debug, StructOpt)]
+        struct Args {
+            positional: Option<String>,
+            #[clap(flatten)]
+            workspace: Workspace,
+        }
+
+        assert_eq!(
+            Args {
+                positional: None,
+                workspace: Workspace {
+                    package: vec![],
+                    workspace: false,
+                    all: false,
+                    exclude: vec![],
+                }
+            },
+            Args::parse_from(&["test"])
+        );
+        assert_eq!(
+            Args {
+                positional: Some("baz".to_owned()),
+                workspace: Workspace {
+                    package: vec!["foo".to_owned(), "bar".to_owned()],
+                    workspace: false,
+                    all: false,
+                    exclude: vec![],
+                }
+            },
+            Args::parse_from(&["test", "--package", "foo", "--package", "bar", "baz"])
+        );
+        assert_eq!(
+            Args {
+                positional: Some("baz".to_owned()),
+                workspace: Workspace {
+                    package: vec![],
+                    workspace: false,
+                    all: false,
+                    exclude: vec!["foo".to_owned(), "bar".to_owned()],
+                }
+            },
+            Args::parse_from(&["test", "--exclude", "foo", "--exclude", "bar", "baz"])
+        );
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[cfg(test)]
+    mod partition_default {
+        use super::*;
+
+        #[test]
+        fn single_crate() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/simple/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn mixed_ws_root() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/mixed_ws/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+
+        #[test]
+        fn mixed_ws_leaf() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/mixed_ws/c/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+
+        #[test]
+        fn pure_ws_root() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/pure_ws/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 3);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn pure_ws_leaf() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/pure_ws/c/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[cfg(test)]
+    mod partition_all {
+        use super::*;
+
+        #[test]
+        fn single_crate() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/simple/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                all: true,
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn mixed_ws_root() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/mixed_ws/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                all: true,
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 3);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn mixed_ws_leaf() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/mixed_ws/c/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                all: true,
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 3);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn pure_ws_root() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/pure_ws/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                all: true,
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 3);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn pure_ws_leaf() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/pure_ws/c/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                all: true,
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 3);
+            assert_eq!(excluded.len(), 0);
+        }
+    }
+
+    #[cfg(feature = "cargo_metadata")]
+    #[cfg(test)]
+    mod partition_package {
+        use super::*;
+
+        #[test]
+        fn single_crate() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/simple/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                package: vec!["simple".to_owned()],
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 0);
+        }
+
+        #[test]
+        fn mixed_ws_root() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/mixed_ws/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                package: vec!["a".to_owned()],
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+
+        #[test]
+        fn mixed_ws_leaf() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/mixed_ws/c/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                package: vec!["a".to_owned()],
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+
+        #[test]
+        fn pure_ws_root() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/pure_ws/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                package: vec!["a".to_owned()],
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+
+        #[test]
+        fn pure_ws_leaf() {
+            let mut metadata = cargo_metadata::MetadataCommand::new();
+            metadata.manifest_path("tests/fixtures/pure_ws/c/Cargo.toml");
+            let metadata = metadata.exec().unwrap();
+
+            let workspace = Workspace {
+                package: vec!["a".to_owned()],
+                ..Default::default()
+            };
+            let (included, excluded) = workspace.partition_packages(&metadata);
+            assert_eq!(included.len(), 1);
+            assert_eq!(excluded.len(), 2);
+        }
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/.cargo-checksum.json b/android/vendor/clap_derive-3.2.6/.cargo-checksum.json
new file mode 100644
index 0000000..15dc733
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"77ba6a8cf703e21158d6909b450c70edfa43f23ae41b0a460cad371ecc182ca2","LICENSE-APACHE":"c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4","LICENSE-MIT":"6725d1437fc6c77301f2ff0e7d52914cf4f9509213e1078dc77d9356dbe6eac5","README.md":"3cc8d9df72358dff2d8dcb063a095a08efe61904f89812e876085051268d5bcd","src/attrs.rs":"dd4288ac38aeb184bbffade71af48706034f10d311068af2917c0f96d813698a","src/derives/args.rs":"27a13d33f24f7f7668c82fa653978e909514bd39e808c7996fddb0d3a3c0e570","src/derives/into_app.rs":"02c36d403ad35e3d49de6042cacecf2a724561b5e3948b5aec4b45646e031877","src/derives/mod.rs":"ff7947fddee4b3d8365e29459a02458382e13df022aee822e09bce1ac255d3bb","src/derives/parser.rs":"9ca609e6e5bfb303e22b4ecb8aca9035571179920b0df91031e9f987559252e0","src/derives/subcommand.rs":"0513c48013c2bd9f450ffc7bfcbf84b3a3290e37ff571dd070798356c2b291ac","src/derives/value_enum.rs":"27b87ccb6829925f6ffa631109217bffd81b74f61519841678bd6d8c5cfcbe40","src/dummies.rs":"02f111bbd84b8f0525faeb9189c59cb2fd2df05ae6c7b014735c82feac5ff23f","src/lib.rs":"e4be47e8db06a6555a2a4cd1802d17c16a3b51ae0ec291b3ec75ef2b6517eb0e","src/parse.rs":"f0d720da5477755bdce02fcd248a57efe74b2fbbc5e07c5dc17d9bf78b017958","src/utils/doc_comments.rs":"386859b274fd1e298aeaeafd2b20764db0957cbb4e6c9e8bab52a506a0b8ecda","src/utils/mod.rs":"ee28526587d2d80d5dba162f28191f44f6a0c296d0e52225eb74b90534d49b25","src/utils/spanned.rs":"e93600124c54985533f74fe23f096f4ada94b310eff97a16f0ce40fb0f690a3b","src/utils/ty.rs":"0a9b8c5dabfa28388b60423f4b6075a275b347258ac35301997cb0d7f763607f"},"package":"ed6db9e867166a43a53f7199b5e4d1f522a1e5bd626654be263c999ce59df39a"}
\ No newline at end of file
diff --git a/android/vendor/clap_derive-3.2.6/Cargo.toml b/android/vendor/clap_derive-3.2.6/Cargo.toml
new file mode 100644
index 0000000..fedecf4
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/Cargo.toml
@@ -0,0 +1,82 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2021"
+rust-version = "1.56.1"
+name = "clap_derive"
+version = "3.2.6"
+include = [
+    "build.rs",
+    "src/**/*",
+    "Cargo.toml",
+    "LICENSE*",
+    "README.md",
+    "benches/**/*",
+    "examples/**/*",
+]
+description = "Parse command line argument by defining a struct, derive crate."
+keywords = [
+    "clap",
+    "cli",
+    "parse",
+    "derive",
+    "proc_macro",
+]
+categories = [
+    "command-line-interface",
+    "development-tools::procedural-macro-helpers",
+]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/clap-rs/clap/tree/master/clap_derive"
+resolver = "2"
+
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
+
+[package.metadata.release]
+shared-version = true
+dependent-version = "upgrade"
+tag-name = "v{{version}}"
+
+[[package.metadata.release.pre-release-replacements]]
+file = "README.md"
+search = "github.com/clap-rs/clap/blob/[^/]+/"
+replace = "github.com/clap-rs/clap/blob/{{tag_name}}/"
+exactly = 2
+prerelease = true
+
+[lib]
+bench = false
+proc-macro = true
+
+[dependencies.heck]
+version = "0.4.0"
+
+[dependencies.proc-macro-error]
+version = "1"
+
+[dependencies.proc-macro2]
+version = "1.0.28"
+
+[dependencies.quote]
+version = "1.0.9"
+
+[dependencies.syn]
+version = "1.0.74"
+features = ["full"]
+
+[features]
+debug = []
+default = []
+deprecated = []
+raw-deprecated = ["deprecated"]
+unstable-v4 = ["deprecated"]
diff --git a/android/vendor/clap_derive-3.2.6/LICENSE-APACHE b/android/vendor/clap_derive-3.2.6/LICENSE-APACHE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/android/vendor/clap_derive-3.2.6/LICENSE-MIT b/android/vendor/clap_derive-3.2.6/LICENSE-MIT
new file mode 100644
index 0000000..5acedf0
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/LICENSE-MIT
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015-2016 Kevin B. Knapp
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/android/vendor/clap_derive-3.2.6/README.md b/android/vendor/clap_derive-3.2.6/README.md
new file mode 100644
index 0000000..0426fc9
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/README.md
@@ -0,0 +1,24 @@
+# clap_derive
+
+Macro implementation for clap's derives.
+
+[docs.rs](https://docs.rs/clap)
+- [Derive Tutorial](https://github.com/clap-rs/clap/blob/v3.2.6/examples/tutorial_derive/README.md)
+- [Derive Reference](https://github.com/clap-rs/clap/blob/v3.2.6/examples/derive_ref/README.md)
+
+## License
+
+Licensed under either of
+
+- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <https://www.apache.org/licenses/LICENSE-2.0>)
+- MIT license ([LICENSE-MIT](LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
+dual licensed as above, without any additional terms or conditions.
+
+See [CONTRIBUTING](CONTRIBUTING.md) for more details.
diff --git a/android/vendor/clap_derive-3.2.6/src/attrs.rs b/android/vendor/clap_derive-3.2.6/src/attrs.rs
new file mode 100644
index 0000000..3c685fb
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/attrs.rs
@@ -0,0 +1,1259 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+
+use crate::{
+    parse::*,
+    utils::{inner_type, is_simple_ty, process_doc_comment, Sp, Ty},
+};
+
+use std::env;
+
+use heck::{ToKebabCase, ToLowerCamelCase, ToShoutySnakeCase, ToSnakeCase, ToUpperCamelCase};
+use proc_macro2::{self, Span, TokenStream};
+use proc_macro_error::abort;
+use quote::{quote, quote_spanned, ToTokens};
+use syn::{
+    self, ext::IdentExt, spanned::Spanned, Attribute, Expr, Field, Ident, LitStr, MetaNameValue,
+    Type, Variant,
+};
+
+/// Default casing style for generated arguments.
+pub const DEFAULT_CASING: CasingStyle = CasingStyle::Kebab;
+
+/// Default casing style for environment variables
+pub const DEFAULT_ENV_CASING: CasingStyle = CasingStyle::ScreamingSnake;
+
+#[derive(Clone)]
+pub struct Attrs {
+    name: Name,
+    casing: Sp<CasingStyle>,
+    env_casing: Sp<CasingStyle>,
+    ty: Option<Type>,
+    doc_comment: Vec<Method>,
+    methods: Vec<Method>,
+    value_parser: Option<ValueParser>,
+    action: Option<Action>,
+    parser: Option<Sp<Parser>>,
+    verbatim_doc_comment: Option<Ident>,
+    next_display_order: Option<Method>,
+    next_help_heading: Option<Method>,
+    help_heading: Option<Method>,
+    is_enum: bool,
+    is_positional: bool,
+    kind: Sp<Kind>,
+}
+
+impl Attrs {
+    pub fn from_struct(
+        span: Span,
+        attrs: &[Attribute],
+        name: Name,
+        argument_casing: Sp<CasingStyle>,
+        env_casing: Sp<CasingStyle>,
+    ) -> Self {
+        let mut res = Self::new(span, name, None, argument_casing, env_casing);
+        res.push_attrs(attrs);
+        res.push_doc_comment(attrs, "about");
+
+        if let Some(value_parser) = res.value_parser.as_ref() {
+            abort!(
+                value_parser.span(),
+                "`value_parser` attribute is only allowed on fields"
+            );
+        }
+        if let Some(action) = res.action.as_ref() {
+            abort!(
+                action.span(),
+                "`action` attribute is only allowed on fields"
+            );
+        }
+        if let Some(parser) = res.parser.as_ref() {
+            abort!(parser.span(), "`parse` attribute is only allowed on fields");
+        }
+        match &*res.kind {
+            Kind::Subcommand(_) => abort!(res.kind.span(), "subcommand is only allowed on fields"),
+            Kind::Skip(_) => abort!(res.kind.span(), "skip is only allowed on fields"),
+            Kind::Arg(_) => res,
+            Kind::FromGlobal(_) => abort!(res.kind.span(), "from_global is only allowed on fields"),
+            Kind::Flatten => abort!(res.kind.span(), "flatten is only allowed on fields"),
+            Kind::ExternalSubcommand => abort!(
+                res.kind.span(),
+                "external_subcommand is only allowed on fields"
+            ),
+        }
+    }
+
+    pub fn from_variant(
+        variant: &Variant,
+        struct_casing: Sp<CasingStyle>,
+        env_casing: Sp<CasingStyle>,
+    ) -> Self {
+        let name = variant.ident.clone();
+        let mut res = Self::new(
+            variant.span(),
+            Name::Derived(name),
+            None,
+            struct_casing,
+            env_casing,
+        );
+        res.push_attrs(&variant.attrs);
+        res.push_doc_comment(&variant.attrs, "about");
+
+        match &*res.kind {
+            Kind::Flatten => {
+                if let Some(value_parser) = res.value_parser.as_ref() {
+                    abort!(
+                        value_parser.span(),
+                        "`value_parser` attribute is not allowed for flattened entry"
+                    );
+                }
+                if let Some(action) = res.action.as_ref() {
+                    abort!(
+                        action.span(),
+                        "`action` attribute is not allowed for flattened entry"
+                    );
+                }
+                if let Some(parser) = res.parser.as_ref() {
+                    abort!(
+                        parser.span(),
+                        "parse attribute is not allowed for flattened entry"
+                    );
+                }
+                if res.has_explicit_methods() {
+                    abort!(
+                        res.kind.span(),
+                        "methods are not allowed for flattened entry"
+                    );
+                }
+
+                // ignore doc comments
+                res.doc_comment = vec![];
+            }
+
+            Kind::ExternalSubcommand => (),
+
+            Kind::Subcommand(_) => {
+                if let Some(value_parser) = res.value_parser.as_ref() {
+                    abort!(
+                        value_parser.span(),
+                        "`value_parser` attribute is not allowed for subcommand"
+                    );
+                }
+                if let Some(action) = res.action.as_ref() {
+                    abort!(
+                        action.span(),
+                        "`action` attribute is not allowed for subcommand"
+                    );
+                }
+                if let Some(parser) = res.parser.as_ref() {
+                    abort!(
+                        parser.span(),
+                        "parse attribute is not allowed for subcommand"
+                    );
+                }
+
+                use syn::Fields::*;
+                use syn::FieldsUnnamed;
+                let field_ty = match variant.fields {
+                    Named(_) => {
+                        abort!(variant.span(), "structs are not allowed for subcommand");
+                    }
+                    Unit => abort!(variant.span(), "unit-type is not allowed for subcommand"),
+                    Unnamed(FieldsUnnamed { ref unnamed, .. }) if unnamed.len() == 1 => {
+                        &unnamed[0].ty
+                    }
+                    Unnamed(..) => {
+                        abort!(
+                            variant,
+                            "non single-typed tuple is not allowed for subcommand"
+                        )
+                    }
+                };
+                let ty = Ty::from_syn_ty(field_ty);
+                match *ty {
+                    Ty::OptionOption => {
+                        abort!(
+                            field_ty,
+                            "Option<Option<T>> type is not allowed for subcommand"
+                        );
+                    }
+                    Ty::OptionVec => {
+                        abort!(
+                            field_ty,
+                            "Option<Vec<T>> type is not allowed for subcommand"
+                        );
+                    }
+                    _ => (),
+                }
+
+                res.kind = Sp::new(Kind::Subcommand(ty), res.kind.span());
+            }
+            Kind::Skip(_) => (),
+            Kind::FromGlobal(_) => {
+                abort!(res.kind.span(), "from_global is not supported on variants");
+            }
+            Kind::Arg(_) => (),
+        }
+
+        res
+    }
+
+    pub fn from_value_enum_variant(
+        variant: &Variant,
+        argument_casing: Sp<CasingStyle>,
+        env_casing: Sp<CasingStyle>,
+    ) -> Self {
+        let mut res = Self::new(
+            variant.span(),
+            Name::Derived(variant.ident.clone()),
+            None,
+            argument_casing,
+            env_casing,
+        );
+        res.push_attrs(&variant.attrs);
+        res.push_doc_comment(&variant.attrs, "help");
+
+        if let Some(value_parser) = res.value_parser.as_ref() {
+            abort!(
+                value_parser.span(),
+                "`value_parser` attribute is only allowed on fields"
+            );
+        }
+        if let Some(action) = res.action.as_ref() {
+            abort!(
+                action.span(),
+                "`action` attribute is only allowed on fields"
+            );
+        }
+        if let Some(parser) = res.parser.as_ref() {
+            abort!(parser.span(), "`parse` attribute is only allowed on fields");
+        }
+        match &*res.kind {
+            Kind::Subcommand(_) => abort!(res.kind.span(), "subcommand is only allowed on fields"),
+            Kind::Skip(_) => res,
+            Kind::Arg(_) => res,
+            Kind::FromGlobal(_) => abort!(res.kind.span(), "from_global is only allowed on fields"),
+            Kind::Flatten => abort!(res.kind.span(), "flatten is only allowed on fields"),
+            Kind::ExternalSubcommand => abort!(
+                res.kind.span(),
+                "external_subcommand is only allowed on fields"
+            ),
+        }
+    }
+
+    pub fn from_field(
+        field: &Field,
+        struct_casing: Sp<CasingStyle>,
+        env_casing: Sp<CasingStyle>,
+    ) -> Self {
+        let name = field.ident.clone().unwrap();
+        let mut res = Self::new(
+            field.span(),
+            Name::Derived(name),
+            Some(field.ty.clone()),
+            struct_casing,
+            env_casing,
+        );
+        res.push_attrs(&field.attrs);
+        res.push_doc_comment(&field.attrs, "help");
+
+        match &*res.kind {
+            Kind::Flatten => {
+                if let Some(value_parser) = res.value_parser.as_ref() {
+                    abort!(
+                        value_parser.span(),
+                        "`value_parser` attribute is not allowed for flattened entry"
+                    );
+                }
+                if let Some(action) = res.action.as_ref() {
+                    abort!(
+                        action.span(),
+                        "`action` attribute is not allowed for flattened entry"
+                    );
+                }
+                if let Some(parser) = res.parser.as_ref() {
+                    abort!(
+                        parser.span(),
+                        "parse attribute is not allowed for flattened entry"
+                    );
+                }
+                if res.has_explicit_methods() {
+                    abort!(
+                        res.kind.span(),
+                        "methods are not allowed for flattened entry"
+                    );
+                }
+
+                // ignore doc comments
+                res.doc_comment = vec![];
+            }
+
+            Kind::ExternalSubcommand => {
+                abort! { res.kind.span(),
+                    "`external_subcommand` can be used only on enum variants"
+                }
+            }
+
+            Kind::Subcommand(_) => {
+                if let Some(value_parser) = res.value_parser.as_ref() {
+                    abort!(
+                        value_parser.span(),
+                        "`value_parser` attribute is not allowed for subcommand"
+                    );
+                }
+                if let Some(action) = res.action.as_ref() {
+                    abort!(
+                        action.span(),
+                        "`action` attribute is not allowed for subcommand"
+                    );
+                }
+                if let Some(parser) = res.parser.as_ref() {
+                    abort!(
+                        parser.span(),
+                        "parse attribute is not allowed for subcommand"
+                    );
+                }
+                if res.has_explicit_methods() {
+                    abort!(
+                        res.kind.span(),
+                        "methods in attributes are not allowed for subcommand"
+                    );
+                }
+
+                let ty = Ty::from_syn_ty(&field.ty);
+                match *ty {
+                    Ty::OptionOption => {
+                        abort!(
+                            field.ty,
+                            "Option<Option<T>> type is not allowed for subcommand"
+                        );
+                    }
+                    Ty::OptionVec => {
+                        abort!(
+                            field.ty,
+                            "Option<Vec<T>> type is not allowed for subcommand"
+                        );
+                    }
+                    _ => (),
+                }
+
+                res.kind = Sp::new(Kind::Subcommand(ty), res.kind.span());
+            }
+            Kind::Skip(_) => {
+                if res.has_explicit_methods() {
+                    abort!(
+                        res.kind.span(),
+                        "methods are not allowed for skipped fields"
+                    );
+                }
+            }
+            Kind::FromGlobal(orig_ty) => {
+                let ty = Ty::from_syn_ty(&field.ty);
+                res.kind = Sp::new(Kind::FromGlobal(ty), orig_ty.span());
+            }
+            Kind::Arg(_) => {
+                let mut ty = Ty::from_syn_ty(&field.ty);
+                if res.parser.is_some() {
+                    if let Some(value_parser) = res.value_parser.as_ref() {
+                        abort!(
+                            value_parser.span(),
+                            "`value_parser` attribute conflicts with `parse` attribute"
+                        );
+                    }
+                    if let Some(action) = res.action.as_ref() {
+                        abort!(
+                            action.span(),
+                            "`action` attribute conflicts with `parse` attribute"
+                        );
+                    }
+                    match *ty {
+                        Ty::Option | Ty::Vec | Ty::OptionVec => (),
+                        _ => ty = Sp::new(Ty::Other, ty.span()),
+                    }
+                }
+
+                match *ty {
+                    Ty::Option => {
+                        if let Some(m) = res.find_default_method() {
+                            abort!(m.name, "default_value is meaningless for Option")
+                        }
+                    }
+                    Ty::OptionOption => {
+                        if res.is_positional() {
+                            abort!(
+                                field.ty,
+                                "Option<Option<T>> type is meaningless for positional argument"
+                            )
+                        }
+                    }
+                    Ty::OptionVec => {
+                        if res.is_positional() {
+                            abort!(
+                                field.ty,
+                                "Option<Vec<T>> type is meaningless for positional argument"
+                            )
+                        }
+                    }
+
+                    _ => (),
+                }
+                res.kind = Sp::new(
+                    Kind::Arg(ty),
+                    field
+                        .ident
+                        .as_ref()
+                        .map(|i| i.span())
+                        .unwrap_or_else(|| field.ty.span()),
+                );
+            }
+        }
+
+        res
+    }
+
+    fn new(
+        default_span: Span,
+        name: Name,
+        ty: Option<Type>,
+        casing: Sp<CasingStyle>,
+        env_casing: Sp<CasingStyle>,
+    ) -> Self {
+        Self {
+            name,
+            ty,
+            casing,
+            env_casing,
+            doc_comment: vec![],
+            methods: vec![],
+            value_parser: None,
+            action: None,
+            parser: None,
+            verbatim_doc_comment: None,
+            next_display_order: None,
+            next_help_heading: None,
+            help_heading: None,
+            is_enum: false,
+            is_positional: true,
+            kind: Sp::new(Kind::Arg(Sp::new(Ty::Other, default_span)), default_span),
+        }
+    }
+
+    fn push_method(&mut self, name: Ident, arg: impl ToTokens) {
+        if name == "name" {
+            self.name = Name::Assigned(quote!(#arg));
+        } else if name == "value_parser" {
+            self.value_parser = Some(ValueParser::Explicit(Method::new(name, quote!(#arg))));
+        } else if name == "action" {
+            self.action = Some(Action::Explicit(Method::new(name, quote!(#arg))));
+        } else {
+            if name == "short" || name == "long" {
+                self.is_positional = false;
+            }
+            self.methods.push(Method::new(name, quote!(#arg)));
+        }
+    }
+
+    fn push_attrs(&mut self, attrs: &[Attribute]) {
+        use ClapAttr::*;
+
+        let parsed = parse_clap_attributes(attrs);
+        for attr in &parsed {
+            let attr = attr.clone();
+            match attr {
+                Short(ident) => {
+                    self.push_method(ident, self.name.clone().translate_char(*self.casing));
+                }
+
+                Long(ident) => {
+                    self.push_method(ident, self.name.clone().translate(*self.casing));
+                }
+
+                ValueParser(ident) => {
+                    use crate::attrs::ValueParser;
+                    self.value_parser = Some(ValueParser::Implicit(ident));
+                }
+
+                Action(ident) => {
+                    use crate::attrs::Action;
+                    self.action = Some(Action::Implicit(ident));
+                }
+
+                Env(ident) => {
+                    self.push_method(ident, self.name.clone().translate(*self.env_casing));
+                }
+
+                ValueEnum(_) => self.is_enum = true,
+
+                FromGlobal(ident) => {
+                    let ty = Sp::call_site(Ty::Other);
+                    let kind = Sp::new(Kind::FromGlobal(ty), ident.span());
+                    self.set_kind(kind);
+                }
+
+                Subcommand(ident) => {
+                    let ty = Sp::call_site(Ty::Other);
+                    let kind = Sp::new(Kind::Subcommand(ty), ident.span());
+                    self.set_kind(kind);
+                }
+
+                ExternalSubcommand(ident) => {
+                    let kind = Sp::new(Kind::ExternalSubcommand, ident.span());
+                    self.set_kind(kind);
+                }
+
+                Flatten(ident) => {
+                    let kind = Sp::new(Kind::Flatten, ident.span());
+                    self.set_kind(kind);
+                }
+
+                Skip(ident, expr) => {
+                    let kind = Sp::new(Kind::Skip(expr), ident.span());
+                    self.set_kind(kind);
+                }
+
+                VerbatimDocComment(ident) => self.verbatim_doc_comment = Some(ident),
+
+                DefaultValueT(ident, expr) => {
+                    let ty = if let Some(ty) = self.ty.as_ref() {
+                        ty
+                    } else {
+                        abort!(
+                            ident,
+                            "#[clap(default_value_t)] (without an argument) can be used \
+                            only on field level";
+
+                            note = "see \
+                                https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#magic-attributes")
+                    };
+
+                    let val = if let Some(expr) = expr {
+                        quote!(#expr)
+                    } else {
+                        quote!(<#ty as ::std::default::Default>::default())
+                    };
+
+                    let val = if parsed.iter().any(|a| matches!(a, ValueEnum(_))) {
+                        quote_spanned!(ident.span()=> {
+                            {
+                                let val: #ty = #val;
+                                clap::ValueEnum::to_possible_value(&val).unwrap().get_name()
+                            }
+                        })
+                    } else {
+                        quote_spanned!(ident.span()=> {
+                            static DEFAULT_VALUE: clap::once_cell::sync::Lazy<String> = clap::once_cell::sync::Lazy::new(|| {
+                                let val: #ty = #val;
+                                ::std::string::ToString::to_string(&val)
+                            });
+                            &*DEFAULT_VALUE
+                        })
+                    };
+
+                    let raw_ident = Ident::new("default_value", ident.span());
+                    self.methods.push(Method::new(raw_ident, val));
+                }
+
+                DefaultValueOsT(ident, expr) => {
+                    let ty = if let Some(ty) = self.ty.as_ref() {
+                        ty
+                    } else {
+                        abort!(
+                            ident,
+                            "#[clap(default_value_os_t)] (without an argument) can be used \
+                            only on field level";
+
+                            note = "see \
+                                https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#magic-attributes")
+                    };
+
+                    let val = if let Some(expr) = expr {
+                        quote!(#expr)
+                    } else {
+                        quote!(<#ty as ::std::default::Default>::default())
+                    };
+
+                    let val = if parsed.iter().any(|a| matches!(a, ValueEnum(_))) {
+                        quote_spanned!(ident.span()=> {
+                            {
+                                let val: #ty = #val;
+                                clap::ValueEnum::to_possible_value(&val).unwrap().get_name()
+                            }
+                        })
+                    } else {
+                        quote_spanned!(ident.span()=> {
+                            static DEFAULT_VALUE: clap::once_cell::sync::Lazy<::std::ffi::OsString> = clap::once_cell::sync::Lazy::new(|| {
+                                let val: #ty = #val;
+                                ::std::ffi::OsString::from(val)
+                            });
+                            &*DEFAULT_VALUE
+                        })
+                    };
+
+                    let raw_ident = Ident::new("default_value_os", ident.span());
+                    self.methods.push(Method::new(raw_ident, val));
+                }
+
+                NextDisplayOrder(ident, expr) => {
+                    self.next_display_order = Some(Method::new(ident, quote!(#expr)));
+                }
+
+                HelpHeading(ident, expr) => {
+                    self.help_heading = Some(Method::new(ident, quote!(#expr)));
+                }
+                NextHelpHeading(ident, expr) => {
+                    self.next_help_heading = Some(Method::new(ident, quote!(#expr)));
+                }
+
+                About(ident) => {
+                    if let Some(method) = Method::from_env(ident, "CARGO_PKG_DESCRIPTION") {
+                        self.methods.push(method);
+                    }
+                }
+
+                Author(ident) => {
+                    if let Some(method) = Method::from_env(ident, "CARGO_PKG_AUTHORS") {
+                        self.methods.push(method);
+                    }
+                }
+
+                Version(ident) => {
+                    if let Some(method) = Method::from_env(ident, "CARGO_PKG_VERSION") {
+                        self.methods.push(method);
+                    }
+                }
+
+                NameLitStr(name, lit) => {
+                    self.push_method(name, lit);
+                }
+
+                NameExpr(name, expr) => {
+                    self.push_method(name, expr);
+                }
+
+                MethodCall(name, args) => self.push_method(name, quote!(#(#args),*)),
+
+                RenameAll(_, casing_lit) => {
+                    self.casing = CasingStyle::from_lit(casing_lit);
+                }
+
+                RenameAllEnv(_, casing_lit) => {
+                    self.env_casing = CasingStyle::from_lit(casing_lit);
+                }
+
+                Parse(ident, spec) => {
+                    self.parser = Some(Parser::from_spec(ident, spec));
+                }
+            }
+        }
+    }
+
+    fn push_doc_comment(&mut self, attrs: &[Attribute], name: &str) {
+        use syn::Lit::*;
+        use syn::Meta::*;
+
+        let comment_parts: Vec<_> = attrs
+            .iter()
+            .filter(|attr| attr.path.is_ident("doc"))
+            .filter_map(|attr| {
+                if let Ok(NameValue(MetaNameValue { lit: Str(s), .. })) = attr.parse_meta() {
+                    Some(s.value())
+                } else {
+                    // non #[doc = "..."] attributes are not our concern
+                    // we leave them for rustc to handle
+                    None
+                }
+            })
+            .collect();
+
+        self.doc_comment =
+            process_doc_comment(comment_parts, name, self.verbatim_doc_comment.is_none());
+    }
+
+    fn set_kind(&mut self, kind: Sp<Kind>) {
+        if let Kind::Arg(_) = *self.kind {
+            self.kind = kind;
+        } else {
+            abort!(
+                kind.span(),
+                "`subcommand`, `flatten`, `external_subcommand` and `skip` cannot be used together"
+            );
+        }
+    }
+
+    pub fn find_method(&self, name: &str) -> Option<&Method> {
+        self.methods.iter().find(|m| m.name == name)
+    }
+
+    pub fn find_default_method(&self) -> Option<&Method> {
+        self.methods
+            .iter()
+            .find(|m| m.name == "default_value" || m.name == "default_value_os")
+    }
+
+    /// generate methods from attributes on top of struct or enum
+    pub fn initial_top_level_methods(&self) -> TokenStream {
+        let next_display_order = self.next_display_order.as_ref().into_iter();
+        let next_help_heading = self.next_help_heading.as_ref().into_iter();
+        let help_heading = self.help_heading.as_ref().into_iter();
+        quote!(
+            #(#next_display_order)*
+            #(#next_help_heading)*
+            #(#help_heading)*
+        )
+    }
+
+    pub fn final_top_level_methods(&self) -> TokenStream {
+        let methods = &self.methods;
+        let doc_comment = &self.doc_comment;
+
+        quote!( #(#doc_comment)* #(#methods)*)
+    }
+
+    /// generate methods on top of a field
+    pub fn field_methods(&self, supports_long_help: bool) -> proc_macro2::TokenStream {
+        let methods = &self.methods;
+        let help_heading = self.help_heading.as_ref().into_iter();
+        match supports_long_help {
+            true => {
+                let doc_comment = &self.doc_comment;
+                quote!( #(#doc_comment)* #(#help_heading)* #(#methods)* )
+            }
+            false => {
+                let doc_comment = self
+                    .doc_comment
+                    .iter()
+                    .filter(|mth| mth.name != "long_help");
+                quote!( #(#doc_comment)* #(#help_heading)* #(#methods)* )
+            }
+        }
+    }
+
+    pub fn next_display_order(&self) -> TokenStream {
+        let next_display_order = self.next_display_order.as_ref().into_iter();
+        quote!( #(#next_display_order)* )
+    }
+
+    pub fn next_help_heading(&self) -> TokenStream {
+        let next_help_heading = self.next_help_heading.as_ref().into_iter();
+        let help_heading = self.help_heading.as_ref().into_iter();
+        quote!( #(#next_help_heading)*  #(#help_heading)* )
+    }
+
+    #[cfg(feature = "unstable-v4")]
+    pub fn id(&self) -> TokenStream {
+        self.name.clone().raw()
+    }
+
+    #[cfg(not(feature = "unstable-v4"))]
+    pub fn id(&self) -> TokenStream {
+        self.cased_name()
+    }
+
+    pub fn cased_name(&self) -> TokenStream {
+        self.name.clone().translate(*self.casing)
+    }
+
+    pub fn value_name(&self) -> TokenStream {
+        self.name.clone().translate(CasingStyle::ScreamingSnake)
+    }
+
+    pub fn value_parser(&self, field_type: &Type) -> Method {
+        self.value_parser
+            .clone()
+            .map(|p| {
+                let inner_type = inner_type(field_type);
+                p.resolve(inner_type)
+            })
+            .unwrap_or_else(|| {
+                if let Some(action) = self.action.as_ref() {
+                    let inner_type = inner_type(field_type);
+                    let span = action.span();
+                    default_value_parser(inner_type, span)
+                } else if !self.ignore_parser() || cfg!(not(feature = "unstable-v4")) {
+                    self.parser(field_type).value_parser()
+                } else {
+                    let inner_type = inner_type(field_type);
+                    let span = self
+                        .action
+                        .as_ref()
+                        .map(|a| a.span())
+                        .unwrap_or_else(|| self.kind.span());
+                    default_value_parser(inner_type, span)
+                }
+            })
+    }
+
+    pub fn action(&self, field_type: &Type) -> Method {
+        self.action
+            .clone()
+            .map(|p| p.resolve(field_type))
+            .unwrap_or_else(|| {
+                if let Some(value_parser) = self.value_parser.as_ref() {
+                    let span = value_parser.span();
+                    default_action(field_type, span)
+                } else if !self.ignore_parser() || cfg!(not(feature = "unstable-v4")) {
+                    self.parser(field_type).action()
+                } else {
+                    let span = self
+                        .value_parser
+                        .as_ref()
+                        .map(|a| a.span())
+                        .unwrap_or_else(|| self.kind.span());
+                    default_action(field_type, span)
+                }
+            })
+    }
+
+    #[cfg(feature = "unstable-v4")]
+    pub fn ignore_parser(&self) -> bool {
+        self.parser.is_none()
+    }
+
+    #[cfg(not(feature = "unstable-v4"))]
+    pub fn ignore_parser(&self) -> bool {
+        self.value_parser.is_some() || self.action.is_some()
+    }
+
+    pub fn explicit_parser(&self) -> bool {
+        self.parser.is_some()
+    }
+
+    pub fn parser(&self, field_type: &Type) -> Sp<Parser> {
+        self.parser
+            .clone()
+            .unwrap_or_else(|| Parser::from_type(field_type, self.kind.span()))
+    }
+
+    pub fn kind(&self) -> Sp<Kind> {
+        self.kind.clone()
+    }
+
+    pub fn is_enum(&self) -> bool {
+        self.is_enum
+    }
+
+    pub fn is_positional(&self) -> bool {
+        self.is_positional
+    }
+
+    pub fn ignore_case(&self) -> TokenStream {
+        let method = self.find_method("ignore_case");
+
+        if let Some(method) = method {
+            method.args.clone()
+        } else {
+            quote! { false }
+        }
+    }
+
+    pub fn casing(&self) -> Sp<CasingStyle> {
+        self.casing.clone()
+    }
+
+    pub fn env_casing(&self) -> Sp<CasingStyle> {
+        self.env_casing.clone()
+    }
+
+    pub fn has_explicit_methods(&self) -> bool {
+        self.methods
+            .iter()
+            .any(|m| m.name != "help" && m.name != "long_help")
+    }
+}
+
+#[derive(Clone)]
+enum ValueParser {
+    Explicit(Method),
+    Implicit(Ident),
+}
+
+impl ValueParser {
+    fn resolve(self, inner_type: &Type) -> Method {
+        match self {
+            Self::Explicit(method) => method,
+            Self::Implicit(ident) => default_value_parser(inner_type, ident.span()),
+        }
+    }
+
+    fn span(&self) -> Span {
+        match self {
+            Self::Explicit(method) => method.name.span(),
+            Self::Implicit(ident) => ident.span(),
+        }
+    }
+}
+
+fn default_value_parser(inner_type: &Type, span: Span) -> Method {
+    let func = Ident::new("value_parser", span);
+    Method::new(
+        func,
+        quote_spanned! { span=>
+            clap::value_parser!(#inner_type)
+        },
+    )
+}
+
+#[derive(Clone)]
+pub enum Action {
+    Explicit(Method),
+    Implicit(Ident),
+}
+
+impl Action {
+    pub fn resolve(self, field_type: &Type) -> Method {
+        match self {
+            Self::Explicit(method) => method,
+            Self::Implicit(ident) => default_action(field_type, ident.span()),
+        }
+    }
+
+    pub fn span(&self) -> Span {
+        match self {
+            Self::Explicit(method) => method.name.span(),
+            Self::Implicit(ident) => ident.span(),
+        }
+    }
+}
+
+fn default_action(field_type: &Type, span: Span) -> Method {
+    let ty = Ty::from_syn_ty(field_type);
+    let args = match *ty {
+        Ty::Vec | Ty::OptionVec => {
+            quote_spanned! { span=>
+                clap::ArgAction::Append
+            }
+        }
+        Ty::Option | Ty::OptionOption => {
+            quote_spanned! { span=>
+                clap::ArgAction::Set
+            }
+        }
+        _ => {
+            if is_simple_ty(field_type, "bool") {
+                quote_spanned! { span=>
+                    clap::ArgAction::SetTrue
+                }
+            } else {
+                quote_spanned! { span=>
+                    clap::ArgAction::Set
+                }
+            }
+        }
+    };
+
+    let func = Ident::new("action", span);
+    Method::new(func, args)
+}
+
+#[allow(clippy::large_enum_variant)]
+#[derive(Clone)]
+pub enum Kind {
+    Arg(Sp<Ty>),
+    FromGlobal(Sp<Ty>),
+    Subcommand(Sp<Ty>),
+    Flatten,
+    Skip(Option<Expr>),
+    ExternalSubcommand,
+}
+
+#[derive(Clone)]
+pub struct Method {
+    name: Ident,
+    args: TokenStream,
+}
+
+impl Method {
+    pub fn new(name: Ident, args: TokenStream) -> Self {
+        Method { name, args }
+    }
+
+    fn from_env(ident: Ident, env_var: &str) -> Option<Self> {
+        let mut lit = match env::var(env_var) {
+            Ok(val) => {
+                if val.is_empty() {
+                    return None;
+                }
+                LitStr::new(&val, ident.span())
+            }
+            Err(_) => {
+                abort!(ident,
+                    "cannot derive `{}` from Cargo.toml", ident;
+                    note = "`{}` environment variable is not set", env_var;
+                    help = "use `{} = \"...\"` to set {} manually", ident, ident;
+                );
+            }
+        };
+
+        if ident == "author" {
+            let edited = process_author_str(&lit.value());
+            lit = LitStr::new(&edited, lit.span());
+        }
+
+        Some(Method::new(ident, quote!(#lit)))
+    }
+
+    pub(crate) fn args(&self) -> &TokenStream {
+        &self.args
+    }
+}
+
+impl ToTokens for Method {
+    fn to_tokens(&self, ts: &mut proc_macro2::TokenStream) {
+        let Method { ref name, ref args } = self;
+
+        let tokens = quote!( .#name(#args) );
+
+        tokens.to_tokens(ts);
+    }
+}
+
+/// replace all `:` with `, ` when not inside the `<>`
+///
+/// `"author1:author2:author3" => "author1, author2, author3"`
+/// `"author1 <http://website1.com>:author2" => "author1 <http://website1.com>, author2"
+fn process_author_str(author: &str) -> String {
+    let mut res = String::with_capacity(author.len());
+    let mut inside_angle_braces = 0usize;
+
+    for ch in author.chars() {
+        if inside_angle_braces > 0 && ch == '>' {
+            inside_angle_braces -= 1;
+            res.push(ch);
+        } else if ch == '<' {
+            inside_angle_braces += 1;
+            res.push(ch);
+        } else if inside_angle_braces == 0 && ch == ':' {
+            res.push_str(", ");
+        } else {
+            res.push(ch);
+        }
+    }
+
+    res
+}
+
+#[derive(Clone)]
+pub struct Parser {
+    pub kind: Sp<ParserKind>,
+    pub func: TokenStream,
+}
+
+impl Parser {
+    fn from_type(field_type: &Type, span: Span) -> Sp<Self> {
+        if is_simple_ty(field_type, "bool") {
+            let kind = Sp::new(ParserKind::FromFlag, span);
+            let func = quote_spanned!(span=> ::std::convert::From::from);
+            Sp::new(Parser { kind, func }, span)
+        } else {
+            let kind = Sp::new(ParserKind::TryFromStr, span);
+            let func = quote_spanned!(span=> ::std::str::FromStr::from_str);
+            Sp::new(Parser { kind, func }, span)
+        }
+    }
+
+    fn from_spec(parse_ident: Ident, spec: ParserSpec) -> Sp<Self> {
+        use self::ParserKind::*;
+
+        let kind = match &*spec.kind.to_string() {
+            "from_str" => FromStr,
+            "try_from_str" => TryFromStr,
+            "from_os_str" => FromOsStr,
+            "try_from_os_str" => TryFromOsStr,
+            "from_occurrences" => FromOccurrences,
+            "from_flag" => FromFlag,
+            s => abort!(spec.kind.span(), "unsupported parser `{}`", s),
+        };
+
+        let func = match spec.parse_func {
+            None => match kind {
+                FromStr | FromOsStr => {
+                    quote_spanned!(spec.kind.span()=> ::std::convert::From::from)
+                }
+                TryFromStr => quote_spanned!(spec.kind.span()=> ::std::str::FromStr::from_str),
+                TryFromOsStr => abort!(
+                    spec.kind.span(),
+                    "you must set parser for `try_from_os_str` explicitly"
+                ),
+                FromOccurrences => quote_spanned!(spec.kind.span()=> { |v| v as _ }),
+                FromFlag => quote_spanned!(spec.kind.span()=> ::std::convert::From::from),
+            },
+
+            Some(func) => match func {
+                Expr::Path(_) => quote!(#func),
+                _ => abort!(func, "`parse` argument must be a function path"),
+            },
+        };
+
+        let kind = Sp::new(kind, spec.kind.span());
+        let parser = Parser { kind, func };
+        Sp::new(parser, parse_ident.span())
+    }
+
+    fn value_parser(&self) -> Method {
+        let func = Ident::new("value_parser", self.kind.span());
+        match *self.kind {
+            ParserKind::FromStr | ParserKind::TryFromStr => Method::new(
+                func,
+                quote_spanned! { self.kind.span()=>
+                clap::builder::ValueParser::string()},
+            ),
+            ParserKind::FromOsStr | ParserKind::TryFromOsStr => Method::new(
+                func,
+                quote_spanned! { self.kind.span()=> clap::builder::ValueParser::os_string()},
+            ),
+            ParserKind::FromOccurrences => Method::new(
+                func,
+                quote_spanned! { self.kind.span()=> clap::value_parser!(u64)},
+            ),
+            ParserKind::FromFlag => Method::new(
+                func,
+                quote_spanned! { self.kind.span()=> clap::builder::ValueParser::bool()},
+            ),
+        }
+    }
+
+    fn action(&self) -> Method {
+        let func = Ident::new("action", self.kind.span());
+        match *self.kind {
+            ParserKind::FromStr
+            | ParserKind::TryFromStr
+            | ParserKind::FromOsStr
+            | ParserKind::TryFromOsStr => Method::new(
+                func,
+                quote_spanned! { self.kind.span()=> clap::ArgAction::StoreValue},
+            ),
+            ParserKind::FromOccurrences | ParserKind::FromFlag => Method::new(
+                func,
+                quote_spanned! { self.kind.span()=> clap::ArgAction::IncOccurrence},
+            ),
+        }
+    }
+}
+
+#[derive(Debug, PartialEq, Clone, Copy)]
+pub enum ParserKind {
+    FromStr,
+    TryFromStr,
+    FromOsStr,
+    TryFromOsStr,
+    FromOccurrences,
+    FromFlag,
+}
+
+/// Defines the casing for the attributes long representation.
+#[derive(Copy, Clone, Debug, PartialEq)]
+pub enum CasingStyle {
+    /// Indicate word boundaries with uppercase letter, excluding the first word.
+    Camel,
+    /// Keep all letters lowercase and indicate word boundaries with hyphens.
+    Kebab,
+    /// Indicate word boundaries with uppercase letter, including the first word.
+    Pascal,
+    /// Keep all letters uppercase and indicate word boundaries with underscores.
+    ScreamingSnake,
+    /// Keep all letters lowercase and indicate word boundaries with underscores.
+    Snake,
+    /// Keep all letters lowercase and remove word boundaries.
+    Lower,
+    /// Keep all letters uppercase and remove word boundaries.
+    Upper,
+    /// Use the original attribute name defined in the code.
+    Verbatim,
+}
+
+impl CasingStyle {
+    fn from_lit(name: LitStr) -> Sp<Self> {
+        use self::CasingStyle::*;
+
+        let normalized = name.value().to_upper_camel_case().to_lowercase();
+        let cs = |kind| Sp::new(kind, name.span());
+
+        match normalized.as_ref() {
+            "camel" | "camelcase" => cs(Camel),
+            "kebab" | "kebabcase" => cs(Kebab),
+            "pascal" | "pascalcase" => cs(Pascal),
+            "screamingsnake" | "screamingsnakecase" => cs(ScreamingSnake),
+            "snake" | "snakecase" => cs(Snake),
+            "lower" | "lowercase" => cs(Lower),
+            "upper" | "uppercase" => cs(Upper),
+            "verbatim" | "verbatimcase" => cs(Verbatim),
+            s => abort!(name, "unsupported casing: `{}`", s),
+        }
+    }
+}
+
+#[derive(Clone)]
+pub enum Name {
+    Derived(Ident),
+    Assigned(TokenStream),
+}
+
+impl Name {
+    #[cfg(feature = "unstable-v4")]
+    pub fn raw(self) -> TokenStream {
+        match self {
+            Name::Assigned(tokens) => tokens,
+            Name::Derived(ident) => {
+                let s = ident.unraw().to_string();
+                quote_spanned!(ident.span()=> #s)
+            }
+        }
+    }
+
+    pub fn translate(self, style: CasingStyle) -> TokenStream {
+        use CasingStyle::*;
+
+        match self {
+            Name::Assigned(tokens) => tokens,
+            Name::Derived(ident) => {
+                let s = ident.unraw().to_string();
+                let s = match style {
+                    Pascal => s.to_upper_camel_case(),
+                    Kebab => s.to_kebab_case(),
+                    Camel => s.to_lower_camel_case(),
+                    ScreamingSnake => s.to_shouty_snake_case(),
+                    Snake => s.to_snake_case(),
+                    Lower => s.to_snake_case().replace('_', ""),
+                    Upper => s.to_shouty_snake_case().replace('_', ""),
+                    Verbatim => s,
+                };
+                quote_spanned!(ident.span()=> #s)
+            }
+        }
+    }
+
+    pub fn translate_char(self, style: CasingStyle) -> TokenStream {
+        use CasingStyle::*;
+
+        match self {
+            Name::Assigned(tokens) => quote!( (#tokens).chars().next().unwrap() ),
+            Name::Derived(ident) => {
+                let s = ident.unraw().to_string();
+                let s = match style {
+                    Pascal => s.to_upper_camel_case(),
+                    Kebab => s.to_kebab_case(),
+                    Camel => s.to_lower_camel_case(),
+                    ScreamingSnake => s.to_shouty_snake_case(),
+                    Snake => s.to_snake_case(),
+                    Lower => s.to_snake_case(),
+                    Upper => s.to_shouty_snake_case(),
+                    Verbatim => s,
+                };
+
+                let s = s.chars().next().unwrap();
+                quote_spanned!(ident.span()=> #s)
+            }
+        }
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/derives/args.rs b/android/vendor/clap_derive-3.2.6/src/derives/args.rs
new file mode 100644
index 0000000..4195a08
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/derives/args.rs
@@ -0,0 +1,796 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+
+use crate::{
+    attrs::{Attrs, Kind, Name, ParserKind, DEFAULT_CASING, DEFAULT_ENV_CASING},
+    dummies,
+    utils::{inner_type, is_simple_ty, sub_type, Sp, Ty},
+};
+
+use proc_macro2::{Ident, Span, TokenStream};
+use proc_macro_error::{abort, abort_call_site};
+use quote::{format_ident, quote, quote_spanned};
+use syn::{
+    punctuated::Punctuated, spanned::Spanned, token::Comma, Attribute, Data, DataStruct,
+    DeriveInput, Field, Fields, Generics, Type,
+};
+
+pub fn derive_args(input: &DeriveInput) -> TokenStream {
+    let ident = &input.ident;
+
+    dummies::args(ident);
+
+    match input.data {
+        Data::Struct(DataStruct {
+            fields: Fields::Named(ref fields),
+            ..
+        }) => gen_for_struct(ident, &input.generics, &fields.named, &input.attrs),
+        Data::Struct(DataStruct {
+            fields: Fields::Unit,
+            ..
+        }) => gen_for_struct(
+            ident,
+            &input.generics,
+            &Punctuated::<Field, Comma>::new(),
+            &input.attrs,
+        ),
+        _ => abort_call_site!("`#[derive(Args)]` only supports non-tuple structs"),
+    }
+}
+
+pub fn gen_for_struct(
+    struct_name: &Ident,
+    generics: &Generics,
+    fields: &Punctuated<Field, Comma>,
+    attrs: &[Attribute],
+) -> TokenStream {
+    let from_arg_matches = gen_from_arg_matches_for_struct(struct_name, generics, fields, attrs);
+
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Derived(struct_name.clone()),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+    let app_var = Ident::new("__clap_app", Span::call_site());
+    let augmentation = gen_augment(fields, &app_var, &attrs, false);
+    let augmentation_update = gen_augment(fields, &app_var, &attrs, true);
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        #from_arg_matches
+
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        impl #impl_generics clap::Args for #struct_name #ty_generics #where_clause {
+            fn augment_args<'b>(#app_var: clap::Command<'b>) -> clap::Command<'b> {
+                #augmentation
+            }
+            fn augment_args_for_update<'b>(#app_var: clap::Command<'b>) -> clap::Command<'b> {
+                #augmentation_update
+            }
+        }
+    }
+}
+
+pub fn gen_from_arg_matches_for_struct(
+    struct_name: &Ident,
+    generics: &Generics,
+    fields: &Punctuated<Field, Comma>,
+    attrs: &[Attribute],
+) -> TokenStream {
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Derived(struct_name.clone()),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+
+    let constructor = gen_constructor(fields, &attrs);
+    let updater = gen_updater(fields, &attrs, true);
+    let raw_deprecated = raw_deprecated();
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        impl #impl_generics clap::FromArgMatches for #struct_name #ty_generics #where_clause {
+            fn from_arg_matches(__clap_arg_matches: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
+                Self::from_arg_matches_mut(&mut __clap_arg_matches.clone())
+            }
+
+            fn from_arg_matches_mut(__clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
+                #raw_deprecated
+                let v = #struct_name #constructor;
+                ::std::result::Result::Ok(v)
+            }
+
+            fn update_from_arg_matches(&mut self, __clap_arg_matches: &clap::ArgMatches) -> ::std::result::Result<(), clap::Error> {
+                self.update_from_arg_matches_mut(&mut __clap_arg_matches.clone())
+            }
+
+            fn update_from_arg_matches_mut(&mut self, __clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result<(), clap::Error> {
+                #raw_deprecated
+                #updater
+                ::std::result::Result::Ok(())
+            }
+        }
+    }
+}
+
+/// Generate a block of code to add arguments/subcommands corresponding to
+/// the `fields` to an cmd.
+pub fn gen_augment(
+    fields: &Punctuated<Field, Comma>,
+    app_var: &Ident,
+    parent_attribute: &Attrs,
+    override_required: bool,
+) -> TokenStream {
+    let mut subcmds = fields.iter().filter_map(|field| {
+        let attrs = Attrs::from_field(
+            field,
+            parent_attribute.casing(),
+            parent_attribute.env_casing(),
+        );
+        let kind = attrs.kind();
+        if let Kind::Subcommand(ty) = &*kind {
+            let subcmd_type = match (**ty, sub_type(&field.ty)) {
+                (Ty::Option, Some(sub_type)) => sub_type,
+                _ => &field.ty,
+            };
+            let required = if **ty == Ty::Option {
+                quote!()
+            } else {
+                quote_spanned! { kind.span()=>
+                    #[allow(deprecated)]
+                    let #app_var = #app_var.setting(
+                        clap::AppSettings::SubcommandRequiredElseHelp
+                    );
+                }
+            };
+
+            let span = field.span();
+            let ts = if override_required {
+                quote! {
+                    let #app_var = <#subcmd_type as clap::Subcommand>::augment_subcommands_for_update( #app_var );
+                }
+            } else{
+                quote! {
+                    let #app_var = <#subcmd_type as clap::Subcommand>::augment_subcommands( #app_var );
+                    #required
+                }
+            };
+            Some((span, ts))
+        } else {
+            None
+        }
+    });
+    let subcmd = subcmds.next().map(|(_, ts)| ts);
+    if let Some((span, _)) = subcmds.next() {
+        abort!(
+            span,
+            "multiple subcommand sets are not allowed, that's the second"
+        );
+    }
+
+    let args = fields.iter().filter_map(|field| {
+        let attrs = Attrs::from_field(
+            field,
+            parent_attribute.casing(),
+            parent_attribute.env_casing(),
+        );
+        let kind = attrs.kind();
+        match &*kind {
+            Kind::Subcommand(_)
+            | Kind::Skip(_)
+            | Kind::FromGlobal(_)
+            | Kind::ExternalSubcommand => None,
+            Kind::Flatten => {
+                let ty = &field.ty;
+                let old_heading_var = format_ident!("__clap_old_heading");
+                let next_help_heading = attrs.next_help_heading();
+                let next_display_order = attrs.next_display_order();
+                if override_required {
+                    Some(quote_spanned! { kind.span()=>
+                        let #old_heading_var = #app_var.get_next_help_heading();
+                        let #app_var = #app_var #next_help_heading #next_display_order;
+                        let #app_var = <#ty as clap::Args>::augment_args_for_update(#app_var);
+                        let #app_var = #app_var.next_help_heading(#old_heading_var);
+                    })
+                } else {
+                    Some(quote_spanned! { kind.span()=>
+                        let #old_heading_var = #app_var.get_next_help_heading();
+                        let #app_var = #app_var #next_help_heading #next_display_order;
+                        let #app_var = <#ty as clap::Args>::augment_args(#app_var);
+                        let #app_var = #app_var.next_help_heading(#old_heading_var);
+                    })
+                }
+            }
+            Kind::Arg(ty) => {
+                let convert_type = inner_type(&field.ty);
+
+                let parser = attrs.parser(&field.ty);
+
+                let value_parser = attrs.value_parser(&field.ty);
+                let action = attrs.action(&field.ty);
+                let func = &parser.func;
+
+                let mut occurrences = false;
+                let mut flag = false;
+                let validator = match *parser.kind {
+                    _ if attrs.ignore_parser() || attrs.is_enum() => quote!(),
+                    ParserKind::TryFromStr => quote_spanned! { func.span()=>
+                        .validator(|s| {
+                            #func(s)
+                            .map(|_: #convert_type| ())
+                        })
+                    },
+                    ParserKind::TryFromOsStr => quote_spanned! { func.span()=>
+                        .validator_os(|s| #func(s).map(|_: #convert_type| ()))
+                    },
+                    ParserKind::FromStr | ParserKind::FromOsStr => quote!(),
+                    ParserKind::FromFlag => {
+                        flag = true;
+                        quote!()
+                    }
+                    ParserKind::FromOccurrences => {
+                        occurrences = true;
+                        quote!()
+                    }
+                };
+                let parse_deprecation = match *parser.kind {
+                    _ if !attrs.explicit_parser() || cfg!(not(feature = "deprecated")) => quote!(),
+                    ParserKind::FromStr => quote_spanned! { func.span()=>
+                        #[deprecated(since = "3.2.0", note = "Replaced with `#[clap(value_parser = ...)]`")]
+                        fn parse_from_str() {
+                        }
+                        parse_from_str();
+                    },
+                    ParserKind::TryFromStr => quote_spanned! { func.span()=>
+                        #[deprecated(since = "3.2.0", note = "Replaced with `#[clap(value_parser = ...)]`")]
+                        fn parse_try_from_str() {
+                        }
+                        parse_try_from_str();
+                    },
+                    ParserKind::FromOsStr => quote_spanned! { func.span()=>
+                        #[deprecated(since = "3.2.0", note = "Replaced with `#[clap(value_parser)]` for `PathBuf` or `#[clap(value_parser = ...)]` with a custom `TypedValueParser`")]
+                        fn parse_from_os_str() {
+                        }
+                        parse_from_os_str();
+                    },
+                    ParserKind::TryFromOsStr => quote_spanned! { func.span()=>
+                        #[deprecated(since = "3.2.0", note = "Replaced with `#[clap(value_parser = ...)]` with a custom `TypedValueParser`")]
+                        fn parse_try_from_os_str() {
+                        }
+                        parse_try_from_os_str();
+                    },
+                    ParserKind::FromFlag => quote_spanned! { func.span()=>
+                        #[deprecated(since = "3.2.0", note = "Replaced with `#[clap(action = ArgAction::SetTrue)]`")]
+                        fn parse_from_flag() {
+                        }
+                        parse_from_flag();
+                    },
+                    ParserKind::FromOccurrences => quote_spanned! { func.span()=>
+                        #[deprecated(since = "3.2.0", note = "Replaced with `#[clap(action = ArgAction::Count)]` with a field type of `u8`")]
+                        fn parse_from_occurrences() {
+                        }
+                        parse_from_occurrences();
+                    },
+                };
+
+                let value_name = attrs.value_name();
+                let possible_values = if attrs.is_enum() && !attrs.ignore_parser() {
+                    gen_value_enum_possible_values(convert_type)
+                } else {
+                    quote!()
+                };
+
+                let implicit_methods = match **ty {
+                    Ty::Option => {
+                        quote_spanned! { ty.span()=>
+                            .takes_value(true)
+                            .value_name(#value_name)
+                            #possible_values
+                            #validator
+                            #value_parser
+                            #action
+                        }
+                    }
+
+                    Ty::OptionOption => quote_spanned! { ty.span()=>
+                        .takes_value(true)
+                        .value_name(#value_name)
+                        .min_values(0)
+                        .max_values(1)
+                        .multiple_values(false)
+                        #possible_values
+                        #validator
+                        #value_parser
+                        #action
+                    },
+
+                    Ty::OptionVec => {
+                        if attrs.ignore_parser() {
+                            if attrs.is_positional() {
+                                quote_spanned! { ty.span()=>
+                                    .takes_value(true)
+                                    .value_name(#value_name)
+                                    .multiple_values(true)  // action won't be sufficient for getting multiple
+                                    #possible_values
+                                    #validator
+                                    #value_parser
+                                    #action
+                                }
+                            } else {
+                                quote_spanned! { ty.span()=>
+                                    .takes_value(true)
+                                    .value_name(#value_name)
+                                    #possible_values
+                                    #validator
+                                    #value_parser
+                                    #action
+                                }
+                            }
+                        } else {
+                            quote_spanned! { ty.span()=>
+                                .takes_value(true)
+                                .value_name(#value_name)
+                                .multiple_occurrences(true)
+                                #possible_values
+                                #validator
+                                #value_parser
+                                #action
+                            }
+                        }
+                    }
+
+                    Ty::Vec => {
+                        if attrs.ignore_parser() {
+                            if attrs.is_positional() {
+                                quote_spanned! { ty.span()=>
+                                    .takes_value(true)
+                                    .value_name(#value_name)
+                                    .multiple_values(true)  // action won't be sufficient for getting multiple
+                                    #possible_values
+                                    #validator
+                                    #value_parser
+                                    #action
+                                }
+                            } else {
+                                quote_spanned! { ty.span()=>
+                                    .takes_value(true)
+                                    .value_name(#value_name)
+                                    #possible_values
+                                    #validator
+                                    #value_parser
+                                    #action
+                                }
+                            }
+                        } else {
+                            quote_spanned! { ty.span()=>
+                                .takes_value(true)
+                                .value_name(#value_name)
+                                .multiple_occurrences(true)
+                                #possible_values
+                                #validator
+                                #value_parser
+                                #action
+                            }
+                        }
+                    }
+
+                    Ty::Other if occurrences => quote_spanned! { ty.span()=>
+                        .multiple_occurrences(true)
+                    },
+
+                    Ty::Other if flag => quote_spanned! { ty.span()=>
+                        .takes_value(false)
+                    },
+
+                    Ty::Other => {
+                        let required = attrs.find_default_method().is_none() && !override_required;
+                        // `ArgAction::takes_values` is assuming `ArgAction::default_value` will be
+                        // set though that won't always be true but this should be good enough,
+                        // otherwise we'll report an "arg required" error when unwrapping.
+                        let action_value = action.args();
+                        quote_spanned! { ty.span()=>
+                            .takes_value(true)
+                            .value_name(#value_name)
+                            .required(#required && #action_value.takes_values())
+                            #possible_values
+                            #validator
+                            #value_parser
+                            #action
+                        }
+                    }
+                };
+
+                let id = attrs.id();
+                let explicit_methods = attrs.field_methods(true);
+
+                Some(quote_spanned! { field.span()=>
+                    let #app_var = #app_var.arg({
+                        #parse_deprecation
+
+                        #[allow(deprecated)]
+                        let arg = clap::Arg::new(#id)
+                            #implicit_methods;
+
+                        let arg = arg
+                            #explicit_methods;
+                        arg
+                    });
+                })
+            }
+        }
+    });
+
+    let initial_app_methods = parent_attribute.initial_top_level_methods();
+    let final_app_methods = parent_attribute.final_top_level_methods();
+    quote! {{
+        let #app_var = #app_var #initial_app_methods;
+        #( #args )*
+        #subcmd
+        #app_var #final_app_methods
+    }}
+}
+
+fn gen_value_enum_possible_values(ty: &Type) -> TokenStream {
+    quote_spanned! { ty.span()=>
+        .possible_values(<#ty as clap::ValueEnum>::value_variants().iter().filter_map(clap::ValueEnum::to_possible_value))
+    }
+}
+
+pub fn gen_constructor(fields: &Punctuated<Field, Comma>, parent_attribute: &Attrs) -> TokenStream {
+    let fields = fields.iter().map(|field| {
+        let attrs = Attrs::from_field(
+            field,
+            parent_attribute.casing(),
+            parent_attribute.env_casing(),
+        );
+        let field_name = field.ident.as_ref().unwrap();
+        let kind = attrs.kind();
+        let arg_matches = format_ident!("__clap_arg_matches");
+        match &*kind {
+            Kind::ExternalSubcommand => {
+                abort! { kind.span(),
+                    "`external_subcommand` can be used only on enum variants"
+                }
+            }
+            Kind::Subcommand(ty) => {
+                let subcmd_type = match (**ty, sub_type(&field.ty)) {
+                    (Ty::Option, Some(sub_type)) => sub_type,
+                    _ => &field.ty,
+                };
+                match **ty {
+                    Ty::Option => {
+                        quote_spanned! { kind.span()=>
+                            #field_name: {
+                                if #arg_matches.subcommand_name().map(<#subcmd_type as clap::Subcommand>::has_subcommand).unwrap_or(false) {
+                                    Some(<#subcmd_type as clap::FromArgMatches>::from_arg_matches_mut(#arg_matches)?)
+                                } else {
+                                    None
+                                }
+                            }
+                        }
+                    },
+                    _ => {
+                        quote_spanned! { kind.span()=>
+                            #field_name: {
+                                <#subcmd_type as clap::FromArgMatches>::from_arg_matches_mut(#arg_matches)?
+                            }
+                        }
+                    },
+                }
+            }
+
+            Kind::Flatten => quote_spanned! { kind.span()=>
+                #field_name: clap::FromArgMatches::from_arg_matches_mut(#arg_matches)?
+            },
+
+            Kind::Skip(val) => match val {
+                None => quote_spanned!(kind.span()=> #field_name: Default::default()),
+                Some(val) => quote_spanned!(kind.span()=> #field_name: (#val).into()),
+            },
+
+            Kind::Arg(ty) | Kind::FromGlobal(ty) => {
+                gen_parsers(&attrs, ty, field_name, field, None)
+            }
+        }
+    });
+
+    quote! {{
+        #( #fields ),*
+    }}
+}
+
+pub fn gen_updater(
+    fields: &Punctuated<Field, Comma>,
+    parent_attribute: &Attrs,
+    use_self: bool,
+) -> TokenStream {
+    let fields = fields.iter().map(|field| {
+        let attrs = Attrs::from_field(
+            field,
+            parent_attribute.casing(),
+            parent_attribute.env_casing(),
+        );
+        let field_name = field.ident.as_ref().unwrap();
+        let kind = attrs.kind();
+
+        let access = if use_self {
+            quote! {
+                #[allow(non_snake_case)]
+                let #field_name = &mut self.#field_name;
+            }
+        } else {
+            quote!()
+        };
+        let arg_matches = format_ident!("__clap_arg_matches");
+
+        match &*kind {
+            Kind::ExternalSubcommand => {
+                abort! { kind.span(),
+                    "`external_subcommand` can be used only on enum variants"
+                }
+            }
+            Kind::Subcommand(ty) => {
+                let subcmd_type = match (**ty, sub_type(&field.ty)) {
+                    (Ty::Option, Some(sub_type)) => sub_type,
+                    _ => &field.ty,
+                };
+
+                let updater = quote_spanned! { ty.span()=>
+                    <#subcmd_type as clap::FromArgMatches>::update_from_arg_matches_mut(#field_name, #arg_matches)?;
+                };
+
+                let updater = match **ty {
+                    Ty::Option => quote_spanned! { kind.span()=>
+                        if let Some(#field_name) = #field_name.as_mut() {
+                            #updater
+                        } else {
+                            *#field_name = Some(<#subcmd_type as clap::FromArgMatches>::from_arg_matches_mut(
+                                #arg_matches
+                            )?);
+                        }
+                    },
+                    _ => quote_spanned! { kind.span()=>
+                        #updater
+                    },
+                };
+
+                quote_spanned! { kind.span()=>
+                    {
+                        #access
+                        #updater
+                    }
+                }
+            }
+
+            Kind::Flatten => quote_spanned! { kind.span()=> {
+                    #access
+                    clap::FromArgMatches::update_from_arg_matches_mut(#field_name, #arg_matches)?;
+                }
+            },
+
+            Kind::Skip(_) => quote!(),
+
+            Kind::Arg(ty) | Kind::FromGlobal(ty) => gen_parsers(&attrs, ty, field_name, field, Some(&access)),
+        }
+    });
+
+    quote! {
+        #( #fields )*
+    }
+}
+
+fn gen_parsers(
+    attrs: &Attrs,
+    ty: &Sp<Ty>,
+    field_name: &Ident,
+    field: &Field,
+    update: Option<&TokenStream>,
+) -> TokenStream {
+    use self::ParserKind::*;
+
+    let parser = attrs.parser(&field.ty);
+    let func = &parser.func;
+    let span = parser.kind.span();
+    let convert_type = inner_type(&field.ty);
+    let id = attrs.id();
+    let mut flag = false;
+    let mut occurrences = false;
+    let (get_one, get_many, deref, mut parse) = match *parser.kind {
+        _ if attrs.ignore_parser() => (
+            quote_spanned!(span=> remove_one::<#convert_type>),
+            quote_spanned!(span=> remove_many::<#convert_type>),
+            quote!(|s| s),
+            quote_spanned!(func.span()=> |s| ::std::result::Result::Ok::<_, clap::Error>(s)),
+        ),
+        FromOccurrences => {
+            occurrences = true;
+            (
+                quote_spanned!(span=> occurrences_of),
+                quote!(),
+                quote!(|s| ::std::ops::Deref::deref(s)),
+                func.clone(),
+            )
+        }
+        FromFlag => {
+            flag = true;
+            (
+                quote!(),
+                quote!(),
+                quote!(|s| ::std::ops::Deref::deref(s)),
+                func.clone(),
+            )
+        }
+        FromStr => (
+            quote_spanned!(span=> get_one::<String>),
+            quote_spanned!(span=> get_many::<String>),
+            quote!(|s| ::std::ops::Deref::deref(s)),
+            quote_spanned!(func.span()=> |s| ::std::result::Result::Ok::<_, clap::Error>(#func(s))),
+        ),
+        TryFromStr => (
+            quote_spanned!(span=> get_one::<String>),
+            quote_spanned!(span=> get_many::<String>),
+            quote!(|s| ::std::ops::Deref::deref(s)),
+            quote_spanned!(func.span()=> |s| #func(s).map_err(|err| clap::Error::raw(clap::ErrorKind::ValueValidation, format!("Invalid value for {}: {}", #id, err)))),
+        ),
+        FromOsStr => (
+            quote_spanned!(span=> get_one::<::std::ffi::OsString>),
+            quote_spanned!(span=> get_many::<::std::ffi::OsString>),
+            quote!(|s| ::std::ops::Deref::deref(s)),
+            quote_spanned!(func.span()=> |s| ::std::result::Result::Ok::<_, clap::Error>(#func(s))),
+        ),
+        TryFromOsStr => (
+            quote_spanned!(span=> get_one::<::std::ffi::OsString>),
+            quote_spanned!(span=> get_many::<::std::ffi::OsString>),
+            quote!(|s| ::std::ops::Deref::deref(s)),
+            quote_spanned!(func.span()=> |s| #func(s).map_err(|err| clap::Error::raw(clap::ErrorKind::ValueValidation, format!("Invalid value for {}: {}", #id, err)))),
+        ),
+    };
+    if attrs.is_enum() && !attrs.ignore_parser() {
+        let ci = attrs.ignore_case();
+
+        parse = quote_spanned! { convert_type.span()=>
+            |s| <#convert_type as clap::ValueEnum>::from_str(s, #ci).map_err(|err| clap::Error::raw(clap::ErrorKind::ValueValidation, format!("Invalid value for {}: {}", #id, err)))
+        }
+    }
+
+    // Give this identifier the same hygiene
+    // as the `arg_matches` parameter definition. This
+    // allows us to refer to `arg_matches` within a `quote_spanned` block
+    let arg_matches = format_ident!("__clap_arg_matches");
+
+    let field_value = match **ty {
+        Ty::Option => {
+            quote_spanned! { ty.span()=>
+                #arg_matches.#get_one(#id)
+                    .map(#deref)
+                    .map(#parse)
+                    .transpose()?
+            }
+        }
+
+        Ty::OptionOption => quote_spanned! { ty.span()=>
+            if #arg_matches.contains_id(#id) {
+                Some(
+                    #arg_matches.#get_one(#id)
+                        .map(#deref)
+                        .map(#parse).transpose()?
+                )
+            } else {
+                None
+            }
+        },
+
+        Ty::OptionVec => quote_spanned! { ty.span()=>
+            if #arg_matches.contains_id(#id) {
+                Some(#arg_matches.#get_many(#id)
+                    .map(|v| v.map(#deref).map::<::std::result::Result<#convert_type, clap::Error>, _>(#parse).collect::<::std::result::Result<Vec<_>, clap::Error>>())
+                    .transpose()?
+                    .unwrap_or_else(Vec::new))
+            } else {
+                None
+            }
+        },
+
+        Ty::Vec => {
+            quote_spanned! { ty.span()=>
+                #arg_matches.#get_many(#id)
+                    .map(|v| v.map(#deref).map::<::std::result::Result<#convert_type, clap::Error>, _>(#parse).collect::<::std::result::Result<Vec<_>, clap::Error>>())
+                    .transpose()?
+                    .unwrap_or_else(Vec::new)
+            }
+        }
+
+        Ty::Other if occurrences => quote_spanned! { ty.span()=>
+            #parse(
+                #arg_matches.#get_one(#id)
+            )
+        },
+
+        Ty::Other if flag => {
+            if update.is_some() && is_simple_ty(&field.ty, "bool") {
+                quote_spanned! { ty.span()=>
+                    *#field_name || #arg_matches.is_present(#id)
+                }
+            } else {
+                quote_spanned! { ty.span()=>
+                    #parse(#arg_matches.is_present(#id))
+                }
+            }
+        }
+
+        Ty::Other => {
+            quote_spanned! { ty.span()=>
+                #arg_matches.#get_one(#id)
+                    .map(#deref)
+                    .ok_or_else(|| clap::Error::raw(clap::ErrorKind::MissingRequiredArgument, format!("The following required argument was not provided: {}", #id)))
+                    .and_then(#parse)?
+            }
+        }
+    };
+
+    if let Some(access) = update {
+        quote_spanned! { field.span()=>
+            if #arg_matches.contains_id(#id) {
+                #access
+                *#field_name = #field_value
+            }
+        }
+    } else {
+        quote_spanned!(field.span()=> #field_name: #field_value )
+    }
+}
+
+#[cfg(feature = "raw-deprecated")]
+pub fn raw_deprecated() -> TokenStream {
+    quote! {}
+}
+
+#[cfg(not(feature = "raw-deprecated"))]
+pub fn raw_deprecated() -> TokenStream {
+    quote! {
+        #![allow(deprecated)]  // Assuming any deprecation in here will be related to a deprecation in `Args`
+
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/derives/into_app.rs b/android/vendor/clap_derive-3.2.6/src/derives/into_app.rs
new file mode 100644
index 0000000..3197357
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/derives/into_app.rs
@@ -0,0 +1,119 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+
+use std::env;
+
+use proc_macro2::{Span, TokenStream};
+use quote::quote;
+use syn::{Attribute, Generics, Ident};
+
+use crate::{
+    attrs::{Attrs, Name, DEFAULT_CASING, DEFAULT_ENV_CASING},
+    utils::Sp,
+};
+
+pub fn gen_for_struct(
+    struct_name: &Ident,
+    generics: &Generics,
+    attrs: &[Attribute],
+) -> TokenStream {
+    let app_name = env::var("CARGO_PKG_NAME").ok().unwrap_or_default();
+
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Assigned(quote!(#app_name)),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+    let name = attrs.cased_name();
+    let app_var = Ident::new("__clap_app", Span::call_site());
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    let tokens = quote! {
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        #[allow(deprecated)]
+        impl #impl_generics clap::CommandFactory for #struct_name #ty_generics #where_clause {
+            fn into_app<'b>() -> clap::Command<'b> {
+                let #app_var = clap::Command::new(#name);
+                <Self as clap::Args>::augment_args(#app_var)
+            }
+
+            fn into_app_for_update<'b>() -> clap::Command<'b> {
+                let #app_var = clap::Command::new(#name);
+                <Self as clap::Args>::augment_args_for_update(#app_var)
+            }
+        }
+    };
+
+    tokens
+}
+
+pub fn gen_for_enum(enum_name: &Ident, generics: &Generics, attrs: &[Attribute]) -> TokenStream {
+    let app_name = env::var("CARGO_PKG_NAME").ok().unwrap_or_default();
+
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Assigned(quote!(#app_name)),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+    let name = attrs.cased_name();
+    let app_var = Ident::new("__clap_app", Span::call_site());
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        impl #impl_generics clap::CommandFactory for #enum_name #ty_generics #where_clause {
+            fn into_app<'b>() -> clap::Command<'b> {
+                #[allow(deprecated)]
+                let #app_var = clap::Command::new(#name)
+                    .setting(clap::AppSettings::SubcommandRequiredElseHelp);
+                <Self as clap::Subcommand>::augment_subcommands(#app_var)
+            }
+
+            fn into_app_for_update<'b>() -> clap::Command<'b> {
+                let #app_var = clap::Command::new(#name);
+                <Self as clap::Subcommand>::augment_subcommands_for_update(#app_var)
+            }
+        }
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/derives/mod.rs b/android/vendor/clap_derive-3.2.6/src/derives/mod.rs
new file mode 100644
index 0000000..3deeb91
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/derives/mod.rs
@@ -0,0 +1,23 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+mod args;
+mod into_app;
+mod parser;
+mod subcommand;
+mod value_enum;
+
+pub use self::parser::derive_parser;
+pub use args::derive_args;
+pub use subcommand::derive_subcommand;
+pub use value_enum::derive_value_enum;
diff --git a/android/vendor/clap_derive-3.2.6/src/derives/parser.rs b/android/vendor/clap_derive-3.2.6/src/derives/parser.rs
new file mode 100644
index 0000000..621430f
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/derives/parser.rs
@@ -0,0 +1,95 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+
+use crate::{
+    derives::{args, into_app, subcommand},
+    dummies,
+};
+
+use proc_macro2::TokenStream;
+use proc_macro_error::abort_call_site;
+use quote::quote;
+use syn::{
+    self, punctuated::Punctuated, token::Comma, Attribute, Data, DataEnum, DataStruct, DeriveInput,
+    Field, Fields, Generics, Ident,
+};
+
+pub fn derive_parser(input: &DeriveInput) -> TokenStream {
+    let ident = &input.ident;
+
+    match input.data {
+        Data::Struct(DataStruct {
+            fields: Fields::Named(ref fields),
+            ..
+        }) => {
+            dummies::parser_struct(ident);
+            gen_for_struct(ident, &input.generics, &fields.named, &input.attrs)
+        }
+        Data::Struct(DataStruct {
+            fields: Fields::Unit,
+            ..
+        }) => {
+            dummies::parser_struct(ident);
+            gen_for_struct(
+                ident,
+                &input.generics,
+                &Punctuated::<Field, Comma>::new(),
+                &input.attrs,
+            )
+        }
+        Data::Enum(ref e) => {
+            dummies::parser_enum(ident);
+            gen_for_enum(ident, &input.generics, &input.attrs, e)
+        }
+        _ => abort_call_site!("`#[derive(Parser)]` only supports non-tuple structs and enums"),
+    }
+}
+
+fn gen_for_struct(
+    name: &Ident,
+    generics: &Generics,
+    fields: &Punctuated<Field, Comma>,
+    attrs: &[Attribute],
+) -> TokenStream {
+    let into_app = into_app::gen_for_struct(name, generics, attrs);
+    let args = args::gen_for_struct(name, generics, fields, attrs);
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        impl #impl_generics clap::Parser for #name #ty_generics #where_clause {}
+
+        #into_app
+        #args
+    }
+}
+
+fn gen_for_enum(
+    name: &Ident,
+    generics: &Generics,
+    attrs: &[Attribute],
+    e: &DataEnum,
+) -> TokenStream {
+    let into_app = into_app::gen_for_enum(name, generics, attrs);
+    let subcommand = subcommand::gen_for_enum(name, generics, attrs, e);
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        impl #impl_generics clap::Parser for #name #ty_generics #where_clause {}
+
+        #into_app
+        #subcommand
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/derives/subcommand.rs b/android/vendor/clap_derive-3.2.6/src/derives/subcommand.rs
new file mode 100644
index 0000000..07bdce5
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/derives/subcommand.rs
@@ -0,0 +1,678 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+use crate::{
+    attrs::{Attrs, Kind, Name, DEFAULT_CASING, DEFAULT_ENV_CASING},
+    derives::args,
+    dummies,
+    utils::{is_simple_ty, subty_if_name, Sp},
+};
+
+use proc_macro2::{Ident, Span, TokenStream};
+use proc_macro_error::{abort, abort_call_site};
+use quote::{format_ident, quote, quote_spanned};
+use syn::{
+    punctuated::Punctuated, spanned::Spanned, Attribute, Data, DataEnum, DeriveInput,
+    FieldsUnnamed, Generics, Token, Variant,
+};
+
+pub fn derive_subcommand(input: &DeriveInput) -> TokenStream {
+    let ident = &input.ident;
+
+    dummies::subcommand(ident);
+
+    match input.data {
+        Data::Enum(ref e) => gen_for_enum(ident, &input.generics, &input.attrs, e),
+        _ => abort_call_site!("`#[derive(Subcommand)]` only supports enums"),
+    }
+}
+
+pub fn gen_for_enum(
+    enum_name: &Ident,
+    generics: &Generics,
+    attrs: &[Attribute],
+    e: &DataEnum,
+) -> TokenStream {
+    let from_arg_matches = gen_from_arg_matches_for_enum(enum_name, generics, attrs, e);
+
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Derived(enum_name.clone()),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+    let augmentation = gen_augment(&e.variants, &attrs, false);
+    let augmentation_update = gen_augment(&e.variants, &attrs, true);
+    let has_subcommand = gen_has_subcommand(&e.variants, &attrs);
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        #from_arg_matches
+
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        impl #impl_generics clap::Subcommand for #enum_name #ty_generics #where_clause {
+            fn augment_subcommands <'b>(__clap_app: clap::Command<'b>) -> clap::Command<'b> {
+                #augmentation
+            }
+            fn augment_subcommands_for_update <'b>(__clap_app: clap::Command<'b>) -> clap::Command<'b> {
+                #augmentation_update
+            }
+            fn has_subcommand(__clap_name: &str) -> bool {
+                #has_subcommand
+            }
+        }
+    }
+}
+
+fn gen_from_arg_matches_for_enum(
+    name: &Ident,
+    generics: &Generics,
+    attrs: &[Attribute],
+    e: &DataEnum,
+) -> TokenStream {
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Derived(name.clone()),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+
+    let from_arg_matches = gen_from_arg_matches(name, &e.variants, &attrs);
+    let update_from_arg_matches = gen_update_from_arg_matches(name, &e.variants, &attrs);
+
+    let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();
+
+    quote! {
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        impl #impl_generics clap::FromArgMatches for #name #ty_generics #where_clause {
+            fn from_arg_matches(__clap_arg_matches: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
+                Self::from_arg_matches_mut(&mut __clap_arg_matches.clone())
+            }
+
+            #from_arg_matches
+
+            fn update_from_arg_matches(&mut self, __clap_arg_matches: &clap::ArgMatches) -> ::std::result::Result<(), clap::Error> {
+                self.update_from_arg_matches_mut(&mut __clap_arg_matches.clone())
+            }
+            #update_from_arg_matches
+        }
+    }
+}
+
+fn gen_augment(
+    variants: &Punctuated<Variant, Token![,]>,
+    parent_attribute: &Attrs,
+    override_required: bool,
+) -> TokenStream {
+    use syn::Fields::*;
+
+    let app_var = Ident::new("__clap_app", Span::call_site());
+
+    let subcommands: Vec<_> = variants
+        .iter()
+        .filter_map(|variant| {
+            let attrs = Attrs::from_variant(
+                variant,
+                parent_attribute.casing(),
+                parent_attribute.env_casing(),
+            );
+            let kind = attrs.kind();
+
+            match &*kind {
+                Kind::Skip(_) => None,
+
+                Kind::ExternalSubcommand => {
+                    let ty = match variant.fields {
+                        Unnamed(ref fields) if fields.unnamed.len() == 1 => &fields.unnamed[0].ty,
+
+                        _ => abort!(
+                            variant,
+                            "The enum variant marked with `external_subcommand` must be \
+                             a single-typed tuple, and the type must be either `Vec<String>` \
+                             or `Vec<OsString>`."
+                        ),
+                    };
+                    let subcommand = match subty_if_name(ty, "Vec") {
+                        Some(subty) => {
+                            if is_simple_ty(subty, "OsString") {
+                                quote_spanned! { kind.span()=>
+                                    let #app_var = #app_var.allow_external_subcommands(true).allow_invalid_utf8_for_external_subcommands(true);
+                                }
+                            } else {
+                                quote_spanned! { kind.span()=>
+                                    let #app_var = #app_var.allow_external_subcommands(true);
+                                }
+                            }
+                        }
+
+                        None => abort!(
+                            ty.span(),
+                            "The type must be `Vec<_>` \
+                             to be used with `external_subcommand`."
+                        ),
+                    };
+                    Some(subcommand)
+                }
+
+                Kind::Flatten => match variant.fields {
+                    Unnamed(FieldsUnnamed { ref unnamed, .. }) if unnamed.len() == 1 => {
+                        let ty = &unnamed[0];
+                        let old_heading_var = format_ident!("__clap_old_heading");
+                        let next_help_heading = attrs.next_help_heading();
+                        let next_display_order = attrs.next_display_order();
+                        let subcommand = if override_required {
+                            quote! {
+                                let #old_heading_var = #app_var.get_next_help_heading();
+                                let #app_var = #app_var #next_help_heading #next_display_order;
+                                let #app_var = <#ty as clap::Subcommand>::augment_subcommands_for_update(#app_var);
+                                let #app_var = #app_var.next_help_heading(#old_heading_var);
+                            }
+                        } else {
+                            quote! {
+                                let #old_heading_var = #app_var.get_next_help_heading();
+                                let #app_var = #app_var #next_help_heading #next_display_order;
+                                let #app_var = <#ty as clap::Subcommand>::augment_subcommands(#app_var);
+                                let #app_var = #app_var.next_help_heading(#old_heading_var);
+                            }
+                        };
+                        Some(subcommand)
+                    }
+                    _ => abort!(
+                        variant,
+                        "`flatten` is usable only with single-typed tuple variants"
+                    ),
+                },
+
+                Kind::Subcommand(_) => {
+                    let subcommand_var = Ident::new("__clap_subcommand", Span::call_site());
+                    let arg_block = match variant.fields {
+                        Named(_) => {
+                            abort!(variant, "non single-typed tuple enums are not supported")
+                        }
+                        Unit => quote!( #subcommand_var ),
+                        Unnamed(FieldsUnnamed { ref unnamed, .. }) if unnamed.len() == 1 => {
+                            let ty = &unnamed[0];
+                            if override_required {
+                                quote_spanned! { ty.span()=>
+                                    {
+                                        <#ty as clap::Subcommand>::augment_subcommands_for_update(#subcommand_var)
+                                    }
+                                }
+                            } else {
+                                quote_spanned! { ty.span()=>
+                                    {
+                                        <#ty as clap::Subcommand>::augment_subcommands(#subcommand_var)
+                                    }
+                                }
+                            }
+                        }
+                        Unnamed(..) => {
+                            abort!(variant, "non single-typed tuple enums are not supported")
+                        }
+                    };
+
+                    let name = attrs.cased_name();
+                    let initial_app_methods = attrs.initial_top_level_methods();
+                    let final_from_attrs = attrs.final_top_level_methods();
+                    let subcommand = quote! {
+                        let #app_var = #app_var.subcommand({
+                            let #subcommand_var = clap::Command::new(#name);
+                            let #subcommand_var = #subcommand_var #initial_app_methods;
+                            let #subcommand_var = #arg_block;
+                            #[allow(deprecated)]
+                            let #subcommand_var = #subcommand_var.setting(clap::AppSettings::SubcommandRequiredElseHelp);
+                            #subcommand_var #final_from_attrs
+                        });
+                    };
+                    Some(subcommand)
+                }
+
+                _ => {
+                    let subcommand_var = Ident::new("__clap_subcommand", Span::call_site());
+                    let sub_augment = match variant.fields {
+                        Named(ref fields) => {
+                            // Defer to `gen_augment` for adding cmd methods
+                            args::gen_augment(&fields.named, &subcommand_var, &attrs, override_required)
+                        }
+                        Unit => {
+                            let arg_block = quote!( #subcommand_var );
+                            let initial_app_methods = attrs.initial_top_level_methods();
+                            let final_from_attrs = attrs.final_top_level_methods();
+                            quote! {
+                                let #subcommand_var = #subcommand_var #initial_app_methods;
+                                let #subcommand_var = #arg_block;
+                                #subcommand_var #final_from_attrs
+                            }
+                        },
+                        Unnamed(FieldsUnnamed { ref unnamed, .. }) if unnamed.len() == 1 => {
+                            let ty = &unnamed[0];
+                            let arg_block = if override_required {
+                                quote_spanned! { ty.span()=>
+                                    {
+                                        <#ty as clap::Args>::augment_args_for_update(#subcommand_var)
+                                    }
+                                }
+                            } else {
+                                quote_spanned! { ty.span()=>
+                                    {
+                                        <#ty as clap::Args>::augment_args(#subcommand_var)
+                                    }
+                                }
+                            };
+                            let initial_app_methods = attrs.initial_top_level_methods();
+                            let final_from_attrs = attrs.final_top_level_methods();
+                            quote! {
+                                let #subcommand_var = #subcommand_var #initial_app_methods;
+                                let #subcommand_var = #arg_block;
+                                #subcommand_var #final_from_attrs
+                            }
+                        }
+                        Unnamed(..) => {
+                            abort!(variant, "non single-typed tuple enums are not supported")
+                        }
+                    };
+
+                    let name = attrs.cased_name();
+                    let subcommand = quote! {
+                        let #app_var = #app_var.subcommand({
+                            let #subcommand_var = clap::Command::new(#name);
+                            #sub_augment
+                        });
+                    };
+                    Some(subcommand)
+                }
+            }
+        })
+        .collect();
+
+    let initial_app_methods = parent_attribute.initial_top_level_methods();
+    let final_app_methods = parent_attribute.final_top_level_methods();
+    quote! {
+            let #app_var = #app_var #initial_app_methods;
+            #( #subcommands )*;
+            #app_var #final_app_methods
+    }
+}
+
+fn gen_has_subcommand(
+    variants: &Punctuated<Variant, Token![,]>,
+    parent_attribute: &Attrs,
+) -> TokenStream {
+    use syn::Fields::*;
+
+    let mut ext_subcmd = false;
+
+    let (flatten_variants, variants): (Vec<_>, Vec<_>) = variants
+        .iter()
+        .filter_map(|variant| {
+            let attrs = Attrs::from_variant(
+                variant,
+                parent_attribute.casing(),
+                parent_attribute.env_casing(),
+            );
+
+            if let Kind::ExternalSubcommand = &*attrs.kind() {
+                ext_subcmd = true;
+                None
+            } else {
+                Some((variant, attrs))
+            }
+        })
+        .partition(|(_, attrs)| {
+            let kind = attrs.kind();
+            matches!(&*kind, Kind::Flatten)
+        });
+
+    let subcommands = variants.iter().map(|(_variant, attrs)| {
+        let sub_name = attrs.cased_name();
+        quote! {
+            if #sub_name == __clap_name {
+                return true
+            }
+        }
+    });
+    let child_subcommands = flatten_variants
+        .iter()
+        .map(|(variant, _attrs)| match variant.fields {
+            Unnamed(ref fields) if fields.unnamed.len() == 1 => {
+                let ty = &fields.unnamed[0];
+                quote! {
+                    if <#ty as clap::Subcommand>::has_subcommand(__clap_name) {
+                        return true;
+                    }
+                }
+            }
+            _ => abort!(
+                variant,
+                "`flatten` is usable only with single-typed tuple variants"
+            ),
+        });
+
+    if ext_subcmd {
+        quote! { true }
+    } else {
+        quote! {
+            #( #subcommands )*
+
+            #( #child_subcommands )else*
+
+            false
+        }
+    }
+}
+
+fn gen_from_arg_matches(
+    name: &Ident,
+    variants: &Punctuated<Variant, Token![,]>,
+    parent_attribute: &Attrs,
+) -> TokenStream {
+    use syn::Fields::*;
+
+    let mut ext_subcmd = None;
+
+    let subcommand_name_var = format_ident!("__clap_name");
+    let sub_arg_matches_var = format_ident!("__clap_arg_matches");
+    let (flatten_variants, variants): (Vec<_>, Vec<_>) = variants
+        .iter()
+        .filter_map(|variant| {
+            let attrs = Attrs::from_variant(
+                variant,
+                parent_attribute.casing(),
+                parent_attribute.env_casing(),
+            );
+
+            if let Kind::ExternalSubcommand = &*attrs.kind() {
+                if ext_subcmd.is_some() {
+                    abort!(
+                        attrs.kind().span(),
+                        "Only one variant can be marked with `external_subcommand`, \
+                         this is the second"
+                    );
+                }
+
+                let ty = match variant.fields {
+                    Unnamed(ref fields) if fields.unnamed.len() == 1 => &fields.unnamed[0].ty,
+
+                    _ => abort!(
+                        variant,
+                        "The enum variant marked with `external_subcommand` must be \
+                         a single-typed tuple, and the type must be either `Vec<String>` \
+                         or `Vec<OsString>`."
+                    ),
+                };
+
+                let (span, str_ty) = match subty_if_name(ty, "Vec") {
+                    Some(subty) => {
+                        if is_simple_ty(subty, "String") {
+                            (subty.span(), quote!(::std::string::String))
+                        } else if is_simple_ty(subty, "OsString") {
+                            (subty.span(), quote!(::std::ffi::OsString))
+                        } else {
+                            abort!(
+                                ty.span(),
+                                "The type must be either `Vec<String>` or `Vec<OsString>` \
+                                 to be used with `external_subcommand`."
+                            );
+                        }
+                    }
+
+                    None => abort!(
+                        ty.span(),
+                        "The type must be either `Vec<String>` or `Vec<OsString>` \
+                         to be used with `external_subcommand`."
+                    ),
+                };
+
+                ext_subcmd = Some((span, &variant.ident, str_ty));
+                None
+            } else {
+                Some((variant, attrs))
+            }
+        })
+        .partition(|(_, attrs)| {
+            let kind = attrs.kind();
+            matches!(&*kind, Kind::Flatten)
+        });
+
+    let subcommands = variants.iter().map(|(variant, attrs)| {
+        let sub_name = attrs.cased_name();
+        let variant_name = &variant.ident;
+        let constructor_block = match variant.fields {
+            Named(ref fields) => args::gen_constructor(&fields.named, attrs),
+            Unit => quote!(),
+            Unnamed(ref fields) if fields.unnamed.len() == 1 => {
+                let ty = &fields.unnamed[0];
+                quote!( ( <#ty as clap::FromArgMatches>::from_arg_matches_mut(__clap_arg_matches)? ) )
+            }
+            Unnamed(..) => abort_call_site!("{}: tuple enums are not supported", variant.ident),
+        };
+
+        if cfg!(feature = "unstable-v4") {
+            quote! {
+                if #sub_name == #subcommand_name_var && !#sub_arg_matches_var.contains_id("") {
+                    return ::std::result::Result::Ok(#name :: #variant_name #constructor_block)
+                }
+            }
+        } else {
+            quote! {
+                if #sub_name == #subcommand_name_var {
+                    return ::std::result::Result::Ok(#name :: #variant_name #constructor_block)
+                }
+            }
+        }
+    });
+    let child_subcommands = flatten_variants.iter().map(|(variant, _attrs)| {
+        let variant_name = &variant.ident;
+        match variant.fields {
+            Unnamed(ref fields) if fields.unnamed.len() == 1 => {
+                let ty = &fields.unnamed[0];
+                quote! {
+                    if __clap_arg_matches
+                        .subcommand_name()
+                        .map(|__clap_name| <#ty as clap::Subcommand>::has_subcommand(__clap_name))
+                        .unwrap_or_default()
+                    {
+                        let __clap_res = <#ty as clap::FromArgMatches>::from_arg_matches_mut(__clap_arg_matches)?;
+                        return ::std::result::Result::Ok(#name :: #variant_name (__clap_res));
+                    }
+                }
+            }
+            _ => abort!(
+                variant,
+                "`flatten` is usable only with single-typed tuple variants"
+            ),
+        }
+    });
+
+    let wildcard = match ext_subcmd {
+        Some((span, var_name, str_ty)) => quote_spanned! { span=>
+                ::std::result::Result::Ok(#name::#var_name(
+                    ::std::iter::once(#str_ty::from(#subcommand_name_var))
+                    .chain(
+                        #sub_arg_matches_var
+                            .remove_many::<#str_ty>("")
+                            .into_iter().flatten()  // `""` isn't present, bug in `unstable-v4`
+                            .map(#str_ty::from)
+                    )
+                    .collect::<::std::vec::Vec<_>>()
+                ))
+        },
+
+        None => quote! {
+            ::std::result::Result::Err(clap::Error::raw(clap::ErrorKind::UnrecognizedSubcommand, format!("The subcommand '{}' wasn't recognized", #subcommand_name_var)))
+        },
+    };
+
+    let raw_deprecated = args::raw_deprecated();
+    quote! {
+        fn from_arg_matches_mut(__clap_arg_matches: &mut clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
+            #raw_deprecated
+
+            #( #child_subcommands )else*
+
+            if let Some((#subcommand_name_var, mut __clap_arg_sub_matches)) = __clap_arg_matches.remove_subcommand() {
+                let #sub_arg_matches_var = &mut __clap_arg_sub_matches;
+                #( #subcommands )*
+
+                #wildcard
+            } else {
+                ::std::result::Result::Err(clap::Error::raw(clap::ErrorKind::MissingSubcommand, "A subcommand is required but one was not provided."))
+            }
+        }
+    }
+}
+
+fn gen_update_from_arg_matches(
+    name: &Ident,
+    variants: &Punctuated<Variant, Token![,]>,
+    parent_attribute: &Attrs,
+) -> TokenStream {
+    use syn::Fields::*;
+
+    let (flatten, variants): (Vec<_>, Vec<_>) = variants
+        .iter()
+        .filter_map(|variant| {
+            let attrs = Attrs::from_variant(
+                variant,
+                parent_attribute.casing(),
+                parent_attribute.env_casing(),
+            );
+
+            match &*attrs.kind() {
+                // Fallback to `from_arg_matches_mut`
+                Kind::ExternalSubcommand => None,
+                _ => Some((variant, attrs)),
+            }
+        })
+        .partition(|(_, attrs)| {
+            let kind = attrs.kind();
+            matches!(&*kind, Kind::Flatten)
+        });
+
+    let subcommands = variants.iter().map(|(variant, attrs)| {
+        let sub_name = attrs.cased_name();
+        let variant_name = &variant.ident;
+        let (pattern, updater) = match variant.fields {
+            Named(ref fields) => {
+                let (fields, update): (Vec<_>, Vec<_>) = fields
+                    .named
+                    .iter()
+                    .map(|field| {
+                        let attrs = Attrs::from_field(
+                            field,
+                            parent_attribute.casing(),
+                            parent_attribute.env_casing(),
+                        );
+                        let field_name = field.ident.as_ref().unwrap();
+                        (
+                            quote!( ref mut #field_name ),
+                            args::gen_updater(&fields.named, &attrs, false),
+                        )
+                    })
+                    .unzip();
+                (quote!( { #( #fields, )* }), quote!( { #( #update )* } ))
+            }
+            Unit => (quote!(), quote!({})),
+            Unnamed(ref fields) => {
+                if fields.unnamed.len() == 1 {
+                    (
+                        quote!((ref mut __clap_arg)),
+                        quote!(clap::FromArgMatches::update_from_arg_matches_mut(
+                            __clap_arg,
+                            __clap_arg_matches
+                        )?),
+                    )
+                } else {
+                    abort_call_site!("{}: tuple enums are not supported", variant.ident)
+                }
+            }
+        };
+
+        quote! {
+            #name :: #variant_name #pattern if #sub_name == __clap_name => {
+                let (_, mut __clap_arg_sub_matches) = __clap_arg_matches.remove_subcommand().unwrap();
+                let __clap_arg_matches = &mut __clap_arg_sub_matches;
+                #updater
+            }
+        }
+    });
+
+    let child_subcommands = flatten.iter().map(|(variant, _attrs)| {
+        let variant_name = &variant.ident;
+        match variant.fields {
+            Unnamed(ref fields) if fields.unnamed.len() == 1 => {
+                let ty = &fields.unnamed[0];
+                quote! {
+                    if <#ty as clap::Subcommand>::has_subcommand(__clap_name) {
+                        if let #name :: #variant_name (child) = s {
+                            <#ty as clap::FromArgMatches>::update_from_arg_matches_mut(child, __clap_arg_matches)?;
+                            return ::std::result::Result::Ok(());
+                        }
+                    }
+                }
+            }
+            _ => abort!(
+                variant,
+                "`flatten` is usable only with single-typed tuple variants"
+            ),
+        }
+    });
+
+    let raw_deprecated = args::raw_deprecated();
+    quote! {
+        fn update_from_arg_matches_mut<'b>(
+            &mut self,
+            __clap_arg_matches: &mut clap::ArgMatches,
+        ) -> ::std::result::Result<(), clap::Error> {
+            #raw_deprecated
+
+            if let Some(__clap_name) = __clap_arg_matches.subcommand_name() {
+                match self {
+                    #( #subcommands ),*
+                    s => {
+                        #( #child_subcommands )*
+                        *s = <Self as clap::FromArgMatches>::from_arg_matches_mut(__clap_arg_matches)?;
+                    }
+                }
+            }
+            ::std::result::Result::Ok(())
+        }
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/derives/value_enum.rs b/android/vendor/clap_derive-3.2.6/src/derives/value_enum.rs
new file mode 100644
index 0000000..b18b665
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/derives/value_enum.rs
@@ -0,0 +1,124 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use crate::{
+    attrs::{Attrs, Kind, Name, DEFAULT_CASING, DEFAULT_ENV_CASING},
+    dummies,
+    utils::Sp,
+};
+
+use proc_macro2::{Span, TokenStream};
+use proc_macro_error::{abort, abort_call_site};
+use quote::quote;
+use quote::quote_spanned;
+use syn::{
+    punctuated::Punctuated, spanned::Spanned, token::Comma, Attribute, Data, DataEnum, DeriveInput,
+    Fields, Ident, Variant,
+};
+
+pub fn derive_value_enum(input: &DeriveInput) -> TokenStream {
+    let ident = &input.ident;
+
+    dummies::value_enum(ident);
+
+    match input.data {
+        Data::Enum(ref e) => gen_for_enum(ident, &input.attrs, e),
+        _ => abort_call_site!("`#[derive(ValueEnum)]` only supports enums"),
+    }
+}
+
+pub fn gen_for_enum(name: &Ident, attrs: &[Attribute], e: &DataEnum) -> TokenStream {
+    let attrs = Attrs::from_struct(
+        Span::call_site(),
+        attrs,
+        Name::Derived(name.clone()),
+        Sp::call_site(DEFAULT_CASING),
+        Sp::call_site(DEFAULT_ENV_CASING),
+    );
+
+    let lits = lits(&e.variants, &attrs);
+    let value_variants = gen_value_variants(&lits);
+    let to_possible_value = gen_to_possible_value(&lits);
+
+    quote! {
+        #[allow(dead_code, unreachable_code, unused_variables, unused_braces)]
+        #[allow(
+            clippy::style,
+            clippy::complexity,
+            clippy::pedantic,
+            clippy::restriction,
+            clippy::perf,
+            clippy::deprecated,
+            clippy::nursery,
+            clippy::cargo,
+            clippy::suspicious_else_formatting,
+        )]
+        #[deny(clippy::correctness)]
+        impl clap::ValueEnum for #name {
+            #value_variants
+            #to_possible_value
+        }
+    }
+}
+
+fn lits(
+    variants: &Punctuated<Variant, Comma>,
+    parent_attribute: &Attrs,
+) -> Vec<(TokenStream, Ident)> {
+    variants
+        .iter()
+        .filter_map(|variant| {
+            let attrs = Attrs::from_value_enum_variant(
+                variant,
+                parent_attribute.casing(),
+                parent_attribute.env_casing(),
+            );
+            if let Kind::Skip(_) = &*attrs.kind() {
+                None
+            } else {
+                if !matches!(variant.fields, Fields::Unit) {
+                    abort!(variant.span(), "`#[derive(ValueEnum)]` only supports non-unit variants, unless they are skipped");
+                }
+                let fields = attrs.field_methods(false);
+                let name = attrs.cased_name();
+                Some((
+                    quote_spanned! { variant.span()=>
+                        clap::PossibleValue::new(#name)
+                        #fields
+                    },
+                    variant.ident.clone(),
+                ))
+            }
+        })
+        .collect::<Vec<_>>()
+}
+
+fn gen_value_variants(lits: &[(TokenStream, Ident)]) -> TokenStream {
+    let lit = lits.iter().map(|l| &l.1).collect::<Vec<_>>();
+
+    quote! {
+        fn value_variants<'a>() -> &'a [Self]{
+            &[#(Self::#lit),*]
+        }
+    }
+}
+
+fn gen_to_possible_value(lits: &[(TokenStream, Ident)]) -> TokenStream {
+    let (lit, variant): (Vec<TokenStream>, Vec<Ident>) = lits.iter().cloned().unzip();
+
+    quote! {
+        fn to_possible_value<'a>(&self) -> ::std::option::Option<clap::PossibleValue<'a>> {
+            match self {
+                #(Self::#variant => Some(#lit),)*
+                _ => None
+            }
+        }
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/dummies.rs b/android/vendor/clap_derive-3.2.6/src/dummies.rs
new file mode 100644
index 0000000..74b7def
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/dummies.rs
@@ -0,0 +1,91 @@
+//! Dummy implementations that we emit along with an error.
+
+use proc_macro2::Ident;
+use proc_macro_error::append_dummy;
+use quote::quote;
+
+pub fn parser_struct(name: &Ident) {
+    into_app(name);
+    args(name);
+    append_dummy(quote!( impl clap::Parser for #name {} ));
+}
+
+pub fn parser_enum(name: &Ident) {
+    into_app(name);
+    subcommand(name);
+    append_dummy(quote!( impl clap::Parser for #name {} ));
+}
+
+pub fn into_app(name: &Ident) {
+    append_dummy(quote! {
+        #[allow(deprecated)]
+        impl clap::CommandFactory for #name {
+            fn into_app<'b>() -> clap::Command<'b> {
+                unimplemented!()
+            }
+            fn into_app_for_update<'b>() -> clap::Command<'b> {
+                unimplemented!()
+            }
+        }
+    });
+}
+
+pub fn from_arg_matches(name: &Ident) {
+    append_dummy(quote! {
+        impl clap::FromArgMatches for #name {
+            fn from_arg_matches(_m: &clap::ArgMatches) -> ::std::result::Result<Self, clap::Error> {
+                unimplemented!()
+            }
+            fn update_from_arg_matches(&mut self, matches: &clap::ArgMatches) -> ::std::result::Result<(), clap::Error>{
+                unimplemented!()
+            }
+        }
+    });
+}
+
+pub fn subcommand(name: &Ident) {
+    from_arg_matches(name);
+    append_dummy(quote! {
+        impl clap::Subcommand for #name {
+            fn augment_subcommands(_cmd: clap::Command<'_>) -> clap::Command<'_> {
+                unimplemented!()
+            }
+            fn augment_subcommands_for_update(_cmd: clap::Command<'_>) -> clap::Command<'_> {
+                unimplemented!()
+            }
+            fn has_subcommand(name: &str) -> bool {
+                unimplemented!()
+            }
+        }
+    });
+}
+
+pub fn args(name: &Ident) {
+    from_arg_matches(name);
+    append_dummy(quote! {
+        impl clap::Args for #name {
+            fn augment_args(_cmd: clap::Command<'_>) -> clap::Command<'_> {
+                unimplemented!()
+            }
+            fn augment_args_for_update(_cmd: clap::Command<'_>) -> clap::Command<'_> {
+                unimplemented!()
+            }
+        }
+    });
+}
+
+pub fn value_enum(name: &Ident) {
+    append_dummy(quote! {
+        impl clap::ValueEnum for #name {
+            fn value_variants<'a>() -> &'a [Self]{
+                unimplemented!()
+            }
+            fn from_str(_input: &str, _ignore_case: bool) -> ::std::result::Result<Self, String> {
+                unimplemented!()
+            }
+            fn to_possible_value<'a>(&self) -> ::std::option::Option<clap::PossibleValue<'a>>{
+                unimplemented!()
+            }
+        }
+    })
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/lib.rs b/android/vendor/clap_derive-3.2.6/src/lib.rs
new file mode 100644
index 0000000..86b7628
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/lib.rs
@@ -0,0 +1,74 @@
+// Copyright 2018 Guillaume Pinot (@TeXitoi) <texitoi@texitoi.eu>,
+// Kevin Knapp (@kbknapp) <kbknapp@gmail.com>, and
+// Ana Hobden (@hoverbear) <operator@hoverbear.org>
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+//
+// This work was derived from Structopt (https://github.com/TeXitoi/structopt)
+// commit#ea76fa1b1b273e65e3b0b1046643715b49bec51f which is licensed under the
+// MIT/Apache 2.0 license.
+
+#![doc(html_logo_url = "https://raw.githubusercontent.com/clap-rs/clap/master/assets/clap.png")]
+#![doc = include_str!("../README.md")]
+#![forbid(unsafe_code)]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+use proc_macro_error::proc_macro_error;
+use syn::{parse_macro_input, DeriveInput};
+
+mod attrs;
+mod derives;
+mod dummies;
+mod parse;
+mod utils;
+
+/// Generates the `ValueEnum` impl.
+#[proc_macro_derive(ValueEnum, attributes(clap))]
+#[proc_macro_error]
+pub fn value_enum(input: TokenStream) -> TokenStream {
+    let input: DeriveInput = parse_macro_input!(input);
+    derives::derive_value_enum(&input).into()
+}
+
+/// Generates the `ValueEnum` impl.
+#[proc_macro_derive(ArgEnum, attributes(clap))]
+#[proc_macro_error]
+pub fn arg_enum(input: TokenStream) -> TokenStream {
+    let input: DeriveInput = parse_macro_input!(input);
+    derives::derive_value_enum(&input).into()
+}
+
+/// Generates the `Parser` implementation.
+///
+/// This is far less verbose than defining the `clap::Command` struct manually,
+/// receiving an instance of `clap::ArgMatches` from conducting parsing, and then
+/// implementing a conversion code to instantiate an instance of the user
+/// context struct.
+#[proc_macro_derive(Parser, attributes(clap, structopt))]
+#[proc_macro_error]
+pub fn parser(input: TokenStream) -> TokenStream {
+    let input: DeriveInput = parse_macro_input!(input);
+    derives::derive_parser(&input).into()
+}
+
+/// Generates the `Subcommand` impl.
+#[proc_macro_derive(Subcommand, attributes(clap))]
+#[proc_macro_error]
+pub fn subcommand(input: TokenStream) -> TokenStream {
+    let input: DeriveInput = parse_macro_input!(input);
+    derives::derive_subcommand(&input).into()
+}
+
+/// Generates the `Args` impl.
+#[proc_macro_derive(Args, attributes(clap))]
+#[proc_macro_error]
+pub fn args(input: TokenStream) -> TokenStream {
+    let input: DeriveInput = parse_macro_input!(input);
+    derives::derive_args(&input).into()
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/parse.rs b/android/vendor/clap_derive-3.2.6/src/parse.rs
new file mode 100644
index 0000000..253736c
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/parse.rs
@@ -0,0 +1,284 @@
+use std::iter::FromIterator;
+
+use proc_macro_error::{abort, ResultExt};
+use quote::ToTokens;
+use syn::{
+    self, parenthesized,
+    parse::{Parse, ParseBuffer, ParseStream},
+    punctuated::Punctuated,
+    Attribute, Expr, ExprLit, Ident, Lit, LitBool, LitStr, Token,
+};
+
+pub fn parse_clap_attributes(all_attrs: &[Attribute]) -> Vec<ClapAttr> {
+    all_attrs
+        .iter()
+        .filter(|attr| attr.path.is_ident("clap") || attr.path.is_ident("structopt"))
+        .flat_map(|attr| {
+            attr.parse_args_with(Punctuated::<ClapAttr, Token![,]>::parse_terminated)
+                .unwrap_or_abort()
+        })
+        .collect()
+}
+
+#[allow(clippy::large_enum_variant)]
+#[derive(Clone)]
+pub enum ClapAttr {
+    // single-identifier attributes
+    Short(Ident),
+    Long(Ident),
+    ValueParser(Ident),
+    Action(Ident),
+    Env(Ident),
+    Flatten(Ident),
+    ValueEnum(Ident),
+    FromGlobal(Ident),
+    Subcommand(Ident),
+    VerbatimDocComment(Ident),
+    ExternalSubcommand(Ident),
+    About(Ident),
+    Author(Ident),
+    Version(Ident),
+
+    // ident = "string literal"
+    RenameAllEnv(Ident, LitStr),
+    RenameAll(Ident, LitStr),
+    NameLitStr(Ident, LitStr),
+
+    // parse(parser_kind [= parser_func])
+    Parse(Ident, ParserSpec),
+
+    // ident [= arbitrary_expr]
+    Skip(Ident, Option<Expr>),
+
+    // ident = arbitrary_expr
+    NameExpr(Ident, Expr),
+    DefaultValueT(Ident, Option<Expr>),
+    DefaultValueOsT(Ident, Option<Expr>),
+    NextDisplayOrder(Ident, Expr),
+    NextHelpHeading(Ident, Expr),
+    HelpHeading(Ident, Expr),
+
+    // ident(arbitrary_expr,*)
+    MethodCall(Ident, Vec<Expr>),
+}
+
+impl Parse for ClapAttr {
+    fn parse(input: ParseStream) -> syn::Result<Self> {
+        use self::ClapAttr::*;
+
+        let name: Ident = input.parse()?;
+        let name_str = name.to_string();
+
+        if input.peek(Token![=]) {
+            // `name = value` attributes.
+            let assign_token = input.parse::<Token![=]>()?; // skip '='
+
+            if input.peek(LitStr) {
+                let lit: LitStr = input.parse()?;
+
+                match &*name_str {
+                    "rename_all" => Ok(RenameAll(name, lit)),
+                    "rename_all_env" => Ok(RenameAllEnv(name, lit)),
+
+                    "skip" => {
+                        let expr = ExprLit {
+                            attrs: vec![],
+                            lit: Lit::Str(lit),
+                        };
+                        let expr = Expr::Lit(expr);
+                        Ok(Skip(name, Some(expr)))
+                    }
+
+                    "next_display_order" => {
+                        let expr = ExprLit {
+                            attrs: vec![],
+                            lit: Lit::Str(lit),
+                        };
+                        let expr = Expr::Lit(expr);
+                        Ok(NextDisplayOrder(name, expr))
+                    }
+
+                    "next_help_heading" => {
+                        let expr = ExprLit {
+                            attrs: vec![],
+                            lit: Lit::Str(lit),
+                        };
+                        let expr = Expr::Lit(expr);
+                        Ok(NextHelpHeading(name, expr))
+                    }
+                    "help_heading" => {
+                        let expr = ExprLit {
+                            attrs: vec![],
+                            lit: Lit::Str(lit),
+                        };
+                        let expr = Expr::Lit(expr);
+                        Ok(HelpHeading(name, expr))
+                    }
+
+                    _ => Ok(NameLitStr(name, lit)),
+                }
+            } else {
+                match input.parse::<Expr>() {
+                    Ok(expr) => match &*name_str {
+                        "skip" => Ok(Skip(name, Some(expr))),
+                        "default_value_t" => Ok(DefaultValueT(name, Some(expr))),
+                        "default_value_os_t" => Ok(DefaultValueOsT(name, Some(expr))),
+                        "next_display_order" => Ok(NextDisplayOrder(name, expr)),
+                        "next_help_heading" => Ok(NextHelpHeading(name, expr)),
+                        "help_heading" => Ok(HelpHeading(name, expr)),
+                        _ => Ok(NameExpr(name, expr)),
+                    },
+
+                    Err(_) => abort! {
+                        assign_token,
+                        "expected `string literal` or `expression` after `=`"
+                    },
+                }
+            }
+        } else if input.peek(syn::token::Paren) {
+            // `name(...)` attributes.
+            let nested;
+            parenthesized!(nested in input);
+
+            match name_str.as_ref() {
+                "parse" => {
+                    let parser_specs: Punctuated<ParserSpec, Token![,]> =
+                        nested.parse_terminated(ParserSpec::parse)?;
+
+                    if parser_specs.len() == 1 {
+                        Ok(Parse(name, parser_specs[0].clone()))
+                    } else {
+                        abort!(name, "parse must have exactly one argument")
+                    }
+                }
+
+                "raw" => match nested.parse::<LitBool>() {
+                    Ok(bool_token) => {
+                        let expr = ExprLit {
+                            attrs: vec![],
+                            lit: Lit::Bool(bool_token),
+                        };
+                        let expr = Expr::Lit(expr);
+                        Ok(MethodCall(name, vec![expr]))
+                    }
+
+                    Err(_) => {
+                        abort!(name,
+                            "`#[clap(raw(...))` attributes are removed, \
+                            they are replaced with raw methods";
+                            help = "if you meant to call `clap::Arg::raw()` method \
+                                you should use bool literal, like `raw(true)` or `raw(false)`";
+                            note = raw_method_suggestion(nested);
+                        );
+                    }
+                },
+
+                _ => {
+                    let method_args: Punctuated<_, Token![,]> =
+                        nested.parse_terminated(Expr::parse)?;
+                    Ok(MethodCall(name, Vec::from_iter(method_args)))
+                }
+            }
+        } else {
+            // Attributes represented with a sole identifier.
+            match name_str.as_ref() {
+                "long" => Ok(Long(name)),
+                "short" => Ok(Short(name)),
+                "value_parser" => Ok(ValueParser(name)),
+                "action" => Ok(Action(name)),
+                "env" => Ok(Env(name)),
+                "flatten" => Ok(Flatten(name)),
+                "arg_enum" => Ok(ValueEnum(name)),
+                "value_enum" => Ok(ValueEnum(name)),
+                "from_global" => Ok(FromGlobal(name)),
+                "subcommand" => Ok(Subcommand(name)),
+                "external_subcommand" => Ok(ExternalSubcommand(name)),
+                "verbatim_doc_comment" => Ok(VerbatimDocComment(name)),
+
+                "default_value" => {
+                    abort!(name,
+                        "`#[clap(default_value)` attribute (without a value) has been replaced by `#[clap(default_value_t)]`.";
+                        help = "Change the attribute to `#[clap(default_value_t)]`";
+                    )
+                }
+                "default_value_t" => Ok(DefaultValueT(name, None)),
+                "default_value_os_t" => Ok(DefaultValueOsT(name, None)),
+                "about" => (Ok(About(name))),
+                "author" => (Ok(Author(name))),
+                "version" => Ok(Version(name)),
+
+                "skip" => Ok(Skip(name, None)),
+
+                _ => abort!(name, "unexpected attribute: {}", name_str),
+            }
+        }
+    }
+}
+
+#[derive(Clone)]
+pub struct ParserSpec {
+    pub kind: Ident,
+    pub eq_token: Option<Token![=]>,
+    pub parse_func: Option<Expr>,
+}
+
+impl Parse for ParserSpec {
+    fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
+        let kind = input
+            .parse()
+            .map_err(|_| input.error("parser specification must start with identifier"))?;
+        let eq_token = input.parse()?;
+        let parse_func = match eq_token {
+            None => None,
+            Some(_) => Some(input.parse()?),
+        };
+        Ok(ParserSpec {
+            kind,
+            eq_token,
+            parse_func,
+        })
+    }
+}
+
+fn raw_method_suggestion(ts: ParseBuffer) -> String {
+    let do_parse = move || -> Result<(Ident, Punctuated<Expr, Token![,]>), syn::Error> {
+        let name = ts.parse()?;
+        let _eq: Token![=] = ts.parse()?;
+        let val: LitStr = ts.parse()?;
+        let exprs = val.parse_with(Punctuated::<Expr, Token![,]>::parse_terminated)?;
+        Ok((name, exprs))
+    };
+
+    fn to_string<T: ToTokens>(val: &T) -> String {
+        val.to_token_stream()
+            .to_string()
+            .replace(' ', "")
+            .replace(',', ", ")
+    }
+
+    if let Ok((name, exprs)) = do_parse() {
+        let suggestion = if exprs.len() == 1 {
+            let val = to_string(&exprs[0]);
+            format!(" = {}", val)
+        } else {
+            let val = exprs
+                .into_iter()
+                .map(|expr| to_string(&expr))
+                .collect::<Vec<_>>()
+                .join(", ");
+
+            format!("({})", val)
+        };
+
+        format!(
+            "if you need to call `clap::Arg/Command::{}` method you \
+             can do it like this: #[clap({}{})]",
+            name, name, suggestion
+        )
+    } else {
+        "if you need to call some method from `clap::Arg/Command` \
+         you should use raw method, see \
+         https://github.com/clap-rs/clap/blob/master/examples/derive_ref/README.md#raw-attributes"
+            .into()
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/utils/doc_comments.rs b/android/vendor/clap_derive-3.2.6/src/utils/doc_comments.rs
new file mode 100644
index 0000000..f0a5034
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/utils/doc_comments.rs
@@ -0,0 +1,107 @@
+//! The preprocessing we apply to doc comments.
+//!
+//! #[derive(Parser)] works in terms of "paragraphs". Paragraph is a sequence of
+//! non-empty adjacent lines, delimited by sequences of blank (whitespace only) lines.
+
+use crate::attrs::Method;
+
+use quote::{format_ident, quote};
+use std::iter;
+
+pub fn process_doc_comment(lines: Vec<String>, name: &str, preprocess: bool) -> Vec<Method> {
+    // multiline comments (`/** ... */`) may have LFs (`\n`) in them,
+    // we need to split so we could handle the lines correctly
+    //
+    // we also need to remove leading and trailing blank lines
+    let mut lines: Vec<&str> = lines
+        .iter()
+        .skip_while(|s| is_blank(s))
+        .flat_map(|s| s.split('\n'))
+        .collect();
+
+    while let Some(true) = lines.last().map(|s| is_blank(s)) {
+        lines.pop();
+    }
+
+    // remove one leading space no matter what
+    for line in lines.iter_mut() {
+        if line.starts_with(' ') {
+            *line = &line[1..];
+        }
+    }
+
+    if lines.is_empty() {
+        return vec![];
+    }
+
+    let short_name = format_ident!("{}", name);
+    let long_name = format_ident!("long_{}", name);
+
+    if let Some(first_blank) = lines.iter().position(|s| is_blank(s)) {
+        let (short, long) = if preprocess {
+            let paragraphs = split_paragraphs(&lines);
+            let short = paragraphs[0].clone();
+            let long = paragraphs.join("\n\n");
+            (remove_period(short), long)
+        } else {
+            let short = lines[..first_blank].join("\n");
+            let long = lines.join("\n");
+            (short, long)
+        };
+
+        vec![
+            Method::new(short_name, quote!(#short)),
+            Method::new(long_name, quote!(#long)),
+        ]
+    } else {
+        let short = if preprocess {
+            let s = merge_lines(&lines);
+            remove_period(s)
+        } else {
+            lines.join("\n")
+        };
+
+        vec![
+            Method::new(short_name, quote!(#short)),
+            Method::new(long_name, quote!(None)),
+        ]
+    }
+}
+
+fn split_paragraphs(lines: &[&str]) -> Vec<String> {
+    let mut last_line = 0;
+    iter::from_fn(|| {
+        let slice = &lines[last_line..];
+        let start = slice.iter().position(|s| !is_blank(s)).unwrap_or(0);
+
+        let slice = &slice[start..];
+        let len = slice
+            .iter()
+            .position(|s| is_blank(s))
+            .unwrap_or(slice.len());
+
+        last_line += start + len;
+
+        if len != 0 {
+            Some(merge_lines(&slice[..len]))
+        } else {
+            None
+        }
+    })
+    .collect()
+}
+
+fn remove_period(mut s: String) -> String {
+    if s.ends_with('.') && !s.ends_with("..") {
+        s.pop();
+    }
+    s
+}
+
+fn is_blank(s: &str) -> bool {
+    s.trim().is_empty()
+}
+
+fn merge_lines(lines: &[&str]) -> String {
+    lines.iter().map(|s| s.trim()).collect::<Vec<_>>().join(" ")
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/utils/mod.rs b/android/vendor/clap_derive-3.2.6/src/utils/mod.rs
new file mode 100644
index 0000000..77a467c
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/utils/mod.rs
@@ -0,0 +1,9 @@
+mod doc_comments;
+mod spanned;
+mod ty;
+
+pub use self::{
+    doc_comments::process_doc_comment,
+    spanned::Sp,
+    ty::{inner_type, is_simple_ty, sub_type, subty_if_name, Ty},
+};
diff --git a/android/vendor/clap_derive-3.2.6/src/utils/spanned.rs b/android/vendor/clap_derive-3.2.6/src/utils/spanned.rs
new file mode 100644
index 0000000..11415f6
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/utils/spanned.rs
@@ -0,0 +1,92 @@
+use proc_macro2::{Ident, Span, TokenStream};
+use quote::ToTokens;
+use syn::LitStr;
+
+use std::ops::{Deref, DerefMut};
+
+/// An entity with a span attached.
+#[derive(Debug, Clone)]
+pub struct Sp<T> {
+    val: T,
+    span: Span,
+}
+
+impl<T> Sp<T> {
+    pub fn new(val: T, span: Span) -> Self {
+        Sp { val, span }
+    }
+
+    pub fn call_site(val: T) -> Self {
+        Sp {
+            val,
+            span: Span::call_site(),
+        }
+    }
+
+    pub fn span(&self) -> Span {
+        self.span
+    }
+}
+
+impl<T> Deref for Sp<T> {
+    type Target = T;
+
+    fn deref(&self) -> &T {
+        &self.val
+    }
+}
+
+impl<T> DerefMut for Sp<T> {
+    fn deref_mut(&mut self) -> &mut T {
+        &mut self.val
+    }
+}
+
+impl From<Ident> for Sp<String> {
+    fn from(ident: Ident) -> Self {
+        Sp {
+            val: ident.to_string(),
+            span: ident.span(),
+        }
+    }
+}
+
+impl From<LitStr> for Sp<String> {
+    fn from(lit: LitStr) -> Self {
+        Sp {
+            val: lit.value(),
+            span: lit.span(),
+        }
+    }
+}
+
+impl<'a> From<Sp<&'a str>> for Sp<String> {
+    fn from(sp: Sp<&'a str>) -> Self {
+        Sp::new(sp.val.into(), sp.span)
+    }
+}
+
+impl<U, T: PartialEq<U>> PartialEq<U> for Sp<T> {
+    fn eq(&self, other: &U) -> bool {
+        self.val == *other
+    }
+}
+
+impl<T: AsRef<str>> AsRef<str> for Sp<T> {
+    fn as_ref(&self) -> &str {
+        self.val.as_ref()
+    }
+}
+
+impl<T: ToTokens> ToTokens for Sp<T> {
+    fn to_tokens(&self, stream: &mut TokenStream) {
+        // this is the simplest way out of correct ones to change span on
+        // arbitrary token tree I could come up with
+        let tt = self.val.to_token_stream().into_iter().map(|mut tt| {
+            tt.set_span(self.span);
+            tt
+        });
+
+        stream.extend(tt);
+    }
+}
diff --git a/android/vendor/clap_derive-3.2.6/src/utils/ty.rs b/android/vendor/clap_derive-3.2.6/src/utils/ty.rs
new file mode 100644
index 0000000..0bcb59f
--- /dev/null
+++ b/android/vendor/clap_derive-3.2.6/src/utils/ty.rs
@@ -0,0 +1,119 @@
+//! Special types handling
+
+use super::spanned::Sp;
+
+use syn::{
+    spanned::Spanned, GenericArgument, Path, PathArguments, PathArguments::AngleBracketed,
+    PathSegment, Type, TypePath,
+};
+
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub enum Ty {
+    Vec,
+    Option,
+    OptionOption,
+    OptionVec,
+    Other,
+}
+
+impl Ty {
+    pub fn from_syn_ty(ty: &syn::Type) -> Sp<Self> {
+        use self::Ty::*;
+        let t = |kind| Sp::new(kind, ty.span());
+
+        if is_generic_ty(ty, "Vec") {
+            t(Vec)
+        } else if let Some(subty) = subty_if_name(ty, "Option") {
+            if is_generic_ty(subty, "Option") {
+                t(OptionOption)
+            } else if is_generic_ty(subty, "Vec") {
+                t(OptionVec)
+            } else {
+                t(Option)
+            }
+        } else {
+            t(Other)
+        }
+    }
+}
+
+pub fn inner_type(field_ty: &syn::Type) -> &syn::Type {
+    let ty = Ty::from_syn_ty(field_ty);
+    match *ty {
+        Ty::Vec | Ty::Option => sub_type(field_ty).unwrap_or(field_ty),
+        Ty::OptionOption | Ty::OptionVec => {
+            sub_type(field_ty).and_then(sub_type).unwrap_or(field_ty)
+        }
+        _ => field_ty,
+    }
+}
+
+pub fn sub_type(ty: &syn::Type) -> Option<&syn::Type> {
+    subty_if(ty, |_| true)
+}
+
+fn only_last_segment(mut ty: &syn::Type) -> Option<&PathSegment> {
+    while let syn::Type::Group(syn::TypeGroup { elem, .. }) = ty {
+        ty = elem;
+    }
+    match ty {
+        Type::Path(TypePath {
+            qself: None,
+            path:
+                Path {
+                    leading_colon: None,
+                    segments,
+                },
+        }) => only_one(segments.iter()),
+
+        _ => None,
+    }
+}
+
+fn subty_if<F>(ty: &syn::Type, f: F) -> Option<&syn::Type>
+where
+    F: FnOnce(&PathSegment) -> bool,
+{
+    only_last_segment(ty)
+        .filter(|segment| f(segment))
+        .and_then(|segment| {
+            if let AngleBracketed(args) = &segment.arguments {
+                only_one(args.args.iter()).and_then(|genneric| {
+                    if let GenericArgument::Type(ty) = genneric {
+                        Some(ty)
+                    } else {
+                        None
+                    }
+                })
+            } else {
+                None
+            }
+        })
+}
+
+pub fn subty_if_name<'a>(ty: &'a syn::Type, name: &str) -> Option<&'a syn::Type> {
+    subty_if(ty, |seg| seg.ident == name)
+}
+
+pub fn is_simple_ty(ty: &syn::Type, name: &str) -> bool {
+    only_last_segment(ty)
+        .map(|segment| {
+            if let PathArguments::None = segment.arguments {
+                segment.ident == name
+            } else {
+                false
+            }
+        })
+        .unwrap_or(false)
+}
+
+fn is_generic_ty(ty: &syn::Type, name: &str) -> bool {
+    subty_if_name(ty, name).is_some()
+}
+
+fn only_one<I, T>(mut iter: I) -> Option<T>
+where
+    I: Iterator<Item = T>,
+{
+    iter.next().filter(|_| iter.next().is_none())
+}
diff --git a/android/vendor/console-0.15.0/.cargo-checksum.json b/android/vendor/console-0.15.0/.cargo-checksum.json
new file mode 100644
index 0000000..eb8414f
--- /dev/null
+++ b/android/vendor/console-0.15.0/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"2ef889ab1ed43c7b7fee3bcf968f2e194127e8bb777a97ca1f1486e4657dc719","Cargo.lock":"717062ea564fbae871ae1abae18c10bc203aafb64a8e9e57ae922dd9b346ba12","Cargo.toml":"2e822855bbf98e831cf3af4e8ee0de0e95ccf36ab89c2f715e8fe4e1fe3cad41","LICENSE":"2022c11b24fc1e50fa06a5959e40198a3464f560729ad3d00139abb8a328362d","README.md":"c284737aacf50e2d57080f73379747dfdc6f5f0a36774cfd0b6cfb746b64171e","examples/colors.rs":"395c5f8c4950830f3f960ed9b5522e93d5fdbda1d9c3d16c77144f4d87b503c7","examples/colors256.rs":"6da18eac72af296c8f2a9d152681ce03abd044a2be7297e98b5764bd1e5911e5","examples/cursor_at.rs":"9e21cedb6d0211fab831c71131bbf5e54e6df8e50129c36faee8957a45c33e1f","examples/term.rs":"10739f800cf0548bb8639d809c1f32b886f27ae4ba716d5db642fb6f37f580c4","src/ansi.rs":"1307d47d66583fe64025aebea836d02d4cc7422fa2482ee4b881adf7c8f2f06c","src/common_term.rs":"c924164ac0731148f3c696af0a9af5759465c959631d12fb90462a515e8c186c","src/kb.rs":"2bdb0c50ccb35efc2866e2e31e4e9308732b043b22800dfb26ac560b8fc189b8","src/lib.rs":"42d1567cf713e781ef92ceb843d08f7d4530085d41cb9a9ba127ba2fa7416de4","src/term.rs":"46973bcc66752d33a41f8b39e995120e65d0babd2dcb0d2c3944b649ffeaedba","src/unix_term.rs":"236472b7fe2928f7dd07ad5688ccda285cdf5440ad7fd40f8b9d940396eb0846","src/utils.rs":"4d8cec265b07672fdc58a99f27a20b7f5f89555720cbb4e466eb52e82b1c128c","src/wasm_term.rs":"0a94bbe12f6cfa7af14a9a2538abe3988b419aed5151207e05f27901ec85d29d","src/windows_term.rs":"f9d82bb2fd8952b18034d69ca686c219bda9e2501abdc50ed46fdb99514dd41b"},"package":"a28b32d32ca44b70c3e4acd7db1babf555fa026e385fb95f18028f88848b3c31"}
\ No newline at end of file
diff --git a/android/vendor/console-0.15.0/CHANGELOG.md b/android/vendor/console-0.15.0/CHANGELOG.md
new file mode 100644
index 0000000..105a9ea
--- /dev/null
+++ b/android/vendor/console-0.15.0/CHANGELOG.md
@@ -0,0 +1,55 @@
+# Changelog
+
+## Unreleased
+
+## 0.15.0
+
+### Enhancements
+
+* Addeed more key recognitions
+* Exposed `pad_str_with` to public API
+* Added `ReadWritePair`
+* Support `color256` in `Style::from_dotted_str`
+
+### BREAKING
+
+* Added `ReadWritePair` to `TermTarget` to allow arbitrary read write pairs behave as a term
+* Removed `Copy` and `PartialEq` from `TermTarget`
+
+## 0.14.1
+
+### Enhancements
+
+* Added `NO_COLOR` support
+* Added some more key recognitions
+* Undeprecate `Term::is_term`
+
+## 0.14.0
+
+### Enhancements
+
+* Added emoji support for newer Windows terminals.
+
+### BREAKING
+
+* Made the windows terminal emulation a non default feature (`windows-console-colors`)
+
+## 0.13.0
+
+### Enhancements
+
+* Added `user_attended_stderr` for checking if stderr is a terminal
+* Removed `termios` dependency
+
+### Bug Fixes
+
+* Better handling of key recognition on unix
+* `Term::terminal_size()` on stderr terms correctly returns stderr term info
+
+### Deprecated
+
+* Deprecate `Term::is_term()` in favor of `Term::features().is_attended()`
+
+### BREAKING
+
+* Remove `Term::want_emoji()` in favor of `Term::features().wants_emoji()`
diff --git a/android/vendor/console-0.15.0/Cargo.lock b/android/vendor/console-0.15.0/Cargo.lock
new file mode 100644
index 0000000..7d1e3ff
--- /dev/null
+++ b/android/vendor/console-0.15.0/Cargo.lock
@@ -0,0 +1,97 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "console"
+version = "0.15.0"
+dependencies = [
+ "encode_unicode",
+ "libc",
+ "once_cell",
+ "regex",
+ "terminal_size",
+ "unicode-width",
+ "winapi",
+ "winapi-util",
+]
+
+[[package]]
+name = "encode_unicode"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
+
+[[package]]
+name = "libc"
+version = "0.2.69"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
+
+[[package]]
+name = "once_cell"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
+
+[[package]]
+name = "regex"
+version = "1.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
+dependencies = [
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.6.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
+
+[[package]]
+name = "terminal_size"
+version = "0.1.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bd2d183bd3fac5f5fe38ddbeb4dc9aec4a39a9d7d59e7491d900302da01cbe1"
+dependencies = [
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "unicode-width"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
+
+[[package]]
+name = "winapi"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-util"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/android/vendor/console-0.15.0/Cargo.toml b/android/vendor/console-0.15.0/Cargo.toml
new file mode 100644
index 0000000..0f81d4f
--- /dev/null
+++ b/android/vendor/console-0.15.0/Cargo.toml
@@ -0,0 +1,56 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "console"
+version = "0.15.0"
+authors = ["Armin Ronacher <armin.ronacher@active-4.com>"]
+description = "A terminal and console abstraction for Rust"
+homepage = "https://github.com/mitsuhiko/console"
+documentation = "https://docs.rs/console"
+readme = "README.md"
+keywords = ["cli", "terminal", "colors", "console", "ansi"]
+license = "MIT"
+repository = "https://github.com/mitsuhiko/console"
+[dependencies.libc]
+version = "0.2"
+
+[dependencies.once_cell]
+version = "1"
+
+[dependencies.regex]
+version = "1.4.2"
+features = ["std"]
+optional = true
+default-features = false
+
+[dependencies.terminal_size]
+version = "0.1.14"
+
+[dependencies.unicode-width]
+version = "0.1"
+optional = true
+
+[features]
+ansi-parsing = ["regex"]
+default = ["unicode-width", "ansi-parsing"]
+windows-console-colors = ["ansi-parsing", "winapi-util"]
+[target."cfg(windows)".dependencies.encode_unicode]
+version = "0.3"
+
+[target."cfg(windows)".dependencies.winapi]
+version = "0.3"
+features = ["winbase", "winuser", "consoleapi", "processenv", "wincon"]
+
+[target."cfg(windows)".dependencies.winapi-util]
+version = "0.1.3"
+optional = true
diff --git a/android/vendor/console-0.15.0/LICENSE b/android/vendor/console-0.15.0/LICENSE
new file mode 100644
index 0000000..dc9a85c
--- /dev/null
+++ b/android/vendor/console-0.15.0/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2017 Armin Ronacher <armin.ronacher@active-4.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/android/vendor/console-0.15.0/README.md b/android/vendor/console-0.15.0/README.md
new file mode 100644
index 0000000..abbd4d3
--- /dev/null
+++ b/android/vendor/console-0.15.0/README.md
@@ -0,0 +1,70 @@
+# `console`
+
+**console** is a library for Rust that provides access to various terminal
+features so you can build nicer looking command line interfaces.  It
+comes with various tools and utilities for working with Terminals and
+formatting text.
+
+Best paired with other libraries in the family:
+
+* [dialoguer](https://docs.rs/dialoguer)
+* [indicatif](https://docs.rs/indicatif)
+
+## Terminal Access
+
+The terminal is abstracted through the `console::Term` type.  It can
+either directly provide access to the connected terminal or by buffering
+up commands.  A buffered terminal will however not be completely buffered
+on windows where cursor movements are currently directly passed through.
+
+Example usage:
+
+```rust
+use std::thread;
+use std::time::Duration;
+
+use console::Term;
+
+let term = Term::stdout();
+term.write_line("Hello World!")?;
+thread::sleep(Duration::from_millis(2000));
+term.clear_line()?;
+```
+
+## Colors and Styles
+
+`console` uses `clicolors-control` to control colors.  It also
+provides higher level wrappers for styling text and other things
+that can be displayed with the `style` function and utility types.
+
+Example usage:
+
+```rust
+use console::style;
+
+println!("This is {} neat", style("quite").cyan());
+```
+
+You can also store styles and apply them to text later:
+
+```rust
+use console::Style;
+
+let cyan = Style::new().cyan();
+println!("This is {} neat", cyan.apply_to("quite"));
+```
+
+## Working with ANSI Codes
+
+The crate provids the function `strip_ansi_codes` to remove ANSI codes
+from a string as well as `measure_text_width` to calculate the width of a
+string as it would be displayed by the terminal.  Both of those together
+are useful for more complex formatting.
+
+## Unicode Width Support
+
+By default this crate depends on the `unicode-width` crate to calculate
+the width of terminal characters.  If you do not need this you can disable
+the `unicode-width` feature which will cut down on dependencies.
+
+License: MIT
diff --git a/android/vendor/console-0.15.0/examples/colors.rs b/android/vendor/console-0.15.0/examples/colors.rs
new file mode 100644
index 0000000..69c51fd
--- /dev/null
+++ b/android/vendor/console-0.15.0/examples/colors.rs
@@ -0,0 +1,14 @@
+use console::style;
+
+fn main() {
+    println!(
+        "This is red on black: {:010x}",
+        style(42).red().on_black().bold()
+    );
+    println!("This is reversed: [{}]", style("whatever").reverse());
+    println!("This is cyan: {}", style("whatever").cyan());
+    eprintln!(
+        "This is black bright: {}",
+        style("whatever").for_stderr().bright().black()
+    );
+}
diff --git a/android/vendor/console-0.15.0/examples/colors256.rs b/android/vendor/console-0.15.0/examples/colors256.rs
new file mode 100644
index 0000000..274b312
--- /dev/null
+++ b/android/vendor/console-0.15.0/examples/colors256.rs
@@ -0,0 +1,17 @@
+use console::style;
+
+fn main() {
+    for i in 0..=255 {
+        print!("{:03} ", style(i).color256(i));
+        if i % 16 == 15 {
+            println!("");
+        }
+    }
+
+    for i in 0..=255 {
+        print!("{:03} ", style(i).black().on_color256(i));
+        if i % 16 == 15 {
+            println!("");
+        }
+    }
+}
diff --git a/android/vendor/console-0.15.0/examples/cursor_at.rs b/android/vendor/console-0.15.0/examples/cursor_at.rs
new file mode 100644
index 0000000..9a1bb3d
--- /dev/null
+++ b/android/vendor/console-0.15.0/examples/cursor_at.rs
@@ -0,0 +1,30 @@
+extern crate console;
+
+use std::io;
+use std::thread;
+use std::time::Duration;
+
+use console::{style, Term};
+
+fn write_chars() -> io::Result<()> {
+    let term = Term::stdout();
+    let (heigth, width) = term.size();
+    for x in 0..width {
+        for y in 0..heigth {
+            term.move_cursor_to(x as usize, y as usize)?;
+            let text = if (x + y) % 2 == 0 {
+                format!("{}", style(x % 10).black().on_red())
+            } else {
+                format!("{}", style(x % 10).red().on_black())
+            };
+
+            term.write_str(&text)?;
+            thread::sleep(Duration::from_micros(600));
+        }
+    }
+    Ok(())
+}
+
+fn main() {
+    write_chars().unwrap();
+}
diff --git a/android/vendor/console-0.15.0/examples/term.rs b/android/vendor/console-0.15.0/examples/term.rs
new file mode 100644
index 0000000..a0637f7
--- /dev/null
+++ b/android/vendor/console-0.15.0/examples/term.rs
@@ -0,0 +1,33 @@
+use std::io::{self, Write};
+use std::thread;
+use std::time::Duration;
+
+use console::{style, Term};
+
+fn do_stuff() -> io::Result<()> {
+    let term = Term::stdout();
+    term.set_title("Counting...");
+    term.write_line("Going to do some counting now")?;
+    term.hide_cursor()?;
+    for x in 0..10 {
+        if x != 0 {
+            term.move_cursor_up(1)?;
+        }
+        term.write_line(&format!("Counting {}/10", style(x + 1).cyan()))?;
+        thread::sleep(Duration::from_millis(400));
+    }
+    term.show_cursor()?;
+    term.clear_last_lines(1)?;
+    term.write_line("Done counting!")?;
+    writeln!(&term, "Hello World!")?;
+
+    write!(&term, "To edit: ")?;
+    let res = term.read_line_initial_text("default")?;
+    writeln!(&term, "\n{}", res)?;
+
+    Ok(())
+}
+
+fn main() {
+    do_stuff().unwrap();
+}
diff --git a/android/vendor/console-0.15.0/src/ansi.rs b/android/vendor/console-0.15.0/src/ansi.rs
new file mode 100644
index 0000000..cde1691
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/ansi.rs
@@ -0,0 +1,135 @@
+use std::borrow::Cow;
+
+use once_cell::sync::Lazy;
+use regex::{Matches, Regex};
+
+static STRIP_ANSI_RE: Lazy<Regex> = Lazy::new(|| {
+    Regex::new(
+        r"[\x1b\x9b]([()][012AB]|[\[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><])",
+    )
+    .unwrap()
+});
+
+/// Helper function to strip ansi codes.
+pub fn strip_ansi_codes(s: &str) -> Cow<str> {
+    STRIP_ANSI_RE.replace_all(s, "")
+}
+
+/// An iterator over ansi codes in a string.
+///
+/// This type can be used to scan over ansi codes in a string.
+/// It yields tuples in the form `(s, is_ansi)` where `s` is a slice of
+/// the original string and `is_ansi` indicates if the slice contains
+/// ansi codes or string values.
+pub struct AnsiCodeIterator<'a> {
+    s: &'a str,
+    pending_item: Option<(&'a str, bool)>,
+    last_idx: usize,
+    cur_idx: usize,
+    iter: Matches<'static, 'a>,
+}
+
+impl<'a> AnsiCodeIterator<'a> {
+    /// Creates a new ansi code iterator.
+    pub fn new(s: &'a str) -> AnsiCodeIterator<'a> {
+        AnsiCodeIterator {
+            s,
+            pending_item: None,
+            last_idx: 0,
+            cur_idx: 0,
+            iter: STRIP_ANSI_RE.find_iter(s),
+        }
+    }
+
+    /// Returns the string slice up to the current match.
+    pub fn current_slice(&self) -> &str {
+        &self.s[..self.cur_idx]
+    }
+
+    /// Returns the string slice from the current match to the end.
+    pub fn rest_slice(&self) -> &str {
+        &self.s[self.cur_idx..]
+    }
+}
+
+impl<'a> Iterator for AnsiCodeIterator<'a> {
+    type Item = (&'a str, bool);
+
+    fn next(&mut self) -> Option<(&'a str, bool)> {
+        if let Some(pending_item) = self.pending_item.take() {
+            self.cur_idx += pending_item.0.len();
+            Some(pending_item)
+        } else if let Some(m) = self.iter.next() {
+            let s = &self.s[self.last_idx..m.start()];
+            self.last_idx = m.end();
+            if s.is_empty() {
+                self.cur_idx = m.end();
+                Some((m.as_str(), true))
+            } else {
+                self.cur_idx = m.start();
+                self.pending_item = Some((m.as_str(), true));
+                Some((s, false))
+            }
+        } else if self.last_idx < self.s.len() {
+            let rv = &self.s[self.last_idx..];
+            self.cur_idx = self.s.len();
+            self.last_idx = self.s.len();
+            Some((rv, false))
+        } else {
+            None
+        }
+    }
+}
+
+#[test]
+fn test_ansi_iter_re_vt100() {
+    let s = "\x1b(0lpq\x1b)Benglish";
+    let mut iter = AnsiCodeIterator::new(s);
+    assert_eq!(iter.next(), Some(("\x1b(0", true)));
+    assert_eq!(iter.next(), Some(("lpq", false)));
+    assert_eq!(iter.next(), Some(("\x1b)B", true)));
+    assert_eq!(iter.next(), Some(("english", false)));
+}
+
+#[test]
+fn test_ansi_iter_re() {
+    use crate::style;
+    let s = format!("Hello {}!", style("World").red().force_styling(true));
+    let mut iter = AnsiCodeIterator::new(&s);
+    assert_eq!(iter.next(), Some(("Hello ", false)));
+    assert_eq!(iter.current_slice(), "Hello ");
+    assert_eq!(iter.rest_slice(), "\x1b[31mWorld\x1b[0m!");
+    assert_eq!(iter.next(), Some(("\x1b[31m", true)));
+    assert_eq!(iter.current_slice(), "Hello \x1b[31m");
+    assert_eq!(iter.rest_slice(), "World\x1b[0m!");
+    assert_eq!(iter.next(), Some(("World", false)));
+    assert_eq!(iter.current_slice(), "Hello \x1b[31mWorld");
+    assert_eq!(iter.rest_slice(), "\x1b[0m!");
+    assert_eq!(iter.next(), Some(("\x1b[0m", true)));
+    assert_eq!(iter.current_slice(), "Hello \x1b[31mWorld\x1b[0m");
+    assert_eq!(iter.rest_slice(), "!");
+    assert_eq!(iter.next(), Some(("!", false)));
+    assert_eq!(iter.current_slice(), "Hello \x1b[31mWorld\x1b[0m!");
+    assert_eq!(iter.rest_slice(), "");
+    assert_eq!(iter.next(), None);
+}
+
+#[test]
+fn test_ansi_iter_re_on_multi() {
+    use crate::style;
+    let s = format!("{}", style("a").red().bold().force_styling(true));
+    let mut iter = AnsiCodeIterator::new(&s);
+    assert_eq!(iter.next(), Some(("\x1b[31m", true)));
+    assert_eq!(iter.current_slice(), "\x1b[31m");
+    assert_eq!(iter.rest_slice(), "\x1b[1ma\x1b[0m");
+    assert_eq!(iter.next(), Some(("\x1b[1m", true)));
+    assert_eq!(iter.current_slice(), "\x1b[31m\x1b[1m");
+    assert_eq!(iter.rest_slice(), "a\x1b[0m");
+    assert_eq!(iter.next(), Some(("a", false)));
+    assert_eq!(iter.current_slice(), "\x1b[31m\x1b[1ma");
+    assert_eq!(iter.rest_slice(), "\x1b[0m");
+    assert_eq!(iter.next(), Some(("\x1b[0m", true)));
+    assert_eq!(iter.current_slice(), "\x1b[31m\x1b[1ma\x1b[0m");
+    assert_eq!(iter.rest_slice(), "");
+    assert_eq!(iter.next(), None);
+}
diff --git a/android/vendor/console-0.15.0/src/common_term.rs b/android/vendor/console-0.15.0/src/common_term.rs
new file mode 100644
index 0000000..020660a
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/common_term.rs
@@ -0,0 +1,72 @@
+use std::io;
+
+use crate::term::Term;
+
+pub fn move_cursor_down(out: &Term, n: usize) -> io::Result<()> {
+    if n > 0 {
+        out.write_str(&format!("\x1b[{}B", n))
+    } else {
+        Ok(())
+    }
+}
+
+pub fn move_cursor_up(out: &Term, n: usize) -> io::Result<()> {
+    if n > 0 {
+        out.write_str(&format!("\x1b[{}A", n))
+    } else {
+        Ok(())
+    }
+}
+pub fn move_cursor_left(out: &Term, n: usize) -> io::Result<()> {
+    if n > 0 {
+        out.write_str(&format!("\x1b[{}D", n))
+    } else {
+        Ok(())
+    }
+}
+
+pub fn move_cursor_right(out: &Term, n: usize) -> io::Result<()> {
+    if n > 0 {
+        out.write_str(&format!("\x1b[{}C", n))
+    } else {
+        Ok(())
+    }
+}
+
+#[inline]
+pub fn move_cursor_to(out: &Term, x: usize, y: usize) -> io::Result<()> {
+    out.write_str(&format!("\x1B[{};{}H", y + 1, x + 1))
+}
+
+pub fn clear_chars(out: &Term, n: usize) -> io::Result<()> {
+    if n > 0 {
+        out.write_str(&format!("\x1b[{}D\x1b[0K", n))
+    } else {
+        Ok(())
+    }
+}
+
+#[inline]
+pub fn clear_line(out: &Term) -> io::Result<()> {
+    out.write_str("\r\x1b[2K")
+}
+
+#[inline]
+pub fn clear_screen(out: &Term) -> io::Result<()> {
+    out.write_str("\r\x1b[2J\r\x1b[H")
+}
+
+#[inline]
+pub fn clear_to_end_of_screen(out: &Term) -> io::Result<()> {
+    out.write_str("\r\x1b[0J")
+}
+
+#[inline]
+pub fn show_cursor(out: &Term) -> io::Result<()> {
+    out.write_str("\x1b[?25h")
+}
+
+#[inline]
+pub fn hide_cursor(out: &Term) -> io::Result<()> {
+    out.write_str("\x1b[?25l")
+}
diff --git a/android/vendor/console-0.15.0/src/kb.rs b/android/vendor/console-0.15.0/src/kb.rs
new file mode 100644
index 0000000..d3ab830
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/kb.rs
@@ -0,0 +1,29 @@
+/// Key mapping
+///
+/// This is an incomplete mapping of keys that are supported for reading
+/// from the keyboard.
+#[non_exhaustive]
+#[derive(Clone, PartialEq, Eq, Debug)]
+pub enum Key {
+    Unknown,
+    /// Unrecognized sequence containing Esc and a list of chars
+    UnknownEscSeq(Vec<char>),
+    ArrowLeft,
+    ArrowRight,
+    ArrowUp,
+    ArrowDown,
+    Enter,
+    Escape,
+    Backspace,
+    Home,
+    End,
+    Tab,
+    BackTab,
+    Alt,
+    Del,
+    Shift,
+    Insert,
+    PageUp,
+    PageDown,
+    Char(char),
+}
diff --git a/android/vendor/console-0.15.0/src/lib.rs b/android/vendor/console-0.15.0/src/lib.rs
new file mode 100644
index 0000000..63c3112
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/lib.rs
@@ -0,0 +1,104 @@
+//! console is a library for Rust that provides access to various terminal
+//! features so you can build nicer looking command line interfaces.  It
+//! comes with various tools and utilities for working with Terminals and
+//! formatting text.
+//!
+//! Best paired with other libraries in the family:
+//!
+//! * [dialoguer](https://docs.rs/dialoguer)
+//! * [indicatif](https://docs.rs/indicatif)
+//!
+//! # Terminal Access
+//!
+//! The terminal is abstracted through the `console::Term` type.  It can
+//! either directly provide access to the connected terminal or by buffering
+//! up commands.  A buffered terminal will however not be completely buffered
+//! on windows where cursor movements are currently directly passed through.
+//!
+//! Example usage:
+//!
+//! ```
+//! # fn test() -> Result<(), Box<dyn std::error::Error>> {
+//! use std::thread;
+//! use std::time::Duration;
+//!
+//! use console::Term;
+//!
+//! let term = Term::stdout();
+//! term.write_line("Hello World!")?;
+//! thread::sleep(Duration::from_millis(2000));
+//! term.clear_line()?;
+//! # Ok(()) } test().unwrap();
+//! ```
+//!
+//! # Colors and Styles
+//!
+//! `console` uses `clicolors-control` to control colors.  It also
+//! provides higher level wrappers for styling text and other things
+//! that can be displayed with the `style` function and utility types.
+//!
+//! Example usage:
+//!
+//! ```
+//! use console::style;
+//!
+//! println!("This is {} neat", style("quite").cyan());
+//! ```
+//!
+//! You can also store styles and apply them to text later:
+//!
+//! ```
+//! use console::Style;
+//!
+//! let cyan = Style::new().cyan();
+//! println!("This is {} neat", cyan.apply_to("quite"));
+//! ```
+//!
+//! # Working with ANSI Codes
+//!
+//! The crate provids the function `strip_ansi_codes` to remove ANSI codes
+//! from a string as well as `measure_text_width` to calculate the width of a
+//! string as it would be displayed by the terminal.  Both of those together
+//! are useful for more complex formatting.
+//!
+//! # Unicode Width Support
+//!
+//! By default this crate depends on the `unicode-width` crate to calculate
+//! the width of terminal characters.  If you do not need this you can disable
+//! the `unicode-width` feature which will cut down on dependencies.
+//!
+//! # Features
+//!
+//! By default all features are enabled.  The following features exist:
+//!
+//! * `unicode-width`: adds support for unicode width calculations
+//! * `ansi-parsing`: adds support for parsing ansi codes (this adds support
+//!   for stripping and taking ansi escape codes into account for length
+//!   calculations).
+
+pub use crate::kb::Key;
+pub use crate::term::{
+    user_attended, user_attended_stderr, Term, TermFamily, TermFeatures, TermTarget,
+};
+pub use crate::utils::{
+    colors_enabled, colors_enabled_stderr, measure_text_width, pad_str, pad_str_with,
+    set_colors_enabled, set_colors_enabled_stderr, style, truncate_str, Alignment, Attribute,
+    Color, Emoji, Style, StyledObject,
+};
+
+#[cfg(feature = "ansi-parsing")]
+pub use crate::ansi::{strip_ansi_codes, AnsiCodeIterator};
+
+mod common_term;
+mod kb;
+mod term;
+#[cfg(unix)]
+mod unix_term;
+mod utils;
+#[cfg(target_arch = "wasm32")]
+mod wasm_term;
+#[cfg(windows)]
+mod windows_term;
+
+#[cfg(feature = "ansi-parsing")]
+mod ansi;
diff --git a/android/vendor/console-0.15.0/src/term.rs b/android/vendor/console-0.15.0/src/term.rs
new file mode 100644
index 0000000..56287dc
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/term.rs
@@ -0,0 +1,620 @@
+use std::fmt::{Debug, Display};
+use std::io::{self, Read, Write};
+use std::sync::{Arc, Mutex};
+
+#[cfg(unix)]
+use std::os::unix::io::{AsRawFd, RawFd};
+#[cfg(windows)]
+use std::os::windows::io::{AsRawHandle, RawHandle};
+
+use crate::{kb::Key, utils::Style};
+
+#[cfg(unix)]
+trait TermWrite: Write + Debug + AsRawFd + Send {}
+#[cfg(unix)]
+impl<T: Write + Debug + AsRawFd + Send> TermWrite for T {}
+
+#[cfg(unix)]
+trait TermRead: Read + Debug + AsRawFd + Send {}
+#[cfg(unix)]
+impl<T: Read + Debug + AsRawFd + Send> TermRead for T {}
+
+#[cfg(unix)]
+#[derive(Debug, Clone)]
+pub struct ReadWritePair {
+    read: Arc<Mutex<dyn TermRead>>,
+    write: Arc<Mutex<dyn TermWrite>>,
+    style: Style,
+}
+
+/// Where the term is writing.
+#[derive(Debug, Clone)]
+pub enum TermTarget {
+    Stdout,
+    Stderr,
+    #[cfg(unix)]
+    ReadWritePair(ReadWritePair),
+}
+
+#[derive(Debug)]
+pub struct TermInner {
+    target: TermTarget,
+    buffer: Option<Mutex<Vec<u8>>>,
+}
+
+/// The family of the terminal.
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub enum TermFamily {
+    /// Redirected to a file or file like thing.
+    File,
+    /// A standard unix terminal.
+    UnixTerm,
+    /// A cmd.exe like windows console.
+    WindowsConsole,
+    /// A dummy terminal (for instance on wasm)
+    Dummy,
+}
+
+/// Gives access to the terminal features.
+#[derive(Debug, Clone)]
+pub struct TermFeatures<'a>(&'a Term);
+
+impl<'a> TermFeatures<'a> {
+    /// Checks if this is a real user attended terminal (`isatty`)
+    #[inline]
+    pub fn is_attended(&self) -> bool {
+        is_a_terminal(self.0)
+    }
+
+    /// Checks if colors are supported by this terminal.
+    ///
+    /// This does not check if colors are enabled.  Currently all terminals
+    /// are considered to support colors
+    #[inline]
+    pub fn colors_supported(&self) -> bool {
+        is_a_color_terminal(self.0)
+    }
+
+    /// Checks if this terminal is an msys terminal.
+    ///
+    /// This is sometimes useful to disable features that are known to not
+    /// work on msys terminals or require special handling.
+    #[inline]
+    pub fn is_msys_tty(&self) -> bool {
+        #[cfg(windows)]
+        {
+            msys_tty_on(self.0)
+        }
+        #[cfg(not(windows))]
+        {
+            false
+        }
+    }
+
+    /// Checks if this terminal wants emojis.
+    #[inline]
+    pub fn wants_emoji(&self) -> bool {
+        self.is_attended() && wants_emoji()
+    }
+
+    /// Returns the family of the terminal.
+    #[inline]
+    pub fn family(&self) -> TermFamily {
+        if !self.is_attended() {
+            return TermFamily::File;
+        }
+        #[cfg(windows)]
+        {
+            TermFamily::WindowsConsole
+        }
+        #[cfg(unix)]
+        {
+            TermFamily::UnixTerm
+        }
+        #[cfg(target_arch = "wasm32")]
+        {
+            TermFamily::Dummy
+        }
+    }
+}
+
+/// Abstraction around a terminal.
+///
+/// A terminal can be cloned.  If a buffer is used it's shared across all
+/// clones which means it largely acts as a handle.
+#[derive(Clone, Debug)]
+pub struct Term {
+    inner: Arc<TermInner>,
+    pub(crate) is_msys_tty: bool,
+    pub(crate) is_tty: bool,
+}
+
+impl Term {
+    fn with_inner(inner: TermInner) -> Term {
+        let mut term = Term {
+            inner: Arc::new(inner),
+            is_msys_tty: false,
+            is_tty: false,
+        };
+
+        term.is_msys_tty = term.features().is_msys_tty();
+        term.is_tty = term.features().is_attended();
+        term
+    }
+
+    /// Return a new unbuffered terminal
+    #[inline]
+    pub fn stdout() -> Term {
+        Term::with_inner(TermInner {
+            target: TermTarget::Stdout,
+            buffer: None,
+        })
+    }
+
+    /// Return a new unbuffered terminal to stderr
+    #[inline]
+    pub fn stderr() -> Term {
+        Term::with_inner(TermInner {
+            target: TermTarget::Stderr,
+            buffer: None,
+        })
+    }
+
+    /// Return a new buffered terminal
+    pub fn buffered_stdout() -> Term {
+        Term::with_inner(TermInner {
+            target: TermTarget::Stdout,
+            buffer: Some(Mutex::new(vec![])),
+        })
+    }
+
+    /// Return a new buffered terminal to stderr
+    pub fn buffered_stderr() -> Term {
+        Term::with_inner(TermInner {
+            target: TermTarget::Stderr,
+            buffer: Some(Mutex::new(vec![])),
+        })
+    }
+
+    /// Return a terminal for the given Read/Write pair styled-like Stderr.
+    #[cfg(unix)]
+    pub fn read_write_pair<R, W>(read: R, write: W) -> Term
+    where
+        R: Read + Debug + AsRawFd + Send + 'static,
+        W: Write + Debug + AsRawFd + Send + 'static,
+    {
+        Self::read_write_pair_with_style(read, write, Style::new().for_stderr())
+    }
+
+    /// Return a terminal for the given Read/Write pair.
+    #[cfg(unix)]
+    pub fn read_write_pair_with_style<R, W>(read: R, write: W, style: Style) -> Term
+    where
+        R: Read + Debug + AsRawFd + Send + 'static,
+        W: Write + Debug + AsRawFd + Send + 'static,
+    {
+        Term::with_inner(TermInner {
+            target: TermTarget::ReadWritePair(ReadWritePair {
+                read: Arc::new(Mutex::new(read)),
+                write: Arc::new(Mutex::new(write)),
+                style,
+            }),
+            buffer: None,
+        })
+    }
+
+    /// Returns the style for the term
+    #[inline]
+    pub fn style(&self) -> Style {
+        match self.inner.target {
+            TermTarget::Stderr => Style::new().for_stderr(),
+            TermTarget::Stdout => Style::new().for_stdout(),
+            #[cfg(unix)]
+            TermTarget::ReadWritePair(ReadWritePair { ref style, .. }) => style.clone(),
+        }
+    }
+
+    /// Returns the target
+    #[inline]
+    pub fn target(&self) -> TermTarget {
+        self.inner.target.clone()
+    }
+
+    #[doc(hidden)]
+    pub fn write_str(&self, s: &str) -> io::Result<()> {
+        match self.inner.buffer {
+            Some(ref buffer) => buffer.lock().unwrap().write_all(s.as_bytes()),
+            None => self.write_through(s.as_bytes()),
+        }
+    }
+
+    /// Writes a string to the terminal and adds a newline.
+    pub fn write_line(&self, s: &str) -> io::Result<()> {
+        match self.inner.buffer {
+            Some(ref mutex) => {
+                let mut buffer = mutex.lock().unwrap();
+                buffer.extend_from_slice(s.as_bytes());
+                buffer.push(b'\n');
+                Ok(())
+            }
+            None => self.write_through(format!("{}\n", s).as_bytes()),
+        }
+    }
+
+    /// Read a single character from the terminal
+    ///
+    /// This does not echo the character and blocks until a single character
+    /// is entered.
+    pub fn read_char(&self) -> io::Result<char> {
+        loop {
+            match self.read_key()? {
+                Key::Char(c) => {
+                    return Ok(c);
+                }
+                Key::Enter => {
+                    return Ok('\n');
+                }
+                Key::Unknown => {
+                    return Err(io::Error::new(
+                        io::ErrorKind::NotConnected,
+                        "Not a terminal",
+                    ))
+                }
+                _ => {}
+            }
+        }
+    }
+
+    /// Read a single key form the terminal.
+    ///
+    /// This does not echo anything.  If the terminal is not user attended
+    /// the return value will always be the unknown key.
+    pub fn read_key(&self) -> io::Result<Key> {
+        if !self.is_tty {
+            Ok(Key::Unknown)
+        } else {
+            read_single_key()
+        }
+    }
+
+    /// Read one line of input.
+    ///
+    /// This does not include the trailing newline.  If the terminal is not
+    /// user attended the return value will always be an empty string.
+    pub fn read_line(&self) -> io::Result<String> {
+        if !self.is_tty {
+            return Ok("".into());
+        }
+        let mut rv = String::new();
+        io::stdin().read_line(&mut rv)?;
+        let len = rv.trim_end_matches(&['\r', '\n'][..]).len();
+        rv.truncate(len);
+        Ok(rv)
+    }
+
+    /// Read one line of input with initial text.
+    ///
+    /// This does not include the trailing newline.  If the terminal is not
+    /// user attended the return value will always be an empty string.
+    pub fn read_line_initial_text(&self, initial: &str) -> io::Result<String> {
+        if !self.is_tty {
+            return Ok("".into());
+        }
+        self.write_str(initial)?;
+
+        let mut chars: Vec<char> = initial.chars().collect();
+
+        loop {
+            match self.read_key()? {
+                Key::Backspace => {
+                    if chars.pop().is_some() {
+                        self.clear_chars(1)?;
+                    }
+                    self.flush()?;
+                }
+                Key::Char(chr) => {
+                    chars.push(chr);
+                    let mut bytes_char = [0; 4];
+                    chr.encode_utf8(&mut bytes_char);
+                    self.write_str(chr.encode_utf8(&mut bytes_char))?;
+                    self.flush()?;
+                }
+                Key::Enter => break,
+                Key::Unknown => {
+                    return Err(io::Error::new(
+                        io::ErrorKind::NotConnected,
+                        "Not a terminal",
+                    ))
+                }
+                _ => (),
+            }
+        }
+        Ok(chars.iter().collect::<String>())
+    }
+
+    /// Read securely a line of input.
+    ///
+    /// This is similar to `read_line` but will not echo the output.  This
+    /// also switches the terminal into a different mode where not all
+    /// characters might be accepted.
+    pub fn read_secure_line(&self) -> io::Result<String> {
+        if !self.is_tty {
+            return Ok("".into());
+        }
+        match read_secure() {
+            Ok(rv) => {
+                self.write_line("")?;
+                Ok(rv)
+            }
+            Err(err) => Err(err),
+        }
+    }
+
+    /// Flushes internal buffers.
+    ///
+    /// This forces the contents of the internal buffer to be written to
+    /// the terminal.  This is unnecessary for unbuffered terminals which
+    /// will automatically flush.
+    pub fn flush(&self) -> io::Result<()> {
+        if let Some(ref buffer) = self.inner.buffer {
+            let mut buffer = buffer.lock().unwrap();
+            if !buffer.is_empty() {
+                self.write_through(&buffer[..])?;
+                buffer.clear();
+            }
+        }
+        Ok(())
+    }
+
+    /// Checks if the terminal is indeed a terminal.
+    #[inline]
+    pub fn is_term(&self) -> bool {
+        self.is_tty
+    }
+
+    /// Checks for common terminal features.
+    #[inline]
+    pub fn features(&self) -> TermFeatures<'_> {
+        TermFeatures(self)
+    }
+
+    /// Returns the terminal size in rows and columns or gets sensible defaults.
+    #[inline]
+    pub fn size(&self) -> (u16, u16) {
+        self.size_checked().unwrap_or((24, DEFAULT_WIDTH))
+    }
+
+    /// Returns the terminal size in rows and columns.
+    ///
+    /// If the size cannot be reliably determined None is returned.
+    #[inline]
+    pub fn size_checked(&self) -> Option<(u16, u16)> {
+        terminal_size(self)
+    }
+
+    /// Moves the cursor to `x` and `y`
+    #[inline]
+    pub fn move_cursor_to(&self, x: usize, y: usize) -> io::Result<()> {
+        move_cursor_to(self, x, y)
+    }
+
+    /// Moves the cursor up `n` lines
+    #[inline]
+    pub fn move_cursor_up(&self, n: usize) -> io::Result<()> {
+        move_cursor_up(self, n)
+    }
+
+    /// Moves the cursor down `n` lines
+    #[inline]
+    pub fn move_cursor_down(&self, n: usize) -> io::Result<()> {
+        move_cursor_down(self, n)
+    }
+
+    /// Moves the cursor left `n` lines
+    #[inline]
+    pub fn move_cursor_left(&self, n: usize) -> io::Result<()> {
+        move_cursor_left(self, n)
+    }
+
+    /// Moves the cursor down `n` lines
+    #[inline]
+    pub fn move_cursor_right(&self, n: usize) -> io::Result<()> {
+        move_cursor_right(self, n)
+    }
+
+    /// Clears the current line.
+    ///
+    /// The positions the cursor at the beginning of the line again.
+    #[inline]
+    pub fn clear_line(&self) -> io::Result<()> {
+        clear_line(self)
+    }
+
+    /// Clear the last `n` lines.
+    ///
+    /// This positions the cursor at the beginning of the first line
+    /// that was cleared.
+    pub fn clear_last_lines(&self, n: usize) -> io::Result<()> {
+        self.move_cursor_up(n)?;
+        for _ in 0..n {
+            self.clear_line()?;
+            self.move_cursor_down(1)?;
+        }
+        self.move_cursor_up(n)?;
+        Ok(())
+    }
+
+    /// Clears the entire screen.
+    #[inline]
+    pub fn clear_screen(&self) -> io::Result<()> {
+        clear_screen(self)
+    }
+
+    /// Clears the entire screen.
+    #[inline]
+    pub fn clear_to_end_of_screen(&self) -> io::Result<()> {
+        clear_to_end_of_screen(self)
+    }
+
+    /// Clears the last char in the the current line.
+    #[inline]
+    pub fn clear_chars(&self, n: usize) -> io::Result<()> {
+        clear_chars(self, n)
+    }
+
+    /// Set the terminal title
+    pub fn set_title<T: Display>(&self, title: T) {
+        if !self.is_tty {
+            return;
+        }
+        set_title(title);
+    }
+
+    /// Makes cursor visible again
+    #[inline]
+    pub fn show_cursor(&self) -> io::Result<()> {
+        show_cursor(self)
+    }
+
+    /// Hides cursor
+    #[inline]
+    pub fn hide_cursor(&self) -> io::Result<()> {
+        hide_cursor(self)
+    }
+
+    // helpers
+
+    #[cfg(all(windows, feature = "windows-console-colors"))]
+    fn write_through(&self, bytes: &[u8]) -> io::Result<()> {
+        if self.is_msys_tty || !self.is_tty {
+            self.write_through_common(bytes)
+        } else {
+            use winapi_util::console::Console;
+
+            match self.inner.target {
+                TermTarget::Stdout => console_colors(self, Console::stdout()?, bytes),
+                TermTarget::Stderr => console_colors(self, Console::stderr()?, bytes),
+            }
+        }
+    }
+
+    #[cfg(not(all(windows, feature = "windows-console-colors")))]
+    fn write_through(&self, bytes: &[u8]) -> io::Result<()> {
+        self.write_through_common(bytes)
+    }
+
+    pub(crate) fn write_through_common(&self, bytes: &[u8]) -> io::Result<()> {
+        match self.inner.target {
+            TermTarget::Stdout => {
+                io::stdout().write_all(bytes)?;
+                io::stdout().flush()?;
+            }
+            TermTarget::Stderr => {
+                io::stderr().write_all(bytes)?;
+                io::stderr().flush()?;
+            }
+            #[cfg(unix)]
+            TermTarget::ReadWritePair(ReadWritePair { ref write, .. }) => {
+                let mut write = write.lock().unwrap();
+                write.write_all(bytes)?;
+                write.flush()?;
+            }
+        }
+        Ok(())
+    }
+}
+
+/// A fast way to check if the application has a user attended for stdout.
+///
+/// This means that stdout is connected to a terminal instead of a
+/// file or redirected by other means. This is a shortcut for
+/// checking the `is_attended` feature on the stdout terminal.
+#[inline]
+pub fn user_attended() -> bool {
+    Term::stdout().features().is_attended()
+}
+
+/// A fast way to check if the application has a user attended for stderr.
+///
+/// This means that stderr is connected to a terminal instead of a
+/// file or redirected by other means. This is a shortcut for
+/// checking the `is_attended` feature on the stderr terminal.
+#[inline]
+pub fn user_attended_stderr() -> bool {
+    Term::stderr().features().is_attended()
+}
+
+#[cfg(unix)]
+impl AsRawFd for Term {
+    fn as_raw_fd(&self) -> RawFd {
+        match self.inner.target {
+            TermTarget::Stdout => libc::STDOUT_FILENO,
+            TermTarget::Stderr => libc::STDERR_FILENO,
+            TermTarget::ReadWritePair(ReadWritePair { ref write, .. }) => {
+                write.lock().unwrap().as_raw_fd()
+            }
+        }
+    }
+}
+
+#[cfg(windows)]
+impl AsRawHandle for Term {
+    fn as_raw_handle(&self) -> RawHandle {
+        use winapi::um::processenv::GetStdHandle;
+        use winapi::um::winbase::{STD_ERROR_HANDLE, STD_OUTPUT_HANDLE};
+
+        unsafe {
+            GetStdHandle(match self.inner.target {
+                TermTarget::Stdout => STD_OUTPUT_HANDLE,
+                TermTarget::Stderr => STD_ERROR_HANDLE,
+            }) as RawHandle
+        }
+    }
+}
+
+impl Write for Term {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        match self.inner.buffer {
+            Some(ref buffer) => buffer.lock().unwrap().write_all(buf),
+            None => self.write_through(buf),
+        }?;
+        Ok(buf.len())
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        Term::flush(self)
+    }
+}
+
+impl<'a> Write for &'a Term {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        match self.inner.buffer {
+            Some(ref buffer) => buffer.lock().unwrap().write_all(buf),
+            None => self.write_through(buf),
+        }?;
+        Ok(buf.len())
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        Term::flush(self)
+    }
+}
+
+impl Read for Term {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        io::stdin().read(buf)
+    }
+}
+
+impl<'a> Read for &'a Term {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        io::stdin().read(buf)
+    }
+}
+
+#[cfg(unix)]
+pub use crate::unix_term::*;
+#[cfg(target_arch = "wasm32")]
+pub use crate::wasm_term::*;
+#[cfg(windows)]
+pub use crate::windows_term::*;
diff --git a/android/vendor/console-0.15.0/src/unix_term.rs b/android/vendor/console-0.15.0/src/unix_term.rs
new file mode 100644
index 0000000..da5524c
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/unix_term.rs
@@ -0,0 +1,292 @@
+use std::env;
+use std::fmt::Display;
+use std::fs;
+use std::io;
+use std::io::{BufRead, BufReader};
+use std::os::unix::io::AsRawFd;
+use std::str;
+
+use crate::kb::Key;
+use crate::term::Term;
+
+pub use crate::common_term::*;
+
+pub const DEFAULT_WIDTH: u16 = 80;
+
+#[inline]
+pub fn is_a_terminal(out: &Term) -> bool {
+    unsafe { libc::isatty(out.as_raw_fd()) != 0 }
+}
+
+pub fn is_a_color_terminal(out: &Term) -> bool {
+    if !is_a_terminal(out) {
+        return false;
+    }
+
+    if env::var("NO_COLOR").is_ok() {
+        return false;
+    }
+
+    match env::var("TERM") {
+        Ok(term) => term != "dumb",
+        Err(_) => false,
+    }
+}
+
+pub fn c_result<F: FnOnce() -> libc::c_int>(f: F) -> io::Result<()> {
+    let res = f();
+    if res != 0 {
+        Err(io::Error::last_os_error())
+    } else {
+        Ok(())
+    }
+}
+
+#[inline]
+pub fn terminal_size(out: &Term) -> Option<(u16, u16)> {
+    terminal_size::terminal_size_using_fd(out.as_raw_fd()).map(|x| ((x.1).0, (x.0).0))
+}
+
+pub fn read_secure() -> io::Result<String> {
+    let f_tty;
+    let fd = unsafe {
+        if libc::isatty(libc::STDIN_FILENO) == 1 {
+            f_tty = None;
+            libc::STDIN_FILENO
+        } else {
+            let f = fs::File::open("/dev/tty")?;
+            let fd = f.as_raw_fd();
+            f_tty = Some(BufReader::new(f));
+            fd
+        }
+    };
+
+    let mut termios = core::mem::MaybeUninit::uninit();
+    c_result(|| unsafe { libc::tcgetattr(fd, termios.as_mut_ptr()) })?;
+    let mut termios = unsafe { termios.assume_init() };
+    let original = termios;
+    termios.c_lflag &= !libc::ECHO;
+    c_result(|| unsafe { libc::tcsetattr(fd, libc::TCSAFLUSH, &termios) })?;
+    let mut rv = String::new();
+
+    let read_rv = if let Some(mut f) = f_tty {
+        f.read_line(&mut rv)
+    } else {
+        io::stdin().read_line(&mut rv)
+    };
+
+    c_result(|| unsafe { libc::tcsetattr(fd, libc::TCSAFLUSH, &original) })?;
+
+    read_rv.map(|_| {
+        let len = rv.trim_end_matches(&['\r', '\n'][..]).len();
+        rv.truncate(len);
+        rv
+    })
+}
+
+fn read_single_char(fd: i32) -> io::Result<Option<char>> {
+    let mut pollfd = libc::pollfd {
+        fd,
+        events: libc::POLLIN,
+        revents: 0,
+    };
+
+    // timeout of zero means that it will not block
+    let ret = unsafe { libc::poll(&mut pollfd as *mut _, 1, 0) };
+    if ret < 0 {
+        return Err(io::Error::last_os_error());
+    }
+
+    let is_ready = pollfd.revents & libc::POLLIN != 0;
+
+    if is_ready {
+        // if there is something to be read, take 1 byte from it
+        let mut buf: [u8; 1] = [0];
+
+        read_bytes(fd, &mut buf, 1)?;
+        Ok(Some(buf[0] as char))
+    } else {
+        //there is nothing to be read
+        Ok(None)
+    }
+}
+
+// Similar to libc::read. Read count bytes into slice buf from descriptor fd.
+// If successful, return the number of bytes read.
+// Will return an error if nothing was read, i.e when called at end of file.
+fn read_bytes(fd: i32, buf: &mut [u8], count: u8) -> io::Result<u8> {
+    let read = unsafe { libc::read(fd, buf.as_mut_ptr() as *mut _, count as usize) };
+    if read < 0 {
+        Err(io::Error::last_os_error())
+    } else if read == 0 {
+        Err(io::Error::new(
+            io::ErrorKind::UnexpectedEof,
+            "Reached end of file",
+        ))
+    } else if buf[0] == b'\x03' {
+        Err(io::Error::new(
+            io::ErrorKind::Interrupted,
+            "read interrupted",
+        ))
+    } else {
+        Ok(read as u8)
+    }
+}
+
+pub fn read_single_key() -> io::Result<Key> {
+    let tty_f;
+    let fd = unsafe {
+        if libc::isatty(libc::STDIN_FILENO) == 1 {
+            libc::STDIN_FILENO
+        } else {
+            tty_f = fs::File::open("/dev/tty")?;
+            tty_f.as_raw_fd()
+        }
+    };
+    let mut termios = core::mem::MaybeUninit::uninit();
+    c_result(|| unsafe { libc::tcgetattr(fd, termios.as_mut_ptr()) })?;
+    let mut termios = unsafe { termios.assume_init() };
+    let original = termios;
+    unsafe { libc::cfmakeraw(&mut termios) };
+    c_result(|| unsafe { libc::tcsetattr(fd, libc::TCSADRAIN, &termios) })?;
+
+    let rv = match read_single_char(fd)? {
+        Some('\x1b') => {
+            // Escape was read, keep reading in case we find a familiar key
+            if let Some(c1) = read_single_char(fd)? {
+                if c1 == '[' {
+                    if let Some(c2) = read_single_char(fd)? {
+                        match c2 {
+                            'A' => Ok(Key::ArrowUp),
+                            'B' => Ok(Key::ArrowDown),
+                            'C' => Ok(Key::ArrowRight),
+                            'D' => Ok(Key::ArrowLeft),
+                            'H' => Ok(Key::Home),
+                            'F' => Ok(Key::End),
+                            'Z' => Ok(Key::BackTab),
+                            _ => {
+                                let c3 = read_single_char(fd)?;
+                                if let Some(c3) = c3 {
+                                    if c3 == '~' {
+                                        match c2 {
+                                            '1' => Ok(Key::Home), // tmux
+                                            '2' => Ok(Key::Insert),
+                                            '3' => Ok(Key::Del),
+                                            '4' => Ok(Key::End), // tmux
+                                            '5' => Ok(Key::PageUp),
+                                            '6' => Ok(Key::PageDown),
+                                            '7' => Ok(Key::Home), // xrvt
+                                            '8' => Ok(Key::End),  // xrvt
+                                            _ => Ok(Key::UnknownEscSeq(vec![c1, c2, c3])),
+                                        }
+                                    } else {
+                                        Ok(Key::UnknownEscSeq(vec![c1, c2, c3]))
+                                    }
+                                } else {
+                                    // \x1b[ and 1 more char
+                                    Ok(Key::UnknownEscSeq(vec![c1, c2]))
+                                }
+                            }
+                        }
+                    } else {
+                        // \x1b[ and no more input
+                        Ok(Key::UnknownEscSeq(vec![c1]))
+                    }
+                } else {
+                    // char after escape is not [
+                    Ok(Key::UnknownEscSeq(vec![c1]))
+                }
+            } else {
+                //nothing after escape
+                Ok(Key::Escape)
+            }
+        }
+        Some(c) => {
+            let byte = c as u8;
+            let mut buf: [u8; 4] = [byte, 0, 0, 0];
+
+            if byte & 224u8 == 192u8 {
+                // a two byte unicode character
+                read_bytes(fd, &mut buf[1..], 1)?;
+                Ok(key_from_utf8(&buf[..2]))
+            } else if byte & 240u8 == 224u8 {
+                // a three byte unicode character
+                read_bytes(fd, &mut buf[1..], 2)?;
+                Ok(key_from_utf8(&buf[..3]))
+            } else if byte & 248u8 == 240u8 {
+                // a four byte unicode character
+                read_bytes(fd, &mut buf[1..], 3)?;
+                Ok(key_from_utf8(&buf[..4]))
+            } else {
+                Ok(match c {
+                    '\n' | '\r' => Key::Enter,
+                    '\x7f' => Key::Backspace,
+                    '\t' => Key::Tab,
+                    '\x01' => Key::Home,      // Control-A (home)
+                    '\x05' => Key::End,       // Control-E (end)
+                    '\x08' => Key::Backspace, // Control-H (8) (Identical to '\b')
+                    _ => Key::Char(c),
+                })
+            }
+        }
+        None => {
+            // there is no subsequent byte ready to be read, block and wait for input
+
+            let mut pollfd = libc::pollfd {
+                fd,
+                events: libc::POLLIN,
+                revents: 0,
+            };
+
+            // negative timeout means that it will block indefinitely
+            let ret = unsafe { libc::poll(&mut pollfd as *mut _, 1, -1) };
+            if ret < 0 {
+                return Err(io::Error::last_os_error());
+            }
+
+            read_single_key()
+        }
+    };
+    c_result(|| unsafe { libc::tcsetattr(fd, libc::TCSADRAIN, &original) })?;
+
+    // if the user hit ^C we want to signal SIGINT to outselves.
+    if let Err(ref err) = rv {
+        if err.kind() == io::ErrorKind::Interrupted {
+            unsafe {
+                libc::raise(libc::SIGINT);
+            }
+        }
+    }
+
+    rv
+}
+
+pub fn key_from_utf8(buf: &[u8]) -> Key {
+    if let Ok(s) = str::from_utf8(buf) {
+        if let Some(c) = s.chars().next() {
+            return Key::Char(c);
+        }
+    }
+    Key::Unknown
+}
+
+#[cfg(not(target_os = "macos"))]
+static IS_LANG_UTF8: once_cell::sync::Lazy<bool> =
+    once_cell::sync::Lazy::new(|| match std::env::var("LANG") {
+        Ok(lang) => lang.to_uppercase().ends_with("UTF-8"),
+        _ => false,
+    });
+
+#[cfg(target_os = "macos")]
+pub fn wants_emoji() -> bool {
+    true
+}
+
+#[cfg(not(target_os = "macos"))]
+pub fn wants_emoji() -> bool {
+    *IS_LANG_UTF8
+}
+
+pub fn set_title<T: Display>(title: T) {
+    print!("\x1b]0;{}\x07", title);
+}
diff --git a/android/vendor/console-0.15.0/src/utils.rs b/android/vendor/console-0.15.0/src/utils.rs
new file mode 100644
index 0000000..d9cbee8
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/utils.rs
@@ -0,0 +1,939 @@
+use std::borrow::Cow;
+use std::collections::BTreeSet;
+use std::env;
+use std::fmt;
+use std::sync::atomic::{AtomicBool, Ordering};
+
+use crate::term::{wants_emoji, Term};
+use once_cell::sync::Lazy;
+
+#[cfg(feature = "ansi-parsing")]
+use crate::ansi::{strip_ansi_codes, AnsiCodeIterator};
+
+#[cfg(not(feature = "ansi-parsing"))]
+fn strip_ansi_codes(s: &str) -> &str {
+    s
+}
+
+fn default_colors_enabled(out: &Term) -> bool {
+    (out.features().colors_supported()
+        && &env::var("CLICOLOR").unwrap_or_else(|_| "1".into()) != "0")
+        || &env::var("CLICOLOR_FORCE").unwrap_or_else(|_| "0".into()) != "0"
+}
+
+static STDOUT_COLORS: Lazy<AtomicBool> =
+    Lazy::new(|| AtomicBool::new(default_colors_enabled(&Term::stdout())));
+static STDERR_COLORS: Lazy<AtomicBool> =
+    Lazy::new(|| AtomicBool::new(default_colors_enabled(&Term::stderr())));
+
+/// Returns `true` if colors should be enabled for stdout.
+///
+/// This honors the [clicolors spec](http://bixense.com/clicolors/).
+///
+/// * `CLICOLOR != 0`: ANSI colors are supported and should be used when the program isn't piped.
+/// * `CLICOLOR == 0`: Don't output ANSI color escape codes.
+/// * `CLICOLOR_FORCE != 0`: ANSI colors should be enabled no matter what.
+#[inline]
+pub fn colors_enabled() -> bool {
+    STDOUT_COLORS.load(Ordering::Relaxed)
+}
+
+/// Forces colorization on or off for stdout.
+///
+/// This overrides the default for the current process and changes the return value of the
+/// `colors_enabled` function.
+#[inline]
+pub fn set_colors_enabled(val: bool) {
+    STDOUT_COLORS.store(val, Ordering::Relaxed)
+}
+
+/// Returns `true` if colors should be enabled for stderr.
+///
+/// This honors the [clicolors spec](http://bixense.com/clicolors/).
+///
+/// * `CLICOLOR != 0`: ANSI colors are supported and should be used when the program isn't piped.
+/// * `CLICOLOR == 0`: Don't output ANSI color escape codes.
+/// * `CLICOLOR_FORCE != 0`: ANSI colors should be enabled no matter what.
+#[inline]
+pub fn colors_enabled_stderr() -> bool {
+    STDERR_COLORS.load(Ordering::Relaxed)
+}
+
+/// Forces colorization on or off for stderr.
+///
+/// This overrides the default for the current process and changes the return value of the
+/// `colors_enabled` function.
+#[inline]
+pub fn set_colors_enabled_stderr(val: bool) {
+    STDERR_COLORS.store(val, Ordering::Relaxed)
+}
+
+/// Measure the width of a string in terminal characters.
+pub fn measure_text_width(s: &str) -> usize {
+    str_width(&strip_ansi_codes(s))
+}
+
+/// A terminal color.
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub enum Color {
+    Black,
+    Red,
+    Green,
+    Yellow,
+    Blue,
+    Magenta,
+    Cyan,
+    White,
+    Color256(u8),
+}
+
+impl Color {
+    #[inline]
+    fn ansi_num(self) -> usize {
+        match self {
+            Color::Black => 0,
+            Color::Red => 1,
+            Color::Green => 2,
+            Color::Yellow => 3,
+            Color::Blue => 4,
+            Color::Magenta => 5,
+            Color::Cyan => 6,
+            Color::White => 7,
+            Color::Color256(x) => x as usize,
+        }
+    }
+
+    #[inline]
+    fn is_color256(self) -> bool {
+        #[allow(clippy::match_like_matches_macro)]
+        match self {
+            Color::Color256(_) => true,
+            _ => false,
+        }
+    }
+}
+
+/// A terminal style attribute.
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd)]
+pub enum Attribute {
+    Bold,
+    Dim,
+    Italic,
+    Underlined,
+    Blink,
+    Reverse,
+    Hidden,
+}
+
+impl Attribute {
+    #[inline]
+    fn ansi_num(self) -> usize {
+        match self {
+            Attribute::Bold => 1,
+            Attribute::Dim => 2,
+            Attribute::Italic => 3,
+            Attribute::Underlined => 4,
+            Attribute::Blink => 5,
+            Attribute::Reverse => 7,
+            Attribute::Hidden => 8,
+        }
+    }
+}
+
+/// Defines the alignment for padding operations.
+#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+pub enum Alignment {
+    Left,
+    Center,
+    Right,
+}
+
+/// A stored style that can be applied.
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub struct Style {
+    fg: Option<Color>,
+    bg: Option<Color>,
+    fg_bright: bool,
+    bg_bright: bool,
+    attrs: BTreeSet<Attribute>,
+    force: Option<bool>,
+    for_stderr: bool,
+}
+
+impl Default for Style {
+    fn default() -> Style {
+        Style::new()
+    }
+}
+
+impl Style {
+    /// Returns an empty default style.
+    pub fn new() -> Style {
+        Style {
+            fg: None,
+            bg: None,
+            fg_bright: false,
+            bg_bright: false,
+            attrs: BTreeSet::new(),
+            force: None,
+            for_stderr: false,
+        }
+    }
+
+    /// Creates a style from a dotted string.
+    ///
+    /// Effectively the string is split at each dot and then the
+    /// terms in between are applied.  For instance `red.on_blue` will
+    /// create a string that is red on blue background. `9.on_12` is
+    /// the same, but using 256 color numbers. Unknown terms are
+    /// ignored.
+    pub fn from_dotted_str(s: &str) -> Style {
+        let mut rv = Style::new();
+        for part in s.split('.') {
+            rv = match part {
+                "black" => rv.black(),
+                "red" => rv.red(),
+                "green" => rv.green(),
+                "yellow" => rv.yellow(),
+                "blue" => rv.blue(),
+                "magenta" => rv.magenta(),
+                "cyan" => rv.cyan(),
+                "white" => rv.white(),
+                "bright" => rv.bright(),
+                "on_black" => rv.on_black(),
+                "on_red" => rv.on_red(),
+                "on_green" => rv.on_green(),
+                "on_yellow" => rv.on_yellow(),
+                "on_blue" => rv.on_blue(),
+                "on_magenta" => rv.on_magenta(),
+                "on_cyan" => rv.on_cyan(),
+                "on_white" => rv.on_white(),
+                "on_bright" => rv.on_bright(),
+                "bold" => rv.bold(),
+                "dim" => rv.dim(),
+                "underlined" => rv.underlined(),
+                "blink" => rv.blink(),
+                "reverse" => rv.reverse(),
+                "hidden" => rv.hidden(),
+                on_c if on_c.starts_with("on_") => {
+                    if let Ok(n) = on_c[3..].parse::<u8>() {
+                        rv.on_color256(n)
+                    } else {
+                        continue;
+                    }
+                }
+                c => {
+                    if let Ok(n) = c.parse::<u8>() {
+                        rv.color256(n)
+                    } else {
+                        continue;
+                    }
+                }
+            };
+        }
+        rv
+    }
+
+    /// Apply the style to something that can be displayed.
+    pub fn apply_to<D>(&self, val: D) -> StyledObject<D> {
+        StyledObject {
+            style: self.clone(),
+            val,
+        }
+    }
+
+    /// Forces styling on or off.
+    ///
+    /// This overrides the detection from `clicolors-control`.
+    #[inline]
+    pub fn force_styling(mut self, value: bool) -> Style {
+        self.force = Some(value);
+        self
+    }
+
+    /// Specifies that style is applying to something being written on stderr.
+    #[inline]
+    pub fn for_stderr(mut self) -> Style {
+        self.for_stderr = true;
+        self
+    }
+
+    /// Specifies that style is applying to something being written on stdout.
+    ///
+    /// This is the default behaviour.
+    #[inline]
+    pub fn for_stdout(mut self) -> Style {
+        self.for_stderr = false;
+        self
+    }
+
+    /// Sets a foreground color.
+    #[inline]
+    pub fn fg(mut self, color: Color) -> Style {
+        self.fg = Some(color);
+        self
+    }
+
+    /// Sets a background color.
+    #[inline]
+    pub fn bg(mut self, color: Color) -> Style {
+        self.bg = Some(color);
+        self
+    }
+
+    /// Adds a attr.
+    #[inline]
+    pub fn attr(mut self, attr: Attribute) -> Style {
+        self.attrs.insert(attr);
+        self
+    }
+
+    #[inline]
+    pub fn black(self) -> Style {
+        self.fg(Color::Black)
+    }
+    #[inline]
+    pub fn red(self) -> Style {
+        self.fg(Color::Red)
+    }
+    #[inline]
+    pub fn green(self) -> Style {
+        self.fg(Color::Green)
+    }
+    #[inline]
+    pub fn yellow(self) -> Style {
+        self.fg(Color::Yellow)
+    }
+    #[inline]
+    pub fn blue(self) -> Style {
+        self.fg(Color::Blue)
+    }
+    #[inline]
+    pub fn magenta(self) -> Style {
+        self.fg(Color::Magenta)
+    }
+    #[inline]
+    pub fn cyan(self) -> Style {
+        self.fg(Color::Cyan)
+    }
+    #[inline]
+    pub fn white(self) -> Style {
+        self.fg(Color::White)
+    }
+    #[inline]
+    pub fn color256(self, color: u8) -> Style {
+        self.fg(Color::Color256(color))
+    }
+
+    #[inline]
+    pub fn bright(mut self) -> Style {
+        self.fg_bright = true;
+        self
+    }
+
+    #[inline]
+    pub fn on_black(self) -> Style {
+        self.bg(Color::Black)
+    }
+    #[inline]
+    pub fn on_red(self) -> Style {
+        self.bg(Color::Red)
+    }
+    #[inline]
+    pub fn on_green(self) -> Style {
+        self.bg(Color::Green)
+    }
+    #[inline]
+    pub fn on_yellow(self) -> Style {
+        self.bg(Color::Yellow)
+    }
+    #[inline]
+    pub fn on_blue(self) -> Style {
+        self.bg(Color::Blue)
+    }
+    #[inline]
+    pub fn on_magenta(self) -> Style {
+        self.bg(Color::Magenta)
+    }
+    #[inline]
+    pub fn on_cyan(self) -> Style {
+        self.bg(Color::Cyan)
+    }
+    #[inline]
+    pub fn on_white(self) -> Style {
+        self.bg(Color::White)
+    }
+    #[inline]
+    pub fn on_color256(self, color: u8) -> Style {
+        self.bg(Color::Color256(color))
+    }
+
+    #[inline]
+    pub fn on_bright(mut self) -> Style {
+        self.bg_bright = true;
+        self
+    }
+
+    #[inline]
+    pub fn bold(self) -> Style {
+        self.attr(Attribute::Bold)
+    }
+    #[inline]
+    pub fn dim(self) -> Style {
+        self.attr(Attribute::Dim)
+    }
+    #[inline]
+    pub fn italic(self) -> Style {
+        self.attr(Attribute::Italic)
+    }
+    #[inline]
+    pub fn underlined(self) -> Style {
+        self.attr(Attribute::Underlined)
+    }
+    #[inline]
+    pub fn blink(self) -> Style {
+        self.attr(Attribute::Blink)
+    }
+    #[inline]
+    pub fn reverse(self) -> Style {
+        self.attr(Attribute::Reverse)
+    }
+    #[inline]
+    pub fn hidden(self) -> Style {
+        self.attr(Attribute::Hidden)
+    }
+}
+
+/// Wraps an object for formatting for styling.
+///
+/// Example:
+///
+/// ```rust,no_run
+/// # use console::style;
+/// format!("Hello {}", style("World").cyan());
+/// ```
+///
+/// This is a shortcut for making a new style and applying it
+/// to a value:
+///
+/// ```rust,no_run
+/// # use console::Style;
+/// format!("Hello {}", Style::new().cyan().apply_to("World"));
+/// ```
+pub fn style<D>(val: D) -> StyledObject<D> {
+    Style::new().apply_to(val)
+}
+
+/// A formatting wrapper that can be styled for a terminal.
+#[derive(Clone)]
+pub struct StyledObject<D> {
+    style: Style,
+    val: D,
+}
+
+impl<D> StyledObject<D> {
+    /// Forces styling on or off.
+    ///
+    /// This overrides the detection from `clicolors-control`.
+    #[inline]
+    pub fn force_styling(mut self, value: bool) -> StyledObject<D> {
+        self.style = self.style.force_styling(value);
+        self
+    }
+
+    /// Specifies that style is applying to something being written on stderr
+    #[inline]
+    pub fn for_stderr(mut self) -> StyledObject<D> {
+        self.style = self.style.for_stderr();
+        self
+    }
+
+    /// Specifies that style is applying to something being written on stdout
+    ///
+    /// This is the default
+    #[inline]
+    pub fn for_stdout(mut self) -> StyledObject<D> {
+        self.style = self.style.for_stdout();
+        self
+    }
+
+    /// Sets a foreground color.
+    #[inline]
+    pub fn fg(mut self, color: Color) -> StyledObject<D> {
+        self.style = self.style.fg(color);
+        self
+    }
+
+    /// Sets a background color.
+    #[inline]
+    pub fn bg(mut self, color: Color) -> StyledObject<D> {
+        self.style = self.style.bg(color);
+        self
+    }
+
+    /// Adds a attr.
+    #[inline]
+    pub fn attr(mut self, attr: Attribute) -> StyledObject<D> {
+        self.style = self.style.attr(attr);
+        self
+    }
+
+    #[inline]
+    pub fn black(self) -> StyledObject<D> {
+        self.fg(Color::Black)
+    }
+    #[inline]
+    pub fn red(self) -> StyledObject<D> {
+        self.fg(Color::Red)
+    }
+    #[inline]
+    pub fn green(self) -> StyledObject<D> {
+        self.fg(Color::Green)
+    }
+    #[inline]
+    pub fn yellow(self) -> StyledObject<D> {
+        self.fg(Color::Yellow)
+    }
+    #[inline]
+    pub fn blue(self) -> StyledObject<D> {
+        self.fg(Color::Blue)
+    }
+    #[inline]
+    pub fn magenta(self) -> StyledObject<D> {
+        self.fg(Color::Magenta)
+    }
+    #[inline]
+    pub fn cyan(self) -> StyledObject<D> {
+        self.fg(Color::Cyan)
+    }
+    #[inline]
+    pub fn white(self) -> StyledObject<D> {
+        self.fg(Color::White)
+    }
+    #[inline]
+    pub fn color256(self, color: u8) -> StyledObject<D> {
+        self.fg(Color::Color256(color))
+    }
+
+    #[inline]
+    pub fn bright(mut self) -> StyledObject<D> {
+        self.style = self.style.bright();
+        self
+    }
+
+    #[inline]
+    pub fn on_black(self) -> StyledObject<D> {
+        self.bg(Color::Black)
+    }
+    #[inline]
+    pub fn on_red(self) -> StyledObject<D> {
+        self.bg(Color::Red)
+    }
+    #[inline]
+    pub fn on_green(self) -> StyledObject<D> {
+        self.bg(Color::Green)
+    }
+    #[inline]
+    pub fn on_yellow(self) -> StyledObject<D> {
+        self.bg(Color::Yellow)
+    }
+    #[inline]
+    pub fn on_blue(self) -> StyledObject<D> {
+        self.bg(Color::Blue)
+    }
+    #[inline]
+    pub fn on_magenta(self) -> StyledObject<D> {
+        self.bg(Color::Magenta)
+    }
+    #[inline]
+    pub fn on_cyan(self) -> StyledObject<D> {
+        self.bg(Color::Cyan)
+    }
+    #[inline]
+    pub fn on_white(self) -> StyledObject<D> {
+        self.bg(Color::White)
+    }
+    #[inline]
+    pub fn on_color256(self, color: u8) -> StyledObject<D> {
+        self.bg(Color::Color256(color))
+    }
+
+    #[inline]
+    pub fn on_bright(mut self) -> StyledObject<D> {
+        self.style = self.style.on_bright();
+        self
+    }
+
+    #[inline]
+    pub fn bold(self) -> StyledObject<D> {
+        self.attr(Attribute::Bold)
+    }
+    #[inline]
+    pub fn dim(self) -> StyledObject<D> {
+        self.attr(Attribute::Dim)
+    }
+    #[inline]
+    pub fn italic(self) -> StyledObject<D> {
+        self.attr(Attribute::Italic)
+    }
+    #[inline]
+    pub fn underlined(self) -> StyledObject<D> {
+        self.attr(Attribute::Underlined)
+    }
+    #[inline]
+    pub fn blink(self) -> StyledObject<D> {
+        self.attr(Attribute::Blink)
+    }
+    #[inline]
+    pub fn reverse(self) -> StyledObject<D> {
+        self.attr(Attribute::Reverse)
+    }
+    #[inline]
+    pub fn hidden(self) -> StyledObject<D> {
+        self.attr(Attribute::Hidden)
+    }
+}
+
+macro_rules! impl_fmt {
+    ($name:ident) => {
+        impl<D: fmt::$name> fmt::$name for StyledObject<D> {
+            fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+                let mut reset = false;
+                if self
+                    .style
+                    .force
+                    .unwrap_or_else(|| match self.style.for_stderr {
+                        true => colors_enabled_stderr(),
+                        false => colors_enabled(),
+                    })
+                {
+                    if let Some(fg) = self.style.fg {
+                        if fg.is_color256() {
+                            write!(f, "\x1b[38;5;{}m", fg.ansi_num())?;
+                        } else if self.style.fg_bright {
+                            write!(f, "\x1b[38;5;{}m", fg.ansi_num() + 8)?;
+                        } else {
+                            write!(f, "\x1b[{}m", fg.ansi_num() + 30)?;
+                        }
+                        reset = true;
+                    }
+                    if let Some(bg) = self.style.bg {
+                        if bg.is_color256() {
+                            write!(f, "\x1b[48;5;{}m", bg.ansi_num())?;
+                        } else if self.style.bg_bright {
+                            write!(f, "\x1b[48;5;{}m", bg.ansi_num() + 8)?;
+                        } else {
+                            write!(f, "\x1b[{}m", bg.ansi_num() + 40)?;
+                        }
+                        reset = true;
+                    }
+                    for attr in &self.style.attrs {
+                        write!(f, "\x1b[{}m", attr.ansi_num())?;
+                        reset = true;
+                    }
+                }
+                fmt::$name::fmt(&self.val, f)?;
+                if reset {
+                    write!(f, "\x1b[0m")?;
+                }
+                Ok(())
+            }
+        }
+    };
+}
+
+impl_fmt!(Binary);
+impl_fmt!(Debug);
+impl_fmt!(Display);
+impl_fmt!(LowerExp);
+impl_fmt!(LowerHex);
+impl_fmt!(Octal);
+impl_fmt!(Pointer);
+impl_fmt!(UpperExp);
+impl_fmt!(UpperHex);
+
+/// "Intelligent" emoji formatter.
+///
+/// This struct intelligently wraps an emoji so that it is rendered
+/// only on systems that want emojis and renders a fallback on others.
+///
+/// Example:
+///
+/// ```rust
+/// use console::Emoji;
+/// println!("[3/4] {}Downloading ...", Emoji("🚚 ", ""));
+/// println!("[4/4] {} Done!", Emoji("✨", ":-)"));
+/// ```
+#[derive(Copy, Clone)]
+pub struct Emoji<'a, 'b>(pub &'a str, pub &'b str);
+
+impl<'a, 'b> Emoji<'a, 'b> {
+    pub fn new(emoji: &'a str, fallback: &'b str) -> Emoji<'a, 'b> {
+        Emoji(emoji, fallback)
+    }
+}
+
+impl<'a, 'b> fmt::Display for Emoji<'a, 'b> {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        if wants_emoji() {
+            write!(f, "{}", self.0)
+        } else {
+            write!(f, "{}", self.1)
+        }
+    }
+}
+
+fn str_width(s: &str) -> usize {
+    #[cfg(feature = "unicode-width")]
+    {
+        use unicode_width::UnicodeWidthStr;
+        s.width()
+    }
+    #[cfg(not(feature = "unicode-width"))]
+    {
+        s.chars().count()
+    }
+}
+
+#[cfg(feature = "ansi-parsing")]
+fn char_width(c: char) -> usize {
+    #[cfg(feature = "unicode-width")]
+    {
+        use unicode_width::UnicodeWidthChar;
+        c.width().unwrap_or(0)
+    }
+    #[cfg(not(feature = "unicode-width"))]
+    {
+        let _c = c;
+        1
+    }
+}
+
+/// Truncates a string to a certain number of characters.
+///
+/// This ensures that escape codes are not screwed up in the process.
+/// If the maximum length is hit the string will be truncated but
+/// escapes code will still be honored.  If truncation takes place
+/// the tail string will be appended.
+pub fn truncate_str<'a>(s: &'a str, width: usize, tail: &str) -> Cow<'a, str> {
+    #[cfg(feature = "ansi-parsing")]
+    {
+        use std::cmp::Ordering;
+        let mut iter = AnsiCodeIterator::new(s);
+        let mut length = 0;
+        let mut rv = None;
+
+        while let Some(item) = iter.next() {
+            match item {
+                (s, false) => {
+                    if rv.is_none() {
+                        if str_width(s) + length > width - str_width(tail) {
+                            let ts = iter.current_slice();
+
+                            let mut s_byte = 0;
+                            let mut s_width = 0;
+                            let rest_width = width - str_width(tail) - length;
+                            for c in s.chars() {
+                                s_byte += c.len_utf8();
+                                s_width += char_width(c);
+                                match s_width.cmp(&rest_width) {
+                                    Ordering::Equal => break,
+                                    Ordering::Greater => {
+                                        s_byte -= c.len_utf8();
+                                        break;
+                                    }
+                                    Ordering::Less => continue,
+                                }
+                            }
+
+                            let idx = ts.len() - s.len() + s_byte;
+                            let mut buf = ts[..idx].to_string();
+                            buf.push_str(tail);
+                            rv = Some(buf);
+                        }
+                        length += str_width(s);
+                    }
+                }
+                (s, true) => {
+                    if rv.is_some() {
+                        rv.as_mut().unwrap().push_str(s);
+                    }
+                }
+            }
+        }
+
+        if let Some(buf) = rv {
+            Cow::Owned(buf)
+        } else {
+            Cow::Borrowed(s)
+        }
+    }
+
+    #[cfg(not(feature = "ansi-parsing"))]
+    {
+        if s.len() <= width - tail.len() {
+            Cow::Borrowed(s)
+        } else {
+            Cow::Owned(format!(
+                "{}{}",
+                s.get(..width - tail.len()).unwrap_or_default(),
+                tail
+            ))
+        }
+    }
+}
+
+/// Pads a string to fill a certain number of characters.
+///
+/// This will honor ansi codes correctly and allows you to align a string
+/// on the left, right or centered.  Additionally truncation can be enabled
+/// by setting `truncate` to a string that should be used as a truncation
+/// marker.
+pub fn pad_str<'a>(
+    s: &'a str,
+    width: usize,
+    align: Alignment,
+    truncate: Option<&str>,
+) -> Cow<'a, str> {
+    pad_str_with(s, width, align, truncate, ' ')
+}
+/// Pads a string with specific padding to fill a certain number of characters.
+///
+/// This will honor ansi codes correctly and allows you to align a string
+/// on the left, right or centered.  Additionally truncation can be enabled
+/// by setting `truncate` to a string that should be used as a truncation
+/// marker.
+pub fn pad_str_with<'a>(
+    s: &'a str,
+    width: usize,
+    align: Alignment,
+    truncate: Option<&str>,
+    pad: char,
+) -> Cow<'a, str> {
+    let cols = measure_text_width(s);
+
+    if cols >= width {
+        return match truncate {
+            None => Cow::Borrowed(s),
+            Some(tail) => truncate_str(s, width, tail),
+        };
+    }
+
+    let diff = width - cols;
+
+    let (left_pad, right_pad) = match align {
+        Alignment::Left => (0, diff),
+        Alignment::Right => (diff, 0),
+        Alignment::Center => (diff / 2, diff - diff / 2),
+    };
+
+    let mut rv = String::new();
+    for _ in 0..left_pad {
+        rv.push(pad);
+    }
+    rv.push_str(s);
+    for _ in 0..right_pad {
+        rv.push(pad);
+    }
+    Cow::Owned(rv)
+}
+
+#[test]
+fn test_text_width() {
+    let s = style("foo")
+        .red()
+        .on_black()
+        .bold()
+        .force_styling(true)
+        .to_string();
+    assert_eq!(
+        measure_text_width(&s),
+        if cfg!(feature = "ansi-parsing") {
+            3
+        } else if cfg!(feature = "unicode-width") {
+            17
+        } else {
+            21
+        }
+    );
+}
+
+#[test]
+#[cfg(all(feature = "unicode-width", feature = "ansi-parsing"))]
+fn test_truncate_str() {
+    let s = format!("foo {}", style("bar").red().force_styling(true));
+    assert_eq!(
+        &truncate_str(&s, 5, ""),
+        &format!("foo {}", style("b").red().force_styling(true))
+    );
+    let s = format!("foo {}", style("bar").red().force_styling(true));
+    assert_eq!(
+        &truncate_str(&s, 5, "!"),
+        &format!("foo {}", style("!").red().force_styling(true))
+    );
+    let s = format!("foo {} baz", style("bar").red().force_styling(true));
+    assert_eq!(
+        &truncate_str(&s, 10, "..."),
+        &format!("foo {}...", style("bar").red().force_styling(true))
+    );
+    let s = format!("foo {}", style("バー").red().force_styling(true));
+    assert_eq!(
+        &truncate_str(&s, 5, ""),
+        &format!("foo {}", style("").red().force_styling(true))
+    );
+    let s = format!("foo {}", style("バー").red().force_styling(true));
+    assert_eq!(
+        &truncate_str(&s, 6, ""),
+        &format!("foo {}", style("バ").red().force_styling(true))
+    );
+}
+
+#[test]
+fn test_truncate_str_no_ansi() {
+    assert_eq!(&truncate_str("foo bar", 5, ""), "foo b");
+    assert_eq!(&truncate_str("foo bar", 5, "!"), "foo !");
+    assert_eq!(&truncate_str("foo bar baz", 10, "..."), "foo bar...");
+}
+
+#[test]
+fn test_pad_str() {
+    assert_eq!(pad_str("foo", 7, Alignment::Center, None), "  foo  ");
+    assert_eq!(pad_str("foo", 7, Alignment::Left, None), "foo    ");
+    assert_eq!(pad_str("foo", 7, Alignment::Right, None), "    foo");
+    assert_eq!(pad_str("foo", 3, Alignment::Left, None), "foo");
+    assert_eq!(pad_str("foobar", 3, Alignment::Left, None), "foobar");
+    assert_eq!(pad_str("foobar", 3, Alignment::Left, Some("")), "foo");
+    assert_eq!(
+        pad_str("foobarbaz", 6, Alignment::Left, Some("...")),
+        "foo..."
+    );
+}
+
+#[test]
+fn test_pad_str_with() {
+    assert_eq!(
+        pad_str_with("foo", 7, Alignment::Center, None, '#'),
+        "##foo##"
+    );
+    assert_eq!(
+        pad_str_with("foo", 7, Alignment::Left, None, '#'),
+        "foo####"
+    );
+    assert_eq!(
+        pad_str_with("foo", 7, Alignment::Right, None, '#'),
+        "####foo"
+    );
+    assert_eq!(pad_str_with("foo", 3, Alignment::Left, None, '#'), "foo");
+    assert_eq!(
+        pad_str_with("foobar", 3, Alignment::Left, None, '#'),
+        "foobar"
+    );
+    assert_eq!(
+        pad_str_with("foobar", 3, Alignment::Left, Some(""), '#'),
+        "foo"
+    );
+    assert_eq!(
+        pad_str_with("foobarbaz", 6, Alignment::Left, Some("..."), '#'),
+        "foo..."
+    );
+}
diff --git a/android/vendor/console-0.15.0/src/wasm_term.rs b/android/vendor/console-0.15.0/src/wasm_term.rs
new file mode 100644
index 0000000..677e9e2
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/wasm_term.rs
@@ -0,0 +1,45 @@
+use std::fmt::Display;
+use std::io;
+
+use crate::kb::Key;
+use crate::term::Term;
+
+pub use crate::common_term::*;
+
+pub const DEFAULT_WIDTH: u16 = 80;
+
+#[inline]
+pub fn is_a_terminal(_out: &Term) -> bool {
+    false
+}
+
+#[inline]
+pub fn is_a_color_terminal(_out: &Term) -> bool {
+    false
+}
+
+#[inline]
+pub fn terminal_size(_out: &Term) -> Option<(u16, u16)> {
+    None
+}
+
+pub fn read_secure() -> io::Result<String> {
+    Err(io::Error::new(
+        io::ErrorKind::Other,
+        "unsupported operation",
+    ))
+}
+
+pub fn read_single_key() -> io::Result<Key> {
+    Err(io::Error::new(
+        io::ErrorKind::Other,
+        "unsupported operation",
+    ))
+}
+
+#[inline]
+pub fn wants_emoji() -> bool {
+    false
+}
+
+pub fn set_title<T: Display>(_title: T) {}
diff --git a/android/vendor/console-0.15.0/src/windows_term.rs b/android/vendor/console-0.15.0/src/windows_term.rs
new file mode 100644
index 0000000..77ee4ef
--- /dev/null
+++ b/android/vendor/console-0.15.0/src/windows_term.rs
@@ -0,0 +1,601 @@
+use std::cmp;
+use std::env;
+use std::ffi::OsStr;
+use std::fmt::Display;
+use std::io;
+use std::iter::once;
+use std::mem;
+use std::os::windows::ffi::OsStrExt;
+use std::os::windows::io::AsRawHandle;
+use std::slice;
+use std::{char, mem::MaybeUninit};
+
+use encode_unicode::error::InvalidUtf16Tuple;
+use encode_unicode::CharExt;
+use winapi::ctypes::c_void;
+use winapi::shared::minwindef::DWORD;
+use winapi::shared::minwindef::MAX_PATH;
+use winapi::um::consoleapi::{GetConsoleMode, SetConsoleMode};
+use winapi::um::consoleapi::{GetNumberOfConsoleInputEvents, ReadConsoleInputW};
+use winapi::um::fileapi::FILE_NAME_INFO;
+use winapi::um::handleapi::INVALID_HANDLE_VALUE;
+use winapi::um::minwinbase::FileNameInfo;
+use winapi::um::processenv::GetStdHandle;
+use winapi::um::winbase::GetFileInformationByHandleEx;
+use winapi::um::winbase::{STD_ERROR_HANDLE, STD_INPUT_HANDLE, STD_OUTPUT_HANDLE};
+use winapi::um::wincon::{
+    FillConsoleOutputAttribute, FillConsoleOutputCharacterA, GetConsoleCursorInfo,
+    GetConsoleScreenBufferInfo, SetConsoleCursorInfo, SetConsoleCursorPosition, SetConsoleTitleW,
+    CONSOLE_CURSOR_INFO, CONSOLE_SCREEN_BUFFER_INFO, COORD, INPUT_RECORD, KEY_EVENT,
+    KEY_EVENT_RECORD,
+};
+use winapi::um::winnt::{CHAR, HANDLE, INT, WCHAR};
+#[cfg(feature = "windows-console-colors")]
+use winapi_util::console::{Color, Console, Intense};
+
+use crate::common_term;
+use crate::kb::Key;
+use crate::term::{Term, TermTarget};
+
+#[cfg(feature = "windows-console-colors")]
+use once_cell::sync::Lazy;
+#[cfg(feature = "windows-console-colors")]
+use regex::Regex;
+#[cfg(feature = "windows-console-colors")]
+static INTENSE_COLOR_RE: Lazy<Regex> =
+    Lazy::new(|| Regex::new(r"\x1b\[(3|4)8;5;(8|9|1[0-5])m").unwrap());
+#[cfg(feature = "windows-console-colors")]
+static NORMAL_COLOR_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"\x1b\[(3|4)([0-7])m").unwrap());
+#[cfg(feature = "windows-console-colors")]
+static ATTR_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"\x1b\[([1-8])m").unwrap());
+
+const ENABLE_VIRTUAL_TERMINAL_PROCESSING: u32 = 0x4;
+pub const DEFAULT_WIDTH: u16 = 79;
+
+pub fn as_handle(term: &Term) -> HANDLE {
+    // convert between winapi::um::winnt::HANDLE and std::os::windows::raw::HANDLE
+    // which are both c_void. would be nice to find a better way to do this
+    term.as_raw_handle() as HANDLE
+}
+
+pub fn is_a_terminal(out: &Term) -> bool {
+    let (fd, others) = match out.target() {
+        TermTarget::Stdout => (STD_OUTPUT_HANDLE, [STD_INPUT_HANDLE, STD_ERROR_HANDLE]),
+        TermTarget::Stderr => (STD_ERROR_HANDLE, [STD_INPUT_HANDLE, STD_OUTPUT_HANDLE]),
+    };
+
+    if unsafe { console_on_any(&[fd]) } {
+        // False positives aren't possible. If we got a console then
+        // we definitely have a tty on stdin.
+        return true;
+    }
+
+    // At this point, we *could* have a false negative. We can determine that
+    // this is true negative if we can detect the presence of a console on
+    // any of the other streams. If another stream has a console, then we know
+    // we're in a Windows console and can therefore trust the negative.
+    if unsafe { console_on_any(&others) } {
+        return false;
+    }
+
+    msys_tty_on(out)
+}
+
+pub fn is_a_color_terminal(out: &Term) -> bool {
+    if !is_a_terminal(out) {
+        return false;
+    }
+    if msys_tty_on(out) {
+        return match env::var("TERM") {
+            Ok(term) => term != "dumb",
+            Err(_) => true,
+        };
+    }
+    enable_ansi_on(out)
+}
+
+fn enable_ansi_on(out: &Term) -> bool {
+    unsafe {
+        let handle = as_handle(out);
+
+        let mut dw_mode = 0;
+        if GetConsoleMode(handle, &mut dw_mode) == 0 {
+            return false;
+        }
+
+        dw_mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+        if SetConsoleMode(handle, dw_mode) == 0 {
+            return false;
+        }
+
+        true
+    }
+}
+
+unsafe fn console_on_any(fds: &[DWORD]) -> bool {
+    for &fd in fds {
+        let mut out = 0;
+        let handle = GetStdHandle(fd);
+        if GetConsoleMode(handle, &mut out) != 0 {
+            return true;
+        }
+    }
+    false
+}
+
+#[inline]
+pub fn terminal_size(out: &Term) -> Option<(u16, u16)> {
+    terminal_size::terminal_size_using_handle(out.as_raw_handle()).map(|x| ((x.1).0, (x.0).0))
+}
+
+pub fn move_cursor_to(out: &Term, x: usize, y: usize) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::move_cursor_to(out, x, y);
+    }
+    if let Some((hand, _)) = get_console_screen_buffer_info(as_handle(out)) {
+        unsafe {
+            SetConsoleCursorPosition(
+                hand,
+                COORD {
+                    X: x as i16,
+                    Y: y as i16,
+                },
+            );
+        }
+    }
+    Ok(())
+}
+
+pub fn move_cursor_up(out: &Term, n: usize) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::move_cursor_up(out, n);
+    }
+
+    if let Some((_, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        move_cursor_to(out, 0, csbi.dwCursorPosition.Y as usize - n)?;
+    }
+    Ok(())
+}
+
+pub fn move_cursor_down(out: &Term, n: usize) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::move_cursor_down(out, n);
+    }
+
+    if let Some((_, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        move_cursor_to(out, 0, csbi.dwCursorPosition.Y as usize + n)?;
+    }
+    Ok(())
+}
+
+pub fn move_cursor_left(out: &Term, n: usize) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::move_cursor_left(out, n);
+    }
+
+    if let Some((_, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        move_cursor_to(
+            out,
+            csbi.dwCursorPosition.X as usize - n,
+            csbi.dwCursorPosition.Y as usize,
+        )?;
+    }
+    Ok(())
+}
+
+pub fn move_cursor_right(out: &Term, n: usize) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::move_cursor_right(out, n);
+    }
+
+    if let Some((_, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        move_cursor_to(
+            out,
+            csbi.dwCursorPosition.X as usize + n,
+            csbi.dwCursorPosition.Y as usize,
+        )?;
+    }
+    Ok(())
+}
+
+pub fn clear_line(out: &Term) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::clear_line(out);
+    }
+    if let Some((hand, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        unsafe {
+            let width = csbi.srWindow.Right - csbi.srWindow.Left;
+            let pos = COORD {
+                X: 0,
+                Y: csbi.dwCursorPosition.Y,
+            };
+            let mut written = 0;
+            FillConsoleOutputCharacterA(hand, b' ' as CHAR, width as DWORD, pos, &mut written);
+            FillConsoleOutputAttribute(hand, csbi.wAttributes, width as DWORD, pos, &mut written);
+            SetConsoleCursorPosition(hand, pos);
+        }
+    }
+    Ok(())
+}
+
+pub fn clear_chars(out: &Term, n: usize) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::clear_chars(out, n);
+    }
+    if let Some((hand, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        unsafe {
+            let width = cmp::min(csbi.dwCursorPosition.X, n as i16);
+            let pos = COORD {
+                X: csbi.dwCursorPosition.X - width,
+                Y: csbi.dwCursorPosition.Y,
+            };
+            let mut written = 0;
+            FillConsoleOutputCharacterA(hand, b' ' as CHAR, width as DWORD, pos, &mut written);
+            FillConsoleOutputAttribute(hand, csbi.wAttributes, width as DWORD, pos, &mut written);
+            SetConsoleCursorPosition(hand, pos);
+        }
+    }
+    Ok(())
+}
+
+pub fn clear_screen(out: &Term) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::clear_screen(out);
+    }
+    if let Some((hand, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        unsafe {
+            let cells = csbi.dwSize.X as DWORD * csbi.dwSize.Y as DWORD; // as DWORD, or else this causes stack overflows.
+            let pos = COORD { X: 0, Y: 0 };
+            let mut written = 0;
+            FillConsoleOutputCharacterA(hand, b' ' as CHAR, cells, pos, &mut written); // cells as DWORD no longer needed.
+            FillConsoleOutputAttribute(hand, csbi.wAttributes, cells, pos, &mut written);
+            SetConsoleCursorPosition(hand, pos);
+        }
+    }
+    Ok(())
+}
+
+pub fn clear_to_end_of_screen(out: &Term) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::clear_to_end_of_screen(out);
+    }
+    if let Some((hand, csbi)) = get_console_screen_buffer_info(as_handle(out)) {
+        unsafe {
+            let bottom = csbi.srWindow.Right as DWORD * csbi.srWindow.Bottom as DWORD;
+            let cells =
+                bottom - (csbi.dwCursorPosition.X as DWORD * csbi.dwCursorPosition.Y as DWORD); // as DWORD, or else this causes stack overflows.
+            let pos = COORD {
+                X: 0,
+                Y: csbi.dwCursorPosition.Y,
+            };
+            let mut written = 0;
+            FillConsoleOutputCharacterA(hand, b' ' as CHAR, cells, pos, &mut written); // cells as DWORD no longer needed.
+            FillConsoleOutputAttribute(hand, csbi.wAttributes, cells, pos, &mut written);
+            SetConsoleCursorPosition(hand, pos);
+        }
+    }
+    Ok(())
+}
+
+pub fn show_cursor(out: &Term) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::show_cursor(out);
+    }
+    if let Some((hand, mut cci)) = get_console_cursor_info(as_handle(out)) {
+        unsafe {
+            cci.bVisible = 1;
+            SetConsoleCursorInfo(hand, &cci);
+        }
+    }
+    Ok(())
+}
+
+pub fn hide_cursor(out: &Term) -> io::Result<()> {
+    if out.is_msys_tty {
+        return common_term::hide_cursor(out);
+    }
+    if let Some((hand, mut cci)) = get_console_cursor_info(as_handle(out)) {
+        unsafe {
+            cci.bVisible = 0;
+            SetConsoleCursorInfo(hand, &cci);
+        }
+    }
+    Ok(())
+}
+
+fn get_console_screen_buffer_info(hand: HANDLE) -> Option<(HANDLE, CONSOLE_SCREEN_BUFFER_INFO)> {
+    let mut csbi: CONSOLE_SCREEN_BUFFER_INFO = unsafe { mem::zeroed() };
+    match unsafe { GetConsoleScreenBufferInfo(hand, &mut csbi) } {
+        0 => None,
+        _ => Some((hand, csbi)),
+    }
+}
+
+fn get_console_cursor_info(hand: HANDLE) -> Option<(HANDLE, CONSOLE_CURSOR_INFO)> {
+    let mut cci: CONSOLE_CURSOR_INFO = unsafe { mem::zeroed() };
+    match unsafe { GetConsoleCursorInfo(hand, &mut cci) } {
+        0 => None,
+        _ => Some((hand, cci)),
+    }
+}
+
+pub fn key_from_key_code(code: INT) -> Key {
+    match code {
+        winapi::um::winuser::VK_LEFT => Key::ArrowLeft,
+        winapi::um::winuser::VK_RIGHT => Key::ArrowRight,
+        winapi::um::winuser::VK_UP => Key::ArrowUp,
+        winapi::um::winuser::VK_DOWN => Key::ArrowDown,
+        winapi::um::winuser::VK_RETURN => Key::Enter,
+        winapi::um::winuser::VK_ESCAPE => Key::Escape,
+        winapi::um::winuser::VK_BACK => Key::Backspace,
+        winapi::um::winuser::VK_TAB => Key::Tab,
+        winapi::um::winuser::VK_HOME => Key::Home,
+        winapi::um::winuser::VK_END => Key::End,
+        winapi::um::winuser::VK_DELETE => Key::Del,
+        winapi::um::winuser::VK_SHIFT => Key::Shift,
+        winapi::um::winuser::VK_MENU => Key::Alt,
+        _ => Key::Unknown,
+    }
+}
+
+pub fn read_secure() -> io::Result<String> {
+    let mut rv = String::new();
+    loop {
+        match read_single_key()? {
+            Key::Enter => {
+                break;
+            }
+            Key::Char('\x08') => {
+                if !rv.is_empty() {
+                    let new_len = rv.len() - 1;
+                    rv.truncate(new_len);
+                }
+            }
+            Key::Char(c) => {
+                rv.push(c);
+            }
+            _ => {}
+        }
+    }
+    Ok(rv)
+}
+
+pub fn read_single_key() -> io::Result<Key> {
+    let key_event = read_key_event()?;
+
+    let unicode_char = unsafe { *key_event.uChar.UnicodeChar() };
+    if unicode_char == 0 {
+        Ok(key_from_key_code(key_event.wVirtualKeyCode as INT))
+    } else {
+        // This is a unicode character, in utf-16. Try to decode it by itself.
+        match char::from_utf16_tuple((unicode_char, None)) {
+            Ok(c) => {
+                // Maintain backward compatibility. The previous implementation (_getwch()) would return
+                // a special keycode for `Enter`, while ReadConsoleInputW() prefers to use '\r'.
+                if c == '\r' {
+                    Ok(Key::Enter)
+                } else if c == '\x08' {
+                    Ok(Key::Backspace)
+                } else if c == '\x1B' {
+                    Ok(Key::Escape)
+                } else {
+                    Ok(Key::Char(c))
+                }
+            }
+            // This is part of a surrogate pair. Try to read the second half.
+            Err(InvalidUtf16Tuple::MissingSecond) => {
+                // Confirm that there is a next character to read.
+                if get_key_event_count()? == 0 {
+                    let message = format!(
+                        "Read invlid utf16 {}: {}",
+                        unicode_char,
+                        InvalidUtf16Tuple::MissingSecond
+                    );
+                    return Err(io::Error::new(io::ErrorKind::InvalidData, message));
+                }
+
+                // Read the next character.
+                let next_event = read_key_event()?;
+                let next_surrogate = unsafe { *next_event.uChar.UnicodeChar() };
+
+                // Attempt to decode it.
+                match char::from_utf16_tuple((unicode_char, Some(next_surrogate))) {
+                    Ok(c) => Ok(Key::Char(c)),
+
+                    // Return an InvalidData error. This is the recommended value for UTF-related I/O errors.
+                    // (This error is given when reading a non-UTF8 file into a String, for example.)
+                    Err(e) => {
+                        let message = format!(
+                            "Read invalid surrogate pair ({}, {}): {}",
+                            unicode_char, next_surrogate, e
+                        );
+                        Err(io::Error::new(io::ErrorKind::InvalidData, message))
+                    }
+                }
+            }
+
+            // Return an InvalidData error. This is the recommended value for UTF-related I/O errors.
+            // (This error is given when reading a non-UTF8 file into a String, for example.)
+            Err(e) => {
+                let message = format!("Read invalid utf16 {}: {}", unicode_char, e);
+                Err(io::Error::new(io::ErrorKind::InvalidData, message))
+            }
+        }
+    }
+}
+
+fn get_stdin_handle() -> io::Result<HANDLE> {
+    let handle = unsafe { GetStdHandle(STD_INPUT_HANDLE) };
+    if handle == INVALID_HANDLE_VALUE {
+        Err(io::Error::last_os_error())
+    } else {
+        Ok(handle)
+    }
+}
+
+/// Get the number of pending events in the ReadConsoleInput queue. Note that while
+/// these aren't necessarily key events, the only way that multiple events can be
+/// put into the queue simultaneously is if a unicode character spanning multiple u16's
+/// is read.
+///
+/// Therefore, this is accurate as long as at least one KEY_EVENT has already been read.
+fn get_key_event_count() -> io::Result<DWORD> {
+    let handle = get_stdin_handle()?;
+    let mut event_count: DWORD = unsafe { mem::zeroed() };
+
+    let success = unsafe { GetNumberOfConsoleInputEvents(handle, &mut event_count) };
+    if success == 0 {
+        Err(io::Error::last_os_error())
+    } else {
+        Ok(event_count)
+    }
+}
+
+fn read_key_event() -> io::Result<KEY_EVENT_RECORD> {
+    let handle = get_stdin_handle()?;
+    let mut buffer: INPUT_RECORD = unsafe { mem::zeroed() };
+
+    let mut events_read: DWORD = unsafe { mem::zeroed() };
+
+    let mut key_event: KEY_EVENT_RECORD;
+    loop {
+        let success = unsafe { ReadConsoleInputW(handle, &mut buffer, 1, &mut events_read) };
+        if success == 0 {
+            return Err(io::Error::last_os_error());
+        }
+        if events_read == 0 {
+            return Err(io::Error::new(
+                io::ErrorKind::Other,
+                "ReadConsoleInput returned no events, instead of waiting for an event",
+            ));
+        }
+
+        if events_read == 1 && buffer.EventType != KEY_EVENT {
+            // This isn't a key event; ignore it.
+            continue;
+        }
+
+        key_event = unsafe { mem::transmute(buffer.Event) };
+
+        if key_event.bKeyDown == 0 {
+            // This is a key being released; ignore it.
+            continue;
+        }
+
+        return Ok(key_event);
+    }
+}
+
+pub fn wants_emoji() -> bool {
+    // If WT_SESSION is set, we can assume we're running in the nne
+    // Windows Terminal.  The correct way to detect this is not available
+    // yet.  See https://github.com/microsoft/terminal/issues/1040
+    env::var("WT_SESSION").is_ok()
+}
+
+/// Returns true if there is an MSYS tty on the given handle.
+pub fn msys_tty_on(term: &Term) -> bool {
+    let handle = term.as_raw_handle();
+    unsafe {
+        // Check whether the Windows 10 native pty is enabled
+        {
+            let mut out = MaybeUninit::uninit();
+            let res = GetConsoleMode(handle as *mut _, out.as_mut_ptr());
+            if res != 0 // If res is true then out was initialized.
+                && (out.assume_init() & ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+                    == ENABLE_VIRTUAL_TERMINAL_PROCESSING
+            {
+                return true;
+            }
+        }
+
+        let size = mem::size_of::<FILE_NAME_INFO>();
+        let mut name_info_bytes = vec![0u8; size + MAX_PATH * mem::size_of::<WCHAR>()];
+        let res = GetFileInformationByHandleEx(
+            handle as *mut _,
+            FileNameInfo,
+            &mut *name_info_bytes as *mut _ as *mut c_void,
+            name_info_bytes.len() as u32,
+        );
+        if res == 0 {
+            return false;
+        }
+        let name_info: &FILE_NAME_INFO = &*(name_info_bytes.as_ptr() as *const FILE_NAME_INFO);
+        let s = slice::from_raw_parts(
+            name_info.FileName.as_ptr(),
+            name_info.FileNameLength as usize / 2,
+        );
+        let name = String::from_utf16_lossy(s);
+        // This checks whether 'pty' exists in the file name, which indicates that
+        // a pseudo-terminal is attached. To mitigate against false positives
+        // (e.g., an actual file name that contains 'pty'), we also require that
+        // either the strings 'msys-' or 'cygwin-' are in the file name as well.)
+        let is_msys = name.contains("msys-") || name.contains("cygwin-");
+        let is_pty = name.contains("-pty");
+        is_msys && is_pty
+    }
+}
+
+pub fn set_title<T: Display>(title: T) {
+    let buffer: Vec<u16> = OsStr::new(&format!("{}", title))
+        .encode_wide()
+        .chain(once(0))
+        .collect();
+    unsafe {
+        SetConsoleTitleW(buffer.as_ptr());
+    }
+}
+
+#[cfg(feature = "windows-console-colors")]
+pub fn console_colors(out: &Term, mut con: Console, bytes: &[u8]) -> io::Result<()> {
+    use crate::ansi::AnsiCodeIterator;
+    use std::str::from_utf8;
+
+    let s = from_utf8(bytes).expect("data to be printed is not an ansi string");
+    let mut iter = AnsiCodeIterator::new(s);
+
+    while !iter.rest_slice().is_empty() {
+        if let Some((part, is_esc)) = iter.next() {
+            if !is_esc {
+                out.write_through_common(part.as_bytes())?;
+            } else if part == "\x1b[0m" {
+                con.reset()?;
+            } else if let Some(cap) = INTENSE_COLOR_RE.captures(part) {
+                let color = get_color_from_ansi(cap.get(2).unwrap().as_str());
+
+                match cap.get(1).unwrap().as_str() {
+                    "3" => con.fg(Intense::Yes, color)?,
+                    "4" => con.bg(Intense::Yes, color)?,
+                    _ => unreachable!(),
+                };
+            } else if let Some(cap) = NORMAL_COLOR_RE.captures(part) {
+                let color = get_color_from_ansi(cap.get(2).unwrap().as_str());
+
+                match cap.get(1).unwrap().as_str() {
+                    "3" => con.fg(Intense::No, color)?,
+                    "4" => con.bg(Intense::No, color)?,
+                    _ => unreachable!(),
+                };
+            } else if !ATTR_RE.is_match(part) {
+                out.write_through_common(part.as_bytes())?;
+            }
+        }
+    }
+
+    Ok(())
+}
+
+#[cfg(feature = "windows-console-colors")]
+fn get_color_from_ansi(ansi: &str) -> Color {
+    match ansi {
+        "0" | "8" => Color::Black,
+        "1" | "9" => Color::Red,
+        "2" | "10" => Color::Green,
+        "3" | "11" => Color::Yellow,
+        "4" | "12" => Color::Blue,
+        "5" | "13" => Color::Magenta,
+        "6" | "14" => Color::Cyan,
+        "7" | "15" => Color::White,
+        _ => unreachable!(),
+    }
+}
diff --git a/android/vendor/crates-index-0.18.8/.cargo-checksum.json b/android/vendor/crates-index-0.18.8/.cargo-checksum.json
new file mode 100644
index 0000000..6ec0560
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"25de9ceb867b1e78457042bd4d28e0bec0b9e98b22b596d2fe34f3084eaf4356","LICENSE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","README.md":"9155c133aa7b1cedd65a0949ff571b57bcbd61733f4f014b33d5836af3c04d72","src/bare_index.rs":"9bc2599272d0100d17eaf0f200a080822598da418ca2beae66f1566408ef3628","src/dedupe.rs":"5d6b07d6512f7543e0739a56adf79023acbd3ceb0e591650a677e4b11d3ebab9","src/error.rs":"0364889a61cd01a37bb4885fe8210a999a9088dce4ca1daaf9111140165507fc","src/lib.rs":"0c9a95ebee8ae55ef099bccf0017710d1f7cbc7bd8e749dfb983cc4ed26e36a1","tests/mem.rs":"9fbeacb84ac1997b3e4634fba42734d303459d80f30f17d32b8a752c5dbbb754"},"package":"2519c91ad7a6e3250a64fb71162d2db1afe7bcf826a465f84d2052fd69639b7a"}
\ No newline at end of file
diff --git a/android/vendor/crates-index-0.18.8/Cargo.toml b/android/vendor/crates-index-0.18.8/Cargo.toml
new file mode 100644
index 0000000..e37d5f6
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/Cargo.toml
@@ -0,0 +1,96 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "crates-index"
+version = "0.18.8"
+authors = [
+    "Corey Farwell <coreyf@rwell.org>",
+    "Kornel <kornel@geekhood.net>",
+]
+description = "Library for retrieving and interacting with the crates.io index"
+homepage = "https://lib.rs/crates-index"
+documentation = "https://docs.rs/crates-index/"
+keywords = [
+    "packaging",
+    "index",
+    "dependencies",
+    "crate",
+    "meta",
+]
+categories = [
+    "development-tools",
+    "database",
+]
+license = "Apache-2.0"
+repository = "https://github.com/frewsxcv/rust-crates-index"
+
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
+
+[dependencies.git2]
+version = ">= 0.13.25, <0.15"
+default-features = false
+
+[dependencies.hex]
+version = "0.4.3"
+features = ["serde"]
+
+[dependencies.home]
+version = "0.5.3"
+
+[dependencies.memchr]
+version = "2.5.0"
+
+[dependencies.num_cpus]
+version = "1.13.1"
+
+[dependencies.rayon]
+version = "1.5.3"
+optional = true
+
+[dependencies.rustc-hash]
+version = "1.1.0"
+
+[dependencies.semver]
+version = "1.0.9"
+
+[dependencies.serde]
+version = "1.0.137"
+features = ["rc"]
+
+[dependencies.serde_derive]
+version = "1.0.137"
+
+[dependencies.serde_json]
+version = "1.0.81"
+
+[dependencies.smartstring]
+version = "1.0.1"
+features = ["serde"]
+
+[dev-dependencies.cap]
+version = "0.1.0"
+
+[dev-dependencies.tempfile]
+version = "3.3.0"
+
+[features]
+default = [
+    "git2/default",
+    "parallel",
+]
+parallel = ["rayon"]
+vendored-openssl = ["git2/vendored-openssl"]
+
+[badges.maintenance]
+status = "actively-developed"
diff --git a/android/vendor/crates-index-0.18.8/LICENSE b/android/vendor/crates-index-0.18.8/LICENSE
new file mode 100644
index 0000000..16fe87b
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/LICENSE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/crates-index-0.18.8/README.md b/android/vendor/crates-index-0.18.8/README.md
new file mode 100644
index 0000000..c6441ec
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/README.md
@@ -0,0 +1,37 @@
+# rust-crates-index
+
+[![crates-index on Crates.io](https://img.shields.io/crates/v/crates-index.svg)](https://lib.rs/crates/crates-index)
+
+Library for retrieving and interacting with the [crates.io registry git-based index](https://github.com/rust-lang/crates.io-index).
+
+[Documentation](https://docs.rs/crates-index/)
+
+## Example
+
+```rust
+let index = crates_index::Index::new_cargo_default()?;
+
+for crate_releases in index.crates() {
+    let _ = crate_releases.latest_version(); // any version most recently published
+    let crate_version = crate_releases.highest_version(); // max version by semver
+    println!("crate name: {}", crate_version.name());
+    println!("crate version: {}", crate_version.version());
+}
+```
+
+## Migration from 0.16 and 0.17
+
+* `BareIndex` and `BareIndexRepo` have become the `Index`.
+* `Index::new_cargo_default()?` is the preferred way of accessing the index. Use `with_path()` to clone to a different directory.
+* There's no need to call `retrieve()` or `exists()`. It's always retrieved and always exists.
+* `retrieve_or_update()` is just `update()`.
+* `highest_version()` returns crate metadata rather than just the version number. Call `highest_version().version().parse()` to get `semver::Version`.
+* There's no `crate_index_paths()`, because there are no files any more. Use `crate_` to get individual crates.
+
+## Similar crates
+
+- [`crates_io_api`](https://github.com/theduke/crates_io_api)
+
+## License
+
+Licensed under version 2 of the Apache License
diff --git a/android/vendor/crates-index-0.18.8/src/bare_index.rs b/android/vendor/crates-index-0.18.8/src/bare_index.rs
new file mode 100644
index 0000000..aa9bf37
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/src/bare_index.rs
@@ -0,0 +1,644 @@
+use crate::dedupe::DedupeContext;
+use crate::{Crate, CratesIterError, Error, IndexConfig};
+use git2::Repository;
+use std::fmt;
+
+use std::{
+    io,
+    path::{Path, PathBuf},
+};
+
+/// Wrapper around managing the crates.io-index git repository
+///
+/// Uses a "bare" git index that fetches files directly from the repo instead of local checkout.
+/// Uses Cargo's cache.
+pub struct Index {
+    path: PathBuf,
+    url: String,
+
+    repo: git2::Repository,
+    head: git2::Oid,
+    head_str: String,
+}
+
+impl Index {
+    #[doc(hidden)]
+    #[deprecated(note = "use new_cargo_default()")]
+    pub fn new<P: Into<PathBuf>>(path: P) -> Self {
+        Self::from_path_and_url(path.into(), crate::INDEX_GIT_URL.into()).unwrap()
+    }
+
+    /// Creates an index for the default crates.io registry, using the same
+    /// disk location as Cargo itself.
+    ///
+    /// This is the recommended way to access Cargo's index.
+    #[inline]
+    pub fn new_cargo_default() -> Result<Self, Error> {
+        Self::from_url(crate::INDEX_GIT_URL)
+    }
+
+    /// Creates a bare index from a provided URL, opening the same location on
+    /// disk that Cargo uses for that registry index.
+    ///
+    /// It can be used to access custom registries.
+    pub fn from_url(url: &str) -> Result<Self, Error> {
+        let (dir_name, canonical_url) = url_to_local_dir(url)?;
+        let mut path = home::cargo_home().unwrap_or_default();
+
+        path.push("registry/index");
+        path.push(dir_name);
+
+        Self::from_path_and_url(path, canonical_url)
+    }
+
+    /// Creates a bare index at the provided path with the specified repository URL.
+    #[inline]
+    pub fn with_path<P: Into<PathBuf>, S: Into<String>>(path: P, url: S) -> Result<Self, Error> {
+        Self::from_path_and_url(path.into(), url.into())
+    }
+
+    /// Get the index directory.
+    #[inline]
+    pub fn path(&self) -> &Path {
+        &self.path
+    }
+
+    /// Get the index url.
+    #[inline]
+    #[must_use]
+    pub fn url(&self) -> &str {
+        &self.url
+    }
+}
+
+impl Index {
+    fn from_path_and_url(path: PathBuf, url: String) -> Result<Self, Error> {
+        let exists = git2::Repository::discover(&path)
+            .map(|repository| {
+                repository
+                    .find_remote("origin")
+                    .ok()
+                    // Cargo creates a checkout without an origin set,
+                    // so default to true in case of missing origin
+                    .map_or(true, |remote| remote.url().map_or(true, |u| u == url))
+            })
+            .unwrap_or(false);
+
+        let repo = if !exists {
+            let mut opts = git2::RepositoryInitOptions::new();
+            opts.external_template(false);
+            let repo = git2::Repository::init_opts(&path, &opts)?;
+            {
+                let mut origin_remote = repo
+                    .find_remote("origin")
+                    .or_else(|_| repo.remote_anonymous(&url))?;
+
+                origin_remote.fetch(
+                    &[
+                        "HEAD:refs/remotes/origin/HEAD",
+                        "master:refs/remotes/origin/master",
+                    ],
+                    Some(&mut crate::fetch_opts()),
+                    None,
+                )?;
+            }
+            repo
+        } else {
+            git2::Repository::open(&path)?
+        };
+
+        let head = repo
+            // Fallback to HEAD, as a fresh clone won't have a FETCH_HEAD
+            .refname_to_id("FETCH_HEAD")
+            .or_else(|_| repo.refname_to_id("HEAD"))?;
+        let head_str = head.to_string();
+
+        Ok(Self {
+            path,
+            url,
+            head_str,
+            repo,
+            head,
+        })
+    }
+
+    fn tree(&self) -> Result<git2::Tree<'_>, git2::Error> {
+        let commit = self.repo.find_commit(self.head)?;
+        commit.tree()
+    }
+
+    #[doc(hidden)]
+    #[deprecated(note = "use update()")]
+    pub fn retrieve_or_update(&mut self) -> Result<(), Error> {
+        self.update()
+    }
+
+    #[doc(hidden)]
+    #[deprecated(note = "it's always retrieved. there's no need to call it any more")]
+    pub fn retrieve(&self) -> Result<(), Error> {
+        Ok(())
+    }
+
+    #[doc(hidden)]
+    #[deprecated(note = "it's always retrieved, so it's assumed to always exist")]
+    pub fn exists(&self) -> bool {
+        true
+    }
+
+    /// Fetches latest from the remote index repository. Note that using this
+    /// method will mean no cache entries will be used, if a new commit is fetched
+    /// from the repository, as their commit version will no longer match.
+    pub fn update(&mut self) -> Result<(), Error> {
+        {
+            let mut origin_remote = self
+                .repo
+                .find_remote("origin")
+                .or_else(|_| self.repo.remote_anonymous(&self.url))?;
+
+            origin_remote.fetch(
+                &[
+                    "HEAD:refs/remotes/origin/HEAD",
+                    "master:refs/remotes/origin/master",
+                ],
+                Some(&mut crate::fetch_opts()),
+                None,
+            )?;
+        }
+
+        let head = self
+            .repo
+            .refname_to_id("FETCH_HEAD")
+            .or_else(|_| self.repo.refname_to_id("HEAD"))?;
+
+        self.head = head;
+        self.head_str = self.head.to_string();
+
+        Ok(())
+    }
+
+    /// Reads a crate from the index, it will attempt to use a cached entry if
+    /// one is available, otherwise it will fallback to reading the crate
+    /// directly from the git blob containing the crate information.
+    ///
+    /// Use this only if you need to get very few crates. If you're going
+    /// to read majority of crates, prefer the [`Index::crates()`] iterator.
+    pub fn crate_(&self, name: &str) -> Option<Crate> {
+        let rel_path = crate::crate_name_to_relative_path(name)?;
+
+        // Attempt to load the .cache/ entry first, this is purely an acceleration
+        // mechanism and can fail for a few reasons that are non-fatal
+        {
+            // avoid realloc on each push
+            let mut cache_path = PathBuf::with_capacity(path_max_byte_len(&self.path) + 8 + rel_path.len());
+            cache_path.push(&self.path);
+            cache_path.push(".cache");
+            cache_path.push(&rel_path);
+            if let Ok(cache_bytes) = std::fs::read(&cache_path) {
+                if let Ok(krate) = Crate::from_cache_slice(&cache_bytes, &self.head_str) {
+                    return Some(krate);
+                }
+            }
+        }
+
+        // Fallback to reading the blob directly via git if we don't have a
+        // valid cache entry
+        self.crate_from_rel_path(&rel_path).ok()
+    }
+
+    fn crate_from_rel_path(&self, path: &str) -> Result<Crate, Error> {
+        let entry = self.tree()?.get_path(Path::new(path))?;
+        let object = entry.to_object(&self.repo)?;
+        let blob = object
+            .as_blob()
+            .ok_or_else(|| Error::Io(io::Error::new(io::ErrorKind::NotFound, path.to_owned())))?;
+
+        Crate::from_slice(blob.content()).map_err(Error::Io)
+    }
+
+    /// Single-threaded iterator over all the crates in the index.
+    ///
+    /// [`Index::crates_parallel`] is typically 3 times faster.
+    ///
+    /// Skips crates that can not be parsed (but there shouldn't be any such crates in the crates-io index).
+    #[inline]
+    pub fn crates(&self) -> Crates<'_> {
+        Crates {
+            blobs: self.crates_refs().expect("HEAD commit disappeared"),
+            dedupe: MaybeOwned::Owned(DedupeContext::new()),
+        }
+    }
+
+    /// Iterate over all crates using rayon.
+    ///
+    /// This method is available only if the "parallel" feature is enabled.
+    #[cfg(feature = "parallel")]
+    pub fn crates_parallel(&self) -> impl rayon::iter::ParallelIterator<Item=Result<Crate, CratesIterError>> + '_ {
+        use rayon::iter::{IntoParallelIterator, ParallelIterator, IndexedParallelIterator};
+
+        let tree_oids = match self.crates_top_level_refs() {
+            Ok(objs) => objs.into_iter().map(|obj| obj.id()).collect::<Vec<_>>(),
+            Err(_) => vec![git2::Oid::zero()], // intentionally broken oid to return error from the iterator
+        };
+
+        let path = self.repo.path();
+
+        tree_oids.into_par_iter()
+            .with_min_len(64)
+            .map_init(
+                move || (Repository::open_bare(&path), DedupeContext::new()),
+                |(repo, ctx), oid| {
+                    let repo = match repo.as_ref() {
+                        Ok(repo) => repo,
+                        Err(_) => return vec![Err(CratesIterError)],
+                    };
+                    let mut stack = Vec::with_capacity(64);
+                    match repo.find_object(oid, None) {
+                        Ok(obj) => stack.push(obj),
+                        Err(_) => return vec![Err(CratesIterError)],
+                    };
+                    let blobs = CratesRefs { stack, repo };
+                    Crates {
+                        blobs,
+                        dedupe: MaybeOwned::Borrowed(ctx),
+                    }
+                    .map(Ok)
+                    .collect::<Vec<_>>()
+                },
+            )
+            .flat_map_iter(|chunk| chunk.into_iter())
+    }
+
+    /// update an iterator over all the crates in the index.
+    /// Returns opaque reference for each crate in the index, which can be used with [`CrateRef::parse`]
+    pub(crate) fn crates_refs(&self) -> Result<CratesRefs<'_>, git2::Error> {
+        Ok(CratesRefs {
+            stack: self.crates_top_level_refs()?,
+            repo: &self.repo,
+        })
+    }
+
+    pub(crate) fn crates_top_level_refs(&self) -> Result<Vec<git2::Object<'_>>, git2::Error> {
+        let mut stack = Vec::with_capacity(800);
+        for entry in self.tree()?.iter() {
+            // crates are in short dirs, skip .git/.cache
+            if entry.name_bytes().len() <= 2 {
+                let entry = entry.to_object(&self.repo)?;
+                // Scan only directories at top level
+                if entry.as_tree().is_some() {
+                    stack.push(entry);
+                }
+            }
+        }
+        Ok(stack)
+    }
+
+    /// Get the global configuration of the index.
+    pub fn index_config(&self) -> Result<IndexConfig, Error> {
+        let entry = self.tree()?.get_path(Path::new("config.json"))?;
+        let object = entry.to_object(&self.repo)?;
+        let blob = object
+            .as_blob()
+            .ok_or_else(|| Error::Io(io::Error::new(io::ErrorKind::NotFound, "config.json")))?;
+        serde_json::from_slice(blob.content()).map_err(Error::Json)
+    }
+}
+
+#[cfg(unix)]
+fn path_max_byte_len(path: &Path) -> usize {
+    use std::os::unix::prelude::OsStrExt;
+    path.as_os_str().as_bytes().len()
+}
+
+#[cfg(not(unix))]
+fn path_max_byte_len(path: &Path) -> usize {
+    path.to_str().map_or(0, |p| p.len())
+}
+
+/// Iterator over all crates in the index, but returns opaque objects that can be parsed separately.
+///
+/// See [`CrateRef::parse`].
+pub(crate) struct CratesRefs<'a> {
+    stack: Vec<git2::Object<'a>>,
+    repo: &'a git2::Repository,
+}
+
+/// Opaque representation of a crate in the index. See [`CrateRef::parse`].
+pub(crate) struct CrateRef<'a>(git2::Object<'a>);
+
+impl CrateRef<'_> {
+    #[inline]
+    /// Parse a crate from [`Index::crates_blobs`] iterator
+    pub fn parse(&self, ctx: &mut DedupeContext) -> io::Result<Crate> {
+        let blob = self.as_slice().ok_or(io::ErrorKind::InvalidData)?;
+        Crate::from_slice_with_context(blob, ctx)
+    }
+
+    /// Raw crate data that can be parsed with [`Crate::from_slice`]
+    pub fn as_slice(&self) -> Option<&[u8]> {
+        Some(self.0.as_blob()?.content())
+    }
+}
+
+impl<'a> Iterator for CratesRefs<'a> {
+    type Item = CrateRef<'a>;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        while let Some(last) = self.stack.pop() {
+            match last.as_tree() {
+                None => return Some(CrateRef(last)),
+                Some(tree) => {
+                    for entry in tree.iter().rev() {
+                        self.stack.push(entry.to_object(self.repo).unwrap());
+                    }
+                    continue;
+                }
+            }
+        }
+        None
+    }
+}
+
+impl fmt::Debug for CrateRef<'_> {
+    #[cold]
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.debug_struct("CrateRef")
+            .field("oid", &self.0.id())
+            .finish()
+    }
+}
+
+enum MaybeOwned<'a, T> {
+    Owned(T),
+    Borrowed(&'a mut T),
+}
+
+/// Iterator over all crates in the index. Skips crates that failed to parse.
+pub struct Crates<'a> {
+    blobs: CratesRefs<'a>,
+    dedupe: MaybeOwned<'a, DedupeContext>,
+}
+
+impl<'a> Iterator for Crates<'a> {
+    type Item = Crate;
+
+    fn next(&mut self) -> Option<Self::Item> {
+        for next in self.blobs.by_ref() {
+            let dedupe = match &mut self.dedupe {
+                MaybeOwned::Owned(d) => d,
+                MaybeOwned::Borrowed(d) => d,
+            };
+            if let Ok(k) = CrateRef::parse(&next, dedupe) {
+                return Some(k);
+            }
+        }
+        None
+    }
+}
+
+/// Converts a full url, eg https://github.com/rust-lang/crates.io-index, into
+/// the root directory name where cargo itself will fetch it on disk
+fn url_to_local_dir(url: &str) -> Result<(String, String), Error> {
+    fn to_hex(num: u64) -> String {
+        const CHARS: &[u8] = b"0123456789abcdef";
+
+        let bytes = &[
+            num as u8,
+            (num >> 8) as u8,
+            (num >> 16) as u8,
+            (num >> 24) as u8,
+            (num >> 32) as u8,
+            (num >> 40) as u8,
+            (num >> 48) as u8,
+            (num >> 56) as u8,
+        ];
+
+        let mut output = vec![0u8; 16];
+
+        let mut ind = 0;
+
+        for &byte in bytes {
+            output[ind] = CHARS[(byte >> 4) as usize];
+            output[ind + 1] = CHARS[(byte & 0xf) as usize];
+
+            ind += 2;
+        }
+
+        String::from_utf8(output).expect("valid utf-8 hex string")
+    }
+
+    #[allow(deprecated)]
+    fn hash_u64(url: &str) -> u64 {
+        use std::hash::{Hash, Hasher, SipHasher};
+
+        let mut hasher = SipHasher::new_with_keys(0, 0);
+        // Registry
+        2usize.hash(&mut hasher);
+        // Url
+        url.hash(&mut hasher);
+        hasher.finish()
+    }
+
+    // Ensure we have a registry or bare url
+    let (url, scheme_ind) = {
+        let scheme_ind = url
+            .find("://")
+            .ok_or_else(|| Error::Url(format!("'{}' is not a valid url", url)))?;
+
+        let scheme_str = &url[..scheme_ind];
+        if let Some(ind) = scheme_str.find('+') {
+            if &scheme_str[..ind] != "registry" {
+                return Err(Error::Url(format!("'{}' is not a valid registry url", url)));
+            }
+
+            (&url[ind + 1..], scheme_ind - ind - 1)
+        } else {
+            (url, scheme_ind)
+        }
+    };
+
+    // Could use the Url crate for this, but it's simple enough and we don't
+    // need to deal with every possible url (I hope...)
+    let host = match url[scheme_ind + 3..].find('/') {
+        Some(end) => &url[scheme_ind + 3..scheme_ind + 3 + end],
+        None => &url[scheme_ind + 3..],
+    };
+
+    // cargo special cases github.com for reasons, so do the same
+    let mut canonical = if host == "github.com" {
+        url.to_lowercase()
+    } else {
+        url.to_owned()
+    };
+
+    // Chop off any query params/fragments
+    if let Some(hash) = canonical.rfind('#') {
+        canonical.truncate(hash);
+    }
+
+    if let Some(query) = canonical.rfind('?') {
+        canonical.truncate(query);
+    }
+
+    let ident = to_hex(hash_u64(&canonical));
+
+    if canonical.ends_with('/') {
+        canonical.pop();
+    }
+
+    if canonical.contains("github.com/") && canonical.ends_with(".git") {
+        // Only GitHub (crates.io) repositories have their .git suffix truncated
+        canonical.truncate(canonical.len() - 4);
+    }
+
+    Ok((format!("{}-{}", host, ident), canonical))
+}
+
+#[cfg(test)]
+mod test {
+    #[test]
+    fn matches_cargo() {
+        assert_eq!(
+            super::url_to_local_dir(crate::INDEX_GIT_URL).unwrap(),
+            (
+                "github.com-1ecc6299db9ec823".to_owned(),
+                crate::INDEX_GIT_URL.to_owned()
+            )
+        );
+
+        // I've confirmed this also works with a custom registry, unfortunately
+        // that one includes a secret key as part of the url which would allow
+        // anyone to publish to the registry, so uhh...here's a fake one instead
+        assert_eq!(
+            super::url_to_local_dir(
+                "https://dl.cloudsmith.io/aBcW1234aBcW1234/embark/rust/cargo/index.git"
+            )
+            .unwrap(),
+            (
+                "dl.cloudsmith.io-ff79e51ddd2b38fd".to_owned(),
+                "https://dl.cloudsmith.io/aBcW1234aBcW1234/embark/rust/cargo/index.git".to_owned()
+            )
+        );
+
+        // Ensure we actually strip off the irrelevant parts of a url, note that
+        // the .git suffix is not part of the canonical url, but *is* used when hashing
+        assert_eq!(
+            super::url_to_local_dir(&format!(
+                "registry+{}.git?one=1&two=2#fragment",
+                crate::INDEX_GIT_URL
+            ))
+            .unwrap(),
+            (
+                "github.com-c786010fb7ef2e6e".to_owned(),
+                crate::INDEX_GIT_URL.to_owned()
+            )
+        );
+    }
+
+    #[test]
+    fn bare_iterator() {
+        use super::Index;
+
+        let tmp_dir = tempfile::TempDir::new().unwrap();
+
+        let repo = Index::with_path(tmp_dir.path().to_owned(), crate::INDEX_GIT_URL)
+            .expect("Failed to clone crates.io index");
+        assert_eq!("time", repo.crate_("time").unwrap().name());
+
+        let mut found_gcc_crate = false;
+        let mut found_time_crate = false;
+
+        for c in repo.crates() {
+            if c.name() == "gcc" {
+                found_gcc_crate = true;
+            }
+            if c.name() == "time" {
+                found_time_crate = true;
+            }
+        }
+
+        assert!(found_gcc_crate);
+        assert!(found_time_crate);
+    }
+
+    #[test]
+    fn clones_bare_index() {
+        use super::Index;
+
+        let tmp_dir = tempfile::TempDir::new().unwrap();
+
+        let mut repo = Index::with_path(tmp_dir.path().to_owned(), crate::INDEX_GIT_URL)
+            .expect("Failed to clone crates.io index");
+
+        fn test_sval(repo: &Index) {
+            let krate = repo
+                .crate_("sval")
+                .expect("Could not find the crate sval in the index");
+
+            let version = krate
+                .versions()
+                .iter()
+                .find(|v| v.version() == "0.0.1")
+                .expect("Version 0.0.1 of sval does not exist?");
+            let dep_with_package_name = version
+                .dependencies()
+                .iter()
+                .find(|d| d.name() == "serde_lib")
+                .expect("sval does not have expected dependency?");
+            assert_ne!(
+                dep_with_package_name.name(),
+                dep_with_package_name.package().unwrap()
+            );
+            assert_eq!(
+                dep_with_package_name.crate_name(),
+                dep_with_package_name.package().unwrap()
+            );
+        }
+
+        test_sval(&repo);
+
+        repo.update().expect("Failed to fetch crates.io index");
+
+        test_sval(&repo);
+    }
+
+    #[test]
+    fn opens_bare_index() {
+        use super::Index;
+
+        let tmp_dir = tempfile::TempDir::new().unwrap();
+
+        let mut repo = Index::with_path(tmp_dir.path().to_owned(), crate::INDEX_GIT_URL)
+            .expect("Failed to open crates.io index");
+
+        fn test_sval(repo: &Index) {
+            let krate = repo
+                .crate_("sval")
+                .expect("Could not find the crate sval in the index");
+
+            let version = krate
+                .versions()
+                .iter()
+                .find(|v| v.version() == "0.0.1")
+                .expect("Version 0.0.1 of sval does not exist?");
+            let dep_with_package_name = version
+                .dependencies()
+                .iter()
+                .find(|d| d.name() == "serde_lib")
+                .expect("sval does not have expected dependency?");
+            assert_ne!(
+                dep_with_package_name.name(),
+                dep_with_package_name.package().unwrap()
+            );
+            assert_eq!(
+                dep_with_package_name.crate_name(),
+                dep_with_package_name.package().unwrap()
+            );
+        }
+
+        test_sval(&repo);
+
+        repo.update().expect("Failed to fetch crates.io index");
+
+        test_sval(&repo);
+    }
+}
diff --git a/android/vendor/crates-index-0.18.8/src/dedupe.rs b/android/vendor/crates-index-0.18.8/src/dedupe.rs
new file mode 100644
index 0000000..c0fdf9a
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/src/dedupe.rs
@@ -0,0 +1,71 @@
+use crate::Dependency;
+use rustc_hash::FxHashSet;
+use std::collections::HashMap;
+use std::hash::Hash;
+use std::hash::Hasher;
+use std::sync::Arc;
+
+/// Many crates (their versions) have the same features and dependencies
+pub(crate) struct DedupeContext {
+    features: FxHashSet<HashableHashMap<String, Vec<String>>>,
+    deps: FxHashSet<Arc<[Dependency]>>,
+}
+
+impl DedupeContext {
+    #[inline]
+    pub(crate) fn new() -> Self {
+        Self {
+            deps: FxHashSet::default(),
+            features: FxHashSet::default(),
+        }
+    }
+
+    pub(crate) fn features(&mut self, features: &mut Arc<HashMap<String, Vec<String>>>) {
+        let features_to_dedupe = HashableHashMap::new(Arc::clone(features));
+        if let Some(has_feats) = self.features.get(&features_to_dedupe) {
+            *features = Arc::clone(&has_feats.map);
+        } else {
+            if self.features.len() > 16384 { // keeps peek memory low (must clear, remove is leaving tombstones)
+                self.features.clear();
+            }
+            self.features.insert(features_to_dedupe);
+        }
+    }
+
+    pub(crate) fn deps(&mut self, deps: &mut Arc<[Dependency]>) {
+        if let Some(has_deps) = self.deps.get(&*deps) {
+            *deps = Arc::clone(has_deps);
+        } else {
+            if self.deps.len() > 16384 { // keeps peek memory low (must clear, remove is leaving tombstones)
+                self.deps.clear();
+            }
+            self.deps.insert(Arc::clone(deps));
+        }
+    }
+}
+
+/// Newtype that caches hash of the hashmap (the default hashmap has a random order of the keys, so it's not cheap to hash)
+#[derive(PartialEq, Eq)]
+pub struct HashableHashMap<K: PartialEq + Hash + Eq, V: PartialEq + Hash + Eq> {
+    pub map: Arc<HashMap<K, V>>,
+    hash: u64,
+}
+
+impl<K: PartialEq + Hash + Eq, V: PartialEq + Hash + Eq> Hash for HashableHashMap<K, V> {
+    fn hash<H>(&self, hasher: &mut H) where H: Hasher {
+        hasher.write_u64(self.hash);
+    }
+}
+
+impl<K: PartialEq + Hash + Eq, V: PartialEq + Hash + Eq> HashableHashMap<K, V> {
+    pub(crate) fn new(map: Arc<HashMap<K, V>>) -> Self {
+        let mut hash = 0;
+        for (k, v) in map.iter() {
+            let mut hasher = rustc_hash::FxHasher::default();
+            k.hash(&mut hasher);
+            v.hash(&mut hasher);
+            hash ^= hasher.finish(); // XOR makes it order-independent
+        }
+        Self { hash, map }
+    }
+}
diff --git a/android/vendor/crates-index-0.18.8/src/error.rs b/android/vendor/crates-index-0.18.8/src/error.rs
new file mode 100644
index 0000000..43363d0
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/src/error.rs
@@ -0,0 +1,65 @@
+use git2::Error as GitErr;
+use serde_json::Error as SerdeJsonError;
+use std::{fmt, io::Error as IoErr};
+
+/// Oops
+#[derive(Debug)]
+pub enum Error {
+    /// git2 library failed. If problems persist, delete `~/.cargo/registry`
+    Git(GitErr),
+    /// `Index::from_url` got a bogus URL
+    Url(String),
+    /// Filesystem error
+    Io(IoErr),
+    /// If this happens, the registry is seriously corrupted. Delete `~/.cargo/registry`.
+    Json(SerdeJsonError),
+}
+
+impl fmt::Display for Error {
+    #[cold]
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            Self::Git(e) => fmt::Display::fmt(&e, f),
+            Self::Url(u) => f.write_str(u),
+            Self::Io(e) => fmt::Display::fmt(&e, f),
+            Self::Json(e) => fmt::Display::fmt(&e, f),
+        }
+    }
+}
+
+impl std::error::Error for Error {
+    #[cold]
+    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
+        match self {
+            Self::Git(e) => Some(e),
+            Self::Io(e) => Some(e),
+            _ => None,
+        }
+    }
+}
+
+impl From<GitErr> for Error {
+    #[cold]
+    fn from(e: GitErr) -> Self {
+        Self::Git(e)
+    }
+}
+
+#[test]
+fn error_is_send() {
+    fn is_send<T: Send>() {}
+    is_send::<Error>();
+}
+
+/// Unknown error from [`crate::Index::crates_parallel`]
+#[derive(Debug)]
+pub struct CratesIterError;
+
+impl std::error::Error for CratesIterError {}
+
+impl fmt::Display for CratesIterError {
+    #[cold]
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        f.write_str("error while iterating git repository")
+    }
+}
diff --git a/android/vendor/crates-index-0.18.8/src/lib.rs b/android/vendor/crates-index-0.18.8/src/lib.rs
new file mode 100644
index 0000000..f496b72
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/src/lib.rs
@@ -0,0 +1,664 @@
+// Copyright 2015 Corey Farwell
+// Copyright 2015 Contributors of github.com/huonw/crates.io-graph
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//	http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//! Library for retrieving and interacting with the [crates.io index].
+//!
+//! [crates.io index]: https://github.com/rust-lang/crates.io-index
+//!
+//! ## Examples
+//!
+//! ### Getting information about a single crate
+//!
+//! ```rust
+//! let index = crates_index::Index::new_cargo_default()?;
+//! let serde_crate = index.crate_("serde").expect("you should handle errors here");
+//! println!("Serde is at v{}", serde_crate.highest_stable_version().unwrap().version());
+//! # Ok::<_, crates_index::Error>(())
+//! ```
+//!
+//! ### Iterating over *all* crates in the index
+//!
+//! ```rust
+//! let index = crates_index::Index::new_cargo_default()?;
+//! for crate_ in index.crates() {
+//!    let latest_version = crate_.latest_version();
+//!    println!("crate name: {}", latest_version.name());
+//!    println!("most recently released version: {}", latest_version.version());
+//! }
+//!
+//! // or faster:
+//! use rayon::prelude::*;
+//! index.crates_parallel().for_each(|crate_| {
+//!     /* etc. */
+//! });
+//!
+//! # Ok::<_, crates_index::Error>(())
+//! ```
+#![forbid(unsafe_code)]
+#![deny(missing_docs)]
+
+use dedupe::DedupeContext;
+use git2::{Config, Cred, CredentialHelper, RemoteCallbacks};
+use semver::Version as SemverVersion;
+use serde_derive::{Deserialize, Serialize};
+use smartstring::alias::String as SmolStr;
+use std::collections::HashMap;
+use std::io;
+use std::path::Path;
+use std::sync::Arc;
+
+mod bare_index;
+mod dedupe;
+mod error;
+
+pub use bare_index::Crates;
+pub use bare_index::Index;
+pub use error::CratesIterError;
+pub use error::Error;
+
+static INDEX_GIT_URL: &str = "https://github.com/rust-lang/crates.io-index";
+
+/// A single version of a crate (package) published to the index
+#[derive(Serialize, Deserialize, Clone, Debug)]
+pub struct Version {
+    name: SmolStr,
+    vers: SmolStr,
+    deps: Arc<[Dependency]>,
+    features: Arc<HashMap<String, Vec<String>>>,
+    /// It's wrapped in `Option<Box>` to reduce size of the struct when the field is unused (i.e. almost always)
+    /// <https://rust-lang.github.io/rfcs/3143-cargo-weak-namespaced-features.html#index-changes>
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    features2: Option<Box<HashMap<String, Vec<String>>>>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    links: Option<Box<SmolStr>>,
+    #[serde(with = "hex")]
+    cksum: [u8; 32],
+    #[serde(default)]
+    yanked: bool,
+}
+
+impl Version {
+    /// Name of the crate
+    #[inline]
+    pub fn name(&self) -> &str {
+        &self.name
+    }
+
+    /// Name of this version
+    #[inline]
+    pub fn version(&self) -> &str {
+        &self.vers
+    }
+
+    /// Dependencies for this version
+    #[inline]
+    pub fn dependencies(&self) -> &[Dependency] {
+        &self.deps
+    }
+
+    /// Checksum of the package for this version
+    ///
+    /// SHA256 of the .crate file
+    #[inline]
+    pub fn checksum(&self) -> &[u8; 32] {
+        &self.cksum
+    }
+
+    /// Explicit features this crate has. This list is not exhaustive,
+    /// because any optional dependency becomes a feature automatically.
+    ///
+    /// `default` is a special feature name for implicitly enabled features.
+    #[inline]
+    pub fn features(&self) -> &HashMap<String, Vec<String>> {
+        &self.features
+    }
+
+    /// Exclusivity flag. If this is a sys crate, it informs it
+    /// conflicts with any other crate with the same links string.
+    ///
+    /// It does not involve linker or libraries in any way.
+    #[inline]
+    pub fn links(&self) -> Option<&str> {
+        self.links.as_ref().map(|s| s.as_str())
+    }
+
+    /// Whether this version was [yanked](http://doc.crates.io/crates-io.html#cargo-yank) from the
+    /// index
+    #[inline]
+    pub fn is_yanked(&self) -> bool {
+        self.yanked
+    }
+
+    /// Where to find crate tarball
+    pub fn download_url(&self, index: &IndexConfig) -> Option<String> {
+        index.download_url(&self.name, &self.vers)
+    }
+}
+
+/// A single dependency of a specific crate version
+#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash)]
+pub struct Dependency {
+    name: SmolStr,
+    req: SmolStr,
+    /// Double indirection to remove size from this struct, since the features are rarely set
+    features: Box<Box<[String]>>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    package: Option<Box<SmolStr>>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    kind: Option<DependencyKind>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    target: Option<Box<SmolStr>>,
+    optional: bool,
+    default_features: bool,
+}
+
+impl Dependency {
+    /// Dependency's arbitrary nickname (it may be an alias). Use [`Dependency::crate_name`] for actual crate name.
+    #[inline]
+    pub fn name(&self) -> &str {
+        &self.name
+    }
+
+    /// Semver version pattern
+    #[inline]
+    pub fn requirement(&self) -> &str {
+        &self.req
+    }
+
+    /// Features unconditionally enabled when using this dependency,
+    /// in addition to [`Dependency::has_default_features`] and features enabled through
+    /// parent crate's feature list.
+    #[inline]
+    pub fn features(&self) -> &[String] {
+        &self.features
+    }
+
+    /// If it's optional, it implies a feature of its [`Dependency::name`], and can be enabled through
+    /// the crate's features.
+    #[inline]
+    pub fn is_optional(&self) -> bool {
+        self.optional
+    }
+
+    /// If `true` (default), enable `default` feature of this dependency
+    #[inline]
+    pub fn has_default_features(&self) -> bool {
+        self.default_features
+    }
+
+    /// This dependency is only used when compiling for this `cfg` expression
+    #[inline]
+    pub fn target(&self) -> Option<&str> {
+        self.target.as_ref().map(|s| s.as_str())
+    }
+
+    /// Dev or not
+    #[inline]
+    pub fn kind(&self) -> DependencyKind {
+        self.kind.unwrap_or_default()
+    }
+
+    /// Set if dependency's crate name is different from the `name` (alias)
+    #[inline]
+    pub fn package(&self) -> Option<&str> {
+        self.package.as_ref().map(|s| s.as_str())
+    }
+
+    /// Returns the name of the crate providing the dependency.
+    /// This is equivalent to `name()` unless `self.package()`
+    /// is not `None`, in which case it's equal to `self.package()`.
+    ///
+    /// Basically, you can define a dependency in your `Cargo.toml`
+    /// like this:
+    ///
+    /// ```toml
+    /// serde_lib = {version = "1", package = "serde"}
+    /// ```
+    ///
+    /// ...which means that it uses the crate `serde` but imports
+    /// it under the name `serde_lib`.
+    #[inline]
+    pub fn crate_name(&self) -> &str {
+        match self.package {
+            Some(ref s) => s,
+            None => self.name(),
+        }
+    }
+}
+
+/// Section in which this dependency was defined
+#[derive(Debug, Copy, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)]
+#[serde(rename_all = "lowercase")]
+pub enum DependencyKind {
+    /// Used at run time
+    Normal,
+    /// Not fetched and not used, except for when used direclty in a workspace
+    Dev,
+    /// Used at build time, not available at run time
+    Build,
+}
+
+impl Default for DependencyKind {
+    fn default() -> Self {
+        Self::Normal
+    }
+}
+
+fn fetch_opts<'cb>() -> git2::FetchOptions<'cb> {
+    let mut proxy_opts = git2::ProxyOptions::new();
+    proxy_opts.auto();
+    let mut fetch_opts = git2::FetchOptions::new();
+    fetch_opts.proxy_options(proxy_opts);
+
+    let mut remote_callbacks = RemoteCallbacks::new();
+    remote_callbacks.credentials(|url, username_from_url, _allowed_types| {
+        let config = Config::open_default()?;
+        match CredentialHelper::new(url)
+            .config(&config)
+            .username(username_from_url)
+            .execute()
+        {
+            Some((username, password)) => {
+                let cred = Cred::userpass_plaintext(&username, &password)?;
+                Ok(cred)
+            }
+            None => Err(git2::Error::from_str(
+                "failed to acquire username/password from local configuration",
+            )),
+        }
+    });
+    fetch_opts.remote_callbacks(remote_callbacks);
+
+    fetch_opts
+}
+
+fn crate_prefix(accumulator: &mut String, crate_name: &str, separator: char) -> Option<()> {
+    match crate_name.len() {
+        0 => return None,
+        1 => accumulator.push('1'),
+        2 => accumulator.push('2'),
+        3 => {
+            accumulator.push('3');
+            accumulator.push(separator);
+            accumulator.extend(crate_name.as_bytes().get(0..1)?.iter().map(|c| c.to_ascii_lowercase() as char));
+        }
+        _ => {
+            accumulator.extend(crate_name.as_bytes().get(0..2)?.iter().map(|c| c.to_ascii_lowercase() as char));
+            accumulator.push(separator);
+            accumulator.extend(crate_name.as_bytes().get(2..4)?.iter().map(|c| c.to_ascii_lowercase() as char));
+        }
+    };
+    Some(())
+}
+
+fn crate_name_to_relative_path(crate_name: &str) -> Option<String> {
+    let mut rel_path = String::with_capacity(crate_name.len() + 6);
+    crate_prefix(&mut rel_path, crate_name, std::path::MAIN_SEPARATOR)?;
+    rel_path.push(std::path::MAIN_SEPARATOR);
+    rel_path.extend(crate_name.as_bytes().iter().map(|c| c.to_ascii_lowercase() as char));
+
+    Some(rel_path)
+}
+
+/// A whole crate with all its versions
+#[derive(Serialize, Deserialize, Clone, Debug)]
+pub struct Crate {
+    versions: Box<[Version]>,
+}
+
+impl Crate {
+    /// Parse the file with crate versions.
+    ///
+    /// The file must contain at least one version.
+    #[inline]
+    pub fn new<P: AsRef<Path>>(index_path: P) -> io::Result<Crate> {
+        let lines = std::fs::read(index_path)?;
+        Self::from_slice(&lines)
+    }
+
+    /// Parse crate file from in-memory JSON data
+    #[inline]
+    pub fn from_slice(bytes: &[u8]) -> io::Result<Crate> {
+        let mut dedupe = DedupeContext::new();
+        Self::from_slice_with_context(bytes, &mut dedupe)
+    }
+
+    /// Parse crate file from in-memory JSON data
+    pub(crate) fn from_slice_with_context(mut bytes: &[u8], dedupe: &mut DedupeContext) -> io::Result<Crate> {
+        // Trim last newline
+        while bytes.last() == Some(&b'\n') {
+            bytes = &bytes[..bytes.len() - 1];
+        }
+
+        #[inline(always)]
+        fn is_newline(&c: &u8) -> bool {
+            c == b'\n'
+        }
+        let num_versions = bytes.split(is_newline).count();
+        let mut versions = Vec::with_capacity(num_versions);
+        for line in bytes.split(is_newline) {
+            let mut version: Version = serde_json::from_slice(line)
+                .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
+
+            if let Some(features2) = version.features2.take() {
+                if let Some(f1) = Arc::get_mut(&mut version.features) {
+                    for (key, mut val) in features2.into_iter() {
+                        f1.entry(key).or_insert_with(Vec::new).append(&mut val);
+                    }
+                }
+            }
+
+            // Many versions have identical dependencies and features
+            dedupe.deps(&mut version.deps);
+            dedupe.features(&mut version.features);
+
+            versions.push(version);
+        }
+        if versions.is_empty() {
+            return Err(io::Error::new(
+                io::ErrorKind::Other,
+                "crate must have versions",
+            ));
+        }
+        debug_assert_eq!(versions.len(), versions.capacity());
+        Ok(Crate {
+            versions: versions.into_boxed_slice(),
+        })
+    }
+
+    /// Parse crate index entry from a .cache file, this can fail for a number of reasons
+    ///
+    /// 1. There is no entry for this crate
+    /// 2. The entry was created with an older commit and might be outdated
+    /// 3. The entry is a newer version than what can be read, would only
+    /// happen if a future version of cargo changed the format of the cache entries
+    /// 4. The cache entry is malformed somehow
+    pub(crate) fn from_cache_slice(bytes: &[u8], index_version: &str) -> io::Result<Crate> {
+        const CURRENT_CACHE_VERSION: u8 = 1;
+
+        // See src/cargo/sources/registry/index.rs
+        let (first_byte, rest) = bytes
+            .split_first()
+            .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "malformed cache"))?;
+
+        if *first_byte != CURRENT_CACHE_VERSION {
+            return Err(io::Error::new(
+                io::ErrorKind::Other,
+                "looks like a different Cargo's cache, bailing out",
+            ));
+        }
+
+        fn split<'a>(haystack: &'a [u8], needle: u8) -> impl Iterator<Item = &'a [u8]> + 'a {
+            struct Split<'a> {
+                haystack: &'a [u8],
+                needle: u8,
+            }
+
+            impl<'a> Iterator for Split<'a> {
+                type Item = &'a [u8];
+
+                fn next(&mut self) -> Option<&'a [u8]> {
+                    if self.haystack.is_empty() {
+                        return None;
+                    }
+                    let (ret, remaining) = match memchr::memchr(self.needle, self.haystack) {
+                        Some(pos) => (&self.haystack[..pos], &self.haystack[pos + 1..]),
+                        None => (self.haystack, &[][..]),
+                    };
+                    self.haystack = remaining;
+                    Some(ret)
+                }
+            }
+
+            Split { haystack, needle }
+        }
+
+        let mut iter = split(rest, 0);
+        if let Some(update) = iter.next() {
+            if update != index_version.as_bytes() {
+                return Err(io::Error::new(
+                    io::ErrorKind::Other,
+                    format!(
+                        "cache out of date: current index ({}) != cache ({})",
+                        index_version,
+                        std::str::from_utf8(update)
+                            .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?,
+                    ),
+                ));
+            }
+        } else {
+            return Err(io::Error::new(io::ErrorKind::Other, "malformed file"));
+        }
+
+        let mut versions = Vec::new();
+
+        // Each entry is a tuple of (semver, version_json)
+        while let Some(_version) = iter.next() {
+            let version_slice = iter
+                .next()
+                .ok_or_else(|| io::Error::new(io::ErrorKind::Other, "malformed file"))?;
+            let version: Version = serde_json::from_slice(version_slice)
+                .map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
+            versions.push(version);
+        }
+
+        Ok(Self {
+            versions: versions.into_boxed_slice(),
+        })
+    }
+
+    /// Unconstrained All versions of this crate sorted chronologically by date originally published
+    ///
+    /// Warning: may be yanked or duplicate
+    #[inline]
+    pub fn versions(&self) -> &[Version] {
+        &self.versions
+    }
+
+    /// Unconstrained Earliest version
+    ///
+    /// Warning: may not be the lowest version number and may be yanked
+    #[inline]
+    pub fn earliest_version(&self) -> &Version {
+        &self.versions[0]
+    }
+
+    /// Unconstrained Latest version
+    ///
+    /// Warning: may not be the highest version and may be yanked
+    #[inline]
+    pub fn latest_version(&self) -> &Version {
+        &self.versions[self.versions.len() - 1]
+    }
+
+    /// The highest version as per semantic versioning specification
+    ///
+    /// Warning: may be prerelease or yanked
+    pub fn highest_version(&self) -> &Version {
+        self.versions
+            .iter()
+            .max_by_key(|v| SemverVersion::parse(&v.vers).ok())
+            // Safety: Versions inside the index will always adhere to
+            // semantic versioning. If a crate is inside the index, at
+            // least one version is available.
+            .unwrap()
+    }
+
+    /// Returns the highest version as per semantic versioning specification,
+    /// filtering out versions with pre-release identifiers.
+    ///
+    /// Warning: may be yanked
+    pub fn highest_stable_version(&self) -> Option<&Version> {
+        self.versions
+            .iter()
+            .filter_map(|v| Some((v, SemverVersion::parse(&v.vers).ok()?)))
+            .filter(|(_, sem)| sem.pre.is_empty())
+            .max_by(|a, b| a.1.cmp(&b.1))
+            .map(|(v, _)| v)
+    }
+
+    /// Crate's unique registry name. Case-sensitive, mostly.
+    #[inline]
+    pub fn name(&self) -> &str {
+        self.versions[0].name()
+    }
+}
+
+/// Global configuration of an index, reflecting the [contents of config.json](https://doc.rust-lang.org/cargo/reference/registries.html#index-format).
+#[derive(Clone, Debug, Deserialize)]
+pub struct IndexConfig {
+    /// Pattern for creating download URLs. Use [`IndexConfig::download_url`] instead.
+    pub dl: String,
+    /// Base URL for publishing, etc.
+    pub api: Option<String>,
+}
+
+impl IndexConfig {
+    /// Get the URL from where the specified package can be downloaded.
+    /// This method assumes the particular version is present in the registry,
+    /// and does not verify that it is.
+    pub fn download_url(&self, name: &str, version: &str) -> Option<String> {
+        if !self.dl.contains("{crate}")
+            && !self.dl.contains("{version}")
+            && !self.dl.contains("{prefix}")
+            && !self.dl.contains("{lowerprefix}")
+        {
+            let mut new = String::with_capacity(self.dl.len() + name.len() + version.len() + 10);
+            new.push_str(&self.dl);
+            new.push('/');
+            new.push_str(name);
+            new.push('/');
+            new.push_str(version);
+            new.push_str("/download");
+            Some(new)
+        } else {
+            let mut prefix = String::with_capacity(5);
+            crate_prefix(&mut prefix, name, '/')?;
+            Some(
+                self.dl
+                    .replace("{crate}", name)
+                    .replace("{version}", version)
+                    .replace("{prefix}", &prefix)
+                    .replace("{lowerprefix}", &prefix.to_ascii_lowercase()),
+            )
+        }
+    }
+}
+
+#[cfg(test)]
+mod test {
+    use super::*;
+    use tempfile::TempDir;
+
+    #[test]
+    fn sizes() {
+        assert!(std::mem::size_of::<Version>() <= 128);
+        assert!(std::mem::size_of::<Crate>() <= 16);
+        assert!(std::mem::size_of::<Dependency>() <= 80);
+    }
+
+    #[test]
+    fn semver() {
+        let c = Crate::from_slice(r#"{"vers":"1.0.0", "name":"test", "deps":[], "features":{}, "cksum":"1234567890123456789012345678901234567890123456789012345678901234", "yanked":false}
+            {"vers":"1.2.0-alpha.1", "name":"test", "deps":[], "features":{}, "cksum":"1234567890123456789012345678901234567890123456789012345678901234", "yanked":false}
+            {"vers":"1.0.1", "name":"test", "deps":[], "features":{}, "cksum":"1234567890123456789012345678901234567890123456789012345678901234", "yanked":false}"#.as_bytes()).unwrap();
+        assert_eq!(c.latest_version().version(), "1.0.1");
+        assert_eq!(c.highest_version().version(), "1.2.0-alpha.1");
+        assert_eq!(c.highest_stable_version().unwrap().version(), "1.0.1");
+    }
+
+    #[test]
+    fn test_dependencies() {
+        let index = Index::new_cargo_default().unwrap();
+
+        let crate_ = index
+            .crate_("sval")
+            .expect("Could not find the crate libnotify in the index");
+        let _ = format!("supports debug {:?}", crate_);
+
+        let version = crate_
+            .versions()
+            .iter()
+            .find(|v| v.version() == "0.0.1")
+            .expect("Version 0.0.1 of sval does not exist?");
+        let dep_with_package_name = version
+            .dependencies()
+            .iter()
+            .find(|d| d.name() == "serde_lib")
+            .expect("sval does not have expected dependency?");
+        assert_ne!(
+            dep_with_package_name.name(),
+            dep_with_package_name.package().unwrap()
+        );
+        assert_eq!(
+            dep_with_package_name.crate_name(),
+            dep_with_package_name.package().unwrap()
+        );
+    }
+
+    #[test]
+    fn test_cargo_default_updates() {
+        let mut index = Index::new_cargo_default().unwrap();
+        index
+            .update()
+            .map_err(|e| {
+                format!(
+                    "could not fetch cargo's index in {}: {}",
+                    index.path().display(),
+                    e
+                )
+            })
+            .unwrap();
+        assert!(index.crate_("crates-index").is_some());
+        assert!(index.crate_("toml").is_some());
+        assert!(index.crate_("gcc").is_some());
+        assert!(index.crate_("cc").is_some());
+        assert!(index.crate_("CC").is_some());
+        assert!(index.crate_("無").is_none());
+    }
+
+    #[test]
+    fn test_can_parse_all() {
+        let tmp_dir = TempDir::new().unwrap();
+        let mut found_gcc_crate = false;
+
+        let index = Index::with_path(tmp_dir.path(), crate::INDEX_GIT_URL).unwrap();
+        let mut ctx = DedupeContext::new();
+
+        for c in index.crates_refs().unwrap() {
+            match c.parse(&mut ctx) {
+                Ok(c) => {
+                    if c.name() == "gcc" {
+                        found_gcc_crate = true;
+                    }
+                }
+                Err(e) => panic!("can't parse :( {:?}: {}", c, e),
+            }
+        }
+
+        assert!(found_gcc_crate);
+    }
+
+    #[test]
+    fn features2() {
+        let c = Crate::from_slice(br#"{"vers":"1.0.0", "name":"test", "deps":[], "features":{"a":["one"], "b":["x"]},"features2":{"a":["two"], "c":["y"]}, "cksum":"1234567890123456789012345678901234567890123456789012345678901234"}"#).unwrap();
+        let f2 = c.latest_version().features();
+
+        assert_eq!(3, f2.len());
+        assert_eq!(["one", "two"], &f2["a"][..]);
+        assert_eq!(["x"], &f2["b"][..]);
+        assert_eq!(["y"], &f2["c"][..]);
+    }
+}
diff --git a/android/vendor/crates-index-0.18.8/tests/mem.rs b/android/vendor/crates-index-0.18.8/tests/mem.rs
new file mode 100644
index 0000000..2a6325f
--- /dev/null
+++ b/android/vendor/crates-index-0.18.8/tests/mem.rs
@@ -0,0 +1,26 @@
+use cap::Cap;
+use crates_index::*;
+use rayon::iter::ParallelIterator;
+use std::alloc;
+
+#[global_allocator]
+static ALLOCATOR: Cap<alloc::System> = Cap::new(alloc::System, usize::max_value());
+
+#[test]
+fn mem_usage() {
+    let index = Index::new_cargo_default().unwrap();
+
+    let before = ALLOCATOR.allocated();
+    // let all_crates: Vec<_> = index.crates().collect();
+    let all_crates: Vec<_> = index.crates_parallel().map(|c| c.unwrap()).collect();
+    let after = ALLOCATOR.allocated();
+    let used = after - before;
+    assert!(all_crates.len() > 76200);
+    eprintln!(
+        "used mem: {}B for {} crates, {}B per crate",
+        used,
+        all_crates.len(),
+        used / all_crates.len()
+    );
+    assert!(used / all_crates.len() < 4800);
+}
diff --git a/android/vendor/doc-comment-0.3.3/.cargo-checksum.json b/android/vendor/doc-comment-0.3.3/.cargo-checksum.json
new file mode 100644
index 0000000..448171c
--- /dev/null
+++ b/android/vendor/doc-comment-0.3.3/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"ed50e70a8759606f877f51a5f94dc409d34991d6321db165f736de0734b64bb9","LICENSE":"7a9b7dd9d68943a39bbf3ea97f37b3c7b257168ecbaa9e00606f64e6ff61fe35","README.md":"a965b7507b31a3c34f8bf20a04a63296ba1d04f44c1339a72d002c15ba3c4acf","build.rs":"a342cd0a760b7e04b13406c5de82a9b6b39d9b8495a274c2f78d56d676aeca3a","src/lib.rs":"07382530d2e560f34e18dec0efef2093902e752452abd75b1df9a90e79728b31"},"package":"fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"}
\ No newline at end of file
diff --git a/android/vendor/doc-comment-0.3.3/Cargo.toml b/android/vendor/doc-comment-0.3.3/Cargo.toml
new file mode 100644
index 0000000..081bbf5
--- /dev/null
+++ b/android/vendor/doc-comment-0.3.3/Cargo.toml
@@ -0,0 +1,31 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "doc-comment"
+version = "0.3.3"
+authors = ["Guillaume Gomez <guillaume1.gomez@gmail.com>"]
+build = "build.rs"
+description = "Macro to generate doc comments"
+documentation = "http://docs.rs/crate/doc-comment"
+readme = "README.md"
+license = "MIT"
+repository = "https://github.com/GuillaumeGomez/doc-comment"
+
+[lib]
+name = "doc_comment"
+
+[features]
+no_core = []
+old_macros = []
+[badges.travis-ci]
+repository = "GuillaumeGomez/doc-comment"
diff --git a/android/vendor/doc-comment-0.3.3/LICENSE b/android/vendor/doc-comment-0.3.3/LICENSE
new file mode 100644
index 0000000..a81db36
--- /dev/null
+++ b/android/vendor/doc-comment-0.3.3/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Guillaume Gomez
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/android/vendor/doc-comment-0.3.3/README.md b/android/vendor/doc-comment-0.3.3/README.md
new file mode 100644
index 0000000..ed4e619
--- /dev/null
+++ b/android/vendor/doc-comment-0.3.3/README.md
@@ -0,0 +1,33 @@
+# doc-comment [![][img_travis-ci]][travis-ci] [![][img_crates]][crates] [![][img_doc]][doc]
+
+[img_travis-ci]: https://api.travis-ci.org/GuillaumeGomez/doc-comment.png?branch=master
+[travis-ci]: https://travis-ci.org/GuillaumeGomez/doc-comment
+
+[img_crates]: https://img.shields.io/crates/v/doc-comment.svg
+[crates]: https://crates.io/crates/doc-comment
+
+[img_doc]: https://img.shields.io/badge/rust-documentation-blue.svg
+
+Write doc comments from macros.
+
+## Usage example
+
+````rust
+// Of course, we need to import the `doc_comment` macro:
+#[macro_use]
+extern crate doc_comment;
+
+// If you want to test examples in your README file.
+doctest!("../README.md");
+
+// If you want to test your README file ONLY on "cargo test":
+#[cfg(doctest)]
+doctest!("../README.md");
+
+// If you want to document an item:
+doc_comment!(concat!("fooo", "or not foo"), pub struct Foo {});
+````
+
+For more information, take a look at the [documentation][doc].
+
+[doc]: https://docs.rs/doc-comment/
\ No newline at end of file
diff --git a/android/vendor/doc-comment-0.3.3/build.rs b/android/vendor/doc-comment-0.3.3/build.rs
new file mode 100644
index 0000000..77348e7
--- /dev/null
+++ b/android/vendor/doc-comment-0.3.3/build.rs
@@ -0,0 +1,24 @@
+use std::process::Command;
+
+fn main() {
+    if let Ok(v) = Command::new("rustc").arg("--version").output() {
+        let s = match String::from_utf8(v.stdout) {
+            Ok(s) => s,
+            _ => return,
+        };
+        if !s.starts_with("rustc ") {
+            return;
+        }
+        if let Some(s) = s.split(' ').skip(1).next() {
+            let s = s.split('.').collect::<Vec<_>>();
+            if s.len() < 3 {
+                return;
+            }
+            if s[0] == "1" && u32::from_str_radix(&s[1], 10)
+                                  .map(|nb| nb < 30)
+                                  .unwrap_or_else(|_| false) {
+                println!("cargo:rustc-cfg=feature=\"old_macros\"");
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/android/vendor/doc-comment-0.3.3/src/lib.rs b/android/vendor/doc-comment-0.3.3/src/lib.rs
new file mode 100644
index 0000000..620b246
--- /dev/null
+++ b/android/vendor/doc-comment-0.3.3/src/lib.rs
@@ -0,0 +1,228 @@
+//
+// Doc comment
+//
+// Copyright (c) 2018 Guillaume Gomez
+//
+
+#![cfg_attr(feature = "no_core", feature(no_core))]
+#![cfg_attr(feature = "no_core", no_core)]
+#![cfg_attr(not(feature = "no_core"), no_std)]
+
+//! The point of this (small) crate is to allow you to add doc comments from macros or
+//! to test external markdown files' code blocks through `rustdoc`.
+//!
+//! ## Including file(s) for testing
+//!
+//! Let's assume you want to test code examples in your `README.md` file which
+//! looks like this:
+//!
+//! ````text
+//! # A crate
+//!
+//! Here is a code example:
+//!
+//! ```rust
+//! let x = 2;
+//! assert!(x != 0);
+//! ```
+//! ````
+//!
+//! You can use the `doc_comment!` macro to test it like this:
+//!
+//! ```
+//! #[macro_use]
+//! extern crate doc_comment;
+//!
+//! // When running `cargo test`, rustdoc will check this file as well.
+//! doc_comment!(include_str!("../README.md"));
+//! # fn main() {}
+//! ```
+//!
+//! Please note that can also use the `doctest!` macro to have a shorter way to test an outer
+//! file:
+//!
+//! ```no_run
+//! #[macro_use]
+//! extern crate doc_comment;
+//!
+//! doctest!("../README.md");
+//! # fn main() {}
+//! ```
+//!
+//! Please also note that you can use `#[cfg(doctest)]`:
+//!
+//! ```no_run
+//! # #[macro_use]
+//! # extern crate doc_comment;
+//! #[cfg(doctest)]
+//! doctest!("../README.md");
+//! # fn main() {}
+//! ```
+//!
+//! In this case, the examples in the `README.md` file will only be run on `cargo test`. You
+//! can find more information about `#[cfg(doctest)]` in [this blogpost](https://blog.guillaume-gomez.fr/articles/2020-03-07+cfg%28doctest%29+is+stable+and+you+should+use+it).
+//!
+//! ## Generic documentation
+//!
+//! Now let's imagine you want to write documentation once for multiple types but
+//! still having examples specific to each type:
+//!
+//! ```
+//! // The macro which generates types
+//! macro_rules! gen_types {
+//!     ($tyname:ident) => {
+//!         /// This is a wonderful generated struct!
+//!         ///
+//!         /// You can use it as follow:
+//!         ///
+//!         /// ```
+//!         /// let x = FirstOne {
+//!         ///     field1: 0,
+//!         ///     field2: 0,
+//!         ///     field3: 0,
+//!         ///     field4: 0,
+//!         /// };
+//!         ///
+//!         /// println!("Created a new instance of FirstOne: {:?}", x);
+//!         /// ```
+//!         #[derive(Debug)]
+//!         pub struct $tyname {
+//!             pub field1: u8,
+//!             pub field2: u16,
+//!             pub field3: u32,
+//!             pub field4: u64,
+//!         }
+//!     }
+//! }
+//!
+//! // Now let's actually generate types:
+//! gen_types!(FirstOne);
+//! gen_types!(SecondOne);
+//! gen_types!(Another);
+//! ```
+//!
+//! So now we have created three structs with different names, but they all have the exact same
+//! documentation, which is an issue for any structs not called `FirstOne`. That's where
+//! [`doc_comment!`] macro comes in handy!
+//!
+//! Let's rewrite the `gen_types!` macro:
+//!
+//!     // Of course, we need to import the `doc_comment` macro:
+//!     #[macro_use]
+//!     extern crate doc_comment;
+//!
+//!     macro_rules! gen_types {
+//!         ($tyname:ident) => {
+//!             doc_comment! {
+//!     concat!("This is a wonderful generated struct!
+//!
+//!     You can use it as follow:
+//!
+//!     ```
+//!     let x = ", stringify!($tyname), " {
+//!         field1: 0,
+//!         field2: 0,
+//!         field3: 0,
+//!         field4: 0,
+//!     };
+//!
+//!     println!(\"Created a new instance of ", stringify!($tyname), ": {:?}\", x);
+//!     ```"),
+//!                 #[derive(Debug)]
+//!                 pub struct $tyname {
+//!                     pub field1: u8,
+//!                     pub field2: u16,
+//!                     pub field3: u32,
+//!                     pub field4: u64,
+//!                 }
+//!             }
+//!         }
+//!     }
+//!
+//!     gen_types!(FirstOne);
+//!     gen_types!(SecondOne);
+//!     gen_types!(Another);
+//!     # fn main() {}
+//!
+//! Now each struct has doc which match itself!
+
+/// This macro can be used to generate documentation upon a type/item (or just to test outer
+/// markdown file code examples).
+///
+/// # Example
+///
+/// ```
+/// #[macro_use]
+/// extern crate doc_comment;
+///
+/// // If you just want to test an outer markdown file:
+/// doc_comment!(include_str!("../README.md"));
+///
+/// // If you want to document an item:
+/// doc_comment!("fooo", pub struct Foo {});
+/// # fn main() {}
+/// ```
+#[macro_export]
+macro_rules! doc_comment {
+    ($x:expr) => {
+        #[doc = $x]
+        extern {}
+    };
+    ($x:expr, $($tt:tt)*) => {
+        #[doc = $x]
+        $($tt)*
+    };
+}
+
+/// This macro provides a simpler way to test an outer markdown file.
+///
+/// # Example
+///
+/// ```
+/// extern crate doc_comment;
+///
+/// // The two next lines are doing exactly the same thing:
+/// doc_comment::doc_comment!(include_str!("../README.md"));
+/// doc_comment::doctest!("../README.md");
+///
+/// // If you want to have a name for your tests:
+/// doc_comment::doctest!("../README.md", another);
+/// # fn main() {}
+/// ```
+#[cfg(not(feature = "old_macros"))]
+#[macro_export]
+macro_rules! doctest {
+    ($x:expr) => {
+        doc_comment::doc_comment!(include_str!($x));
+    };
+    ($x:expr, $y:ident) => {
+        doc_comment::doc_comment!(include_str!($x), mod $y {});
+    };
+}
+
+/// This macro provides a simpler way to test an outer markdown file.
+///
+/// # Example
+///
+/// ```
+/// #[macro_use]
+/// extern crate doc_comment;
+///
+/// // The two next lines are doing exactly the same thing:
+/// doc_comment!(include_str!("../README.md"));
+/// doctest!("../README.md");
+///
+/// // If you want to have a name for your tests:
+/// doctest!("../README.md", another);
+/// # fn main() {}
+/// ```
+#[cfg(feature = "old_macros")]
+#[macro_export]
+macro_rules! doctest {
+    ($x:expr) => {
+        doc_comment!(include_str!($x));
+    };
+    ($x:expr, $y:ident) => {
+        doc_comment!(include_str!($x), mod $y {});
+    };
+}
diff --git a/android/vendor/encode_unicode-0.3.6/.cargo-checksum.json b/android/vendor/encode_unicode-0.3.6/.cargo-checksum.json
new file mode 100644
index 0000000..75bdcff
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"AUTHORS.md":"f2cf336738ad935a482a799be004083ddd07c904513caf80f9e48011888fe1b6","Cargo.toml":"6fd14a963bfb44b78883bb57c082300138668bc163c949286453836116c7018d","LICENSE-APACHE":"cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30","LICENSE-MIT":"da23be69ad3ccf7a5823d62152efcd2b15de9482a5014fcb1b02844662d86abd","README.md":"c33df8cbe2645cd55d3644d4af453c0bd3cf3ffaa4a0c15ac6f3162fade966d6","RELEASES.md":"0a10f449adcf53ab00a43bb0242e38b508a51b529b3afc02eb645dbb0216b3bc","benches/multiiterators.rs":"69c878d010856a24247085356ed3045c6ceb1ac88cd75ea7a00b11206090debe","src/decoding_iterators.rs":"72c9fe0d10240e021dfc46546e814f04ab5c7e142a04305fad8c8da48575fe92","src/errors.rs":"0355e926edd1c8e81b537aca1a80fc324912a8c21e84db278c232860e3476822","src/lib.rs":"972010cd7f1b24dd048d066f1a3ff57fc16d4486a7e3583f7ae995dbd1ada5c8","src/traits.rs":"7ec1b649f23410e55bbfe6df13713040bcd292ee90a81d31437291ad100ea99f","src/utf16_char.rs":"c014de07ebc08592b3527e62d66699c8d637c8c9491835341ccdc71e28f346a1","src/utf16_iterators.rs":"9344132fb95077f05b6da8d9da77eb38ddfc8134e543313d74f286e7e545e875","src/utf8_char.rs":"349a3ebafa8ae2c88efa334958ea4d1863ca559d1b17aeb2c53113cd9afc7d15","src/utf8_iterators.rs":"e3d3bbb23253a582c48985b4eb26a4febfb40fc79a12e5fc1ca28c4cdef9fe81","tests/errs.rs":"7244966b93fc98c19a9ca163870863c1fba6107d526f8c2baa065696eb4cf9b4","tests/exhaustive.rs":"25c71761e57ac45125c2d527ddc5fc5e7b89b9b1055df3db50bce81af9844250","tests/iterators.rs":"1bda1ea031950134eef6b21e8473f4c7a2d338822cd40bb47267db4fe608d586","tests/oks.rs":"9c3e571488bc66696f7cd518f89e25bbb0ad382cbf2834f7461043237c42f6d9"},"package":"a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"}
\ No newline at end of file
diff --git a/android/vendor/encode_unicode-0.3.6/AUTHORS.md b/android/vendor/encode_unicode-0.3.6/AUTHORS.md
new file mode 100644
index 0000000..6759605
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/AUTHORS.md
@@ -0,0 +1,4 @@
+# The encode_unicode Developers
+
+* Torbjørn Birch Moltu
+* Aljoscha Meyer
diff --git a/android/vendor/encode_unicode-0.3.6/Cargo.toml b/android/vendor/encode_unicode-0.3.6/Cargo.toml
new file mode 100644
index 0000000..618c9c7
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/Cargo.toml
@@ -0,0 +1,39 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+name = "encode_unicode"
+version = "0.3.6"
+authors = ["Torbjørn Birch Moltu <t.b.moltu@lyse.net>"]
+description = "UTF-8 and UTF-16 character types, iterators and related methods for char, u8 and u16.\n"
+documentation = "https://docs.rs/encode_unicode/"
+readme = "README.md"
+keywords = ["unicode", "UTF-8", "UTF-16"]
+categories = ["encoding", "no-std"]
+license = "MIT/Apache-2.0"
+repository = "https://github.com/tormol/encode_unicode"
+[package.metadata.docs.rs]
+features = ["ascii/std"]
+[dependencies.ascii]
+version = ">=0.8, <2"
+optional = true
+default-features = false
+
+[dependencies.clippy]
+version = "0.*"
+optional = true
+
+[features]
+default = ["std"]
+std = []
+[target."cfg(unix)".dev-dependencies.lazy_static]
+version = "1.0.*"
diff --git a/android/vendor/encode_unicode-0.3.6/LICENSE-APACHE b/android/vendor/encode_unicode-0.3.6/LICENSE-APACHE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/LICENSE-APACHE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/android/vendor/encode_unicode-0.3.6/LICENSE-MIT b/android/vendor/encode_unicode-0.3.6/LICENSE-MIT
new file mode 100644
index 0000000..de22e42
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/LICENSE-MIT
@@ -0,0 +1,17 @@
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE
diff --git a/android/vendor/encode_unicode-0.3.6/README.md b/android/vendor/encode_unicode-0.3.6/README.md
new file mode 100644
index 0000000..b1bfc6c
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/README.md
@@ -0,0 +1,59 @@
+# encode_unicode
+
+UTF-8 and UTF-16 character types, iterators and related methods for `char`, `u8` and `u16`.
+
+[![crates.io page](https://img.shields.io/crates/v/encode_unicode.svg)](https://crates.io/crates/encode_unicode/)
+
+## Features
+
+* **[`Utf8Char`](https://docs.rs/encode_unicode/latest/encode_unicode/struct.Utf8Char.html)**:
+  A `char` stored as UTF-8. Can be borrowed as a `str` or `u8` slice.
+* **[`Utf16Char`](https://docs.rs/encode_unicode/latest/encode_unicode/struct.Utf16Char.html)**:
+  A `char` stored as UTF-16. Can be borrowed as an `u16` slice.
+* [Conversion methods on `char`](https://docs.rs/encode_unicode/latest/encode_unicode/trait.CharExt.html):
+  * to and from UTF-8 as `[u8; 4]` or slice.
+  * to and from UTF-16 as `(u16, Option<u16>)` or slice.
+* [Iterator adapters](https://docs.rs/encode_unicode/latest/encode_unicode/trait.IterExt.html)
+  for converting betwenn `u8`s and `Utf8Char`s or `u16`s and `Utf16Char`s.
+* Optimized [slice-based decoding iterators](https://docs.rs/encode_unicode/latest/encode_unicode/trait.SliceExt.html).
+* [Precise errors when decoding a char from UTF-8, UTF-16 or `u32` fails](http://docs.rs/encode_unicode/latest/encode_unicode/error/index.html).
+* Utility methods on [`u8`](https://docs.rs/encode_unicode/latest/encode_unicode/trait.U8UtfExt.html)
+  and [`u16`](https://docs.rs/encode_unicode/latest/encode_unicode/trait.U16UtfExt.html).
+
+The minimum supported version of Rust is 1.15,
+older versions might work now but can break with a minor update.
+
+## Optional features
+
+* `#![no_std]`-mode: There are a few differences:
+  * `Error` doesn't exist, but `description()` is made available as an inherent impl.
+  * `Extend`/`FromIterator`-implementations for `String`/`Vec<u8>`/`Vec<u16>` are missing.
+  * There is no `io`, so `Utf8Iterator` and `Utf8CharSplitter` doesn't implement `Read`.
+  This feature is enabled by setting `default-features=false` in `Cargo.toml`:
+  `encode_unicode = {version="0.3.4", default-features=false}`.
+* Integration with the [ascii](https://tomprogrammer.github.io/rust-ascii/ascii/index.html) crate:
+  Convert `Utf8Char` and `Utf16Char` to and from [ascii::`AsciiChar`](https://tomprogrammer.github.io/rust-ascii/ascii/enum.AsciiChar.html).
+
+## License
+
+Licensed under either of
+
+* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
+* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally
+submitted for inclusion in the work by you, as defined in the Apache-2.0
+license, shall be dual licensed as above, without any additional terms or
+conditions.
+
+## History
+
+The original purpose of this crate was to provide standins for the then
+unstable `encode_utf8()` and `encode_utf16()`.  
+The standins were removed in 0.3 when Rust 1.15 stabilized the `encode_`
+methods, but the other stuff I added, such as iterators like
+those `encode_utf{8,16}() returned for a while, might still be of use.
diff --git a/android/vendor/encode_unicode-0.3.6/RELEASES.md b/android/vendor/encode_unicode-0.3.6/RELEASES.md
new file mode 100644
index 0000000..371f8bf
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/RELEASES.md
@@ -0,0 +1,74 @@
+Version 0.3.6 (2019-08-23)
+==========================
+* Fix pointless undefined behavior in `Utf16Char.to_ascii_char()` (which is part of ascii feature)
+* Widen ascii version requirement to include 1.*
+* Add `[u16; 2]` UTF-16 array alternatives to `(u16, Some(u16))` UTF-16 tuple methods
+* Add `Utf16Char.is_bmp()`
+
+Version 0.3.5 (2018-10-23)
+==========================
+* Fix docs.rs build failure
+
+Version 0.3.4 (2018-10-23)
+==========================
+* Fix UB in UTF-8 validation which lead to invalid codepoints being accepted in release mode
+* Add fallible decoding iterator adapters `Utf8CharMerger` and `Utf16CharMerger`
+  and slice-based iterators `Utf8CharDecoder` and `Utf16CharDecoder`
+* Widen ascii version requirement from 0.8.* to 0.8.0 - 0.10.*
+* Implement creating / extending `String`s from `Utf16Char`-producing iterators
+
+Version 0.3.3 (2018-10-16)
+==========================
+* Fix UTF-8 overlong check. (`from_array()` and `from_slice()` accepted two-byte encodings of ASCII characters >= '@', which includes all letters)
+* Implement `FromStr` for `Utf16Char`
+* Add `from_str_start()` to `Utf8Char` and `Utf16Char`
+* Add `Utf{8,16}Char{s,Indices}`: `str`-based iterators for `Utf8Char` and `Utf16Char` equivalent to `char`'s `Chars` and `CharIndices`.
+* Add `StrExt` with functions to create the above iterators.
+* Implement `FromIterator` and `Extend` for `Vec<{u8,u16}>` with reference-producing `Utf{8,16}Char` iterators too.
+* Add `Utf8CharSplitter` and `Utf16CharSplitter`: `Utf{8,16}Char`-to-`u{8,16}` iterator adapters.
+* Add `IterExt`, `iter_bytes()` and `iter_units()` to create the above splitting iterators.
+* Add `Utf8Char::from_ascii()`, `Utf16Char::from_bmp()` with `_unchecked` versions of both.
+* Add cross-type `PartialEq` and `PartialOrd` implementations.
+* Change the `description()` for a few error types.
+
+Version 0.3.2 (2018-08-08)
+==========================
+* Hide `AsciiExt` deprecation warning and add replacement methods.
+* Correct documentation for `U8UtfExt::extra_utf8_bytes()`.
+* Fix misspellings in some error descriptions.
+* Avoid potentially bad transmutes.
+
+Version 0.3.1 (2017-06-16)
+==========================
+* Implement `Display` for `Utf8Char` and `Utf16Char`.
+
+Version 0.3.0 (2017-03-29)
+==========================
+* Replace the "no_std" feature with opt-out "std".
+  * Upgrade ascii to v0.8.
+  * Make tests compile on stable.
+* Remove `CharExt::write_utf{8,16}()` because `encode_utf{8,16}()` has been stabilized.
+* Return a proper error from `U16UtfExt::utf16_needs_extra_unit()` instead of `None`.
+* Rename `U16UtfExt::utf_is_leading_surrogate()` to `is_utf16_leading_surrogate()`.
+* Rename `Utf16Char::from_slice()` to `from_slice_start()`  and `CharExt::from_utf{8,16}_slice()`
+  to `from_utf{8,16}_slice_start()` to be consistent with `Utf8Char`.
+* Fix a bug where `CharExt::from_slice()` would accept some trailing surrogates
+  as standalone codepoints.
+
+Version 0.2.0 (2016-07-24)
+==========================
+* Change `CharExt::write_utf{8,16}()` to panic instead of returning `None`
+  if the slice is too short.
+* Fix bug where `CharExt::write_utf8()` and `Utf8Char::to_slice()` could change bytes it shouldn't.
+* Rename lots of errors with search and replace:
+  * CodePoint -> Codepoint
+  * Several -> Multiple
+* Update the ascii feature to use [ascii](https://tomprogrammer.github.io/rust-ascii/ascii/index.html) v0.7.
+* Support `#[no_std]`; see 70e090ee for differences.
+* Ungate impls of `AsciiExt`. (doesn't require ascii or nightly)
+* Make the tests compile (and pass) again.
+  (They still require nightly).
+
+Version 0.1.* (2016-04-07)
+==========================
+First release.
diff --git a/android/vendor/encode_unicode-0.3.6/benches/multiiterators.rs b/android/vendor/encode_unicode-0.3.6/benches/multiiterators.rs
new file mode 100644
index 0000000..22c3eed
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/benches/multiiterators.rs
@@ -0,0 +1,93 @@
+// uses /usr/share/dict/ for text to convert to Vec<Utf*Char> and iterate over
+#![cfg(all(unix, feature="std"))]
+#![feature(test)]
+extern crate test;
+use test::{Bencher, black_box};
+#[macro_use] extern crate lazy_static;
+extern crate encode_unicode;
+use encode_unicode::{CharExt, Utf8Char, Utf16Char, iter_bytes, iter_units};
+
+static ENGLISH: &str = include_str!("/usr/share/dict/american-english");
+// TODO find a big chinese file; `aptitude search '?provides(wordlist)'` didn't have one
+lazy_static!{
+    static ref UTF8CHARS: Vec<Utf8Char> = ENGLISH.chars().map(|c| c.to_utf8() ).collect();
+    static ref UTF16CHARS: Vec<Utf16Char> = ENGLISH.chars().map(|c| c.to_utf16() ).collect();
+}
+
+
+#[bench]
+fn utf16_split_all_single_mulititerator(b: &mut Bencher) {
+    b.iter(|| {
+        iter_units(black_box(&*UTF16CHARS)).for_each(|u| assert!(u != 0) );
+    });
+}
+#[bench]
+fn utf16_split_all_single_flatmap(b: &mut Bencher) {
+    b.iter(|| {
+        black_box(&*UTF16CHARS).iter().flat_map(|&u16c| u16c ).for_each(|u| assert!(u != 0) );
+    });
+}
+#[bench]
+fn utf16_split_all_single_cloned_flatten(b: &mut Bencher) {
+    b.iter(|| {
+        black_box(&*UTF16CHARS).iter().cloned().flatten().for_each(|u| assert!(u != 0) );
+    });
+}
+
+
+#[bench]
+fn utf8_split_mostly_ascii_multiiterator(b: &mut Bencher) {
+    b.iter(|| {
+        iter_bytes(black_box(&*UTF8CHARS)).for_each(|b| assert!(b != 0) );
+    });
+}
+#[bench]
+fn utf8_split_mostly_ascii_flatmap(b: &mut Bencher) {
+    b.iter(|| {
+        black_box(&*UTF8CHARS).iter().flat_map(|&u8c| u8c ).for_each(|b| assert!(b != 0) );
+    });
+}
+#[bench]
+fn utf8_split_mostly_ascii_cloned_flatten(b: &mut Bencher) {
+    b.iter(|| {
+        black_box(&*UTF8CHARS).iter().cloned().flatten().for_each(|b| assert!(b != 0) );
+    });
+}
+
+
+#[bench]
+fn utf8_extend_mostly_ascii_multiiterator(b: &mut Bencher) {
+    b.iter(|| {
+        let vec: Vec<u8> = iter_bytes(black_box(&*UTF8CHARS)).collect();
+        assert_eq!(black_box(vec).len(), ENGLISH.len());
+    });
+}
+#[bench]
+fn utf8_extend_mostly_ascii_custom(b: &mut Bencher) {
+    b.iter(|| {
+        let vec: Vec<u8> = black_box(&*UTF8CHARS).iter().collect();
+        assert_eq!(black_box(vec).len(), ENGLISH.len());
+    });
+}
+#[bench]
+fn utf8_extend_mostly_ascii_custom_str(b: &mut Bencher) {
+    b.iter(|| {
+        let vec: String = black_box(&*UTF8CHARS).iter().cloned().collect();
+        assert_eq!(black_box(vec).len(), ENGLISH.len());
+    });
+}
+
+#[bench]
+fn utf16_extend_all_single_multiiterator(b: &mut Bencher) {
+    b.iter(|| {
+        let vec: Vec<u16> = iter_units(black_box(&*UTF16CHARS)).collect();
+        assert!(black_box(vec).len() < ENGLISH.len());
+    });
+}
+#[bench]
+fn utf16_extend_all_single_custom(b: &mut Bencher) {
+    b.iter(|| {
+        let vec: Vec<u16> = black_box(&*UTF16CHARS).iter().collect();
+        assert!(black_box(vec).len() < ENGLISH.len());
+    });
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/decoding_iterators.rs b/android/vendor/encode_unicode-0.3.6/src/decoding_iterators.rs
new file mode 100644
index 0000000..4ef4125
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/decoding_iterators.rs
@@ -0,0 +1,494 @@
+/* Copyright 2018 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+//! Iterators that turn multiple `u8`s or `u16`s into `Utf*Char`s, but can fail.
+//!
+//! To be predictable, all errors consume one element each.
+//!
+//! The iterator adaptors produce neither offset nor element length to work
+//! well with other adaptors,
+//! while the slice iterators yield both to make more advanced use cases easy.
+
+use errors::{InvalidUtf8Slice, InvalidUtf16FirstUnit, Utf16PairError};
+use errors::InvalidUtf8Slice::*;
+use errors::InvalidUtf8::*;
+use errors::InvalidUtf8FirstByte::*;
+use errors::InvalidUtf16Slice::*;
+use errors::InvalidCodepoint::*;
+use errors::Utf16PairError::*;
+use utf8_char::Utf8Char;
+use utf16_char::Utf16Char;
+use traits::U16UtfExt;
+extern crate core;
+use self::core::borrow::Borrow;
+use self::core::fmt::{self, Debug};
+use self::core::iter::Chain;
+use self::core::option;
+
+
+/// Decodes UTF-8 characters from a byte iterator into `Utf8Char`s.
+///
+/// See [`IterExt::to_utf8chars()`](../trait.IterExt.html#tymethod.to_utf8chars)
+/// for examples and error handling.
+#[derive(Clone, Default)]
+pub struct Utf8CharMerger<B:Borrow<u8>, I:Iterator<Item=B>> {
+    iter: I,
+    /// number of bytes that were read before an error was detected
+    after_err_leftover: u8,
+    /// stack because it simplifies popping.
+    after_err_stack: [u8; 3],
+}
+impl<B:Borrow<u8>, I:Iterator<Item=B>, T:IntoIterator<IntoIter=I,Item=B>>
+From<T> for Utf8CharMerger<B, I> {
+    fn from(t: T) -> Self {
+        Utf8CharMerger {
+            iter: t.into_iter(),
+            after_err_leftover: 0,
+            after_err_stack: [0; 3],
+        }
+    }
+}
+impl<B:Borrow<u8>, I:Iterator<Item=B>> Utf8CharMerger<B,I> {
+    /// Extract the inner iterator.
+    ///
+    /// If the last item produced by `.next()` was an `Err`,
+    /// up to three following bytes might be missing.  
+    /// The exact number of missing bytes for each error type should not be relied on.
+    ///
+    /// # Examples
+    ///
+    /// Three bytes swallowed:
+    /// ```
+    /// # use encode_unicode::IterExt;
+    /// let mut merger = b"\xf4\xa1\xb2FS".iter().to_utf8chars();
+    /// assert!(merger.next().unwrap().is_err());
+    /// let mut inner: std::slice::Iter<u8> = merger.into_inner();
+    /// assert_eq!(inner.next(), Some(&b'S')); // b'\xa1', b'\xb2' and b'F' disappeared
+    /// ```
+    ///
+    /// All bytes present:
+    /// ```
+    /// # use encode_unicode::IterExt;
+    /// let mut merger = b"\xb0FS".iter().to_utf8chars();
+    /// assert!(merger.next().unwrap().is_err());
+    /// assert_eq!(merger.into_inner().next(), Some(&b'F'));
+    /// ```
+    ///
+    /// Two bytes missing:
+    /// ```
+    /// # use encode_unicode::IterExt;
+    /// let mut merger = b"\xe0\x80\x80FS".iter().to_utf8chars();
+    /// assert!(merger.next().unwrap().is_err());
+    /// assert_eq!(merger.into_inner().next(), Some(&b'F'));
+    /// ```
+    pub fn into_inner(self) -> I {
+        self.iter
+    }
+
+    fn save(&mut self,  bytes: &[u8;4],  len: usize) {
+        // forget bytes[0] and push the others onto self.after_err_stack (in reverse).
+        for &after_err in bytes[1..len].iter().rev() {
+            self.after_err_stack[self.after_err_leftover as usize] = after_err;
+            self.after_err_leftover += 1;
+        }
+    }
+    /// Reads len-1 bytes into bytes[1..]
+    fn extra(&mut self,  bytes: &mut[u8;4],  len: usize) -> Result<(),InvalidUtf8Slice> {
+        // This is the only function that pushes onto after_err_stack,
+        // and it checks that all bytes are continuation bytes before fetching the next one.
+        // Therefore only the last byte retrieved can be a non-continuation byte.
+        // That last byte is also the last to be retrieved from after_err.
+        //
+        // Before this function is called, there has been retrieved at least one byte.
+        // If that byte was a continuation byte, next() produces an error
+        // and won't call this function.
+        // Therefore, we know that after_err is empty at this point.
+        // This means that we can use self.iter directly, and knows where to start pushing
+        debug_assert_eq!(self.after_err_leftover, 0, "first: {:#02x}, stack: {:?}", bytes[0], self.after_err_stack);
+        for i in 1..len {
+            if let Some(extra) = self.iter.next() {
+                let extra = *extra.borrow();
+                bytes[i] = extra;
+                if extra & 0b1100_0000 != 0b1000_0000 {
+                    // not a continuation byte
+                    self.save(bytes, i+1);
+                    return Err(InvalidUtf8Slice::Utf8(NotAContinuationByte(i)))
+                }
+            } else {
+                self.save(bytes, i);
+                return Err(TooShort(len));
+            }
+        }
+        Ok(())
+    }
+}
+impl<B:Borrow<u8>, I:Iterator<Item=B>> Iterator for Utf8CharMerger<B,I> {
+    type Item = Result<Utf8Char,InvalidUtf8Slice>;
+    fn next(&mut self) -> Option<Self::Item> {
+        let first: u8;
+        if self.after_err_leftover != 0 {
+            self.after_err_leftover -= 1;
+            first = self.after_err_stack[self.after_err_leftover as usize];
+        } else if let Some(next) = self.iter.next() {
+            first = *next.borrow();
+        } else {
+            return None;
+        }
+
+        unsafe {
+            let mut bytes = [first, 0, 0, 0];
+            let ok = match first {
+                0b0000_0000...0b0111_1111 => {/*1 and */Ok(())},
+                0b1100_0010...0b1101_1111 => {//2 and not overlong
+                    self.extra(&mut bytes, 2) // no extra validation required
+                },
+                0b1110_0000...0b1110_1111 => {//3
+                    if let Err(e) = self.extra(&mut bytes, 3) {
+                        Err(e)
+                    } else if bytes[0] == 0b1110_0000  &&  bytes[1] <= 0b10_011111 {
+                        self.save(&bytes, 3);
+                        Err(Utf8(OverLong))
+                    } else if bytes[0] == 0b1110_1101  &&  bytes[1] & 0b11_100000 == 0b10_100000 {
+                        self.save(&bytes, 3);
+                        Err(Codepoint(Utf16Reserved))
+                    } else {
+                        Ok(())
+                    }
+                },
+                0b1111_0000...0b1111_0100 => {//4
+                    if let Err(e) = self.extra(&mut bytes, 4) {
+                        Err(e)
+                    } else if bytes[0] == 0b11110_000  &&  bytes[1] <= 0b10_001111 {
+                        self.save(&bytes, 4);
+                        Err(InvalidUtf8Slice::Utf8(OverLong))
+                    } else if bytes[0] == 0b11110_100  &&  bytes[1] > 0b10_001111 {
+                        self.save(&bytes, 4);
+                        Err(InvalidUtf8Slice::Codepoint(TooHigh))
+                    } else {
+                        Ok(())
+                    }
+                },
+                0b1000_0000...0b1011_1111 => {// continuation byte
+                    Err(Utf8(FirstByte(ContinuationByte)))
+                },
+                0b1100_0000...0b1100_0001 => {// 2 and overlong
+                    Err(Utf8(OverLong))
+                },
+                0b1111_0101...0b1111_0111 => {// 4 and too high codepoint
+                    Err(Codepoint(TooHigh))
+                },
+                0b1111_1000...0b1111_1111 => {
+                    Err(Utf8(FirstByte(TooLongSeqence)))
+                },
+                _ => unreachable!("all possible byte values should be covered")
+            };
+            Some(ok.map(|()| Utf8Char::from_array_unchecked(bytes) ))
+        }
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        let (iter_min, iter_max) = self.iter.size_hint();
+        // cannot be exact, so KISS
+        let min = iter_min / 4; // don't bother rounding up or accounting for after_err
+        // handle edge case of max > usize::MAX-3 just in case.
+        // Using wrapping_add() wouldn't violate any API contract as the trait isn't unsafe.
+        let max = iter_max.and_then(|max| {
+            max.checked_add(self.after_err_leftover as usize)
+        });
+        (min, max)
+    }
+}
+impl<B:Borrow<u8>, I:Iterator<Item=B>+Debug> Debug for Utf8CharMerger<B,I> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        let mut in_order = [0u8; 3];
+        for i in 0..self.after_err_leftover as usize {
+            in_order[i] = self.after_err_stack[self.after_err_leftover as usize - i - 1];
+        }
+        fmtr.debug_struct("Utf8CharMerger")
+            .field("buffered", &&in_order[..self.after_err_leftover as usize])
+            .field("inner", &self.iter)
+            .finish()
+    }
+}
+
+
+/// An [`Utf8CharMerger`](struct.Utf8CharMerger.html) that also produces
+/// offsets and lengths, but can only iterate over slices.
+///
+/// See [`SliceExt::utf8char_indices()`](../trait.SliceExt.html#tymethod.utf8char_indices)
+/// for examples and error handling.
+#[derive(Clone, Default)]
+pub struct Utf8CharDecoder<'a> {
+    slice: &'a[u8],
+    index: usize,
+}
+impl<'a> From<&'a[u8]> for Utf8CharDecoder<'a> {
+    fn from(s: &[u8]) -> Utf8CharDecoder {
+        Utf8CharDecoder { slice: s, index: 0 }
+    }
+}
+impl<'a> Utf8CharDecoder<'a> {
+    /// Extract the remainder of the source slice.
+    ///
+    /// # Examples
+    ///
+    /// Unlike `Utf8CharMerger::into_inner()`, bytes directly after an error
+    /// are never swallowed:
+    /// ```
+    /// # use encode_unicode::SliceExt;
+    /// let mut iter = b"\xf4\xa1\xb2FS".utf8char_indices();
+    /// assert!(iter.next().unwrap().1.is_err());
+    /// assert_eq!(iter.as_slice(), b"\xa1\xb2FS");
+    /// ```
+    pub fn as_slice(&self) -> &'a[u8] {
+        &self.slice[self.index..]
+    }
+}
+impl<'a> Iterator for Utf8CharDecoder<'a> {
+    type Item = (usize, Result<Utf8Char,InvalidUtf8Slice>, usize);
+    fn next(&mut self) -> Option<Self::Item> {
+        let start = self.index;
+        match Utf8Char::from_slice_start(&self.slice[self.index..]) {
+            Ok((u8c, len)) => {
+                self.index += len;
+                Some((start, Ok(u8c), len))
+            },
+            Err(TooShort(1)) => None,
+            Err(e) => {
+                self.index += 1;
+                Some((start, Err(e), 1))
+            }
+        }
+    }
+    #[inline]
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        let bytes = self.slice.len() - self.index;
+        // Cannot be exact, so KISS and don't bother rounding up.
+        // The slice is unlikely be full of 4-byte codepoints, so buffers
+        // allocated with the lower bound will have to be grown anyway.
+        (bytes/4, Some(bytes))
+    }
+}
+impl<'a> DoubleEndedIterator for Utf8CharDecoder<'a> {
+    fn next_back(&mut self) -> Option<Self::Item> {
+        if self.index < self.slice.len() {
+            let extras = self.slice.iter()
+                .rev()
+                .take_while(|&b| b & 0b1100_0000 == 0b1000_0000 )
+                .count();
+            let starts = self.slice.len() - (extras+1);
+            match Utf8Char::from_slice_start(&self.slice[starts..]) {
+                Ok((u8c,len)) if len == 1+extras => {
+                    self.slice = &self.slice[..starts];
+                    Some((starts, Ok(u8c), len))
+                },
+                // This enures errors for every byte in both directions,
+                // but means overlong and codepoint errors will be turned into
+                // tooshort errors.
+                Err(e) if extras == 0 => {
+                    self.slice = &self.slice[..self.slice.len()-1];
+                    Some((self.slice.len()-1, Err(e), 1))
+                },
+                _ => {
+                    self.slice = &self.slice[..self.slice.len()-1];
+                    Some((self.slice.len()-1, Err(Utf8(FirstByte(ContinuationByte))), 1))
+                },
+            }
+        } else {
+            None
+        }
+    }
+}
+impl<'a> Debug for Utf8CharDecoder<'a> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        write!(fmtr, "Utf8CharDecoder {{ bytes[{}..]: {:?} }}", self.index, self.as_slice())
+    }
+}
+
+
+
+/// Decodes UTF-16 characters from a `u16` iterator into `Utf16Char`s.
+///
+/// See [`IterExt::to_utf16chars()`](../trait.IterExt.html#tymethod.to_utf16chars)
+/// for examples and error handling.
+#[derive(Clone, Default)]
+pub struct Utf16CharMerger<B:Borrow<u16>, I:Iterator<Item=B>> {
+    iter: I,
+    /// Used when a trailing surrogate was expected, the u16 can be any value.
+    prev: Option<B>,
+}
+impl<B:Borrow<u16>, I:Iterator<Item=B>, T:IntoIterator<IntoIter=I,Item=B>>
+From<T> for Utf16CharMerger<B,I> {
+    fn from(t: T) -> Self {
+        Utf16CharMerger { iter: t.into_iter(),  prev: None }
+    }
+}
+impl<B:Borrow<u16>, I:Iterator<Item=B>> Utf16CharMerger<B,I> {
+    /// Extract the inner iterator.
+    ///
+    /// If the last item produced was an `Err`, the first unit might be missing.
+    ///
+    /// # Examples
+    ///
+    /// Unit right after an error missing
+    /// ```
+    /// # use encode_unicode::IterExt;
+    /// # use encode_unicode::error::Utf16PairError;
+    /// let mut merger = [0xd901, 'F' as u16, 'S' as u16].iter().to_utf16chars();
+    /// assert_eq!(merger.next(), Some(Err(Utf16PairError::UnmatchedLeadingSurrogate)));
+    /// let mut inner: std::slice::Iter<u16> = merger.into_inner();
+    /// assert_eq!(inner.next(), Some('S' as u16).as_ref()); // 'F' was consumed by Utf16CharMerger
+    /// ```
+    ///
+    /// Error that doesn't swallow any units
+    /// ```
+    /// # use encode_unicode::IterExt;
+    /// # use encode_unicode::error::Utf16PairError;
+    /// let mut merger = [0xde00, 'F' as u16, 'S' as u16].iter().to_utf16chars();
+    /// assert_eq!(merger.next(), Some(Err(Utf16PairError::UnexpectedTrailingSurrogate)));
+    /// let mut inner: std::slice::Iter<u16> = merger.into_inner();
+    /// assert_eq!(inner.next(), Some('F' as u16).as_ref()); // not consumed
+    /// ```
+    pub fn into_inner(self) -> I {
+        self.iter
+    }
+    /// Returns an iterator over the remaining units.
+    /// Unlike `into_inner()` this will never drop any units.
+    ///
+    /// The exact type of the returned iterator should not be depended on.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # use encode_unicode::IterExt;
+    /// # use encode_unicode::error::Utf16PairError;
+    /// let slice = [0xd901, 'F' as u16, 'S' as u16];
+    /// let mut merger = slice.iter().to_utf16chars();
+    /// assert_eq!(merger.next(), Some(Err(Utf16PairError::UnmatchedLeadingSurrogate)));
+    /// let mut remaining = merger.into_remaining_units();
+    /// assert_eq!(remaining.next(), Some('F' as u16).as_ref());
+    /// ```
+    pub fn into_remaining_units(self) -> Chain<option::IntoIter<B>,I> {
+        self.prev.into_iter().chain(self.iter)
+    }
+}
+impl<B:Borrow<u16>, I:Iterator<Item=B>> Iterator for Utf16CharMerger<B,I> {
+    type Item = Result<Utf16Char,Utf16PairError>;
+    fn next(&mut self) -> Option<Self::Item> {
+        let first = self.prev.take().or_else(|| self.iter.next() );
+        first.map(|first| unsafe {
+            match first.borrow().utf16_needs_extra_unit() {
+                Ok(false) => Ok(Utf16Char::from_array_unchecked([*first.borrow(), 0])),
+                Ok(true) => match self.iter.next() {
+                    Some(second) => match second.borrow().utf16_needs_extra_unit() {
+                        Err(InvalidUtf16FirstUnit) => Ok(Utf16Char::from_tuple_unchecked((
+                            *first.borrow(),
+                            Some(*second.borrow())
+                        ))),
+                        Ok(_) => {
+                            self.prev = Some(second);
+                            Err(Utf16PairError::UnmatchedLeadingSurrogate)
+                        }
+                    },
+                    None => Err(Utf16PairError::Incomplete)
+                },
+                Err(InvalidUtf16FirstUnit) => Err(Utf16PairError::UnexpectedTrailingSurrogate),
+            }
+        })
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        let (iter_min, iter_max) = self.iter.size_hint();
+        // cannot be exact, so KISS
+        let min = iter_min / 2; // don't bother rounding up or accounting for self.prev
+        let max = match (iter_max, &self.prev) {
+            (Some(max), &Some(_)) => max.checked_add(1),
+            (max, _) => max,
+        };
+        (min, max)
+    }
+}
+impl<B:Borrow<u16>, I:Iterator<Item=B>+Debug> Debug for Utf16CharMerger<B,I> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmtr.debug_struct("Utf16CharMerger")
+            .field("buffered", &self.prev.as_ref().map(|b| *b.borrow() ))
+            .field("inner", &self.iter)
+            .finish()
+    }
+}
+
+
+/// An [`Utf16CharMerger`](struct.Utf16CharMerger.html) that also produces
+/// offsets and lengths, but can only iterate over slices.
+///
+/// See [`SliceExt::utf16char_indices()`](../trait.SliceExt.html#tymethod.utf16char_indices)
+/// for examples and error handling.
+#[derive(Clone, Default)]
+pub struct Utf16CharDecoder<'a> {
+    slice: &'a[u16],
+    index: usize,
+}
+impl<'a> From<&'a[u16]> for Utf16CharDecoder<'a> {
+    fn from(s: &'a[u16]) -> Self {
+        Utf16CharDecoder{ slice: s,  index: 0 }
+    }
+}
+impl<'a> Utf16CharDecoder<'a> {
+    /// Extract the remainder of the source slice.
+    ///
+    /// # Examples
+    ///
+    /// Unlike `Utf16CharMerger::into_inner()`, the unit after an error is never swallowed:
+    /// ```
+    /// # use encode_unicode::SliceExt;
+    /// # use encode_unicode::error::Utf16PairError;
+    /// let mut iter = [0xd901, 'F' as u16, 'S' as u16].utf16char_indices();
+    /// assert_eq!(iter.next(), Some((0, Err(Utf16PairError::UnmatchedLeadingSurrogate), 1)));
+    /// assert_eq!(iter.as_slice(), &['F' as u16, 'S' as u16]);
+    /// ```
+    pub fn as_slice(&self) -> &[u16] {
+        &self.slice[self.index..]
+    }
+}
+impl<'a> Iterator for Utf16CharDecoder<'a> {
+    type Item = (usize,Result<Utf16Char,Utf16PairError>,usize);
+    #[inline]
+    fn next(&mut self) -> Option<Self::Item>  {
+        let start = self.index;
+        match Utf16Char::from_slice_start(self.as_slice()) {
+            Ok((u16c,len)) => {
+                self.index += len;
+                Some((start, Ok(u16c), len))
+            },
+            Err(EmptySlice) => None,
+            Err(FirstLowSurrogate) => {
+                self.index += 1;
+                Some((start, Err(UnexpectedTrailingSurrogate), 1))
+            },
+            Err(SecondNotLowSurrogate) => {
+                self.index += 1;
+                Some((start, Err(UnmatchedLeadingSurrogate), 1))
+            },
+            Err(MissingSecond) => {
+                self.index = self.slice.len();
+                Some((start, Err(Incomplete), 1))
+            }
+        }
+    }
+    #[inline]
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        let units = self.slice.len() - self.index;
+        // Cannot be exact, so KISS and don't bother rounding up.
+        // The slice is unlikely be full of surrogate pairs, so buffers
+        // allocated with the lower bound will have to be grown anyway.
+        (units/2, Some(units))
+    }
+}
+impl<'a> Debug for Utf16CharDecoder<'a> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        write!(fmtr, "Utf16CharDecoder {{ units[{}..]: {:?} }}", self.index, self.as_slice())
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/errors.rs b/android/vendor/encode_unicode-0.3.6/src/errors.rs
new file mode 100644
index 0000000..fb587fa
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/errors.rs
@@ -0,0 +1,289 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+
+//! Boilerplatey error types
+
+extern crate core;
+use self::core::fmt::{self,Display,Formatter};
+#[cfg(feature="std")]
+use std::error::Error;
+
+
+macro_rules! description {($err:ty, $desc:expr) => {
+    #[cfg(not(feature="std"))]
+    impl $err {
+        #[allow(missing_docs)]
+        pub fn description(&self) -> &'static str {
+            ($desc)(self)
+        }
+    }
+    #[cfg(feature="std")]
+    impl Error for $err {
+        fn description(&self) -> &'static str {
+            ($desc)(self)
+        }
+    }
+    impl Display for $err {
+        fn fmt(&self,  fmtr: &mut Formatter) -> fmt::Result {
+            write!(fmtr, "{}", self.description())
+        }
+    }
+}}
+
+
+macro_rules! single_cause {(#[$doc1:meta] #[$doc2:meta] $err:ident => $desc:expr) => {
+    // Rust 1.15 doesn't understand $(#[$doc:meta])* $:ident
+    #[$doc1]
+    #[$doc2]
+    #[derive(Clone,Copy, Debug, PartialEq,Eq)]
+    pub struct $err;
+    description!{$err, |_| $desc }
+}}
+
+
+single_cause!{
+    /// Cannot tell whether an `u16` needs an extra unit,
+    /// because it's a trailing surrogate itself.
+    InvalidUtf16FirstUnit => "is a trailing surrogate"
+}
+
+single_cause!{
+    /// Cannot create an `Utf8Char` or `Utf16Char` from the first codepoint of a str,
+    /// because there are none.
+    EmptyStrError => "is empty"
+}
+
+single_cause!{
+    /// Cannot create an `Utf8Char` from a standalone `u8`
+    /// that is not an ASCII character.
+    NonAsciiError => "is not an ASCII character"
+}
+
+single_cause!{
+    /// Cannot create an `Utf16Char` from a standalone `u16` that is not a
+    /// codepoint in the basic multilingual plane, but part of a suurrogate pair.
+    NonBMPError => "is not a codepoint in the basic multilingual plane"
+}
+
+
+
+macro_rules! simple {(#[$tydoc:meta] $err:ident  {
+                          $($(#[$vardoc:meta])* ::$variant:ident => $string:expr),+,
+                      } ) => {
+    #[$tydoc]
+    #[derive(Clone,Copy, Debug, PartialEq,Eq)]
+    pub enum $err {
+        $($(#[$vardoc])* $variant),*
+    }
+    description!{$err, |e: &$err| match *e {$($err::$variant=>$string),*} }
+}}
+
+
+simple!{/// Reasons why an `u32` is not a valid UTF codepoint.
+    InvalidCodepoint {
+        /// It's reserved for UTF-16 surrogate pairs."
+        ::Utf16Reserved => "is reserved for UTF-16 surrogate pairs",
+        /// It's higher than the highest codepoint (which is 0x10ffff).
+        ::TooHigh => "is higher than the highest codepoint",
+    }}
+use self::InvalidCodepoint::*;
+impl InvalidCodepoint {
+    /// Get the range of values for which this error would be given.
+    pub fn error_range(self) -> (u32,u32) {match self {
+        Utf16Reserved => (0xd8_00, 0xdf_ff),
+        TooHigh => (0x00_10_ff_ff, 0xff_ff_ff_ff),
+    }}
+}
+
+
+simple!{/// Reasons why a `[u16; 2]` doesn't form a valid UTF-16 codepoint.
+    InvalidUtf16Array {
+        /// The first unit is a trailing/low surrogate, which is never valid.
+        ::FirstIsTrailingSurrogate => "the first unit is a trailing surrogate, which is never valid",
+        /// The second unit is needed, but is not a trailing surrogate.
+        ::SecondIsNotTrailingSurrogate => "the second unit is needed but is not a trailing surrogate",
+    }}
+
+simple!{/// Reasons why one or two `u16`s are not valid UTF-16, in sinking precedence.
+    InvalidUtf16Tuple {
+        /// The first unit is a trailing/low surrogate, which is never valid.
+        ///
+        /// Note that the value of a low surrogate is actually higher than a high surrogate.
+        ::FirstIsTrailingSurrogate => "the first unit is a trailing / low surrogate, which is never valid",
+        /// You provided a second unit, but the first one stands on its own.
+        ::SuperfluousSecond => "the second unit is superfluous",
+        /// The first and only unit requires a second unit.
+        ::MissingSecond => "the first unit requires a second unit",
+        /// The first unit requires a second unit, but it's not a trailing/low surrogate.
+        ///
+        /// Note that the value of a low surrogate is actually higher than a high surrogate.
+        ::InvalidSecond => "the required second unit is not a trailing / low surrogate",
+    }}
+
+
+simple!{/// Reasons why a slice of `u16`s doesn't start with valid UTF-16.
+    InvalidUtf16Slice {
+        /// The slice is empty.
+        ::EmptySlice => "the slice is empty",
+        /// The first unit is a low surrogate.
+        ::FirstLowSurrogate => "the first unit is a trailing surrogate",
+        /// The first and only unit requires a second unit.
+        ::MissingSecond => "the first and only unit requires a second one",
+        /// The first unit requires a second one, but it's not a trailing surrogate.
+        ::SecondNotLowSurrogate => "the required second unit is not a trailing surrogate",
+    }}
+
+simple!{/// Types of invalid sequences encountered by `Utf16CharParser`.
+    Utf16PairError {
+        /// A trailing surrogate was not preceeded by a leading surrogate.
+        ::UnexpectedTrailingSurrogate => "a trailing surrogate was not preceeded by a leading surrogate",
+        /// A leading surrogate was followed by an unit that was not a trailing surrogate.
+        ::UnmatchedLeadingSurrogate => "a leading surrogate was followed by an unit that was not a trailing surrogate",
+        /// A trailing surrogate was expected when the end was reached.
+        ::Incomplete => "a trailing surrogate was expected when the end was reached",
+    }}
+
+
+simple!{/// Reasons why `Utf8Char::from_str()` or `Utf16Char::from_str()` failed.
+    FromStrError {
+        /// `Utf8Char` or `Utf16Char` cannot store more than a single codepoint.
+        ::MultipleCodepoints => "has more than one codepoint",
+        /// `Utf8Char` or `Utf16Char` cannot be empty.
+        ::Empty => "is empty",
+    }}
+
+
+simple!{/// Reasons why a byte is not the start of a UTF-8 codepoint.
+    InvalidUtf8FirstByte {
+        /// Sequences cannot be longer than 4 bytes. Is given for values >= 240.
+        ::TooLongSeqence => "is greater than 247 (UTF-8 sequences cannot be longer than four bytes)",
+        /// This byte belongs to a previous sequence. Is given for values between 128 and 192 (exclusive).
+        ::ContinuationByte => "is a continuation of a previous sequence",
+    }}
+use self::InvalidUtf8FirstByte::*;
+
+
+
+macro_rules! complex {
+($err:ty
+ {$($sub:ty => $to:expr,)*}
+ {$($desc:pat => $string:expr),+,}
+ => $use_cause:expr =>
+ {$($cause:pat => $result:expr),+,} $(#[$causedoc:meta])*
+) => {
+    $(impl From<$sub> for $err {
+          fn from(error: $sub) -> $err {
+              $to(error)
+          }
+      })*
+    #[cfg(not(feature="std"))]
+    impl $err {
+        #[allow(missing_docs)]
+        pub fn description(&self) -> &'static str {
+            match *self{ $($desc => $string,)* }
+        }
+        /// A hack to avoid two Display impls
+        fn cause(&self) -> Option<&Display> {None}
+    }
+    #[cfg(feature="std")]
+    impl Error for $err {
+        fn description(&self) -> &'static str {
+            match *self{ $($desc => $string,)* }
+        }
+        $(#[$causedoc])*
+        fn cause(&self) -> Option<&Error> {
+            match *self{ $($cause => $result,)* }
+        }
+    }
+    impl Display for $err {
+        fn fmt(&self,  fmtr: &mut Formatter) -> fmt::Result {
+            match (self.cause(), $use_cause) {
+                (Some(d),true) => write!(fmtr, "{}: {}", self.description(), d),
+                        _      => write!(fmtr, "{}", self.description()),
+            }
+        }
+    }
+}}
+
+
+/// Reasons why a byte sequence is not valid UTF-8, excluding invalid codepoint.
+/// In sinking precedence.
+#[derive(Clone,Copy, Debug, PartialEq,Eq)]
+pub enum InvalidUtf8 {
+    /// Something is wrong with the first byte.
+    FirstByte(InvalidUtf8FirstByte),
+    /// The byte at index 1...3 should be a continuation byte,
+    /// but dosesn't fit the pattern 0b10xx_xxxx.
+    NotAContinuationByte(usize),
+    /// There are too many leading zeros: it could be a byte shorter.
+    ///
+    /// [Decoding this could allow someone to input otherwise prohibited
+    /// characters and sequences, such as "../"](https://tools.ietf.org/html/rfc3629#section-10).
+    OverLong,
+}
+use self::InvalidUtf8::*;
+complex!{InvalidUtf8 {
+        InvalidUtf8FirstByte => FirstByte,
+    } {
+        FirstByte(TooLongSeqence) => "the first byte is greater than 239 (UTF-8 sequences cannot be longer than four bytes)",
+        FirstByte(ContinuationByte) => "the first byte is a continuation of a previous sequence",
+        OverLong => "the sequence contains too many zeros and could be shorter",
+        NotAContinuationByte(_) => "the sequence is too short",
+    } => false => {
+        FirstByte(ref cause) => Some(cause),
+        _ => None,
+    }/// Returns `Some` if the error is a `InvalidUtf8FirstByte`.
+}
+
+
+/// Reasons why a byte array is not valid UTF-8, in sinking precedence.
+#[derive(Clone,Copy, Debug, PartialEq,Eq)]
+pub enum InvalidUtf8Array {
+    /// Not a valid UTF-8 sequence.
+    Utf8(InvalidUtf8),
+    /// Not a valid unicode codepoint.
+    Codepoint(InvalidCodepoint),
+}
+complex!{InvalidUtf8Array {
+        InvalidUtf8 => InvalidUtf8Array::Utf8,
+        InvalidCodepoint => InvalidUtf8Array::Codepoint,
+    } {
+        InvalidUtf8Array::Utf8(_) => "the sequence is invalid UTF-8",
+        InvalidUtf8Array::Codepoint(_) => "the encoded codepoint is invalid",
+    } => true => {
+        InvalidUtf8Array::Utf8(ref u) => Some(u),
+        InvalidUtf8Array::Codepoint(ref c) => Some(c),
+    }/// Always returns `Some`.
+}
+
+
+/// Reasons why a byte slice is not valid UTF-8, in sinking precedence.
+#[derive(Clone,Copy, Debug, PartialEq,Eq)]
+pub enum InvalidUtf8Slice {
+    /// Something is certainly wrong with the first byte.
+    Utf8(InvalidUtf8),
+    /// The encoded codepoint is invalid:
+    Codepoint(InvalidCodepoint),
+    /// The slice is too short; n bytes was required.
+    TooShort(usize),
+}
+complex!{InvalidUtf8Slice {
+        InvalidUtf8 => InvalidUtf8Slice::Utf8,
+        InvalidCodepoint => InvalidUtf8Slice::Codepoint,
+    } {
+        InvalidUtf8Slice::Utf8(_) => "the sequence is invalid UTF-8",
+        InvalidUtf8Slice::Codepoint(_) => "the encoded codepoint is invalid",
+        InvalidUtf8Slice::TooShort(1) => "the slice is empty",
+        InvalidUtf8Slice::TooShort(_) => "the slice is shorter than the sequence",
+    } => true => {
+        InvalidUtf8Slice::Utf8(ref u) => Some(u),
+        InvalidUtf8Slice::Codepoint(ref c) => Some(c),
+        InvalidUtf8Slice::TooShort(_) => None,
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/lib.rs b/android/vendor/encode_unicode-0.3.6/src/lib.rs
new file mode 100644
index 0000000..c50e126
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/lib.rs
@@ -0,0 +1,78 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+
+/*!
+Miscellaneous UTF-8 and UTF-16 types and methods.
+
+# Optional features:
+* `#![no_std]`-mode: There are a few differences:
+  * `Error` doesn't exist, but `description()` is made available as an inherent impl.
+  * `Extend`/`FromIterator`-implementations for `String`/`Vec<u8>`/`Vec<u16>` are missing.
+  * There is no `io`, so `Utf8Iterator` and `Utf8CharSplitter` doesn't implement `Read`.
+
+  This feature is enabled by setting `default-features=false` in `Cargo.toml`:
+  `encode_unicode = {version="0.3.4", default-features=false}`
+* Integration with the [ascii](https://tomprogrammer.github.io/rust-ascii/ascii/index.html) crate:  
+  Convert `Utf8Char` and `Utf16Char` to and from
+  [ascii::`AsciiChar`](https://tomprogrammer.github.io/rust-ascii/ascii/enum.AsciiChar.html).
+
+The minimum supported version of Rust is 1.15,
+older versions might work now but can break with a minor update.
+
+[crates.io page](https://crates.io/crates/encode_unicode)  
+[github repository](https://github.com/tormol/encode_unicode)
+
+*/
+
+#![warn(missing_docs)]
+
+#![cfg_attr(not(feature="std"), no_std)]
+// either `cargo clippy` doesn't see theese, or I get a warning when I build.
+#![cfg_attr(feature="clippy", feature(plugin))]
+#![cfg_attr(feature="clippy", plugin(clippy))]
+#![cfg_attr(feature="clippy", allow(derive_hash_xor_eq))]// tested
+#![cfg_attr(feature="clippy", allow(len_without_is_empty))]// UtfxChar is never empty
+#![cfg_attr(feature="clippy", allow(match_same_arms))]// looks better IMO
+#![cfg_attr(feature="clippy", allow(needless_return))]// `foo.bar(); foo` looks unfinished
+#![cfg_attr(feature="clippy", allow(redundant_closure))]// keep it explicit
+#![cfg_attr(feature="clippy", allow(redundant_closure_call))]// not redundant in macros
+#![cfg_attr(feature="clippy", allow(cast_lossless))]// too much noise (and too verbose)
+// precedence: I prefer spaces to parentheses, but it's nice to recheck.
+
+mod errors;
+mod traits;
+mod utf8_char;
+mod utf8_iterators;
+mod utf16_char;
+mod utf16_iterators;
+mod decoding_iterators;
+
+pub use traits::{CharExt, U8UtfExt, U16UtfExt, StrExt, IterExt, SliceExt};
+pub use utf8_char::Utf8Char;
+pub use utf16_char::Utf16Char;
+pub use utf8_iterators::{Utf8Iterator, iter_bytes};
+pub use utf16_iterators::{Utf16Iterator, iter_units};
+
+pub mod error {// keeping the public interface in one file
+    //! Errors returned by various conversion methods in this crate.
+    pub use errors::{FromStrError, EmptyStrError};
+    pub use errors::{InvalidCodepoint, InvalidUtf8};
+    pub use errors::{InvalidUtf8FirstByte,InvalidUtf16FirstUnit};
+    pub use errors::{InvalidUtf8Slice,InvalidUtf16Slice};
+    pub use errors::{InvalidUtf8Array,InvalidUtf16Array,InvalidUtf16Tuple};
+    pub use errors::Utf16PairError;
+}
+
+pub mod iterator {
+    //! Iterator types that you should rarely need to name
+    pub use utf8_iterators::{Utf8Iterator, Utf8CharSplitter, Utf8Chars, Utf8CharIndices};
+    pub use utf16_iterators::{Utf16Iterator, Utf16CharSplitter, Utf16Chars, Utf16CharIndices};
+    pub use decoding_iterators::{Utf8CharMerger, Utf8CharDecoder};
+    pub use decoding_iterators::{Utf16CharMerger, Utf16CharDecoder};
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/traits.rs b/android/vendor/encode_unicode-0.3.6/src/traits.rs
new file mode 100644
index 0000000..3f36903
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/traits.rs
@@ -0,0 +1,1014 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+#![allow(unused_unsafe)]// explicit unsafe{} blocks in unsafe functions are a good thing.
+
+use utf8_char::Utf8Char;
+use utf16_char::Utf16Char;
+use utf8_iterators::*;
+use utf16_iterators::*;
+use decoding_iterators::*;
+use error::*;
+extern crate core;
+use self::core::{char, u32, mem};
+use self::core::ops::{Not, Index, RangeFull};
+use self::core::borrow::Borrow;
+#[cfg(feature="ascii")]
+extern crate ascii;
+#[cfg(feature="ascii")]
+use self::ascii::AsciiStr;
+
+// TODO better docs and tests
+
+/// Methods for working with `u8`s as UTF-8 bytes.
+pub trait U8UtfExt {
+    /// How many more bytes will you need to complete this codepoint?
+    ///
+    /// # Errors
+    ///
+    /// An error is returned if the byte is not a valid start of an UTF-8
+    /// codepoint:
+    ///
+    /// * `128..192`: ContinuationByte
+    /// * `248..`: TooLongSequence
+    ///
+    /// Values in 244..248 represent a too high codepoint, but do not cause an
+    /// error.
+    fn extra_utf8_bytes(self) -> Result<usize,InvalidUtf8FirstByte>;
+
+    /// How many more bytes will you need to complete this codepoint?
+    ///
+    /// This function assumes that the byte is a valid UTF-8 start, and might
+    /// return any value otherwise. (but the function is pure and safe to call
+    /// with any value).
+    fn extra_utf8_bytes_unchecked(self) -> usize;
+}
+
+impl U8UtfExt for u8 {
+    #[inline]
+    fn extra_utf8_bytes(self) -> Result<usize,InvalidUtf8FirstByte> {
+        use error::InvalidUtf8FirstByte::{ContinuationByte,TooLongSeqence};
+        // the bit twiddling is explained in extra_utf8_bytes_unchecked()
+        if self < 128 {
+            return Ok(0);
+        }
+        match ((self as u32)<<25).not().leading_zeros() {
+            n @ 1...3 => Ok(n as usize),
+            0 => Err(ContinuationByte),
+            _ => Err(TooLongSeqence),
+        }
+    }
+    #[inline]
+    fn extra_utf8_bytes_unchecked(self) -> usize {
+        // For fun I've optimized this function (for x86 instruction count):
+        // The most straightforward implementation, that lets the compiler do
+        // the optimizing:
+        //match self {
+        //    0b0000_0000...0b0111_1111 => 0,
+        //    0b1100_0010...0b1101_1111 => 1,
+        //    0b1110_0000...0b1110_1111 => 2,
+        //    0b1111_0000...0b1111_0100 => 3,
+        //                _             => whatever()
+        //}
+        // Using `unsafe{self::core::hint::unreachable_unchecked()}` for the
+        // "don't care" case is a terrible idea: while having the function
+        // non-deterministically return whatever happens to be in a register
+        // MIGHT be acceptable, it permits the function to not `ret`urn at all,
+        // but let execution fall through to whatever comes after it in the
+        // binary! (in other words completely UB).
+        // Currently unreachable_unchecked() might trap too,
+        // which is certainly not what we want.
+        // I also think `unsafe{mem::unitialized()}` is much more likely to
+        // explicitly produce whatever happens to be in a register than tell
+        // the compiler it can ignore this branch but needs to produce a value.
+        //
+        // From the bit patterns we see that for non-ASCII values the result is
+        // (number of leading set bits) - 1
+        // The standard library doesn't have a method for counting leading ones,
+        // but it has leading_zeros(), which can be used after inverting.
+        // This function can therefore be reduced to the one-liner
+        //`self.not().leading_zeros().saturating_sub(1) as usize`, which would
+        // be branchless for architectures with instructions for
+        // leading_zeros() and saturating_sub().
+
+        // Shortest version as long as ASCII-ness can be predicted: (especially
+        // if the BSR instruction which leading_zeros() uses is microcoded or
+        // doesn't exist)
+        // u8.leading_zeros() would cast to a bigger type internally, so that's
+        // free. compensating by shifting left by 24 before inverting lets the
+        // compiler know that the value passed to leading_zeros() is not zero,
+        // for which BSR's output is undefined and leading_zeros() normally has
+        // special case with a branch.
+        // Shifting one bit too many left acts as a saturating_sub(1).
+        if self<128 {0} else {((self as u32)<<25).not().leading_zeros() as usize}
+
+        // Branchless but longer version: (9 instructions)
+        // It's tempting to try (self|0x80).not().leading_zeros().wrapping_sub(1),
+        // but that produces high lengths for ASCII values 0b01xx_xxxx.
+        // If we could somehow (branchlessy) clear that bit for ASCII values...
+        // We can by masking with the value shifted right with sign extension!
+        // (any nonzero number of bits in range works)
+        //let extended = self as i8 as i32;
+        //let ascii_cleared = (extended<<25) & (extended>>25);
+        //ascii_cleared.not().leading_zeros() as usize
+
+        // cmov version: (7 instructions)
+        //(((self as u32)<<24).not().leading_zeros() as usize).saturating_sub(1)
+    }
+}
+
+
+/// Methods for working with `u16`s as UTF-16 units.
+pub trait U16UtfExt {
+    /// Will you need an extra unit to complete this codepoint?
+    ///
+    /// Returns `Err` for trailing surrogates, `Ok(true)` for leading surrogates,
+    /// and `Ok(false)` for others.
+    fn utf16_needs_extra_unit(self) -> Result<bool,InvalidUtf16FirstUnit>;
+
+    /// Does this `u16` need another `u16` to complete a codepoint?
+    /// Returns `(self & 0xfc00) == 0xd800`
+    ///
+    /// Is basically an unchecked variant of `utf16_needs_extra_unit()`.
+    fn is_utf16_leading_surrogate(self) -> bool;
+}
+impl U16UtfExt for u16 {
+    #[inline]
+    fn utf16_needs_extra_unit(self) -> Result<bool,InvalidUtf16FirstUnit> {
+        match self {
+            // https://en.wikipedia.org/wiki/UTF-16#U.2B10000_to_U.2B10FFFF
+            0x00_00...0xd7_ff | 0xe0_00...0xff_ff => Ok(false),
+            0xd8_00...0xdb_ff => Ok(true),
+                    _         => Err(InvalidUtf16FirstUnit)
+        }
+    }
+    #[inline]
+    fn is_utf16_leading_surrogate(self) -> bool {
+        (self & 0xfc00) == 0xd800// Clear the ten content bytes of a surrogate,
+                                 // and see if it's a leading surrogate.
+    }
+}
+
+
+
+
+/// Extension trait for `char` that adds methods for converting to and from UTF-8 or UTF-16.
+pub trait CharExt: Sized {
+    /// Get the UTF-8 representation of this codepoint.
+    ///
+    /// `Utf8Char` is to `[u8;4]` what `char` is to `u32`:
+    /// a restricted type that cannot be mutated internally.
+    fn to_utf8(self) -> Utf8Char;
+
+    /// Get the UTF-16 representation of this codepoint.
+    ///
+    /// `Utf16Char` is to `[u16;2]` what `char` is to `u32`:
+    /// a restricted type that cannot be mutated internally.
+    fn to_utf16(self) -> Utf16Char;
+
+    /// Iterate over or [read](https://doc.rust-lang.org/std/io/trait.Read.html)
+    /// the one to four bytes in the UTF-8 representation of this codepoint.
+    ///
+    /// An identical alternative to the unstable `char.encode_utf8()`.
+    /// That method somehow still exist on stable, so I have to use a different name.
+    fn iter_utf8_bytes(self) -> Utf8Iterator;
+
+    /// Iterate over the one or two units in the UTF-16 representation of this codepoint.
+    ///
+    /// An identical alternative to the unstable `char.encode_utf16()`.
+    /// That method somehow still exist on stable, so I have to use a different name.
+    fn iter_utf16_units(self) -> Utf16Iterator;
+
+
+    /// Convert this char to an UTF-8 array, and also return how many bytes of
+    /// the array are used,
+    ///
+    /// The returned array is left-aligned with unused bytes set to zero.
+    fn to_utf8_array(self) -> ([u8; 4], usize);
+
+    /// Convert this `char` to UTF-16.
+    ///
+    /// The second element is non-zero when a surrogate pair is required.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    ///
+    /// assert_eq!('@'.to_utf16_array(), ['@' as u16, 0]);
+    /// assert_eq!('睷'.to_utf16_array(), ['睷' as u16, 0]);
+    /// assert_eq!('\u{abcde}'.to_utf16_array(), [0xda6f, 0xdcde]);
+    /// ```
+    fn to_utf16_array(self) -> [u16; 2];
+
+    /// Convert this `char` to UTF-16.
+    /// The second item is `Some` if a surrogate pair is required.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    ///
+    /// assert_eq!('@'.to_utf16_tuple(), ('@' as u16, None));
+    /// assert_eq!('睷'.to_utf16_tuple(), ('睷' as u16, None));
+    /// assert_eq!('\u{abcde}'.to_utf16_tuple(), (0xda6f, Some(0xdcde)));
+    /// ```
+    fn to_utf16_tuple(self) -> (u16, Option<u16>);
+
+
+
+    /// Create a `char` from the start of an UTF-8 slice,
+    /// and also return how many bytes were used.
+    ///
+    /// # Errors
+    ///
+    /// Returns an `Err` if the slice is empty, doesn't start with a valid
+    /// UTF-8 sequence or is too short for the sequence.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    /// use encode_unicode::error::InvalidUtf8Slice::*;
+    /// use encode_unicode::error::InvalidUtf8::*;
+    ///
+    /// assert_eq!(char::from_utf8_slice_start(&[b'A', b'B', b'C']), Ok(('A',1)));
+    /// assert_eq!(char::from_utf8_slice_start(&[0xdd, 0xbb]), Ok(('\u{77b}',2)));
+    ///
+    /// assert_eq!(char::from_utf8_slice_start(&[]), Err(TooShort(1)));
+    /// assert_eq!(char::from_utf8_slice_start(&[0xf0, 0x99]), Err(TooShort(4)));
+    /// assert_eq!(char::from_utf8_slice_start(&[0xee, b'F', 0x80]), Err(Utf8(NotAContinuationByte(1))));
+    /// assert_eq!(char::from_utf8_slice_start(&[0xee, 0x99, 0x0f]), Err(Utf8(NotAContinuationByte(2))));
+    /// ```
+    fn from_utf8_slice_start(src: &[u8]) -> Result<(Self,usize),InvalidUtf8Slice>;
+
+    /// Create a `char` from the start of an UTF-16 slice,
+    /// and also return how many units were used.
+    ///
+    /// If you want to continue after an error, continue with the next `u16` unit.
+    fn from_utf16_slice_start(src: &[u16]) -> Result<(Self,usize), InvalidUtf16Slice>;
+
+
+    /// Convert an UTF-8 sequence as returned from `.to_utf8_array()` into a `char`
+    ///
+    /// The codepoint must start at the first byte, and leftover bytes are ignored.
+    ///
+    /// # Errors
+    ///
+    /// Returns an `Err` if the array doesn't start with a valid UTF-8 sequence.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    /// use encode_unicode::error::InvalidUtf8Array::*;
+    /// use encode_unicode::error::InvalidUtf8::*;
+    /// use encode_unicode::error::InvalidCodepoint::*;
+    ///
+    /// assert_eq!(char::from_utf8_array([b'A', 0, 0, 0]), Ok('A'));
+    /// assert_eq!(char::from_utf8_array([0xf4, 0x8b, 0xbb, 0xbb]), Ok('\u{10befb}'));
+    /// assert_eq!(char::from_utf8_array([b'A', b'B', b'C', b'D']), Ok('A'));
+    /// assert_eq!(char::from_utf8_array([0, 0, 0xcc, 0xbb]), Ok('\0'));
+    ///
+    /// assert_eq!(char::from_utf8_array([0xef, b'F', 0x80, 0x80]), Err(Utf8(NotAContinuationByte(1))));
+    /// assert_eq!(char::from_utf8_array([0xc1, 0x80, 0, 0]), Err(Utf8(OverLong)));
+    /// assert_eq!(char::from_utf8_array([0xf7, 0xaa, 0x99, 0x88]), Err(Codepoint(TooHigh)));
+    /// ```
+    fn from_utf8_array(utf8: [u8; 4]) -> Result<Self,InvalidUtf8Array>;
+
+    /// Convert a UTF-16 pair as returned from `.to_utf16_array()` into a `char`.
+    ///
+    /// The second element is ignored when not required.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    /// use encode_unicode::error::InvalidUtf16Array;
+    ///
+    /// assert_eq!(char::from_utf16_array(['x' as u16, 'y' as u16]), Ok('x'));
+    /// assert_eq!(char::from_utf16_array(['睷' as u16, 0]), Ok('睷'));
+    /// assert_eq!(char::from_utf16_array([0xda6f, 0xdcde]), Ok('\u{abcde}'));
+    /// assert_eq!(char::from_utf16_array([0xf111, 0xdbad]), Ok('\u{f111}'));
+    /// assert_eq!(char::from_utf16_array([0xdaaf, 0xdaaf]), Err(InvalidUtf16Array::SecondIsNotTrailingSurrogate));
+    /// assert_eq!(char::from_utf16_array([0xdcac, 0x9000]), Err(InvalidUtf16Array::FirstIsTrailingSurrogate));
+    /// ```
+    fn from_utf16_array(utf16: [u16; 2]) -> Result<Self, InvalidUtf16Array>;
+
+    /// Convert a UTF-16 pair as returned from `.to_utf16_tuple()` into a `char`.
+    fn from_utf16_tuple(utf16: (u16, Option<u16>)) -> Result<Self, InvalidUtf16Tuple>;
+
+
+    /// Convert an UTF-8 sequence into a char.
+    ///
+    /// The length of the slice is taken as length of the sequence;
+    /// it should be 1,2,3 or 4.
+    ///
+    /// # Safety
+    ///
+    /// The slice must contain exactly one, valid, UTF-8 sequence.
+    ///
+    /// Passing a slice that produces an invalid codepoint is always undefined
+    /// behavior; Later checks that the codepoint is valid can be removed
+    /// by the compiler.
+    ///
+    /// # Panics
+    ///
+    /// If the slice is empty
+    unsafe fn from_utf8_exact_slice_unchecked(src: &[u8]) -> Self;
+
+    /// Convert a UTF-16 array as returned from `.to_utf16_array()` into a
+    /// `char`.
+    ///
+    /// This function is safe because it avoids creating invalid codepoints,
+    /// but the returned value might not be what one expectedd.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    ///
+    /// // starts with a trailing surrogate - converted as if it was a valid
+    /// // surrogate pair anyway.
+    /// assert_eq!(char::from_utf16_array_unchecked([0xdbad, 0xf19e]), '\u{fb59e}');
+    /// // missing trailing surrogate - ditto
+    /// assert_eq!(char::from_utf16_array_unchecked([0xd802, 0]), '\u{10800}');
+    /// ```
+    fn from_utf16_array_unchecked(utf16: [u16;2]) -> Self;
+
+    /// Convert a UTF-16 tuple as returned from `.to_utf16_tuple()` into a `char`.
+    unsafe fn from_utf16_tuple_unchecked(utf16: (u16, Option<u16>)) -> Self;
+
+
+    /// Produces more detailed errors than `char::from_u32()`
+    ///
+    /// # Errors
+    ///
+    /// This function will return an error if
+    ///
+    /// * the value is greater than 0x10ffff
+    /// * the value is between 0xd800 and 0xdfff (inclusive)
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::CharExt;
+    /// use encode_unicode::error::InvalidCodepoint;
+    ///
+    /// assert_eq!(char::from_u32_detailed(0x41), Ok('A'));
+    /// assert_eq!(char::from_u32_detailed(0x40_00_00), Err(InvalidCodepoint::TooHigh));
+    /// assert_eq!(char::from_u32_detailed(0xd951), Err(InvalidCodepoint::Utf16Reserved));
+    /// assert_eq!(char::from_u32_detailed(0xdddd), Err(InvalidCodepoint::Utf16Reserved));
+    /// assert_eq!(char::from_u32_detailed(0xdd), Ok('Ý'));
+    /// assert_eq!(char::from_u32_detailed(0x1f331), Ok('🌱'));
+    /// ```
+    fn from_u32_detailed(c: u32) -> Result<Self,InvalidCodepoint>;
+}
+
+
+
+impl CharExt for char {
+      /////////
+     //UTF-8//
+    /////////
+
+    fn to_utf8(self) -> Utf8Char {
+        self.into()
+    }
+    fn iter_utf8_bytes(self) -> Utf8Iterator {
+        self.to_utf8().into_iter()
+    }
+
+    fn to_utf8_array(self) -> ([u8; 4], usize) {
+        let len = self.len_utf8();
+        let mut c = self as u32;
+        if len == 1 {// ASCII, the common case
+            ([c as u8, 0, 0, 0],  1)
+        } else {
+            let mut parts = 0;// convert to 6-bit bytes
+                        parts |= c & 0x3f;  c>>=6;
+            parts<<=8;  parts |= c & 0x3f;  c>>=6;
+            parts<<=8;  parts |= c & 0x3f;  c>>=6;
+            parts<<=8;  parts |= c & 0x3f;
+            parts |= 0x80_80_80_80;// set the most significant bit
+            parts >>= 8*(4-len);// right-align bytes
+            // Now, unused bytes are zero, (which matters for Utf8Char.eq())
+            // and the rest are 0b10xx_xxxx
+
+            // set header on first byte
+            parts |= (0xff_00u32 >> len)  &  0xff;// store length
+            parts &= Not::not(1u32 << 7-len);// clear the next bit after it
+
+            let bytes: [u8; 4] = unsafe{ mem::transmute(u32::from_le(parts)) };
+            (bytes, len)
+        }
+    }
+
+
+    fn from_utf8_slice_start(src: &[u8]) -> Result<(Self,usize),InvalidUtf8Slice> {
+        use errors::InvalidUtf8::*;
+        use errors::InvalidUtf8Slice::*;
+        let first = match src.first() {
+            Some(first) => *first,
+            None => return Err(TooShort(1)),
+        };
+        let bytes = match first.extra_utf8_bytes() {
+            Err(e)    => return Err(Utf8(FirstByte(e))),
+            Ok(0)     => return Ok((first as char, 1)),
+            Ok(extra) if extra >= src.len()
+                      => return Err(TooShort(extra+1)),
+            Ok(extra) => &src[..extra+1],
+        };
+        if let Some(i) = bytes.iter().skip(1).position(|&b| (b >> 6) != 0b10 ) {
+            Err(Utf8(NotAContinuationByte(i+1)))
+        } else if overlong(bytes[0], bytes[1]) {
+            Err(Utf8(OverLong))
+        } else {
+            match char::from_u32_detailed(merge_nonascii_unchecked_utf8(bytes)) {
+                Ok(c) => Ok((c, bytes.len())),
+                Err(e) => Err(Codepoint(e)),
+            }
+        }
+    }
+
+    fn from_utf8_array(utf8: [u8; 4]) -> Result<Self,InvalidUtf8Array> {
+        use errors::InvalidUtf8::*;
+        use errors::InvalidUtf8Array::*;
+        let src = match utf8[0].extra_utf8_bytes() {
+            Err(error) => return Err(Utf8(FirstByte(error))),
+            Ok(0)      => return Ok(utf8[0] as char),
+            Ok(extra)  => &utf8[..extra+1],
+        };
+        if let Some(i) = src[1..].iter().position(|&b| (b >> 6) != 0b10 ) {
+            Err(Utf8(NotAContinuationByte(i+1)))
+        } else if overlong(utf8[0], utf8[1]) {
+            Err(Utf8(OverLong))
+        } else {
+            char::from_u32_detailed(merge_nonascii_unchecked_utf8(src))
+                 .map_err(|e| Codepoint(e) )
+        }
+    }
+
+    unsafe fn from_utf8_exact_slice_unchecked(src: &[u8]) -> Self {
+        if src.len() == 1 {
+            src[0] as char
+        } else {
+            char::from_u32_unchecked(merge_nonascii_unchecked_utf8(src))
+        }
+    }
+
+
+
+      //////////
+     //UTF-16//
+    //////////
+
+    fn to_utf16(self) -> Utf16Char {
+        Utf16Char::from(self)
+    }
+    fn iter_utf16_units(self) -> Utf16Iterator {
+        self.to_utf16().into_iter()
+    }
+
+    fn to_utf16_array(self) -> [u16;2] {
+        let (first, second) = self.to_utf16_tuple();
+        [first, second.unwrap_or(0)]
+    }
+    fn to_utf16_tuple(self) -> (u16, Option<u16>) {
+        if self <= '\u{ffff}' {// single
+            (self as u16, None)
+        } else {// double
+            let c = self as u32 - 0x_01_00_00;
+            let high = 0x_d8_00 + (c >> 10);
+            let low = 0x_dc_00 + (c & 0x_03_ff);
+            (high as u16,  Some(low as u16))
+        }
+    }
+
+
+    fn from_utf16_slice_start(src: &[u16]) -> Result<(Self,usize), InvalidUtf16Slice> {
+        use errors::InvalidUtf16Slice::*;
+        unsafe {match (src.get(0), src.get(1)) {
+            (Some(&u @ 0x00_00...0xd7_ff), _) |
+            (Some(&u @ 0xe0_00...0xff_ff), _)
+                => Ok((char::from_u32_unchecked(u as u32), 1)),
+            (Some(&0xdc_00...0xdf_ff), _) => Err(FirstLowSurrogate),
+            (None, _) => Err(EmptySlice),
+            (Some(&f @ 0xd8_00...0xdb_ff), Some(&s @ 0xdc_00...0xdf_ff))
+                => Ok((char::from_utf16_tuple_unchecked((f, Some(s))), 2)),
+            (Some(&0xd8_00...0xdb_ff), Some(_)) => Err(SecondNotLowSurrogate),
+            (Some(&0xd8_00...0xdb_ff), None) => Err(MissingSecond),
+            (Some(_), _) => unreachable!()
+        }}
+    }
+
+    fn from_utf16_array(utf16: [u16;2]) -> Result<Self, InvalidUtf16Array> {
+        use errors::InvalidUtf16Array::*;
+        if let Some(c) = char::from_u32(utf16[0] as u32) {
+            Ok(c) // single
+        } else if utf16[0] < 0xdc_00  &&  utf16[1] & 0xfc_00 == 0xdc_00 {
+            // correct surrogate pair
+            Ok(combine_surrogates(utf16[0], utf16[1]))
+        } else if utf16[0] < 0xdc_00 {
+            Err(SecondIsNotTrailingSurrogate)
+        } else {
+            Err(FirstIsTrailingSurrogate)
+        }
+    }
+    fn from_utf16_tuple(utf16: (u16, Option<u16>)) -> Result<Self, InvalidUtf16Tuple> {
+        use errors::InvalidUtf16Tuple::*;
+        unsafe{ match utf16 {
+            (0x00_00...0xd7_ff, None) | // single
+            (0xe0_00...0xff_ff, None) | // single
+            (0xd8_00...0xdb_ff, Some(0xdc_00...0xdf_ff)) // correct surrogate
+                => Ok(char::from_utf16_tuple_unchecked(utf16)),
+            (0xd8_00...0xdb_ff, Some(_)) => Err(InvalidSecond),
+            (0xd8_00...0xdb_ff, None   ) => Err(MissingSecond),
+            (0xdc_00...0xdf_ff,    _   ) => Err(FirstIsTrailingSurrogate),
+            (        _        , Some(_)) => Err(SuperfluousSecond),
+            (        _        , None   ) => unreachable!()
+        }}
+    }
+
+    fn from_utf16_array_unchecked(utf16: [u16;2]) -> Self {
+        // treat any array with a surrogate value in [0] as a surrogate because
+        // combine_surrogates() is safe.
+        // `(utf16[0] & 0xf800) == 0xd80` might not be quite as fast as
+        // `utf16[1] != 0`, but avoiding the potential for UB is worth it
+        // since the conversion isn't zero-cost in either case.
+        char::from_u32(utf16[0] as u32)
+            .unwrap_or_else(|| combine_surrogates(utf16[0], utf16[1]) )
+    }
+    unsafe fn from_utf16_tuple_unchecked(utf16: (u16, Option<u16>)) -> Self {
+        match utf16.1 {
+            Some(second) => combine_surrogates(utf16.0, second),
+            None         => char::from_u32_unchecked(utf16.0 as u32)
+        }
+    }
+
+
+    fn from_u32_detailed(c: u32) -> Result<Self,InvalidCodepoint> {
+        match char::from_u32(c) {
+            Some(c) => Ok(c),
+            None if c > 0x10_ff_ff => Err(InvalidCodepoint::TooHigh),
+            None => Err(InvalidCodepoint::Utf16Reserved),
+        }
+    }
+}
+
+// Adapted from https://www.cl.cam.ac.uk/~mgk25/ucs/utf8_check.c
+fn overlong(first: u8, second: u8) -> bool {
+    if first < 0x80 {
+        false
+    } else if (first & 0xe0) == 0xc0 {
+        (first & 0xfe) == 0xc0
+    } else if (first & 0xf0) == 0xe0 {
+        first == 0xe0 && (second & 0xe0) == 0x80
+    } else {
+        first == 0xf0 && (second & 0xf0) == 0x80
+    }
+}
+
+/// Decodes the codepoint represented by a multi-byte UTF-8 sequence.
+///
+/// Does not check that the codepoint is valid,
+/// and returns `u32` because casting invalid codepoints to `char` is insta UB.
+fn merge_nonascii_unchecked_utf8(src: &[u8]) -> u32 {
+    let mut c = src[0] as u32 & (0x7f >> src.len());
+    for b in &src[1..] {
+        c = (c << 6)  |  (b & 0b0011_1111) as u32;
+    }
+    c
+}
+
+/// Create a `char` from a leading and a trailing surrogate.
+///
+/// This function is safe because it ignores the six most significant bits of
+/// each arguments and always produces a codepoint in 0x01_00_00..=0x10_ff_ff.
+fn combine_surrogates(first: u16,  second: u16) -> char {
+    unsafe {
+        let high = (first & 0x_03_ff) as u32;
+        let low = (second & 0x_03_ff) as u32;
+        let c = ((high << 10) | low) + 0x_01_00_00; // no, the constant can't be or'd in
+        char::from_u32_unchecked(c)
+    }
+}
+
+
+
+/// Adds `.utf8chars()` and `.utf16chars()` iterator constructors to `&str`.
+pub trait StrExt: AsRef<str> {
+    /// Equivalent to `.chars()` but produces `Utf8Char`s.
+    fn utf8chars(&self) -> Utf8Chars;
+    /// Equivalent to `.chars()` but produces `Utf16Char`s.
+    fn utf16chars(&self) -> Utf16Chars;
+    /// Equivalent to `.char_indices()` but produces `Utf8Char`s.
+    fn utf8char_indices(&self) -> Utf8CharIndices;
+    /// Equivalent to `.char_indices()` but produces `Utf16Char`s.
+    fn utf16char_indices(&self) -> Utf16CharIndices;
+}
+
+impl StrExt for str {
+    fn utf8chars(&self) -> Utf8Chars {
+        Utf8Chars::from(self)
+    }
+    fn utf16chars(&self) -> Utf16Chars {
+        Utf16Chars::from(self)
+    }
+    fn utf8char_indices(&self) -> Utf8CharIndices {
+        Utf8CharIndices::from(self)
+    }
+    fn utf16char_indices(&self) -> Utf16CharIndices {
+        Utf16CharIndices::from(self)
+    }
+}
+
+#[cfg(feature="ascii")]
+impl StrExt for AsciiStr {
+    fn utf8chars(&self) -> Utf8Chars {
+        Utf8Chars::from(self.as_str())
+    }
+    fn utf16chars(&self) -> Utf16Chars {
+        Utf16Chars::from(self.as_str())
+    }
+    fn utf8char_indices(&self) -> Utf8CharIndices {
+        Utf8CharIndices::from(self.as_str())
+    }
+    fn utf16char_indices(&self) -> Utf16CharIndices {
+        Utf16CharIndices::from(self.as_str())
+    }
+}
+
+
+
+/// Iterator methods that convert between `u8`s and `Utf8Char` or `u16`s and `Utf16Char`
+///
+/// All the iterator adapters also accept iterators that produce references of
+/// the type they convert from.
+pub trait IterExt: Iterator+Sized {
+    /// Converts an iterator of `Utf8Char`s or `&Utf8Char`s to an iterator of
+    /// `u8`s.
+    ///
+    /// Has the same effect as `.flat_map()` or `.flatten()`, but the returned
+    /// iterator is ~40% faster.
+    ///
+    /// The iterator also implements `Read`
+    /// (when the `std` feature isn't disabled).  
+    /// Reading will never produce an error, and calls to `.read()` and `.next()`
+    /// can be mixed.
+    ///
+    /// The exact number of bytes cannot be known in advance, but `size_hint()`
+    /// gives the possible range.
+    /// (min: all remaining characters are ASCII, max: all require four bytes)
+    ///
+    /// # Examples
+    ///
+    /// From iterator of values:
+    ///
+    /// ```
+    /// use encode_unicode::{IterExt, StrExt};
+    ///
+    /// let iterator = "foo".utf8chars();
+    /// let mut bytes = [0; 4];
+    /// for (u,dst) in iterator.to_bytes().zip(&mut bytes) {*dst=u;}
+    /// assert_eq!(&bytes, b"foo\0");
+    /// ```
+    ///
+    /// From iterator of references:
+    ///
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{IterExt, StrExt, Utf8Char};
+    ///
+    /// let chars: Vec<Utf8Char> = "💣 bomb 💣".utf8chars().collect();
+    /// let bytes: Vec<u8> = chars.iter().to_bytes().collect();
+    /// let flat_map: Vec<u8> = chars.iter().flat_map(|u8c| *u8c ).collect();
+    /// assert_eq!(bytes, flat_map);
+    /// ```
+    ///
+    /// `Read`ing from it:
+    ///
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{IterExt, StrExt};
+    /// use std::io::Read;
+    ///
+    /// let s = "Ååh‽";
+    /// assert_eq!(s.len(), 8);
+    /// let mut buf = [b'E'; 9];
+    /// let mut reader = s.utf8chars().to_bytes();
+    /// assert_eq!(reader.read(&mut buf[..]).unwrap(), 8);
+    /// assert_eq!(reader.read(&mut buf[..]).unwrap(), 0);
+    /// assert_eq!(&buf[..8], s.as_bytes());
+    /// assert_eq!(buf[8], b'E');
+    /// ```
+    fn to_bytes(self) -> Utf8CharSplitter<Self::Item,Self> where Self::Item: Borrow<Utf8Char>;
+
+    /// Converts an iterator of `Utf16Char` (or `&Utf16Char`) to an iterator of
+    /// `u16`s.
+    ///
+    /// Has the same effect as `.flat_map()` or `.flatten()`, but the returned
+    /// iterator is about twice as fast.
+    ///
+    /// The exact number of units cannot be known in advance, but `size_hint()`
+    /// gives the possible range.
+    ///
+    /// # Examples
+    ///
+    /// From iterator of values:
+    ///
+    /// ```
+    /// use encode_unicode::{IterExt, StrExt};
+    ///
+    /// let iterator = "foo".utf16chars();
+    /// let mut units = [0; 4];
+    /// for (u,dst) in iterator.to_units().zip(&mut units) {*dst=u;}
+    ///
+    /// assert_eq!(units, ['f' as u16, 'o' as u16, 'o' as u16, 0]);
+    /// ```
+    ///
+    /// From iterator of references:
+    ///
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{IterExt, StrExt, Utf16Char};
+    ///
+    /// // (💣 takes two units)
+    /// let chars: Vec<Utf16Char> = "💣 bomb 💣".utf16chars().collect();
+    /// let units: Vec<u16> = chars.iter().to_units().collect();
+    /// let flat_map: Vec<u16> = chars.iter().flat_map(|u16c| *u16c ).collect();
+    ///
+    /// assert_eq!(units, flat_map);
+    /// ```
+    fn to_units(self) -> Utf16CharSplitter<Self::Item,Self> where Self::Item: Borrow<Utf16Char>;
+
+    /// Decodes bytes as UTF-8 and groups them into `Utf8Char`s
+    ///
+    /// When errors (invalid values or sequences) are encountered,
+    /// it continues with the byte right after the start of the error sequence.  
+    /// This is neither the most intelligent choiche (sometimes it is guaranteed to
+    ///  produce another error), nor the easiest to implement, but I believe it to
+    /// be the most predictable.
+    /// It also means that ASCII characters are never hidden by errors.
+    ///
+    /// # Examples
+    ///
+    /// Replace all errors with u+FFFD REPLACEMENT_CHARACTER:
+    /// ```
+    /// use encode_unicode::{Utf8Char, IterExt};
+    ///
+    /// let mut buf = [b'\0'; 255];
+    /// let len = b"foo\xCFbar".iter()
+    ///     .to_utf8chars()
+    ///     .flat_map(|r| r.unwrap_or(Utf8Char::from('\u{FFFD}')).into_iter() )
+    ///     .zip(&mut buf[..])
+    ///     .map(|(byte, dst)| *dst = byte )
+    ///     .count();
+    ///
+    /// assert_eq!(&buf[..len], "foo\u{FFFD}bar".as_bytes());
+    /// ```
+    ///
+    /// Collect everything up until the first error into a string:
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::iterator::Utf8CharMerger;
+    /// let mut good = String::new();
+    /// for r in Utf8CharMerger::from(b"foo\xcc\xbbbar\xcc\xddbaz") {
+    ///     if let Ok(uc) = r {
+    ///         good.push_str(uc.as_str());
+    ///     } else {
+    ///         break;
+    ///     }
+    /// }
+    /// assert_eq!(good, "foo̻bar");
+    /// ```
+    ///
+    /// Abort decoding on error:
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{IterExt, Utf8Char};
+    /// use encode_unicode::error::{InvalidUtf8Slice, InvalidUtf8};
+    ///
+    /// let result = b"ab\0\xe0\xbc\xa9 \xf3\x80\x77".iter()
+    ///     .to_utf8chars()
+    ///     .collect::<Result<String,InvalidUtf8Slice>>();
+    ///
+    /// assert_eq!(result, Err(InvalidUtf8Slice::Utf8(InvalidUtf8::NotAContinuationByte(2))));
+    /// ```
+    fn to_utf8chars(self) -> Utf8CharMerger<Self::Item,Self> where Self::Item: Borrow<u8>;
+
+    /// Decodes bytes as UTF-16 and groups them into `Utf16Char`s
+    ///
+    /// When errors (unmatched leading surrogates or unexpected trailing surrogates)
+    /// are encountered, an error is produced for every unit.
+    ///
+    /// # Examples
+    ///
+    /// Replace errors with '�':
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{IterExt, Utf16Char};
+    ///
+    /// let slice = &['a' as u16, 0xdf00, 0xd83c, 0xdca0][..];
+    /// let string = slice.iter()
+    ///     .to_utf16chars()
+    ///     .map(|r| r.unwrap_or(Utf16Char::from('\u{fffd}')) ) // REPLACEMENT_CHARACTER
+    ///     .collect::<String>();
+    ///
+    /// assert_eq!(string, "a�🂠");
+    /// ```
+    ///
+    /// ```
+    /// use encode_unicode::{IterExt, Utf16Char};
+    /// use encode_unicode::error::Utf16PairError::*;
+    ///
+    /// let slice = [0xdcba, 0xdeff, 0xd8be, 0xdeee, 'Y' as u16, 0xdab1, 0xdab1];
+    /// let mut iter = slice.iter().to_utf16chars();
+    /// assert_eq!(iter.size_hint(), (3, Some(7)));
+    /// assert_eq!(iter.next(), Some(Err(UnexpectedTrailingSurrogate)));
+    /// assert_eq!(iter.next(), Some(Err(UnexpectedTrailingSurrogate)));
+    /// assert_eq!(iter.next(), Some(Ok(Utf16Char::from('\u{3faee}'))));
+    /// assert_eq!(iter.next(), Some(Ok(Utf16Char::from('Y'))));
+    /// assert_eq!(iter.next(), Some(Err(UnmatchedLeadingSurrogate)));
+    /// assert_eq!(iter.next(), Some(Err(Incomplete)));
+    /// assert_eq!(iter.into_remaining_units().next(), None);
+    /// ```
+    ///
+    /// Search for a codepoint and return the codepoint index of the first match:
+    /// ```
+    /// use encode_unicode::{IterExt, Utf16Char};
+    ///
+    /// let position = [0xd875, 0xdd4f, '≈' as u16, '2' as u16].iter()
+    ///     .to_utf16chars()
+    ///     .position(|r| r == Ok(Utf16Char::from('≈')) );
+    ///
+    /// assert_eq!(position, Some(1));
+    /// ```
+    fn to_utf16chars(self) -> Utf16CharMerger<Self::Item,Self> where Self::Item: Borrow<u16>;
+}
+
+impl<I:Iterator> IterExt for I {
+    fn to_bytes(self) -> Utf8CharSplitter<Self::Item,Self> where Self::Item: Borrow<Utf8Char> {
+        iter_bytes(self)
+    }
+    fn to_units(self) -> Utf16CharSplitter<Self::Item,Self> where Self::Item: Borrow<Utf16Char> {
+        iter_units(self)
+    }
+    fn to_utf8chars(self) -> Utf8CharMerger<Self::Item,Self> where Self::Item: Borrow<u8> {
+        Utf8CharMerger::from(self)
+    }
+    fn to_utf16chars(self) -> Utf16CharMerger<Self::Item,Self> where Self::Item: Borrow<u16> {
+        Utf16CharMerger::from(self)
+    }
+}
+
+
+/// Methods for iterating over `u8` and `u16` slices as UTF-8 or UTF-16 characters.
+///
+/// The iterators are slightly faster than the similar methods in [`IterExt`](trait.IterExt.html)
+/// because they con "push back" items for free after errors and don't need a
+/// separate buffer that must be checked on every call to `.next()`.
+pub trait SliceExt: Index<RangeFull> {
+    /// Decode `u8` slices as UTF-8 and iterate over the codepoints as `Utf8Char`s,
+    ///
+    /// # Examples
+    ///
+    /// Get the index and error type of the first error:
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{SliceExt, Utf8Char};
+    /// use encode_unicode::error::InvalidUtf8Slice;
+    ///
+    /// let slice = b"ab\0\xe0\xbc\xa9 \xf3\x80\x77";
+    /// let result = slice.utf8char_indices()
+    ///     .map(|(offset,r,length)| r.map_err(|e| (offset,e,length) ) )
+    ///     .collect::<Result<String,(usize,InvalidUtf8Slice,usize)>>();
+    ///
+    /// assert_eq!(result, Err((7, InvalidUtf8Slice::TooShort(4), 1)));
+    /// ```
+    ///
+    /// ```
+    /// use encode_unicode::{SliceExt, Utf8Char};
+    /// use std::error::Error;
+    ///
+    /// let slice = b"\xf0\xbf\xbf\xbfXY\xdd\xbb\xe1\x80\x99quux123";
+    /// let mut fixed_size = [Utf8Char::default(); 8];
+    /// for (cp_i, (byte_index, r, _)) in slice.utf8char_indices().enumerate().take(8) {
+    ///     match r {
+    ///         Ok(u8c) => fixed_size[cp_i] = u8c,
+    ///         Err(e) => panic!("Invalid codepoint at index {} ({})", cp_i, e.description()),
+    ///     }
+    /// }
+    /// let chars = ['\u{3ffff}', 'X', 'Y', '\u{77b}', '\u{1019}', 'q', 'u', 'u'];
+    /// assert_eq!(fixed_size, chars);
+    /// ```
+    ///
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{SliceExt, Utf8Char};
+    /// use encode_unicode::error::InvalidUtf8Slice::*;
+    /// use encode_unicode::error::{InvalidUtf8, InvalidUtf8FirstByte, InvalidCodepoint};
+    ///
+    /// let bytes = b"\xfa-\xf4\x8f\xee\xa1\x8f-\xed\xa9\x87\xf0\xcc\xbb";
+    /// let mut errors = Vec::new();
+    /// let mut lengths = Vec::new();
+    /// let mut string = String::new();
+    /// for (offset,result,length) in bytes.utf8char_indices() {
+    ///     lengths.push((offset,length));
+    ///     let c = result.unwrap_or_else(|error| {
+    ///         errors.push((offset,error));
+    ///         Utf8Char::from('\u{fffd}') // replacement character
+    ///     });
+    ///     string.push_str(c.as_str());
+    /// }
+    ///
+    /// assert_eq!(string, "�-��\u{e84f}-����\u{33b}");
+    /// assert_eq!(lengths, [(0,1), (1,1), (2,1), (3,1), (4,3), (7,1),
+    ///                      (8,1), (9,1), (10,1), (11,1), (12,2)]);
+    /// assert_eq!(errors, [
+    ///     ( 0, Utf8(InvalidUtf8::FirstByte(InvalidUtf8FirstByte::TooLongSeqence))),
+    ///     ( 2, Utf8(InvalidUtf8::NotAContinuationByte(2))),
+    ///     ( 3, Utf8(InvalidUtf8::FirstByte(InvalidUtf8FirstByte::ContinuationByte))),
+    ///     ( 8, Codepoint(InvalidCodepoint::Utf16Reserved)),
+    ///     ( 9, Utf8(InvalidUtf8::FirstByte(InvalidUtf8FirstByte::ContinuationByte))),
+    ///     (10, Utf8(InvalidUtf8::FirstByte(InvalidUtf8FirstByte::ContinuationByte))),
+    ///     (11, TooShort(4)), // (but it was not the last element returned!)
+    /// ]);
+    /// ```
+    fn utf8char_indices(&self) -> Utf8CharDecoder where Self::Output: Borrow<[u8]>;
+
+
+    /// Decode `u16` slices as UTF-16 and iterate over the codepoints as `Utf16Char`s,
+    ///
+    /// The iterator produces `(usize,Result<Utf16Char,Utf16Error>,usize)`,
+    /// and the slice is validated as you go.
+    ///
+    /// The first `usize` contains the offset from the start of the slice and
+    /// the last `usize` contains the length of the codepoint or error.
+    /// The length is either 1 or 2, and always 1 for errors.
+    ///
+    /// # Examples
+    ///
+    #[cfg_attr(feature="std", doc=" ```")]
+    #[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+    /// use encode_unicode::{SliceExt, Utf8Char};
+    ///
+    /// let slice = &['a' as u16, 0xdf00, 0xd83c, 0xdca0][..];
+    /// let mut errors = Vec::new();
+    /// let string = slice.utf16char_indices().map(|(offset,r,_)| match r {
+    ///     Ok(u16c) => Utf8Char::from(u16c),
+    ///     Err(_) => {
+    ///         errors.push(offset);
+    ///         Utf8Char::from('\u{fffd}') // REPLACEMENT_CHARACTER
+    ///     }
+    /// }).collect::<String>();
+    ///
+    /// assert_eq!(string, "a�🂠");
+    /// assert_eq!(errors, [1]);
+    /// ```
+    ///
+    /// Search for a codepoint and return its unit and codepoint index.
+    /// ```
+    /// use encode_unicode::{SliceExt, Utf16Char};
+    ///
+    /// let slice = [0xd875,/*'𝕏'*/ 0xdd4f, '≈' as u16, '2' as u16];
+    /// let position = slice.utf16char_indices()
+    ///     .enumerate()
+    ///     .find(|&(_,(_,r,_))| r == Ok(Utf16Char::from('≈')) )
+    ///     .map(|(codepoint, (offset, _, _))| (codepoint, offset) );
+    ///
+    /// assert_eq!(position, Some((1,2)));
+    /// ```
+    ///
+    /// Error types:
+    /// ```
+    /// use encode_unicode::{SliceExt, Utf16Char};
+    /// use encode_unicode::error::Utf16PairError::*;
+    ///
+    /// let slice = [0xdcba, 0xdeff, 0xd8be, 0xdeee, 'λ' as u16, 0xdab1, 0xdab1];
+    /// let mut iter = slice.utf16char_indices();
+    /// assert_eq!(iter.next(), Some((0, Err(UnexpectedTrailingSurrogate), 1)));
+    /// assert_eq!(iter.next(), Some((1, Err(UnexpectedTrailingSurrogate), 1)));
+    /// assert_eq!(iter.next(), Some((2, Ok(Utf16Char::from('\u{3faee}')), 2)));
+    /// assert_eq!(iter.next(), Some((4, Ok(Utf16Char::from('λ')), 1)));
+    /// assert_eq!(iter.next(), Some((5, Err(UnmatchedLeadingSurrogate), 1)));
+    /// assert_eq!(iter.next(), Some((6, Err(Incomplete), 1)));
+    /// assert_eq!(iter.next(), None);
+    /// assert_eq!(iter.as_slice(), [])
+    /// ```
+    fn utf16char_indices(&self) -> Utf16CharDecoder where Self::Output: Borrow<[u16]>;
+}
+
+impl<S: ?Sized+Index<RangeFull>> SliceExt for S {
+    fn utf8char_indices(&self) -> Utf8CharDecoder where Self::Output: Borrow<[u8]> {
+        Utf8CharDecoder::from(self[..].borrow())
+    }
+    fn utf16char_indices(&self) -> Utf16CharDecoder where Self::Output: Borrow<[u16]> {
+        Utf16CharDecoder::from(self[..].borrow())
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/utf16_char.rs b/android/vendor/encode_unicode-0.3.6/src/utf16_char.rs
new file mode 100644
index 0000000..d8a6cec
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/utf16_char.rs
@@ -0,0 +1,687 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+use utf16_iterators::Utf16Iterator;
+use traits::{CharExt, U16UtfExt};
+use utf8_char::Utf8Char;
+use errors::{InvalidUtf16Slice, InvalidUtf16Array, InvalidUtf16Tuple};
+use errors::{NonBMPError, EmptyStrError, FromStrError};
+extern crate core;
+use self::core::{hash,fmt};
+use self::core::cmp::Ordering;
+use self::core::borrow::Borrow;
+use self::core::ops::Deref;
+use self::core::str::FromStr;
+#[cfg(feature="std")]
+use self::core::iter::FromIterator;
+#[cfg(feature="std")]
+#[allow(deprecated)]
+use std::ascii::AsciiExt;
+#[cfg(feature="ascii")]
+use self::core::char;
+#[cfg(feature="ascii")]
+extern crate ascii;
+#[cfg(feature="ascii")]
+use self::ascii::{AsciiChar,ToAsciiChar,ToAsciiCharError};
+
+
+// I don't think there is any good default value for char, but char does.
+#[derive(Default)]
+// char doesn't do anything more advanced than u32 for Eq/Ord, so we shouldn't either.
+// When it's a single unit, the second is zero, so Eq works.
+// #[derive(Ord)] however, breaks on surrogate pairs.
+#[derive(PartialEq,Eq)]
+#[derive(Clone,Copy)]
+
+
+/// An unicode codepoint stored as UTF-16.
+///
+/// It can be borrowed as an `u16` slice, and has the same size as `char`.
+pub struct Utf16Char {
+    units: [u16; 2],
+}
+
+
+  /////////////////////
+ //conversion traits//
+/////////////////////
+impl FromStr for Utf16Char {
+    type Err = FromStrError;
+    /// Create an `Utf16Char` from a string slice.
+    /// The string must contain exactly one codepoint.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::error::FromStrError::*;
+    /// use encode_unicode::Utf16Char;
+    /// use std::str::FromStr;
+    ///
+    /// assert_eq!(Utf16Char::from_str("a"), Ok(Utf16Char::from('a')));
+    /// assert_eq!(Utf16Char::from_str("🂠"), Ok(Utf16Char::from('🂠')));
+    /// assert_eq!(Utf16Char::from_str(""), Err(Empty));
+    /// assert_eq!(Utf16Char::from_str("ab"), Err(MultipleCodepoints));
+    /// assert_eq!(Utf16Char::from_str("é"), Err(MultipleCodepoints));// 'e'+u301 combining mark
+    /// ```
+    fn from_str(s: &str) -> Result<Self, FromStrError> {
+        match Utf16Char::from_str_start(s) {
+            Ok((u16c,bytes)) if bytes == s.len() => Ok(u16c),
+            Ok((_,_)) => Err(FromStrError::MultipleCodepoints),
+            Err(EmptyStrError) => Err(FromStrError::Empty),
+        }
+    }
+}
+impl From<char> for Utf16Char {
+    fn from(c: char) -> Self {
+        let (first, second) = c.to_utf16_tuple();
+        Utf16Char{ units: [first, second.unwrap_or(0)] }
+    }
+}
+impl From<Utf8Char> for Utf16Char {
+    fn from(utf8: Utf8Char) -> Utf16Char {
+        let (b, utf8_len) = utf8.to_array();
+        match utf8_len {
+            1 => Utf16Char{ units: [b[0] as u16, 0] },
+            4 => {// need surrogate
+                let mut first = 0xd800 - (0x01_00_00u32 >> 10) as u16;
+                first += (b[0] as u16 & 0x07) << 8;
+                first += (b[1] as u16 & 0x3f) << 2;
+                first += (b[2] as u16 & 0x30) >> 4;
+                let mut second = 0xdc00;
+                second |= (b[2] as u16 & 0x0f) << 6;
+                second |=  b[3] as u16 & 0x3f;
+                Utf16Char{ units: [first, second] }
+            },
+            _ => { // 2 or 3
+                let mut unit = ((b[0] as u16 & 0x1f) << 6) | (b[1] as u16 & 0x3f);
+                if utf8_len == 3 {
+                    unit = (unit << 6) | (b[2] as u16 & 0x3f);
+                }
+                Utf16Char{ units: [unit, 0] }
+            },
+        }
+    }
+}
+impl From<Utf16Char> for char {
+    fn from(uc: Utf16Char) -> char {
+        char::from_utf16_array_unchecked(uc.to_array())
+    }
+}
+impl IntoIterator for Utf16Char {
+    type Item=u16;
+    type IntoIter=Utf16Iterator;
+    /// Iterate over the units.
+    fn into_iter(self) -> Utf16Iterator {
+        Utf16Iterator::from(self)
+    }
+}
+
+#[cfg(feature="std")]
+impl Extend<Utf16Char> for Vec<u16> {
+    fn extend<I:IntoIterator<Item=Utf16Char>>(&mut self,  iter: I) {
+        let iter = iter.into_iter();
+        self.reserve(iter.size_hint().0);
+        for u16c in iter {
+            self.push(u16c.units[0]);
+            if u16c.units[1] != 0 {
+                self.push(u16c.units[1]);
+            }
+        }
+    }
+}
+#[cfg(feature="std")]
+impl<'a> Extend<&'a Utf16Char> for Vec<u16> {
+    fn extend<I:IntoIterator<Item=&'a Utf16Char>>(&mut self,  iter: I) {
+        self.extend(iter.into_iter().cloned())
+    }
+}
+#[cfg(feature="std")]
+impl FromIterator<Utf16Char> for Vec<u16> {
+    fn from_iter<I:IntoIterator<Item=Utf16Char>>(iter: I) -> Self {
+        let mut vec = Vec::new();
+        vec.extend(iter);
+        return vec;
+    }
+}
+#[cfg(feature="std")]
+impl<'a> FromIterator<&'a Utf16Char> for Vec<u16> {
+    fn from_iter<I:IntoIterator<Item=&'a Utf16Char>>(iter: I) -> Self {
+        Self::from_iter(iter.into_iter().cloned())
+    }
+}
+
+#[cfg(feature="std")]
+impl Extend<Utf16Char> for String {
+    fn extend<I:IntoIterator<Item=Utf16Char>>(&mut self,  iter: I) {
+        self.extend(iter.into_iter().map(|u16c| Utf8Char::from(u16c) ));
+    }
+}
+#[cfg(feature="std")]
+impl<'a> Extend<&'a Utf16Char> for String {
+    fn extend<I:IntoIterator<Item=&'a Utf16Char>>(&mut self,  iter: I) {
+        self.extend(iter.into_iter().cloned());
+    }
+}
+#[cfg(feature="std")]
+impl FromIterator<Utf16Char> for String {
+    fn from_iter<I:IntoIterator<Item=Utf16Char>>(iter: I) -> Self {
+        let mut s = String::new();
+        s.extend(iter);
+        return s;
+    }
+}
+#[cfg(feature="std")]
+impl<'a> FromIterator<&'a Utf16Char> for String {
+    fn from_iter<I:IntoIterator<Item=&'a Utf16Char>>(iter: I) -> Self {
+        Self::from_iter(iter.into_iter().cloned())
+    }
+}
+
+
+  /////////////////
+ //getter traits//
+/////////////////
+impl AsRef<[u16]> for Utf16Char {
+    #[inline]
+    fn as_ref(&self) -> &[u16] {
+        &self.units[..self.len()]
+    }
+}
+impl Borrow<[u16]> for Utf16Char {
+    #[inline]
+    fn borrow(&self) -> &[u16] {
+        self.as_ref()
+    }
+}
+impl Deref for Utf16Char {
+    type Target = [u16];
+    #[inline]
+    fn deref(&self) -> &[u16] {
+        self.as_ref()
+    }
+}
+
+
+  ////////////////
+ //ascii traits//
+////////////////
+#[cfg(feature="std")]
+#[allow(deprecated)]
+impl AsciiExt for Utf16Char {
+    type Owned = Self;
+    fn is_ascii(&self) -> bool {
+        self.units[0] < 128
+    }
+    fn eq_ignore_ascii_case(&self,  other: &Self) -> bool {
+        self.to_ascii_lowercase() == other.to_ascii_lowercase()
+    }
+    fn to_ascii_uppercase(&self) -> Self {
+        let n = self.units[0].wrapping_sub(b'a' as u16);
+        if n < 26 {Utf16Char{ units: [n+b'A' as u16, 0] }}
+        else      {*self}
+    }
+    fn to_ascii_lowercase(&self) -> Self {
+        let n = self.units[0].wrapping_sub(b'A' as u16);
+        if n < 26 {Utf16Char{ units: [n+b'a' as u16, 0] }}
+        else      {*self}
+    }
+    fn make_ascii_uppercase(&mut self) {
+        *self = self.to_ascii_uppercase()
+    }
+    fn make_ascii_lowercase(&mut self) {
+        *self = self.to_ascii_lowercase();
+    }
+}
+
+#[cfg(feature="ascii")]
+/// Requires the feature "ascii".
+impl From<AsciiChar> for Utf16Char {
+    #[inline]
+    fn from(ac: AsciiChar) -> Self {
+        Utf16Char{ units: [ac.as_byte() as u16, 0] }
+    }
+}
+#[cfg(feature="ascii")]
+/// Requires the feature "ascii".
+impl ToAsciiChar for Utf16Char {
+    #[inline]
+    fn to_ascii_char(self) -> Result<AsciiChar, ToAsciiCharError> {
+        // ToAsciiCHar is not implemented for u16 in ascii 0.9.0
+        if self.is_ascii() {self.units[0] as u8} else {255}.to_ascii_char()
+    }
+    #[inline]
+    unsafe fn to_ascii_char_unchecked(self) -> AsciiChar {
+        (self.units[0] as u8).to_ascii_char_unchecked()
+    }
+}
+
+
+  /////////////////////////////////////////////////////////
+ //Genaral traits that cannot be derived to emulate char//
+/////////////////////////////////////////////////////////
+impl hash::Hash for Utf16Char {
+    fn hash<H : hash::Hasher>(&self,  state: &mut H) {
+        self.to_char().hash(state);
+    }
+}
+impl fmt::Debug for Utf16Char {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Debug::fmt(&self.to_char(), fmtr)
+    }
+}
+impl fmt::Display for Utf16Char {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Display::fmt(&Utf8Char::from(*self), fmtr)
+    }
+}
+// Cannot derive these impls because two-unit characters must always compare
+// greater than one-unit ones.
+impl PartialOrd for Utf16Char {
+    #[inline]
+    fn partial_cmp(&self,  rhs: &Self) -> Option<Ordering> {
+        Some(self.cmp(rhs))
+    }
+}
+impl Ord for Utf16Char {
+    #[inline]
+    fn cmp(&self,  rhs: &Self) -> Ordering {
+        // Shift the first unit by 0xd if surrogate, and 0 otherwise.
+        // This ensures surrogates are always greater than 0xffff, and
+        // that the second unit only affect the result when the first are equal.
+        // Multiplying by a constant factor isn't enough because that factor
+        // would have to be greater than 1023 and smaller than 5.5.
+        // This transformation is less complicated than combine_surrogates().
+        let lhs = (self.units[0] as u32, self.units[1] as u32);
+        let rhs = (rhs.units[0] as u32, rhs.units[1] as u32);
+        let lhs = (lhs.0 << (lhs.1 >> 12)) + lhs.1;
+        let rhs = (rhs.0 << (rhs.1 >> 12)) + rhs.1;
+        lhs.cmp(&rhs)
+    }
+}
+
+
+  ////////////////////////////////
+ //Comparisons with other types//
+////////////////////////////////
+impl PartialEq<char> for Utf16Char {
+    fn eq(&self,  u32c: &char) -> bool {
+        *self == Utf16Char::from(*u32c)
+    }
+}
+impl PartialEq<Utf16Char> for char {
+    fn eq(&self,  u16c: &Utf16Char) -> bool {
+        Utf16Char::from(*self) == *u16c
+    }
+}
+impl PartialOrd<char> for Utf16Char {
+    fn partial_cmp(&self,  u32c: &char) -> Option<Ordering> {
+        self.partial_cmp(&Utf16Char::from(*u32c))
+    }
+}
+impl PartialOrd<Utf16Char> for char {
+    fn partial_cmp(&self,  u16c: &Utf16Char) -> Option<Ordering> {
+        Utf16Char::from(*self).partial_cmp(u16c)
+    }
+}
+
+impl PartialEq<Utf8Char> for Utf16Char {
+    fn eq(&self,  u8c: &Utf8Char) -> bool {
+        *self == Utf16Char::from(*u8c)
+    }
+}
+impl PartialOrd<Utf8Char> for Utf16Char {
+    fn partial_cmp(&self,  u8c: &Utf8Char) -> Option<Ordering> {
+        self.partial_cmp(&Utf16Char::from(*u8c))
+    }
+}
+// The other direction is implemented in utf8_char.rs
+
+/// Only considers the unit equal if the codepoint of the `Utf16Char` is not
+/// made up of a surrogate pair.
+///
+/// There is no impl in the opposite direction, as this should only be used to
+/// compare `Utf16Char`s against constants.
+///
+/// # Examples
+///
+/// ```
+/// # use encode_unicode::Utf16Char;
+/// assert!(Utf16Char::from('6') == b'6' as u16);
+/// assert!(Utf16Char::from('\u{FFFF}') == 0xffff_u16);
+/// assert!(Utf16Char::from_tuple((0xd876, Some(0xdef9))).unwrap() != 0xd876_u16);
+/// ```
+impl PartialEq<u16> for Utf16Char {
+    fn eq(&self,  unit: &u16) -> bool {
+        self.units[0] == *unit  &&  self.units[1] == 0
+    }
+}
+/// Only considers the byte equal if the codepoint of the `Utf16Char` is <= U+FF.
+///
+/// # Examples
+///
+/// ```
+/// # use encode_unicode::Utf16Char;
+/// assert!(Utf16Char::from('6') == b'6');
+/// assert!(Utf16Char::from('\u{00FF}') == b'\xff');
+/// assert!(Utf16Char::from('\u{0100}') != b'\0');
+/// ```
+impl PartialEq<u8> for Utf16Char {
+    fn eq(&self,  byte: &u8) -> bool {
+        self.units[0] == *byte as u16
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf16Char`s that are not ASCII never compare equal.
+impl PartialEq<AsciiChar> for Utf16Char {
+    #[inline]
+    fn eq(&self,  ascii: &AsciiChar) -> bool {
+        self.units[0] == *ascii as u16
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf16Char`s that are not ASCII never compare equal.
+impl PartialEq<Utf16Char> for AsciiChar {
+    #[inline]
+    fn eq(&self,  u16c: &Utf16Char) -> bool {
+        *self as u16 == u16c.units[0]
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf16Char`s that are not ASCII always compare greater.
+impl PartialOrd<AsciiChar> for Utf16Char {
+    #[inline]
+    fn partial_cmp(&self,  ascii: &AsciiChar) -> Option<Ordering> {
+        self.units[0].partial_cmp(&(*ascii as u16))
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf16Char`s that are not ASCII always compare greater.
+impl PartialOrd<Utf16Char> for AsciiChar {
+    #[inline]
+    fn partial_cmp(&self,  u16c: &Utf16Char) -> Option<Ordering> {
+        (*self as u16).partial_cmp(&u16c.units[0])
+    }
+}
+
+
+  ///////////////////////////////////////////////////////
+ //pub impls that should be together for nicer rustdoc//
+///////////////////////////////////////////////////////
+impl Utf16Char {
+    /// Create an `Utf16Char` from the first codepoint in a string slice,
+    /// converting from UTF-8 to UTF-16.
+    ///
+    /// The returned `usize` is the number of UTF-8 bytes used from the str,
+    /// and not the number of UTF-16 units.
+    ///
+    /// Returns an error if the `str` is empty.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::Utf16Char;
+    ///
+    /// assert_eq!(Utf16Char::from_str_start("a"), Ok((Utf16Char::from('a'),1)));
+    /// assert_eq!(Utf16Char::from_str_start("ab"), Ok((Utf16Char::from('a'),1)));
+    /// assert_eq!(Utf16Char::from_str_start("🂠 "), Ok((Utf16Char::from('🂠'),4)));
+    /// assert_eq!(Utf16Char::from_str_start("é"), Ok((Utf16Char::from('e'),1)));// 'e'+u301 combining mark
+    /// assert!(Utf16Char::from_str_start("").is_err());
+    /// ```
+    pub fn from_str_start(s: &str) -> Result<(Self,usize), EmptyStrError> {
+        if s.is_empty() {
+            return Err(EmptyStrError);
+        }
+        let b = s.as_bytes();
+        // Read the last byte first to reduce the number of unnecesary length checks.
+        match b[0] {
+            0...127 => {// 1 byte => 1 unit
+                let unit = b[0] as u16;// 0b0000_0000_0xxx_xxxx
+                Ok((Utf16Char{ units: [unit, 0] }, 1))
+            },
+            0b1000_0000...0b1101_1111 => {// 2 bytes => 1 unit
+                let unit = (((b[1] & 0x3f) as u16) << 0) // 0b0000_0000_00xx_xxxx
+                         | (((b[0] & 0x1f) as u16) << 6);// 0b0000_0xxx_xx00_0000
+                Ok((Utf16Char{ units: [unit, 0] }, 2))
+            },
+            0b1110_0000...0b1110_1111 => {// 3 bytes => 1 unit
+                let unit = (((b[2] & 0x3f) as u16) <<  0) // 0b0000_0000_00xx_xxxx
+                         | (((b[1] & 0x3f) as u16) <<  6) // 0b0000_xxxx_xx00_0000
+                         | (((b[0] & 0x0f) as u16) << 12);// 0bxxxx_0000_0000_0000
+                Ok((Utf16Char{ units: [unit, 0] }, 3))
+            },
+            _ => {// 4 bytes => 2 units
+                let second = 0xdc00                        // 0b1101_1100_0000_0000
+                           | (((b[3] & 0x3f) as u16) << 0) // 0b0000_0000_00xx_xxxx
+                           | (((b[2] & 0x0f) as u16) << 6);// 0b0000_00xx_xx00_0000
+                let first = 0xd800-(0x01_00_00u32>>10) as u16// 0b1101_0111_1100_0000
+                          + (((b[2] & 0x30) as u16) >> 4)    // 0b0000_0000_0000_00xx
+                          + (((b[1] & 0x3f) as u16) << 2)    // 0b0000_0000_xxxx_xx00
+                          + (((b[0] & 0x07) as u16) << 8);   // 0b0000_0xxx_0000_0000
+                Ok((Utf16Char{ units: [first, second] }, 4))
+            }
+        }
+    }
+    /// Validate and store the first UTF-16 codepoint in the slice.
+    /// Also return how many units were needed.
+    pub fn from_slice_start(src: &[u16]) -> Result<(Self,usize), InvalidUtf16Slice> {
+        char::from_utf16_slice_start(src).map(|(_,len)| {
+            let second = if len==2 {src[1]} else {0};
+            (Utf16Char{ units: [src[0], second] }, len)
+        })
+    }
+    /// Store the first UTF-16 codepoint of the slice.
+    ///
+    /// # Safety
+    ///
+    /// The slice must be non-empty and start with a valid UTF-16 codepoint.  
+    /// The length of the slice is never checked.
+    pub unsafe fn from_slice_start_unchecked(src: &[u16]) -> (Self,usize) {
+        let first = *src.get_unchecked(0);
+        if first.is_utf16_leading_surrogate() {
+            (Utf16Char{ units: [first, *src.get_unchecked(1)] }, 2)
+        } else {
+            (Utf16Char{ units: [first, 0] }, 1)
+        }
+    }
+    /// Validate and store an UTF-16 array as returned from `char.to_utf16_array()`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::Utf16Char;
+    /// use encode_unicode::error::InvalidUtf16Array;
+    ///
+    /// assert_eq!(Utf16Char::from_array(['x' as u16, 'y' as u16]), Ok(Utf16Char::from('x')));
+    /// assert_eq!(Utf16Char::from_array(['睷' as u16, 0]), Ok(Utf16Char::from('睷')));
+    /// assert_eq!(Utf16Char::from_array([0xda6f, 0xdcde]), Ok(Utf16Char::from('\u{abcde}')));
+    /// assert_eq!(Utf16Char::from_array([0xf111, 0xdbad]), Ok(Utf16Char::from('\u{f111}')));
+    /// assert_eq!(Utf16Char::from_array([0xdaaf, 0xdaaf]), Err(InvalidUtf16Array::SecondIsNotTrailingSurrogate));
+    /// assert_eq!(Utf16Char::from_array([0xdcac, 0x9000]), Err(InvalidUtf16Array::FirstIsTrailingSurrogate));
+    /// ```
+    pub fn from_array(units: [u16; 2]) -> Result<Self,InvalidUtf16Array> {
+        if (units[0] & 0xf8_00) != 0xd8_00 {
+            Ok(Utf16Char { units: [units[0], 0] })
+        } else if units[0] < 0xdc_00  &&  (units[1] & 0xfc_00) == 0xdc_00 {
+            Ok(Utf16Char { units: units })
+        } else if units[0] < 0xdc_00 {
+            Err(InvalidUtf16Array::SecondIsNotTrailingSurrogate)
+        } else {
+            Err(InvalidUtf16Array::FirstIsTrailingSurrogate)
+        }
+    }
+    /// Create an `Utf16Char` from an array as returned from `char.to_utf16_array()`.
+    ///
+    /// # Safety
+    ///
+    /// The units must form a valid codepoint, and the second unit must be 0
+    /// when a surrogate pair is not required.
+    /// Violating this can easily lead to undefined behavior, although unlike
+    /// `char` bad `Utf16Char`s simply existing is not immediately UB.
+    pub unsafe fn from_array_unchecked(units: [u16; 2]) -> Self {
+        Utf16Char { units: units }
+    }
+    /// Validate and store a UTF-16 pair as returned from `char.to_utf16_tuple()`.
+    pub fn from_tuple(utf16: (u16,Option<u16>)) -> Result<Self,InvalidUtf16Tuple> {
+        unsafe {char::from_utf16_tuple(utf16).map(|_|
+            Self::from_tuple_unchecked(utf16)
+        )}
+    }
+    /// Create an `Utf16Char` from a tuple as returned from `char.to_utf16_tuple()`.
+    ///
+    /// # Safety
+    ///
+    /// The units must form a valid codepoint with the second being 0 when a
+    /// surrogate pair is not required.
+    /// Violating this can easily lead to undefined behavior.
+    pub unsafe fn from_tuple_unchecked(utf16: (u16,Option<u16>)) -> Self {
+        Utf16Char { units: [utf16.0, utf16.1.unwrap_or(0)] }
+    }
+    /// Create an `Utf16Char` from a single unit.
+    ///
+    /// Codepoints < '\u{1_0000}' (which fit in a `u16`) are part of the basic
+    /// multilingual plane unless they are reserved for surrogate pairs.
+    ///
+    /// # Errors
+    ///
+    /// Returns `NonBMPError` if the unit is in the range `0xd800..0xe000`
+    /// (which means that it's part of a surrogat pair)
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # use encode_unicode::Utf16Char;
+    /// assert_eq!(Utf16Char::from_bmp(0x40).unwrap(), '@');
+    /// assert_eq!(Utf16Char::from_bmp('ø' as u16).unwrap(), 'ø');
+    /// assert!(Utf16Char::from_bmp(0xdddd).is_err());
+    /// ```
+    pub fn from_bmp(bmp_codepoint: u16) -> Result<Self,NonBMPError> {
+        if bmp_codepoint & 0xf800 != 0xd800 {
+            Ok(Utf16Char{ units: [bmp_codepoint, 0] })
+        } else {
+            Err(NonBMPError)
+        }
+    }
+    /// Create an `Utf16Char` from a single unit without checking that it's a
+    /// valid codepoint on its own.
+    ///
+    /// # Safety
+    ///
+    /// The unit must be less than 0xd800 or greater than 0xdfff.
+    /// In other words, not part of a surrogate pair.  
+    /// Violating this can easily lead to undefined behavior.
+    #[inline]
+    pub unsafe fn from_bmp_unchecked(bmp_codepoint: u16) -> Self {
+        Utf16Char{ units: [bmp_codepoint, 0] }
+    }
+    /// Checks that the codepoint is in the basic multilingual plane.
+    ///
+    /// # Examples
+    /// ```
+    /// # use encode_unicode::Utf16Char;
+    /// assert_eq!(Utf16Char::from('e').is_bmp(), true);
+    /// assert_eq!(Utf16Char::from('€').is_bmp(), true);
+    /// assert_eq!(Utf16Char::from('𝔼').is_bmp(), false);
+    /// ```
+    #[inline]
+    pub fn is_bmp(&self) -> bool {
+        self.units[1] == 0
+    }
+
+    /// The number of units this character is made up of.
+    ///
+    /// Is either 1 or 2 and identical to `.as_char().len_utf16()`
+    /// or `.as_ref().len()`.
+    #[inline]
+    pub fn len(self) -> usize {
+        1 + (self.units[1] as usize >> 15)
+    }
+    // There is no `.is_emty()` because it would always return false.
+
+    /// Checks that the codepoint is an ASCII character.
+    #[inline]
+    pub fn is_ascii(&self) -> bool {
+        self.units[0] <= 127
+    }
+    /// Checks that two characters are an ASCII case-insensitive match.
+    ///
+    /// Is equivalent to `a.to_ascii_lowercase() == b.to_ascii_lowercase()`.
+    #[cfg(feature="std")]
+    pub fn eq_ignore_ascii_case(&self,  other: &Self) -> bool {
+        self.to_ascii_lowercase() == other.to_ascii_lowercase()
+    }
+    /// Converts the character to its ASCII upper case equivalent.
+    ///
+    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
+    /// but non-ASCII letters are unchanged.
+    #[cfg(feature="std")]
+    pub fn to_ascii_uppercase(&self) -> Self {
+        let n = self.units[0].wrapping_sub(b'a' as u16);
+        if n < 26 {Utf16Char{ units: [n+b'A' as u16, 0] }}
+        else      {*self}
+    }
+    /// Converts the character to its ASCII lower case equivalent.
+    ///
+    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
+    /// but non-ASCII letters are unchanged.
+    #[cfg(feature="std")]
+    pub fn to_ascii_lowercase(&self) -> Self {
+        let n = self.units[0].wrapping_sub(b'A' as u16);
+        if n < 26 {Utf16Char{ units: [n+b'a' as u16, 0] }}
+        else      {*self}
+    }
+    /// Converts the character to its ASCII upper case equivalent in-place.
+    ///
+    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
+    /// but non-ASCII letters are unchanged.
+    #[cfg(feature="std")]
+    pub fn make_ascii_uppercase(&mut self) {
+        *self = self.to_ascii_uppercase()
+    }
+    /// Converts the character to its ASCII lower case equivalent in-place.
+    ///
+    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
+    /// but non-ASCII letters are unchanged.
+    #[cfg(feature="std")]
+    pub fn make_ascii_lowercase(&mut self) {
+        *self = self.to_ascii_lowercase();
+    }
+
+    /// Convert from UTF-16 to UTF-32
+    pub fn to_char(self) -> char {
+        self.into()
+    }
+    /// Write the internal representation to a slice,
+    /// and then returns the number of `u16`s written.
+    ///
+    /// # Panics
+    /// Will panic the buffer is too small;
+    /// You can get the required length from `.len()`,
+    /// but a buffer of length two is always large enough.
+    pub fn to_slice(self,  dst: &mut[u16]) -> usize {
+        // Write the last unit first to avoid repeated length checks.
+        let extra = self.units[1] as usize >> 15;
+        match dst.get_mut(extra) {
+            Some(first) => *first = self.units[extra],
+            None => panic!("The provided buffer is too small.")
+        }
+        if extra != 0 {dst[0] = self.units[0];}
+        extra+1
+    }
+    /// Get the character represented as an array of two units.
+    ///
+    /// The second `u16` is zero for codepoints that fit in one unit.
+    #[inline]
+    pub fn to_array(self) -> [u16;2] {
+        self.units
+    }
+    /// The second `u16` is used for surrogate pairs.
+    #[inline]
+    pub fn to_tuple(self) -> (u16,Option<u16>) {
+        (self.units[0],  if self.units[1]==0 {None} else {Some(self.units[1])})
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/utf16_iterators.rs b/android/vendor/encode_unicode-0.3.6/src/utf16_iterators.rs
new file mode 100644
index 0000000..7adb5ac
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/utf16_iterators.rs
@@ -0,0 +1,270 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+use traits::CharExt;
+use utf16_char::Utf16Char;
+use errors::EmptyStrError;
+extern crate core;
+use self::core::fmt;
+use self::core::borrow::Borrow;
+
+// Invalid values that says the field is consumed or empty.
+const FIRST_USED: u16 = 0x_dc_00;
+const SECOND_USED: u16 = 0;
+
+/// Iterate over the units of the UTF-16 representation of a codepoint.
+#[derive(Clone)]
+pub struct Utf16Iterator {
+    first: u16,
+    second: u16,
+}
+impl From<char> for Utf16Iterator {
+    fn from(c: char) -> Self {
+        let (first, second) = c.to_utf16_tuple();
+        Utf16Iterator{ first: first,  second: second.unwrap_or(SECOND_USED) }
+    }
+}
+impl From<Utf16Char> for Utf16Iterator {
+    fn from(uc: Utf16Char) -> Self {
+        let (first, second) = uc.to_tuple();
+        Utf16Iterator{ first: first,  second: second.unwrap_or(SECOND_USED) }
+    }
+}
+impl Iterator for Utf16Iterator {
+    type Item=u16;
+    fn next(&mut self) -> Option<u16> {
+        match (self.first, self.second) {
+            (FIRST_USED, SECOND_USED)  =>  {                            None        },
+            (FIRST_USED, second     )  =>  {self.second = SECOND_USED;  Some(second)},
+            (first     ,      _     )  =>  {self.first = FIRST_USED;    Some(first )},
+        }
+    }
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (self.len(), Some(self.len()))
+    }
+}
+impl ExactSizeIterator for Utf16Iterator {
+    fn len(&self) -> usize {
+        (if self.first == FIRST_USED {0} else {1}) +
+        (if self.second == SECOND_USED {0} else {1})
+    }
+}
+impl fmt::Debug for Utf16Iterator {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        let mut clone = self.clone();
+        match (clone.next(), clone.next()) {
+            (Some(one), None)  => write!(fmtr, "[{}]", one),
+            (Some(a), Some(b)) => write!(fmtr, "[{}, {}]", a, b),
+            (None,  _)         => write!(fmtr, "[]"),
+        }
+    }
+}
+
+
+
+/// Converts an iterator of `Utf16Char` (or `&Utf16Char`)
+/// to an iterator of `u16`s.  
+/// Is equivalent to calling `.flat_map()` on the original iterator,
+/// but the returned iterator is about twice as fast.
+///
+/// The exact number of units cannot be known in advance, but `size_hint()`
+/// gives the possible range.
+///
+/// # Examples
+///
+/// From iterator of values:
+///
+/// ```
+/// use encode_unicode::{iter_units, CharExt};
+///
+/// let iterator = "foo".chars().map(|c| c.to_utf16() );
+/// let mut units = [0; 4];
+/// for (u,dst) in iter_units(iterator).zip(&mut units) {*dst=u;}
+/// assert_eq!(units, ['f' as u16, 'o' as u16, 'o' as u16, 0]);
+/// ```
+///
+/// From iterator of references:
+///
+#[cfg_attr(feature="std", doc=" ```")]
+#[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+/// use encode_unicode::{iter_units, CharExt, Utf16Char};
+///
+/// // (💣 takes two units)
+/// let chars: Vec<Utf16Char> = "💣 bomb 💣".chars().map(|c| c.to_utf16() ).collect();
+/// let units: Vec<u16> = iter_units(&chars).collect();
+/// let flat_map: Vec<u16> = chars.iter().flat_map(|u16c| *u16c ).collect();
+/// assert_eq!(units, flat_map);
+/// ```
+pub fn iter_units<U:Borrow<Utf16Char>, I:IntoIterator<Item=U>>
+(iterable: I) -> Utf16CharSplitter<U, I::IntoIter> {
+    Utf16CharSplitter{ inner: iterable.into_iter(),  prev_second: 0 }
+}
+
+/// The iterator type returned by `iter_units()`
+#[derive(Clone)]
+pub struct Utf16CharSplitter<U:Borrow<Utf16Char>, I:Iterator<Item=U>> {
+    inner: I,
+    prev_second: u16,
+}
+impl<I:Iterator<Item=Utf16Char>> From<I> for Utf16CharSplitter<Utf16Char,I> {
+    /// A less generic constructor than `iter_units()`
+    fn from(iter: I) -> Self {
+        iter_units(iter)
+    }
+}
+impl<U:Borrow<Utf16Char>, I:Iterator<Item=U>> Utf16CharSplitter<U,I> {
+    /// Extracts the source iterator.
+    ///
+    /// Note that `iter_units(iter.into_inner())` is not a no-op:  
+    /// If the last returned unit from `next()` was a leading surrogate,
+    /// the trailing surrogate is lost.
+    pub fn into_inner(self) -> I {
+        self.inner
+    }
+}
+impl<U:Borrow<Utf16Char>, I:Iterator<Item=U>> Iterator for Utf16CharSplitter<U,I> {
+    type Item = u16;
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.prev_second == 0 {
+            self.inner.next().map(|u16c| {
+                let units = u16c.borrow().to_array();
+                self.prev_second = units[1];
+                units[0]
+            })
+        } else {
+            let prev_second = self.prev_second;
+            self.prev_second = 0;
+            Some(prev_second)
+        }
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        // Doesn't need to handle unlikely overflows correctly because
+        // size_hint() cannot be relied upon anyway. (the trait isn't unsafe)
+        let (min, max) = self.inner.size_hint();
+        let add = if self.prev_second == 0 {0} else {1};
+        (min.wrapping_add(add), max.map(|max| max.wrapping_mul(2).wrapping_add(add) ))
+    }
+}
+
+
+
+/// An iterator over the codepoints in a `str` represented as `Utf16Char`.
+#[derive(Clone)]
+pub struct Utf16CharIndices<'a>{
+    str: &'a str,
+    index: usize,
+}
+impl<'a> From<&'a str> for Utf16CharIndices<'a> {
+    fn from(s: &str) -> Utf16CharIndices {
+        Utf16CharIndices{str: s, index: 0}
+    }
+}
+impl<'a> Utf16CharIndices<'a> {
+    /// Extract the remainder of the source `str`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::{StrExt, Utf16Char};
+    /// let mut iter = "abc".utf16char_indices();
+    /// assert_eq!(iter.next_back(), Some((2, Utf16Char::from('c'))));
+    /// assert_eq!(iter.next(), Some((0, Utf16Char::from('a'))));
+    /// assert_eq!(iter.as_str(), "b");
+    /// ```
+    pub fn as_str(&self) -> &'a str {
+        &self.str[self.index..]
+    }
+}
+impl<'a> Iterator for Utf16CharIndices<'a> {
+    type Item = (usize,Utf16Char);
+    fn next(&mut self) -> Option<(usize,Utf16Char)> {
+        match Utf16Char::from_str_start(&self.str[self.index..]) {
+            Ok((u16c, bytes)) => {
+                let item = (self.index, u16c);
+                self.index += bytes;
+                Some(item)
+            },
+            Err(EmptyStrError) => None
+        }
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        let len = self.str.len() - self.index;
+        // For len+3 to overflow, the slice must fill all but two bytes of
+        // addressable memory, and size_hint() doesn't need to be correct.
+        (len.wrapping_add(3)/4, Some(len))
+    }
+}
+impl<'a> DoubleEndedIterator for Utf16CharIndices<'a> {
+    fn next_back(&mut self) -> Option<(usize,Utf16Char)> {
+        if self.index < self.str.len() {
+            let rev = self.str.bytes().rev();
+            let len = 1 + rev.take_while(|b| b & 0b1100_0000 == 0b1000_0000 ).count();
+            let starts = self.str.len() - len;
+            let (u16c,_) = Utf16Char::from_str_start(&self.str[starts..]).unwrap();
+            self.str = &self.str[..starts];
+            Some((starts, u16c))
+        } else {
+            None
+        }
+    }
+}
+impl<'a> fmt::Debug for Utf16CharIndices<'a> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmtr.debug_tuple("Utf16CharIndices")
+            .field(&self.index)
+            .field(&self.as_str())
+            .finish()
+    }
+}
+
+
+/// An iterator over the codepoints in a `str` represented as `Utf16Char`.
+#[derive(Clone)]
+pub struct Utf16Chars<'a>(Utf16CharIndices<'a>);
+impl<'a> From<&'a str> for Utf16Chars<'a> {
+    fn from(s: &str) -> Utf16Chars {
+        Utf16Chars(Utf16CharIndices::from(s))
+    }
+}
+impl<'a> Utf16Chars<'a> {
+    /// Extract the remainder of the source `str`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::{StrExt, Utf16Char};
+    /// let mut iter = "abc".utf16chars();
+    /// assert_eq!(iter.next(), Some(Utf16Char::from('a')));
+    /// assert_eq!(iter.next_back(), Some(Utf16Char::from('c')));
+    /// assert_eq!(iter.as_str(), "b");
+    /// ```
+    pub fn as_str(&self) -> &'a str {
+        self.0.as_str()
+    }
+}
+impl<'a> Iterator for Utf16Chars<'a> {
+    type Item = Utf16Char;
+    fn next(&mut self) -> Option<Utf16Char> {
+        self.0.next().map(|(_,u16c)| u16c )
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        self.0.size_hint()
+    }
+}
+impl<'a> DoubleEndedIterator for Utf16Chars<'a> {
+    fn next_back(&mut self) -> Option<Utf16Char> {
+        self.0.next_back().map(|(_,u16c)| u16c )
+    }
+}
+impl<'a> fmt::Debug for Utf16Chars<'a> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmtr.debug_tuple("Utf16Chars")
+            .field(&self.as_str())
+            .finish()
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/utf8_char.rs b/android/vendor/encode_unicode-0.3.6/src/utf8_char.rs
new file mode 100644
index 0000000..9dba4ba
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/utf8_char.rs
@@ -0,0 +1,647 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+use errors::{FromStrError, EmptyStrError, NonAsciiError, InvalidUtf8Slice, InvalidUtf8Array};
+use utf8_iterators::Utf8Iterator;
+use traits::{CharExt, U8UtfExt};
+use utf16_char::Utf16Char;
+extern crate core;
+use self::core::{hash, fmt, str, ptr};
+use self::core::cmp::Ordering;
+use self::core::borrow::Borrow;
+use self::core::ops::Deref;
+use self::core::mem::transmute;
+#[cfg(feature="std")]
+use self::core::iter::FromIterator;
+#[cfg(feature="std")]
+#[allow(deprecated)]
+use std::ascii::AsciiExt;
+#[cfg(feature="ascii")]
+extern crate ascii;
+#[cfg(feature="ascii")]
+use self::ascii::{AsciiChar,ToAsciiChar,ToAsciiCharError};
+
+
+// I don't think there is any good default value for char, but char does.
+#[derive(Default)]
+// char doesn't do anything more advanced than u32 for Eq/Ord, so we shouldn't either.
+// The default impl of Ord for arrays works out because longer codepoints
+//     start with more ones, so if they're equal, the length is the same,
+// breaks down for values above 0x1f_ff_ff but those can only be created by unsafe code.
+#[derive(PartialEq,Eq, PartialOrd,Ord)]
+
+#[derive(Clone,Copy)]
+
+
+/// An unicode codepoint stored as UTF-8.
+///
+/// It can be borrowed as a `str`, and has the same size as `char`.
+pub struct Utf8Char {
+    bytes: [u8; 4],
+}
+
+
+  /////////////////////
+ //conversion traits//
+/////////////////////
+impl str::FromStr for Utf8Char {
+    type Err = FromStrError;
+    /// Create an `Utf8Char` from a string slice.
+    /// The string must contain exactly one codepoint.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::error::FromStrError::*;
+    /// use encode_unicode::Utf8Char;
+    /// use std::str::FromStr;
+    ///
+    /// assert_eq!(Utf8Char::from_str("a"), Ok(Utf8Char::from('a')));
+    /// assert_eq!(Utf8Char::from_str("🂠"), Ok(Utf8Char::from('🂠')));
+    /// assert_eq!(Utf8Char::from_str(""), Err(Empty));
+    /// assert_eq!(Utf8Char::from_str("ab"), Err(MultipleCodepoints));
+    /// assert_eq!(Utf8Char::from_str("é"), Err(MultipleCodepoints));// 'e'+u301 combining mark
+    /// ```
+    fn from_str(s: &str) -> Result<Self, FromStrError> {
+        if s.is_empty() {
+            Err(FromStrError::Empty)
+        } else if s.len() != 1+s.as_bytes()[0].extra_utf8_bytes_unchecked() {
+            Err(FromStrError::MultipleCodepoints)
+        } else {
+            let mut bytes = [0; 4];
+            bytes[..s.len()].copy_from_slice(s.as_bytes());
+            Ok(Utf8Char{bytes: bytes})
+        }
+    }
+}
+impl From<Utf16Char> for Utf8Char {
+    fn from(utf16: Utf16Char) -> Utf8Char {
+        match utf16.to_tuple() {
+            (a @ 0...0x00_7f, _) => {
+                Utf8Char{ bytes: [a as u8, 0, 0, 0] }
+            },
+            (u @ 0...0x07_ff, _) => {
+                let b = 0x80 |  (u & 0x00_3f) as u8;
+                let a = 0xc0 | ((u & 0x07_c0) >> 6) as u8;
+                Utf8Char{ bytes: [a, b, 0, 0] }
+            },
+            (u, None) => {
+                let c = 0x80 |  (u & 0x00_3f) as u8;
+                let b = 0x80 | ((u & 0x0f_c0) >> 6) as u8;
+                let a = 0xe0 | ((u & 0xf0_00) >> 12) as u8;
+                Utf8Char{ bytes: [a, b, c, 0] }
+            },
+            (f, Some(s)) => {
+                let f = f + (0x01_00_00u32 >> 10) as u16;
+                let d = 0x80 |  (s & 0x00_3f) as u8;
+                let c = 0x80 | ((s & 0x03_c0) >> 6) as u8
+                             | ((f & 0x00_03) << 4) as u8;
+                let b = 0x80 | ((f & 0x00_fc) >> 2) as u8;
+                let a = 0xf0 | ((f & 0x07_00) >> 8) as u8;
+                Utf8Char{ bytes: [a, b, c, d] }
+            }
+        }
+    }
+}
+impl From<char> for Utf8Char {
+    fn from(c: char) -> Self {
+        Utf8Char{ bytes: c.to_utf8_array().0 }
+    }
+}
+impl From<Utf8Char> for char {
+    fn from(uc: Utf8Char) -> char {
+        unsafe{ char::from_utf8_exact_slice_unchecked(&uc.bytes[..uc.len()]) }
+    }
+}
+impl IntoIterator for Utf8Char {
+    type Item=u8;
+    type IntoIter=Utf8Iterator;
+    /// Iterate over the byte values.
+    fn into_iter(self) -> Utf8Iterator {
+        Utf8Iterator::from(self)
+    }
+}
+
+#[cfg(feature="std")]
+impl Extend<Utf8Char> for Vec<u8> {
+    fn extend<I:IntoIterator<Item=Utf8Char>>(&mut self,  iter: I) {
+        let iter = iter.into_iter();
+        self.reserve(iter.size_hint().0);
+        for u8c in iter {
+            // twice as fast as self.extend_from_slice(u8c.as_bytes());
+            self.push(u8c.bytes[0]);
+            for &extra in &u8c.bytes[1..] {
+                if extra != 0 {
+                    self.push(extra);
+                }
+            }
+        }
+    }
+}
+#[cfg(feature="std")]
+impl<'a> Extend<&'a Utf8Char> for Vec<u8> {
+    fn extend<I:IntoIterator<Item=&'a Utf8Char>>(&mut self,  iter: I) {
+        self.extend(iter.into_iter().cloned())
+    }
+}
+#[cfg(feature="std")]
+impl Extend<Utf8Char> for String {
+    fn extend<I:IntoIterator<Item=Utf8Char>>(&mut self,  iter: I) {
+        unsafe { self.as_mut_vec().extend(iter) }
+    }
+}
+#[cfg(feature="std")]
+impl<'a> Extend<&'a Utf8Char> for String {
+    fn extend<I:IntoIterator<Item=&'a Utf8Char>>(&mut self,  iter: I) {
+        self.extend(iter.into_iter().cloned())
+    }
+}
+#[cfg(feature="std")]
+impl FromIterator<Utf8Char> for String {
+    fn from_iter<I:IntoIterator<Item=Utf8Char>>(iter: I) -> String {
+        let mut string = String::new();
+        string.extend(iter);
+        return string;
+    }
+}
+#[cfg(feature="std")]
+impl<'a> FromIterator<&'a Utf8Char> for String {
+    fn from_iter<I:IntoIterator<Item=&'a Utf8Char>>(iter: I) -> String {
+        iter.into_iter().cloned().collect()
+    }
+}
+#[cfg(feature="std")]
+impl FromIterator<Utf8Char> for Vec<u8> {
+    fn from_iter<I:IntoIterator<Item=Utf8Char>>(iter: I) -> Self {
+        iter.into_iter().collect::<String>().into_bytes()
+    }
+}
+#[cfg(feature="std")]
+impl<'a> FromIterator<&'a Utf8Char> for Vec<u8> {
+    fn from_iter<I:IntoIterator<Item=&'a Utf8Char>>(iter: I) -> Self {
+        iter.into_iter().cloned().collect::<String>().into_bytes()
+    }
+}
+
+
+  /////////////////
+ //getter traits//
+/////////////////
+impl AsRef<[u8]> for Utf8Char {
+    fn as_ref(&self) -> &[u8] {
+        &self.bytes[..self.len()]
+    }
+}
+impl AsRef<str> for Utf8Char {
+    fn as_ref(&self) -> &str {
+        unsafe{ str::from_utf8_unchecked( self.as_ref() ) }
+    }
+}
+impl Borrow<[u8]> for Utf8Char {
+    fn borrow(&self) -> &[u8] {
+        self.as_ref()
+    }
+}
+impl Borrow<str> for Utf8Char {
+    fn borrow(&self) -> &str {
+        self.as_ref()
+    }
+}
+impl Deref for Utf8Char {
+    type Target = str;
+    fn deref(&self) -> &Self::Target {
+        self.as_ref()
+    }
+}
+
+
+  ////////////////
+ //ascii traits//
+////////////////
+#[cfg(feature="std")]
+#[allow(deprecated)]
+impl AsciiExt for Utf8Char {
+    type Owned = Utf8Char;
+    fn is_ascii(&self) -> bool {
+        self.bytes[0].is_ascii()
+    }
+    fn eq_ignore_ascii_case(&self,  other: &Self) -> bool {
+        if self.is_ascii() {self.bytes[0].eq_ignore_ascii_case(&other.bytes[0])}
+        else               {self == other}
+    }
+    fn to_ascii_uppercase(&self) -> Self::Owned {
+        let mut uc = *self;
+        uc.make_ascii_uppercase();
+        uc
+    }
+    fn to_ascii_lowercase(&self) -> Self::Owned {
+        let mut uc = *self;
+        uc.make_ascii_lowercase();
+        uc
+    }
+    fn make_ascii_uppercase(&mut self) {
+        self.bytes[0].make_ascii_uppercase()
+    }
+    fn make_ascii_lowercase(&mut self) {
+        self.bytes[0].make_ascii_lowercase();
+    }
+}
+
+#[cfg(feature="ascii")]
+/// Requires the feature "ascii".
+impl From<AsciiChar> for Utf8Char {
+    fn from(ac: AsciiChar) -> Self {
+        Utf8Char{ bytes: [ac.as_byte(),0,0,0] }
+    }
+}
+#[cfg(feature="ascii")]
+/// Requires the feature "ascii".
+impl ToAsciiChar for Utf8Char {
+    fn to_ascii_char(self) -> Result<AsciiChar, ToAsciiCharError> {
+        self.bytes[0].to_ascii_char()
+    }
+    unsafe fn to_ascii_char_unchecked(self) -> AsciiChar {
+        self.bytes[0].to_ascii_char_unchecked()
+    }
+}
+
+
+  /////////////////////////////////////////////////////////
+ //Genaral traits that cannot be derived to emulate char//
+/////////////////////////////////////////////////////////
+impl hash::Hash for Utf8Char {
+    fn hash<H : hash::Hasher>(&self,  state: &mut H) {
+        self.to_char().hash(state);
+    }
+}
+impl fmt::Debug for Utf8Char {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmt::Debug::fmt(&self.to_char(), fmtr)
+    }
+}
+impl fmt::Display for Utf8Char {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmtr.write_str(self.as_str())
+    }
+}
+
+
+  ////////////////////////////////
+ //Comparisons with other types//
+////////////////////////////////
+impl PartialEq<char> for Utf8Char {
+    fn eq(&self,  u32c: &char) -> bool {
+        *self == Utf8Char::from(*u32c)
+    }
+}
+impl PartialEq<Utf8Char> for char {
+    fn eq(&self,  u8c: &Utf8Char) -> bool {
+        Utf8Char::from(*self) == *u8c
+    }
+}
+impl PartialOrd<char> for Utf8Char {
+    fn partial_cmp(&self,  u32c: &char) -> Option<Ordering> {
+        self.partial_cmp(&Self::from(*u32c))
+    }
+}
+impl PartialOrd<Utf8Char> for char {
+    fn partial_cmp(&self,  u8c: &Utf8Char) -> Option<Ordering> {
+        Utf8Char::from(*self).partial_cmp(u8c)
+    }
+}
+
+impl PartialEq<Utf16Char> for Utf8Char {
+    fn eq(&self,  u16c: &Utf16Char) -> bool {
+        *self == Self::from(*u16c)
+    }
+}
+impl PartialOrd<Utf16Char> for Utf8Char {
+    fn partial_cmp(&self,  u16c: &Utf16Char) -> Option<Ordering> {
+        self.partial_cmp(&Self::from(*u16c))
+    }
+}
+// The other direction is implemented in utf16_char.rs
+
+/// Only considers the byte equal if both it and the `Utf8Char` represents ASCII characters.
+///
+/// There is no impl in the opposite direction, as this should only be used to
+/// compare `Utf8Char`s against constants.
+///
+/// # Examples
+///
+/// ```
+/// # use encode_unicode::Utf8Char;
+/// assert!(Utf8Char::from('8') == b'8');
+/// assert!(Utf8Char::from_array([0xf1,0x80,0x80,0x80]).unwrap() != 0xf1);
+/// assert!(Utf8Char::from('\u{ff}') != 0xff);
+/// assert!(Utf8Char::from('\u{80}') != 0x80);
+/// ```
+impl PartialEq<u8> for Utf8Char {
+    fn eq(&self,  byte: &u8) -> bool {
+        self.bytes[0] == *byte  &&  self.bytes[1] == 0
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf8Char`s that are not ASCII never compare equal.
+impl PartialEq<AsciiChar> for Utf8Char {
+    #[inline]
+    fn eq(&self,  ascii: &AsciiChar) -> bool {
+        self.bytes[0] == *ascii as u8
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf8Char`s that are not ASCII never compare equal.
+impl PartialEq<Utf8Char> for AsciiChar {
+    #[inline]
+    fn eq(&self,  u8c: &Utf8Char) -> bool {
+        u8c == self
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf8Char`s that are not ASCII always compare greater.
+impl PartialOrd<AsciiChar> for Utf8Char {
+    #[inline]
+    fn partial_cmp(&self,  ascii: &AsciiChar) -> Option<Ordering> {
+        self.bytes[0].partial_cmp(ascii)
+    }
+}
+#[cfg(feature = "ascii")]
+/// `Utf8Char`s that are not ASCII always compare greater.
+impl PartialOrd<Utf8Char> for AsciiChar {
+    #[inline]
+    fn partial_cmp(&self,  u8c: &Utf8Char) -> Option<Ordering> {
+        self.partial_cmp(&u8c.bytes[0])
+    }
+}
+
+
+  ///////////////////////////////////////////////////////
+ //pub impls that should be together for nicer rustdoc//
+///////////////////////////////////////////////////////
+impl Utf8Char {
+    /// Create an `Utf8Char` from the first codepoint in a `str`.
+    ///
+    /// Returns an error if the `str` is empty.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::Utf8Char;
+    ///
+    /// assert_eq!(Utf8Char::from_str_start("a"), Ok((Utf8Char::from('a'),1)));
+    /// assert_eq!(Utf8Char::from_str_start("ab"), Ok((Utf8Char::from('a'),1)));
+    /// assert_eq!(Utf8Char::from_str_start("🂠 "), Ok((Utf8Char::from('🂠'),4)));
+    /// assert_eq!(Utf8Char::from_str_start("é"), Ok((Utf8Char::from('e'),1)));// 'e'+u301 combining mark
+    /// assert!(Utf8Char::from_str_start("").is_err());
+    /// ```
+    pub fn from_str_start(src: &str) -> Result<(Self,usize),EmptyStrError> {
+        unsafe {
+            if src.is_empty() {
+                Err(EmptyStrError)
+            } else {
+                Ok(Utf8Char::from_slice_start_unchecked(src.as_bytes()))
+            }
+        }
+    }
+    /// Create an `Utf8Char` of the first codepoint in an UTF-8 slice.  
+    /// Also returns the length of the UTF-8 sequence for the codepoint.
+    ///
+    /// If the slice is from a `str`, use `::from_str_start()` to skip UTF-8 validation.
+    ///
+    /// # Errors
+    ///
+    /// Returns an `Err` if the slice is empty, doesn't start with a valid
+    /// UTF-8 sequence or is too short for the sequence.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::Utf8Char;
+    /// use encode_unicode::error::InvalidUtf8Slice::*;
+    /// use encode_unicode::error::InvalidUtf8::*;
+    ///
+    /// assert_eq!(Utf8Char::from_slice_start(&[b'A', b'B', b'C']), Ok((Utf8Char::from('A'),1)));
+    /// assert_eq!(Utf8Char::from_slice_start(&[0xdd, 0xbb]), Ok((Utf8Char::from('\u{77b}'),2)));
+    ///
+    /// assert_eq!(Utf8Char::from_slice_start(&[]), Err(TooShort(1)));
+    /// assert_eq!(Utf8Char::from_slice_start(&[0xf0, 0x99]), Err(TooShort(4)));
+    /// assert_eq!(Utf8Char::from_slice_start(&[0xee, b'F', 0x80]), Err(Utf8(NotAContinuationByte(1))));
+    /// assert_eq!(Utf8Char::from_slice_start(&[0xee, 0x99, 0x0f]), Err(Utf8(NotAContinuationByte(2))));
+    /// ```
+    pub fn from_slice_start(src: &[u8]) -> Result<(Self,usize),InvalidUtf8Slice> {
+        char::from_utf8_slice_start(src).map(|(_,len)| {
+            let mut bytes = [0; 4];
+            bytes[..len].copy_from_slice(&src[..len]);
+            (Utf8Char{ bytes: bytes }, len)
+        })
+    }
+    /// A `from_slice_start()` that doesn't validate the codepoint.
+    ///
+    /// # Safety
+    ///
+    /// The slice must be non-empty and start with a valid UTF-8 codepoint.  
+    /// Invalid or incomplete values might cause reads of uninitalized memory.
+    pub unsafe fn from_slice_start_unchecked(src: &[u8]) -> (Self,usize) {
+        let len = 1+src.get_unchecked(0).extra_utf8_bytes_unchecked();
+        let mut bytes = [0; 4];
+        ptr::copy_nonoverlapping(src.as_ptr(), &mut bytes[0] as *mut u8, len);
+        (Utf8Char{ bytes: bytes }, len)
+    }
+    /// Create an `Utf8Char` from a byte array after validating it.
+    ///
+    /// The codepoint must start at the first byte.  
+    /// Unused bytes are set to zero by this function and so can be anything.
+    ///
+    /// # Errors
+    ///
+    /// Returns an `Err` if the array doesn't start with a valid UTF-8 sequence.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::Utf8Char;
+    /// use encode_unicode::error::InvalidUtf8Array::*;
+    /// use encode_unicode::error::InvalidUtf8::*;
+    /// use encode_unicode::error::InvalidCodepoint::*;
+    ///
+    /// assert_eq!(Utf8Char::from_array([b'A', 0, 0, 0]), Ok(Utf8Char::from('A')));
+    /// assert_eq!(Utf8Char::from_array([0xf4, 0x8b, 0xbb, 0xbb]), Ok(Utf8Char::from('\u{10befb}')));
+    /// assert_eq!(Utf8Char::from_array([b'A', b'B', b'C', b'D']), Ok(Utf8Char::from('A')));
+    /// assert_eq!(Utf8Char::from_array([0, 0, 0xcc, 0xbb]), Ok(Utf8Char::from('\0')));
+    ///
+    /// assert_eq!(Utf8Char::from_array([0xef, b'F', 0x80, 0x80]), Err(Utf8(NotAContinuationByte(1))));
+    /// assert_eq!(Utf8Char::from_array([0xc1, 0x80, 0, 0]), Err(Utf8(OverLong)));
+    /// assert_eq!(Utf8Char::from_array([0xf7, 0xaa, 0x99, 0x88]), Err(Codepoint(TooHigh)));
+    /// ```
+    pub fn from_array(utf8: [u8;4]) -> Result<Self,InvalidUtf8Array> {
+        unsafe {
+            // perform all validation
+            try!(char::from_utf8_array(utf8));
+            let extra = utf8[0].extra_utf8_bytes_unchecked() as u32;
+            // zero unused bytes in one operation by transmuting the arrary to
+            // u32, apply an endian-corrected mask and transmute back
+            let mask = u32::from_le(0xff_ff_ff_ff >> 8*(3-extra));
+            let unused_zeroed = mask  &  transmute::<_,u32>(utf8);
+            Ok(Utf8Char{ bytes: transmute(unused_zeroed) })
+        }
+    }
+    /// Zero-cost constructor.
+    ///
+    /// # Safety
+    ///
+    /// Must contain a valid codepoint starting at the first byte, with the
+    /// unused bytes zeroed.  
+    /// Bad values can easily lead to undefined behavior.
+    #[inline]
+    pub unsafe fn from_array_unchecked(utf8: [u8;4]) -> Self {
+        Utf8Char{ bytes: utf8 }
+    }
+    /// Create an `Utf8Char` from a single byte.
+    ///
+    /// The byte must be an ASCII character.
+    ///
+    /// # Errors
+    ///
+    /// Returns `NonAsciiError` if the byte greater than 127.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// # use encode_unicode::Utf8Char;
+    /// assert_eq!(Utf8Char::from_ascii(b'a').unwrap(), 'a');
+    /// assert!(Utf8Char::from_ascii(128).is_err());
+    /// ```
+    pub fn from_ascii(ascii: u8) -> Result<Self,NonAsciiError> {
+        if ascii as i8 >= 0 {
+            Ok(Utf8Char{ bytes: [ascii, 0, 0, 0] })
+        } else {
+            Err(NonAsciiError)
+        }
+    }
+    /// Create an `Utf8Char` from a single byte without checking that it's a
+    /// valid codepoint on its own, which is only true for ASCII characters.
+    ///
+    /// # Safety
+    ///
+    /// The byte must be less than 128.
+    #[inline]
+    pub unsafe fn from_ascii_unchecked(ascii: u8) -> Self {
+        Utf8Char{ bytes: [ascii, 0, 0, 0] }
+    }
+
+    /// The number of bytes this character needs.
+    ///
+    /// Is between 1 and 4 (inclusive) and identical to `.as_ref().len()` or
+    /// `.as_char().len_utf8()`.
+    #[inline]
+    pub fn len(self) -> usize {
+        // Invariants of the extra bytes enambles algorithms that
+        // `u8.extra_utf8_bytes_unchecked()` cannot use.
+        // Some of them turned out to require fewer x86 instructions:
+
+        // Exploits that unused bytes are zero and calculates the number of
+        // trailing zero bytes.
+        // Setting a bit in the first byte prevents the function from returning
+        // 0 for '\0' (which has 32 leading zeros).
+        // trailing and leading is swapped below to optimize for little-endian
+        // architectures.
+        (4 - (u32::to_le(unsafe{transmute(self.bytes)})|1).leading_zeros()/8) as usize
+
+        // Exploits that the extra bytes have their most significant bit set if
+        // in use.
+        // Takes fewer instructions than the one above if popcnt can be used,
+        // (which it cannot by default,
+        //  set RUSTFLAGS='-C target-cpu=native' to enable)
+        //let all: u32 = unsafe{transmute(self.bytes)};
+        //let msb_mask = u32::from_be(0x00808080);
+        //let add_one = u32::from_be(0x80000000);
+        //((all & msb_mask) | add_one).count_ones() as usize
+    }
+    // There is no .is_emty() because this type is never empty.
+
+    /// Checks that the codepoint is an ASCII character.
+    pub fn is_ascii(&self) -> bool {
+        self.bytes[0] <= 127
+    }
+    /// Checks that two characters are an ASCII case-insensitive match.
+    ///
+    /// Is equivalent to `a.to_ascii_lowercase() == b.to_ascii_lowercase()`.
+    #[cfg(feature="std")]
+    pub fn eq_ignore_ascii_case(&self,  other: &Self) -> bool {
+        if self.is_ascii() {self.bytes[0].eq_ignore_ascii_case(&other.bytes[0])}
+        else               {self == other}
+    }
+    /// Converts the character to its ASCII upper case equivalent.
+    ///
+    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
+    /// but non-ASCII letters are unchanged.
+    #[cfg(feature="std")]
+    pub fn to_ascii_uppercase(&self) -> Self {
+        let mut uc = *self;
+        uc.make_ascii_uppercase();
+        uc
+    }
+    /// Converts the character to its ASCII lower case equivalent.
+    ///
+    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
+    /// but non-ASCII letters are unchanged.
+    #[cfg(feature="std")]
+    pub fn to_ascii_lowercase(&self) -> Self {
+        let mut uc = *self;
+        uc.make_ascii_lowercase();
+        uc
+    }
+    /// Converts the character to its ASCII upper case equivalent in-place.
+    ///
+    /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
+    /// but non-ASCII letters are unchanged.
+    #[inline]
+    #[cfg(feature="std")]
+    pub fn make_ascii_uppercase(&mut self) {
+        self.bytes[0].make_ascii_uppercase()
+    }
+    /// Converts the character to its ASCII lower case equivalent in-place.
+    ///
+    /// ASCII letters 'A' to 'Z' are mapped to 'a' to 'z',
+    /// but non-ASCII letters are unchanged.
+    #[inline]
+    #[cfg(feature="std")]
+    pub fn make_ascii_lowercase(&mut self) {
+        self.bytes[0].make_ascii_lowercase();
+    }
+
+    /// Convert from UTF-8 to UTF-32
+    pub fn to_char(self) -> char {
+        self.into()
+    }
+    /// Write the internal representation to a slice,
+    /// and then returns the number of bytes written.
+    ///
+    /// # Panics
+    ///
+    /// Will panic the buffer is too small;
+    /// You can get the required length from `.len()`,
+    /// but a buffer of length four is always large enough.
+    pub fn to_slice(self,  dst: &mut[u8]) -> usize {
+        if self.len() > dst.len() {
+            panic!("The provided buffer is too small.");
+        }
+        dst[..self.len()].copy_from_slice(&self.bytes[..self.len()]);
+        self.len()
+    }
+    /// Expose the internal array and the number of used bytes.
+    pub fn to_array(self) -> ([u8;4],usize) {
+        (self.bytes, self.len())
+    }
+    /// Return a `str` view of the array the codepoint is stored as.
+    ///
+    /// Is an unambiguous version of `.as_ref()`.
+    pub fn as_str(&self) -> &str {
+        self.deref()
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/src/utf8_iterators.rs b/android/vendor/encode_unicode-0.3.6/src/utf8_iterators.rs
new file mode 100644
index 0000000..891d729
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/src/utf8_iterators.rs
@@ -0,0 +1,352 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+use utf8_char::Utf8Char;
+use errors::EmptyStrError;
+extern crate core;
+use self::core::{mem, u32, u64};
+use self::core::ops::Not;
+use self::core::fmt;
+use self::core::borrow::Borrow;
+#[cfg(feature="std")]
+use std::io::{Read, Error as ioError};
+
+
+
+/// Read or iterate over the bytes of the UTF-8 representation of a codepoint.
+#[derive(Clone)]
+pub struct Utf8Iterator (u32);
+
+impl From<Utf8Char> for Utf8Iterator {
+    fn from(uc: Utf8Char) -> Self {
+        let used = u32::from_le(unsafe{ mem::transmute(uc.to_array().0) });
+        // uses u64 because shifting an u32 by 32 bits is a no-op.
+        let unused_set = (u64::MAX  <<  uc.len() as u64*8) as u32;
+        Utf8Iterator(used | unused_set)
+    }
+}
+impl From<char> for Utf8Iterator {
+    fn from(c: char) -> Self {
+        Self::from(Utf8Char::from(c))
+    }
+}
+impl Iterator for Utf8Iterator {
+    type Item=u8;
+    fn next(&mut self) -> Option<u8> {
+        let next = self.0 as u8;
+        if next == 0xff {
+            None
+        } else {
+            self.0 = (self.0 >> 8)  |  0xff_00_00_00;
+            Some(next)
+        }
+    }
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (self.len(),  Some(self.len()))
+    }
+}
+impl ExactSizeIterator for Utf8Iterator {
+    fn len(&self) -> usize {// not straightforward, but possible
+        let unused_bytes = self.0.not().leading_zeros() / 8;
+        4 - unused_bytes as usize
+    }
+}
+#[cfg(feature="std")]
+impl Read for Utf8Iterator {
+    /// Always returns Ok
+    fn read(&mut self,  buf: &mut[u8]) -> Result<usize, ioError> {
+        // Cannot call self.next() until I know I can write the result.
+        for (i, dst) in buf.iter_mut().enumerate() {
+            match self.next() {
+                Some(b) => *dst = b,
+                None    => return Ok(i),
+            }
+        }
+        Ok(buf.len())
+    }
+}
+impl fmt::Debug for Utf8Iterator {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        let mut content = [0; 4];
+        let mut i = 0;
+        for b in self.clone() {
+            content[i] = b;
+            i += 1;
+        }
+        write!(fmtr, "{:?}", &content[..i])
+    }
+}
+
+
+
+/// Converts an iterator of `Utf8Char` (or `&Utf8Char`)
+/// to an iterator of `u8`s.  
+/// Is equivalent to calling `.flat_map()` on the original iterator,
+/// but the returned iterator is ~40% faster.
+///
+/// The iterator also implements `Read` (if the `std` feature isn't disabled).
+/// Reading will never produce an error, and calls to `.read()` and `.next()`
+/// can be mixed.
+///
+/// The exact number of bytes cannot be known in advance, but `size_hint()`
+/// gives the possible range.
+/// (min: all remaining characters are ASCII, max: all require four bytes)
+///
+/// # Examples
+///
+/// From iterator of values:
+///
+/// ```
+/// use encode_unicode::{iter_bytes, CharExt};
+///
+/// let iterator = "foo".chars().map(|c| c.to_utf8() );
+/// let mut bytes = [0; 4];
+/// for (u,dst) in iter_bytes(iterator).zip(&mut bytes) {*dst=u;}
+/// assert_eq!(&bytes, b"foo\0");
+/// ```
+///
+/// From iterator of references:
+///
+#[cfg_attr(feature="std", doc=" ```")]
+#[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+/// use encode_unicode::{iter_bytes, CharExt, Utf8Char};
+///
+/// let chars: Vec<Utf8Char> = "💣 bomb 💣".chars().map(|c| c.to_utf8() ).collect();
+/// let bytes: Vec<u8> = iter_bytes(&chars).collect();
+/// let flat_map: Vec<u8> = chars.iter().flat_map(|u8c| *u8c ).collect();
+/// assert_eq!(bytes, flat_map);
+/// ```
+///
+/// `Read`ing from it:
+///
+#[cfg_attr(feature="std", doc=" ```")]
+#[cfg_attr(not(feature="std"), doc=" ```no_compile")]
+/// use encode_unicode::{iter_bytes, CharExt};
+/// use std::io::Read;
+///
+/// let s = "Ååh‽";
+/// assert_eq!(s.len(), 8);
+/// let mut buf = [b'E'; 9];
+/// let mut reader = iter_bytes(s.chars().map(|c| c.to_utf8() ));
+/// assert_eq!(reader.read(&mut buf[..]).unwrap(), 8);
+/// assert_eq!(reader.read(&mut buf[..]).unwrap(), 0);
+/// assert_eq!(&buf[..8], s.as_bytes());
+/// assert_eq!(buf[8], b'E');
+/// ```
+pub fn iter_bytes<U:Borrow<Utf8Char>, I:IntoIterator<Item=U>>
+(iterable: I) -> Utf8CharSplitter<U, I::IntoIter> {
+    Utf8CharSplitter{ inner: iterable.into_iter(),  prev: 0 }
+}
+
+/// The iterator type returned by `iter_bytes()`
+///
+/// See its documentation for details.
+#[derive(Clone)]
+pub struct Utf8CharSplitter<U:Borrow<Utf8Char>, I:Iterator<Item=U>> {
+    inner: I,
+    prev: u32,
+}
+impl<I:Iterator<Item=Utf8Char>> From<I> for Utf8CharSplitter<Utf8Char,I> {
+    /// A less generic constructor than `iter_bytes()`
+    fn from(iter: I) -> Self {
+        iter_bytes(iter)
+    }
+}
+impl<U:Borrow<Utf8Char>, I:Iterator<Item=U>> Utf8CharSplitter<U,I> {
+    /// Extracts the source iterator.
+    ///
+    /// Note that `iter_bytes(iter.into_inner())` is not a no-op:  
+    /// If the last returned byte from `next()` was not an ASCII by,
+    /// the remaining bytes of that codepoint is lost.
+    pub fn into_inner(self) -> I {
+        self.inner
+    }
+}
+impl<U:Borrow<Utf8Char>, I:Iterator<Item=U>> Iterator for Utf8CharSplitter<U,I> {
+    type Item = u8;
+    fn next(&mut self) -> Option<Self::Item> {
+        if self.prev == 0 {
+            self.inner.next().map(|u8c| {
+                let array = u8c.borrow().to_array().0;
+                self.prev = unsafe{ u32::from_le(mem::transmute(array)) } >> 8;
+                array[0]
+            })
+        } else {
+            let next = self.prev as u8;
+            self.prev >>= 8;
+            Some(next)
+        }
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        // Doesn't need to handle unlikely overflows correctly because
+        // size_hint() cannot be relied upon anyway. (the trait isn't unsafe)
+        let (min, max) = self.inner.size_hint();
+        let add = 4 - (self.prev.leading_zeros() / 8) as usize;
+        (min.wrapping_add(add), max.map(|max| max.wrapping_mul(4).wrapping_add(add) ))
+    }
+}
+#[cfg(feature="std")]
+impl<U:Borrow<Utf8Char>, I:Iterator<Item=U>> Read for Utf8CharSplitter<U,I> {
+    /// Always returns `Ok`
+    fn read(&mut self,  buf: &mut[u8]) -> Result<usize, ioError> {
+        let mut i = 0;
+        // write remaining bytes of previous codepoint
+        while self.prev != 0  &&  i < buf.len() {
+            buf[i] = self.prev as u8;
+            self.prev >>= 8;
+            i += 1;
+        }
+        // write whole characters
+        while i < buf.len() {
+            let bytes = match self.inner.next() {
+                Some(u8c) => u8c.borrow().to_array().0,
+                None => break
+            };
+            buf[i] = bytes[0];
+            i += 1;
+            if bytes[1] != 0 {
+                let len = bytes[0].not().leading_zeros() as usize;
+                let mut written = 1;
+                while written < len {
+                    if i < buf.len() {
+                        buf[i] = bytes[written];
+                        i += 1;
+                        written += 1;
+                    } else {
+                        let bytes_as_u32 = unsafe{ u32::from_le(mem::transmute(bytes)) };
+                        self.prev = bytes_as_u32 >> (8*written);
+                        return Ok(i);
+                    }
+                }
+            }
+        }
+        Ok(i)
+    }
+}
+
+
+
+/// An iterator over the `Utf8Char` of a string slice, and their positions.
+///
+/// This struct is created by the `utf8char_indices() method from [`StrExt`] trait. See its documentation for more.
+#[derive(Clone)]
+pub struct Utf8CharIndices<'a>{
+    str: &'a str,
+    index: usize,
+}
+impl<'a> From<&'a str> for Utf8CharIndices<'a> {
+    fn from(s: &str) -> Utf8CharIndices {
+        Utf8CharIndices{str: s, index: 0}
+    }
+}
+impl<'a> Utf8CharIndices<'a> {
+    /// Extract the remainder of the source `str`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::{StrExt, Utf8Char};
+    /// let mut iter = "abc".utf8char_indices();
+    /// assert_eq!(iter.next_back(), Some((2, Utf8Char::from('c'))));
+    /// assert_eq!(iter.next(), Some((0, Utf8Char::from('a'))));
+    /// assert_eq!(iter.as_str(), "b");
+    /// ```
+    pub fn as_str(&self) -> &'a str {
+        &self.str[self.index..]
+    }
+}
+impl<'a> Iterator for Utf8CharIndices<'a> {
+    type Item = (usize,Utf8Char);
+    fn next(&mut self) -> Option<(usize,Utf8Char)> {
+        match Utf8Char::from_str_start(&self.str[self.index..]) {
+            Ok((u8c, len)) => {
+                let item = (self.index, u8c);
+                self.index += len;
+                Some(item)
+            },
+            Err(EmptyStrError) => None
+        }
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        let len = self.str.len() - self.index;
+        // For len+3 to overflow, the slice must fill all but two bytes of
+        // addressable memory, and size_hint() doesn't need to be correct.
+        (len.wrapping_add(3)/4, Some(len))
+    }
+}
+impl<'a> DoubleEndedIterator for Utf8CharIndices<'a> {
+    fn next_back(&mut self) -> Option<(usize,Utf8Char)> {
+        // Cannot refactor out the unwrap without switching to ::from_slice()
+        // since slicing the str panics if not on a boundary.
+        if self.index < self.str.len() {
+            let rev = self.str.bytes().rev();
+            let len = 1 + rev.take_while(|b| b & 0b1100_0000 == 0b1000_0000 ).count();
+            let starts = self.str.len() - len;
+            let (u8c,_) = Utf8Char::from_str_start(&self.str[starts..]).unwrap();
+            self.str = &self.str[..starts];
+            Some((starts, u8c))
+        } else {
+            None
+        }
+    }
+}
+impl<'a> fmt::Debug for Utf8CharIndices<'a> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmtr.debug_tuple("Utf8CharIndices")
+            .field(&self.index)
+            .field(&self.as_str())
+            .finish()
+    }
+}
+
+
+/// An iterator over the codepoints in a `str` represented as `Utf8Char`.
+#[derive(Clone)]
+pub struct Utf8Chars<'a>(Utf8CharIndices<'a>);
+impl<'a> From<&'a str> for Utf8Chars<'a> {
+    fn from(s: &str) -> Utf8Chars {
+        Utf8Chars(Utf8CharIndices::from(s))
+    }
+}
+impl<'a> Utf8Chars<'a> {
+    /// Extract the remainder of the source `str`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use encode_unicode::{StrExt, Utf8Char};
+    /// let mut iter = "abc".utf8chars();
+    /// assert_eq!(iter.next(), Some(Utf8Char::from('a')));
+    /// assert_eq!(iter.next_back(), Some(Utf8Char::from('c')));
+    /// assert_eq!(iter.as_str(), "b");
+    /// ```
+    pub fn as_str(&self) -> &'a str {
+        self.0.as_str()
+    }
+}
+impl<'a> Iterator for Utf8Chars<'a> {
+    type Item = Utf8Char;
+    fn next(&mut self) -> Option<Utf8Char> {
+        self.0.next().map(|(_,u8c)| u8c )
+    }
+    fn size_hint(&self) -> (usize,Option<usize>) {
+        self.0.size_hint()
+    }
+}
+impl<'a> DoubleEndedIterator for Utf8Chars<'a> {
+    fn next_back(&mut self) -> Option<Utf8Char> {
+        self.0.next_back().map(|(_,u8c)| u8c )
+    }
+}
+impl<'a> fmt::Debug for Utf8Chars<'a> {
+    fn fmt(&self,  fmtr: &mut fmt::Formatter) -> fmt::Result {
+        fmtr.debug_tuple("Utf8CharIndices")
+            .field(&self.as_str())
+            .finish()
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/tests/errs.rs b/android/vendor/encode_unicode-0.3.6/tests/errs.rs
new file mode 100644
index 0000000..9c8747b
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/tests/errs.rs
@@ -0,0 +1,197 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+//! Test that methods gives the correct error.
+//! Some also test a bit more because it's easy.
+
+extern crate core;
+use core::char;
+extern crate encode_unicode;
+use encode_unicode::*;
+use encode_unicode::error::*;
+use encode_unicode::error::InvalidUtf8Array as a;
+use encode_unicode::error::InvalidUtf8Slice as s;
+use encode_unicode::error::InvalidCodepoint::*;
+use encode_unicode::error::InvalidUtf8::*;
+use encode_unicode::error::InvalidUtf8FirstByte::*;
+
+
+#[test]
+fn from_u32() {
+    for c in 0xd800..0xe000 {
+        assert_eq!(char::from_u32_detailed(c),  Err(Utf16Reserved));
+    }
+    let mut c = 0x11_00_00;
+    loop {
+        assert_eq!(char::from_u32_detailed(c),  Err(TooHigh));
+        // Don't test every value. (Range.step_by() is unstable)
+        match c.checked_add(0x10_11_11) {
+            Some(next) => c = next,
+            None => break,
+        }
+    }
+}
+
+#[test]
+fn utf8_extra_bytes() {
+    for c in 0..256 {
+        assert_eq!( (c as u8).extra_utf8_bytes(), match c {
+            0b_1000_0000...0b_1011_1111 => Err(ContinuationByte),
+            0b_1111_1000...0b_1111_1111 => Err(TooLongSeqence),
+            0b_0000_0000...0b_0111_1111 => Ok(0),
+            0b_1100_0000...0b_1101_1111 => Ok(1),
+            0b_1110_0000...0b_1110_1111 => Ok(2),
+            0b_1111_0000...0b_1111_0111 => Ok(3),
+                         _              => unreachable!(),
+        });
+    }
+}
+
+#[test]
+fn utf16_extra_unit() {
+    for c in 0..0x1_00_00 {
+        assert_eq!( (c as u16).utf16_needs_extra_unit(), match c {
+            0b_0000_0000_0000_0000...0b_1101_0111_1111_1111 => Ok(false),
+            0b_1101_1000_0000_0000...0b_1101_1011_1111_1111 => Ok(true),
+            0b_1101_1100_0000_0000...0b_1101_1111_1111_1111 => Err(InvalidUtf16FirstUnit),
+            0b_1110_0000_0000_0000...0b_1111_1111_1111_1111 => Ok(false),
+                                   _                        => unreachable!(),
+        });
+    }
+}
+
+
+#[test]
+fn from_utf16_tuple() {
+    use encode_unicode::error::InvalidUtf16Tuple::*;
+    for u in 0xdc00..0xe000 {
+        let close = if u%3==0 {u-100} else {u+100};
+        let doesnt_matter = if u%2==0 {Some(close)} else {None};
+        assert_eq!(char::from_utf16_tuple((u,doesnt_matter)), Err(FirstIsTrailingSurrogate));
+    }
+    for u in (0..0xd800).chain(0xe000..0x10000) {
+        assert_eq!(
+            char::from_utf16_tuple((u as u16, Some((0x100+u) as u16))),
+            Err(SuperfluousSecond)
+        );
+    }
+    for u in 0xd800..0xdc00 {
+        assert_eq!(char::from_utf16_tuple((u,None)), Err(MissingSecond));
+        assert_eq!(char::from_utf16_tuple((u,Some(u - 0x2ff))), Err(InvalidSecond));
+    }
+}
+
+#[test]
+fn from_utf16_slice_start() {
+    use encode_unicode::error::InvalidUtf16Slice::*;
+    assert_eq!(char::from_utf16_slice_start(&[]), Err(EmptySlice));
+    let mut buf = [0; 6];
+    for u in 0xd800..0xdc00 {
+        buf[0] = u;
+        assert_eq!(char::from_utf16_slice_start(&buf[..1]), Err(MissingSecond));
+        buf[1] = u;
+        let pass = 2 + (u as usize % (buf.len()-2));
+        assert_eq!(char::from_utf16_slice_start(&buf[..pass]), Err(SecondNotLowSurrogate));
+    }
+    for u in 0xdc00..0xe000 {
+        buf[0] = u;
+        let close = if u%3==0 {u-100} else {u+100};
+        let pass = 1 + (u as usize % (buf.len()-1));
+        buf[pass] = close;
+        assert_eq!(char::from_utf16_slice_start(&buf[..pass]), Err(FirstLowSurrogate));
+    }
+}
+
+#[test]
+fn utf8_overlong() {
+    let overlongs = [
+        [0xf0,0x8f], [0xf0,0x87], [0xf0,0x80], // 4-byte
+        [0xe0,0x9f], [0xe0,0x8f], [0xe0,0x80], // 3-byte
+        [0xc1,0xbf], [0xc1,0x92], [0xc1,0x80], // 2-byte
+        [0xc0,0xbf], [0xc0,0x9f], [0xc0,0x80], // 2-byte
+    ];
+    for o in overlongs.iter() {
+        for &last in &[0x80, 0xbf] {
+            let arr = [o[0], o[1], last, last];
+            assert_eq!(char::from_utf8_slice_start(&arr), Err(InvalidUtf8Slice::Utf8(OverLong)));
+            assert_eq!(char::from_utf8_array(arr), Err(InvalidUtf8Array::Utf8(OverLong)));
+            assert_eq!(Utf8Char::from_slice_start(&arr), Err(InvalidUtf8Slice::Utf8(OverLong)));
+            assert_eq!(Utf8Char::from_array(arr), Err(InvalidUtf8Array::Utf8(OverLong)));
+        }
+    }
+}
+
+#[test]
+fn from_str_start() {
+    assert_eq!(Utf8Char::from_str_start(""), Err(EmptyStrError));
+    assert_eq!(Utf16Char::from_str_start(""), Err(EmptyStrError));
+}
+
+#[test] fn utf8_codepoint_is_too_high() {
+    assert_eq!(Utf8Char::from_array([0xf4, 0x90, 0x80, 0x80]), Err(a::Codepoint(TooHigh)));
+    assert_eq!(char::from_utf8_array([0xf4, 0x90, 0x80, 0x80]), Err(a::Codepoint(TooHigh)));
+    assert_eq!(Utf8Char::from_slice_start(&[0xf4, 0x90, 0x80, 0x80]), Err(s::Codepoint(TooHigh)));
+    assert_eq!(char::from_utf8_slice_start(&[0xf4, 0x90, 0x80, 0x80]), Err(s::Codepoint(TooHigh)));
+
+    assert_eq!(Utf8Char::from_array([0xf5, 0x88, 0x99, 0xaa]), Err(a::Codepoint(TooHigh)));
+    assert_eq!(char::from_utf8_array([0xf5, 0xaa, 0xbb, 0x88]), Err(a::Codepoint(TooHigh)));
+    assert_eq!(Utf8Char::from_slice_start(&[0xf5, 0x99, 0xaa, 0xbb]), Err(s::Codepoint(TooHigh)));
+    assert_eq!(char::from_utf8_slice_start(&[0xf5, 0xbb, 0x88, 0x99]), Err(s::Codepoint(TooHigh)));
+}
+
+#[test] fn utf8_codepoint_is_utf16_reserved() {
+    assert_eq!(Utf8Char::from_array([0xed, 0xa0, 0x80, 0xff]), Err(a::Codepoint(Utf16Reserved)));
+    assert_eq!(char::from_utf8_array([0xed, 0xa0, 0x8f, 0x00]), Err(a::Codepoint(Utf16Reserved)));
+    assert_eq!(Utf8Char::from_slice_start(&[0xed, 0xa0, 0xbe, 0xa5]), Err(s::Codepoint(Utf16Reserved)));
+    assert_eq!(char::from_utf8_slice_start(&[0xed, 0xa0, 0xbf]), Err(s::Codepoint(Utf16Reserved)));
+    assert_eq!(Utf8Char::from_array([0xed, 0xbf, 0x80, 0xff]), Err(a::Codepoint(Utf16Reserved)));
+    assert_eq!(char::from_utf8_array([0xed, 0xbf, 0x8f, 0x00]), Err(a::Codepoint(Utf16Reserved)));
+    assert_eq!(Utf8Char::from_slice_start(&[0xed, 0xbf, 0xbe, 0xa5]), Err(s::Codepoint(Utf16Reserved)));
+    assert_eq!(char::from_utf8_slice_start(&[0xed, 0xbf, 0xbf]), Err(s::Codepoint(Utf16Reserved)));
+}
+
+#[test] fn utf8_first_is_continuation_byte() {
+    for first in 0x80..0xc0 {
+        let arr = [first, first<<2, first<<4, first<<6];
+        assert_eq!(Utf8Char::from_array(arr), Err(a::Utf8(FirstByte(ContinuationByte))));
+        assert_eq!(char::from_utf8_array(arr), Err(a::Utf8(FirstByte(ContinuationByte))));
+        let len = (1 + first%3) as usize;
+        assert_eq!(Utf8Char::from_slice_start(&arr[..len]), Err(s::Utf8(FirstByte(ContinuationByte))));
+        assert_eq!(char::from_utf8_slice_start(&arr[..len]), Err(s::Utf8(FirstByte(ContinuationByte))));
+    }
+}
+
+#[test] fn utf8_too_long() {
+    for first in 0xf8..0x100 {
+        let arr = [first as u8, 0x88, 0x80, 0x80];
+        assert_eq!(Utf8Char::from_array(arr), Err(a::Utf8(FirstByte(TooLongSeqence))));
+        assert_eq!(char::from_utf8_array(arr), Err(a::Utf8(FirstByte(TooLongSeqence))));
+        let arr = [first as u8, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80];
+        let slice = &arr[..if first&1 == 0 {1} else {8}];
+        assert_eq!(Utf8Char::from_slice_start(slice), Err(s::Utf8(FirstByte(TooLongSeqence))));
+        assert_eq!(char::from_utf8_slice_start(slice), Err(s::Utf8(FirstByte(TooLongSeqence))));
+    }
+}
+
+#[test] fn utf8_not_continuation_byte() {
+    for first in 0xc2..0xf4 {
+        let mut arr = [first, 0x90, 0xa0, 0xb0];
+        let extra = first.extra_utf8_bytes().unwrap();
+        for corrupt in (1..extra).rev() {
+            let expected = NotAContinuationByte(corrupt);
+            for &bad in &[0x00, 0x3f,  0x40, 0x7f,  0xc0, 0xff] {
+                arr[corrupt] = bad;
+                assert_eq!(Utf8Char::from_array(arr), Err(a::Utf8(expected)), "{:?}", arr);
+                assert_eq!(char::from_utf8_array(arr), Err(a::Utf8(expected)));
+                let slice = if first&1 == 0 {&arr[..1+extra]} else {&arr};
+                assert_eq!(Utf8Char::from_slice_start(slice), Err(s::Utf8(expected)), "{:?}", slice);
+                assert_eq!(char::from_utf8_slice_start(slice), Err(s::Utf8(expected)));
+            }
+        }
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/tests/exhaustive.rs b/android/vendor/encode_unicode-0.3.6/tests/exhaustive.rs
new file mode 100644
index 0000000..ce60c6b
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/tests/exhaustive.rs
@@ -0,0 +1,34 @@
+/* Copyright 2018 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+//! Tests that try all possible values for at least one parameter / byte / unit
+//! of the tested function.
+
+use std::char;
+extern crate encode_unicode;
+use encode_unicode::*;
+
+#[test]
+fn from_ascii() {
+    for cp in 0u32..256 {
+        assert_eq!(Utf8Char::from_ascii(cp as u8).is_ok(), cp & 0x80 == 0);
+        if let Ok(u8c) = Utf8Char::from_ascii(cp as u8) {
+            assert_eq!(u8c, Utf8Char::from(cp as u8 as char));
+        }
+    }
+}
+
+#[test]
+fn from_bmp() {
+    for cp in 0u32..0x1_00_00 {
+        assert_eq!(
+            Utf16Char::from_bmp(cp as u16).ok(),
+            char::from_u32(cp).map(|u32c| Utf16Char::from(u32c) )
+        );
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/tests/iterators.rs b/android/vendor/encode_unicode-0.3.6/tests/iterators.rs
new file mode 100644
index 0000000..2a4c006
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/tests/iterators.rs
@@ -0,0 +1,182 @@
+/* Copyright 2018 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+//! Iterator tests
+
+#![cfg(feature="std")]
+
+extern crate encode_unicode;
+
+use encode_unicode::{IterExt, SliceExt, CharExt};
+use encode_unicode::iterator::Utf8CharSplitter;
+use encode_unicode::error::InvalidUtf8Slice::*;
+use encode_unicode::error::InvalidUtf8::*;
+use encode_unicode::error::InvalidUtf8FirstByte::*;
+use encode_unicode::error::InvalidCodepoint::*;
+use encode_unicode::error::Utf16PairError::*;
+use std::io::Read;
+use std::cmp::min;
+
+#[test] fn utf8charmerger() {
+    let slice = b"\xf0\xa1\x92X\xcc\xbb";
+    let mut iter = slice.iter().to_utf8chars();
+    assert_eq!(iter.size_hint(), (1, Some(6)));
+    assert_eq!(format!("{:?}", &iter),
+               format!("Utf8CharMerger {{ buffered: [], inner: {:?} }}", slice.iter()));
+
+    assert_eq!(iter.next(), Some(Err(Utf8(NotAContinuationByte(3)))));
+    assert_eq!(iter.size_hint(), (0, Some(5)));
+    assert_eq!(
+        format!("{:?}", &iter),
+        format!("Utf8CharMerger {{ buffered: [161, 146, 88], inner: {:?} }}", slice[4..].iter())
+    );
+
+    assert_eq!(iter.next(), Some(Err(Utf8(FirstByte(ContinuationByte)))));
+    assert_eq!(iter.into_inner().next(), Some(&b'\xcc'));
+}
+
+#[test] fn utf8chardecoder() {
+    let slice = b"\xf4\xbf\x80\x80XY\xcc\xbbZ_";
+    let mut iter = slice.utf8char_indices();
+    assert_eq!(iter.size_hint(), (2, Some(10)));
+    assert_eq!(
+        format!("{:?}", &iter),
+        format!("Utf8CharDecoder {{ bytes[0..]: {:?} }}", &slice)
+    );
+
+    assert_eq!(iter.next(), Some((0, Err(Codepoint(TooHigh)), 1)));
+    assert_eq!(
+        format!("{:?}", &iter),
+        format!("Utf8CharDecoder {{ bytes[1..]: {:?} }}", &slice[1..])
+    );
+    assert_eq!(iter.size_hint(), (2, Some(9)));
+    assert_eq!(iter.count(), 8);
+}
+
+#[test] fn utf16charmerger() {
+    let slice = [0xd800, 'x' as u16, 0xd900, 0xdfff, 'λ' as u16];
+    let mut iter = slice.iter().to_utf16chars();
+    assert_eq!(iter.size_hint(), (2, Some(5)));
+    assert_eq!(format!("{:?}", &iter),
+               format!("Utf16CharMerger {{ buffered: None, inner: {:?} }}", slice.iter()));
+
+    assert_eq!(iter.next(), Some(Err(UnmatchedLeadingSurrogate)));
+    assert_eq!(iter.size_hint(), (1, Some(4)));
+    assert_eq!(
+        format!("{:?}", &iter),
+        format!("Utf16CharMerger {{ buffered: Some(120), inner: {:?} }}", slice[2..].iter())
+    );
+
+    assert_eq!(iter.into_inner().next(), Some(&0xd900));
+}
+
+#[test] fn utf16chardecoder() {
+    let slice = [0xd800, 'x' as u16, 0xd900, 0xdfff, 'λ' as u16];
+    let mut iter = slice.utf16char_indices();
+    assert_eq!(iter.size_hint(), (2, Some(5)));
+    assert_eq!(
+        format!("{:?}", &iter),
+        format!("Utf16CharDecoder {{ units[0..]: {:?} }}", &slice)
+    );
+
+    assert_eq!(iter.next(), Some((0, Err(UnmatchedLeadingSurrogate), 1)));
+    assert_eq!(
+        format!("{:?}", &iter),
+        format!("Utf16CharDecoder {{ units[1..]: {:?} }}", &slice[1..])
+    );
+    assert_eq!(iter.size_hint(), (2, Some(4)));
+    assert_eq!(iter.count(), 3);
+}
+
+
+
+/// Tests for ensuring that iterators which also implement Read support
+/// interleaving calls of `read()` and `next()`, and that they implement Read
+/// correctly (support any buffer size at any time).
+
+#[test] fn read_single_ascii() {
+    let uc = 'a'.to_utf8();
+    assert_eq!(uc.len(), 1);
+    for chunk in 1..5 {
+        let mut buf = [b'E'; 6];
+        let mut iter = uc.into_iter();
+        let mut written = 0;
+        for _ in 0..4 {
+            assert_eq!(iter.read(&mut buf[..0]).unwrap(), 0);
+            let wrote = iter.read(&mut buf[written..written+chunk]).unwrap();
+            assert_eq!(wrote, min(1-written, chunk));
+            written += wrote;
+            for &b in &buf[written..] {assert_eq!(b, b'E');}
+            assert_eq!(buf[..written], AsRef::<[u8]>::as_ref(&uc)[..written]);
+        }
+        assert_eq!(written, 1);
+    }
+}
+
+#[test] fn read_single_nonascii() {
+    let uc = 'ä'.to_utf8();
+    assert_eq!(uc.len(), 2);
+    for chunk in 1..5 {
+        let mut buf = [b'E'; 6];
+        let mut iter = uc.into_iter();
+        let mut written = 0;
+        for _ in 0..4 {
+            assert_eq!(iter.read(&mut buf[..0]).unwrap(), 0);
+            let wrote = iter.read(&mut buf[written..written+chunk]).unwrap();
+            assert_eq!(wrote, min(2-written, chunk));
+            written += wrote;
+            for &b in &buf[written..] {assert_eq!(b, b'E');}
+            assert_eq!(buf[..written], AsRef::<[u8]>::as_ref(&uc)[..written]);
+        }
+        assert_eq!(written, 2);
+    }
+}
+
+
+#[test] fn utf8charsplitter_read_all_sizes() {
+    let s = "1111\u{104444}\u{222}1\u{833}1111\u{100004}";
+    assert!(s.len()%3 == 1);
+    let mut buf = vec![b'E'; s.len()+6];
+    for size in 2..6 {//s.len()+4 {
+        let mut reader = Utf8CharSplitter::from(s.chars().map(|c| c.to_utf8() ));
+        for (offset, part) in s.as_bytes().chunks(size).enumerate() {
+            let read_to = if part.len() == size {(offset+1)*size} else {buf.len()};
+            assert_eq!(reader.read(&mut buf[offset*size..read_to]).unwrap(), part.len());
+            assert_eq!(&buf[..offset*size+part.len()], &s.as_bytes()[..offset*size+part.len()]);
+        }
+        assert_eq!(reader.read(&mut buf[..]).unwrap(), 0);
+        assert!(buf[s.len()..].iter().all(|&b| b==b'E' ));
+    }
+}
+
+#[test] fn utf8charsplitter_alternate_iter_read() {
+    let s = "1111\u{104444}\u{222}1\u{833}1111\u{100004}";
+    let mut buf = [b'0'; 10];
+    for n in 0..2 {
+        // need to collect to test size_hint()
+        // because chars().size_hint() returns ((bytes+3)/4, Some(bytes))
+        let u8chars = s.chars().map(|c| c.to_utf8() ).collect::<Vec<_>>();
+        let mut iter: Utf8CharSplitter<_,_> = u8chars.into_iter().into();
+        for (i, byte) in s.bytes().enumerate() {
+            let until_next = s.as_bytes()[i..].iter().take_while(|&b| (b>>6)==0b10u8 ).count();
+            let remaining_chars = s[i+until_next..].chars().count();
+            println!("{}. run: byte {:02} of {}, remaining: {:02}+{}: 0b{:08b} = {:?}",
+                     n, i, s.len(), remaining_chars, until_next, byte, byte as char);
+            assert_eq!(iter.read(&mut[][..]).unwrap(), 0);
+            if i % 2 == n {
+                assert_eq!(iter.next(), Some(byte));
+            } else {
+                assert_eq!(iter.read(&mut buf[..1]).unwrap(), 1);
+                assert_eq!(buf[0], byte);
+            }
+        }
+        assert_eq!(iter.size_hint(), (0, Some(0)));
+        assert_eq!(iter.next(), None);
+        assert_eq!(iter.read(&mut buf[..]).unwrap(), 0);
+    }
+}
diff --git a/android/vendor/encode_unicode-0.3.6/tests/oks.rs b/android/vendor/encode_unicode-0.3.6/tests/oks.rs
new file mode 100644
index 0000000..8bab37f
--- /dev/null
+++ b/android/vendor/encode_unicode-0.3.6/tests/oks.rs
@@ -0,0 +1,284 @@
+/* Copyright 2016 The encode_unicode Developers
+ *
+ * Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
+ * http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
+ * http://opensource.org/licenses/MIT>, at your option. This file may not be
+ * copied, modified, or distributed except according to those terms.
+ */
+
+//! Test that every method gives the correct result for valid values.
+//! Except iterators, which are stateful.
+
+use std::char;
+use std::str::{self,FromStr};
+use std::cmp::Ordering;
+use std::hash::{Hash,Hasher};
+use std::collections::hash_map::DefaultHasher;
+#[allow(deprecated,unused)]
+use std::ascii::AsciiExt;
+use std::iter::FromIterator;
+extern crate encode_unicode;
+use encode_unicode::*;
+
+
+#[test]
+fn equal_defaults() {
+    assert_eq!(Utf8Char::default().to_char(), char::default());
+    assert_eq!(Utf16Char::default().to_char(), char::default());
+}
+
+#[test]
+fn same_size_as_char() {
+    use std::mem::size_of;
+    assert_eq!(size_of::<Utf8Char>(), size_of::<char>());
+    assert_eq!(size_of::<Utf16Char>(), size_of::<char>());
+}
+
+#[test]
+fn utf16chars_to_string() {
+    let s = "aå\u{10ffff}‽\u{100000}\u{fee1}";
+    let u16cs = s.chars().map(|c| Utf16Char::from(c) ).collect::<Vec<Utf16Char>>();
+
+    let mut from_refs: String = u16cs.iter().collect();
+    assert_eq!(&from_refs, s);
+    from_refs.extend(&u16cs);
+    assert_eq!(&from_refs[s.len()..], s);
+
+    let mut from_vals: String = u16cs.iter().cloned().collect();
+    assert_eq!(&from_vals, s);
+    from_vals.extend(u16cs);
+    assert_eq!(&from_vals[s.len()..], s);
+}
+
+
+const EDGES_AND_BETWEEN: [char;19] = [
+    '\u{0}',// min
+    '\u{3b}',// middle ASCII
+    'A',// min ASCII uppercase
+    'N',// middle ASCII uppercase
+    'Z',// max ASCII uppercase
+    'a',// min ASCII lowercase
+    'm',// middle ASCII lowercase
+    'z',// max ASCII lowercase
+    '\u{7f}',// max ASCII and 1-byte UTF-8
+    '\u{80}',// min 2-byte UTF-8
+    '\u{111}',// middle
+    '\u{7ff}',// max 2-byte UTF-8
+    '\u{800}',// min 3-byte UTF-8
+    '\u{d7ff}',// before reserved
+    '\u{e000}',// after reserved
+    '\u{ffff}',// max UTF-16 single and 3-byte UTF-8
+    '\u{10000}',// min UTF-16 surrogate and 4-byte UTF-8
+    '\u{abcde}',// middle
+    '\u{10ffff}',// max
+];
+
+fn eq_cmp_hash(c: char) -> (Utf8Char, Utf16Char) {
+    fn hash<T:Hash>(v: T) -> u64 {
+        #[allow(deprecated)]
+        let mut hasher = DefaultHasher::new();
+        v.hash(&mut hasher);
+        hasher.finish()
+    }
+    let u8c = c.to_utf8();
+    assert_eq!(u8c.to_char(), c);
+    assert_eq!(u8c, u8c);
+    assert_eq!(hash(u8c), hash(u8c));
+    assert_eq!(u8c.cmp(&u8c), Ordering::Equal);
+    assert!(u8c.eq_ignore_ascii_case(&u8c));
+    let u16c = c.to_utf16();
+    assert_eq!(u16c.to_char(), c);
+    assert_eq!(u16c, u16c);
+    assert_eq!(hash(u16c), hash(c));
+    assert_eq!(u16c.cmp(&u16c), Ordering::Equal);
+    assert!(u16c.eq_ignore_ascii_case(&u16c));
+
+    assert_eq!(u8c, c);
+    assert_eq!(c, u8c);
+    assert_eq!(u16c, c);
+    assert_eq!(c, u16c);
+    assert_eq!(u8c, u16c);
+    assert_eq!(u16c, u8c);
+    assert_eq!(u8c == c as u8,  c <= '\u{7F}');
+    assert_eq!(u16c == c as u8,  c <= '\u{FF}');
+    assert_eq!(u16c == c as u16,  c <= '\u{FFFF}');
+
+    assert_eq!(u8c.partial_cmp(&c), Some(Ordering::Equal));
+    assert_eq!(c.partial_cmp(&u8c), Some(Ordering::Equal));
+    assert_eq!(u16c.partial_cmp(&c), Some(Ordering::Equal));
+    assert_eq!(c.partial_cmp(&u16c), Some(Ordering::Equal));
+    assert_eq!(u8c.partial_cmp(&u16c), Some(Ordering::Equal));
+    assert_eq!(u16c.partial_cmp(&u8c), Some(Ordering::Equal));
+
+
+    for &other in &EDGES_AND_BETWEEN {
+        let u8other = other.to_utf8();
+        assert_eq!(u8c == u8other,  c == other);
+        assert_eq!(hash(u8c)==hash(u8other),  hash(c)==hash(other));
+        assert_eq!(u8c.cmp(&u8other), c.cmp(&other));
+        assert_eq!(u8c.eq_ignore_ascii_case(&u8other), c.eq_ignore_ascii_case(&other));
+        assert_eq!(u8c.partial_cmp(&other), c.partial_cmp(&other));
+        assert_eq!(c.partial_cmp(&u8other), c.partial_cmp(&other));
+        assert_eq!(u8other.partial_cmp(&c), other.partial_cmp(&c));
+        assert_eq!(other.partial_cmp(&u8c), other.partial_cmp(&c));
+        assert_eq!(u8c == other as u8,  other as u8 <= 127 && c == other as u8 as char);
+
+        let u16other = other.to_utf16();
+        assert_eq!(u16c == u16other,  c == other);
+        assert_eq!(hash(u16c)==hash(u16other),  hash(c)==hash(other));
+        assert_eq!(u16c.cmp(&u16other), c.cmp(&other));
+        assert_eq!(u16c.eq_ignore_ascii_case(&u16other), c.eq_ignore_ascii_case(&other));
+        assert_eq!(u16c.partial_cmp(&other), c.partial_cmp(&other));
+        assert_eq!(c.partial_cmp(&u16other), c.partial_cmp(&other));
+        assert_eq!(u16other.partial_cmp(&c), other.partial_cmp(&c));
+        assert_eq!(other.partial_cmp(&u16c), other.partial_cmp(&c));
+        assert_eq!(u16c == other as u8,  c == other as u8 as char);
+        assert_eq!(u16c == other as u16,  c as u32 == other as u16 as u32);
+
+        assert_eq!(u8c == u16other,  c == other);
+        assert_eq!(u16c == u8other,  c == other);
+        assert_eq!(u8c.partial_cmp(&u16other),  c.partial_cmp(&other));
+        assert_eq!(u16c.partial_cmp(&u8other),  c.partial_cmp(&other));
+        assert_eq!(u8other.partial_cmp(&u16c),  other.partial_cmp(&c));
+        assert_eq!(u16other.partial_cmp(&u8c),  other.partial_cmp(&c));
+    }
+    (u8c, u16c)
+}
+
+fn iterators(c: char) {
+    let mut iter = c.iter_utf8_bytes();
+    let mut buf = [0; 4];
+    let mut iter_ref = c.encode_utf8(&mut buf[..]).as_bytes().iter();
+    for _ in 0..6 {
+        assert_eq!(iter.size_hint(), iter_ref.size_hint());
+        assert_eq!(format!("{:?}", iter), format!("{:?}", iter_ref.as_slice()));
+        assert_eq!(iter.next(), iter_ref.next().cloned());
+    }
+
+    let mut iter = c.iter_utf16_units();
+    let mut buf = [0; 2];
+    let mut iter_ref = c.encode_utf16(&mut buf[..]).iter();
+    for _ in 0..4 {
+        assert_eq!(iter.size_hint(), iter_ref.size_hint());
+        assert_eq!(format!("{:?}", iter), format!("{:?}", iter_ref.as_slice()));
+        assert_eq!(iter.next(), iter_ref.next().cloned());
+    }
+}
+
+fn test(c: char) {
+    assert_eq!(char::from_u32(c as u32), Some(c));
+    assert_eq!(char::from_u32_detailed(c as u32), Ok(c));
+    assert_eq!(unsafe{ char::from_u32_unchecked(c as u32) }, c);
+    let (u8c, u16c) = eq_cmp_hash(c);
+    iterators(c);
+    assert_eq!(Utf16Char::from(u8c), u16c);
+    assert_eq!(Utf8Char::from(u16c), u8c);
+    let utf8_len = c.len_utf8();
+    let utf16_len = c.len_utf16();
+    let mut as_str = c.to_string();
+
+    // UTF-8
+    let mut buf = [0; 4];
+    let reference = c.encode_utf8(&mut buf[..]).as_bytes();
+    let len = reference.len(); // short name because it is used in many places.
+    assert_eq!(len, utf8_len);
+    assert_eq!(reference[0].extra_utf8_bytes(), Ok(len-1));
+    assert_eq!(reference[0].extra_utf8_bytes_unchecked(), len-1);
+    assert_eq!(AsRef::<[u8]>::as_ref(&u8c), reference);
+
+    let (arr,arrlen) = u8c.to_array();
+    assert_eq!(arrlen, len);
+    assert_eq!(Utf8Char::from_array(arr), Ok(u8c));
+    assert_eq!(c.to_utf8_array(),  (arr, len));
+
+    let str_ = str::from_utf8(reference).unwrap();
+    let ustr = Utf8Char::from_str(str_).unwrap();
+    assert_eq!(ustr.to_array().0, arr);// bitwise equality
+    assert_eq!(char::from_utf8_array(arr), Ok(c));
+    let mut longer = [0xff; 5]; // 0xff is never valid
+    longer[..len].copy_from_slice(reference);
+    assert_eq!(char::from_utf8_slice_start(reference), Ok((c,len)));
+    assert_eq!(char::from_utf8_slice_start(&longer), Ok((c,len)));
+    assert_eq!(Utf8Char::from_slice_start(reference), Ok((u8c,len)));
+    assert_eq!(Utf8Char::from_slice_start(&longer), Ok((u8c,len)));
+    for other in &mut longer[len..] {*other = b'?'}
+    assert_eq!(Utf8Char::from_str(str_), Ok(u8c));
+    assert_eq!(Utf8Char::from_str_start(str_), Ok((u8c,len)));
+    assert_eq!(Utf8Char::from_str_start(str::from_utf8(&longer).unwrap()), Ok((u8c,len)));
+    unsafe {
+        // Hopefully make bugs easier to catch by making reads into unallocated memory by filling
+        // a jemalloc bin. See table on http://jemalloc.net/jemalloc.3.html for bin sizes.
+        // I have no idea whether this works.
+        let mut boxed = Box::new([0xffu8; 16]);
+        let start = boxed.len()-len; // reach the end
+        boxed[start..].copy_from_slice(reference);
+        let slice = &boxed[start..start]; // length of slice should be ignored.
+        assert_eq!(Utf8Char::from_slice_start_unchecked(slice), (u8c,len));
+    }
+    assert_eq!(&Vec::<u8>::from_iter(Some(u8c))[..], reference);
+    assert_eq!(&String::from_iter(Some(u8c))[..], str_);
+    assert_eq!(format!("{:?}", u8c), format!("{:?}", c));
+    assert_eq!(format!("{}", u8c), format!("{}", c));
+    assert_eq!(u8c.is_ascii(), c.is_ascii());
+    assert_eq!(u8c.to_ascii_lowercase().to_char(), c.to_ascii_lowercase());
+    assert_eq!(u8c.to_ascii_uppercase().to_char(), c.to_ascii_uppercase());
+
+    // UTF-16
+    let mut buf = [0; 2];
+    let reference = c.encode_utf16(&mut buf[..]);
+    let len = reference.len();
+    assert_eq!(len, utf16_len);
+    assert_eq!(reference[0].utf16_needs_extra_unit(), Ok(len==2));
+    assert_eq!(reference[0].is_utf16_leading_surrogate(), len==2);
+    assert_eq!(u16c.as_ref(), reference);
+    let mut longer = [0; 3];
+    longer[..len].copy_from_slice(reference);
+    assert_eq!(char::from_utf16_slice_start(reference), Ok((c,len)));
+    assert_eq!(char::from_utf16_slice_start(&longer), Ok((c,len)));
+    assert_eq!(Utf16Char::from_slice_start(reference), Ok((u16c,len)));
+    assert_eq!(Utf16Char::from_slice_start(&longer), Ok((u16c,len)));
+    assert_eq!(Utf16Char::from_str(&as_str), Ok(u16c));
+    as_str.push(c);
+    assert_eq!(Utf16Char::from_str_start(&as_str), Ok((u16c,utf8_len)));
+    unsafe {
+        // Hopefully make bugs easier to catch by making reads into unallocated memory by filling
+        // a jemalloc bin. See table on http://jemalloc.net/jemalloc.3.html for bin sizes.
+        // I have no idea whether this works.
+        let mut boxed = Box::new([0u16; 8]);
+        let start = boxed.len()-len; // reach the end
+        boxed[start..].copy_from_slice(reference);
+        let slice = &boxed[start..start]; // length of slice should be ignored.
+        assert_eq!(Utf16Char::from_slice_start_unchecked(slice), (u16c,len));
+    }
+    let array = c.to_utf16_array();
+    let tuple = c.to_utf16_tuple();
+    assert_eq!(&array[..reference.len()], reference);
+    assert_eq!(tuple, (reference[0],reference.get(1).cloned()));
+    assert_eq!(char::from_utf16_array(array), Ok(c));
+    assert_eq!(char::from_utf16_tuple(tuple), Ok(c));
+    assert_eq!(c.to_utf16().to_char(), c);
+    assert_eq!(&Vec::<u16>::from_iter(Some(u16c))[..], reference);
+    assert_eq!(format!("{:?}", u16c), format!("{:?}", c));
+    assert_eq!(format!("{}", u16c), format!("{}", c));
+    assert_eq!(u16c.is_ascii(), c.is_ascii());
+    assert_eq!(u16c.to_ascii_lowercase().to_char(), c.to_ascii_lowercase());
+    assert_eq!(u16c.to_ascii_uppercase().to_char(), c.to_ascii_uppercase());
+}
+
+
+#[test]
+fn edges_middle() {
+    for &c in &EDGES_AND_BETWEEN {
+        test(c);
+    }
+}
+
+
+#[test]
+#[ignore]
+fn all() {
+    for cp in std::iter::Iterator::chain(0..0xd800, 0xe000..0x110000) {
+        let c = char::from_u32(cp).expect("not a valid char");
+        test(c);
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/.cargo-checksum.json b/android/vendor/flate2-1.0.24/.cargo-checksum.json
new file mode 100644
index 0000000..0cf4f26
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.lock":"2a6c871e5e5001d23934ab7a2e1e936dc1265d912d384e10c07bede2c1163d31","Cargo.toml":"fb0c03843e790a49015855ebc71b0805ec3647b55093876709a2ed1b1437e263","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"b9fa7ea44625cd15b942c9ae748f8f35197f9c19f5deb7087a5fc115064d19d3","examples/compress_file.rs":"65cac39f50420861cb86120b0e7edce4704eb5afd1e27f790a66b8138176fc4d","examples/deflatedecoder-bufread.rs":"59aaa1dcf999da7909ea0a01bef757b80e366f8adf60984cc2e2c70acc774e1a","examples/deflatedecoder-read.rs":"7784b03156600d9a0efadb830920439a8a8f7fe70250090ee8c637033c1338eb","examples/deflatedecoder-write.rs":"6e6952cef15adbf465d4985802d315a3b51f3137be36e62bbcaed0bb27a8d5a6","examples/deflateencoder-bufread.rs":"0cefcb1edef04834e684c9c3d4048a32c7831617e51a102a7bd6a7351d4799be","examples/deflateencoder-read.rs":"d1718c60bb527a2ca15fd208e22c1df51ed972ea48b9d506536635effdbc4847","examples/deflateencoder-write.rs":"79203d1db1128df2a3fa5cbd61d60776e02959c4da67a473f3b96dfb5f01f964","examples/gzbuilder.rs":"e7435090c86db3133d19f7a2bfb7d49bb60ebbd1e0acaf74c2d0d27375d0c41d","examples/gzdecoder-bufread.rs":"8ad927ad5761e4b31bec5c2b4e5429dd9370e25f35be6e60a29149ed834c97a1","examples/gzdecoder-read.rs":"e63ae23a6188ab9831758178a86a36b8693de27e291725d2d5274df4cb93566c","examples/gzdecoder-write.rs":"a8843c75fa725de84b8eb75b08525e61586f60f9f8bfd874fbfd44039d119c5f","examples/gzencoder-bufread.rs":"aaad311ad799c2e739b58fc4e570225d8f52d3bc407f9c71c28023b321e02100","examples/gzencoder-read.rs":"797522cd3d5815321bbb5c26fdfeae027807219e429e36a1b99fff50fcdf0a64","examples/gzencoder-write.rs":"2eea8a8c8bf22f060d8749d786835ce9454abe2cfd24bf0f7a23b5a8d1030121","examples/gzmultidecoder-bufread.rs":"1e4b31da4f1352e748b4516ba60dcd52e5d5e62733fa1c8e7da7bee4efcce1c4","examples/gzmultidecoder-read.rs":"3976274ac8b8190b3f7ed9fd855a193c38458bd40a2dba6a7de21986f78682f6","examples/hello_world.txt":"d2a84f4b8b650937ec8f73cd8be2c74add5a911ba64df27458ed8229da804a26","examples/zlibdecoder-bufread.rs":"e57a597030e6bd87e79329d87b3743b7fb0ff4c217846b0ba2c2d32264208ff1","examples/zlibdecoder-read.rs":"83b3abd1c12586f820d55e4d86c328fdccbdec963e90c44a44cd7d5f1caa4c8f","examples/zlibdecoder-write.rs":"e7cbec46414eb5d67fee95bf1e4a4e6a1ba2a41f4ce9542dd4481035d3f8070d","examples/zlibencoder-bufread.rs":"13d79baeffb6080b4b4f837e23092b52b92b85466ed9e42b0a33a864232e693f","examples/zlibencoder-read.rs":"7f95783b38e0005740f05dbcc03af3bbf28dfe7c9f0542d3fb015d09554163bd","examples/zlibencoder-write.rs":"47c25fb6711e22f95bdc89309c6e367d1060a0120d4259011e97908563e2b8bc","src/bufreader.rs":"2d6a59330e8f838eb6474d19104f21cb98236125c189f36bdff75a069a4cea8f","src/crc.rs":"bfc96a0df325e8fb0005b008a52f1227546c2a4f72f422d4dd40769a8317eb37","src/deflate/bufread.rs":"7dd1c1a5a74abbf32537285c286551c20b3ed62c99e28a67b7d4d7eaeee73570","src/deflate/mod.rs":"ebaa68e75d0c7470c7a2afd7af0f8cc5413654f7c35ac1cb6af3df0144eeb2cf","src/deflate/read.rs":"dc0d080b0a4ab3aa3f2870b69f7cb5380e49baab4eb5fdfe98f7a0a9fb6b32b9","src/deflate/write.rs":"fef4deebc0dc29d4ad481718613c694f6d1b733199e241a1f7f064e2707e4908","src/ffi/c.rs":"387bba48532bb90f13b38f685f68c0e0b3bb2b3a84e6e915abb2fd571ce9c1e9","src/ffi/mod.rs":"d90bfe6150d905c06755a3bf9355be69a7ffb664ca701d51ee1ffe93229abee1","src/ffi/rust.rs":"235cf72391d4077b569f88854b6468e371c19c417b4815468070e155268d83dd","src/gz/bufread.rs":"62881dd14a736cf5fc3d5006e83afd6e5462808f4e8eeb5844ae07d67ad28f16","src/gz/mod.rs":"77d10acd6e923f35cc6434e70cc33002006a8cf5923ebb3105531d4f05542327","src/gz/read.rs":"275150a42ae3a39cc56a83ef212bffce32c74eae1bc6ede33945370bb555ad4d","src/gz/write.rs":"41b9c738bcf64dec44cef591b42e1cb5ef0316aa33d621816fbdd5484e51037b","src/lib.rs":"a1cdcc834b6cc7e470c397578142eca0872840ceb594603264b0aa92b73b94fa","src/mem.rs":"e66a546c83c723dc13320f791de5f43f6683f5549e6d8d0e53fda6108762cc8a","src/zio.rs":"066238023d9c931498d996b6bcd135ba58bc9e916dbaaeddec26a20ad07c698e","src/zlib/bufread.rs":"2c6440dd8958469bb07644a50d3170988a5d75f17788d5bfbf03adfd30e50f4a","src/zlib/mod.rs":"fffaea011fc774756f5392cffb1d2d06c05767e7bbbe306fa5fbe95108b9b06b","src/zlib/read.rs":"11dc6a4072b5d99490f7e5ea8eca9da67b4e77981b05eb3ed56067caaffb3a27","src/zlib/write.rs":"330d6ebe93939c8a045c72fb2c8106bfad92e0ed80c60f729ebba40d11090338","tests/corrupt-gz-file.bin":"083dd284aa1621916a2d0f66ea048c8d3ba7a722b22d0d618722633f51e7d39c","tests/early-flush.rs":"5ed4b0f8e66cab9209e079d5636e5f1b780606cd553a182c809cf73a24e77e8e","tests/empty-read.rs":"45477d316f77a048d747e9d18292abfec0cac667768385c8a061e18fd1240238","tests/good-file.gz":"87296963e53024a74752179ce7e54087565d358a85d3e65c3b37ef36eaa3d4a6","tests/good-file.txt":"bc4e03658a441fe2ad2df7cd2197144b87e41696f01e327b380e869cd9b485a0","tests/gunzip.rs":"a67f2e2dc2e6fbdc42f9ea003eae70f862478a5226d961658b30c8c7928fb7f5","tests/multi.gz":"efa3341da052f95056314cc6920e02a3da15bdef30234b2552fb407812db5cc6","tests/multi.txt":"dbea9325179efe46ea2add94f7b6b745ca983fabb208dc6d34aa064623d7ee23","tests/zero-write.rs":"ff8d0349a540b54363c55807c5fd7fbbdc363d08a536d35a3a40f0ce92c16489"},"package":"f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6"}
\ No newline at end of file
diff --git a/android/vendor/flate2-1.0.24/Cargo.lock b/android/vendor/flate2-1.0.24/Cargo.lock
new file mode 100644
index 0000000..732ee01
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/Cargo.lock
@@ -0,0 +1,173 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "adler"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+
+[[package]]
+name = "cc"
+version = "1.0.73"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "cloudflare-zlib-sys"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2040b6d1edfee6d75f172d81e2d2a7807534f3f294ce18184c70e7bb0105cd6f"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "cmake"
+version = "0.1.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "crc32fast"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "flate2"
+version = "1.0.24"
+dependencies = [
+ "cloudflare-zlib-sys",
+ "crc32fast",
+ "libz-ng-sys",
+ "libz-sys",
+ "miniz_oxide",
+ "quickcheck",
+ "rand",
+]
+
+[[package]]
+name = "getrandom"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad"
+dependencies = [
+ "cfg-if",
+ "libc",
+ "wasi",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.124"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
+
+[[package]]
+name = "libz-ng-sys"
+version = "1.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4399ae96a9966bf581e726de86969f803a81b7ce795fcd5480e640589457e0f2"
+dependencies = [
+ "cmake",
+ "libc",
+]
+
+[[package]]
+name = "libz-sys"
+version = "1.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf"
+dependencies = [
+ "cc",
+ "cmake",
+ "libc",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "miniz_oxide"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082"
+dependencies = [
+ "adler",
+]
+
+[[package]]
+name = "pkg-config"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
+
+[[package]]
+name = "ppv-lite86"
+version = "0.2.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
+
+[[package]]
+name = "quickcheck"
+version = "1.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "588f6378e4dd99458b60ec275b4477add41ce4fa9f64dcba6f15adccb19b50d6"
+dependencies = [
+ "rand",
+]
+
+[[package]]
+name = "rand"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
+dependencies = [
+ "libc",
+ "rand_chacha",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_chacha"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+dependencies = [
+ "ppv-lite86",
+ "rand_core",
+]
+
+[[package]]
+name = "rand_core"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
+dependencies = [
+ "getrandom",
+]
+
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
+[[package]]
+name = "wasi"
+version = "0.10.2+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
diff --git a/android/vendor/flate2-1.0.24/Cargo.toml b/android/vendor/flate2-1.0.24/Cargo.toml
new file mode 100644
index 0000000..23b8b80
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/Cargo.toml
@@ -0,0 +1,94 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "flate2"
+version = "1.0.24"
+authors = [
+    "Alex Crichton <alex@alexcrichton.com>",
+    "Josh Triplett <josh@joshtriplett.org>",
+]
+description = """
+DEFLATE compression and decompression exposed as Read/BufRead/Write streams.
+Supports miniz_oxide and multiple zlib implementations. Supports zlib, gzip,
+and raw deflate streams.
+"""
+homepage = "https://github.com/rust-lang/flate2-rs"
+documentation = "https://docs.rs/flate2"
+readme = "README.md"
+keywords = [
+    "gzip",
+    "deflate",
+    "zlib",
+    "zlib-ng",
+    "encoding",
+]
+categories = [
+    "compression",
+    "api-bindings",
+]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/rust-lang/flate2-rs"
+
+[dependencies.cloudflare-zlib-sys]
+version = "0.3.0"
+optional = true
+
+[dependencies.crc32fast]
+version = "1.2.0"
+
+[dependencies.libz-ng-sys]
+version = "1.1.8"
+optional = true
+
+[dependencies.libz-sys]
+version = "1.1.8"
+optional = true
+default-features = false
+
+[dependencies.miniz_oxide]
+version = "0.5.0"
+optional = true
+default-features = false
+
+[dev-dependencies.quickcheck]
+version = "1.0"
+default-features = false
+
+[dev-dependencies.rand]
+version = "0.8"
+
+[features]
+any_zlib = []
+cloudflare_zlib = [
+    "any_zlib",
+    "cloudflare-zlib-sys",
+]
+default = ["rust_backend"]
+miniz-sys = ["rust_backend"]
+rust_backend = ["miniz_oxide"]
+zlib = [
+    "any_zlib",
+    "libz-sys",
+]
+zlib-ng = [
+    "any_zlib",
+    "libz-ng-sys",
+]
+zlib-ng-compat = [
+    "zlib",
+    "libz-sys/zlib-ng",
+]
+
+[target."cfg(all(target_arch = \"wasm32\", not(target_os = \"emscripten\")))".dependencies.miniz_oxide]
+version = "0.5.0"
+default-features = false
diff --git a/android/vendor/flate2-1.0.24/LICENSE-APACHE b/android/vendor/flate2-1.0.24/LICENSE-APACHE
new file mode 100644
index 0000000..16fe87b
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/flate2-1.0.24/LICENSE-MIT b/android/vendor/flate2-1.0.24/LICENSE-MIT
new file mode 100644
index 0000000..39e0ed6
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/flate2-1.0.24/README.md b/android/vendor/flate2-1.0.24/README.md
new file mode 100644
index 0000000..d4763a4
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/README.md
@@ -0,0 +1,114 @@
+# flate2
+
+[![Crates.io](https://img.shields.io/crates/v/flate2.svg?maxAge=2592000)](https://crates.io/crates/flate2)
+[![Documentation](https://docs.rs/flate2/badge.svg)](https://docs.rs/flate2)
+
+A streaming compression/decompression library DEFLATE-based streams in Rust.
+
+This crate by default uses the `miniz_oxide` crate, a port of `miniz.c` to pure
+Rust. This crate also supports other [backends](#Backends), such as the widely
+available zlib library or the high-performance zlib-ng library.
+
+Supported formats:
+
+* deflate
+* zlib
+* gzip
+
+```toml
+# Cargo.toml
+[dependencies]
+flate2 = "1.0"
+```
+
+## Compression
+
+```rust
+use std::io::prelude::*;
+use flate2::Compression;
+use flate2::write::ZlibEncoder;
+
+fn main() {
+    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"foo");
+    e.write_all(b"bar");
+    let compressed_bytes = e.finish();
+}
+```
+
+## Decompression
+
+```rust,no_run
+use std::io::prelude::*;
+use flate2::read::GzDecoder;
+
+fn main() {
+    let mut d = GzDecoder::new("...".as_bytes());
+    let mut s = String::new();
+    d.read_to_string(&mut s).unwrap();
+    println!("{}", s);
+}
+```
+
+## Backends
+
+The default `miniz_oxide` backend has the advantage of being pure Rust. If you
+want maximum performance, you can use the zlib-ng C library:
+
+```toml
+[dependencies]
+flate2 = { version = "1.0.17", features = ["zlib-ng"], default-features = false }
+```
+
+Note that the `"zlib-ng"` feature works even if some other part of your crate
+graph depends on zlib.
+
+However, if you're already using another C or Rust library that depends on
+zlib, and you want to avoid including both zlib and zlib-ng, you can use that
+for Rust code as well:
+
+```toml
+[dependencies]
+flate2 = { version = "1.0.17", features = ["zlib"], default-features = false }
+```
+
+Or, if you have C or Rust code that depends on zlib and you want to use zlib-ng
+via libz-sys in zlib-compat mode, use:
+
+```toml
+[dependencies]
+flate2 = { version = "1.0.17", features = ["zlib-ng-compat"], default-features = false }
+```
+
+Note that when using the `"zlib-ng-compat"` feature, if any crate in your
+dependency graph explicitly requests stock zlib, or uses libz-sys directly
+without `default-features = false`, you'll get stock zlib rather than zlib-ng.
+See [the libz-sys
+README](https://github.com/rust-lang/libz-sys/blob/main/README.md) for details.
+To avoid that, use the `"zlib-ng"` feature instead.
+
+For compatibility with previous versions of `flate2`, the Cloudflare optimized
+version of zlib is available, via the `cloudflare_zlib` feature. It's not as
+fast as zlib-ng, but it's faster than stock zlib. It requires an x86-64 CPU with
+SSE 4.2 or ARM64 with NEON & CRC. It does not support 32-bit CPUs at all and is
+incompatible with mingw. For more information check the [crate
+documentation](https://crates.io/crates/cloudflare-zlib-sys). Note that
+`cloudflare_zlib` will cause breakage if any other crate in your crate graph
+uses another version of zlib/libz.
+
+# License
+
+This project is licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
+   https://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or
+   https://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in this project by you, as defined in the Apache-2.0 license,
+shall be dual licensed as above, without any additional terms or conditions.
diff --git a/android/vendor/flate2-1.0.24/examples/compress_file.rs b/android/vendor/flate2-1.0.24/examples/compress_file.rs
new file mode 100644
index 0000000..39ed8ee
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/compress_file.rs
@@ -0,0 +1,28 @@
+extern crate flate2;
+
+use flate2::write::GzEncoder;
+use flate2::Compression;
+use std::env::args;
+use std::fs::File;
+use std::io::copy;
+use std::io::BufReader;
+use std::time::Instant;
+
+fn main() {
+    if args().len() != 3 {
+        eprintln!("Usage: ./compress_file `source` `target`");
+        return;
+    }
+    let mut input = BufReader::new(File::open(args().nth(1).unwrap()).unwrap());
+    let output = File::create(args().nth(2).unwrap()).unwrap();
+    let mut encoder = GzEncoder::new(output, Compression::default());
+    let start = Instant::now();
+    copy(&mut input, &mut encoder).unwrap();
+    let output = encoder.finish().unwrap();
+    println!(
+        "Source len: {:?}",
+        input.get_ref().metadata().unwrap().len()
+    );
+    println!("Target len: {:?}", output.metadata().unwrap().len());
+    println!("Elapsed: {:?}", start.elapsed());
+}
diff --git a/android/vendor/flate2-1.0.24/examples/deflatedecoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/deflatedecoder-bufread.rs
new file mode 100644
index 0000000..7d1cb6f
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/deflatedecoder-bufread.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::bufread::DeflateDecoder;
+use flate2::write::DeflateEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Deflate Encoded vector of bytes and returns a string or error
+// Here &[u8] implements Read
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut deflater = DeflateDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    deflater.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/deflatedecoder-read.rs b/android/vendor/flate2-1.0.24/examples/deflatedecoder-read.rs
new file mode 100644
index 0000000..cc5d435
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/deflatedecoder-read.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::read::DeflateDecoder;
+use flate2::write::DeflateEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Deflate Encoded vector of bytes and returns a string or error
+// Here &[u8] implements Read
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut deflater = DeflateDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    deflater.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/deflatedecoder-write.rs b/android/vendor/flate2-1.0.24/examples/deflatedecoder-write.rs
new file mode 100644
index 0000000..276490b
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/deflatedecoder-write.rs
@@ -0,0 +1,26 @@
+extern crate flate2;
+
+use flate2::write::DeflateDecoder;
+use flate2::write::DeflateEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Deflate Encoded vector of bytes and returns a string or error
+// Here Vec<u8> implements Write
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut writer = Vec::new();
+    let mut deflater = DeflateDecoder::new(writer);
+    deflater.write_all(&bytes[..])?;
+    writer = deflater.finish()?;
+    let return_string = String::from_utf8(writer).expect("String parsing error");
+    Ok(return_string)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/deflateencoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/deflateencoder-bufread.rs
new file mode 100644
index 0000000..6240f39
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/deflateencoder-bufread.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::bufread::DeflateEncoder;
+use flate2::Compression;
+use std::fs::File;
+use std::io;
+use std::io::prelude::*;
+use std::io::BufReader;
+
+// Open file and debug print the contents compressed with Deflate
+fn main() {
+    println!("{:?}", open_hello_world().unwrap());
+}
+
+// Opens sample file, compresses the contents and returns a Vector or error
+// File wrapped in a BufReader implements Bufread
+fn open_hello_world() -> io::Result<Vec<u8>> {
+    let f = File::open("examples/hello_world.txt")?;
+    let b = BufReader::new(f);
+    let mut deflater = DeflateEncoder::new(b, Compression::fast());
+    let mut buffer = Vec::new();
+    deflater.read_to_end(&mut buffer)?;
+    Ok(buffer)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/deflateencoder-read.rs b/android/vendor/flate2-1.0.24/examples/deflateencoder-read.rs
new file mode 100644
index 0000000..ffb628e
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/deflateencoder-read.rs
@@ -0,0 +1,20 @@
+extern crate flate2;
+
+use flate2::read::DeflateEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Print the Deflate compressed representation of hello world
+fn main() {
+    println!("{:?}", deflateencoder_read_hello_world().unwrap());
+}
+
+// Return a vector containing the Deflate compressed version of hello world
+fn deflateencoder_read_hello_world() -> io::Result<Vec<u8>> {
+    let mut result = Vec::new();
+    let c = b"hello world";
+    let mut deflater = DeflateEncoder::new(&c[..], Compression::fast());
+    deflater.read_to_end(&mut result)?;
+    Ok(result)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/deflateencoder-write.rs b/android/vendor/flate2-1.0.24/examples/deflateencoder-write.rs
new file mode 100644
index 0000000..243b9df
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/deflateencoder-write.rs
@@ -0,0 +1,12 @@
+extern crate flate2;
+
+use flate2::write::DeflateEncoder;
+use flate2::Compression;
+use std::io::prelude::*;
+
+// Vec<u8> implements Write to print the compressed bytes of sample string
+fn main() {
+    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    println!("{:?}", e.finish().unwrap());
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzbuilder.rs b/android/vendor/flate2-1.0.24/examples/gzbuilder.rs
new file mode 100644
index 0000000..d6ec2f4
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzbuilder.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::Compression;
+use flate2::GzBuilder;
+use std::fs::File;
+use std::io;
+use std::io::prelude::*;
+
+// Compresses content of a text file into a gzip file
+fn main() {
+    sample_builder().unwrap();
+}
+
+// GzBuilder opens a file and writes a sample string using Builder pattern
+fn sample_builder() -> Result<(), io::Error> {
+    let f = File::create("examples/hello_world.txt.gz")?;
+    let mut gz = GzBuilder::new()
+        .filename("hello_world.txt")
+        .comment("test file, please delete")
+        .write(f, Compression::default());
+    gz.write_all(b"hello world")?;
+    gz.finish()?;
+    Ok(())
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzdecoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/gzdecoder-bufread.rs
new file mode 100644
index 0000000..8551197
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzdecoder-bufread.rs
@@ -0,0 +1,23 @@
+extern crate flate2;
+
+use flate2::write::GzEncoder;
+use flate2::{bufread, Compression};
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Gz Encoded vector of bytes and returns a string or error
+// Here &[u8] implements BufRead
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut gz = bufread::GzDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    gz.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzdecoder-read.rs b/android/vendor/flate2-1.0.24/examples/gzdecoder-read.rs
new file mode 100644
index 0000000..705d28c
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzdecoder-read.rs
@@ -0,0 +1,23 @@
+extern crate flate2;
+
+use flate2::write::GzEncoder;
+use flate2::{read, Compression};
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Gz Encoded vector of bytes and returns a string or error
+// Here &[u8] implements Read
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut gz = read::GzDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    gz.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzdecoder-write.rs b/android/vendor/flate2-1.0.24/examples/gzdecoder-write.rs
new file mode 100644
index 0000000..766bb5e
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzdecoder-write.rs
@@ -0,0 +1,26 @@
+extern crate flate2;
+
+use flate2::write::{GzDecoder, GzEncoder};
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_writer(bytes).unwrap());
+}
+
+// Uncompresses a Gz Encoded vector of bytes and returns a string or error
+// Here &[u8] implements Read
+fn decode_writer(bytes: Vec<u8>) -> io::Result<String> {
+    let mut writer = Vec::new();
+    let mut decoder = GzDecoder::new(writer);
+    decoder.write_all(&bytes[..])?;
+    decoder.try_finish()?;
+    writer = decoder.finish()?;
+    let return_string = String::from_utf8(writer).expect("String parsing error");
+    Ok(return_string)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzencoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/gzencoder-bufread.rs
new file mode 100644
index 0000000..015ae0a
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzencoder-bufread.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::bufread::GzEncoder;
+use flate2::Compression;
+use std::fs::File;
+use std::io;
+use std::io::prelude::*;
+use std::io::BufReader;
+
+// Open file and debug print the contents compressed with gzip
+fn main() {
+    println!("{:?}", open_hello_world().unwrap());
+}
+
+// Opens sample file, compresses the contents and returns a Vector or error
+// File wrapped in a BufReader implements Bufread
+fn open_hello_world() -> io::Result<Vec<u8>> {
+    let f = File::open("examples/hello_world.txt")?;
+    let b = BufReader::new(f);
+    let mut gz = GzEncoder::new(b, Compression::fast());
+    let mut buffer = Vec::new();
+    gz.read_to_end(&mut buffer)?;
+    Ok(buffer)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzencoder-read.rs b/android/vendor/flate2-1.0.24/examples/gzencoder-read.rs
new file mode 100644
index 0000000..3f1262b
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzencoder-read.rs
@@ -0,0 +1,20 @@
+extern crate flate2;
+
+use flate2::read::GzEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Print the GZ compressed representation of hello world
+fn main() {
+    println!("{:?}", gzencoder_read_hello_world().unwrap());
+}
+
+// Return a vector containing the GZ compressed version of hello world
+fn gzencoder_read_hello_world() -> io::Result<Vec<u8>> {
+    let mut result = Vec::new();
+    let c = b"hello world";
+    let mut z = GzEncoder::new(&c[..], Compression::fast());
+    z.read_to_end(&mut result)?;
+    Ok(result)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzencoder-write.rs b/android/vendor/flate2-1.0.24/examples/gzencoder-write.rs
new file mode 100644
index 0000000..275b010
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzencoder-write.rs
@@ -0,0 +1,12 @@
+extern crate flate2;
+
+use flate2::write::GzEncoder;
+use flate2::Compression;
+use std::io::prelude::*;
+
+// Vec<u8> implements Write to print the compressed bytes of sample string
+fn main() {
+    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    println!("{:?}", e.finish().unwrap());
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzmultidecoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/gzmultidecoder-bufread.rs
new file mode 100644
index 0000000..c6bb2c5
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzmultidecoder-bufread.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::bufread::MultiGzDecoder;
+use flate2::write::GzEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Gz Encoded vector of bytes and returns a string or error
+// Here &[u8] implements BufRead
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut gz = MultiGzDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    gz.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/gzmultidecoder-read.rs b/android/vendor/flate2-1.0.24/examples/gzmultidecoder-read.rs
new file mode 100644
index 0000000..7c8a8e3
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/gzmultidecoder-read.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::read::MultiGzDecoder;
+use flate2::write::GzEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Gz Encoded vector of bytes and returns a string or error
+// Here &[u8] implements Read
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut gz = MultiGzDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    gz.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/hello_world.txt b/android/vendor/flate2-1.0.24/examples/hello_world.txt
new file mode 100644
index 0000000..557db03
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/hello_world.txt
@@ -0,0 +1 @@
+Hello World
diff --git a/android/vendor/flate2-1.0.24/examples/zlibdecoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/zlibdecoder-bufread.rs
new file mode 100644
index 0000000..30f168a
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/zlibdecoder-bufread.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::bufread::ZlibDecoder;
+use flate2::write::ZlibEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_bufreader(bytes).unwrap());
+}
+
+// Uncompresses a Zlib Encoded vector of bytes and returns a string or error
+// Here &[u8] implements BufRead
+fn decode_bufreader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut z = ZlibDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    z.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/zlibdecoder-read.rs b/android/vendor/flate2-1.0.24/examples/zlibdecoder-read.rs
new file mode 100644
index 0000000..f7e5fb0
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/zlibdecoder-read.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::read::ZlibDecoder;
+use flate2::write::ZlibEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Zlib Encoded vector of bytes and returns a string or error
+// Here &[u8] implements Read
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut z = ZlibDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    z.read_to_string(&mut s)?;
+    Ok(s)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/zlibdecoder-write.rs b/android/vendor/flate2-1.0.24/examples/zlibdecoder-write.rs
new file mode 100644
index 0000000..358e903
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/zlibdecoder-write.rs
@@ -0,0 +1,26 @@
+extern crate flate2;
+
+use flate2::write::ZlibDecoder;
+use flate2::write::ZlibEncoder;
+use flate2::Compression;
+use std::io;
+use std::io::prelude::*;
+
+// Compress a sample string and print it after transformation.
+fn main() {
+    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    let bytes = e.finish().unwrap();
+    println!("{}", decode_reader(bytes).unwrap());
+}
+
+// Uncompresses a Zlib Encoded vector of bytes and returns a string or error
+// Here Vec<u8> implements Write
+fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+    let mut writer = Vec::new();
+    let mut z = ZlibDecoder::new(writer);
+    z.write_all(&bytes[..])?;
+    writer = z.finish()?;
+    let return_string = String::from_utf8(writer).expect("String parsing error");
+    Ok(return_string)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/zlibencoder-bufread.rs b/android/vendor/flate2-1.0.24/examples/zlibencoder-bufread.rs
new file mode 100644
index 0000000..0321d8d
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/zlibencoder-bufread.rs
@@ -0,0 +1,24 @@
+extern crate flate2;
+
+use flate2::bufread::ZlibEncoder;
+use flate2::Compression;
+use std::fs::File;
+use std::io;
+use std::io::prelude::*;
+use std::io::BufReader;
+
+// Open file and debug print the contents compressed with zlib
+fn main() {
+    println!("{:?}", open_hello_world().unwrap());
+}
+
+// Opens sample file, compresses the contents and returns a Vector or error
+// File wrapped in a BufReader implements Bufread
+fn open_hello_world() -> io::Result<Vec<u8>> {
+    let f = File::open("examples/hello_world.txt")?;
+    let b = BufReader::new(f);
+    let mut z = ZlibEncoder::new(b, Compression::fast());
+    let mut buffer = Vec::new();
+    z.read_to_end(&mut buffer)?;
+    Ok(buffer)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/zlibencoder-read.rs b/android/vendor/flate2-1.0.24/examples/zlibencoder-read.rs
new file mode 100644
index 0000000..779eb1d
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/zlibencoder-read.rs
@@ -0,0 +1,21 @@
+extern crate flate2;
+
+use flate2::read::ZlibEncoder;
+use flate2::Compression;
+use std::fs::File;
+use std::io::prelude::*;
+
+// Open file and debug print the compressed contents
+fn main() {
+    println!("{:?}", open_hello_world().unwrap());
+}
+
+// Opens sample file, compresses the contents and returns a Vector or error
+// File implements Read
+fn open_hello_world() -> std::io::Result<Vec<u8>> {
+    let f = File::open("examples/hello_world.txt")?;
+    let mut z = ZlibEncoder::new(f, Compression::fast());
+    let mut result = Vec::new();
+    z.read_to_end(&mut result)?;
+    Ok(result)
+}
diff --git a/android/vendor/flate2-1.0.24/examples/zlibencoder-write.rs b/android/vendor/flate2-1.0.24/examples/zlibencoder-write.rs
new file mode 100644
index 0000000..76bcf17
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/examples/zlibencoder-write.rs
@@ -0,0 +1,12 @@
+extern crate flate2;
+
+use flate2::write::ZlibEncoder;
+use flate2::Compression;
+use std::io::prelude::*;
+
+// Vec<u8> implements Write to print the compressed bytes of sample string
+fn main() {
+    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+    e.write_all(b"Hello World").unwrap();
+    println!("{:?}", e.finish().unwrap());
+}
diff --git a/android/vendor/flate2-1.0.24/src/bufreader.rs b/android/vendor/flate2-1.0.24/src/bufreader.rs
new file mode 100644
index 0000000..7e6f89d
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/bufreader.rs
@@ -0,0 +1,104 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// <https://github.com/rust-lang/rust/blob/HEAD/COPYRIGHT>.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::cmp;
+use std::io;
+use std::io::prelude::*;
+use std::mem;
+
+pub struct BufReader<R> {
+    inner: R,
+    buf: Box<[u8]>,
+    pos: usize,
+    cap: usize,
+}
+
+impl<R> ::std::fmt::Debug for BufReader<R>
+where
+    R: ::std::fmt::Debug,
+{
+    fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
+        fmt.debug_struct("BufReader")
+            .field("reader", &self.inner)
+            .field(
+                "buffer",
+                &format_args!("{}/{}", self.cap - self.pos, self.buf.len()),
+            )
+            .finish()
+    }
+}
+
+impl<R: Read> BufReader<R> {
+    pub fn new(inner: R) -> BufReader<R> {
+        BufReader::with_buf(vec![0; 32 * 1024], inner)
+    }
+
+    pub fn with_buf(buf: Vec<u8>, inner: R) -> BufReader<R> {
+        BufReader {
+            inner,
+            buf: buf.into_boxed_slice(),
+            pos: 0,
+            cap: 0,
+        }
+    }
+}
+
+impl<R> BufReader<R> {
+    pub fn get_ref(&self) -> &R {
+        &self.inner
+    }
+
+    pub fn get_mut(&mut self) -> &mut R {
+        &mut self.inner
+    }
+
+    pub fn into_inner(self) -> R {
+        self.inner
+    }
+
+    pub fn reset(&mut self, inner: R) -> R {
+        self.pos = 0;
+        self.cap = 0;
+        mem::replace(&mut self.inner, inner)
+    }
+}
+
+impl<R: Read> Read for BufReader<R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        // If we don't have any buffered data and we're doing a massive read
+        // (larger than our internal buffer), bypass our internal buffer
+        // entirely.
+        if self.pos == self.cap && buf.len() >= self.buf.len() {
+            return self.inner.read(buf);
+        }
+        let nread = {
+            let mut rem = self.fill_buf()?;
+            rem.read(buf)?
+        };
+        self.consume(nread);
+        Ok(nread)
+    }
+}
+
+impl<R: Read> BufRead for BufReader<R> {
+    fn fill_buf(&mut self) -> io::Result<&[u8]> {
+        // If we've reached the end of our internal buffer then we need to fetch
+        // some more data from the underlying reader.
+        if self.pos == self.cap {
+            self.cap = self.inner.read(&mut self.buf)?;
+            self.pos = 0;
+        }
+        Ok(&self.buf[self.pos..self.cap])
+    }
+
+    fn consume(&mut self, amt: usize) {
+        self.pos = cmp::min(self.pos + amt, self.cap);
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/crc.rs b/android/vendor/flate2-1.0.24/src/crc.rs
new file mode 100644
index 0000000..cd00ceb
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/crc.rs
@@ -0,0 +1,184 @@
+//! Simple CRC bindings backed by miniz.c
+
+use std::io;
+use std::io::prelude::*;
+
+use crc32fast::Hasher;
+
+/// The CRC calculated by a [`CrcReader`].
+///
+/// [`CrcReader`]: struct.CrcReader.html
+#[derive(Debug)]
+pub struct Crc {
+    amt: u32,
+    hasher: Hasher,
+}
+
+/// A wrapper around a [`Read`] that calculates the CRC.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+#[derive(Debug)]
+pub struct CrcReader<R> {
+    inner: R,
+    crc: Crc,
+}
+
+impl Default for Crc {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl Crc {
+    /// Create a new CRC.
+    pub fn new() -> Crc {
+        Crc {
+            amt: 0,
+            hasher: Hasher::new(),
+        }
+    }
+
+    /// Returns the current crc32 checksum.
+    pub fn sum(&self) -> u32 {
+        self.hasher.clone().finalize()
+    }
+
+    /// The number of bytes that have been used to calculate the CRC.
+    /// This value is only accurate if the amount is lower than 2<sup>32</sup>.
+    pub fn amount(&self) -> u32 {
+        self.amt
+    }
+
+    /// Update the CRC with the bytes in `data`.
+    pub fn update(&mut self, data: &[u8]) {
+        self.amt = self.amt.wrapping_add(data.len() as u32);
+        self.hasher.update(data);
+    }
+
+    /// Reset the CRC.
+    pub fn reset(&mut self) {
+        self.amt = 0;
+        self.hasher.reset();
+    }
+
+    /// Combine the CRC with the CRC for the subsequent block of bytes.
+    pub fn combine(&mut self, additional_crc: &Crc) {
+        self.amt += additional_crc.amt;
+        self.hasher.combine(&additional_crc.hasher);
+    }
+}
+
+impl<R: Read> CrcReader<R> {
+    /// Create a new CrcReader.
+    pub fn new(r: R) -> CrcReader<R> {
+        CrcReader {
+            inner: r,
+            crc: Crc::new(),
+        }
+    }
+}
+
+impl<R> CrcReader<R> {
+    /// Get the Crc for this CrcReader.
+    pub fn crc(&self) -> &Crc {
+        &self.crc
+    }
+
+    /// Get the reader that is wrapped by this CrcReader.
+    pub fn into_inner(self) -> R {
+        self.inner
+    }
+
+    /// Get the reader that is wrapped by this CrcReader by reference.
+    pub fn get_ref(&self) -> &R {
+        &self.inner
+    }
+
+    /// Get a mutable reference to the reader that is wrapped by this CrcReader.
+    pub fn get_mut(&mut self) -> &mut R {
+        &mut self.inner
+    }
+
+    /// Reset the Crc in this CrcReader.
+    pub fn reset(&mut self) {
+        self.crc.reset();
+    }
+}
+
+impl<R: Read> Read for CrcReader<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        let amt = self.inner.read(into)?;
+        self.crc.update(&into[..amt]);
+        Ok(amt)
+    }
+}
+
+impl<R: BufRead> BufRead for CrcReader<R> {
+    fn fill_buf(&mut self) -> io::Result<&[u8]> {
+        self.inner.fill_buf()
+    }
+    fn consume(&mut self, amt: usize) {
+        if let Ok(data) = self.inner.fill_buf() {
+            self.crc.update(&data[..amt]);
+        }
+        self.inner.consume(amt);
+    }
+}
+
+/// A wrapper around a [`Write`] that calculates the CRC.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+#[derive(Debug)]
+pub struct CrcWriter<W> {
+    inner: W,
+    crc: Crc,
+}
+
+impl<W> CrcWriter<W> {
+    /// Get the Crc for this CrcWriter.
+    pub fn crc(&self) -> &Crc {
+        &self.crc
+    }
+
+    /// Get the writer that is wrapped by this CrcWriter.
+    pub fn into_inner(self) -> W {
+        self.inner
+    }
+
+    /// Get the writer that is wrapped by this CrcWriter by reference.
+    pub fn get_ref(&self) -> &W {
+        &self.inner
+    }
+
+    /// Get a mutable reference to the writer that is wrapped by this CrcWriter.
+    pub fn get_mut(&mut self) -> &mut W {
+        &mut self.inner
+    }
+
+    /// Reset the Crc in this CrcWriter.
+    pub fn reset(&mut self) {
+        self.crc.reset();
+    }
+}
+
+impl<W: Write> CrcWriter<W> {
+    /// Create a new CrcWriter.
+    pub fn new(w: W) -> CrcWriter<W> {
+        CrcWriter {
+            inner: w,
+            crc: Crc::new(),
+        }
+    }
+}
+
+impl<W: Write> Write for CrcWriter<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        let amt = self.inner.write(buf)?;
+        self.crc.update(&buf[..amt]);
+        Ok(amt)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/deflate/bufread.rs b/android/vendor/flate2-1.0.24/src/deflate/bufread.rs
new file mode 100644
index 0000000..f0b29e0
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/deflate/bufread.rs
@@ -0,0 +1,243 @@
+use std::io;
+use std::io::prelude::*;
+use std::mem;
+
+use crate::zio;
+use crate::{Compress, Decompress};
+
+/// A DEFLATE encoder, or compressor.
+///
+/// This structure consumes a [`BufRead`] interface, reading uncompressed data
+/// from the underlying reader, and emitting compressed data.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// use flate2::Compression;
+/// use flate2::bufread::DeflateEncoder;
+/// use std::fs::File;
+/// use std::io::BufReader;
+///
+/// # fn main() {
+/// #    println!("{:?}", open_hello_world().unwrap());
+/// # }
+/// #
+/// // Opens sample file, compresses the contents and returns a Vector
+/// fn open_hello_world() -> io::Result<Vec<u8>> {
+///    let f = File::open("examples/hello_world.txt")?;
+///    let b = BufReader::new(f);
+///    let mut deflater = DeflateEncoder::new(b, Compression::fast());
+///    let mut buffer = Vec::new();
+///    deflater.read_to_end(&mut buffer)?;
+///    Ok(buffer)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct DeflateEncoder<R> {
+    obj: R,
+    data: Compress,
+}
+
+impl<R: BufRead> DeflateEncoder<R> {
+    /// Creates a new encoder which will read uncompressed data from the given
+    /// stream and emit the compressed stream.
+    pub fn new(r: R, level: crate::Compression) -> DeflateEncoder<R> {
+        DeflateEncoder {
+            obj: r,
+            data: Compress::new(level, false),
+        }
+    }
+}
+
+pub fn reset_encoder_data<R>(zlib: &mut DeflateEncoder<R>) {
+    zlib.data.reset();
+}
+
+impl<R> DeflateEncoder<R> {
+    /// Resets the state of this encoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This function will reset the internal state of this encoder and replace
+    /// the input stream with the one provided, returning the previous input
+    /// stream. Future data read from this encoder will be the compressed
+    /// version of `r`'s data.
+    pub fn reset(&mut self, r: R) -> R {
+        reset_encoder_data(self);
+        mem::replace(&mut self.obj, r)
+    }
+
+    /// Acquires a reference to the underlying reader
+    pub fn get_ref(&self) -> &R {
+        &self.obj
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        &mut self.obj
+    }
+
+    /// Consumes this encoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.obj
+    }
+
+    /// Returns the number of bytes that have been read into this compressor.
+    ///
+    /// Note that not all bytes read from the underlying object may be accounted
+    /// for, there may still be some active buffering.
+    pub fn total_in(&self) -> u64 {
+        self.data.total_in()
+    }
+
+    /// Returns the number of bytes that the compressor has produced.
+    ///
+    /// Note that not all bytes may have been read yet, some may still be
+    /// buffered.
+    pub fn total_out(&self) -> u64 {
+        self.data.total_out()
+    }
+}
+
+impl<R: BufRead> Read for DeflateEncoder<R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        zio::read(&mut self.obj, &mut self.data, buf)
+    }
+}
+
+impl<W: BufRead + Write> Write for DeflateEncoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A DEFLATE decoder, or decompressor.
+///
+/// This structure consumes a [`BufRead`] interface, reading compressed data
+/// from the underlying reader, and emitting uncompressed data.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::DeflateEncoder;
+/// use flate2::bufread::DeflateDecoder;
+///
+/// # fn main() {
+/// #    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+/// #    e.write_all(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// // Uncompresses a Deflate Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements Read
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut deflater = DeflateDecoder::new(&bytes[..]);
+///    let mut s = String::new();
+///    deflater.read_to_string(&mut s)?;
+///    Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct DeflateDecoder<R> {
+    obj: R,
+    data: Decompress,
+}
+
+pub fn reset_decoder_data<R>(zlib: &mut DeflateDecoder<R>) {
+    zlib.data = Decompress::new(false);
+}
+
+impl<R: BufRead> DeflateDecoder<R> {
+    /// Creates a new decoder which will decompress data read from the given
+    /// stream.
+    pub fn new(r: R) -> DeflateDecoder<R> {
+        DeflateDecoder {
+            obj: r,
+            data: Decompress::new(false),
+        }
+    }
+}
+
+impl<R> DeflateDecoder<R> {
+    /// Resets the state of this decoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This will reset the internal state of this decoder and replace the
+    /// input stream with the one provided, returning the previous input
+    /// stream. Future data read from this decoder will be the decompressed
+    /// version of `r`'s data.
+    pub fn reset(&mut self, r: R) -> R {
+        reset_decoder_data(self);
+        mem::replace(&mut self.obj, r)
+    }
+
+    /// Resets the state of this decoder's data
+    ///
+    /// This will reset the internal state of this decoder. It will continue
+    /// reading from the same stream.
+    pub fn reset_data(&mut self) {
+        reset_decoder_data(self);
+    }
+
+    /// Acquires a reference to the underlying stream
+    pub fn get_ref(&self) -> &R {
+        &self.obj
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        &mut self.obj
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.obj
+    }
+
+    /// Returns the number of bytes that the decompressor has consumed.
+    ///
+    /// Note that this will likely be smaller than what the decompressor
+    /// actually read from the underlying stream due to buffering.
+    pub fn total_in(&self) -> u64 {
+        self.data.total_in()
+    }
+
+    /// Returns the number of bytes that the decompressor has produced.
+    pub fn total_out(&self) -> u64 {
+        self.data.total_out()
+    }
+}
+
+impl<R: BufRead> Read for DeflateDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        zio::read(&mut self.obj, &mut self.data, into)
+    }
+}
+
+impl<W: BufRead + Write> Write for DeflateDecoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/deflate/mod.rs b/android/vendor/flate2-1.0.24/src/deflate/mod.rs
new file mode 100644
index 0000000..51758b3
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/deflate/mod.rs
@@ -0,0 +1,193 @@
+pub mod bufread;
+pub mod read;
+pub mod write;
+
+#[cfg(test)]
+mod tests {
+    use std::io::prelude::*;
+
+    use rand::{thread_rng, Rng};
+
+    use super::{read, write};
+    use crate::Compression;
+
+    #[test]
+    fn roundtrip() {
+        let mut real = Vec::new();
+        let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default());
+        let v = crate::random_bytes().take(1024).collect::<Vec<_>>();
+        for _ in 0..200 {
+            let to_write = &v[..thread_rng().gen_range(0..v.len())];
+            real.extend(to_write.iter().map(|x| *x));
+            w.write_all(to_write).unwrap();
+        }
+        let result = w.finish().unwrap();
+        let mut r = read::DeflateDecoder::new(&result[..]);
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert!(ret == real);
+    }
+
+    #[test]
+    fn drop_writes() {
+        let mut data = Vec::new();
+        write::DeflateEncoder::new(&mut data, Compression::default())
+            .write_all(b"foo")
+            .unwrap();
+        let mut r = read::DeflateDecoder::new(&data[..]);
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert!(ret == b"foo");
+    }
+
+    #[test]
+    fn total_in() {
+        let mut real = Vec::new();
+        let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default());
+        let v = crate::random_bytes().take(1024).collect::<Vec<_>>();
+        for _ in 0..200 {
+            let to_write = &v[..thread_rng().gen_range(0..v.len())];
+            real.extend(to_write.iter().map(|x| *x));
+            w.write_all(to_write).unwrap();
+        }
+        let mut result = w.finish().unwrap();
+
+        let result_len = result.len();
+
+        for _ in 0..200 {
+            result.extend(v.iter().map(|x| *x));
+        }
+
+        let mut r = read::DeflateDecoder::new(&result[..]);
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert!(ret == real);
+        assert_eq!(r.total_in(), result_len as u64);
+    }
+
+    #[test]
+    fn roundtrip2() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut r =
+            read::DeflateDecoder::new(read::DeflateEncoder::new(&v[..], Compression::default()));
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert_eq!(ret, v);
+    }
+
+    #[test]
+    fn roundtrip3() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut w = write::DeflateEncoder::new(
+            write::DeflateDecoder::new(Vec::new()),
+            Compression::default(),
+        );
+        w.write_all(&v).unwrap();
+        let w = w.finish().unwrap().finish().unwrap();
+        assert!(w == v);
+    }
+
+    #[test]
+    fn reset_writer() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default());
+        w.write_all(&v).unwrap();
+        let a = w.reset(Vec::new()).unwrap();
+        w.write_all(&v).unwrap();
+        let b = w.finish().unwrap();
+
+        let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default());
+        w.write_all(&v).unwrap();
+        let c = w.finish().unwrap();
+        assert!(a == b && b == c);
+    }
+
+    #[test]
+    fn reset_reader() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let (mut a, mut b, mut c) = (Vec::new(), Vec::new(), Vec::new());
+        let mut r = read::DeflateEncoder::new(&v[..], Compression::default());
+        r.read_to_end(&mut a).unwrap();
+        r.reset(&v[..]);
+        r.read_to_end(&mut b).unwrap();
+
+        let mut r = read::DeflateEncoder::new(&v[..], Compression::default());
+        r.read_to_end(&mut c).unwrap();
+        assert!(a == b && b == c);
+    }
+
+    #[test]
+    fn reset_decoder() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut w = write::DeflateEncoder::new(Vec::new(), Compression::default());
+        w.write_all(&v).unwrap();
+        let data = w.finish().unwrap();
+
+        {
+            let (mut a, mut b, mut c) = (Vec::new(), Vec::new(), Vec::new());
+            let mut r = read::DeflateDecoder::new(&data[..]);
+            r.read_to_end(&mut a).unwrap();
+            r.reset(&data);
+            r.read_to_end(&mut b).unwrap();
+
+            let mut r = read::DeflateDecoder::new(&data[..]);
+            r.read_to_end(&mut c).unwrap();
+            assert!(a == b && b == c && c == v);
+        }
+
+        {
+            let mut w = write::DeflateDecoder::new(Vec::new());
+            w.write_all(&data).unwrap();
+            let a = w.reset(Vec::new()).unwrap();
+            w.write_all(&data).unwrap();
+            let b = w.finish().unwrap();
+
+            let mut w = write::DeflateDecoder::new(Vec::new());
+            w.write_all(&data).unwrap();
+            let c = w.finish().unwrap();
+            assert!(a == b && b == c && c == v);
+        }
+    }
+
+    #[test]
+    fn zero_length_read_with_data() {
+        let m = vec![3u8; 128 * 1024 + 1];
+        let mut c = read::DeflateEncoder::new(&m[..], Compression::default());
+
+        let mut result = Vec::new();
+        c.read_to_end(&mut result).unwrap();
+
+        let mut d = read::DeflateDecoder::new(&result[..]);
+        let mut data = Vec::new();
+        assert!(d.read(&mut data).unwrap() == 0);
+    }
+
+    #[test]
+    fn qc_reader() {
+        ::quickcheck::quickcheck(test as fn(_) -> _);
+
+        fn test(v: Vec<u8>) -> bool {
+            let mut r = read::DeflateDecoder::new(read::DeflateEncoder::new(
+                &v[..],
+                Compression::default(),
+            ));
+            let mut v2 = Vec::new();
+            r.read_to_end(&mut v2).unwrap();
+            v == v2
+        }
+    }
+
+    #[test]
+    fn qc_writer() {
+        ::quickcheck::quickcheck(test as fn(_) -> _);
+
+        fn test(v: Vec<u8>) -> bool {
+            let mut w = write::DeflateEncoder::new(
+                write::DeflateDecoder::new(Vec::new()),
+                Compression::default(),
+            );
+            w.write_all(&v).unwrap();
+            v == w.finish().unwrap().finish().unwrap()
+        }
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/deflate/read.rs b/android/vendor/flate2-1.0.24/src/deflate/read.rs
new file mode 100644
index 0000000..fd17a89
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/deflate/read.rs
@@ -0,0 +1,241 @@
+use std::io;
+use std::io::prelude::*;
+
+use super::bufread;
+use crate::bufreader::BufReader;
+
+/// A DEFLATE encoder, or compressor.
+///
+/// This structure implements a [`Read`] interface and will read uncompressed
+/// data from an underlying stream and emit a stream of compressed data.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// use flate2::Compression;
+/// use flate2::read::DeflateEncoder;
+///
+/// # fn main() {
+/// #    println!("{:?}", deflateencoder_read_hello_world().unwrap());
+/// # }
+/// #
+/// // Return a vector containing the Deflate compressed version of hello world
+/// fn deflateencoder_read_hello_world() -> io::Result<Vec<u8>> {
+///    let mut ret_vec = [0;100];
+///    let c = b"hello world";
+///    let mut deflater = DeflateEncoder::new(&c[..], Compression::fast());
+///    let count = deflater.read(&mut ret_vec)?;
+///    Ok(ret_vec[0..count].to_vec())
+/// }
+/// ```
+#[derive(Debug)]
+pub struct DeflateEncoder<R> {
+    inner: bufread::DeflateEncoder<BufReader<R>>,
+}
+
+impl<R: Read> DeflateEncoder<R> {
+    /// Creates a new encoder which will read uncompressed data from the given
+    /// stream and emit the compressed stream.
+    pub fn new(r: R, level: crate::Compression) -> DeflateEncoder<R> {
+        DeflateEncoder {
+            inner: bufread::DeflateEncoder::new(BufReader::new(r), level),
+        }
+    }
+}
+
+impl<R> DeflateEncoder<R> {
+    /// Resets the state of this encoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This function will reset the internal state of this encoder and replace
+    /// the input stream with the one provided, returning the previous input
+    /// stream. Future data read from this encoder will be the compressed
+    /// version of `r`'s data.
+    ///
+    /// Note that there may be currently buffered data when this function is
+    /// called, and in that case the buffered data is discarded.
+    pub fn reset(&mut self, r: R) -> R {
+        super::bufread::reset_encoder_data(&mut self.inner);
+        self.inner.get_mut().reset(r)
+    }
+
+    /// Acquires a reference to the underlying reader
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Consumes this encoder, returning the underlying reader.
+    ///
+    /// Note that there may be buffered bytes which are not re-acquired as part
+    /// of this transition. It's recommended to only call this function after
+    /// EOF has been reached.
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+
+    /// Returns the number of bytes that have been read into this compressor.
+    ///
+    /// Note that not all bytes read from the underlying object may be accounted
+    /// for, there may still be some active buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.total_in()
+    }
+
+    /// Returns the number of bytes that the compressor has produced.
+    ///
+    /// Note that not all bytes may have been read yet, some may still be
+    /// buffered.
+    pub fn total_out(&self) -> u64 {
+        self.inner.total_out()
+    }
+}
+
+impl<R: Read> Read for DeflateEncoder<R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(buf)
+    }
+}
+
+impl<W: Read + Write> Write for DeflateEncoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A DEFLATE decoder, or decompressor.
+///
+/// This structure implements a [`Read`] interface and takes a stream of
+/// compressed data as input, providing the decompressed data when read from.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::DeflateEncoder;
+/// use flate2::read::DeflateDecoder;
+///
+/// # fn main() {
+/// #    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+/// #    e.write_all(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// // Uncompresses a Deflate Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements Read
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut deflater = DeflateDecoder::new(&bytes[..]);
+///    let mut s = String::new();
+///    deflater.read_to_string(&mut s)?;
+///    Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct DeflateDecoder<R> {
+    inner: bufread::DeflateDecoder<BufReader<R>>,
+}
+
+impl<R: Read> DeflateDecoder<R> {
+    /// Creates a new decoder which will decompress data read from the given
+    /// stream.
+    pub fn new(r: R) -> DeflateDecoder<R> {
+        DeflateDecoder::new_with_buf(r, vec![0; 32 * 1024])
+    }
+
+    /// Same as `new`, but the intermediate buffer for data is specified.
+    ///
+    /// Note that the capacity of the intermediate buffer is never increased,
+    /// and it is recommended for it to be large.
+    pub fn new_with_buf(r: R, buf: Vec<u8>) -> DeflateDecoder<R> {
+        DeflateDecoder {
+            inner: bufread::DeflateDecoder::new(BufReader::with_buf(buf, r)),
+        }
+    }
+}
+
+impl<R> DeflateDecoder<R> {
+    /// Resets the state of this decoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This will reset the internal state of this decoder and replace the
+    /// input stream with the one provided, returning the previous input
+    /// stream. Future data read from this decoder will be the decompressed
+    /// version of `r`'s data.
+    ///
+    /// Note that there may be currently buffered data when this function is
+    /// called, and in that case the buffered data is discarded.
+    pub fn reset(&mut self, r: R) -> R {
+        super::bufread::reset_decoder_data(&mut self.inner);
+        self.inner.get_mut().reset(r)
+    }
+
+    /// Acquires a reference to the underlying stream
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    ///
+    /// Note that there may be buffered bytes which are not re-acquired as part
+    /// of this transition. It's recommended to only call this function after
+    /// EOF has been reached.
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+
+    /// Returns the number of bytes that the decompressor has consumed.
+    ///
+    /// Note that this will likely be smaller than what the decompressor
+    /// actually read from the underlying stream due to buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.total_in()
+    }
+
+    /// Returns the number of bytes that the decompressor has produced.
+    pub fn total_out(&self) -> u64 {
+        self.inner.total_out()
+    }
+}
+
+impl<R: Read> Read for DeflateDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(into)
+    }
+}
+
+impl<W: Read + Write> Write for DeflateDecoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/deflate/write.rs b/android/vendor/flate2-1.0.24/src/deflate/write.rs
new file mode 100644
index 0000000..2c44556
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/deflate/write.rs
@@ -0,0 +1,322 @@
+use std::io;
+use std::io::prelude::*;
+
+use crate::zio;
+use crate::{Compress, Decompress};
+
+/// A DEFLATE encoder, or compressor.
+///
+/// This structure implements a [`Write`] interface and takes a stream of
+/// uncompressed data, writing the compressed data to the wrapped writer.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use flate2::Compression;
+/// use flate2::write::DeflateEncoder;
+///
+/// // Vec<u8> implements Write to print the compressed bytes of sample string
+/// # fn main() {
+///
+/// let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+/// e.write_all(b"Hello World").unwrap();
+/// println!("{:?}", e.finish().unwrap());
+/// # }
+/// ```
+#[derive(Debug)]
+pub struct DeflateEncoder<W: Write> {
+    inner: zio::Writer<W, Compress>,
+}
+
+impl<W: Write> DeflateEncoder<W> {
+    /// Creates a new encoder which will write compressed data to the stream
+    /// given at the given compression level.
+    ///
+    /// When this encoder is dropped or unwrapped the final pieces of data will
+    /// be flushed.
+    pub fn new(w: W, level: crate::Compression) -> DeflateEncoder<W> {
+        DeflateEncoder {
+            inner: zio::Writer::new(w, Compress::new(level, false)),
+        }
+    }
+
+    /// Acquires a reference to the underlying writer.
+    pub fn get_ref(&self) -> &W {
+        self.inner.get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying writer.
+    ///
+    /// Note that mutating the output/input state of the stream may corrupt this
+    /// object, so care must be taken when using this method.
+    pub fn get_mut(&mut self) -> &mut W {
+        self.inner.get_mut()
+    }
+
+    /// Resets the state of this encoder entirely, swapping out the output
+    /// stream for another.
+    ///
+    /// This function will finish encoding the current stream into the current
+    /// output stream before swapping out the two output streams. If the stream
+    /// cannot be finished an error is returned.
+    ///
+    /// After the current stream has been finished, this will reset the internal
+    /// state of this encoder and replace the output stream with the one
+    /// provided, returning the previous output stream. Future data written to
+    /// this encoder will be the compressed into the stream `w` provided.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn reset(&mut self, w: W) -> io::Result<W> {
+        self.inner.finish()?;
+        self.inner.data.reset();
+        Ok(self.inner.replace(w))
+    }
+
+    /// Attempt to finish this output stream, writing out final chunks of data.
+    ///
+    /// Note that this function can only be used once data has finished being
+    /// written to the output stream. After this function is called then further
+    /// calls to `write` may result in a panic.
+    ///
+    /// # Panics
+    ///
+    /// Attempts to write data to this stream may result in a panic after this
+    /// function is called.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn try_finish(&mut self) -> io::Result<()> {
+        self.inner.finish()
+    }
+
+    /// Consumes this encoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream, close off the compressed
+    /// stream and, if successful, return the contained writer.
+    ///
+    /// Note that this function may not be suitable to call in a situation where
+    /// the underlying stream is an asynchronous I/O stream. To finish a stream
+    /// the `try_finish` (or `shutdown`) method should be used instead. To
+    /// re-acquire ownership of a stream it is safe to call this method after
+    /// `try_finish` or `shutdown` has returned `Ok`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn finish(mut self) -> io::Result<W> {
+        self.inner.finish()?;
+        Ok(self.inner.take_inner())
+    }
+
+    /// Consumes this encoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream and then return the contained
+    /// writer if the flush succeeded.
+    /// The compressed stream will not closed but only flushed. This
+    /// means that obtained byte array can by extended by another deflated
+    /// stream. To close the stream add the two bytes 0x3 and 0x0.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn flush_finish(mut self) -> io::Result<W> {
+        self.inner.flush()?;
+        Ok(self.inner.take_inner())
+    }
+
+    /// Returns the number of bytes that have been written to this compressor.
+    ///
+    /// Note that not all bytes written to this object may be accounted for,
+    /// there may still be some active buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.data.total_in()
+    }
+
+    /// Returns the number of bytes that the compressor has produced.
+    ///
+    /// Note that not all bytes may have been written yet, some may still be
+    /// buffered.
+    pub fn total_out(&self) -> u64 {
+        self.inner.data.total_out()
+    }
+}
+
+impl<W: Write> Write for DeflateEncoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.inner.write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
+    }
+}
+
+impl<W: Read + Write> Read for DeflateEncoder<W> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.get_mut().read(buf)
+    }
+}
+
+/// A DEFLATE decoder, or decompressor.
+///
+/// This structure implements a [`Write`] and will emit a stream of decompressed
+/// data when fed a stream of compressed data.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::DeflateEncoder;
+/// use flate2::write::DeflateDecoder;
+///
+/// # fn main() {
+/// #    let mut e = DeflateEncoder::new(Vec::new(), Compression::default());
+/// #    e.write_all(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    println!("{}", decode_writer(bytes).unwrap());
+/// # }
+/// // Uncompresses a Deflate Encoded vector of bytes and returns a string or error
+/// // Here Vec<u8> implements Write
+/// fn decode_writer(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut writer = Vec::new();
+///    let mut deflater = DeflateDecoder::new(writer);
+///    deflater.write_all(&bytes[..])?;
+///    writer = deflater.finish()?;
+///    let return_string = String::from_utf8(writer).expect("String parsing error");
+///    Ok(return_string)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct DeflateDecoder<W: Write> {
+    inner: zio::Writer<W, Decompress>,
+}
+
+impl<W: Write> DeflateDecoder<W> {
+    /// Creates a new decoder which will write uncompressed data to the stream.
+    ///
+    /// When this encoder is dropped or unwrapped the final pieces of data will
+    /// be flushed.
+    pub fn new(w: W) -> DeflateDecoder<W> {
+        DeflateDecoder {
+            inner: zio::Writer::new(w, Decompress::new(false)),
+        }
+    }
+
+    /// Acquires a reference to the underlying writer.
+    pub fn get_ref(&self) -> &W {
+        self.inner.get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying writer.
+    ///
+    /// Note that mutating the output/input state of the stream may corrupt this
+    /// object, so care must be taken when using this method.
+    pub fn get_mut(&mut self) -> &mut W {
+        self.inner.get_mut()
+    }
+
+    /// Resets the state of this decoder entirely, swapping out the output
+    /// stream for another.
+    ///
+    /// This function will finish encoding the current stream into the current
+    /// output stream before swapping out the two output streams.
+    ///
+    /// This will then reset the internal state of this decoder and replace the
+    /// output stream with the one provided, returning the previous output
+    /// stream. Future data written to this decoder will be decompressed into
+    /// the output stream `w`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to finish the stream, and if that I/O
+    /// returns an error then that will be returned from this function.
+    pub fn reset(&mut self, w: W) -> io::Result<W> {
+        self.inner.finish()?;
+        self.inner.data = Decompress::new(false);
+        Ok(self.inner.replace(w))
+    }
+
+    /// Attempt to finish this output stream, writing out final chunks of data.
+    ///
+    /// Note that this function can only be used once data has finished being
+    /// written to the output stream. After this function is called then further
+    /// calls to `write` may result in a panic.
+    ///
+    /// # Panics
+    ///
+    /// Attempts to write data to this stream may result in a panic after this
+    /// function is called.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to finish the stream, returning any
+    /// errors which happen.
+    pub fn try_finish(&mut self) -> io::Result<()> {
+        self.inner.finish()
+    }
+
+    /// Consumes this encoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream and then return the contained
+    /// writer if the flush succeeded.
+    ///
+    /// Note that this function may not be suitable to call in a situation where
+    /// the underlying stream is an asynchronous I/O stream. To finish a stream
+    /// the `try_finish` (or `shutdown`) method should be used instead. To
+    /// re-acquire ownership of a stream it is safe to call this method after
+    /// `try_finish` or `shutdown` has returned `Ok`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn finish(mut self) -> io::Result<W> {
+        self.inner.finish()?;
+        Ok(self.inner.take_inner())
+    }
+
+    /// Returns the number of bytes that the decompressor has consumed for
+    /// decompression.
+    ///
+    /// Note that this will likely be smaller than the number of bytes
+    /// successfully written to this stream due to internal buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.data.total_in()
+    }
+
+    /// Returns the number of bytes that the decompressor has written to its
+    /// output stream.
+    pub fn total_out(&self) -> u64 {
+        self.inner.data.total_out()
+    }
+}
+
+impl<W: Write> Write for DeflateDecoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.inner.write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
+    }
+}
+
+impl<W: Read + Write> Read for DeflateDecoder<W> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.get_mut().read(buf)
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/ffi/c.rs b/android/vendor/flate2-1.0.24/src/ffi/c.rs
new file mode 100644
index 0000000..59e2011
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/ffi/c.rs
@@ -0,0 +1,421 @@
+//! Implementation for C backends.
+use std::alloc::{self, Layout};
+use std::cmp;
+use std::convert::TryFrom;
+use std::fmt;
+use std::marker;
+use std::ops::{Deref, DerefMut};
+use std::os::raw::{c_int, c_uint, c_void};
+use std::ptr;
+
+use super::*;
+use crate::mem::{self, FlushDecompress, Status};
+
+#[derive(Default)]
+pub struct ErrorMessage(Option<&'static str>);
+
+impl ErrorMessage {
+    pub fn get(&self) -> Option<&str> {
+        self.0
+    }
+}
+
+pub struct StreamWrapper {
+    pub inner: Box<mz_stream>,
+}
+
+impl fmt::Debug for StreamWrapper {
+    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(f, "StreamWrapper")
+    }
+}
+
+impl Default for StreamWrapper {
+    fn default() -> StreamWrapper {
+        StreamWrapper {
+            inner: Box::new(mz_stream {
+                next_in: ptr::null_mut(),
+                avail_in: 0,
+                total_in: 0,
+                next_out: ptr::null_mut(),
+                avail_out: 0,
+                total_out: 0,
+                msg: ptr::null_mut(),
+                adler: 0,
+                data_type: 0,
+                reserved: 0,
+                opaque: ptr::null_mut(),
+                state: ptr::null_mut(),
+                #[cfg(all(feature = "any_zlib", not(feature = "cloudflare-zlib-sys")))]
+                zalloc,
+                #[cfg(all(feature = "any_zlib", not(feature = "cloudflare-zlib-sys")))]
+                zfree,
+                #[cfg(not(all(feature = "any_zlib", not(feature = "cloudflare-zlib-sys"))))]
+                zalloc: Some(zalloc),
+                #[cfg(not(all(feature = "any_zlib", not(feature = "cloudflare-zlib-sys"))))]
+                zfree: Some(zfree),
+            }),
+        }
+    }
+}
+
+const ALIGN: usize = std::mem::align_of::<usize>();
+
+fn align_up(size: usize, align: usize) -> usize {
+    (size + align - 1) & !(align - 1)
+}
+
+extern "C" fn zalloc(_ptr: *mut c_void, items: AllocSize, item_size: AllocSize) -> *mut c_void {
+    // We need to multiply `items` and `item_size` to get the actual desired
+    // allocation size. Since `zfree` doesn't receive a size argument we
+    // also need to allocate space for a `usize` as a header so we can store
+    // how large the allocation is to deallocate later.
+    let size = match items
+        .checked_mul(item_size)
+        .and_then(|i| usize::try_from(i).ok())
+        .map(|size| align_up(size, ALIGN))
+        .and_then(|i| i.checked_add(std::mem::size_of::<usize>()))
+    {
+        Some(i) => i,
+        None => return ptr::null_mut(),
+    };
+
+    // Make sure the `size` isn't too big to fail `Layout`'s restrictions
+    let layout = match Layout::from_size_align(size, ALIGN) {
+        Ok(layout) => layout,
+        Err(_) => return ptr::null_mut(),
+    };
+
+    unsafe {
+        // Allocate the data, and if successful store the size we allocated
+        // at the beginning and then return an offset pointer.
+        let ptr = alloc::alloc(layout) as *mut usize;
+        if ptr.is_null() {
+            return ptr as *mut c_void;
+        }
+        *ptr = size;
+        ptr.add(1) as *mut c_void
+    }
+}
+
+extern "C" fn zfree(_ptr: *mut c_void, address: *mut c_void) {
+    unsafe {
+        // Move our address being freed back one pointer, read the size we
+        // stored in `zalloc`, and then free it using the standard Rust
+        // allocator.
+        let ptr = (address as *mut usize).offset(-1);
+        let size = *ptr;
+        let layout = Layout::from_size_align_unchecked(size, ALIGN);
+        alloc::dealloc(ptr as *mut u8, layout)
+    }
+}
+
+impl Deref for StreamWrapper {
+    type Target = mz_stream;
+
+    fn deref(&self) -> &Self::Target {
+        &*self.inner
+    }
+}
+
+impl DerefMut for StreamWrapper {
+    fn deref_mut(&mut self) -> &mut Self::Target {
+        &mut *self.inner
+    }
+}
+
+unsafe impl<D: Direction> Send for Stream<D> {}
+unsafe impl<D: Direction> Sync for Stream<D> {}
+
+/// Trait used to call the right destroy/end function on the inner
+/// stream object on drop.
+pub trait Direction {
+    unsafe fn destroy(stream: *mut mz_stream) -> c_int;
+}
+
+#[derive(Debug)]
+pub enum DirCompress {}
+#[derive(Debug)]
+pub enum DirDecompress {}
+
+#[derive(Debug)]
+pub struct Stream<D: Direction> {
+    pub stream_wrapper: StreamWrapper,
+    pub total_in: u64,
+    pub total_out: u64,
+    pub _marker: marker::PhantomData<D>,
+}
+
+impl<D: Direction> Stream<D> {
+    pub fn msg(&self) -> ErrorMessage {
+        let msg = self.stream_wrapper.msg;
+        ErrorMessage(if msg.is_null() {
+            None
+        } else {
+            let s = unsafe { std::ffi::CStr::from_ptr(msg) };
+            std::str::from_utf8(s.to_bytes()).ok()
+        })
+    }
+}
+
+impl<D: Direction> Drop for Stream<D> {
+    fn drop(&mut self) {
+        unsafe {
+            let _ = D::destroy(&mut *self.stream_wrapper);
+        }
+    }
+}
+
+impl Direction for DirCompress {
+    unsafe fn destroy(stream: *mut mz_stream) -> c_int {
+        mz_deflateEnd(stream)
+    }
+}
+impl Direction for DirDecompress {
+    unsafe fn destroy(stream: *mut mz_stream) -> c_int {
+        mz_inflateEnd(stream)
+    }
+}
+
+#[derive(Debug)]
+pub struct Inflate {
+    pub inner: Stream<DirDecompress>,
+}
+
+impl InflateBackend for Inflate {
+    fn make(zlib_header: bool, window_bits: u8) -> Self {
+        unsafe {
+            let mut state = StreamWrapper::default();
+            let ret = mz_inflateInit2(
+                &mut *state,
+                if zlib_header {
+                    window_bits as c_int
+                } else {
+                    -(window_bits as c_int)
+                },
+            );
+            assert_eq!(ret, 0);
+            Inflate {
+                inner: Stream {
+                    stream_wrapper: state,
+                    total_in: 0,
+                    total_out: 0,
+                    _marker: marker::PhantomData,
+                },
+            }
+        }
+    }
+
+    fn decompress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError> {
+        let raw = &mut *self.inner.stream_wrapper;
+        raw.msg = ptr::null_mut();
+        raw.next_in = input.as_ptr() as *mut u8;
+        raw.avail_in = cmp::min(input.len(), c_uint::max_value() as usize) as c_uint;
+        raw.next_out = output.as_mut_ptr();
+        raw.avail_out = cmp::min(output.len(), c_uint::max_value() as usize) as c_uint;
+
+        let rc = unsafe { mz_inflate(raw, flush as c_int) };
+
+        // Unfortunately the total counters provided by zlib might be only
+        // 32 bits wide and overflow while processing large amounts of data.
+        self.inner.total_in += (raw.next_in as usize - input.as_ptr() as usize) as u64;
+        self.inner.total_out += (raw.next_out as usize - output.as_ptr() as usize) as u64;
+
+        match rc {
+            MZ_DATA_ERROR | MZ_STREAM_ERROR => mem::decompress_failed(self.inner.msg()),
+            MZ_OK => Ok(Status::Ok),
+            MZ_BUF_ERROR => Ok(Status::BufError),
+            MZ_STREAM_END => Ok(Status::StreamEnd),
+            MZ_NEED_DICT => mem::decompress_need_dict(raw.adler as u32),
+            c => panic!("unknown return code: {}", c),
+        }
+    }
+
+    fn reset(&mut self, zlib_header: bool) {
+        let bits = if zlib_header {
+            MZ_DEFAULT_WINDOW_BITS
+        } else {
+            -MZ_DEFAULT_WINDOW_BITS
+        };
+        unsafe {
+            inflateReset2(&mut *self.inner.stream_wrapper, bits);
+        }
+        self.inner.total_out = 0;
+        self.inner.total_in = 0;
+    }
+}
+
+impl Backend for Inflate {
+    #[inline]
+    fn total_in(&self) -> u64 {
+        self.inner.total_in
+    }
+
+    #[inline]
+    fn total_out(&self) -> u64 {
+        self.inner.total_out
+    }
+}
+
+#[derive(Debug)]
+pub struct Deflate {
+    pub inner: Stream<DirCompress>,
+}
+
+impl DeflateBackend for Deflate {
+    fn make(level: Compression, zlib_header: bool, window_bits: u8) -> Self {
+        unsafe {
+            let mut state = StreamWrapper::default();
+            let ret = mz_deflateInit2(
+                &mut *state,
+                level.0 as c_int,
+                MZ_DEFLATED,
+                if zlib_header {
+                    window_bits as c_int
+                } else {
+                    -(window_bits as c_int)
+                },
+                8,
+                MZ_DEFAULT_STRATEGY,
+            );
+            assert_eq!(ret, 0);
+            Deflate {
+                inner: Stream {
+                    stream_wrapper: state,
+                    total_in: 0,
+                    total_out: 0,
+                    _marker: marker::PhantomData,
+                },
+            }
+        }
+    }
+    fn compress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushCompress,
+    ) -> Result<Status, CompressError> {
+        let raw = &mut *self.inner.stream_wrapper;
+        raw.msg = ptr::null_mut();
+        raw.next_in = input.as_ptr() as *mut _;
+        raw.avail_in = cmp::min(input.len(), c_uint::max_value() as usize) as c_uint;
+        raw.next_out = output.as_mut_ptr();
+        raw.avail_out = cmp::min(output.len(), c_uint::max_value() as usize) as c_uint;
+
+        let rc = unsafe { mz_deflate(raw, flush as c_int) };
+
+        // Unfortunately the total counters provided by zlib might be only
+        // 32 bits wide and overflow while processing large amounts of data.
+        self.inner.total_in += (raw.next_in as usize - input.as_ptr() as usize) as u64;
+        self.inner.total_out += (raw.next_out as usize - output.as_ptr() as usize) as u64;
+
+        match rc {
+            MZ_OK => Ok(Status::Ok),
+            MZ_BUF_ERROR => Ok(Status::BufError),
+            MZ_STREAM_END => Ok(Status::StreamEnd),
+            MZ_STREAM_ERROR => mem::compress_failed(self.inner.msg()),
+            c => panic!("unknown return code: {}", c),
+        }
+    }
+
+    fn reset(&mut self) {
+        self.inner.total_in = 0;
+        self.inner.total_out = 0;
+        let rc = unsafe { mz_deflateReset(&mut *self.inner.stream_wrapper) };
+        assert_eq!(rc, MZ_OK);
+    }
+}
+
+impl Backend for Deflate {
+    #[inline]
+    fn total_in(&self) -> u64 {
+        self.inner.total_in
+    }
+
+    #[inline]
+    fn total_out(&self) -> u64 {
+        self.inner.total_out
+    }
+}
+
+pub use self::c_backend::*;
+
+/// For backwards compatibility, we provide symbols as `mz_` to mimic the miniz API
+#[allow(bad_style)]
+mod c_backend {
+    use std::mem;
+    use std::os::raw::{c_char, c_int};
+
+    #[cfg(feature = "zlib-ng")]
+    use libz_ng_sys as libz;
+
+    #[cfg(all(not(feature = "zlib-ng"), feature = "cloudflare_zlib"))]
+    use cloudflare_zlib_sys as libz;
+
+    #[cfg(all(not(feature = "cloudflare_zlib"), not(feature = "zlib-ng")))]
+    use libz_sys as libz;
+
+    pub use libz::deflate as mz_deflate;
+    pub use libz::deflateEnd as mz_deflateEnd;
+    pub use libz::deflateReset as mz_deflateReset;
+    pub use libz::inflate as mz_inflate;
+    pub use libz::inflateEnd as mz_inflateEnd;
+    pub use libz::z_stream as mz_stream;
+    pub use libz::*;
+
+    pub use libz::Z_BLOCK as MZ_BLOCK;
+    pub use libz::Z_BUF_ERROR as MZ_BUF_ERROR;
+    pub use libz::Z_DATA_ERROR as MZ_DATA_ERROR;
+    pub use libz::Z_DEFAULT_STRATEGY as MZ_DEFAULT_STRATEGY;
+    pub use libz::Z_DEFLATED as MZ_DEFLATED;
+    pub use libz::Z_FINISH as MZ_FINISH;
+    pub use libz::Z_FULL_FLUSH as MZ_FULL_FLUSH;
+    pub use libz::Z_NEED_DICT as MZ_NEED_DICT;
+    pub use libz::Z_NO_FLUSH as MZ_NO_FLUSH;
+    pub use libz::Z_OK as MZ_OK;
+    pub use libz::Z_PARTIAL_FLUSH as MZ_PARTIAL_FLUSH;
+    pub use libz::Z_STREAM_END as MZ_STREAM_END;
+    pub use libz::Z_STREAM_ERROR as MZ_STREAM_ERROR;
+    pub use libz::Z_SYNC_FLUSH as MZ_SYNC_FLUSH;
+    pub type AllocSize = libz::uInt;
+
+    pub const MZ_DEFAULT_WINDOW_BITS: c_int = 15;
+
+    #[cfg(feature = "zlib-ng")]
+    const ZLIB_VERSION: &'static str = "2.1.0.devel\0";
+    #[cfg(not(feature = "zlib-ng"))]
+    const ZLIB_VERSION: &'static str = "1.2.8\0";
+
+    pub unsafe extern "C" fn mz_deflateInit2(
+        stream: *mut mz_stream,
+        level: c_int,
+        method: c_int,
+        window_bits: c_int,
+        mem_level: c_int,
+        strategy: c_int,
+    ) -> c_int {
+        libz::deflateInit2_(
+            stream,
+            level,
+            method,
+            window_bits,
+            mem_level,
+            strategy,
+            ZLIB_VERSION.as_ptr() as *const c_char,
+            mem::size_of::<mz_stream>() as c_int,
+        )
+    }
+    pub unsafe extern "C" fn mz_inflateInit2(stream: *mut mz_stream, window_bits: c_int) -> c_int {
+        libz::inflateInit2_(
+            stream,
+            window_bits,
+            ZLIB_VERSION.as_ptr() as *const c_char,
+            mem::size_of::<mz_stream>() as c_int,
+        )
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/ffi/mod.rs b/android/vendor/flate2-1.0.24/src/ffi/mod.rs
new file mode 100644
index 0000000..8bac6e4
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/ffi/mod.rs
@@ -0,0 +1,52 @@
+//! This module contains backend-specific code.
+
+use crate::mem::{CompressError, DecompressError, FlushCompress, FlushDecompress, Status};
+use crate::Compression;
+
+/// Traits specifying the interface of the backends.
+///
+/// Sync + Send are added as a condition to ensure they are available
+/// for the frontend.
+pub trait Backend: Sync + Send {
+    fn total_in(&self) -> u64;
+    fn total_out(&self) -> u64;
+}
+
+pub trait InflateBackend: Backend {
+    fn make(zlib_header: bool, window_bits: u8) -> Self;
+    fn decompress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError>;
+    fn reset(&mut self, zlib_header: bool);
+}
+
+pub trait DeflateBackend: Backend {
+    fn make(level: Compression, zlib_header: bool, window_bits: u8) -> Self;
+    fn compress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushCompress,
+    ) -> Result<Status, CompressError>;
+    fn reset(&mut self);
+}
+
+// Default to Rust implementation unless explicitly opted in to a different backend.
+#[cfg(feature = "any_zlib")]
+mod c;
+#[cfg(feature = "any_zlib")]
+pub use self::c::*;
+
+#[cfg(not(feature = "any_zlib"))]
+mod rust;
+#[cfg(not(feature = "any_zlib"))]
+pub use self::rust::*;
+
+impl std::fmt::Debug for ErrorMessage {
+    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
+        self.get().fmt(f)
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/ffi/rust.rs b/android/vendor/flate2-1.0.24/src/ffi/rust.rs
new file mode 100644
index 0000000..eadd6ec
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/ffi/rust.rs
@@ -0,0 +1,183 @@
+//! Implementation for miniz_oxide rust backend.
+
+use std::convert::TryInto;
+use std::fmt;
+
+use miniz_oxide::deflate::core::CompressorOxide;
+use miniz_oxide::inflate::stream::InflateState;
+pub use miniz_oxide::*;
+
+pub const MZ_NO_FLUSH: isize = MZFlush::None as isize;
+pub const MZ_PARTIAL_FLUSH: isize = MZFlush::Partial as isize;
+pub const MZ_SYNC_FLUSH: isize = MZFlush::Sync as isize;
+pub const MZ_FULL_FLUSH: isize = MZFlush::Full as isize;
+pub const MZ_FINISH: isize = MZFlush::Finish as isize;
+
+use super::*;
+use crate::mem;
+
+// miniz_oxide doesn't provide any error messages (yet?)
+#[derive(Default)]
+pub struct ErrorMessage;
+
+impl ErrorMessage {
+    pub fn get(&self) -> Option<&str> {
+        None
+    }
+}
+
+fn format_from_bool(zlib_header: bool) -> DataFormat {
+    if zlib_header {
+        DataFormat::Zlib
+    } else {
+        DataFormat::Raw
+    }
+}
+
+pub struct Inflate {
+    inner: Box<InflateState>,
+    total_in: u64,
+    total_out: u64,
+}
+
+impl fmt::Debug for Inflate {
+    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(
+            f,
+            "miniz_oxide inflate internal state. total_in: {}, total_out: {}",
+            self.total_in, self.total_out,
+        )
+    }
+}
+
+impl InflateBackend for Inflate {
+    fn make(zlib_header: bool, _window_bits: u8) -> Self {
+        let format = format_from_bool(zlib_header);
+
+        Inflate {
+            inner: InflateState::new_boxed(format),
+            total_in: 0,
+            total_out: 0,
+        }
+    }
+
+    fn decompress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError> {
+        let flush = MZFlush::new(flush as i32).unwrap();
+
+        let res = inflate::stream::inflate(&mut self.inner, input, output, flush);
+        self.total_in += res.bytes_consumed as u64;
+        self.total_out += res.bytes_written as u64;
+
+        match res.status {
+            Ok(status) => match status {
+                MZStatus::Ok => Ok(Status::Ok),
+                MZStatus::StreamEnd => Ok(Status::StreamEnd),
+                MZStatus::NeedDict => {
+                    mem::decompress_need_dict(self.inner.decompressor().adler32().unwrap_or(0))
+                }
+            },
+            Err(status) => match status {
+                MZError::Buf => Ok(Status::BufError),
+                _ => mem::decompress_failed(ErrorMessage),
+            },
+        }
+    }
+
+    fn reset(&mut self, zlib_header: bool) {
+        self.inner.reset(format_from_bool(zlib_header));
+        self.total_in = 0;
+        self.total_out = 0;
+    }
+}
+
+impl Backend for Inflate {
+    #[inline]
+    fn total_in(&self) -> u64 {
+        self.total_in
+    }
+
+    #[inline]
+    fn total_out(&self) -> u64 {
+        self.total_out
+    }
+}
+
+pub struct Deflate {
+    inner: Box<CompressorOxide>,
+    total_in: u64,
+    total_out: u64,
+}
+
+impl fmt::Debug for Deflate {
+    fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+        write!(
+            f,
+            "miniz_oxide deflate internal state. total_in: {}, total_out: {}",
+            self.total_in, self.total_out,
+        )
+    }
+}
+
+impl DeflateBackend for Deflate {
+    fn make(level: Compression, zlib_header: bool, _window_bits: u8) -> Self {
+        // Check in case the integer value changes at some point.
+        debug_assert!(level.level() <= 10);
+
+        let mut inner: Box<CompressorOxide> = Box::default();
+        let format = format_from_bool(zlib_header);
+        inner.set_format_and_level(format, level.level().try_into().unwrap_or(1));
+
+        Deflate {
+            inner,
+            total_in: 0,
+            total_out: 0,
+        }
+    }
+
+    fn compress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushCompress,
+    ) -> Result<Status, CompressError> {
+        let flush = MZFlush::new(flush as i32).unwrap();
+        let res = deflate::stream::deflate(&mut self.inner, input, output, flush);
+        self.total_in += res.bytes_consumed as u64;
+        self.total_out += res.bytes_written as u64;
+
+        match res.status {
+            Ok(status) => match status {
+                MZStatus::Ok => Ok(Status::Ok),
+                MZStatus::StreamEnd => Ok(Status::StreamEnd),
+                MZStatus::NeedDict => mem::compress_failed(ErrorMessage),
+            },
+            Err(status) => match status {
+                MZError::Buf => Ok(Status::BufError),
+                _ => mem::compress_failed(ErrorMessage),
+            },
+        }
+    }
+
+    fn reset(&mut self) {
+        self.total_in = 0;
+        self.total_out = 0;
+        self.inner.reset();
+    }
+}
+
+impl Backend for Deflate {
+    #[inline]
+    fn total_in(&self) -> u64 {
+        self.total_in
+    }
+
+    #[inline]
+    fn total_out(&self) -> u64 {
+        self.total_out
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/gz/bufread.rs b/android/vendor/flate2-1.0.24/src/gz/bufread.rs
new file mode 100644
index 0000000..6be144d
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/gz/bufread.rs
@@ -0,0 +1,852 @@
+use std::cmp;
+use std::io;
+use std::io::prelude::*;
+use std::mem;
+
+use super::{GzBuilder, GzHeader};
+use super::{FCOMMENT, FEXTRA, FHCRC, FNAME};
+use crate::crc::{Crc, CrcReader};
+use crate::deflate;
+use crate::Compression;
+
+fn copy(into: &mut [u8], from: &[u8], pos: &mut usize) -> usize {
+    let min = cmp::min(into.len(), from.len() - *pos);
+    for (slot, val) in into.iter_mut().zip(from[*pos..*pos + min].iter()) {
+        *slot = *val;
+    }
+    *pos += min;
+    min
+}
+
+pub(crate) fn corrupt() -> io::Error {
+    io::Error::new(
+        io::ErrorKind::InvalidInput,
+        "corrupt gzip stream does not have a matching checksum",
+    )
+}
+
+fn bad_header() -> io::Error {
+    io::Error::new(io::ErrorKind::InvalidInput, "invalid gzip header")
+}
+
+fn read_le_u16<R: Read>(r: &mut Buffer<R>) -> io::Result<u16> {
+    let mut b = [0; 2];
+    r.read_and_forget(&mut b)?;
+    Ok((b[0] as u16) | ((b[1] as u16) << 8))
+}
+
+fn read_gz_header_part<'a, R: Read>(r: &'a mut Buffer<'a, R>) -> io::Result<()> {
+    loop {
+        match r.part.state {
+            GzHeaderParsingState::Start => {
+                let mut header = [0; 10];
+                r.read_and_forget(&mut header)?;
+
+                if header[0] != 0x1f || header[1] != 0x8b {
+                    return Err(bad_header());
+                }
+                if header[2] != 8 {
+                    return Err(bad_header());
+                }
+
+                r.part.flg = header[3];
+                r.part.header.mtime = ((header[4] as u32) << 0)
+                    | ((header[5] as u32) << 8)
+                    | ((header[6] as u32) << 16)
+                    | ((header[7] as u32) << 24);
+                let _xfl = header[8];
+                r.part.header.operating_system = header[9];
+                r.part.state = GzHeaderParsingState::Xlen;
+            }
+            GzHeaderParsingState::Xlen => {
+                if r.part.flg & FEXTRA != 0 {
+                    r.part.xlen = read_le_u16(r)?;
+                }
+                r.part.state = GzHeaderParsingState::Extra;
+            }
+            GzHeaderParsingState::Extra => {
+                if r.part.flg & FEXTRA != 0 {
+                    let mut extra = vec![0; r.part.xlen as usize];
+                    r.read_and_forget(&mut extra)?;
+                    r.part.header.extra = Some(extra);
+                }
+                r.part.state = GzHeaderParsingState::Filename;
+            }
+            GzHeaderParsingState::Filename => {
+                if r.part.flg & FNAME != 0 {
+                    if None == r.part.header.filename {
+                        r.part.header.filename = Some(Vec::new());
+                    };
+                    for byte in r.bytes() {
+                        let byte = byte?;
+                        if byte == 0 {
+                            break;
+                        }
+                    }
+                }
+                r.part.state = GzHeaderParsingState::Comment;
+            }
+            GzHeaderParsingState::Comment => {
+                if r.part.flg & FCOMMENT != 0 {
+                    if None == r.part.header.comment {
+                        r.part.header.comment = Some(Vec::new());
+                    };
+                    for byte in r.bytes() {
+                        let byte = byte?;
+                        if byte == 0 {
+                            break;
+                        }
+                    }
+                }
+                r.part.state = GzHeaderParsingState::Crc;
+            }
+            GzHeaderParsingState::Crc => {
+                if r.part.flg & FHCRC != 0 {
+                    let stored_crc = read_le_u16(r)?;
+                    let calced_crc = r.part.crc.sum() as u16;
+                    if stored_crc != calced_crc {
+                        return Err(corrupt());
+                    }
+                }
+                return Ok(());
+            }
+        }
+    }
+}
+
+pub(crate) fn read_gz_header<R: Read>(r: &mut R) -> io::Result<GzHeader> {
+    let mut part = GzHeaderPartial::new();
+
+    let result = {
+        let mut reader = Buffer::new(&mut part, r);
+        read_gz_header_part(&mut reader)
+    };
+    result.map(|()| part.take_header())
+}
+
+/// A gzip streaming encoder
+///
+/// This structure exposes a [`BufRead`] interface that will read uncompressed data
+/// from the underlying reader and expose the compressed version as a [`BufRead`]
+/// interface.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// use flate2::Compression;
+/// use flate2::bufread::GzEncoder;
+/// use std::fs::File;
+/// use std::io::BufReader;
+///
+/// // Opens sample file, compresses the contents and returns a Vector or error
+/// // File wrapped in a BufReader implements BufRead
+///
+/// fn open_hello_world() -> io::Result<Vec<u8>> {
+///     let f = File::open("examples/hello_world.txt")?;
+///     let b = BufReader::new(f);
+///     let mut gz = GzEncoder::new(b, Compression::fast());
+///     let mut buffer = Vec::new();
+///     gz.read_to_end(&mut buffer)?;
+///     Ok(buffer)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct GzEncoder<R> {
+    inner: deflate::bufread::DeflateEncoder<CrcReader<R>>,
+    header: Vec<u8>,
+    pos: usize,
+    eof: bool,
+}
+
+pub fn gz_encoder<R: BufRead>(header: Vec<u8>, r: R, lvl: Compression) -> GzEncoder<R> {
+    let crc = CrcReader::new(r);
+    GzEncoder {
+        inner: deflate::bufread::DeflateEncoder::new(crc, lvl),
+        header,
+        pos: 0,
+        eof: false,
+    }
+}
+
+impl<R: BufRead> GzEncoder<R> {
+    /// Creates a new encoder which will use the given compression level.
+    ///
+    /// The encoder is not configured specially for the emitted header. For
+    /// header configuration, see the `GzBuilder` type.
+    ///
+    /// The data read from the stream `r` will be compressed and available
+    /// through the returned reader.
+    pub fn new(r: R, level: Compression) -> GzEncoder<R> {
+        GzBuilder::new().buf_read(r, level)
+    }
+
+    fn read_footer(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        if self.pos == 8 {
+            return Ok(0);
+        }
+        let crc = self.inner.get_ref().crc();
+        let ref arr = [
+            (crc.sum() >> 0) as u8,
+            (crc.sum() >> 8) as u8,
+            (crc.sum() >> 16) as u8,
+            (crc.sum() >> 24) as u8,
+            (crc.amount() >> 0) as u8,
+            (crc.amount() >> 8) as u8,
+            (crc.amount() >> 16) as u8,
+            (crc.amount() >> 24) as u8,
+        ];
+        Ok(copy(into, arr, &mut self.pos))
+    }
+}
+
+impl<R> GzEncoder<R> {
+    /// Acquires a reference to the underlying reader.
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying reader.
+    ///
+    /// Note that mutation of the reader may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Returns the underlying stream, consuming this encoder
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+}
+
+#[inline]
+fn finish(buf: &[u8; 8]) -> (u32, u32) {
+    let crc = ((buf[0] as u32) << 0)
+        | ((buf[1] as u32) << 8)
+        | ((buf[2] as u32) << 16)
+        | ((buf[3] as u32) << 24);
+    let amt = ((buf[4] as u32) << 0)
+        | ((buf[5] as u32) << 8)
+        | ((buf[6] as u32) << 16)
+        | ((buf[7] as u32) << 24);
+    (crc, amt)
+}
+
+impl<R: BufRead> Read for GzEncoder<R> {
+    fn read(&mut self, mut into: &mut [u8]) -> io::Result<usize> {
+        let mut amt = 0;
+        if self.eof {
+            return self.read_footer(into);
+        } else if self.pos < self.header.len() {
+            amt += copy(into, &self.header, &mut self.pos);
+            if amt == into.len() {
+                return Ok(amt);
+            }
+            let tmp = into;
+            into = &mut tmp[amt..];
+        }
+        match self.inner.read(into)? {
+            0 => {
+                self.eof = true;
+                self.pos = 0;
+                self.read_footer(into)
+            }
+            n => Ok(amt + n),
+        }
+    }
+}
+
+impl<R: BufRead + Write> Write for GzEncoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A gzip streaming decoder
+///
+/// This structure consumes a [`BufRead`] interface, reading compressed data
+/// from the underlying reader, and emitting uncompressed data.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::GzEncoder;
+/// use flate2::bufread::GzDecoder;
+///
+/// # fn main() {
+/// #   let mut e = GzEncoder::new(Vec::new(), Compression::default());
+/// #   e.write_all(b"Hello World").unwrap();
+/// #   let bytes = e.finish().unwrap();
+/// #   println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Gz Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements BufRead
+///
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut gz = GzDecoder::new(&bytes[..]);
+///    let mut s = String::new();
+///    gz.read_to_string(&mut s)?;
+///    Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct GzDecoder<R> {
+    inner: GzState,
+    header: Option<GzHeader>,
+    reader: CrcReader<deflate::bufread::DeflateDecoder<R>>,
+    multi: bool,
+}
+
+#[derive(Debug)]
+pub enum GzHeaderParsingState {
+    Start,
+    Xlen,
+    Extra,
+    Filename,
+    Comment,
+    Crc,
+}
+
+#[derive(Debug)]
+pub struct GzHeaderPartial {
+    buf: Vec<u8>,
+    state: GzHeaderParsingState,
+    flg: u8,
+    xlen: u16,
+    crc: Crc,
+    header: GzHeader,
+}
+
+impl GzHeaderPartial {
+    fn new() -> GzHeaderPartial {
+        GzHeaderPartial {
+            buf: Vec::with_capacity(10), // minimum header length
+            state: GzHeaderParsingState::Start,
+            flg: 0,
+            xlen: 0,
+            crc: Crc::new(),
+            header: GzHeader {
+                extra: None,
+                filename: None,
+                comment: None,
+                operating_system: 0,
+                mtime: 0,
+            },
+        }
+    }
+
+    pub fn take_header(self) -> GzHeader {
+        self.header
+    }
+}
+
+#[derive(Debug)]
+enum GzState {
+    Header(GzHeaderPartial),
+    Body,
+    Finished(usize, [u8; 8]),
+    Err(io::Error),
+    End,
+}
+
+/// A small adapter which reads data originally from `buf` and then reads all
+/// further data from `reader`. This will also buffer all data read from
+/// `reader` into `buf` for reuse on a further call.
+struct Buffer<'a, T: 'a> {
+    part: &'a mut GzHeaderPartial,
+    buf_cur: usize,
+    buf_max: usize,
+    reader: &'a mut T,
+}
+
+impl<'a, T> Buffer<'a, T> {
+    fn new(part: &'a mut GzHeaderPartial, reader: &'a mut T) -> Buffer<'a, T> {
+        Buffer {
+            reader,
+            buf_cur: 0,
+            buf_max: part.buf.len(),
+            part,
+        }
+    }
+}
+
+impl<'a, T: Read> Read for Buffer<'a, T> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        let mut bufref = match self.part.state {
+            GzHeaderParsingState::Filename => self.part.header.filename.as_mut(),
+            GzHeaderParsingState::Comment => self.part.header.comment.as_mut(),
+            _ => None,
+        };
+        if let Some(ref mut b) = bufref {
+            // we have a direct reference to a buffer where to write
+            let len = self.reader.read(buf)?;
+            if len > 0 && buf[len - 1] == 0 {
+                // we do not append the final 0
+                b.extend_from_slice(&buf[..len - 1]);
+            } else {
+                b.extend_from_slice(&buf[..len]);
+            }
+            self.part.crc.update(&buf[..len]);
+            Ok(len)
+        } else if self.buf_cur == self.buf_max {
+            // we read new bytes and also save them in self.part.buf
+            let len = self.reader.read(buf)?;
+            self.part.buf.extend_from_slice(&buf[..len]);
+            self.part.crc.update(&buf[..len]);
+            Ok(len)
+        } else {
+            // we first read the previously saved bytes
+            let len = (&self.part.buf[self.buf_cur..self.buf_max]).read(buf)?;
+            self.buf_cur += len;
+            Ok(len)
+        }
+    }
+}
+
+impl<'a, T> Buffer<'a, T>
+where
+    T: std::io::Read,
+{
+    // If we manage to read all the bytes, we reset the buffer
+    fn read_and_forget(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.read_exact(buf)?;
+        // we managed to read the whole buf
+        // we will no longer need the previously saved bytes in self.part.buf
+        let rlen = buf.len();
+        self.part.buf.truncate(0);
+        self.buf_cur = 0;
+        self.buf_max = 0;
+        Ok(rlen)
+    }
+}
+
+impl<R: BufRead> GzDecoder<R> {
+    /// Creates a new decoder from the given reader, immediately parsing the
+    /// gzip header.
+    pub fn new(mut r: R) -> GzDecoder<R> {
+        let mut part = GzHeaderPartial::new();
+        let mut header = None;
+
+        let result = {
+            let mut reader = Buffer::new(&mut part, &mut r);
+            read_gz_header_part(&mut reader)
+        };
+
+        let state = match result {
+            Ok(()) => {
+                header = Some(part.take_header());
+                GzState::Body
+            }
+            Err(ref err) if io::ErrorKind::WouldBlock == err.kind() => GzState::Header(part),
+            Err(err) => GzState::Err(err),
+        };
+
+        GzDecoder {
+            inner: state,
+            reader: CrcReader::new(deflate::bufread::DeflateDecoder::new(r)),
+            multi: false,
+            header,
+        }
+    }
+
+    fn multi(mut self, flag: bool) -> GzDecoder<R> {
+        self.multi = flag;
+        self
+    }
+}
+
+impl<R> GzDecoder<R> {
+    /// Returns the header associated with this stream, if it was valid
+    pub fn header(&self) -> Option<&GzHeader> {
+        self.header.as_ref()
+    }
+
+    /// Acquires a reference to the underlying reader.
+    pub fn get_ref(&self) -> &R {
+        self.reader.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream.
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.reader.get_mut().get_mut()
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.reader.into_inner().into_inner()
+    }
+}
+
+impl<R: BufRead> Read for GzDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        let GzDecoder {
+            inner,
+            header,
+            reader,
+            multi,
+        } = self;
+
+        loop {
+            *inner = match mem::replace(inner, GzState::End) {
+                GzState::Header(mut part) => {
+                    let result = {
+                        let mut reader = Buffer::new(&mut part, reader.get_mut().get_mut());
+                        read_gz_header_part(&mut reader)
+                    };
+                    match result {
+                        Ok(()) => {
+                            *header = Some(part.take_header());
+                            GzState::Body
+                        }
+                        Err(err) if io::ErrorKind::WouldBlock == err.kind() => {
+                            *inner = GzState::Header(part);
+                            return Err(err);
+                        }
+                        Err(err) => return Err(err),
+                    }
+                }
+                GzState::Body => {
+                    if into.is_empty() {
+                        *inner = GzState::Body;
+                        return Ok(0);
+                    }
+
+                    let n = reader.read(into).map_err(|err| {
+                        if io::ErrorKind::WouldBlock == err.kind() {
+                            *inner = GzState::Body;
+                        }
+
+                        err
+                    })?;
+
+                    match n {
+                        0 => GzState::Finished(0, [0; 8]),
+                        n => {
+                            *inner = GzState::Body;
+                            return Ok(n);
+                        }
+                    }
+                }
+                GzState::Finished(pos, mut buf) => {
+                    if pos < buf.len() {
+                        let n = reader
+                            .get_mut()
+                            .get_mut()
+                            .read(&mut buf[pos..])
+                            .and_then(|n| {
+                                if n == 0 {
+                                    Err(io::ErrorKind::UnexpectedEof.into())
+                                } else {
+                                    Ok(n)
+                                }
+                            })
+                            .map_err(|err| {
+                                if io::ErrorKind::WouldBlock == err.kind() {
+                                    *inner = GzState::Finished(pos, buf);
+                                }
+
+                                err
+                            })?;
+
+                        GzState::Finished(pos + n, buf)
+                    } else {
+                        let (crc, amt) = finish(&buf);
+
+                        if crc != reader.crc().sum() || amt != reader.crc().amount() {
+                            return Err(corrupt());
+                        } else if *multi {
+                            let is_eof = reader
+                                .get_mut()
+                                .get_mut()
+                                .fill_buf()
+                                .map(|buf| buf.is_empty())
+                                .map_err(|err| {
+                                    if io::ErrorKind::WouldBlock == err.kind() {
+                                        *inner = GzState::Finished(pos, buf);
+                                    }
+
+                                    err
+                                })?;
+
+                            if is_eof {
+                                GzState::End
+                            } else {
+                                reader.reset();
+                                reader.get_mut().reset_data();
+                                header.take();
+                                GzState::Header(GzHeaderPartial::new())
+                            }
+                        } else {
+                            GzState::End
+                        }
+                    }
+                }
+                GzState::Err(err) => return Err(err),
+                GzState::End => return Ok(0),
+            };
+        }
+    }
+}
+
+impl<R: BufRead + Write> Write for GzDecoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A gzip streaming decoder that decodes all members of a multistream
+///
+/// A gzip member consists of a header, compressed data and a trailer. The [gzip
+/// specification](https://tools.ietf.org/html/rfc1952), however, allows multiple
+/// gzip members to be joined in a single stream. `MultiGzDecoder` will
+/// decode all consecutive members while `GzDecoder` will only decompress
+/// the first gzip member. The multistream format is commonly used in
+/// bioinformatics, for example when using the BGZF compressed data.
+///
+/// This structure exposes a [`BufRead`] interface that will consume all gzip members
+/// from the underlying reader and emit uncompressed data.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::GzEncoder;
+/// use flate2::bufread::MultiGzDecoder;
+///
+/// # fn main() {
+/// #   let mut e = GzEncoder::new(Vec::new(), Compression::default());
+/// #   e.write_all(b"Hello World").unwrap();
+/// #   let bytes = e.finish().unwrap();
+/// #   println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Gz Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements BufRead
+///
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut gz = MultiGzDecoder::new(&bytes[..]);
+///    let mut s = String::new();
+///    gz.read_to_string(&mut s)?;
+///    Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct MultiGzDecoder<R>(GzDecoder<R>);
+
+impl<R: BufRead> MultiGzDecoder<R> {
+    /// Creates a new decoder from the given reader, immediately parsing the
+    /// (first) gzip header. If the gzip stream contains multiple members all will
+    /// be decoded.
+    pub fn new(r: R) -> MultiGzDecoder<R> {
+        MultiGzDecoder(GzDecoder::new(r).multi(true))
+    }
+}
+
+impl<R> MultiGzDecoder<R> {
+    /// Returns the current header associated with this stream, if it's valid
+    pub fn header(&self) -> Option<&GzHeader> {
+        self.0.header()
+    }
+
+    /// Acquires a reference to the underlying reader.
+    pub fn get_ref(&self) -> &R {
+        self.0.get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream.
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.0.get_mut()
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.0.into_inner()
+    }
+}
+
+impl<R: BufRead> Read for MultiGzDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        self.0.read(into)
+    }
+}
+
+#[cfg(test)]
+pub mod tests {
+    use crate::gz::bufread::*;
+    use std::io;
+    use std::io::{Cursor, Read, Write};
+
+    //a cursor turning EOF into blocking errors
+    #[derive(Debug)]
+    pub struct BlockingCursor {
+        pub cursor: Cursor<Vec<u8>>,
+    }
+
+    impl BlockingCursor {
+        pub fn new() -> BlockingCursor {
+            BlockingCursor {
+                cursor: Cursor::new(Vec::new()),
+            }
+        }
+
+        pub fn set_position(&mut self, pos: u64) {
+            return self.cursor.set_position(pos);
+        }
+
+        pub fn position(&mut self) -> u64 {
+            return self.cursor.position();
+        }
+    }
+
+    impl Write for BlockingCursor {
+        fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+            return self.cursor.write(buf);
+        }
+        fn flush(&mut self) -> io::Result<()> {
+            return self.cursor.flush();
+        }
+    }
+
+    impl Read for BlockingCursor {
+        fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+            //use the cursor, except it turns eof into blocking error
+            let r = self.cursor.read(buf);
+            match r {
+                Err(ref err) => {
+                    if err.kind() == io::ErrorKind::UnexpectedEof {
+                        return Err(io::ErrorKind::WouldBlock.into());
+                    }
+                }
+                Ok(0) => {
+                    //regular EOF turned into blocking error
+                    return Err(io::ErrorKind::WouldBlock.into());
+                }
+                Ok(_n) => {}
+            }
+            return r;
+        }
+    }
+    #[test]
+    // test function read_and_forget of Buffer
+    fn buffer_read_and_forget() {
+        // this is unused except for the buffering
+        let mut part = GzHeaderPartial::new();
+        // this is a reader which receives data afterwards
+        let mut r = BlockingCursor::new();
+        let data = vec![1, 2, 3];
+        let mut out = Vec::with_capacity(7);
+
+        match r.write_all(&data) {
+            Ok(()) => {}
+            _ => {
+                panic!("Unexpected result for write_all");
+            }
+        }
+        r.set_position(0);
+
+        // First read : successful for one byte
+        let mut reader = Buffer::new(&mut part, &mut r);
+        out.resize(1, 0);
+        match reader.read_and_forget(&mut out) {
+            Ok(1) => {}
+            _ => {
+                panic!("Unexpected result for read_and_forget with data");
+            }
+        }
+
+        // Second read : incomplete for 7 bytes (we have only 2)
+        out.resize(7, 0);
+        match reader.read_and_forget(&mut out) {
+            Err(ref err) => {
+                assert_eq!(io::ErrorKind::WouldBlock, err.kind());
+            }
+            _ => {
+                panic!("Unexpected result for read_and_forget with incomplete");
+            }
+        }
+
+        // 3 more data bytes have arrived
+        let pos = r.position();
+        let data2 = vec![4, 5, 6];
+        match r.write_all(&data2) {
+            Ok(()) => {}
+            _ => {
+                panic!("Unexpected result for write_all");
+            }
+        }
+        r.set_position(pos);
+
+        // Third read : still incomplete for 7 bytes (we have 5)
+        let mut reader2 = Buffer::new(&mut part, &mut r);
+        match reader2.read_and_forget(&mut out) {
+            Err(ref err) => {
+                assert_eq!(io::ErrorKind::WouldBlock, err.kind());
+            }
+            _ => {
+                panic!("Unexpected result for read_and_forget with more incomplete");
+            }
+        }
+
+        // 3 more data bytes have arrived again
+        let pos2 = r.position();
+        let data3 = vec![7, 8, 9];
+        match r.write_all(&data3) {
+            Ok(()) => {}
+            _ => {
+                panic!("Unexpected result for write_all");
+            }
+        }
+        r.set_position(pos2);
+
+        // Fourth read : now successful for 7 bytes
+        let mut reader3 = Buffer::new(&mut part, &mut r);
+        match reader3.read_and_forget(&mut out) {
+            Ok(7) => {
+                assert_eq!(out[0], 2);
+                assert_eq!(out[6], 8);
+            }
+            _ => {
+                panic!("Unexpected result for read_and_forget with data");
+            }
+        }
+
+        // Fifth read : successful for one more byte
+        out.resize(1, 0);
+        match reader3.read_and_forget(&mut out) {
+            Ok(1) => {
+                assert_eq!(out[0], 9);
+            }
+            _ => {
+                panic!("Unexpected result for read_and_forget with data");
+            }
+        }
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/gz/mod.rs b/android/vendor/flate2-1.0.24/src/gz/mod.rs
new file mode 100644
index 0000000..505450e
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/gz/mod.rs
@@ -0,0 +1,385 @@
+use std::ffi::CString;
+use std::io::prelude::*;
+use std::time;
+
+use crate::bufreader::BufReader;
+use crate::Compression;
+
+pub static FHCRC: u8 = 1 << 1;
+pub static FEXTRA: u8 = 1 << 2;
+pub static FNAME: u8 = 1 << 3;
+pub static FCOMMENT: u8 = 1 << 4;
+
+pub mod bufread;
+pub mod read;
+pub mod write;
+
+/// A structure representing the header of a gzip stream.
+///
+/// The header can contain metadata about the file that was compressed, if
+/// present.
+#[derive(PartialEq, Clone, Debug, Default)]
+pub struct GzHeader {
+    extra: Option<Vec<u8>>,
+    filename: Option<Vec<u8>>,
+    comment: Option<Vec<u8>>,
+    operating_system: u8,
+    mtime: u32,
+}
+
+impl GzHeader {
+    /// Returns the `filename` field of this gzip stream's header, if present.
+    pub fn filename(&self) -> Option<&[u8]> {
+        self.filename.as_ref().map(|s| &s[..])
+    }
+
+    /// Returns the `extra` field of this gzip stream's header, if present.
+    pub fn extra(&self) -> Option<&[u8]> {
+        self.extra.as_ref().map(|s| &s[..])
+    }
+
+    /// Returns the `comment` field of this gzip stream's header, if present.
+    pub fn comment(&self) -> Option<&[u8]> {
+        self.comment.as_ref().map(|s| &s[..])
+    }
+
+    /// Returns the `operating_system` field of this gzip stream's header.
+    ///
+    /// There are predefined values for various operating systems.
+    /// 255 means that the value is unknown.
+    pub fn operating_system(&self) -> u8 {
+        self.operating_system
+    }
+
+    /// This gives the most recent modification time of the original file being compressed.
+    ///
+    /// The time is in Unix format, i.e., seconds since 00:00:00 GMT, Jan. 1, 1970.
+    /// (Note that this may cause problems for MS-DOS and other systems that use local
+    /// rather than Universal time.) If the compressed data did not come from a file,
+    /// `mtime` is set to the time at which compression started.
+    /// `mtime` = 0 means no time stamp is available.
+    ///
+    /// The usage of `mtime` is discouraged because of Year 2038 problem.
+    pub fn mtime(&self) -> u32 {
+        self.mtime
+    }
+
+    /// Returns the most recent modification time represented by a date-time type.
+    /// Returns `None` if the value of the underlying counter is 0,
+    /// indicating no time stamp is available.
+    ///
+    ///
+    /// The time is measured as seconds since 00:00:00 GMT, Jan. 1 1970.
+    /// See [`mtime`](#method.mtime) for more detail.
+    pub fn mtime_as_datetime(&self) -> Option<time::SystemTime> {
+        if self.mtime == 0 {
+            None
+        } else {
+            let duration = time::Duration::new(u64::from(self.mtime), 0);
+            let datetime = time::UNIX_EPOCH + duration;
+            Some(datetime)
+        }
+    }
+}
+
+/// A builder structure to create a new gzip Encoder.
+///
+/// This structure controls header configuration options such as the filename.
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// # use std::io;
+/// use std::fs::File;
+/// use flate2::GzBuilder;
+/// use flate2::Compression;
+///
+/// // GzBuilder opens a file and writes a sample string using GzBuilder pattern
+///
+/// # fn sample_builder() -> Result<(), io::Error> {
+/// let f = File::create("examples/hello_world.gz")?;
+/// let mut gz = GzBuilder::new()
+///                 .filename("hello_world.txt")
+///                 .comment("test file, please delete")
+///                 .write(f, Compression::default());
+/// gz.write_all(b"hello world")?;
+/// gz.finish()?;
+/// # Ok(())
+/// # }
+/// ```
+#[derive(Debug)]
+pub struct GzBuilder {
+    extra: Option<Vec<u8>>,
+    filename: Option<CString>,
+    comment: Option<CString>,
+    operating_system: Option<u8>,
+    mtime: u32,
+}
+
+impl Default for GzBuilder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl GzBuilder {
+    /// Create a new blank builder with no header by default.
+    pub fn new() -> GzBuilder {
+        GzBuilder {
+            extra: None,
+            filename: None,
+            comment: None,
+            operating_system: None,
+            mtime: 0,
+        }
+    }
+
+    /// Configure the `mtime` field in the gzip header.
+    pub fn mtime(mut self, mtime: u32) -> GzBuilder {
+        self.mtime = mtime;
+        self
+    }
+
+    /// Configure the `operating_system` field in the gzip header.
+    pub fn operating_system(mut self, os: u8) -> GzBuilder {
+        self.operating_system = Some(os);
+        self
+    }
+
+    /// Configure the `extra` field in the gzip header.
+    pub fn extra<T: Into<Vec<u8>>>(mut self, extra: T) -> GzBuilder {
+        self.extra = Some(extra.into());
+        self
+    }
+
+    /// Configure the `filename` field in the gzip header.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the `filename` slice contains a zero.
+    pub fn filename<T: Into<Vec<u8>>>(mut self, filename: T) -> GzBuilder {
+        self.filename = Some(CString::new(filename.into()).unwrap());
+        self
+    }
+
+    /// Configure the `comment` field in the gzip header.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the `comment` slice contains a zero.
+    pub fn comment<T: Into<Vec<u8>>>(mut self, comment: T) -> GzBuilder {
+        self.comment = Some(CString::new(comment.into()).unwrap());
+        self
+    }
+
+    /// Consume this builder, creating a writer encoder in the process.
+    ///
+    /// The data written to the returned encoder will be compressed and then
+    /// written out to the supplied parameter `w`.
+    pub fn write<W: Write>(self, w: W, lvl: Compression) -> write::GzEncoder<W> {
+        write::gz_encoder(self.into_header(lvl), w, lvl)
+    }
+
+    /// Consume this builder, creating a reader encoder in the process.
+    ///
+    /// Data read from the returned encoder will be the compressed version of
+    /// the data read from the given reader.
+    pub fn read<R: Read>(self, r: R, lvl: Compression) -> read::GzEncoder<R> {
+        read::gz_encoder(self.buf_read(BufReader::new(r), lvl))
+    }
+
+    /// Consume this builder, creating a reader encoder in the process.
+    ///
+    /// Data read from the returned encoder will be the compressed version of
+    /// the data read from the given reader.
+    pub fn buf_read<R>(self, r: R, lvl: Compression) -> bufread::GzEncoder<R>
+    where
+        R: BufRead,
+    {
+        bufread::gz_encoder(self.into_header(lvl), r, lvl)
+    }
+
+    fn into_header(self, lvl: Compression) -> Vec<u8> {
+        let GzBuilder {
+            extra,
+            filename,
+            comment,
+            operating_system,
+            mtime,
+        } = self;
+        let mut flg = 0;
+        let mut header = vec![0u8; 10];
+        if let Some(v) = extra {
+            flg |= FEXTRA;
+            header.push((v.len() >> 0) as u8);
+            header.push((v.len() >> 8) as u8);
+            header.extend(v);
+        }
+        if let Some(filename) = filename {
+            flg |= FNAME;
+            header.extend(filename.as_bytes_with_nul().iter().map(|x| *x));
+        }
+        if let Some(comment) = comment {
+            flg |= FCOMMENT;
+            header.extend(comment.as_bytes_with_nul().iter().map(|x| *x));
+        }
+        header[0] = 0x1f;
+        header[1] = 0x8b;
+        header[2] = 8;
+        header[3] = flg;
+        header[4] = (mtime >> 0) as u8;
+        header[5] = (mtime >> 8) as u8;
+        header[6] = (mtime >> 16) as u8;
+        header[7] = (mtime >> 24) as u8;
+        header[8] = if lvl.0 >= Compression::best().0 {
+            2
+        } else if lvl.0 <= Compression::fast().0 {
+            4
+        } else {
+            0
+        };
+
+        // Typically this byte indicates what OS the gz stream was created on,
+        // but in an effort to have cross-platform reproducible streams just
+        // default this value to 255. I'm not sure that if we "correctly" set
+        // this it'd do anything anyway...
+        header[9] = operating_system.unwrap_or(255);
+        header
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use std::io::prelude::*;
+
+    use super::{read, write, GzBuilder};
+    use crate::Compression;
+    use rand::{thread_rng, Rng};
+
+    #[test]
+    fn roundtrip() {
+        let mut e = write::GzEncoder::new(Vec::new(), Compression::default());
+        e.write_all(b"foo bar baz").unwrap();
+        let inner = e.finish().unwrap();
+        let mut d = read::GzDecoder::new(&inner[..]);
+        let mut s = String::new();
+        d.read_to_string(&mut s).unwrap();
+        assert_eq!(s, "foo bar baz");
+    }
+
+    #[test]
+    fn roundtrip_zero() {
+        let e = write::GzEncoder::new(Vec::new(), Compression::default());
+        let inner = e.finish().unwrap();
+        let mut d = read::GzDecoder::new(&inner[..]);
+        let mut s = String::new();
+        d.read_to_string(&mut s).unwrap();
+        assert_eq!(s, "");
+    }
+
+    #[test]
+    fn roundtrip_big() {
+        let mut real = Vec::new();
+        let mut w = write::GzEncoder::new(Vec::new(), Compression::default());
+        let v = crate::random_bytes().take(1024).collect::<Vec<_>>();
+        for _ in 0..200 {
+            let to_write = &v[..thread_rng().gen_range(0..v.len())];
+            real.extend(to_write.iter().map(|x| *x));
+            w.write_all(to_write).unwrap();
+        }
+        let result = w.finish().unwrap();
+        let mut r = read::GzDecoder::new(&result[..]);
+        let mut v = Vec::new();
+        r.read_to_end(&mut v).unwrap();
+        assert!(v == real);
+    }
+
+    #[test]
+    fn roundtrip_big2() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut r = read::GzDecoder::new(read::GzEncoder::new(&v[..], Compression::default()));
+        let mut res = Vec::new();
+        r.read_to_end(&mut res).unwrap();
+        assert!(res == v);
+    }
+
+    #[test]
+    fn fields() {
+        let r = vec![0, 2, 4, 6];
+        let e = GzBuilder::new()
+            .filename("foo.rs")
+            .comment("bar")
+            .extra(vec![0, 1, 2, 3])
+            .read(&r[..], Compression::default());
+        let mut d = read::GzDecoder::new(e);
+        assert_eq!(d.header().unwrap().filename(), Some(&b"foo.rs"[..]));
+        assert_eq!(d.header().unwrap().comment(), Some(&b"bar"[..]));
+        assert_eq!(d.header().unwrap().extra(), Some(&b"\x00\x01\x02\x03"[..]));
+        let mut res = Vec::new();
+        d.read_to_end(&mut res).unwrap();
+        assert_eq!(res, vec![0, 2, 4, 6]);
+    }
+
+    #[test]
+    fn keep_reading_after_end() {
+        let mut e = write::GzEncoder::new(Vec::new(), Compression::default());
+        e.write_all(b"foo bar baz").unwrap();
+        let inner = e.finish().unwrap();
+        let mut d = read::GzDecoder::new(&inner[..]);
+        let mut s = String::new();
+        d.read_to_string(&mut s).unwrap();
+        assert_eq!(s, "foo bar baz");
+        d.read_to_string(&mut s).unwrap();
+        assert_eq!(s, "foo bar baz");
+    }
+
+    #[test]
+    fn qc_reader() {
+        ::quickcheck::quickcheck(test as fn(_) -> _);
+
+        fn test(v: Vec<u8>) -> bool {
+            let r = read::GzEncoder::new(&v[..], Compression::default());
+            let mut r = read::GzDecoder::new(r);
+            let mut v2 = Vec::new();
+            r.read_to_end(&mut v2).unwrap();
+            v == v2
+        }
+    }
+
+    #[test]
+    fn flush_after_write() {
+        let mut f = write::GzEncoder::new(Vec::new(), Compression::default());
+        write!(f, "Hello world").unwrap();
+        f.flush().unwrap();
+    }
+
+    use crate::gz::bufread::tests::BlockingCursor;
+    #[test]
+    // test function read_and_forget of Buffer
+    fn blocked_partial_header_read() {
+        // this is a reader which receives data afterwards
+        let mut r = BlockingCursor::new();
+        let data = vec![1, 2, 3];
+
+        match r.write_all(&data) {
+            Ok(()) => {}
+            _ => {
+                panic!("Unexpected result for write_all");
+            }
+        }
+        r.set_position(0);
+
+        // this is unused except for the buffering
+        let mut decoder = read::GzDecoder::new(r);
+        let mut out = Vec::with_capacity(7);
+        match decoder.read(&mut out) {
+            Err(e) => {
+                assert_eq!(e.kind(), std::io::ErrorKind::WouldBlock);
+            }
+            _ => {
+                panic!("Unexpected result for decoder.read");
+            }
+        }
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/gz/read.rs b/android/vendor/flate2-1.0.24/src/gz/read.rs
new file mode 100644
index 0000000..dbbe632
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/gz/read.rs
@@ -0,0 +1,278 @@
+use std::io;
+use std::io::prelude::*;
+
+use super::bufread;
+use super::{GzBuilder, GzHeader};
+use crate::bufreader::BufReader;
+use crate::Compression;
+
+/// A gzip streaming encoder
+///
+/// This structure exposes a [`Read`] interface that will read uncompressed data
+/// from the underlying reader and expose the compressed version as a [`Read`]
+/// interface.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// use flate2::Compression;
+/// use flate2::read::GzEncoder;
+///
+/// // Return a vector containing the GZ compressed version of hello world
+///
+/// fn gzencode_hello_world() -> io::Result<Vec<u8>> {
+///     let mut ret_vec = [0;100];
+///     let bytestring = b"hello world";
+///     let mut gz = GzEncoder::new(&bytestring[..], Compression::fast());
+///     let count = gz.read(&mut ret_vec)?;
+///     Ok(ret_vec[0..count].to_vec())
+/// }
+/// ```
+#[derive(Debug)]
+pub struct GzEncoder<R> {
+    inner: bufread::GzEncoder<BufReader<R>>,
+}
+
+pub fn gz_encoder<R: Read>(inner: bufread::GzEncoder<BufReader<R>>) -> GzEncoder<R> {
+    GzEncoder { inner }
+}
+
+impl<R: Read> GzEncoder<R> {
+    /// Creates a new encoder which will use the given compression level.
+    ///
+    /// The encoder is not configured specially for the emitted header. For
+    /// header configuration, see the `GzBuilder` type.
+    ///
+    /// The data read from the stream `r` will be compressed and available
+    /// through the returned reader.
+    pub fn new(r: R, level: Compression) -> GzEncoder<R> {
+        GzBuilder::new().read(r, level)
+    }
+}
+
+impl<R> GzEncoder<R> {
+    /// Acquires a reference to the underlying reader.
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying reader.
+    ///
+    /// Note that mutation of the reader may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Returns the underlying stream, consuming this encoder
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+}
+
+impl<R: Read> Read for GzEncoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(into)
+    }
+}
+
+impl<R: Read + Write> Write for GzEncoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A gzip streaming decoder
+///
+/// This structure exposes a [`Read`] interface that will consume compressed
+/// data from the underlying reader and emit uncompressed data.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+///
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::GzEncoder;
+/// use flate2::read::GzDecoder;
+///
+/// # fn main() {
+/// #    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+/// #    e.write_all(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Gz Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements Read
+///
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut gz = GzDecoder::new(&bytes[..]);
+///    let mut s = String::new();
+///    gz.read_to_string(&mut s)?;
+///    Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct GzDecoder<R> {
+    inner: bufread::GzDecoder<BufReader<R>>,
+}
+
+impl<R: Read> GzDecoder<R> {
+    /// Creates a new decoder from the given reader, immediately parsing the
+    /// gzip header.
+    pub fn new(r: R) -> GzDecoder<R> {
+        GzDecoder {
+            inner: bufread::GzDecoder::new(BufReader::new(r)),
+        }
+    }
+}
+
+impl<R> GzDecoder<R> {
+    /// Returns the header associated with this stream, if it was valid.
+    pub fn header(&self) -> Option<&GzHeader> {
+        self.inner.header()
+    }
+
+    /// Acquires a reference to the underlying reader.
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream.
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+}
+
+impl<R: Read> Read for GzDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(into)
+    }
+}
+
+impl<R: Read + Write> Write for GzDecoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A gzip streaming decoder that decodes all members of a multistream
+///
+/// A gzip member consists of a header, compressed data and a trailer. The [gzip
+/// specification](https://tools.ietf.org/html/rfc1952), however, allows multiple
+/// gzip members to be joined in a single stream.  `MultiGzDecoder` will
+/// decode all consecutive members while `GzDecoder` will only decompress the
+/// first gzip member. The multistream format is commonly used in bioinformatics,
+/// for example when using the BGZF compressed data.
+///
+/// This structure exposes a [`Read`] interface that will consume all gzip members
+/// from the underlying reader and emit uncompressed data.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::GzEncoder;
+/// use flate2::read::MultiGzDecoder;
+///
+/// # fn main() {
+/// #    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+/// #    e.write_all(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Gz Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements Read
+///
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut gz = MultiGzDecoder::new(&bytes[..]);
+///    let mut s = String::new();
+///    gz.read_to_string(&mut s)?;
+///    Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct MultiGzDecoder<R> {
+    inner: bufread::MultiGzDecoder<BufReader<R>>,
+}
+
+impl<R: Read> MultiGzDecoder<R> {
+    /// Creates a new decoder from the given reader, immediately parsing the
+    /// (first) gzip header. If the gzip stream contains multiple members all will
+    /// be decoded.
+    pub fn new(r: R) -> MultiGzDecoder<R> {
+        MultiGzDecoder {
+            inner: bufread::MultiGzDecoder::new(BufReader::new(r)),
+        }
+    }
+}
+
+impl<R> MultiGzDecoder<R> {
+    /// Returns the current header associated with this stream, if it's valid.
+    pub fn header(&self) -> Option<&GzHeader> {
+        self.inner.header()
+    }
+
+    /// Acquires a reference to the underlying reader.
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream.
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+}
+
+impl<R: Read> Read for MultiGzDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(into)
+    }
+}
+
+impl<R: Read + Write> Write for MultiGzDecoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/gz/write.rs b/android/vendor/flate2-1.0.24/src/gz/write.rs
new file mode 100644
index 0000000..7cf1a7c
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/gz/write.rs
@@ -0,0 +1,450 @@
+use std::cmp;
+use std::io;
+use std::io::prelude::*;
+
+use super::bufread::{corrupt, read_gz_header};
+use super::{GzBuilder, GzHeader};
+use crate::crc::{Crc, CrcWriter};
+use crate::zio;
+use crate::{Compress, Compression, Decompress, Status};
+
+/// A gzip streaming encoder
+///
+/// This structure exposes a [`Write`] interface that will emit compressed data
+/// to the underlying writer `W`.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use flate2::Compression;
+/// use flate2::write::GzEncoder;
+///
+/// // Vec<u8> implements Write to print the compressed bytes of sample string
+/// # fn main() {
+///
+/// let mut e = GzEncoder::new(Vec::new(), Compression::default());
+/// e.write_all(b"Hello World").unwrap();
+/// println!("{:?}", e.finish().unwrap());
+/// # }
+/// ```
+#[derive(Debug)]
+pub struct GzEncoder<W: Write> {
+    inner: zio::Writer<W, Compress>,
+    crc: Crc,
+    crc_bytes_written: usize,
+    header: Vec<u8>,
+}
+
+pub fn gz_encoder<W: Write>(header: Vec<u8>, w: W, lvl: Compression) -> GzEncoder<W> {
+    GzEncoder {
+        inner: zio::Writer::new(w, Compress::new(lvl, false)),
+        crc: Crc::new(),
+        header,
+        crc_bytes_written: 0,
+    }
+}
+
+impl<W: Write> GzEncoder<W> {
+    /// Creates a new encoder which will use the given compression level.
+    ///
+    /// The encoder is not configured specially for the emitted header. For
+    /// header configuration, see the `GzBuilder` type.
+    ///
+    /// The data written to the returned encoder will be compressed and then
+    /// written to the stream `w`.
+    pub fn new(w: W, level: Compression) -> GzEncoder<W> {
+        GzBuilder::new().write(w, level)
+    }
+
+    /// Acquires a reference to the underlying writer.
+    pub fn get_ref(&self) -> &W {
+        self.inner.get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying writer.
+    ///
+    /// Note that mutation of the writer may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut W {
+        self.inner.get_mut()
+    }
+
+    /// Attempt to finish this output stream, writing out final chunks of data.
+    ///
+    /// Note that this function can only be used once data has finished being
+    /// written to the output stream. After this function is called then further
+    /// calls to `write` may result in a panic.
+    ///
+    /// # Panics
+    ///
+    /// Attempts to write data to this stream may result in a panic after this
+    /// function is called.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn try_finish(&mut self) -> io::Result<()> {
+        self.write_header()?;
+        self.inner.finish()?;
+
+        while self.crc_bytes_written < 8 {
+            let (sum, amt) = (self.crc.sum() as u32, self.crc.amount());
+            let buf = [
+                (sum >> 0) as u8,
+                (sum >> 8) as u8,
+                (sum >> 16) as u8,
+                (sum >> 24) as u8,
+                (amt >> 0) as u8,
+                (amt >> 8) as u8,
+                (amt >> 16) as u8,
+                (amt >> 24) as u8,
+            ];
+            let inner = self.inner.get_mut();
+            let n = inner.write(&buf[self.crc_bytes_written..])?;
+            self.crc_bytes_written += n;
+        }
+        Ok(())
+    }
+
+    /// Finish encoding this stream, returning the underlying writer once the
+    /// encoding is done.
+    ///
+    /// Note that this function may not be suitable to call in a situation where
+    /// the underlying stream is an asynchronous I/O stream. To finish a stream
+    /// the `try_finish` (or `shutdown`) method should be used instead. To
+    /// re-acquire ownership of a stream it is safe to call this method after
+    /// `try_finish` or `shutdown` has returned `Ok`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn finish(mut self) -> io::Result<W> {
+        self.try_finish()?;
+        Ok(self.inner.take_inner())
+    }
+
+    fn write_header(&mut self) -> io::Result<()> {
+        while !self.header.is_empty() {
+            let n = self.inner.get_mut().write(&self.header)?;
+            self.header.drain(..n);
+        }
+        Ok(())
+    }
+}
+
+impl<W: Write> Write for GzEncoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        assert_eq!(self.crc_bytes_written, 0);
+        self.write_header()?;
+        let n = self.inner.write(buf)?;
+        self.crc.update(&buf[..n]);
+        Ok(n)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        assert_eq!(self.crc_bytes_written, 0);
+        self.write_header()?;
+        self.inner.flush()
+    }
+}
+
+impl<R: Read + Write> Read for GzEncoder<R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.get_mut().read(buf)
+    }
+}
+
+impl<W: Write> Drop for GzEncoder<W> {
+    fn drop(&mut self) {
+        if self.inner.is_present() {
+            let _ = self.try_finish();
+        }
+    }
+}
+
+/// A gzip streaming decoder
+///
+/// This structure exposes a [`Write`] interface that will emit compressed data
+/// to the underlying writer `W`.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// use flate2::Compression;
+/// use flate2::write::{GzEncoder, GzDecoder};
+///
+/// # fn main() {
+/// #    let mut e = GzEncoder::new(Vec::new(), Compression::default());
+/// #    e.write(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    assert_eq!("Hello World", decode_writer(bytes).unwrap());
+/// # }
+/// // Uncompresses a gzip encoded vector of bytes and returns a string or error
+/// // Here Vec<u8> implements Write
+/// fn decode_writer(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut writer = Vec::new();
+///    let mut decoder = GzDecoder::new(writer);
+///    decoder.write_all(&bytes[..])?;
+///    writer = decoder.finish()?;
+///    let return_string = String::from_utf8(writer).expect("String parsing error");
+///    Ok(return_string)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct GzDecoder<W: Write> {
+    inner: zio::Writer<CrcWriter<W>, Decompress>,
+    crc_bytes: Vec<u8>,
+    header: Option<GzHeader>,
+    header_buf: Vec<u8>,
+}
+
+const CRC_BYTES_LEN: usize = 8;
+
+impl<W: Write> GzDecoder<W> {
+    /// Creates a new decoder which will write uncompressed data to the stream.
+    ///
+    /// When this encoder is dropped or unwrapped the final pieces of data will
+    /// be flushed.
+    pub fn new(w: W) -> GzDecoder<W> {
+        GzDecoder {
+            inner: zio::Writer::new(CrcWriter::new(w), Decompress::new(false)),
+            crc_bytes: Vec::with_capacity(CRC_BYTES_LEN),
+            header: None,
+            header_buf: Vec::new(),
+        }
+    }
+
+    /// Returns the header associated with this stream.
+    pub fn header(&self) -> Option<&GzHeader> {
+        self.header.as_ref()
+    }
+
+    /// Acquires a reference to the underlying writer.
+    pub fn get_ref(&self) -> &W {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying writer.
+    ///
+    /// Note that mutating the output/input state of the stream may corrupt this
+    /// object, so care must be taken when using this method.
+    pub fn get_mut(&mut self) -> &mut W {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Attempt to finish this output stream, writing out final chunks of data.
+    ///
+    /// Note that this function can only be used once data has finished being
+    /// written to the output stream. After this function is called then further
+    /// calls to `write` may result in a panic.
+    ///
+    /// # Panics
+    ///
+    /// Attempts to write data to this stream may result in a panic after this
+    /// function is called.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to finish the stream, returning any
+    /// errors which happen.
+    pub fn try_finish(&mut self) -> io::Result<()> {
+        self.finish_and_check_crc()?;
+        Ok(())
+    }
+
+    /// Consumes this decoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream and then return the contained
+    /// writer if the flush succeeded.
+    ///
+    /// Note that this function may not be suitable to call in a situation where
+    /// the underlying stream is an asynchronous I/O stream. To finish a stream
+    /// the `try_finish` (or `shutdown`) method should be used instead. To
+    /// re-acquire ownership of a stream it is safe to call this method after
+    /// `try_finish` or `shutdown` has returned `Ok`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn finish(mut self) -> io::Result<W> {
+        self.finish_and_check_crc()?;
+        Ok(self.inner.take_inner().into_inner())
+    }
+
+    fn finish_and_check_crc(&mut self) -> io::Result<()> {
+        self.inner.finish()?;
+
+        if self.crc_bytes.len() != 8 {
+            return Err(corrupt());
+        }
+
+        let crc = ((self.crc_bytes[0] as u32) << 0)
+            | ((self.crc_bytes[1] as u32) << 8)
+            | ((self.crc_bytes[2] as u32) << 16)
+            | ((self.crc_bytes[3] as u32) << 24);
+        let amt = ((self.crc_bytes[4] as u32) << 0)
+            | ((self.crc_bytes[5] as u32) << 8)
+            | ((self.crc_bytes[6] as u32) << 16)
+            | ((self.crc_bytes[7] as u32) << 24);
+        if crc != self.inner.get_ref().crc().sum() as u32 {
+            return Err(corrupt());
+        }
+        if amt != self.inner.get_ref().crc().amount() {
+            return Err(corrupt());
+        }
+        Ok(())
+    }
+}
+
+struct Counter<T: Read> {
+    inner: T,
+    pos: usize,
+}
+
+impl<T: Read> Read for Counter<T> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        let pos = self.inner.read(buf)?;
+        self.pos += pos;
+        Ok(pos)
+    }
+}
+
+impl<W: Write> Write for GzDecoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        if self.header.is_none() {
+            // trying to avoid buffer usage
+            let (res, pos) = {
+                let mut counter = Counter {
+                    inner: self.header_buf.chain(buf),
+                    pos: 0,
+                };
+                let res = read_gz_header(&mut counter);
+                (res, counter.pos)
+            };
+
+            match res {
+                Err(err) => {
+                    if err.kind() == io::ErrorKind::UnexpectedEof {
+                        // not enough data for header, save to the buffer
+                        self.header_buf.extend(buf);
+                        Ok(buf.len())
+                    } else {
+                        Err(err)
+                    }
+                }
+                Ok(header) => {
+                    self.header = Some(header);
+                    let pos = pos - self.header_buf.len();
+                    self.header_buf.truncate(0);
+                    Ok(pos)
+                }
+            }
+        } else {
+            let (n, status) = self.inner.write_with_status(buf)?;
+
+            if status == Status::StreamEnd && n < buf.len() && self.crc_bytes.len() < 8 {
+                let remaining = buf.len() - n;
+                let crc_bytes = cmp::min(remaining, CRC_BYTES_LEN - self.crc_bytes.len());
+                self.crc_bytes.extend(&buf[n..n + crc_bytes]);
+                return Ok(n + crc_bytes);
+            }
+            Ok(n)
+        }
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
+    }
+}
+
+impl<W: Read + Write> Read for GzDecoder<W> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.get_mut().get_mut().read(buf)
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    const STR: &'static str = "Hello World Hello World Hello World Hello World Hello World \
+                               Hello World Hello World Hello World Hello World Hello World \
+                               Hello World Hello World Hello World Hello World Hello World \
+                               Hello World Hello World Hello World Hello World Hello World \
+                               Hello World Hello World Hello World Hello World Hello World";
+
+    #[test]
+    fn decode_writer_one_chunk() {
+        let mut e = GzEncoder::new(Vec::new(), Compression::default());
+        e.write(STR.as_ref()).unwrap();
+        let bytes = e.finish().unwrap();
+
+        let mut writer = Vec::new();
+        let mut decoder = GzDecoder::new(writer);
+        let n = decoder.write(&bytes[..]).unwrap();
+        decoder.write(&bytes[n..]).unwrap();
+        decoder.try_finish().unwrap();
+        writer = decoder.finish().unwrap();
+        let return_string = String::from_utf8(writer).expect("String parsing error");
+        assert_eq!(return_string, STR);
+    }
+
+    #[test]
+    fn decode_writer_partial_header() {
+        let mut e = GzEncoder::new(Vec::new(), Compression::default());
+        e.write(STR.as_ref()).unwrap();
+        let bytes = e.finish().unwrap();
+
+        let mut writer = Vec::new();
+        let mut decoder = GzDecoder::new(writer);
+        assert_eq!(decoder.write(&bytes[..5]).unwrap(), 5);
+        let n = decoder.write(&bytes[5..]).unwrap();
+        if n < bytes.len() - 5 {
+            decoder.write(&bytes[n + 5..]).unwrap();
+        }
+        writer = decoder.finish().unwrap();
+        let return_string = String::from_utf8(writer).expect("String parsing error");
+        assert_eq!(return_string, STR);
+    }
+
+    #[test]
+    fn decode_writer_exact_header() {
+        let mut e = GzEncoder::new(Vec::new(), Compression::default());
+        e.write(STR.as_ref()).unwrap();
+        let bytes = e.finish().unwrap();
+
+        let mut writer = Vec::new();
+        let mut decoder = GzDecoder::new(writer);
+        assert_eq!(decoder.write(&bytes[..10]).unwrap(), 10);
+        decoder.write(&bytes[10..]).unwrap();
+        writer = decoder.finish().unwrap();
+        let return_string = String::from_utf8(writer).expect("String parsing error");
+        assert_eq!(return_string, STR);
+    }
+
+    #[test]
+    fn decode_writer_partial_crc() {
+        let mut e = GzEncoder::new(Vec::new(), Compression::default());
+        e.write(STR.as_ref()).unwrap();
+        let bytes = e.finish().unwrap();
+
+        let mut writer = Vec::new();
+        let mut decoder = GzDecoder::new(writer);
+        let l = bytes.len() - 5;
+        let n = decoder.write(&bytes[..l]).unwrap();
+        decoder.write(&bytes[n..]).unwrap();
+        writer = decoder.finish().unwrap();
+        let return_string = String::from_utf8(writer).expect("String parsing error");
+        assert_eq!(return_string, STR);
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/lib.rs b/android/vendor/flate2-1.0.24/src/lib.rs
new file mode 100644
index 0000000..23a783e
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/lib.rs
@@ -0,0 +1,204 @@
+//! A DEFLATE-based stream compression/decompression library
+//!
+//! This library provides support for compression and decompression of
+//! DEFLATE-based streams:
+//!
+//! * the DEFLATE format itself
+//! * the zlib format
+//! * gzip
+//!
+//! These three formats are all closely related and largely only differ in their
+//! headers/footers. This crate has three types in each submodule for dealing
+//! with these three formats.
+//!
+//! # Implementation
+//!
+//! In addition to supporting three formats, this crate supports several different
+//! backends, controlled through this crate's features:
+//!
+//! * `default`, or `rust_backend` - this implementation uses the `miniz_oxide`
+//!   crate which is a port of `miniz.c` (below) to Rust. This feature does not
+//!   require a C compiler and only requires Rust code.
+//!
+//! * `zlib` - this feature will enable linking against the `libz` library, typically found on most
+//!   Linux systems by default. If the library isn't found to already be on the system it will be
+//!   compiled from source (this is a C library).
+//!
+//! There's various tradeoffs associated with each implementation, but in general you probably
+//! won't have to tweak the defaults. The default choice is selected to avoid the need for a C
+//! compiler at build time. `zlib-ng-compat` is useful if you're using zlib for compatibility but
+//! want performance via zlib-ng's zlib-compat mode. `zlib` is useful if something else in your
+//! dependencies links the original zlib so you cannot use zlib-ng-compat. The compression ratios
+//! and performance of each of these feature should be roughly comparable, but you'll likely want
+//! to run your own tests if you're curious about the performance.
+//!
+//! # Organization
+//!
+//! This crate consists mainly of three modules, [`read`], [`write`], and
+//! [`bufread`]. Each module contains a number of types used to encode and
+//! decode various streams of data.
+//!
+//! All types in the [`write`] module work on instances of [`Write`][write],
+//! whereas all types in the [`read`] module work on instances of
+//! [`Read`][read] and [`bufread`] works with [`BufRead`][bufread]. If you
+//! are decoding directly from a `&[u8]`, use the [`bufread`] types.
+//!
+//! ```
+//! use flate2::write::GzEncoder;
+//! use flate2::Compression;
+//! use std::io;
+//! use std::io::prelude::*;
+//!
+//! # fn main() { let _ = run(); }
+//! # fn run() -> io::Result<()> {
+//! let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
+//! encoder.write_all(b"Example")?;
+//! # Ok(())
+//! # }
+//! ```
+//!
+//!
+//! Other various types are provided at the top-level of the crate for
+//! management and dealing with encoders/decoders. Also note that types which
+//! operate over a specific trait often implement the mirroring trait as well.
+//! For example a `flate2::read::DeflateDecoder<T>` *also* implements the
+//! `Write` trait if `T: Write`. That is, the "dual trait" is forwarded directly
+//! to the underlying object if available.
+//!
+//! [`read`]: read/index.html
+//! [`bufread`]: bufread/index.html
+//! [`write`]: write/index.html
+//! [read]: https://doc.rust-lang.org/std/io/trait.Read.html
+//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html
+//! [bufread]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+#![doc(html_root_url = "https://docs.rs/flate2/0.2")]
+#![deny(missing_docs)]
+#![deny(missing_debug_implementations)]
+#![allow(trivial_numeric_casts)]
+#![cfg_attr(test, deny(warnings))]
+
+pub use crate::crc::{Crc, CrcReader, CrcWriter};
+pub use crate::gz::GzBuilder;
+pub use crate::gz::GzHeader;
+pub use crate::mem::{Compress, CompressError, Decompress, DecompressError, Status};
+pub use crate::mem::{FlushCompress, FlushDecompress};
+
+mod bufreader;
+mod crc;
+mod deflate;
+mod ffi;
+mod gz;
+mod mem;
+mod zio;
+mod zlib;
+
+/// Types which operate over [`Read`] streams, both encoders and decoders for
+/// various formats.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+pub mod read {
+    pub use crate::deflate::read::DeflateDecoder;
+    pub use crate::deflate::read::DeflateEncoder;
+    pub use crate::gz::read::GzDecoder;
+    pub use crate::gz::read::GzEncoder;
+    pub use crate::gz::read::MultiGzDecoder;
+    pub use crate::zlib::read::ZlibDecoder;
+    pub use crate::zlib::read::ZlibEncoder;
+}
+
+/// Types which operate over [`Write`] streams, both encoders and decoders for
+/// various formats.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+pub mod write {
+    pub use crate::deflate::write::DeflateDecoder;
+    pub use crate::deflate::write::DeflateEncoder;
+    pub use crate::gz::write::GzDecoder;
+    pub use crate::gz::write::GzEncoder;
+    pub use crate::zlib::write::ZlibDecoder;
+    pub use crate::zlib::write::ZlibEncoder;
+}
+
+/// Types which operate over [`BufRead`] streams, both encoders and decoders for
+/// various formats.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+pub mod bufread {
+    pub use crate::deflate::bufread::DeflateDecoder;
+    pub use crate::deflate::bufread::DeflateEncoder;
+    pub use crate::gz::bufread::GzDecoder;
+    pub use crate::gz::bufread::GzEncoder;
+    pub use crate::gz::bufread::MultiGzDecoder;
+    pub use crate::zlib::bufread::ZlibDecoder;
+    pub use crate::zlib::bufread::ZlibEncoder;
+}
+
+fn _assert_send_sync() {
+    fn _assert_send_sync<T: Send + Sync>() {}
+
+    _assert_send_sync::<read::DeflateEncoder<&[u8]>>();
+    _assert_send_sync::<read::DeflateDecoder<&[u8]>>();
+    _assert_send_sync::<read::ZlibEncoder<&[u8]>>();
+    _assert_send_sync::<read::ZlibDecoder<&[u8]>>();
+    _assert_send_sync::<read::GzEncoder<&[u8]>>();
+    _assert_send_sync::<read::GzDecoder<&[u8]>>();
+    _assert_send_sync::<read::MultiGzDecoder<&[u8]>>();
+    _assert_send_sync::<write::DeflateEncoder<Vec<u8>>>();
+    _assert_send_sync::<write::DeflateDecoder<Vec<u8>>>();
+    _assert_send_sync::<write::ZlibEncoder<Vec<u8>>>();
+    _assert_send_sync::<write::ZlibDecoder<Vec<u8>>>();
+    _assert_send_sync::<write::GzEncoder<Vec<u8>>>();
+    _assert_send_sync::<write::GzDecoder<Vec<u8>>>();
+}
+
+/// When compressing data, the compression level can be specified by a value in
+/// this enum.
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub struct Compression(u32);
+
+impl Compression {
+    /// Creates a new description of the compression level with an explicitly
+    /// specified integer.
+    ///
+    /// The integer here is typically on a scale of 0-9 where 0 means "no
+    /// compression" and 9 means "take as long as you'd like".
+    pub const fn new(level: u32) -> Compression {
+        Compression(level)
+    }
+
+    /// No compression is to be performed, this may actually inflate data
+    /// slightly when encoding.
+    pub const fn none() -> Compression {
+        Compression(0)
+    }
+
+    /// Optimize for the best speed of encoding.
+    pub const fn fast() -> Compression {
+        Compression(1)
+    }
+
+    /// Optimize for the size of data being encoded.
+    pub const fn best() -> Compression {
+        Compression(9)
+    }
+
+    /// Returns an integer representing the compression level, typically on a
+    /// scale of 0-9
+    pub fn level(&self) -> u32 {
+        self.0
+    }
+}
+
+impl Default for Compression {
+    fn default() -> Compression {
+        Compression(6)
+    }
+}
+
+#[cfg(test)]
+fn random_bytes() -> impl Iterator<Item = u8> {
+    use rand::Rng;
+    use std::iter;
+
+    iter::repeat(()).map(|_| rand::thread_rng().gen())
+}
diff --git a/android/vendor/flate2-1.0.24/src/mem.rs b/android/vendor/flate2-1.0.24/src/mem.rs
new file mode 100644
index 0000000..5f1d6d8
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/mem.rs
@@ -0,0 +1,788 @@
+use std::error::Error;
+use std::fmt;
+use std::io;
+use std::slice;
+
+use crate::ffi::{self, Backend, Deflate, DeflateBackend, ErrorMessage, Inflate, InflateBackend};
+use crate::Compression;
+
+/// Raw in-memory compression stream for blocks of data.
+///
+/// This type is the building block for the I/O streams in the rest of this
+/// crate. It requires more management than the [`Read`]/[`Write`] API but is
+/// maximally flexible in terms of accepting input from any source and being
+/// able to produce output to any memory location.
+///
+/// It is recommended to use the I/O stream adaptors over this type as they're
+/// easier to use.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+#[derive(Debug)]
+pub struct Compress {
+    inner: Deflate,
+}
+
+/// Raw in-memory decompression stream for blocks of data.
+///
+/// This type is the building block for the I/O streams in the rest of this
+/// crate. It requires more management than the [`Read`]/[`Write`] API but is
+/// maximally flexible in terms of accepting input from any source and being
+/// able to produce output to any memory location.
+///
+/// It is recommended to use the I/O stream adaptors over this type as they're
+/// easier to use.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+#[derive(Debug)]
+pub struct Decompress {
+    inner: Inflate,
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+/// Values which indicate the form of flushing to be used when compressing
+/// in-memory data.
+pub enum FlushCompress {
+    /// A typical parameter for passing to compression/decompression functions,
+    /// this indicates that the underlying stream to decide how much data to
+    /// accumulate before producing output in order to maximize compression.
+    None = ffi::MZ_NO_FLUSH as isize,
+
+    /// All pending output is flushed to the output buffer and the output is
+    /// aligned on a byte boundary so that the decompressor can get all input
+    /// data available so far.
+    ///
+    /// Flushing may degrade compression for some compression algorithms and so
+    /// it should only be used when necessary. This will complete the current
+    /// deflate block and follow it with an empty stored block.
+    Sync = ffi::MZ_SYNC_FLUSH as isize,
+
+    /// All pending output is flushed to the output buffer, but the output is
+    /// not aligned to a byte boundary.
+    ///
+    /// All of the input data so far will be available to the decompressor (as
+    /// with `Flush::Sync`. This completes the current deflate block and follows
+    /// it with an empty fixed codes block that is 10 bites long, and it assures
+    /// that enough bytes are output in order for the decompressor to finish the
+    /// block before the empty fixed code block.
+    Partial = ffi::MZ_PARTIAL_FLUSH as isize,
+
+    /// All output is flushed as with `Flush::Sync` and the compression state is
+    /// reset so decompression can restart from this point if previous
+    /// compressed data has been damaged or if random access is desired.
+    ///
+    /// Using this option too often can seriously degrade compression.
+    Full = ffi::MZ_FULL_FLUSH as isize,
+
+    /// Pending input is processed and pending output is flushed.
+    ///
+    /// The return value may indicate that the stream is not yet done and more
+    /// data has yet to be processed.
+    Finish = ffi::MZ_FINISH as isize,
+
+    #[doc(hidden)]
+    _Nonexhaustive,
+}
+
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+/// Values which indicate the form of flushing to be used when
+/// decompressing in-memory data.
+pub enum FlushDecompress {
+    /// A typical parameter for passing to compression/decompression functions,
+    /// this indicates that the underlying stream to decide how much data to
+    /// accumulate before producing output in order to maximize compression.
+    None = ffi::MZ_NO_FLUSH as isize,
+
+    /// All pending output is flushed to the output buffer and the output is
+    /// aligned on a byte boundary so that the decompressor can get all input
+    /// data available so far.
+    ///
+    /// Flushing may degrade compression for some compression algorithms and so
+    /// it should only be used when necessary. This will complete the current
+    /// deflate block and follow it with an empty stored block.
+    Sync = ffi::MZ_SYNC_FLUSH as isize,
+
+    /// Pending input is processed and pending output is flushed.
+    ///
+    /// The return value may indicate that the stream is not yet done and more
+    /// data has yet to be processed.
+    Finish = ffi::MZ_FINISH as isize,
+
+    #[doc(hidden)]
+    _Nonexhaustive,
+}
+
+/// The inner state for an error when decompressing
+#[derive(Debug)]
+pub(crate) enum DecompressErrorInner {
+    General { msg: ErrorMessage },
+    NeedsDictionary(u32),
+}
+
+/// Error returned when a decompression object finds that the input stream of
+/// bytes was not a valid input stream of bytes.
+#[derive(Debug)]
+pub struct DecompressError(pub(crate) DecompressErrorInner);
+
+impl DecompressError {
+    /// Indicates whether decompression failed due to requiring a dictionary.
+    ///
+    /// The resulting integer is the Adler-32 checksum of the dictionary
+    /// required.
+    pub fn needs_dictionary(&self) -> Option<u32> {
+        match self.0 {
+            DecompressErrorInner::NeedsDictionary(adler) => Some(adler),
+            _ => None,
+        }
+    }
+}
+
+#[inline]
+pub(crate) fn decompress_failed<T>(msg: ErrorMessage) -> Result<T, DecompressError> {
+    Err(DecompressError(DecompressErrorInner::General { msg }))
+}
+
+#[inline]
+pub(crate) fn decompress_need_dict<T>(adler: u32) -> Result<T, DecompressError> {
+    Err(DecompressError(DecompressErrorInner::NeedsDictionary(
+        adler,
+    )))
+}
+
+/// Error returned when a compression object is used incorrectly or otherwise
+/// generates an error.
+#[derive(Debug)]
+pub struct CompressError {
+    pub(crate) msg: ErrorMessage,
+}
+
+#[inline]
+pub(crate) fn compress_failed<T>(msg: ErrorMessage) -> Result<T, CompressError> {
+    Err(CompressError { msg })
+}
+
+/// Possible status results of compressing some data or successfully
+/// decompressing a block of data.
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub enum Status {
+    /// Indicates success.
+    ///
+    /// Means that more input may be needed but isn't available
+    /// and/or there's more output to be written but the output buffer is full.
+    Ok,
+
+    /// Indicates that forward progress is not possible due to input or output
+    /// buffers being empty.
+    ///
+    /// For compression it means the input buffer needs some more data or the
+    /// output buffer needs to be freed up before trying again.
+    ///
+    /// For decompression this means that more input is needed to continue or
+    /// the output buffer isn't large enough to contain the result. The function
+    /// can be called again after fixing both.
+    BufError,
+
+    /// Indicates that all input has been consumed and all output bytes have
+    /// been written. Decompression/compression should not be called again.
+    ///
+    /// For decompression with zlib streams the adler-32 of the decompressed
+    /// data has also been verified.
+    StreamEnd,
+}
+
+impl Compress {
+    /// Creates a new object ready for compressing data that it's given.
+    ///
+    /// The `level` argument here indicates what level of compression is going
+    /// to be performed, and the `zlib_header` argument indicates whether the
+    /// output data should have a zlib header or not.
+    pub fn new(level: Compression, zlib_header: bool) -> Compress {
+        Compress {
+            inner: Deflate::make(level, zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8),
+        }
+    }
+
+    /// Creates a new object ready for compressing data that it's given.
+    ///
+    /// The `level` argument here indicates what level of compression is going
+    /// to be performed, and the `zlib_header` argument indicates whether the
+    /// output data should have a zlib header or not. The `window_bits` parameter
+    /// indicates the base-2 logarithm of the sliding window size and must be
+    /// between 9 and 15.
+    ///
+    /// # Panics
+    ///
+    /// If `window_bits` does not fall into the range 9 ..= 15,
+    /// `new_with_window_bits` will panic.
+    ///
+    /// # Note
+    ///
+    /// This constructor is only available when the `zlib` feature is used.
+    /// Other backends currently do not support custom window bits.
+    #[cfg(feature = "any_zlib")]
+    pub fn new_with_window_bits(
+        level: Compression,
+        zlib_header: bool,
+        window_bits: u8,
+    ) -> Compress {
+        assert!(
+            window_bits > 8 && window_bits < 16,
+            "window_bits must be within 9 ..= 15"
+        );
+        Compress {
+            inner: Deflate::make(level, zlib_header, window_bits),
+        }
+    }
+
+    /// Creates a new object ready for compressing data that it's given.
+    ///
+    /// The `level` argument here indicates what level of compression is going
+    /// to be performed.
+    ///
+    /// The Compress object produced by this constructor outputs gzip headers
+    /// for the compressed data.
+    ///
+    /// # Panics
+    ///
+    /// If `window_bits` does not fall into the range 9 ..= 15,
+    /// `new_with_window_bits` will panic.
+    ///
+    /// # Note
+    ///
+    /// This constructor is only available when the `zlib` feature is used.
+    /// Other backends currently do not support gzip headers for Compress.
+    #[cfg(feature = "any_zlib")]
+    pub fn new_gzip(level: Compression, window_bits: u8) -> Compress {
+        assert!(
+            window_bits > 8 && window_bits < 16,
+            "window_bits must be within 9 ..= 15"
+        );
+        Compress {
+            inner: Deflate::make(level, true, window_bits + 16),
+        }
+    }
+
+    /// Returns the total number of input bytes which have been processed by
+    /// this compression object.
+    pub fn total_in(&self) -> u64 {
+        self.inner.total_in()
+    }
+
+    /// Returns the total number of output bytes which have been produced by
+    /// this compression object.
+    pub fn total_out(&self) -> u64 {
+        self.inner.total_out()
+    }
+
+    /// Specifies the compression dictionary to use.
+    ///
+    /// Returns the Adler-32 checksum of the dictionary.
+    #[cfg(feature = "any_zlib")]
+    pub fn set_dictionary(&mut self, dictionary: &[u8]) -> Result<u32, CompressError> {
+        let stream = &mut *self.inner.inner.stream_wrapper;
+        stream.msg = std::ptr::null_mut();
+        let rc = unsafe {
+            assert!(dictionary.len() < ffi::uInt::MAX as usize);
+            ffi::deflateSetDictionary(stream, dictionary.as_ptr(), dictionary.len() as ffi::uInt)
+        };
+
+        match rc {
+            ffi::MZ_STREAM_ERROR => compress_failed(self.inner.inner.msg()),
+            ffi::MZ_OK => Ok(stream.adler as u32),
+            c => panic!("unknown return code: {}", c),
+        }
+    }
+
+    /// Quickly resets this compressor without having to reallocate anything.
+    ///
+    /// This is equivalent to dropping this object and then creating a new one.
+    pub fn reset(&mut self) {
+        self.inner.reset();
+    }
+
+    /// Dynamically updates the compression level.
+    ///
+    /// This can be used to switch between compression levels for different
+    /// kinds of data, or it can be used in conjunction with a call to reset
+    /// to reuse the compressor.
+    ///
+    /// This may return an error if there wasn't enough output space to complete
+    /// the compression of the available input data before changing the
+    /// compression level. Flushing the stream before calling this method
+    /// ensures that the function will succeed on the first call.
+    #[cfg(feature = "any_zlib")]
+    pub fn set_level(&mut self, level: Compression) -> Result<(), CompressError> {
+        use std::os::raw::c_int;
+        let stream = &mut *self.inner.inner.stream_wrapper;
+        stream.msg = std::ptr::null_mut();
+
+        let rc = unsafe { ffi::deflateParams(stream, level.0 as c_int, ffi::MZ_DEFAULT_STRATEGY) };
+
+        match rc {
+            ffi::MZ_OK => Ok(()),
+            ffi::MZ_BUF_ERROR => compress_failed(self.inner.inner.msg()),
+            c => panic!("unknown return code: {}", c),
+        }
+    }
+
+    /// Compresses the input data into the output, consuming only as much
+    /// input as needed and writing as much output as possible.
+    ///
+    /// The flush option can be any of the available `FlushCompress` parameters.
+    ///
+    /// To learn how much data was consumed or how much output was produced, use
+    /// the `total_in` and `total_out` functions before/after this is called.
+    pub fn compress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushCompress,
+    ) -> Result<Status, CompressError> {
+        self.inner.compress(input, output, flush)
+    }
+
+    /// Compresses the input data into the extra space of the output, consuming
+    /// only as much input as needed and writing as much output as possible.
+    ///
+    /// This function has the same semantics as `compress`, except that the
+    /// length of `vec` is managed by this function. This will not reallocate
+    /// the vector provided or attempt to grow it, so space for the output must
+    /// be reserved in the output vector by the caller before calling this
+    /// function.
+    pub fn compress_vec(
+        &mut self,
+        input: &[u8],
+        output: &mut Vec<u8>,
+        flush: FlushCompress,
+    ) -> Result<Status, CompressError> {
+        let cap = output.capacity();
+        let len = output.len();
+
+        unsafe {
+            let before = self.total_out();
+            let ret = {
+                let ptr = output.as_mut_ptr().offset(len as isize);
+                let out = slice::from_raw_parts_mut(ptr, cap - len);
+                self.compress(input, out, flush)
+            };
+            output.set_len((self.total_out() - before) as usize + len);
+            ret
+        }
+    }
+}
+
+impl Decompress {
+    /// Creates a new object ready for decompressing data that it's given.
+    ///
+    /// The `zlib_header` argument indicates whether the input data is expected
+    /// to have a zlib header or not.
+    pub fn new(zlib_header: bool) -> Decompress {
+        Decompress {
+            inner: Inflate::make(zlib_header, ffi::MZ_DEFAULT_WINDOW_BITS as u8),
+        }
+    }
+
+    /// Creates a new object ready for decompressing data that it's given.
+    ///
+    /// The `zlib_header` argument indicates whether the input data is expected
+    /// to have a zlib header or not. The `window_bits` parameter indicates the
+    /// base-2 logarithm of the sliding window size and must be between 9 and 15.
+    ///
+    /// # Panics
+    ///
+    /// If `window_bits` does not fall into the range 9 ..= 15,
+    /// `new_with_window_bits` will panic.
+    ///
+    /// # Note
+    ///
+    /// This constructor is only available when the `zlib` feature is used.
+    /// Other backends currently do not support custom window bits.
+    #[cfg(feature = "any_zlib")]
+    pub fn new_with_window_bits(zlib_header: bool, window_bits: u8) -> Decompress {
+        assert!(
+            window_bits > 8 && window_bits < 16,
+            "window_bits must be within 9 ..= 15"
+        );
+        Decompress {
+            inner: Inflate::make(zlib_header, window_bits),
+        }
+    }
+
+    /// Creates a new object ready for decompressing data that it's given.
+    ///
+    /// The Decompress object produced by this constructor expects gzip headers
+    /// for the compressed data.
+    ///
+    /// # Panics
+    ///
+    /// If `window_bits` does not fall into the range 9 ..= 15,
+    /// `new_with_window_bits` will panic.
+    ///
+    /// # Note
+    ///
+    /// This constructor is only available when the `zlib` feature is used.
+    /// Other backends currently do not support gzip headers for Decompress.
+    #[cfg(feature = "any_zlib")]
+    pub fn new_gzip(window_bits: u8) -> Decompress {
+        assert!(
+            window_bits > 8 && window_bits < 16,
+            "window_bits must be within 9 ..= 15"
+        );
+        Decompress {
+            inner: Inflate::make(true, window_bits + 16),
+        }
+    }
+
+    /// Returns the total number of input bytes which have been processed by
+    /// this decompression object.
+    pub fn total_in(&self) -> u64 {
+        self.inner.total_in()
+    }
+
+    /// Returns the total number of output bytes which have been produced by
+    /// this decompression object.
+    pub fn total_out(&self) -> u64 {
+        self.inner.total_out()
+    }
+
+    /// Decompresses the input data into the output, consuming only as much
+    /// input as needed and writing as much output as possible.
+    ///
+    /// The flush option can be any of the available `FlushDecompress` parameters.
+    ///
+    /// If the first call passes `FlushDecompress::Finish` it is assumed that
+    /// the input and output buffers are both sized large enough to decompress
+    /// the entire stream in a single call.
+    ///
+    /// A flush value of `FlushDecompress::Finish` indicates that there are no
+    /// more source bytes available beside what's already in the input buffer,
+    /// and the output buffer is large enough to hold the rest of the
+    /// decompressed data.
+    ///
+    /// To learn how much data was consumed or how much output was produced, use
+    /// the `total_in` and `total_out` functions before/after this is called.
+    ///
+    /// # Errors
+    ///
+    /// If the input data to this instance of `Decompress` is not a valid
+    /// zlib/deflate stream then this function may return an instance of
+    /// `DecompressError` to indicate that the stream of input bytes is corrupted.
+    pub fn decompress(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError> {
+        self.inner.decompress(input, output, flush)
+    }
+
+    /// Decompresses the input data into the extra space in the output vector
+    /// specified by `output`.
+    ///
+    /// This function has the same semantics as `decompress`, except that the
+    /// length of `vec` is managed by this function. This will not reallocate
+    /// the vector provided or attempt to grow it, so space for the output must
+    /// be reserved in the output vector by the caller before calling this
+    /// function.
+    ///
+    /// # Errors
+    ///
+    /// If the input data to this instance of `Decompress` is not a valid
+    /// zlib/deflate stream then this function may return an instance of
+    /// `DecompressError` to indicate that the stream of input bytes is corrupted.
+    pub fn decompress_vec(
+        &mut self,
+        input: &[u8],
+        output: &mut Vec<u8>,
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError> {
+        let cap = output.capacity();
+        let len = output.len();
+
+        unsafe {
+            let before = self.total_out();
+            let ret = {
+                let ptr = output.as_mut_ptr().offset(len as isize);
+                let out = slice::from_raw_parts_mut(ptr, cap - len);
+                self.decompress(input, out, flush)
+            };
+            output.set_len((self.total_out() - before) as usize + len);
+            ret
+        }
+    }
+
+    /// Specifies the decompression dictionary to use.
+    #[cfg(feature = "any_zlib")]
+    pub fn set_dictionary(&mut self, dictionary: &[u8]) -> Result<u32, DecompressError> {
+        let stream = &mut *self.inner.inner.stream_wrapper;
+        stream.msg = std::ptr::null_mut();
+        let rc = unsafe {
+            assert!(dictionary.len() < ffi::uInt::MAX as usize);
+            ffi::inflateSetDictionary(stream, dictionary.as_ptr(), dictionary.len() as ffi::uInt)
+        };
+
+        match rc {
+            ffi::MZ_STREAM_ERROR => decompress_failed(self.inner.inner.msg()),
+            ffi::MZ_DATA_ERROR => decompress_need_dict(stream.adler as u32),
+            ffi::MZ_OK => Ok(stream.adler as u32),
+            c => panic!("unknown return code: {}", c),
+        }
+    }
+
+    /// Performs the equivalent of replacing this decompression state with a
+    /// freshly allocated copy.
+    ///
+    /// This function may not allocate memory, though, and attempts to reuse any
+    /// previously existing resources.
+    ///
+    /// The argument provided here indicates whether the reset state will
+    /// attempt to decode a zlib header first or not.
+    pub fn reset(&mut self, zlib_header: bool) {
+        self.inner.reset(zlib_header);
+    }
+}
+
+impl Error for DecompressError {}
+
+impl DecompressError {
+    /// Retrieve the implementation's message about why the operation failed, if one exists.
+    pub fn message(&self) -> Option<&str> {
+        match &self.0 {
+            DecompressErrorInner::General { msg } => msg.get(),
+            _ => None,
+        }
+    }
+}
+
+impl From<DecompressError> for io::Error {
+    fn from(data: DecompressError) -> io::Error {
+        io::Error::new(io::ErrorKind::Other, data)
+    }
+}
+
+impl fmt::Display for DecompressError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let msg = match &self.0 {
+            DecompressErrorInner::General { msg } => msg.get(),
+            DecompressErrorInner::NeedsDictionary { .. } => Some("requires a dictionary"),
+        };
+        match msg {
+            Some(msg) => write!(f, "deflate decompression error: {}", msg),
+            None => write!(f, "deflate decompression error"),
+        }
+    }
+}
+
+impl Error for CompressError {}
+
+impl CompressError {
+    /// Retrieve the implementation's message about why the operation failed, if one exists.
+    pub fn message(&self) -> Option<&str> {
+        self.msg.get()
+    }
+}
+
+impl From<CompressError> for io::Error {
+    fn from(data: CompressError) -> io::Error {
+        io::Error::new(io::ErrorKind::Other, data)
+    }
+}
+
+impl fmt::Display for CompressError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self.msg.get() {
+            Some(msg) => write!(f, "deflate compression error: {}", msg),
+            None => write!(f, "deflate compression error"),
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use std::io::Write;
+
+    use crate::write;
+    use crate::{Compression, Decompress, FlushDecompress};
+
+    #[cfg(feature = "any_zlib")]
+    use crate::{Compress, FlushCompress};
+
+    #[test]
+    fn issue51() {
+        let data = vec![
+            0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xb3, 0xc9, 0x28, 0xc9,
+            0xcd, 0xb1, 0xe3, 0xe5, 0xb2, 0xc9, 0x48, 0x4d, 0x4c, 0xb1, 0xb3, 0x29, 0xc9, 0x2c,
+            0xc9, 0x49, 0xb5, 0x33, 0x31, 0x30, 0x51, 0xf0, 0xcb, 0x2f, 0x51, 0x70, 0xcb, 0x2f,
+            0xcd, 0x4b, 0xb1, 0xd1, 0x87, 0x08, 0xda, 0xe8, 0x83, 0x95, 0x00, 0x95, 0x26, 0xe5,
+            0xa7, 0x54, 0x2a, 0x24, 0xa5, 0x27, 0xe7, 0xe7, 0xe4, 0x17, 0xd9, 0x2a, 0x95, 0x67,
+            0x64, 0x96, 0xa4, 0x2a, 0x81, 0x8c, 0x48, 0x4e, 0xcd, 0x2b, 0x49, 0x2d, 0xb2, 0xb3,
+            0xc9, 0x30, 0x44, 0x37, 0x01, 0x28, 0x62, 0xa3, 0x0f, 0x95, 0x06, 0xd9, 0x05, 0x54,
+            0x04, 0xe5, 0xe5, 0xa5, 0x67, 0xe6, 0x55, 0xe8, 0x1b, 0xea, 0x99, 0xe9, 0x19, 0x21,
+            0xab, 0xd0, 0x07, 0xd9, 0x01, 0x32, 0x53, 0x1f, 0xea, 0x3e, 0x00, 0x94, 0x85, 0xeb,
+            0xe4, 0xa8, 0x00, 0x00, 0x00,
+        ];
+
+        let mut decoded = Vec::with_capacity(data.len() * 2);
+
+        let mut d = Decompress::new(false);
+        // decompressed whole deflate stream
+        assert!(d
+            .decompress_vec(&data[10..], &mut decoded, FlushDecompress::Finish)
+            .is_ok());
+
+        // decompress data that has nothing to do with the deflate stream (this
+        // used to panic)
+        drop(d.decompress_vec(&[0], &mut decoded, FlushDecompress::None));
+    }
+
+    #[test]
+    fn reset() {
+        let string = "hello world".as_bytes();
+        let mut zlib = Vec::new();
+        let mut deflate = Vec::new();
+
+        let comp = Compression::default();
+        write::ZlibEncoder::new(&mut zlib, comp)
+            .write_all(string)
+            .unwrap();
+        write::DeflateEncoder::new(&mut deflate, comp)
+            .write_all(string)
+            .unwrap();
+
+        let mut dst = [0; 1024];
+        let mut decoder = Decompress::new(true);
+        decoder
+            .decompress(&zlib, &mut dst, FlushDecompress::Finish)
+            .unwrap();
+        assert_eq!(decoder.total_out(), string.len() as u64);
+        assert!(dst.starts_with(string));
+
+        decoder.reset(false);
+        decoder
+            .decompress(&deflate, &mut dst, FlushDecompress::Finish)
+            .unwrap();
+        assert_eq!(decoder.total_out(), string.len() as u64);
+        assert!(dst.starts_with(string));
+    }
+
+    #[cfg(feature = "any_zlib")]
+    #[test]
+    fn set_dictionary_with_zlib_header() {
+        let string = "hello, hello!".as_bytes();
+        let dictionary = "hello".as_bytes();
+
+        let mut encoded = Vec::with_capacity(1024);
+
+        let mut encoder = Compress::new(Compression::default(), true);
+
+        let dictionary_adler = encoder.set_dictionary(&dictionary).unwrap();
+
+        encoder
+            .compress_vec(string, &mut encoded, FlushCompress::Finish)
+            .unwrap();
+
+        assert_eq!(encoder.total_in(), string.len() as u64);
+        assert_eq!(encoder.total_out(), encoded.len() as u64);
+
+        let mut decoder = Decompress::new(true);
+        let mut decoded = [0; 1024];
+        let decompress_error = decoder
+            .decompress(&encoded, &mut decoded, FlushDecompress::Finish)
+            .expect_err("decompression should fail due to requiring a dictionary");
+
+        let required_adler = decompress_error.needs_dictionary()
+            .expect("the first call to decompress should indicate a dictionary is required along with the required Adler-32 checksum");
+
+        assert_eq!(required_adler, dictionary_adler,
+            "the Adler-32 checksum should match the value when the dictionary was set on the compressor");
+
+        let actual_adler = decoder.set_dictionary(&dictionary).unwrap();
+
+        assert_eq!(required_adler, actual_adler);
+
+        // Decompress the rest of the input to the remainder of the output buffer
+        let total_in = decoder.total_in();
+        let total_out = decoder.total_out();
+
+        let decompress_result = decoder.decompress(
+            &encoded[total_in as usize..],
+            &mut decoded[total_out as usize..],
+            FlushDecompress::Finish,
+        );
+        assert!(decompress_result.is_ok());
+
+        assert_eq!(&decoded[..decoder.total_out() as usize], string);
+    }
+
+    #[cfg(feature = "any_zlib")]
+    #[test]
+    fn set_dictionary_raw() {
+        let string = "hello, hello!".as_bytes();
+        let dictionary = "hello".as_bytes();
+
+        let mut encoded = Vec::with_capacity(1024);
+
+        let mut encoder = Compress::new(Compression::default(), false);
+
+        encoder.set_dictionary(&dictionary).unwrap();
+
+        encoder
+            .compress_vec(string, &mut encoded, FlushCompress::Finish)
+            .unwrap();
+
+        assert_eq!(encoder.total_in(), string.len() as u64);
+        assert_eq!(encoder.total_out(), encoded.len() as u64);
+
+        let mut decoder = Decompress::new(false);
+
+        decoder.set_dictionary(&dictionary).unwrap();
+
+        let mut decoded = [0; 1024];
+        let decompress_result = decoder.decompress(&encoded, &mut decoded, FlushDecompress::Finish);
+
+        assert!(decompress_result.is_ok());
+
+        assert_eq!(&decoded[..decoder.total_out() as usize], string);
+    }
+
+    #[cfg(feature = "any_zlib")]
+    #[test]
+    fn test_gzip_flate() {
+        let string = "hello, hello!".as_bytes();
+
+        let mut encoded = Vec::with_capacity(1024);
+
+        let mut encoder = Compress::new_gzip(Compression::default(), 9);
+
+        encoder
+            .compress_vec(string, &mut encoded, FlushCompress::Finish)
+            .unwrap();
+
+        assert_eq!(encoder.total_in(), string.len() as u64);
+        assert_eq!(encoder.total_out(), encoded.len() as u64);
+
+        let mut decoder = Decompress::new_gzip(9);
+
+        let mut decoded = [0; 1024];
+        decoder
+            .decompress(&encoded, &mut decoded, FlushDecompress::Finish)
+            .unwrap();
+
+        assert_eq!(&decoded[..decoder.total_out() as usize], string);
+    }
+
+    #[cfg(feature = "any_zlib")]
+    #[test]
+    fn test_error_message() {
+        let mut decoder = Decompress::new(false);
+        let mut decoded = [0; 128];
+        let garbage = b"xbvxzi";
+
+        let err = decoder
+            .decompress(&*garbage, &mut decoded, FlushDecompress::Finish)
+            .unwrap_err();
+
+        assert_eq!(err.message(), Some("invalid stored block lengths"));
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/zio.rs b/android/vendor/flate2-1.0.24/src/zio.rs
new file mode 100644
index 0000000..50beacb
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/zio.rs
@@ -0,0 +1,288 @@
+use std::io;
+use std::io::prelude::*;
+use std::mem;
+
+use crate::{Compress, Decompress, DecompressError, FlushCompress, FlushDecompress, Status};
+
+#[derive(Debug)]
+pub struct Writer<W: Write, D: Ops> {
+    obj: Option<W>,
+    pub data: D,
+    buf: Vec<u8>,
+}
+
+pub trait Ops {
+    type Flush: Flush;
+    fn total_in(&self) -> u64;
+    fn total_out(&self) -> u64;
+    fn run(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: Self::Flush,
+    ) -> Result<Status, DecompressError>;
+    fn run_vec(
+        &mut self,
+        input: &[u8],
+        output: &mut Vec<u8>,
+        flush: Self::Flush,
+    ) -> Result<Status, DecompressError>;
+}
+
+impl Ops for Compress {
+    type Flush = FlushCompress;
+    fn total_in(&self) -> u64 {
+        self.total_in()
+    }
+    fn total_out(&self) -> u64 {
+        self.total_out()
+    }
+    fn run(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushCompress,
+    ) -> Result<Status, DecompressError> {
+        Ok(self.compress(input, output, flush).unwrap())
+    }
+    fn run_vec(
+        &mut self,
+        input: &[u8],
+        output: &mut Vec<u8>,
+        flush: FlushCompress,
+    ) -> Result<Status, DecompressError> {
+        Ok(self.compress_vec(input, output, flush).unwrap())
+    }
+}
+
+impl Ops for Decompress {
+    type Flush = FlushDecompress;
+    fn total_in(&self) -> u64 {
+        self.total_in()
+    }
+    fn total_out(&self) -> u64 {
+        self.total_out()
+    }
+    fn run(
+        &mut self,
+        input: &[u8],
+        output: &mut [u8],
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError> {
+        self.decompress(input, output, flush)
+    }
+    fn run_vec(
+        &mut self,
+        input: &[u8],
+        output: &mut Vec<u8>,
+        flush: FlushDecompress,
+    ) -> Result<Status, DecompressError> {
+        self.decompress_vec(input, output, flush)
+    }
+}
+
+pub trait Flush {
+    fn none() -> Self;
+    fn sync() -> Self;
+    fn finish() -> Self;
+}
+
+impl Flush for FlushCompress {
+    fn none() -> Self {
+        FlushCompress::None
+    }
+
+    fn sync() -> Self {
+        FlushCompress::Sync
+    }
+
+    fn finish() -> Self {
+        FlushCompress::Finish
+    }
+}
+
+impl Flush for FlushDecompress {
+    fn none() -> Self {
+        FlushDecompress::None
+    }
+
+    fn sync() -> Self {
+        FlushDecompress::Sync
+    }
+
+    fn finish() -> Self {
+        FlushDecompress::Finish
+    }
+}
+
+pub fn read<R, D>(obj: &mut R, data: &mut D, dst: &mut [u8]) -> io::Result<usize>
+where
+    R: BufRead,
+    D: Ops,
+{
+    loop {
+        let (read, consumed, ret, eof);
+        {
+            let input = obj.fill_buf()?;
+            eof = input.is_empty();
+            let before_out = data.total_out();
+            let before_in = data.total_in();
+            let flush = if eof {
+                D::Flush::finish()
+            } else {
+                D::Flush::none()
+            };
+            ret = data.run(input, dst, flush);
+            read = (data.total_out() - before_out) as usize;
+            consumed = (data.total_in() - before_in) as usize;
+        }
+        obj.consume(consumed);
+
+        match ret {
+            // If we haven't ready any data and we haven't hit EOF yet,
+            // then we need to keep asking for more data because if we
+            // return that 0 bytes of data have been read then it will
+            // be interpreted as EOF.
+            Ok(Status::Ok) | Ok(Status::BufError) if read == 0 && !eof && !dst.is_empty() => {
+                continue
+            }
+            Ok(Status::Ok) | Ok(Status::BufError) | Ok(Status::StreamEnd) => return Ok(read),
+
+            Err(..) => {
+                return Err(io::Error::new(
+                    io::ErrorKind::InvalidInput,
+                    "corrupt deflate stream",
+                ))
+            }
+        }
+    }
+}
+
+impl<W: Write, D: Ops> Writer<W, D> {
+    pub fn new(w: W, d: D) -> Writer<W, D> {
+        Writer {
+            obj: Some(w),
+            data: d,
+            buf: Vec::with_capacity(32 * 1024),
+        }
+    }
+
+    pub fn finish(&mut self) -> io::Result<()> {
+        loop {
+            self.dump()?;
+
+            let before = self.data.total_out();
+            self.data.run_vec(&[], &mut self.buf, D::Flush::finish())?;
+            if before == self.data.total_out() {
+                return Ok(());
+            }
+        }
+    }
+
+    pub fn replace(&mut self, w: W) -> W {
+        self.buf.truncate(0);
+        mem::replace(self.get_mut(), w)
+    }
+
+    pub fn get_ref(&self) -> &W {
+        self.obj.as_ref().unwrap()
+    }
+
+    pub fn get_mut(&mut self) -> &mut W {
+        self.obj.as_mut().unwrap()
+    }
+
+    // Note that this should only be called if the outer object is just about
+    // to be consumed!
+    //
+    // (e.g. an implementation of `into_inner`)
+    pub fn take_inner(&mut self) -> W {
+        self.obj.take().unwrap()
+    }
+
+    pub fn is_present(&self) -> bool {
+        self.obj.is_some()
+    }
+
+    // Returns total written bytes and status of underlying codec
+    pub(crate) fn write_with_status(&mut self, buf: &[u8]) -> io::Result<(usize, Status)> {
+        // miniz isn't guaranteed to actually write any of the buffer provided,
+        // it may be in a flushing mode where it's just giving us data before
+        // we're actually giving it any data. We don't want to spuriously return
+        // `Ok(0)` when possible as it will cause calls to write_all() to fail.
+        // As a result we execute this in a loop to ensure that we try our
+        // darndest to write the data.
+        loop {
+            self.dump()?;
+
+            let before_in = self.data.total_in();
+            let ret = self.data.run_vec(buf, &mut self.buf, D::Flush::none());
+            let written = (self.data.total_in() - before_in) as usize;
+            let is_stream_end = matches!(ret, Ok(Status::StreamEnd));
+
+            if !buf.is_empty() && written == 0 && ret.is_ok() && !is_stream_end {
+                continue;
+            }
+            return match ret {
+                Ok(st) => match st {
+                    Status::Ok | Status::BufError | Status::StreamEnd => Ok((written, st)),
+                },
+                Err(..) => Err(io::Error::new(
+                    io::ErrorKind::InvalidInput,
+                    "corrupt deflate stream",
+                )),
+            };
+        }
+    }
+
+    fn dump(&mut self) -> io::Result<()> {
+        // TODO: should manage this buffer not with `drain` but probably more of
+        // a deque-like strategy.
+        while !self.buf.is_empty() {
+            let n = self.obj.as_mut().unwrap().write(&self.buf)?;
+            if n == 0 {
+                return Err(io::ErrorKind::WriteZero.into());
+            }
+            self.buf.drain(..n);
+        }
+        Ok(())
+    }
+}
+
+impl<W: Write, D: Ops> Write for Writer<W, D> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.write_with_status(buf).map(|res| res.0)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.data
+            .run_vec(&[], &mut self.buf, D::Flush::sync())
+            .unwrap();
+
+        // Unfortunately miniz doesn't actually tell us when we're done with
+        // pulling out all the data from the internal stream. To remedy this we
+        // have to continually ask the stream for more memory until it doesn't
+        // give us a chunk of memory the same size as our own internal buffer,
+        // at which point we assume it's reached the end.
+        loop {
+            self.dump()?;
+            let before = self.data.total_out();
+            self.data
+                .run_vec(&[], &mut self.buf, D::Flush::none())
+                .unwrap();
+            if before == self.data.total_out() {
+                break;
+            }
+        }
+
+        self.obj.as_mut().unwrap().flush()
+    }
+}
+
+impl<W: Write, D: Ops> Drop for Writer<W, D> {
+    fn drop(&mut self) {
+        if self.obj.is_some() {
+            let _ = self.finish();
+        }
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/zlib/bufread.rs b/android/vendor/flate2-1.0.24/src/zlib/bufread.rs
new file mode 100644
index 0000000..f1d3231
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/zlib/bufread.rs
@@ -0,0 +1,233 @@
+use std::io;
+use std::io::prelude::*;
+use std::mem;
+
+use crate::zio;
+use crate::{Compress, Decompress};
+
+/// A ZLIB encoder, or compressor.
+///
+/// This structure consumes a [`BufRead`] interface, reading uncompressed data
+/// from the underlying reader, and emitting compressed data.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use flate2::Compression;
+/// use flate2::bufread::ZlibEncoder;
+/// use std::fs::File;
+/// use std::io::BufReader;
+///
+/// // Use a buffered file to compress contents into a Vec<u8>
+///
+/// # fn open_hello_world() -> std::io::Result<Vec<u8>> {
+/// let f = File::open("examples/hello_world.txt")?;
+/// let b = BufReader::new(f);
+/// let mut z = ZlibEncoder::new(b, Compression::fast());
+/// let mut buffer = Vec::new();
+/// z.read_to_end(&mut buffer)?;
+/// # Ok(buffer)
+/// # }
+/// ```
+#[derive(Debug)]
+pub struct ZlibEncoder<R> {
+    obj: R,
+    data: Compress,
+}
+
+impl<R: BufRead> ZlibEncoder<R> {
+    /// Creates a new encoder which will read uncompressed data from the given
+    /// stream and emit the compressed stream.
+    pub fn new(r: R, level: crate::Compression) -> ZlibEncoder<R> {
+        ZlibEncoder {
+            obj: r,
+            data: Compress::new(level, true),
+        }
+    }
+}
+
+pub fn reset_encoder_data<R>(zlib: &mut ZlibEncoder<R>) {
+    zlib.data.reset()
+}
+
+impl<R> ZlibEncoder<R> {
+    /// Resets the state of this encoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This function will reset the internal state of this encoder and replace
+    /// the input stream with the one provided, returning the previous input
+    /// stream. Future data read from this encoder will be the compressed
+    /// version of `r`'s data.
+    pub fn reset(&mut self, r: R) -> R {
+        reset_encoder_data(self);
+        mem::replace(&mut self.obj, r)
+    }
+
+    /// Acquires a reference to the underlying reader
+    pub fn get_ref(&self) -> &R {
+        &self.obj
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        &mut self.obj
+    }
+
+    /// Consumes this encoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.obj
+    }
+
+    /// Returns the number of bytes that have been read into this compressor.
+    ///
+    /// Note that not all bytes read from the underlying object may be accounted
+    /// for, there may still be some active buffering.
+    pub fn total_in(&self) -> u64 {
+        self.data.total_in()
+    }
+
+    /// Returns the number of bytes that the compressor has produced.
+    ///
+    /// Note that not all bytes may have been read yet, some may still be
+    /// buffered.
+    pub fn total_out(&self) -> u64 {
+        self.data.total_out()
+    }
+}
+
+impl<R: BufRead> Read for ZlibEncoder<R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        zio::read(&mut self.obj, &mut self.data, buf)
+    }
+}
+
+impl<R: BufRead + Write> Write for ZlibEncoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A ZLIB decoder, or decompressor.
+///
+/// This structure consumes a [`BufRead`] interface, reading compressed data
+/// from the underlying reader, and emitting uncompressed data.
+///
+/// [`BufRead`]: https://doc.rust-lang.org/std/io/trait.BufRead.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::ZlibEncoder;
+/// use flate2::bufread::ZlibDecoder;
+///
+/// # fn main() {
+/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+/// # e.write_all(b"Hello World").unwrap();
+/// # let bytes = e.finish().unwrap();
+/// # println!("{}", decode_bufreader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Zlib Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements BufRead
+///
+/// fn decode_bufreader(bytes: Vec<u8>) -> io::Result<String> {
+///     let mut z = ZlibDecoder::new(&bytes[..]);
+///     let mut s = String::new();
+///     z.read_to_string(&mut s)?;
+///     Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct ZlibDecoder<R> {
+    obj: R,
+    data: Decompress,
+}
+
+impl<R: BufRead> ZlibDecoder<R> {
+    /// Creates a new decoder which will decompress data read from the given
+    /// stream.
+    pub fn new(r: R) -> ZlibDecoder<R> {
+        ZlibDecoder {
+            obj: r,
+            data: Decompress::new(true),
+        }
+    }
+}
+
+pub fn reset_decoder_data<R>(zlib: &mut ZlibDecoder<R>) {
+    zlib.data = Decompress::new(true);
+}
+
+impl<R> ZlibDecoder<R> {
+    /// Resets the state of this decoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This will reset the internal state of this decoder and replace the
+    /// input stream with the one provided, returning the previous input
+    /// stream. Future data read from this decoder will be the decompressed
+    /// version of `r`'s data.
+    pub fn reset(&mut self, r: R) -> R {
+        reset_decoder_data(self);
+        mem::replace(&mut self.obj, r)
+    }
+
+    /// Acquires a reference to the underlying stream
+    pub fn get_ref(&self) -> &R {
+        &self.obj
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        &mut self.obj
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    pub fn into_inner(self) -> R {
+        self.obj
+    }
+
+    /// Returns the number of bytes that the decompressor has consumed.
+    ///
+    /// Note that this will likely be smaller than what the decompressor
+    /// actually read from the underlying stream due to buffering.
+    pub fn total_in(&self) -> u64 {
+        self.data.total_in()
+    }
+
+    /// Returns the number of bytes that the decompressor has produced.
+    pub fn total_out(&self) -> u64 {
+        self.data.total_out()
+    }
+}
+
+impl<R: BufRead> Read for ZlibDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        zio::read(&mut self.obj, &mut self.data, into)
+    }
+}
+
+impl<R: BufRead + Write> Write for ZlibDecoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/zlib/mod.rs b/android/vendor/flate2-1.0.24/src/zlib/mod.rs
new file mode 100644
index 0000000..9d3de95
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/zlib/mod.rs
@@ -0,0 +1,159 @@
+pub mod bufread;
+pub mod read;
+pub mod write;
+
+#[cfg(test)]
+mod tests {
+    use std::io;
+    use std::io::prelude::*;
+
+    use rand::{thread_rng, Rng};
+
+    use crate::zlib::{read, write};
+    use crate::Compression;
+
+    #[test]
+    fn roundtrip() {
+        let mut real = Vec::new();
+        let mut w = write::ZlibEncoder::new(Vec::new(), Compression::default());
+        let v = crate::random_bytes().take(1024).collect::<Vec<_>>();
+        for _ in 0..200 {
+            let to_write = &v[..thread_rng().gen_range(0..v.len())];
+            real.extend(to_write.iter().map(|x| *x));
+            w.write_all(to_write).unwrap();
+        }
+        let result = w.finish().unwrap();
+        let mut r = read::ZlibDecoder::new(&result[..]);
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert!(ret == real);
+    }
+
+    #[test]
+    fn drop_writes() {
+        let mut data = Vec::new();
+        write::ZlibEncoder::new(&mut data, Compression::default())
+            .write_all(b"foo")
+            .unwrap();
+        let mut r = read::ZlibDecoder::new(&data[..]);
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert!(ret == b"foo");
+    }
+
+    #[test]
+    fn total_in() {
+        let mut real = Vec::new();
+        let mut w = write::ZlibEncoder::new(Vec::new(), Compression::default());
+        let v = crate::random_bytes().take(1024).collect::<Vec<_>>();
+        for _ in 0..200 {
+            let to_write = &v[..thread_rng().gen_range(0..v.len())];
+            real.extend(to_write.iter().map(|x| *x));
+            w.write_all(to_write).unwrap();
+        }
+        let mut result = w.finish().unwrap();
+
+        let result_len = result.len();
+
+        for _ in 0..200 {
+            result.extend(v.iter().map(|x| *x));
+        }
+
+        let mut r = read::ZlibDecoder::new(&result[..]);
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert!(ret == real);
+        assert_eq!(r.total_in(), result_len as u64);
+    }
+
+    #[test]
+    fn roundtrip2() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut r = read::ZlibDecoder::new(read::ZlibEncoder::new(&v[..], Compression::default()));
+        let mut ret = Vec::new();
+        r.read_to_end(&mut ret).unwrap();
+        assert_eq!(ret, v);
+    }
+
+    #[test]
+    fn roundtrip3() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut w =
+            write::ZlibEncoder::new(write::ZlibDecoder::new(Vec::new()), Compression::default());
+        w.write_all(&v).unwrap();
+        let w = w.finish().unwrap().finish().unwrap();
+        assert!(w == v);
+    }
+
+    #[test]
+    fn reset_decoder() {
+        let v = crate::random_bytes().take(1024 * 1024).collect::<Vec<_>>();
+        let mut w = write::ZlibEncoder::new(Vec::new(), Compression::default());
+        w.write_all(&v).unwrap();
+        let data = w.finish().unwrap();
+
+        {
+            let (mut a, mut b, mut c) = (Vec::new(), Vec::new(), Vec::new());
+            let mut r = read::ZlibDecoder::new(&data[..]);
+            r.read_to_end(&mut a).unwrap();
+            r.reset(&data);
+            r.read_to_end(&mut b).unwrap();
+
+            let mut r = read::ZlibDecoder::new(&data[..]);
+            r.read_to_end(&mut c).unwrap();
+            assert!(a == b && b == c && c == v);
+        }
+
+        {
+            let mut w = write::ZlibDecoder::new(Vec::new());
+            w.write_all(&data).unwrap();
+            let a = w.reset(Vec::new()).unwrap();
+            w.write_all(&data).unwrap();
+            let b = w.finish().unwrap();
+
+            let mut w = write::ZlibDecoder::new(Vec::new());
+            w.write_all(&data).unwrap();
+            let c = w.finish().unwrap();
+            assert!(a == b && b == c && c == v);
+        }
+    }
+
+    #[test]
+    fn bad_input() {
+        // regress tests: previously caused a panic on drop
+        let mut out: Vec<u8> = Vec::new();
+        let data: Vec<u8> = (0..255).cycle().take(1024).collect();
+        let mut w = write::ZlibDecoder::new(&mut out);
+        match w.write_all(&data[..]) {
+            Ok(_) => panic!("Expected an error to be returned!"),
+            Err(e) => assert_eq!(e.kind(), io::ErrorKind::InvalidInput),
+        }
+    }
+
+    #[test]
+    fn qc_reader() {
+        ::quickcheck::quickcheck(test as fn(_) -> _);
+
+        fn test(v: Vec<u8>) -> bool {
+            let mut r =
+                read::ZlibDecoder::new(read::ZlibEncoder::new(&v[..], Compression::default()));
+            let mut v2 = Vec::new();
+            r.read_to_end(&mut v2).unwrap();
+            v == v2
+        }
+    }
+
+    #[test]
+    fn qc_writer() {
+        ::quickcheck::quickcheck(test as fn(_) -> _);
+
+        fn test(v: Vec<u8>) -> bool {
+            let mut w = write::ZlibEncoder::new(
+                write::ZlibDecoder::new(Vec::new()),
+                Compression::default(),
+            );
+            w.write_all(&v).unwrap();
+            v == w.finish().unwrap().finish().unwrap()
+        }
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/zlib/read.rs b/android/vendor/flate2-1.0.24/src/zlib/read.rs
new file mode 100644
index 0000000..5094931
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/zlib/read.rs
@@ -0,0 +1,240 @@
+use std::io;
+use std::io::prelude::*;
+
+use super::bufread;
+use crate::bufreader::BufReader;
+
+/// A ZLIB encoder, or compressor.
+///
+/// This structure implements a [`Read`] interface and will read uncompressed
+/// data from an underlying stream and emit a stream of compressed data.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use flate2::Compression;
+/// use flate2::read::ZlibEncoder;
+/// use std::fs::File;
+///
+/// // Open example file and compress the contents using Read interface
+///
+/// # fn open_hello_world() -> std::io::Result<Vec<u8>> {
+/// let f = File::open("examples/hello_world.txt")?;
+/// let mut z = ZlibEncoder::new(f, Compression::fast());
+/// let mut buffer = [0;50];
+/// let byte_count = z.read(&mut buffer)?;
+/// # Ok(buffer[0..byte_count].to_vec())
+/// # }
+/// ```
+#[derive(Debug)]
+pub struct ZlibEncoder<R> {
+    inner: bufread::ZlibEncoder<BufReader<R>>,
+}
+
+impl<R: Read> ZlibEncoder<R> {
+    /// Creates a new encoder which will read uncompressed data from the given
+    /// stream and emit the compressed stream.
+    pub fn new(r: R, level: crate::Compression) -> ZlibEncoder<R> {
+        ZlibEncoder {
+            inner: bufread::ZlibEncoder::new(BufReader::new(r), level),
+        }
+    }
+}
+
+impl<R> ZlibEncoder<R> {
+    /// Resets the state of this encoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This function will reset the internal state of this encoder and replace
+    /// the input stream with the one provided, returning the previous input
+    /// stream. Future data read from this encoder will be the compressed
+    /// version of `r`'s data.
+    ///
+    /// Note that there may be currently buffered data when this function is
+    /// called, and in that case the buffered data is discarded.
+    pub fn reset(&mut self, r: R) -> R {
+        super::bufread::reset_encoder_data(&mut self.inner);
+        self.inner.get_mut().reset(r)
+    }
+
+    /// Acquires a reference to the underlying stream
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Consumes this encoder, returning the underlying reader.
+    ///
+    /// Note that there may be buffered bytes which are not re-acquired as part
+    /// of this transition. It's recommended to only call this function after
+    /// EOF has been reached.
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+
+    /// Returns the number of bytes that have been read into this compressor.
+    ///
+    /// Note that not all bytes read from the underlying object may be accounted
+    /// for, there may still be some active buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.total_in()
+    }
+
+    /// Returns the number of bytes that the compressor has produced.
+    ///
+    /// Note that not all bytes may have been read yet, some may still be
+    /// buffered.
+    pub fn total_out(&self) -> u64 {
+        self.inner.total_out()
+    }
+}
+
+impl<R: Read> Read for ZlibEncoder<R> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(buf)
+    }
+}
+
+impl<W: Read + Write> Write for ZlibEncoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
+
+/// A ZLIB decoder, or decompressor.
+///
+/// This structure implements a [`Read`] interface and takes a stream of
+/// compressed data as input, providing the decompressed data when read from.
+///
+/// [`Read`]: https://doc.rust-lang.org/std/io/trait.Read.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::ZlibEncoder;
+/// use flate2::read::ZlibDecoder;
+///
+/// # fn main() {
+/// # let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+/// # e.write_all(b"Hello World").unwrap();
+/// # let bytes = e.finish().unwrap();
+/// # println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Zlib Encoded vector of bytes and returns a string or error
+/// // Here &[u8] implements Read
+///
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///     let mut z = ZlibDecoder::new(&bytes[..]);
+///     let mut s = String::new();
+///     z.read_to_string(&mut s)?;
+///     Ok(s)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct ZlibDecoder<R> {
+    inner: bufread::ZlibDecoder<BufReader<R>>,
+}
+
+impl<R: Read> ZlibDecoder<R> {
+    /// Creates a new decoder which will decompress data read from the given
+    /// stream.
+    pub fn new(r: R) -> ZlibDecoder<R> {
+        ZlibDecoder::new_with_buf(r, vec![0; 32 * 1024])
+    }
+
+    /// Same as `new`, but the intermediate buffer for data is specified.
+    ///
+    /// Note that the specified buffer will only be used up to its current
+    /// length. The buffer's capacity will also not grow over time.
+    pub fn new_with_buf(r: R, buf: Vec<u8>) -> ZlibDecoder<R> {
+        ZlibDecoder {
+            inner: bufread::ZlibDecoder::new(BufReader::with_buf(buf, r)),
+        }
+    }
+}
+
+impl<R> ZlibDecoder<R> {
+    /// Resets the state of this decoder entirely, swapping out the input
+    /// stream for another.
+    ///
+    /// This will reset the internal state of this decoder and replace the
+    /// input stream with the one provided, returning the previous input
+    /// stream. Future data read from this decoder will be the decompressed
+    /// version of `r`'s data.
+    ///
+    /// Note that there may be currently buffered data when this function is
+    /// called, and in that case the buffered data is discarded.
+    pub fn reset(&mut self, r: R) -> R {
+        super::bufread::reset_decoder_data(&mut self.inner);
+        self.inner.get_mut().reset(r)
+    }
+
+    /// Acquires a reference to the underlying stream
+    pub fn get_ref(&self) -> &R {
+        self.inner.get_ref().get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying stream
+    ///
+    /// Note that mutation of the stream may result in surprising results if
+    /// this encoder is continued to be used.
+    pub fn get_mut(&mut self) -> &mut R {
+        self.inner.get_mut().get_mut()
+    }
+
+    /// Consumes this decoder, returning the underlying reader.
+    ///
+    /// Note that there may be buffered bytes which are not re-acquired as part
+    /// of this transition. It's recommended to only call this function after
+    /// EOF has been reached.
+    pub fn into_inner(self) -> R {
+        self.inner.into_inner().into_inner()
+    }
+
+    /// Returns the number of bytes that the decompressor has consumed.
+    ///
+    /// Note that this will likely be smaller than what the decompressor
+    /// actually read from the underlying stream due to buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.total_in()
+    }
+
+    /// Returns the number of bytes that the decompressor has produced.
+    pub fn total_out(&self) -> u64 {
+        self.inner.total_out()
+    }
+}
+
+impl<R: Read> Read for ZlibDecoder<R> {
+    fn read(&mut self, into: &mut [u8]) -> io::Result<usize> {
+        self.inner.read(into)
+    }
+}
+
+impl<R: Read + Write> Write for ZlibDecoder<R> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.get_mut().write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.get_mut().flush()
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/src/zlib/write.rs b/android/vendor/flate2-1.0.24/src/zlib/write.rs
new file mode 100644
index 0000000..c671814
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/src/zlib/write.rs
@@ -0,0 +1,321 @@
+use std::io;
+use std::io::prelude::*;
+
+use crate::zio;
+use crate::{Compress, Decompress};
+
+/// A ZLIB encoder, or compressor.
+///
+/// This structure implements a [`Write`] interface and takes a stream of
+/// uncompressed data, writing the compressed data to the wrapped writer.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use flate2::Compression;
+/// use flate2::write::ZlibEncoder;
+///
+/// // Vec<u8> implements Write, assigning the compressed bytes of sample string
+///
+/// # fn zlib_encoding() -> std::io::Result<()> {
+/// let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+/// e.write_all(b"Hello World")?;
+/// let compressed = e.finish()?;
+/// # Ok(())
+/// # }
+/// ```
+#[derive(Debug)]
+pub struct ZlibEncoder<W: Write> {
+    inner: zio::Writer<W, Compress>,
+}
+
+impl<W: Write> ZlibEncoder<W> {
+    /// Creates a new encoder which will write compressed data to the stream
+    /// given at the given compression level.
+    ///
+    /// When this encoder is dropped or unwrapped the final pieces of data will
+    /// be flushed.
+    pub fn new(w: W, level: crate::Compression) -> ZlibEncoder<W> {
+        ZlibEncoder {
+            inner: zio::Writer::new(w, Compress::new(level, true)),
+        }
+    }
+
+    /// Acquires a reference to the underlying writer.
+    pub fn get_ref(&self) -> &W {
+        self.inner.get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying writer.
+    ///
+    /// Note that mutating the output/input state of the stream may corrupt this
+    /// object, so care must be taken when using this method.
+    pub fn get_mut(&mut self) -> &mut W {
+        self.inner.get_mut()
+    }
+
+    /// Resets the state of this encoder entirely, swapping out the output
+    /// stream for another.
+    ///
+    /// This function will finish encoding the current stream into the current
+    /// output stream before swapping out the two output streams.
+    ///
+    /// After the current stream has been finished, this will reset the internal
+    /// state of this encoder and replace the output stream with the one
+    /// provided, returning the previous output stream. Future data written to
+    /// this encoder will be the compressed into the stream `w` provided.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn reset(&mut self, w: W) -> io::Result<W> {
+        self.inner.finish()?;
+        self.inner.data.reset();
+        Ok(self.inner.replace(w))
+    }
+
+    /// Attempt to finish this output stream, writing out final chunks of data.
+    ///
+    /// Note that this function can only be used once data has finished being
+    /// written to the output stream. After this function is called then further
+    /// calls to `write` may result in a panic.
+    ///
+    /// # Panics
+    ///
+    /// Attempts to write data to this stream may result in a panic after this
+    /// function is called.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn try_finish(&mut self) -> io::Result<()> {
+        self.inner.finish()
+    }
+
+    /// Consumes this encoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream, close off the compressed
+    /// stream and, if successful, return the contained writer.
+    ///
+    /// Note that this function may not be suitable to call in a situation where
+    /// the underlying stream is an asynchronous I/O stream. To finish a stream
+    /// the `try_finish` (or `shutdown`) method should be used instead. To
+    /// re-acquire ownership of a stream it is safe to call this method after
+    /// `try_finish` or `shutdown` has returned `Ok`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn finish(mut self) -> io::Result<W> {
+        self.inner.finish()?;
+        Ok(self.inner.take_inner())
+    }
+
+    /// Consumes this encoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream and then return the contained
+    /// writer if the flush succeeded.
+    /// The compressed stream will not closed but only flushed. This
+    /// means that obtained byte array can by extended by another deflated
+    /// stream. To close the stream add the two bytes 0x3 and 0x0.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn flush_finish(mut self) -> io::Result<W> {
+        self.inner.flush()?;
+        Ok(self.inner.take_inner())
+    }
+
+    /// Returns the number of bytes that have been written to this compressor.
+    ///
+    /// Note that not all bytes written to this object may be accounted for,
+    /// there may still be some active buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.data.total_in()
+    }
+
+    /// Returns the number of bytes that the compressor has produced.
+    ///
+    /// Note that not all bytes may have been written yet, some may still be
+    /// buffered.
+    pub fn total_out(&self) -> u64 {
+        self.inner.data.total_out()
+    }
+}
+
+impl<W: Write> Write for ZlibEncoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.inner.write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
+    }
+}
+
+impl<W: Read + Write> Read for ZlibEncoder<W> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.get_mut().read(buf)
+    }
+}
+
+/// A ZLIB decoder, or decompressor.
+///
+/// This structure implements a [`Write`] and will emit a stream of decompressed
+/// data when fed a stream of compressed data.
+///
+/// [`Write`]: https://doc.rust-lang.org/std/io/trait.Write.html
+///
+/// # Examples
+///
+/// ```
+/// use std::io::prelude::*;
+/// use std::io;
+/// # use flate2::Compression;
+/// # use flate2::write::ZlibEncoder;
+/// use flate2::write::ZlibDecoder;
+///
+/// # fn main() {
+/// #    let mut e = ZlibEncoder::new(Vec::new(), Compression::default());
+/// #    e.write_all(b"Hello World").unwrap();
+/// #    let bytes = e.finish().unwrap();
+/// #    println!("{}", decode_reader(bytes).unwrap());
+/// # }
+/// #
+/// // Uncompresses a Zlib Encoded vector of bytes and returns a string or error
+/// // Here Vec<u8> implements Write
+///
+/// fn decode_reader(bytes: Vec<u8>) -> io::Result<String> {
+///    let mut writer = Vec::new();
+///    let mut z = ZlibDecoder::new(writer);
+///    z.write_all(&bytes[..])?;
+///    writer = z.finish()?;
+///    let return_string = String::from_utf8(writer).expect("String parsing error");
+///    Ok(return_string)
+/// }
+/// ```
+#[derive(Debug)]
+pub struct ZlibDecoder<W: Write> {
+    inner: zio::Writer<W, Decompress>,
+}
+
+impl<W: Write> ZlibDecoder<W> {
+    /// Creates a new decoder which will write uncompressed data to the stream.
+    ///
+    /// When this decoder is dropped or unwrapped the final pieces of data will
+    /// be flushed.
+    pub fn new(w: W) -> ZlibDecoder<W> {
+        ZlibDecoder {
+            inner: zio::Writer::new(w, Decompress::new(true)),
+        }
+    }
+
+    /// Acquires a reference to the underlying writer.
+    pub fn get_ref(&self) -> &W {
+        self.inner.get_ref()
+    }
+
+    /// Acquires a mutable reference to the underlying writer.
+    ///
+    /// Note that mutating the output/input state of the stream may corrupt this
+    /// object, so care must be taken when using this method.
+    pub fn get_mut(&mut self) -> &mut W {
+        self.inner.get_mut()
+    }
+
+    /// Resets the state of this decoder entirely, swapping out the output
+    /// stream for another.
+    ///
+    /// This will reset the internal state of this decoder and replace the
+    /// output stream with the one provided, returning the previous output
+    /// stream. Future data written to this decoder will be decompressed into
+    /// the output stream `w`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn reset(&mut self, w: W) -> io::Result<W> {
+        self.inner.finish()?;
+        self.inner.data = Decompress::new(true);
+        Ok(self.inner.replace(w))
+    }
+
+    /// Attempt to finish this output stream, writing out final chunks of data.
+    ///
+    /// Note that this function can only be used once data has finished being
+    /// written to the output stream. After this function is called then further
+    /// calls to `write` may result in a panic.
+    ///
+    /// # Panics
+    ///
+    /// Attempts to write data to this stream may result in a panic after this
+    /// function is called.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn try_finish(&mut self) -> io::Result<()> {
+        self.inner.finish()
+    }
+
+    /// Consumes this encoder, flushing the output stream.
+    ///
+    /// This will flush the underlying data stream and then return the contained
+    /// writer if the flush succeeded.
+    ///
+    /// Note that this function may not be suitable to call in a situation where
+    /// the underlying stream is an asynchronous I/O stream. To finish a stream
+    /// the `try_finish` (or `shutdown`) method should be used instead. To
+    /// re-acquire ownership of a stream it is safe to call this method after
+    /// `try_finish` or `shutdown` has returned `Ok`.
+    ///
+    /// # Errors
+    ///
+    /// This function will perform I/O to complete this stream, and any I/O
+    /// errors which occur will be returned from this function.
+    pub fn finish(mut self) -> io::Result<W> {
+        self.inner.finish()?;
+        Ok(self.inner.take_inner())
+    }
+
+    /// Returns the number of bytes that the decompressor has consumed for
+    /// decompression.
+    ///
+    /// Note that this will likely be smaller than the number of bytes
+    /// successfully written to this stream due to internal buffering.
+    pub fn total_in(&self) -> u64 {
+        self.inner.data.total_in()
+    }
+
+    /// Returns the number of bytes that the decompressor has written to its
+    /// output stream.
+    pub fn total_out(&self) -> u64 {
+        self.inner.data.total_out()
+    }
+}
+
+impl<W: Write> Write for ZlibDecoder<W> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        self.inner.write(buf)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
+    }
+}
+
+impl<W: Read + Write> Read for ZlibDecoder<W> {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        self.inner.get_mut().read(buf)
+    }
+}
diff --git a/android/vendor/flate2-1.0.24/tests/corrupt-gz-file.bin b/android/vendor/flate2-1.0.24/tests/corrupt-gz-file.bin
new file mode 100644
index 0000000..159333b
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/corrupt-gz-file.bin
Binary files differ
diff --git a/android/vendor/flate2-1.0.24/tests/early-flush.rs b/android/vendor/flate2-1.0.24/tests/early-flush.rs
new file mode 100644
index 0000000..e717ada
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/early-flush.rs
@@ -0,0 +1,20 @@
+extern crate flate2;
+
+use std::io::{Read, Write};
+
+use flate2::read::GzDecoder;
+use flate2::write::GzEncoder;
+
+#[test]
+fn smoke() {
+    let mut w = GzEncoder::new(Vec::new(), flate2::Compression::default());
+    w.flush().unwrap();
+    w.write_all(b"hello").unwrap();
+
+    let bytes = w.finish().unwrap();
+
+    let mut r = GzDecoder::new(&bytes[..]);
+    let mut s = String::new();
+    r.read_to_string(&mut s).unwrap();
+    assert_eq!(s, "hello");
+}
diff --git a/android/vendor/flate2-1.0.24/tests/empty-read.rs b/android/vendor/flate2-1.0.24/tests/empty-read.rs
new file mode 100644
index 0000000..7551238
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/empty-read.rs
@@ -0,0 +1,82 @@
+extern crate flate2;
+
+use std::io::{Read, Write};
+
+#[test]
+fn deflate_decoder_empty_read() {
+    let original: &[u8] = b"Lorem ipsum dolor sit amet.";
+    let mut encoder =
+        flate2::write::DeflateEncoder::new(Vec::new(), flate2::Compression::default());
+    encoder.write_all(original).unwrap();
+    let encoded: Vec<u8> = encoder.finish().unwrap();
+    let mut decoder = flate2::read::DeflateDecoder::new(encoded.as_slice());
+    assert_eq!(decoder.read(&mut []).unwrap(), 0);
+    let mut decoded = Vec::new();
+    decoder.read_to_end(&mut decoded).unwrap();
+    assert_eq!(decoded.as_slice(), original);
+}
+
+#[test]
+fn deflate_encoder_empty_read() {
+    let original: &[u8] = b"Lorem ipsum dolor sit amet.";
+    let mut encoder = flate2::read::DeflateEncoder::new(original, flate2::Compression::default());
+    assert_eq!(encoder.read(&mut []).unwrap(), 0);
+    let mut encoded = Vec::new();
+    encoder.read_to_end(&mut encoded).unwrap();
+    let mut decoder = flate2::read::DeflateDecoder::new(encoded.as_slice());
+    let mut decoded = Vec::new();
+    decoder.read_to_end(&mut decoded).unwrap();
+    assert_eq!(decoded.as_slice(), original);
+}
+
+#[test]
+fn gzip_decoder_empty_read() {
+    let original: &[u8] = b"Lorem ipsum dolor sit amet.";
+    let mut encoder = flate2::write::GzEncoder::new(Vec::new(), flate2::Compression::default());
+    encoder.write_all(original).unwrap();
+    let encoded: Vec<u8> = encoder.finish().unwrap();
+    let mut decoder = flate2::read::GzDecoder::new(encoded.as_slice());
+    assert_eq!(decoder.read(&mut []).unwrap(), 0);
+    let mut decoded = Vec::new();
+    decoder.read_to_end(&mut decoded).unwrap();
+    assert_eq!(decoded.as_slice(), original);
+}
+
+#[test]
+fn gzip_encoder_empty_read() {
+    let original: &[u8] = b"Lorem ipsum dolor sit amet.";
+    let mut encoder = flate2::read::GzEncoder::new(original, flate2::Compression::default());
+    assert_eq!(encoder.read(&mut []).unwrap(), 0);
+    let mut encoded = Vec::new();
+    encoder.read_to_end(&mut encoded).unwrap();
+    let mut decoder = flate2::read::GzDecoder::new(encoded.as_slice());
+    let mut decoded = Vec::new();
+    decoder.read_to_end(&mut decoded).unwrap();
+    assert_eq!(decoded.as_slice(), original);
+}
+
+#[test]
+fn zlib_decoder_empty_read() {
+    let original: &[u8] = b"Lorem ipsum dolor sit amet.";
+    let mut encoder = flate2::write::ZlibEncoder::new(Vec::new(), flate2::Compression::default());
+    encoder.write_all(original).unwrap();
+    let encoded: Vec<u8> = encoder.finish().unwrap();
+    let mut decoder = flate2::read::ZlibDecoder::new(encoded.as_slice());
+    assert_eq!(decoder.read(&mut []).unwrap(), 0);
+    let mut decoded = Vec::new();
+    decoder.read_to_end(&mut decoded).unwrap();
+    assert_eq!(decoded.as_slice(), original);
+}
+
+#[test]
+fn zlib_encoder_empty_read() {
+    let original: &[u8] = b"Lorem ipsum dolor sit amet.";
+    let mut encoder = flate2::read::ZlibEncoder::new(original, flate2::Compression::default());
+    assert_eq!(encoder.read(&mut []).unwrap(), 0);
+    let mut encoded = Vec::new();
+    encoder.read_to_end(&mut encoded).unwrap();
+    let mut decoder = flate2::read::ZlibDecoder::new(encoded.as_slice());
+    let mut decoded = Vec::new();
+    decoder.read_to_end(&mut decoded).unwrap();
+    assert_eq!(decoded.as_slice(), original);
+}
diff --git a/android/vendor/flate2-1.0.24/tests/good-file.gz b/android/vendor/flate2-1.0.24/tests/good-file.gz
new file mode 100644
index 0000000..f968689
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/good-file.gz
Binary files differ
diff --git a/android/vendor/flate2-1.0.24/tests/good-file.txt b/android/vendor/flate2-1.0.24/tests/good-file.txt
new file mode 100644
index 0000000..ee39ac5
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/good-file.txt
@@ -0,0 +1,733 @@
+##	##
+timestep	simulated EIR	patent hosts
+0	0.136402	16855
+1	0.146872	18564
+2	0.150157	20334
+3	0.146358	22159
+4	0.136315	23655
+5	0.122354	24848
+6	0.104753	25887
+7	0.084439	26770
+8	0.06417	27238
+9	0.0450397	27349
+10	0.0295473	27274
+11	0.0184662	26909
+12	0.0110032	26324
+13	0.00634348	25513
+14	0.0036144	24469
+15	0.00208133	23383
+16	0.00122468	22345
+17	0.000752514	21342
+18	0.000545333	20416
+19	0.000546139	19657
+20	0.00054572	18806
+21	0.000545757	18015
+22	0.000545898	17349
+23	0.000546719	16594
+24	0.000547353	15955
+25	0.000547944	15374
+26	0.000547606	14765
+27	0.000594773	14212
+28	0.000969163	13677
+29	0.00168295	13180
+30	0.003059	12760
+31	0.00571599	12313
+32	0.0107918	11896
+33	0.0201943	11512
+34	0.0368013	11340
+35	0.0640629	11323
+36	0.104447	11769
+37	0.157207	12728
+38	0.216682	14261
+39	0.271159	16491
+40	0.303552	19274
+41	0.303678	22157
+42	0.271945	24875
+43	0.215445	27027
+44	0.154503	28690
+45	0.100717	30046
+46	0.0600343	30602
+47	0.0328576	30709
+48	0.016964	30315
+49	0.00841526	29310
+50	0.0040958	28058
+51	0.0019953	26662
+52	0.000986531	25259
+53	0.000545786	24049
+54	0.000546405	22966
+55	0.000546036	21933
+56	0.00054427	20953
+57	0.000542769	20057
+58	0.000541566	19304
+59	0.000541822	18477
+60	0.000541643	17695
+61	0.000541989	17002
+62	0.000769298	16391
+63	0.00150811	15805
+64	0.00295097	15172
+65	0.00566197	14690
+66	0.0105243	14206
+67	0.0186965	13791
+68	0.0313363	13470
+69	0.0490605	13377
+70	0.0711679	13631
+71	0.0953625	14209
+72	0.118026	15277
+73	0.134612	16760
+74	0.144311	18339
+75	0.146328	20124
+76	0.142936	21803
+77	0.134029	23435
+78	0.120562	24854
+79	0.103157	25880
+80	0.0834054	26597
+81	0.0632474	27226
+82	0.0447785	27294
+83	0.0295654	27169
+84	0.0184081	26803
+85	0.0109489	26265
+86	0.00631234	25375
+87	0.00359978	24306
+88	0.00206967	23260
+89	0.00122197	22225
+90	0.000751031	21277
+91	0.000544507	20295
+92	0.000543897	19417
+93	0.000543483	18623
+94	0.000542926	17837
+95	0.000542685	17070
+96	0.000542387	16424
+97	0.000541194	15838
+98	0.000540427	15177
+99	0.000540774	14608
+100	0.000588312	14066
+101	0.000959183	13499
+102	0.00166774	12979
+103	0.00303278	12545
+104	0.00567457	12067
+105	0.0107272	11712
+106	0.0200606	11368
+107	0.0364637	11207
+108	0.063339	11238
+109	0.103717	11660
+110	0.156884	12621
+111	0.217072	14151
+112	0.272311	16358
+113	0.305046	19005
+114	0.304927	21926
+115	0.272427	24662
+116	0.216478	27080
+117	0.155168	29064
+118	0.10079	30370
+119	0.0599659	30992
+120	0.0331287	30975
+121	0.017235	30317
+122	0.00860221	29455
+123	0.00419286	28172
+124	0.00203361	26809
+125	0.000998847	25476
+126	0.000551418	24230
+127	0.000551119	23106
+128	0.000552786	22147
+129	0.000553814	21183
+130	0.000553743	20280
+131	0.000554428	19423
+132	0.000555022	18598
+133	0.000555921	17864
+134	0.000556687	17187
+135	0.000789996	16527
+136	0.00154597	15870
+137	0.00302776	15226
+138	0.00581484	14685
+139	0.010812	14234
+140	0.0191832	13818
+141	0.0321572	13571
+142	0.050328	13538
+143	0.072817	13812
+144	0.0974321	14368
+145	0.120225	15436
+146	0.137418	16988
+147	0.147086	18775
+148	0.149165	20563
+149	0.144943	22223
+150	0.136631	23741
+151	0.123355	24920
+152	0.105401	25779
+153	0.0851918	26781
+154	0.0641702	27265
+155	0.0450746	27505
+156	0.0294136	27416
+157	0.0183811	27028
+158	0.0109285	26260
+159	0.00634296	25451
+160	0.00364513	24472
+161	0.0021051	23427
+162	0.00123693	22403
+163	0.000759531	21393
+164	0.000551727	20485
+165	0.000552256	19660
+166	0.000552303	18862
+167	0.000550927	18094
+168	0.000551098	17378
+169	0.000551093	16691
+170	0.000551885	16050
+171	0.000552282	15420
+172	0.000552591	14878
+173	0.00060109	14357
+174	0.000980446	13768
+175	0.00170301	13241
+176	0.003096	12745
+177	0.00579971	12294
+178	0.010976	11879
+179	0.0205422	11636
+180	0.0374515	11431
+181	0.0649916	11517
+182	0.106008	11966
+183	0.159983	12918
+184	0.221127	14484
+185	0.276503	16696
+186	0.310316	19518
+187	0.311205	22301
+188	0.276769	25047
+189	0.220506	27360
+190	0.159123	29133
+191	0.103761	30440
+192	0.0613797	31087
+193	0.033583	31037
+194	0.0173275	30555
+195	0.00861968	29617
+196	0.00419503	28292
+197	0.00203304	26944
+198	0.00100126	25569
+199	0.000553511	24349
+200	0.000554687	23257
+201	0.00055586	22204
+202	0.000555419	21176
+203	0.000556032	20316
+204	0.000555974	19509
+205	0.000556859	18746
+206	0.000556996	17978
+207	0.000557102	17288
+208	0.000790187	16672
+209	0.00154711	16057
+210	0.00303521	15449
+211	0.00584201	14915
+212	0.0108854	14397
+213	0.0193386	14010
+214	0.0324346	13730
+215	0.0507192	13674
+216	0.0736661	13874
+217	0.0987887	14515
+218	0.122411	15693
+219	0.139964	17265
+220	0.149125	18894
+221	0.151434	20662
+222	0.148067	22442
+223	0.138894	24116
+224	0.125436	25367
+225	0.107664	26360
+226	0.0865709	27044
+227	0.0655588	27428
+228	0.0459664	27714
+229	0.0301384	27687
+230	0.0186481	27262
+231	0.01103	26677
+232	0.00636957	25722
+233	0.00366188	24662
+234	0.00212213	23575
+235	0.00125358	22520
+236	0.000768665	21480
+237	0.000556393	20563
+238	0.000555892	19706
+239	0.00055534	18914
+240	0.000555027	18165
+241	0.000555062	17432
+242	0.000553766	16733
+243	0.000552984	16070
+244	0.000553634	15396
+245	0.000554286	14867
+246	0.000603759	14362
+247	0.000982974	13867
+248	0.00170532	13379
+249	0.00310471	12907
+250	0.00582577	12446
+251	0.0110122	12018
+252	0.0206284	11730
+253	0.0375835	11546
+254	0.0652192	11605
+255	0.10646	11981
+256	0.160858	12949
+257	0.223122	14478
+258	0.279678	16810
+259	0.312171	19452
+260	0.311778	22391
+261	0.276966	25204
+262	0.22251	27379
+263	0.159246	29248
+264	0.104109	30532
+265	0.0617903	30995
+266	0.0338421	31042
+267	0.0174647	30620
+268	0.00867821	29589
+269	0.00419968	28293
+270	0.00203244	26916
+271	0.00100204	25464
+272	0.000555586	24219
+273	0.000555599	23207
+274	0.00055582	22187
+275	0.00055516	21136
+276	0.000555436	20243
+277	0.000555618	19426
+278	0.000556778	18635
+279	0.000556976	17870
+280	0.000557162	17190
+281	0.0007904	16506
+282	0.00154557	15837
+283	0.00302973	15234
+284	0.00584543	14717
+285	0.0108796	14225
+286	0.0192919	13810
+287	0.032329	13605
+288	0.0505293	13536
+289	0.0733417	13760
+290	0.0982413	14378
+291	0.121477	15400
+292	0.138636	17017
+293	0.14875	18764
+294	0.150515	20516
+295	0.146372	22389
+296	0.137332	23975
+297	0.124076	25120
+298	0.106469	26137
+299	0.0862987	26973
+300	0.0650552	27584
+301	0.0456456	27741
+302	0.0300744	27565
+303	0.0187879	27212
+304	0.0112085	26432
+305	0.00648306	25501
+306	0.00370346	24466
+307	0.00213399	23472
+308	0.00125463	22415
+309	0.000765794	21427
+310	0.000552587	20533
+311	0.000553175	19632
+312	0.000553525	18831
+313	0.000554941	18119
+314	0.000556327	17336
+315	0.000556008	16721
+316	0.00055593	16086
+317	0.000556421	15516
+318	0.000557308	14918
+319	0.00060681	14402
+320	0.000990746	13849
+321	0.00172359	13355
+322	0.00313688	12902
+323	0.0058708	12425
+324	0.0110637	12087
+325	0.0206777	11743
+326	0.0376394	11531
+327	0.0656182	11582
+328	0.107414	12034
+329	0.162101	12955
+330	0.223525	14571
+331	0.279935	16842
+332	0.314601	19566
+333	0.313556	22575
+334	0.279571	25279
+335	0.221638	27642
+336	0.158038	29275
+337	0.102505	30638
+338	0.0608328	31209
+339	0.0335531	31260
+340	0.0173332	30520
+341	0.00861545	29604
+342	0.00419454	28370
+343	0.00202587	26940
+344	0.000994029	25614
+345	0.000549339	24445
+346	0.000551477	23239
+347	0.000552891	22300
+348	0.000551775	21280
+349	0.000552425	20424
+350	0.000552135	19571
+351	0.000552542	18753
+352	0.000552863	18058
+353	0.000554438	17348
+354	0.000786735	16671
+355	0.00153958	16047
+356	0.00301482	15500
+357	0.00580589	14883
+358	0.0108227	14347
+359	0.0192357	13947
+360	0.0321613	13672
+361	0.050229	13606
+362	0.0729462	13815
+363	0.0978564	14566
+364	0.120879	15674
+365	0.137663	17049
+366	0.147092	18813
+367	0.150184	20578
+368	0.146971	22245
+369	0.136769	23723
+370	0.12367	24905
+371	0.106187	25871
+372	0.0860921	26687
+373	0.0645899	27375
+374	0.0453473	27635
+375	0.0298122	27551
+376	0.0185448	27134
+377	0.0110517	26468
+378	0.00640294	25661
+379	0.00367011	24653
+380	0.00211832	23556
+381	0.00125246	22513
+382	0.00076891	21568
+383	0.000557384	20672
+384	0.000557295	19811
+385	0.000556837	18982
+386	0.000557433	18179
+387	0.000557376	17457
+388	0.000557751	16720
+389	0.000556844	16112
+390	0.000555603	15479
+391	0.000554871	14809
+392	0.00060335	14275
+393	0.000982808	13757
+394	0.00170757	13221
+395	0.00310351	12758
+396	0.0058181	12286
+397	0.010991	11906
+398	0.0205342	11557
+399	0.0373486	11393
+400	0.0647659	11487
+401	0.105589	11887
+402	0.15967	12798
+403	0.220945	14260
+404	0.277122	16477
+405	0.310108	19295
+406	0.308854	22110
+407	0.274911	24915
+408	0.218618	27273
+409	0.156618	29189
+410	0.101775	30572
+411	0.0607503	31174
+412	0.0334708	31316
+413	0.0173443	30731
+414	0.00865633	29636
+415	0.00421141	28342
+416	0.00204387	26991
+417	0.00100602	25595
+418	0.000555131	24336
+419	0.000555037	23251
+420	0.000555559	22267
+421	0.000554916	21212
+422	0.000554432	20306
+423	0.000554751	19488
+424	0.00055638	18727
+425	0.000556727	17927
+426	0.000556368	17198
+427	0.000788004	16578
+428	0.00154404	15944
+429	0.00302383	15315
+430	0.00582586	14786
+431	0.0108457	14290
+432	0.0192962	13815
+433	0.0323072	13561
+434	0.0505101	13456
+435	0.0732162	13811
+436	0.0978737	14403
+437	0.121405	15460
+438	0.138202	16993
+439	0.1482	18710
+440	0.149707	20578
+441	0.146945	22256
+442	0.137785	23713
+443	0.123767	25058
+444	0.105989	26087
+445	0.085483	26759
+446	0.0646144	27375
+447	0.0454389	27680
+448	0.0299337	27531
+449	0.018663	27041
+450	0.0111347	26416
+451	0.00644197	25614
+452	0.00369229	24666
+453	0.00211986	23647
+454	0.00124761	22650
+455	0.000769104	21642
+456	0.000558796	20693
+457	0.000559908	19746
+458	0.000559562	18952
+459	0.00056042	18100
+460	0.000559447	17401
+461	0.000557893	16756
+462	0.000557137	16148
+463	0.000557269	15504
+464	0.000557596	14974
+465	0.000606298	14408
+466	0.000987712	13909
+467	0.00171257	13402
+468	0.00311667	12891
+469	0.00584794	12433
+470	0.0110774	11980
+471	0.0207006	11713
+472	0.037673	11583
+473	0.0654988	11677
+474	0.106982	12072
+475	0.161926	12898
+476	0.224327	14548
+477	0.281709	16796
+478	0.314567	19512
+479	0.313419	22428
+480	0.278962	25186
+481	0.221864	27755
+482	0.158559	29556
+483	0.103532	30572
+484	0.0611592	31162
+485	0.0337539	31197
+486	0.0175096	30619
+487	0.00865906	29606
+488	0.00420125	28271
+489	0.00203207	26856
+490	0.00100238	25542
+491	0.000554405	24306
+492	0.00055373	23160
+493	0.0005552	22152
+494	0.000553776	21192
+495	0.000553636	20302
+496	0.000553165	19505
+497	0.000554014	18719
+498	0.00055519	17993
+499	0.000556582	17233
+500	0.000788165	16569
+501	0.00154132	15953
+502	0.00302099	15350
+503	0.00581186	14752
+504	0.0108291	14267
+505	0.0192368	13946
+506	0.0322191	13677
+507	0.0503789	13594
+508	0.0730706	13768
+509	0.0980646	14416
+510	0.121601	15634
+511	0.139046	17110
+512	0.147779	18876
+513	0.149612	20734
+514	0.145796	22414
+515	0.136936	23884
+516	0.123807	25078
+517	0.106212	26066
+518	0.0855482	26779
+519	0.0643386	27340
+520	0.0452926	27530
+521	0.0298659	27573
+522	0.0185447	27169
+523	0.0110178	26489
+524	0.00635235	25588
+525	0.00362881	24549
+526	0.00209238	23528
+527	0.00123133	22541
+528	0.000755917	21498
+529	0.000546368	20607
+530	0.000547382	19712
+531	0.000547084	18975
+532	0.000546453	18178
+533	0.000546062	17452
+534	0.000546085	16749
+535	0.000546151	16135
+536	0.000545628	15567
+537	0.000545969	14968
+538	0.000594606	14392
+539	0.000968849	13854
+540	0.00168489	13360
+541	0.00306337	12899
+542	0.00573505	12407
+543	0.0108348	12017
+544	0.02025	11713
+545	0.0368201	11517
+546	0.0639795	11556
+547	0.104882	11941
+548	0.158923	12854
+549	0.219796	14396
+550	0.275801	16733
+551	0.307622	19367
+552	0.30785	22230
+553	0.272898	24873
+554	0.217351	27152
+555	0.156138	29108
+556	0.101477	30379
+557	0.0601091	30971
+558	0.0331551	31126
+559	0.017167	30418
+560	0.00853886	29430
+561	0.00415201	28190
+562	0.00201849	26849
+563	0.000991957	25528
+564	0.000546751	24180
+565	0.00054534	23090
+566	0.000544403	22096
+567	0.00054368	21140
+568	0.000543407	20213
+569	0.000544421	19405
+570	0.000545241	18625
+571	0.000546995	17868
+572	0.000547101	17102
+573	0.00077428	16423
+574	0.00151348	15783
+575	0.00296212	15220
+576	0.00569555	14602
+577	0.0106307	14154
+578	0.0188783	13743
+579	0.0316572	13538
+580	0.0495211	13467
+581	0.0718936	13665
+582	0.0961304	14240
+583	0.119127	15341
+584	0.136233	16912
+585	0.145327	18567
+586	0.146983	20301
+587	0.143022	21953
+588	0.134931	23439
+589	0.121892	24750
+590	0.103955	25688
+591	0.0833804	26253
+592	0.0625106	26918
+593	0.0440419	27279
+594	0.0290823	27159
+595	0.0180758	26786
+596	0.0107654	26049
+597	0.00622673	25202
+598	0.00356716	24168
+599	0.00205866	23122
+600	0.00121254	22076
+601	0.000745744	21100
+602	0.000537789	20207
+603	0.000537982	19340
+604	0.000537795	18527
+605	0.000537955	17768
+606	0.000539259	17117
+607	0.00053942	16425
+608	0.000540477	15701
+609	0.000540424	15134
+610	0.000540084	14558
+611	0.00058571	14069
+612	0.00095364	13498
+613	0.00165505	13054
+614	0.00300205	12616
+615	0.00561724	12142
+616	0.0106079	11720
+617	0.0198178	11410
+618	0.0360368	11231
+619	0.0623418	11314
+620	0.101856	11688
+621	0.15376	12623
+622	0.213046	14078
+623	0.267285	16225
+624	0.299225	18856
+625	0.299517	21756
+626	0.26697	24652
+627	0.2119	27051
+628	0.151393	28925
+629	0.098869	30065
+630	0.0593653	30570
+631	0.0327177	30483
+632	0.0170081	29735
+633	0.0084493	28844
+634	0.00409333	27665
+635	0.00197466	26356
+636	0.000967996	25009
+637	0.000533137	23839
+638	0.000532992	22721
+639	0.000534258	21676
+640	0.000534251	20709
+641	0.000534556	19798
+642	0.000535287	19008
+643	0.000536214	18278
+644	0.000536647	17547
+645	0.000536556	16901
+646	0.000761043	16256
+647	0.00149108	15621
+648	0.00292808	15032
+649	0.0056527	14504
+650	0.0105421	14010
+651	0.0186823	13646
+652	0.0312164	13356
+653	0.0485643	13404
+654	0.0704061	13612
+655	0.0945219	14230
+656	0.117178	15374
+657	0.134568	16843
+658	0.144475	18492
+659	0.146915	20238
+660	0.14393	21958
+661	0.134621	23537
+662	0.121737	24773
+663	0.104744	25772
+664	0.0846226	26427
+665	0.0639754	27040
+666	0.0448457	27279
+667	0.029482	27106
+668	0.0183036	26853
+669	0.0108721	26178
+670	0.00627116	25425
+671	0.0035776	24326
+672	0.00206466	23279
+673	0.00122064	22191
+674	0.000751578	21231
+675	0.000542574	20323
+676	0.000540396	19496
+677	0.000538805	18651
+678	0.00053881	17920
+679	0.000537801	17217
+680	0.000537866	16520
+681	0.000538522	15876
+682	0.000538795	15229
+683	0.000539519	14656
+684	0.000587348	14121
+685	0.000955855	13626
+686	0.00165656	13086
+687	0.00301095	12666
+688	0.00564993	12250
+689	0.0106767	11869
+690	0.0199729	11524
+691	0.03641	11331
+692	0.0632378	11402
+693	0.103483	11788
+694	0.156399	12682
+695	0.215591	14337
+696	0.269462	16547
+697	0.303615	19239
+698	0.304506	22023
+699	0.273068	24769
+700	0.21682	27223
+701	0.154934	29029
+702	0.100495	30241
+703	0.0597382	30801
+704	0.0329221	30881
+705	0.0170591	30288
+706	0.00845353	29329
+707	0.00408176	28108
+708	0.00198037	26715
+709	0.000977102	25340
+710	0.000541566	24039
+711	0.000542333	22965
+712	0.000542417	21858
+713	0.000541182	20952
+714	0.00054038	20049
+715	0.000539725	19192
+716	0.000539603	18409
+717	0.000539754	17700
+718	0.000539679	16960
+719	0.000763508	16287
+720	0.00149327	15637
+721	0.00292609	15057
+722	0.00563308	14524
+723	0.0104893	14003
+724	0.0185874	13625
+725	0.0310985	13319
+726	0.0487417	13278
+727	0.0707124	13502
+728	0.0947795	14147
+729	0.117155	15183
+730	0.133995	16622
diff --git a/android/vendor/flate2-1.0.24/tests/gunzip.rs b/android/vendor/flate2-1.0.24/tests/gunzip.rs
new file mode 100644
index 0000000..c382032
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/gunzip.rs
@@ -0,0 +1,77 @@
+extern crate flate2;
+
+use flate2::read::GzDecoder;
+use flate2::read::MultiGzDecoder;
+use std::fs::File;
+use std::io::prelude::*;
+use std::io::{self, BufReader};
+use std::path::Path;
+
+// test extraction of a gzipped file
+#[test]
+fn test_extract_success() {
+    let content = extract_file(Path::new("tests/good-file.gz")).unwrap();
+    let mut expected = Vec::new();
+    File::open("tests/good-file.txt")
+        .unwrap()
+        .read_to_end(&mut expected)
+        .unwrap();
+    assert!(content == expected);
+}
+//
+// test partial extraction of a multistream gzipped file
+#[test]
+fn test_extract_success_partial_multi() {
+    let content = extract_file(Path::new("tests/multi.gz")).unwrap();
+    let mut expected = String::new();
+    BufReader::new(File::open("tests/multi.txt").unwrap())
+        .read_line(&mut expected)
+        .unwrap();
+    assert_eq!(content, expected.as_bytes());
+}
+
+// test extraction fails on a corrupt file
+#[test]
+fn test_extract_failure() {
+    let result = extract_file(Path::new("tests/corrupt-gz-file.bin"));
+    assert_eq!(result.err().unwrap().kind(), io::ErrorKind::InvalidInput);
+}
+
+//test complete extraction of a multistream gzipped file
+#[test]
+fn test_extract_success_multi() {
+    let content = extract_file_multi(Path::new("tests/multi.gz")).unwrap();
+    let mut expected = Vec::new();
+    File::open("tests/multi.txt")
+        .unwrap()
+        .read_to_end(&mut expected)
+        .unwrap();
+    assert_eq!(content, expected);
+}
+
+// Tries to extract path into memory (assuming a .gz file).
+fn extract_file(path_compressed: &Path) -> io::Result<Vec<u8>> {
+    let mut v = Vec::new();
+    let f = File::open(path_compressed)?;
+    GzDecoder::new(f).read_to_end(&mut v)?;
+    Ok(v)
+}
+
+// Tries to extract path into memory (decompressing all members in case
+// of a multi member .gz file).
+fn extract_file_multi(path_compressed: &Path) -> io::Result<Vec<u8>> {
+    let mut v = Vec::new();
+    let f = File::open(path_compressed)?;
+    MultiGzDecoder::new(f).read_to_end(&mut v)?;
+    Ok(v)
+}
+
+#[test]
+fn empty_error_once() {
+    let data: &[u8] = &[];
+    let cbjson = GzDecoder::new(data);
+    let reader = BufReader::new(cbjson);
+    let mut stream = reader.lines();
+    assert!(stream.next().unwrap().is_err());
+    assert!(stream.next().is_none());
+}
diff --git a/android/vendor/flate2-1.0.24/tests/multi.gz b/android/vendor/flate2-1.0.24/tests/multi.gz
new file mode 100644
index 0000000..cabc896
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/multi.gz
Binary files differ
diff --git a/android/vendor/flate2-1.0.24/tests/multi.txt b/android/vendor/flate2-1.0.24/tests/multi.txt
new file mode 100644
index 0000000..66a52ee
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/multi.txt
@@ -0,0 +1,2 @@
+first
+second
diff --git a/android/vendor/flate2-1.0.24/tests/zero-write.rs b/android/vendor/flate2-1.0.24/tests/zero-write.rs
new file mode 100644
index 0000000..f0db86c
--- /dev/null
+++ b/android/vendor/flate2-1.0.24/tests/zero-write.rs
@@ -0,0 +1,8 @@
+extern crate flate2;
+
+#[test]
+fn zero_write_is_error() {
+    let mut buf = [0u8];
+    let writer = flate2::write::DeflateEncoder::new(&mut buf[..], flate2::Compression::default());
+    assert!(writer.finish().is_err());
+}
diff --git a/android/vendor/form_urlencoded-1.0.1/.cargo-checksum.json b/android/vendor/form_urlencoded-1.0.1/.cargo-checksum.json
new file mode 100644
index 0000000..33e19d1
--- /dev/null
+++ b/android/vendor/form_urlencoded-1.0.1/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"aadc4e4ba33e86861d8d1d8b848ac11a27b6f87340d082b47f762387464c61ed","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"20c7855c364d57ea4c97889a5e8d98470a9952dade37bd9248b9a54431670e5e","src/lib.rs":"5d30edec687843447c97e4ea87583983eb9fc06135ae718c8ecc0fa8cebef2df"},"package":"5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"}
\ No newline at end of file
diff --git a/android/vendor/form_urlencoded-1.0.1/Cargo.toml b/android/vendor/form_urlencoded-1.0.1/Cargo.toml
new file mode 100644
index 0000000..4c9fae2
--- /dev/null
+++ b/android/vendor/form_urlencoded-1.0.1/Cargo.toml
@@ -0,0 +1,28 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies
+#
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
+
+[package]
+edition = "2018"
+name = "form_urlencoded"
+version = "1.0.1"
+authors = ["The rust-url developers"]
+description = "Parser and serializer for the application/x-www-form-urlencoded syntax, as used by HTML forms."
+license = "MIT/Apache-2.0"
+repository = "https://github.com/servo/rust-url"
+
+[lib]
+test = false
+[dependencies.matches]
+version = "0.1"
+
+[dependencies.percent-encoding]
+version = "2.1.0"
diff --git a/android/vendor/form_urlencoded-1.0.1/LICENSE-APACHE b/android/vendor/form_urlencoded-1.0.1/LICENSE-APACHE
new file mode 100644
index 0000000..16fe87b
--- /dev/null
+++ b/android/vendor/form_urlencoded-1.0.1/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/form_urlencoded-1.0.1/LICENSE-MIT b/android/vendor/form_urlencoded-1.0.1/LICENSE-MIT
new file mode 100644
index 0000000..24de6b4
--- /dev/null
+++ b/android/vendor/form_urlencoded-1.0.1/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2013-2016 The rust-url developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/form_urlencoded-1.0.1/src/lib.rs b/android/vendor/form_urlencoded-1.0.1/src/lib.rs
new file mode 100644
index 0000000..765ee16
--- /dev/null
+++ b/android/vendor/form_urlencoded-1.0.1/src/lib.rs
@@ -0,0 +1,420 @@
+// Copyright 2013-2016 The rust-url developers.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Parser and serializer for the [`application/x-www-form-urlencoded` syntax](
+//! http://url.spec.whatwg.org/#application/x-www-form-urlencoded),
+//! as used by HTML forms.
+//!
+//! Converts between a string (such as an URL’s query string)
+//! and a sequence of (name, value) pairs.
+
+#[macro_use]
+extern crate matches;
+
+use percent_encoding::{percent_decode, percent_encode_byte};
+use std::borrow::{Borrow, Cow};
+use std::str;
+
+/// Convert a byte string in the `application/x-www-form-urlencoded` syntax
+/// into a iterator of (name, value) pairs.
+///
+/// Use `parse(input.as_bytes())` to parse a `&str` string.
+///
+/// The names and values are percent-decoded. For instance, `%23first=%25try%25` will be
+/// converted to `[("#first", "%try%")]`.
+#[inline]
+pub fn parse(input: &[u8]) -> Parse<'_> {
+    Parse { input }
+}
+/// The return type of `parse()`.
+#[derive(Copy, Clone)]
+pub struct Parse<'a> {
+    input: &'a [u8],
+}
+
+impl<'a> Iterator for Parse<'a> {
+    type Item = (Cow<'a, str>, Cow<'a, str>);
+
+    fn next(&mut self) -> Option<Self::Item> {
+        loop {
+            if self.input.is_empty() {
+                return None;
+            }
+            let mut split2 = self.input.splitn(2, |&b| b == b'&');
+            let sequence = split2.next().unwrap();
+            self.input = split2.next().unwrap_or(&[][..]);
+            if sequence.is_empty() {
+                continue;
+            }
+            let mut split2 = sequence.splitn(2, |&b| b == b'=');
+            let name = split2.next().unwrap();
+            let value = split2.next().unwrap_or(&[][..]);
+            return Some((decode(name), decode(value)));
+        }
+    }
+}
+
+fn decode(input: &[u8]) -> Cow<'_, str> {
+    let replaced = replace_plus(input);
+    decode_utf8_lossy(match percent_decode(&replaced).into() {
+        Cow::Owned(vec) => Cow::Owned(vec),
+        Cow::Borrowed(_) => replaced,
+    })
+}
+
+/// Replace b'+' with b' '
+fn replace_plus(input: &[u8]) -> Cow<'_, [u8]> {
+    match input.iter().position(|&b| b == b'+') {
+        None => Cow::Borrowed(input),
+        Some(first_position) => {
+            let mut replaced = input.to_owned();
+            replaced[first_position] = b' ';
+            for byte in &mut replaced[first_position + 1..] {
+                if *byte == b'+' {
+                    *byte = b' ';
+                }
+            }
+            Cow::Owned(replaced)
+        }
+    }
+}
+
+impl<'a> Parse<'a> {
+    /// Return a new iterator that yields pairs of `String` instead of pairs of `Cow<str>`.
+    pub fn into_owned(self) -> ParseIntoOwned<'a> {
+        ParseIntoOwned { inner: self }
+    }
+}
+
+/// Like `Parse`, but yields pairs of `String` instead of pairs of `Cow<str>`.
+pub struct ParseIntoOwned<'a> {
+    inner: Parse<'a>,
+}
+
+impl<'a> Iterator for ParseIntoOwned<'a> {
+    type Item = (String, String);
+
+    fn next(&mut self) -> Option<Self::Item> {
+        self.inner
+            .next()
+            .map(|(k, v)| (k.into_owned(), v.into_owned()))
+    }
+}
+
+/// The [`application/x-www-form-urlencoded` byte serializer](
+/// https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer).
+///
+/// Return an iterator of `&str` slices.
+pub fn byte_serialize(input: &[u8]) -> ByteSerialize<'_> {
+    ByteSerialize { bytes: input }
+}
+
+/// Return value of `byte_serialize()`.
+#[derive(Debug)]
+pub struct ByteSerialize<'a> {
+    bytes: &'a [u8],
+}
+
+fn byte_serialized_unchanged(byte: u8) -> bool {
+    matches!(byte, b'*' | b'-' | b'.' | b'0' ..= b'9' | b'A' ..= b'Z' | b'_' | b'a' ..= b'z')
+}
+
+impl<'a> Iterator for ByteSerialize<'a> {
+    type Item = &'a str;
+
+    fn next(&mut self) -> Option<&'a str> {
+        if let Some((&first, tail)) = self.bytes.split_first() {
+            if !byte_serialized_unchanged(first) {
+                self.bytes = tail;
+                return Some(if first == b' ' {
+                    "+"
+                } else {
+                    percent_encode_byte(first)
+                });
+            }
+            let position = tail.iter().position(|&b| !byte_serialized_unchanged(b));
+            let (unchanged_slice, remaining) = match position {
+                // 1 for first_byte + i unchanged in tail
+                Some(i) => self.bytes.split_at(1 + i),
+                None => (self.bytes, &[][..]),
+            };
+            self.bytes = remaining;
+            // This unsafe is appropriate because we have already checked these
+            // bytes in byte_serialized_unchanged, which checks for a subset
+            // of UTF-8. So we know these bytes are valid UTF-8, and doing
+            // another UTF-8 check would be wasteful.
+            Some(unsafe { str::from_utf8_unchecked(unchanged_slice) })
+        } else {
+            None
+        }
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        if self.bytes.is_empty() {
+            (0, Some(0))
+        } else {
+            (1, Some(self.bytes.len()))
+        }
+    }
+}
+
+/// The [`application/x-www-form-urlencoded` serializer](
+/// https://url.spec.whatwg.org/#concept-urlencoded-serializer).
+pub struct Serializer<'a, T: Target> {
+    target: Option<T>,
+    start_position: usize,
+    encoding: EncodingOverride<'a>,
+}
+
+pub trait Target {
+    fn as_mut_string(&mut self) -> &mut String;
+    fn finish(self) -> Self::Finished;
+    type Finished;
+}
+
+impl Target for String {
+    fn as_mut_string(&mut self) -> &mut String {
+        self
+    }
+    fn finish(self) -> Self {
+        self
+    }
+    type Finished = Self;
+}
+
+impl<'a> Target for &'a mut String {
+    fn as_mut_string(&mut self) -> &mut String {
+        &mut **self
+    }
+    fn finish(self) -> Self {
+        self
+    }
+    type Finished = Self;
+}
+
+impl<'a, T: Target> Serializer<'a, T> {
+    /// Create a new `application/x-www-form-urlencoded` serializer for the given target.
+    ///
+    /// If the target is non-empty,
+    /// its content is assumed to already be in `application/x-www-form-urlencoded` syntax.
+    pub fn new(target: T) -> Self {
+        Self::for_suffix(target, 0)
+    }
+
+    /// Create a new `application/x-www-form-urlencoded` serializer
+    /// for a suffix of the given target.
+    ///
+    /// If that suffix is non-empty,
+    /// its content is assumed to already be in `application/x-www-form-urlencoded` syntax.
+    pub fn for_suffix(mut target: T, start_position: usize) -> Self {
+        if target.as_mut_string().len() < start_position {
+            panic!(
+                "invalid length {} for target of length {}",
+                start_position,
+                target.as_mut_string().len()
+            );
+        }
+
+        Serializer {
+            target: Some(target),
+            start_position,
+            encoding: None,
+        }
+    }
+
+    /// Remove any existing name/value pair.
+    ///
+    /// Panics if called after `.finish()`.
+    pub fn clear(&mut self) -> &mut Self {
+        string(&mut self.target).truncate(self.start_position);
+        self
+    }
+
+    /// Set the character encoding to be used for names and values before percent-encoding.
+    pub fn encoding_override(&mut self, new: EncodingOverride<'a>) -> &mut Self {
+        self.encoding = new;
+        self
+    }
+
+    /// Serialize and append a name/value pair.
+    ///
+    /// Panics if called after `.finish()`.
+    pub fn append_pair(&mut self, name: &str, value: &str) -> &mut Self {
+        append_pair(
+            string(&mut self.target),
+            self.start_position,
+            self.encoding,
+            name,
+            value,
+        );
+        self
+    }
+
+    /// Serialize and append a name of parameter without any value.
+    ///
+    /// Panics if called after `.finish()`.
+    pub fn append_key_only(&mut self, name: &str) -> &mut Self {
+        append_key_only(
+            string(&mut self.target),
+            self.start_position,
+            self.encoding,
+            name,
+        );
+        self
+    }
+
+    /// Serialize and append a number of name/value pairs.
+    ///
+    /// This simply calls `append_pair` repeatedly.
+    /// This can be more convenient, so the user doesn’t need to introduce a block
+    /// to limit the scope of `Serializer`’s borrow of its string.
+    ///
+    /// Panics if called after `.finish()`.
+    pub fn extend_pairs<I, K, V>(&mut self, iter: I) -> &mut Self
+    where
+        I: IntoIterator,
+        I::Item: Borrow<(K, V)>,
+        K: AsRef<str>,
+        V: AsRef<str>,
+    {
+        {
+            let string = string(&mut self.target);
+            for pair in iter {
+                let &(ref k, ref v) = pair.borrow();
+                append_pair(
+                    string,
+                    self.start_position,
+                    self.encoding,
+                    k.as_ref(),
+                    v.as_ref(),
+                );
+            }
+        }
+        self
+    }
+
+    /// Serialize and append a number of names without values.
+    ///
+    /// This simply calls `append_key_only` repeatedly.
+    /// This can be more convenient, so the user doesn’t need to introduce a block
+    /// to limit the scope of `Serializer`’s borrow of its string.
+    ///
+    /// Panics if called after `.finish()`.
+    pub fn extend_keys_only<I, K>(&mut self, iter: I) -> &mut Self
+    where
+        I: IntoIterator,
+        I::Item: Borrow<K>,
+        K: AsRef<str>,
+    {
+        {
+            let string = string(&mut self.target);
+            for key in iter {
+                let k = key.borrow().as_ref();
+                append_key_only(string, self.start_position, self.encoding, k);
+            }
+        }
+        self
+    }
+
+    /// If this serializer was constructed with a string, take and return that string.
+    ///
+    /// ```rust
+    /// use form_urlencoded;
+    /// let encoded: String = form_urlencoded::Serializer::new(String::new())
+    ///     .append_pair("foo", "bar & baz")
+    ///     .append_pair("saison", "Été+hiver")
+    ///     .finish();
+    /// assert_eq!(encoded, "foo=bar+%26+baz&saison=%C3%89t%C3%A9%2Bhiver");
+    /// ```
+    ///
+    /// Panics if called more than once.
+    pub fn finish(&mut self) -> T::Finished {
+        self.target
+            .take()
+            .expect("url::form_urlencoded::Serializer double finish")
+            .finish()
+    }
+}
+
+fn append_separator_if_needed(string: &mut String, start_position: usize) {
+    if string.len() > start_position {
+        string.push('&')
+    }
+}
+
+fn string<T: Target>(target: &mut Option<T>) -> &mut String {
+    target
+        .as_mut()
+        .expect("url::form_urlencoded::Serializer finished")
+        .as_mut_string()
+}
+
+fn append_pair(
+    string: &mut String,
+    start_position: usize,
+    encoding: EncodingOverride<'_>,
+    name: &str,
+    value: &str,
+) {
+    append_separator_if_needed(string, start_position);
+    append_encoded(name, string, encoding);
+    string.push('=');
+    append_encoded(value, string, encoding);
+}
+
+fn append_key_only(
+    string: &mut String,
+    start_position: usize,
+    encoding: EncodingOverride,
+    name: &str,
+) {
+    append_separator_if_needed(string, start_position);
+    append_encoded(name, string, encoding);
+}
+
+fn append_encoded(s: &str, string: &mut String, encoding: EncodingOverride<'_>) {
+    string.extend(byte_serialize(&encode(encoding, s)))
+}
+
+pub(crate) fn encode<'a>(encoding_override: EncodingOverride<'_>, input: &'a str) -> Cow<'a, [u8]> {
+    if let Some(o) = encoding_override {
+        return o(input);
+    }
+    input.as_bytes().into()
+}
+
+pub(crate) fn decode_utf8_lossy(input: Cow<'_, [u8]>) -> Cow<'_, str> {
+    // Note: This function is duplicated in `percent_encoding/lib.rs`.
+    match input {
+        Cow::Borrowed(bytes) => String::from_utf8_lossy(bytes),
+        Cow::Owned(bytes) => {
+            match String::from_utf8_lossy(&bytes) {
+                Cow::Borrowed(utf8) => {
+                    // If from_utf8_lossy returns a Cow::Borrowed, then we can
+                    // be sure our original bytes were valid UTF-8. This is because
+                    // if the bytes were invalid UTF-8 from_utf8_lossy would have
+                    // to allocate a new owned string to back the Cow so it could
+                    // replace invalid bytes with a placeholder.
+
+                    // First we do a debug_assert to confirm our description above.
+                    let raw_utf8: *const [u8];
+                    raw_utf8 = utf8.as_bytes();
+                    debug_assert!(raw_utf8 == &*bytes as *const [u8]);
+
+                    // Given we know the original input bytes are valid UTF-8,
+                    // and we have ownership of those bytes, we re-use them and
+                    // return a Cow::Owned here.
+                    Cow::Owned(unsafe { String::from_utf8_unchecked(bytes) })
+                }
+                Cow::Owned(s) => Cow::Owned(s),
+            }
+        }
+    }
+}
+
+pub type EncodingOverride<'a> = Option<&'a dyn Fn(&str) -> Cow<'_, [u8]>>;
diff --git a/android/vendor/futures-core-0.3.21/.cargo-checksum.json b/android/vendor/futures-core-0.3.21/.cargo-checksum.json
new file mode 100644
index 0000000..efc788d
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"Cargo.toml":"373c595fe1f9268dcbc213f61f761fe00e7f7774868330754742847af0597e2c","LICENSE-APACHE":"275c491d6d1160553c32fd6127061d7f9606c3ea25abfad6ca3f6ed088785427","LICENSE-MIT":"6652c868f35dfe5e8ef636810a4e576b9d663f3a17fb0f5613ad73583e1b88fd","README.md":"e8258273fed6f1796485777655118f2369fd3f000191e9d8cdbd10bf052946a9","build.rs":"5b263bd2bd587511a9c8daef580b05e0613c15a6c5f800b1e5bc145fa013d99e","no_atomic_cas.rs":"fe91bb68759c090ed8180a6cfb181633bf87e3cb7fc2c48b53733d95fd5398a0","src/future.rs":"0cb559fad0d43566dab959e929c4631c25cf749e2e29a5444fbcad464c9262ae","src/lib.rs":"eacd5816fbb914ca061d49ff6203723ebbe639eb7c45ebfa8a0613069d174111","src/stream.rs":"f1c7ab84161c5d5b424655b257fc3183eb6f2ed5324ba4006a70f9a4b0dc8872","src/task/__internal/atomic_waker.rs":"4ca94b25d3bcf4db863f008224cc4797dbbe7c93495a1abb232048846694a716","src/task/__internal/mod.rs":"7d0d297f58987b05ffa152605feb78ddc9b6e5168e7d621ec36dfbee558e4bec","src/task/mod.rs":"e213602a2fe5ae78ad5f1ca20e6d32dcbab17aba5b6b072fb927a72da99b4a11","src/task/poll.rs":"74c2717c1f9a37587a367da1b690d1cd2312e95dbaffca42be4755f1cd164bb8"},"package":"0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"}
\ No newline at end of file
diff --git a/android/vendor/futures-core-0.3.21/Cargo.toml b/android/vendor/futures-core-0.3.21/Cargo.toml
new file mode 100644
index 0000000..32fedcb
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/Cargo.toml
@@ -0,0 +1,40 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+rust-version = "1.36"
+name = "futures-core"
+version = "0.3.21"
+description = """
+The core traits and types in for the `futures` library.
+"""
+homepage = "https://rust-lang.github.io/futures-rs"
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/rust-lang/futures-rs"
+
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = [
+    "--cfg",
+    "docsrs",
+]
+
+[dependencies]
+
+[dev-dependencies]
+
+[features]
+alloc = []
+cfg-target-has-atomic = []
+default = ["std"]
+std = ["alloc"]
+unstable = []
diff --git a/android/vendor/futures-core-0.3.21/LICENSE-APACHE b/android/vendor/futures-core-0.3.21/LICENSE-APACHE
new file mode 100644
index 0000000..9eb0b09
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/LICENSE-APACHE
@@ -0,0 +1,202 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright (c) 2016 Alex Crichton
+Copyright (c) 2017 The Tokio Authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/futures-core-0.3.21/LICENSE-MIT b/android/vendor/futures-core-0.3.21/LICENSE-MIT
new file mode 100644
index 0000000..8ad082e
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/LICENSE-MIT
@@ -0,0 +1,26 @@
+Copyright (c) 2016 Alex Crichton
+Copyright (c) 2017 The Tokio Authors
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/futures-core-0.3.21/README.md b/android/vendor/futures-core-0.3.21/README.md
new file mode 100644
index 0000000..96e0e06
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/README.md
@@ -0,0 +1,23 @@
+# futures-core
+
+The core traits and types in for the `futures` library.
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+futures-core = "0.3"
+```
+
+The current `futures-core` requires Rust 1.36 or later.
+
+## License
+
+Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or
+[MIT license](LICENSE-MIT) at your option.
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in the work by you, as defined in the Apache-2.0 license, shall
+be dual licensed as above, without any additional terms or conditions.
diff --git a/android/vendor/futures-core-0.3.21/build.rs b/android/vendor/futures-core-0.3.21/build.rs
new file mode 100644
index 0000000..05e0496
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/build.rs
@@ -0,0 +1,41 @@
+// The rustc-cfg listed below are considered public API, but it is *unstable*
+// and outside of the normal semver guarantees:
+//
+// - `futures_no_atomic_cas`
+//      Assume the target does *not* support atomic CAS operations.
+//      This is usually detected automatically by the build script, but you may
+//      need to enable it manually when building for custom targets or using
+//      non-cargo build systems that don't run the build script.
+//
+// With the exceptions mentioned above, the rustc-cfg emitted by the build
+// script are *not* public API.
+
+#![warn(rust_2018_idioms, single_use_lifetimes)]
+
+use std::env;
+
+include!("no_atomic_cas.rs");
+
+fn main() {
+    let target = match env::var("TARGET") {
+        Ok(target) => target,
+        Err(e) => {
+            println!(
+                "cargo:warning={}: unable to get TARGET environment variable: {}",
+                env!("CARGO_PKG_NAME"),
+                e
+            );
+            return;
+        }
+    };
+
+    // Note that this is `no_*`, not `has_*`. This allows treating
+    // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
+    // run. This is needed for compatibility with non-cargo build systems that
+    // don't run the build script.
+    if NO_ATOMIC_CAS.contains(&&*target) {
+        println!("cargo:rustc-cfg=futures_no_atomic_cas");
+    }
+
+    println!("cargo:rerun-if-changed=no_atomic_cas.rs");
+}
diff --git a/android/vendor/futures-core-0.3.21/no_atomic_cas.rs b/android/vendor/futures-core-0.3.21/no_atomic_cas.rs
new file mode 100644
index 0000000..9b05d4b
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/no_atomic_cas.rs
@@ -0,0 +1,13 @@
+// This file is @generated by no_atomic_cas.sh.
+// It is not intended for manual editing.
+
+const NO_ATOMIC_CAS: &[&str] = &[
+    "avr-unknown-gnu-atmega328",
+    "bpfeb-unknown-none",
+    "bpfel-unknown-none",
+    "msp430-none-elf",
+    "riscv32i-unknown-none-elf",
+    "riscv32imc-unknown-none-elf",
+    "thumbv4t-none-eabi",
+    "thumbv6m-none-eabi",
+];
diff --git a/android/vendor/futures-core-0.3.21/src/future.rs b/android/vendor/futures-core-0.3.21/src/future.rs
new file mode 100644
index 0000000..7540cd0
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/future.rs
@@ -0,0 +1,103 @@
+//! Futures.
+
+use core::ops::DerefMut;
+use core::pin::Pin;
+use core::task::{Context, Poll};
+
+#[doc(no_inline)]
+pub use core::future::Future;
+
+/// An owned dynamically typed [`Future`] for use in cases where you can't
+/// statically type your result or need to add some indirection.
+#[cfg(feature = "alloc")]
+pub type BoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + Send + 'a>>;
+
+/// `BoxFuture`, but without the `Send` requirement.
+#[cfg(feature = "alloc")]
+pub type LocalBoxFuture<'a, T> = Pin<alloc::boxed::Box<dyn Future<Output = T> + 'a>>;
+
+/// A future which tracks whether or not the underlying future
+/// should no longer be polled.
+///
+/// `is_terminated` will return `true` if a future should no longer be polled.
+/// Usually, this state occurs after `poll` (or `try_poll`) returned
+/// `Poll::Ready`. However, `is_terminated` may also return `true` if a future
+/// has become inactive and can no longer make progress and should be ignored
+/// or dropped rather than being `poll`ed again.
+pub trait FusedFuture: Future {
+    /// Returns `true` if the underlying future should no longer be polled.
+    fn is_terminated(&self) -> bool;
+}
+
+impl<F: FusedFuture + ?Sized + Unpin> FusedFuture for &mut F {
+    fn is_terminated(&self) -> bool {
+        <F as FusedFuture>::is_terminated(&**self)
+    }
+}
+
+impl<P> FusedFuture for Pin<P>
+where
+    P: DerefMut + Unpin,
+    P::Target: FusedFuture,
+{
+    fn is_terminated(&self) -> bool {
+        <P::Target as FusedFuture>::is_terminated(&**self)
+    }
+}
+
+mod private_try_future {
+    use super::Future;
+
+    pub trait Sealed {}
+
+    impl<F, T, E> Sealed for F where F: ?Sized + Future<Output = Result<T, E>> {}
+}
+
+/// A convenience for futures that return `Result` values that includes
+/// a variety of adapters tailored to such futures.
+pub trait TryFuture: Future + private_try_future::Sealed {
+    /// The type of successful values yielded by this future
+    type Ok;
+
+    /// The type of failures yielded by this future
+    type Error;
+
+    /// Poll this `TryFuture` as if it were a `Future`.
+    ///
+    /// This method is a stopgap for a compiler limitation that prevents us from
+    /// directly inheriting from the `Future` trait; in the future it won't be
+    /// needed.
+    fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<Self::Ok, Self::Error>>;
+}
+
+impl<F, T, E> TryFuture for F
+where
+    F: ?Sized + Future<Output = Result<T, E>>,
+{
+    type Ok = T;
+    type Error = E;
+
+    #[inline]
+    fn try_poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
+        self.poll(cx)
+    }
+}
+
+#[cfg(feature = "alloc")]
+mod if_alloc {
+    use super::*;
+    use alloc::boxed::Box;
+
+    impl<F: FusedFuture + ?Sized + Unpin> FusedFuture for Box<F> {
+        fn is_terminated(&self) -> bool {
+            <F as FusedFuture>::is_terminated(&**self)
+        }
+    }
+
+    #[cfg(feature = "std")]
+    impl<F: FusedFuture> FusedFuture for std::panic::AssertUnwindSafe<F> {
+        fn is_terminated(&self) -> bool {
+            <F as FusedFuture>::is_terminated(&**self)
+        }
+    }
+}
diff --git a/android/vendor/futures-core-0.3.21/src/lib.rs b/android/vendor/futures-core-0.3.21/src/lib.rs
new file mode 100644
index 0000000..9c31d8d
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/lib.rs
@@ -0,0 +1,27 @@
+//! Core traits and types for asynchronous operations in Rust.
+
+#![cfg_attr(not(feature = "std"), no_std)]
+#![warn(missing_debug_implementations, missing_docs, rust_2018_idioms, unreachable_pub)]
+// It cannot be included in the published code because this lints have false positives in the minimum required version.
+#![cfg_attr(test, warn(single_use_lifetimes))]
+#![doc(test(
+    no_crate_inject,
+    attr(
+        deny(warnings, rust_2018_idioms, single_use_lifetimes),
+        allow(dead_code, unused_assignments, unused_variables)
+    )
+))]
+
+#[cfg(feature = "alloc")]
+extern crate alloc;
+
+pub mod future;
+#[doc(no_inline)]
+pub use self::future::{FusedFuture, Future, TryFuture};
+
+pub mod stream;
+#[doc(no_inline)]
+pub use self::stream::{FusedStream, Stream, TryStream};
+
+#[macro_use]
+pub mod task;
diff --git a/android/vendor/futures-core-0.3.21/src/stream.rs b/android/vendor/futures-core-0.3.21/src/stream.rs
new file mode 100644
index 0000000..ad5350b
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/stream.rs
@@ -0,0 +1,235 @@
+//! Asynchronous streams.
+
+use core::ops::DerefMut;
+use core::pin::Pin;
+use core::task::{Context, Poll};
+
+/// An owned dynamically typed [`Stream`] for use in cases where you can't
+/// statically type your result or need to add some indirection.
+#[cfg(feature = "alloc")]
+pub type BoxStream<'a, T> = Pin<alloc::boxed::Box<dyn Stream<Item = T> + Send + 'a>>;
+
+/// `BoxStream`, but without the `Send` requirement.
+#[cfg(feature = "alloc")]
+pub type LocalBoxStream<'a, T> = Pin<alloc::boxed::Box<dyn Stream<Item = T> + 'a>>;
+
+/// A stream of values produced asynchronously.
+///
+/// If `Future<Output = T>` is an asynchronous version of `T`, then `Stream<Item
+/// = T>` is an asynchronous version of `Iterator<Item = T>`. A stream
+/// represents a sequence of value-producing events that occur asynchronously to
+/// the caller.
+///
+/// The trait is modeled after `Future`, but allows `poll_next` to be called
+/// even after a value has been produced, yielding `None` once the stream has
+/// been fully exhausted.
+#[must_use = "streams do nothing unless polled"]
+pub trait Stream {
+    /// Values yielded by the stream.
+    type Item;
+
+    /// Attempt to pull out the next value of this stream, registering the
+    /// current task for wakeup if the value is not yet available, and returning
+    /// `None` if the stream is exhausted.
+    ///
+    /// # Return value
+    ///
+    /// There are several possible return values, each indicating a distinct
+    /// stream state:
+    ///
+    /// - `Poll::Pending` means that this stream's next value is not ready
+    /// yet. Implementations will ensure that the current task will be notified
+    /// when the next value may be ready.
+    ///
+    /// - `Poll::Ready(Some(val))` means that the stream has successfully
+    /// produced a value, `val`, and may produce further values on subsequent
+    /// `poll_next` calls.
+    ///
+    /// - `Poll::Ready(None)` means that the stream has terminated, and
+    /// `poll_next` should not be invoked again.
+    ///
+    /// # Panics
+    ///
+    /// Once a stream has finished (returned `Ready(None)` from `poll_next`), calling its
+    /// `poll_next` method again may panic, block forever, or cause other kinds of
+    /// problems; the `Stream` trait places no requirements on the effects of
+    /// such a call. However, as the `poll_next` method is not marked `unsafe`,
+    /// Rust's usual rules apply: calls must never cause undefined behavior
+    /// (memory corruption, incorrect use of `unsafe` functions, or the like),
+    /// regardless of the stream's state.
+    ///
+    /// If this is difficult to guard against then the [`fuse`] adapter can be used
+    /// to ensure that `poll_next` always returns `Ready(None)` in subsequent
+    /// calls.
+    ///
+    /// [`fuse`]: https://docs.rs/futures/0.3/futures/stream/trait.StreamExt.html#method.fuse
+    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>>;
+
+    /// Returns the bounds on the remaining length of the stream.
+    ///
+    /// Specifically, `size_hint()` returns a tuple where the first element
+    /// is the lower bound, and the second element is the upper bound.
+    ///
+    /// The second half of the tuple that is returned is an [`Option`]`<`[`usize`]`>`.
+    /// A [`None`] here means that either there is no known upper bound, or the
+    /// upper bound is larger than [`usize`].
+    ///
+    /// # Implementation notes
+    ///
+    /// It is not enforced that a stream implementation yields the declared
+    /// number of elements. A buggy stream may yield less than the lower bound
+    /// or more than the upper bound of elements.
+    ///
+    /// `size_hint()` is primarily intended to be used for optimizations such as
+    /// reserving space for the elements of the stream, but must not be
+    /// trusted to e.g., omit bounds checks in unsafe code. An incorrect
+    /// implementation of `size_hint()` should not lead to memory safety
+    /// violations.
+    ///
+    /// That said, the implementation should provide a correct estimation,
+    /// because otherwise it would be a violation of the trait's protocol.
+    ///
+    /// The default implementation returns `(0, `[`None`]`)` which is correct for any
+    /// stream.
+    #[inline]
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (0, None)
+    }
+}
+
+impl<S: ?Sized + Stream + Unpin> Stream for &mut S {
+    type Item = S::Item;
+
+    fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+        S::poll_next(Pin::new(&mut **self), cx)
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (**self).size_hint()
+    }
+}
+
+impl<P> Stream for Pin<P>
+where
+    P: DerefMut + Unpin,
+    P::Target: Stream,
+{
+    type Item = <P::Target as Stream>::Item;
+
+    fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+        self.get_mut().as_mut().poll_next(cx)
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        (**self).size_hint()
+    }
+}
+
+/// A stream which tracks whether or not the underlying stream
+/// should no longer be polled.
+///
+/// `is_terminated` will return `true` if a future should no longer be polled.
+/// Usually, this state occurs after `poll_next` (or `try_poll_next`) returned
+/// `Poll::Ready(None)`. However, `is_terminated` may also return `true` if a
+/// stream has become inactive and can no longer make progress and should be
+/// ignored or dropped rather than being polled again.
+pub trait FusedStream: Stream {
+    /// Returns `true` if the stream should no longer be polled.
+    fn is_terminated(&self) -> bool;
+}
+
+impl<F: ?Sized + FusedStream + Unpin> FusedStream for &mut F {
+    fn is_terminated(&self) -> bool {
+        <F as FusedStream>::is_terminated(&**self)
+    }
+}
+
+impl<P> FusedStream for Pin<P>
+where
+    P: DerefMut + Unpin,
+    P::Target: FusedStream,
+{
+    fn is_terminated(&self) -> bool {
+        <P::Target as FusedStream>::is_terminated(&**self)
+    }
+}
+
+mod private_try_stream {
+    use super::Stream;
+
+    pub trait Sealed {}
+
+    impl<S, T, E> Sealed for S where S: ?Sized + Stream<Item = Result<T, E>> {}
+}
+
+/// A convenience for streams that return `Result` values that includes
+/// a variety of adapters tailored to such futures.
+pub trait TryStream: Stream + private_try_stream::Sealed {
+    /// The type of successful values yielded by this future
+    type Ok;
+
+    /// The type of failures yielded by this future
+    type Error;
+
+    /// Poll this `TryStream` as if it were a `Stream`.
+    ///
+    /// This method is a stopgap for a compiler limitation that prevents us from
+    /// directly inheriting from the `Stream` trait; in the future it won't be
+    /// needed.
+    fn try_poll_next(
+        self: Pin<&mut Self>,
+        cx: &mut Context<'_>,
+    ) -> Poll<Option<Result<Self::Ok, Self::Error>>>;
+}
+
+impl<S, T, E> TryStream for S
+where
+    S: ?Sized + Stream<Item = Result<T, E>>,
+{
+    type Ok = T;
+    type Error = E;
+
+    fn try_poll_next(
+        self: Pin<&mut Self>,
+        cx: &mut Context<'_>,
+    ) -> Poll<Option<Result<Self::Ok, Self::Error>>> {
+        self.poll_next(cx)
+    }
+}
+
+#[cfg(feature = "alloc")]
+mod if_alloc {
+    use super::*;
+    use alloc::boxed::Box;
+
+    impl<S: ?Sized + Stream + Unpin> Stream for Box<S> {
+        type Item = S::Item;
+
+        fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+            Pin::new(&mut **self).poll_next(cx)
+        }
+
+        fn size_hint(&self) -> (usize, Option<usize>) {
+            (**self).size_hint()
+        }
+    }
+
+    #[cfg(feature = "std")]
+    impl<S: Stream> Stream for std::panic::AssertUnwindSafe<S> {
+        type Item = S::Item;
+
+        fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<S::Item>> {
+            unsafe { self.map_unchecked_mut(|x| &mut x.0) }.poll_next(cx)
+        }
+
+        fn size_hint(&self) -> (usize, Option<usize>) {
+            self.0.size_hint()
+        }
+    }
+
+    impl<S: ?Sized + FusedStream + Unpin> FusedStream for Box<S> {
+        fn is_terminated(&self) -> bool {
+            <S as FusedStream>::is_terminated(&**self)
+        }
+    }
+}
diff --git a/android/vendor/futures-core-0.3.21/src/task/__internal/atomic_waker.rs b/android/vendor/futures-core-0.3.21/src/task/__internal/atomic_waker.rs
new file mode 100644
index 0000000..d49d043
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/task/__internal/atomic_waker.rs
@@ -0,0 +1,409 @@
+use core::cell::UnsafeCell;
+use core::fmt;
+use core::sync::atomic::AtomicUsize;
+use core::sync::atomic::Ordering::{AcqRel, Acquire, Release};
+use core::task::Waker;
+
+/// A synchronization primitive for task wakeup.
+///
+/// Sometimes the task interested in a given event will change over time.
+/// An `AtomicWaker` can coordinate concurrent notifications with the consumer
+/// potentially "updating" the underlying task to wake up. This is useful in
+/// scenarios where a computation completes in another thread and wants to
+/// notify the consumer, but the consumer is in the process of being migrated to
+/// a new logical task.
+///
+/// Consumers should call `register` before checking the result of a computation
+/// and producers should call `wake` after producing the computation (this
+/// differs from the usual `thread::park` pattern). It is also permitted for
+/// `wake` to be called **before** `register`. This results in a no-op.
+///
+/// A single `AtomicWaker` may be reused for any number of calls to `register` or
+/// `wake`.
+///
+/// # Memory ordering
+///
+/// Calling `register` "acquires" all memory "released" by calls to `wake`
+/// before the call to `register`.  Later calls to `wake` will wake the
+/// registered waker (on contention this wake might be triggered in `register`).
+///
+/// For concurrent calls to `register` (should be avoided) the ordering is only
+/// guaranteed for the winning call.
+///
+/// # Examples
+///
+/// Here is a simple example providing a `Flag` that can be signalled manually
+/// when it is ready.
+///
+/// ```
+/// use futures::future::Future;
+/// use futures::task::{Context, Poll, AtomicWaker};
+/// use std::sync::Arc;
+/// use std::sync::atomic::AtomicBool;
+/// use std::sync::atomic::Ordering::Relaxed;
+/// use std::pin::Pin;
+///
+/// struct Inner {
+///     waker: AtomicWaker,
+///     set: AtomicBool,
+/// }
+///
+/// #[derive(Clone)]
+/// struct Flag(Arc<Inner>);
+///
+/// impl Flag {
+///     pub fn new() -> Self {
+///         Self(Arc::new(Inner {
+///             waker: AtomicWaker::new(),
+///             set: AtomicBool::new(false),
+///         }))
+///     }
+///
+///     pub fn signal(&self) {
+///         self.0.set.store(true, Relaxed);
+///         self.0.waker.wake();
+///     }
+/// }
+///
+/// impl Future for Flag {
+///     type Output = ();
+///
+///     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
+///         // quick check to avoid registration if already done.
+///         if self.0.set.load(Relaxed) {
+///             return Poll::Ready(());
+///         }
+///
+///         self.0.waker.register(cx.waker());
+///
+///         // Need to check condition **after** `register` to avoid a race
+///         // condition that would result in lost notifications.
+///         if self.0.set.load(Relaxed) {
+///             Poll::Ready(())
+///         } else {
+///             Poll::Pending
+///         }
+///     }
+/// }
+/// ```
+pub struct AtomicWaker {
+    state: AtomicUsize,
+    waker: UnsafeCell<Option<Waker>>,
+}
+
+// `AtomicWaker` is a multi-consumer, single-producer transfer cell. The cell
+// stores a `Waker` value produced by calls to `register` and many threads can
+// race to take the waker (to wake it) by calling `wake`.
+//
+// If a new `Waker` instance is produced by calling `register` before an
+// existing one is consumed, then the existing one is overwritten.
+//
+// While `AtomicWaker` is single-producer, the implementation ensures memory
+// safety. In the event of concurrent calls to `register`, there will be a
+// single winner whose waker will get stored in the cell. The losers will not
+// have their tasks woken. As such, callers should ensure to add synchronization
+// to calls to `register`.
+//
+// The implementation uses a single `AtomicUsize` value to coordinate access to
+// the `Waker` cell. There are two bits that are operated on independently.
+// These are represented by `REGISTERING` and `WAKING`.
+//
+// The `REGISTERING` bit is set when a producer enters the critical section. The
+// `WAKING` bit is set when a consumer enters the critical section. Neither bit
+// being set is represented by `WAITING`.
+//
+// A thread obtains an exclusive lock on the waker cell by transitioning the
+// state from `WAITING` to `REGISTERING` or `WAKING`, depending on the operation
+// the thread wishes to perform. When this transition is made, it is guaranteed
+// that no other thread will access the waker cell.
+//
+// # Registering
+//
+// On a call to `register`, an attempt to transition the state from WAITING to
+// REGISTERING is made. On success, the caller obtains a lock on the waker cell.
+//
+// If the lock is obtained, then the thread sets the waker cell to the waker
+// provided as an argument. Then it attempts to transition the state back from
+// `REGISTERING` -> `WAITING`.
+//
+// If this transition is successful, then the registering process is complete
+// and the next call to `wake` will observe the waker.
+//
+// If the transition fails, then there was a concurrent call to `wake` that was
+// unable to access the waker cell (due to the registering thread holding the
+// lock). To handle this, the registering thread removes the waker it just set
+// from the cell and calls `wake` on it. This call to wake represents the
+// attempt to wake by the other thread (that set the `WAKING` bit). The state is
+// then transitioned from `REGISTERING | WAKING` back to `WAITING`.  This
+// transition must succeed because, at this point, the state cannot be
+// transitioned by another thread.
+//
+// # Waking
+//
+// On a call to `wake`, an attempt to transition the state from `WAITING` to
+// `WAKING` is made. On success, the caller obtains a lock on the waker cell.
+//
+// If the lock is obtained, then the thread takes ownership of the current value
+// in the waker cell, and calls `wake` on it. The state is then transitioned
+// back to `WAITING`. This transition must succeed as, at this point, the state
+// cannot be transitioned by another thread.
+//
+// If the thread is unable to obtain the lock, the `WAKING` bit is still.  This
+// is because it has either been set by the current thread but the previous
+// value included the `REGISTERING` bit **or** a concurrent thread is in the
+// `WAKING` critical section. Either way, no action must be taken.
+//
+// If the current thread is the only concurrent call to `wake` and another
+// thread is in the `register` critical section, when the other thread **exits**
+// the `register` critical section, it will observe the `WAKING` bit and handle
+// the wake itself.
+//
+// If another thread is in the `wake` critical section, then it will handle
+// waking the task.
+//
+// # A potential race (is safely handled).
+//
+// Imagine the following situation:
+//
+// * Thread A obtains the `wake` lock and wakes a task.
+//
+// * Before thread A releases the `wake` lock, the woken task is scheduled.
+//
+// * Thread B attempts to wake the task. In theory this should result in the
+//   task being woken, but it cannot because thread A still holds the wake lock.
+//
+// This case is handled by requiring users of `AtomicWaker` to call `register`
+// **before** attempting to observe the application state change that resulted
+// in the task being awoken. The wakers also change the application state before
+// calling wake.
+//
+// Because of this, the waker will do one of two things.
+//
+// 1) Observe the application state change that Thread B is woken for. In this
+//    case, it is OK for Thread B's wake to be lost.
+//
+// 2) Call register before attempting to observe the application state. Since
+//    Thread A still holds the `wake` lock, the call to `register` will result
+//    in the task waking itself and get scheduled again.
+
+/// Idle state
+const WAITING: usize = 0;
+
+/// A new waker value is being registered with the `AtomicWaker` cell.
+const REGISTERING: usize = 0b01;
+
+/// The waker currently registered with the `AtomicWaker` cell is being woken.
+const WAKING: usize = 0b10;
+
+impl AtomicWaker {
+    /// Create an `AtomicWaker`.
+    pub const fn new() -> Self {
+        // Make sure that task is Sync
+        trait AssertSync: Sync {}
+        impl AssertSync for Waker {}
+
+        Self { state: AtomicUsize::new(WAITING), waker: UnsafeCell::new(None) }
+    }
+
+    /// Registers the waker to be notified on calls to `wake`.
+    ///
+    /// The new task will take place of any previous tasks that were registered
+    /// by previous calls to `register`. Any calls to `wake` that happen after
+    /// a call to `register` (as defined by the memory ordering rules), will
+    /// notify the `register` caller's task and deregister the waker from future
+    /// notifications. Because of this, callers should ensure `register` gets
+    /// invoked with a new `Waker` **each** time they require a wakeup.
+    ///
+    /// It is safe to call `register` with multiple other threads concurrently
+    /// calling `wake`. This will result in the `register` caller's current
+    /// task being notified once.
+    ///
+    /// This function is safe to call concurrently, but this is generally a bad
+    /// idea. Concurrent calls to `register` will attempt to register different
+    /// tasks to be notified. One of the callers will win and have its task set,
+    /// but there is no guarantee as to which caller will succeed.
+    ///
+    /// # Examples
+    ///
+    /// Here is how `register` is used when implementing a flag.
+    ///
+    /// ```
+    /// use futures::future::Future;
+    /// use futures::task::{Context, Poll, AtomicWaker};
+    /// use std::sync::atomic::AtomicBool;
+    /// use std::sync::atomic::Ordering::Relaxed;
+    /// use std::pin::Pin;
+    ///
+    /// struct Flag {
+    ///     waker: AtomicWaker,
+    ///     set: AtomicBool,
+    /// }
+    ///
+    /// impl Future for Flag {
+    ///     type Output = ();
+    ///
+    ///     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
+    ///         // Register **before** checking `set` to avoid a race condition
+    ///         // that would result in lost notifications.
+    ///         self.waker.register(cx.waker());
+    ///
+    ///         if self.set.load(Relaxed) {
+    ///             Poll::Ready(())
+    ///         } else {
+    ///             Poll::Pending
+    ///         }
+    ///     }
+    /// }
+    /// ```
+    pub fn register(&self, waker: &Waker) {
+        match self
+            .state
+            .compare_exchange(WAITING, REGISTERING, Acquire, Acquire)
+            .unwrap_or_else(|x| x)
+        {
+            WAITING => {
+                unsafe {
+                    // Locked acquired, update the waker cell
+                    *self.waker.get() = Some(waker.clone());
+
+                    // Release the lock. If the state transitioned to include
+                    // the `WAKING` bit, this means that at least one wake has
+                    // been called concurrently.
+                    //
+                    // Start by assuming that the state is `REGISTERING` as this
+                    // is what we just set it to. If this holds, we know that no
+                    // other writes were performed in the meantime, so there is
+                    // nothing to acquire, only release. In case of concurrent
+                    // wakers, we need to acquire their releases, so success needs
+                    // to do both.
+                    let res = self.state.compare_exchange(REGISTERING, WAITING, AcqRel, Acquire);
+
+                    match res {
+                        Ok(_) => {
+                            // memory ordering: acquired self.state during CAS
+                            // - if previous wakes went through it syncs with
+                            //   their final release (`fetch_and`)
+                            // - if there was no previous wake the next wake
+                            //   will wake us, no sync needed.
+                        }
+                        Err(actual) => {
+                            // This branch can only be reached if at least one
+                            // concurrent thread called `wake`. In this
+                            // case, `actual` **must** be `REGISTERING |
+                            // `WAKING`.
+                            debug_assert_eq!(actual, REGISTERING | WAKING);
+
+                            // Take the waker to wake once the atomic operation has
+                            // completed.
+                            let waker = (*self.waker.get()).take().unwrap();
+
+                            // We need to return to WAITING state (clear our lock and
+                            // concurrent WAKING flag). This needs to acquire all
+                            // WAKING fetch_or releases and it needs to release our
+                            // update to self.waker, so we need a `swap` operation.
+                            self.state.swap(WAITING, AcqRel);
+
+                            // memory ordering: we acquired the state for all
+                            // concurrent wakes, but future wakes might still
+                            // need to wake us in case we can't make progress
+                            // from the pending wakes.
+                            //
+                            // So we simply schedule to come back later (we could
+                            // also simply leave the registration in place above).
+                            waker.wake();
+                        }
+                    }
+                }
+            }
+            WAKING => {
+                // Currently in the process of waking the task, i.e.,
+                // `wake` is currently being called on the old task handle.
+                //
+                // memory ordering: we acquired the state for all
+                // concurrent wakes, but future wakes might still
+                // need to wake us in case we can't make progress
+                // from the pending wakes.
+                //
+                // So we simply schedule to come back later (we
+                // could also spin here trying to acquire the lock
+                // to register).
+                waker.wake_by_ref();
+            }
+            state => {
+                // In this case, a concurrent thread is holding the
+                // "registering" lock. This probably indicates a bug in the
+                // caller's code as racing to call `register` doesn't make much
+                // sense.
+                //
+                // memory ordering: don't care. a concurrent register() is going
+                // to succeed and provide proper memory ordering.
+                //
+                // We just want to maintain memory safety. It is ok to drop the
+                // call to `register`.
+                debug_assert!(state == REGISTERING || state == REGISTERING | WAKING);
+            }
+        }
+    }
+
+    /// Calls `wake` on the last `Waker` passed to `register`.
+    ///
+    /// If `register` has not been called yet, then this does nothing.
+    pub fn wake(&self) {
+        if let Some(waker) = self.take() {
+            waker.wake();
+        }
+    }
+
+    /// Returns the last `Waker` passed to `register`, so that the user can wake it.
+    ///
+    ///
+    /// Sometimes, just waking the AtomicWaker is not fine grained enough. This allows the user
+    /// to take the waker and then wake it separately, rather than performing both steps in one
+    /// atomic action.
+    ///
+    /// If a waker has not been registered, this returns `None`.
+    pub fn take(&self) -> Option<Waker> {
+        // AcqRel ordering is used in order to acquire the value of the `task`
+        // cell as well as to establish a `release` ordering with whatever
+        // memory the `AtomicWaker` is associated with.
+        match self.state.fetch_or(WAKING, AcqRel) {
+            WAITING => {
+                // The waking lock has been acquired.
+                let waker = unsafe { (*self.waker.get()).take() };
+
+                // Release the lock
+                self.state.fetch_and(!WAKING, Release);
+
+                waker
+            }
+            state => {
+                // There is a concurrent thread currently updating the
+                // associated task.
+                //
+                // Nothing more to do as the `WAKING` bit has been set. It
+                // doesn't matter if there are concurrent registering threads or
+                // not.
+                //
+                debug_assert!(
+                    state == REGISTERING || state == REGISTERING | WAKING || state == WAKING
+                );
+                None
+            }
+        }
+    }
+}
+
+impl Default for AtomicWaker {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl fmt::Debug for AtomicWaker {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        write!(f, "AtomicWaker")
+    }
+}
+
+unsafe impl Send for AtomicWaker {}
+unsafe impl Sync for AtomicWaker {}
diff --git a/android/vendor/futures-core-0.3.21/src/task/__internal/mod.rs b/android/vendor/futures-core-0.3.21/src/task/__internal/mod.rs
new file mode 100644
index 0000000..c902eb4
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/task/__internal/mod.rs
@@ -0,0 +1,4 @@
+#[cfg(not(futures_no_atomic_cas))]
+mod atomic_waker;
+#[cfg(not(futures_no_atomic_cas))]
+pub use self::atomic_waker::AtomicWaker;
diff --git a/android/vendor/futures-core-0.3.21/src/task/mod.rs b/android/vendor/futures-core-0.3.21/src/task/mod.rs
new file mode 100644
index 0000000..19e4eae
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/task/mod.rs
@@ -0,0 +1,10 @@
+//! Task notification.
+
+#[macro_use]
+mod poll;
+
+#[doc(hidden)]
+pub mod __internal;
+
+#[doc(no_inline)]
+pub use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
diff --git a/android/vendor/futures-core-0.3.21/src/task/poll.rs b/android/vendor/futures-core-0.3.21/src/task/poll.rs
new file mode 100644
index 0000000..607e78e
--- /dev/null
+++ b/android/vendor/futures-core-0.3.21/src/task/poll.rs
@@ -0,0 +1,12 @@
+/// Extracts the successful type of a `Poll<T>`.
+///
+/// This macro bakes in propagation of `Pending` signals by returning early.
+#[macro_export]
+macro_rules! ready {
+    ($e:expr $(,)?) => {
+        match $e {
+            $crate::task::Poll::Ready(t) => t,
+            $crate::task::Poll::Pending => return $crate::task::Poll::Pending,
+        }
+    };
+}
diff --git a/android/vendor/getrandom-0.2.7/.cargo-checksum.json b/android/vendor/getrandom-0.2.7/.cargo-checksum.json
new file mode 100644
index 0000000..adfe6c9
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CHANGELOG.md":"1289f7318d266dca92eceb373c5ff6ee81fa867a6f180ad57759d37df9fcad91","Cargo.toml":"2b0b1b62739f57c58e5069f90b70003f56f3242517d14ac1f875b9f36d227e6e","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"7ae74633326a22fd6298d7f209fb14884277bd98049795f444945acbb2b0dfbd","benches/mod.rs":"5495735ff210a50cab23c2cc84191ed910af7c30395a3d9d6095b722765b3864","src/3ds.rs":"0f48fc15f89b518fb92e06aaa4838b62dc073598e8f288df56ad1e5a9251af1e","src/bsd_arandom.rs":"d90c419d4def20f83e7535cd3f5ec07035045011a50c3652951d196a120c5d3e","src/custom.rs":"b363ee77664203d141985402433afd6808b72cc50bff586b3034d303eccfc281","src/dragonfly.rs":"47f933eac189f6ea48ecf021efd0747ebce1b43d1bece6bbf72a951bab705987","src/error.rs":"f87ce17f9299f9b59b47306dab25ed01d720a0ba53363f52b46b50e2f5e49e36","src/error_impls.rs":"9c34832ebb99cd5e31bc5c8ffc5beb5b3fa6f7ff0226aaa1cdf8e10e6d64b324","src/espidf.rs":"19f101486584fde6dad962f4d9792de168658047312106641a5caf6866a5bbcf","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"4bad4f5c096a50338b86aeac91a937c18bc55b9555e6f34806ad13732e64523d","src/js.rs":"04c750491ba3bcdad3609265938410ee09928c5d6dfd0d33d826a9884d13ac4c","src/lib.rs":"6f61a660fe35864a2fc8ed2fe29b1c2ddf5d29854a2871daade66f0059f65b8e","src/linux_android.rs":"ec24575aa4ae71b6991290dadfdea931b05397c3faababf24bd794f1a9624835","src/macos.rs":"6c09827ad5292cd022e063efa79523bfdb50ed08b9867ebaa007cd321b8d218e","src/openbsd.rs":"450a23ead462d4a840fee4aa0bfdab1e3d88c8f48e4bb608d457429ddeca69c0","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"d52fee9dd7d661f960c01894edd563c1ff8a512c111f7803092d9aa2ff98718e","src/solid.rs":"997035d54c9762d22a5a14f54e7fbed4dd266cdeacbdf6aab7d8aee05537e8ba","src/use_file.rs":"16e42eb0a56e375c330c1ca8eb58c444e82ef3ad35230b961fdba96a02a68804","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"2a63ac0e6dab16b85c4728b79a16e0640301e8b876f151b0a1db0b4394fa219f","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"dfdd0a870581948bd03abe64d49ca4295d9cfa26e09b97a526fd5e17148ad9ca","src/windows.rs":"d0b4f2afd1959660aa9abcd9477764bd7dc0b7d7048aee748804b37963c77c6f","tests/common/mod.rs":"b6beee8f535d2d094a65711fe0af91a6fc220aa09729ed7269fe33cafdc9177f","tests/custom.rs":"9f2c0193193f6bcf641116ca0b3653b33d2015e0e98ce107ee1d1f60c5eeae3a","tests/normal.rs":"9e1c4b1e468a09ed0225370dfb6608f8b8135e0fabb09bbc1a718105164aade6","tests/rdrand.rs":"4474ccebf9d33c89288862a7e367018405968dddc55c7c6f97e21b5fe2264601"},"package":"4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"}
\ No newline at end of file
diff --git a/android/vendor/getrandom-0.2.7/CHANGELOG.md b/android/vendor/getrandom-0.2.7/CHANGELOG.md
new file mode 100644
index 0000000..b257049
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/CHANGELOG.md
@@ -0,0 +1,334 @@
+# Changelog
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [0.2.7] - 2022-06-14
+### Changed
+- Update `wasi` dependency to `0.11` [#253]
+
+### Fixed
+- Use `AtomicPtr` instead of `AtomicUsize` for Strict Provenance compatibility. [#263]
+
+### Documentation
+- Add comments explaining use of fallback mechanisms [#257] [#260]
+
+[#263]: https://github.com/rust-random/getrandom/pull/263
+[#260]: https://github.com/rust-random/getrandom/pull/260
+[#253]: https://github.com/rust-random/getrandom/pull/253
+[#257]: https://github.com/rust-random/getrandom/pull/257
+
+## [0.2.6] - 2022-03-28
+### Added
+- Nintendo 3DS (`armv6k-nintendo-3ds`) support [#248]
+
+### Changed
+- Retry `open` when interrupted [#252]
+
+[#248]: https://github.com/rust-random/getrandom/pull/248
+[#252]: https://github.com/rust-random/getrandom/pull/252
+
+## [0.2.5] - 2022-02-22
+### Added
+- ESP-IDF targets (`*‑espidf`) support [#245]
+
+### Fixed
+- Webpack warning caused by dynamic require [#234]
+- Error checking on iOS for `SecRandomCopyBytes` [#244]
+
+[#234]: https://github.com/rust-random/getrandom/pull/234
+[#244]: https://github.com/rust-random/getrandom/pull/244
+[#245]: https://github.com/rust-random/getrandom/pull/245
+
+## [0.2.4] - 2021-12-13
+### Changed
+- Use explicit imports in the `js` backend [#220]
+- Use `/dev/urandom` on Redox instead of `rand:` [#222]
+- Use `NonZeroU32::new_unchecked` to convert wasi error [#233]
+
+### Added
+- SOLID targets (`*-kmc-solid_*`) support [#235]
+- Limited Hermit (`x86_64-unknown-hermit`) support [#236]
+
+[#220]: https://github.com/rust-random/getrandom/pull/220
+[#222]: https://github.com/rust-random/getrandom/pull/222
+[#233]: https://github.com/rust-random/getrandom/pull/233
+[#235]: https://github.com/rust-random/getrandom/pull/235
+[#236]: https://github.com/rust-random/getrandom/pull/236
+
+## [0.2.3] - 2021-04-10
+### Changed
+- Replace build.rs with link attributes. [#205]
+- Add support for getrandom syscall on DragonFly BSD. [#210]
+- Improve Node.js detection. [#215]
+
+[#205]: https://github.com/rust-random/getrandom/pull/205
+[#210]: https://github.com/rust-random/getrandom/pull/210
+[#215]: https://github.com/rust-random/getrandom/pull/215
+
+## [0.2.2] - 2021-01-19
+### Changed
+- Forward `rustc-dep-of-std` to dependencies. [#198]
+- Highlight feature-dependend functionality in documentation using the `doc_cfg` feature. [#200]
+
+[#198]: https://github.com/rust-random/getrandom/pull/198
+[#200]: https://github.com/rust-random/getrandom/pull/200
+
+## [0.2.1] - 2021-01-03
+### Changed
+- Update `cfg-if` to v1.0. [#166]
+- Update `wasi` to v0.10. [#167]
+
+### Fixed
+- Multithreaded WASM support. [#165]
+
+### Removed
+- Windows XP support. [#177]
+- Direct `stdweb` support. [#178]
+- CloudABI support. [#184]
+
+[#165]: https://github.com/rust-random/getrandom/pull/165
+[#166]: https://github.com/rust-random/getrandom/pull/166
+[#167]: https://github.com/rust-random/getrandom/pull/167
+[#177]: https://github.com/rust-random/getrandom/pull/177
+[#178]: https://github.com/rust-random/getrandom/pull/178
+[#184]: https://github.com/rust-random/getrandom/pull/184
+
+## [0.2.0] - 2020-09-10
+### Features for using getrandom on unsupported targets
+
+The following (off by default) Cargo features have been added:
+- `"rdrand"` - use the RDRAND instruction on `no_std` `x86`/`x86_64` targets [#133]
+- `"js"` - use JavaScript calls on `wasm32-unknown-unknown` [#149]
+  - Replaces the `stdweb` and `wasm-bindgen` features (which are removed)
+- `"custom"` - allows a user to specify a custom implementation [#109]
+
+### Breaking Changes
+- Unsupported targets no longer compile [#107]
+- Change/Add `Error` constants [#120]
+- Only impl `std` traits when the `"std"` Cargo feature is specified [#106]
+- Remove official support for Hermit, L4Re, and UEFI [#133]
+- Remove optional `"log"` dependency [#131]
+- Update minimum supported Linux kernel to 2.6.32 [#153]
+- Update MSRV to 1.34 [#159]
+
+[#106]: https://github.com/rust-random/getrandom/pull/106
+[#107]: https://github.com/rust-random/getrandom/pull/107
+[#109]: https://github.com/rust-random/getrandom/pull/109
+[#120]: https://github.com/rust-random/getrandom/pull/120
+[#131]: https://github.com/rust-random/getrandom/pull/131
+[#133]: https://github.com/rust-random/getrandom/pull/133
+[#149]: https://github.com/rust-random/getrandom/pull/149
+[#153]: https://github.com/rust-random/getrandom/pull/153
+[#159]: https://github.com/rust-random/getrandom/pull/159
+
+## [0.1.16] - 2020-12-31
+### Changed
+- Update `cfg-if` to v1.0. [#173]
+- Implement `std::error::Error` for the `Error` type on additional targets. [#169]
+
+### Fixed
+- Multithreaded WASM support. [#171]
+
+[#173]: https://github.com/rust-random/getrandom/pull/173
+[#171]: https://github.com/rust-random/getrandom/pull/171
+[#169]: https://github.com/rust-random/getrandom/pull/169
+
+## [0.1.15] - 2020-09-10
+### Changed
+- Added support for Internet Explorer 11 [#139]
+- Fix Webpack require warning with `wasm-bindgen` [#137]
+
+[#137]: https://github.com/rust-random/getrandom/pull/137
+[#139]: https://github.com/rust-random/getrandom/pull/139
+
+## [0.1.14] - 2020-01-07
+### Changed
+- Remove use of spin-locks in the `use_file` module. [#125]
+- Update `wasi` to v0.9. [#126]
+- Do not read errno value on DragonFlyBSD to fix compilation failure. [#129]
+
+[#125]: https://github.com/rust-random/getrandom/pull/125
+[#126]: https://github.com/rust-random/getrandom/pull/126
+[#129]: https://github.com/rust-random/getrandom/pull/129
+
+## [0.1.13] - 2019-08-25
+### Added
+- VxWorks targets support. [#86]
+
+### Changed
+- If zero-length slice is passed to the `getrandom` function, always return
+`Ok(())` immediately without doing any calls to the underlying operating
+system. [#104]
+- Use the `kern.arandom` sysctl on NetBSD. [#115]
+
+### Fixed
+- Bump `cfg-if` minimum version from 0.1.0 to 0.1.2. [#112]
+- Typos and bad doc links. [#117]
+
+[#86]: https://github.com/rust-random/getrandom/pull/86
+[#104]: https://github.com/rust-random/getrandom/pull/104
+[#112]: https://github.com/rust-random/getrandom/pull/112
+[#115]: https://github.com/rust-random/getrandom/pull/115
+[#117]: https://github.com/rust-random/getrandom/pull/117
+
+## [0.1.12] - 2019-08-18
+### Changed
+- Update wasi dependency from v0.5 to v0.7. [#100]
+
+[#100]: https://github.com/rust-random/getrandom/pull/100
+
+## [0.1.11] - 2019-08-25
+### Fixed
+- Implement `std`-dependent traits for selected targets even if `std`
+feature is disabled. (backward compatibility with v0.1.8) [#96]
+
+[#96]: https://github.com/rust-random/getrandom/pull/96
+
+## [0.1.10] - 2019-08-18 [YANKED]
+### Changed
+- Use the dummy implementation on `wasm32-unknown-unknown` even with the
+disabled `dummy` feature. [#90]
+
+### Fixed
+- Fix CSP error for `wasm-bindgen`. [#92]
+
+[#90]: https://github.com/rust-random/getrandom/pull/90
+[#92]: https://github.com/rust-random/getrandom/pull/92
+
+## [0.1.9] - 2019-08-14 [YANKED]
+### Changed
+- Remove `std` dependency for opening and reading files. [#58]
+- Use `wasi` isntead of `libc` on WASI target. [#64]
+- By default emit a compile-time error when built for an unsupported target.
+This behaviour can be disabled by using the `dummy` feature. [#71]
+
+### Added
+- Add support for UWP targets. [#69]
+- Add unstable `rustc-dep-of-std` feature. [#78]
+
+[#58]: https://github.com/rust-random/getrandom/pull/58
+[#64]: https://github.com/rust-random/getrandom/pull/64
+[#69]: https://github.com/rust-random/getrandom/pull/69
+[#71]: https://github.com/rust-random/getrandom/pull/71
+[#78]: https://github.com/rust-random/getrandom/pull/78
+
+## [0.1.8] - 2019-07-29
+### Changed
+- Explicitly specify types to arguments of 'libc::syscall'. [#74]
+
+[#74]: https://github.com/rust-random/getrandom/pull/74
+
+## [0.1.7] - 2019-07-29
+### Added
+- Support for hermit and l4re. [#61]
+- `Error::raw_os_error` method, `Error::INTERNAL_START` and
+`Error::CUSTOM_START` constants. Use `libc` for retrieving OS error descriptions. [#54]
+
+### Changed
+- Remove `lazy_static` dependency and use custom structures for lock-free
+initialization. [#51] [#52]
+- Try `getrandom()` first on FreeBSD. [#57]
+
+### Removed
+-  Bitrig support. [#56]
+
+### Deprecated
+- `Error::UNKNOWN`, `Error::UNAVAILABLE`. [#54]
+
+[#51]: https://github.com/rust-random/getrandom/pull/51
+[#52]: https://github.com/rust-random/getrandom/pull/52
+[#54]: https://github.com/rust-random/getrandom/pull/54
+[#56]: https://github.com/rust-random/getrandom/pull/56
+[#57]: https://github.com/rust-random/getrandom/pull/57
+[#61]: https://github.com/rust-random/getrandom/pull/61
+
+## [0.1.6] - 2019-06-30
+### Changed
+- Minor change of RDRAND AMD bug handling. [#48]
+
+[#48]: https://github.com/rust-random/getrandom/pull/48
+
+## [0.1.5] - 2019-06-29
+### Fixed
+- Use shared `File` instead of shared file descriptor. [#44]
+- Workaround for RDRAND hardware bug present on some AMD CPUs. [#43]
+
+### Changed
+- Try `getentropy` and then fallback to `/dev/random` on macOS. [#38]
+
+[#38]: https://github.com/rust-random/getrandom/issues/38
+[#43]: https://github.com/rust-random/getrandom/pull/43
+[#44]: https://github.com/rust-random/getrandom/issues/44
+
+## [0.1.4] - 2019-06-28
+### Added
+- Add support for `x86_64-unknown-uefi` target by using RDRAND with CPUID
+feature detection. [#30]
+
+### Fixed
+- Fix long buffer issues on Windows and Linux. [#31] [#32]
+- Check `EPERM` in addition to `ENOSYS` on Linux. [#37]
+
+### Changed
+- Improve efficiency by sharing file descriptor across threads. [#13]
+- Remove `cloudabi`, `winapi`, and `fuchsia-cprng` dependencies. [#40]
+- Improve RDRAND implementation. [#24]
+- Don't block during syscall detection on Linux. [#26]
+- Increase consistency with libc implementation on FreeBSD. [#36]
+- Apply `rustfmt`. [#39]
+
+[#30]: https://github.com/rust-random/getrandom/pull/30
+[#13]: https://github.com/rust-random/getrandom/issues/13
+[#40]: https://github.com/rust-random/getrandom/pull/40
+[#26]: https://github.com/rust-random/getrandom/pull/26
+[#24]: https://github.com/rust-random/getrandom/pull/24
+[#39]: https://github.com/rust-random/getrandom/pull/39
+[#36]: https://github.com/rust-random/getrandom/pull/36
+[#31]: https://github.com/rust-random/getrandom/issues/31
+[#32]: https://github.com/rust-random/getrandom/issues/32
+[#37]: https://github.com/rust-random/getrandom/issues/37
+
+## [0.1.3] - 2019-05-15
+- Update for `wasm32-unknown-wasi` being renamed to `wasm32-wasi`, and for
+  WASI being categorized as an OS.
+
+## [0.1.2] - 2019-04-06
+- Add support for `wasm32-unknown-wasi` target.
+
+## [0.1.1] - 2019-04-05
+- Enable std functionality for CloudABI by default.
+
+## [0.1.0] - 2019-03-23
+Publish initial implementation.
+
+## [0.0.0] - 2019-01-19
+Publish an empty template library.
+
+[0.2.7]: https://github.com/rust-random/getrandom/compare/v0.2.6...v0.2.7
+[0.2.6]: https://github.com/rust-random/getrandom/compare/v0.2.5...v0.2.6
+[0.2.5]: https://github.com/rust-random/getrandom/compare/v0.2.4...v0.2.5
+[0.2.4]: https://github.com/rust-random/getrandom/compare/v0.2.3...v0.2.4
+[0.2.3]: https://github.com/rust-random/getrandom/compare/v0.2.2...v0.2.3
+[0.2.2]: https://github.com/rust-random/getrandom/compare/v0.2.1...v0.2.2
+[0.2.1]: https://github.com/rust-random/getrandom/compare/v0.2.0...v0.2.1
+[0.2.0]: https://github.com/rust-random/getrandom/compare/v0.1.15...v0.2.0
+[0.1.16]: https://github.com/rust-random/getrandom/compare/v0.1.15...v0.1.16
+[0.1.15]: https://github.com/rust-random/getrandom/compare/v0.1.14...v0.1.15
+[0.1.14]: https://github.com/rust-random/getrandom/compare/v0.1.13...v0.1.14
+[0.1.13]: https://github.com/rust-random/getrandom/compare/v0.1.12...v0.1.13
+[0.1.12]: https://github.com/rust-random/getrandom/compare/v0.1.11...v0.1.12
+[0.1.11]: https://github.com/rust-random/getrandom/compare/v0.1.10...v0.1.11
+[0.1.10]: https://github.com/rust-random/getrandom/compare/v0.1.9...v0.1.10
+[0.1.9]: https://github.com/rust-random/getrandom/compare/v0.1.8...v0.1.9
+[0.1.8]: https://github.com/rust-random/getrandom/compare/v0.1.7...v0.1.8
+[0.1.7]: https://github.com/rust-random/getrandom/compare/v0.1.6...v0.1.7
+[0.1.6]: https://github.com/rust-random/getrandom/compare/v0.1.5...v0.1.6
+[0.1.5]: https://github.com/rust-random/getrandom/compare/v0.1.4...v0.1.5
+[0.1.4]: https://github.com/rust-random/getrandom/compare/v0.1.3...v0.1.4
+[0.1.3]: https://github.com/rust-random/getrandom/compare/v0.1.2...v0.1.3
+[0.1.2]: https://github.com/rust-random/getrandom/compare/v0.1.1...v0.1.2
+[0.1.1]: https://github.com/rust-random/getrandom/compare/v0.1.0...v0.1.1
+[0.1.0]: https://github.com/rust-random/getrandom/compare/v0.0.0...v0.1.0
+[0.0.0]: https://github.com/rust-random/getrandom/releases/tag/v0.0.0
diff --git a/android/vendor/getrandom-0.2.7/Cargo.toml b/android/vendor/getrandom-0.2.7/Cargo.toml
new file mode 100644
index 0000000..9b9c088
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/Cargo.toml
@@ -0,0 +1,83 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "getrandom"
+version = "0.2.7"
+authors = ["The Rand Project Developers"]
+exclude = [".*"]
+description = "A small cross-platform library for retrieving random data from system source"
+documentation = "https://docs.rs/getrandom"
+readme = "README.md"
+categories = [
+    "os",
+    "no-std",
+]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/rust-random/getrandom"
+
+[package.metadata.docs.rs]
+features = [
+    "std",
+    "custom",
+]
+rustdoc-args = [
+    "--cfg",
+    "docsrs",
+]
+
+[dependencies.cfg-if]
+version = "1"
+
+[dependencies.compiler_builtins]
+version = "0.1"
+optional = true
+
+[dependencies.core]
+version = "1.0"
+optional = true
+package = "rustc-std-workspace-core"
+
+[features]
+custom = []
+js = [
+    "wasm-bindgen",
+    "js-sys",
+]
+rdrand = []
+rustc-dep-of-std = [
+    "compiler_builtins",
+    "core",
+    "libc/rustc-dep-of-std",
+    "wasi/rustc-dep-of-std",
+]
+std = []
+test-in-browser = []
+
+[target."cfg(all(target_arch = \"wasm32\", target_os = \"unknown\"))".dependencies.js-sys]
+version = "0.3"
+optional = true
+
+[target."cfg(all(target_arch = \"wasm32\", target_os = \"unknown\"))".dependencies.wasm-bindgen]
+version = "0.2.62"
+optional = true
+default-features = false
+
+[target."cfg(all(target_arch = \"wasm32\", target_os = \"unknown\"))".dev-dependencies.wasm-bindgen-test]
+version = "0.3.18"
+
+[target."cfg(target_os = \"wasi\")".dependencies.wasi]
+version = "0.11"
+
+[target."cfg(unix)".dependencies.libc]
+version = "0.2.120"
+default-features = false
diff --git a/android/vendor/getrandom-0.2.7/LICENSE-APACHE b/android/vendor/getrandom-0.2.7/LICENSE-APACHE
new file mode 100644
index 0000000..17d7468
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     https://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	https://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/getrandom-0.2.7/LICENSE-MIT b/android/vendor/getrandom-0.2.7/LICENSE-MIT
new file mode 100644
index 0000000..d93b5ba
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/LICENSE-MIT
@@ -0,0 +1,26 @@
+Copyright 2018 Developers of the Rand project
+Copyright (c) 2014 The Rust Project Developers
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/getrandom-0.2.7/README.md b/android/vendor/getrandom-0.2.7/README.md
new file mode 100644
index 0000000..df2307b
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/README.md
@@ -0,0 +1,64 @@
+# getrandom
+
+[![Build Status]][GitHub Actions] [![Crate]][crates.io] [![Documentation]][docs.rs] [![Dependency Status]][deps.rs] [![Downloads]][crates.io] [![License]][LICENSE-MIT]
+
+[GitHub Actions]: https://github.com/rust-random/getrandom/actions?query=workflow:Tests+branch:master
+[Build Status]: https://github.com/rust-random/getrandom/workflows/Tests/badge.svg?branch=master
+[crates.io]: https://crates.io/crates/getrandom
+[Crate]: https://img.shields.io/crates/v/getrandom
+[docs.rs]: https://docs.rs/getrandom
+[Documentation]: https://docs.rs/getrandom/badge.svg
+[deps.rs]: https://deps.rs/repo/github/rust-random/getrandom
+[Dependency Status]: https://deps.rs/repo/github/rust-random/getrandom/status.svg
+[Downloads]: https://img.shields.io/crates/d/getrandom
+[LICENSE-MIT]: https://raw.githubusercontent.com/rust-random/getrandom/master/LICENSE-MIT
+[License]: https://img.shields.io/crates/l/getrandom
+
+
+A Rust library for retrieving random data from (operating) system source. It is
+assumed that system always provides high-quality cryptographically secure random
+data, ideally backed by hardware entropy sources. This crate derives its name
+from Linux's `getrandom` function, but is cross platform, roughly supporting
+the same set of platforms as Rust's `std` lib.
+
+This is a low-level API. Most users should prefer using high-level random-number
+library like [`rand`].
+
+[`rand`]: https://crates.io/crates/rand
+
+## Usage
+
+Add this to your `Cargo.toml`:
+
+```toml
+[dependencies]
+getrandom = "0.2"
+```
+
+Then invoke the `getrandom` function:
+
+```rust
+fn get_random_buf() -> Result<[u8; 32], getrandom::Error> {
+    let mut buf = [0u8; 32];
+    getrandom::getrandom(&mut buf)?;
+    Ok(buf)
+}
+```
+
+For more information about supported targets, entropy sources, `no_std` targets,
+crate features, WASM support and Custom RNGs see the
+[`getrandom` documentation](https://docs.rs/getrandom/latest) and
+[`getrandom::Error` documentation](https://docs.rs/getrandom/latest/getrandom/struct.Error.html).
+
+## Minimum Supported Rust Version
+
+This crate requires Rust 1.34.0 or later.
+
+# License
+
+The `getrandom` library is distributed under either of
+
+ * [Apache License, Version 2.0](LICENSE-APACHE)
+ * [MIT license](LICENSE-MIT)
+
+at your option.
diff --git a/android/vendor/getrandom-0.2.7/benches/mod.rs b/android/vendor/getrandom-0.2.7/benches/mod.rs
new file mode 100644
index 0000000..a93e720
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/benches/mod.rs
@@ -0,0 +1,22 @@
+#![feature(test)]
+extern crate test;
+
+#[bench]
+fn bench_64(b: &mut test::Bencher) {
+    let mut buf = [0u8; 64];
+    b.iter(|| {
+        getrandom::getrandom(&mut buf[..]).unwrap();
+        test::black_box(&buf);
+    });
+    b.bytes = buf.len() as u64;
+}
+
+#[bench]
+fn bench_65536(b: &mut test::Bencher) {
+    let mut buf = [0u8; 65536];
+    b.iter(|| {
+        getrandom::getrandom(&mut buf[..]).unwrap();
+        test::black_box(&buf);
+    });
+    b.bytes = buf.len() as u64;
+}
diff --git a/android/vendor/getrandom-0.2.7/src/3ds.rs b/android/vendor/getrandom-0.2.7/src/3ds.rs
new file mode 100644
index 0000000..6030512
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/3ds.rs
@@ -0,0 +1,17 @@
+// Copyright 2021 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for Nintendo 3DS
+use crate::util_libc::sys_fill_exact;
+use crate::Error;
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    sys_fill_exact(dest, |buf| unsafe {
+        libc::getrandom(buf.as_mut_ptr() as *mut libc::c_void, buf.len(), 0)
+    })
+}
diff --git a/android/vendor/getrandom-0.2.7/src/bsd_arandom.rs b/android/vendor/getrandom-0.2.7/src/bsd_arandom.rs
new file mode 100644
index 0000000..d441212
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/bsd_arandom.rs
@@ -0,0 +1,53 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for FreeBSD and NetBSD
+use crate::{util_libc::sys_fill_exact, Error};
+use core::ptr;
+
+fn kern_arnd(buf: &mut [u8]) -> libc::ssize_t {
+    static MIB: [libc::c_int; 2] = [libc::CTL_KERN, libc::KERN_ARND];
+    let mut len = buf.len();
+    let ret = unsafe {
+        libc::sysctl(
+            MIB.as_ptr(),
+            MIB.len() as libc::c_uint,
+            buf.as_mut_ptr() as *mut _,
+            &mut len,
+            ptr::null(),
+            0,
+        )
+    };
+    if ret == -1 {
+        -1
+    } else {
+        len as libc::ssize_t
+    }
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // getrandom(2) was introduced in FreeBSD 12.0 and NetBSD 10.0
+    #[cfg(target_os = "freebsd")]
+    {
+        use crate::util_libc::Weak;
+        static GETRANDOM: Weak = unsafe { Weak::new("getrandom\0") };
+        type GetRandomFn =
+            unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::ssize_t;
+
+        if let Some(fptr) = GETRANDOM.ptr() {
+            let func: GetRandomFn = unsafe { core::mem::transmute(fptr) };
+            return sys_fill_exact(dest, |buf| unsafe { func(buf.as_mut_ptr(), buf.len(), 0) });
+        }
+    }
+    // Both FreeBSD and NetBSD will only return up to 256 bytes at a time, and
+    // older NetBSD kernels will fail on longer buffers.
+    for chunk in dest.chunks_mut(256) {
+        sys_fill_exact(chunk, kern_arnd)?
+    }
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/src/custom.rs b/android/vendor/getrandom-0.2.7/src/custom.rs
new file mode 100644
index 0000000..6110b05
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/custom.rs
@@ -0,0 +1,102 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! An implementation which calls out to an externally defined function.
+use crate::Error;
+use core::num::NonZeroU32;
+
+/// Register a function to be invoked by `getrandom` on unsupported targets.
+///
+/// ## Writing a custom `getrandom` implementation
+///
+/// The function to register must have the same signature as
+/// [`getrandom::getrandom`](crate::getrandom). The function can be defined
+/// wherever you want, either in root crate or a dependent crate.
+///
+/// For example, if we wanted a `failure-getrandom` crate containing an
+/// implementation that always fails, we would first depend on `getrandom`
+/// (for the [`Error`] type) in `failure-getrandom/Cargo.toml`:
+/// ```toml
+/// [dependencies]
+/// getrandom = "0.2"
+/// ```
+/// Note that the crate containing this function does **not** need to enable the
+/// `"custom"` Cargo feature.
+///
+/// Next, in `failure-getrandom/src/lib.rs`, we define our function:
+/// ```rust
+/// use core::num::NonZeroU32;
+/// use getrandom::Error;
+///
+/// // Some application-specific error code
+/// const MY_CUSTOM_ERROR_CODE: u32 = Error::CUSTOM_START + 42;
+/// pub fn always_fail(buf: &mut [u8]) -> Result<(), Error> {
+///     let code = NonZeroU32::new(MY_CUSTOM_ERROR_CODE).unwrap();
+///     Err(Error::from(code))
+/// }
+/// ```
+///
+/// ## Registering a custom `getrandom` implementation
+///
+/// Functions can only be registered in the root binary crate. Attempting to
+/// register a function in a non-root crate will result in a linker error.
+/// This is similar to
+/// [`#[panic_handler]`](https://doc.rust-lang.org/nomicon/panic-handler.html) or
+/// [`#[global_allocator]`](https://doc.rust-lang.org/edition-guide/rust-2018/platform-and-target-support/global-allocators.html),
+/// where helper crates define handlers/allocators but only the binary crate
+/// actually _uses_ the functionality.
+///
+/// To register the function, we first depend on `failure-getrandom` _and_
+/// `getrandom` in `Cargo.toml`:
+/// ```toml
+/// [dependencies]
+/// failure-getrandom = "0.1"
+/// getrandom = { version = "0.2", features = ["custom"] }
+/// ```
+///
+/// Then, we register the function in `src/main.rs`:
+/// ```rust
+/// # mod failure_getrandom { pub fn always_fail(_: &mut [u8]) -> Result<(), getrandom::Error> { unimplemented!() } }
+/// use failure_getrandom::always_fail;
+/// use getrandom::register_custom_getrandom;
+///
+/// register_custom_getrandom!(always_fail);
+/// ```
+///
+/// Now any user of `getrandom` (direct or indirect) on this target will use the
+/// registered function. As noted in the
+/// [top-level documentation](index.html#custom-implementations) this
+/// registration only has an effect on unsupported targets.
+#[macro_export]
+#[cfg_attr(docsrs, doc(cfg(feature = "custom")))]
+macro_rules! register_custom_getrandom {
+    ($path:path) => {
+        // We use an extern "C" function to get the guarantees of a stable ABI.
+        #[no_mangle]
+        extern "C" fn __getrandom_custom(dest: *mut u8, len: usize) -> u32 {
+            let f: fn(&mut [u8]) -> Result<(), ::getrandom::Error> = $path;
+            let slice = unsafe { ::core::slice::from_raw_parts_mut(dest, len) };
+            match f(slice) {
+                Ok(()) => 0,
+                Err(e) => e.code().get(),
+            }
+        }
+    };
+}
+
+#[allow(dead_code)]
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    extern "C" {
+        fn __getrandom_custom(dest: *mut u8, len: usize) -> u32;
+    }
+    let ret = unsafe { __getrandom_custom(dest.as_mut_ptr(), dest.len()) };
+    match NonZeroU32::new(ret) {
+        None => Ok(()),
+        Some(code) => Err(Error::from(code)),
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/dragonfly.rs b/android/vendor/getrandom-0.2.7/src/dragonfly.rs
new file mode 100644
index 0000000..8daaa40
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/dragonfly.rs
@@ -0,0 +1,27 @@
+// Copyright 2021 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for DragonFly BSD
+use crate::{
+    use_file,
+    util_libc::{sys_fill_exact, Weak},
+    Error,
+};
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    static GETRANDOM: Weak = unsafe { Weak::new("getrandom\0") };
+    type GetRandomFn = unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::ssize_t;
+
+    // getrandom(2) was introduced in DragonflyBSD 5.7
+    if let Some(fptr) = GETRANDOM.ptr() {
+        let func: GetRandomFn = unsafe { core::mem::transmute(fptr) };
+        return sys_fill_exact(dest, |buf| unsafe { func(buf.as_mut_ptr(), buf.len(), 0) });
+    } else {
+        use_file::getrandom_inner(dest)
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/error.rs b/android/vendor/getrandom-0.2.7/src/error.rs
new file mode 100644
index 0000000..b5ab2bb
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/error.rs
@@ -0,0 +1,187 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+use core::{fmt, num::NonZeroU32};
+
+/// A small and `no_std` compatible error type
+///
+/// The [`Error::raw_os_error()`] will indicate if the error is from the OS, and
+/// if so, which error code the OS gave the application. If such an error is
+/// encountered, please consult with your system documentation.
+///
+/// Internally this type is a NonZeroU32, with certain values reserved for
+/// certain purposes, see [`Error::INTERNAL_START`] and [`Error::CUSTOM_START`].
+///
+/// *If this crate's `"std"` Cargo feature is enabled*, then:
+/// - [`getrandom::Error`][Error] implements
+///   [`std::error::Error`](https://doc.rust-lang.org/std/error/trait.Error.html)
+/// - [`std::io::Error`](https://doc.rust-lang.org/std/io/struct.Error.html) implements
+///   [`From<getrandom::Error>`](https://doc.rust-lang.org/std/convert/trait.From.html).
+#[derive(Copy, Clone, Eq, PartialEq)]
+pub struct Error(NonZeroU32);
+
+const fn internal_error(n: u16) -> Error {
+    // SAFETY: code > 0 as INTERNAL_START > 0 and adding n won't overflow a u32.
+    let code = Error::INTERNAL_START + (n as u32);
+    Error(unsafe { NonZeroU32::new_unchecked(code) })
+}
+
+impl Error {
+    /// This target/platform is not supported by `getrandom`.
+    pub const UNSUPPORTED: Error = internal_error(0);
+    /// The platform-specific `errno` returned a non-positive value.
+    pub const ERRNO_NOT_POSITIVE: Error = internal_error(1);
+    /// Call to iOS [`SecRandomCopyBytes`](https://developer.apple.com/documentation/security/1399291-secrandomcopybytes) failed.
+    pub const IOS_SEC_RANDOM: Error = internal_error(3);
+    /// Call to Windows [`RtlGenRandom`](https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom) failed.
+    pub const WINDOWS_RTL_GEN_RANDOM: Error = internal_error(4);
+    /// RDRAND instruction failed due to a hardware issue.
+    pub const FAILED_RDRAND: Error = internal_error(5);
+    /// RDRAND instruction unsupported on this target.
+    pub const NO_RDRAND: Error = internal_error(6);
+    /// The browser does not have support for `self.crypto`.
+    pub const WEB_CRYPTO: Error = internal_error(7);
+    /// The browser does not have support for `crypto.getRandomValues`.
+    pub const WEB_GET_RANDOM_VALUES: Error = internal_error(8);
+    /// On VxWorks, call to `randSecure` failed (random number generator is not yet initialized).
+    pub const VXWORKS_RAND_SECURE: Error = internal_error(11);
+    /// NodeJS does not have support for the `crypto` module.
+    pub const NODE_CRYPTO: Error = internal_error(12);
+    /// NodeJS does not have support for `crypto.randomFillSync`.
+    pub const NODE_RANDOM_FILL_SYNC: Error = internal_error(13);
+
+    /// Codes below this point represent OS Errors (i.e. positive i32 values).
+    /// Codes at or above this point, but below [`Error::CUSTOM_START`] are
+    /// reserved for use by the `rand` and `getrandom` crates.
+    pub const INTERNAL_START: u32 = 1 << 31;
+
+    /// Codes at or above this point can be used by users to define their own
+    /// custom errors.
+    pub const CUSTOM_START: u32 = (1 << 31) + (1 << 30);
+
+    /// Extract the raw OS error code (if this error came from the OS)
+    ///
+    /// This method is identical to [`std::io::Error::raw_os_error()`][1], except
+    /// that it works in `no_std` contexts. If this method returns `None`, the
+    /// error value can still be formatted via the `Display` implementation.
+    ///
+    /// [1]: https://doc.rust-lang.org/std/io/struct.Error.html#method.raw_os_error
+    #[inline]
+    pub fn raw_os_error(self) -> Option<i32> {
+        if self.0.get() < Self::INTERNAL_START {
+            match () {
+                #[cfg(target_os = "solid_asp3")]
+                // On SOLID, negate the error code again to obtain the original
+                // error code.
+                () => Some(-(self.0.get() as i32)),
+                #[cfg(not(target_os = "solid_asp3"))]
+                () => Some(self.0.get() as i32),
+            }
+        } else {
+            None
+        }
+    }
+
+    /// Extract the bare error code.
+    ///
+    /// This code can either come from the underlying OS, or be a custom error.
+    /// Use [`Error::raw_os_error()`] to disambiguate.
+    #[inline]
+    pub const fn code(self) -> NonZeroU32 {
+        self.0
+    }
+}
+
+cfg_if! {
+    if #[cfg(unix)] {
+        fn os_err(errno: i32, buf: &mut [u8]) -> Option<&str> {
+            let buf_ptr = buf.as_mut_ptr() as *mut libc::c_char;
+            if unsafe { libc::strerror_r(errno, buf_ptr, buf.len()) } != 0 {
+                return None;
+            }
+
+            // Take up to trailing null byte
+            let n = buf.len();
+            let idx = buf.iter().position(|&b| b == 0).unwrap_or(n);
+            core::str::from_utf8(&buf[..idx]).ok()
+        }
+    } else {
+        fn os_err(_errno: i32, _buf: &mut [u8]) -> Option<&str> {
+            None
+        }
+    }
+}
+
+impl fmt::Debug for Error {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        let mut dbg = f.debug_struct("Error");
+        if let Some(errno) = self.raw_os_error() {
+            dbg.field("os_error", &errno);
+            let mut buf = [0u8; 128];
+            if let Some(err) = os_err(errno, &mut buf) {
+                dbg.field("description", &err);
+            }
+        } else if let Some(desc) = internal_desc(*self) {
+            dbg.field("internal_code", &self.0.get());
+            dbg.field("description", &desc);
+        } else {
+            dbg.field("unknown_code", &self.0.get());
+        }
+        dbg.finish()
+    }
+}
+
+impl fmt::Display for Error {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        if let Some(errno) = self.raw_os_error() {
+            let mut buf = [0u8; 128];
+            match os_err(errno, &mut buf) {
+                Some(err) => err.fmt(f),
+                None => write!(f, "OS Error: {}", errno),
+            }
+        } else if let Some(desc) = internal_desc(*self) {
+            f.write_str(desc)
+        } else {
+            write!(f, "Unknown Error: {}", self.0.get())
+        }
+    }
+}
+
+impl From<NonZeroU32> for Error {
+    fn from(code: NonZeroU32) -> Self {
+        Self(code)
+    }
+}
+
+fn internal_desc(error: Error) -> Option<&'static str> {
+    match error {
+        Error::UNSUPPORTED => Some("getrandom: this target is not supported"),
+        Error::ERRNO_NOT_POSITIVE => Some("errno: did not return a positive value"),
+        Error::IOS_SEC_RANDOM => Some("SecRandomCopyBytes: iOS Security framework failure"),
+        Error::WINDOWS_RTL_GEN_RANDOM => Some("RtlGenRandom: Windows system function failure"),
+        Error::FAILED_RDRAND => Some("RDRAND: failed multiple times: CPU issue likely"),
+        Error::NO_RDRAND => Some("RDRAND: instruction not supported"),
+        Error::WEB_CRYPTO => Some("Web Crypto API is unavailable"),
+        Error::WEB_GET_RANDOM_VALUES => Some("Web API crypto.getRandomValues is unavailable"),
+        Error::VXWORKS_RAND_SECURE => Some("randSecure: VxWorks RNG module is not initialized"),
+        Error::NODE_CRYPTO => Some("Node.js crypto module is unavailable"),
+        Error::NODE_RANDOM_FILL_SYNC => Some("Node.js API crypto.randomFillSync is unavailable"),
+        _ => None,
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::Error;
+    use core::mem::size_of;
+
+    #[test]
+    fn test_size() {
+        assert_eq!(size_of::<Error>(), 4);
+        assert_eq!(size_of::<Result<(), Error>>(), 4);
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/error_impls.rs b/android/vendor/getrandom-0.2.7/src/error_impls.rs
new file mode 100644
index 0000000..61f46d2
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/error_impls.rs
@@ -0,0 +1,24 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+#![cfg_attr(docsrs, doc(cfg(feature = "std")))]
+extern crate std;
+
+use crate::Error;
+use core::convert::From;
+use std::io;
+
+impl From<Error> for io::Error {
+    fn from(err: Error) -> Self {
+        match err.raw_os_error() {
+            Some(errno) => io::Error::from_raw_os_error(errno),
+            None => io::Error::new(io::ErrorKind::Other, err),
+        }
+    }
+}
+
+impl std::error::Error for Error {}
diff --git a/android/vendor/getrandom-0.2.7/src/espidf.rs b/android/vendor/getrandom-0.2.7/src/espidf.rs
new file mode 100644
index 0000000..dce8a2a
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/espidf.rs
@@ -0,0 +1,26 @@
+// Copyright 2021 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for ESP-IDF
+use crate::Error;
+use core::ffi::c_void;
+
+extern "C" {
+    fn esp_fill_random(buf: *mut c_void, len: usize) -> u32;
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // Not that NOT enabling WiFi, BT, or the voltage noise entropy source (via `bootloader_random_enable`)
+    // will cause ESP-IDF to return pseudo-random numbers based on the voltage noise entropy, after the initial boot process:
+    // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/random.html
+    //
+    // However tracking if some of these entropy sources is enabled is way too difficult to implement here
+    unsafe { esp_fill_random(dest.as_mut_ptr().cast(), dest.len()) };
+
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/src/fuchsia.rs b/android/vendor/getrandom-0.2.7/src/fuchsia.rs
new file mode 100644
index 0000000..572ff53
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/fuchsia.rs
@@ -0,0 +1,20 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for Fuchsia Zircon
+use crate::Error;
+
+#[link(name = "zircon")]
+extern "C" {
+    fn zx_cprng_draw(buffer: *mut u8, length: usize);
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    unsafe { zx_cprng_draw(dest.as_mut_ptr(), dest.len()) }
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/src/ios.rs b/android/vendor/getrandom-0.2.7/src/ios.rs
new file mode 100644
index 0000000..226de16
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/ios.rs
@@ -0,0 +1,27 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for iOS
+use crate::Error;
+use core::{ffi::c_void, ptr::null};
+
+#[link(name = "Security", kind = "framework")]
+extern "C" {
+    fn SecRandomCopyBytes(rnd: *const c_void, count: usize, bytes: *mut u8) -> i32;
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // Apple's documentation guarantees kSecRandomDefault is a synonym for NULL.
+    let ret = unsafe { SecRandomCopyBytes(null(), dest.len(), dest.as_mut_ptr()) };
+    // errSecSuccess (from SecBase.h) is always zero.
+    if ret != 0 {
+        Err(Error::IOS_SEC_RANDOM)
+    } else {
+        Ok(())
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/js.rs b/android/vendor/getrandom-0.2.7/src/js.rs
new file mode 100644
index 0000000..e910f2b
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/js.rs
@@ -0,0 +1,129 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+use crate::Error;
+
+extern crate std;
+use std::thread_local;
+
+use js_sys::{global, Uint8Array};
+use wasm_bindgen::{prelude::wasm_bindgen, JsCast, JsValue};
+
+// Maximum is 65536 bytes see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues
+const BROWSER_CRYPTO_BUFFER_SIZE: usize = 256;
+
+enum RngSource {
+    Node(NodeCrypto),
+    Browser(BrowserCrypto, Uint8Array),
+}
+
+// JsValues are always per-thread, so we initialize RngSource for each thread.
+//   See: https://github.com/rustwasm/wasm-bindgen/pull/955
+thread_local!(
+    static RNG_SOURCE: Result<RngSource, Error> = getrandom_init();
+);
+
+pub(crate) fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    RNG_SOURCE.with(|result| {
+        let source = result.as_ref().map_err(|&e| e)?;
+
+        match source {
+            RngSource::Node(n) => {
+                if n.random_fill_sync(dest).is_err() {
+                    return Err(Error::NODE_RANDOM_FILL_SYNC);
+                }
+            }
+            RngSource::Browser(crypto, buf) => {
+                // getRandomValues does not work with all types of WASM memory,
+                // so we initially write to browser memory to avoid exceptions.
+                for chunk in dest.chunks_mut(BROWSER_CRYPTO_BUFFER_SIZE) {
+                    // The chunk can be smaller than buf's length, so we call to
+                    // JS to create a smaller view of buf without allocation.
+                    let sub_buf = buf.subarray(0, chunk.len() as u32);
+
+                    if crypto.get_random_values(&sub_buf).is_err() {
+                        return Err(Error::WEB_GET_RANDOM_VALUES);
+                    }
+                    sub_buf.copy_to(chunk);
+                }
+            }
+        };
+        Ok(())
+    })
+}
+
+fn getrandom_init() -> Result<RngSource, Error> {
+    let global: Global = global().unchecked_into();
+    if is_node(&global) {
+        let crypto = NODE_MODULE
+            .require("crypto")
+            .map_err(|_| Error::NODE_CRYPTO)?;
+        return Ok(RngSource::Node(crypto));
+    }
+
+    // Assume we are in some Web environment (browser or web worker). We get
+    // `self.crypto` (called `msCrypto` on IE), so we can call
+    // `crypto.getRandomValues`. If `crypto` isn't defined, we assume that
+    // we are in an older web browser and the OS RNG isn't available.
+    let crypto = match (global.crypto(), global.ms_crypto()) {
+        (c, _) if c.is_object() => c,
+        (_, c) if c.is_object() => c,
+        _ => return Err(Error::WEB_CRYPTO),
+    };
+
+    let buf = Uint8Array::new_with_length(BROWSER_CRYPTO_BUFFER_SIZE as u32);
+    Ok(RngSource::Browser(crypto, buf))
+}
+
+// Taken from https://www.npmjs.com/package/browser-or-node
+fn is_node(global: &Global) -> bool {
+    let process = global.process();
+    if process.is_object() {
+        let versions = process.versions();
+        if versions.is_object() {
+            return versions.node().is_string();
+        }
+    }
+    false
+}
+
+#[wasm_bindgen]
+extern "C" {
+    type Global; // Return type of js_sys::global()
+
+    // Web Crypto API (https://www.w3.org/TR/WebCryptoAPI/)
+    #[wasm_bindgen(method, getter, js_name = "msCrypto")]
+    fn ms_crypto(this: &Global) -> BrowserCrypto;
+    #[wasm_bindgen(method, getter)]
+    fn crypto(this: &Global) -> BrowserCrypto;
+    type BrowserCrypto;
+    #[wasm_bindgen(method, js_name = getRandomValues, catch)]
+    fn get_random_values(this: &BrowserCrypto, buf: &Uint8Array) -> Result<(), JsValue>;
+
+    // We use a "module" object here instead of just annotating require() with
+    // js_name = "module.require", so that Webpack doesn't give a warning. See:
+    //   https://github.com/rust-random/getrandom/issues/224
+    type NodeModule;
+    #[wasm_bindgen(js_name = module)]
+    static NODE_MODULE: NodeModule;
+    // Node JS crypto module (https://nodejs.org/api/crypto.html)
+    #[wasm_bindgen(method, catch)]
+    fn require(this: &NodeModule, s: &str) -> Result<NodeCrypto, JsValue>;
+    type NodeCrypto;
+    #[wasm_bindgen(method, js_name = randomFillSync, catch)]
+    fn random_fill_sync(this: &NodeCrypto, buf: &mut [u8]) -> Result<(), JsValue>;
+
+    // Node JS process Object (https://nodejs.org/api/process.html)
+    #[wasm_bindgen(method, getter)]
+    fn process(this: &Global) -> Process;
+    type Process;
+    #[wasm_bindgen(method, getter)]
+    fn versions(this: &Process) -> Versions;
+    type Versions;
+    #[wasm_bindgen(method, getter)]
+    fn node(this: &Versions) -> JsValue;
+}
diff --git a/android/vendor/getrandom-0.2.7/src/lib.rs b/android/vendor/getrandom-0.2.7/src/lib.rs
new file mode 100644
index 0000000..c62056e
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/lib.rs
@@ -0,0 +1,263 @@
+// Copyright 2019 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Interface to the operating system's random number generator.
+//!
+//! # Supported targets
+//!
+//! | Target            | Target Triple      | Implementation
+//! | ----------------- | ------------------ | --------------
+//! | Linux, Android    | `*‑linux‑*`        | [`getrandom`][1] system call if available, otherwise [`/dev/urandom`][2] after successfully polling `/dev/random`
+//! | Windows           | `*‑windows‑*`      | [`BCryptGenRandom`]
+//! | macOS             | `*‑apple‑darwin`   | [`getentropy`][3] if available, otherwise [`/dev/random`][4] (identical to `/dev/urandom`)
+//! | iOS               | `*‑apple‑ios`      | [`SecRandomCopyBytes`]
+//! | FreeBSD           | `*‑freebsd`        | [`getrandom`][5] if available, otherwise [`kern.arandom`][6]
+//! | OpenBSD           | `*‑openbsd`        | [`getentropy`][7]
+//! | NetBSD            | `*‑netbsd`         | [`kern.arandom`][8]
+//! | Dragonfly BSD     | `*‑dragonfly`      | [`getrandom`][9] if available, otherwise [`/dev/random`][10]
+//! | Solaris, illumos  | `*‑solaris`, `*‑illumos` | [`getrandom`][11] if available, otherwise [`/dev/random`][12]
+//! | Fuchsia OS        | `*‑fuchsia`        | [`cprng_draw`]
+//! | Redox             | `*‑redox`          | `/dev/urandom`
+//! | Haiku             | `*‑haiku`          | `/dev/random` (identical to `/dev/urandom`)
+//! | Hermit            | `x86_64-*-hermit`  | [`RDRAND`]
+//! | SGX               | `x86_64‑*‑sgx`     | [`RDRAND`]
+//! | VxWorks           | `*‑wrs‑vxworks‑*`  | `randABytes` after checking entropy pool initialization with `randSecure`
+//! | ESP-IDF           | `*‑espidf`         | [`esp_fill_random`]
+//! | Emscripten        | `*‑emscripten`     | `/dev/random` (identical to `/dev/urandom`)
+//! | WASI              | `wasm32‑wasi`      | [`random_get`]
+//! | Web Browser       | `wasm32‑*‑unknown` | [`Crypto.getRandomValues`], see [WebAssembly support]
+//! | Node.js           | `wasm32‑*‑unknown` | [`crypto.randomBytes`], see [WebAssembly support]
+//! | SOLID             | `*-kmc-solid_*`    | `SOLID_RNG_SampleRandomBytes`
+//! | Nintendo 3DS      | `armv6k-nintendo-3ds` | [`getrandom`][1]
+//!
+//! There is no blanket implementation on `unix` targets that reads from
+//! `/dev/urandom`. This ensures all supported targets are using the recommended
+//! interface and respect maximum buffer sizes.
+//!
+//! Pull Requests that add support for new targets to `getrandom` are always welcome.
+//!
+//! ## Unsupported targets
+//!
+//! By default, `getrandom` will not compile on unsupported targets, but certain
+//! features allow a user to select a "fallback" implementation if no supported
+//! implementation exists.
+//!
+//! All of the below mechanisms only affect unsupported
+//! targets. Supported targets will _always_ use their supported implementations.
+//! This prevents a crate from overriding a secure source of randomness
+//! (either accidentally or intentionally).
+//!
+//! ### RDRAND on x86
+//!
+//! *If the `rdrand` Cargo feature is enabled*, `getrandom` will fallback to using
+//! the [`RDRAND`] instruction to get randomness on `no_std` `x86`/`x86_64`
+//! targets. This feature has no effect on other CPU architectures.
+//!
+//! ### WebAssembly support
+//!
+//! This crate fully supports the
+//! [`wasm32-wasi`](https://github.com/CraneStation/wasi) and
+//! [`wasm32-unknown-emscripten`](https://www.hellorust.com/setup/emscripten/)
+//! targets. However, the `wasm32-unknown-unknown` target (i.e. the target used
+//! by `wasm-pack`) is not automatically
+//! supported since, from the target name alone, we cannot deduce which
+//! JavaScript interface is in use (or if JavaScript is available at all).
+//!
+//! Instead, *if the `js` Cargo feature is enabled*, this crate will assume
+//! that you are building for an environment containing JavaScript, and will
+//! call the appropriate methods. Both web browser (main window and Web Workers)
+//! and Node.js environments are supported, invoking the methods
+//! [described above](#supported-targets) using the
+//! [wasm-bindgen](https://github.com/rust-lang/rust-bindgen) toolchain.
+//!
+//! This feature has no effect on targets other than `wasm32-unknown-unknown`.
+//!
+//! ### Custom implementations
+//!
+//! The [`register_custom_getrandom!`] macro allows a user to mark their own
+//! function as the backing implementation for [`getrandom`]. See the macro's
+//! documentation for more information about writing and registering your own
+//! custom implementations.
+//!
+//! Note that registering a custom implementation only has an effect on targets
+//! that would otherwise not compile. Any supported targets (including those
+//! using `rdrand` and `js` Cargo features) continue using their normal
+//! implementations even if a function is registered.
+//!
+//! ### Indirect Dependencies
+//!
+//! If `getrandom` is not a direct dependency of your crate, you can still
+//! enable any of the above fallback behaviors by enabling the relevant
+//! feature in your root crate's `Cargo.toml`:
+//! ```toml
+//! [dependencies]
+//! getrandom = { version = "0.2", features = ["js"] }
+//! ```
+//!
+//! ## Early boot
+//!
+//! Sometimes, early in the boot process, the OS has not collected enough
+//! entropy to securely seed its RNG. This is especially common on virtual
+//! machines, where standard "random" events are hard to come by.
+//!
+//! Some operating system interfaces always block until the RNG is securely
+//! seeded. This can take anywhere from a few seconds to more than a minute.
+//! A few (Linux, NetBSD and Solaris) offer a choice between blocking and
+//! getting an error; in these cases, we always choose to block.
+//!
+//! On Linux (when the `getrandom` system call is not available), reading from
+//! `/dev/urandom` never blocks, even when the OS hasn't collected enough
+//! entropy yet. To avoid returning low-entropy bytes, we first poll
+//! `/dev/random` and only switch to `/dev/urandom` once this has succeeded.
+//!
+//! ## Error handling
+//!
+//! We always choose failure over returning insecure "random" bytes. In general,
+//! on supported platforms, failure is highly unlikely, though not impossible.
+//! If an error does occur, then it is likely that it will occur on every call to
+//! `getrandom`, hence after the first successful call one can be reasonably
+//! confident that no errors will occur.
+//!
+//! [1]: http://man7.org/linux/man-pages/man2/getrandom.2.html
+//! [2]: http://man7.org/linux/man-pages/man4/urandom.4.html
+//! [3]: https://www.unix.com/man-page/mojave/2/getentropy/
+//! [4]: https://www.unix.com/man-page/mojave/4/random/
+//! [5]: https://www.freebsd.org/cgi/man.cgi?query=getrandom&manpath=FreeBSD+12.0-stable
+//! [6]: https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4
+//! [7]: https://man.openbsd.org/getentropy.2
+//! [8]: https://man.netbsd.org/sysctl.7
+//! [9]: https://leaf.dragonflybsd.org/cgi/web-man?command=getrandom
+//! [10]: https://leaf.dragonflybsd.org/cgi/web-man?command=random&section=4
+//! [11]: https://docs.oracle.com/cd/E88353_01/html/E37841/getrandom-2.html
+//! [12]: https://docs.oracle.com/cd/E86824_01/html/E54777/random-7d.html
+//!
+//! [`BCryptGenRandom`]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
+//! [`Crypto.getRandomValues`]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues
+//! [`RDRAND`]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide
+//! [`SecRandomCopyBytes`]: https://developer.apple.com/documentation/security/1399291-secrandomcopybytes?language=objc
+//! [`cprng_draw`]: https://fuchsia.dev/fuchsia-src/zircon/syscalls/cprng_draw
+//! [`crypto.randomBytes`]: https://nodejs.org/api/crypto.html#crypto_crypto_randombytes_size_callback
+//! [`esp_fill_random`]: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/random.html#_CPPv415esp_fill_randomPv6size_t
+//! [`random_get`]: https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#-random_getbuf-pointeru8-buf_len-size---errno
+//! [WebAssembly support]: #webassembly-support
+
+#![doc(
+    html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
+    html_favicon_url = "https://www.rust-lang.org/favicon.ico",
+    html_root_url = "https://docs.rs/getrandom/0.2.7"
+)]
+#![no_std]
+#![warn(rust_2018_idioms, unused_lifetimes, missing_docs)]
+#![cfg_attr(docsrs, feature(doc_cfg))]
+
+#[macro_use]
+extern crate cfg_if;
+
+mod error;
+mod util;
+// To prevent a breaking change when targets are added, we always export the
+// register_custom_getrandom macro, so old Custom RNG crates continue to build.
+#[cfg(feature = "custom")]
+mod custom;
+#[cfg(feature = "std")]
+mod error_impls;
+
+pub use crate::error::Error;
+
+// System-specific implementations.
+//
+// These should all provide getrandom_inner with the same signature as getrandom.
+cfg_if! {
+    if #[cfg(any(target_os = "emscripten", target_os = "haiku",
+                 target_os = "redox"))] {
+        mod util_libc;
+        #[path = "use_file.rs"] mod imp;
+    } else if #[cfg(any(target_os = "android", target_os = "linux"))] {
+        mod util_libc;
+        mod use_file;
+        #[path = "linux_android.rs"] mod imp;
+    } else if #[cfg(any(target_os = "illumos", target_os = "solaris"))] {
+        mod util_libc;
+        mod use_file;
+        #[path = "solaris_illumos.rs"] mod imp;
+    } else if #[cfg(any(target_os = "freebsd", target_os = "netbsd"))] {
+        mod util_libc;
+        #[path = "bsd_arandom.rs"] mod imp;
+    } else if #[cfg(target_os = "dragonfly")] {
+        mod util_libc;
+        mod use_file;
+        #[path = "dragonfly.rs"] mod imp;
+    } else if #[cfg(target_os = "fuchsia")] {
+        #[path = "fuchsia.rs"] mod imp;
+    } else if #[cfg(target_os = "ios")] {
+        #[path = "ios.rs"] mod imp;
+    } else if #[cfg(target_os = "macos")] {
+        mod util_libc;
+        mod use_file;
+        #[path = "macos.rs"] mod imp;
+    } else if #[cfg(target_os = "openbsd")] {
+        mod util_libc;
+        #[path = "openbsd.rs"] mod imp;
+    } else if #[cfg(target_os = "wasi")] {
+        #[path = "wasi.rs"] mod imp;
+    } else if #[cfg(all(target_arch = "x86_64", target_os = "hermit"))] {
+        #[path = "rdrand.rs"] mod imp;
+    } else if #[cfg(target_os = "vxworks")] {
+        mod util_libc;
+        #[path = "vxworks.rs"] mod imp;
+    } else if #[cfg(target_os = "solid_asp3")] {
+        #[path = "solid.rs"] mod imp;
+    } else if #[cfg(target_os = "espidf")] {
+        #[path = "espidf.rs"] mod imp;
+    } else if #[cfg(windows)] {
+        #[path = "windows.rs"] mod imp;
+    } else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] {
+        #[path = "rdrand.rs"] mod imp;
+    } else if #[cfg(all(feature = "rdrand",
+                        any(target_arch = "x86_64", target_arch = "x86")))] {
+        #[path = "rdrand.rs"] mod imp;
+    } else if #[cfg(all(feature = "js",
+                        target_arch = "wasm32", target_os = "unknown"))] {
+        #[path = "js.rs"] mod imp;
+    } else if #[cfg(all(target_os = "horizon", target_arch = "arm"))] {
+        // We check for target_arch = "arm" because the Nintendo Switch also
+        // uses Horizon OS (it is aarch64).
+        mod util_libc;
+        #[path = "3ds.rs"] mod imp;
+    } else if #[cfg(feature = "custom")] {
+        use custom as imp;
+    } else if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] {
+        compile_error!("the wasm32-unknown-unknown target is not supported by \
+                        default, you may need to enable the \"js\" feature. \
+                        For more information see: \
+                        https://docs.rs/getrandom/#webassembly-support");
+    } else {
+        compile_error!("target is not supported, for more information see: \
+                        https://docs.rs/getrandom/#unsupported-targets");
+    }
+}
+
+/// Fill `dest` with random bytes from the system's preferred random number
+/// source.
+///
+/// This function returns an error on any failure, including partial reads. We
+/// make no guarantees regarding the contents of `dest` on error. If `dest` is
+/// empty, `getrandom` immediately returns success, making no calls to the
+/// underlying operating system.
+///
+/// Blocking is possible, at least during early boot; see module documentation.
+///
+/// In general, `getrandom` will be fast enough for interactive usage, though
+/// significantly slower than a user-space CSPRNG; for the latter consider
+/// [`rand::thread_rng`](https://docs.rs/rand/*/rand/fn.thread_rng.html).
+pub fn getrandom(dest: &mut [u8]) -> Result<(), Error> {
+    if dest.is_empty() {
+        return Ok(());
+    }
+    imp::getrandom_inner(dest)
+}
diff --git a/android/vendor/getrandom-0.2.7/src/linux_android.rs b/android/vendor/getrandom-0.2.7/src/linux_android.rs
new file mode 100644
index 0000000..4270b67
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/linux_android.rs
@@ -0,0 +1,47 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for Linux / Android
+use crate::{
+    util::LazyBool,
+    util_libc::{last_os_error, sys_fill_exact},
+    {use_file, Error},
+};
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // getrandom(2) was introduced in Linux 3.17
+    static HAS_GETRANDOM: LazyBool = LazyBool::new();
+    if HAS_GETRANDOM.unsync_init(is_getrandom_available) {
+        sys_fill_exact(dest, |buf| unsafe {
+            getrandom(buf.as_mut_ptr() as *mut libc::c_void, buf.len(), 0)
+        })
+    } else {
+        use_file::getrandom_inner(dest)
+    }
+}
+
+fn is_getrandom_available() -> bool {
+    let res = unsafe { getrandom(core::ptr::null_mut(), 0, libc::GRND_NONBLOCK) };
+    if res < 0 {
+        match last_os_error().raw_os_error() {
+            Some(libc::ENOSYS) => false, // No kernel support
+            Some(libc::EPERM) => false,  // Blocked by seccomp
+            _ => true,
+        }
+    } else {
+        true
+    }
+}
+
+unsafe fn getrandom(
+    buf: *mut libc::c_void,
+    buflen: libc::size_t,
+    flags: libc::c_uint,
+) -> libc::ssize_t {
+    libc::syscall(libc::SYS_getrandom, buf, buflen, flags) as libc::ssize_t
+}
diff --git a/android/vendor/getrandom-0.2.7/src/macos.rs b/android/vendor/getrandom-0.2.7/src/macos.rs
new file mode 100644
index 0000000..671a053
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/macos.rs
@@ -0,0 +1,36 @@
+// Copyright 2019 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for macOS
+use crate::{
+    use_file,
+    util_libc::{last_os_error, Weak},
+    Error,
+};
+use core::mem;
+
+type GetEntropyFn = unsafe extern "C" fn(*mut u8, libc::size_t) -> libc::c_int;
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // getentropy(2) was added in 10.12, Rust supports 10.7+
+    static GETENTROPY: Weak = unsafe { Weak::new("getentropy\0") };
+    if let Some(fptr) = GETENTROPY.ptr() {
+        let func: GetEntropyFn = unsafe { mem::transmute(fptr) };
+        for chunk in dest.chunks_mut(256) {
+            let ret = unsafe { func(chunk.as_mut_ptr(), chunk.len()) };
+            if ret != 0 {
+                return Err(last_os_error());
+            }
+        }
+        Ok(())
+    } else {
+        // We fallback to reading from /dev/random instead of SecRandomCopyBytes
+        // to avoid high startup costs and linking the Security framework.
+        use_file::getrandom_inner(dest)
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/openbsd.rs b/android/vendor/getrandom-0.2.7/src/openbsd.rs
new file mode 100644
index 0000000..4137173
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/openbsd.rs
@@ -0,0 +1,21 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for OpenBSD
+use crate::{util_libc::last_os_error, Error};
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // getentropy(2) was added in OpenBSD 5.6, so we can use it unconditionally.
+    for chunk in dest.chunks_mut(256) {
+        let ret = unsafe { libc::getentropy(chunk.as_mut_ptr() as *mut libc::c_void, chunk.len()) };
+        if ret == -1 {
+            return Err(last_os_error());
+        }
+    }
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/src/rdrand.rs b/android/vendor/getrandom-0.2.7/src/rdrand.rs
new file mode 100644
index 0000000..1df21e5
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/rdrand.rs
@@ -0,0 +1,97 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for SGX using RDRAND instruction
+use crate::Error;
+use core::mem;
+
+cfg_if! {
+    if #[cfg(target_arch = "x86_64")] {
+        use core::arch::x86_64 as arch;
+        use arch::_rdrand64_step as rdrand_step;
+    } else if #[cfg(target_arch = "x86")] {
+        use core::arch::x86 as arch;
+        use arch::_rdrand32_step as rdrand_step;
+    }
+}
+
+// Recommendation from "Intel® Digital Random Number Generator (DRNG) Software
+// Implementation Guide" - Section 5.2.1 and "Intel® 64 and IA-32 Architectures
+// Software Developer’s Manual" - Volume 1 - Section 7.3.17.1.
+const RETRY_LIMIT: usize = 10;
+const WORD_SIZE: usize = mem::size_of::<usize>();
+
+#[target_feature(enable = "rdrand")]
+unsafe fn rdrand() -> Result<[u8; WORD_SIZE], Error> {
+    for _ in 0..RETRY_LIMIT {
+        let mut el = mem::zeroed();
+        if rdrand_step(&mut el) == 1 {
+            // AMD CPUs from families 14h to 16h (pre Ryzen) sometimes fail to
+            // set CF on bogus random data, so we check these values explicitly.
+            // See https://github.com/systemd/systemd/issues/11810#issuecomment-489727505
+            // We perform this check regardless of target to guard against
+            // any implementation that incorrectly fails to set CF.
+            if el != 0 && el != !0 {
+                return Ok(el.to_ne_bytes());
+            }
+            // Keep looping in case this was a false positive.
+        }
+    }
+    Err(Error::FAILED_RDRAND)
+}
+
+// "rdrand" target feature requires "+rdrnd" flag, see https://github.com/rust-lang/rust/issues/49653.
+#[cfg(all(target_env = "sgx", not(target_feature = "rdrand")))]
+compile_error!(
+    "SGX targets require 'rdrand' target feature. Enable by using -C target-feature=+rdrnd."
+);
+
+#[cfg(target_feature = "rdrand")]
+fn is_rdrand_supported() -> bool {
+    true
+}
+
+// TODO use is_x86_feature_detected!("rdrand") when that works in core. See:
+// https://github.com/rust-lang-nursery/stdsimd/issues/464
+#[cfg(not(target_feature = "rdrand"))]
+fn is_rdrand_supported() -> bool {
+    use crate::util::LazyBool;
+
+    // SAFETY: All Rust x86 targets are new enough to have CPUID, and if CPUID
+    // is supported, CPUID leaf 1 is always supported.
+    const FLAG: u32 = 1 << 30;
+    static HAS_RDRAND: LazyBool = LazyBool::new();
+    HAS_RDRAND.unsync_init(|| unsafe { (arch::__cpuid(1).ecx & FLAG) != 0 })
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    if !is_rdrand_supported() {
+        return Err(Error::NO_RDRAND);
+    }
+
+    // SAFETY: After this point, rdrand is supported, so calling the rdrand
+    // functions is not undefined behavior.
+    unsafe { rdrand_exact(dest) }
+}
+
+#[target_feature(enable = "rdrand")]
+unsafe fn rdrand_exact(dest: &mut [u8]) -> Result<(), Error> {
+    // We use chunks_exact_mut instead of chunks_mut as it allows almost all
+    // calls to memcpy to be elided by the compiler.
+    let mut chunks = dest.chunks_exact_mut(WORD_SIZE);
+    for chunk in chunks.by_ref() {
+        chunk.copy_from_slice(&rdrand()?);
+    }
+
+    let tail = chunks.into_remainder();
+    let n = tail.len();
+    if n > 0 {
+        tail.copy_from_slice(&rdrand()?[..n]);
+    }
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/src/solaris_illumos.rs b/android/vendor/getrandom-0.2.7/src/solaris_illumos.rs
new file mode 100644
index 0000000..cf3067d
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/solaris_illumos.rs
@@ -0,0 +1,48 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for the Solaris family
+//!
+//! Read from `/dev/random`, with chunks of limited size (256 bytes).
+//! `/dev/random` uses the Hash_DRBG with SHA512 algorithm from NIST SP 800-90A.
+//! `/dev/urandom` uses the FIPS 186-2 algorithm, which is considered less
+//! secure. We choose to read from `/dev/random`.
+//!
+//! Since Solaris 11.3 and mid-2015 illumos, the `getrandom` syscall is available.
+//! To make sure we can compile on both Solaris and its derivatives, as well as
+//! function, we check for the existence of getrandom(2) in libc by calling
+//! libc::dlsym.
+use crate::{
+    use_file,
+    util_libc::{sys_fill_exact, Weak},
+    Error,
+};
+use core::mem;
+
+#[cfg(target_os = "illumos")]
+type GetRandomFn = unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::ssize_t;
+#[cfg(target_os = "solaris")]
+type GetRandomFn = unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::c_int;
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // getrandom(2) was introduced in Solaris 11.3 for Illumos in 2015.
+    static GETRANDOM: Weak = unsafe { Weak::new("getrandom\0") };
+    if let Some(fptr) = GETRANDOM.ptr() {
+        let func: GetRandomFn = unsafe { mem::transmute(fptr) };
+        // 256 bytes is the lowest common denominator across all the Solaris
+        // derived platforms for atomically obtaining random data.
+        for chunk in dest.chunks_mut(256) {
+            sys_fill_exact(chunk, |buf| unsafe {
+                func(buf.as_mut_ptr(), buf.len(), 0) as libc::ssize_t
+            })?
+        }
+        Ok(())
+    } else {
+        use_file::getrandom_inner(dest)
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/solid.rs b/android/vendor/getrandom-0.2.7/src/solid.rs
new file mode 100644
index 0000000..dc76aac
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/solid.rs
@@ -0,0 +1,26 @@
+// Copyright 2021 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for SOLID
+use crate::Error;
+use core::num::NonZeroU32;
+
+extern "C" {
+    pub fn SOLID_RNG_SampleRandomBytes(buffer: *mut u8, length: usize) -> i32;
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    let ret = unsafe { SOLID_RNG_SampleRandomBytes(dest.as_mut_ptr(), dest.len()) };
+    if ret >= 0 {
+        Ok(())
+    } else {
+        // ITRON error numbers are always negative, so we negate it so that it
+        // falls in the dedicated OS error range (1..INTERNAL_START).
+        Err(NonZeroU32::new((-ret) as u32).unwrap().into())
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/use_file.rs b/android/vendor/getrandom-0.2.7/src/use_file.rs
new file mode 100644
index 0000000..16c0216
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/use_file.rs
@@ -0,0 +1,139 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementations that just need to read from a file
+use crate::{
+    util::LazyUsize,
+    util_libc::{open_readonly, sys_fill_exact},
+    Error,
+};
+use core::{
+    cell::UnsafeCell,
+    sync::atomic::{AtomicUsize, Ordering::Relaxed},
+};
+
+#[cfg(any(
+    target_os = "dragonfly",
+    target_os = "emscripten",
+    target_os = "haiku",
+    target_os = "macos",
+    target_os = "solaris",
+    target_os = "illumos"
+))]
+const FILE_PATH: &str = "/dev/random\0";
+#[cfg(any(target_os = "android", target_os = "linux", target_os = "redox"))]
+const FILE_PATH: &str = "/dev/urandom\0";
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    let fd = get_rng_fd()?;
+    let read = |buf: &mut [u8]| unsafe { libc::read(fd, buf.as_mut_ptr() as *mut _, buf.len()) };
+
+    if cfg!(target_os = "emscripten") {
+        // `Crypto.getRandomValues` documents `dest` should be at most 65536 bytes.
+        for chunk in dest.chunks_mut(65536) {
+            sys_fill_exact(chunk, read)?;
+        }
+    } else {
+        sys_fill_exact(dest, read)?;
+    }
+    Ok(())
+}
+
+// Returns the file descriptor for the device file used to retrieve random
+// bytes. The file will be opened exactly once. All subsequent calls will
+// return the same file descriptor. This file descriptor is never closed.
+fn get_rng_fd() -> Result<libc::c_int, Error> {
+    static FD: AtomicUsize = AtomicUsize::new(LazyUsize::UNINIT);
+    fn get_fd() -> Option<libc::c_int> {
+        match FD.load(Relaxed) {
+            LazyUsize::UNINIT => None,
+            val => Some(val as libc::c_int),
+        }
+    }
+
+    // Use double-checked locking to avoid acquiring the lock if possible.
+    if let Some(fd) = get_fd() {
+        return Ok(fd);
+    }
+
+    // SAFETY: We use the mutex only in this method, and we always unlock it
+    // before returning, making sure we don't violate the pthread_mutex_t API.
+    static MUTEX: Mutex = Mutex::new();
+    unsafe { MUTEX.lock() };
+    let _guard = DropGuard(|| unsafe { MUTEX.unlock() });
+
+    if let Some(fd) = get_fd() {
+        return Ok(fd);
+    }
+
+    // On Linux, /dev/urandom might return insecure values.
+    #[cfg(any(target_os = "android", target_os = "linux"))]
+    wait_until_rng_ready()?;
+
+    let fd = unsafe { open_readonly(FILE_PATH)? };
+    // The fd always fits in a usize without conflicting with UNINIT.
+    debug_assert!(fd >= 0 && (fd as usize) < LazyUsize::UNINIT);
+    FD.store(fd as usize, Relaxed);
+
+    Ok(fd)
+}
+
+// Succeeds once /dev/urandom is safe to read from
+#[cfg(any(target_os = "android", target_os = "linux"))]
+fn wait_until_rng_ready() -> Result<(), Error> {
+    // Poll /dev/random to make sure it is ok to read from /dev/urandom.
+    let fd = unsafe { open_readonly("/dev/random\0")? };
+    let mut pfd = libc::pollfd {
+        fd,
+        events: libc::POLLIN,
+        revents: 0,
+    };
+    let _guard = DropGuard(|| unsafe {
+        libc::close(fd);
+    });
+
+    loop {
+        // A negative timeout means an infinite timeout.
+        let res = unsafe { libc::poll(&mut pfd, 1, -1) };
+        if res >= 0 {
+            debug_assert_eq!(res, 1); // We only used one fd, and cannot timeout.
+            return Ok(());
+        }
+        let err = crate::util_libc::last_os_error();
+        match err.raw_os_error() {
+            Some(libc::EINTR) | Some(libc::EAGAIN) => continue,
+            _ => return Err(err),
+        }
+    }
+}
+
+struct Mutex(UnsafeCell<libc::pthread_mutex_t>);
+
+impl Mutex {
+    const fn new() -> Self {
+        Self(UnsafeCell::new(libc::PTHREAD_MUTEX_INITIALIZER))
+    }
+    unsafe fn lock(&self) {
+        let r = libc::pthread_mutex_lock(self.0.get());
+        debug_assert_eq!(r, 0);
+    }
+    unsafe fn unlock(&self) {
+        let r = libc::pthread_mutex_unlock(self.0.get());
+        debug_assert_eq!(r, 0);
+    }
+}
+
+unsafe impl Sync for Mutex {}
+
+struct DropGuard<F: FnMut()>(F);
+
+impl<F: FnMut()> Drop for DropGuard<F> {
+    fn drop(&mut self) {
+        self.0()
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/util.rs b/android/vendor/getrandom-0.2.7/src/util.rs
new file mode 100644
index 0000000..06e23c2
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/util.rs
@@ -0,0 +1,64 @@
+// Copyright 2019 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+#![allow(dead_code)]
+use core::sync::atomic::{AtomicUsize, Ordering::Relaxed};
+
+// This structure represents a lazily initialized static usize value. Useful
+// when it is preferable to just rerun initialization instead of locking.
+// Both unsync_init and sync_init will invoke an init() function until it
+// succeeds, then return the cached value for future calls.
+//
+// Both methods support init() "failing". If the init() method returns UNINIT,
+// that value will be returned as normal, but will not be cached.
+//
+// Users should only depend on the _value_ returned by init() functions.
+// Specifically, for the following init() function:
+//      fn init() -> usize {
+//          a();
+//          let v = b();
+//          c();
+//          v
+//      }
+// the effects of c() or writes to shared memory will not necessarily be
+// observed and additional synchronization methods with be needed.
+pub struct LazyUsize(AtomicUsize);
+
+impl LazyUsize {
+    pub const fn new() -> Self {
+        Self(AtomicUsize::new(Self::UNINIT))
+    }
+
+    // The initialization is not completed.
+    pub const UNINIT: usize = usize::max_value();
+
+    // Runs the init() function at least once, returning the value of some run
+    // of init(). Multiple callers can run their init() functions in parallel.
+    // init() should always return the same value, if it succeeds.
+    pub fn unsync_init(&self, init: impl FnOnce() -> usize) -> usize {
+        // Relaxed ordering is fine, as we only have a single atomic variable.
+        let mut val = self.0.load(Relaxed);
+        if val == Self::UNINIT {
+            val = init();
+            self.0.store(val, Relaxed);
+        }
+        val
+    }
+}
+
+// Identical to LazyUsize except with bool instead of usize.
+pub struct LazyBool(LazyUsize);
+
+impl LazyBool {
+    pub const fn new() -> Self {
+        Self(LazyUsize::new())
+    }
+
+    pub fn unsync_init(&self, init: impl FnOnce() -> bool) -> bool {
+        self.0.unsync_init(|| init() as usize) != 0
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/util_libc.rs b/android/vendor/getrandom-0.2.7/src/util_libc.rs
new file mode 100644
index 0000000..d057071
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/util_libc.rs
@@ -0,0 +1,160 @@
+// Copyright 2019 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+#![allow(dead_code)]
+use crate::Error;
+use core::{
+    num::NonZeroU32,
+    ptr::NonNull,
+    sync::atomic::{fence, AtomicPtr, Ordering},
+};
+use libc::c_void;
+
+cfg_if! {
+    if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] {
+        use libc::__errno as errno_location;
+    } else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "redox"))] {
+        use libc::__errno_location as errno_location;
+    } else if #[cfg(any(target_os = "solaris", target_os = "illumos"))] {
+        use libc::___errno as errno_location;
+    } else if #[cfg(any(target_os = "macos", target_os = "freebsd"))] {
+        use libc::__error as errno_location;
+    } else if #[cfg(target_os = "haiku")] {
+        use libc::_errnop as errno_location;
+    } else if #[cfg(all(target_os = "horizon", target_arch = "arm"))] {
+        extern "C" {
+            // Not provided by libc: https://github.com/rust-lang/libc/issues/1995
+            fn __errno() -> *mut libc::c_int;
+        }
+        use __errno as errno_location;
+    }
+}
+
+cfg_if! {
+    if #[cfg(target_os = "vxworks")] {
+        use libc::errnoGet as get_errno;
+    } else if #[cfg(target_os = "dragonfly")] {
+        // Until rust-lang/rust#29594 is stable, we cannot get the errno value
+        // on DragonFlyBSD. So we just return an out-of-range errno.
+        unsafe fn get_errno() -> libc::c_int { -1 }
+    } else {
+        unsafe fn get_errno() -> libc::c_int { *errno_location() }
+    }
+}
+
+pub fn last_os_error() -> Error {
+    let errno = unsafe { get_errno() };
+    if errno > 0 {
+        Error::from(NonZeroU32::new(errno as u32).unwrap())
+    } else {
+        Error::ERRNO_NOT_POSITIVE
+    }
+}
+
+// Fill a buffer by repeatedly invoking a system call. The `sys_fill` function:
+//   - should return -1 and set errno on failure
+//   - should return the number of bytes written on success
+pub fn sys_fill_exact(
+    mut buf: &mut [u8],
+    sys_fill: impl Fn(&mut [u8]) -> libc::ssize_t,
+) -> Result<(), Error> {
+    while !buf.is_empty() {
+        let res = sys_fill(buf);
+        if res < 0 {
+            let err = last_os_error();
+            // We should try again if the call was interrupted.
+            if err.raw_os_error() != Some(libc::EINTR) {
+                return Err(err);
+            }
+        } else {
+            // We don't check for EOF (ret = 0) as the data we are reading
+            // should be an infinite stream of random bytes.
+            buf = &mut buf[(res as usize)..];
+        }
+    }
+    Ok(())
+}
+
+// A "weak" binding to a C function that may or may not be present at runtime.
+// Used for supporting newer OS features while still building on older systems.
+// Based off of the DlsymWeak struct in libstd:
+// https://github.com/rust-lang/rust/blob/1.61.0/library/std/src/sys/unix/weak.rs#L84
+// except that the caller must manually cast self.ptr() to a function pointer.
+pub struct Weak {
+    name: &'static str,
+    addr: AtomicPtr<c_void>,
+}
+
+impl Weak {
+    // A non-null pointer value which indicates we are uninitialized. This
+    // constant should ideally not be a valid address of a function pointer.
+    // However, if by chance libc::dlsym does return UNINIT, there will not
+    // be undefined behavior. libc::dlsym will just be called each time ptr()
+    // is called. This would be inefficient, but correct.
+    // TODO: Replace with core::ptr::invalid_mut(1) when that is stable.
+    const UNINIT: *mut c_void = 1 as *mut c_void;
+
+    // Construct a binding to a C function with a given name. This function is
+    // unsafe because `name` _must_ be null terminated.
+    pub const unsafe fn new(name: &'static str) -> Self {
+        Self {
+            name,
+            addr: AtomicPtr::new(Self::UNINIT),
+        }
+    }
+
+    // Return the address of a function if present at runtime. Otherwise,
+    // return None. Multiple callers can call ptr() concurrently. It will
+    // always return _some_ value returned by libc::dlsym. However, the
+    // dlsym function may be called multiple times.
+    pub fn ptr(&self) -> Option<NonNull<c_void>> {
+        // Despite having only a single atomic variable (self.addr), we still
+        // cannot always use Ordering::Relaxed, as we need to make sure a
+        // successful call to dlsym() is "ordered before" any data read through
+        // the returned pointer (which occurs when the function is called).
+        // Our implementation mirrors that of the one in libstd, meaning that
+        // the use of non-Relaxed operations is probably unnecessary.
+        match self.addr.load(Ordering::Relaxed) {
+            Self::UNINIT => {
+                let symbol = self.name.as_ptr() as *const _;
+                let addr = unsafe { libc::dlsym(libc::RTLD_DEFAULT, symbol) };
+                // Synchronizes with the Acquire fence below
+                self.addr.store(addr, Ordering::Release);
+                NonNull::new(addr)
+            }
+            addr => {
+                let func = NonNull::new(addr)?;
+                fence(Ordering::Acquire);
+                Some(func)
+            }
+        }
+    }
+}
+
+cfg_if! {
+    if #[cfg(any(target_os = "linux", target_os = "emscripten"))] {
+        use libc::open64 as open;
+    } else {
+        use libc::open;
+    }
+}
+
+// SAFETY: path must be null terminated, FD must be manually closed.
+pub unsafe fn open_readonly(path: &str) -> Result<libc::c_int, Error> {
+    debug_assert_eq!(path.as_bytes().last(), Some(&0));
+    loop {
+        let fd = open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
+        if fd >= 0 {
+            return Ok(fd);
+        }
+        let err = last_os_error();
+        // We should try again if open() was interrupted.
+        if err.raw_os_error() != Some(libc::EINTR) {
+            return Err(err);
+        }
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/vxworks.rs b/android/vendor/getrandom-0.2.7/src/vxworks.rs
new file mode 100644
index 0000000..6cb5d52
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/vxworks.rs
@@ -0,0 +1,34 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for VxWorks
+use crate::{util_libc::last_os_error, Error};
+use core::sync::atomic::{AtomicBool, Ordering::Relaxed};
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    static RNG_INIT: AtomicBool = AtomicBool::new(false);
+    while !RNG_INIT.load(Relaxed) {
+        let ret = unsafe { libc::randSecure() };
+        if ret < 0 {
+            return Err(Error::VXWORKS_RAND_SECURE);
+        } else if ret > 0 {
+            RNG_INIT.store(true, Relaxed);
+            break;
+        }
+        unsafe { libc::usleep(10) };
+    }
+
+    // Prevent overflow of i32
+    for chunk in dest.chunks_mut(i32::max_value() as usize) {
+        let ret = unsafe { libc::randABytes(chunk.as_mut_ptr(), chunk.len() as i32) };
+        if ret != 0 {
+            return Err(last_os_error());
+        }
+    }
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/src/wasi.rs b/android/vendor/getrandom-0.2.7/src/wasi.rs
new file mode 100644
index 0000000..c512182
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/wasi.rs
@@ -0,0 +1,19 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Implementation for WASI
+use crate::Error;
+use core::num::NonZeroU32;
+use wasi::wasi_snapshot_preview1::random_get;
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    match unsafe { random_get(dest.as_mut_ptr() as i32, dest.len() as i32) } {
+        0 => Ok(()),
+        err => Err(unsafe { NonZeroU32::new_unchecked(err as u32) }.into()),
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/src/windows.rs b/android/vendor/getrandom-0.2.7/src/windows.rs
new file mode 100644
index 0000000..41dc37a
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/src/windows.rs
@@ -0,0 +1,49 @@
+// Copyright 2018 Developers of the Rand project.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use crate::Error;
+use core::{ffi::c_void, num::NonZeroU32, ptr};
+
+const BCRYPT_USE_SYSTEM_PREFERRED_RNG: u32 = 0x00000002;
+
+#[link(name = "bcrypt")]
+extern "system" {
+    fn BCryptGenRandom(
+        hAlgorithm: *mut c_void,
+        pBuffer: *mut u8,
+        cbBuffer: u32,
+        dwFlags: u32,
+    ) -> u32;
+}
+
+pub fn getrandom_inner(dest: &mut [u8]) -> Result<(), Error> {
+    // Prevent overflow of u32
+    for chunk in dest.chunks_mut(u32::max_value() as usize) {
+        // BCryptGenRandom was introduced in Windows Vista
+        let ret = unsafe {
+            BCryptGenRandom(
+                ptr::null_mut(),
+                chunk.as_mut_ptr(),
+                chunk.len() as u32,
+                BCRYPT_USE_SYSTEM_PREFERRED_RNG,
+            )
+        };
+        // NTSTATUS codes use the two highest bits for severity status.
+        if ret >> 30 == 0b11 {
+            // We zeroize the highest bit, so the error code will reside
+            // inside the range designated for OS codes.
+            let code = ret ^ (1 << 31);
+            // SAFETY: the second highest bit is always equal to one,
+            // so it's impossible to get zero. Unfortunately the type
+            // system does not have a way to express this yet.
+            let code = unsafe { NonZeroU32::new_unchecked(code) };
+            return Err(Error::from(code));
+        }
+    }
+    Ok(())
+}
diff --git a/android/vendor/getrandom-0.2.7/tests/common/mod.rs b/android/vendor/getrandom-0.2.7/tests/common/mod.rs
new file mode 100644
index 0000000..006f230
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/tests/common/mod.rs
@@ -0,0 +1,66 @@
+use super::getrandom_impl;
+
+#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
+use wasm_bindgen_test::wasm_bindgen_test as test;
+
+#[cfg(feature = "test-in-browser")]
+wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
+
+#[test]
+fn test_zero() {
+    // Test that APIs are happy with zero-length requests
+    getrandom_impl(&mut [0u8; 0]).unwrap();
+}
+
+#[test]
+fn test_diff() {
+    let mut v1 = [0u8; 1000];
+    getrandom_impl(&mut v1).unwrap();
+
+    let mut v2 = [0u8; 1000];
+    getrandom_impl(&mut v2).unwrap();
+
+    let mut n_diff_bits = 0;
+    for i in 0..v1.len() {
+        n_diff_bits += (v1[i] ^ v2[i]).count_ones();
+    }
+
+    // Check at least 1 bit per byte differs. p(failure) < 1e-1000 with random input.
+    assert!(n_diff_bits >= v1.len() as u32);
+}
+
+#[test]
+fn test_huge() {
+    let mut huge = [0u8; 100_000];
+    getrandom_impl(&mut huge).unwrap();
+}
+
+// On WASM, the thread API always fails/panics
+#[cfg(not(target_arch = "wasm32"))]
+#[test]
+fn test_multithreading() {
+    extern crate std;
+    use std::{sync::mpsc::channel, thread, vec};
+
+    let mut txs = vec![];
+    for _ in 0..20 {
+        let (tx, rx) = channel();
+        txs.push(tx);
+
+        thread::spawn(move || {
+            // wait until all the tasks are ready to go.
+            rx.recv().unwrap();
+            let mut v = [0u8; 1000];
+
+            for _ in 0..100 {
+                getrandom_impl(&mut v).unwrap();
+                thread::yield_now();
+            }
+        });
+    }
+
+    // start all the tasks
+    for tx in txs.iter() {
+        tx.send(()).unwrap();
+    }
+}
diff --git a/android/vendor/getrandom-0.2.7/tests/custom.rs b/android/vendor/getrandom-0.2.7/tests/custom.rs
new file mode 100644
index 0000000..62eae1d
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/tests/custom.rs
@@ -0,0 +1,50 @@
+// Test that a custom handler works on wasm32-unknown-unknown
+#![cfg(all(
+    target_arch = "wasm32",
+    target_os = "unknown",
+    feature = "custom",
+    not(feature = "js")
+))]
+
+use wasm_bindgen_test::wasm_bindgen_test as test;
+#[cfg(feature = "test-in-browser")]
+wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
+
+use core::{
+    num::NonZeroU32,
+    sync::atomic::{AtomicU8, Ordering},
+};
+use getrandom::{getrandom, register_custom_getrandom, Error};
+
+fn len7_err() -> Error {
+    NonZeroU32::new(Error::INTERNAL_START + 7).unwrap().into()
+}
+
+fn super_insecure_rng(buf: &mut [u8]) -> Result<(), Error> {
+    // Length 7 buffers return a custom error
+    if buf.len() == 7 {
+        return Err(len7_err());
+    }
+    // Otherwise, increment an atomic counter
+    static COUNTER: AtomicU8 = AtomicU8::new(0);
+    for b in buf {
+        *b = COUNTER.fetch_add(1, Ordering::Relaxed);
+    }
+    Ok(())
+}
+
+register_custom_getrandom!(super_insecure_rng);
+
+#[test]
+fn custom_rng_output() {
+    let mut buf = [0u8; 4];
+    assert_eq!(getrandom(&mut buf), Ok(()));
+    assert_eq!(buf, [0, 1, 2, 3]);
+    assert_eq!(getrandom(&mut buf), Ok(()));
+    assert_eq!(buf, [4, 5, 6, 7]);
+}
+
+#[test]
+fn rng_err_output() {
+    assert_eq!(getrandom(&mut [0; 7]), Err(len7_err()));
+}
diff --git a/android/vendor/getrandom-0.2.7/tests/normal.rs b/android/vendor/getrandom-0.2.7/tests/normal.rs
new file mode 100644
index 0000000..5fff13b
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/tests/normal.rs
@@ -0,0 +1,11 @@
+// Don't test on custom wasm32-unknown-unknown
+#![cfg(not(all(
+    target_arch = "wasm32",
+    target_os = "unknown",
+    feature = "custom",
+    not(feature = "js")
+)))]
+
+// Use the normal getrandom implementation on this architecture.
+use getrandom::getrandom as getrandom_impl;
+mod common;
diff --git a/android/vendor/getrandom-0.2.7/tests/rdrand.rs b/android/vendor/getrandom-0.2.7/tests/rdrand.rs
new file mode 100644
index 0000000..4ff85c4
--- /dev/null
+++ b/android/vendor/getrandom-0.2.7/tests/rdrand.rs
@@ -0,0 +1,15 @@
+// We only test the RDRAND-based RNG source on supported architectures.
+#![cfg(any(target_arch = "x86_64", target_arch = "x86"))]
+
+// rdrand.rs expects to be part of the getrandom main crate, so we need these
+// additional imports to get rdrand.rs to compile.
+use getrandom::Error;
+#[macro_use]
+extern crate cfg_if;
+#[path = "../src/rdrand.rs"]
+mod rdrand;
+#[path = "../src/util.rs"]
+mod util;
+
+use rdrand::getrandom_inner as getrandom_impl;
+mod common;
diff --git a/android/vendor/git2-0.14.4/.cargo-checksum.json b/android/vendor/git2-0.14.4/.cargo-checksum.json
new file mode 100644
index 0000000..5c7c3d3
--- /dev/null
+++ b/android/vendor/git2-0.14.4/.cargo-checksum.json
@@ -0,0 +1 @@
+{"files":{"CONTRIBUTING.md":"ed1b35c16d94c5c8e447f444a78bf06459f57bf63ce9e9dcaa562d3950700fd8","Cargo.lock":"6ab41de1a77710aa9a89edbb9e58857b5131819e39dc19eadf83ea3eaaafcaf9","Cargo.toml":"8db91d66fb6aa22b12882c04f54668ce95c90f26c0d180108e8e640c8034e00a","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"c4d4a30ebb88024ba9db3989d383458e4a7ca51b1124c4fb3d0acabf333df9ca","examples/add.rs":"a9903f7a1af1b199783099509de3b640a3d039e9ad0b8c752c908e7fedf59b88","examples/blame.rs":"b59dc1daff18dee256038ea5e66c478678e51df1aacd20325f01d4e270fe3f20","examples/cat-file.rs":"93da1bf8891e43c308390e02f3c32106fcc085755e7f3e184d58aa2288c30cf4","examples/clone.rs":"822e6dac8f71877e8966ab72d3896dc82dfd7b525dbd54b1867964c2a9b241fd","examples/diff.rs":"d92d25865621aabccdc70087fb366211bb3fad4604d5b68bd8a580e8e4ee8412","examples/fetch.rs":"a34826b1f4448b688313b0322c951401e19b62c8f6cf28d06251bd148d842128","examples/init.rs":"3a88038e2e6eb1ff555db5cec0beff466ee500de03eaa075af3a5920d59db81b","examples/log.rs":"ea825b4b3c1410e7c14832ca87e4c1f291b5f8f83c527672be8d61d188326a16","examples/ls-remote.rs":"9e1d2fb2441c535f8abc5f1d146dd1d499e518f583baaae99b5234195153cf82","examples/pull.rs":"1b5b7a31f25b6b9168d279d3c055c99c8b174c69e7cf64806b481d088d85270f","examples/rev-list.rs":"2e18eea067c0d684dd89f6d86b4ddb052a3d594471b17eddfac9d0c18f64ae67","examples/rev-parse.rs":"125e80a916a3476d894aa555e2b780a8cf1316a0b5b850b9918b3c1af5c00dd4","examples/status.rs":"89ec5127e44123afaf429233c885cd547d7a28670512bf87c30770eba615e061","examples/tag.rs":"881ba5797fe5133c6321927518198c3ad42dd81499b57e9f32df590505b49d17","src/apply.rs":"1ca5b0c06b96cd0af13dc322bf858e375a50f76d887c61052115ea8af2245847","src/attr.rs":"bc1957f495cf3aed4a663b50b43dd8deee6770ab259283673a883ac3c66908a7","src/blame.rs":"538944e8264a1dfea2868247a1f3b44817df583131370bb6785caeafd3fdf1da","src/blob.rs":"7cb0326521dec9548a05c155283495c33f629678d9f7263e9de500c32052fb74","src/branch.rs":"1afa850c4c3a22531baddf5636bf55c9122a76b0d010e8392fbf04f1b76067ed","src/buf.rs":"d4d9795afc04eba6eb6a08c5dbcbc8e3e8341adc11701c65198d514f6cdfbac0","src/build.rs":"12ad0e2cc806123b5d23589a48dfa3fec954b0e42a01c030a21de6262aaae1b5","src/call.rs":"e5d3c59df621224c44f8caf8bd71997c33306ba251fbb58f411020377b1bc354","src/cert.rs":"023630970f1428526443afff3349cfde8439d7fdb8010c750fc8224b5362f700","src/cherrypick.rs":"1ce882b6be825243d5551f11e1f48f53acc4aa52c4c5fb5510e69fd077a512bc","src/commit.rs":"9903f1656c695947164f18291a6659726897db782b6b84f0bca14f3e829d3b45","src/config.rs":"2e5dd2b84e62a706b08ece599822744dcdd827e0b872b91401e5b02b8576b8f7","src/cred.rs":"465872992de3fd9fc11137bffed19fe60d75ffbc352809061969a00d1c1d56f5","src/describe.rs":"3adb68b3118bfa18c09f7ca767afa38d76e22130b1cebf20cc3b97c9a198957a","src/diff.rs":"7ceee521dc66471b05e5259f1c9292b37e106dca4fd05bdb46c4988968f903af","src/error.rs":"0db7bd98064fec2ed223a19064cb2da66914899ff099468d9c55fc1145235320","src/index.rs":"b6fb87fecc6e3d59e867d07166583c1d9c190c8ee8c6bd019248767be6acf5ba","src/indexer.rs":"bf9a61849d937fbcf544aabf5bf251659a2ff11171d4817d24ab78881f3c8097","src/lib.rs":"a62979c6ba8c34be44563133c4c195db0633d0b225f4182860aaa8720cb06464","src/mailmap.rs":"a034b1c86c8a8d4362939e2e2c1d0b1b2f5c71bac883b2b1b65b64078c70349e","src/mempack.rs":"8549f984360ac12868018e4f107a60386474c58cfb6c41993cbb0a820bd28908","src/merge.rs":"681f2f1e59cec49a8618a894e22645915e8f8a815a71d4ca7c6ab10fbdaeb919","src/message.rs":"77d42388ff836c6c3b49f8c8da24ca0cf42d8f8631bf8d31e68cdb6299030c38","src/note.rs":"55b286c3736833432d391184136f0fb0928e337990d1558166e2d998dc63f0dd","src/object.rs":"8b66f1c34570b37d204d0b3f626edbdd0baa7eb9734e3e444b72bf3e8fc46a27","src/odb.rs":"4f5f9358fc3456035688b4fd89918376f415ee2940ac451d0a45ca4212082313","src/oid.rs":"dc284f1523b3109e9721165289adcd820733fe72d5807f7739d307c2f88d2006","src/oid_array.rs":"3cac8e5220e01e4cbd32f9898d48ec610e27cf3f0ce4970f63bd7585e0b953fa","src/opts.rs":"76d23adc6ad168db68a2d1a0823ce408d79d4265d56af84198053bc7231aae94","src/packbuilder.rs":"649246626d600f7d023e73ab3e3d4ca691d482d85de11338f3c5cea66f7f84ee","src/panic.rs":"62ef0684379f4cdebf9477e2f63c9f0ecc80fe608de2df32bca13ce0086249d6","src/patch.rs":"740fa2a29148605e3dac16f58fd603b408283cfe148b922fbe6b5a5d62f18db0","src/pathspec.rs":"4687cbfdf26081ba25323e2ba03bfd0f9d56d1e71cc29f0c91d082540171b339","src/proxy_options.rs":"cfa029317ae00a15074d4fd5de5d7c8da982459b915399c1d6010ddbee43ab28","src/rebase.rs":"179fc17e402d902300de8d37a65ceb0c29d6e8f4ba50cc8b7a7d8b09cfe9ef55","src/reference.rs":"a6d7569f381071e7bb97b1dcd3a9f6bea4409475114b0df232fbe4c5e3660fc6","src/reflog.rs":"45e05e0cb5418be7a0f15a2992802391d31806ed459e8c49864db5d67c6aedd7","src/refspec.rs":"5107582963524fe9ff312a280232dba08d25be06fdf8f278c0bbfdbfa7a50402","src/remote.rs":"252d1533144845dcfe6c6f9cad8e8f8414a620ec3793993093ac94db69439f79","src/remote_callbacks.rs":"bb359251e53b2d49786e1793cf2625214aaa12a2c5c09499ff50f8c337418573","src/repo.rs":"297f1f71c705a834d0aaa2d36edac09de2109890ec08dfa61a0099307cb5cf54","src/revert.rs":"b51dd98a9775e80dfd56b2fe13737e15baf64d3ac9c56546b2bbdfd53d1de7f9","src/revspec.rs":"29df0754775603ed1189bbe28f933f5851d50936eda380a57f175ec35496d637","src/revwalk.rs":"abbe43b3e3884cb9d74eee6773dff7d341620b125d004f4d1309da62fa9651fc","src/signature.rs":"89be2b042b7b26e8d2ea4b98136ce289e29ecd24735dca356af1379f58cc05db","src/stash.rs":"c320ed9288731067a9135fdf3e964ac8a85c99587ffa66dd16ee452ead3675d0","src/status.rs":"c3f661659d23300383a3bfef9e68a519b8204f20c50e0e6ef7bfe60e0fe159c1","src/string_array.rs":"7a73a0aac41f5bad1d9329910540b9d7065e86449688035d0f2c0eb6d18a7d7a","src/submodule.rs":"ae56e4adffc5849332ec02f3351f36160bcb0471991d0013bb5f2e20dcdbc69d","src/tag.rs":"96ffa3ddd96349032e5e97323ed8fd7a3054a4f3263db38fda0d501749db3b6b","src/tagforeach.rs":"04ea7ff4072a270c5febaee8133ae93040eb81a139ed987238e0b500e9626c4c","src/test.rs":"74c34ed48ff74bdcf3f92d8d44ba15d2b3bc0960847c6839e7c9d2e9c4518369","src/time.rs":"7fd2bcdda9baf24c6292edd04be6112c83a57e8f9e566d6d219563ad98c12203","src/tracing.rs":"48d37e08040242117ba043448786cff7a81adf6b315a688b4f66a01f2285d6ac","src/transaction.rs":"fcaaae2135ef209593cf5c5ac9693e6cf63cfe2f343df49aa22b572bb19e832f","src/transport.rs":"d81db6973b36532a248b6f5366e89daa35d09e1f2c3474d277db897e250f0073","src/tree.rs":"bec372ad4f9ae5022fc58c90e74e27851bd108d2063f3078a27e21a004b6cc10","src/treebuilder.rs":"337c5898c42ffe72a96c3d3871b49d83d673c2a4e3e7d9fa715fcba59d042187","src/util.rs":"84be65355ca3d4666ed208ef23806ff46699553dfb9c3cfe769726e162b47424","src/version.rs":"bcc26c9dcc5bf872afd0741233f07981df0a4be28faeba9ad52eb437961eb30f","src/worktree.rs":"b2f4910730ee520b48b8311a196702461b13d4c63b2feb5536549a1dfde7261d","tests/add_extensions.rs":"b800abd0f208bfe64fe0c78a3d2934939408916edb87cc35607e659e312f26cc","tests/get_extensions.rs":"22182deb909b46486a88b1a21cc99b64a3c93a321c5524c9c144486c04ccd3e1","tests/global_state.rs":"c75947eca9718277da08722ca9a58d9b4154b36b1aca6453bb198238c17904ce","tests/remove_extensions.rs":"a7940866b4712d330a0e8d854fe98c8de9c6d37d5809a003828b2b4b5ef00bc7"},"package":"d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c"}
\ No newline at end of file
diff --git a/android/vendor/git2-0.14.4/CONTRIBUTING.md b/android/vendor/git2-0.14.4/CONTRIBUTING.md
new file mode 100644
index 0000000..ceb1de4
--- /dev/null
+++ b/android/vendor/git2-0.14.4/CONTRIBUTING.md
@@ -0,0 +1,34 @@
+# Contributing
+
+## Updating libgit2
+
+The following steps can be used to update libgit2:
+
+1. Update the submodule.
+   There are several ways to go about this.
+   One way is to go to the `libgit2-sys/libgit2` directory and run `git fetch origin` to download the latest updates, and then check out a specific tag (such as `git checkout v1.4.1`).
+2. Update all the references to the version:
+    * Update [`libgit2-sys/build.rs`](https://github.com/rust-lang/git2-rs/blob/master/libgit2-sys/build.rs).
+      There is a version probe (search for `cfg.atleast_version`) which should be updated.
+    * Update the version in
+      [`libgit2-sys/Cargo.toml`](https://github.com/rust-lang/git2-rs/blob/master/libgit2-sys/Cargo.toml).
+      Update the metadata portion (the part after the `+`) to match libgit2.
+      Also bump the Cargo version (the part before the `+`), keeping in mind
+      if this will be a SemVer breaking change or not.
+    * Update the dependency version in [`Cargo.toml`](https://github.com/rust-lang/git2-rs/blob/master/Cargo.toml) to match the version in the last step (do not include the `+` metadata).
+      Also update the version of the `git2` crate itself so it will pick up the change to `libgit2-sys` (also keeping in mind if it is a SemVer breaking release).
+    * Update the version in [`README.md`](https://github.com/rust-lang/git2-rs/blob/master/README.md) if needed.
+    * If there was a SemVer-breaking version bump for either library, also update the `html_root_url` attribute in the `lib.rs` of each library.
+3. Run tests.
+   `cargo test -p git2 -p git2-curl` is a good starting point.
+4. Run `systest`.
+   This will validate for any C-level API problems.
+   Unfortunately `systest` does not work on nightly, so you'll need to use stable.
+
+   `cargo +stable run -p systest`
+
+   The changelog at <https://github.com/libgit2/libgit2/blob/main/docs/changelog.md>
+   can be helpful for seeing what has changed.
+   The project has recently started labeling API and ABI breaking changes with labels:
+   <https://github.com/libgit2/libgit2/pulls?q=is%3Apr+label%3A%22api+breaking%22%2C%22abi+breaking%22+is%3Aclosed>
+4. Once you have everything functional, publish a PR with the updates.
diff --git a/android/vendor/git2-0.14.4/Cargo.lock b/android/vendor/git2-0.14.4/Cargo.lock
new file mode 100644
index 0000000..afc0d4b
--- /dev/null
+++ b/android/vendor/git2-0.14.4/Cargo.lock
@@ -0,0 +1,513 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "ansi_term"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "atty"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
+dependencies = [
+ "hermit-abi",
+ "libc",
+ "winapi",
+]
+
+[[package]]
+name = "autocfg"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+
+[[package]]
+name = "bitflags"
+version = "1.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
+
+[[package]]
+name = "cc"
+version = "1.0.73"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
+dependencies = [
+ "jobserver",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clap"
+version = "2.34.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
+dependencies = [
+ "ansi_term",
+ "atty",
+ "bitflags",
+ "strsim",
+ "textwrap",
+ "unicode-width",
+ "vec_map",
+]
+
+[[package]]
+name = "cmake"
+version = "0.1.48"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "fastrand"
+version = "1.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
+dependencies = [
+ "instant",
+]
+
+[[package]]
+name = "form_urlencoded"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
+dependencies = [
+ "matches",
+ "percent-encoding",
+]
+
+[[package]]
+name = "git2"
+version = "0.14.4"
+dependencies = [
+ "bitflags",
+ "libc",
+ "libgit2-sys",
+ "log",
+ "openssl-probe",
+ "openssl-sys",
+ "paste",
+ "structopt",
+ "tempfile",
+ "time",
+ "url",
+]
+
+[[package]]
+name = "heck"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
+dependencies = [
+ "unicode-segmentation",
+]
+
+[[package]]
+name = "hermit-abi"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "idna"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
+dependencies = [
+ "matches",
+ "unicode-bidi",
+ "unicode-normalization",
+]
+
+[[package]]
+name = "instant"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "jobserver"
+version = "0.1.24"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa"
+dependencies = [
+ "libc",
+]
+
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
+[[package]]
+name = "libc"
+version = "0.2.124"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50"
+
+[[package]]
+name = "libgit2-sys"
+version = "0.13.4+1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1"
+dependencies = [
+ "cc",
+ "libc",
+ "libssh2-sys",
+ "libz-sys",
+ "openssl-sys",
+ "pkg-config",
+]
+
+[[package]]
+name = "libssh2-sys"
+version = "0.2.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca"
+dependencies = [
+ "cc",
+ "libc",
+ "libz-sys",
+ "openssl-sys",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "libz-sys"
+version = "1.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6f35facd4a5673cb5a48822be2be1d4236c1c99cb4113cab7061ac720d5bf859"
+dependencies = [
+ "cc",
+ "cmake",
+ "libc",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "log"
+version = "0.4.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
+name = "matches"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
+
+[[package]]
+name = "openssl-probe"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
+
+[[package]]
+name = "openssl-src"
+version = "111.18.0+1.1.1n"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7897a926e1e8d00219127dc020130eca4292e5ca666dd592480d72c3eca2ff6c"
+dependencies = [
+ "cc",
+]
+
+[[package]]
+name = "openssl-sys"
+version = "0.9.72"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb"
+dependencies = [
+ "autocfg",
+ "cc",
+ "libc",
+ "openssl-src",
+ "pkg-config",
+ "vcpkg",
+]
+
+[[package]]
+name = "paste"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc"
+
+[[package]]
+name = "percent-encoding"
+version = "2.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
+
+[[package]]
+name = "pkg-config"
+version = "0.3.25"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
+
+[[package]]
+name = "proc-macro-error"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
+dependencies = [
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro-error-attr"
+version = "1.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "version_check",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1"
+dependencies = [
+ "unicode-xid",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "redox_syscall"
+version = "0.2.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
+dependencies = [
+ "bitflags",
+]
+
+[[package]]
+name = "remove_dir_all"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
+dependencies = [
+ "winapi",
+]
+
+[[package]]
+name = "strsim"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
+
+[[package]]
+name = "structopt"
+version = "0.3.26"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
+dependencies = [
+ "clap",
+ "lazy_static",
+ "structopt-derive",
+]
+
+[[package]]
+name = "structopt-derive"
+version = "0.4.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
+dependencies = [
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "syn"
+version = "1.0.91"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
+]
+
+[[package]]
+name = "tempfile"
+version = "3.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
+dependencies = [
+ "cfg-if",
+ "fastrand",
+ "libc",
+ "redox_syscall",
+ "remove_dir_all",
+ "winapi",
+]
+
+[[package]]
+name = "textwrap"
+version = "0.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
+dependencies = [
+ "unicode-width",
+]
+
+[[package]]
+name = "time"
+version = "0.1.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
+dependencies = [
+ "libc",
+ "wasi",
+ "winapi",
+]
+
+[[package]]
+name = "tinyvec"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
+dependencies = [
+ "tinyvec_macros",
+]
+
+[[package]]
+name = "tinyvec_macros"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
+
+[[package]]
+name = "unicode-bidi"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
+
+[[package]]
+name = "unicode-normalization"
+version = "0.1.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9"
+dependencies = [
+ "tinyvec",
+]
+
+[[package]]
+name = "unicode-segmentation"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
+
+[[package]]
+name = "unicode-width"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
+
+[[package]]
+name = "unicode-xid"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
+
+[[package]]
+name = "url"
+version = "2.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
+dependencies = [
+ "form_urlencoded",
+ "idna",
+ "matches",
+ "percent-encoding",
+]
+
+[[package]]
+name = "vcpkg"
+version = "0.2.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
+
+[[package]]
+name = "vec_map"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
+
+[[package]]
+name = "version_check"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+
+[[package]]
+name = "wasi"
+version = "0.10.0+wasi-snapshot-preview1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
+
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/android/vendor/git2-0.14.4/Cargo.toml b/android/vendor/git2-0.14.4/Cargo.toml
new file mode 100644
index 0000000..6a92670
--- /dev/null
+++ b/android/vendor/git2-0.14.4/Cargo.toml
@@ -0,0 +1,86 @@
+# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
+#
+# When uploading crates to the registry Cargo will automatically
+# "normalize" Cargo.toml files for maximal compatibility
+# with all versions of Cargo and also rewrite `path` dependencies
+# to registry (e.g., crates.io) dependencies.
+#
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
+
+[package]
+edition = "2018"
+name = "git2"
+version = "0.14.4"
+authors = [
+    "Josh Triplett <josh@joshtriplett.org>",
+    "Alex Crichton <alex@alexcrichton.com>",
+]
+description = """
+Bindings to libgit2 for interoperating with git repositories. This library is
+both threadsafe and memory safe and allows both reading and writing git
+repositories.
+"""
+documentation = "https://docs.rs/git2"
+readme = "README.md"
+keywords = ["git"]
+categories = ["api-bindings"]
+license = "MIT OR Apache-2.0"
+repository = "https://github.com/rust-lang/git2-rs"
+
+[dependencies.bitflags]
+version = "1.1.0"
+
+[dependencies.libc]
+version = "0.2"
+
+[dependencies.libgit2-sys]
+version = "0.13.4"
+
+[dependencies.log]
+version = "0.4.8"
+
+[dependencies.url]
+version = "2.0"
+
+[dev-dependencies.paste]
+version = "1"
+
+[dev-dependencies.structopt]
+version = "0.3"
+
+[dev-dependencies.tempfile]
+version = "3.1.0"
+
+[dev-dependencies.time]
+version = "0.1.39"
+
+[features]
+default = [
+    "ssh",
+    "https",
+    "ssh_key_from_memory",
+]
+https = [
+    "libgit2-sys/https",
+    "openssl-sys",
+    "openssl-probe",
+]
+ssh = ["libgit2-sys/ssh"]
+ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"]
+unstable = []
+vendored-libgit2 = ["libgit2-sys/vendored"]
+vendored-openssl = [
+    "openssl-sys/vendored",
+    "libgit2-sys/vendored-openssl",
+]
+zlib-ng-compat = ["libgit2-sys/zlib-ng-compat"]
+
+[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-probe]
+version = "0.1"
+optional = true
+
+[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys]
+version = "0.9.0"
+optional = true
diff --git a/android/vendor/git2-0.14.4/LICENSE-APACHE b/android/vendor/git2-0.14.4/LICENSE-APACHE
new file mode 100644
index 0000000..16fe87b
--- /dev/null
+++ b/android/vendor/git2-0.14.4/LICENSE-APACHE
@@ -0,0 +1,201 @@
+                              Apache License
+                        Version 2.0, January 2004
+                     http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+   "License" shall mean the terms and conditions for use, reproduction,
+   and distribution as defined by Sections 1 through 9 of this document.
+
+   "Licensor" shall mean the copyright owner or entity authorized by
+   the copyright owner that is granting the License.
+
+   "Legal Entity" shall mean the union of the acting entity and all
+   other entities that control, are controlled by, or are under common
+   control with that entity. For the purposes of this definition,
+   "control" means (i) the power, direct or indirect, to cause the
+   direction or management of such entity, whether by contract or
+   otherwise, or (ii) ownership of fifty percent (50%) or more of the
+   outstanding shares, or (iii) beneficial ownership of such entity.
+
+   "You" (or "Your") shall mean an individual or Legal Entity
+   exercising permissions granted by this License.
+
+   "Source" form shall mean the preferred form for making modifications,
+   including but not limited to software source code, documentation
+   source, and configuration files.
+
+   "Object" form shall mean any form resulting from mechanical
+   transformation or translation of a Source form, including but
+   not limited to compiled object code, generated documentation,
+   and conversions to other media types.
+
+   "Work" shall mean the work of authorship, whether in Source or
+   Object form, made available under the License, as indicated by a
+   copyright notice that is included in or attached to the work
+   (an example is provided in the Appendix below).
+
+   "Derivative Works" shall mean any work, whether in Source or Object
+   form, that is based on (or derived from) the Work and for which the
+   editorial revisions, annotations, elaborations, or other modifications
+   represent, as a whole, an original work of authorship. For the purposes
+   of this License, Derivative Works shall not include works that remain
+   separable from, or merely link (or bind by name) to the interfaces of,
+   the Work and Derivative Works thereof.
+
+   "Contribution" shall mean any work of authorship, including
+   the original version of the Work and any modifications or additions
+   to that Work or Derivative Works thereof, that is intentionally
+   submitted to Licensor for inclusion in the Work by the copyright owner
+   or by an individual or Legal Entity authorized to submit on behalf of
+   the copyright owner. For the purposes of this definition, "submitted"
+   means any form of electronic, verbal, or written communication sent
+   to the Licensor or its representatives, including but not limited to
+   communication on electronic mailing lists, source code control systems,
+   and issue tracking systems that are managed by, or on behalf of, the
+   Licensor for the purpose of discussing and improving the Work, but
+   excluding communication that is conspicuously marked or otherwise
+   designated in writing by the copyright owner as "Not a Contribution."
+
+   "Contributor" shall mean Licensor and any individual or Legal Entity
+   on behalf of whom a Contribution has been received by Licensor and
+   subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   copyright license to reproduce, prepare Derivative Works of,
+   publicly display, publicly perform, sublicense, and distribute the
+   Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+   this License, each Contributor hereby grants to You a perpetual,
+   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+   (except as stated in this section) patent license to make, have made,
+   use, offer to sell, sell, import, and otherwise transfer the Work,
+   where such license applies only to those patent claims licensable
+   by such Contributor that are necessarily infringed by their
+   Contribution(s) alone or by combination of their Contribution(s)
+   with the Work to which such Contribution(s) was submitted. If You
+   institute patent litigation against any entity (including a
+   cross-claim or counterclaim in a lawsuit) alleging that the Work
+   or a Contribution incorporated within the Work constitutes direct
+   or contributory patent infringement, then any patent licenses
+   granted to You under this License for that Work shall terminate
+   as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+   Work or Derivative Works thereof in any medium, with or without
+   modifications, and in Source or Object form, provided that You
+   meet the following conditions:
+
+   (a) You must give any other recipients of the Work or
+       Derivative Works a copy of this License; and
+
+   (b) You must cause any modified files to carry prominent notices
+       stating that You changed the files; and
+
+   (c) You must retain, in the Source form of any Derivative Works
+       that You distribute, all copyright, patent, trademark, and
+       attribution notices from the Source form of the Work,
+       excluding those notices that do not pertain to any part of
+       the Derivative Works; and
+
+   (d) If the Work includes a "NOTICE" text file as part of its
+       distribution, then any Derivative Works that You distribute must
+       include a readable copy of the attribution notices contained
+       within such NOTICE file, excluding those notices that do not
+       pertain to any part of the Derivative Works, in at least one
+       of the following places: within a NOTICE text file distributed
+       as part of the Derivative Works; within the Source form or
+       documentation, if provided along with the Derivative Works; or,
+       within a display generated by the Derivative Works, if and
+       wherever such third-party notices normally appear. The contents
+       of the NOTICE file are for informational purposes only and
+       do not modify the License. You may add Your own attribution
+       notices within Derivative Works that You distribute, alongside
+       or as an addendum to the NOTICE text from the Work, provided
+       that such additional attribution notices cannot be construed
+       as modifying the License.
+
+   You may add Your own copyright statement to Your modifications and
+   may provide additional or different license terms and conditions
+   for use, reproduction, or distribution of Your modifications, or
+   for any such Derivative Works as a whole, provided Your use,
+   reproduction, and distribution of the Work otherwise complies with
+   the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+   any Contribution intentionally submitted for inclusion in the Work
+   by You to the Licensor shall be under the terms and conditions of
+   this License, without any additional terms or conditions.
+   Notwithstanding the above, nothing herein shall supersede or modify
+   the terms of any separate license agreement you may have executed
+   with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+   names, trademarks, service marks, or product names of the Licensor,
+   except as required for reasonable and customary use in describing the
+   origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+   agreed to in writing, Licensor provides the Work (and each
+   Contributor provides its Contributions) on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+   implied, including, without limitation, any warranties or conditions
+   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+   PARTICULAR PURPOSE. You are solely responsible for determining the
+   appropriateness of using or redistributing the Work and assume any
+   risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+   whether in tort (including negligence), contract, or otherwise,
+   unless required by applicable law (such as deliberate and grossly
+   negligent acts) or agreed to in writing, shall any Contributor be
+   liable to You for damages, including any direct, indirect, special,
+   incidental, or consequential damages of any character arising as a
+   result of this License or out of the use or inability to use the
+   Work (including but not limited to damages for loss of goodwill,
+   work stoppage, computer failure or malfunction, or any and all
+   other commercial damages or losses), even if such Contributor
+   has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+   the Work or Derivative Works thereof, You may choose to offer,
+   and charge a fee for, acceptance of support, warranty, indemnity,
+   or other liability obligations and/or rights consistent with this
+   License. However, in accepting such obligations, You may act only
+   on Your own behalf and on Your sole responsibility, not on behalf
+   of any other Contributor, and only if You agree to indemnify,
+   defend, and hold each Contributor harmless for any liability
+   incurred by, or claims asserted against, such Contributor by reason
+   of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+   To apply the Apache License to your work, attach the following
+   boilerplate notice, with the fields enclosed by brackets "[]"
+   replaced with your own identifying information. (Don't include
+   the brackets!)  The text should be enclosed in the appropriate
+   comment syntax for the file format. We also recommend that a
+   file or class name and description of purpose be included on the
+   same "printed page" as the copyright notice for easier
+   identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+	http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/android/vendor/git2-0.14.4/LICENSE-MIT b/android/vendor/git2-0.14.4/LICENSE-MIT
new file mode 100644
index 0000000..39e0ed6
--- /dev/null
+++ b/android/vendor/git2-0.14.4/LICENSE-MIT
@@ -0,0 +1,25 @@
+Copyright (c) 2014 Alex Crichton
+
+Permission is hereby granted, free of charge, to any
+person obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without
+limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software
+is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice
+shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/android/vendor/git2-0.14.4/README.md b/android/vendor/git2-0.14.4/README.md
new file mode 100644
index 0000000..1168099
--- /dev/null
+++ b/android/vendor/git2-0.14.4/README.md
@@ -0,0 +1,65 @@
+# git2-rs
+
+[Documentation](https://docs.rs/git2)
+
+libgit2 bindings for Rust.
+
+```toml
+[dependencies]
+git2 = "0.14"
+```
+
+## Rust version requirements
+
+git2-rs works with stable Rust, and typically works with the most recent prior
+stable release as well.
+
+## Version of libgit2
+
+Currently this library requires libgit2 1.4. The source for libgit2 is
+included in the libgit2-sys crate so there's no need to pre-install the libgit2
+library, the libgit2-sys crate will figure that and/or build that for you.
+
+## Building git2-rs
+
+```sh
+$ git clone https://github.com/rust-lang/git2-rs
+$ cd git2-rs
+$ cargo build
+```
+
+### Automating Testing
+
+Running tests and handling all of the associated edge cases on every commit
+proves tedious very quickly.  To automate tests and handle proper stashing and
+unstashing of unstaged changes and thus avoid nasty surprises, use the
+pre-commit hook found [here][pre-commit-hook] and place it into the
+`.git/hooks/` with the name `pre-commit`.  You may need to add execution
+permissions with `chmod +x`.
+
+To skip tests on a simple commit or doc-fixes, use `git commit --no-verify`.
+
+## Building on macOS 10.10+
+
+If the `ssh` feature is enabled (and it is by default) then this library depends
+on libssh2 which depends on OpenSSL. To get OpenSSL working follow the
+[`openssl` crate's instructions](https://github.com/sfackler/rust-openssl/blob/master/openssl/src/lib.rs#L31).
+
+# License
+
+This project is licensed under either of
+
+ * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
+   https://www.apache.org/licenses/LICENSE-2.0)
+ * MIT license ([LICENSE-MIT](LICENSE-MIT) or
+   https://opensource.org/licenses/MIT)
+
+at your option.
+
+### Contribution
+
+Unless you explicitly state otherwise, any contribution intentionally submitted
+for inclusion in git2-rs by you, as defined in the Apache-2.0 license, shall be
+dual licensed as above, without any additional terms or conditions.
+
+[pre-commit-hook]: https://gist.github.com/glfmn/0c5e9e2b41b48007ed3497d11e3dbbfa
diff --git a/android/vendor/git2-0.14.4/examples/add.rs b/android/vendor/git2-0.14.4/examples/add.rs
new file mode 100644
index 0000000..25e972c
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/add.rs
@@ -0,0 +1,81 @@
+/*
+ * libgit2 "add" example - shows how to modify the index
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+#![allow(trivial_casts)]
+
+use git2::Repository;
+use std::path::Path;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "spec")]
+    arg_spec: Vec<String>,
+    #[structopt(name = "dry_run", short = "n", long)]
+    /// dry run
+    flag_dry_run: bool,
+    #[structopt(name = "verbose", short, long)]
+    /// be verbose
+    flag_verbose: bool,
+    #[structopt(name = "update", short, long)]
+    /// update tracked files
+    flag_update: bool,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let repo = Repository::open(&Path::new("."))?;
+    let mut index = repo.index()?;
+
+    let cb = &mut |path: &Path, _matched_spec: &[u8]| -> i32 {
+        let status = repo.status_file(path).unwrap();
+
+        let ret = if status.contains(git2::Status::WT_MODIFIED)
+            || status.contains(git2::Status::WT_NEW)
+        {
+            println!("add '{}'", path.display());
+            0
+        } else {
+            1
+        };
+
+        if args.flag_dry_run {
+            1
+        } else {
+            ret
+        }
+    };
+    let cb = if args.flag_verbose || args.flag_update {
+        Some(cb as &mut git2::IndexMatchedPath)
+    } else {
+        None
+    };
+
+    if args.flag_update {
+        index.update_all(args.arg_spec.iter(), cb)?;
+    } else {
+        index.add_all(args.arg_spec.iter(), git2::IndexAddOption::DEFAULT, cb)?;
+    }
+
+    index.write()?;
+    Ok(())
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/blame.rs b/android/vendor/git2-0.14.4/examples/blame.rs
new file mode 100644
index 0000000..7cb1b69
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/blame.rs
@@ -0,0 +1,104 @@
+/*
+ * libgit2 "blame" example - shows how to use the blame API
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{BlameOptions, Repository};
+use std::io::{BufRead, BufReader};
+use std::path::Path;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+#[allow(non_snake_case)]
+struct Args {
+    #[structopt(name = "path")]
+    arg_path: String,
+    #[structopt(name = "spec")]
+    arg_spec: Option<String>,
+    #[structopt(short = "M")]
+    /// find line moves within and across files
+    flag_M: bool,
+    #[structopt(short = "C")]
+    /// find line copies within and across files
+    flag_C: bool,
+    #[structopt(short = "F")]
+    /// follow only the first parent commits
+    flag_F: bool,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let repo = Repository::open(".")?;
+    let path = Path::new(&args.arg_path[..]);
+
+    // Prepare our blame options
+    let mut opts = BlameOptions::new();
+    opts.track_copies_same_commit_moves(args.flag_M)
+        .track_copies_same_commit_copies(args.flag_C)
+        .first_parent(args.flag_F);
+
+    let mut commit_id = "HEAD".to_string();
+
+    // Parse spec
+    if let Some(spec) = args.arg_spec.as_ref() {
+        let revspec = repo.revparse(spec)?;
+
+        let (oldest, newest) = if revspec.mode().contains(git2::RevparseMode::SINGLE) {
+            (None, revspec.from())
+        } else if revspec.mode().contains(git2::RevparseMode::RANGE) {
+            (revspec.from(), revspec.to())
+        } else {
+            (None, None)
+        };
+
+        if let Some(commit) = oldest {
+            opts.oldest_commit(commit.id());
+        }
+
+        if let Some(commit) = newest {
+            opts.newest_commit(commit.id());
+            if !commit.id().is_zero() {
+                commit_id = format!("{}", commit.id())
+            }
+        }
+    }
+
+    let spec = format!("{}:{}", commit_id, path.display());
+    let blame = repo.blame_file(path, Some(&mut opts))?;
+    let object = repo.revparse_single(&spec[..])?;
+    let blob = repo.find_blob(object.id())?;
+    let reader = BufReader::new(blob.content());
+
+    for (i, line) in reader.lines().enumerate() {
+        if let (Ok(line), Some(hunk)) = (line, blame.get_line(i + 1)) {
+            let sig = hunk.final_signature();
+            println!(
+                "{} {} <{}> {}",
+                hunk.final_commit_id(),
+                String::from_utf8_lossy(sig.name_bytes()),
+                String::from_utf8_lossy(sig.email_bytes()),
+                line
+            );
+        }
+    }
+
+    Ok(())
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/cat-file.rs b/android/vendor/git2-0.14.4/examples/cat-file.rs
new file mode 100644
index 0000000..0ce21b3
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/cat-file.rs
@@ -0,0 +1,149 @@
+/*
+ * libgit2 "cat-file" example - shows how to print data from the ODB
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use std::io::{self, Write};
+
+use git2::{Blob, Commit, ObjectType, Repository, Signature, Tag, Tree};
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "object")]
+    arg_object: String,
+    #[structopt(short = "t")]
+    /// show the object type
+    flag_t: bool,
+    #[structopt(short = "s")]
+    /// show the object size
+    flag_s: bool,
+    #[structopt(short = "e")]
+    /// suppress all output
+    flag_e: bool,
+    #[structopt(short = "p")]
+    /// pretty print the contents of the object
+    flag_p: bool,
+    #[structopt(name = "quiet", short, long)]
+    /// suppress output
+    flag_q: bool,
+    #[structopt(name = "verbose", short, long)]
+    flag_v: bool,
+    #[structopt(name = "dir", long = "git-dir")]
+    /// use the specified directory as the base directory
+    flag_git_dir: Option<String>,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let path = args.flag_git_dir.as_ref().map(|s| &s[..]).unwrap_or(".");
+    let repo = Repository::open(path)?;
+
+    let obj = repo.revparse_single(&args.arg_object)?;
+    if args.flag_v && !args.flag_q {
+        println!("{} {}\n--", obj.kind().unwrap().str(), obj.id());
+    }
+
+    if args.flag_t {
+        println!("{}", obj.kind().unwrap().str());
+    } else if args.flag_s || args.flag_e {
+        /* ... */
+    } else if args.flag_p {
+        match obj.kind() {
+            Some(ObjectType::Blob) => {
+                show_blob(obj.as_blob().unwrap());
+            }
+            Some(ObjectType::Commit) => {
+                show_commit(obj.as_commit().unwrap());
+            }
+            Some(ObjectType::Tag) => {
+                show_tag(obj.as_tag().unwrap());
+            }
+            Some(ObjectType::Tree) => {
+                show_tree(obj.as_tree().unwrap());
+            }
+            Some(ObjectType::Any) | None => println!("unknown {}", obj.id()),
+        }
+    }
+    Ok(())
+}
+
+fn show_blob(blob: &Blob) {
+    io::stdout().write_all(blob.content()).unwrap();
+}
+
+fn show_commit(commit: &Commit) {
+    println!("tree {}", commit.tree_id());
+    for parent in commit.parent_ids() {
+        println!("parent {}", parent);
+    }
+    show_sig("author", Some(commit.author()));
+    show_sig("committer", Some(commit.committer()));
+    if let Some(msg) = commit.message() {
+        println!("\n{}", msg);
+    }
+}
+
+fn show_tag(tag: &Tag) {
+    println!("object {}", tag.target_id());
+    println!("type {}", tag.target_type().unwrap().str());
+    println!("tag {}", tag.name().unwrap());
+    show_sig("tagger", tag.tagger());
+
+    if let Some(msg) = tag.message() {
+        println!("\n{}", msg);
+    }
+}
+
+fn show_tree(tree: &Tree) {
+    for entry in tree.iter() {
+        println!(
+            "{:06o} {} {}\t{}",
+            entry.filemode(),
+            entry.kind().unwrap().str(),
+            entry.id(),
+            entry.name().unwrap()
+        );
+    }
+}
+
+fn show_sig(header: &str, sig: Option<Signature>) {
+    let sig = match sig {
+        Some(s) => s,
+        None => return,
+    };
+    let offset = sig.when().offset_minutes();
+    let (sign, offset) = if offset < 0 {
+        ('-', -offset)
+    } else {
+        ('+', offset)
+    };
+    let (hours, minutes) = (offset / 60, offset % 60);
+    println!(
+        "{} {} {} {}{:02}{:02}",
+        header,
+        sig,
+        sig.when().seconds(),
+        sign,
+        hours,
+        minutes
+    );
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/clone.rs b/android/vendor/git2-0.14.4/examples/clone.rs
new file mode 100644
index 0000000..5af7322
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/clone.rs
@@ -0,0 +1,126 @@
+/*
+ * libgit2 "clone" example
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::build::{CheckoutBuilder, RepoBuilder};
+use git2::{FetchOptions, Progress, RemoteCallbacks};
+use std::cell::RefCell;
+use std::io::{self, Write};
+use std::path::{Path, PathBuf};
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "url")]
+    arg_url: String,
+    #[structopt(name = "path")]
+    arg_path: String,
+}
+
+struct State {
+    progress: Option<Progress<'static>>,
+    total: usize,
+    current: usize,
+    path: Option<PathBuf>,
+    newline: bool,
+}
+
+fn print(state: &mut State) {
+    let stats = state.progress.as_ref().unwrap();
+    let network_pct = (100 * stats.received_objects()) / stats.total_objects();
+    let index_pct = (100 * stats.indexed_objects()) / stats.total_objects();
+    let co_pct = if state.total > 0 {
+        (100 * state.current) / state.total
+    } else {
+        0
+    };
+    let kbytes = stats.received_bytes() / 1024;
+    if stats.received_objects() == stats.total_objects() {
+        if !state.newline {
+            println!();
+            state.newline = true;
+        }
+        print!(
+            "Resolving deltas {}/{}\r",
+            stats.indexed_deltas(),
+            stats.total_deltas()
+        );
+    } else {
+        print!(
+            "net {:3}% ({:4} kb, {:5}/{:5})  /  idx {:3}% ({:5}/{:5})  \
+             /  chk {:3}% ({:4}/{:4}) {}\r",
+            network_pct,
+            kbytes,
+            stats.received_objects(),
+            stats.total_objects(),
+            index_pct,
+            stats.indexed_objects(),
+            stats.total_objects(),
+            co_pct,
+            state.current,
+            state.total,
+            state
+                .path
+                .as_ref()
+                .map(|s| s.to_string_lossy().into_owned())
+                .unwrap_or_default()
+        )
+    }
+    io::stdout().flush().unwrap();
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let state = RefCell::new(State {
+        progress: None,
+        total: 0,
+        current: 0,
+        path: None,
+        newline: false,
+    });
+    let mut cb = RemoteCallbacks::new();
+    cb.transfer_progress(|stats| {
+        let mut state = state.borrow_mut();
+        state.progress = Some(stats.to_owned());
+        print(&mut *state);
+        true
+    });
+
+    let mut co = CheckoutBuilder::new();
+    co.progress(|path, cur, total| {
+        let mut state = state.borrow_mut();
+        state.path = path.map(|p| p.to_path_buf());
+        state.current = cur;
+        state.total = total;
+        print(&mut *state);
+    });
+
+    let mut fo = FetchOptions::new();
+    fo.remote_callbacks(cb);
+    RepoBuilder::new()
+        .fetch_options(fo)
+        .with_checkout(co)
+        .clone(&args.arg_url, Path::new(&args.arg_path))?;
+    println!();
+
+    Ok(())
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/diff.rs b/android/vendor/git2-0.14.4/examples/diff.rs
new file mode 100644
index 0000000..c3026ed
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/diff.rs
@@ -0,0 +1,368 @@
+/*
+ * libgit2 "diff" example - shows how to use the diff API
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Blob, Diff, DiffOptions, Error, Object, ObjectType, Oid, Repository};
+use git2::{DiffDelta, DiffFindOptions, DiffFormat, DiffHunk, DiffLine};
+use std::str;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+#[allow(non_snake_case)]
+struct Args {
+    #[structopt(name = "from_oid")]
+    arg_from_oid: Option<String>,
+    #[structopt(name = "to_oid")]
+    arg_to_oid: Option<String>,
+    #[structopt(name = "blobs", long)]
+    /// treat from_oid and to_oid as blob ids
+    flag_blobs: bool,
+    #[structopt(name = "patch", short, long)]
+    /// show output in patch format
+    flag_patch: bool,
+    #[structopt(name = "cached", long)]
+    /// use staged changes as diff
+    flag_cached: bool,
+    #[structopt(name = "nocached", long)]
+    /// do not use staged changes
+    flag_nocached: bool,
+    #[structopt(name = "name-only", long)]
+    /// show only names of changed files
+    flag_name_only: bool,
+    #[structopt(name = "name-status", long)]
+    /// show only names and status changes
+    flag_name_status: bool,
+    #[structopt(name = "raw", long)]
+    /// generate the raw format
+    flag_raw: bool,
+    #[structopt(name = "format", long)]
+    /// specify format for stat summary
+    flag_format: Option<String>,
+    #[structopt(name = "color", long)]
+    /// use color output
+    flag_color: bool,
+    #[structopt(name = "no-color", long)]
+    /// never use color output
+    flag_no_color: bool,
+    #[structopt(short = "R")]
+    /// swap two inputs
+    flag_R: bool,
+    #[structopt(name = "text", short = "a", long)]
+    /// treat all files as text
+    flag_text: bool,
+    #[structopt(name = "ignore-space-at-eol", long)]
+    /// ignore changes in whitespace at EOL
+    flag_ignore_space_at_eol: bool,
+    #[structopt(name = "ignore-space-change", short = "b", long)]
+    /// ignore changes in amount of whitespace
+    flag_ignore_space_change: bool,
+    #[structopt(name = "ignore-all-space", short = "w", long)]
+    /// ignore whitespace when comparing lines
+    flag_ignore_all_space: bool,
+    #[structopt(name = "ignored", long)]
+    /// show untracked files
+    flag_ignored: bool,
+    #[structopt(name = "untracked", long)]
+    /// generate diff using the patience algorithm
+    flag_untracked: bool,
+    #[structopt(name = "patience", long)]
+    /// show ignored files as well
+    flag_patience: bool,
+    #[structopt(name = "minimal", long)]
+    /// spend extra time to find smallest diff
+    flag_minimal: bool,
+    #[structopt(name = "stat", long)]
+    /// generate a diffstat
+    flag_stat: bool,
+    #[structopt(name = "numstat", long)]
+    /// similar to --stat, but more machine friendly
+    flag_numstat: bool,
+    #[structopt(name = "shortstat", long)]
+    /// only output last line of --stat
+    flag_shortstat: bool,
+    #[structopt(name = "summary", long)]
+    /// output condensed summary of header info
+    flag_summary: bool,
+    #[structopt(name = "find-renames", short = "M", long)]
+    /// set threshold for findind renames (default 50)
+    flag_find_renames: Option<u16>,
+    #[structopt(name = "find-copies", short = "C", long)]
+    /// set threshold for finding copies (default 50)
+    flag_find_copies: Option<u16>,
+    #[structopt(name = "find-copies-harder", long)]
+    /// inspect unmodified files for sources of copies
+    flag_find_copies_harder: bool,
+    #[structopt(name = "break_rewrites", short = "B", long)]
+    /// break complete rewrite changes into pairs
+    flag_break_rewrites: bool,
+    #[structopt(name = "unified", short = "U", long)]
+    /// lints of context to show
+    flag_unified: Option<u32>,
+    #[structopt(name = "inter-hunk-context", long)]
+    /// maximum lines of change between hunks
+    flag_inter_hunk_context: Option<u32>,
+    #[structopt(name = "abbrev", long)]
+    /// length to abbreviate commits to
+    flag_abbrev: Option<u16>,
+    #[structopt(name = "src-prefix", long)]
+    /// show given source prefix instead of 'a/'
+    flag_src_prefix: Option<String>,
+    #[structopt(name = "dst-prefix", long)]
+    /// show given destinction prefix instead of 'b/'
+    flag_dst_prefix: Option<String>,
+    #[structopt(name = "path", long = "git-dir")]
+    /// path to git repository to use
+    flag_git_dir: Option<String>,
+}
+
+const RESET: &str = "\u{1b}[m";
+const BOLD: &str = "\u{1b}[1m";
+const RED: &str = "\u{1b}[31m";
+const GREEN: &str = "\u{1b}[32m";
+const CYAN: &str = "\u{1b}[36m";
+
+#[derive(PartialEq, Eq, Copy, Clone)]
+enum Cache {
+    Normal,
+    Only,
+    None,
+}
+
+fn line_color(line: &DiffLine) -> Option<&'static str> {
+    match line.origin() {
+        '+' => Some(GREEN),
+        '-' => Some(RED),
+        '>' => Some(GREEN),
+        '<' => Some(RED),
+        'F' => Some(BOLD),
+        'H' => Some(CYAN),
+        _ => None,
+    }
+}
+
+fn print_diff_line(
+    _delta: DiffDelta,
+    _hunk: Option<DiffHunk>,
+    line: DiffLine,
+    args: &Args,
+) -> bool {
+    if args.color() {
+        print!("{}", RESET);
+        if let Some(color) = line_color(&line) {
+            print!("{}", color);
+        }
+    }
+    match line.origin() {
+        '+' | '-' | ' ' => print!("{}", line.origin()),
+        _ => {}
+    }
+    print!("{}", str::from_utf8(line.content()).unwrap());
+    true
+}
+
+fn run(args: &Args) -> Result<(), Error> {
+    let path = args.flag_git_dir.as_ref().map(|s| &s[..]).unwrap_or(".");
+    let repo = Repository::open(path)?;
+
+    // Prepare our diff options based on the arguments given
+    let mut opts = DiffOptions::new();
+    opts.reverse(args.flag_R)
+        .force_text(args.flag_text)
+        .ignore_whitespace_eol(args.flag_ignore_space_at_eol)
+        .ignore_whitespace_change(args.flag_ignore_space_change)
+        .ignore_whitespace(args.flag_ignore_all_space)
+        .include_ignored(args.flag_ignored)
+        .include_untracked(args.flag_untracked)
+        .patience(args.flag_patience)
+        .minimal(args.flag_minimal);
+    if let Some(amt) = args.flag_unified {
+        opts.context_lines(amt);
+    }
+    if let Some(amt) = args.flag_inter_hunk_context {
+        opts.interhunk_lines(amt);
+    }
+    if let Some(amt) = args.flag_abbrev {
+        opts.id_abbrev(amt);
+    }
+    if let Some(ref s) = args.flag_src_prefix {
+        opts.old_prefix(&s);
+    }
+    if let Some(ref s) = args.flag_dst_prefix {
+        opts.new_prefix(&s);
+    }
+    if let Some("diff-index") = args.flag_format.as_ref().map(|s| &s[..]) {
+        opts.id_abbrev(40);
+    }
+
+    if args.flag_blobs {
+        let b1 = resolve_blob(&repo, args.arg_from_oid.as_ref())?;
+        let b2 = resolve_blob(&repo, args.arg_to_oid.as_ref())?;
+        repo.diff_blobs(
+            b1.as_ref(),
+            None,
+            b2.as_ref(),
+            None,
+            Some(&mut opts),
+            None,
+            None,
+            None,
+            Some(&mut |d, h, l| print_diff_line(d, h, l, args)),
+        )?;
+        if args.color() {
+            print!("{}", RESET);
+        }
+        return Ok(());
+    }
+
+    // Prepare the diff to inspect
+    let t1 = tree_to_treeish(&repo, args.arg_from_oid.as_ref())?;
+    let t2 = tree_to_treeish(&repo, args.arg_to_oid.as_ref())?;
+    let head = tree_to_treeish(&repo, Some(&"HEAD".to_string()))?.unwrap();
+    let mut diff = match (t1, t2, args.cache()) {
+        (Some(t1), Some(t2), _) => {
+            repo.diff_tree_to_tree(t1.as_tree(), t2.as_tree(), Some(&mut opts))?
+        }
+        (t1, None, Cache::None) => {
+            let t1 = t1.unwrap_or(head);
+            repo.diff_tree_to_workdir(t1.as_tree(), Some(&mut opts))?
+        }
+        (t1, None, Cache::Only) => {
+            let t1 = t1.unwrap_or(head);
+            repo.diff_tree_to_index(t1.as_tree(), None, Some(&mut opts))?
+        }
+        (Some(t1), None, _) => {
+            repo.diff_tree_to_workdir_with_index(t1.as_tree(), Some(&mut opts))?
+        }
+        (None, None, _) => repo.diff_index_to_workdir(None, Some(&mut opts))?,
+        (None, Some(_), _) => unreachable!(),
+    };
+
+    // Apply rename and copy detection if requested
+    if args.flag_break_rewrites
+        || args.flag_find_copies_harder
+        || args.flag_find_renames.is_some()
+        || args.flag_find_copies.is_some()
+    {
+        let mut opts = DiffFindOptions::new();
+        if let Some(t) = args.flag_find_renames {
+            opts.rename_threshold(t);
+            opts.renames(true);
+        }
+        if let Some(t) = args.flag_find_copies {
+            opts.copy_threshold(t);
+            opts.copies(true);
+        }
+        opts.copies_from_unmodified(args.flag_find_copies_harder)
+            .rewrites(args.flag_break_rewrites);
+        diff.find_similar(Some(&mut opts))?;
+    }
+
+    // Generate simple output
+    let stats = args.flag_stat | args.flag_numstat | args.flag_shortstat | args.flag_summary;
+    if stats {
+        print_stats(&diff, args)?;
+    }
+    if args.flag_patch || !stats {
+        diff.print(args.diff_format(), |d, h, l| print_diff_line(d, h, l, args))?;
+        if args.color() {
+            print!("{}", RESET);
+        }
+    }
+
+    Ok(())
+}
+
+fn print_stats(diff: &Diff, args: &Args) -> Result<(), Error> {
+    let stats = diff.stats()?;
+    let mut format = git2::DiffStatsFormat::NONE;
+    if args.flag_stat {
+        format |= git2::DiffStatsFormat::FULL;
+    }
+    if args.flag_shortstat {
+        format |= git2::DiffStatsFormat::SHORT;
+    }
+    if args.flag_numstat {
+        format |= git2::DiffStatsFormat::NUMBER;
+    }
+    if args.flag_summary {
+        format |= git2::DiffStatsFormat::INCLUDE_SUMMARY;
+    }
+    let buf = stats.to_buf(format, 80)?;
+    print!("{}", str::from_utf8(&*buf).unwrap());
+    Ok(())
+}
+
+fn tree_to_treeish<'a>(
+    repo: &'a Repository,
+    arg: Option<&String>,
+) -> Result<Option<Object<'a>>, Error> {
+    let arg = match arg {
+        Some(s) => s,
+        None => return Ok(None),
+    };
+    let obj = repo.revparse_single(arg)?;
+    let tree = obj.peel(ObjectType::Tree)?;
+    Ok(Some(tree))
+}
+
+fn resolve_blob<'a>(repo: &'a Repository, arg: Option<&String>) -> Result<Option<Blob<'a>>, Error> {
+    let arg = match arg {
+        Some(s) => Oid::from_str(s)?,
+        None => return Ok(None),
+    };
+    repo.find_blob(arg).map(|b| Some(b))
+}
+
+impl Args {
+    fn cache(&self) -> Cache {
+        if self.flag_cached {
+            Cache::Only
+        } else if self.flag_nocached {
+            Cache::None
+        } else {
+            Cache::Normal
+        }
+    }
+    fn color(&self) -> bool {
+        self.flag_color && !self.flag_no_color
+    }
+    fn diff_format(&self) -> DiffFormat {
+        if self.flag_patch {
+            DiffFormat::Patch
+        } else if self.flag_name_only {
+            DiffFormat::NameOnly
+        } else if self.flag_name_status {
+            DiffFormat::NameStatus
+        } else if self.flag_raw {
+            DiffFormat::Raw
+        } else {
+            match self.flag_format.as_ref().map(|s| &s[..]) {
+                Some("name") => DiffFormat::NameOnly,
+                Some("name-status") => DiffFormat::NameStatus,
+                Some("raw") => DiffFormat::Raw,
+                Some("diff-index") => DiffFormat::Raw,
+                _ => DiffFormat::Patch,
+            }
+        }
+    }
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/fetch.rs b/android/vendor/git2-0.14.4/examples/fetch.rs
new file mode 100644
index 0000000..64374a6
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/fetch.rs
@@ -0,0 +1,127 @@
+/*
+ * libgit2 "fetch" example - shows how to fetch remote data
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{AutotagOption, FetchOptions, RemoteCallbacks, Repository};
+use std::io::{self, Write};
+use std::str;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "remote")]
+    arg_remote: Option<String>,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let repo = Repository::open(".")?;
+    let remote = args.arg_remote.as_ref().map(|s| &s[..]).unwrap_or("origin");
+
+    // Figure out whether it's a named remote or a URL
+    println!("Fetching {} for repo", remote);
+    let mut cb = RemoteCallbacks::new();
+    let mut remote = repo
+        .find_remote(remote)
+        .or_else(|_| repo.remote_anonymous(remote))?;
+    cb.sideband_progress(|data| {
+        print!("remote: {}", str::from_utf8(data).unwrap());
+        io::stdout().flush().unwrap();
+        true
+    });
+
+    // This callback gets called for each remote-tracking branch that gets
+    // updated. The message we output depends on whether it's a new one or an
+    // update.
+    cb.update_tips(|refname, a, b| {
+        if a.is_zero() {
+            println!("[new]     {:20} {}", b, refname);
+        } else {
+            println!("[updated] {:10}..{:10} {}", a, b, refname);
+        }
+        true
+    });
+
+    // Here we show processed and total objects in the pack and the amount of
+    // received data. Most frontends will probably want to show a percentage and
+    // the download rate.
+    cb.transfer_progress(|stats| {
+        if stats.received_objects() == stats.total_objects() {
+            print!(
+                "Resolving deltas {}/{}\r",
+                stats.indexed_deltas(),
+                stats.total_deltas()
+            );
+        } else if stats.total_objects() > 0 {
+            print!(
+                "Received {}/{} objects ({}) in {} bytes\r",
+                stats.received_objects(),
+                stats.total_objects(),
+                stats.indexed_objects(),
+                stats.received_bytes()
+            );
+        }
+        io::stdout().flush().unwrap();
+        true
+    });
+
+    // Download the packfile and index it. This function updates the amount of
+    // received data and the indexer stats which lets you inform the user about
+    // progress.
+    let mut fo = FetchOptions::new();
+    fo.remote_callbacks(cb);
+    remote.download(&[] as &[&str], Some(&mut fo))?;
+
+    {
+        // If there are local objects (we got a thin pack), then tell the user
+        // how many objects we saved from having to cross the network.
+        let stats = remote.stats();
+        if stats.local_objects() > 0 {
+            println!(
+                "\rReceived {}/{} objects in {} bytes (used {} local \
+                 objects)",
+                stats.indexed_objects(),
+                stats.total_objects(),
+                stats.received_bytes(),
+                stats.local_objects()
+            );
+        } else {
+            println!(
+                "\rReceived {}/{} objects in {} bytes",
+                stats.indexed_objects(),
+                stats.total_objects(),
+                stats.received_bytes()
+            );
+        }
+    }
+
+    // Disconnect the underlying connection to prevent from idling.
+    remote.disconnect()?;
+
+    // Update the references in the remote's namespace to point to the right
+    // commits. This may be needed even if there was no packfile to download,
+    // which can happen e.g. when the branches have been changed but all the
+    // needed objects are available locally.
+    remote.update_tips(None, true, AutotagOption::Unspecified, None)?;
+
+    Ok(())
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/init.rs b/android/vendor/git2-0.14.4/examples/init.rs
new file mode 100644
index 0000000..3e447cb
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/init.rs
@@ -0,0 +1,145 @@
+/*
+ * libgit2 "init" example - shows how to initialize a new repo
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Error, Repository, RepositoryInitMode, RepositoryInitOptions};
+use std::path::{Path, PathBuf};
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "directory")]
+    arg_directory: String,
+    #[structopt(name = "quiet", short, long)]
+    /// don't print information to stdout
+    flag_quiet: bool,
+    #[structopt(name = "bare", long)]
+    /// initialize a new bare repository
+    flag_bare: bool,
+    #[structopt(name = "dir", long = "template")]
+    /// use <dir> as an initialization template
+    flag_template: Option<String>,
+    #[structopt(name = "separate-git-dir", long)]
+    /// use <dir> as the .git directory
+    flag_separate_git_dir: Option<String>,
+    #[structopt(name = "initial-commit", long)]
+    /// create an initial empty commit
+    flag_initial_commit: bool,
+    #[structopt(name = "perms", long = "shared")]
+    /// permissions to create the repository with
+    flag_shared: Option<String>,
+}
+
+fn run(args: &Args) -> Result<(), Error> {
+    let mut path = PathBuf::from(&args.arg_directory);
+    let repo = if !args.flag_bare
+        && args.flag_template.is_none()
+        && args.flag_shared.is_none()
+        && args.flag_separate_git_dir.is_none()
+    {
+        Repository::init(&path)?
+    } else {
+        let mut opts = RepositoryInitOptions::new();
+        opts.bare(args.flag_bare);
+        if let Some(ref s) = args.flag_template {
+            opts.template_path(Path::new(s));
+        }
+
+        // If you specified a separate git directory, then initialize
+        // the repository at that path and use the second path as the
+        // working directory of the repository (with a git-link file)
+        if let Some(ref s) = args.flag_separate_git_dir {
+            opts.workdir_path(&path);
+            path = PathBuf::from(s);
+        }
+
+        if let Some(ref s) = args.flag_shared {
+            opts.mode(parse_shared(s)?);
+        }
+        Repository::init_opts(&path, &opts)?
+    };
+
+    // Print a message to stdout like "git init" does
+    if !args.flag_quiet {
+        if args.flag_bare || args.flag_separate_git_dir.is_some() {
+            path = repo.path().to_path_buf();
+        } else {
+            path = repo.workdir().unwrap().to_path_buf();
+        }
+        println!("Initialized empty Git repository in {}", path.display());
+    }
+
+    if args.flag_initial_commit {
+        create_initial_commit(&repo)?;
+        println!("Created empty initial commit");
+    }
+
+    Ok(())
+}
+
+/// Unlike regular "git init", this example shows how to create an initial empty
+/// commit in the repository. This is the helper function that does that.
+fn create_initial_commit(repo: &Repository) -> Result<(), Error> {
+    // First use the config to initialize a commit signature for the user.
+    let sig = repo.signature()?;
+
+    // Now let's create an empty tree for this commit
+    let tree_id = {
+        let mut index = repo.index()?;
+
+        // Outside of this example, you could call index.add_path()
+        // here to put actual files into the index. For our purposes, we'll
+        // leave it empty for now.
+
+        index.write_tree()?
+    };
+
+    let tree = repo.find_tree(tree_id)?;
+
+    // Ready to create the initial commit.
+    //
+    // Normally creating a commit would involve looking up the current HEAD
+    // commit and making that be the parent of the initial commit, but here this
+    // is the first commit so there will be no parent.
+    repo.commit(Some("HEAD"), &sig, &sig, "Initial commit", &tree, &[])?;
+
+    Ok(())
+}
+
+fn parse_shared(shared: &str) -> Result<RepositoryInitMode, Error> {
+    match shared {
+        "false" | "umask" => Ok(git2::RepositoryInitMode::SHARED_UMASK),
+        "true" | "group" => Ok(git2::RepositoryInitMode::SHARED_GROUP),
+        "all" | "world" => Ok(git2::RepositoryInitMode::SHARED_ALL),
+        _ => {
+            if shared.starts_with('0') {
+                match u32::from_str_radix(&shared[1..], 8).ok() {
+                    Some(n) => Ok(RepositoryInitMode::from_bits_truncate(n)),
+                    None => Err(Error::from_str("invalid octal value for --shared")),
+                }
+            } else {
+                Err(Error::from_str("unknown value for --shared"))
+            }
+        }
+    }
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/log.rs b/android/vendor/git2-0.14.4/examples/log.rs
new file mode 100644
index 0000000..ad3bb35
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/log.rs
@@ -0,0 +1,310 @@
+/*
+ * libgit2 "log" example - shows how to walk history and get commit info
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Commit, DiffOptions, ObjectType, Repository, Signature, Time};
+use git2::{DiffFormat, Error, Pathspec};
+use std::str;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "topo-order", long)]
+    /// sort commits in topological order
+    flag_topo_order: bool,
+    #[structopt(name = "date-order", long)]
+    /// sort commits in date order
+    flag_date_order: bool,
+    #[structopt(name = "reverse", long)]
+    /// sort commits in reverse
+    flag_reverse: bool,
+    #[structopt(name = "author", long)]
+    /// author to sort by
+    flag_author: Option<String>,
+    #[structopt(name = "committer", long)]
+    /// committer to sort by
+    flag_committer: Option<String>,
+    #[structopt(name = "pat", long = "grep")]
+    /// pattern to filter commit messages by
+    flag_grep: Option<String>,
+    #[structopt(name = "dir", long = "git-dir")]
+    /// alternative git directory to use
+    flag_git_dir: Option<String>,
+    #[structopt(name = "skip", long)]
+    /// number of commits to skip
+    flag_skip: Option<usize>,
+    #[structopt(name = "max-count", short = "n", long)]
+    /// maximum number of commits to show
+    flag_max_count: Option<usize>,
+    #[structopt(name = "merges", long)]
+    /// only show merge commits
+    flag_merges: bool,
+    #[structopt(name = "no-merges", long)]
+    /// don't show merge commits
+    flag_no_merges: bool,
+    #[structopt(name = "no-min-parents", long)]
+    /// don't require a minimum number of parents
+    flag_no_min_parents: bool,
+    #[structopt(name = "no-max-parents", long)]
+    /// don't require a maximum number of parents
+    flag_no_max_parents: bool,
+    #[structopt(name = "max-parents")]
+    /// specify a maximum number of parents for a commit
+    flag_max_parents: Option<usize>,
+    #[structopt(name = "min-parents")]
+    /// specify a minimum number of parents for a commit
+    flag_min_parents: Option<usize>,
+    #[structopt(name = "patch", long, short)]
+    /// show commit diff
+    flag_patch: bool,
+    #[structopt(name = "commit")]
+    arg_commit: Vec<String>,
+    #[structopt(name = "spec", last = true)]
+    arg_spec: Vec<String>,
+}
+
+fn run(args: &Args) -> Result<(), Error> {
+    let path = args.flag_git_dir.as_ref().map(|s| &s[..]).unwrap_or(".");
+    let repo = Repository::open(path)?;
+    let mut revwalk = repo.revwalk()?;
+
+    // Prepare the revwalk based on CLI parameters
+    let base = if args.flag_reverse {
+        git2::Sort::REVERSE
+    } else {
+        git2::Sort::NONE
+    };
+    revwalk.set_sorting(
+        base | if args.flag_topo_order {
+            git2::Sort::TOPOLOGICAL
+        } else if args.flag_date_order {
+            git2::Sort::TIME
+        } else {
+            git2::Sort::NONE
+        },
+    )?;
+    for commit in &args.arg_commit {
+        if commit.starts_with('^') {
+            let obj = repo.revparse_single(&commit[1..])?;
+            revwalk.hide(obj.id())?;
+            continue;
+        }
+        let revspec = repo.revparse(commit)?;
+        if revspec.mode().contains(git2::RevparseMode::SINGLE) {
+            revwalk.push(revspec.from().unwrap().id())?;
+        } else {
+            let from = revspec.from().unwrap().id();
+            let to = revspec.to().unwrap().id();
+            revwalk.push(to)?;
+            if revspec.mode().contains(git2::RevparseMode::MERGE_BASE) {
+                let base = repo.merge_base(from, to)?;
+                let o = repo.find_object(base, Some(ObjectType::Commit))?;
+                revwalk.push(o.id())?;
+            }
+            revwalk.hide(from)?;
+        }
+    }
+    if args.arg_commit.is_empty() {
+        revwalk.push_head()?;
+    }
+
+    // Prepare our diff options and pathspec matcher
+    let (mut diffopts, mut diffopts2) = (DiffOptions::new(), DiffOptions::new());
+    for spec in &args.arg_spec {
+        diffopts.pathspec(spec);
+        diffopts2.pathspec(spec);
+    }
+    let ps = Pathspec::new(args.arg_spec.iter())?;
+
+    // Filter our revwalk based on the CLI parameters
+    macro_rules! filter_try {
+        ($e:expr) => {
+            match $e {
+                Ok(t) => t,
+                Err(e) => return Some(Err(e)),
+            }
+        };
+    }
+    let revwalk = revwalk
+        .filter_map(|id| {
+            let id = filter_try!(id);
+            let commit = filter_try!(repo.find_commit(id));
+            let parents = commit.parents().len();
+            if parents < args.min_parents() {
+                return None;
+            }
+            if let Some(n) = args.max_parents() {
+                if parents >= n {
+                    return None;
+                }
+            }
+            if !args.arg_spec.is_empty() {
+                match commit.parents().len() {
+                    0 => {
+                        let tree = filter_try!(commit.tree());
+                        let flags = git2::PathspecFlags::NO_MATCH_ERROR;
+                        if ps.match_tree(&tree, flags).is_err() {
+                            return None;
+                        }
+                    }
+                    _ => {
+                        let m = commit.parents().all(|parent| {
+                            match_with_parent(&repo, &commit, &parent, &mut diffopts)
+                                .unwrap_or(false)
+                        });
+                        if !m {
+                            return None;
+                        }
+                    }
+                }
+            }
+            if !sig_matches(&commit.author(), &args.flag_author) {
+                return None;
+            }
+            if !sig_matches(&commit.committer(), &args.flag_committer) {
+                return None;
+            }
+            if !log_message_matches(commit.message(), &args.flag_grep) {
+                return None;
+            }
+            Some(Ok(commit))
+        })
+        .skip(args.flag_skip.unwrap_or(0))
+        .take(args.flag_max_count.unwrap_or(!0));
+
+    // print!
+    for commit in revwalk {
+        let commit = commit?;
+        print_commit(&commit);
+        if !args.flag_patch || commit.parents().len() > 1 {
+            continue;
+        }
+        let a = if commit.parents().len() == 1 {
+            let parent = commit.parent(0)?;
+            Some(parent.tree()?)
+        } else {
+            None
+        };
+        let b = commit.tree()?;
+        let diff = repo.diff_tree_to_tree(a.as_ref(), Some(&b), Some(&mut diffopts2))?;
+        diff.print(DiffFormat::Patch, |_delta, _hunk, line| {
+            match line.origin() {
+                ' ' | '+' | '-' => print!("{}", line.origin()),
+                _ => {}
+            }
+            print!("{}", str::from_utf8(line.content()).unwrap());
+            true
+        })?;
+    }
+
+    Ok(())
+}
+
+fn sig_matches(sig: &Signature, arg: &Option<String>) -> bool {
+    match *arg {
+        Some(ref s) => {
+            sig.name().map(|n| n.contains(s)).unwrap_or(false)
+                || sig.email().map(|n| n.contains(s)).unwrap_or(false)
+        }
+        None => true,
+    }
+}
+
+fn log_message_matches(msg: Option<&str>, grep: &Option<String>) -> bool {
+    match (grep, msg) {
+        (&None, _) => true,
+        (&Some(_), None) => false,
+        (&Some(ref s), Some(msg)) => msg.contains(s),
+    }
+}
+
+fn print_commit(commit: &Commit) {
+    println!("commit {}", commit.id());
+
+    if commit.parents().len() > 1 {
+        print!("Merge:");
+        for id in commit.parent_ids() {
+            print!(" {:.8}", id);
+        }
+        println!();
+    }
+
+    let author = commit.author();
+    println!("Author: {}", author);
+    print_time(&author.when(), "Date:   ");
+    println!();
+
+    for line in String::from_utf8_lossy(commit.message_bytes()).lines() {
+        println!("    {}", line);
+    }
+    println!();
+}
+
+fn print_time(time: &Time, prefix: &str) {
+    let (offset, sign) = match time.offset_minutes() {
+        n if n < 0 => (-n, '-'),
+        n => (n, '+'),
+    };
+    let (hours, minutes) = (offset / 60, offset % 60);
+    let ts = time::Timespec::new(time.seconds() + (time.offset_minutes() as i64) * 60, 0);
+    let time = time::at(ts);
+
+    println!(
+        "{}{} {}{:02}{:02}",
+        prefix,
+        time.strftime("%a %b %e %T %Y").unwrap(),
+        sign,
+        hours,
+        minutes
+    );
+}
+
+fn match_with_parent(
+    repo: &Repository,
+    commit: &Commit,
+    parent: &Commit,
+    opts: &mut DiffOptions,
+) -> Result<bool, Error> {
+    let a = parent.tree()?;
+    let b = commit.tree()?;
+    let diff = repo.diff_tree_to_tree(Some(&a), Some(&b), Some(opts))?;
+    Ok(diff.deltas().len() > 0)
+}
+
+impl Args {
+    fn min_parents(&self) -> usize {
+        if self.flag_no_min_parents {
+            return 0;
+        }
+        self.flag_min_parents
+            .unwrap_or(if self.flag_merges { 2 } else { 0 })
+    }
+
+    fn max_parents(&self) -> Option<usize> {
+        if self.flag_no_max_parents {
+            return None;
+        }
+        self.flag_max_parents
+            .or(if self.flag_no_merges { Some(1) } else { None })
+    }
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/ls-remote.rs b/android/vendor/git2-0.14.4/examples/ls-remote.rs
new file mode 100644
index 0000000..1808459
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/ls-remote.rs
@@ -0,0 +1,51 @@
+/*
+ * libgit2 "ls-remote" example
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Direction, Repository};
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "remote")]
+    arg_remote: String,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let repo = Repository::open(".")?;
+    let remote = &args.arg_remote;
+    let mut remote = repo
+        .find_remote(remote)
+        .or_else(|_| repo.remote_anonymous(remote))?;
+
+    // Connect to the remote and call the printing function for each of the
+    // remote references.
+    let connection = remote.connect_auth(Direction::Fetch, None, None)?;
+
+    // Get the list of references on the remote and print out their name next to
+    // what they point to.
+    for head in connection.list()?.iter() {
+        println!("{}\t{}", head.oid(), head.name());
+    }
+    Ok(())
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/pull.rs b/android/vendor/git2-0.14.4/examples/pull.rs
new file mode 100644
index 0000000..33f5cb1
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/pull.rs
@@ -0,0 +1,208 @@
+/*
+ * libgit2 "pull" example - shows how to pull remote data into a local branch.
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+use git2::Repository;
+use std::io::{self, Write};
+use std::str;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    arg_remote: Option<String>,
+    arg_branch: Option<String>,
+}
+
+fn do_fetch<'a>(
+    repo: &'a git2::Repository,
+    refs: &[&str],
+    remote: &'a mut git2::Remote,
+) -> Result<git2::AnnotatedCommit<'a>, git2::Error> {
+    let mut cb = git2::RemoteCallbacks::new();
+
+    // Print out our transfer progress.
+    cb.transfer_progress(|stats| {
+        if stats.received_objects() == stats.total_objects() {
+            print!(
+                "Resolving deltas {}/{}\r",
+                stats.indexed_deltas(),
+                stats.total_deltas()
+            );
+        } else if stats.total_objects() > 0 {
+            print!(
+                "Received {}/{} objects ({}) in {} bytes\r",
+                stats.received_objects(),
+                stats.total_objects(),
+                stats.indexed_objects(),
+                stats.received_bytes()
+            );
+        }
+        io::stdout().flush().unwrap();
+        true
+    });
+
+    let mut fo = git2::FetchOptions::new();
+    fo.remote_callbacks(cb);
+    // Always fetch all tags.
+    // Perform a download and also update tips
+    fo.download_tags(git2::AutotagOption::All);
+    println!("Fetching {} for repo", remote.name().unwrap());
+    remote.fetch(refs, Some(&mut fo), None)?;
+
+    // If there are local objects (we got a thin pack), then tell the user
+    // how many objects we saved from having to cross the network.
+    let stats = remote.stats();
+    if stats.local_objects() > 0 {
+        println!(
+            "\rReceived {}/{} objects in {} bytes (used {} local \
+             objects)",
+            stats.indexed_objects(),
+            stats.total_objects(),
+            stats.received_bytes(),
+            stats.local_objects()
+        );
+    } else {
+        println!(
+            "\rReceived {}/{} objects in {} bytes",
+            stats.indexed_objects(),
+            stats.total_objects(),
+            stats.received_bytes()
+        );
+    }
+
+    let fetch_head = repo.find_reference("FETCH_HEAD")?;
+    Ok(repo.reference_to_annotated_commit(&fetch_head)?)
+}
+
+fn fast_forward(
+    repo: &Repository,
+    lb: &mut git2::Reference,
+    rc: &git2::AnnotatedCommit,
+) -> Result<(), git2::Error> {
+    let name = match lb.name() {
+        Some(s) => s.to_string(),
+        None => String::from_utf8_lossy(lb.name_bytes()).to_string(),
+    };
+    let msg = format!("Fast-Forward: Setting {} to id: {}", name, rc.id());
+    println!("{}", msg);
+    lb.set_target(rc.id(), &msg)?;
+    repo.set_head(&name)?;
+    repo.checkout_head(Some(
+        git2::build::CheckoutBuilder::default()
+            // For some reason the force is required to make the working directory actually get updated
+            // I suspect we should be adding some logic to handle dirty working directory states
+            // but this is just an example so maybe not.
+            .force(),
+    ))?;
+    Ok(())
+}
+
+fn normal_merge(
+    repo: &Repository,
+    local: &git2::AnnotatedCommit,
+    remote: &git2::AnnotatedCommit,
+) -> Result<(), git2::Error> {
+    let local_tree = repo.find_commit(local.id())?.tree()?;
+    let remote_tree = repo.find_commit(remote.id())?.tree()?;
+    let ancestor = repo
+        .find_commit(repo.merge_base(local.id(), remote.id())?)?
+        .tree()?;
+    let mut idx = repo.merge_trees(&ancestor, &local_tree, &remote_tree, None)?;
+
+    if idx.has_conflicts() {
+        println!("Merge conficts detected...");
+        repo.checkout_index(Some(&mut idx), None)?;
+        return Ok(());
+    }
+    let result_tree = repo.find_tree(idx.write_tree_to(repo)?)?;
+    // now create the merge commit
+    let msg = format!("Merge: {} into {}", remote.id(), local.id());
+    let sig = repo.signature()?;
+    let local_commit = repo.find_commit(local.id())?;
+    let remote_commit = repo.find_commit(remote.id())?;
+    // Do our merge commit and set current branch head to that commit.
+    let _merge_commit = repo.commit(
+        Some("HEAD"),
+        &sig,
+        &sig,
+        &msg,
+        &result_tree,
+        &[&local_commit, &remote_commit],
+    )?;
+    // Set working tree to match head.
+    repo.checkout_head(None)?;
+    Ok(())
+}
+
+fn do_merge<'a>(
+    repo: &'a Repository,
+    remote_branch: &str,
+    fetch_commit: git2::AnnotatedCommit<'a>,
+) -> Result<(), git2::Error> {
+    // 1. do a merge analysis
+    let analysis = repo.merge_analysis(&[&fetch_commit])?;
+
+    // 2. Do the appopriate merge
+    if analysis.0.is_fast_forward() {
+        println!("Doing a fast forward");
+        // do a fast forward
+        let refname = format!("refs/heads/{}", remote_branch);
+        match repo.find_reference(&refname) {
+            Ok(mut r) => {
+                fast_forward(repo, &mut r, &fetch_commit)?;
+            }
+            Err(_) => {
+                // The branch doesn't exist so just set the reference to the
+                // commit directly. Usually this is because you are pulling
+                // into an empty repository.
+                repo.reference(
+                    &refname,
+                    fetch_commit.id(),
+                    true,
+                    &format!("Setting {} to {}", remote_branch, fetch_commit.id()),
+                )?;
+                repo.set_head(&refname)?;
+                repo.checkout_head(Some(
+                    git2::build::CheckoutBuilder::default()
+                        .allow_conflicts(true)
+                        .conflict_style_merge(true)
+                        .force(),
+                ))?;
+            }
+        };
+    } else if analysis.0.is_normal() {
+        // do a normal merge
+        let head_commit = repo.reference_to_annotated_commit(&repo.head()?)?;
+        normal_merge(&repo, &head_commit, &fetch_commit)?;
+    } else {
+        println!("Nothing to do...");
+    }
+    Ok(())
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let remote_name = args.arg_remote.as_ref().map(|s| &s[..]).unwrap_or("origin");
+    let remote_branch = args.arg_branch.as_ref().map(|s| &s[..]).unwrap_or("master");
+    let repo = Repository::open(".")?;
+    let mut remote = repo.find_remote(remote_name)?;
+    let fetch_commit = do_fetch(&repo, &[remote_branch], &mut remote)?;
+    do_merge(&repo, &remote_branch, fetch_commit)
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/rev-list.rs b/android/vendor/git2-0.14.4/examples/rev-list.rs
new file mode 100644
index 0000000..9b49877
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/rev-list.rs
@@ -0,0 +1,105 @@
+/*
+ * libgit2 "rev-list" example - shows how to transform a rev-spec into a list
+ * of commit ids
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Error, Oid, Repository, Revwalk};
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "topo-order", long)]
+    /// sort commits in topological order
+    flag_topo_order: bool,
+    #[structopt(name = "date-order", long)]
+    /// sort commits in date order
+    flag_date_order: bool,
+    #[structopt(name = "reverse", long)]
+    /// sort commits in reverse
+    flag_reverse: bool,
+    #[structopt(name = "not")]
+    /// don't show <spec>
+    flag_not: Vec<String>,
+    #[structopt(name = "spec", last = true)]
+    arg_spec: Vec<String>,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let repo = Repository::open(".")?;
+    let mut revwalk = repo.revwalk()?;
+
+    let base = if args.flag_reverse {
+        git2::Sort::REVERSE
+    } else {
+        git2::Sort::NONE
+    };
+    revwalk.set_sorting(
+        base | if args.flag_topo_order {
+            git2::Sort::TOPOLOGICAL
+        } else if args.flag_date_order {
+            git2::Sort::TIME
+        } else {
+            git2::Sort::NONE
+        },
+    )?;
+
+    let specs = args
+        .flag_not
+        .iter()
+        .map(|s| (s, true))
+        .chain(args.arg_spec.iter().map(|s| (s, false)))
+        .map(|(spec, hide)| {
+            if spec.starts_with('^') {
+                (&spec[1..], !hide)
+            } else {
+                (&spec[..], hide)
+            }
+        });
+    for (spec, hide) in specs {
+        let id = if spec.contains("..") {
+            let revspec = repo.revparse(spec)?;
+            if revspec.mode().contains(git2::RevparseMode::MERGE_BASE) {
+                return Err(Error::from_str("merge bases not implemented"));
+            }
+            push(&mut revwalk, revspec.from().unwrap().id(), !hide)?;
+            revspec.to().unwrap().id()
+        } else {
+            repo.revparse_single(spec)?.id()
+        };
+        push(&mut revwalk, id, hide)?;
+    }
+
+    for id in revwalk {
+        let id = id?;
+        println!("{}", id);
+    }
+    Ok(())
+}
+
+fn push(revwalk: &mut Revwalk, id: Oid, hide: bool) -> Result<(), Error> {
+    if hide {
+        revwalk.hide(id)
+    } else {
+        revwalk.push(id)
+    }
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/rev-parse.rs b/android/vendor/git2-0.14.4/examples/rev-parse.rs
new file mode 100644
index 0000000..a465f15
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/rev-parse.rs
@@ -0,0 +1,60 @@
+/*
+ * libgit2 "rev-parse" example - shows how to parse revspecs
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::Repository;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    #[structopt(name = "spec")]
+    arg_spec: String,
+    #[structopt(name = "dir", long = "git-dir")]
+    /// directory of the git repository to check
+    flag_git_dir: Option<String>,
+}
+
+fn run(args: &Args) -> Result<(), git2::Error> {
+    let path = args.flag_git_dir.as_ref().map(|s| &s[..]).unwrap_or(".");
+    let repo = Repository::open(path)?;
+
+    let revspec = repo.revparse(&args.arg_spec)?;
+
+    if revspec.mode().contains(git2::RevparseMode::SINGLE) {
+        println!("{}", revspec.from().unwrap().id());
+    } else if revspec.mode().contains(git2::RevparseMode::RANGE) {
+        let to = revspec.to().unwrap();
+        let from = revspec.from().unwrap();
+        println!("{}", to.id());
+
+        if revspec.mode().contains(git2::RevparseMode::MERGE_BASE) {
+            let base = repo.merge_base(from.id(), to.id())?;
+            println!("{}", base);
+        }
+
+        println!("^{}", from.id());
+    } else {
+        return Err(git2::Error::from_str("invalid results from revparse"));
+    }
+    Ok(())
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/status.rs b/android/vendor/git2-0.14.4/examples/status.rs
new file mode 100644
index 0000000..4f7bc79
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/status.rs
@@ -0,0 +1,441 @@
+/*
+ * libgit2 "status" example - shows how to use the status APIs
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Error, ErrorCode, Repository, StatusOptions, SubmoduleIgnore};
+use std::str;
+use std::time::Duration;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    arg_spec: Vec<String>,
+    #[structopt(name = "long", long)]
+    /// show longer statuses (default)
+    _flag_long: bool,
+    /// show short statuses
+    #[structopt(name = "short", long)]
+    flag_short: bool,
+    #[structopt(name = "porcelain", long)]
+    /// ??
+    flag_porcelain: bool,
+    #[structopt(name = "branch", short, long)]
+    /// show branch information
+    flag_branch: bool,
+    #[structopt(name = "z", short)]
+    /// ??
+    flag_z: bool,
+    #[structopt(name = "ignored", long)]
+    /// show ignored files as well
+    flag_ignored: bool,
+    #[structopt(name = "opt-modules", long = "untracked-files")]
+    /// setting for showing untracked files [no|normal|all]
+    flag_untracked_files: Option<String>,
+    #[structopt(name = "opt-files", long = "ignore-submodules")]
+    /// setting for ignoring submodules [all]
+    flag_ignore_submodules: Option<String>,
+    #[structopt(name = "dir", long = "git-dir")]
+    /// git directory to analyze
+    flag_git_dir: Option<String>,
+    #[structopt(name = "repeat", long)]
+    /// repeatedly show status, sleeping inbetween
+    flag_repeat: bool,
+    #[structopt(name = "list-submodules", long)]
+    /// show submodules
+    flag_list_submodules: bool,
+}
+
+#[derive(Eq, PartialEq)]
+enum Format {
+    Long,
+    Short,
+    Porcelain,
+}
+
+fn run(args: &Args) -> Result<(), Error> {
+    let path = args.flag_git_dir.clone().unwrap_or_else(|| ".".to_string());
+    let repo = Repository::open(&path)?;
+    if repo.is_bare() {
+        return Err(Error::from_str("cannot report status on bare repository"));
+    }
+
+    let mut opts = StatusOptions::new();
+    opts.include_ignored(args.flag_ignored);
+    match args.flag_untracked_files.as_ref().map(|s| &s[..]) {
+        Some("no") => {
+            opts.include_untracked(false);
+        }
+        Some("normal") => {
+            opts.include_untracked(true);
+        }
+        Some("all") => {
+            opts.include_untracked(true).recurse_untracked_dirs(true);
+        }
+        Some(_) => return Err(Error::from_str("invalid untracked-files value")),
+        None => {}
+    }
+    match args.flag_ignore_submodules.as_ref().map(|s| &s[..]) {
+        Some("all") => {
+            opts.exclude_submodules(true);
+        }
+        Some(_) => return Err(Error::from_str("invalid ignore-submodules value")),
+        None => {}
+    }
+    opts.include_untracked(!args.flag_ignored);
+    for spec in &args.arg_spec {
+        opts.pathspec(spec);
+    }
+
+    loop {
+        if args.flag_repeat {
+            println!("\u{1b}[H\u{1b}[2J");
+        }
+
+        let statuses = repo.statuses(Some(&mut opts))?;
+
+        if args.flag_branch {
+            show_branch(&repo, &args.format())?;
+        }
+        if args.flag_list_submodules {
+            print_submodules(&repo)?;
+        }
+
+        if args.format() == Format::Long {
+            print_long(&statuses);
+        } else {
+            print_short(&repo, &statuses);
+        }
+
+        if args.flag_repeat {
+            std::thread::sleep(Duration::new(10, 0));
+        } else {
+            return Ok(());
+        }
+    }
+}
+
+fn show_branch(repo: &Repository, format: &Format) -> Result<(), Error> {
+    let head = match repo.head() {
+        Ok(head) => Some(head),
+        Err(ref e) if e.code() == ErrorCode::UnbornBranch || e.code() == ErrorCode::NotFound => {
+            None
+        }
+        Err(e) => return Err(e),
+    };
+    let head = head.as_ref().and_then(|h| h.shorthand());
+
+    if format == &Format::Long {
+        println!(
+            "# On branch {}",
+            head.unwrap_or("Not currently on any branch")
+        );
+    } else {
+        println!("## {}", head.unwrap_or("HEAD (no branch)"));
+    }
+    Ok(())
+}
+
+fn print_submodules(repo: &Repository) -> Result<(), Error> {
+    let modules = repo.submodules()?;
+    println!("# Submodules");
+    for sm in &modules {
+        println!(
+            "# - submodule '{}' at {}",
+            sm.name().unwrap(),
+            sm.path().display()
+        );
+    }
+    Ok(())
+}
+
+// This function print out an output similar to git's status command in long
+// form, including the command-line hints.
+fn print_long(statuses: &git2::Statuses) {
+    let mut header = false;
+    let mut rm_in_workdir = false;
+    let mut changes_in_index = false;
+    let mut changed_in_workdir = false;
+
+    // Print index changes
+    for entry in statuses
+        .iter()
+        .filter(|e| e.status() != git2::Status::CURRENT)
+    {
+        if entry.status().contains(git2::Status::WT_DELETED) {
+            rm_in_workdir = true;
+        }
+        let istatus = match entry.status() {
+            s if s.contains(git2::Status::INDEX_NEW) => "new file: ",
+            s if s.contains(git2::Status::INDEX_MODIFIED) => "modified: ",
+            s if s.contains(git2::Status::INDEX_DELETED) => "deleted: ",
+            s if s.contains(git2::Status::INDEX_RENAMED) => "renamed: ",
+            s if s.contains(git2::Status::INDEX_TYPECHANGE) => "typechange:",
+            _ => continue,
+        };
+        if !header {
+            println!(
+                "\
+# Changes to be committed:
+#   (use \"git reset HEAD <file>...\" to unstage)
+#"
+            );
+            header = true;
+        }
+
+        let old_path = entry.head_to_index().unwrap().old_file().path();
+        let new_path = entry.head_to_index().unwrap().new_file().path();
+        match (old_path, new_path) {
+            (Some(old), Some(new)) if old != new => {
+                println!("#\t{}  {} -> {}", istatus, old.display(), new.display());
+            }
+            (old, new) => {
+                println!("#\t{}  {}", istatus, old.or(new).unwrap().display());
+            }
+        }
+    }
+
+    if header {
+        changes_in_index = true;
+        println!("#");
+    }
+    header = false;
+
+    // Print workdir changes to tracked files
+    for entry in statuses.iter() {
+        // With `Status::OPT_INCLUDE_UNMODIFIED` (not used in this example)
+        // `index_to_workdir` may not be `None` even if there are no differences,
+        // in which case it will be a `Delta::Unmodified`.
+        if entry.status() == git2::Status::CURRENT || entry.index_to_workdir().is_none() {
+            continue;
+        }
+
+        let istatus = match entry.status() {
+            s if s.contains(git2::Status::WT_MODIFIED) => "modified: ",
+            s if s.contains(git2::Status::WT_DELETED) => "deleted: ",
+            s if s.contains(git2::Status::WT_RENAMED) => "renamed: ",
+            s if s.contains(git2::Status::WT_TYPECHANGE) => "typechange:",
+            _ => continue,
+        };
+
+        if !header {
+            println!(
+                "\
+# Changes not staged for commit:
+#   (use \"git add{} <file>...\" to update what will be committed)
+#   (use \"git checkout -- <file>...\" to discard changes in working directory)
+#\
+                ",
+                if rm_in_workdir { "/rm" } else { "" }
+            );
+            header = true;
+        }
+
+        let old_path = entry.index_to_workdir().unwrap().old_file().path();
+        let new_path = entry.index_to_workdir().unwrap().new_file().path();
+        match (old_path, new_path) {
+            (Some(old), Some(new)) if old != new => {
+                println!("#\t{}  {} -> {}", istatus, old.display(), new.display());
+            }
+            (old, new) => {
+                println!("#\t{}  {}", istatus, old.or(new).unwrap().display());
+            }
+        }
+    }
+
+    if header {
+        changed_in_workdir = true;
+        println!("#");
+    }
+    header = false;
+
+    // Print untracked files
+    for entry in statuses
+        .iter()
+        .filter(|e| e.status() == git2::Status::WT_NEW)
+    {
+        if !header {
+            println!(
+                "\
+# Untracked files
+#   (use \"git add <file>...\" to include in what will be committed)
+#"
+            );
+            header = true;
+        }
+        let file = entry.index_to_workdir().unwrap().old_file().path().unwrap();
+        println!("#\t{}", file.display());
+    }
+    header = false;
+
+    // Print ignored files
+    for entry in statuses
+        .iter()
+        .filter(|e| e.status() == git2::Status::IGNORED)
+    {
+        if !header {
+            println!(
+                "\
+# Ignored files
+#   (use \"git add -f <file>...\" to include in what will be committed)
+#"
+            );
+            header = true;
+        }
+        let file = entry.index_to_workdir().unwrap().old_file().path().unwrap();
+        println!("#\t{}", file.display());
+    }
+
+    if !changes_in_index && changed_in_workdir {
+        println!(
+            "no changes added to commit (use \"git add\" and/or \
+             \"git commit -a\")"
+        );
+    }
+}
+
+// This version of the output prefixes each path with two status columns and
+// shows submodule status information.
+fn print_short(repo: &Repository, statuses: &git2::Statuses) {
+    for entry in statuses
+        .iter()
+        .filter(|e| e.status() != git2::Status::CURRENT)
+    {
+        let mut istatus = match entry.status() {
+            s if s.contains(git2::Status::INDEX_NEW) => 'A',
+            s if s.contains(git2::Status::INDEX_MODIFIED) => 'M',
+            s if s.contains(git2::Status::INDEX_DELETED) => 'D',
+            s if s.contains(git2::Status::INDEX_RENAMED) => 'R',
+            s if s.contains(git2::Status::INDEX_TYPECHANGE) => 'T',
+            _ => ' ',
+        };
+        let mut wstatus = match entry.status() {
+            s if s.contains(git2::Status::WT_NEW) => {
+                if istatus == ' ' {
+                    istatus = '?';
+                }
+                '?'
+            }
+            s if s.contains(git2::Status::WT_MODIFIED) => 'M',
+            s if s.contains(git2::Status::WT_DELETED) => 'D',
+            s if s.contains(git2::Status::WT_RENAMED) => 'R',
+            s if s.contains(git2::Status::WT_TYPECHANGE) => 'T',
+            _ => ' ',
+        };
+
+        if entry.status().contains(git2::Status::IGNORED) {
+            istatus = '!';
+            wstatus = '!';
+        }
+        if istatus == '?' && wstatus == '?' {
+            continue;
+        }
+        let mut extra = "";
+
+        // A commit in a tree is how submodules are stored, so let's go take a
+        // look at its status.
+        //
+        // TODO: check for GIT_FILEMODE_COMMIT
+        let status = entry.index_to_workdir().and_then(|diff| {
+            let ignore = SubmoduleIgnore::Unspecified;
+            diff.new_file()
+                .path_bytes()
+                .and_then(|s| str::from_utf8(s).ok())
+                .and_then(|name| repo.submodule_status(name, ignore).ok())
+        });
+        if let Some(status) = status {
+            if status.contains(git2::SubmoduleStatus::WD_MODIFIED) {
+                extra = " (new commits)";
+            } else if status.contains(git2::SubmoduleStatus::WD_INDEX_MODIFIED)
+                || status.contains(git2::SubmoduleStatus::WD_WD_MODIFIED)
+            {
+                extra = " (modified content)";
+            } else if status.contains(git2::SubmoduleStatus::WD_UNTRACKED) {
+                extra = " (untracked content)";
+            }
+        }
+
+        let (mut a, mut b, mut c) = (None, None, None);
+        if let Some(diff) = entry.head_to_index() {
+            a = diff.old_file().path();
+            b = diff.new_file().path();
+        }
+        if let Some(diff) = entry.index_to_workdir() {
+            a = a.or_else(|| diff.old_file().path());
+            b = b.or_else(|| diff.old_file().path());
+            c = diff.new_file().path();
+        }
+
+        match (istatus, wstatus) {
+            ('R', 'R') => println!(
+                "RR {} {} {}{}",
+                a.unwrap().display(),
+                b.unwrap().display(),
+                c.unwrap().display(),
+                extra
+            ),
+            ('R', w) => println!(
+                "R{} {} {}{}",
+                w,
+                a.unwrap().display(),
+                b.unwrap().display(),
+                extra
+            ),
+            (i, 'R') => println!(
+                "{}R {} {}{}",
+                i,
+                a.unwrap().display(),
+                c.unwrap().display(),
+                extra
+            ),
+            (i, w) => println!("{}{} {}{}", i, w, a.unwrap().display(), extra),
+        }
+    }
+
+    for entry in statuses
+        .iter()
+        .filter(|e| e.status() == git2::Status::WT_NEW)
+    {
+        println!(
+            "?? {}",
+            entry
+                .index_to_workdir()
+                .unwrap()
+                .old_file()
+                .path()
+                .unwrap()
+                .display()
+        );
+    }
+}
+
+impl Args {
+    fn format(&self) -> Format {
+        if self.flag_short {
+            Format::Short
+        } else if self.flag_porcelain || self.flag_z {
+            Format::Porcelain
+        } else {
+            Format::Long
+        }
+    }
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/examples/tag.rs b/android/vendor/git2-0.14.4/examples/tag.rs
new file mode 100644
index 0000000..c44c288
--- /dev/null
+++ b/android/vendor/git2-0.14.4/examples/tag.rs
@@ -0,0 +1,127 @@
+/*
+ * libgit2 "tag" example - shows how to list, create and delete tags
+ *
+ * Written by the libgit2 contributors
+ *
+ * To the extent possible under law, the author(s) have dedicated all copyright
+ * and related and neighboring rights to this software to the public domain
+ * worldwide. This software is distributed without any warranty.
+ *
+ * You should have received a copy of the CC0 Public Domain Dedication along
+ * with this software. If not, see
+ * <http://creativecommons.org/publicdomain/zero/1.0/>.
+ */
+
+#![deny(warnings)]
+
+use git2::{Commit, Error, Repository, Tag};
+use std::str;
+use structopt::StructOpt;
+
+#[derive(StructOpt)]
+struct Args {
+    arg_tagname: Option<String>,
+    arg_object: Option<String>,
+    arg_pattern: Option<String>,
+    #[structopt(name = "n", short)]
+    /// specify number of lines from the annotation to print
+    flag_n: Option<u32>,
+    #[structopt(name = "force", short, long)]
+    /// replace an existing tag with the given name
+    flag_force: bool,
+    #[structopt(name = "list", short, long)]
+    /// list tags with names matching the pattern given
+    flag_list: bool,
+    #[structopt(name = "tag", short, long = "delete")]
+    /// delete the tag specified
+    flag_delete: Option<String>,
+    #[structopt(name = "msg", short, long = "message")]
+    /// message for a new tag
+    flag_message: Option<String>,
+}
+
+fn run(args: &Args) -> Result<(), Error> {
+    let repo = Repository::open(".")?;
+
+    if let Some(ref name) = args.arg_tagname {
+        let target = args.arg_object.as_ref().map(|s| &s[..]).unwrap_or("HEAD");
+        let obj = repo.revparse_single(target)?;
+
+        if let Some(ref message) = args.flag_message {
+            let sig = repo.signature()?;
+            repo.tag(name, &obj, &sig, message, args.flag_force)?;
+        } else {
+            repo.tag_lightweight(name, &obj, args.flag_force)?;
+        }
+    } else if let Some(ref name) = args.flag_delete {
+        let obj = repo.revparse_single(name)?;
+        let id = obj.short_id()?;
+        repo.tag_delete(name)?;
+        println!(
+            "Deleted tag '{}' (was {})",
+            name,
+            str::from_utf8(&*id).unwrap()
+        );
+    } else if args.flag_list {
+        let pattern = args.arg_pattern.as_ref().map(|s| &s[..]).unwrap_or("*");
+        for name in repo.tag_names(Some(pattern))?.iter() {
+            let name = name.unwrap();
+            let obj = repo.revparse_single(name)?;
+
+            if let Some(tag) = obj.as_tag() {
+                print_tag(tag, args);
+            } else if let Some(commit) = obj.as_commit() {
+                print_commit(commit, name, args);
+            } else {
+                print_name(name);
+            }
+        }
+    }
+    Ok(())
+}
+
+fn print_tag(tag: &Tag, args: &Args) {
+    print!("{:<16}", tag.name().unwrap());
+    if args.flag_n.is_some() {
+        print_list_lines(tag.message(), args);
+    } else {
+        println!();
+    }
+}
+
+fn print_commit(commit: &Commit, name: &str, args: &Args) {
+    print!("{:<16}", name);
+    if args.flag_n.is_some() {
+        print_list_lines(commit.message(), args);
+    } else {
+        println!();
+    }
+}
+
+fn print_name(name: &str) {
+    println!("{}", name);
+}
+
+fn print_list_lines(message: Option<&str>, args: &Args) {
+    let message = match message {
+        Some(s) => s,
+        None => return,
+    };
+    let mut lines = message.lines().filter(|l| !l.trim().is_empty());
+    if let Some(first) = lines.next() {
+        print!("{}", first);
+    }
+    println!();
+
+    for line in lines.take(args.flag_n.unwrap_or(0) as usize) {
+        print!("    {}", line);
+    }
+}
+
+fn main() {
+    let args = Args::from_args();
+    match run(&args) {
+        Ok(()) => {}
+        Err(e) => println!("error: {}", e),
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/apply.rs b/android/vendor/git2-0.14.4/src/apply.rs
new file mode 100644
index 0000000..34dc811
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/apply.rs
@@ -0,0 +1,208 @@
+//! git_apply support
+//! see original: <https://github.com/libgit2/libgit2/blob/master/include/git2/apply.h>
+
+use crate::{panic, raw, util::Binding, DiffDelta, DiffHunk};
+use libc::c_int;
+use std::{ffi::c_void, mem};
+
+/// Possible application locations for git_apply
+/// see <https://libgit2.org/libgit2/#HEAD/type/git_apply_options>
+#[derive(Copy, Clone, Debug)]
+pub enum ApplyLocation {
+    /// Apply the patch to the workdir
+    WorkDir,
+    /// Apply the patch to the index
+    Index,
+    /// Apply the patch to both the working directory and the index
+    Both,
+}
+
+impl Binding for ApplyLocation {
+    type Raw = raw::git_apply_location_t;
+    unsafe fn from_raw(raw: raw::git_apply_location_t) -> Self {
+        match raw {
+            raw::GIT_APPLY_LOCATION_WORKDIR => Self::WorkDir,
+            raw::GIT_APPLY_LOCATION_INDEX => Self::Index,
+            raw::GIT_APPLY_LOCATION_BOTH => Self::Both,
+            _ => panic!("Unknown git diff binary kind"),
+        }
+    }
+    fn raw(&self) -> raw::git_apply_location_t {
+        match *self {
+            Self::WorkDir => raw::GIT_APPLY_LOCATION_WORKDIR,
+            Self::Index => raw::GIT_APPLY_LOCATION_INDEX,
+            Self::Both => raw::GIT_APPLY_LOCATION_BOTH,
+        }
+    }
+}
+
+/// Options to specify when applying a diff
+pub struct ApplyOptions<'cb> {
+    raw: raw::git_apply_options,
+    hunk_cb: Option<Box<HunkCB<'cb>>>,
+    delta_cb: Option<Box<DeltaCB<'cb>>>,
+}
+
+type HunkCB<'a> = dyn FnMut(Option<DiffHunk<'_>>) -> bool + 'a;
+type DeltaCB<'a> = dyn FnMut(Option<DiffDelta<'_>>) -> bool + 'a;
+
+extern "C" fn delta_cb_c(delta: *const raw::git_diff_delta, data: *mut c_void) -> c_int {
+    panic::wrap(|| unsafe {
+        let delta = Binding::from_raw_opt(delta as *mut _);
+
+        let payload = &mut *(data as *mut ApplyOptions<'_>);
+        let callback = match payload.delta_cb {
+            Some(ref mut c) => c,
+            None => return -1,
+        };
+
+        let apply = callback(delta);
+        if apply {
+            0
+        } else {
+            1
+        }
+    })
+    .unwrap_or(-1)
+}
+
+extern "C" fn hunk_cb_c(hunk: *const raw::git_diff_hunk, data: *mut c_void) -> c_int {
+    panic::wrap(|| unsafe {
+        let hunk = Binding::from_raw_opt(hunk);
+
+        let payload = &mut *(data as *mut ApplyOptions<'_>);
+        let callback = match payload.hunk_cb {
+            Some(ref mut c) => c,
+            None => return -1,
+        };
+
+        let apply = callback(hunk);
+        if apply {
+            0
+        } else {
+            1
+        }
+    })
+    .unwrap_or(-1)
+}
+
+impl<'cb> ApplyOptions<'cb> {
+    /// Creates a new set of empty options (zeroed).
+    pub fn new() -> Self {
+        let mut opts = Self {
+            raw: unsafe { mem::zeroed() },
+            hunk_cb: None,
+            delta_cb: None,
+        };
+        assert_eq!(
+            unsafe { raw::git_apply_options_init(&mut opts.raw, raw::GIT_APPLY_OPTIONS_VERSION) },
+            0
+        );
+        opts
+    }
+
+    fn flag(&mut self, opt: raw::git_apply_flags_t, val: bool) -> &mut Self {
+        let opt = opt as u32;
+        if val {
+            self.raw.flags |= opt;
+        } else {
+            self.raw.flags &= !opt;
+        }
+        self
+    }
+
+    /// Don't actually make changes, just test that the patch applies.
+    pub fn check(&mut self, check: bool) -> &mut Self {
+        self.flag(raw::GIT_APPLY_CHECK, check)
+    }
+
+    /// When applying a patch, callback that will be made per hunk.
+    pub fn hunk_callback<F>(&mut self, cb: F) -> &mut Self
+    where
+        F: FnMut(Option<DiffHunk<'_>>) -> bool + 'cb,
+    {
+        self.hunk_cb = Some(Box::new(cb) as Box<HunkCB<'cb>>);
+
+        self.raw.hunk_cb = Some(hunk_cb_c);
+        self.raw.payload = self as *mut _ as *mut _;
+
+        self
+    }
+
+    /// When applying a patch, callback that will be made per delta (file).
+    pub fn delta_callback<F>(&mut self, cb: F) -> &mut Self
+    where
+        F: FnMut(Option<DiffDelta<'_>>) -> bool + 'cb,
+    {
+        self.delta_cb = Some(Box::new(cb) as Box<DeltaCB<'cb>>);
+
+        self.raw.delta_cb = Some(delta_cb_c);
+        self.raw.payload = self as *mut _ as *mut _;
+
+        self
+    }
+
+    /// Pointer to a raw git_stash_apply_options
+    pub unsafe fn raw(&mut self) -> *const raw::git_apply_options {
+        &self.raw as *const _
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use std::{fs::File, io::Write, path::Path};
+
+    #[test]
+    fn smoke_test() {
+        let (_td, repo) = crate::test::repo_init();
+        let diff = t!(repo.diff_tree_to_workdir(None, None));
+        let mut count_hunks = 0;
+        let mut count_delta = 0;
+        {
+            let mut opts = ApplyOptions::new();
+            opts.hunk_callback(|_hunk| {
+                count_hunks += 1;
+                true
+            });
+            opts.delta_callback(|_delta| {
+                count_delta += 1;
+                true
+            });
+            t!(repo.apply(&diff, ApplyLocation::Both, Some(&mut opts)));
+        }
+        assert_eq!(count_hunks, 0);
+        assert_eq!(count_delta, 0);
+    }
+
+    #[test]
+    fn apply_hunks_and_delta() {
+        let file_path = Path::new("foo.txt");
+        let (td, repo) = crate::test::repo_init();
+        // create new file
+        t!(t!(File::create(&td.path().join(file_path))).write_all(b"bar"));
+        // stage the new file
+        t!(t!(repo.index()).add_path(file_path));
+        // now change workdir version
+        t!(t!(File::create(&td.path().join(file_path))).write_all(b"foo\nbar"));
+
+        let diff = t!(repo.diff_index_to_workdir(None, None));
+        assert_eq!(diff.deltas().len(), 1);
+        let mut count_hunks = 0;
+        let mut count_delta = 0;
+        {
+            let mut opts = ApplyOptions::new();
+            opts.hunk_callback(|_hunk| {
+                count_hunks += 1;
+                true
+            });
+            opts.delta_callback(|_delta| {
+                count_delta += 1;
+                true
+            });
+            t!(repo.apply(&diff, ApplyLocation::Index, Some(&mut opts)));
+        }
+        assert_eq!(count_delta, 1);
+        assert_eq!(count_hunks, 1);
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/attr.rs b/android/vendor/git2-0.14.4/src/attr.rs
new file mode 100644
index 0000000..33b1d2d
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/attr.rs
@@ -0,0 +1,175 @@
+use crate::raw;
+use std::ptr;
+use std::str;
+
+/// All possible states of an attribute.
+///
+/// This enum is used to interpret the value returned by
+/// [`Repository::get_attr`](crate::Repository::get_attr) and
+/// [`Repository::get_attr_bytes`](crate::Repository::get_attr_bytes).
+#[derive(Debug, Clone, Copy, Eq)]
+pub enum AttrValue<'string> {
+    /// The attribute is set to true.
+    True,
+    /// The attribute is unset (set to false).
+    False,
+    /// The attribute is set to a [valid UTF-8 string](prim@str).
+    String(&'string str),
+    /// The attribute is set to a string that might not be [valid UTF-8](prim@str).
+    Bytes(&'string [u8]),
+    /// The attribute is not specified.
+    Unspecified,
+}
+
+macro_rules! from_value {
+    ($value:expr => $string:expr) => {
+        match unsafe { raw::git_attr_value($value.map_or(ptr::null(), |v| v.as_ptr().cast())) } {
+            raw::GIT_ATTR_VALUE_TRUE => Self::True,
+            raw::GIT_ATTR_VALUE_FALSE => Self::False,
+            raw::GIT_ATTR_VALUE_STRING => $string,
+            raw::GIT_ATTR_VALUE_UNSPECIFIED => Self::Unspecified,
+            _ => unreachable!(),
+        }
+    };
+}
+
+impl<'string> AttrValue<'string> {
+    /// Returns the state of an attribute by inspecting its [value](crate::Repository::get_attr)
+    /// by a [string](prim@str).
+    ///
+    /// This function always returns [`AttrValue::String`] and never returns [`AttrValue::Bytes`]
+    /// when the attribute is set to a string.
+    pub fn from_string(value: Option<&'string str>) -> Self {
+        from_value!(value => Self::String(value.unwrap()))
+    }
+
+    /// Returns the state of an attribute by inspecting its [value](crate::Repository::get_attr_bytes)
+    /// by a [byte](u8) [slice].
+    ///
+    /// This function will perform UTF-8 validation when the attribute is set to a string, returns
+    /// [`AttrValue::String`] if it's valid UTF-8 and [`AttrValue::Bytes`] otherwise.
+    pub fn from_bytes(value: Option<&'string [u8]>) -> Self {
+        let mut value = Self::always_bytes(value);
+        if let Self::Bytes(bytes) = value {
+            if let Ok(string) = str::from_utf8(bytes) {
+                value = Self::String(string);
+            }
+        }
+        value
+    }
+
+    /// Returns the state of an attribute just like [`AttrValue::from_bytes`], but skips UTF-8
+    /// validation and always returns [`AttrValue::Bytes`] when it's set to a string.
+    pub fn always_bytes(value: Option<&'string [u8]>) -> Self {
+        from_value!(value => Self::Bytes(value.unwrap()))
+    }
+}
+
+/// Compare two [`AttrValue`]s.
+///
+/// Note that this implementation does not differentiate between [`AttrValue::String`] and
+/// [`AttrValue::Bytes`].
+impl PartialEq for AttrValue<'_> {
+    fn eq(&self, other: &AttrValue<'_>) -> bool {
+        match (self, other) {
+            (Self::True, AttrValue::True)
+            | (Self::False, AttrValue::False)
+            | (Self::Unspecified, AttrValue::Unspecified) => true,
+            (AttrValue::String(string), AttrValue::Bytes(bytes))
+            | (AttrValue::Bytes(bytes), AttrValue::String(string)) => string.as_bytes() == *bytes,
+            (AttrValue::String(left), AttrValue::String(right)) => left == right,
+            (AttrValue::Bytes(left), AttrValue::Bytes(right)) => left == right,
+            _ => false,
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::AttrValue;
+
+    macro_rules! test_attr_value {
+        ($function:ident, $variant:ident) => {
+            const ATTR_TRUE: &str = "[internal]__TRUE__";
+            const ATTR_FALSE: &str = "[internal]__FALSE__";
+            const ATTR_UNSET: &str = "[internal]__UNSET__";
+            let as_bytes = AsRef::<[u8]>::as_ref;
+            // Use `matches!` here since the `PartialEq` implementation does not differentiate
+            // between `String` and `Bytes`.
+            assert!(matches!(
+                AttrValue::$function(Some(ATTR_TRUE.as_ref())),
+                AttrValue::$variant(s) if as_bytes(s) == ATTR_TRUE.as_bytes()
+            ));
+            assert!(matches!(
+                AttrValue::$function(Some(ATTR_FALSE.as_ref())),
+                AttrValue::$variant(s) if as_bytes(s) == ATTR_FALSE.as_bytes()
+            ));
+            assert!(matches!(
+                AttrValue::$function(Some(ATTR_UNSET.as_ref())),
+                AttrValue::$variant(s) if as_bytes(s) == ATTR_UNSET.as_bytes()
+            ));
+            assert!(matches!(
+                AttrValue::$function(Some("foo".as_ref())),
+                AttrValue::$variant(s) if as_bytes(s) == b"foo"
+            ));
+            assert!(matches!(
+                AttrValue::$function(Some("bar".as_ref())),
+                AttrValue::$variant(s) if as_bytes(s) == b"bar"
+            ));
+            assert_eq!(AttrValue::$function(None), AttrValue::Unspecified);
+        };
+    }
+
+    #[test]
+    fn attr_value_from_string() {
+        test_attr_value!(from_string, String);
+    }
+
+    #[test]
+    fn attr_value_from_bytes() {
+        test_attr_value!(from_bytes, String);
+        assert!(matches!(
+            AttrValue::from_bytes(Some(&[0xff])),
+            AttrValue::Bytes(&[0xff])
+        ));
+        assert!(matches!(
+            AttrValue::from_bytes(Some(b"\xffoobar")),
+            AttrValue::Bytes(b"\xffoobar")
+        ));
+    }
+
+    #[test]
+    fn attr_value_always_bytes() {
+        test_attr_value!(always_bytes, Bytes);
+        assert!(matches!(
+            AttrValue::always_bytes(Some(&[0xff; 2])),
+            AttrValue::Bytes(&[0xff, 0xff])
+        ));
+        assert!(matches!(
+            AttrValue::always_bytes(Some(b"\xffoo")),
+            AttrValue::Bytes(b"\xffoo")
+        ));
+    }
+
+    #[test]
+    fn attr_value_partial_eq() {
+        assert_eq!(AttrValue::True, AttrValue::True);
+        assert_eq!(AttrValue::False, AttrValue::False);
+        assert_eq!(AttrValue::String("foo"), AttrValue::String("foo"));
+        assert_eq!(AttrValue::Bytes(b"foo"), AttrValue::Bytes(b"foo"));
+        assert_eq!(AttrValue::String("bar"), AttrValue::Bytes(b"bar"));
+        assert_eq!(AttrValue::Bytes(b"bar"), AttrValue::String("bar"));
+        assert_eq!(AttrValue::Unspecified, AttrValue::Unspecified);
+        assert_ne!(AttrValue::True, AttrValue::False);
+        assert_ne!(AttrValue::False, AttrValue::Unspecified);
+        assert_ne!(AttrValue::Unspecified, AttrValue::True);
+        assert_ne!(AttrValue::True, AttrValue::String("true"));
+        assert_ne!(AttrValue::Unspecified, AttrValue::Bytes(b"unspecified"));
+        assert_ne!(AttrValue::Bytes(b"false"), AttrValue::False);
+        assert_ne!(AttrValue::String("unspecified"), AttrValue::Unspecified);
+        assert_ne!(AttrValue::String("foo"), AttrValue::String("bar"));
+        assert_ne!(AttrValue::Bytes(b"foo"), AttrValue::Bytes(b"bar"));
+        assert_ne!(AttrValue::String("foo"), AttrValue::Bytes(b"bar"));
+        assert_ne!(AttrValue::Bytes(b"foo"), AttrValue::String("bar"));
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/blame.rs b/android/vendor/git2-0.14.4/src/blame.rs
new file mode 100644
index 0000000..496efa9
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/blame.rs
@@ -0,0 +1,350 @@
+use crate::util::{self, Binding};
+use crate::{raw, signature, Oid, Repository, Signature};
+use std::marker;
+use std::mem;
+use std::ops::Range;
+use std::path::Path;
+
+/// Opaque structure to hold blame results.
+pub struct Blame<'repo> {
+    raw: *mut raw::git_blame,
+    _marker: marker::PhantomData<&'repo Repository>,
+}
+
+/// Structure that represents a blame hunk.
+pub struct BlameHunk<'blame> {
+    raw: *mut raw::git_blame_hunk,
+    _marker: marker::PhantomData<&'blame raw::git_blame>,
+}
+
+/// Blame options
+pub struct BlameOptions {
+    raw: raw::git_blame_options,
+}
+
+/// An iterator over the hunks in a blame.
+pub struct BlameIter<'blame> {
+    range: Range<usize>,
+    blame: &'blame Blame<'blame>,
+}
+
+impl<'repo> Blame<'repo> {
+    /// Gets the number of hunks that exist in the blame structure.
+    pub fn len(&self) -> usize {
+        unsafe { raw::git_blame_get_hunk_count(self.raw) as usize }
+    }
+
+    /// Return `true` is there is no hunk in the blame structure.
+    pub fn is_empty(&self) -> bool {
+        self.len() == 0
+    }
+
+    /// Gets the blame hunk at the given index.
+    pub fn get_index(&self, index: usize) -> Option<BlameHunk<'_>> {
+        unsafe {
+            let ptr = raw::git_blame_get_hunk_byindex(self.raw(), index as u32);
+            if ptr.is_null() {
+                None
+            } else {
+                Some(BlameHunk::from_raw_const(ptr))
+            }
+        }
+    }
+
+    /// Gets the hunk that relates to the given line number in the newest
+    /// commit.
+    pub fn get_line(&self, lineno: usize) -> Option<BlameHunk<'_>> {
+        unsafe {
+            let ptr = raw::git_blame_get_hunk_byline(self.raw(), lineno);
+            if ptr.is_null() {
+                None
+            } else {
+                Some(BlameHunk::from_raw_const(ptr))
+            }
+        }
+    }
+
+    /// Returns an iterator over the hunks in this blame.
+    pub fn iter(&self) -> BlameIter<'_> {
+        BlameIter {
+            range: 0..self.len(),
+            blame: self,
+        }
+    }
+}
+
+impl<'blame> BlameHunk<'blame> {
+    unsafe fn from_raw_const(raw: *const raw::git_blame_hunk) -> BlameHunk<'blame> {
+        BlameHunk {
+            raw: raw as *mut raw::git_blame_hunk,
+            _marker: marker::PhantomData,
+        }
+    }
+
+    /// Returns OID of the commit where this line was last changed
+    pub fn final_commit_id(&self) -> Oid {
+        unsafe { Oid::from_raw(&(*self.raw).final_commit_id) }
+    }
+
+    /// Returns signature of the commit.
+    pub fn final_signature(&self) -> Signature<'_> {
+        unsafe { signature::from_raw_const(self, (*self.raw).final_signature) }
+    }
+
+    /// Returns line number where this hunk begins.
+    ///
+    /// Note that the start line is counting from 1.
+    pub fn final_start_line(&self) -> usize {
+        unsafe { (*self.raw).final_start_line_number }
+    }
+
+    /// Returns the OID of the commit where this hunk was found.
+    ///
+    /// This will usually be the same as `final_commit_id`,
+    /// except when `BlameOptions::track_copies_any_commit_copies` has been
+    /// turned on
+    pub fn orig_commit_id(&self) -> Oid {
+        unsafe { Oid::from_raw(&(*self.raw).orig_commit_id) }
+    }
+
+    /// Returns signature of the commit.
+    pub fn orig_signature(&self) -> Signature<'_> {
+        unsafe { signature::from_raw_const(self, (*self.raw).orig_signature) }
+    }
+
+    /// Returns line number where this hunk begins.
+    ///
+    /// Note that the start line is counting from 1.
+    pub fn orig_start_line(&self) -> usize {
+        unsafe { (*self.raw).orig_start_line_number }
+    }
+
+    /// Returns path to the file where this hunk originated.
+    ///
+    /// Note: `None` could be returned for non-unicode paths on Windows.
+    pub fn path(&self) -> Option<&Path> {
+        unsafe {
+            if let Some(bytes) = crate::opt_bytes(self, (*self.raw).orig_path) {
+                Some(util::bytes2path(bytes))
+            } else {
+                None
+            }
+        }
+    }
+
+    /// Tests whether this hunk has been tracked to a boundary commit
+    /// (the root, or the commit specified in git_blame_options.oldest_commit).
+    pub fn is_boundary(&self) -> bool {
+        unsafe { (*self.raw).boundary == 1 }
+    }
+
+    /// Returns number of lines in this hunk.
+    pub fn lines_in_hunk(&self) -> usize {
+        unsafe { (*self.raw).lines_in_hunk as usize }
+    }
+}
+
+impl Default for BlameOptions {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl BlameOptions {
+    /// Initialize options
+    pub fn new() -> BlameOptions {
+        unsafe {
+            let mut raw: raw::git_blame_options = mem::zeroed();
+            assert_eq!(
+                raw::git_blame_init_options(&mut raw, raw::GIT_BLAME_OPTIONS_VERSION),
+                0
+            );
+
+            Binding::from_raw(&raw as *const _ as *mut _)
+        }
+    }
+
+    fn flag(&mut self, opt: u32, val: bool) -> &mut BlameOptions {
+        if val {
+            self.raw.flags |= opt;
+        } else {
+            self.raw.flags &= !opt;
+        }
+        self
+    }
+
+    /// Track lines that have moved within a file.
+    pub fn track_copies_same_file(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_TRACK_COPIES_SAME_FILE, opt)
+    }
+
+    /// Track lines that have moved across files in the same commit.
+    pub fn track_copies_same_commit_moves(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES, opt)
+    }
+
+    /// Track lines that have been copied from another file that exists
+    /// in the same commit.
+    pub fn track_copies_same_commit_copies(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES, opt)
+    }
+
+    /// Track lines that have been copied from another file that exists
+    /// in any commit.
+    pub fn track_copies_any_commit_copies(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES, opt)
+    }
+
+    /// Restrict the search of commits to those reachable following only
+    /// the first parents.
+    pub fn first_parent(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_FIRST_PARENT, opt)
+    }
+
+    /// Use mailmap file to map author and committer names and email addresses
+    /// to canonical real names and email addresses. The mailmap will be read
+    /// from the working directory, or HEAD in a bare repository.
+    pub fn use_mailmap(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_USE_MAILMAP, opt)
+    }
+
+    /// Ignore whitespace differences.
+    pub fn ignore_whitespace(&mut self, opt: bool) -> &mut BlameOptions {
+        self.flag(raw::GIT_BLAME_IGNORE_WHITESPACE, opt)
+    }
+
+    /// Setter for the id of the newest commit to consider.
+    pub fn newest_commit(&mut self, id: Oid) -> &mut BlameOptions {
+        unsafe {
+            self.raw.newest_commit = *id.raw();
+        }
+        self
+    }
+
+    /// Setter for the id of the oldest commit to consider.
+    pub fn oldest_commit(&mut self, id: Oid) -> &mut BlameOptions {
+        unsafe {
+            self.raw.oldest_commit = *id.raw();
+        }
+        self
+    }
+
+    /// The first line in the file to blame.
+    pub fn min_line(&mut self, lineno: usize) -> &mut BlameOptions {
+        self.raw.min_line = lineno;
+        self
+    }
+
+    /// The last line in the file to blame.
+    pub fn max_line(&mut self, lineno: usize) -> &mut BlameOptions {
+        self.raw.max_line = lineno;
+        self
+    }
+}
+
+impl<'repo> Binding for Blame<'repo> {
+    type Raw = *mut raw::git_blame;
+
+    unsafe fn from_raw(raw: *mut raw::git_blame) -> Blame<'repo> {
+        Blame {
+            raw,
+            _marker: marker::PhantomData,
+        }
+    }
+
+    fn raw(&self) -> *mut raw::git_blame {
+        self.raw
+    }
+}
+
+impl<'repo> Drop for Blame<'repo> {
+    fn drop(&mut self) {
+        unsafe { raw::git_blame_free(self.raw) }
+    }
+}
+
+impl<'blame> Binding for BlameHunk<'blame> {
+    type Raw = *mut raw::git_blame_hunk;
+
+    unsafe fn from_raw(raw: *mut raw::git_blame_hunk) -> BlameHunk<'blame> {
+        BlameHunk {
+            raw,
+            _marker: marker::PhantomData,
+        }
+    }
+
+    fn raw(&self) -> *mut raw::git_blame_hunk {
+        self.raw
+    }
+}
+
+impl Binding for BlameOptions {
+    type Raw = *mut raw::git_blame_options;
+
+    unsafe fn from_raw(opts: *mut raw::git_blame_options) -> BlameOptions {
+        BlameOptions { raw: *opts }
+    }
+
+    fn raw(&self) -> *mut raw::git_blame_options {
+        &self.raw as *const _ as *mut _
+    }
+}
+
+impl<'blame> Iterator for BlameIter<'blame> {
+    type Item = BlameHunk<'blame>;
+    fn next(&mut self) -> Option<BlameHunk<'blame>> {
+        self.range.next().and_then(|i| self.blame.get_index(i))
+    }
+
+    fn size_hint(&self) -> (usize, Option<usize>) {
+        self.range.size_hint()
+    }
+}
+
+impl<'blame> DoubleEndedIterator for BlameIter<'blame> {
+    fn next_back(&mut self) -> Option<BlameHunk<'blame>> {
+        self.range.next_back().and_then(|i| self.blame.get_index(i))
+    }
+}
+
+impl<'blame> ExactSizeIterator for BlameIter<'blame> {}
+
+#[cfg(test)]
+mod tests {
+    use std::fs::{self, File};
+    use std::path::Path;
+
+    #[test]
+    fn smoke() {
+        let (_td, repo) = crate::test::repo_init();
+        let mut index = repo.index().unwrap();
+
+        let root = repo.workdir().unwrap();
+        fs::create_dir(&root.join("foo")).unwrap();
+        File::create(&root.join("foo/bar")).unwrap();
+        index.add_path(Path::new("foo/bar")).unwrap();
+
+        let id = index.write_tree().unwrap();
+        let tree = repo.find_tree(id).unwrap();
+        let sig = repo.signature().unwrap();
+        let id = repo.refname_to_id("HEAD").unwrap();
+        let parent = repo.find_commit(id).unwrap();
+        let commit = repo
+            .commit(Some("HEAD"), &sig, &sig, "commit", &tree, &[&parent])
+            .unwrap();
+
+        let blame = repo.blame_file(Path::new("foo/bar"), None).unwrap();
+
+        assert_eq!(blame.len(), 1);
+        assert_eq!(blame.iter().count(), 1);
+
+        let hunk = blame.get_index(0).unwrap();
+        assert_eq!(hunk.final_commit_id(), commit);
+        assert_eq!(hunk.final_signature().name(), sig.name());
+        assert_eq!(hunk.final_signature().email(), sig.email());
+        assert_eq!(hunk.final_start_line(), 1);
+        assert_eq!(hunk.path(), Some(Path::new("foo/bar")));
+        assert_eq!(hunk.lines_in_hunk(), 0);
+        assert!(!hunk.is_boundary())
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/blob.rs b/android/vendor/git2-0.14.4/src/blob.rs
new file mode 100644
index 0000000..5c4a6ce
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/blob.rs
@@ -0,0 +1,208 @@
+use std::io;
+use std::marker;
+use std::mem;
+use std::slice;
+
+use crate::util::Binding;
+use crate::{raw, Error, Object, Oid};
+
+/// A structure to represent a git [blob][1]
+///
+/// [1]: http://git-scm.com/book/en/Git-Internals-Git-Objects
+pub struct Blob<'repo> {
+    raw: *mut raw::git_blob,
+    _marker: marker::PhantomData<Object<'repo>>,
+}
+
+impl<'repo> Blob<'repo> {
+    /// Get the id (SHA1) of a repository blob
+    pub fn id(&self) -> Oid {
+        unsafe { Binding::from_raw(raw::git_blob_id(&*self.raw)) }
+    }
+
+    /// Determine if the blob content is most certainly binary or not.
+    pub fn is_binary(&self) -> bool {
+        unsafe { raw::git_blob_is_binary(&*self.raw) == 1 }
+    }
+
+    /// Get the content of this blob.
+    pub fn content(&self) -> &[u8] {
+        unsafe {
+            let data = raw::git_blob_rawcontent(&*self.raw) as *const u8;
+            let len = raw::git_blob_rawsize(&*self.raw) as usize;
+            slice::from_raw_parts(data, len)
+        }
+    }
+
+    /// Get the size in bytes of the contents of this blob.
+    pub fn size(&self) -> usize {
+        unsafe { raw::git_blob_rawsize(&*self.raw) as usize }
+    }
+
+    /// Casts this Blob to be usable as an `Object`
+    pub fn as_object(&self) -> &Object<'repo> {
+        unsafe { &*(self as *const _ as *const Object<'repo>) }
+    }
+
+    /// Consumes Blob to be returned as an `Object`
+    pub fn into_object(self) -> Object<'repo> {
+        assert_eq!(mem::size_of_val(&self), mem::size_of::<Object<'_>>());
+        unsafe { mem::transmute(self) }
+    }
+}
+
+impl<'repo> Binding for Blob<'repo> {
+    type Raw = *mut raw::git_blob;
+
+    unsafe fn from_raw(raw: *mut raw::git_blob) -> Blob<'repo> {
+        Blob {
+            raw,
+            _marker: marker::PhantomData,
+        }
+    }
+    fn raw(&self) -> *mut raw::git_blob {
+        self.raw
+    }
+}
+
+impl<'repo> std::fmt::Debug for Blob<'repo> {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
+        f.debug_struct("Blob").field("id", &self.id()).finish()
+    }
+}
+
+impl<'repo> Clone for Blob<'repo> {
+    fn clone(&self) -> Self {
+        self.as_object().clone().into_blob().ok().unwrap()
+    }
+}
+
+impl<'repo> Drop for Blob<'repo> {
+    fn drop(&mut self) {
+        unsafe { raw::git_blob_free(self.raw) }
+    }
+}
+
+/// A structure to represent a git writestream for blobs
+pub struct BlobWriter<'repo> {
+    raw: *mut raw::git_writestream,
+    need_cleanup: bool,
+    _marker: marker::PhantomData<Object<'repo>>,
+}
+
+impl<'repo> BlobWriter<'repo> {
+    /// Finalize blob writing stream and write the blob to the object db
+    pub fn commit(mut self) -> Result<Oid, Error> {
+        // After commit we already doesn't need cleanup on drop
+        self.need_cleanup = false;
+        let mut raw = raw::git_oid {
+            id: [0; raw::GIT_OID_RAWSZ],
+        };
+        unsafe {
+            try_call!(raw::git_blob_create_fromstream_commit(&mut raw, self.raw));
+            Ok(Binding::from_raw(&raw as *const _))
+        }
+    }
+}
+
+impl<'repo> Binding for BlobWriter<'repo> {
+    type Raw = *mut raw::git_writestream;
+
+    unsafe fn from_raw(raw: *mut raw::git_writestream) -> BlobWriter<'repo> {
+        BlobWriter {
+            raw,
+            need_cleanup: true,
+            _marker: marker::PhantomData,
+        }
+    }
+    fn raw(&self) -> *mut raw::git_writestream {
+        self.raw
+    }
+}
+
+impl<'repo> Drop for BlobWriter<'repo> {
+    fn drop(&mut self) {
+        // We need cleanup in case the stream has not been committed
+        if self.need_cleanup {
+            unsafe {
+                if let Some(f) = (*self.raw).free {
+                    f(self.raw)
+                }
+            }
+        }
+    }
+}
+
+impl<'repo> io::Write for BlobWriter<'repo> {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        unsafe {
+            if let Some(f) = (*self.raw).write {
+                let res = f(self.raw, buf.as_ptr() as *const _, buf.len());
+                if res < 0 {
+                    Err(io::Error::new(io::ErrorKind::Other, "Write error"))
+                } else {
+                    Ok(buf.len())
+                }
+            } else {
+                Err(io::Error::new(io::ErrorKind::Other, "no write callback"))
+            }
+        }
+    }
+    fn flush(&mut self) -> io::Result<()> {
+        Ok(())
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::Repository;
+    use std::fs::File;
+    use std::io::prelude::*;
+    use std::path::Path;
+    use tempfile::TempDir;
+
+    #[test]
+    fn buffer() {
+        let td = TempDir::new().unwrap();
+        let repo = Repository::init(td.path()).unwrap();
+        let id = repo.blob(&[5, 4, 6]).unwrap();
+        let blob = repo.find_blob(id).unwrap();
+
+        assert_eq!(blob.id(), id);
+        assert_eq!(blob.size(), 3);
+        assert_eq!(blob.content(), [5, 4, 6]);
+        assert!(blob.is_binary());
+
+        repo.find_object(id, None).unwrap().as_blob().unwrap();
+        repo.find_object(id, None)
+            .unwrap()
+            .into_blob()
+            .ok()
+            .unwrap();
+    }
+
+    #[test]
+    fn path() {
+        let td = TempDir::new().unwrap();
+        let path = td.path().join("foo");
+        File::create(&path).unwrap().write_all(&[7, 8, 9]).unwrap();
+        let repo = Repository::init(td.path()).unwrap();
+        let id = repo.blob_path(&path).unwrap();
+        let blob = repo.find_blob(id).unwrap();
+        assert_eq!(blob.content(), [7, 8, 9]);
+        blob.into_object();
+    }
+
+    #[test]
+    fn stream() {
+        let td = TempDir::new().unwrap();
+        let repo = Repository::init(td.path()).unwrap();
+        let mut ws = repo.blob_writer(Some(Path::new("foo"))).unwrap();
+        let wl = ws.write(&[10, 11, 12]).unwrap();
+        assert_eq!(wl, 3);
+        let id = ws.commit().unwrap();
+        let blob = repo.find_blob(id).unwrap();
+        assert_eq!(blob.content(), [10, 11, 12]);
+        blob.into_object();
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/branch.rs b/android/vendor/git2-0.14.4/src/branch.rs
new file mode 100644
index 0000000..e1eba99
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/branch.rs
@@ -0,0 +1,197 @@
+use std::ffi::CString;
+use std::marker;
+use std::ptr;
+use std::str;
+
+use crate::util::Binding;
+use crate::{raw, BranchType, Error, Reference, References};
+
+/// A structure to represent a git [branch][1]
+///
+/// A branch is currently just a wrapper to an underlying `Reference`. The
+/// reference can be accessed through the `get` and `into_reference` methods.
+///
+/// [1]: http://git-scm.com/book/en/Git-Branching-What-a-Branch-Is
+pub struct Branch<'repo> {
+    inner: Reference<'repo>,
+}
+
+/// An iterator over the branches inside of a repository.
+pub struct Branches<'repo> {
+    raw: *mut raw::git_branch_iterator,
+    _marker: marker::PhantomData<References<'repo>>,
+}
+
+impl<'repo> Branch<'repo> {
+    /// Creates Branch type from a Reference
+    pub fn wrap(reference: Reference<'_>) -> Branch<'_> {
+        Branch { inner: reference }
+    }
+
+    /// Ensure the branch name is well-formed.
+    pub fn name_is_valid(name: &str) -> Result<bool, Error> {
+        crate::init();
+        let name = CString::new(name)?;
+        let mut valid: libc::c_int = 0;
+        unsafe {
+            try_call!(raw::git_branch_name_is_valid(&mut valid, name.as_ptr()));
+        }
+        Ok(valid == 1)
+    }
+
+    /// Gain access to the reference that is this branch
+    pub fn get(&self) -> &Reference<'repo> {
+        &self.inner
+    }
+
+    /// Gain mutable access to the reference that is this branch
+    pub fn get_mut(&mut self) -> &mut Reference<'repo> {
+        &mut self.inner
+    }
+
+    /// Take ownership of the underlying reference.
+    pub fn into_reference(self) -> Reference<'repo> {
+        self.inner
+    }
+
+    /// Delete an existing branch reference.
+    pub fn delete(&mut self) -> Result<(), Error> {
+        unsafe {
+            try_call!(raw::git_branch_delete(self.get().raw()));
+        }
+        Ok(())
+    }
+
+    /// Determine if the current local branch is pointed at by HEAD.
+    pub fn is_head(&self) -> bool {
+        unsafe { raw::git_branch_is_head(&*self.get().raw()) == 1 }
+    }
+
+    /// Move/rename an existing local branch reference.
+    pub fn rename(&mut self, new_branch_name: &str, force: bool) -> Result<Branch<'repo>, Error> {
+        let mut ret = ptr::null_mut();
+        let new_branch_name = CString::new(new_branch_name)?;
+        unsafe {
+            try_call!(raw::git_branch_move(
+                &mut ret,
+                self.get().raw(),
+                new_branch_name,
+                force
+            ));
+            Ok(Branch::wrap(Binding::from_raw(ret)))
+        }
+    }
+
+    /// Return the name of the given local or remote branch.
+    ///
+    /// May return `Ok(None)` if the name is not valid utf-8.
+    pub fn name(&self) -> Result<Option<&str>, Error> {
+        self.name_bytes().map(|s| str::from_utf8(s).ok())
+    }
+
+    /// Return the name of the given local or remote branch.
+    pub fn name_bytes(&self) -> Result<&[u8], Error> {
+        let mut ret = ptr::null();
+        unsafe {
+            try_call!(raw::git_branch_name(&mut ret, &*self.get().raw()));
+            Ok(crate::opt_bytes(self, ret).unwrap())
+        }
+    }
+
+    /// Return the reference supporting the remote tracking branch, given a
+    /// local branch reference.
+    pub fn upstream(&self) -> Result<Branch<'repo>, Error> {
+        let mut ret = ptr::null_mut();
+        unsafe {
+            try_call!(raw::git_branch_upstream(&mut ret, &*self.get().raw()));
+            Ok(Branch::wrap(Binding::from_raw(ret)))
+        }
+    }
+
+    /// Set the upstream configuration for a given local branch.
+    ///
+    /// If `None` is specified, then the upstream branch is unset. The name
+    /// provided is the name of the branch to set as upstream.
+    pub fn set_upstream(&mut self, upstream_name: Option<&str>) -> Result<(), Error> {
+        let upstream_name = crate::opt_cstr(upstream_name)?;
+        unsafe {
+            try_call!(raw::git_branch_set_upstream(
+                self.get().raw(),
+                upstream_name
+            ));
+            Ok(())
+        }
+    }
+}
+
+impl<'repo> Branches<'repo> {
+    /// Creates a new iterator from the raw pointer given.
+    ///
+    /// This function is unsafe as it is not guaranteed that `raw` is a valid
+    /// pointer.
+    pub unsafe fn from_raw(raw: *mut raw::git_branch_iterator) -> Branches<'repo> {
+        Branches {
+            raw,
+            _marker: marker::PhantomData,
+        }
+    }
+}
+
+impl<'repo> Iterator for Branches<'repo> {
+    type Item = Result<(Branch<'repo>, BranchType), Error>;
+    fn next(&mut self) -> Option<Result<(Branch<'repo>, BranchType), Error>> {
+        let mut ret = ptr::null_mut();
+        let mut typ = raw::GIT_BRANCH_LOCAL;
+        unsafe {
+            try_call_iter!(raw::git_branch_next(&mut ret, &mut typ, self.raw));
+            let typ = match typ {
+                raw::GIT_BRANCH_LOCAL => BranchType::Local,
+                raw::GIT_BRANCH_REMOTE => BranchType::Remote,
+                n => panic!("unexected branch type: {}", n),
+            };
+            Some(Ok((Branch::wrap(Binding::from_raw(ret)), typ)))
+        }
+    }
+}
+
+impl<'repo> Drop for Branches<'repo> {
+    fn drop(&mut self) {
+        unsafe { raw::git_branch_iterator_free(self.raw) }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use crate::{Branch, BranchType};
+
+    #[test]
+    fn smoke() {
+        let (_td, repo) = crate::test::repo_init();
+        let head = repo.head().unwrap();
+        let target = head.target().unwrap();
+        let commit = repo.find_commit(target).unwrap();
+
+        let mut b1 = repo.branch("foo", &commit, false).unwrap();
+        assert!(!b1.is_head());
+        repo.branch("foo2", &commit, false).unwrap();
+
+        assert_eq!(repo.branches(None).unwrap().count(), 3);
+        repo.find_branch("foo", BranchType::Local).unwrap();
+        let mut b1 = b1.rename("bar", false).unwrap();
+        assert_eq!(b1.name().unwrap(), Some("bar"));
+        assert!(b1.upstream().is_err());
+        b1.set_upstream(Some("main")).unwrap();
+        b1.upstream().unwrap();
+        b1.set_upstream(None).unwrap();
+
+        b1.delete().unwrap();
+    }
+
+    #[test]
+    fn name_is_valid() {
+        assert!(Branch::name_is_valid("foo").unwrap());
+        assert!(!Branch::name_is_valid("").unwrap());
+        assert!(!Branch::name_is_valid("with spaces").unwrap());
+        assert!(!Branch::name_is_valid("~tilde").unwrap());
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/buf.rs b/android/vendor/git2-0.14.4/src/buf.rs
new file mode 100644
index 0000000..fd2bcbf
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/buf.rs
@@ -0,0 +1,71 @@
+use std::ops::{Deref, DerefMut};
+use std::ptr;
+use std::slice;
+use std::str;
+
+use crate::raw;
+use crate::util::Binding;
+
+/// A structure to wrap an intermediate buffer used by libgit2.
+///
+/// A buffer can be thought of a `Vec<u8>`, but the `Vec` type is not used to
+/// avoid copying data back and forth.
+pub struct Buf {
+    raw: raw::git_buf,
+}
+
+impl Default for Buf {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl Buf {
+    /// Creates a new empty buffer.
+    pub fn new() -> Buf {
+        crate::init();
+        unsafe {
+            Binding::from_raw(&mut raw::git_buf {
+                ptr: ptr::null_mut(),
+                size: 0,
+                reserved: 0,
+            } as *mut _)
+        }
+    }
+
+    /// Attempt to view this buffer as a string slice.
+    ///
+    /// Returns `None` if the buffer is not valid utf-8.
+    pub fn as_str(&self) -> Option<&str> {
+        str::from_utf8(&**self).ok()
+    }
+}
+
+impl Deref for Buf {
+    type Target = [u8];
+    fn deref(&self) -> &[u8] {
+        unsafe { slice::from_raw_parts(self.raw.ptr as *const u8, self.raw.size as usize) }
+    }
+}
+
+impl DerefMut for Buf {
+    fn deref_mut(&mut self) -> &mut [u8] {
+        unsafe { slice::from_raw_parts_mut(self.raw.ptr as *mut u8, self.raw.size as usize) }
+    }
+}
+
+impl Binding for Buf {
+    type Raw = *mut raw::git_buf;
+    unsafe fn from_raw(raw: *mut raw::git_buf) -> Buf {
+        Buf { raw: *raw }
+    }
+    fn raw(&self) -> *mut raw::git_buf {
+        &self.raw as *const _ as *mut _
+    }
+}
+
+impl Drop for Buf {
+    fn drop(&mut self) {
+        unsafe { raw::git_buf_dispose(&mut self.raw) }
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/build.rs b/android/vendor/git2-0.14.4/src/build.rs
new file mode 100644
index 0000000..5b5cd15
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/build.rs
@@ -0,0 +1,853 @@
+//! Builder-pattern objects for configuration various git operations.
+
+use libc::{c_char, c_int, c_uint, c_void, size_t};
+use std::ffi::{CStr, CString};
+use std::mem;
+use std::path::Path;
+use std::ptr;
+
+use crate::util::{self, Binding};
+use crate::{panic, raw, Error, FetchOptions, IntoCString, Oid, Repository, Tree};
+use crate::{CheckoutNotificationType, DiffFile, FileMode, Remote};
+
+/// A builder struct which is used to build configuration for cloning a new git
+/// repository.
+///
+/// # Example
+///
+/// Cloning using SSH:
+///
+/// ```no_run
+/// use git2::{Cred, Error, RemoteCallbacks};
+/// use std::env;
+/// use std::path::Path;
+///
+///   // Prepare callbacks.
+///   let mut callbacks = RemoteCallbacks::new();
+///   callbacks.credentials(|_url, username_from_url, _allowed_types| {
+///     Cred::ssh_key(
+///       username_from_url.unwrap(),
+///       None,
+///       Path::new(&format!("{}/.ssh/id_rsa", env::var("HOME").unwrap())),
+///       None,
+///     )
+///   });
+///
+///   // Prepare fetch options.
+///   let mut fo = git2::FetchOptions::new();
+///   fo.remote_callbacks(callbacks);
+///
+///   // Prepare builder.
+///   let mut builder = git2::build::RepoBuilder::new();
+///   builder.fetch_options(fo);
+///
+///   // Clone the project.
+///   builder.clone(
+///     "git@github.com:rust-lang/git2-rs.git",
+///     Path::new("/tmp/git2-rs"),
+///   );
+/// ```
+pub struct RepoBuilder<'cb> {
+    bare: bool,
+    branch: Option<CString>,
+    local: bool,
+    hardlinks: bool,
+    checkout: Option<CheckoutBuilder<'cb>>,
+    fetch_opts: Option<FetchOptions<'cb>>,
+    clone_local: Option<CloneLocal>,
+    remote_create: Option<Box<RemoteCreate<'cb>>>,
+}
+
+/// Type of callback passed to `RepoBuilder::remote_create`.
+///
+/// The second and third arguments are the remote's name and the remote's url.
+pub type RemoteCreate<'cb> =
+    dyn for<'a> FnMut(&'a Repository, &str, &str) -> Result<Remote<'a>, Error> + 'cb;
+
+/// A builder struct for git tree updates, for use with `git_tree_create_updated`.
+pub struct TreeUpdateBuilder {
+    updates: Vec<raw::git_tree_update>,
+    paths: Vec<CString>,
+}
+
+/// A builder struct for configuring checkouts of a repository.
+pub struct CheckoutBuilder<'cb> {
+    their_label: Option<CString>,
+    our_label: Option<CString>,
+    ancestor_label: Option<CString>,
+    target_dir: Option<CString>,
+    paths: Vec<CString>,
+    path_ptrs: Vec<*const c_char>,
+    file_perm: Option<i32>,
+    dir_perm: Option<i32>,
+    disable_filters: bool,
+    checkout_opts: u32,
+    progress: Option<Box<Progress<'cb>>>,
+    notify: Option<Box<Notify<'cb>>>,
+    notify_flags: CheckoutNotificationType,
+}
+
+/// Checkout progress notification callback.
+///
+/// The first argument is the path for the notification, the next is the numver
+/// of completed steps so far, and the final is the total number of steps.
+pub type Progress<'a> = dyn FnMut(Option<&Path>, usize, usize) + 'a;
+
+/// Checkout notifications callback.
+///
+/// The first argument is the notification type, the next is the path for the
+/// the notification, followed by the baseline diff, target diff, and workdir diff.
+///
+/// The callback must return a bool specifying whether the checkout should
+/// continue.
+pub type Notify<'a> = dyn FnMut(
+        CheckoutNotificationType,
+        Option<&Path>,
+        Option<DiffFile<'_>>,
+        Option<DiffFile<'_>>,
+        Option<DiffFile<'_>>,
+    ) -> bool
+    + 'a;
+
+impl<'cb> Default for RepoBuilder<'cb> {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+/// Options that can be passed to `RepoBuilder::clone_local`.
+#[derive(Clone, Copy)]
+pub enum CloneLocal {
+    /// Auto-detect (default)
+    ///
+    /// Here libgit2 will bypass the git-aware transport for local paths, but
+    /// use a normal fetch for `file://` urls.
+    Auto = raw::GIT_CLONE_LOCAL_AUTO as isize,
+
+    /// Bypass the git-aware transport even for `file://` urls.
+    Local = raw::GIT_CLONE_LOCAL as isize,
+
+    /// Never bypass the git-aware transport
+    None = raw::GIT_CLONE_NO_LOCAL as isize,
+
+    /// Bypass the git-aware transport, but don't try to use hardlinks.
+    NoLinks = raw::GIT_CLONE_LOCAL_NO_LINKS as isize,
+
+    #[doc(hidden)]
+    __Nonexhaustive = 0xff,
+}
+
+impl<'cb> RepoBuilder<'cb> {
+    /// Creates a new repository builder with all of the default configuration.
+    ///
+    /// When ready, the `clone()` method can be used to clone a new repository
+    /// using this configuration.
+    pub fn new() -> RepoBuilder<'cb> {
+        crate::init();
+        RepoBuilder {
+            bare: false,
+            branch: None,
+            local: true,
+            clone_local: None,
+            hardlinks: true,
+            checkout: None,
+            fetch_opts: None,
+            remote_create: None,
+        }
+    }
+
+    /// Indicate whether the repository will be cloned as a bare repository or
+    /// not.
+    pub fn bare(&mut self, bare: bool) -> &mut RepoBuilder<'cb> {
+        self.bare = bare;
+        self
+    }
+
+    /// Specify the name of the branch to check out after the clone.
+    ///
+    /// If not specified, the remote's default branch will be used.
+    pub fn branch(&mut self, branch: &str) -> &mut RepoBuilder<'cb> {
+        self.branch = Some(CString::new(branch).unwrap());
+        self
+    }
+
+    /// Configures options for bypassing the git-aware transport on clone.
+    ///
+    /// Bypassing it means that instead of a fetch libgit2 will copy the object
+    /// database directory instead of figuring out what it needs, which is
+    /// faster. If possible, it will hardlink the files to save space.
+    pub fn clone_local(&mut self, clone_local: CloneLocal) -> &mut RepoBuilder<'cb> {
+        self.clone_local = Some(clone_local);
+        self
+    }
+
+    /// Set the flag for bypassing the git aware transport mechanism for local
+    /// paths.
+    ///
+    /// If `true`, the git-aware transport will be bypassed for local paths. If
+    /// `false`, the git-aware transport will not be bypassed.
+    #[deprecated(note = "use `clone_local` instead")]
+    #[doc(hidden)]
+    pub fn local(&mut self, local: bool) -> &mut RepoBuilder<'cb> {
+        self.local = local;
+        self
+    }
+
+    /// Set the flag for whether hardlinks are used when using a local git-aware
+    /// transport mechanism.
+    #[deprecated(note = "use `clone_local` instead")]
+    #[doc(hidden)]
+    pub fn hardlinks(&mut self, links: bool) -> &mut RepoBuilder<'cb> {
+        self.hardlinks = links;
+        self
+    }
+
+    /// Configure the checkout which will be performed by consuming a checkout
+    /// builder.
+    pub fn with_checkout(&mut self, checkout: CheckoutBuilder<'cb>) -> &mut RepoBuilder<'cb> {
+        self.checkout = Some(checkout);
+        self
+    }
+
+    /// Options which control the fetch, including callbacks.
+    ///
+    /// The callbacks are used for reporting fetch progress, and for acquiring
+    /// credentials in the event they are needed.
+    pub fn fetch_options(&mut self, fetch_opts: FetchOptions<'cb>) -> &mut RepoBuilder<'cb> {
+        self.fetch_opts = Some(fetch_opts);
+        self
+    }
+
+    /// Configures a callback used to create the git remote, prior to its being
+    /// used to perform the clone operation.
+    pub fn remote_create<F>(&mut self, f: F) -> &mut RepoBuilder<'cb>
+    where
+        F: for<'a> FnMut(&'a Repository, &str, &str) -> Result<Remote<'a>, Error> + 'cb,
+    {
+        self.remote_create = Some(Box::new(f));
+        self
+    }
+
+    /// Clone a remote repository.
+    ///
+    /// This will use the options configured so far to clone the specified url
+    /// into the specified local path.
+    pub fn clone(&mut self, url: &str, into: &Path) -> Result<Repository, Error> {
+        let mut opts: raw::git_clone_options = unsafe { mem::zeroed() };
+        unsafe {
+            try_call!(raw::git_clone_init_options(
+                &mut opts,
+                raw::GIT_CLONE_OPTIONS_VERSION
+            ));
+        }
+        opts.bare = self.bare as c_int;
+        opts.checkout_branch = self
+            .branch
+            .as_ref()
+            .map(|s| s.as_ptr())
+            .unwrap_or(ptr::null());
+
+        if let Some(ref local) = self.clone_local {
+            opts.local = *local as raw::git_clone_local_t;
+        } else {
+            opts.local = match (self.local, self.hardlinks) {
+                (true, false) => raw::GIT_CLONE_LOCAL_NO_LINKS,
+                (false, _) => raw::GIT_CLONE_NO_LOCAL,
+                (true, _) => raw::GIT_CLONE_LOCAL_AUTO,
+            };
+        }
+
+        if let Some(ref mut cbs) = self.fetch_opts {
+            opts.fetch_opts = cbs.raw();
+        }
+
+        if let Some(ref mut c) = self.checkout {
+            unsafe {
+                c.configure(&mut opts.checkout_opts);
+            }
+        }
+
+        if let Some(ref mut callback) = self.remote_create {
+            opts.remote_cb = Some(remote_create_cb);
+            opts.remote_cb_payload = callback as *mut _ as *mut _;
+        }
+
+        let url = CString::new(url)?;
+        // Normal file path OK (does not need Windows conversion).
+        let into = into.into_c_string()?;
+        let mut raw = ptr::null_mut();
+        unsafe {
+            try_call!(raw::git_clone(&mut raw, url, into, &opts));
+            Ok(Binding::from_raw(raw))
+        }
+    }
+}
+
+extern "C" fn remote_create_cb(
+    out: *mut *mut raw::git_remote,
+    repo: *mut raw::git_repository,
+    name: *const c_char,
+    url: *const c_char,
+    payload: *mut c_void,
+) -> c_int {
+    unsafe {
+        let repo = Repository::from_raw(repo);
+        let code = panic::wrap(|| {
+            let name = CStr::from_ptr(name).to_str().unwrap();
+            let url = CStr::from_ptr(url).to_str().unwrap();
+            let f = payload as *mut Box<RemoteCreate<'_>>;
+            match (*f)(&repo, name, url) {
+                Ok(remote) => {
+                    *out = crate::remote::remote_into_raw(remote);
+                    0
+                }
+                Err(e) => e.raw_code(),
+            }
+        });
+        mem::forget(repo);
+        code.unwrap_or(-1)
+    }
+}
+
+impl<'cb> Default for CheckoutBuilder<'cb> {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl<'cb> CheckoutBuilder<'cb> {
+    /// Creates a new builder for checkouts with all of its default
+    /// configuration.
+    pub fn new() -> CheckoutBuilder<'cb> {
+        crate::init();
+        CheckoutBuilder {
+            disable_filters: false,
+            dir_perm: None,
+            file_perm: None,
+            path_ptrs: Vec::new(),
+            paths: Vec::new(),
+            target_dir: None,
+            ancestor_label: None,
+            our_label: None,
+            their_label: None,
+            checkout_opts: raw::GIT_CHECKOUT_SAFE as u32,
+            progress: None,
+            notify: None,
+            notify_flags: CheckoutNotificationType::empty(),
+        }
+    }
+
+    /// Indicate that this checkout should perform a dry run by checking for
+    /// conflicts but not make any actual changes.
+    pub fn dry_run(&mut self) -> &mut CheckoutBuilder<'cb> {
+        self.checkout_opts &= !((1 << 4) - 1);
+        self.checkout_opts |= raw::GIT_CHECKOUT_NONE as u32;
+        self
+    }
+
+    /// Take any action necessary to get the working directory to match the
+    /// target including potentially discarding modified files.
+    pub fn force(&mut self) -> &mut CheckoutBuilder<'cb> {
+        self.checkout_opts &= !((1 << 4) - 1);
+        self.checkout_opts |= raw::GIT_CHECKOUT_FORCE as u32;
+        self
+    }
+
+    /// Indicate that the checkout should be performed safely, allowing new
+    /// files to be created but not overwriting extisting files or changes.
+    ///
+    /// This is the default.
+    pub fn safe(&mut self) -> &mut CheckoutBuilder<'cb> {
+        self.checkout_opts &= !((1 << 4) - 1);
+        self.checkout_opts |= raw::GIT_CHECKOUT_SAFE as u32;
+        self
+    }
+
+    fn flag(&mut self, bit: raw::git_checkout_strategy_t, on: bool) -> &mut CheckoutBuilder<'cb> {
+        if on {
+            self.checkout_opts |= bit as u32;
+        } else {
+            self.checkout_opts &= !(bit as u32);
+        }
+        self
+    }
+
+    /// In safe mode, create files that don't exist.
+    ///
+    /// Defaults to false.
+    pub fn recreate_missing(&mut self, allow: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_RECREATE_MISSING, allow)
+    }
+
+    /// In safe mode, apply safe file updates even when there are conflicts
+    /// instead of canceling the checkout.
+    ///
+    /// Defaults to false.
+    pub fn allow_conflicts(&mut self, allow: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_ALLOW_CONFLICTS, allow)
+    }
+
+    /// Remove untracked files from the working dir.
+    ///
+    /// Defaults to false.
+    pub fn remove_untracked(&mut self, remove: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_REMOVE_UNTRACKED, remove)
+    }
+
+    /// Remove ignored files from the working dir.
+    ///
+    /// Defaults to false.
+    pub fn remove_ignored(&mut self, remove: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_REMOVE_IGNORED, remove)
+    }
+
+    /// Only update the contents of files that already exist.
+    ///
+    /// If set, files will not be created or deleted.
+    ///
+    /// Defaults to false.
+    pub fn update_only(&mut self, update: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_UPDATE_ONLY, update)
+    }
+
+    /// Prevents checkout from writing the updated files' information to the
+    /// index.
+    ///
+    /// Defaults to true.
+    pub fn update_index(&mut self, update: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_DONT_UPDATE_INDEX, !update)
+    }
+
+    /// Indicate whether the index and git attributes should be refreshed from
+    /// disk before any operations.
+    ///
+    /// Defaults to true,
+    pub fn refresh(&mut self, refresh: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_NO_REFRESH, !refresh)
+    }
+
+    /// Skip files with unmerged index entries.
+    ///
+    /// Defaults to false.
+    pub fn skip_unmerged(&mut self, skip: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_SKIP_UNMERGED, skip)
+    }
+
+    /// Indicate whether the checkout should proceed on conflicts by using the
+    /// stage 2 version of the file ("ours").
+    ///
+    /// Defaults to false.
+    pub fn use_ours(&mut self, ours: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_USE_OURS, ours)
+    }
+
+    /// Indicate whether the checkout should proceed on conflicts by using the
+    /// stage 3 version of the file ("theirs").
+    ///
+    /// Defaults to false.
+    pub fn use_theirs(&mut self, theirs: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_USE_THEIRS, theirs)
+    }
+
+    /// Indicate whether ignored files should be overwritten during the checkout.
+    ///
+    /// Defaults to true.
+    pub fn overwrite_ignored(&mut self, overwrite: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_DONT_OVERWRITE_IGNORED, !overwrite)
+    }
+
+    /// Indicate whether a normal merge file should be written for conflicts.
+    ///
+    /// Defaults to false.
+    pub fn conflict_style_merge(&mut self, on: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_CONFLICT_STYLE_MERGE, on)
+    }
+
+    /// Specify for which notification types to invoke the notification
+    /// callback.
+    ///
+    /// Defaults to none.
+    pub fn notify_on(
+        &mut self,
+        notification_types: CheckoutNotificationType,
+    ) -> &mut CheckoutBuilder<'cb> {
+        self.notify_flags = notification_types;
+        self
+    }
+
+    /// Indicates whether to include common ancestor data in diff3 format files
+    /// for conflicts.
+    ///
+    /// Defaults to false.
+    pub fn conflict_style_diff3(&mut self, on: bool) -> &mut CheckoutBuilder<'cb> {
+        self.flag(raw::GIT_CHECKOUT_CONFLICT_STYLE_DIFF3, on)
+    }
+
+    /// Indicate whether to apply filters like CRLF conversion.
+    pub fn disable_filters(&mut self, disable: bool) -> &mut CheckoutBuilder<'cb> {
+        self.disable_filters = disable;
+        self
+    }
+
+    /// Set the mode with which new directories are created.
+    ///
+    /// Default is 0755
+    pub fn dir_perm(&mut self, perm: i32) -> &mut CheckoutBuilder<'cb> {
+        self.dir_perm = Some(perm);
+        self
+    }
+
+    /// Set the mode with which new files are created.
+    ///
+    /// The default is 0644 or 0755 as dictated by the blob.
+    pub fn file_perm(&mut self, perm: i32) -> &mut CheckoutBuilder<'cb> {
+        self.file_perm = Some(perm);
+        self
+    }
+
+    /// Add a path to be checked out.
+    ///
+    /// If no paths are specified, then all files are checked out. Otherwise
+    /// only these specified paths are checked out.
+    pub fn path<T: IntoCString>(&mut self, path: T) -> &mut CheckoutBuilder<'cb> {
+        let path = util::cstring_to_repo_path(path).unwrap();
+        self.path_ptrs.push(path.as_ptr());
+        self.paths.push(path);
+        self
+    }
+
+    /// Set the directory to check out to
+    pub fn target_dir(&mut self, dst: &Path) -> &mut CheckoutBuilder<'cb> {
+        // Normal file path OK (does not need Windows conversion).
+        self.target_dir = Some(dst.into_c_string().unwrap());
+        self
+    }
+
+    /// The name of the common ancestor side of conflicts
+    pub fn ancestor_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb> {
+        self.ancestor_label = Some(CString::new(label).unwrap());
+        self
+    }
+
+    /// The name of the common our side of conflicts
+    pub fn our_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb> {
+        self.our_label = Some(CString::new(label).unwrap());
+        self
+    }
+
+    /// The name of the common their side of conflicts
+    pub fn their_label(&mut self, label: &str) -> &mut CheckoutBuilder<'cb> {
+        self.their_label = Some(CString::new(label).unwrap());
+        self
+    }
+
+    /// Set a callback to receive notifications of checkout progress.
+    pub fn progress<F>(&mut self, cb: F) -> &mut CheckoutBuilder<'cb>
+    where
+        F: FnMut(Option<&Path>, usize, usize) + 'cb,
+    {
+        self.progress = Some(Box::new(cb) as Box<Progress<'cb>>);
+        self
+    }
+
+    /// Set a callback to receive checkout notifications.
+    ///
+    /// Callbacks are invoked prior to modifying any files on disk.
+    /// Returning `false` from the callback will cancel the checkout.
+    pub fn notify<F>(&mut self, cb: F) -> &mut CheckoutBuilder<'cb>
+    where
+        F: FnMut(
+                CheckoutNotificationType,
+                Option<&Path>,
+                Option<DiffFile<'_>>,
+                Option<DiffFile<'_>>,
+                Option<DiffFile<'_>>,
+            ) -> bool
+            + 'cb,
+    {
+        self.notify = Some(Box::new(cb) as Box<Notify<'cb>>);
+        self
+    }
+
+    /// Configure a raw checkout options based on this configuration.
+    ///
+    /// This method is unsafe as there is no guarantee that this structure will
+    /// outlive the provided checkout options.
+    pub unsafe fn configure(&mut self, opts: &mut raw::git_checkout_options) {
+        opts.version = raw::GIT_CHECKOUT_OPTIONS_VERSION;
+        opts.disable_filters = self.disable_filters as c_int;
+        opts.dir_mode = self.dir_perm.unwrap_or(0) as c_uint;
+        opts.file_mode = self.file_perm.unwrap_or(0) as c_uint;
+
+        if !self.path_ptrs.is_empty() {
+            opts.paths.strings = self.path_ptrs.as_ptr() as *mut _;
+            opts.paths.count = self.path_ptrs.len() as size_t;
+        }
+
+        if let Some(ref c) = self.target_dir {
+            opts.target_directory = c.as_ptr();
+        }
+        if let Some(ref c) = self.ancestor_label {
+            opts.ancestor_label = c.as_ptr();
+        }
+        if let Some(ref c) = self.our_label {
+            opts.our_label = c.as_ptr();
+        }
+        if let Some(ref c) = self.their_label {
+            opts.their_label = c.as_ptr();
+        }
+        if self.progress.is_some() {
+            opts.progress_cb = Some(progress_cb);
+            opts.progress_payload = self as *mut _ as *mut _;
+        }
+        if self.notify.is_some() {
+            opts.notify_cb = Some(notify_cb);
+            opts.notify_payload = self as *mut _ as *mut _;
+            opts.notify_flags = self.notify_flags.bits() as c_uint;
+        }
+        opts.checkout_strategy = self.checkout_opts as c_uint;
+    }
+}
+
+extern "C" fn progress_cb(
+    path: *const c_char,
+    completed: size_t,
+    total: size_t,
+    data: *mut c_void,
+) {
+    panic::wrap(|| unsafe {
+        let payload = &mut *(data as *mut CheckoutBuilder<'_>);
+        let callback = match payload.progress {
+            Some(ref mut c) => c,
+            None => return,
+        };
+        let path = if path.is_null() {
+            None
+        } else {
+            Some(util::bytes2path(CStr::from_ptr(path).to_bytes()))
+        };
+        callback(path, completed as usize, total as usize)
+    });
+}
+
+extern "C" fn notify_cb(
+    why: raw::git_checkout_notify_t,
+    path: *const c_char,
+    baseline: *const raw::git_diff_file,
+    target: *const raw::git_diff_file,
+    workdir: *const raw::git_diff_file,
+    data: *mut c_void,
+) -> c_int {
+    // pack callback etc
+    panic::wrap(|| unsafe {
+        let payload = &mut *(data as *mut CheckoutBuilder<'_>);
+        let callback = match payload.notify {
+            Some(ref mut c) => c,
+            None => return 0,
+        };
+        let path = if path.is_null() {
+            None
+        } else {
+            Some(util::bytes2path(CStr::from_ptr(path).to_bytes()))
+        };
+
+        let baseline = if baseline.is_null() {
+            None
+        } else {
+            Some(DiffFile::from_raw(baseline))
+        };
+
+        let target = if target.is_null() {
+            None
+        } else {
+            Some(DiffFile::from_raw(target))
+        };
+
+        let workdir = if workdir.is_null() {
+            None
+        } else {
+            Some(DiffFile::from_raw(workdir))
+        };
+
+        let why = CheckoutNotificationType::from_bits_truncate(why as u32);
+        let keep_going = callback(why, path, baseline, target, workdir);
+        if keep_going {
+            0
+        } else {
+            1
+        }
+    })
+    .unwrap_or(2)
+}
+
+unsafe impl Send for TreeUpdateBuilder {}
+
+impl Default for TreeUpdateBuilder {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl TreeUpdateBuilder {
+    /// Create a new empty series of updates.
+    pub fn new() -> Self {
+        Self {
+            updates: Vec::new(),
+            paths: Vec::new(),
+        }
+    }
+
+    /// Add an update removing the specified `path` from a tree.
+    pub fn remove<T: IntoCString>(&mut self, path: T) -> &mut Self {
+        let path = util::cstring_to_repo_path(path).unwrap();
+        let path_ptr = path.as_ptr();
+        self.paths.push(path);
+        self.updates.push(raw::git_tree_update {
+            action: raw::GIT_TREE_UPDATE_REMOVE,
+            id: raw::git_oid {
+                id: [0; raw::GIT_OID_RAWSZ],
+            },
+            filemode: raw::GIT_FILEMODE_UNREADABLE,
+            path: path_ptr,
+        });
+        self
+    }
+
+    /// Add an update setting the specified `path` to a specific Oid, whether it currently exists
+    /// or not.
+    ///
+    /// Note that libgit2 does not support an upsert of a previously removed path, or an upsert
+    /// that changes the type of an object (such as from tree to blob or vice versa).
+    pub fn upsert<T: IntoCString>(&mut self, path: T, id: Oid, filemode: FileMode) -> &mut Self {
+        let path = util::cstring_to_repo_path(path).unwrap();
+        let path_ptr = path.as_ptr();
+        self.paths.push(path);
+        self.updates.push(raw::git_tree_update {
+            action: raw::GIT_TREE_UPDATE_UPSERT,
+            id: unsafe { *id.raw() },
+            filemode: u32::from(filemode) as raw::git_filemode_t,
+            path: path_ptr,
+        });
+        self
+    }
+
+    /// Create a new tree from the specified baseline and this series of updates.
+    ///
+    /// The baseline tree must exist in the specified repository.
+    pub fn create_updated(&mut self, repo: &Repository, baseline: &Tree<'_>) -> Result<Oid, Error> {
+        let mut ret = raw::git_oid {
+            id: [0; raw::GIT_OID_RAWSZ],
+        };
+        unsafe {
+            try_call!(raw::git_tree_create_updated(
+                &mut ret,
+                repo.raw(),
+                baseline.raw(),
+                self.updates.len(),
+                self.updates.as_ptr()
+            ));
+            Ok(Binding::from_raw(&ret as *const _))
+        }
+    }
+}
+
+#[cfg(test)]
+mod tests {
+    use super::{CheckoutBuilder, RepoBuilder, TreeUpdateBuilder};
+    use crate::{CheckoutNotificationType, FileMode, Repository};
+    use std::fs;
+    use std::path::Path;
+    use tempfile::TempDir;
+
+    #[test]
+    fn smoke() {
+        let r = RepoBuilder::new().clone("/path/to/nowhere", Path::new("foo"));
+        assert!(r.is_err());
+    }
+
+    #[test]
+    fn smoke2() {
+        let td = TempDir::new().unwrap();
+        Repository::init_bare(&td.path().join("bare")).unwrap();
+        let url = if cfg!(unix) {
+            format!("file://{}/bare", td.path().display())
+        } else {
+            format!(
+                "file:///{}/bare",
+                td.path().display().to_string().replace("\\", "/")
+            )
+        };
+
+        let dst = td.path().join("foo");
+        RepoBuilder::new().clone(&url, &dst).unwrap();
+        fs::remove_dir_all(&dst).unwrap();
+        assert!(RepoBuilder::new().branch("foo").clone(&url, &dst).is_err());
+    }
+
+    #[test]
+    fn smoke_tree_create_updated() {
+        let (_tempdir, repo) = crate::test::repo_init();
+        let (_, tree_id) = crate::test::commit(&repo);
+        let tree = t!(repo.find_tree(tree_id));
+        assert!(tree.get_name("bar").is_none());
+        let foo_id = tree.get_name("foo").unwrap().id();
+        let tree2_id = t!(TreeUpdateBuilder::new()
+            .remove("foo")
+            .upsert("bar/baz", foo_id, FileMode::Blob)
+            .create_updated(&repo, &tree));
+        let tree2 = t!(repo.find_tree(tree2_id));
+        assert!(tree2.get_name("foo").is_none());
+        let baz_id = tree2.get_path(Path::new("bar/baz")).unwrap().id();
+        assert_eq!(foo_id, baz_id);
+    }
+
+    /// Issue regression test #365
+    #[test]
+    fn notify_callback() {
+        let td = TempDir::new().unwrap();
+        let cd = TempDir::new().unwrap();
+
+        {
+            let mut opts = crate::RepositoryInitOptions::new();
+            opts.initial_head("main");
+            let repo = Repository::init_opts(&td.path(), &opts).unwrap();
+
+            let mut config = repo.config().unwrap();
+            config.set_str("user.name", "name").unwrap();
+            config.set_str("user.email", "email").unwrap();
+
+            let mut index = repo.index().unwrap();
+            let p = Path::new(td.path()).join("file");
+            println!("using path {:?}", p);
+            fs::File::create(&p).unwrap();
+            index.add_path(&Path::new("file")).unwrap();
+            let id = index.write_tree().unwrap();
+
+            let tree = repo.find_tree(id).unwrap();
+            let sig = repo.signature().unwrap();
+            repo.commit(Some("HEAD"), &sig, &sig, "initial", &tree, &[])
+                .unwrap();
+        }
+
+        let repo = Repository::open_bare(&td.path().join(".git")).unwrap();
+        let tree = repo
+            .revparse_single(&"main")
+            .unwrap()
+            .peel_to_tree()
+            .unwrap();
+        let mut index = repo.index().unwrap();
+        index.read_tree(&tree).unwrap();
+
+        let mut checkout_opts = CheckoutBuilder::new();
+        checkout_opts.target_dir(&cd.path());
+        checkout_opts.notify_on(CheckoutNotificationType::all());
+        checkout_opts.notify(|_notif, _path, baseline, target, workdir| {
+            assert!(baseline.is_none());
+            assert_eq!(target.unwrap().path(), Some(Path::new("file")));
+            assert!(workdir.is_none());
+            true
+        });
+        repo.checkout_index(Some(&mut index), Some(&mut checkout_opts))
+            .unwrap();
+    }
+}
diff --git a/android/vendor/git2-0.14.4/src/call.rs b/android/vendor/git2-0.14.4/src/call.rs
new file mode 100644
index 0000000..d9fd234
--- /dev/null
+++ b/android/vendor/git2-0.14.4/src/call.rs
@@ -0,0 +1,246 @@
+#![macro_use]
+use libc;
+
+use crate::Error;
+
+macro_rules! call {
+    (raw::$p:ident ($($e:expr),*)) => (
+        raw::$p($(crate::call::convert(&$e)),*)
+    )
+}
+
+macro_rules! try_call {
+    (raw::$p:ident ($($e:expr),*)) => ({
+        match crate::call::c_try(raw::$p($(crate::call::convert(&$e)),*)) {
+            Ok(o) => o,
+            Err(e) => { crate::panic::check(); return Err(e) }
+        }
+    })
+}
+
+macro_rules! try_call_iter {
+    ($($f:tt)*) => {
+        match call!($($f)*) {
+            0 => {}
+            raw::GIT_ITEROVER => return None,
+            e => return Some(Err(crate::call::last_error(e)))
+        }
+    }
+}
+
+#[doc(hidden)]
+pub trait Convert<T> {
+    fn convert(&self) -> T;
+}
+
+pub fn convert<T, U: Convert<T>>(u: &U) -> T {
+    u.convert()
+}
+
+pub fn c_try(ret: libc::c_int) -> Result<libc::c_int, Error> {
+    match ret {
+        n if n < 0 => Err(last_error(n)),
+        n => Ok(n),
+    }
+}
+
+pub fn last_error(code: libc::c_int) -> Error {
+    // nowadays this unwrap is safe as `Error::last_error` always returns
+    // `Some`.
+    Error::last_error(code).unwrap()
+}
+
+mod impls {
+    use std::ffi::CString;
+    use std::ptr;
+
+    use libc;
+
+    use crate::call::Convert;
+    use crate::{raw, BranchType, ConfigLevel, Direction, ObjectType, ResetType};
+    use crate::{
+        AutotagOption, DiffFormat, FetchPrune, FileFavor, SubmoduleIgnore, SubmoduleUpdate,
+    };
+
+    impl<T: Copy> Convert<T> for T {
+        fn convert(&self) -> T {
+            *self
+        }
+    }
+
+    impl Convert<libc::c_int> for bool {
+        fn convert(&self) -> libc::c_int {
+            *self as libc::c_int
+        }
+    }
+    impl<'a, T> Convert<*const T> for &'a T {
+        fn convert(&self) -> *const T {
+            *self as *const T
+        }
+    }
+    impl<'a, T> Convert<*mut T> for &'a mut T {
+        fn convert(&self) -> *mut T {
+            &**self as *const T as *mut T
+        }
+    }
+    impl<T> Convert<*const T> for *mut T {
+        fn convert(&self) -> *const T {
+            *self as *const T
+        }
+    }
+
+    impl Convert<*const libc::c_char> for CString {
+        fn convert(&self) -> *const libc::c_char {
+            self.as_ptr()
+        }
+    }
+
+    impl<T, U: Convert<*const T>> Convert<*const T> for Option<U> {
+        fn convert(&self) -> *const T {
+            self.as_ref().map(|s| s.convert()).unwrap_or(ptr::null())
+        }
+    }
+
+    impl<T, U: Convert<*mut T>> Convert<*mut T> for Option<U> {
+        fn convert(&self) -> *mut T {
+            self.as_ref()
+                .map(|s| s.convert())
+                .unwrap_or(ptr::null_mut())
+        }
+    }
+
+    impl Convert<raw::git_reset_t> for ResetType {
+        fn convert(&self) -> raw::git_reset_t {
+            match *self {
+                ResetType::Soft => raw::GIT_RESET_SOFT,
+                ResetType::Hard => raw::GIT_RESET_HARD,
+                ResetType::Mixed => raw::GIT_RESET_MIXED,
+            }
+        }
+    }
+
+    impl Convert<raw::git_direction> for Direction {
+        fn convert(&self) -> raw::git_direction {
+            match *self {
+                Direction::Push => raw::GIT_DIRECTION_PUSH,
+                Direction::Fetch => raw::GIT_DIRECTION_FETCH,
+            }
+        }
+    }
+
+    impl Convert<raw::git_object_t> for ObjectType {
+        fn convert(&self) -> raw::git_object_t {
+            match *self {
+                ObjectType::Any => raw::GIT_OBJECT_ANY,
+                ObjectType::Commit => raw::GIT_OBJECT_COMMIT,
+                ObjectType::Tree => raw::GIT_OBJECT_TREE,
+                ObjectType::Blob => raw::GIT_OBJECT_BLOB,
+                ObjectType::Tag => raw::GIT_OBJECT_TAG,
+            }
+        }
+    }
+
+    impl Convert<raw::git_object_t> for Option<ObjectType> {
+        fn convert(&self) -> raw::git_object_t {
+            self.unwrap_or(ObjectType::Any).convert()
+        }
+    }
+
+    impl Convert<raw::git_branch_t> for BranchType {
+        fn convert(&self) -> raw::git_branch_t {
+            match *self {
+                BranchType::Remote => raw::GIT_BRANCH_REMOTE,
+                BranchType::Local => raw::GIT_BRANCH_LOCAL,
+            }
+        }
+    }
+
+    impl Convert<raw::git_branch_t> for Option<BranchType> {
+        fn convert(&self) -> raw::git_branch_t {
+            self.map(|s| s.convert()).unwrap_or(raw::GIT_BRANCH_ALL)
+        }
+    }
+
+    impl Convert<raw::git_config_level_t> for ConfigLevel {
+        fn convert(&self) -> raw::git_config_level_t {
+            match *self {
+                ConfigLevel::ProgramData => raw::GIT_CONFIG_LEVEL_PROGRAMDATA,
+                ConfigLevel::System => raw::GIT_CONFIG_LEVEL_SYSTEM,
+                ConfigLevel::XDG => raw::GIT_CONFIG_LEVEL_XDG,
+                ConfigLevel::Global => raw::GIT_CONFIG_LEVEL_GLOBAL,
+                ConfigLevel::Local => raw::GIT_CONFIG_LEVEL_LOCAL,
+                ConfigLevel::App => raw::GIT_CONFIG_LEVEL_APP,
+                ConfigLevel::Highest => raw::GIT_CONFIG_HIGHEST_LEVEL,
+            }
+        }
+    }
+
+    impl Convert<raw::git_diff_format_t> for DiffFormat {
+        fn convert(&self) -> raw::git_diff_format_t {
+            match *self {
+                DiffFormat::Patch => raw::GIT_DIFF_FORMAT_PATCH,
+                DiffFormat::PatchHeader => raw::GIT_DIFF_FORMAT_PATCH_HEADER,
+                DiffFormat::Raw => raw::GIT_DIFF_FORMAT_RAW,
+                DiffFormat::NameOnly => raw::GIT_DIFF_FORMAT_NAME_ONLY,
+                DiffFormat::NameStatus => raw::GIT_DIFF_FORMAT_NAME_STATUS,
+                DiffFormat::PatchId => raw::GIT_DIFF_FORMAT_PATCH_ID,
+            }
+        }
+    }
+
+    impl Convert<raw::git_merge_file_favor_t> for FileFavor {
+        fn convert(&self) -> raw::git_merge_file_favor_t {
+            match *self {
+                FileFavor::Normal => raw::GIT_MERGE_FILE_FAVOR_NORMAL,
+                FileFavor::Ours => raw::GIT_MERGE_FILE_FAVOR_OURS,
+                FileFavor::Theirs => raw::GIT_MERGE_FILE_FAVOR_THEIRS,
+                FileFavor::Union => raw::GIT_MERGE_FILE_FAVOR_UNION,
+            }
+        }
+    }
+
+    impl Convert<raw::git_submodule_ignore_t> for SubmoduleIgnore {
+        fn convert(&self) -> raw::git_submodule_ignore_t {
+            match *self {
+                SubmoduleIgnore::Unspecified => raw::GIT_SUBMODULE_IGNORE_UNSPECIFIED,
+                SubmoduleIgnore::None => raw::GIT_SUBMODULE_IGNORE_NONE,
+                SubmoduleIgnore::Untracked => raw::GIT_SUBMODULE_IGNORE_UNTRACKED,
+                SubmoduleIgnore::Dirty => raw::GIT_SUBMODULE_IGNORE_DIRTY,
+                SubmoduleIgnore::All => raw::GIT_SUBMODULE_IGNORE_ALL,
+            }
+        }
+    }
+
+    impl Convert<raw::git_submodule_update_t> for SubmoduleUpdate {
+        fn convert(&self) -> raw::git_submodule_update_t {
+            match *self {
+                SubmoduleUpdate::Checkout => raw::GIT_SUBMODULE_UPDATE_CHECKOUT,
+                SubmoduleUpdate::Rebase => raw::GIT_SUBMODULE_UPDATE_REBASE,
+                SubmoduleUpdate::Merge => raw::GIT_SUBMODULE_UPDATE_MERGE,
+                SubmoduleUpdate::None => raw::GIT_SUBMODULE_UPDATE_NONE,
+                SubmoduleUpdate::Default => raw::GIT_SUBMODULE_UPDATE_DEFAULT,
+            }
+        }
+    }
+
+    impl Convert<raw::git_remote_autotag_option_t> for AutotagOption {
+        fn convert(&self) -> raw::git_remote_autotag_option_t {
+            match *self {
+                AutotagOption::Unspecified => raw::GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED,
+                AutotagOption::None => raw::GIT_REMOTE_DOWNLOAD_TAGS_NONE,
+                AutotagOption::Auto => raw::GIT_REMOTE_DOWNLOAD_TAGS_AUTO,
+                AutotagOption::All => raw::GIT_REMOTE_DOWNLOAD_TAGS_ALL,
+            }
+        }
+    }
+</