From b137b16600793d59cd9cb501f487b1a8ffae380d Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Fri, 29 May 2020 03:22:15 +0200 Subject: [PATCH] third_party/cargo: add flatbuffers, bump --- third_party/cargo/Cargo.lock | 305 +- third_party/cargo/Cargo.toml | 7 +- third_party/cargo/patches/BUILD | 2 +- .../cargo/patches/images-fix-alias.patch | 6 +- third_party/cargo/vendor/andrew-0.2.1/BUILD | 4 +- .../android_glue-0.2.3/.cargo-checksum.json | 1 - .../vendor/android_glue-0.2.3/Cargo.toml | 8 - .../vendor/android_glue-0.2.3/src/lib.rs | 152 - .../.cargo-checksum.json | 1 + .../cargo/vendor/android_log-sys-0.1.2/BUILD | 42 + .../vendor/android_log-sys-0.1.2/Cargo.toml | 26 + .../android_log-sys-0.1.2/LICENSE-APACHE | 201 + .../vendor/android_log-sys-0.1.2/LICENSE-MIT | 19 + .../vendor/android_log-sys-0.1.2/README.md | 17 + .../vendor/android_log-sys-0.1.2/src/lib.rs | 53 + .../arrayvec-0.5.1/.cargo-checksum.json | 1 - .../cargo/vendor/arrayvec-0.5.1/Cargo.toml | 62 - .../cargo/vendor/arrayvec-0.5.1/README.rst | 259 - .../arrayvec-0.5.1/benches/arraystring.rs | 90 - .../vendor/arrayvec-0.5.1/benches/extend.rs | 78 - .../cargo/vendor/arrayvec-0.5.1/custom.css | 25 - .../cargo/vendor/arrayvec-0.5.1/src/array.rs | 144 - .../vendor/arrayvec-0.5.1/src/array_string.rs | 567 - .../cargo/vendor/arrayvec-0.5.1/src/char.rs | 98 - .../cargo/vendor/arrayvec-0.5.1/src/errors.rs | 53 - .../cargo/vendor/arrayvec-0.5.1/src/lib.rs | 1156 -- .../vendor/arrayvec-0.5.1/src/maybe_uninit.rs | 44 - .../vendor/arrayvec-0.5.1/tests/serde.rs | 79 - .../vendor/arrayvec-0.5.1/tests/tests.rs | 679 - .../vendor/atty-0.2.14/.cargo-checksum.json | 2 +- third_party/cargo/vendor/atty-0.2.14/BUILD | 2 +- .../cargo/vendor/atty-0.2.14/Cargo.lock | 49 + .../vendor/autocfg-0.1.7/.cargo-checksum.json | 2 +- .../cargo/vendor/autocfg-0.1.7/Cargo.lock | 6 + .../vendor/autocfg-1.0.0/.cargo-checksum.json | 2 +- .../cargo/vendor/autocfg-1.0.0/Cargo.lock | 6 + third_party/cargo/vendor/calloop-0.4.4/BUILD | 2 +- .../vendor/cc-1.0.50/.cargo-checksum.json | 1 - .../vendor/cc-1.0.54/.cargo-checksum.json | 1 + .../vendor/{cc-1.0.50 => cc-1.0.54}/BUILD | 4 +- third_party/cargo/vendor/cc-1.0.54/Cargo.lock | 156 + .../{cc-1.0.50 => cc-1.0.54}/Cargo.toml | 2 +- .../LICENSE-APACHE | 0 .../{cc-1.0.50 => cc-1.0.54}/LICENSE-MIT | 0 .../vendor/{cc-1.0.50 => cc-1.0.54}/README.md | 0 .../src/bin/gcc-shim.rs | 0 .../{cc-1.0.50 => cc-1.0.54}/src/com.rs | 0 .../{cc-1.0.50 => cc-1.0.54}/src/lib.rs | 361 +- .../{cc-1.0.50 => cc-1.0.54}/src/registry.rs | 0 .../src/setup_config.rs | 0 .../{cc-1.0.50 => cc-1.0.54}/src/winapi.rs | 0 .../src/windows_registry.rs | 71 +- .../{cc-1.0.50 => cc-1.0.54}/tests/cc_env.rs | 0 .../{cc-1.0.50 => cc-1.0.54}/tests/cflags.rs | 0 .../tests/cxxflags.rs | 0 .../tests/support/mod.rs | 12 + .../{cc-1.0.50 => cc-1.0.54}/tests/test.rs | 36 + .../vendor/cmake-0.1.42/.cargo-checksum.json | 1 - .../vendor/cmake-0.1.44/.cargo-checksum.json | 1 + .../{cmake-0.1.42 => cmake-0.1.44}/BUILD | 4 +- .../{cmake-0.1.42 => cmake-0.1.44}/Cargo.toml | 2 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../{cmake-0.1.42 => cmake-0.1.44}/README.md | 0 .../{cmake-0.1.42 => cmake-0.1.44}/src/lib.rs | 24 + third_party/cargo/vendor/cocoa-0.19.1/BUILD | 2 +- .../cargo/vendor/cocoa-0.20.0/Cargo.lock | 95 - .../.cargo-checksum.json | 2 +- .../{cocoa-0.20.0 => cocoa-0.20.1}/BUILD | 6 +- .../{cocoa-0.20.0 => cocoa-0.20.1}/COPYRIGHT | 0 .../cargo/vendor/cocoa-0.20.1/Cargo.lock | 93 + .../{cocoa-0.20.0 => cocoa-0.20.1}/Cargo.toml | 6 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../{cocoa-0.20.0 => cocoa-0.20.1}/README.md | 0 .../examples/color.rs | 0 .../examples/fullscreen.rs | 0 .../examples/hello_world.rs | 0 .../examples/tab_view.rs | 0 .../src/appkit.rs | 19 +- .../src/base.rs | 0 .../src/foundation.rs | 58 + .../{cocoa-0.20.0 => cocoa-0.20.1}/src/lib.rs | 0 .../src/macros.rs | 0 .../src/quartzcore.rs | 0 .../tests/foundation.rs | 0 .../cargo/vendor/core-foundation-0.6.4/BUILD | 2 +- .../cargo/vendor/core-foundation-0.7.0/BUILD | 2 +- .../cargo/vendor/core-graphics-0.17.3/BUILD | 2 +- .../cargo/vendor/core-graphics-0.19.0/BUILD | 2 +- .../core-video-sys-0.1.3/.cargo-checksum.json | 1 - .../vendor/core-video-sys-0.1.3/build.rs | 6 - .../core-video-sys-0.1.4/.cargo-checksum.json | 1 + .../BUILD | 9 +- .../Cargo.toml | 13 +- .../LICENSE | 0 .../src/base.rs | 72 +- .../src/buffer.rs | 3 +- .../src/display_link.rs | 0 .../src/host_time.rs | 8 +- .../src/image_buffer.rs | 0 .../src/lib.rs | 5 + .../src/metal_texture.rs | 0 .../src/metal_texture_cache.rs | 0 .../src/open_gl_es_texture.rs | 0 .../src/open_gl_es_texture_cache.rs | 0 .../src/opengl_buffer.rs | 2 +- .../src/opengl_buffer_pool.rs | 0 .../src/opengl_texture.rs | 0 .../src/opengl_texture_cache.rs | 0 .../src/pixel_buffer.rs | 6 +- .../src/pixel_buffer_io_surface.rs | 0 .../src/pixel_buffer_pool.rs | 0 .../src/pixel_format_description.rs | 0 .../src/return_.rs | 3 +- .../cargo/vendor/crossbeam-0.7.3/BUILD | 2 +- .../.cargo-checksum.json | 1 - .../.cargo-checksum.json | 1 + .../BUILD | 8 +- .../CHANGELOG.md | 4 + .../Cargo.toml | 14 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../LICENSE-THIRD-PARTY | 0 .../README.md | 20 +- .../src/array_queue.rs | 50 +- .../src/err.rs | 24 +- .../src/lib.rs | 27 +- .../src/seg_queue.rs | 43 +- .../tests/array_queue.rs | 4 - .../tests/seg_queue.rs | 4 - .../vendor/deflate-0.8.3/.cargo-checksum.json | 1 - .../vendor/deflate-0.8.4/.cargo-checksum.json | 1 + .../{deflate-0.8.3 => deflate-0.8.4}/BUILD | 2 +- .../Cargo.toml | 2 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 0 .../benches/bench.rs | 0 .../cargo/vendor/deflate-0.8.4/changelog.md | 4 + .../src/bit_reverse.rs | 0 .../src/bitstream.rs | 0 .../src/chained_hash_table.rs | 0 .../src/checksum.rs | 0 .../src/compress.rs | 0 .../src/compression_options.rs | 0 .../src/deflate_state.rs | 0 .../src/encoder_state.rs | 0 .../src/huffman_lengths.rs | 0 .../src/huffman_table.rs | 0 .../src/input_buffer.rs | 0 .../src/length_encode.rs | 0 .../src/lib.rs | 0 .../src/lz77.rs | 6 +- .../src/lzvalue.rs | 0 .../src/matching.rs | 0 .../src/output_writer.rs | 0 .../src/rle.rs | 0 .../src/stored_block.rs | 0 .../src/test_utils.rs | 0 .../src/writer.rs | 0 .../src/zlib.rs | 0 .../derivative-2.1.1/.cargo-checksum.json | 1 + .../cargo/vendor/derivative-2.1.1/BUILD | 112 + .../vendor/derivative-2.1.1/CHANGELOG.md | 60 + .../vendor/derivative-2.1.1/CONTRIBUTING.md | 14 + .../cargo/vendor/derivative-2.1.1/Cargo.toml | 45 + .../LICENSE-APACHE | 0 .../cargo/vendor/derivative-2.1.1/LICENSE-MIT | 19 + .../cargo/vendor/derivative-2.1.1/Makefile | 7 + .../cargo/vendor/derivative-2.1.1/README.md | 56 + .../vendor/derivative-2.1.1/appveyor.yml | 44 + .../cargo/vendor/derivative-2.1.1/book.json | 12 + .../vendor/derivative-2.1.1/doc/Clone.md | 38 + .../vendor/derivative-2.1.1/doc/Debug.md | 111 + .../vendor/derivative-2.1.1/doc/Default.md | 96 + .../cargo/vendor/derivative-2.1.1/doc/Hash.md | 65 + .../vendor/derivative-2.1.1/doc/README.md | 42 + .../vendor/derivative-2.1.1/doc/SUMMARY.md | 25 + .../cargo/vendor/derivative-2.1.1/doc/cmp.md | 93 + .../doc/debug-transparent-orig.rs | 7 + .../derivative-2.1.1/doc/debug-transparent.rs | 3 + .../derivative-2.1.1/doc/default-enum-orig.rs | 14 + .../derivative-2.1.1/doc/default-enum.rs | 9 + .../doc/default-value-orig.rs | 28 + .../derivative-2.1.1/doc/default-value.rs | 16 + .../derivative-2.1.1/doc/eq-ignore-orig.rs | 37 + .../vendor/derivative-2.1.1/doc/eq-ignore.rs | 22 + .../derivative-2.1.1/doc/styles/website.css | 11 + .../cargo/vendor/derivative-2.1.1/src/ast.rs | 153 + .../cargo/vendor/derivative-2.1.1/src/attr.rs | 873 + .../vendor/derivative-2.1.1/src/bound.rs | 174 + .../vendor/derivative-2.1.1/src/clone.rs | 195 + .../cargo/vendor/derivative-2.1.1/src/cmp.rs | 346 + .../vendor/derivative-2.1.1/src/debug.rs | 205 + .../vendor/derivative-2.1.1/src/default.rs | 120 + .../cargo/vendor/derivative-2.1.1/src/hash.rs | 97 + .../cargo/vendor/derivative-2.1.1/src/lib.rs | 89 + .../vendor/derivative-2.1.1/src/matcher.rs | 266 + .../vendor/derivative-2.1.1/src/paths.rs | 10 + .../vendor/derivative-2.1.1/src/utils.rs | 43 + .../tests/compile-fail/derive-debug.rs | 15 + .../tests/compile-fail/derive-debug.stderr | 12 + .../tests/compile-fail/derive-partial-ord.rs | 11 + .../compile-fail/derive-partial-ord.stderr | 5 + .../tests/compile-fail/invalid-attribute.rs | 23 + .../compile-fail/invalid-attribute.stderr | 23 + .../tests/compile-fail/unknown-attribute.rs | 15 + .../compile-fail/unknown-attribute.stderr | 11 + .../tests/compile-fail/unknown-derive.rs | 22 + .../tests/compile-fail/unknown-derive.stderr | 17 + .../derivative-2.1.1/tests/compile-test.rs | 9 + .../tests/derive-clone-generics.rs | 29 + .../derivative-2.1.1/tests/derive-clone.rs | 64 + .../tests/derive-debug-bounds.rs | 83 + .../tests/derive-debug-generics.rs | 91 + .../tests/derive-debug-transparent.rs | 39 + .../derivative-2.1.1/tests/derive-debug.rs | 75 + .../tests/derive-default-bounds.rs | 42 + .../derivative-2.1.1/tests/derive-default.rs | 78 + .../derivative-2.1.1/tests/derive-eq.rs | 48 + .../derivative-2.1.1/tests/derive-hash.rs | 134 + .../derivative-2.1.1/tests/derive-ord.rs | 260 + .../tests/derive-partial-eq.rs | 146 + .../tests/issue-37-turbofish.rs | 12 + .../vendor/derivative-2.1.1/tests/issue-55.rs | 21 + .../vendor/derivative-2.1.1/tests/issue-57.rs | 19 + .../vendor/derivative-2.1.1/tests/issue-58.rs | 18 + .../vendor/derivative-2.1.1/tests/issue-67.rs | 11 + .../tests/rustc-class-implement-traits.rs | 80 + .../tests/rustc-deriving-bounds.rs | 24 + .../tests/rustc-deriving-clone-array.rs | 27 + .../tests/rustc-deriving-clone-enum.rs | 32 + .../rustc-deriving-clone-generic-enum.rs | 31 + ...stc-deriving-clone-generic-tuple-struct.rs | 26 + .../tests/rustc-deriving-clone-struct.rs | 45 + .../rustc-deriving-clone-tuple-struct.rs | 24 + .../tests/rustc-deriving-cmp-generic-enum.rs | 68 + .../rustc-deriving-cmp-generic-struct-enum.rs | 66 + .../rustc-deriving-cmp-generic-struct.rs | 58 + ...rustc-deriving-cmp-generic-tuple-struct.rs | 55 + .../tests/rustc-deriving-copyclone.rs | 59 + .../tests/rustc-deriving-default-box.rs | 30 + .../rustc-deriving-enum-single-variant.rs | 30 + .../tests/rustc-deriving-hash.rs | 83 + .../tests/rustc-deriving-in-fn.rs | 27 + .../tests/rustc-deriving-meta-multiple.rs | 40 + .../tests/rustc-deriving-meta.rs | 37 + .../tests/rustc-deriving-show-2.rs | 75 + .../tests/rustc-deriving-show.rs | 51 + .../rustc-deriving-via-extension-hash-enum.rs | 36 + ...ustc-deriving-via-extension-hash-struct.rs | 34 + ...ustc-deriving-via-extension-type-params.rs | 33 + .../derivative-2.1.1/tests/rustc-expr-copy.rs | 35 + .../derivative-2.1.1/tests/rustc-exterior.rs | 41 + .../tests/rustc-issue-12860.rs | 67 + .../tests/rustc-issue-13434.rs | 38 + .../tests/rustc-issue-16530.rs | 32 + .../tests/rustc-issue-19037.rs | 38 + .../tests/rustc-issue-19102.rs | 26 + .../tests/rustc-issue-19135.rs | 30 + .../tests/rustc-issue-19358.rs | 38 + .../tests/rustc-issue-21402.rs | 29 + .../tests/rustc-issue-23649-3.rs | 23 + .../tests/rustc-issue-24085.rs | 36 + .../tests/rustc-issue-25394.rs | 26 + .../tests/rustc-issue-28561.rs | 134 + .../tests/rustc-issue-29030.rs | 27 + .../tests/rustc-issue-29540.rs | 509 + .../tests/rustc-issue-29710.rs | 29 + .../tests/rustc-issue-32292.rs | 27 + .../tests/rustc-issue-3935.rs | 29 + .../tests/rustc-issue-42453.rs | 28 + .../tests/rustc-issue-58319.rs | 644 + .../tests/rustc-issue-6341.rs | 30 + .../tests/rustc-typeclasses-eq-example.rs | 83 + .../tests/rustc-zero-sized-btreemap-insert.rs | 41 + .../vendor/dlib-0.4.1/.cargo-checksum.json | 1 - .../vendor/dlib-0.4.2/.cargo-checksum.json | 1 + .../vendor/{dlib-0.4.1 => dlib-0.4.2}/BUILD | 4 +- .../{dlib-0.4.1 => dlib-0.4.2}/Cargo.toml | 6 +- .../{dlib-0.4.1 => dlib-0.4.2}/LICENSE.txt | 0 .../{dlib-0.4.1 => dlib-0.4.2}/README.md | 0 .../{dlib-0.4.1 => dlib-0.4.2}/src/lib.rs | 0 .../env_logger-0.6.2/.cargo-checksum.json | 2 +- .../cargo/vendor/env_logger-0.6.2/BUILD | 2 +- .../cargo/vendor/env_logger-0.6.2/Cargo.lock | 212 + .../flatbuffers-0.6.1/.cargo-checksum.json | 1 + .../cargo/vendor/flatbuffers-0.6.1/BUILD | 43 + .../cargo/vendor/flatbuffers-0.6.1/Cargo.toml | 24 + .../vendor/flatbuffers-0.6.1/src/builder.rs | 698 + .../flatbuffers-0.6.1/src/endian_scalar.rs | 179 + .../vendor/flatbuffers-0.6.1/src/follow.rs | 62 + .../cargo/vendor/flatbuffers-0.6.1/src/lib.rs | 54 + .../flatbuffers-0.6.1/src/primitives.rs | 325 + .../vendor/flatbuffers-0.6.1/src/push.rs | 80 + .../vendor/flatbuffers-0.6.1/src/table.rs | 77 + .../vendor/flatbuffers-0.6.1/src/vector.rs | 275 + .../vendor/flatbuffers-0.6.1/src/vtable.rs | 91 + .../flatbuffers-0.6.1/src/vtable_writer.rs | 84 + .../vendor/fnv-1.0.6/.cargo-checksum.json | 1 - .../vendor/fnv-1.0.7/.cargo-checksum.json | 1 + .../vendor/{fnv-1.0.6 => fnv-1.0.7}/BUILD | 4 +- .../{fnv-1.0.6 => fnv-1.0.7}/Cargo.toml | 8 +- .../{fnv-1.0.6 => fnv-1.0.7}/LICENSE-APACHE | 0 .../{fnv-1.0.6 => fnv-1.0.7}/LICENSE-MIT | 0 .../vendor/{fnv-1.0.6 => fnv-1.0.7}/README.md | 2 +- .../vendor/{fnv-1.0.6 => fnv-1.0.7}/lib.rs | 96 +- .../vendor/half-1.5.0/.cargo-checksum.json | 1 - .../vendor/half-1.6.0/.cargo-checksum.json | 1 + .../vendor/{half-1.5.0 => half-1.6.0}/BUILD | 2 +- .../{half-1.5.0 => half-1.6.0}/CHANGELOG.md | 49 +- .../{half-1.5.0 => half-1.6.0}/Cargo.toml | 2 +- .../{half-1.5.0 => half-1.6.0}/LICENSE-APACHE | 0 .../{half-1.5.0 => half-1.6.0}/LICENSE-MIT | 0 .../{half-1.5.0 => half-1.6.0}/README.md | 0 .../{half-1.5.0 => half-1.6.0}/appveyor.yml | 0 .../benches/convert.rs | 0 .../{half-1.5.0 => half-1.6.0}/src/bfloat.rs | 117 + .../src/bfloat/convert.rs | 0 .../src/binary16.rs | 117 + .../src/binary16/convert.rs | 0 .../{half-1.5.0 => half-1.6.0}/src/lib.rs | 2 +- .../{half-1.5.0 => half-1.6.0}/src/slice.rs | 0 .../{half-1.5.0 => half-1.6.0}/src/vec.rs | 0 .../tests/version-numbers.rs | 5 + .../hermit-abi-0.1.13/.cargo-checksum.json | 1 + .../BUILD | 4 +- .../Cargo.toml | 3 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 5 + .../rust-toolchain | 0 .../cargo/vendor/hermit-abi-0.1.13/src/lib.rs | 393 + .../src/tcpstream.rs | 3 + .../hermit-abi-0.1.8/.cargo-checksum.json | 1 - .../cargo/vendor/hermit-abi-0.1.8/src/lib.rs | 238 - .../vendor/image-0.23.1/.cargo-checksum.json | 1 - .../vendor/image-0.23.1/benches/encode_bmp.rs | 146 - .../image-0.23.1/benches/encode_jpeg.rs | 30 - .../cargo/vendor/image-0.23.1/benches/load.rs | 84 - .../cargo/vendor/image-0.23.1/src/lib.rs | 141 - .../cargo/vendor/image-0.23.1/src/traits.rs | 75 - .../vendor/image-0.23.1/src/webp/decoder.rs | 141 - .../vendor/image-0.23.4/.cargo-checksum.json | 1 + .../{image-0.23.1 => image-0.23.4}/BUILD | 14 +- .../{image-0.23.1 => image-0.23.4}/CHANGES.md | 20 + .../{image-0.23.1 => image-0.23.4}/Cargo.toml | 16 +- .../Cargo.toml.public-private-dependencies | 4 +- .../{image-0.23.1 => image-0.23.4}/LICENSE | 0 .../{image-0.23.1 => image-0.23.4}/README.md | 2 + .../benches/README.md | 0 .../vendor/image-0.23.4/benches/decode.rs | 123 + .../vendor/image-0.23.4/benches/encode.rs | 122 + .../docs/2019-04-23-memory-unsafety.md | 0 .../{image-0.23.1 => image-0.23.4}/release.sh | 0 .../src/animation.rs | 2 +- .../src/bmp/decoder.rs | 259 +- .../src/bmp/encoder.rs | 73 - .../src/bmp/mod.rs | 0 .../src/buffer.rs | 208 +- .../src/color.rs | 13 +- .../{image-0.23.1 => image-0.23.4}/src/dds.rs | 67 +- .../{image-0.23.1 => image-0.23.4}/src/dxt.rs | 2 +- .../src/dynimage.rs | 41 +- .../src/error.rs | 95 +- .../cargo/vendor/image-0.23.4/src/farbfeld.rs | 353 + .../src/flat.rs | 29 +- .../{image-0.23.1 => image-0.23.4}/src/gif.rs | 165 +- .../src/hdr/decoder.rs | 231 +- .../src/hdr/encoder.rs | 0 .../src/hdr/mod.rs | 0 .../src/ico/decoder.rs | 140 +- .../src/ico/encoder.rs | 0 .../src/ico/mod.rs | 0 .../src/image.rs | 65 +- .../src/imageops/affine.rs | 27 +- .../src/imageops/colorops.rs | 9 +- .../src/imageops/mod.rs | 30 +- .../src/imageops/sample.rs | 6 +- .../src/io/free_functions.rs | 8 +- .../src/io/mod.rs | 0 .../src/io/reader.rs | 13 +- .../src/jpeg/decoder.rs | 10 +- .../src/jpeg/encoder.rs | 38 +- .../src/jpeg/entropy.rs | 0 .../src/jpeg/mod.rs | 0 .../src/jpeg/transform.rs | 0 .../cargo/vendor/image-0.23.4/src/lib.rs | 252 + .../src/math/mod.rs | 0 .../src/math/nq.rs | 0 .../src/math/rect.rs | 0 .../src/math/utils.rs | 0 .../{image-0.23.1 => image-0.23.4}/src/png.rs | 52 +- .../src/pnm/autobreak.rs | 0 .../src/pnm/decoder.rs | 492 +- .../src/pnm/encoder.rs | 0 .../src/pnm/header.rs | 46 +- .../src/pnm/mod.rs | 0 .../src/tga/decoder.rs | 47 +- .../src/tga/mod.rs | 0 .../src/tiff.rs | 0 .../cargo/vendor/image-0.23.4/src/traits.rs | 231 + .../src/utils/mod.rs | 0 .../vendor/image-0.23.4/src/webp/decoder.rs | 184 + .../src/webp/mod.rs | 0 .../src/webp/transform.rs | 0 .../src/webp/vp8.rs | 128 +- .../vendor/instant-0.1.2/.cargo-checksum.json | 1 - .../cargo/vendor/instant-0.1.2/src/lib.rs | 42 - .../cargo/vendor/instant-0.1.2/tests/wasm.rs | 21 - .../vendor/instant-0.1.4/.cargo-checksum.json | 1 + .../{instant-0.1.2 => instant-0.1.4}/AUTHORS | 0 .../{instant-0.1.2 => instant-0.1.4}/BUILD | 2 +- .../Cargo.toml | 31 +- .../{instant-0.1.2 => instant-0.1.4}/LICENSE | 0 .../README.md | 25 +- .../cargo/vendor/instant-0.1.4/src/lib.rs | 24 + .../src/native.rs | 0 .../src/wasm.rs | 54 +- .../cargo/vendor/instant-0.1.4/tests/wasm.rs | 46 + third_party/cargo/vendor/iovec-0.1.4/BUILD | 2 +- .../vendor/jni-sys-0.3.0/.cargo-checksum.json | 1 + .../BUILD | 6 +- .../cargo/vendor/jni-sys-0.3.0/Cargo.toml | 30 + .../cargo/vendor/jni-sys-0.3.0/LICENSE-APACHE | 202 + .../cargo/vendor/jni-sys-0.3.0/LICENSE-MIT | 19 + .../cargo/vendor/jni-sys-0.3.0/README.md | 24 + .../cargo/vendor/jni-sys-0.3.0/appveyor.yml | 19 + .../cargo/vendor/jni-sys-0.3.0/src/lib.rs | 1515 ++ .../jpeg-decoder-0.1.18/.cargo-checksum.json | 1 - .../vendor/jpeg-decoder-0.1.18/src/idct.rs | 315 - .../jpeg-decoder-0.1.19/.cargo-checksum.json | 1 + .../BUILD | 2 +- .../CHANGELOG.md | 6 + .../Cargo.lock | 60 +- .../Cargo.toml | 4 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 2 +- .../appveyor.yml | 0 .../benches/decoding_benchmark.rs | 4 + .../benches/tower.jpg | Bin .../benches/tower_grayscale.jpg | Bin 0 -> 54254 bytes .../benches/tower_progressive.jpg | Bin .../examples/decode.rs | 9 +- .../src/decoder.rs | 60 +- .../src/error.rs | 11 +- .../src/huffman.rs | 0 .../vendor/jpeg-decoder-0.1.19/src/idct.rs | 381 + .../src/lib.rs | 0 .../src/marker.rs | 0 .../src/parser.rs | 37 +- .../src/upsampler.rs | 0 .../src/worker/immediate.rs | 0 .../src/worker/mod.rs | 0 .../src/worker/threaded.rs | 0 .../vendor/libc-0.2.67/.cargo-checksum.json | 1 - .../linux/musl/b64/aarch64/align.rs | 7 - .../libc-0.2.67/src/unix/solarish/compat.rs | 32 - .../vendor/libc-0.2.71/.cargo-checksum.json | 1 + .../vendor/{libc-0.2.67 => libc-0.2.71}/BUILD | 2 +- .../CONTRIBUTING.md | 0 .../{libc-0.2.67 => libc-0.2.71}/Cargo.toml | 11 +- .../LICENSE-APACHE | 0 .../cargo/vendor/libc-0.2.71/LICENSE-MIT | 25 + .../{libc-0.2.67 => libc-0.2.71}/README.md | 2 +- .../{libc-0.2.67 => libc-0.2.71}/build.rs | 0 .../{libc-0.2.67 => libc-0.2.71}/rustfmt.toml | 0 .../src/cloudabi/aarch64.rs | 0 .../src/cloudabi/arm.rs | 0 .../src/cloudabi/mod.rs | 3 +- .../src/cloudabi/x86.rs | 0 .../src/cloudabi/x86_64.rs | 0 .../src/fixed_width_ints.rs | 0 .../src/fuchsia/aarch64.rs | 0 .../src/fuchsia/align.rs | 0 .../src/fuchsia/mod.rs | 19 +- .../src/fuchsia/no_align.rs | 0 .../src/fuchsia/x86_64.rs | 0 .../src/hermit/aarch64.rs | 0 .../src/hermit/mod.rs | 10 - .../src/hermit/x86_64.rs | 0 .../{libc-0.2.67 => libc-0.2.71}/src/lib.rs | 24 +- .../src/macros.rs | 0 .../cargo/vendor/libc-0.2.71/src/psp.rs | 47 + .../{libc-0.2.67 => libc-0.2.71}/src/sgx.rs | 0 .../src/switch.rs | 0 .../src/unix/align.rs | 0 .../src/unix/bsd/apple/b32/align.rs | 0 .../src/unix/bsd/apple/b32/mod.rs | 0 .../src/unix/bsd/apple/b64/align.rs | 0 .../src/unix/bsd/apple/b64/mod.rs | 102 + .../src/unix/bsd/apple/mod.rs | 175 +- .../unix/bsd/freebsdlike/dragonfly/errno.rs | 0 .../src/unix/bsd/freebsdlike/dragonfly/mod.rs | 0 .../unix/bsd/freebsdlike/freebsd/aarch64.rs | 0 .../src/unix/bsd/freebsdlike/freebsd/arm.rs | 0 .../bsd/freebsdlike/freebsd/freebsd11/mod.rs | 0 .../freebsdlike/freebsd/freebsd11/x86_64.rs | 0 .../bsd/freebsdlike/freebsd/freebsd12/mod.rs | 0 .../freebsdlike/freebsd/freebsd12/x86_64.rs | 0 .../src/unix/bsd/freebsdlike/freebsd/mod.rs | 25 + .../unix/bsd/freebsdlike/freebsd/powerpc64.rs | 0 .../src/unix/bsd/freebsdlike/freebsd/x86.rs | 0 .../bsd/freebsdlike/freebsd/x86_64/align.rs | 0 .../bsd/freebsdlike/freebsd/x86_64/mod.rs | 0 .../src/unix/bsd/freebsdlike/mod.rs | 92 +- .../src/unix/bsd/mod.rs | 97 +- .../src/unix/bsd/netbsdlike/mod.rs | 6 + .../src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 0 .../src/unix/bsd/netbsdlike/netbsd/arm.rs | 0 .../src/unix/bsd/netbsdlike/netbsd/mod.rs | 88 + .../src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 0 .../src/unix/bsd/netbsdlike/netbsd/sparc64.rs | 0 .../src/unix/bsd/netbsdlike/netbsd/x86.rs | 0 .../src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 0 .../unix/bsd/netbsdlike/openbsd/aarch64.rs | 0 .../src/unix/bsd/netbsdlike/openbsd/mod.rs | 8 +- .../unix/bsd/netbsdlike/openbsd/sparc64.rs | 0 .../src/unix/bsd/netbsdlike/openbsd/x86.rs | 0 .../src/unix/bsd/netbsdlike/openbsd/x86_64.rs | 0 .../src/unix/haiku/b32.rs | 0 .../src/unix/haiku/b64.rs | 0 .../src/unix/haiku/mod.rs | 42 +- .../src/unix/hermit/aarch64.rs | 0 .../src/unix/hermit/mod.rs | 14 +- .../src/unix/hermit/x86_64.rs | 0 .../src/unix/linux_like/android/b32/arm.rs | 166 + .../src/unix/linux_like/android/b32/mod.rs | 18 + .../unix/linux_like/android/b32/x86/align.rs | 0 .../unix/linux_like/android/b32/x86/mod.rs | 160 + .../linux_like/android/b64/aarch64/align.rs | 0 .../linux_like/android/b64/aarch64/mod.rs | 0 .../src/unix/linux_like/android/b64/mod.rs | 12 + .../linux_like/android/b64/x86_64/align.rs | 0 .../unix/linux_like/android/b64/x86_64/mod.rs | 238 + .../src/unix/linux_like/android/mod.rs | 167 +- .../src/unix/linux_like/emscripten/align.rs | 4 +- .../src/unix/linux_like/emscripten/mod.rs | 252 +- .../unix/linux_like/emscripten/no_align.rs | 0 .../src/unix/linux_like/linux/align.rs | 17 +- .../src/unix/linux_like/linux/gnu/align.rs | 0 .../linux_like/linux/gnu/b32/arm/align.rs | 0 .../unix/linux_like/linux/gnu/b32/arm/mod.rs | 1 + .../linux_like/linux/gnu/b32/mips/align.rs | 0 .../unix/linux_like/linux/gnu/b32/mips/mod.rs | 0 .../src/unix/linux_like/linux/gnu/b32/mod.rs | 7 + .../unix/linux_like/linux/gnu/b32/powerpc.rs | 1 + .../linux_like/linux/gnu/b32/sparc/align.rs | 0 .../linux_like/linux/gnu/b32/sparc/mod.rs | 4 + .../linux_like/linux/gnu/b32/x86/align.rs | 0 .../unix/linux_like/linux/gnu/b32/x86/mod.rs | 3 + .../linux_like/linux/gnu/b64/aarch64/align.rs | 29 + .../linux_like/linux/gnu/b64/aarch64/mod.rs | 60 +- .../linux_like/linux/gnu/b64/mips64/align.rs | 0 .../linux_like/linux/gnu/b64/mips64/mod.rs | 5 + .../src/unix/linux_like/linux/gnu/b64/mod.rs | 0 .../linux/gnu/b64/powerpc64/align.rs | 0 .../linux_like/linux/gnu/b64/powerpc64/mod.rs | 6 + .../linux_like/linux/gnu/b64/riscv64/mod.rs | 178 +- .../unix/linux_like/linux/gnu/b64/s390x.rs | 5 + .../linux_like/linux/gnu/b64/sparc64/align.rs | 0 .../linux_like/linux/gnu/b64/sparc64/mod.rs | 18 +- .../linux_like/linux/gnu/b64/x86_64/align.rs | 0 .../linux_like/linux/gnu/b64/x86_64/mod.rs | 8 + .../linux/gnu/b64/x86_64/not_x32.rs | 0 .../linux_like/linux/gnu/b64/x86_64/x32.rs | 0 .../src/unix/linux_like/linux/gnu/mod.rs | 341 +- .../src/unix/linux_like/linux/gnu/no_align.rs | 0 .../src/unix/linux_like/linux/mod.rs | 377 +- .../linux_like/linux/musl/b32/arm/align.rs | 0 .../unix/linux_like/linux/musl/b32/arm/mod.rs | 22 + .../unix/linux_like/linux/musl/b32/hexagon.rs | 4 - .../linux_like/linux/musl/b32/mips/align.rs | 0 .../linux_like/linux/musl/b32/mips/mod.rs | 21 + .../src/unix/linux_like/linux/musl/b32/mod.rs | 1 + .../unix/linux_like/linux/musl/b32/powerpc.rs | 3 + .../linux_like/linux/musl/b32/x86/align.rs | 0 .../unix/linux_like/linux/musl/b32/x86/mod.rs | 22 + .../linux/musl}/b64/aarch64/align.rs | 0 .../linux_like/linux/musl/b64/aarch64/mod.rs | 4 + .../unix/linux_like/linux/musl/b64/mips64.rs | 21 + .../src/unix/linux_like/linux/musl/b64/mod.rs | 1 + .../linux_like/linux/musl/b64/powerpc64.rs | 4 + .../linux_like/linux/musl/b64/x86_64/align.rs | 0 .../linux_like/linux/musl/b64/x86_64/mod.rs | 22 + .../src/unix/linux_like/linux/musl/mod.rs | 76 +- .../src/unix/linux_like/linux/no_align.rs | 13 + .../src/unix/linux_like/mod.rs | 74 +- .../src/unix/mod.rs | 27 +- .../src/unix/newlib/aarch64/mod.rs | 9 + .../src/unix/newlib/align.rs | 0 .../src/unix/newlib/arm/mod.rs | 11 +- .../src/unix/newlib/mod.rs | 69 +- .../src/unix/newlib/no_align.rs | 0 .../libc-0.2.71/src/unix/newlib/xtensa/mod.rs | 97 + .../src/unix/no_align.rs | 0 .../src/unix/redox/mod.rs | 51 +- .../libc-0.2.71/src/unix/solarish/compat.rs | 47 + .../libc-0.2.71/src/unix/solarish/illumos.rs | 27 + .../src/unix/solarish/mod.rs | 236 +- .../libc-0.2.71/src/unix/solarish/solaris.rs | 94 + .../src/unix/uclibc/align.rs | 0 .../src/unix/uclibc/arm/align.rs | 0 .../src/unix/uclibc/arm/mod.rs | 0 .../src/unix/uclibc/arm/no_align.rs | 0 .../src/unix/uclibc/mips/mips32/align.rs | 0 .../src/unix/uclibc/mips/mips32/mod.rs | 0 .../src/unix/uclibc/mips/mips32/no_align.rs | 0 .../src/unix/uclibc/mips/mips64/align.rs | 0 .../src/unix/uclibc/mips/mips64/mod.rs | 0 .../src/unix/uclibc/mips/mips64/no_align.rs | 0 .../src/unix/uclibc/mips/mod.rs | 0 .../src/unix/uclibc/mod.rs | 36 +- .../src/unix/uclibc/no_align.rs | 0 .../src/unix/uclibc/x86_64/align.rs | 12 +- .../src/unix/uclibc/x86_64/l4re.rs | 0 .../src/unix/uclibc/x86_64/mod.rs | 20 +- .../src/unix/uclibc/x86_64/no_align.rs | 12 +- .../src/unix/uclibc/x86_64/other.rs | 0 .../src/vxworks/aarch64.rs | 0 .../src/vxworks/arm.rs | 0 .../src/vxworks/mod.rs | 50 +- .../src/vxworks/powerpc.rs | 0 .../src/vxworks/powerpc64.rs | 0 .../src/vxworks/x86.rs | 0 .../src/vxworks/x86_64.rs | 0 .../{libc-0.2.67 => libc-0.2.71}/src/wasi.rs | 0 .../src/windows/gnu/align.rs | 0 .../src/windows/gnu/mod.rs | 8 + .../src/windows/mod.rs | 2 +- .../src/windows/msvc.rs | 0 .../tests/const_fn.rs | 0 .../cargo/vendor/libc-0.2.71/triagebot.toml | 1 + .../libloading-0.5.2/.cargo-checksum.json | 1 - .../vendor/libloading-0.5.2/appveyor.yml | 19 - .../cargo/vendor/libloading-0.5.2/build.rs | 32 - .../src/os/unix/global_static.c | 20 - .../cargo/vendor/libloading-0.5.2/src/util.rs | 61 - .../libloading-0.6.2/.cargo-checksum.json | 1 + .../BUILD | 2 +- .../Cargo.toml | 4 +- .../LICENSE | 0 .../README.mkd | 7 +- .../cargo/vendor/libloading-0.6.2/build.rs | 64 + .../src/changelog.rs | 45 + .../vendor/libloading-0.6.2/src/error.rs | 114 + .../src/lib.rs | 30 +- .../src/os/mod.rs | 0 .../src/os/unix/mod.rs | 236 +- .../src/os/windows/mod.rs | 131 +- .../src/test_helpers.rs | 0 .../cargo/vendor/libloading-0.6.2/src/util.rs | 31 + .../tests/functions.rs | 16 +- .../tests/markers.rs | 0 .../tests/nagisa32.dll | Bin .../tests/nagisa64.dll | Bin .../tests/windows.rs | 0 .../lock_api-0.3.3/.cargo-checksum.json | 1 - .../lock_api-0.3.4/.cargo-checksum.json | 1 + .../{lock_api-0.3.3 => lock_api-0.3.4}/BUILD | 2 +- .../Cargo.toml | 2 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../src/lib.rs | 4 +- .../src/mutex.rs | 18 +- .../src/remutex.rs | 24 +- .../src/rwlock.rs | 17 +- .../cargo/vendor/malloc_buf-0.0.6/BUILD | 2 +- third_party/cargo/vendor/memmap-0.7.0/BUILD | 2 +- .../vendor/mio-0.6.21/.cargo-checksum.json | 1 - .../vendor/mio-0.6.21/azure-pipelines.yml | 50 - .../vendor/mio-0.6.21/benches/bench_poll.rs | 53 - .../mio-0.6.21/ci/azure-cross-compile.yml | 56 - .../mio-0.6.21/ci/azure-deploy-docs.yml | 39 - .../mio-0.6.21/ci/azure-install-rust.yml | 32 - .../mio-0.6.21/ci/azure-test-stable.yml | 45 - .../cargo/vendor/mio-0.6.21/test/benchmark.rs | 80 - .../cargo/vendor/mio-0.6.21/test/mod.rs | 214 - .../vendor/mio-0.6.21/test/test_battery.rs | 269 - .../mio-0.6.21/test/test_broken_pipe.rs | 28 - .../mio-0.6.21/test/test_close_on_drop.rs | 119 - .../mio-0.6.21/test/test_custom_evented.rs | 394 - .../mio-0.6.21/test/test_double_register.rs | 17 - .../mio-0.6.21/test/test_echo_server.rs | 303 - .../mio-0.6.21/test/test_fuchsia_handles.rs | 30 - .../mio-0.6.21/test/test_local_addr_ready.rs | 67 - .../vendor/mio-0.6.21/test/test_multicast.rs | 107 - .../vendor/mio-0.6.21/test/test_notify.rs | 192 - .../vendor/mio-0.6.21/test/test_oneshot.rs | 64 - .../cargo/vendor/mio-0.6.21/test/test_poll.rs | 18 - .../mio-0.6.21/test/test_poll_channel.rs | 285 - .../test/test_register_deregister.rs | 123 - .../test_register_multiple_event_loops.rs | 63 - .../test/test_reregister_without_poll.rs | 28 - .../vendor/mio-0.6.21/test/test_smoke.rs | 23 - .../mio-0.6.21/test/test_subprocess_pipe.rs | 249 - .../cargo/vendor/mio-0.6.21/test/test_tcp.rs | 660 - .../vendor/mio-0.6.21/test/test_tcp_level.rs | 142 - .../mio-0.6.21/test/test_tcp_shutdown.rs | 248 - .../cargo/vendor/mio-0.6.21/test/test_tick.rs | 64 - .../vendor/mio-0.6.21/test/test_udp_level.rs | 52 - .../vendor/mio-0.6.21/test/test_udp_socket.rs | 252 - .../mio-0.6.21/test/test_uds_shutdown.rs | 300 - .../mio-0.6.21/test/test_unix_echo_server.rs | 292 - .../mio-0.6.21/test/test_unix_pass_fd.rs | 306 - .../mio-0.6.21/test/test_write_then_drop.rs | 123 - .../vendor/mio-0.6.22/.cargo-checksum.json | 1 + .../vendor/{mio-0.6.21 => mio-0.6.22}/BUILD | 7 +- .../{mio-0.6.21 => mio-0.6.22}/CHANGELOG.md | 5 + .../{mio-0.6.21 => mio-0.6.22}/Cargo.toml | 12 +- .../vendor/{mio-0.6.21 => mio-0.6.22}/LICENSE | 0 .../{mio-0.6.21 => mio-0.6.22}/README.md | 0 .../{mio-0.6.21 => mio-0.6.22}/src/channel.rs | 0 .../src/deprecated/event_loop.rs | 0 .../src/deprecated/handler.rs | 0 .../src/deprecated/io.rs | 0 .../src/deprecated/mod.rs | 0 .../src/deprecated/notify.rs | 0 .../src/deprecated/unix.rs | 0 .../src/event_imp.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/io.rs | 0 .../src/lazycell.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/lib.rs | 2 +- .../{mio-0.6.21 => mio-0.6.22}/src/net/mod.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/net/tcp.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/net/udp.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/poll.rs | 0 .../src/sys/fuchsia/awakener.rs | 0 .../src/sys/fuchsia/eventedfd.rs | 0 .../src/sys/fuchsia/handles.rs | 0 .../src/sys/fuchsia/mod.rs | 0 .../src/sys/fuchsia/net.rs | 0 .../src/sys/fuchsia/ready.rs | 0 .../src/sys/fuchsia/selector.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/sys/mod.rs | 0 .../src/sys/unix/awakener.rs | 0 .../src/sys/unix/dlsym.rs | 0 .../src/sys/unix/epoll.rs | 0 .../src/sys/unix/eventedfd.rs | 0 .../src/sys/unix/io.rs | 0 .../src/sys/unix/kqueue.rs | 0 .../src/sys/unix/mod.rs | 14 +- .../src/sys/unix/ready.rs | 45 +- .../src/sys/unix/tcp.rs | 0 .../src/sys/unix/udp.rs | 0 .../src/sys/unix/uds.rs | 0 .../src/sys/unix/uio.rs | 0 .../src/sys/windows/awakener.rs | 0 .../src/sys/windows/buffer_pool.rs | 0 .../src/sys/windows/from_raw_arc.rs | 0 .../src/sys/windows/mod.rs | 0 .../src/sys/windows/selector.rs | 0 .../src/sys/windows/tcp.rs | 0 .../src/sys/windows/udp.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/timer.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/token.rs | 0 .../{mio-0.6.21 => mio-0.6.22}/src/udp.rs | 0 .../cargo/vendor/mio-extras-2.0.6/BUILD | 2 +- third_party/cargo/vendor/miow-0.2.1/BUILD | 2 +- .../vendor/ndk-0.1.0/.cargo-checksum.json | 1 + third_party/cargo/vendor/ndk-0.1.0/BUILD | 45 + third_party/cargo/vendor/ndk-0.1.0/Cargo.toml | 46 + .../cargo/vendor/ndk-0.1.0/src/asset.rs | 259 + .../vendor/ndk-0.1.0/src/configuration.rs | 560 + .../cargo/vendor/ndk-0.1.0/src/event.rs | 1461 ++ .../cargo/vendor/ndk-0.1.0/src/input_queue.rs | 91 + third_party/cargo/vendor/ndk-0.1.0/src/lib.rs | 24 + .../cargo/vendor/ndk-0.1.0/src/looper.rs | 272 + .../vendor/ndk-0.1.0/src/native_activity.rs | 185 + .../vendor/ndk-0.1.0/src/native_window.rs | 30 + .../ndk-glue-0.1.0/.cargo-checksum.json | 1 + third_party/cargo/vendor/ndk-glue-0.1.0/BUILD | 48 + .../cargo/vendor/ndk-glue-0.1.0/Cargo.toml | 36 + .../cargo/vendor/ndk-glue-0.1.0/src/lib.rs | 305 + .../vendor/ndk-sys-0.1.0/.cargo-checksum.json | 1 + third_party/cargo/vendor/ndk-sys-0.1.0/BUILD | 42 + .../cargo/vendor/ndk-sys-0.1.0/Cargo.toml | 30 + .../vendor/ndk-sys-0.1.0/generate_bindings.sh | 14 + .../vendor/ndk-sys-0.1.0/src/ffi_aarch64.rs | 13841 ++++++++++++++++ .../cargo/vendor/ndk-sys-0.1.0/src/ffi_arm.rs | 13590 +++++++++++++++ .../vendor/ndk-sys-0.1.0/src/ffi_i686.rs | 13560 +++++++++++++++ .../vendor/ndk-sys-0.1.0/src/ffi_x86_64.rs | 13840 +++++++++++++++ .../cargo/vendor/ndk-sys-0.1.0/src/lib.rs | 39 + .../cargo/vendor/ndk-sys-0.1.0/wrapper.h | 33 + .../vendor/net2-0.2.33/.cargo-checksum.json | 1 - .../cargo/vendor/net2-0.2.33/appveyor.yml | 17 - .../cargo/vendor/net2-0.2.33/tests/all.rs | 45 - .../vendor/net2-0.2.34/.cargo-checksum.json | 1 + .../vendor/{net2-0.2.33 => net2-0.2.34}/BUILD | 5 +- .../{net2-0.2.33 => net2-0.2.34}/Cargo.toml | 15 +- .../LICENSE-APACHE | 0 .../{libc-0.2.67 => net2-0.2.34}/LICENSE-MIT | 0 .../{net2-0.2.33 => net2-0.2.34}/README.md | 22 +- .../{net2-0.2.33 => net2-0.2.34}/src/ext.rs | 89 +- .../{net2-0.2.33 => net2-0.2.34}/src/lib.rs | 9 +- .../src/socket.rs | 4 +- .../src/sys/redox/impls.rs | 0 .../src/sys/redox/mod.rs | 0 .../src/sys/unix/impls.rs | 0 .../src/sys/unix/mod.rs | 8 +- .../vendor/net2-0.2.34/src/sys/wasi/impls.rs | 33 + .../vendor/net2-0.2.34/src/sys/wasi/mod.rs | 185 + .../src/sys/windows/impls.rs | 0 .../src/sys/windows/mod.rs | 0 .../{net2-0.2.33 => net2-0.2.34}/src/tcp.rs | 0 .../{net2-0.2.33 => net2-0.2.34}/src/udp.rs | 0 .../{net2-0.2.33 => net2-0.2.34}/src/unix.rs | 4 +- .../{net2-0.2.33 => net2-0.2.34}/src/utils.rs | 0 third_party/cargo/vendor/nix-0.14.1/BUILD | 2 +- .../num-rational-0.2.3/.cargo-checksum.json | 1 - .../num-rational-0.2.4/.cargo-checksum.json | 1 + .../BUILD | 2 +- .../Cargo.toml | 2 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 0 .../RELEASES.md | 8 + .../build.rs | 0 .../src/lib.rs | 173 +- .../num_cpus-1.12.0/.cargo-checksum.json | 1 - .../num_cpus-1.13.0/.cargo-checksum.json | 1 + .../BUILD | 4 +- .../CHANGELOG.md | 6 + .../CONTRIBUTING.md | 0 .../Cargo.lock | 9 +- .../Cargo.toml | 4 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 0 .../num_cpus-1.13.0/ci/cgroups/Dockerfile | 9 + .../examples/values.rs | 0 .../cgroups/cgroups/ceil/cpu.cfs_period_us | 2 + .../cgroups/cgroups/ceil/cpu.cfs_quota_us | 2 + .../cgroups/cgroups/good/cpu.cfs_period_us | 2 + .../cgroups/cgroups/good/cpu.cfs_quota_us | 2 + .../cgroups/zero-period/cpu.cfs_period_us | 2 + .../cgroups/zero-period/cpu.cfs_quota_us | 1 + .../fixtures/cgroups/proc/cgroups/cgroup | 3 + .../fixtures/cgroups/proc/cgroups/mountinfo | 8 + .../src/lib.rs | 90 +- .../cargo/vendor/num_cpus-1.13.0/src/linux.rs | 414 + .../num_enum-0.4.3/.cargo-checksum.json | 1 + third_party/cargo/vendor/num_enum-0.4.3/BUILD | 48 + .../cargo/vendor/num_enum-0.4.3/Cargo.toml | 44 + .../cargo/vendor/num_enum-0.4.3/LICENSE | 27 + .../cargo/vendor/num_enum-0.4.3/README.md | 104 + .../cargo/vendor/num_enum-0.4.3/src/lib.rs | 45 + .../cargo/vendor/num_enum-0.4.3/tests/lib.rs | 299 + .../num_enum-0.4.3/tests/renamed_num_enum.rs | 13 + .../.cargo-checksum.json | 1 + .../BUILD | 17 +- .../vendor/num_enum_derive-0.4.3/Cargo.toml | 44 + .../vendor/num_enum_derive-0.4.3/LICENSE | 27 + .../vendor/num_enum_derive-0.4.3/src/lib.rs | 313 + .../vendor/objc-0.2.7/.cargo-checksum.json | 2 +- .../cargo/vendor/objc-0.2.7/Cargo.lock | 41 + .../parking_lot-0.10.0/.cargo-checksum.json | 1 - .../parking_lot-0.10.2/.cargo-checksum.json | 1 + .../BUILD | 7 +- .../CHANGELOG.md | 18 +- .../Cargo.toml | 9 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 11 +- .../appveyor.yml | 0 .../cargo/vendor/parking_lot-0.10.2/bors.toml | 3 + .../src/condvar.rs | 2 +- .../src/deadlock.rs | 4 +- .../src/elision.rs | 40 +- .../parking_lot-0.10.2/src/fair_mutex.rs | 278 + .../src/lib.rs | 13 +- .../src/mutex.rs | 10 +- .../src/once.rs | 0 .../parking_lot-0.10.2/src/raw_fair_mutex.rs | 60 + .../src/raw_mutex.rs | 0 .../src/raw_rwlock.rs | 0 .../src/remutex.rs | 13 +- .../src/rwlock.rs | 31 + .../src/util.rs | 0 .../parking_lot-0.10.2/tests/issue_203.rs | 26 + .../.cargo-checksum.json | 2 +- .../BUILD | 6 +- .../Cargo.toml | 4 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../src/lib.rs | 0 .../src/parking_lot.rs | 68 +- .../src/spinwait.rs | 0 .../src/thread_parker/cloudabi.rs | 0 .../src/thread_parker/generic.rs | 0 .../src/thread_parker/linux.rs | 0 .../src/thread_parker/mod.rs | 0 .../src/thread_parker/redox.rs | 0 .../src/thread_parker/sgx.rs | 0 .../src/thread_parker/unix.rs | 0 .../src/thread_parker/wasm.rs | 0 .../src/thread_parker/wasm_atomic.rs | 0 .../src/thread_parker/windows/keyed_event.rs | 0 .../src/thread_parker/windows/mod.rs | 0 .../src/thread_parker/windows/waitaddress.rs | 0 .../src/util.rs | 0 .../src/word_lock.rs | 0 .../vendor/png-0.16.1/.cargo-checksum.json | 1 - .../vendor/png-0.16.1/benches/decoder.rs | 25 - .../cargo/vendor/png-0.16.1/src/filter.rs | 158 - .../cargo/vendor/png-0.16.1/src/traits.rs | 72 - .../vendor/png-0.16.3/.cargo-checksum.json | 1 + .../vendor/{png-0.16.1 => png-0.16.3}/BUILD | 4 +- .../{png-0.16.1 => png-0.16.3}/CHANGES.md | 9 + .../cargo/vendor/png-0.16.3/Cargo.lock | 1431 ++ .../{png-0.16.1 => png-0.16.3}/Cargo.toml | 10 +- .../{png-0.16.1 => png-0.16.3}/LICENSE-APACHE | 0 .../{png-0.16.1 => png-0.16.3}/LICENSE-MIT | 0 .../{png-0.16.1 => png-0.16.3}/README.md | 0 .../benches/README.md | 0 .../vendor/png-0.16.3/benches/decoder.rs | 39 + .../examples/pngcheck.rs | 109 +- .../examples/show.rs | 150 +- .../{png-0.16.1 => png-0.16.3}/src/chunk.rs | 2 +- .../{png-0.16.1 => png-0.16.3}/src/common.rs | 73 +- .../src/decoder/mod.rs | 318 +- .../src/decoder/stream.rs | 326 +- .../{png-0.16.1 => png-0.16.3}/src/encoder.rs | 153 +- .../cargo/vendor/png-0.16.3/src/filter.rs | 265 + .../{png-0.16.1 => png-0.16.3}/src/lib.rs | 11 +- .../cargo/vendor/png-0.16.3/src/traits.rs | 43 + .../{png-0.16.1 => png-0.16.3}/src/utils.rs | 257 +- .../.cargo-checksum.json | 1 + .../cargo/vendor/proc-macro-crate-0.1.4/BUILD | 43 + .../vendor/proc-macro-crate-0.1.4/Cargo.toml | 34 + .../vendor/proc-macro-crate-0.1.4/README.md | 53 + .../vendor/proc-macro-crate-0.1.4/src/lib.rs | 274 + .../proc-macro2-1.0.17/.cargo-checksum.json | 1 + .../cargo/vendor/proc-macro2-1.0.17/BUILD | 50 + .../vendor/proc-macro2-1.0.17/Cargo.toml | 42 + .../LICENSE-APACHE | 0 .../LICENSE-MIT | 2 +- .../cargo/vendor/proc-macro2-1.0.17/README.md | 93 + .../cargo/vendor/proc-macro2-1.0.17/build.rs | 137 + .../proc-macro2-1.0.17/src/detection.rs | 67 + .../vendor/proc-macro2-1.0.17/src/fallback.rs | 856 + .../vendor/proc-macro2-1.0.17/src/lib.rs | 1226 ++ .../vendor/proc-macro2-1.0.17/src/parse.rs | 791 + .../vendor/proc-macro2-1.0.17/src/strnom.rs | 0 .../vendor/proc-macro2-1.0.17/src/wrapper.rs | 898 + .../proc-macro2-1.0.17/tests/comments.rs | 103 + .../proc-macro2-1.0.17/tests/features.rs | 8 + .../vendor/proc-macro2-1.0.17/tests/marker.rs | 59 + .../vendor/proc-macro2-1.0.17/tests/test.rs | 476 + .../quick-error-1.2.3/.cargo-checksum.json | 2 +- .../cargo/vendor/quick-error-1.2.3/Cargo.lock | 6 + .../vendor/quote-1.0.6/.cargo-checksum.json | 1 + third_party/cargo/vendor/quote-1.0.6/BUILD | 47 + .../cargo/vendor/quote-1.0.6/Cargo.toml | 40 + .../LICENSE-APACHE | 0 .../LICENSE-MIT | 2 +- .../cargo/vendor/quote-1.0.6/README.md | 261 + .../cargo/vendor/quote-1.0.6/src/ext.rs | 112 + .../cargo/vendor/quote-1.0.6/src/format.rs | 164 + .../vendor/quote-1.0.6/src/ident_fragment.rs | 86 + .../cargo/vendor/quote-1.0.6/src/lib.rs | 962 ++ .../cargo/vendor/quote-1.0.6/src/runtime.rs | 362 + .../cargo/vendor/quote-1.0.6/src/spanned.rs | 42 + .../cargo/vendor/quote-1.0.6/src/to_tokens.rs | 209 + .../vendor/quote-1.0.6/tests/compiletest.rs | 6 + .../cargo/vendor/quote-1.0.6/tests/test.rs | 437 + .../ui/does-not-have-iter-interpolated-dup.rs | 9 + .../ui/does-not-have-iter-interpolated.rs | 9 + .../tests/ui/does-not-have-iter-separated.rs | 5 + .../tests/ui/does-not-have-iter.rs | 5 + .../quote-1.0.6/tests/ui/not-quotable.rs | 7 + .../quote-1.0.6/tests/ui/not-repeatable.rs | 7 + .../quote-1.0.6/tests/ui/wrong-type-span.rs | 7 + third_party/cargo/vendor/rand-0.6.5/BUILD | 2 +- third_party/cargo/vendor/rand_os-0.1.3/BUILD | 2 +- .../vendor/raw-window-handle-0.3.3/BUILD | 2 +- .../cargo/vendor/rayon-core-1.7.0/BUILD | 4 +- .../.cargo-checksum.json | 2 +- .../vendor/{regex-1.3.5 => regex-1.3.9}/BUILD | 4 +- .../{regex-1.3.5 => regex-1.3.9}/CHANGELOG.md | 53 + .../{regex-1.3.5 => regex-1.3.9}/Cargo.lock | 25 +- .../{regex-1.3.5 => regex-1.3.9}/Cargo.toml | 11 +- .../{regex-1.3.5 => regex-1.3.9}/HACKING.md | 0 .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../PERFORMANCE.md | 0 .../{regex-1.3.5 => regex-1.3.9}/README.md | 0 .../{regex-1.3.5 => regex-1.3.9}/UNICODE.md | 0 .../examples/regexdna-input.txt | 0 .../examples/regexdna-output.txt | 0 .../examples/shootout-regex-dna-bytes.rs | 0 .../examples/shootout-regex-dna-cheat.rs | 0 .../examples/shootout-regex-dna-replace.rs | 0 .../shootout-regex-dna-single-cheat.rs | 0 .../examples/shootout-regex-dna-single.rs | 0 .../examples/shootout-regex-dna.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/rustfmt.toml | 0 .../src/backtrack.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/cache.rs | 0 .../src/compile.rs | 263 +- .../{regex-1.3.5 => regex-1.3.9}/src/dfa.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/error.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/exec.rs | 0 .../src/expand.rs | 0 .../src/find_byte.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/freqs.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/input.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/lib.rs | 13 +- .../src/literal/imp.rs | 0 .../src/literal/mod.rs | 0 .../src/pattern.rs | 0 .../src/pikevm.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/src/prog.rs | 0 .../src/re_builder.rs | 0 .../src/re_bytes.rs | 0 .../src/re_set.rs | 0 .../src/re_trait.rs | 0 .../src/re_unicode.rs | 0 .../src/sparse.rs | 9 +- .../src/testdata/LICENSE | 0 .../src/testdata/README | 0 .../src/testdata/basic.dat | 0 .../src/testdata/nullsubexpr.dat | 0 .../src/testdata/repetition.dat | 0 .../{regex-1.3.5 => regex-1.3.9}/src/utf8.rs | 0 .../vendor/{regex-1.3.5 => regex-1.3.9}/test | 0 .../{regex-1.3.5 => regex-1.3.9}/tests/api.rs | 0 .../tests/api_str.rs | 0 .../tests/bytes.rs | 0 .../tests/consistent.rs | 0 .../tests/crates_regex.rs | 0 .../tests/crazy.rs | 12 + .../tests/flags.rs | 0 .../tests/fowler.rs | 0 .../tests/macros.rs | 0 .../tests/macros_bytes.rs | 0 .../tests/macros_str.rs | 0 .../tests/misc.rs | 0 .../tests/multiline.rs | 0 .../tests/noparse.rs | 9 +- .../tests/regression.rs | 7 + .../tests/replace.rs | 0 .../tests/searcher.rs | 0 .../{regex-1.3.5 => regex-1.3.9}/tests/set.rs | 11 + .../tests/shortest_match.rs | 0 .../tests/suffix_reverse.rs | 0 .../tests/test_backtrack.rs | 0 .../tests/test_backtrack_bytes.rs | 0 .../tests/test_backtrack_utf8bytes.rs | 0 .../tests/test_crates_regex.rs | 0 .../tests/test_default.rs | 0 .../tests/test_default_bytes.rs | 0 .../tests/test_nfa.rs | 0 .../tests/test_nfa_bytes.rs | 0 .../tests/test_nfa_utf8bytes.rs | 0 .../tests/unicode.rs | 0 .../tests/word_boundary.rs | 0 .../tests/word_boundary_ascii.rs | 0 .../tests/word_boundary_unicode.rs | 0 .../regex-syntax-0.6.17/.cargo-checksum.json | 1 - .../regex-syntax-0.6.18/.cargo-checksum.json | 1 + .../BUILD | 4 +- .../Cargo.toml | 2 +- .../vendor/regex-syntax-0.6.18/LICENSE-APACHE | 201 + .../LICENSE-MIT | 0 .../README.md | 0 .../benches/bench.rs | 0 .../src/ast/mod.rs | 0 .../src/ast/parse.rs | 0 .../src/ast/print.rs | 0 .../src/ast/visitor.rs | 0 .../src/either.rs | 0 .../src/error.rs | 0 .../src/hir/interval.rs | 0 .../src/hir/literal/mod.rs | 0 .../src/hir/mod.rs | 14 +- .../src/hir/print.rs | 0 .../src/hir/translate.rs | 4 +- .../src/hir/visitor.rs | 0 .../src/lib.rs | 3 +- .../src/parser.rs | 0 .../src/unicode.rs | 0 .../src/unicode_tables/LICENSE-UNICODE | 0 .../src/unicode_tables/age.rs | 6 +- .../src/unicode_tables/case_folding_simple.rs | 6 +- .../src/unicode_tables/general_category.rs | 6 +- .../unicode_tables/grapheme_cluster_break.rs | 6 +- .../src/unicode_tables/mod.rs | 0 .../src/unicode_tables/perl_decimal.rs | 6 +- .../src/unicode_tables/perl_space.rs | 6 +- .../src/unicode_tables/perl_word.rs | 6 +- .../src/unicode_tables/property_bool.rs | 6 +- .../src/unicode_tables/property_names.rs | 6 +- .../src/unicode_tables/property_values.rs | 6 +- .../src/unicode_tables/script.rs | 6 +- .../src/unicode_tables/script_extension.rs | 6 +- .../src/unicode_tables/sentence_break.rs | 6 +- .../src/unicode_tables/word_break.rs | 6 +- .../src/utf8.rs | 0 .../test | 0 .../rusttype-0.7.9/.cargo-checksum.json | 2 +- third_party/cargo/vendor/rusttype-0.7.9/BUILD | 2 +- .../{png-0.16.1 => rusttype-0.7.9}/Cargo.lock | 714 +- .../rusttype-0.8.2/.cargo-checksum.json | 1 - .../rusttype-0.8.3/.cargo-checksum.json | 1 + .../{rusttype-0.8.2 => rusttype-0.8.3}/BUILD | 3 +- .../CHANGELOG.md | 4 + .../Cargo.toml | 6 +- .../LICENSE-APACHE | 0 .../LICENSE-MIT | 0 .../README.md | 0 .../rustfmt.toml | 0 .../src/geometry.rs | 12 +- .../src/gpu_cache.rs | 33 +- .../src/lib.rs | 4 +- .../src/nostd_float.rs | 0 .../src/rasterizer.rs | 36 +- .../same-file-1.0.6/.cargo-checksum.json | 2 +- .../cargo/vendor/same-file-1.0.6/Cargo.lock | 48 + .../vendor/serde-1.0.110/.cargo-checksum.json | 1 + third_party/cargo/vendor/serde-1.0.110/BUILD | 45 + .../cargo/vendor/serde-1.0.110/Cargo.toml | 44 + .../cargo/vendor/serde-1.0.110/LICENSE-APACHE | 201 + .../cargo/vendor/serde-1.0.110/LICENSE-MIT | 23 + .../cargo/vendor/serde-1.0.110/README.md | 101 + .../cargo/vendor/serde-1.0.110/build.rs | 127 + .../cargo/vendor/serde-1.0.110/crates-io.md | 52 + .../serde-1.0.110/src/de/from_primitive.rs | 260 + .../serde-1.0.110/src/de/ignored_any.rs | 227 + .../vendor/serde-1.0.110/src/de/impls.rs | 2612 +++ .../cargo/vendor/serde-1.0.110/src/de/mod.rs | 2276 +++ .../cargo/vendor/serde-1.0.110/src/de/utf8.rs | 46 + .../vendor/serde-1.0.110/src/de/value.rs | 1497 ++ .../cargo/vendor/serde-1.0.110/src/export.rs | 39 + .../vendor/serde-1.0.110/src/integer128.rs | 82 + .../cargo/vendor/serde-1.0.110/src/lib.rs | 278 + .../cargo/vendor/serde-1.0.110/src/macros.rs | 236 + .../vendor/serde-1.0.110/src/private/de.rs | 2948 ++++ .../serde-1.0.110/src/private/macros.rs | 140 + .../vendor/serde-1.0.110/src/private/mod.rs | 4 + .../vendor/serde-1.0.110/src/private/ser.rs | 1326 ++ .../cargo/vendor/serde-1.0.110/src/ser/fmt.rs | 174 + .../vendor/serde-1.0.110/src/ser/impls.rs | 883 + .../serde-1.0.110/src/ser/impossible.rs | 216 + .../cargo/vendor/serde-1.0.110/src/ser/mod.rs | 1993 +++ .../vendor/serde-1.0.110/src/std_error.rs | 48 + .../cargo/vendor/shared_library-0.1.9/BUILD | 2 +- .../smallvec-1.2.0/.cargo-checksum.json | 1 - .../smallvec-1.4.0/.cargo-checksum.json | 1 + .../{smallvec-1.2.0 => smallvec-1.4.0}/BUILD | 2 +- .../Cargo.toml | 3 +- .../vendor/smallvec-1.4.0/LICENSE-APACHE | 201 + .../LICENSE-MIT | 0 .../README.md | 0 .../benches/bench.rs | 0 .../{smallvec-1.2.0 => smallvec-1.4.0}/lib.rs | 206 +- .../scripts/run_miri.sh | 6 +- .../specialization.rs | 0 .../vendor/smithay-client-toolkit-0.6.6/BUILD | 2 +- .../stb_truetype-0.3.1/.cargo-checksum.json | 2 +- .../vendor/stb_truetype-0.3.1/Cargo.lock | 48 + .../vendor/syn-1.0.27/.cargo-checksum.json | 1 + third_party/cargo/vendor/syn-1.0.27/BUILD | 80 + .../cargo/vendor/syn-1.0.27/Cargo.toml | 97 + .../cargo/vendor/syn-1.0.27/LICENSE-APACHE | 201 + .../cargo/vendor/syn-1.0.27/LICENSE-MIT | 23 + third_party/cargo/vendor/syn-1.0.27/README.md | 291 + .../cargo/vendor/syn-1.0.27/benches/file.rs | 30 + .../cargo/vendor/syn-1.0.27/benches/rust.rs | 159 + third_party/cargo/vendor/syn-1.0.27/build.rs | 39 + .../cargo/vendor/syn-1.0.27/src/attr.rs | 686 + .../cargo/vendor/syn-1.0.27/src/await.rs | 2 + .../cargo/vendor/syn-1.0.27/src/bigint.rs | 66 + .../cargo/vendor/syn-1.0.27/src/buffer.rs | 382 + .../vendor/syn-1.0.27/src/custom_keyword.rs | 252 + .../syn-1.0.27/src/custom_punctuation.rs | 299 + .../cargo/vendor/syn-1.0.27/src/data.rs | 466 + .../cargo/vendor/syn-1.0.27/src/derive.rs | 273 + .../vendor/syn-1.0.27/src/discouraged.rs | 194 + .../cargo/vendor/syn-1.0.27/src/error.rs | 375 + .../cargo/vendor/syn-1.0.27/src/export.rs | 35 + .../cargo/vendor/syn-1.0.27/src/expr.rs | 3203 ++++ .../cargo/vendor/syn-1.0.27/src/ext.rs | 135 + .../cargo/vendor/syn-1.0.27/src/file.rs | 113 + .../cargo/vendor/syn-1.0.27/src/gen/fold.rs | 3220 ++++ .../cargo/vendor/syn-1.0.27/src/gen/visit.rs | 3775 +++++ .../vendor/syn-1.0.27/src/gen/visit_mut.rs | 3781 +++++ .../cargo/vendor/syn-1.0.27/src/gen_helper.rs | 154 + .../cargo/vendor/syn-1.0.27/src/generics.rs | 1166 ++ .../cargo/vendor/syn-1.0.27/src/group.rs | 280 + .../cargo/vendor/syn-1.0.27/src/ident.rs | 101 + .../cargo/vendor/syn-1.0.27/src/item.rs | 3393 ++++ .../cargo/vendor/syn-1.0.27/src/lib.rs | 957 ++ .../cargo/vendor/syn-1.0.27/src/lifetime.rs | 140 + .../cargo/vendor/syn-1.0.27/src/lit.rs | 1497 ++ .../cargo/vendor/syn-1.0.27/src/lookahead.rs | 168 + .../cargo/vendor/syn-1.0.27/src/mac.rs | 244 + .../cargo/vendor/syn-1.0.27/src/macros.rs | 191 + third_party/cargo/vendor/syn-1.0.27/src/op.rs | 231 + .../cargo/vendor/syn-1.0.27/src/parse.rs | 1245 ++ .../syn-1.0.27/src/parse_macro_input.rs | 110 + .../vendor/syn-1.0.27/src/parse_quote.rs | 142 + .../cargo/vendor/syn-1.0.27/src/pat.rs | 974 ++ .../cargo/vendor/syn-1.0.27/src/path.rs | 739 + .../cargo/vendor/syn-1.0.27/src/print.rs | 16 + .../cargo/vendor/syn-1.0.27/src/punctuated.rs | 921 + .../cargo/vendor/syn-1.0.27/src/sealed.rs | 4 + .../cargo/vendor/syn-1.0.27/src/span.rs | 67 + .../cargo/vendor/syn-1.0.27/src/spanned.rs | 114 + .../cargo/vendor/syn-1.0.27/src/stmt.rs | 315 + .../cargo/vendor/syn-1.0.27/src/thread.rs | 41 + .../cargo/vendor/syn-1.0.27/src/token.rs | 955 ++ third_party/cargo/vendor/syn-1.0.27/src/tt.rs | 108 + third_party/cargo/vendor/syn-1.0.27/src/ty.rs | 1237 ++ .../cargo/vendor/syn-1.0.27/src/verbatim.rs | 15 + .../vendor/syn-1.0.27/tests/common/eq.rs | 468 + .../vendor/syn-1.0.27/tests/common/mod.rs | 23 + .../vendor/syn-1.0.27/tests/common/parse.rs | 49 + .../vendor/syn-1.0.27/tests/debug/gen.rs | 5633 +++++++ .../vendor/syn-1.0.27/tests/debug/mod.rs | 118 + .../vendor/syn-1.0.27/tests/macros/mod.rs | 76 + .../cargo/vendor/syn-1.0.27/tests/repo/mod.rs | 126 + .../vendor/syn-1.0.27/tests/repo/progress.rs | 37 + .../vendor/syn-1.0.27/tests/test_asyncness.rs | 37 + .../vendor/syn-1.0.27/tests/test_attribute.rs | 336 + .../syn-1.0.27/tests/test_derive_input.rs | 892 + .../vendor/syn-1.0.27/tests/test_expr.rs | 117 + .../vendor/syn-1.0.27/tests/test_generics.rs | 283 + .../vendor/syn-1.0.27/tests/test_grouping.rs | 53 + .../vendor/syn-1.0.27/tests/test_ident.rs | 85 + .../vendor/syn-1.0.27/tests/test_iterators.rs | 49 + .../cargo/vendor/syn-1.0.27/tests/test_lit.rs | 231 + .../vendor/syn-1.0.27/tests/test_meta.rs | 339 + .../syn-1.0.27/tests/test_parse_buffer.rs | 90 + .../cargo/vendor/syn-1.0.27/tests/test_pat.rs | 38 + .../vendor/syn-1.0.27/tests/test_path.rs | 52 + .../syn-1.0.27/tests/test_precedence.rs | 405 + .../vendor/syn-1.0.27/tests/test_receiver.rs | 127 + .../syn-1.0.27/tests/test_round_trip.rs | 152 + .../syn-1.0.27/tests/test_should_parse.rs | 45 + .../vendor/syn-1.0.27/tests/test_size.rs | 29 + .../vendor/syn-1.0.27/tests/test_stmt.rs | 44 + .../syn-1.0.27/tests/test_token_trees.rs | 30 + .../cargo/vendor/syn-1.0.27/tests/test_ty.rs | 10 + .../syn-1.0.27/tests/test_visibility.rs | 97 + .../vendor/syn-1.0.27/tests/zzz_stable.rs | 33 + .../vendor/toml-0.5.6/.cargo-checksum.json | 1 + third_party/cargo/vendor/toml-0.5.6/BUILD | 48 + .../cargo/vendor/toml-0.5.6/Cargo.lock | 103 + .../cargo/vendor/toml-0.5.6/Cargo.toml | 40 + .../cargo/vendor/toml-0.5.6/LICENSE-APACHE | 201 + .../cargo/vendor/toml-0.5.6/LICENSE-MIT | 25 + third_party/cargo/vendor/toml-0.5.6/README.md | 38 + .../vendor/toml-0.5.6/examples/decode.rs | 53 + .../toml-0.5.6/examples/enum_external.rs | 44 + .../vendor/toml-0.5.6/examples/toml2json.rs | 47 + .../cargo/vendor/toml-0.5.6/src/datetime.rs | 425 + third_party/cargo/vendor/toml-0.5.6/src/de.rs | 2244 +++ .../cargo/vendor/toml-0.5.6/src/lib.rs | 174 + .../cargo/vendor/toml-0.5.6/src/macros.rs | 462 + .../cargo/vendor/toml-0.5.6/src/map.rs | 595 + .../cargo/vendor/toml-0.5.6/src/ser.rs | 1853 +++ .../cargo/vendor/toml-0.5.6/src/spanned.rs | 168 + .../cargo/vendor/toml-0.5.6/src/tokens.rs | 736 + .../cargo/vendor/toml-0.5.6/src/value.rs | 1080 ++ .../tests/enum_external_deserialize.rs | 258 + .../unicode-xid-0.2.0/.cargo-checksum.json | 1 + .../cargo/vendor/unicode-xid-0.2.0/BUILD | 43 + .../cargo/vendor/unicode-xid-0.2.0/COPYRIGHT | 7 + .../cargo/vendor/unicode-xid-0.2.0/Cargo.toml | 31 + .../vendor/unicode-xid-0.2.0/LICENSE-APACHE | 201 + .../vendor/unicode-xid-0.2.0/LICENSE-MIT | 25 + .../cargo/vendor/unicode-xid-0.2.0/README.md | 44 + .../cargo/vendor/unicode-xid-0.2.0/src/lib.rs | 87 + .../vendor/unicode-xid-0.2.0/src/tables.rs | 451 + .../vendor/unicode-xid-0.2.0/src/tests.rs | 111 + third_party/cargo/vendor/vulkano-0.18.0/BUILD | 6 +- .../cargo/vendor/vulkano-win-0.18.0/BUILD | 2 +- .../cargo/vendor/wayland-client-0.23.6/BUILD | 4 +- .../cargo/vendor/wayland-scanner-0.23.6/BUILD | 2 +- .../cargo/vendor/wayland-sys-0.23.6/BUILD | 2 +- .../.cargo-checksum.json | 2 +- .../BUILD | 2 +- .../COPYING | 0 .../Cargo.toml | 4 +- .../LICENSE-MIT | 0 .../README.md | 0 .../UNLICENSE | 0 .../rustfmt.toml | 0 .../src/console.rs | 25 + .../src/file.rs | 0 .../src/lib.rs | 0 .../src/win.rs | 0 .../vendor/winit-0.22.0/.cargo-checksum.json | 1 - .../winit-0.22.0/src/platform/android.rs | 33 - .../src/platform_impl/android/ffi.rs | 122 - .../src/platform_impl/android/mod.rs | 450 - .../src/platform_impl/web/stdweb/timeout.rs | 25 - .../src/platform_impl/web/web_sys/timeout.rs | 40 - .../windows/event_loop/runner.rs | 475 - .../vendor/winit-0.22.2/.cargo-checksum.json | 1 + .../{winit-0.22.0 => winit-0.22.2}/BUILD | 10 +- .../CHANGELOG.md | 21 +- .../CONTRIBUTING.md | 0 .../{winit-0.22.0 => winit-0.22.2}/Cargo.lock | 314 +- .../{winit-0.22.0 => winit-0.22.2}/Cargo.toml | 26 +- .../FEATURES.md | 4 +- .../HALL_OF_CHAMPIONS.md | 0 .../{winit-0.22.0 => winit-0.22.2}/LICENSE | 0 .../{winit-0.22.0 => winit-0.22.2}/README.md | 24 +- .../examples/control_flow.rs | 12 +- .../examples/cursor.rs | 0 .../examples/cursor_grab.rs | 0 .../examples/custom_events.rs | 0 .../examples/fullscreen.rs | 0 .../examples/handling_close.rs | 0 .../examples/icon.png | Bin .../examples/min_max_size.rs | 0 .../examples/minimize.rs | 0 .../examples/monitor_list.rs | 0 .../examples/multithreaded.rs | 0 .../examples/multiwindow.rs | 0 .../examples/request_redraw.rs | 0 .../examples/request_redraw_threaded.rs | 0 .../examples/resizable.rs | 0 .../examples/timer.rs | 0 .../examples/transparent.rs | 0 .../examples/video_modes.rs | 0 .../examples/web.rs | 0 .../examples/window.rs | 0 .../examples/window_debug.rs | 0 .../examples/window_icon.rs | 0 .../examples/window_run_return.rs | 0 .../rustfmt.toml | 0 .../{winit-0.22.0 => winit-0.22.2}/src/dpi.rs | 0 .../src/error.rs | 0 .../src/event.rs | 131 +- .../src/event_loop.rs | 3 +- .../src/icon.rs | 0 .../{winit-0.22.0 => winit-0.22.2}/src/lib.rs | 22 +- .../src/monitor.rs | 0 .../winit-0.22.2/src/platform/android.rs | 40 + .../src/platform/desktop.rs | 0 .../src/platform/ios.rs | 0 .../src/platform/macos.rs | 0 .../src/platform/mod.rs | 0 .../src/platform/unix.rs | 0 .../src/platform/web.rs | 0 .../src/platform/windows.rs | 0 .../src/platform_impl/android/mod.rs | 519 + .../src/platform_impl/ios/app_state.rs | 0 .../src/platform_impl/ios/event_loop.rs | 0 .../src/platform_impl/ios/ffi.rs | 0 .../src/platform_impl/ios/mod.rs | 0 .../src/platform_impl/ios/monitor.rs | 0 .../src/platform_impl/ios/view.rs | 12 +- .../src/platform_impl/ios/window.rs | 0 .../src/platform_impl/linux/mod.rs | 2 +- .../platform_impl/linux/wayland/event_loop.rs | 85 +- .../platform_impl/linux/wayland/keyboard.rs | 0 .../src/platform_impl/linux/wayland/mod.rs | 0 .../platform_impl/linux/wayland/pointer.rs | 0 .../src/platform_impl/linux/wayland/touch.rs | 0 .../src/platform_impl/linux/wayland/window.rs | 83 +- .../src/platform_impl/linux/x11/dnd.rs | 0 .../linux/x11/event_processor.rs | 0 .../src/platform_impl/linux/x11/events.rs | 0 .../src/platform_impl/linux/x11/ffi.rs | 0 .../platform_impl/linux/x11/ime/callbacks.rs | 0 .../platform_impl/linux/x11/ime/context.rs | 0 .../src/platform_impl/linux/x11/ime/inner.rs | 0 .../linux/x11/ime/input_method.rs | 0 .../src/platform_impl/linux/x11/ime/mod.rs | 0 .../src/platform_impl/linux/x11/mod.rs | 54 +- .../src/platform_impl/linux/x11/monitor.rs | 0 .../src/platform_impl/linux/x11/util/atom.rs | 0 .../linux/x11/util/client_msg.rs | 0 .../platform_impl/linux/x11/util/cursor.rs | 0 .../platform_impl/linux/x11/util/format.rs | 0 .../platform_impl/linux/x11/util/geometry.rs | 0 .../src/platform_impl/linux/x11/util/hint.rs | 0 .../src/platform_impl/linux/x11/util/icon.rs | 0 .../src/platform_impl/linux/x11/util/input.rs | 0 .../src/platform_impl/linux/x11/util/keys.rs | 0 .../platform_impl/linux/x11/util/memory.rs | 0 .../src/platform_impl/linux/x11/util/mod.rs | 0 .../platform_impl/linux/x11/util/modifiers.rs | 0 .../src/platform_impl/linux/x11/util/randr.rs | 0 .../linux/x11/util/window_property.rs | 0 .../src/platform_impl/linux/x11/util/wm.rs | 0 .../src/platform_impl/linux/x11/window.rs | 0 .../src/platform_impl/linux/x11/xdisplay.rs | 0 .../platform_impl/macos/activation_hack.rs | 0 .../src/platform_impl/macos/app.rs | 0 .../src/platform_impl/macos/app_delegate.rs | 0 .../src/platform_impl/macos/app_state.rs | 0 .../src/platform_impl/macos/event.rs | 0 .../src/platform_impl/macos/event_loop.rs | 8 + .../src/platform_impl/macos/ffi.rs | 0 .../src/platform_impl/macos/mod.rs | 0 .../src/platform_impl/macos/monitor.rs | 0 .../src/platform_impl/macos/observer.rs | 0 .../src/platform_impl/macos/util/async.rs | 0 .../src/platform_impl/macos/util/cursor.rs | 0 .../src/platform_impl/macos/util/mod.rs | 0 .../src/platform_impl/macos/view.rs | 12 + .../src/platform_impl/macos/window.rs | 0 .../platform_impl/macos/window_delegate.rs | 0 .../src/platform_impl/mod.rs | 0 .../src/platform_impl/web/device.rs | 0 .../src/platform_impl/web/error.rs | 0 .../src/platform_impl/web/event_loop/mod.rs | 0 .../src/platform_impl/web/event_loop/proxy.rs | 0 .../platform_impl/web/event_loop/runner.rs | 7 +- .../src/platform_impl/web/event_loop/state.rs | 2 +- .../web/event_loop/window_target.rs | 0 .../src/platform_impl/web/mod.rs | 0 .../src/platform_impl/web/monitor.rs | 0 .../src/platform_impl/web/stdweb/canvas.rs | 0 .../src/platform_impl/web/stdweb/event.rs | 0 .../src/platform_impl/web/stdweb/mod.rs | 2 +- .../src/platform_impl/web/stdweb/timeout.rs | 63 + .../src/platform_impl/web/web_sys/canvas.rs | 0 .../src/platform_impl/web/web_sys/event.rs | 0 .../src/platform_impl/web/web_sys/mod.rs | 2 +- .../src/platform_impl/web/web_sys/timeout.rs | 87 + .../src/platform_impl/web/window.rs | 0 .../src/platform_impl/windows/dark_mode.rs | 0 .../src/platform_impl/windows/dpi.rs | 0 .../src/platform_impl/windows/drop_handler.rs | 0 .../src/platform_impl/windows/event.rs | 0 .../src/platform_impl/windows/event_loop.rs | 492 +- .../windows/event_loop/runner.rs | 410 + .../src/platform_impl/windows/icon.rs | 0 .../src/platform_impl/windows/mod.rs | 0 .../src/platform_impl/windows/monitor.rs | 0 .../src/platform_impl/windows/raw_input.rs | 0 .../src/platform_impl/windows/util.rs | 0 .../src/platform_impl/windows/window.rs | 7 +- .../src/platform_impl/windows/window_state.rs | 4 +- .../src/window.rs | 0 .../tests/send_objects.rs | 0 .../tests/serde_objects.rs | 0 .../tests/sync_object.rs | 0 third_party/cargo/vendor/x11-dl-2.18.5/BUILD | 2 +- .../vendor/xml-rs-0.8.0/.cargo-checksum.json | 1 - .../vendor/xml-rs-0.8.3/.cargo-checksum.json | 1 + .../{xml-rs-0.8.0 => xml-rs-0.8.3}/BUILD | 4 +- .../cargo/vendor/xml-rs-0.8.3/Cargo.lock | 21 + .../{xml-rs-0.8.0 => xml-rs-0.8.3}/Cargo.toml | 14 +- .../Changelog.md | 22 + .../{xml-rs-0.8.0 => xml-rs-0.8.3}/LICENSE | 0 .../{xml-rs-0.8.0 => xml-rs-0.8.3}/Readme.md | 20 +- .../{xml-rs-0.8.0 => xml-rs-0.8.3}/design.md | 0 .../src/analyze.rs | 2 + .../src/attribute.rs | 0 .../src/common.rs | 2 +- .../src/escape.rs | 0 .../{xml-rs-0.8.0 => xml-rs-0.8.3}/src/lib.rs | 8 + .../src/macros.rs | 0 .../src/name.rs | 0 .../src/namespace.rs | 0 .../src/reader/config.rs | 23 +- .../src/reader/error.rs | 0 .../src/reader/events.rs | 0 .../src/reader/lexer.rs | 38 +- .../src/reader/mod.rs | 0 .../src/reader/parser/inside_cdata.rs | 0 .../reader/parser/inside_closing_tag_name.rs | 0 .../src/reader/parser/inside_comment.rs | 0 .../src/reader/parser/inside_declaration.rs | 0 .../src/reader/parser/inside_doctype.rs | 0 .../src/reader/parser/inside_opening_tag.rs | 0 .../parser/inside_processing_instruction.rs | 0 .../src/reader/parser/inside_reference.rs | 27 +- .../src/reader/parser/mod.rs | 0 .../src/reader/parser/outside_tag.rs | 8 +- .../src/util.rs | 0 .../src/writer/config.rs | 15 +- .../src/writer/emitter.rs | 5 +- .../src/writer/events.rs | 0 .../src/writer/mod.rs | 0 .../tests/documents/sample_1.xml | 0 .../tests/documents/sample_1_full.txt | 0 .../tests/documents/sample_1_short.txt | 0 .../tests/documents/sample_2.xml | 0 .../tests/documents/sample_2_full.txt | 0 .../tests/documents/sample_2_short.txt | 0 .../tests/documents/sample_3.xml | 0 .../tests/documents/sample_3_full.txt | 0 .../tests/documents/sample_3_short.txt | 0 .../tests/documents/sample_4.xml | 0 .../tests/documents/sample_4_full.txt | 0 .../tests/documents/sample_4_short.txt | 0 .../tests/documents/sample_5.xml | 0 .../tests/documents/sample_5_short.txt | 0 .../xml-rs-0.8.3/tests/documents/sample_6.xml | 4 + .../tests/documents/sample_6_full.txt | 8 + .../tests/event_reader.rs | 121 +- .../tests/event_writer.rs | 47 + .../tests/streaming.rs | 2 + 1503 files changed, 166042 insertions(+), 16414 deletions(-) delete mode 100644 third_party/cargo/vendor/android_glue-0.2.3/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/android_glue-0.2.3/Cargo.toml delete mode 100644 third_party/cargo/vendor/android_glue-0.2.3/src/lib.rs create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/BUILD create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/Cargo.toml create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-APACHE create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-MIT create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/README.md create mode 100644 third_party/cargo/vendor/android_log-sys-0.1.2/src/lib.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/Cargo.toml delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/README.rst delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/benches/arraystring.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/benches/extend.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/custom.css delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/src/array.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/src/array_string.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/src/char.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/src/errors.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/src/lib.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/src/maybe_uninit.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/tests/serde.rs delete mode 100644 third_party/cargo/vendor/arrayvec-0.5.1/tests/tests.rs create mode 100644 third_party/cargo/vendor/atty-0.2.14/Cargo.lock create mode 100644 third_party/cargo/vendor/autocfg-0.1.7/Cargo.lock create mode 100644 third_party/cargo/vendor/autocfg-1.0.0/Cargo.lock delete mode 100644 third_party/cargo/vendor/cc-1.0.50/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/cc-1.0.54/.cargo-checksum.json rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/BUILD (96%) create mode 100644 third_party/cargo/vendor/cc-1.0.54/Cargo.lock rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/Cargo.toml (98%) rename third_party/cargo/vendor/{arrayvec-0.5.1 => cc-1.0.54}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/README.md (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/bin/gcc-shim.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/com.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/lib.rs (87%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/registry.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/setup_config.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/winapi.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/src/windows_registry.rs (93%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/tests/cc_env.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/tests/cflags.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/tests/cxxflags.rs (100%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/tests/support/mod.rs (85%) rename third_party/cargo/vendor/{cc-1.0.50 => cc-1.0.54}/tests/test.rs (93%) delete mode 100644 third_party/cargo/vendor/cmake-0.1.42/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/cmake-0.1.44/.cargo-checksum.json rename third_party/cargo/vendor/{cmake-0.1.42 => cmake-0.1.44}/BUILD (90%) rename third_party/cargo/vendor/{cmake-0.1.42 => cmake-0.1.44}/Cargo.toml (98%) rename third_party/cargo/vendor/{cc-1.0.50 => cmake-0.1.44}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{cmake-0.1.42 => cmake-0.1.44}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{cmake-0.1.42 => cmake-0.1.44}/README.md (100%) rename third_party/cargo/vendor/{cmake-0.1.42 => cmake-0.1.44}/src/lib.rs (97%) delete mode 100644 third_party/cargo/vendor/cocoa-0.20.0/Cargo.lock rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/.cargo-checksum.json (63%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/BUILD (93%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/COPYRIGHT (100%) create mode 100644 third_party/cargo/vendor/cocoa-0.20.1/Cargo.lock rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/Cargo.toml (94%) rename third_party/cargo/vendor/{cmake-0.1.42 => cocoa-0.20.1}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/README.md (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/examples/color.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/examples/fullscreen.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/examples/hello_world.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/examples/tab_view.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/src/appkit.rs (99%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/src/base.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/src/foundation.rs (96%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/src/lib.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/src/macros.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/src/quartzcore.rs (100%) rename third_party/cargo/vendor/{cocoa-0.20.0 => cocoa-0.20.1}/tests/foundation.rs (100%) delete mode 100644 third_party/cargo/vendor/core-video-sys-0.1.3/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/core-video-sys-0.1.3/build.rs create mode 100644 third_party/cargo/vendor/core-video-sys-0.1.4/.cargo-checksum.json rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/BUILD (77%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/Cargo.toml (91%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/LICENSE (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/base.rs (59%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/buffer.rs (96%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/display_link.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/host_time.rs (82%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/image_buffer.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/lib.rs (94%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/metal_texture.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/metal_texture_cache.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/open_gl_es_texture.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/open_gl_es_texture_cache.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/opengl_buffer.rs (98%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/opengl_buffer_pool.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/opengl_texture.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/opengl_texture_cache.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/pixel_buffer.rs (99%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/pixel_buffer_io_surface.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/pixel_buffer_pool.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/pixel_format_description.rs (100%) rename third_party/cargo/vendor/{core-video-sys-0.1.3 => core-video-sys-0.1.4}/src/return_.rs (96%) delete mode 100644 third_party/cargo/vendor/crossbeam-queue-0.2.1/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/crossbeam-queue-0.2.2/.cargo-checksum.json rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/BUILD (89%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/CHANGELOG.md (80%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/Cargo.toml (87%) rename third_party/cargo/vendor/{cocoa-0.20.0 => crossbeam-queue-0.2.2}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/LICENSE-THIRD-PARTY (100%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/README.md (76%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/src/array_queue.rs (92%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/src/err.rs (52%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/src/lib.rs (65%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/src/seg_queue.rs (93%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/tests/array_queue.rs (98%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => crossbeam-queue-0.2.2}/tests/seg_queue.rs (97%) delete mode 100644 third_party/cargo/vendor/deflate-0.8.3/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/deflate-0.8.4/.cargo-checksum.json rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/BUILD (97%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/Cargo.toml (98%) rename third_party/cargo/vendor/{crossbeam-queue-0.2.1 => deflate-0.8.4}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/README.md (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/benches/bench.rs (100%) create mode 100644 third_party/cargo/vendor/deflate-0.8.4/changelog.md rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/bit_reverse.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/bitstream.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/chained_hash_table.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/checksum.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/compress.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/compression_options.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/deflate_state.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/encoder_state.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/huffman_lengths.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/huffman_table.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/input_buffer.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/length_encode.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/lib.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/lz77.rs (99%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/lzvalue.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/matching.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/output_writer.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/rle.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/stored_block.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/test_utils.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/writer.rs (100%) rename third_party/cargo/vendor/{deflate-0.8.3 => deflate-0.8.4}/src/zlib.rs (100%) create mode 100644 third_party/cargo/vendor/derivative-2.1.1/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/derivative-2.1.1/BUILD create mode 100644 third_party/cargo/vendor/derivative-2.1.1/CHANGELOG.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/CONTRIBUTING.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/Cargo.toml rename third_party/cargo/vendor/{deflate-0.8.3 => derivative-2.1.1}/LICENSE-APACHE (100%) create mode 100644 third_party/cargo/vendor/derivative-2.1.1/LICENSE-MIT create mode 100644 third_party/cargo/vendor/derivative-2.1.1/Makefile create mode 100644 third_party/cargo/vendor/derivative-2.1.1/README.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/appveyor.yml create mode 100644 third_party/cargo/vendor/derivative-2.1.1/book.json create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/Clone.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/Debug.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/Default.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/Hash.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/README.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/SUMMARY.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/cmp.md create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent-orig.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/default-enum-orig.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/default-enum.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/default-value-orig.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/default-value.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore-orig.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/doc/styles/website.css create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/ast.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/attr.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/bound.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/clone.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/cmp.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/debug.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/default.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/hash.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/lib.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/matcher.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/paths.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/src/utils.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.stderr create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.stderr create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.stderr create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.stderr create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.stderr create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/compile-test.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone-generics.rs create mode 100755 third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-bounds.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-generics.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-transparent.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug.rs create mode 100755 third_party/cargo/vendor/derivative-2.1.1/tests/derive-default-bounds.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-default.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-eq.rs create mode 100755 third_party/cargo/vendor/derivative-2.1.1/tests/derive-hash.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-ord.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/derive-partial-eq.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/issue-37-turbofish.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/issue-55.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/issue-57.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/issue-58.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/issue-67.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-class-implement-traits.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-bounds.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-array.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-enum.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-enum.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-tuple-struct.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-struct.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-tuple-struct.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-enum.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct-enum.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-tuple-struct.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-copyclone.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-default-box.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-enum-single-variant.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-hash.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-in-fn.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta-multiple.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show-2.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-enum.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-struct.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-type-params.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-expr-copy.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-exterior.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-12860.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-13434.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-16530.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19037.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19102.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19135.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19358.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-21402.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-23649-3.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-24085.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-25394.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-28561.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29030.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29540.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29710.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-32292.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-3935.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-42453.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-58319.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-6341.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-typeclasses-eq-example.rs create mode 100644 third_party/cargo/vendor/derivative-2.1.1/tests/rustc-zero-sized-btreemap-insert.rs delete mode 100644 third_party/cargo/vendor/dlib-0.4.1/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/dlib-0.4.2/.cargo-checksum.json rename third_party/cargo/vendor/{dlib-0.4.1 => dlib-0.4.2}/BUILD (89%) rename third_party/cargo/vendor/{dlib-0.4.1 => dlib-0.4.2}/Cargo.toml (90%) rename third_party/cargo/vendor/{dlib-0.4.1 => dlib-0.4.2}/LICENSE.txt (100%) rename third_party/cargo/vendor/{dlib-0.4.1 => dlib-0.4.2}/README.md (100%) rename third_party/cargo/vendor/{dlib-0.4.1 => dlib-0.4.2}/src/lib.rs (100%) create mode 100644 third_party/cargo/vendor/env_logger-0.6.2/Cargo.lock create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/BUILD create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/Cargo.toml create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/builder.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/endian_scalar.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/follow.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/lib.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/primitives.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/push.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/table.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/vector.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable.rs create mode 100644 third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable_writer.rs delete mode 100644 third_party/cargo/vendor/fnv-1.0.6/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/fnv-1.0.7/.cargo-checksum.json rename third_party/cargo/vendor/{fnv-1.0.6 => fnv-1.0.7}/BUILD (92%) rename third_party/cargo/vendor/{fnv-1.0.6 => fnv-1.0.7}/Cargo.toml (88%) rename third_party/cargo/vendor/{fnv-1.0.6 => fnv-1.0.7}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{fnv-1.0.6 => fnv-1.0.7}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{fnv-1.0.6 => fnv-1.0.7}/README.md (97%) rename third_party/cargo/vendor/{fnv-1.0.6 => fnv-1.0.7}/lib.rs (92%) delete mode 100644 third_party/cargo/vendor/half-1.5.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/half-1.6.0/.cargo-checksum.json rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/BUILD (97%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/CHANGELOG.md (83%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/Cargo.toml (98%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/README.md (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/appveyor.yml (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/benches/convert.rs (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/bfloat.rs (90%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/bfloat/convert.rs (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/binary16.rs (92%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/binary16/convert.rs (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/lib.rs (98%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/slice.rs (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/src/vec.rs (100%) rename third_party/cargo/vendor/{half-1.5.0 => half-1.6.0}/tests/version-numbers.rs (61%) create mode 100644 third_party/cargo/vendor/hermit-abi-0.1.13/.cargo-checksum.json rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/BUILD (90%) rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/Cargo.toml (95%) rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/README.md (67%) rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/rust-toolchain (100%) create mode 100644 third_party/cargo/vendor/hermit-abi-0.1.13/src/lib.rs rename third_party/cargo/vendor/{hermit-abi-0.1.8 => hermit-abi-0.1.13}/src/tcpstream.rs (97%) delete mode 100644 third_party/cargo/vendor/hermit-abi-0.1.8/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/hermit-abi-0.1.8/src/lib.rs delete mode 100644 third_party/cargo/vendor/image-0.23.1/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/image-0.23.1/benches/encode_bmp.rs delete mode 100644 third_party/cargo/vendor/image-0.23.1/benches/encode_jpeg.rs delete mode 100644 third_party/cargo/vendor/image-0.23.1/benches/load.rs delete mode 100644 third_party/cargo/vendor/image-0.23.1/src/lib.rs delete mode 100644 third_party/cargo/vendor/image-0.23.1/src/traits.rs delete mode 100644 third_party/cargo/vendor/image-0.23.1/src/webp/decoder.rs create mode 100644 third_party/cargo/vendor/image-0.23.4/.cargo-checksum.json rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/BUILD (79%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/CHANGES.md (93%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/Cargo.toml (90%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/Cargo.toml.public-private-dependencies (91%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/LICENSE (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/README.md (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/benches/README.md (100%) create mode 100644 third_party/cargo/vendor/image-0.23.4/benches/decode.rs create mode 100644 third_party/cargo/vendor/image-0.23.4/benches/encode.rs rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/docs/2019-04-23-memory-unsafety.md (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/release.sh (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/animation.rs (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/bmp/decoder.rs (86%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/bmp/encoder.rs (83%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/bmp/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/buffer.rs (86%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/color.rs (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/dds.rs (73%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/dxt.rs (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/dynimage.rs (96%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/error.rs (85%) create mode 100644 third_party/cargo/vendor/image-0.23.4/src/farbfeld.rs rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/flat.rs (98%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/gif.rs (71%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/hdr/decoder.rs (80%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/hdr/encoder.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/hdr/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/ico/decoder.rs (62%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/ico/encoder.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/ico/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/image.rs (94%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/imageops/affine.rs (92%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/imageops/colorops.rs (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/imageops/mod.rs (92%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/imageops/sample.rs (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/io/free_functions.rs (96%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/io/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/io/reader.rs (94%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/jpeg/decoder.rs (99%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/jpeg/encoder.rs (94%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/jpeg/entropy.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/jpeg/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/jpeg/transform.rs (100%) create mode 100644 third_party/cargo/vendor/image-0.23.4/src/lib.rs rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/math/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/math/nq.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/math/rect.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/math/utils.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/png.rs (85%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/pnm/autobreak.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/pnm/decoder.rs (75%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/pnm/encoder.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/pnm/header.rs (87%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/pnm/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/tga/decoder.rs (91%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/tga/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/tiff.rs (100%) create mode 100644 third_party/cargo/vendor/image-0.23.4/src/traits.rs rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/utils/mod.rs (100%) create mode 100644 third_party/cargo/vendor/image-0.23.4/src/webp/decoder.rs rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/webp/mod.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/webp/transform.rs (100%) rename third_party/cargo/vendor/{image-0.23.1 => image-0.23.4}/src/webp/vp8.rs (96%) delete mode 100644 third_party/cargo/vendor/instant-0.1.2/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/instant-0.1.2/src/lib.rs delete mode 100644 third_party/cargo/vendor/instant-0.1.2/tests/wasm.rs create mode 100644 third_party/cargo/vendor/instant-0.1.4/.cargo-checksum.json rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/AUTHORS (100%) rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/BUILD (97%) rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/Cargo.toml (71%) rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/LICENSE (100%) rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/README.md (82%) create mode 100644 third_party/cargo/vendor/instant-0.1.4/src/lib.rs rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/src/native.rs (100%) rename third_party/cargo/vendor/{instant-0.1.2 => instant-0.1.4}/src/wasm.rs (54%) create mode 100644 third_party/cargo/vendor/instant-0.1.4/tests/wasm.rs create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/.cargo-checksum.json rename third_party/cargo/vendor/{android_glue-0.2.3 => jni-sys-0.3.0}/BUILD (90%) create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/Cargo.toml create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-APACHE create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-MIT create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/README.md create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/appveyor.yml create mode 100644 third_party/cargo/vendor/jni-sys-0.3.0/src/lib.rs delete mode 100644 third_party/cargo/vendor/jpeg-decoder-0.1.18/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/jpeg-decoder-0.1.18/src/idct.rs create mode 100644 third_party/cargo/vendor/jpeg-decoder-0.1.19/.cargo-checksum.json rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/BUILD (97%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/CHANGELOG.md (92%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/Cargo.lock (92%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/Cargo.toml (96%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/README.md (86%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/appveyor.yml (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/benches/decoding_benchmark.rs (86%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/benches/tower.jpg (100%) create mode 100644 third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/tower_grayscale.jpg rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/benches/tower_progressive.jpg (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/examples/decode.rs (88%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/decoder.rs (94%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/error.rs (86%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/huffman.rs (100%) create mode 100644 third_party/cargo/vendor/jpeg-decoder-0.1.19/src/idct.rs rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/lib.rs (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/marker.rs (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/parser.rs (93%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/upsampler.rs (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/worker/immediate.rs (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/worker/mod.rs (100%) rename third_party/cargo/vendor/{jpeg-decoder-0.1.18 => jpeg-decoder-0.1.19}/src/worker/threaded.rs (100%) delete mode 100644 third_party/cargo/vendor/libc-0.2.67/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/align.rs delete mode 100644 third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/compat.rs create mode 100644 third_party/cargo/vendor/libc-0.2.71/.cargo-checksum.json rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/BUILD (97%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/CONTRIBUTING.md (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/Cargo.toml (90%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/LICENSE-APACHE (100%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/LICENSE-MIT rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/README.md (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/build.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/rustfmt.toml (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/cloudabi/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/cloudabi/arm.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/cloudabi/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/cloudabi/x86.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/cloudabi/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/fixed_width_ints.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/fuchsia/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/fuchsia/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/fuchsia/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/fuchsia/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/fuchsia/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/hermit/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/hermit/mod.rs (77%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/hermit/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/lib.rs (89%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/macros.rs (100%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/src/psp.rs rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/sgx.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/switch.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/apple/b32/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/apple/b32/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/apple/b64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/apple/b64/mod.rs (51%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/apple/mod.rs (95%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/dragonfly/errno.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/dragonfly/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/arm.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/x86.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/freebsdlike/mod.rs (94%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/mod.rs (90%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/arm.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/mod.rs (96%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/powerpc.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/sparc64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/x86.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/netbsd/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/openbsd/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/openbsd/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/openbsd/sparc64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/openbsd/x86.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/bsd/netbsdlike/openbsd/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/haiku/b32.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/haiku/b64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/haiku/mod.rs (97%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/hermit/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/hermit/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/hermit/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b32/arm.rs (68%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b32/mod.rs (93%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b32/x86/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b32/x86/mod.rs (72%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b64/aarch64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b64/aarch64/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b64/mod.rs (96%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b64/x86_64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/b64/x86_64/mod.rs (65%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/android/mod.rs (94%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/emscripten/align.rs (97%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/emscripten/mod.rs (92%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/emscripten/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/align.rs (89%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/arm/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/arm/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/mips/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/mips/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/mod.rs (97%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/powerpc.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/sparc/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/x86/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b32/x86/mod.rs (99%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs (93%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/mips64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs (90%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/s390x.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/mod.rs (74%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/gnu/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/mod.rs (89%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/arm/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/arm/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/hexagon.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/mips/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/mips/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/powerpc.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/x86/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b32/x86/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67/src/unix/linux_like/linux/gnu => libc-0.2.71/src/unix/linux_like/linux/musl}/b64/aarch64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b64/mips64.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b64/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b64/powerpc64.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b64/x86_64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/musl/mod.rs (84%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/linux/no_align.rs (88%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/linux_like/mod.rs (96%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/newlib/aarch64/mod.rs (75%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/newlib/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/newlib/arm/mod.rs (75%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/newlib/mod.rs (94%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/newlib/no_align.rs (100%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/xtensa/mod.rs rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/redox/mod.rs (96%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/compat.rs create mode 100644 third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/illumos.rs rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/solarish/mod.rs (95%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/solaris.rs rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/arm/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/arm/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/arm/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mips32/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mips32/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mips32/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mips64/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mips64/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mips64/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mips/mod.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/mod.rs (98%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/no_align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/x86_64/align.rs (90%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/x86_64/l4re.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/x86_64/mod.rs (96%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/x86_64/no_align.rs (87%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/unix/uclibc/x86_64/other.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/aarch64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/arm.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/mod.rs (97%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/powerpc.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/powerpc64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/x86.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/vxworks/x86_64.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/wasi.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/windows/gnu/align.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/windows/gnu/mod.rs (65%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/windows/mod.rs (99%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/src/windows/msvc.rs (100%) rename third_party/cargo/vendor/{libc-0.2.67 => libc-0.2.71}/tests/const_fn.rs (100%) create mode 100644 third_party/cargo/vendor/libc-0.2.71/triagebot.toml delete mode 100644 third_party/cargo/vendor/libloading-0.5.2/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/libloading-0.5.2/appveyor.yml delete mode 100644 third_party/cargo/vendor/libloading-0.5.2/build.rs delete mode 100644 third_party/cargo/vendor/libloading-0.5.2/src/os/unix/global_static.c delete mode 100644 third_party/cargo/vendor/libloading-0.5.2/src/util.rs create mode 100644 third_party/cargo/vendor/libloading-0.6.2/.cargo-checksum.json rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/BUILD (97%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/Cargo.toml (94%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/LICENSE (100%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/README.mkd (62%) create mode 100644 third_party/cargo/vendor/libloading-0.6.2/build.rs rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/src/changelog.rs (63%) create mode 100644 third_party/cargo/vendor/libloading-0.6.2/src/error.rs rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/src/lib.rs (89%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/src/os/mod.rs (100%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/src/os/unix/mod.rs (56%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/src/os/windows/mod.rs (70%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/src/test_helpers.rs (100%) create mode 100644 third_party/cargo/vendor/libloading-0.6.2/src/util.rs rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/tests/functions.rs (89%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/tests/markers.rs (100%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/tests/nagisa32.dll (100%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/tests/nagisa64.dll (100%) rename third_party/cargo/vendor/{libloading-0.5.2 => libloading-0.6.2}/tests/windows.rs (100%) delete mode 100644 third_party/cargo/vendor/lock_api-0.3.3/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/lock_api-0.3.4/.cargo-checksum.json rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/BUILD (97%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/Cargo.toml (98%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/src/lib.rs (96%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/src/mutex.rs (97%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/src/remutex.rs (96%) rename third_party/cargo/vendor/{lock_api-0.3.3 => lock_api-0.3.4}/src/rwlock.rs (99%) delete mode 100644 third_party/cargo/vendor/mio-0.6.21/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/mio-0.6.21/azure-pipelines.yml delete mode 100644 third_party/cargo/vendor/mio-0.6.21/benches/bench_poll.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/ci/azure-cross-compile.yml delete mode 100644 third_party/cargo/vendor/mio-0.6.21/ci/azure-deploy-docs.yml delete mode 100644 third_party/cargo/vendor/mio-0.6.21/ci/azure-install-rust.yml delete mode 100644 third_party/cargo/vendor/mio-0.6.21/ci/azure-test-stable.yml delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/benchmark.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/mod.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_battery.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_broken_pipe.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_close_on_drop.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_custom_evented.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_double_register.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_echo_server.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_fuchsia_handles.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_local_addr_ready.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_multicast.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_notify.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_oneshot.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_poll.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_poll_channel.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_register_deregister.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_register_multiple_event_loops.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_reregister_without_poll.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_smoke.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_subprocess_pipe.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_tcp.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_tcp_level.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_tcp_shutdown.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_tick.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_udp_level.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_udp_socket.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_uds_shutdown.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_unix_echo_server.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_unix_pass_fd.rs delete mode 100644 third_party/cargo/vendor/mio-0.6.21/test/test_write_then_drop.rs create mode 100644 third_party/cargo/vendor/mio-0.6.22/.cargo-checksum.json rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/BUILD (84%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/CHANGELOG.md (98%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/Cargo.toml (86%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/LICENSE (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/README.md (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/channel.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/deprecated/event_loop.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/deprecated/handler.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/deprecated/io.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/deprecated/mod.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/deprecated/notify.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/deprecated/unix.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/event_imp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/io.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/lazycell.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/lib.rs (99%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/net/mod.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/net/tcp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/net/udp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/poll.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/awakener.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/eventedfd.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/handles.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/mod.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/net.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/ready.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/fuchsia/selector.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/mod.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/awakener.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/dlsym.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/epoll.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/eventedfd.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/io.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/kqueue.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/mod.rs (91%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/ready.rs (93%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/tcp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/udp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/uds.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/unix/uio.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/awakener.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/buffer_pool.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/from_raw_arc.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/mod.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/selector.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/tcp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/sys/windows/udp.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/timer.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/token.rs (100%) rename third_party/cargo/vendor/{mio-0.6.21 => mio-0.6.22}/src/udp.rs (100%) create mode 100644 third_party/cargo/vendor/ndk-0.1.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/ndk-0.1.0/BUILD create mode 100644 third_party/cargo/vendor/ndk-0.1.0/Cargo.toml create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/asset.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/configuration.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/event.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/input_queue.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/lib.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/looper.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/native_activity.rs create mode 100644 third_party/cargo/vendor/ndk-0.1.0/src/native_window.rs create mode 100644 third_party/cargo/vendor/ndk-glue-0.1.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/ndk-glue-0.1.0/BUILD create mode 100644 third_party/cargo/vendor/ndk-glue-0.1.0/Cargo.toml create mode 100644 third_party/cargo/vendor/ndk-glue-0.1.0/src/lib.rs create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/BUILD create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/Cargo.toml create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/generate_bindings.sh create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_aarch64.rs create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_arm.rs create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_i686.rs create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_x86_64.rs create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/src/lib.rs create mode 100644 third_party/cargo/vendor/ndk-sys-0.1.0/wrapper.h delete mode 100644 third_party/cargo/vendor/net2-0.2.33/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/net2-0.2.33/appveyor.yml delete mode 100644 third_party/cargo/vendor/net2-0.2.33/tests/all.rs create mode 100644 third_party/cargo/vendor/net2-0.2.34/.cargo-checksum.json rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/BUILD (86%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/Cargo.toml (69%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{libc-0.2.67 => net2-0.2.34}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/README.md (62%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/ext.rs (95%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/lib.rs (90%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/socket.rs (98%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/sys/redox/impls.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/sys/redox/mod.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/sys/unix/impls.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/sys/unix/mod.rs (89%) create mode 100644 third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/impls.rs create mode 100644 third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/mod.rs rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/sys/windows/impls.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/sys/windows/mod.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/tcp.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/udp.rs (100%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/unix.rs (92%) rename third_party/cargo/vendor/{net2-0.2.33 => net2-0.2.34}/src/utils.rs (100%) delete mode 100644 third_party/cargo/vendor/num-rational-0.2.3/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/num-rational-0.2.4/.cargo-checksum.json rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/BUILD (97%) rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/Cargo.toml (98%) rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{net2-0.2.33 => num-rational-0.2.4}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/README.md (100%) rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/RELEASES.md (92%) rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/build.rs (100%) rename third_party/cargo/vendor/{num-rational-0.2.3 => num-rational-0.2.4}/src/lib.rs (92%) delete mode 100644 third_party/cargo/vendor/num_cpus-1.12.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/.cargo-checksum.json rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/BUILD (91%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/CHANGELOG.md (95%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/CONTRIBUTING.md (100%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/Cargo.lock (71%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/Cargo.toml (94%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/README.md (100%) create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/ci/cgroups/Dockerfile rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/examples/values.rs (100%) create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_period_us create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_quota_us create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/cgroup create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/mountinfo rename third_party/cargo/vendor/{num_cpus-1.12.0 => num_cpus-1.13.0}/src/lib.rs (85%) create mode 100644 third_party/cargo/vendor/num_cpus-1.13.0/src/linux.rs create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/BUILD create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/Cargo.toml create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/LICENSE create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/README.md create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/src/lib.rs create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/tests/lib.rs create mode 100644 third_party/cargo/vendor/num_enum-0.4.3/tests/renamed_num_enum.rs create mode 100644 third_party/cargo/vendor/num_enum_derive-0.4.3/.cargo-checksum.json rename third_party/cargo/vendor/{arrayvec-0.5.1 => num_enum_derive-0.4.3}/BUILD (63%) create mode 100644 third_party/cargo/vendor/num_enum_derive-0.4.3/Cargo.toml create mode 100644 third_party/cargo/vendor/num_enum_derive-0.4.3/LICENSE create mode 100644 third_party/cargo/vendor/num_enum_derive-0.4.3/src/lib.rs create mode 100644 third_party/cargo/vendor/objc-0.2.7/Cargo.lock delete mode 100644 third_party/cargo/vendor/parking_lot-0.10.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/parking_lot-0.10.2/.cargo-checksum.json rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/BUILD (78%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/CHANGELOG.md (87%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/Cargo.toml (92%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/README.md (96%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/appveyor.yml (100%) create mode 100644 third_party/cargo/vendor/parking_lot-0.10.2/bors.toml rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/condvar.rs (99%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/deadlock.rs (98%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/elision.rs (75%) create mode 100644 third_party/cargo/vendor/parking_lot-0.10.2/src/fair_mutex.rs rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/lib.rs (69%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/mutex.rs (97%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/once.rs (100%) create mode 100644 third_party/cargo/vendor/parking_lot-0.10.2/src/raw_fair_mutex.rs rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/raw_mutex.rs (100%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/raw_rwlock.rs (100%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/remutex.rs (90%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/rwlock.rs (96%) rename third_party/cargo/vendor/{parking_lot-0.10.0 => parking_lot-0.10.2}/src/util.rs (100%) create mode 100644 third_party/cargo/vendor/parking_lot-0.10.2/tests/issue_203.rs rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/.cargo-checksum.json (82%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/BUILD (85%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/Cargo.toml (97%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/lib.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/parking_lot.rs (96%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/spinwait.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/cloudabi.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/generic.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/linux.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/mod.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/redox.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/sgx.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/unix.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/wasm.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/wasm_atomic.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/windows/keyed_event.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/windows/mod.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/thread_parker/windows/waitaddress.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/util.rs (100%) rename third_party/cargo/vendor/{parking_lot_core-0.7.0 => parking_lot_core-0.7.2}/src/word_lock.rs (100%) delete mode 100644 third_party/cargo/vendor/png-0.16.1/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/png-0.16.1/benches/decoder.rs delete mode 100644 third_party/cargo/vendor/png-0.16.1/src/filter.rs delete mode 100644 third_party/cargo/vendor/png-0.16.1/src/traits.rs create mode 100644 third_party/cargo/vendor/png-0.16.3/.cargo-checksum.json rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/BUILD (93%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/CHANGES.md (84%) create mode 100644 third_party/cargo/vendor/png-0.16.3/Cargo.lock rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/Cargo.toml (91%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/README.md (100%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/benches/README.md (100%) create mode 100644 third_party/cargo/vendor/png-0.16.3/benches/decoder.rs rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/examples/pngcheck.rs (83%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/examples/show.rs (54%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/chunk.rs (99%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/common.rs (95%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/decoder/mod.rs (65%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/decoder/stream.rs (73%) rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/encoder.rs (76%) create mode 100644 third_party/cargo/vendor/png-0.16.3/src/filter.rs rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/lib.rs (90%) create mode 100644 third_party/cargo/vendor/png-0.16.3/src/traits.rs rename third_party/cargo/vendor/{png-0.16.1 => png-0.16.3}/src/utils.rs (62%) create mode 100644 third_party/cargo/vendor/proc-macro-crate-0.1.4/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/proc-macro-crate-0.1.4/BUILD create mode 100644 third_party/cargo/vendor/proc-macro-crate-0.1.4/Cargo.toml create mode 100644 third_party/cargo/vendor/proc-macro-crate-0.1.4/README.md create mode 100644 third_party/cargo/vendor/proc-macro-crate-0.1.4/src/lib.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/BUILD create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/Cargo.toml rename third_party/cargo/vendor/{regex-1.3.5 => proc-macro2-1.0.17}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => proc-macro2-1.0.17}/LICENSE-MIT (95%) create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/README.md create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/build.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/src/detection.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/src/fallback.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/src/lib.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/src/parse.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/src/strnom.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/src/wrapper.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/tests/comments.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/tests/features.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/tests/marker.rs create mode 100644 third_party/cargo/vendor/proc-macro2-1.0.17/tests/test.rs create mode 100644 third_party/cargo/vendor/quick-error-1.2.3/Cargo.lock create mode 100644 third_party/cargo/vendor/quote-1.0.6/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/quote-1.0.6/BUILD create mode 100644 third_party/cargo/vendor/quote-1.0.6/Cargo.toml rename third_party/cargo/vendor/{regex-syntax-0.6.17 => quote-1.0.6}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{arrayvec-0.5.1 => quote-1.0.6}/LICENSE-MIT (95%) create mode 100644 third_party/cargo/vendor/quote-1.0.6/README.md create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/ext.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/format.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/ident_fragment.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/lib.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/runtime.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/spanned.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/src/to_tokens.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/compiletest.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/test.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated-dup.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-separated.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/not-quotable.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/not-repeatable.rs create mode 100644 third_party/cargo/vendor/quote-1.0.6/tests/ui/wrong-type-span.rs rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/.cargo-checksum.json (83%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/BUILD (96%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/CHANGELOG.md (94%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/Cargo.lock (90%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/Cargo.toml (93%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/HACKING.md (100%) rename third_party/cargo/vendor/{smallvec-1.2.0 => regex-1.3.9}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{num-rational-0.2.3 => regex-1.3.9}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/PERFORMANCE.md (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/README.md (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/UNICODE.md (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/regexdna-input.txt (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/regexdna-output.txt (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/shootout-regex-dna-bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/shootout-regex-dna-cheat.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/shootout-regex-dna-replace.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/shootout-regex-dna-single-cheat.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/shootout-regex-dna-single.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/examples/shootout-regex-dna.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/rustfmt.toml (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/backtrack.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/cache.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/compile.rs (83%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/dfa.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/error.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/exec.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/expand.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/find_byte.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/freqs.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/input.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/lib.rs (99%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/literal/imp.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/literal/mod.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/pattern.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/pikevm.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/prog.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/re_builder.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/re_bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/re_set.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/re_trait.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/re_unicode.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/sparse.rs (91%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/testdata/LICENSE (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/testdata/README (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/testdata/basic.dat (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/testdata/nullsubexpr.dat (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/testdata/repetition.dat (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/src/utf8.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/test (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/api.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/api_str.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/consistent.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/crates_regex.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/crazy.rs (92%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/flags.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/fowler.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/macros.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/macros_bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/macros_str.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/misc.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/multiline.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/noparse.rs (86%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/regression.rs (96%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/replace.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/searcher.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/set.rs (75%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/shortest_match.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/suffix_reverse.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_backtrack.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_backtrack_bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_backtrack_utf8bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_crates_regex.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_default.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_default_bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_nfa.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_nfa_bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/test_nfa_utf8bytes.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/unicode.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/word_boundary.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/word_boundary_ascii.rs (100%) rename third_party/cargo/vendor/{regex-1.3.5 => regex-1.3.9}/tests/word_boundary_unicode.rs (100%) delete mode 100644 third_party/cargo/vendor/regex-syntax-0.6.17/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/regex-syntax-0.6.18/.cargo-checksum.json rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/BUILD (94%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/Cargo.toml (98%) create mode 100644 third_party/cargo/vendor/regex-syntax-0.6.18/LICENSE-APACHE rename third_party/cargo/vendor/{regex-1.3.5 => regex-syntax-0.6.18}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/README.md (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/benches/bench.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/ast/mod.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/ast/parse.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/ast/print.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/ast/visitor.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/either.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/error.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/hir/interval.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/hir/literal/mod.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/hir/mod.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/hir/print.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/hir/translate.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/hir/visitor.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/lib.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/parser.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/LICENSE-UNICODE (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/age.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/case_folding_simple.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/general_category.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/grapheme_cluster_break.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/mod.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/perl_decimal.rs (90%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/perl_space.rs (76%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/perl_word.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/property_bool.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/property_names.rs (98%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/property_values.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/script.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/script_extension.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/sentence_break.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/unicode_tables/word_break.rs (99%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/src/utf8.rs (100%) rename third_party/cargo/vendor/{regex-syntax-0.6.17 => regex-syntax-0.6.18}/test (100%) rename third_party/cargo/vendor/{png-0.16.1 => rusttype-0.7.9}/Cargo.lock (63%) delete mode 100644 third_party/cargo/vendor/rusttype-0.8.2/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/rusttype-0.8.3/.cargo-checksum.json rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/BUILD (92%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/CHANGELOG.md (98%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/Cargo.toml (96%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/LICENSE-APACHE (100%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/README.md (100%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/rustfmt.toml (100%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/src/geometry.rs (96%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/src/gpu_cache.rs (98%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/src/lib.rs (100%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/src/nostd_float.rs (100%) rename third_party/cargo/vendor/{rusttype-0.8.2 => rusttype-0.8.3}/src/rasterizer.rs (93%) create mode 100644 third_party/cargo/vendor/same-file-1.0.6/Cargo.lock create mode 100644 third_party/cargo/vendor/serde-1.0.110/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/serde-1.0.110/BUILD create mode 100644 third_party/cargo/vendor/serde-1.0.110/Cargo.toml create mode 100644 third_party/cargo/vendor/serde-1.0.110/LICENSE-APACHE create mode 100644 third_party/cargo/vendor/serde-1.0.110/LICENSE-MIT create mode 100644 third_party/cargo/vendor/serde-1.0.110/README.md create mode 100644 third_party/cargo/vendor/serde-1.0.110/build.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/crates-io.md create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/de/from_primitive.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/de/ignored_any.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/de/impls.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/de/mod.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/de/utf8.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/de/value.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/export.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/integer128.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/lib.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/macros.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/private/de.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/private/macros.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/private/mod.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/private/ser.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/ser/fmt.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/ser/impls.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/ser/impossible.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/ser/mod.rs create mode 100644 third_party/cargo/vendor/serde-1.0.110/src/std_error.rs delete mode 100644 third_party/cargo/vendor/smallvec-1.2.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/smallvec-1.4.0/.cargo-checksum.json rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/BUILD (97%) rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/Cargo.toml (96%) create mode 100644 third_party/cargo/vendor/smallvec-1.4.0/LICENSE-APACHE rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/README.md (100%) rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/benches/bench.rs (100%) rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/lib.rs (91%) rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/scripts/run_miri.sh (76%) rename third_party/cargo/vendor/{smallvec-1.2.0 => smallvec-1.4.0}/specialization.rs (100%) create mode 100644 third_party/cargo/vendor/stb_truetype-0.3.1/Cargo.lock create mode 100644 third_party/cargo/vendor/syn-1.0.27/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/syn-1.0.27/BUILD create mode 100644 third_party/cargo/vendor/syn-1.0.27/Cargo.toml create mode 100644 third_party/cargo/vendor/syn-1.0.27/LICENSE-APACHE create mode 100644 third_party/cargo/vendor/syn-1.0.27/LICENSE-MIT create mode 100644 third_party/cargo/vendor/syn-1.0.27/README.md create mode 100644 third_party/cargo/vendor/syn-1.0.27/benches/file.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/benches/rust.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/build.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/attr.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/await.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/bigint.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/buffer.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/custom_keyword.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/custom_punctuation.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/data.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/derive.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/discouraged.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/error.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/export.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/expr.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/ext.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/file.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/gen/fold.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/gen/visit.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/gen/visit_mut.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/gen_helper.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/generics.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/group.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/ident.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/item.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/lib.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/lifetime.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/lit.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/lookahead.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/mac.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/macros.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/op.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/parse.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/parse_macro_input.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/parse_quote.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/pat.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/path.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/print.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/punctuated.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/sealed.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/span.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/spanned.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/stmt.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/thread.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/token.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/tt.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/ty.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/src/verbatim.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/common/eq.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/common/mod.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/common/parse.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/debug/gen.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/debug/mod.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/macros/mod.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/repo/mod.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/repo/progress.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_asyncness.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_attribute.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_derive_input.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_expr.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_generics.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_grouping.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_ident.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_iterators.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_lit.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_meta.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_parse_buffer.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_pat.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_path.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_precedence.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_receiver.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_round_trip.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_should_parse.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_size.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_stmt.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_token_trees.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_ty.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/test_visibility.rs create mode 100644 third_party/cargo/vendor/syn-1.0.27/tests/zzz_stable.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/toml-0.5.6/BUILD create mode 100644 third_party/cargo/vendor/toml-0.5.6/Cargo.lock create mode 100644 third_party/cargo/vendor/toml-0.5.6/Cargo.toml create mode 100644 third_party/cargo/vendor/toml-0.5.6/LICENSE-APACHE create mode 100644 third_party/cargo/vendor/toml-0.5.6/LICENSE-MIT create mode 100644 third_party/cargo/vendor/toml-0.5.6/README.md create mode 100644 third_party/cargo/vendor/toml-0.5.6/examples/decode.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/examples/enum_external.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/examples/toml2json.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/datetime.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/de.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/lib.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/macros.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/map.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/ser.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/spanned.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/tokens.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/src/value.rs create mode 100644 third_party/cargo/vendor/toml-0.5.6/tests/enum_external_deserialize.rs create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/BUILD create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/COPYRIGHT create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/Cargo.toml create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/LICENSE-APACHE create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/LICENSE-MIT create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/README.md create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/src/lib.rs create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/src/tables.rs create mode 100644 third_party/cargo/vendor/unicode-xid-0.2.0/src/tests.rs rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/.cargo-checksum.json (57%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/BUILD (97%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/COPYING (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/Cargo.toml (93%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/LICENSE-MIT (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/README.md (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/UNLICENSE (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/rustfmt.toml (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/src/console.rs (93%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/src/file.rs (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/src/lib.rs (100%) rename third_party/cargo/vendor/{winapi-util-0.1.3 => winapi-util-0.1.5}/src/win.rs (100%) delete mode 100644 third_party/cargo/vendor/winit-0.22.0/.cargo-checksum.json delete mode 100644 third_party/cargo/vendor/winit-0.22.0/src/platform/android.rs delete mode 100644 third_party/cargo/vendor/winit-0.22.0/src/platform_impl/android/ffi.rs delete mode 100644 third_party/cargo/vendor/winit-0.22.0/src/platform_impl/android/mod.rs delete mode 100644 third_party/cargo/vendor/winit-0.22.0/src/platform_impl/web/stdweb/timeout.rs delete mode 100644 third_party/cargo/vendor/winit-0.22.0/src/platform_impl/web/web_sys/timeout.rs delete mode 100644 third_party/cargo/vendor/winit-0.22.0/src/platform_impl/windows/event_loop/runner.rs create mode 100644 third_party/cargo/vendor/winit-0.22.2/.cargo-checksum.json rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/BUILD (91%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/CHANGELOG.md (98%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/CONTRIBUTING.md (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/Cargo.lock (82%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/Cargo.toml (88%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/FEATURES.md (98%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/HALL_OF_CHAMPIONS.md (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/LICENSE (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/README.md (81%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/control_flow.rs (91%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/cursor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/cursor_grab.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/custom_events.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/fullscreen.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/handling_close.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/icon.png (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/min_max_size.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/minimize.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/monitor_list.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/multithreaded.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/multiwindow.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/request_redraw.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/request_redraw_threaded.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/resizable.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/timer.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/transparent.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/video_modes.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/web.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/window.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/window_debug.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/window_icon.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/examples/window_run_return.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/rustfmt.toml (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/dpi.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/error.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/event.rs (87%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/event_loop.rs (98%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/icon.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/lib.rs (82%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/monitor.rs (100%) create mode 100644 third_party/cargo/vendor/winit-0.22.2/src/platform/android.rs rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/desktop.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/ios.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/macos.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/unix.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/web.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform/windows.rs (100%) create mode 100644 third_party/cargo/vendor/winit-0.22.2/src/platform_impl/android/mod.rs rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/app_state.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/event_loop.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/ffi.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/monitor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/view.rs (97%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/ios/window.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/mod.rs (99%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/wayland/event_loop.rs (94%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/wayland/keyboard.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/wayland/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/wayland/pointer.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/wayland/touch.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/wayland/window.rs (89%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/dnd.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/event_processor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/events.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/ffi.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/ime/callbacks.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/ime/context.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/ime/inner.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/ime/input_method.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/ime/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/mod.rs (94%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/monitor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/atom.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/client_msg.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/cursor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/format.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/geometry.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/hint.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/icon.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/input.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/keys.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/memory.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/modifiers.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/randr.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/window_property.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/util/wm.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/window.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/linux/x11/xdisplay.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/activation_hack.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/app.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/app_delegate.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/app_state.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/event.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/event_loop.rs (97%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/ffi.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/monitor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/observer.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/util/async.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/util/cursor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/util/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/view.rs (99%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/window.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/macos/window_delegate.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/device.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/error.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/event_loop/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/event_loop/proxy.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/event_loop/runner.rs (97%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/event_loop/state.rs (94%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/event_loop/window_target.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/monitor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/stdweb/canvas.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/stdweb/event.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/stdweb/mod.rs (97%) create mode 100644 third_party/cargo/vendor/winit-0.22.2/src/platform_impl/web/stdweb/timeout.rs rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/web_sys/canvas.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/web_sys/event.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/web_sys/mod.rs (98%) create mode 100644 third_party/cargo/vendor/winit-0.22.2/src/platform_impl/web/web_sys/timeout.rs rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/web/window.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/dark_mode.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/dpi.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/drop_handler.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/event.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/event_loop.rs (84%) create mode 100644 third_party/cargo/vendor/winit-0.22.2/src/platform_impl/windows/event_loop/runner.rs rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/icon.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/mod.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/monitor.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/raw_input.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/util.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/window.rs (99%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/platform_impl/windows/window_state.rs (99%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/src/window.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/tests/send_objects.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/tests/serde_objects.rs (100%) rename third_party/cargo/vendor/{winit-0.22.0 => winit-0.22.2}/tests/sync_object.rs (100%) delete mode 100644 third_party/cargo/vendor/xml-rs-0.8.0/.cargo-checksum.json create mode 100644 third_party/cargo/vendor/xml-rs-0.8.3/.cargo-checksum.json rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/BUILD (96%) create mode 100644 third_party/cargo/vendor/xml-rs-0.8.3/Cargo.lock rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/Cargo.toml (73%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/Changelog.md (72%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/LICENSE (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/Readme.md (94%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/design.md (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/analyze.rs (99%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/attribute.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/common.rs (98%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/escape.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/lib.rs (78%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/macros.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/name.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/namespace.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/config.rs (85%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/error.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/events.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/lexer.rs (96%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/mod.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_cdata.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_closing_tag_name.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_comment.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_declaration.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_doctype.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_opening_tag.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_processing_instruction.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/inside_reference.rs (62%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/mod.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/reader/parser/outside_tag.rs (97%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/util.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/writer/config.rs (89%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/writer/emitter.rs (98%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/writer/events.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/src/writer/mod.rs (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_1.xml (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_1_full.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_1_short.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_2.xml (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_2_full.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_2_short.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_3.xml (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_3_full.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_3_short.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_4.xml (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_4_full.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_4_short.txt (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_5.xml (100%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/documents/sample_5_short.txt (100%) create mode 100644 third_party/cargo/vendor/xml-rs-0.8.3/tests/documents/sample_6.xml create mode 100644 third_party/cargo/vendor/xml-rs-0.8.3/tests/documents/sample_6_full.txt rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/event_reader.rs (81%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/event_writer.rs (83%) rename third_party/cargo/vendor/{xml-rs-0.8.0 => xml-rs-0.8.3}/tests/streaming.rs (99%) diff --git a/third_party/cargo/Cargo.lock b/third_party/cargo/Cargo.lock index edcf070..8401c62 100644 --- a/third_party/cargo/Cargo.lock +++ b/third_party/cargo/Cargo.lock @@ -30,10 +30,10 @@ dependencies = [ ] [[package]] -name = "android_glue" -version = "0.2.3" +name = "android_log-sys" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +checksum = "b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e" [[package]] name = "approx" @@ -44,12 +44,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - [[package]] name = "atty" version = "0.2.14" @@ -110,9 +104,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.50" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" +checksum = "7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311" [[package]] name = "cfg-if" @@ -142,9 +136,9 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.42" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" +checksum = "0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb" dependencies = [ "cc", ] @@ -166,9 +160,9 @@ dependencies = [ [[package]] name = "cocoa" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4736c86d51bd878b474400d9ec888156f4037015f5d09794fab9f26eab1ad4" +checksum = "8f7b6f3f7f4f0b3ec5c5039aaa9e8c3cef97a7a480a400fd62944841314f293d" dependencies = [ "bitflags", "block", @@ -191,6 +185,7 @@ version = "1.33.7" dependencies = [ "cgmath", "env_logger", + "flatbuffers", "image", "log", "openvr", @@ -257,13 +252,13 @@ dependencies = [ [[package]] name = "core-video-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dc065219542086f72d1e9f7aadbbab0989e980263695d129d502082d063a9d0" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" dependencies = [ "cfg-if", - "core-foundation-sys 0.6.2", - "core-graphics 0.17.3", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.0", "libc", "objc", ] @@ -329,9 +324,9 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" +checksum = "ab6bffe714b6bb07e42f201352c34f51fefd355ace793f9e638ebd52d23f98d2" dependencies = [ "cfg-if", "crossbeam-utils", @@ -350,14 +345,25 @@ dependencies = [ [[package]] name = "deflate" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "050ef6de42a33903b30a7497b76b40d3d58691d4d3eec355348c122444a388f0" +checksum = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" dependencies = [ "adler32", "byteorder", ] +[[package]] +name = "derivative" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" +dependencies = [ + "proc-macro2 1.0.17", + "quote 1.0.6", + "syn", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -366,9 +372,9 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dlib" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" +checksum = "b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76" dependencies = [ "libloading", ] @@ -399,10 +405,19 @@ dependencies = [ ] [[package]] -name = "fnv" -version = "1.0.6" +name = "flatbuffers" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +checksum = "a788f068dd10687940565bf4b5480ee943176cbd114b12e811074bcf7c04e4b9" +dependencies = [ + "smallvec", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foreign-types" @@ -453,15 +468,15 @@ dependencies = [ [[package]] name = "half" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36b5f248235f45773d4944f555f83ea61fe07b18b561ccf99d7483d7381e54d" +checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" [[package]] name = "hermit-abi" -version = "0.1.8" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8" +checksum = "91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71" dependencies = [ "libc", ] @@ -477,9 +492,9 @@ dependencies = [ [[package]] name = "image" -version = "0.23.1" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f0c29211dc50a78eb53eeeae87945d44cb63071881834212f36677fccb2b4" +checksum = "9117f4167a8f21fa2bb3f17a652a760acd7572645281c98e3b612a26242c96ee" dependencies = [ "bytemuck", "byteorder", @@ -504,9 +519,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c346c299e3fe8ef94dc10c2c0253d858a69aac1245157a3bf4125915d528caf" +checksum = "7777a24a1ce5de49fcdde84ec46efa487c3af49d5b6e6e0a50367cc5c1096182" [[package]] name = "iovec" @@ -518,10 +533,16 @@ dependencies = [ ] [[package]] -name = "jpeg-decoder" -version = "0.1.18" +name = "jni-sys" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0256f0aec7352539102a9efbcb75543227b7ab1117e0f95450023af730128451" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jpeg-decoder" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" dependencies = [ "byteorder", "rayon", @@ -551,17 +572,16 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" -version = "0.2.67" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" [[package]] name = "libloading" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +checksum = "2cadb8e769f070c45df05c78c7520eb4cd17061d4ab262e43cfc68b4d00ac71c" dependencies = [ - "cc", "winapi 0.3.8", ] @@ -576,9 +596,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ "scopeguard", ] @@ -664,9 +684,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.21" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ "cfg-if", "fuchsia-zircon", @@ -706,10 +726,41 @@ dependencies = [ ] [[package]] -name = "net2" -version = "0.2.33" +name = "ndk" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +checksum = "95a356cafe20aee088789830bfea3a61336e84ded9e545e00d3869ce95dcb80c" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum", +] + +[[package]] +name = "ndk-glue" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1730ee2e3de41c3321160a6da815f008c4006d71b095880ea50e17cf52332b8" +dependencies = [ + "android_log-sys", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-sys", +] + +[[package]] +name = "ndk-sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2820aca934aba5ed91c79acc72b6a44048ceacc5d36c035ed4e051f12d887d" + +[[package]] +name = "net2" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if", "libc", @@ -752,9 +803,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3" +checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ "autocfg 1.0.0", "num-integer", @@ -772,14 +823,36 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ "hermit-abi", "libc", ] +[[package]] +name = "num_enum" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.17", + "quote 1.0.6", + "syn", +] + [[package]] name = "objc" version = "0.2.7" @@ -829,9 +902,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.10.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ "lock_api", "parking_lot_core", @@ -839,9 +912,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ "cfg-if", "cloudabi", @@ -865,9 +938,9 @@ checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" [[package]] name = "png" -version = "0.16.1" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46060468187c21c00ffa2a920690b29997d7fd543f5a4d400461e4a7d4fccde8" +checksum = "2c68a431ed29933a4eb5709aca9800989758c97759345860fa5db3cfced0b65d" dependencies = [ "bitflags", "crc32fast", @@ -875,13 +948,31 @@ dependencies = [ "inflate", ] +[[package]] +name = "proc-macro-crate" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" +dependencies = [ + "toml", +] + [[package]] name = "proc-macro2" version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" dependencies = [ - "unicode-xid", + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101" +dependencies = [ + "unicode-xid 0.2.0", ] [[package]] @@ -896,7 +987,16 @@ version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" dependencies = [ - "proc-macro2", + "proc-macro2 0.4.30", +] + +[[package]] +name = "quote" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea" +dependencies = [ + "proc-macro2 1.0.17", ] [[package]] @@ -1055,9 +1155,9 @@ checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" [[package]] name = "regex" -version = "1.3.5" +version = "1.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" dependencies = [ "aho-corasick", "memchr", @@ -1067,9 +1167,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" [[package]] name = "rusttype" @@ -1077,17 +1177,16 @@ version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5" dependencies = [ - "rusttype 0.8.2", + "rusttype 0.8.3", ] [[package]] name = "rusttype" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14a911032fb5791ccbeec9f28fdcb9bf0983b81f227bafdfd227c658d0731c8a" +checksum = "9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0" dependencies = [ "approx", - "arrayvec", "ordered-float", "stb_truetype", ] @@ -1113,6 +1212,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "serde" +version = "1.0.110" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c" + [[package]] name = "shared_library" version = "0.1.9" @@ -1131,9 +1236,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.2.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" +checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" [[package]] name = "smithay-client-toolkit" @@ -1160,6 +1265,17 @@ dependencies = [ "byteorder", ] +[[package]] +name = "syn" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de" +dependencies = [ + "proc-macro2 1.0.17", + "quote 1.0.6", + "unicode-xid 0.2.0", +] + [[package]] name = "termcolor" version = "1.1.0" @@ -1189,12 +1305,27 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "toml" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a" +dependencies = [ + "serde", +] + [[package]] name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" + [[package]] name = "vk-sys" version = "0.5.1" @@ -1228,7 +1359,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc7e4c74bbf33d0c6b9f7e98f47068c62dc65d6a0721c0cb4b05fe4776c9af80" dependencies = [ - "cocoa 0.20.0", + "cocoa 0.20.1", "metal", "objc", "vulkano", @@ -1291,8 +1422,8 @@ version = "0.23.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93b02247366f395b9258054f964fe293ddd019c3237afba9be2ccbe9e1651c3d" dependencies = [ - "proc-macro2", - "quote", + "proc-macro2 0.4.30", + "quote 0.6.13", "xml-rs", ] @@ -1336,9 +1467,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ "winapi 0.3.8", ] @@ -1351,15 +1482,14 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winit" -version = "0.22.0" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e9092b71b48ad6a0d98835a786308d10760cc09369d02e4a166608327f1f26" +checksum = "1e4ccbf7ddb6627828eace16cacde80fc6bf4dbb3469f88487262a02cf8e7862" dependencies = [ - "android_glue", "bitflags", - "cocoa 0.19.1", - "core-foundation 0.6.4", - "core-graphics 0.17.3", + "cocoa 0.20.1", + "core-foundation 0.7.0", + "core-graphics 0.19.0", "core-video-sys", "dispatch", "instant", @@ -1368,6 +1498,9 @@ dependencies = [ "log", "mio", "mio-extras", + "ndk", + "ndk-glue", + "ndk-sys", "objc", "parking_lot", "percent-encoding", @@ -1408,6 +1541,6 @@ checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" [[package]] name = "xml-rs" -version = "0.8.0" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5" +checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a" diff --git a/third_party/cargo/Cargo.toml b/third_party/cargo/Cargo.toml index 5584cbc..f285cae 100644 --- a/third_party/cargo/Cargo.toml +++ b/third_party/cargo/Cargo.toml @@ -15,6 +15,7 @@ vulkano-win = "0.18.0" winit = "0.22.0" cgmath = "0.17.0" openvr = "0.6.0" +flatbuffers = "0.6.1" [raze] workspace_path = "//third_party/cargo" @@ -22,7 +23,7 @@ target = "x86_64-unknown-linux-gnu" [raze.crates.andrew.'0.2.1'] skipped_deps = ['rusttype-0.7.9'] -additional_deps = ['//third_party/cargo/vendor/rusttype-0.8.2:rusttype'] +additional_deps = ['//third_party/cargo/vendor/rusttype-0.8.3:rusttype'] [raze.crates.x11-dl.'2.18.5'] gen_buildrs = true @@ -38,11 +39,11 @@ additional_flags = [ "--cfg=atomic_cas" ] -[raze.crates.libloading.'0.5.2'] +[raze.crates.libloading.'0.6.2'] additional_deps = ['//third_party/cargo/patches:libloading_global_static'] [raze.crates.cgmath.'0.17.0'] gen_buildrs = true -[raze.crates.image.'0.23.1'] +[raze.crates.image.'0.23.4'] gen_buildrs = true diff --git a/third_party/cargo/patches/BUILD b/third_party/cargo/patches/BUILD index 5099d46..7ba482f 100644 --- a/third_party/cargo/patches/BUILD +++ b/third_party/cargo/patches/BUILD @@ -2,5 +2,5 @@ cc_library( name = "libloading_global_static", srcs = ["libloading/global_static.c"], copts = ["-fPIC"], - visibility = ["//third_party/cargo/vendor/libloading-0.5.2:__pkg__"], + visibility = ["//third_party/cargo/vendor/libloading-0.6.2:__pkg__"], ) diff --git a/third_party/cargo/patches/images-fix-alias.patch b/third_party/cargo/patches/images-fix-alias.patch index 3f2e2ff..429dd01 100644 --- a/third_party/cargo/patches/images-fix-alias.patch +++ b/third_party/cargo/patches/images-fix-alias.patch @@ -1,7 +1,7 @@ -diff --git a/third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs b/third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs +diff --git a/third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs index 0abe266..1fcd2f2 100644 ---- a/third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs -+++ b/third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs +--- a/third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs ++++ b/third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs @@ -11,21 +11,21 @@ use crate::image::{ImageDecoder, ImageFormat}; /// JPEG decoder diff --git a/third_party/cargo/vendor/andrew-0.2.1/BUILD b/third_party/cargo/vendor/andrew-0.2.1/BUILD index 1ef290e..17e1f26 100644 --- a/third_party/cargo/vendor/andrew-0.2.1/BUILD +++ b/third_party/cargo/vendor/andrew-0.2.1/BUILD @@ -35,8 +35,8 @@ rust_library( "//third_party/cargo/vendor/line_drawing-0.7.0:line_drawing", "//third_party/cargo/vendor/walkdir-2.3.1:walkdir", "//third_party/cargo/vendor/xdg-2.2.0:xdg", - "//third_party/cargo/vendor/xml-rs-0.8.0:xml_rs", - "//third_party/cargo/vendor/rusttype-0.8.2:rusttype", + "//third_party/cargo/vendor/xml-rs-0.8.3:xml_rs", + "//third_party/cargo/vendor/rusttype-0.8.3:rusttype", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/android_glue-0.2.3/.cargo-checksum.json b/third_party/cargo/vendor/android_glue-0.2.3/.cargo-checksum.json deleted file mode 100644 index 5cc98d3..0000000 --- a/third_party/cargo/vendor/android_glue-0.2.3/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"dbe01d8dfe2ea291ca94d56acfe3a401bbaf81d960be2d2afc5e916f755a9ab7","src/lib.rs":"d364185fd66b549a70b935fdfec041b55a10cdc0dd901fd95b38554f08cf0923"},"package":"000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"} \ No newline at end of file diff --git a/third_party/cargo/vendor/android_glue-0.2.3/Cargo.toml b/third_party/cargo/vendor/android_glue-0.2.3/Cargo.toml deleted file mode 100644 index 5e42c10..0000000 --- a/third_party/cargo/vendor/android_glue-0.2.3/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[package] - -name = "android_glue" -version = "0.2.3" -authors = ["Pierre Krieger "] -license = "MIT" -description = "Glue for the Android JNI" -repository = "https://github.com/tomaka/android-rs-glue" diff --git a/third_party/cargo/vendor/android_glue-0.2.3/src/lib.rs b/third_party/cargo/vendor/android_glue-0.2.3/src/lib.rs deleted file mode 100644 index bd1d891..0000000 --- a/third_party/cargo/vendor/android_glue-0.2.3/src/lib.rs +++ /dev/null @@ -1,152 +0,0 @@ -#![cfg(target_os = "android")] - -extern { - fn cargo_apk_injected_glue_get_native_window() -> *const c_void; - fn cargo_apk_injected_glue_add_sender(sender: *mut ()); - fn cargo_apk_injected_glue_add_sender_missing(sender: *mut ()); - fn cargo_apk_injected_glue_add_sync_event_handler(sender: *mut ()); - fn cargo_apk_injected_glue_remove_sync_event_handler(sender: *mut ()); - fn cargo_apk_injected_glue_set_multitouch(multitouch: bool); - fn cargo_apk_injected_glue_write_log(ptr: *const (), len: usize); - fn cargo_apk_injected_glue_load_asset(ptr: *const (), len: usize) -> *mut c_void; - fn cargo_apk_injected_glue_wake_event_loop(); -} - -use std::mem; -use std::os::raw::c_void; -use std::sync::mpsc::Sender; - -/// An event triggered by the Android environment. -#[derive(Clone, Copy, Debug)] -pub enum Event { - EventMotion(Motion), - EventKeyUp, - EventKeyDown, - InitWindow, - SaveState, - TermWindow, - GainedFocus, - LostFocus, - InputChanged, - WindowResized, - WindowRedrawNeeded, - ContentRectChanged, - ConfigChanged, - LowMemory, - Start, - Resume, - Pause, - Stop, - Destroy, - Wake -} - -/// Data about a motion event. -#[derive(Clone, Copy, Debug)] -pub struct Motion { - pub action: MotionAction, - pub pointer_id: i32, - pub x: f32, - pub y: f32, -} - -/// The type of pointer action in a motion event. -#[derive(Clone, Copy, Debug)] -pub enum MotionAction { - Down, - Move, - Up, - Cancel, -} - -pub enum AssetError { - AssetMissing, - EmptyBuffer, -} - -// Trait used to dispatch sync events from the polling loop thread. -pub trait SyncEventHandler { - fn handle(&mut self, event: &Event); -} - -/// Adds a sender where events will be sent to. -#[inline] -pub fn add_sender(sender: Sender) { - unsafe { - let sender = Box::into_raw(Box::new(sender)) as *mut _; - cargo_apk_injected_glue_add_sender(sender); - } -} - -/// Adds a SyncEventHandler which will receive sync events from the polling loop. -#[inline] -pub fn add_sync_event_handler(handler: Box) { - unsafe { - let handler = Box::into_raw(Box::new(handler)) as *mut _; - cargo_apk_injected_glue_add_sync_event_handler(handler); - } -} - -/// Removes a SyncEventHandler. -#[inline] -pub fn remove_sync_event_handler(handler: *const SyncEventHandler) { - unsafe { - let handler = Box::into_raw(Box::new(handler)) as *mut _; - cargo_apk_injected_glue_remove_sync_event_handler(handler); - } -} - -#[inline] -pub fn set_multitouch(multitouch: bool) { - unsafe { - cargo_apk_injected_glue_set_multitouch(multitouch); - } -} - -/// Adds a sender where events will be sent to, but also sends -/// any missing events to the sender object. -/// -/// The missing events happen when the application starts, but before -/// any senders are registered. Since these might be important to certain -/// applications, this function provides that support. -#[inline] -pub fn add_sender_missing(sender: Sender) { - unsafe { - let sender = Box::into_raw(Box::new(sender)) as *mut _; - cargo_apk_injected_glue_add_sender_missing(sender); - } -} - -/// Returns a handle to the native window. -#[inline] -pub unsafe fn get_native_window() -> *const c_void { - cargo_apk_injected_glue_get_native_window() -} - -/// -#[inline] -pub fn write_log(message: &str) { - unsafe { - let (message_ptr, message_len) = mem::transmute(message); - cargo_apk_injected_glue_write_log(message_ptr, message_len); - } -} - -#[inline] -pub fn load_asset(filename: &str) -> Result, AssetError> { - unsafe { - let (filename_ptr, filename_len) = mem::transmute(filename); - let data = cargo_apk_injected_glue_load_asset(filename_ptr, filename_len); - let data: Box, AssetError>> = Box::from_raw(data as *mut _); - *data - } -} - -// Wakes the event poll asynchronously and sends a Event::Wake event to the senders. -// This method can be called on any thread. This method returns immediately. -#[inline] -pub fn wake_event_loop() { - unsafe { - cargo_apk_injected_glue_wake_event_loop(); - } -} diff --git a/third_party/cargo/vendor/android_log-sys-0.1.2/.cargo-checksum.json b/third_party/cargo/vendor/android_log-sys-0.1.2/.cargo-checksum.json new file mode 100644 index 0000000..27a70aa --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"18788b5d8b84916aedc7c85961a8c99f748969e9562663dbfc9704d2263df23d","LICENSE-APACHE":"4d4c32b31308f5a992434c2cf948205852bb2c7bb85cea4c1ab051f41a3eefb3","LICENSE-MIT":"bb3c0c388d2e5efc777ee1a7bc4671188447d5fbbad130aecac9fd52e0010b76","README.md":"56808f9f272c6fad922f23033591464c1403bb5d1f716ee224b6933b90d62e86","src/lib.rs":"ff810c7e6fe722309ea46f9f2a87c10a857f7c6b3563a5986d2d235cdc2109e2"},"package":"b8052e2d8aabbb8d556d6abbcce2a22b9590996c5f849b9c7ce4544a2e3b984e"} \ No newline at end of file diff --git a/third_party/cargo/vendor/android_log-sys-0.1.2/BUILD b/third_party/cargo/vendor/android_log-sys-0.1.2/BUILD new file mode 100644 index 0000000..1f71ab8 --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.2/BUILD @@ -0,0 +1,42 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "android_log_sys", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.2", + crate_features = [ + ], +) + diff --git a/third_party/cargo/vendor/android_log-sys-0.1.2/Cargo.toml b/third_party/cargo/vendor/android_log-sys-0.1.2/Cargo.toml new file mode 100644 index 0000000..1391304 --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.2/Cargo.toml @@ -0,0 +1,26 @@ +# 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 = "android_log-sys" +version = "0.1.2" +authors = ["Nerijus Arlauskas "] +description = "FFI bindings to Android log Library.\n" +documentation = "https://docs.rs/android_log-sys" +readme = "README.md" +keywords = ["ffi", "android", "log"] +categories = ["external-ffi-bindings"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/nercury/android_log-sys-rs" + +[lib] +name = "android_log_sys" diff --git a/third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-APACHE b/third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-APACHE new file mode 100644 index 0000000..09ed963 --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.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 2016 The android_log_sys Developers + +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/third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-MIT b/third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-MIT new file mode 100644 index 0000000..e09729e --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.2/LICENSE-MIT @@ -0,0 +1,19 @@ +Copyright (c) 2016 The android_log_sys 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/third_party/cargo/vendor/android_log-sys-0.1.2/README.md b/third_party/cargo/vendor/android_log-sys-0.1.2/README.md new file mode 100644 index 0000000..88e9528 --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.2/README.md @@ -0,0 +1,17 @@ +# Bindings to Android log Library + +## 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. diff --git a/third_party/cargo/vendor/android_log-sys-0.1.2/src/lib.rs b/third_party/cargo/vendor/android_log-sys-0.1.2/src/lib.rs new file mode 100644 index 0000000..0ee0739 --- /dev/null +++ b/third_party/cargo/vendor/android_log-sys-0.1.2/src/lib.rs @@ -0,0 +1,53 @@ +// Copyright 2016 The android_log_sys Developers +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use std::os::raw; + +#[allow(non_camel_case_types)] +pub type c_va_list = raw::c_void; +#[allow(non_camel_case_types)] +pub type c_int = raw::c_int; +#[allow(non_camel_case_types)] +pub type c_char = raw::c_char; + +// automatically generated by rust-bindgen + +#[derive(Clone, Copy)] +#[repr(isize)] +pub enum LogPriority { + UNKNOWN = 0, + DEFAULT = 1, + VERBOSE = 2, + DEBUG = 3, + INFO = 4, + WARN = 5, + ERROR = 6, + FATAL = 7, + SILENT = 8, +} + +#[link(name = "log")] +extern "C" { + pub fn __android_log_write(prio: c_int, + tag: *const c_char, + text: *const c_char) + -> c_int; + pub fn __android_log_print(prio: c_int, + tag: *const c_char, + fmt: *const c_char, + ...) + -> c_int; + pub fn __android_log_vprint(prio: c_int, + tag: *const c_char, + fmt: *const c_char, + ap: *mut c_va_list) + -> c_int; + pub fn __android_log_assert(cond: *const c_char, + tag: *const c_char, + fmt: *const c_char, + ...); +} diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/.cargo-checksum.json b/third_party/cargo/vendor/arrayvec-0.5.1/.cargo-checksum.json deleted file mode 100644 index f8e8231..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"e7405a91fea075bb4fedb0e76e2039af27d6c380beaa31150f37655d79a7a3ab","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0245ee104228a100ce5fceecf43e25faae450494d9173f43fd94c27d69fdac13","README.rst":"8fab86c3c759d153a1a8a48e5f7f48546c898f0ec91433001c57fe0002af6455","benches/arraystring.rs":"f12b890977117ebde4ca42bcd6b91f2a6a087f2b235aaca6d15e30d125ae9f67","benches/extend.rs":"c3d69cc488ec5341b019cfed545ebbfea252f98718037b413f6a349da9489d1b","custom.css":"e6f2cd299392337b4e2959c52f422e5b7be11920ea98d10db44d10ddef5ed47c","src/array.rs":"8a42b3ff7a5a0713e8ee22462f303b0ce15bdc49a9fd5eb64f58e56855bdf944","src/array_string.rs":"fdcc24f0fd07e781b378f5d0190279e6d9c89b422f67e546ae443c602f967896","src/char.rs":"40af597d93895f206abcd33953b5d3d5a512d3b16ff5f96e492e659d9cca4209","src/errors.rs":"dde99bffaddfd45396aab7e07642cc018ef5435fe60c4f26a2c05a36555be18c","src/lib.rs":"4c00e50b532aec68b52fde4a737b7b5980b0cfb28f5c09ab8408d04896895a87","src/maybe_uninit.rs":"00659a86e8f84852d4355077a16beceaad0440ac0e81851fbac712fdb1850622","tests/serde.rs":"18c165cf6024f04a25b19aa139657d7c59f72d1541c9b24b44f9eaea01f507db","tests/tests.rs":"9633b92fe6c650b9b816cecac23b9c9e6a0365b1f67d4f0bfaad9e645e2bdc49"},"package":"cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"} \ No newline at end of file diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/Cargo.toml b/third_party/cargo/vendor/arrayvec-0.5.1/Cargo.toml deleted file mode 100644 index 2a42a3f..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/Cargo.toml +++ /dev/null @@ -1,62 +0,0 @@ -# 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 = "arrayvec" -version = "0.5.1" -authors = ["bluss"] -description = "A vector with fixed capacity, backed by an array (it can be stored on the stack too). Implements fixed capacity ArrayVec and ArrayString." -documentation = "https://docs.rs/arrayvec/" -keywords = ["stack", "vector", "array", "data-structure", "no_std"] -categories = ["data-structures", "no-std"] -license = "MIT/Apache-2.0" -repository = "https://github.com/bluss/arrayvec" -[package.metadata.docs.rs] -features = ["serde"] - -[package.metadata.release] -no-dev-version = true -tag-name = "{{version}}" -[profile.bench] -debug = true - -[profile.release] -debug = true - -[[bench]] -name = "extend" -harness = false - -[[bench]] -name = "arraystring" -harness = false -[dependencies.serde] -version = "1.0" -optional = true -default-features = false -[dev-dependencies.bencher] -version = "0.1.4" - -[dev-dependencies.matches] -version = "0.1" - -[dev-dependencies.serde_test] -version = "1.0" - -[build-dependencies] - -[features] -array-sizes-129-255 = [] -array-sizes-33-128 = [] -default = ["std"] -std = [] diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/README.rst b/third_party/cargo/vendor/arrayvec-0.5.1/README.rst deleted file mode 100644 index a8bb1db..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/README.rst +++ /dev/null @@ -1,259 +0,0 @@ - -arrayvec -======== - -A vector with fixed capacity. - -Please read the `API documentation here`__ - -__ https://docs.rs/arrayvec - -|build_status|_ |crates|_ |crates2|_ - -.. |build_status| image:: https://travis-ci.org/bluss/arrayvec.svg -.. _build_status: https://travis-ci.org/bluss/arrayvec - -.. |crates| image:: http://meritbadge.herokuapp.com/arrayvec -.. _crates: https://crates.io/crates/arrayvec - -.. |crates2| image:: http://meritbadge.herokuapp.com/nodrop -.. _crates2: https://crates.io/crates/nodrop - -Recent Changes (arrayvec) -------------------------- - -- 0.5.1 - - - Add ``as_ptr``, ``as_mut_ptr`` accessors directly on the ``ArrayVec`` by @tbu- - (matches the same addition to ``Vec`` which happened in Rust 1.37). - - Add method ``ArrayString::len`` (now available directly, not just through deref to str). - - Use raw pointers instead of ``&mut [u8]`` for encoding chars into ``ArrayString`` - (uninit best practice fix). - - Use raw pointers instead of ``get_unchecked_mut`` where the target may be - uninitialized a everywhere relevant in the ArrayVec implementation - (uninit best practice fix). - - Changed inline hints on many methods, mainly removing inline hints - - ``ArrayVec::dispose`` is now deprecated (it has no purpose anymore) - -- 0.4.12 - - - Use raw pointers instead of ``get_unchecked_mut`` where the target may be - uninitialized a everywhere relevant in the ArrayVec implementation. - -- 0.5.0 - - - Use ``MaybeUninit`` (now unconditionally) in the implementation of - ``ArrayVec`` - - Use ``MaybeUninit`` (now unconditionally) in the implementation of - ``ArrayString`` - - The crate feature for serde serialization is now named ``serde``. - - Updated the ``Array`` trait interface, and it is now easier to use for - users outside the crate. - - Add ``FromStr`` impl for ``ArrayString`` by @despawnerer - - Add method ``try_extend_from_slice`` to ``ArrayVec``, which is always - effecient by @Thomasdezeeuw. - - Add method ``remaining_capacity`` by @Thomasdezeeuw - - Improve performance of the ``extend`` method. - - The index type of zero capacity vectors is now itself zero size, by - @clarfon - - Use ``drop_in_place`` for truncate and clear methods. This affects drop order - and resume from panic during drop. - - Use Rust 2018 edition for the implementation - - Require Rust 1.36 or later, for the unconditional ``MaybeUninit`` - improvements. - -- 0.4.11 - - - In Rust 1.36 or later, use newly stable MaybeUninit. This extends the - soundness work introduced in 0.4.9, we are finally able to use this in - stable. We use feature detection (build script) to enable this at build - time. - -- 0.4.10 - - - Use ``repr(C)`` in the ``union`` version that was introduced in 0.4.9, to - allay some soundness concerns. - -- 0.4.9 - - - Use ``union`` in the implementation on when this is detected to be supported - (nightly only for now). This is a better solution for treating uninitialized - regions correctly, and we'll use it in stable Rust as soon as we are able. - When this is enabled, the ``ArrayVec`` has no space overhead in its memory - layout, although the size of the vec should not be relied upon. (See `#114`_) - - ``ArrayString`` updated to not use uninitialized memory, it instead zeros its - backing array. This will be refined in the next version, since we - need to make changes to the user visible API. - - The ``use_union`` feature now does nothing (like its documentation foretold). - -.. _`#114`: https://github.com/bluss/arrayvec/pull/114 - -- 0.4.8 - - - Implement Clone and Debug for ``IntoIter`` by @clarcharr - - Add more array sizes under crate features. These cover all in the range - up to 128 and 129 to 255 respectively (we have a few of those by default): - - - ``array-size-33-128`` - - ``array-size-129-255`` - -- 0.4.7 - - - Fix future compat warning about raw pointer casts - - Use ``drop_in_place`` when dropping the arrayvec by-value iterator - - Decrease mininum Rust version (see docs) by @jeehoonkang - -- 0.3.25 - - - Fix future compat warning about raw pointer casts - -- 0.4.6 - - - Fix compilation on 16-bit targets. This means, the 65536 array size is not - included on these targets. - -- 0.3.24 - - - Fix compilation on 16-bit targets. This means, the 65536 array size is not - included on these targets. - - Fix license files so that they are both included (was fixed in 0.4 before) - -- 0.4.5 - - - Add methods to ``ArrayString`` by @DenialAdams: - - - ``.pop() -> Option`` - - ``.truncate(new_len)`` - - ``.remove(index) -> char`` - - - Remove dependency on crate odds - - Document debug assertions in unsafe methods better - -- 0.4.4 - - - Add method ``ArrayVec::truncate()`` by @niklasf - -- 0.4.3 - - - Improve performance for ``ArrayVec::extend`` with a lower level - implementation (#74) - - Small cleanup in dependencies (use no std for crates where we don't need more) - -- 0.4.2 - - - Add constructor method ``new`` to ``CapacityError``. - -- 0.4.1 - - - Add ``Default`` impl to ``ArrayString`` by @tbu- - -- 0.4.0 - - - Reformed signatures and error handling by @bluss and @tbu-: - - - ``ArrayVec``'s ``push, insert, remove, swap_remove`` now match ``Vec``'s - corresponding signature and panic on capacity errors where applicable. - - Add fallible methods ``try_push, insert`` and checked methods - ``pop_at, swap_pop``. - - Similar changes to ``ArrayString``'s push methods. - - - Use a local version of the ``RangeArgument`` trait - - Add array sizes 50, 150, 200 by @daboross - - Support serde 1.0 by @daboross - - New method ``.push_unchecked()`` by @niklasf - - ``ArrayString`` implements ``PartialOrd, Ord`` by @tbu- - - Require Rust 1.14 - - crate feature ``use_generic_array`` was dropped. - -- 0.3.23 - - - Implement ``PartialOrd, Ord`` as well as ``PartialOrd`` for - ``ArrayString``. - -- 0.3.22 - - - Implement ``Array`` for the 65536 size - -- 0.3.21 - - - Use ``encode_utf8`` from crate odds - - Add constructor ``ArrayString::from_byte_string`` - -- 0.3.20 - - - Simplify and speed up ``ArrayString``’s ``.push(char)``- - -- 0.3.19 - - - Add new crate feature ``use_generic_array`` which allows using their - ``GenericArray`` just like a regular fixed size array for the storage - of an ``ArrayVec``. - -- 0.3.18 - - - Fix bounds check in ``ArrayVec::insert``! - It would be buggy if ``self.len() < index < self.capacity()``. Take note of - the push out behavior specified in the docs. - -- 0.3.17 - - - Added crate feature ``use_union`` which forwards to the nodrop crate feature - - Added methods ``.is_full()`` to ``ArrayVec`` and ``ArrayString``. - -- 0.3.16 - - - Added method ``.retain()`` to ``ArrayVec``. - - Added methods ``.as_slice(), .as_mut_slice()`` to ``ArrayVec`` and ``.as_str()`` - to ``ArrayString``. - -- 0.3.15 - - - Add feature std, which you can opt out of to use ``no_std`` (requires Rust 1.6 - to opt out). - - Implement ``Clone::clone_from`` for ArrayVec and ArrayString - -- 0.3.14 - - - Add ``ArrayString::from(&str)`` - -- 0.3.13 - - - Added ``DerefMut`` impl for ``ArrayString``. - - Added method ``.simplify()`` to drop the element for ``CapacityError``. - - Added method ``.dispose()`` to ``ArrayVec`` - -- 0.3.12 - - - Added ArrayString, a fixed capacity analogy of String - -- 0.3.11 - - - Added trait impls Default, PartialOrd, Ord, Write for ArrayVec - -- 0.3.10 - - - Go back to using external NoDrop, fixing a panic safety bug (issue #3) - -- 0.3.8 - - - Inline the non-dropping logic to remove one drop flag in the - ArrayVec representation. - -- 0.3.7 - - - Added method .into_inner() - - Added unsafe method .set_len() - - -License -======= - -Dual-licensed to be compatible with the Rust project. - -Licensed under the Apache License, Version 2.0 -http://www.apache.org/licenses/LICENSE-2.0 or the MIT license -http://opensource.org/licenses/MIT, at your -option. This file may not be copied, modified, or distributed -except according to those terms. - - diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/benches/arraystring.rs b/third_party/cargo/vendor/arrayvec-0.5.1/benches/arraystring.rs deleted file mode 100644 index 9cff587..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/benches/arraystring.rs +++ /dev/null @@ -1,90 +0,0 @@ - -extern crate arrayvec; -#[macro_use] extern crate bencher; - -use arrayvec::ArrayString; - -use bencher::Bencher; - -fn try_push_c(b: &mut Bencher) { - let mut v = ArrayString::<[u8; 512]>::new(); - b.iter(|| { - v.clear(); - while v.try_push('c').is_ok() { - } - v.len() - }); - b.bytes = v.capacity() as u64; -} - -fn try_push_alpha(b: &mut Bencher) { - let mut v = ArrayString::<[u8; 512]>::new(); - b.iter(|| { - v.clear(); - while v.try_push('α').is_ok() { - } - v.len() - }); - b.bytes = v.capacity() as u64; -} - -// Yes, pushing a string char-by-char is slow. Use .push_str. -fn try_push_string(b: &mut Bencher) { - let mut v = ArrayString::<[u8; 512]>::new(); - let input = "abcαβγ“”"; - b.iter(|| { - v.clear(); - for ch in input.chars().cycle() { - if !v.try_push(ch).is_ok() { - break; - } - } - v.len() - }); - b.bytes = v.capacity() as u64; -} - -fn push_c(b: &mut Bencher) { - let mut v = ArrayString::<[u8; 512]>::new(); - b.iter(|| { - v.clear(); - while !v.is_full() { - v.push('c'); - } - v.len() - }); - b.bytes = v.capacity() as u64; -} - -fn push_alpha(b: &mut Bencher) { - let mut v = ArrayString::<[u8; 512]>::new(); - b.iter(|| { - v.clear(); - while !v.is_full() { - v.push('α'); - } - v.len() - }); - b.bytes = v.capacity() as u64; -} - -fn push_string(b: &mut Bencher) { - let mut v = ArrayString::<[u8; 512]>::new(); - let input = "abcαβγ“”"; - b.iter(|| { - v.clear(); - for ch in input.chars().cycle() { - if !v.is_full() { - v.push(ch); - } else { - break; - } - } - v.len() - }); - b.bytes = v.capacity() as u64; -} - -benchmark_group!(benches, try_push_c, try_push_alpha, try_push_string, push_c, - push_alpha, push_string); -benchmark_main!(benches); diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/benches/extend.rs b/third_party/cargo/vendor/arrayvec-0.5.1/benches/extend.rs deleted file mode 100644 index 0579717..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/benches/extend.rs +++ /dev/null @@ -1,78 +0,0 @@ - -extern crate arrayvec; -#[macro_use] extern crate bencher; - -use std::io::Write; - -use arrayvec::ArrayVec; - -use bencher::Bencher; -use bencher::black_box; - -fn extend_with_constant(b: &mut Bencher) { - let mut v = ArrayVec::<[u8; 512]>::new(); - let cap = v.capacity(); - b.iter(|| { - v.clear(); - let constant = black_box(1); - v.extend((0..cap).map(move |_| constant)); - v[511] - }); - b.bytes = v.capacity() as u64; -} - -fn extend_with_range(b: &mut Bencher) { - let mut v = ArrayVec::<[u8; 512]>::new(); - let cap = v.capacity(); - b.iter(|| { - v.clear(); - let range = 0..cap; - v.extend(range.map(|x| black_box(x as _))); - v[511] - }); - b.bytes = v.capacity() as u64; -} - -fn extend_with_slice(b: &mut Bencher) { - let mut v = ArrayVec::<[u8; 512]>::new(); - let data = [1; 512]; - b.iter(|| { - v.clear(); - let iter = data.iter().map(|&x| x); - v.extend(iter); - v[511] - }); - b.bytes = v.capacity() as u64; -} - -fn extend_with_write(b: &mut Bencher) { - let mut v = ArrayVec::<[u8; 512]>::new(); - let data = [1; 512]; - b.iter(|| { - v.clear(); - v.write(&data[..]).ok(); - v[511] - }); - b.bytes = v.capacity() as u64; -} - -fn extend_from_slice(b: &mut Bencher) { - let mut v = ArrayVec::<[u8; 512]>::new(); - let data = [1; 512]; - b.iter(|| { - v.clear(); - v.try_extend_from_slice(&data).ok(); - v[511] - }); - b.bytes = v.capacity() as u64; -} - -benchmark_group!(benches, - extend_with_constant, - extend_with_range, - extend_with_slice, - extend_with_write, - extend_from_slice -); - -benchmark_main!(benches); diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/custom.css b/third_party/cargo/vendor/arrayvec-0.5.1/custom.css deleted file mode 100644 index 8e0b705..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/custom.css +++ /dev/null @@ -1,25 +0,0 @@ - -.docblock pre.rust { background: #eeeeff; } -pre.trait, pre.fn, pre.struct, pre.enum, pre.typedef { background: #fcfefc; } - -/* Small “example” label for doc examples */ -.docblock pre.rust::before { - content: "example"; - float: right; - font-style: italic; - font-size: 0.8em; - margin-top: -10px; - margin-right: -5px; -} - - -/* Fixup where display in trait listing */ -pre.trait .where::before { -content: '\a '; -} - -.docblock code { - background-color: inherit; - font-weight: bold; - padding: 0 0.1em; -} diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/src/array.rs b/third_party/cargo/vendor/arrayvec-0.5.1/src/array.rs deleted file mode 100644 index 96a8bfd..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/src/array.rs +++ /dev/null @@ -1,144 +0,0 @@ - -/// Trait for fixed size arrays. -/// -/// This trait is implemented for some specific array sizes, see -/// the implementor list below. At the current state of Rust we can't -/// make this fully general for every array size. -/// -/// The following crate features add more array sizes (and they are not -/// enabled by default due to their impact on compliation speed). -/// -/// - `array-sizes-33-128`: All sizes 33 to 128 are implemented -/// (a few in this range are included by default). -/// - `array-sizes-129-255`: All sizes 129 to 255 are implemented -/// (a few in this range are included by default). -/// -/// ## Safety -/// -/// This trait can *only* be implemented by fixed-size arrays or types with -/// *exactly* the representation of a fixed size array (of the right element -/// type and capacity). -/// -/// Normally this trait is an implementation detail of arrayvec and doesn’t -/// need implementing. -pub unsafe trait Array { - /// The array’s element type - type Item; - /// The smallest type that can index and tell the length of the array. - #[doc(hidden)] - type Index: Index; - /// The array's element capacity - const CAPACITY: usize; - fn as_slice(&self) -> &[Self::Item]; - fn as_mut_slice(&mut self) -> &mut [Self::Item]; -} - -pub trait Index : PartialEq + Copy { - fn to_usize(self) -> usize; - fn from(_: usize) -> Self; -} - -impl Index for () { - #[inline(always)] - fn to_usize(self) -> usize { 0 } - #[inline(always)] - fn from(_ix: usize) -> Self { () } -} - -impl Index for bool { - #[inline(always)] - fn to_usize(self) -> usize { self as usize } - #[inline(always)] - fn from(ix: usize) -> Self { ix != 0 } -} - -impl Index for u8 { - #[inline(always)] - fn to_usize(self) -> usize { self as usize } - #[inline(always)] - fn from(ix: usize) -> Self { ix as u8 } -} - -impl Index for u16 { - #[inline(always)] - fn to_usize(self) -> usize { self as usize } - #[inline(always)] - fn from(ix: usize) -> Self { ix as u16 } -} - -impl Index for u32 { - #[inline(always)] - fn to_usize(self) -> usize { self as usize } - #[inline(always)] - fn from(ix: usize) -> Self { ix as u32 } -} - -impl Index for usize { - #[inline(always)] - fn to_usize(self) -> usize { self } - #[inline(always)] - fn from(ix: usize) -> Self { ix } -} - -macro_rules! fix_array_impl { - ($index_type:ty, $len:expr ) => ( - unsafe impl Array for [T; $len] { - type Item = T; - type Index = $index_type; - const CAPACITY: usize = $len; - #[doc(hidden)] - fn as_slice(&self) -> &[Self::Item] { self } - #[doc(hidden)] - fn as_mut_slice(&mut self) -> &mut [Self::Item] { self } - } - ) -} - -macro_rules! fix_array_impl_recursive { - ($index_type:ty, ) => (); - ($index_type:ty, $($len:expr,)*) => ( - $(fix_array_impl!($index_type, $len);)* - ); -} - - -fix_array_impl_recursive!((), 0,); -fix_array_impl_recursive!(bool, 1,); -fix_array_impl_recursive!(u8, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, ); - -#[cfg(not(feature="array-sizes-33-128"))] -fix_array_impl_recursive!(u8, 32, 40, 48, 50, 56, 64, 72, 96, 100, 128, ); - -#[cfg(feature="array-sizes-33-128")] -fix_array_impl_recursive!(u8, -32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, -72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, -92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, -109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, -125, 126, 127, 128, -); - -#[cfg(not(feature="array-sizes-129-255"))] -fix_array_impl_recursive!(u8, 160, 192, 200, 224,); - -#[cfg(feature="array-sizes-129-255")] -fix_array_impl_recursive!(u8, -129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, -141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, -157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, -173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, -189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, -205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, -221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, -237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, -253, 254, 255, -); - -fix_array_impl_recursive!(u16, 256, 384, 512, 768, 1024, 2048, 4096, 8192, 16384, 32768,); -// This array size doesn't exist on 16-bit -#[cfg(any(target_pointer_width="32", target_pointer_width="64"))] -fix_array_impl_recursive!(u32, 1 << 16,); - diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/src/array_string.rs b/third_party/cargo/vendor/arrayvec-0.5.1/src/array_string.rs deleted file mode 100644 index 30aea4a..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/src/array_string.rs +++ /dev/null @@ -1,567 +0,0 @@ -use std::borrow::Borrow; -use std::cmp; -use std::fmt; -use std::hash::{Hash, Hasher}; -use std::ptr; -use std::ops::{Deref, DerefMut}; -use std::str; -use std::str::FromStr; -use std::str::Utf8Error; -use std::slice; - -use crate::array::Array; -use crate::array::Index; -use crate::CapacityError; -use crate::char::encode_utf8; - -#[cfg(feature="serde")] -use serde::{Serialize, Deserialize, Serializer, Deserializer}; - -use super::MaybeUninit as MaybeUninitCopy; - -/// A string with a fixed capacity. -/// -/// The `ArrayString` is a string backed by a fixed size array. It keeps track -/// of its length. -/// -/// The string is a contiguous value that you can store directly on the stack -/// if needed. -#[derive(Copy)] -pub struct ArrayString - where A: Array + Copy -{ - xs: MaybeUninitCopy, - len: A::Index, -} - -impl Default for ArrayString - where A: Array + Copy -{ - /// Return an empty `ArrayString` - fn default() -> ArrayString { - ArrayString::new() - } -} - -impl ArrayString - where A: Array + Copy -{ - /// Create a new empty `ArrayString`. - /// - /// Capacity is inferred from the type parameter. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 16]>::new(); - /// string.push_str("foo"); - /// assert_eq!(&string[..], "foo"); - /// assert_eq!(string.capacity(), 16); - /// ``` - pub fn new() -> ArrayString { - unsafe { - ArrayString { - xs: MaybeUninitCopy::uninitialized(), - len: Index::from(0), - } - } - } - - /// Return the length of the string. - #[inline] - pub fn len(&self) -> usize { self.len.to_usize() } - - /// Create a new `ArrayString` from a `str`. - /// - /// Capacity is inferred from the type parameter. - /// - /// **Errors** if the backing array is not large enough to fit the string. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 3]>::from("foo").unwrap(); - /// assert_eq!(&string[..], "foo"); - /// assert_eq!(string.len(), 3); - /// assert_eq!(string.capacity(), 3); - /// ``` - pub fn from(s: &str) -> Result> { - let mut arraystr = Self::new(); - arraystr.try_push_str(s)?; - Ok(arraystr) - } - - /// Create a new `ArrayString` from a byte string literal. - /// - /// **Errors** if the byte string literal is not valid UTF-8. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let string = ArrayString::from_byte_string(b"hello world").unwrap(); - /// ``` - pub fn from_byte_string(b: &A) -> Result { - let len = str::from_utf8(b.as_slice())?.len(); - debug_assert_eq!(len, A::CAPACITY); - Ok(ArrayString { - xs: MaybeUninitCopy::from(*b), - len: Index::from(A::CAPACITY), - }) - } - - /// Return the capacity of the `ArrayString`. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let string = ArrayString::<[_; 3]>::new(); - /// assert_eq!(string.capacity(), 3); - /// ``` - #[inline(always)] - pub fn capacity(&self) -> usize { A::CAPACITY } - - /// Return if the `ArrayString` is completely filled. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 1]>::new(); - /// assert!(!string.is_full()); - /// string.push_str("A"); - /// assert!(string.is_full()); - /// ``` - pub fn is_full(&self) -> bool { self.len() == self.capacity() } - - /// Adds the given char to the end of the string. - /// - /// ***Panics*** if the backing array is not large enough to fit the additional char. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 2]>::new(); - /// - /// string.push('a'); - /// string.push('b'); - /// - /// assert_eq!(&string[..], "ab"); - /// ``` - pub fn push(&mut self, c: char) { - self.try_push(c).unwrap(); - } - - /// Adds the given char to the end of the string. - /// - /// Returns `Ok` if the push succeeds. - /// - /// **Errors** if the backing array is not large enough to fit the additional char. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 2]>::new(); - /// - /// string.try_push('a').unwrap(); - /// string.try_push('b').unwrap(); - /// let overflow = string.try_push('c'); - /// - /// assert_eq!(&string[..], "ab"); - /// assert_eq!(overflow.unwrap_err().element(), 'c'); - /// ``` - pub fn try_push(&mut self, c: char) -> Result<(), CapacityError> { - let len = self.len(); - unsafe { - let ptr = self.xs.ptr_mut().add(len); - let remaining_cap = self.capacity() - len; - match encode_utf8(c, ptr, remaining_cap) { - Ok(n) => { - self.set_len(len + n); - Ok(()) - } - Err(_) => Err(CapacityError::new(c)), - } - } - } - - /// Adds the given string slice to the end of the string. - /// - /// ***Panics*** if the backing array is not large enough to fit the string. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 2]>::new(); - /// - /// string.push_str("a"); - /// string.push_str("d"); - /// - /// assert_eq!(&string[..], "ad"); - /// ``` - pub fn push_str(&mut self, s: &str) { - self.try_push_str(s).unwrap() - } - - /// Adds the given string slice to the end of the string. - /// - /// Returns `Ok` if the push succeeds. - /// - /// **Errors** if the backing array is not large enough to fit the string. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 2]>::new(); - /// - /// string.try_push_str("a").unwrap(); - /// let overflow1 = string.try_push_str("bc"); - /// string.try_push_str("d").unwrap(); - /// let overflow2 = string.try_push_str("ef"); - /// - /// assert_eq!(&string[..], "ad"); - /// assert_eq!(overflow1.unwrap_err().element(), "bc"); - /// assert_eq!(overflow2.unwrap_err().element(), "ef"); - /// ``` - pub fn try_push_str<'a>(&mut self, s: &'a str) -> Result<(), CapacityError<&'a str>> { - if s.len() > self.capacity() - self.len() { - return Err(CapacityError::new(s)); - } - unsafe { - let dst = self.xs.ptr_mut().offset(self.len() as isize); - let src = s.as_ptr(); - ptr::copy_nonoverlapping(src, dst, s.len()); - let newl = self.len() + s.len(); - self.set_len(newl); - } - Ok(()) - } - - /// Removes the last character from the string and returns it. - /// - /// Returns `None` if this `ArrayString` is empty. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut s = ArrayString::<[_; 3]>::from("foo").unwrap(); - /// - /// assert_eq!(s.pop(), Some('o')); - /// assert_eq!(s.pop(), Some('o')); - /// assert_eq!(s.pop(), Some('f')); - /// - /// assert_eq!(s.pop(), None); - /// ``` - pub fn pop(&mut self) -> Option { - let ch = match self.chars().rev().next() { - Some(ch) => ch, - None => return None, - }; - let new_len = self.len() - ch.len_utf8(); - unsafe { - self.set_len(new_len); - } - Some(ch) - } - - /// Shortens this `ArrayString` to the specified length. - /// - /// If `new_len` is greater than the string’s current length, this has no - /// effect. - /// - /// ***Panics*** if `new_len` does not lie on a `char` boundary. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut string = ArrayString::<[_; 6]>::from("foobar").unwrap(); - /// string.truncate(3); - /// assert_eq!(&string[..], "foo"); - /// string.truncate(4); - /// assert_eq!(&string[..], "foo"); - /// ``` - pub fn truncate(&mut self, new_len: usize) { - if new_len <= self.len() { - assert!(self.is_char_boundary(new_len)); - unsafe { - // In libstd truncate is called on the underlying vector, - // which in turns drops each element. - // As we know we don't have to worry about Drop, - // we can just set the length (a la clear.) - self.set_len(new_len); - } - } - } - - /// Removes a `char` from this `ArrayString` at a byte position and returns it. - /// - /// This is an `O(n)` operation, as it requires copying every element in the - /// array. - /// - /// ***Panics*** if `idx` is larger than or equal to the `ArrayString`’s length, - /// or if it does not lie on a `char` boundary. - /// - /// ``` - /// use arrayvec::ArrayString; - /// - /// let mut s = ArrayString::<[_; 3]>::from("foo").unwrap(); - /// - /// assert_eq!(s.remove(0), 'f'); - /// assert_eq!(s.remove(1), 'o'); - /// assert_eq!(s.remove(0), 'o'); - /// ``` - 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.xs.ptr().offset(next as isize), - self.xs.ptr_mut().offset(idx as isize), - len - next); - self.set_len(len - (next - idx)); - } - ch - } - - /// Make the string empty. - pub fn clear(&mut self) { - unsafe { - self.set_len(0); - } - } - - /// Set the strings’s length. - /// - /// This function is `unsafe` because it changes the notion of the - /// number of “valid” bytes in the string. Use with care. - /// - /// This method uses *debug assertions* to check the validity of `length` - /// and may use other debug assertions. - pub unsafe fn set_len(&mut self, length: usize) { - debug_assert!(length <= self.capacity()); - self.len = Index::from(length); - } - - /// Return a string slice of the whole `ArrayString`. - pub fn as_str(&self) -> &str { - self - } -} - -impl Deref for ArrayString - where A: Array + Copy -{ - type Target = str; - #[inline] - fn deref(&self) -> &str { - unsafe { - let sl = slice::from_raw_parts(self.xs.ptr(), self.len.to_usize()); - str::from_utf8_unchecked(sl) - } - } -} - -impl DerefMut for ArrayString - where A: Array + Copy -{ - #[inline] - fn deref_mut(&mut self) -> &mut str { - unsafe { - let sl = slice::from_raw_parts_mut(self.xs.ptr_mut(), self.len.to_usize()); - str::from_utf8_unchecked_mut(sl) - } - } -} - -impl PartialEq for ArrayString - where A: Array + Copy -{ - fn eq(&self, rhs: &Self) -> bool { - **self == **rhs - } -} - -impl PartialEq for ArrayString - where A: Array + Copy -{ - fn eq(&self, rhs: &str) -> bool { - &**self == rhs - } -} - -impl PartialEq> for str - where A: Array + Copy -{ - fn eq(&self, rhs: &ArrayString) -> bool { - self == &**rhs - } -} - -impl Eq for ArrayString - where A: Array + Copy -{ } - -impl Hash for ArrayString - where A: Array + Copy -{ - fn hash(&self, h: &mut H) { - (**self).hash(h) - } -} - -impl Borrow for ArrayString - where A: Array + Copy -{ - fn borrow(&self) -> &str { self } -} - -impl AsRef for ArrayString - where A: Array + Copy -{ - fn as_ref(&self) -> &str { self } -} - -impl fmt::Debug for ArrayString - where A: Array + Copy -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) } -} - -impl fmt::Display for ArrayString - where A: Array + Copy -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) } -} - -/// `Write` appends written data to the end of the string. -impl fmt::Write for ArrayString - where A: Array + Copy -{ - fn write_char(&mut self, c: char) -> fmt::Result { - self.try_push(c).map_err(|_| fmt::Error) - } - - fn write_str(&mut self, s: &str) -> fmt::Result { - self.try_push_str(s).map_err(|_| fmt::Error) - } -} - -impl Clone for ArrayString - where A: Array + Copy -{ - fn clone(&self) -> ArrayString { - *self - } - fn clone_from(&mut self, rhs: &Self) { - // guaranteed to fit due to types matching. - self.clear(); - self.try_push_str(rhs).ok(); - } -} - -impl PartialOrd for ArrayString - where A: Array + Copy -{ - fn partial_cmp(&self, rhs: &Self) -> Option { - (**self).partial_cmp(&**rhs) - } - fn lt(&self, rhs: &Self) -> bool { **self < **rhs } - fn le(&self, rhs: &Self) -> bool { **self <= **rhs } - fn gt(&self, rhs: &Self) -> bool { **self > **rhs } - fn ge(&self, rhs: &Self) -> bool { **self >= **rhs } -} - -impl PartialOrd for ArrayString - where A: Array + Copy -{ - fn partial_cmp(&self, rhs: &str) -> Option { - (**self).partial_cmp(rhs) - } - fn lt(&self, rhs: &str) -> bool { &**self < rhs } - fn le(&self, rhs: &str) -> bool { &**self <= rhs } - fn gt(&self, rhs: &str) -> bool { &**self > rhs } - fn ge(&self, rhs: &str) -> bool { &**self >= rhs } -} - -impl PartialOrd> for str - where A: Array + Copy -{ - fn partial_cmp(&self, rhs: &ArrayString) -> Option { - self.partial_cmp(&**rhs) - } - fn lt(&self, rhs: &ArrayString) -> bool { self < &**rhs } - fn le(&self, rhs: &ArrayString) -> bool { self <= &**rhs } - fn gt(&self, rhs: &ArrayString) -> bool { self > &**rhs } - fn ge(&self, rhs: &ArrayString) -> bool { self >= &**rhs } -} - -impl Ord for ArrayString - where A: Array + Copy -{ - fn cmp(&self, rhs: &Self) -> cmp::Ordering { - (**self).cmp(&**rhs) - } -} - -impl FromStr for ArrayString - where A: Array + Copy -{ - type Err = CapacityError; - - fn from_str(s: &str) -> Result { - Self::from(s).map_err(CapacityError::simplify) - } -} - -#[cfg(feature="serde")] -/// Requires crate feature `"serde"` -impl Serialize for ArrayString - where A: Array + Copy -{ - fn serialize(&self, serializer: S) -> Result - where S: Serializer - { - serializer.serialize_str(&*self) - } -} - -#[cfg(feature="serde")] -/// Requires crate feature `"serde"` -impl<'de, A> Deserialize<'de> for ArrayString - where A: Array + Copy -{ - fn deserialize(deserializer: D) -> Result - where D: Deserializer<'de> - { - use serde::de::{self, Visitor}; - use std::marker::PhantomData; - - struct ArrayStringVisitor>(PhantomData); - - impl<'de, A: Copy + Array> Visitor<'de> for ArrayStringVisitor { - type Value = ArrayString; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "a string no more than {} bytes long", A::CAPACITY) - } - - fn visit_str(self, v: &str) -> Result - where E: de::Error, - { - ArrayString::from(v).map_err(|_| E::invalid_length(v.len(), &self)) - } - - fn visit_bytes(self, v: &[u8]) -> Result - where E: de::Error, - { - let s = str::from_utf8(v).map_err(|_| E::invalid_value(de::Unexpected::Bytes(v), &self))?; - - ArrayString::from(s).map_err(|_| E::invalid_length(s.len(), &self)) - } - } - - deserializer.deserialize_str(ArrayStringVisitor::(PhantomData)) - } -} diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/src/char.rs b/third_party/cargo/vendor/arrayvec-0.5.1/src/char.rs deleted file mode 100644 index c9b00ca..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/src/char.rs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2012-2016 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// Original authors: alexchrichton, bluss - -use std::ptr; - -// UTF-8 ranges and tags for encoding characters -const TAG_CONT: u8 = 0b1000_0000; -const TAG_TWO_B: u8 = 0b1100_0000; -const TAG_THREE_B: u8 = 0b1110_0000; -const TAG_FOUR_B: u8 = 0b1111_0000; -const MAX_ONE_B: u32 = 0x80; -const MAX_TWO_B: u32 = 0x800; -const MAX_THREE_B: u32 = 0x10000; - -/// Placeholder -pub struct EncodeUtf8Error; - -#[inline] -unsafe fn write(ptr: *mut u8, index: usize, byte: u8) { - ptr::write(ptr.add(index), byte) -} - -/// Encode a char into buf using UTF-8. -/// -/// On success, return the byte length of the encoding (1, 2, 3 or 4).
-/// On error, return `EncodeUtf8Error` if the buffer was too short for the char. -/// -/// Safety: `ptr` must be writable for `len` bytes. -#[inline] -pub unsafe fn encode_utf8(ch: char, ptr: *mut u8, len: usize) -> Result -{ - let code = ch as u32; - if code < MAX_ONE_B && len >= 1 { - write(ptr, 0, code as u8); - return Ok(1); - } else if code < MAX_TWO_B && len >= 2 { - write(ptr, 0, (code >> 6 & 0x1F) as u8 | TAG_TWO_B); - write(ptr, 1, (code & 0x3F) as u8 | TAG_CONT); - return Ok(2); - } else if code < MAX_THREE_B && len >= 3 { - write(ptr, 0, (code >> 12 & 0x0F) as u8 | TAG_THREE_B); - write(ptr, 1, (code >> 6 & 0x3F) as u8 | TAG_CONT); - write(ptr, 2, (code & 0x3F) as u8 | TAG_CONT); - return Ok(3); - } else if len >= 4 { - write(ptr, 0, (code >> 18 & 0x07) as u8 | TAG_FOUR_B); - write(ptr, 1, (code >> 12 & 0x3F) as u8 | TAG_CONT); - write(ptr, 2, (code >> 6 & 0x3F) as u8 | TAG_CONT); - write(ptr, 3, (code & 0x3F) as u8 | TAG_CONT); - return Ok(4); - }; - Err(EncodeUtf8Error) -} - - -#[test] -fn test_encode_utf8() { - // Test that all codepoints are encoded correctly - let mut data = [0u8; 16]; - for codepoint in 0..=(std::char::MAX as u32) { - if let Some(ch) = std::char::from_u32(codepoint) { - for elt in &mut data { *elt = 0; } - let ptr = data.as_mut_ptr(); - let len = data.len(); - unsafe { - let res = encode_utf8(ch, ptr, len).ok().unwrap(); - assert_eq!(res, ch.len_utf8()); - } - let string = std::str::from_utf8(&data).unwrap(); - assert_eq!(string.chars().next(), Some(ch)); - } - } -} - -#[test] -fn test_encode_utf8_oob() { - // test that we report oob if the buffer is too short - let mut data = [0u8; 16]; - let chars = ['a', 'α', '�', '𐍈']; - for (len, &ch) in (1..=4).zip(&chars) { - assert_eq!(len, ch.len_utf8(), "Len of ch={}", ch); - let ptr = data.as_mut_ptr(); - unsafe { - assert!(matches::matches!(encode_utf8(ch, ptr, len - 1), Err(_))); - assert!(matches::matches!(encode_utf8(ch, ptr, len), Ok(_))); - } - } -} - diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/src/errors.rs b/third_party/cargo/vendor/arrayvec-0.5.1/src/errors.rs deleted file mode 100644 index 5bea980..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/src/errors.rs +++ /dev/null @@ -1,53 +0,0 @@ -use std::fmt; -#[cfg(feature="std")] -use std::any::Any; -#[cfg(feature="std")] -use std::error::Error; - -/// Error value indicating insufficient capacity -#[derive(Clone, Copy, Eq, Ord, PartialEq, PartialOrd)] -pub struct CapacityError { - element: T, -} - -impl CapacityError { - /// Create a new `CapacityError` from `element`. - pub fn new(element: T) -> CapacityError { - CapacityError { - element: element, - } - } - - /// Extract the overflowing element - pub fn element(self) -> T { - self.element - } - - /// Convert into a `CapacityError` that does not carry an element. - pub fn simplify(self) -> CapacityError { - CapacityError { element: () } - } -} - -const CAPERROR: &'static str = "insufficient capacity"; - -#[cfg(feature="std")] -/// Requires `features="std"`. -impl Error for CapacityError { - fn description(&self) -> &str { - CAPERROR - } -} - -impl fmt::Display for CapacityError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", CAPERROR) - } -} - -impl fmt::Debug for CapacityError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}: {}", "CapacityError", CAPERROR) - } -} - diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/src/lib.rs b/third_party/cargo/vendor/arrayvec-0.5.1/src/lib.rs deleted file mode 100644 index 0fea03f..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/src/lib.rs +++ /dev/null @@ -1,1156 +0,0 @@ -//! **arrayvec** provides the types `ArrayVec` and `ArrayString`: -//! array-backed vector and string types, which store their contents inline. -//! -//! The arrayvec package has the following cargo features: -//! -//! - `std` -//! - Optional, enabled by default -//! - Use libstd; disable to use `no_std` instead. -//! -//! - `serde` -//! - Optional -//! - Enable serialization for ArrayVec and ArrayString using serde 1.x -//! - `array-sizes-33-128`, `array-sizes-129-255` -//! - Optional -//! - Enable more array sizes (see [Array] for more information) -//! -//! ## Rust Version -//! -//! This version of arrayvec requires Rust 1.36 or later. -//! -#![doc(html_root_url="https://docs.rs/arrayvec/0.4/")] -#![cfg_attr(not(feature="std"), no_std)] - -#[cfg(feature="serde")] -extern crate serde; - -#[cfg(not(feature="std"))] -extern crate core as std; - -use std::cmp; -use std::iter; -use std::mem; -use std::ops::{Bound, Deref, DerefMut, RangeBounds}; -use std::ptr; -use std::slice; - -// extra traits -use std::borrow::{Borrow, BorrowMut}; -use std::hash::{Hash, Hasher}; -use std::fmt; - -#[cfg(feature="std")] -use std::io; - - -mod maybe_uninit; -use crate::maybe_uninit::MaybeUninit; - -#[cfg(feature="serde")] -use serde::{Serialize, Deserialize, Serializer, Deserializer}; - -mod array; -mod array_string; -mod char; -mod errors; - -pub use crate::array::Array; -use crate::array::Index; -pub use crate::array_string::ArrayString; -pub use crate::errors::CapacityError; - - -/// A vector with a fixed capacity. -/// -/// The `ArrayVec` is a vector backed by a fixed size array. It keeps track of -/// the number of initialized elements. -/// -/// The vector is a contiguous value that you can store directly on the stack -/// if needed. -/// -/// It offers a simple API but also dereferences to a slice, so -/// that the full slice API is available. -/// -/// ArrayVec can be converted into a by value iterator. -pub struct ArrayVec { - xs: MaybeUninit
, - len: A::Index, -} - -impl Drop for ArrayVec { - fn drop(&mut self) { - self.clear(); - - // NoDrop inhibits array's drop - // panic safety: NoDrop::drop will trigger on panic, so the inner - // array will not drop even after panic. - } -} - -macro_rules! panic_oob { - ($method_name:expr, $index:expr, $len:expr) => { - panic!(concat!("ArrayVec::", $method_name, ": index {} is out of bounds in vector of length {}"), - $index, $len) - } -} - -impl ArrayVec { - /// Create a new empty `ArrayVec`. - /// - /// Capacity is inferred from the type parameter. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 16]>::new(); - /// array.push(1); - /// array.push(2); - /// assert_eq!(&array[..], &[1, 2]); - /// assert_eq!(array.capacity(), 16); - /// ``` - pub fn new() -> ArrayVec { - unsafe { - ArrayVec { xs: MaybeUninit::uninitialized(), len: Index::from(0) } - } - } - - /// Return the number of elements in the `ArrayVec`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3]); - /// array.pop(); - /// assert_eq!(array.len(), 2); - /// ``` - #[inline] - pub fn len(&self) -> usize { self.len.to_usize() } - - /// Return the capacity of the `ArrayVec`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let array = ArrayVec::from([1, 2, 3]); - /// assert_eq!(array.capacity(), 3); - /// ``` - #[inline(always)] - pub fn capacity(&self) -> usize { A::CAPACITY } - - /// Return if the `ArrayVec` is completely filled. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 1]>::new(); - /// assert!(!array.is_full()); - /// array.push(1); - /// assert!(array.is_full()); - /// ``` - pub fn is_full(&self) -> bool { self.len() == self.capacity() } - - /// Returns the capacity left in the `ArrayVec`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3]); - /// array.pop(); - /// assert_eq!(array.remaining_capacity(), 1); - /// ``` - pub fn remaining_capacity(&self) -> usize { - self.capacity() - self.len() - } - - /// Push `element` to the end of the vector. - /// - /// ***Panics*** if the vector is already full. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 2]>::new(); - /// - /// array.push(1); - /// array.push(2); - /// - /// assert_eq!(&array[..], &[1, 2]); - /// ``` - pub fn push(&mut self, element: A::Item) { - self.try_push(element).unwrap() - } - - /// Push `element` to the end of the vector. - /// - /// Return `Ok` if the push succeeds, or return an error if the vector - /// is already full. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 2]>::new(); - /// - /// let push1 = array.try_push(1); - /// let push2 = array.try_push(2); - /// - /// assert!(push1.is_ok()); - /// assert!(push2.is_ok()); - /// - /// assert_eq!(&array[..], &[1, 2]); - /// - /// let overflow = array.try_push(3); - /// - /// assert!(overflow.is_err()); - /// ``` - pub fn try_push(&mut self, element: A::Item) -> Result<(), CapacityError> { - if self.len() < A::CAPACITY { - unsafe { - self.push_unchecked(element); - } - Ok(()) - } else { - Err(CapacityError::new(element)) - } - } - - - /// Push `element` to the end of the vector without checking the capacity. - /// - /// It is up to the caller to ensure the capacity of the vector is - /// sufficiently large. - /// - /// This method uses *debug assertions* to check that the arrayvec is not full. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 2]>::new(); - /// - /// if array.len() + 2 <= array.capacity() { - /// unsafe { - /// array.push_unchecked(1); - /// array.push_unchecked(2); - /// } - /// } - /// - /// assert_eq!(&array[..], &[1, 2]); - /// ``` - pub unsafe fn push_unchecked(&mut self, element: A::Item) { - let len = self.len(); - debug_assert!(len < A::CAPACITY); - ptr::write(self.get_unchecked_ptr(len), element); - self.set_len(len + 1); - } - - /// Get pointer to where element at `index` would be - unsafe fn get_unchecked_ptr(&mut self, index: usize) -> *mut A::Item { - self.xs.ptr_mut().add(index) - } - - /// Insert `element` at position `index`. - /// - /// Shift up all elements after `index`. - /// - /// It is an error if the index is greater than the length or if the - /// arrayvec is full. - /// - /// ***Panics*** if the array is full or the `index` is out of bounds. See - /// `try_insert` for fallible version. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 2]>::new(); - /// - /// array.insert(0, "x"); - /// array.insert(0, "y"); - /// assert_eq!(&array[..], &["y", "x"]); - /// - /// ``` - pub fn insert(&mut self, index: usize, element: A::Item) { - self.try_insert(index, element).unwrap() - } - - /// Insert `element` at position `index`. - /// - /// Shift up all elements after `index`; the `index` must be less than - /// or equal to the length. - /// - /// Returns an error if vector is already at full capacity. - /// - /// ***Panics*** `index` is out of bounds. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 2]>::new(); - /// - /// assert!(array.try_insert(0, "x").is_ok()); - /// assert!(array.try_insert(0, "y").is_ok()); - /// assert!(array.try_insert(0, "z").is_err()); - /// assert_eq!(&array[..], &["y", "x"]); - /// - /// ``` - pub fn try_insert(&mut self, index: usize, element: A::Item) -> Result<(), CapacityError> { - if index > self.len() { - panic_oob!("try_insert", index, self.len()) - } - if self.len() == self.capacity() { - return Err(CapacityError::new(element)); - } - let len = self.len(); - - // follows is just like Vec - unsafe { // infallible - // The spot to put the new value - { - let p: *mut _ = self.get_unchecked_ptr(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); - } - Ok(()) - } - - /// Remove the last element in the vector and return it. - /// - /// Return `Some(` *element* `)` if the vector is non-empty, else `None`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::<[_; 2]>::new(); - /// - /// array.push(1); - /// - /// assert_eq!(array.pop(), Some(1)); - /// assert_eq!(array.pop(), None); - /// ``` - pub fn pop(&mut self) -> Option { - if self.len() == 0 { - return None; - } - unsafe { - let new_len = self.len() - 1; - self.set_len(new_len); - Some(ptr::read(self.get_unchecked_ptr(new_len))) - } - } - - /// Remove the element at `index` and swap the last element into its place. - /// - /// This operation is O(1). - /// - /// Return the *element* if the index is in bounds, else panic. - /// - /// ***Panics*** if the `index` is out of bounds. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3]); - /// - /// assert_eq!(array.swap_remove(0), 1); - /// assert_eq!(&array[..], &[3, 2]); - /// - /// assert_eq!(array.swap_remove(1), 2); - /// assert_eq!(&array[..], &[3]); - /// ``` - pub fn swap_remove(&mut self, index: usize) -> A::Item { - self.swap_pop(index) - .unwrap_or_else(|| { - panic_oob!("swap_remove", index, self.len()) - }) - } - - /// Remove the element at `index` and swap the last element into its place. - /// - /// This is a checked version of `.swap_remove`. - /// This operation is O(1). - /// - /// Return `Some(` *element* `)` if the index is in bounds, else `None`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3]); - /// - /// assert_eq!(array.swap_pop(0), Some(1)); - /// assert_eq!(&array[..], &[3, 2]); - /// - /// assert_eq!(array.swap_pop(10), None); - /// ``` - pub fn swap_pop(&mut self, index: usize) -> Option { - let len = self.len(); - if index >= len { - return None; - } - self.swap(index, len - 1); - self.pop() - } - - /// Remove the element at `index` and shift down the following elements. - /// - /// The `index` must be strictly less than the length of the vector. - /// - /// ***Panics*** if the `index` is out of bounds. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3]); - /// - /// let removed_elt = array.remove(0); - /// assert_eq!(removed_elt, 1); - /// assert_eq!(&array[..], &[2, 3]); - /// ``` - pub fn remove(&mut self, index: usize) -> A::Item { - self.pop_at(index) - .unwrap_or_else(|| { - panic_oob!("remove", index, self.len()) - }) - } - - /// Remove the element at `index` and shift down the following elements. - /// - /// This is a checked version of `.remove(index)`. Returns `None` if there - /// is no element at `index`. Otherwise, return the element inside `Some`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3]); - /// - /// assert!(array.pop_at(0).is_some()); - /// assert_eq!(&array[..], &[2, 3]); - /// - /// assert!(array.pop_at(2).is_none()); - /// assert!(array.pop_at(10).is_none()); - /// ``` - pub fn pop_at(&mut self, index: usize) -> Option { - if index >= self.len() { - None - } else { - self.drain(index..index + 1).next() - } - } - - /// 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. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3, 4, 5]); - /// array.truncate(3); - /// assert_eq!(&array[..], &[1, 2, 3]); - /// array.truncate(4); - /// assert_eq!(&array[..], &[1, 2, 3]); - /// ``` - pub fn truncate(&mut self, new_len: usize) { - unsafe { - if new_len < self.len() { - let tail: *mut [_] = &mut self[new_len..]; - self.len = Index::from(new_len); - ptr::drop_in_place(tail); - } - } - } - - /// Remove all elements in the vector. - pub fn clear(&mut self) { - self.truncate(0) - } - - /// Retains only the elements specified by the predicate. - /// - /// In other words, remove all elements `e` such that `f(&mut e)` returns false. - /// This method operates in place and preserves the order of the retained - /// elements. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut array = ArrayVec::from([1, 2, 3, 4]); - /// array.retain(|x| *x & 1 != 0 ); - /// assert_eq!(&array[..], &[1, 3]); - /// ``` - pub fn retain(&mut self, mut f: F) - where F: FnMut(&mut A::Item) -> bool - { - let len = self.len(); - let mut del = 0; - { - let v = &mut **self; - - for i in 0..len { - if !f(&mut v[i]) { - del += 1; - } else if del > 0 { - v.swap(i - del, i); - } - } - } - if del > 0 { - self.drain(len - del..); - } - } - - /// Set the vector’s length without dropping or moving out elements - /// - /// This method is `unsafe` because it changes the notion of the - /// number of “valid” elements in the vector. Use with care. - /// - /// This method uses *debug assertions* to check that `length` is - /// not greater than the capacity. - pub unsafe fn set_len(&mut self, length: usize) { - debug_assert!(length <= self.capacity()); - self.len = Index::from(length); - } - - /// Copy and appends all elements in a slice to the `ArrayVec`. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut vec: ArrayVec<[usize; 10]> = ArrayVec::new(); - /// vec.push(1); - /// vec.try_extend_from_slice(&[2, 3]).unwrap(); - /// assert_eq!(&vec[..], &[1, 2, 3]); - /// ``` - /// - /// # Errors - /// - /// This method will return an error if the capacity left (see - /// [`remaining_capacity`]) is smaller then the length of the provided - /// slice. - /// - /// [`remaining_capacity`]: #method.remaining_capacity - pub fn try_extend_from_slice(&mut self, other: &[A::Item]) -> Result<(), CapacityError> - where A::Item: Copy, - { - if self.remaining_capacity() < other.len() { - return Err(CapacityError::new(())); - } - - let self_len = self.len(); - let other_len = other.len(); - - unsafe { - let dst = self.xs.ptr_mut().offset(self_len as isize); - ptr::copy_nonoverlapping(other.as_ptr(), dst, other_len); - self.set_len(self_len + other_len); - } - Ok(()) - } - - /// Create a draining iterator that removes the specified range in the vector - /// and yields the removed items from start to end. The element range is - /// removed even if the iterator is not consumed until the end. - /// - /// Note: It is unspecified how many elements are removed from the vector, - /// if the `Drain` value is leaked. - /// - /// **Panics** if the starting point is greater than the end point or if - /// the end point is greater than the length of the vector. - /// - /// ``` - /// use arrayvec::ArrayVec; - /// - /// let mut v = ArrayVec::from([1, 2, 3]); - /// let u: ArrayVec<[_; 3]> = v.drain(0..2).collect(); - /// assert_eq!(&v[..], &[3]); - /// assert_eq!(&u[..], &[1, 2]); - /// ``` - pub fn drain(&mut self, range: R) -> Drain - where R: RangeBounds - { - // 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() { - Bound::Unbounded => 0, - Bound::Included(&i) => i, - Bound::Excluded(&i) => i.saturating_add(1), - }; - let end = match range.end_bound() { - Bound::Excluded(&j) => j, - Bound::Included(&j) => j.saturating_add(1), - Bound::Unbounded => len, - }; - self.drain_range(start, end) - } - - fn drain_range(&mut self, start: usize, end: usize) -> Drain - { - let len = self.len(); - // bounds check happens here - let range_slice: *const _ = &self[start..end]; - - unsafe { - // set self.vec length's to start, to be safe in case Drain is leaked - self.set_len(start); - Drain { - tail_start: end, - tail_len: len - end, - iter: (*range_slice).iter(), - vec: self as *mut _, - } - } - } - - /// Return the inner fixed size array, if it is full to its capacity. - /// - /// Return an `Ok` value with the array if length equals capacity, - /// return an `Err` with self otherwise. - pub fn into_inner(self) -> Result { - if self.len() < self.capacity() { - Err(self) - } else { - unsafe { - let array = ptr::read(self.xs.ptr() as *const A); - mem::forget(self); - Ok(array) - } - } - } - - /// Dispose of `self` (same as drop) - #[deprecated="Use std::mem::drop instead, if at all needed."] - pub fn dispose(mut self) { - self.clear(); - mem::forget(self); - } - - /// Return a slice containing all elements of the vector. - pub fn as_slice(&self) -> &[A::Item] { - self - } - - /// Return a mutable slice containing all elements of the vector. - pub fn as_mut_slice(&mut self) -> &mut [A::Item] { - self - } - - /// Return a raw pointer to the vector's buffer. - pub fn as_ptr(&self) -> *const A::Item { - self.xs.ptr() - } - - /// Return a raw mutable pointer to the vector's buffer. - pub fn as_mut_ptr(&mut self) -> *mut A::Item { - self.xs.ptr_mut() - } -} - -impl Deref for ArrayVec { - type Target = [A::Item]; - #[inline] - fn deref(&self) -> &[A::Item] { - unsafe { - slice::from_raw_parts(self.xs.ptr(), self.len()) - } - } -} - -impl DerefMut for ArrayVec { - #[inline] - fn deref_mut(&mut self) -> &mut [A::Item] { - let len = self.len(); - unsafe { - slice::from_raw_parts_mut(self.xs.ptr_mut(), len) - } - } -} - -/// Create an `ArrayVec` from an array. -/// -/// ``` -/// use arrayvec::ArrayVec; -/// -/// let mut array = ArrayVec::from([1, 2, 3]); -/// assert_eq!(array.len(), 3); -/// assert_eq!(array.capacity(), 3); -/// ``` -impl From for ArrayVec { - fn from(array: A) -> Self { - ArrayVec { xs: MaybeUninit::from(array), len: Index::from(A::CAPACITY) } - } -} - - -/// Iterate the `ArrayVec` with references to each element. -/// -/// ``` -/// use arrayvec::ArrayVec; -/// -/// let array = ArrayVec::from([1, 2, 3]); -/// -/// for elt in &array { -/// // ... -/// } -/// ``` -impl<'a, A: Array> IntoIterator for &'a ArrayVec { - type Item = &'a A::Item; - type IntoIter = slice::Iter<'a, A::Item>; - fn into_iter(self) -> Self::IntoIter { self.iter() } -} - -/// Iterate the `ArrayVec` with mutable references to each element. -/// -/// ``` -/// use arrayvec::ArrayVec; -/// -/// let mut array = ArrayVec::from([1, 2, 3]); -/// -/// for elt in &mut array { -/// // ... -/// } -/// ``` -impl<'a, A: Array> IntoIterator for &'a mut ArrayVec { - type Item = &'a mut A::Item; - type IntoIter = slice::IterMut<'a, A::Item>; - fn into_iter(self) -> Self::IntoIter { self.iter_mut() } -} - -/// Iterate the `ArrayVec` with each element by value. -/// -/// The vector is consumed by this operation. -/// -/// ``` -/// use arrayvec::ArrayVec; -/// -/// for elt in ArrayVec::from([1, 2, 3]) { -/// // ... -/// } -/// ``` -impl IntoIterator for ArrayVec { - type Item = A::Item; - type IntoIter = IntoIter; - fn into_iter(self) -> IntoIter { - IntoIter { index: Index::from(0), v: self, } - } -} - - -/// By-value iterator for `ArrayVec`. -pub struct IntoIter { - index: A::Index, - v: ArrayVec, -} - -impl Iterator for IntoIter { - type Item = A::Item; - - fn next(&mut self) -> Option { - if self.index == self.v.len { - None - } else { - unsafe { - let index = self.index.to_usize(); - self.index = Index::from(index + 1); - Some(ptr::read(self.v.get_unchecked_ptr(index))) - } - } - } - - fn size_hint(&self) -> (usize, Option) { - let len = self.v.len() - self.index.to_usize(); - (len, Some(len)) - } -} - -impl DoubleEndedIterator for IntoIter { - fn next_back(&mut self) -> Option { - if self.index == self.v.len { - None - } else { - unsafe { - let new_len = self.v.len() - 1; - self.v.set_len(new_len); - Some(ptr::read(self.v.get_unchecked_ptr(new_len))) - } - } - } -} - -impl ExactSizeIterator for IntoIter { } - -impl Drop for IntoIter { - fn drop(&mut self) { - // panic safety: Set length to 0 before dropping elements. - let index = self.index.to_usize(); - let len = self.v.len(); - unsafe { - self.v.set_len(0); - let elements = slice::from_raw_parts_mut( - self.v.get_unchecked_ptr(index), - len - index); - ptr::drop_in_place(elements); - } - } -} - -impl Clone for IntoIter -where - A::Item: Clone, -{ - fn clone(&self) -> IntoIter { - self.v[self.index.to_usize()..] - .iter() - .cloned() - .collect::>() - .into_iter() - } -} - -impl fmt::Debug for IntoIter -where - A::Item: fmt::Debug, -{ - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_list() - .entries(&self.v[self.index.to_usize()..]) - .finish() - } -} - -/// A draining iterator for `ArrayVec`. -pub struct Drain<'a, A> - where A: Array, - A::Item: 'a, -{ - /// Index of tail to preserve - tail_start: usize, - /// Length of tail - tail_len: usize, - /// Current remaining range to remove - iter: slice::Iter<'a, A::Item>, - vec: *mut ArrayVec, -} - -unsafe impl<'a, A: Array + Sync> Sync for Drain<'a, A> {} -unsafe impl<'a, A: Array + Send> Send for Drain<'a, A> {} - -impl<'a, A: Array> Iterator for Drain<'a, A> - where A::Item: 'a, -{ - type Item = A::Item; - - fn next(&mut self) -> Option { - self.iter.next().map(|elt| - unsafe { - ptr::read(elt as *const _) - } - ) - } - - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } -} - -impl<'a, A: Array> DoubleEndedIterator for Drain<'a, A> - where A::Item: 'a, -{ - fn next_back(&mut self) -> Option { - self.iter.next_back().map(|elt| - unsafe { - ptr::read(elt as *const _) - } - ) - } -} - -impl<'a, A: Array> ExactSizeIterator for Drain<'a, A> where A::Item: 'a {} - -impl<'a, A: Array> Drop for Drain<'a, A> - where A::Item: 'a -{ - fn drop(&mut self) { - // len is currently 0 so panicking while dropping will not cause a double drop. - - // exhaust self first - while let Some(_) = self.next() { } - - if self.tail_len > 0 { - unsafe { - let source_vec = &mut *self.vec; - // memmove back untouched tail, update to new length - let start = source_vec.len(); - let tail = self.tail_start; - let src = source_vec.as_ptr().offset(tail as isize); - let dst = source_vec.as_mut_ptr().offset(start as isize); - ptr::copy(src, dst, self.tail_len); - source_vec.set_len(start + self.tail_len); - } - } - } -} - -struct ScopeExitGuard - where F: FnMut(&Data, &mut T) -{ - value: T, - data: Data, - f: F, -} - -impl Drop for ScopeExitGuard - where F: FnMut(&Data, &mut T) -{ - fn drop(&mut self) { - (self.f)(&self.data, &mut self.value) - } -} - - - -/// Extend the `ArrayVec` with an iterator. -/// -/// Does not extract more items than there is space for. No error -/// occurs if there are more iterator elements. -impl Extend for ArrayVec { - fn extend>(&mut self, iter: T) { - let take = self.capacity() - self.len(); - unsafe { - let len = self.len(); - let mut ptr = raw_ptr_add(self.as_mut_ptr(), len); - let end_ptr = raw_ptr_add(ptr, take); - // Keep the length in a separate variable, write it back on scope - // exit. To help the compiler with alias analysis and stuff. - // We update the length to handle panic in the iteration of the - // user's iterator, without dropping any elements on the floor. - let mut guard = ScopeExitGuard { - value: &mut self.len, - data: len, - f: move |&len, self_len| { - **self_len = Index::from(len); - } - }; - let mut iter = iter.into_iter(); - loop { - if ptr == end_ptr { break; } - if let Some(elt) = iter.next() { - raw_ptr_write(ptr, elt); - ptr = raw_ptr_add(ptr, 1); - guard.data += 1; - } else { - break; - } - } - } - } -} - -/// Rawptr add but uses arithmetic distance for ZST -unsafe fn raw_ptr_add(ptr: *mut T, offset: usize) -> *mut T { - if mem::size_of::() == 0 { - // Special case for ZST - (ptr as usize).wrapping_add(offset) as _ - } else { - ptr.offset(offset as isize) - } -} - -unsafe fn raw_ptr_write(ptr: *mut T, value: T) { - if mem::size_of::() == 0 { - /* nothing */ - } else { - ptr::write(ptr, value) - } -} - -/// Create an `ArrayVec` from an iterator. -/// -/// Does not extract more items than there is space for. No error -/// occurs if there are more iterator elements. -impl iter::FromIterator for ArrayVec { - fn from_iter>(iter: T) -> Self { - let mut array = ArrayVec::new(); - array.extend(iter); - array - } -} - -impl Clone for ArrayVec - where A::Item: Clone -{ - fn clone(&self) -> Self { - self.iter().cloned().collect() - } - - fn clone_from(&mut self, rhs: &Self) { - // recursive case for the common prefix - let prefix = cmp::min(self.len(), rhs.len()); - self[..prefix].clone_from_slice(&rhs[..prefix]); - - if prefix < self.len() { - // rhs was shorter - for _ in 0..self.len() - prefix { - self.pop(); - } - } else { - let rhs_elems = rhs[self.len()..].iter().cloned(); - self.extend(rhs_elems); - } - } -} - -impl Hash for ArrayVec - where A::Item: Hash -{ - fn hash(&self, state: &mut H) { - Hash::hash(&**self, state) - } -} - -impl PartialEq for ArrayVec - where A::Item: PartialEq -{ - fn eq(&self, other: &Self) -> bool { - **self == **other - } -} - -impl PartialEq<[A::Item]> for ArrayVec - where A::Item: PartialEq -{ - fn eq(&self, other: &[A::Item]) -> bool { - **self == *other - } -} - -impl Eq for ArrayVec where A::Item: Eq { } - -impl Borrow<[A::Item]> for ArrayVec { - fn borrow(&self) -> &[A::Item] { self } -} - -impl BorrowMut<[A::Item]> for ArrayVec { - fn borrow_mut(&mut self) -> &mut [A::Item] { self } -} - -impl AsRef<[A::Item]> for ArrayVec { - fn as_ref(&self) -> &[A::Item] { self } -} - -impl AsMut<[A::Item]> for ArrayVec { - fn as_mut(&mut self) -> &mut [A::Item] { self } -} - -impl fmt::Debug for ArrayVec where A::Item: fmt::Debug { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { (**self).fmt(f) } -} - -impl Default for ArrayVec { - /// Return an empty array - fn default() -> ArrayVec { - ArrayVec::new() - } -} - -impl PartialOrd for ArrayVec where A::Item: PartialOrd { - fn partial_cmp(&self, other: &ArrayVec) -> Option { - (**self).partial_cmp(other) - } - - fn lt(&self, other: &Self) -> bool { - (**self).lt(other) - } - - fn le(&self, other: &Self) -> bool { - (**self).le(other) - } - - fn ge(&self, other: &Self) -> bool { - (**self).ge(other) - } - - fn gt(&self, other: &Self) -> bool { - (**self).gt(other) - } -} - -impl Ord for ArrayVec where A::Item: Ord { - fn cmp(&self, other: &ArrayVec) -> cmp::Ordering { - (**self).cmp(other) - } -} - -#[cfg(feature="std")] -/// `Write` appends written data to the end of the vector. -/// -/// Requires `features="std"`. -impl> io::Write for ArrayVec { - fn write(&mut self, data: &[u8]) -> io::Result { - let len = cmp::min(self.remaining_capacity(), data.len()); - let _result = self.try_extend_from_slice(&data[..len]); - debug_assert!(_result.is_ok()); - Ok(len) - } - fn flush(&mut self) -> io::Result<()> { Ok(()) } -} - -#[cfg(feature="serde")] -/// Requires crate feature `"serde"` -impl> Serialize for ArrayVec { - fn serialize(&self, serializer: S) -> Result - where S: Serializer - { - serializer.collect_seq(self) - } -} - -#[cfg(feature="serde")] -/// Requires crate feature `"serde"` -impl<'de, T: Deserialize<'de>, A: Array> Deserialize<'de> for ArrayVec { - fn deserialize(deserializer: D) -> Result - where D: Deserializer<'de> - { - use serde::de::{Visitor, SeqAccess, Error}; - use std::marker::PhantomData; - - struct ArrayVecVisitor<'de, T: Deserialize<'de>, A: Array>(PhantomData<(&'de (), T, A)>); - - impl<'de, T: Deserialize<'de>, A: Array> Visitor<'de> for ArrayVecVisitor<'de, T, A> { - type Value = ArrayVec; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "an array with no more than {} items", A::CAPACITY) - } - - fn visit_seq(self, mut seq: SA) -> Result - where SA: SeqAccess<'de>, - { - let mut values = ArrayVec::::new(); - - while let Some(value) = seq.next_element()? { - if let Err(_) = values.try_push(value) { - return Err(SA::Error::invalid_length(A::CAPACITY + 1, &self)); - } - } - - Ok(values) - } - } - - deserializer.deserialize_seq(ArrayVecVisitor::(PhantomData)) - } -} diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/src/maybe_uninit.rs b/third_party/cargo/vendor/arrayvec-0.5.1/src/maybe_uninit.rs deleted file mode 100644 index fc69a3f..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/src/maybe_uninit.rs +++ /dev/null @@ -1,44 +0,0 @@ - - -use crate::array::Array; -use std::mem::MaybeUninit as StdMaybeUninit; - -#[derive(Copy)] -pub struct MaybeUninit { - inner: StdMaybeUninit, -} - -impl Clone for MaybeUninit - where T: Copy -{ - fn clone(&self) -> Self { *self } -} - -impl MaybeUninit { - /// Create a new MaybeUninit with uninitialized interior - pub unsafe fn uninitialized() -> Self { - MaybeUninit { inner: StdMaybeUninit::uninit() } - } - - /// Create a new MaybeUninit from the value `v`. - pub fn from(v: T) -> Self { - MaybeUninit { inner: StdMaybeUninit::new(v) } - } - - // Raw pointer casts written so that we don't reference or access the - // uninitialized interior value - - /// Return a raw pointer to the start of the interior array - pub fn ptr(&self) -> *const T::Item - where T: Array - { - self.inner.as_ptr() as *const T::Item - } - - /// Return a mut raw pointer to the start of the interior array - pub fn ptr_mut(&mut self) -> *mut T::Item - where T: Array - { - self.inner.as_mut_ptr() as *mut T::Item - } -} diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/tests/serde.rs b/third_party/cargo/vendor/arrayvec-0.5.1/tests/serde.rs deleted file mode 100644 index 3876d2a..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/tests/serde.rs +++ /dev/null @@ -1,79 +0,0 @@ -#![cfg(feature = "serde")] -extern crate arrayvec; -extern crate serde_test; - -mod array_vec { - use arrayvec::ArrayVec; - - use serde_test::{Token, assert_tokens, assert_de_tokens_error}; - - #[test] - fn test_ser_de_empty() { - let vec = ArrayVec::<[u32; 0]>::new(); - - assert_tokens(&vec, &[ - Token::Seq { len: Some(0) }, - Token::SeqEnd, - ]); - } - - - #[test] - fn test_ser_de() { - let mut vec = ArrayVec::<[u32; 3]>::new(); - vec.push(20); - vec.push(55); - vec.push(123); - - assert_tokens(&vec, &[ - Token::Seq { len: Some(3) }, - Token::U32(20), - Token::U32(55), - Token::U32(123), - Token::SeqEnd, - ]); - } - - #[test] - fn test_de_too_large() { - assert_de_tokens_error::>(&[ - Token::Seq { len: Some(3) }, - Token::U32(13), - Token::U32(42), - Token::U32(68), - ], "invalid length 3, expected an array with no more than 2 items"); - } -} - -mod array_string { - use arrayvec::ArrayString; - - use serde_test::{Token, assert_tokens, assert_de_tokens_error}; - - #[test] - fn test_ser_de_empty() { - let string = ArrayString::<[u8; 0]>::new(); - - assert_tokens(&string, &[ - Token::Str(""), - ]); - } - - - #[test] - fn test_ser_de() { - let string = ArrayString::<[u8; 9]>::from("1234 abcd") - .expect("expected exact specified capacity to be enough"); - - assert_tokens(&string, &[ - Token::Str("1234 abcd"), - ]); - } - - #[test] - fn test_de_too_large() { - assert_de_tokens_error::>(&[ - Token::Str("afd") - ], "invalid length 3, expected a string no more than 2 bytes long"); - } -} diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/tests/tests.rs b/third_party/cargo/vendor/arrayvec-0.5.1/tests/tests.rs deleted file mode 100644 index 1cf3aad..0000000 --- a/third_party/cargo/vendor/arrayvec-0.5.1/tests/tests.rs +++ /dev/null @@ -1,679 +0,0 @@ -extern crate arrayvec; -#[macro_use] extern crate matches; - -use arrayvec::ArrayVec; -use arrayvec::ArrayString; -use std::mem; -use arrayvec::CapacityError; - -use std::collections::HashMap; - - -#[test] -fn test_simple() { - use std::ops::Add; - - let mut vec: ArrayVec<[Vec; 3]> = ArrayVec::new(); - - vec.push(vec![1, 2, 3, 4]); - vec.push(vec![10]); - vec.push(vec![-1, 13, -2]); - - for elt in &vec { - assert_eq!(elt.iter().fold(0, Add::add), 10); - } - - let sum_len = vec.into_iter().map(|x| x.len()).fold(0, Add::add); - assert_eq!(sum_len, 8); -} - -#[test] -fn test_capacity_left() { - let mut vec: ArrayVec<[usize; 4]> = ArrayVec::new(); - assert_eq!(vec.remaining_capacity(), 4); - vec.push(1); - assert_eq!(vec.remaining_capacity(), 3); - vec.push(2); - assert_eq!(vec.remaining_capacity(), 2); - vec.push(3); - assert_eq!(vec.remaining_capacity(), 1); - vec.push(4); - assert_eq!(vec.remaining_capacity(), 0); -} - -#[test] -fn test_extend_from_slice() { - let mut vec: ArrayVec<[usize; 10]> = ArrayVec::new(); - - vec.try_extend_from_slice(&[1, 2, 3]).unwrap(); - assert_eq!(vec.len(), 3); - assert_eq!(&vec[..], &[1, 2, 3]); - assert_eq!(vec.pop(), Some(3)); - assert_eq!(&vec[..], &[1, 2]); -} - -#[test] -fn test_extend_from_slice_error() { - let mut vec: ArrayVec<[usize; 10]> = ArrayVec::new(); - - vec.try_extend_from_slice(&[1, 2, 3]).unwrap(); - let res = vec.try_extend_from_slice(&[0; 8]); - assert_matches!(res, Err(_)); - - let mut vec: ArrayVec<[usize; 0]> = ArrayVec::new(); - let res = vec.try_extend_from_slice(&[0; 1]); - assert_matches!(res, Err(_)); -} - -#[test] -fn test_u16_index() { - const N: usize = 4096; - let mut vec: ArrayVec<[_; N]> = ArrayVec::new(); - for _ in 0..N { - assert!(vec.try_push(1u8).is_ok()); - } - assert!(vec.try_push(0).is_err()); - assert_eq!(vec.len(), N); -} - -#[test] -fn test_iter() { - let mut iter = ArrayVec::from([1, 2, 3]).into_iter(); - assert_eq!(iter.size_hint(), (3, Some(3))); - assert_eq!(iter.next_back(), Some(3)); - assert_eq!(iter.next(), Some(1)); - assert_eq!(iter.next_back(), Some(2)); - assert_eq!(iter.size_hint(), (0, Some(0))); - assert_eq!(iter.next_back(), None); -} - -#[test] -fn test_drop() { - use std::cell::Cell; - - let flag = &Cell::new(0); - - #[derive(Clone)] - struct Bump<'a>(&'a Cell); - - impl<'a> Drop for Bump<'a> { - fn drop(&mut self) { - let n = self.0.get(); - self.0.set(n + 1); - } - } - - { - let mut array = ArrayVec::<[Bump; 128]>::new(); - array.push(Bump(flag)); - array.push(Bump(flag)); - } - assert_eq!(flag.get(), 2); - - // test something with the nullable pointer optimization - flag.set(0); - - { - let mut array = ArrayVec::<[_; 3]>::new(); - array.push(vec![Bump(flag)]); - array.push(vec![Bump(flag), Bump(flag)]); - array.push(vec![]); - let push4 = array.try_push(vec![Bump(flag)]); - assert_eq!(flag.get(), 0); - drop(push4); - assert_eq!(flag.get(), 1); - drop(array.pop()); - assert_eq!(flag.get(), 1); - drop(array.pop()); - assert_eq!(flag.get(), 3); - } - - assert_eq!(flag.get(), 4); - - // test into_inner - flag.set(0); - { - let mut array = ArrayVec::<[_; 3]>::new(); - array.push(Bump(flag)); - array.push(Bump(flag)); - array.push(Bump(flag)); - let inner = array.into_inner(); - assert!(inner.is_ok()); - assert_eq!(flag.get(), 0); - drop(inner); - assert_eq!(flag.get(), 3); - } - - // test cloning into_iter - flag.set(0); - { - let mut array = ArrayVec::<[_; 3]>::new(); - array.push(Bump(flag)); - array.push(Bump(flag)); - array.push(Bump(flag)); - let mut iter = array.into_iter(); - assert_eq!(flag.get(), 0); - iter.next(); - assert_eq!(flag.get(), 1); - let clone = iter.clone(); - assert_eq!(flag.get(), 1); - drop(clone); - assert_eq!(flag.get(), 3); - drop(iter); - assert_eq!(flag.get(), 5); - } -} - -#[test] -fn test_drop_panics() { - use std::cell::Cell; - use std::panic::catch_unwind; - use std::panic::AssertUnwindSafe; - - let flag = &Cell::new(0); - - struct Bump<'a>(&'a Cell); - - // Panic in the first drop - impl<'a> Drop for Bump<'a> { - fn drop(&mut self) { - let n = self.0.get(); - self.0.set(n + 1); - if n == 0 { - panic!("Panic in Bump's drop"); - } - } - } - // check if rust is new enough - flag.set(0); - { - let array = vec![Bump(flag), Bump(flag)]; - let res = catch_unwind(AssertUnwindSafe(|| { - drop(array); - })); - assert!(res.is_err()); - } - - if flag.get() != 2 { - println!("test_drop_panics: skip, this version of Rust doesn't continue in drop_in_place"); - return; - } - - flag.set(0); - { - let mut array = ArrayVec::<[Bump; 128]>::new(); - array.push(Bump(flag)); - array.push(Bump(flag)); - array.push(Bump(flag)); - - let res = catch_unwind(AssertUnwindSafe(|| { - drop(array); - })); - assert!(res.is_err()); - } - // Check that all the elements drop, even if the first drop panics. - assert_eq!(flag.get(), 3); - - - flag.set(0); - { - let mut array = ArrayVec::<[Bump; 16]>::new(); - array.push(Bump(flag)); - array.push(Bump(flag)); - array.push(Bump(flag)); - array.push(Bump(flag)); - array.push(Bump(flag)); - - let i = 2; - let tail_len = array.len() - i; - - let res = catch_unwind(AssertUnwindSafe(|| { - array.truncate(i); - })); - assert!(res.is_err()); - // Check that all the tail elements drop, even if the first drop panics. - assert_eq!(flag.get(), tail_len as i32); - } - - -} - -#[test] -fn test_extend() { - let mut range = 0..10; - - let mut array: ArrayVec<[_; 5]> = range.by_ref().collect(); - assert_eq!(&array[..], &[0, 1, 2, 3, 4]); - assert_eq!(range.next(), Some(5)); - - array.extend(range.by_ref()); - assert_eq!(range.next(), Some(6)); - - let mut array: ArrayVec<[_; 10]> = (0..3).collect(); - assert_eq!(&array[..], &[0, 1, 2]); - array.extend(3..5); - assert_eq!(&array[..], &[0, 1, 2, 3, 4]); -} - -#[test] -fn test_is_send_sync() { - let data = ArrayVec::<[Vec; 5]>::new(); - &data as &dyn Send; - &data as &dyn Sync; -} - -#[test] -fn test_compact_size() { - // Future rust will kill these drop flags! - // 4 elements size + 1 len + 1 enum tag + [1 drop flag] - type ByteArray = ArrayVec<[u8; 4]>; - println!("{}", mem::size_of::()); - assert!(mem::size_of::() <= 8); - - // 1 enum tag + 1 drop flag - type EmptyArray = ArrayVec<[u8; 0]>; - println!("{}", mem::size_of::()); - assert!(mem::size_of::() <= 2); - - // 12 element size + 1 enum tag + 3 padding + 1 len + 1 drop flag + 2 padding - type QuadArray = ArrayVec<[u32; 3]>; - println!("{}", mem::size_of::()); - assert!(mem::size_of::() <= 24); -} - -#[test] -fn test_still_works_with_option_arrayvec() { - type RefArray = ArrayVec<[&'static i32; 2]>; - let array = Some(RefArray::new()); - assert!(array.is_some()); - println!("{:?}", array); -} - -#[test] -fn test_drain() { - let mut v = ArrayVec::from([0; 8]); - v.pop(); - v.drain(0..7); - assert_eq!(&v[..], &[]); - - v.extend(0..); - v.drain(1..4); - assert_eq!(&v[..], &[0, 4, 5, 6, 7]); - let u: ArrayVec<[_; 3]> = v.drain(1..4).rev().collect(); - assert_eq!(&u[..], &[6, 5, 4]); - assert_eq!(&v[..], &[0, 7]); - v.drain(..); - assert_eq!(&v[..], &[]); -} - -#[test] -fn test_drain_range_inclusive() { - let mut v = ArrayVec::from([0; 8]); - v.drain(0..=7); - assert_eq!(&v[..], &[]); - - v.extend(0..); - v.drain(1..=4); - assert_eq!(&v[..], &[0, 5, 6, 7]); - let u: ArrayVec<[_; 3]> = v.drain(1..=2).rev().collect(); - assert_eq!(&u[..], &[6, 5]); - assert_eq!(&v[..], &[0, 7]); - v.drain(..); - assert_eq!(&v[..], &[]); -} - -#[test] -#[should_panic] -fn test_drain_range_inclusive_oob() { - let mut v = ArrayVec::from([0; 0]); - v.drain(0..=0); -} - -#[test] -fn test_retain() { - let mut v = ArrayVec::from([0; 8]); - for (i, elt) in v.iter_mut().enumerate() { - *elt = i; - } - v.retain(|_| true); - assert_eq!(&v[..], &[0, 1, 2, 3, 4, 5, 6, 7]); - v.retain(|elt| { - *elt /= 2; - *elt % 2 == 0 - }); - assert_eq!(&v[..], &[0, 0, 2, 2]); - v.retain(|_| false); - assert_eq!(&v[..], &[]); -} - -#[test] -#[should_panic] -fn test_drain_oob() { - let mut v = ArrayVec::from([0; 8]); - v.pop(); - v.drain(0..8); -} - -#[test] -#[should_panic] -fn test_drop_panic() { - struct DropPanic; - - impl Drop for DropPanic { - fn drop(&mut self) { - panic!("drop"); - } - } - - let mut array = ArrayVec::<[DropPanic; 1]>::new(); - array.push(DropPanic); -} - -#[test] -#[should_panic] -fn test_drop_panic_into_iter() { - struct DropPanic; - - impl Drop for DropPanic { - fn drop(&mut self) { - panic!("drop"); - } - } - - let mut array = ArrayVec::<[DropPanic; 1]>::new(); - array.push(DropPanic); - array.into_iter(); -} - -#[test] -fn test_insert() { - let mut v = ArrayVec::from([]); - assert_matches!(v.try_push(1), Err(_)); - - let mut v = ArrayVec::<[_; 3]>::new(); - v.insert(0, 0); - v.insert(1, 1); - //let ret1 = v.try_insert(3, 3); - //assert_matches!(ret1, Err(InsertError::OutOfBounds(_))); - assert_eq!(&v[..], &[0, 1]); - v.insert(2, 2); - assert_eq!(&v[..], &[0, 1, 2]); - - let ret2 = v.try_insert(1, 9); - assert_eq!(&v[..], &[0, 1, 2]); - assert_matches!(ret2, Err(_)); - - let mut v = ArrayVec::from([2]); - assert_matches!(v.try_insert(0, 1), Err(CapacityError { .. })); - assert_matches!(v.try_insert(1, 1), Err(CapacityError { .. })); - //assert_matches!(v.try_insert(2, 1), Err(CapacityError { .. })); -} - -#[test] -fn test_into_inner_1() { - let mut v = ArrayVec::from([1, 2]); - v.pop(); - let u = v.clone(); - assert_eq!(v.into_inner(), Err(u)); -} - -#[test] -fn test_into_inner_2() { - let mut v = ArrayVec::<[String; 4]>::new(); - v.push("a".into()); - v.push("b".into()); - v.push("c".into()); - v.push("d".into()); - assert_eq!(v.into_inner().unwrap(), ["a", "b", "c", "d"]); -} - -#[test] -fn test_into_inner_3_() { - let mut v = ArrayVec::<[i32; 4]>::new(); - v.extend(1..); - assert_eq!(v.into_inner().unwrap(), [1, 2, 3, 4]); -} - -#[cfg(feature="std")] -#[test] -fn test_write() { - use std::io::Write; - let mut v = ArrayVec::<[_; 8]>::new(); - write!(&mut v, "\x01\x02\x03").unwrap(); - assert_eq!(&v[..], &[1, 2, 3]); - let r = v.write(&[9; 16]).unwrap(); - assert_eq!(r, 5); - assert_eq!(&v[..], &[1, 2, 3, 9, 9, 9, 9, 9]); -} - -#[test] -fn array_clone_from() { - let mut v = ArrayVec::<[_; 4]>::new(); - v.push(vec![1, 2]); - v.push(vec![3, 4, 5]); - v.push(vec![6]); - let reference = v.to_vec(); - let mut u = ArrayVec::<[_; 4]>::new(); - u.clone_from(&v); - assert_eq!(&u, &reference[..]); - - let mut t = ArrayVec::<[_; 4]>::new(); - t.push(vec![97]); - t.push(vec![]); - t.push(vec![5, 6, 2]); - t.push(vec![2]); - t.clone_from(&v); - assert_eq!(&t, &reference[..]); - t.clear(); - t.clone_from(&v); - assert_eq!(&t, &reference[..]); -} - -#[cfg(feature="std")] -#[test] -fn test_string() { - use std::error::Error; - - let text = "hello world"; - let mut s = ArrayString::<[_; 16]>::new(); - s.try_push_str(text).unwrap(); - assert_eq!(&s, text); - assert_eq!(text, &s); - - // Make sure Hash / Eq / Borrow match up so we can use HashMap - let mut map = HashMap::new(); - map.insert(s, 1); - assert_eq!(map[text], 1); - - let mut t = ArrayString::<[_; 2]>::new(); - assert!(t.try_push_str(text).is_err()); - assert_eq!(&t, ""); - - t.push_str("ab"); - // DerefMut - let tmut: &mut str = &mut t; - assert_eq!(tmut, "ab"); - - // Test Error trait / try - let t = || -> Result<(), Box> { - let mut t = ArrayString::<[_; 2]>::new(); - t.try_push_str(text)?; - Ok(()) - }(); - assert!(t.is_err()); -} - -#[test] -fn test_string_from() { - let text = "hello world"; - // Test `from` constructor - let u = ArrayString::<[_; 11]>::from(text).unwrap(); - assert_eq!(&u, text); - assert_eq!(u.len(), text.len()); -} - -#[test] -fn test_string_parse_from_str() { - let text = "hello world"; - let u: ArrayString<[_; 11]> = text.parse().unwrap(); - assert_eq!(&u, text); - assert_eq!(u.len(), text.len()); -} - -#[test] -fn test_string_from_bytes() { - let text = "hello world"; - let u = ArrayString::from_byte_string(b"hello world").unwrap(); - assert_eq!(&u, text); - assert_eq!(u.len(), text.len()); -} - -#[test] -fn test_string_clone() { - let text = "hi"; - let mut s = ArrayString::<[_; 4]>::new(); - s.push_str("abcd"); - let t = ArrayString::<[_; 4]>::from(text).unwrap(); - s.clone_from(&t); - assert_eq!(&t, &s); -} - -#[test] -fn test_string_push() { - let text = "abcαβγ"; - let mut s = ArrayString::<[_; 8]>::new(); - for c in text.chars() { - if let Err(_) = s.try_push(c) { - break; - } - } - assert_eq!("abcαβ", &s[..]); - s.push('x'); - assert_eq!("abcαβx", &s[..]); - assert!(s.try_push('x').is_err()); -} - - -#[test] -fn test_insert_at_length() { - let mut v = ArrayVec::<[_; 8]>::new(); - let result1 = v.try_insert(0, "a"); - let result2 = v.try_insert(1, "b"); - assert!(result1.is_ok() && result2.is_ok()); - assert_eq!(&v[..], &["a", "b"]); -} - -#[should_panic] -#[test] -fn test_insert_out_of_bounds() { - let mut v = ArrayVec::<[_; 8]>::new(); - let _ = v.try_insert(1, "test"); -} - -/* - * insert that pushes out the last - let mut u = ArrayVec::from([1, 2, 3, 4]); - let ret = u.try_insert(3, 99); - assert_eq!(&u[..], &[1, 2, 3, 99]); - assert_matches!(ret, Err(_)); - let ret = u.try_insert(4, 77); - assert_eq!(&u[..], &[1, 2, 3, 99]); - assert_matches!(ret, Err(_)); -*/ - -#[test] -fn test_drop_in_insert() { - use std::cell::Cell; - - let flag = &Cell::new(0); - - struct Bump<'a>(&'a Cell); - - impl<'a> Drop for Bump<'a> { - fn drop(&mut self) { - let n = self.0.get(); - self.0.set(n + 1); - } - } - - flag.set(0); - - { - let mut array = ArrayVec::<[_; 2]>::new(); - array.push(Bump(flag)); - array.insert(0, Bump(flag)); - assert_eq!(flag.get(), 0); - let ret = array.try_insert(1, Bump(flag)); - assert_eq!(flag.get(), 0); - assert_matches!(ret, Err(_)); - drop(ret); - assert_eq!(flag.get(), 1); - } - assert_eq!(flag.get(), 3); -} - -#[test] -fn test_pop_at() { - let mut v = ArrayVec::<[String; 4]>::new(); - let s = String::from; - v.push(s("a")); - v.push(s("b")); - v.push(s("c")); - v.push(s("d")); - - assert_eq!(v.pop_at(4), None); - assert_eq!(v.pop_at(1), Some(s("b"))); - assert_eq!(v.pop_at(1), Some(s("c"))); - assert_eq!(v.pop_at(2), None); - assert_eq!(&v[..], &["a", "d"]); -} - -#[test] -fn test_sizes() { - let v = ArrayVec::from([0u8; 1 << 16]); - assert_eq!(vec![0u8; v.len()], &v[..]); -} - -#[test] -fn test_default() { - use std::net; - let s: ArrayString<[u8; 4]> = Default::default(); - // Something without `Default` implementation. - let v: ArrayVec<[net::TcpStream; 4]> = Default::default(); - assert_eq!(s.len(), 0); - assert_eq!(v.len(), 0); -} - -#[cfg(feature="array-sizes-33-128")] -#[test] -fn test_sizes_33_128() { - ArrayVec::from([0u8; 52]); - ArrayVec::from([0u8; 127]); -} - -#[cfg(feature="array-sizes-129-255")] -#[test] -fn test_sizes_129_255() { - ArrayVec::from([0u8; 237]); - ArrayVec::from([0u8; 255]); -} - -#[test] -fn test_extend_zst() { - let mut range = 0..10; - #[derive(Copy, Clone, PartialEq, Debug)] - struct Z; // Zero sized type - - let mut array: ArrayVec<[_; 5]> = range.by_ref().map(|_| Z).collect(); - assert_eq!(&array[..], &[Z; 5]); - assert_eq!(range.next(), Some(5)); - - array.extend(range.by_ref().map(|_| Z)); - assert_eq!(range.next(), Some(6)); - - let mut array: ArrayVec<[_; 10]> = (0..3).map(|_| Z).collect(); - assert_eq!(&array[..], &[Z; 3]); - array.extend((3..5).map(|_| Z)); - assert_eq!(&array[..], &[Z; 5]); - assert_eq!(array.len(), 5); -} diff --git a/third_party/cargo/vendor/atty-0.2.14/.cargo-checksum.json b/third_party/cargo/vendor/atty-0.2.14/.cargo-checksum.json index 08e4991..a68b85b 100644 --- a/third_party/cargo/vendor/atty-0.2.14/.cargo-checksum.json +++ b/third_party/cargo/vendor/atty-0.2.14/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"70db121262d72acc472ad1a90b78c42de570820e65b566c6b9339b62e636d572","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 +{"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/third_party/cargo/vendor/atty-0.2.14/BUILD b/third_party/cargo/vendor/atty-0.2.14/BUILD index b690c3d..4eee0e3 100644 --- a/third_party/cargo/vendor/atty-0.2.14/BUILD +++ b/third_party/cargo/vendor/atty-0.2.14/BUILD @@ -32,7 +32,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/atty-0.2.14/Cargo.lock b/third_party/cargo/vendor/atty-0.2.14/Cargo.lock new file mode 100644 index 0000000..8dc13c8 --- /dev/null +++ b/third_party/cargo/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/third_party/cargo/vendor/autocfg-0.1.7/.cargo-checksum.json b/third_party/cargo/vendor/autocfg-0.1.7/.cargo-checksum.json index 824ef78..87bafe6 100644 --- a/third_party/cargo/vendor/autocfg-0.1.7/.cargo-checksum.json +++ b/third_party/cargo/vendor/autocfg-0.1.7/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"4072e465bb2d1110644171c28d1a48a8cf5e9bb85c75d39409bb719348a131f6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"27995d58ad5c1145c1a8cd86244ce844886958a35eb2b78c6b772748669999ac","README.md":"0ff4942223d94c9686f846bb0b1de12221f06e7f39c1818ecbaaec402e89e770","examples/integers.rs":"589ff4271566dfa322becddf3e2c7b592e6e0bc97b02892ce75619b7e452e930","examples/paths.rs":"1b30e466b824ce8df7ad0a55334424131d9d2573d6cf9f7d5d50c09c8901d526","examples/traits.rs":"cbee6a3e1f7db60b02ae25b714926517144a77cb492021f492774cf0e1865a9e","examples/versions.rs":"38535e6d9f5bfae0de474a3db79a40e8f5da8ba9334c5ff4c363de9bc99d4d12","src/error.rs":"12de7dafea4a35d1dc2f0fa79bfa038386bbbea72bf083979f4ddf227999eeda","src/lib.rs":"374704e933dc6263a334652144e4436a7e409f88069c2f4f8e8c4ef14f7aa76b","src/tests.rs":"0b1353344e832553d328c47f1639ced877b5dff70fd2024d84130bd1c33eee07","src/version.rs":"175727d5f02f2fe2271ddc9b041db2a5b9c6fe0f95afd17c73a4d982612764a3","tests/rustflags.rs":"a3788396e0b81a33406d06fef3bc31c5a328f323de6766570a345ebad885cbf9"},"package":"1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"} \ No newline at end of file +{"files":{"Cargo.lock":"745ff40f42e9a1275945a9db2763deeac749909e81d8d91859948fab49f5c268","Cargo.toml":"4072e465bb2d1110644171c28d1a48a8cf5e9bb85c75d39409bb719348a131f6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"27995d58ad5c1145c1a8cd86244ce844886958a35eb2b78c6b772748669999ac","README.md":"0ff4942223d94c9686f846bb0b1de12221f06e7f39c1818ecbaaec402e89e770","examples/integers.rs":"589ff4271566dfa322becddf3e2c7b592e6e0bc97b02892ce75619b7e452e930","examples/paths.rs":"1b30e466b824ce8df7ad0a55334424131d9d2573d6cf9f7d5d50c09c8901d526","examples/traits.rs":"cbee6a3e1f7db60b02ae25b714926517144a77cb492021f492774cf0e1865a9e","examples/versions.rs":"38535e6d9f5bfae0de474a3db79a40e8f5da8ba9334c5ff4c363de9bc99d4d12","src/error.rs":"12de7dafea4a35d1dc2f0fa79bfa038386bbbea72bf083979f4ddf227999eeda","src/lib.rs":"374704e933dc6263a334652144e4436a7e409f88069c2f4f8e8c4ef14f7aa76b","src/tests.rs":"0b1353344e832553d328c47f1639ced877b5dff70fd2024d84130bd1c33eee07","src/version.rs":"175727d5f02f2fe2271ddc9b041db2a5b9c6fe0f95afd17c73a4d982612764a3","tests/rustflags.rs":"a3788396e0b81a33406d06fef3bc31c5a328f323de6766570a345ebad885cbf9"},"package":"1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"} \ No newline at end of file diff --git a/third_party/cargo/vendor/autocfg-0.1.7/Cargo.lock b/third_party/cargo/vendor/autocfg-0.1.7/Cargo.lock new file mode 100644 index 0000000..670c6c2 --- /dev/null +++ b/third_party/cargo/vendor/autocfg-0.1.7/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "autocfg" +version = "0.1.7" + diff --git a/third_party/cargo/vendor/autocfg-1.0.0/.cargo-checksum.json b/third_party/cargo/vendor/autocfg-1.0.0/.cargo-checksum.json index 89b89d6..eb0d565 100644 --- a/third_party/cargo/vendor/autocfg-1.0.0/.cargo-checksum.json +++ b/third_party/cargo/vendor/autocfg-1.0.0/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"9a97fd6cdf41c7b507d2d8954f99dbbae3450e9e67934c87e5cabe8fa795f6c5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"27995d58ad5c1145c1a8cd86244ce844886958a35eb2b78c6b772748669999ac","README.md":"f173253f205c245806e5dd16ad1906e1a1b3f89694890236298b2126e937324a","examples/integers.rs":"589ff4271566dfa322becddf3e2c7b592e6e0bc97b02892ce75619b7e452e930","examples/paths.rs":"1b30e466b824ce8df7ad0a55334424131d9d2573d6cf9f7d5d50c09c8901d526","examples/traits.rs":"cbee6a3e1f7db60b02ae25b714926517144a77cb492021f492774cf0e1865a9e","examples/versions.rs":"38535e6d9f5bfae0de474a3db79a40e8f5da8ba9334c5ff4c363de9bc99d4d12","src/error.rs":"12de7dafea4a35d1dc2f0fa79bfa038386bbbea72bf083979f4ddf227999eeda","src/lib.rs":"4e80b48869f038be4e80e3356e4cce7e81713717ceeca095f9bb04cda2e4d224","src/tests.rs":"8197b5a6e91872d6c63731ed4b7b619068b6d13501d9aecb3652f20857edc9aa","src/version.rs":"175727d5f02f2fe2271ddc9b041db2a5b9c6fe0f95afd17c73a4d982612764a3","tests/rustflags.rs":"441fb0c6606e243c31d3817a5ae2240b65fcae0ea8ab583f80f8f6d6c267e614"},"package":"f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"} \ No newline at end of file +{"files":{"Cargo.lock":"8dc9b28e55bc55e1846909cfbb169aef0ff15bef2cfa6e27eef5adb7634eed1a","Cargo.toml":"9a97fd6cdf41c7b507d2d8954f99dbbae3450e9e67934c87e5cabe8fa795f6c5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"27995d58ad5c1145c1a8cd86244ce844886958a35eb2b78c6b772748669999ac","README.md":"f173253f205c245806e5dd16ad1906e1a1b3f89694890236298b2126e937324a","examples/integers.rs":"589ff4271566dfa322becddf3e2c7b592e6e0bc97b02892ce75619b7e452e930","examples/paths.rs":"1b30e466b824ce8df7ad0a55334424131d9d2573d6cf9f7d5d50c09c8901d526","examples/traits.rs":"cbee6a3e1f7db60b02ae25b714926517144a77cb492021f492774cf0e1865a9e","examples/versions.rs":"38535e6d9f5bfae0de474a3db79a40e8f5da8ba9334c5ff4c363de9bc99d4d12","src/error.rs":"12de7dafea4a35d1dc2f0fa79bfa038386bbbea72bf083979f4ddf227999eeda","src/lib.rs":"4e80b48869f038be4e80e3356e4cce7e81713717ceeca095f9bb04cda2e4d224","src/tests.rs":"8197b5a6e91872d6c63731ed4b7b619068b6d13501d9aecb3652f20857edc9aa","src/version.rs":"175727d5f02f2fe2271ddc9b041db2a5b9c6fe0f95afd17c73a4d982612764a3","tests/rustflags.rs":"441fb0c6606e243c31d3817a5ae2240b65fcae0ea8ab583f80f8f6d6c267e614"},"package":"f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d"} \ No newline at end of file diff --git a/third_party/cargo/vendor/autocfg-1.0.0/Cargo.lock b/third_party/cargo/vendor/autocfg-1.0.0/Cargo.lock new file mode 100644 index 0000000..4f2c78d --- /dev/null +++ b/third_party/cargo/vendor/autocfg-1.0.0/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "autocfg" +version = "1.0.0" + diff --git a/third_party/cargo/vendor/calloop-0.4.4/BUILD b/third_party/cargo/vendor/calloop-0.4.4/BUILD index 64891ca..a12d2a7 100644 --- a/third_party/cargo/vendor/calloop-0.4.4/BUILD +++ b/third_party/cargo/vendor/calloop-0.4.4/BUILD @@ -31,7 +31,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/mio-0.6.21:mio", + "//third_party/cargo/vendor/mio-0.6.22:mio", "//third_party/cargo/vendor/mio-extras-2.0.6:mio_extras", "//third_party/cargo/vendor/nix-0.14.1:nix", ], diff --git a/third_party/cargo/vendor/cc-1.0.50/.cargo-checksum.json b/third_party/cargo/vendor/cc-1.0.50/.cargo-checksum.json deleted file mode 100644 index dc902d5..0000000 --- a/third_party/cargo/vendor/cc-1.0.50/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"a5de831059d43ce5a823420eae1a8b4d4ab167408c5f4d0db53ba526fa7a9303","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7184fbdf375a057e673257348f6d7584c0dd11b66318d98f3647f69eb610b097","src/bin/gcc-shim.rs":"b77907875029494b6288841c3aed2e4939ed40708c7f597fca5c9e2570490ca6","src/com.rs":"bcdaf1c28b71e6ef889c6b08d1ce9d7c0761344a677f523bc4c3cd297957f804","src/lib.rs":"081f51f4ab13b32654ae6d674fed4b423c170c5db8cfdab319e9a80db724e0c3","src/registry.rs":"3cc1b5a50879fa751572878ae1d0afbfc960c11665258492754b2c8bccb0ff5d","src/setup_config.rs":"7014103587d3382eac599cb76f016e2609b8140970861b2237982d1db24af265","src/winapi.rs":"ea8b7edbb9ff87957254f465c2334e714c5d6b3b19a8d757c48ea7ca0881c50c","src/windows_registry.rs":"388e79dcf3e84078ae0b086c6cdee9cf9eb7e3ffafdcbf3e2df26163661f5856","tests/cc_env.rs":"e02b3b0824ad039b47e4462c5ef6dbe6c824c28e7953af94a0f28f7b5158042e","tests/cflags.rs":"57f06eb5ce1557e5b4a032d0c4673e18fbe6f8d26c1deb153126e368b96b41b3","tests/cxxflags.rs":"c2c6c6d8a0d7146616fa1caed26876ee7bc9fcfffd525eb4743593cade5f3371","tests/support/mod.rs":"0a83e858abc4793d9f243fdc211b653a4dc7b909ac00b577acda6a677d23ed47","tests/test.rs":"1605640c9b94a77f48fc92e1dc0485bdf1960da5626e2e00279e4703691656bc"},"package":"95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"} \ No newline at end of file diff --git a/third_party/cargo/vendor/cc-1.0.54/.cargo-checksum.json b/third_party/cargo/vendor/cc-1.0.54/.cargo-checksum.json new file mode 100644 index 0000000..6081516 --- /dev/null +++ b/third_party/cargo/vendor/cc-1.0.54/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.lock":"6ceb0c97cec493a896bf37a9f6f04ea14764277ecc219ac9977199bcdded3805","Cargo.toml":"ee16287327f8bf448537e3058c2bbd17df281f52404928b9b7f50f2191dc09cd","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"7184fbdf375a057e673257348f6d7584c0dd11b66318d98f3647f69eb610b097","src/bin/gcc-shim.rs":"b77907875029494b6288841c3aed2e4939ed40708c7f597fca5c9e2570490ca6","src/com.rs":"bcdaf1c28b71e6ef889c6b08d1ce9d7c0761344a677f523bc4c3cd297957f804","src/lib.rs":"516506ab998fc0dbc82b0ebd39446f80d92f76e7937a0d7adfe1b91e12ba54b2","src/registry.rs":"3cc1b5a50879fa751572878ae1d0afbfc960c11665258492754b2c8bccb0ff5d","src/setup_config.rs":"7014103587d3382eac599cb76f016e2609b8140970861b2237982d1db24af265","src/winapi.rs":"ea8b7edbb9ff87957254f465c2334e714c5d6b3b19a8d757c48ea7ca0881c50c","src/windows_registry.rs":"2b69dd43b5d414fca7a8e50a046cb2cf4c7fe80b9eb6a2e67538a859c597a805","tests/cc_env.rs":"e02b3b0824ad039b47e4462c5ef6dbe6c824c28e7953af94a0f28f7b5158042e","tests/cflags.rs":"57f06eb5ce1557e5b4a032d0c4673e18fbe6f8d26c1deb153126e368b96b41b3","tests/cxxflags.rs":"c2c6c6d8a0d7146616fa1caed26876ee7bc9fcfffd525eb4743593cade5f3371","tests/support/mod.rs":"16274867f23871e9b07614eda4c7344da13d1751fed63d4f633857e40be86394","tests/test.rs":"65c073e0e2cf4aa0433066102788e9f57442719e6f32f5ad5248aa7132bb4597"},"package":"7bbb73db36c1246e9034e307d0fba23f9a2e251faa47ade70c1bd252220c8311"} \ No newline at end of file diff --git a/third_party/cargo/vendor/cc-1.0.50/BUILD b/third_party/cargo/vendor/cc-1.0.54/BUILD similarity index 96% rename from third_party/cargo/vendor/cc-1.0.50/BUILD rename to third_party/cargo/vendor/cc-1.0.54/BUILD index e95b18d..4c3fd54 100644 --- a/third_party/cargo/vendor/cc-1.0.50/BUILD +++ b/third_party/cargo/vendor/cc-1.0.54/BUILD @@ -35,7 +35,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "1.0.50", + version = "1.0.54", crate_features = [ ], ) @@ -57,7 +57,7 @@ rust_binary( rustc_flags = [ "--cap-lints=allow", ], - version = "1.0.50", + version = "1.0.54", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/cc-1.0.54/Cargo.lock b/third_party/cargo/vendor/cc-1.0.54/Cargo.lock new file mode 100644 index 0000000..7fa572a --- /dev/null +++ b/third_party/cargo/vendor/cc-1.0.54/Cargo.lock @@ -0,0 +1,156 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "c2-chacha" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.54" +dependencies = [ + "jobserver 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getrandom" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "jobserver" +version = "0.1.18" +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 = "ppv-lite86" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "remove_dir_all" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.8" +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 c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +"checksum jobserver 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "230ae9adf468173aecd4176c7233bddc84a15871a586c5971ace9a55f881c075" +"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"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/third_party/cargo/vendor/cc-1.0.50/Cargo.toml b/third_party/cargo/vendor/cc-1.0.54/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/cc-1.0.50/Cargo.toml rename to third_party/cargo/vendor/cc-1.0.54/Cargo.toml index 130ddd3..22cd41a 100644 --- a/third_party/cargo/vendor/cc-1.0.50/Cargo.toml +++ b/third_party/cargo/vendor/cc-1.0.54/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "cc" -version = "1.0.50" +version = "1.0.54" authors = ["Alex Crichton "] exclude = ["/.travis.yml", "/appveyor.yml"] description = "A build-time dependency for Cargo build scripts to assist in invoking the native\nC compiler to compile native C code into a static archive to be linked into Rust\ncode.\n" diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/LICENSE-APACHE b/third_party/cargo/vendor/cc-1.0.54/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/arrayvec-0.5.1/LICENSE-APACHE rename to third_party/cargo/vendor/cc-1.0.54/LICENSE-APACHE diff --git a/third_party/cargo/vendor/cc-1.0.50/LICENSE-MIT b/third_party/cargo/vendor/cc-1.0.54/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/LICENSE-MIT rename to third_party/cargo/vendor/cc-1.0.54/LICENSE-MIT diff --git a/third_party/cargo/vendor/cc-1.0.50/README.md b/third_party/cargo/vendor/cc-1.0.54/README.md similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/README.md rename to third_party/cargo/vendor/cc-1.0.54/README.md diff --git a/third_party/cargo/vendor/cc-1.0.50/src/bin/gcc-shim.rs b/third_party/cargo/vendor/cc-1.0.54/src/bin/gcc-shim.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/src/bin/gcc-shim.rs rename to third_party/cargo/vendor/cc-1.0.54/src/bin/gcc-shim.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/src/com.rs b/third_party/cargo/vendor/cc-1.0.54/src/com.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/src/com.rs rename to third_party/cargo/vendor/cc-1.0.54/src/com.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/src/lib.rs b/third_party/cargo/vendor/cc-1.0.54/src/lib.rs similarity index 87% rename from third_party/cargo/vendor/cc-1.0.50/src/lib.rs rename to third_party/cargo/vendor/cc-1.0.54/src/lib.rs index cc1d58c..f46fade 100644 --- a/third_party/cargo/vendor/cc-1.0.50/src/lib.rs +++ b/third_party/cargo/vendor/cc-1.0.54/src/lib.rs @@ -449,11 +449,13 @@ impl Build { let mut cmd = compiler.to_command(); let is_arm = target.contains("aarch64") || target.contains("arm"); + let clang = compiler.family == ToolFamily::Clang; command_add_output_file( &mut cmd, &obj, self.cuda, target.contains("msvc"), + clang, false, is_arm, ); @@ -847,7 +849,7 @@ impl Build { /// Configures whether the compiler will emit position independent code. /// - /// This option defaults to `false` for `windows-gnu` and `riscv` targets and + /// This option defaults to `false` for `windows-gnu` and bare metal targets and /// to `true` for all other targets. pub fn pic(&mut self, pic: bool) -> &mut Build { self.pic = Some(pic); @@ -1144,10 +1146,11 @@ impl Build { let is_asm = obj.src.extension().and_then(|s| s.to_str()) == Some("asm"); let target = self.get_target()?; let msvc = target.contains("msvc"); + let compiler = self.try_get_compiler()?; + let clang = compiler.family == ToolFamily::Clang; let (mut cmd, name) = if msvc && is_asm { self.msvc_macro_assembler()? } else { - let compiler = self.try_get_compiler()?; let mut cmd = compiler.to_command(); for &(ref a, ref b) in self.env.iter() { cmd.env(a, b); @@ -1163,7 +1166,7 @@ impl Build { ) }; let is_arm = target.contains("aarch64") || target.contains("arm"); - command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, is_asm, is_arm); + command_add_output_file(&mut cmd, &obj.dst, self.cuda, msvc, clang, is_asm, is_arm); // armasm and armasm64 don't requrie -c option if !msvc || !is_asm || !is_arm { cmd.arg("-c"); @@ -1367,15 +1370,24 @@ impl Build { cmd.push_opt_unless_duplicate(format!("-O{}", opt_level).into()); } + if cmd.family == ToolFamily::Clang && target.contains("android") { + // For compatibility with code that doesn't use pre-defined `__ANDROID__` macro. + // If compiler used via ndk-build or cmake (officially supported build methods) + // this macros is defined. + // See https://android.googlesource.com/platform/ndk/+/refs/heads/ndk-release-r21/build/cmake/android.toolchain.cmake#456 + // https://android.googlesource.com/platform/ndk/+/refs/heads/ndk-release-r21/build/core/build-binary.mk#141 + cmd.push_opt_unless_duplicate("-DANDROID".into()); + } + if !target.contains("-ios") { cmd.push_cc_arg("-ffunction-sections".into()); cmd.push_cc_arg("-fdata-sections".into()); } - // Disable generation of PIC on bare-metal RISC-V for now: rust-lld doesn't support this yet - if self.pic.unwrap_or( - !target.contains("windows-gnu") - && !(target.contains("riscv") && target.contains("-none-")), - ) { + // Disable generation of PIC on bare-metal for now: rust-lld doesn't support this yet + if self + .pic + .unwrap_or(!target.contains("windows") && !target.contains("-none-")) + { cmd.push_cc_arg("-fPIC".into()); // PLT only applies if code is compiled with PIC support, // and only for ELF targets. @@ -1403,7 +1415,11 @@ impl Build { // Target flags match cmd.family { ToolFamily::Clang => { - cmd.args.push(format!("--target={}", target).into()); + if !(target.contains("android") + && android_clang_compiler_uses_target_arg_internally(&cmd.path)) + { + cmd.args.push(format!("--target={}", target).into()); + } } ToolFamily::Msvc { clang_cl } => { // This is an undocumented flag from MSVC but helps with making @@ -1588,6 +1604,14 @@ impl Build { cmd.args.push("-mfloat-abi=soft".into()); } } + if target.starts_with("armv7a") { + cmd.args.push("-march=armv7-a".into()); + + if target.ends_with("eabihf") { + // lowest common denominator FPU + cmd.args.push("-mfpu=vfpv3-d16".into()); + } + } if target.starts_with("riscv32") || target.starts_with("riscv64") { // get the 32i/32imac/32imc/64gc/64imac/... part let mut parts = target.split('-'); @@ -1603,6 +1627,7 @@ impl Build { } else { cmd.args.push("-mabi=ilp32".into()); } + cmd.args.push("-mcmodel=medany".into()); } } } @@ -1866,7 +1891,7 @@ impl Build { cmd.args.push(sdk_path.trim().into()); cmd.args.push("-fembed-bitcode".into()); /* - * TODO we probably ultimatedly want the -fembed-bitcode-marker flag + * TODO we probably ultimately want the -fembed-bitcode-marker flag * but can't have it now because of an issue in LLVM: * https://github.com/alexcrichton/cc-rs/issues/301 * https://github.com/rust-lang/rust/pull/48896#comment-372192660 @@ -1900,8 +1925,11 @@ impl Build { ("CC", "cl.exe", "gcc", "cc", "clang") }; - // On Solaris, c++/cc unlikely to exist or be correct. - let default = if host.contains("solaris") { + // On historical Solaris systems, "cc" may have been Sun Studio, which + // is not flag-compatible with "gcc". This history casts a long shadow, + // and many modern illumos distributions today ship GCC as "gcc" without + // also making it available as "cc". + let default = if host.contains("solaris") || host.contains("illumos") { gnu } else { traditional @@ -1918,13 +1946,13 @@ impl Build { .iter() .find(|a| a.starts_with(DRIVER_MODE)) .map(|a| &a[DRIVER_MODE.len()..]); - // chop off leading/trailing whitespace to work around + // Chop off leading/trailing whitespace to work around // semi-buggy build scripts which are shared in // makefiles/configure scripts (where spaces are far more // lenient) let mut t = Tool::with_clang_driver(PathBuf::from(tool.trim()), driver_mode); - if let Some(cc) = wrapper { - t.cc_wrapper_path = Some(PathBuf::from(cc)); + if let Some(cc_wrapper) = wrapper { + t.cc_wrapper_path = Some(PathBuf::from(cc_wrapper)); } for arg in args { t.cc_wrapper_args.push(arg.into()); @@ -1959,20 +1987,7 @@ impl Build { format!("{}.exe", gnu) } } else if target.contains("android") { - let target = target - .replace("armv7neon", "arm") - .replace("armv7", "arm") - .replace("thumbv7neon", "arm") - .replace("thumbv7", "arm"); - let gnu_compiler = format!("{}-{}", target, gnu); - let clang_compiler = format!("{}-{}", target, clang); - // Check if gnu compiler is present - // if not, use clang - if Command::new(&gnu_compiler).spawn().is_ok() { - gnu_compiler - } else { - clang_compiler - } + autodetect_android_compiler(&target, &host, gnu, clang) } else if target.contains("cloudabi") { format!("{}-{}", target, traditional) } else if target == "wasm32-wasi" @@ -1983,80 +1998,7 @@ impl Build { } else if target.contains("vxworks") { "wr-c++".to_string() } else if self.get_host()? != target { - // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" - let cc_env = self.getenv("CROSS_COMPILE"); - let cross_compile = cc_env.as_ref().map(|s| s.trim_right_matches('-')); - let prefix = cross_compile.or(match &target[..] { - "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"), - "aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"), - "aarch64-unknown-netbsd" => Some("aarch64--netbsd"), - "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), - "armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), - "armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), - "arm-frc-linux-gnueabi" => Some("arm-frc-linux-gnueabi"), - "arm-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "arm-unknown-linux-musleabi" => Some("arm-linux-musleabi"), - "arm-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "arm-unknown-netbsd-eabi" => Some("arm--netbsdelf-eabi"), - "armv6-unknown-netbsd-eabihf" => Some("armv6--netbsdelf-eabihf"), - "armv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "armv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "armv7neon-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "armv7neon-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "thumbv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "thumbv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "thumbv7neon-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), - "thumbv7neon-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), - "armv7-unknown-netbsd-eabihf" => Some("armv7--netbsdelf-eabihf"), - "i586-unknown-linux-musl" => Some("musl"), - "i686-pc-windows-gnu" => Some("i686-w64-mingw32"), - "i686-uwp-windows-gnu" => Some("i686-w64-mingw32"), - "i686-unknown-linux-musl" => Some("musl"), - "i686-unknown-netbsd" => Some("i486--netbsdelf"), - "mips-unknown-linux-gnu" => Some("mips-linux-gnu"), - "mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"), - "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"), - "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"), - "mipsisa32r6-unknown-linux-gnu" => Some("mipsisa32r6-linux-gnu"), - "mipsisa32r6el-unknown-linux-gnu" => Some("mipsisa32r6el-linux-gnu"), - "mipsisa64r6-unknown-linux-gnuabi64" => Some("mipsisa64r6-linux-gnuabi64"), - "mipsisa64r6el-unknown-linux-gnuabi64" => { - Some("mipsisa64r6el-linux-gnuabi64") - } - "powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"), - "powerpc-unknown-linux-gnuspe" => Some("powerpc-linux-gnuspe"), - "powerpc-unknown-netbsd" => Some("powerpc--netbsd"), - "powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"), - "powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"), - "riscv32i-unknown-none-elf" => Some("riscv32-unknown-elf"), - "riscv32imac-unknown-none-elf" => Some("riscv32-unknown-elf"), - "riscv32imc-unknown-none-elf" => Some("riscv32-unknown-elf"), - "riscv64gc-unknown-none-elf" => Some("riscv64-unknown-elf"), - "riscv64imac-unknown-none-elf" => Some("riscv64-unknown-elf"), - "riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"), - "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"), - "sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"), - "sparc64-unknown-linux-gnu" => Some("sparc64-linux-gnu"), - "sparc64-unknown-netbsd" => Some("sparc64--netbsd"), - "sparcv9-sun-solaris" => Some("sparcv9-sun-solaris"), - "armebv7r-none-eabi" => Some("arm-none-eabi"), - "armebv7r-none-eabihf" => Some("arm-none-eabi"), - "armv7r-none-eabi" => Some("arm-none-eabi"), - "armv7r-none-eabihf" => Some("arm-none-eabi"), - "thumbv6m-none-eabi" => Some("arm-none-eabi"), - "thumbv7em-none-eabi" => Some("arm-none-eabi"), - "thumbv7em-none-eabihf" => Some("arm-none-eabi"), - "thumbv7m-none-eabi" => Some("arm-none-eabi"), - "thumbv8m.base-none-eabi" => Some("arm-none-eabi"), - "thumbv8m.main-none-eabi" => Some("arm-none-eabi"), - "thumbv8m.main-none-eabihf" => Some("arm-none-eabi"), - "x86_64-pc-windows-gnu" => Some("x86_64-w64-mingw32"), - "x86_64-uwp-windows-gnu" => Some("x86_64-w64-mingw32"), - "x86_64-rumprun-netbsd" => Some("x86_64-rumprun-netbsd"), - "x86_64-unknown-linux-musl" => Some("musl"), - "x86_64-unknown-netbsd" => Some("x86_64--netbsd"), - _ => None, - }); + let prefix = self.prefix_for_target(&target); match prefix { Some(prefix) => format!("{}-{}", prefix, gnu), None => default.to_string(), @@ -2064,7 +2006,12 @@ impl Build { } else { default.to_string() }; - Tool::new(PathBuf::from(compiler)) + + let mut t = Tool::new(PathBuf::from(compiler)); + if let Some(cc_wrapper) = Self::rustc_wrapper_fallback() { + t.cc_wrapper_path = Some(PathBuf::from(cc_wrapper)); + } + t } }; @@ -2140,6 +2087,24 @@ impl Build { .collect() } + /// Returns a fallback `cc_compiler_wrapper` by introspecting `RUSTC_WRAPPER` + fn rustc_wrapper_fallback() -> Option { + // No explicit CC wrapper was detected, but check if RUSTC_WRAPPER + // is defined and is a build accelerator that is compatible with + // C/C++ compilers (e.g. sccache) + let valid_wrappers = ["sccache"]; + + let rustc_wrapper = std::env::var_os("RUSTC_WRAPPER")?; + let wrapper_path = Path::new(&rustc_wrapper); + let wrapper_stem = wrapper_path.file_stem()?; + + if valid_wrappers.contains(&wrapper_stem.to_str()?) { + Some(rustc_wrapper.to_str()?.to_owned()) + } else { + None + } + } + /// Returns compiler path, optional modifier name from whitelist, and arguments vec fn env_tool(&self, name: &str) -> Option<(String, Option, Vec)> { let tool = match self.get_var(name) { @@ -2199,7 +2164,7 @@ impl Build { Some(( maybe_wrapper.to_string(), - None, + Self::rustc_wrapper_fallback(), parts.map(|s| s.to_string()).collect(), )) } @@ -2243,6 +2208,7 @@ impl Build { return Ok((self.cmd(&p), p)); } let target = self.get_target()?; + let default_ar = "ar".to_string(); let program = if target.contains("android") { format!("{}-ar", target.replace("armv7", "arm")) } else if target.contains("emscripten") { @@ -2259,12 +2225,105 @@ impl Build { Some(t) => return Ok((t, "lib.exe".to_string())), None => "lib.exe".to_string(), } + } else if self.get_host()? != target { + match self.prefix_for_target(&target) { + Some(p) => { + let target_ar = format!("{}-ar", p); + if Command::new(&target_ar).output().is_ok() { + target_ar + } else { + default_ar + } + } + None => default_ar, + } } else { - "ar".to_string() + default_ar }; Ok((self.cmd(&program), program)) } + fn prefix_for_target(&self, target: &str) -> Option { + // CROSS_COMPILE is of the form: "arm-linux-gnueabi-" + let cc_env = self.getenv("CROSS_COMPILE"); + let cross_compile = cc_env + .as_ref() + .map(|s| s.trim_right_matches('-').to_owned()); + cross_compile.or(match &target[..] { + "aarch64-unknown-linux-gnu" => Some("aarch64-linux-gnu"), + "aarch64-unknown-linux-musl" => Some("aarch64-linux-musl"), + "aarch64-unknown-netbsd" => Some("aarch64--netbsd"), + "arm-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), + "armv4t-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), + "armv5te-unknown-linux-gnueabi" => Some("arm-linux-gnueabi"), + "armv5te-unknown-linux-musleabi" => Some("arm-linux-gnueabi"), + "arm-frc-linux-gnueabi" => Some("arm-frc-linux-gnueabi"), + "arm-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "arm-unknown-linux-musleabi" => Some("arm-linux-musleabi"), + "arm-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "arm-unknown-netbsd-eabi" => Some("arm--netbsdelf-eabi"), + "armv6-unknown-netbsd-eabihf" => Some("armv6--netbsdelf-eabihf"), + "armv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "armv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "armv7neon-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "armv7neon-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "thumbv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "thumbv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "thumbv7neon-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"), + "thumbv7neon-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"), + "armv7-unknown-netbsd-eabihf" => Some("armv7--netbsdelf-eabihf"), + "i586-unknown-linux-musl" => Some("musl"), + "i686-pc-windows-gnu" => Some("i686-w64-mingw32"), + "i686-uwp-windows-gnu" => Some("i686-w64-mingw32"), + "i686-unknown-linux-musl" => Some("musl"), + "i686-unknown-netbsd" => Some("i486--netbsdelf"), + "mips-unknown-linux-gnu" => Some("mips-linux-gnu"), + "mipsel-unknown-linux-gnu" => Some("mipsel-linux-gnu"), + "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"), + "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"), + "mipsisa32r6-unknown-linux-gnu" => Some("mipsisa32r6-linux-gnu"), + "mipsisa32r6el-unknown-linux-gnu" => Some("mipsisa32r6el-linux-gnu"), + "mipsisa64r6-unknown-linux-gnuabi64" => Some("mipsisa64r6-linux-gnuabi64"), + "mipsisa64r6el-unknown-linux-gnuabi64" => Some("mipsisa64r6el-linux-gnuabi64"), + "powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"), + "powerpc-unknown-linux-gnuspe" => Some("powerpc-linux-gnuspe"), + "powerpc-unknown-netbsd" => Some("powerpc--netbsd"), + "powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"), + "powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"), + "riscv32i-unknown-none-elf" => Some("riscv32-unknown-elf"), + "riscv32imac-unknown-none-elf" => Some("riscv32-unknown-elf"), + "riscv32imc-unknown-none-elf" => Some("riscv32-unknown-elf"), + "riscv64gc-unknown-none-elf" => Some("riscv64-unknown-elf"), + "riscv64imac-unknown-none-elf" => Some("riscv64-unknown-elf"), + "riscv64gc-unknown-linux-gnu" => Some("riscv64-linux-gnu"), + "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"), + "sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"), + "sparc64-unknown-linux-gnu" => Some("sparc64-linux-gnu"), + "sparc64-unknown-netbsd" => Some("sparc64--netbsd"), + "sparcv9-sun-solaris" => Some("sparcv9-sun-solaris"), + "armv7a-none-eabi" => Some("arm-none-eabi"), + "armv7a-none-eabihf" => Some("arm-none-eabi"), + "armebv7r-none-eabi" => Some("arm-none-eabi"), + "armebv7r-none-eabihf" => Some("arm-none-eabi"), + "armv7r-none-eabi" => Some("arm-none-eabi"), + "armv7r-none-eabihf" => Some("arm-none-eabi"), + "thumbv6m-none-eabi" => Some("arm-none-eabi"), + "thumbv7em-none-eabi" => Some("arm-none-eabi"), + "thumbv7em-none-eabihf" => Some("arm-none-eabi"), + "thumbv7m-none-eabi" => Some("arm-none-eabi"), + "thumbv8m.base-none-eabi" => Some("arm-none-eabi"), + "thumbv8m.main-none-eabi" => Some("arm-none-eabi"), + "thumbv8m.main-none-eabihf" => Some("arm-none-eabi"), + "x86_64-pc-windows-gnu" => Some("x86_64-w64-mingw32"), + "x86_64-uwp-windows-gnu" => Some("x86_64-w64-mingw32"), + "x86_64-rumprun-netbsd" => Some("x86_64-rumprun-netbsd"), + "x86_64-unknown-linux-musl" => Some("musl"), + "x86_64-unknown-netbsd" => Some("x86_64--netbsd"), + _ => None, + } + .map(|x| x.to_owned())) + } + fn get_target(&self) -> Result { match self.target.clone() { Some(t) => Ok(t), @@ -2352,6 +2411,21 @@ impl Tool { Self::with_features(path, clang_driver, false) } + #[cfg(windows)] + /// Explictly set the `ToolFamily`, skipping name-based detection. + fn with_family(path: PathBuf, family: ToolFamily) -> Self { + Self { + path: path, + cc_wrapper_path: None, + cc_wrapper_args: Vec::new(), + args: Vec::new(), + env: Vec::new(), + family: family, + cuda: false, + removed_args: Vec::new(), + } + } + fn with_features(path: PathBuf, clang_driver: Option<&str>, cuda: bool) -> Self { // Try to detect family of the tool from its name, falling back to Gnu. let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) { @@ -2660,10 +2734,11 @@ fn command_add_output_file( dst: &Path, cuda: bool, msvc: bool, + clang: bool, is_asm: bool, is_arm: bool, ) { - if msvc && !cuda && !(is_asm && is_arm) { + if msvc && !clang && !cuda && !(is_asm && is_arm) { let mut s = OsString::from("-Fo"); s.push(&dst); cmd.arg(s); @@ -2671,3 +2746,75 @@ fn command_add_output_file( cmd.arg("-o").arg(&dst); } } + +// Use by default minimum available API level +// See note about naming here +// https://android.googlesource.com/platform/ndk/+/refs/heads/ndk-release-r21/docs/BuildSystemMaintainers.md#Clang +static NEW_STANDALONE_ANDROID_COMPILERS: [&str; 4] = [ + "aarch64-linux-android21-clang", + "armv7a-linux-androideabi16-clang", + "i686-linux-android16-clang", + "x86_64-linux-android21-clang", +]; + +// New "standalone" C/C++ cross-compiler executables from recent Android NDK +// are just shell scripts that call main clang binary (from Android NDK) with +// proper `--target` argument. +// +// For example, armv7a-linux-androideabi16-clang passes +// `--target=armv7a-linux-androideabi16` to clang. +// So to construct proper command line check if +// `--target` argument would be passed or not to clang +fn android_clang_compiler_uses_target_arg_internally(clang_path: &Path) -> bool { + NEW_STANDALONE_ANDROID_COMPILERS.iter().any(|x| { + let x: &OsStr = x.as_ref(); + x == clang_path.as_os_str() + }) +} + +fn autodetect_android_compiler(target: &str, host: &str, gnu: &str, clang: &str) -> String { + let new_clang_key = match target { + "aarch64-linux-android" => Some("aarch64"), + "armv7-linux-androideabi" => Some("armv7a"), + "i686-linux-android" => Some("i686"), + "x86_64-linux-android" => Some("x86_64"), + _ => None, + }; + + let new_clang = new_clang_key + .map(|key| { + NEW_STANDALONE_ANDROID_COMPILERS + .iter() + .find(|x| x.starts_with(key)) + }) + .unwrap_or(None); + + if let Some(new_clang) = new_clang { + if Command::new(new_clang).output().is_ok() { + return (*new_clang).into(); + } + } + + let target = target + .replace("armv7neon", "arm") + .replace("armv7", "arm") + .replace("thumbv7neon", "arm") + .replace("thumbv7", "arm"); + let gnu_compiler = format!("{}-{}", target, gnu); + let clang_compiler = format!("{}-{}", target, clang); + + // On Windows, the Android clang compiler is provided as a `.cmd` file instead + // of a `.exe` file. `std::process::Command` won't run `.cmd` files unless the + // `.cmd` is explicitly appended to the command name, so we do that here. + let clang_compiler_cmd = format!("{}-{}.cmd", target, clang); + + // Check if gnu compiler is present + // if not, use clang + if Command::new(&gnu_compiler).output().is_ok() { + gnu_compiler + } else if host.contains("windows") && Command::new(&clang_compiler_cmd).output().is_ok() { + clang_compiler_cmd + } else { + clang_compiler + } +} diff --git a/third_party/cargo/vendor/cc-1.0.50/src/registry.rs b/third_party/cargo/vendor/cc-1.0.54/src/registry.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/src/registry.rs rename to third_party/cargo/vendor/cc-1.0.54/src/registry.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/src/setup_config.rs b/third_party/cargo/vendor/cc-1.0.54/src/setup_config.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/src/setup_config.rs rename to third_party/cargo/vendor/cc-1.0.54/src/setup_config.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/src/winapi.rs b/third_party/cargo/vendor/cc-1.0.54/src/winapi.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/src/winapi.rs rename to third_party/cargo/vendor/cc-1.0.54/src/winapi.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/src/windows_registry.rs b/third_party/cargo/vendor/cc-1.0.54/src/windows_registry.rs similarity index 93% rename from third_party/cargo/vendor/cc-1.0.50/src/windows_registry.rs rename to third_party/cargo/vendor/cc-1.0.54/src/windows_registry.rs index 5af3ff7..a5e07d4 100644 --- a/third_party/cargo/vendor/cc-1.0.50/src/windows_registry.rs +++ b/third_party/cargo/vendor/cc-1.0.54/src/windows_registry.rs @@ -14,6 +14,11 @@ use std::process::Command; use crate::Tool; +#[cfg(windows)] +use crate::ToolFamily; + +#[cfg(windows)] +const MSVC_FAMILY: ToolFamily = ToolFamily::Msvc { clang_cl: false }; /// Attempts to find a tool within an MSVC installation using the Windows /// registry as a point to search from. @@ -70,7 +75,7 @@ pub fn find_tool(target: &str, tool: &str) -> Option { .map(|p| p.join(tool)) .find(|p| p.exists()) }) - .map(|path| Tool::new(path.into())); + .map(|path| Tool::with_family(path.into(), MSVC_FAMILY)); } // Ok, if we're here, now comes the fun part of the probing. Default shells @@ -80,7 +85,7 @@ pub fn find_tool(target: &str, tool: &str) -> Option { // environment variables like `LIB`, `INCLUDE`, and `PATH` to ensure that // the tool is actually usable. - return impl_::find_msvc_15(tool, target) + return impl_::find_msvc_15plus(tool, target) .or_else(|| impl_::find_msvc_14(tool, target)) .or_else(|| impl_::find_msvc_12(tool, target)) .or_else(|| impl_::find_msvc_11(tool, target)); @@ -173,7 +178,9 @@ mod impl_ { use std::iter; use std::mem; use std::path::{Path, PathBuf}; + use std::str::FromStr; + use super::MSVC_FAMILY; use crate::Tool; struct MsvcTool { @@ -200,7 +207,7 @@ mod impl_ { path, include, } = self; - let mut tool = Tool::new(tool.into()); + let mut tool = Tool::with_family(tool.into(), MSVC_FAMILY); add_env(&mut tool, "LIB", libs); add_env(&mut tool, "PATH", path); add_env(&mut tool, "INCLUDE", include); @@ -210,7 +217,7 @@ mod impl_ { #[allow(bare_trait_objects)] fn vs16_instances() -> Box> { - let instances = if let Some(instances) = vs15_instances() { + let instances = if let Some(instances) = vs15plus_instances() { instances } else { return Box::new(iter::empty()); @@ -220,6 +227,11 @@ mod impl_ { let installation_name = instance.installation_name().ok()?; if installation_name.to_str()?.starts_with("VisualStudio/16.") { Some(PathBuf::from(instance.installation_path().ok()?)) + } else if installation_name + .to_str()? + .starts_with("VisualStudioPreview/16.") + { + Some(PathBuf::from(instance.installation_path().ok()?)) } else { None } @@ -233,7 +245,7 @@ mod impl_ { if !path.is_file() { return None; } - let mut tool = Tool::new(path); + let mut tool = Tool::with_family(path, MSVC_FAMILY); if target.contains("x86_64") { tool.env.push(("Platform".into(), "X64".into())); } @@ -253,24 +265,34 @@ mod impl_ { // Note that much of this logic can be found [online] wrt paths, COM, etc. // // [online]: https://blogs.msdn.microsoft.com/vcblog/2017/03/06/finding-the-visual-c-compiler-tools-in-visual-studio-2017/ - fn vs15_instances() -> Option { + // + // Returns MSVC 15+ instances (15, 16 right now), the order should be consider undefined. + fn vs15plus_instances() -> Option { com::initialize().ok()?; let config = SetupConfiguration::new().ok()?; config.enum_all_instances().ok() } - pub fn find_msvc_15(tool: &str, target: &str) -> Option { - let iter = vs15_instances()?; - for instance in iter { - let instance = instance.ok()?; - let tool = tool_from_vs15_instance(tool, target, &instance); - if tool.is_some() { - return tool; - } - } + // Inspired from official microsoft/vswhere ParseVersionString + // i.e. at most four u16 numbers separated by '.' + fn parse_version(version: &str) -> Option> { + version + .split('.') + .map(|chunk| u16::from_str(chunk).ok()) + .collect() + } - None + pub fn find_msvc_15plus(tool: &str, target: &str) -> Option { + let iter = vs15plus_instances()?; + iter.filter_map(|instance| { + let instance = instance.ok()?; + let version = parse_version(instance.installation_version().ok()?.to_str()?)?; + let tool = tool_from_vs15plus_instance(tool, target, &instance)?; + Some((version, tool)) + }) + .max_by(|(a_version, _), (b_version, _)| a_version.cmp(b_version)) + .map(|(_version, tool)| tool) } // While the paths to Visual Studio 2017's devenv and MSBuild could @@ -281,7 +303,7 @@ mod impl_ { // // [more reliable]: https://github.com/alexcrichton/cc-rs/pull/331 fn find_tool_in_vs15_path(tool: &str, target: &str) -> Option { - let mut path = match vs15_instances() { + let mut path = match vs15plus_instances() { Some(instances) => instances .filter_map(|instance| { instance @@ -304,7 +326,7 @@ mod impl_ { } path.map(|path| { - let mut tool = Tool::new(path); + let mut tool = Tool::with_family(path, MSVC_FAMILY); if target.contains("x86_64") { tool.env.push(("Platform".into(), "X64".into())); } @@ -312,8 +334,13 @@ mod impl_ { }) } - fn tool_from_vs15_instance(tool: &str, target: &str, instance: &SetupInstance) -> Option { - let (bin_path, host_dylib_path, lib_path, include_path) = vs15_vc_paths(target, instance)?; + fn tool_from_vs15plus_instance( + tool: &str, + target: &str, + instance: &SetupInstance, + ) -> Option { + let (bin_path, host_dylib_path, lib_path, include_path) = + vs15plus_vc_paths(target, instance)?; let tool_path = bin_path.join(tool); if !tool_path.exists() { return None; @@ -334,7 +361,7 @@ mod impl_ { Some(tool.into_tool()) } - fn vs15_vc_paths( + fn vs15plus_vc_paths( target: &str, instance: &SetupInstance, ) -> Option<(PathBuf, PathBuf, PathBuf, PathBuf)> { @@ -744,7 +771,7 @@ mod impl_ { .map(|path| { let mut path = PathBuf::from(path); path.push("MSBuild.exe"); - let mut tool = Tool::new(path); + let mut tool = Tool::with_family(path, MSVC_FAMILY); if target.contains("x86_64") { tool.env.push(("Platform".into(), "X64".into())); } diff --git a/third_party/cargo/vendor/cc-1.0.50/tests/cc_env.rs b/third_party/cargo/vendor/cc-1.0.54/tests/cc_env.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/tests/cc_env.rs rename to third_party/cargo/vendor/cc-1.0.54/tests/cc_env.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/tests/cflags.rs b/third_party/cargo/vendor/cc-1.0.54/tests/cflags.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/tests/cflags.rs rename to third_party/cargo/vendor/cc-1.0.54/tests/cflags.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/tests/cxxflags.rs b/third_party/cargo/vendor/cc-1.0.54/tests/cxxflags.rs similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/tests/cxxflags.rs rename to third_party/cargo/vendor/cc-1.0.54/tests/cxxflags.rs diff --git a/third_party/cargo/vendor/cc-1.0.50/tests/support/mod.rs b/third_party/cargo/vendor/cc-1.0.54/tests/support/mod.rs similarity index 85% rename from third_party/cargo/vendor/cc-1.0.50/tests/support/mod.rs rename to third_party/cargo/vendor/cc-1.0.54/tests/support/mod.rs index fe8acde..cde930e 100644 --- a/third_party/cargo/vendor/cc-1.0.50/tests/support/mod.rs +++ b/third_party/cargo/vendor/cc-1.0.54/tests/support/mod.rs @@ -22,6 +22,18 @@ pub struct Execution { impl Test { pub fn new() -> Test { + // This is ugly: `sccache` needs to introspect the compiler it is + // executing, as it adjusts its behavior depending on the + // language/compiler. This crate's test driver uses mock compilers that + // are obviously not supported by sccache, so the tests fail if + // RUSTC_WRAPPER is set. rust doesn't build test dependencies with + // the `test` feature enabled, so we can't conditionally disable the + // usage of `sccache` if running in a test environment, at least not + // without setting an environment variable here and testing for it + // there. Explicitly deasserting RUSTC_WRAPPER here seems to be the + // lesser of the two evils. + env::remove_var("RUSTC_WRAPPER"); + let mut gcc = PathBuf::from(env::current_exe().unwrap()); gcc.pop(); if gcc.ends_with("deps") { diff --git a/third_party/cargo/vendor/cc-1.0.50/tests/test.rs b/third_party/cargo/vendor/cc-1.0.54/tests/test.rs similarity index 93% rename from third_party/cargo/vendor/cc-1.0.50/tests/test.rs rename to third_party/cargo/vendor/cc-1.0.54/tests/test.rs index def11f0..3c9b4dc 100644 --- a/third_party/cargo/vendor/cc-1.0.50/tests/test.rs +++ b/third_party/cargo/vendor/cc-1.0.54/tests/test.rs @@ -2,8 +2,18 @@ use crate::support::Test; mod support; +// Some tests check that a flag is *not* present. These tests might fail if the flag is set in the +// CFLAGS or CXXFLAGS environment variables. This function clears the CFLAGS and CXXFLAGS +// variables to make sure that the tests can run correctly. +fn reset_env() { + std::env::set_var("CFLAGS", ""); + std::env::set_var("CXXFLAGS", ""); +} + #[test] fn gnu_smoke() { + reset_env(); + let test = Test::gnu(); test.gcc().file("foo.c").compile("foo"); @@ -19,6 +29,8 @@ fn gnu_smoke() { #[test] fn gnu_opt_level_1() { + reset_env(); + let test = Test::gnu(); test.gcc().opt_level(1).file("foo.c").compile("foo"); @@ -27,6 +39,8 @@ fn gnu_opt_level_1() { #[test] fn gnu_opt_level_s() { + reset_env(); + let test = Test::gnu(); test.gcc().opt_level_str("s").file("foo.c").compile("foo"); @@ -56,6 +70,8 @@ fn gnu_debug_fp() { #[test] fn gnu_debug_nofp() { + reset_env(); + let test = Test::gnu(); test.gcc() .debug(true) @@ -100,6 +116,8 @@ fn gnu_warnings() { #[test] fn gnu_extra_warnings0() { + reset_env(); + let test = Test::gnu(); test.gcc() .warnings(true) @@ -113,6 +131,8 @@ fn gnu_extra_warnings0() { #[test] fn gnu_extra_warnings1() { + reset_env(); + let test = Test::gnu(); test.gcc() .warnings(false) @@ -126,6 +146,8 @@ fn gnu_extra_warnings1() { #[test] fn gnu_warnings_overridable() { + reset_env(); + let test = Test::gnu(); test.gcc() .warnings(true) @@ -154,6 +176,8 @@ fn gnu_x86_64() { #[test] fn gnu_x86_64_no_pic() { + reset_env(); + for vendor in &["unknown-linux-gnu", "apple-darwin"] { let target = format!("x86_64-{}", vendor); let test = Test::gnu(); @@ -215,6 +239,8 @@ fn gnu_x86_64_no_plt() { #[test] fn gnu_set_stdlib() { + reset_env(); + let test = Test::gnu(); test.gcc() .cpp_set_stdlib(Some("foo")) @@ -253,6 +279,8 @@ fn gnu_compile_assembly() { #[test] fn gnu_shared() { + reset_env(); + let test = Test::gnu(); test.gcc() .file("foo.c") @@ -265,6 +293,8 @@ fn gnu_shared() { #[test] fn gnu_flag_if_supported() { + reset_env(); + if cfg!(windows) { return; } @@ -301,6 +331,8 @@ fn gnu_flag_if_supported_cpp() { #[test] fn gnu_static() { + reset_env(); + let test = Test::gnu(); test.gcc() .file("foo.c") @@ -313,6 +345,8 @@ fn gnu_static() { #[test] fn msvc_smoke() { + reset_env(); + let test = Test::msvc(); test.gcc().file("foo.c").compile("foo"); @@ -327,6 +361,8 @@ fn msvc_smoke() { #[test] fn msvc_opt_level_0() { + reset_env(); + let test = Test::msvc(); test.gcc().opt_level(0).file("foo.c").compile("foo"); diff --git a/third_party/cargo/vendor/cmake-0.1.42/.cargo-checksum.json b/third_party/cargo/vendor/cmake-0.1.42/.cargo-checksum.json deleted file mode 100644 index 3104bc4..0000000 --- a/third_party/cargo/vendor/cmake-0.1.42/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"1041ef5daf0481026b809a7f0b90de1b449d103593aa219e7c71ced776542d77","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"a4ad0b734acb4d50db72782207587552c5e33c52500318c202776cd32dbdea4a","src/lib.rs":"166e1c3f86d5b5017b88fcc9c2fa3a9b7bd59feab5c2c54b643931f6055bb608"},"package":"81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62"} \ No newline at end of file diff --git a/third_party/cargo/vendor/cmake-0.1.44/.cargo-checksum.json b/third_party/cargo/vendor/cmake-0.1.44/.cargo-checksum.json new file mode 100644 index 0000000..e0e1595 --- /dev/null +++ b/third_party/cargo/vendor/cmake-0.1.44/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"0ce2c3999bc31b6e8fc5356e19c32f950e6176638aa2834c5b0d00c6c58397a0","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"a4ad0b734acb4d50db72782207587552c5e33c52500318c202776cd32dbdea4a","src/lib.rs":"45127eb441cee715f4337cfac78c9ce8ec8feb167d2814ff11a6708a9533bde7"},"package":"0e56268c17a6248366d66d4a47a3381369d068cce8409bb1716ed77ea32163bb"} \ No newline at end of file diff --git a/third_party/cargo/vendor/cmake-0.1.42/BUILD b/third_party/cargo/vendor/cmake-0.1.44/BUILD similarity index 90% rename from third_party/cargo/vendor/cmake-0.1.42/BUILD rename to third_party/cargo/vendor/cmake-0.1.44/BUILD index f6073d0..0ff9b29 100644 --- a/third_party/cargo/vendor/cmake-0.1.42/BUILD +++ b/third_party/cargo/vendor/cmake-0.1.44/BUILD @@ -31,12 +31,12 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/cc-1.0.50:cc", + "//third_party/cargo/vendor/cc-1.0.54:cc", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.42", + version = "0.1.44", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/cmake-0.1.42/Cargo.toml b/third_party/cargo/vendor/cmake-0.1.44/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/cmake-0.1.42/Cargo.toml rename to third_party/cargo/vendor/cmake-0.1.44/Cargo.toml index 833b43c..cc5c482 100644 --- a/third_party/cargo/vendor/cmake-0.1.42/Cargo.toml +++ b/third_party/cargo/vendor/cmake-0.1.44/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "cmake" -version = "0.1.42" +version = "0.1.44" authors = ["Alex Crichton "] description = "A build dependency for running `cmake` to build a native library\n" homepage = "https://github.com/alexcrichton/cmake-rs" diff --git a/third_party/cargo/vendor/cc-1.0.50/LICENSE-APACHE b/third_party/cargo/vendor/cmake-0.1.44/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/cc-1.0.50/LICENSE-APACHE rename to third_party/cargo/vendor/cmake-0.1.44/LICENSE-APACHE diff --git a/third_party/cargo/vendor/cmake-0.1.42/LICENSE-MIT b/third_party/cargo/vendor/cmake-0.1.44/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/cmake-0.1.42/LICENSE-MIT rename to third_party/cargo/vendor/cmake-0.1.44/LICENSE-MIT diff --git a/third_party/cargo/vendor/cmake-0.1.42/README.md b/third_party/cargo/vendor/cmake-0.1.44/README.md similarity index 100% rename from third_party/cargo/vendor/cmake-0.1.42/README.md rename to third_party/cargo/vendor/cmake-0.1.44/README.md diff --git a/third_party/cargo/vendor/cmake-0.1.42/src/lib.rs b/third_party/cargo/vendor/cmake-0.1.44/src/lib.rs similarity index 97% rename from third_party/cargo/vendor/cmake-0.1.42/src/lib.rs rename to third_party/cargo/vendor/cmake-0.1.44/src/lib.rs index 3e96118..ae8770f 100644 --- a/third_party/cargo/vendor/cmake-0.1.42/src/lib.rs +++ b/third_party/cargo/vendor/cmake-0.1.44/src/lib.rs @@ -60,6 +60,7 @@ pub struct Config { generator: Option, cflags: OsString, cxxflags: OsString, + asmflags: OsString, defines: Vec<(OsString, OsString)>, deps: Vec, target: Option, @@ -75,6 +76,7 @@ pub struct Config { no_build_target: bool, verbose_cmake: bool, verbose_make: bool, + pic: Option, } /// Builds the native library rooted at `path` with the default cmake options. @@ -106,6 +108,7 @@ impl Config { generator: None, cflags: OsString::new(), cxxflags: OsString::new(), + asmflags: OsString::new(), defines: Vec::new(), deps: Vec::new(), profile: None, @@ -121,9 +124,16 @@ impl Config { no_build_target: false, verbose_cmake: false, verbose_make: false, + pic: None, } } + /// Sets flag for PIC. Otherwise use cc::Build platform default + pub fn pic(&mut self, explicit_flag: bool) -> &mut Config { + self.pic = Some(explicit_flag); + self + } + /// Sets the build-tool generator (`-G`) for this compilation. pub fn generator>(&mut self, generator: T) -> &mut Config { self.generator = Some(generator.as_ref().to_owned()); @@ -146,6 +156,14 @@ impl Config { self } + /// Adds a custom flag to pass down to the ASM compiler, supplementing those + /// that this library already passes. + pub fn asmflag>(&mut self, flag: P) -> &mut Config { + self.asmflags.push(" "); + self.asmflags.push(flag.as_ref()); + self + } + /// Adds a new `-D` flag to pass to cmake during the generation step. pub fn define(&mut self, k: K, v: V) -> &mut Config where @@ -335,8 +353,13 @@ impl Config { c_cfg.static_crt(static_crt); cxx_cfg.static_crt(static_crt); } + if let Some(explicit_flag) = self.pic { + c_cfg.pic(explicit_flag); + cxx_cfg.pic(explicit_flag); + } let c_compiler = c_cfg.get_compiler(); let cxx_compiler = cxx_cfg.get_compiler(); + let asm_compiler = c_cfg.get_compiler(); let dst = self .out_dir @@ -650,6 +673,7 @@ impl Config { set_compiler("C", &c_compiler, &self.cflags); set_compiler("CXX", &cxx_compiler, &self.cxxflags); + set_compiler("ASM", &asm_compiler, &self.asmflags); } if !self.defined("CMAKE_BUILD_TYPE") { diff --git a/third_party/cargo/vendor/cocoa-0.19.1/BUILD b/third_party/cargo/vendor/cocoa-0.19.1/BUILD index 1643499..48095ae 100644 --- a/third_party/cargo/vendor/cocoa-0.19.1/BUILD +++ b/third_party/cargo/vendor/cocoa-0.19.1/BUILD @@ -36,7 +36,7 @@ rust_library( "//third_party/cargo/vendor/core-foundation-0.6.4:core_foundation", "//third_party/cargo/vendor/core-graphics-0.17.3:core_graphics", "//third_party/cargo/vendor/foreign-types-0.3.2:foreign_types", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/objc-0.2.7:objc", ], rustc_flags = [ diff --git a/third_party/cargo/vendor/cocoa-0.20.0/Cargo.lock b/third_party/cargo/vendor/cocoa-0.20.0/Cargo.lock deleted file mode 100644 index 33c9e21..0000000 --- a/third_party/cargo/vendor/cocoa-0.20.0/Cargo.lock +++ /dev/null @@ -1,95 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cocoa" -version = "0.20.0" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "core-graphics" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.65" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[metadata] -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" -"checksum core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -"checksum core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" -"checksum core-graphics 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd" -"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" -"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -"checksum objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" diff --git a/third_party/cargo/vendor/cocoa-0.20.0/.cargo-checksum.json b/third_party/cargo/vendor/cocoa-0.20.1/.cargo-checksum.json similarity index 63% rename from third_party/cargo/vendor/cocoa-0.20.0/.cargo-checksum.json rename to third_party/cargo/vendor/cocoa-0.20.1/.cargo-checksum.json index 61b70cf..e470ad0 100644 --- a/third_party/cargo/vendor/cocoa-0.20.0/.cargo-checksum.json +++ b/third_party/cargo/vendor/cocoa-0.20.1/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.lock":"0effdfa775e787f93cfabf50aa7039d7a4999e0dd92d57d3d5745a5f5926a962","Cargo.toml":"280ff6f510cff8a892ddbba326304fd8b16ac2eb1ad111948405abe3a6a90d51","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"29542cb34adb016506822ef78bceacf1774dbe8c27818a4d47b7d7b71ed4e1ac","examples/color.rs":"5211a85ab9ec4cbb98f8f677de50bb2f1d300400f50226ebfd714d40b9d32485","examples/fullscreen.rs":"f8719268b6eb1d19078af347e02f9993c9d29633ef2d38dcc4fac26cbd731c2d","examples/hello_world.rs":"7efe2a29de4d4dfc1d8821f469e13b1456f72de478bab55f813d08d4e5aafd5c","examples/tab_view.rs":"e6a3187eeac2f46210994293c2db7756757f4cad07e519902fa994c6d5c1a7d6","src/appkit.rs":"a21c6d612d0ec45dbbb5df45fe96d84b76c5a9982d09bdf74714ce63723da558","src/base.rs":"6c56d1758a9b0a7f8927771fe8b0bb43c6f19e4531bf9accecc786028eaad845","src/foundation.rs":"f0a8c0d2e3aee6bde64f480085025dfa92f903a39d6c15251ba392523aa153a3","src/lib.rs":"ed6164b3e0fe68579218185267d79229a2989c86efce690d7273f779c5239ec3","src/macros.rs":"0de0a8ea9a23f03cad94266a92051c3be8ff3f8f7d7d60f95dafe6c663204d48","src/quartzcore.rs":"cb4f96b4b095e9d623346a42b1e119a5299bf2af73ed81256dd548c688d525e2","tests/foundation.rs":"728eb7dcc9edbfb43dcb6aa1ebcc391658a7d47846d94a71905bcedfce833260"},"package":"0a4736c86d51bd878b474400d9ec888156f4037015f5d09794fab9f26eab1ad4"} \ No newline at end of file +{"files":{"COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.lock":"9909380e3b48716dc2358036627337cea1a7357e0eb3e8e63b6252c074a6077e","Cargo.toml":"028039e35cdeff788575b44c5869857d10e71d7f96f5bbf6f5474acaa3e6aef5","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"29542cb34adb016506822ef78bceacf1774dbe8c27818a4d47b7d7b71ed4e1ac","examples/color.rs":"5211a85ab9ec4cbb98f8f677de50bb2f1d300400f50226ebfd714d40b9d32485","examples/fullscreen.rs":"f8719268b6eb1d19078af347e02f9993c9d29633ef2d38dcc4fac26cbd731c2d","examples/hello_world.rs":"7efe2a29de4d4dfc1d8821f469e13b1456f72de478bab55f813d08d4e5aafd5c","examples/tab_view.rs":"e6a3187eeac2f46210994293c2db7756757f4cad07e519902fa994c6d5c1a7d6","src/appkit.rs":"a2ca0f7c86583be2bc5fed992bb86039bba9eca0586c981ff70091e2298e52cc","src/base.rs":"6c56d1758a9b0a7f8927771fe8b0bb43c6f19e4531bf9accecc786028eaad845","src/foundation.rs":"d3f14a7d1d20840cb00d52cc54df5c68a353b5ea925bd973d6bd27b4911d91b1","src/lib.rs":"ed6164b3e0fe68579218185267d79229a2989c86efce690d7273f779c5239ec3","src/macros.rs":"0de0a8ea9a23f03cad94266a92051c3be8ff3f8f7d7d60f95dafe6c663204d48","src/quartzcore.rs":"cb4f96b4b095e9d623346a42b1e119a5299bf2af73ed81256dd548c688d525e2","tests/foundation.rs":"728eb7dcc9edbfb43dcb6aa1ebcc391658a7d47846d94a71905bcedfce833260"},"package":"8f7b6f3f7f4f0b3ec5c5039aaa9e8c3cef97a7a480a400fd62944841314f293d"} \ No newline at end of file diff --git a/third_party/cargo/vendor/cocoa-0.20.0/BUILD b/third_party/cargo/vendor/cocoa-0.20.1/BUILD similarity index 93% rename from third_party/cargo/vendor/cocoa-0.20.0/BUILD rename to third_party/cargo/vendor/cocoa-0.20.1/BUILD index b1ba891..6a291ea 100644 --- a/third_party/cargo/vendor/cocoa-0.20.0/BUILD +++ b/third_party/cargo/vendor/cocoa-0.20.1/BUILD @@ -27,7 +27,7 @@ load( rust_library( name = "cocoa", crate_root = "src/lib.rs", - crate_type = "rlib", + crate_type = "lib", edition = "2015", srcs = glob(["**/*.rs"]), deps = [ @@ -36,13 +36,13 @@ rust_library( "//third_party/cargo/vendor/core-foundation-0.7.0:core_foundation", "//third_party/cargo/vendor/core-graphics-0.19.0:core_graphics", "//third_party/cargo/vendor/foreign-types-0.3.2:foreign_types", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/objc-0.2.7:objc", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.20.0", + version = "0.20.1", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/cocoa-0.20.0/COPYRIGHT b/third_party/cargo/vendor/cocoa-0.20.1/COPYRIGHT similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/COPYRIGHT rename to third_party/cargo/vendor/cocoa-0.20.1/COPYRIGHT diff --git a/third_party/cargo/vendor/cocoa-0.20.1/Cargo.lock b/third_party/cargo/vendor/cocoa-0.20.1/Cargo.lock new file mode 100644 index 0000000..157c6d0 --- /dev/null +++ b/third_party/cargo/vendor/cocoa-0.20.1/Cargo.lock @@ -0,0 +1,93 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "cocoa" +version = "0.20.1" +dependencies = [ + "bitflags", + "block", + "core-foundation", + "core-graphics", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + +[[package]] +name = "core-graphics" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59e78b2e0aaf43f08e7ae0d6bc96895ef72ff0921c7d4ff4762201b2dba376dd" +dependencies = [ + "bitflags", + "core-foundation", + "foreign-types", + "libc", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "libc" +version = "0.2.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] diff --git a/third_party/cargo/vendor/cocoa-0.20.0/Cargo.toml b/third_party/cargo/vendor/cocoa-0.20.1/Cargo.toml similarity index 94% rename from third_party/cargo/vendor/cocoa-0.20.0/Cargo.toml rename to third_party/cargo/vendor/cocoa-0.20.1/Cargo.toml index 994c2ca..e612514 100644 --- a/third_party/cargo/vendor/cocoa-0.20.0/Cargo.toml +++ b/third_party/cargo/vendor/cocoa-0.20.1/Cargo.toml @@ -12,16 +12,12 @@ [package] name = "cocoa" -version = "0.20.0" +version = "0.20.1" authors = ["The Servo Project Developers"] description = "Bindings to Cocoa for macOS" homepage = "https://github.com/servo/core-foundation-rs" license = "MIT / Apache-2.0" repository = "https://github.com/servo/core-foundation-rs" - -[lib] -name = "cocoa" -crate-type = ["rlib"] [dependencies.bitflags] version = "1.0" diff --git a/third_party/cargo/vendor/cmake-0.1.42/LICENSE-APACHE b/third_party/cargo/vendor/cocoa-0.20.1/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/cmake-0.1.42/LICENSE-APACHE rename to third_party/cargo/vendor/cocoa-0.20.1/LICENSE-APACHE diff --git a/third_party/cargo/vendor/cocoa-0.20.0/LICENSE-MIT b/third_party/cargo/vendor/cocoa-0.20.1/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/LICENSE-MIT rename to third_party/cargo/vendor/cocoa-0.20.1/LICENSE-MIT diff --git a/third_party/cargo/vendor/cocoa-0.20.0/README.md b/third_party/cargo/vendor/cocoa-0.20.1/README.md similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/README.md rename to third_party/cargo/vendor/cocoa-0.20.1/README.md diff --git a/third_party/cargo/vendor/cocoa-0.20.0/examples/color.rs b/third_party/cargo/vendor/cocoa-0.20.1/examples/color.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/examples/color.rs rename to third_party/cargo/vendor/cocoa-0.20.1/examples/color.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/examples/fullscreen.rs b/third_party/cargo/vendor/cocoa-0.20.1/examples/fullscreen.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/examples/fullscreen.rs rename to third_party/cargo/vendor/cocoa-0.20.1/examples/fullscreen.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/examples/hello_world.rs b/third_party/cargo/vendor/cocoa-0.20.1/examples/hello_world.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/examples/hello_world.rs rename to third_party/cargo/vendor/cocoa-0.20.1/examples/hello_world.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/examples/tab_view.rs b/third_party/cargo/vendor/cocoa-0.20.1/examples/tab_view.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/examples/tab_view.rs rename to third_party/cargo/vendor/cocoa-0.20.1/examples/tab_view.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/src/appkit.rs b/third_party/cargo/vendor/cocoa-0.20.1/src/appkit.rs similarity index 99% rename from third_party/cargo/vendor/cocoa-0.20.0/src/appkit.rs rename to third_party/cargo/vendor/cocoa-0.20.1/src/appkit.rs index 53afce4..b7cfb22 100644 --- a/third_party/cargo/vendor/cocoa-0.20.0/src/appkit.rs +++ b/third_party/cargo/vendor/cocoa-0.20.1/src/appkit.rs @@ -987,6 +987,7 @@ pub trait NSWindow: Sized { unsafe fn setLevel_(self, level: NSInteger); // Managing Key Status + unsafe fn isKeyWindow(self) -> BOOL; unsafe fn canBecomeKeyWindow(self) -> BOOL; unsafe fn makeKeyWindow(self); unsafe fn makeKeyAndOrderFront_(self, sender: id); @@ -1480,6 +1481,10 @@ impl NSWindow for id { // Managing Key Status + unsafe fn isKeyWindow(self) -> BOOL { + msg_send![self, isKeyWindow] + } + unsafe fn canBecomeKeyWindow(self) -> BOOL { msg_send![self, canBecomeKeyWindow] } @@ -1778,6 +1783,8 @@ pub trait NSView: Sized { unsafe fn initWithFrame_(self, frameRect: NSRect) -> id; unsafe fn bounds(self) -> NSRect; unsafe fn frame(self) -> NSRect; + unsafe fn setFrameSize(self, frameSize: NSSize); + unsafe fn setFrameOrigin(self, frameOrigin: NSPoint); unsafe fn display_(self); unsafe fn setWantsBestResolutionOpenGLSurface_(self, flag: BOOL); unsafe fn convertPoint_fromView_(self, point: NSPoint, view: id) -> NSPoint; @@ -1813,6 +1820,14 @@ impl NSView for id { msg_send![self, frame] } + unsafe fn setFrameSize(self, frameSize: NSSize) { + msg_send![self, setFrameSize:frameSize] + } + + unsafe fn setFrameOrigin(self, frameOrigin: NSPoint) { + msg_send![self, setFrameOrigin:frameOrigin] + } + unsafe fn display_(self) { msg_send![self, display] } @@ -2968,7 +2983,7 @@ pub trait NSButton: Sized { msg_send![class!(NSButton), alloc] } unsafe fn initWithFrame_(self, frameRect: NSRect) -> id; - unsafe fn setTarget_(self, target: id /* Instance */); + unsafe fn setTarget_(self, target: id /* Instance */); unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance *) */); } @@ -3645,7 +3660,7 @@ pub trait NSTabView: Sized { unsafe fn allowsTruncatedLabels(self) -> BOOL; unsafe fn setAllowsTruncatedLabels_(self, allowTruncatedLabels:BOOL); unsafe fn setDelegate_(self, delegate:id); - unsafe fn delegate(self) -> id ; + unsafe fn delegate(self) -> id; unsafe fn tabViewAtPoint_(self, point:id) -> id; } diff --git a/third_party/cargo/vendor/cocoa-0.20.0/src/base.rs b/third_party/cargo/vendor/cocoa-0.20.1/src/base.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/src/base.rs rename to third_party/cargo/vendor/cocoa-0.20.1/src/base.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/src/foundation.rs b/third_party/cargo/vendor/cocoa-0.20.1/src/foundation.rs similarity index 96% rename from third_party/cargo/vendor/cocoa-0.20.0/src/foundation.rs rename to third_party/cargo/vendor/cocoa-0.20.1/src/foundation.rs index d87c446..6fe5821 100644 --- a/third_party/cargo/vendor/cocoa-0.20.0/src/foundation.rs +++ b/third_party/cargo/vendor/cocoa-0.20.1/src/foundation.rs @@ -203,18 +203,49 @@ impl NSAutoreleasePool for id { } } + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct NSOperatingSystemVersion { + pub majorVersion: NSUInteger, + pub minorVersion: NSUInteger, + pub patchVersion: NSUInteger, +} + +impl NSOperatingSystemVersion { + #[inline] + pub fn new(majorVersion: NSUInteger, minorVersion: NSUInteger, patchVersion: NSUInteger) -> NSOperatingSystemVersion { + NSOperatingSystemVersion { + majorVersion: majorVersion, + minorVersion: minorVersion, + patchVersion: patchVersion + } + } +} + + pub trait NSProcessInfo: Sized { unsafe fn processInfo(_: Self) -> id { msg_send![class!(NSProcessInfo), processInfo] } unsafe fn processName(self) -> id; + unsafe fn operatingSystemVersion(self) -> NSOperatingSystemVersion; + unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool; } impl NSProcessInfo for id { unsafe fn processName(self) -> id { msg_send![self, processName] } + + unsafe fn operatingSystemVersion(self) -> NSOperatingSystemVersion { + msg_send![self, operatingSystemVersion] + } + + unsafe fn isOperatingSystemAtLeastVersion(self, version: NSOperatingSystemVersion) -> bool { + msg_send![self, isOperatingSystemAtLeastVersion: version] + } } pub type NSTimeInterval = libc::c_double; @@ -1316,3 +1347,30 @@ bitflags! { const NSDataSearchAnchored = 1 << 1; } } + +pub trait NSUserDefaults { + unsafe fn standardUserDefaults() -> Self; + + unsafe fn setBool_forKey_(self, value: BOOL, key: id); + unsafe fn bool_forKey_(self, key: id) -> BOOL; + + unsafe fn removeObject_forKey_(self, key: id); +} + +impl NSUserDefaults for id { + unsafe fn standardUserDefaults() -> id { + msg_send![class!(NSUserDefaults), standardUserDefaults] + } + + unsafe fn setBool_forKey_(self, value: BOOL, key: id) { + msg_send![self, setBool:value forKey:key] + } + + unsafe fn bool_forKey_(self, key: id) -> BOOL { + msg_send![self, boolForKey: key] + } + + unsafe fn removeObject_forKey_(self, key: id) { + msg_send![self, removeObjectForKey:key] + } +} diff --git a/third_party/cargo/vendor/cocoa-0.20.0/src/lib.rs b/third_party/cargo/vendor/cocoa-0.20.1/src/lib.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/src/lib.rs rename to third_party/cargo/vendor/cocoa-0.20.1/src/lib.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/src/macros.rs b/third_party/cargo/vendor/cocoa-0.20.1/src/macros.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/src/macros.rs rename to third_party/cargo/vendor/cocoa-0.20.1/src/macros.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/src/quartzcore.rs b/third_party/cargo/vendor/cocoa-0.20.1/src/quartzcore.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/src/quartzcore.rs rename to third_party/cargo/vendor/cocoa-0.20.1/src/quartzcore.rs diff --git a/third_party/cargo/vendor/cocoa-0.20.0/tests/foundation.rs b/third_party/cargo/vendor/cocoa-0.20.1/tests/foundation.rs similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/tests/foundation.rs rename to third_party/cargo/vendor/cocoa-0.20.1/tests/foundation.rs diff --git a/third_party/cargo/vendor/core-foundation-0.6.4/BUILD b/third_party/cargo/vendor/core-foundation-0.6.4/BUILD index 2ff0721..dacdc4a 100644 --- a/third_party/cargo/vendor/core-foundation-0.6.4/BUILD +++ b/third_party/cargo/vendor/core-foundation-0.6.4/BUILD @@ -32,7 +32,7 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/core-foundation-sys-0.6.2:core_foundation_sys", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/core-foundation-0.7.0/BUILD b/third_party/cargo/vendor/core-foundation-0.7.0/BUILD index 7d54876..286b5e3 100644 --- a/third_party/cargo/vendor/core-foundation-0.7.0/BUILD +++ b/third_party/cargo/vendor/core-foundation-0.7.0/BUILD @@ -32,7 +32,7 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/core-foundation-sys-0.7.0:core_foundation_sys", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/core-graphics-0.17.3/BUILD b/third_party/cargo/vendor/core-graphics-0.17.3/BUILD index b85c6d1..237b210 100644 --- a/third_party/cargo/vendor/core-graphics-0.17.3/BUILD +++ b/third_party/cargo/vendor/core-graphics-0.17.3/BUILD @@ -34,7 +34,7 @@ rust_library( "//third_party/cargo/vendor/bitflags-1.2.1:bitflags", "//third_party/cargo/vendor/core-foundation-0.6.4:core_foundation", "//third_party/cargo/vendor/foreign-types-0.3.2:foreign_types", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/core-graphics-0.19.0/BUILD b/third_party/cargo/vendor/core-graphics-0.19.0/BUILD index 1d99e8b..34b9e6e 100644 --- a/third_party/cargo/vendor/core-graphics-0.19.0/BUILD +++ b/third_party/cargo/vendor/core-graphics-0.19.0/BUILD @@ -34,7 +34,7 @@ rust_library( "//third_party/cargo/vendor/bitflags-1.2.1:bitflags", "//third_party/cargo/vendor/core-foundation-0.7.0:core_foundation", "//third_party/cargo/vendor/foreign-types-0.3.2:foreign_types", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/.cargo-checksum.json b/third_party/cargo/vendor/core-video-sys-0.1.3/.cargo-checksum.json deleted file mode 100644 index f8db7d3..0000000 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"b90dee90d0900e4e1b38b183cf1c7dba49a4cd3be5e86c8da7a25745b2520c45","LICENSE":"439952354cd78da9e99d020667b01c011e89dfa57e8e091fe6e099bd7804d86b","build.rs":"d5ce402947ab6c65bd131c19def4fc1e0007d95630432988787b6dc8e4124ee6","src/base.rs":"8fb57ef931405a2effc82b09087ba54ee0224420252e0e77e5d23ded87c71d41","src/buffer.rs":"c15f89522f11c9a5fbc27cc80b36dc4a614294ede18a3048320ed0d17b08c410","src/display_link.rs":"87863c61a85dec42cb0a72f7ab33d4f37a7be6b2aee072b7982a72feb957291c","src/host_time.rs":"11ac7e6ec65c6499e620c28e167f40a60d7787c988bd42f6f89f5be1bc2203fe","src/image_buffer.rs":"aecc238c57cea8d67db2c9507d30ee425124a4bfc3adbf7770a9abb5d10a25c0","src/lib.rs":"1fac840e83b70489938063ab3e4acfa8eda80dae6c33290c1be7150d3599ec08","src/metal_texture.rs":"1e48454a983253093bb8c8f2a426043456a3ea5c7669d76998bb44ee5df8bbe9","src/metal_texture_cache.rs":"e451ca31cd68d37ff323984306196ae6c6de701e949b8261bd1967849abe90b9","src/open_gl_es_texture.rs":"57e5cddfa0de2fa6a24b166e481c0bf3a7491789f27f7e51b0614474a9dc7c5a","src/open_gl_es_texture_cache.rs":"8d9340cc63a4f0ac6b6ec4d988fdfc14e6ab0ca65f678fd86e004e92d2df712c","src/opengl_buffer.rs":"82145551623ed561c32dc206c7fd5ad57d674b3f5e0ef7753a83e8a57ff8c614","src/opengl_buffer_pool.rs":"3cb6c8c2443a567af7dfdef3b3ddda64a64536d4c46617a49ccbd905f27216db","src/opengl_texture.rs":"8369a59288e3b3a0d79725379034e71bcbfb84c10e08290028067c261e767500","src/opengl_texture_cache.rs":"dab814ba2c9b9b1319d57a2260b8283a973eea23cca941c211ac371c109dfce3","src/pixel_buffer.rs":"dd525165a667b2a28ceee3e488989221f02fdb4f3a8e79ebd72a4d30bf263f15","src/pixel_buffer_io_surface.rs":"c007270f9e6db4bab3ac963135a2ca9d761aa0aa40ab1411177d04e006d3c11d","src/pixel_buffer_pool.rs":"6b36547f222ab36ae01497b541fa6685f6a6b7a6d022923e41c57e524cb6648a","src/pixel_format_description.rs":"a2fbe12c6dfc813a0910ea082f334d9441f6a5fa8accfbcb6621ab61ac863970","src/return_.rs":"1702ae3e29a7439d7caa95b43a30747dbc3535e9479d91097850669d18a8bba8"},"package":"8dc065219542086f72d1e9f7aadbbab0989e980263695d129d502082d063a9d0"} \ No newline at end of file diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/build.rs b/third_party/cargo/vendor/core-video-sys-0.1.3/build.rs deleted file mode 100644 index ace9da3..0000000 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/build.rs +++ /dev/null @@ -1,6 +0,0 @@ - -fn main() { - if std::env::var("TARGET").unwrap().contains("-apple") { - println!("cargo:rustc-link-lib=framework=CoreVideo"); - } -} diff --git a/third_party/cargo/vendor/core-video-sys-0.1.4/.cargo-checksum.json b/third_party/cargo/vendor/core-video-sys-0.1.4/.cargo-checksum.json new file mode 100644 index 0000000..9a22e1b --- /dev/null +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"a494862db035d53a5263e7d2820a59e2d500ede90013ab868a3b0e514a5671c7","LICENSE":"439952354cd78da9e99d020667b01c011e89dfa57e8e091fe6e099bd7804d86b","src/base.rs":"cf9d1976f5d6cd1f92bb029994fc9e2d08f5d47ae7d67c07d7d5316dd06ae307","src/buffer.rs":"93bfc5193334aaa651aacee6f234b2687755b7209fc5cbb7612e2dc1b8b03b0b","src/display_link.rs":"87863c61a85dec42cb0a72f7ab33d4f37a7be6b2aee072b7982a72feb957291c","src/host_time.rs":"37187520def434271e1c69deb255e257b66292d2bc11ee741946334543712e57","src/image_buffer.rs":"aecc238c57cea8d67db2c9507d30ee425124a4bfc3adbf7770a9abb5d10a25c0","src/lib.rs":"c49ca1e3abb8571aa1d1bae8317f362e9fbddcc3f1af479e76d1383600f314c9","src/metal_texture.rs":"1e48454a983253093bb8c8f2a426043456a3ea5c7669d76998bb44ee5df8bbe9","src/metal_texture_cache.rs":"e451ca31cd68d37ff323984306196ae6c6de701e949b8261bd1967849abe90b9","src/open_gl_es_texture.rs":"57e5cddfa0de2fa6a24b166e481c0bf3a7491789f27f7e51b0614474a9dc7c5a","src/open_gl_es_texture_cache.rs":"8d9340cc63a4f0ac6b6ec4d988fdfc14e6ab0ca65f678fd86e004e92d2df712c","src/opengl_buffer.rs":"627383b446c3347d3540e932c7ff2fa396145a42761360806263c3ccad4205b0","src/opengl_buffer_pool.rs":"3cb6c8c2443a567af7dfdef3b3ddda64a64536d4c46617a49ccbd905f27216db","src/opengl_texture.rs":"8369a59288e3b3a0d79725379034e71bcbfb84c10e08290028067c261e767500","src/opengl_texture_cache.rs":"dab814ba2c9b9b1319d57a2260b8283a973eea23cca941c211ac371c109dfce3","src/pixel_buffer.rs":"0e39680c65e576d0df4ce60a86e28873330c248e8464517dda9fd8bf38a053f1","src/pixel_buffer_io_surface.rs":"c007270f9e6db4bab3ac963135a2ca9d761aa0aa40ab1411177d04e006d3c11d","src/pixel_buffer_pool.rs":"6b36547f222ab36ae01497b541fa6685f6a6b7a6d022923e41c57e524cb6648a","src/pixel_format_description.rs":"a2fbe12c6dfc813a0910ea082f334d9441f6a5fa8accfbcb6621ab61ac863970","src/return_.rs":"5bae8d265071d531b546e3cfb53265bac611d408a5be2d2ddc24e8e27c3e9a32"},"package":"34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828"} \ No newline at end of file diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/BUILD b/third_party/cargo/vendor/core-video-sys-0.1.4/BUILD similarity index 77% rename from third_party/cargo/vendor/core-video-sys-0.1.3/BUILD rename to third_party/cargo/vendor/core-video-sys-0.1.4/BUILD index eb65ef7..910cf70 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/BUILD +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/BUILD @@ -23,7 +23,6 @@ load( ) -# Unsupported target "build-script-build" with type "custom-build" omitted rust_library( name = "core_video_sys", @@ -33,15 +32,15 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/cfg-if-0.1.10:cfg_if", - "//third_party/cargo/vendor/core-foundation-sys-0.6.2:core_foundation_sys", - "//third_party/cargo/vendor/core-graphics-0.17.3:core_graphics", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/core-foundation-sys-0.7.0:core_foundation_sys", + "//third_party/cargo/vendor/core-graphics-0.19.0:core_graphics", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/objc-0.2.7:objc", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.3", + version = "0.1.4", crate_features = [ "core-graphics", "display_link", diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/Cargo.toml b/third_party/cargo/vendor/core-video-sys-0.1.4/Cargo.toml similarity index 91% rename from third_party/cargo/vendor/core-video-sys-0.1.3/Cargo.toml rename to third_party/cargo/vendor/core-video-sys-0.1.4/Cargo.toml index 3e5fad1..763b7a5 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/Cargo.toml +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/Cargo.toml @@ -13,9 +13,8 @@ [package] edition = "2018" name = "core-video-sys" -version = "0.1.3" +version = "0.1.4" authors = ["luozijun ", "michael.laifx "] -build = "build.rs" description = "Bindings to CoreVideo.framework for macOS and iOS" homepage = "https://github.com/luozijun/rust-core-video-sys" documentation = "https://docs.rs/core-video-sys/*/x86_64-apple-darwin/core-video-sys" @@ -25,22 +24,22 @@ repository = "https://github.com/luozijun/rust-core-video-sys" version = "0.1" [dependencies.core-foundation-sys] -version = "0.6.2" +version = "0.7" [dependencies.core-graphics] -version = "0.17.3" +version = "0.19" optional = true [dependencies.libc] -version = "0.2.47" +version = "0.2" [dependencies.metal] -version = "0.14.0" +version = "0.18" features = ["private"] optional = true [dependencies.objc] -version = "0.2.5" +version = "0.2" [features] all = ["display_link", "direct3d", "io_suface", "opengl"] diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/LICENSE b/third_party/cargo/vendor/core-video-sys-0.1.4/LICENSE similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/LICENSE rename to third_party/cargo/vendor/core-video-sys-0.1.4/LICENSE diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/base.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/base.rs similarity index 59% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/base.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/base.rs index de659e4..37b1aa6 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/base.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/base.rs @@ -1,12 +1,12 @@ -use crate::libc::{ c_double, int16_t, int32_t, int64_t, uint32_t, uint64_t, }; +use crate::libc::c_double; // https://developer.apple.com/documentation/corevideo/cvoptionflags?language=objc -pub type CVOptionFlags = uint64_t; -pub type CVSMPTETimeType = uint32_t; -pub type CVSMPTETimeFlags = uint32_t; -pub type CVTimeFlags = int32_t; -pub type CVTimeStampFlags = uint64_t; +pub type CVOptionFlags = u64; +pub type CVSMPTETimeType = u32; +pub type CVSMPTETimeFlags = u32; +pub type CVTimeFlags = i32; +pub type CVTimeStampFlags = u64; pub const kCVSMPTETimeType24: CVSMPTETimeType = 0; @@ -18,8 +18,8 @@ pub const kCVSMPTETimeType2997Drop: CVSMPTETimeType = 5; pub const kCVSMPTETimeType60: CVSMPTETimeType = 6; pub const kCVSMPTETimeType5994: CVSMPTETimeType = 7; -pub const kCVSMPTETimeValid: CVSMPTETimeFlags = (1 << 0); -pub const kCVSMPTETimeRunning: CVSMPTETimeFlags = (1 << 1); +pub const kCVSMPTETimeValid: CVSMPTETimeFlags = 1 << 0; +pub const kCVSMPTETimeRunning: CVSMPTETimeFlags = 1 << 1; pub const kCVTimeIsIndefinite: CVTimeFlags = 1 << 0; @@ -27,54 +27,54 @@ pub const kCVTimeIsIndefinite: CVTimeFlags = 1 << 0; #[repr(C)] #[derive(Debug, Clone)] pub struct CVSMPTETime { - pub subframes: int16_t, - pub subframeDivisor: int16_t, - pub counter: uint32_t, - pub type_: uint32_t, - pub flags: uint32_t, - pub hours: int16_t, - pub minutes: int16_t, - pub seconds: int16_t, - pub frames: int16_t, + pub subframes: i16, + pub subframeDivisor: i16, + pub counter: u32, + pub type_: u32, + pub flags: u32, + pub hours: i16, + pub minutes: i16, + pub seconds: i16, + pub frames: i16, } #[repr(C)] #[derive(Debug, Clone)] pub struct CVTime { - pub timeValue: int64_t, - pub timeScale: int32_t, - pub flags: int32_t + pub timeValue: i64, + pub timeScale: i32, + pub flags: i32 } #[repr(C)] #[derive(Debug, Clone)] pub struct CVTimeStamp { - pub version: uint32_t, - pub videoTimeScale: int32_t, - pub videoTime: int64_t, - pub hostTime: uint64_t, + pub version: u32, + pub videoTimeScale: i32, + pub videoTime: i64, + pub hostTime: u64, pub rateScalar: c_double, - pub videoRefreshPeriod: int64_t, + pub videoRefreshPeriod: i64, pub smpteTime: CVSMPTETime, - pub flags: uint64_t, - pub reserved: uint64_t, + pub flags: u64, + pub reserved: u64, } -pub const kCVTimeStampVideoTimeValid: CVTimeStampFlags = (1 << 0); -pub const kCVTimeStampHostTimeValid: CVTimeStampFlags = (1 << 1); -pub const kCVTimeStampSMPTETimeValid: CVTimeStampFlags = (1 << 2); -pub const kCVTimeStampVideoRefreshPeriodValid: CVTimeStampFlags = (1 << 3); -pub const kCVTimeStampRateScalarValid: CVTimeStampFlags = (1 << 4); +pub const kCVTimeStampVideoTimeValid: CVTimeStampFlags = 1 << 0; +pub const kCVTimeStampHostTimeValid: CVTimeStampFlags = 1 << 1; +pub const kCVTimeStampSMPTETimeValid: CVTimeStampFlags = 1 << 2; +pub const kCVTimeStampVideoRefreshPeriodValid: CVTimeStampFlags = 1 << 3; +pub const kCVTimeStampRateScalarValid: CVTimeStampFlags = 1 << 4; // There are flags for each field to make it easier to detect interlaced vs progressive output -pub const kCVTimeStampTopField: CVTimeStampFlags = (1 << 16); -pub const kCVTimeStampBottomField: CVTimeStampFlags = (1 << 17); +pub const kCVTimeStampTopField: CVTimeStampFlags = 1 << 16; +pub const kCVTimeStampBottomField: CVTimeStampFlags = 1 << 17; // Some commonly used combinations of timestamp flags -pub const kCVTimeStampVideoHostTimeValid: CVTimeStampFlags = (kCVTimeStampVideoTimeValid | kCVTimeStampHostTimeValid); -pub const kCVTimeStampIsInterlaced: CVTimeStampFlags = (kCVTimeStampTopField | kCVTimeStampBottomField); +pub const kCVTimeStampVideoHostTimeValid: CVTimeStampFlags = kCVTimeStampVideoTimeValid | kCVTimeStampHostTimeValid; +pub const kCVTimeStampIsInterlaced: CVTimeStampFlags = kCVTimeStampTopField | kCVTimeStampBottomField; extern "C" { diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/buffer.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/buffer.rs similarity index 96% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/buffer.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/buffer.rs index ae90ec9..9bb8579 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/buffer.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/buffer.rs @@ -1,4 +1,3 @@ -use crate::libc::{ uint32_t, }; use crate::core_foundation_sys::{ base::{ CFTypeRef, }, string::CFStringRef, @@ -12,7 +11,7 @@ pub enum __CVBuffer { } pub type CVBufferRef = *mut __CVBuffer; -pub type CVAttachmentMode = uint32_t; +pub type CVAttachmentMode = u32; pub const kCVAttachmentMode_ShouldNotPropagate: CVAttachmentMode = 0; pub const kCVAttachmentMode_ShouldPropagate: CVAttachmentMode = 1; diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/display_link.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/display_link.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/display_link.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/display_link.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/host_time.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/host_time.rs similarity index 82% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/host_time.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/host_time.rs index e7ae7a2..d38e8c9 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/host_time.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/host_time.rs @@ -1,4 +1,4 @@ -use crate::libc::{ c_double, uint32_t, uint64_t, }; +use crate::libc::c_double; extern "C" { /// @function CVGetCurrentHostTime @@ -6,7 +6,7 @@ extern "C" { /// @discussion On Mac OS X, the host time base for CoreVideo and CoreAudio are identical, and the values returned from either API /// may be used interchangeably. /// @result The current host time. - pub fn CVGetCurrentHostTime() -> uint64_t; + pub fn CVGetCurrentHostTime() -> u64; /// @function CVGetHostClockFrequency /// @abstract Retrieve the frequency of the host time base. /// @discussion On Mac OS X, the host time base for CoreVideo and CoreAudio are identical, and the values returned from either API @@ -16,13 +16,13 @@ extern "C" { /// @function CVGetHostClockMinimumTimeDelta /// @abstract Retrieve the smallest possible increment in the host time base. /// @result The smallest valid increment in the host time base. - pub fn CVGetHostClockMinimumTimeDelta() -> uint32_t; + pub fn CVGetHostClockMinimumTimeDelta() -> u32; } #[test] fn test_get_curr_time() { unsafe { - assert_eq!(CVGetCurrentHostTime() > 0, true); + assert!(CVGetCurrentHostTime() > 0); } } \ No newline at end of file diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/image_buffer.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/image_buffer.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/image_buffer.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/image_buffer.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/lib.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/lib.rs similarity index 94% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/lib.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/lib.rs index 36780b5..55fa989 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/lib.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/lib.rs @@ -12,6 +12,11 @@ extern crate objc; extern crate core_foundation_sys; +#[cfg(any(target_os = "macos", target_os = "ios"))] +#[link(name = "CoreVideo", kind = "framework")] +extern "C" { } + + pub(crate) type OSType = u32; pub(crate) type GLenum = libc::c_uint; pub(crate) type GLsizei = libc::c_int; diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/metal_texture.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/metal_texture.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/metal_texture.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/metal_texture.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/metal_texture_cache.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/metal_texture_cache.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/metal_texture_cache.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/metal_texture_cache.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/open_gl_es_texture.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/open_gl_es_texture.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/open_gl_es_texture.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/open_gl_es_texture.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/open_gl_es_texture_cache.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/open_gl_es_texture_cache.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/open_gl_es_texture_cache.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/open_gl_es_texture_cache.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_buffer.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_buffer.rs similarity index 98% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_buffer.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_buffer.rs index 8e2caf2..67fb553 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_buffer.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_buffer.rs @@ -1,4 +1,4 @@ -use crate::libc::{ size_t, }; +use crate::libc::size_t; use crate::core_foundation_sys::{ base::{ CFAllocatorRef, CFTypeID, }, dictionary::CFDictionaryRef, diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_buffer_pool.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_buffer_pool.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_buffer_pool.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_buffer_pool.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_texture.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_texture.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_texture.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_texture.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_texture_cache.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_texture_cache.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/opengl_texture_cache.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/opengl_texture_cache.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer.rs similarity index 99% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer.rs index d5a0dfc..b54668e 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer.rs @@ -1,4 +1,4 @@ -use crate::libc::{ c_void, int32_t, uint32_t, size_t, }; +use crate::libc::{ c_void, size_t, }; use crate::core_foundation_sys::{ base::{ Boolean, CFAllocatorRef, CFTypeID }, dictionary::CFDictionaryRef, @@ -98,9 +98,9 @@ pub const kCVPixelBufferLock_ReadOnly: CVPixelBufferLockFlags = 1; #[derive(Debug, Clone, Copy)] pub struct CVPlanarComponentInfo { /// offset from main base address to base address of this plane, big-endian - pub offset: int32_t, + pub offset: i32, /// bytes per row of this plane, big-endian - pub rowBytes: uint32_t, + pub rowBytes: u32, } #[repr(C)] diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer_io_surface.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer_io_surface.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer_io_surface.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer_io_surface.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer_pool.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer_pool.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_buffer_pool.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_buffer_pool.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_format_description.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_format_description.rs similarity index 100% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/pixel_format_description.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/pixel_format_description.rs diff --git a/third_party/cargo/vendor/core-video-sys-0.1.3/src/return_.rs b/third_party/cargo/vendor/core-video-sys-0.1.4/src/return_.rs similarity index 96% rename from third_party/cargo/vendor/core-video-sys-0.1.3/src/return_.rs rename to third_party/cargo/vendor/core-video-sys-0.1.4/src/return_.rs index 24d860a..b6c4d56 100644 --- a/third_party/cargo/vendor/core-video-sys-0.1.3/src/return_.rs +++ b/third_party/cargo/vendor/core-video-sys-0.1.4/src/return_.rs @@ -1,6 +1,5 @@ -use crate::libc::{ int32_t, }; -pub type CVReturn = int32_t; +pub type CVReturn = i32; pub const kCVReturnSuccess: CVReturn = 0; diff --git a/third_party/cargo/vendor/crossbeam-0.7.3/BUILD b/third_party/cargo/vendor/crossbeam-0.7.3/BUILD index 0426edf..7f62506 100644 --- a/third_party/cargo/vendor/crossbeam-0.7.3/BUILD +++ b/third_party/cargo/vendor/crossbeam-0.7.3/BUILD @@ -35,7 +35,7 @@ rust_library( "//third_party/cargo/vendor/crossbeam-channel-0.4.2:crossbeam_channel", "//third_party/cargo/vendor/crossbeam-deque-0.7.3:crossbeam_deque", "//third_party/cargo/vendor/crossbeam-epoch-0.8.2:crossbeam_epoch", - "//third_party/cargo/vendor/crossbeam-queue-0.2.1:crossbeam_queue", + "//third_party/cargo/vendor/crossbeam-queue-0.2.2:crossbeam_queue", "//third_party/cargo/vendor/crossbeam-utils-0.7.2:crossbeam_utils", ], rustc_flags = [ diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/.cargo-checksum.json b/third_party/cargo/vendor/crossbeam-queue-0.2.1/.cargo-checksum.json deleted file mode 100644 index 44a9a3f..0000000 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"11a088f907e561d383ff4b317a36adadaa1369eb3b3e30a9a480264198bb0bd7","Cargo.toml":"2de2e2eaa104a973d39f9689f78fd1040765f7263d83f6d374de2fb57205c48d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","LICENSE-THIRD-PARTY":"abb1905b1c2b7db73902e6c328d332d82f3797d7fab61e6fc1c2fc366b132014","README.md":"b487d2d9d9cf9726fbf3b5cf736ddc363f8d1e1410a0a4020dda27c4df72c627","src/array_queue.rs":"ea8f2ac760dc0418d035df8f47b67fe15dbfb94a31836c3ee7d45e02f8d172db","src/err.rs":"cde063a29dc8887d4c3bd0994f7aab08879841d94c61ecf104a8a85f2c436302","src/lib.rs":"75b2c59de7728e6dce4a31565e3c7ba98132260f02a637726d50cd9fbe4f4886","src/seg_queue.rs":"7a27739c9667cc9b57a4a02a1df2176ab252233c579684a5fd64dd3ffccc2cff","tests/array_queue.rs":"3faa35bbe2acb3dabdfab5e81860a19e0237c57513420bbb9afe0cb89ac25909","tests/seg_queue.rs":"885ea52ce2c5d1fa9b4265250957d51ffa3f0781d57b01d28cb871371e32ac92"},"package":"c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db"} \ No newline at end of file diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.2/.cargo-checksum.json b/third_party/cargo/vendor/crossbeam-queue-0.2.2/.cargo-checksum.json new file mode 100644 index 0000000..1957371 --- /dev/null +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"cd81bbb3201007b7a9e37730501955e44808c48e79738f3f3a033eb507ee578d","Cargo.toml":"6bc61dc53eba6a181cc0a468063a1ad1d60180a171188297bdc97d6b08b1d3d4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"5734ed989dfca1f625b40281ee9f4530f91b2411ec01cb748223e7eb87e201ab","LICENSE-THIRD-PARTY":"abb1905b1c2b7db73902e6c328d332d82f3797d7fab61e6fc1c2fc366b132014","README.md":"a4cf719c04f69cc7a7016242875dcf0f74e4ca710e33df372e21275de08170c2","src/array_queue.rs":"eb12dbe04e8b49a18e85f2a487222e8ca297fd790d40beeeb5fc21ba58560937","src/err.rs":"1cf3b3c12b7de3be7b008dbf43769b585fde832f8a0af526abded52fcb08c41a","src/lib.rs":"b4b2afba1dfb79a4797f5a3a961e17022bfcf9e0bb20423086f501f63b9dc9a2","src/seg_queue.rs":"de3d23f0824ff6c81cc0ccfe7b22735a7533906906736e9e92096151a21ec81a","tests/array_queue.rs":"18fca619e075971b53b6286ac561b7fd3c841039e02dd17c04d16ca0065bfa71","tests/seg_queue.rs":"80eb0ae14911edbaacd98e54b2b97f772bade14a9a892bbb55ce403525e59a99"},"package":"ab6bffe714b6bb07e42f201352c34f51fefd355ace793f9e638ebd52d23f98d2"} \ No newline at end of file diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/BUILD b/third_party/cargo/vendor/crossbeam-queue-0.2.2/BUILD similarity index 89% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/BUILD rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/BUILD index 7a69bef..b551039 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/BUILD +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/BUILD @@ -12,8 +12,7 @@ package(default_visibility = [ ]) licenses([ - "notice", # "MIT" - "restricted", # "Apache-2.0 AND BSD-2-Clause" + "restricted", # "MIT OR Apache-2.0" ]) load( @@ -30,7 +29,7 @@ rust_library( name = "crossbeam_queue", crate_root = "src/lib.rs", crate_type = "lib", - edition = "2015", + edition = "2018", srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/cfg-if-0.1.10:cfg_if", @@ -39,8 +38,9 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.1", + version = "0.2.2", crate_features = [ + "alloc", "default", "std", ], diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/CHANGELOG.md b/third_party/cargo/vendor/crossbeam-queue-0.2.2/CHANGELOG.md similarity index 80% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/CHANGELOG.md rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/CHANGELOG.md index 5677d7c..9ac6d48 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/CHANGELOG.md +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/CHANGELOG.md @@ -1,3 +1,7 @@ +# Version 0.2.2 + +- Fix unsoundness issues by adopting `MaybeUninit`. (#458) + # Version 0.2.1 - Add `no_std` support. diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/Cargo.toml b/third_party/cargo/vendor/crossbeam-queue-0.2.2/Cargo.toml similarity index 87% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/Cargo.toml rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/Cargo.toml index 23a74ed..ebb7348 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/Cargo.toml +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/Cargo.toml @@ -11,8 +11,9 @@ # will likely look very different (and much more reasonable) [package] +edition = "2018" name = "crossbeam-queue" -version = "0.2.1" +version = "0.2.2" authors = ["The Crossbeam Project Developers"] description = "Concurrent queues" homepage = "https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-utils" @@ -20,18 +21,19 @@ documentation = "https://docs.rs/crossbeam-queue" readme = "README.md" keywords = ["queue", "mpmc", "lock-free", "producer", "consumer"] categories = ["concurrency", "data-structures"] -license = "MIT/Apache-2.0 AND BSD-2-Clause" +license = "MIT OR Apache-2.0" repository = "https://github.com/crossbeam-rs/crossbeam" [dependencies.cfg-if] -version = "0.1.2" +version = "0.1.10" [dependencies.crossbeam-utils] version = "0.7" default-features = false [dev-dependencies.rand] -version = "0.6" +version = "0.7.3" [features] -alloc = ["crossbeam-utils/alloc"] +alloc = [] default = ["std"] -std = ["crossbeam-utils/std"] +nightly = [] +std = ["alloc", "crossbeam-utils/std"] diff --git a/third_party/cargo/vendor/cocoa-0.20.0/LICENSE-APACHE b/third_party/cargo/vendor/crossbeam-queue-0.2.2/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/cocoa-0.20.0/LICENSE-APACHE rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/LICENSE-APACHE diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/LICENSE-MIT b/third_party/cargo/vendor/crossbeam-queue-0.2.2/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/LICENSE-MIT rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/LICENSE-MIT diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/LICENSE-THIRD-PARTY b/third_party/cargo/vendor/crossbeam-queue-0.2.2/LICENSE-THIRD-PARTY similarity index 100% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/LICENSE-THIRD-PARTY rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/LICENSE-THIRD-PARTY diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/README.md b/third_party/cargo/vendor/crossbeam-queue-0.2.2/README.md similarity index 76% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/README.md rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/README.md index 646f9cf..008889d 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/README.md +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/README.md @@ -1,14 +1,14 @@ # Crossbeam Queue -[![Build Status](https://travis-ci.org/crossbeam-rs/crossbeam.svg?branch=master)]( -https://travis-ci.org/crossbeam-rs/crossbeam) -[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)]( -https://github.com/crossbeam-rs/crossbeam-queue/tree/master/src) +[![Build Status](https://github.com/crossbeam-rs/crossbeam/workflows/CI/badge.svg)]( +https://github.com/crossbeam-rs/crossbeam/actions) +[![License](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg)]( +https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-queue#license) [![Cargo](https://img.shields.io/crates/v/crossbeam-queue.svg)]( https://crates.io/crates/crossbeam-queue) [![Documentation](https://docs.rs/crossbeam-queue/badge.svg)]( https://docs.rs/crossbeam-queue) -[![Rust 1.28+](https://img.shields.io/badge/rust-1.28+-lightgray.svg)]( +[![Rust 1.36+](https://img.shields.io/badge/rust-1.36+-lightgray.svg)]( https://www.rust-lang.org) [![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq) @@ -29,15 +29,11 @@ Add this to your `Cargo.toml`: crossbeam-queue = "0.2" ``` -Next, add this to your crate: - -```rust -extern crate crossbeam_queue; -``` - ## Compatibility -The minimum supported Rust version is 1.28. Any change to this is considered a breaking change. +Crossbeam Queue supports stable Rust releases going back at least six months, +and every time the minimum supported Rust version is increased, a new minor +version is released. Currently, the minimum supported Rust version is 1.36. ## License diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/array_queue.rs b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/array_queue.rs similarity index 92% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/src/array_queue.rs rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/src/array_queue.rs index 683daad..eb97e8e 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/array_queue.rs +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/array_queue.rs @@ -12,13 +12,12 @@ use alloc::vec::Vec; use core::cell::UnsafeCell; use core::fmt; use core::marker::PhantomData; -use core::mem; -use core::ptr; +use core::mem::{self, MaybeUninit}; use core::sync::atomic::{self, AtomicUsize, Ordering}; use crossbeam_utils::{Backoff, CachePadded}; -use err::{PopError, PushError}; +use crate::err::{PopError, PushError}; /// A slot in a queue. struct Slot { @@ -29,7 +28,7 @@ struct Slot { stamp: AtomicUsize, /// The value in this slot. - value: UnsafeCell, + value: UnsafeCell>, } /// A bounded multi-producer multi-consumer queue. @@ -108,23 +107,23 @@ impl ArrayQueue { let head = 0; let tail = 0; - // Allocate a buffer of `cap` slots. + // Allocate a buffer of `cap` slots initialized + // with stamps. let buffer = { - let mut v = Vec::>::with_capacity(cap); + let mut v: Vec> = (0..cap) + .map(|i| { + // Set the stamp to `{ lap: 0, index: i }`. + Slot { + stamp: AtomicUsize::new(i), + value: UnsafeCell::new(MaybeUninit::uninit()), + } + }) + .collect(); let ptr = v.as_mut_ptr(); mem::forget(v); ptr }; - // Initialize stamps in the slots. - for i in 0..cap { - unsafe { - // Set the stamp to `{ lap: 0, index: i }`. - let slot = buffer.add(i); - ptr::write(&mut (*slot).stamp, AtomicUsize::new(i)); - } - } - // One lap is the smallest power of two greater than `cap`. let one_lap = (cap + 1).next_power_of_two(); @@ -187,7 +186,7 @@ impl ArrayQueue { Ok(_) => { // Write the value into the slot and update the stamp. unsafe { - slot.value.get().write(value); + slot.value.get().write(MaybeUninit::new(value)); } slot.stamp.store(tail + 1, Ordering::Release); return Ok(()); @@ -266,7 +265,7 @@ impl ArrayQueue { ) { Ok(_) => { // Read the value from the slot and update the stamp. - let msg = unsafe { slot.value.get().read() }; + let msg = unsafe { slot.value.get().read().assume_init() }; slot.stamp .store(head.wrapping_add(self.one_lap), Ordering::Release); return Ok(msg); @@ -300,7 +299,7 @@ impl ArrayQueue { /// # Examples /// /// ``` - /// use crossbeam_queue::{ArrayQueue, PopError}; + /// use crossbeam_queue::ArrayQueue; /// /// let q = ArrayQueue::::new(100); /// @@ -315,7 +314,7 @@ impl ArrayQueue { /// # Examples /// /// ``` - /// use crossbeam_queue::{ArrayQueue, PopError}; + /// use crossbeam_queue::ArrayQueue; /// /// let q = ArrayQueue::new(100); /// @@ -340,7 +339,7 @@ impl ArrayQueue { /// # Examples /// /// ``` - /// use crossbeam_queue::{ArrayQueue, PopError}; + /// use crossbeam_queue::ArrayQueue; /// /// let q = ArrayQueue::new(1); /// @@ -364,7 +363,7 @@ impl ArrayQueue { /// # Examples /// /// ``` - /// use crossbeam_queue::{ArrayQueue, PopError}; + /// use crossbeam_queue::ArrayQueue; /// /// let q = ArrayQueue::new(100); /// assert_eq!(q.len(), 0); @@ -415,7 +414,12 @@ impl Drop for ArrayQueue { }; unsafe { - self.buffer.add(index).drop_in_place(); + let p = { + let slot = &mut *self.buffer.add(index); + let value = &mut *slot.value.get(); + value.as_mut_ptr() + }; + p.drop_in_place(); } } @@ -427,7 +431,7 @@ impl Drop for ArrayQueue { } impl fmt::Debug for ArrayQueue { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("ArrayQueue { .. }") } } diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/err.rs b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/err.rs similarity index 52% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/src/err.rs rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/src/err.rs index 42880e8..44fe916 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/err.rs +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/err.rs @@ -5,43 +5,35 @@ use core::fmt; pub struct PopError; impl fmt::Debug for PopError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "PopError".fmt(f) } } impl fmt::Display for PopError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "popping from an empty queue".fmt(f) } } -#[cfg(features = "std")] -impl std::error::Error for PopError { - fn description(&self) -> &str { - "popping from an empty queue" - } -} +#[cfg(feature = "std")] +impl ::std::error::Error for PopError {} /// Error which occurs when pushing into a full queue. #[derive(Clone, Copy, Eq, PartialEq)] pub struct PushError(pub T); impl fmt::Debug for PushError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "PushError(..)".fmt(f) } } impl fmt::Display for PushError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { "pushing into a full queue".fmt(f) } } -#[cfg(features = "std")] -impl std::error::Error for PushError { - fn description(&self) -> &str { - "pushing into a full queue" - } -} +#[cfg(feature = "std")] +impl ::std::error::Error for PushError {} diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/lib.rs b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/lib.rs similarity index 65% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/src/lib.rs rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/src/lib.rs index 2eda6b0..9d29b77 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/lib.rs +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/lib.rs @@ -8,27 +8,22 @@ //! [`ArrayQueue`]: struct.ArrayQueue.html //! [`SegQueue`]: struct.SegQueue.html -#![warn(missing_docs)] -#![warn(missing_debug_implementations)] +#![doc(test( + no_crate_inject, + attr( + deny(warnings, rust_2018_idioms), + allow(dead_code, unused_assignments, unused_variables) + ) +))] +#![warn(missing_docs, missing_debug_implementations, rust_2018_idioms)] #![cfg_attr(not(feature = "std"), no_std)] +#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))] -#[macro_use] -extern crate cfg_if; -#[cfg(feature = "std")] -extern crate core; - -cfg_if! { +#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))] +cfg_if::cfg_if! { if #[cfg(feature = "alloc")] { extern crate alloc; - } else if #[cfg(feature = "std")] { - extern crate std as alloc; - } -} -extern crate crossbeam_utils; - -cfg_if! { - if #[cfg(any(feature = "alloc", feature = "std"))] { mod array_queue; mod err; mod seg_queue; diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/seg_queue.rs b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/seg_queue.rs similarity index 93% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/src/seg_queue.rs rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/src/seg_queue.rs index 2ddfe8b..8dd1547 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/src/seg_queue.rs +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/src/seg_queue.rs @@ -2,13 +2,13 @@ use alloc::boxed::Box; use core::cell::UnsafeCell; use core::fmt; use core::marker::PhantomData; -use core::mem::{self, ManuallyDrop}; +use core::mem::MaybeUninit; use core::ptr; use core::sync::atomic::{self, AtomicPtr, AtomicUsize, Ordering}; use crossbeam_utils::{Backoff, CachePadded}; -use err::PopError; +use crate::err::PopError; // Bits indicating the state of a slot: // * If a value has been written into the slot, `WRITE` is set. @@ -30,7 +30,7 @@ const HAS_NEXT: usize = 1; /// A slot in a block. struct Slot { /// The value. - value: UnsafeCell>, + value: UnsafeCell>, /// The state of the slot. state: AtomicUsize, @@ -60,7 +60,13 @@ struct Block { impl Block { /// Creates an empty block that starts at `start_index`. fn new() -> Block { - unsafe { mem::zeroed() } + // SAFETY: This is safe because: + // [1] `Block::next` (AtomicPtr) may be safely zero initialized. + // [2] `Block::slots` (Array) may be safely zero initialized because of [3, 4]. + // [3] `Slot::value` (UnsafeCell) may be safely zero initialized because it + // holds a MaybeUninit. + // [4] `Slot::state` (AtomicUsize) may be safely zero initialized. + unsafe { MaybeUninit::zeroed().assume_init() } } /// Waits until the next pointer is set. @@ -244,7 +250,7 @@ impl SegQueue { // Write the value into the slot. let slot = (*block).slots.get_unchecked(offset); - slot.value.get().write(ManuallyDrop::new(value)); + slot.value.get().write(MaybeUninit::new(value)); slot.state.fetch_or(WRITE, Ordering::Release); return; @@ -339,8 +345,7 @@ impl SegQueue { // Read the value. let slot = (*block).slots.get_unchecked(offset); slot.wait_write(); - let m = slot.value.get().read(); - let value = ManuallyDrop::into_inner(m); + let value = slot.value.get().read().assume_init(); // Destroy the block if we've reached the end, or if another thread wanted to // destroy but couldn't because we were busy reading from the slot. @@ -385,7 +390,7 @@ impl SegQueue { /// # Examples /// /// ``` - /// use crossbeam_queue::{SegQueue, PopError}; + /// use crossbeam_queue::SegQueue; /// /// let q = SegQueue::new(); /// assert_eq!(q.len(), 0); @@ -408,6 +413,14 @@ impl SegQueue { tail &= !((1 << SHIFT) - 1); head &= !((1 << SHIFT) - 1); + // Fix up indices if they fall onto block ends. + if (tail >> SHIFT) & (LAP - 1) == LAP - 1 { + tail = tail.wrapping_add(1 << SHIFT); + } + if (head >> SHIFT) & (LAP - 1) == LAP - 1 { + head = head.wrapping_add(1 << SHIFT); + } + // Rotate indices so that head falls into the first block. let lap = (head >> SHIFT) / LAP; tail = tail.wrapping_sub((lap * LAP) << SHIFT); @@ -417,15 +430,6 @@ impl SegQueue { tail >>= SHIFT; head >>= SHIFT; - // Fix up indices if they fall onto block ends. - if head == BLOCK_CAP { - head = 0; - tail -= LAP; - } - if tail == BLOCK_CAP { - tail += 1; - } - // Return the difference minus the number of blocks between tail and head. return tail - head - tail / LAP; } @@ -451,7 +455,8 @@ impl Drop for SegQueue { if offset < BLOCK_CAP { // Drop the value in the slot. let slot = (*block).slots.get_unchecked(offset); - ManuallyDrop::drop(&mut *(*slot).value.get()); + let p = &mut *slot.value.get(); + p.as_mut_ptr().drop_in_place(); } else { // Deallocate the block and move to the next one. let next = (*block).next.load(Ordering::Relaxed); @@ -471,7 +476,7 @@ impl Drop for SegQueue { } impl fmt::Debug for SegQueue { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("SegQueue { .. }") } } diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/tests/array_queue.rs b/third_party/cargo/vendor/crossbeam-queue-0.2.2/tests/array_queue.rs similarity index 98% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/tests/array_queue.rs rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/tests/array_queue.rs index a4f64f3..6dd6ce2 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/tests/array_queue.rs +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/tests/array_queue.rs @@ -1,7 +1,3 @@ -extern crate crossbeam_queue; -extern crate crossbeam_utils; -extern crate rand; - use std::sync::atomic::{AtomicUsize, Ordering}; use crossbeam_queue::ArrayQueue; diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/tests/seg_queue.rs b/third_party/cargo/vendor/crossbeam-queue-0.2.2/tests/seg_queue.rs similarity index 97% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/tests/seg_queue.rs rename to third_party/cargo/vendor/crossbeam-queue-0.2.2/tests/seg_queue.rs index ec32e1f..b8ffbd3 100644 --- a/third_party/cargo/vendor/crossbeam-queue-0.2.1/tests/seg_queue.rs +++ b/third_party/cargo/vendor/crossbeam-queue-0.2.2/tests/seg_queue.rs @@ -1,7 +1,3 @@ -extern crate crossbeam_queue; -extern crate crossbeam_utils; -extern crate rand; - use std::sync::atomic::{AtomicUsize, Ordering}; use crossbeam_queue::SegQueue; diff --git a/third_party/cargo/vendor/deflate-0.8.3/.cargo-checksum.json b/third_party/cargo/vendor/deflate-0.8.3/.cargo-checksum.json deleted file mode 100644 index 3ebc8d5..0000000 --- a/third_party/cargo/vendor/deflate-0.8.3/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"072c7be7fbdda0977ca4c0609066a46c590d87f8c25ef75c66be5c5a0763f237","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"852bcc033a46c62f99fb5ffd43b3241ba2c0c440c6034aa2114505f2c4f03c4a","README.md":"eadf743c720d5ee3fcc8a6faeff390d3291fa2383425dd2dccd052b4583848d7","benches/bench.rs":"5a57c0cc31e38a5e4a6db435587f877ad9d71c0dc6b999971ed071a5c7d094a4","src/bit_reverse.rs":"0c5fe0a6fbd01d36b30d53d0215208aee1e6bdf6e02f66ffe149ca3c0c67071f","src/bitstream.rs":"e8c15c517d125a45b40a4f2b06a39bcb54fa559796e40465678e5fdefeedcc01","src/chained_hash_table.rs":"8d45799a74f15cdca5b4cdb75e715f0ef218b894622132b3a5f5026de4e25db1","src/checksum.rs":"2785f88ff8c96d5cf6f6919daf1a66121da293f9d0a19ff227ae6bd40309f5db","src/compress.rs":"ce28956bc0484e977def2e4930a953c2c54932f7614dcd27ff16aa323b2c66af","src/compression_options.rs":"585183818883cf64c3c9021e48be834a07699dc05d544644ecfe837fb17f112b","src/deflate_state.rs":"302a5af101c60158dc99ac9f4e62f68928eb4de39ff484e85ed017217203346e","src/encoder_state.rs":"25db212b800bb54909763d63e727578ba077d0e0082104ded9bcb2205ad6d65e","src/huffman_lengths.rs":"ee04034f4a843022422f98f2fd4c3054447ac13e585dd83ffab2225a487b001c","src/huffman_table.rs":"378f61513d2a918aabd0ccc2e0dfd601a6b3cea1854f1690b90df83c4e2b32a1","src/input_buffer.rs":"0c92be26b993345d0c7181a0150e644543d2ec9302d13ad1fe6bb5f1186a7425","src/length_encode.rs":"e6e3b254a0ad5eecde183b67761fd45d3314f4965b96f830fe8229e91b26debc","src/lib.rs":"8d473e400ee6b452920eaef2bb7765d83cce313b6883a33583466a99f83f3c9e","src/lz77.rs":"ec77dbed67a7a81ac0cfd50aeb05fb3f9fc4604414c0748b602eee1c72e529ac","src/lzvalue.rs":"4dc4a24689c6d56d2efa8e3d67d5a100f538006b49a2e6387b37638978175954","src/matching.rs":"8ab38d8a89b286c5dd618bf067feea61c2464313ac7b70a99c9fe8bece4d9756","src/output_writer.rs":"925046352f57f6494443d60ffcb1abb23f0d0afe2d829e76f9d60ea69f290253","src/rle.rs":"8ee49e091ca975aa11412b1f24d56fc9ae92666b95e52bdc9adbb2ffa765a190","src/stored_block.rs":"7706ffb500a98414c9bced459903242560488fd1a5f8eeeab7ad0b6ce7e62654","src/test_utils.rs":"9a81b4678a766a5488fc75d46968086e27d211014039007ab130f59a972d18c2","src/writer.rs":"3bb7cc0322aa703aa8c346cef271757fda17ab809da2aa6440f22fd141f20427","src/zlib.rs":"13675ed7e8d4d355f93ee81e351fd0633a42b3299129c421b2d15b28c58abf3c"},"package":"050ef6de42a33903b30a7497b76b40d3d58691d4d3eec355348c122444a388f0"} \ No newline at end of file diff --git a/third_party/cargo/vendor/deflate-0.8.4/.cargo-checksum.json b/third_party/cargo/vendor/deflate-0.8.4/.cargo-checksum.json new file mode 100644 index 0000000..6c8ba10 --- /dev/null +++ b/third_party/cargo/vendor/deflate-0.8.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"deea0c7cb215652b65e17d4493479597b189a4b3c45d84035c0822b268216fb7","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"852bcc033a46c62f99fb5ffd43b3241ba2c0c440c6034aa2114505f2c4f03c4a","README.md":"eadf743c720d5ee3fcc8a6faeff390d3291fa2383425dd2dccd052b4583848d7","benches/bench.rs":"5a57c0cc31e38a5e4a6db435587f877ad9d71c0dc6b999971ed071a5c7d094a4","changelog.md":"2aec5aef137eb31b747b0da7d14435dab15017beaa616cb9def4770df6f21c5b","src/bit_reverse.rs":"0c5fe0a6fbd01d36b30d53d0215208aee1e6bdf6e02f66ffe149ca3c0c67071f","src/bitstream.rs":"e8c15c517d125a45b40a4f2b06a39bcb54fa559796e40465678e5fdefeedcc01","src/chained_hash_table.rs":"8d45799a74f15cdca5b4cdb75e715f0ef218b894622132b3a5f5026de4e25db1","src/checksum.rs":"2785f88ff8c96d5cf6f6919daf1a66121da293f9d0a19ff227ae6bd40309f5db","src/compress.rs":"ce28956bc0484e977def2e4930a953c2c54932f7614dcd27ff16aa323b2c66af","src/compression_options.rs":"585183818883cf64c3c9021e48be834a07699dc05d544644ecfe837fb17f112b","src/deflate_state.rs":"302a5af101c60158dc99ac9f4e62f68928eb4de39ff484e85ed017217203346e","src/encoder_state.rs":"25db212b800bb54909763d63e727578ba077d0e0082104ded9bcb2205ad6d65e","src/huffman_lengths.rs":"ee04034f4a843022422f98f2fd4c3054447ac13e585dd83ffab2225a487b001c","src/huffman_table.rs":"378f61513d2a918aabd0ccc2e0dfd601a6b3cea1854f1690b90df83c4e2b32a1","src/input_buffer.rs":"0c92be26b993345d0c7181a0150e644543d2ec9302d13ad1fe6bb5f1186a7425","src/length_encode.rs":"e6e3b254a0ad5eecde183b67761fd45d3314f4965b96f830fe8229e91b26debc","src/lib.rs":"8d473e400ee6b452920eaef2bb7765d83cce313b6883a33583466a99f83f3c9e","src/lz77.rs":"5828136f545c5657acb988c3093da5c3f206177c2debd594b8303b1ff21af210","src/lzvalue.rs":"4dc4a24689c6d56d2efa8e3d67d5a100f538006b49a2e6387b37638978175954","src/matching.rs":"8ab38d8a89b286c5dd618bf067feea61c2464313ac7b70a99c9fe8bece4d9756","src/output_writer.rs":"925046352f57f6494443d60ffcb1abb23f0d0afe2d829e76f9d60ea69f290253","src/rle.rs":"8ee49e091ca975aa11412b1f24d56fc9ae92666b95e52bdc9adbb2ffa765a190","src/stored_block.rs":"7706ffb500a98414c9bced459903242560488fd1a5f8eeeab7ad0b6ce7e62654","src/test_utils.rs":"9a81b4678a766a5488fc75d46968086e27d211014039007ab130f59a972d18c2","src/writer.rs":"3bb7cc0322aa703aa8c346cef271757fda17ab809da2aa6440f22fd141f20427","src/zlib.rs":"13675ed7e8d4d355f93ee81e351fd0633a42b3299129c421b2d15b28c58abf3c"},"package":"e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7"} \ No newline at end of file diff --git a/third_party/cargo/vendor/deflate-0.8.3/BUILD b/third_party/cargo/vendor/deflate-0.8.4/BUILD similarity index 97% rename from third_party/cargo/vendor/deflate-0.8.3/BUILD rename to third_party/cargo/vendor/deflate-0.8.4/BUILD index 7427983..15c90e2 100644 --- a/third_party/cargo/vendor/deflate-0.8.3/BUILD +++ b/third_party/cargo/vendor/deflate-0.8.4/BUILD @@ -38,7 +38,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.8.3", + version = "0.8.4", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/deflate-0.8.3/Cargo.toml b/third_party/cargo/vendor/deflate-0.8.4/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/deflate-0.8.3/Cargo.toml rename to third_party/cargo/vendor/deflate-0.8.4/Cargo.toml index b3e7793..bc523a7 100644 --- a/third_party/cargo/vendor/deflate-0.8.3/Cargo.toml +++ b/third_party/cargo/vendor/deflate-0.8.4/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "deflate" -version = "0.8.3" +version = "0.8.4" authors = ["oyvindln "] exclude = ["tests/*", "fuzz/*"] description = "A DEFLATE, zlib and gzip encoder written in rust.\n" diff --git a/third_party/cargo/vendor/crossbeam-queue-0.2.1/LICENSE-APACHE b/third_party/cargo/vendor/deflate-0.8.4/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/crossbeam-queue-0.2.1/LICENSE-APACHE rename to third_party/cargo/vendor/deflate-0.8.4/LICENSE-APACHE diff --git a/third_party/cargo/vendor/deflate-0.8.3/LICENSE-MIT b/third_party/cargo/vendor/deflate-0.8.4/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/LICENSE-MIT rename to third_party/cargo/vendor/deflate-0.8.4/LICENSE-MIT diff --git a/third_party/cargo/vendor/deflate-0.8.3/README.md b/third_party/cargo/vendor/deflate-0.8.4/README.md similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/README.md rename to third_party/cargo/vendor/deflate-0.8.4/README.md diff --git a/third_party/cargo/vendor/deflate-0.8.3/benches/bench.rs b/third_party/cargo/vendor/deflate-0.8.4/benches/bench.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/benches/bench.rs rename to third_party/cargo/vendor/deflate-0.8.4/benches/bench.rs diff --git a/third_party/cargo/vendor/deflate-0.8.4/changelog.md b/third_party/cargo/vendor/deflate-0.8.4/changelog.md new file mode 100644 index 0000000..ea19f8e --- /dev/null +++ b/third_party/cargo/vendor/deflate-0.8.4/changelog.md @@ -0,0 +1,4 @@ + +### 0.8.5 (2020-04-04) +Fix block size counter bug #44 (probably introduced in 1b70be) +that triggered a debug assertion and that could possibly in theory cause stored block to start at the wrong input position at a block split with low entropy data followed by uncompressible data. diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/bit_reverse.rs b/third_party/cargo/vendor/deflate-0.8.4/src/bit_reverse.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/bit_reverse.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/bit_reverse.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/bitstream.rs b/third_party/cargo/vendor/deflate-0.8.4/src/bitstream.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/bitstream.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/bitstream.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/chained_hash_table.rs b/third_party/cargo/vendor/deflate-0.8.4/src/chained_hash_table.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/chained_hash_table.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/chained_hash_table.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/checksum.rs b/third_party/cargo/vendor/deflate-0.8.4/src/checksum.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/checksum.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/checksum.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/compress.rs b/third_party/cargo/vendor/deflate-0.8.4/src/compress.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/compress.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/compress.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/compression_options.rs b/third_party/cargo/vendor/deflate-0.8.4/src/compression_options.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/compression_options.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/compression_options.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/deflate_state.rs b/third_party/cargo/vendor/deflate-0.8.4/src/deflate_state.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/deflate_state.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/deflate_state.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/encoder_state.rs b/third_party/cargo/vendor/deflate-0.8.4/src/encoder_state.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/encoder_state.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/encoder_state.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/huffman_lengths.rs b/third_party/cargo/vendor/deflate-0.8.4/src/huffman_lengths.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/huffman_lengths.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/huffman_lengths.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/huffman_table.rs b/third_party/cargo/vendor/deflate-0.8.4/src/huffman_table.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/huffman_table.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/huffman_table.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/input_buffer.rs b/third_party/cargo/vendor/deflate-0.8.4/src/input_buffer.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/input_buffer.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/input_buffer.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/length_encode.rs b/third_party/cargo/vendor/deflate-0.8.4/src/length_encode.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/length_encode.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/length_encode.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/lib.rs b/third_party/cargo/vendor/deflate-0.8.4/src/lib.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/lib.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/lib.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/lz77.rs b/third_party/cargo/vendor/deflate-0.8.4/src/lz77.rs similarity index 99% rename from third_party/cargo/vendor/deflate-0.8.3/src/lz77.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/lz77.rs index 9e7c4fe..4ca75a6 100644 --- a/third_party/cargo/vendor/deflate-0.8.3/src/lz77.rs +++ b/third_party/cargo/vendor/deflate-0.8.4/src/lz77.rs @@ -671,10 +671,8 @@ pub fn lz77_compress_block( state.bytes_to_hash = overlap; if let ProcessStatus::BufferFull(written) = p_status { - let nudge = if state.is_first_window { 0 } else { overlap }; - state.current_block_input_bytes += (written - start + nudge + pending_previous - - state.pending_byte_as_num()) - as u64; + state.current_block_input_bytes += + (written - start + pending_previous - state.pending_byte_as_num()) as u64; // If the buffer is full, return and end the block. // If overlap is non-zero, the buffer was full after outputting the last byte, diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/lzvalue.rs b/third_party/cargo/vendor/deflate-0.8.4/src/lzvalue.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/lzvalue.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/lzvalue.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/matching.rs b/third_party/cargo/vendor/deflate-0.8.4/src/matching.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/matching.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/matching.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/output_writer.rs b/third_party/cargo/vendor/deflate-0.8.4/src/output_writer.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/output_writer.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/output_writer.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/rle.rs b/third_party/cargo/vendor/deflate-0.8.4/src/rle.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/rle.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/rle.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/stored_block.rs b/third_party/cargo/vendor/deflate-0.8.4/src/stored_block.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/stored_block.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/stored_block.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/test_utils.rs b/third_party/cargo/vendor/deflate-0.8.4/src/test_utils.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/test_utils.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/test_utils.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/writer.rs b/third_party/cargo/vendor/deflate-0.8.4/src/writer.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/writer.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/writer.rs diff --git a/third_party/cargo/vendor/deflate-0.8.3/src/zlib.rs b/third_party/cargo/vendor/deflate-0.8.4/src/zlib.rs similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/src/zlib.rs rename to third_party/cargo/vendor/deflate-0.8.4/src/zlib.rs diff --git a/third_party/cargo/vendor/derivative-2.1.1/.cargo-checksum.json b/third_party/cargo/vendor/derivative-2.1.1/.cargo-checksum.json new file mode 100644 index 0000000..106fcd4 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"41fe4347cb34b788db536dff2450bb90d5040f40700b207d8570dc1cf1b214a2","CONTRIBUTING.md":"a699b5e04b56f1e344ab4012b648f60124096c9693edca12fd3e036bc6b3ca7a","Cargo.toml":"cca1a9bdfa6f79a3523964b9e3ffe98596ab66aa7b21175c81b9f4703ce14560","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"e94997ba9934ce993406caf5d5002a99ac7b0692363cb801e777b961d1934b98","Makefile":"22590a5e01901b2dc7967090e9fe522434b1975c2dfcfbccf6903437b0980589","README.md":"cdbce1bb83b2e82c432bb0df117805cb069e389b43044ec1737c39803b429a11","appveyor.yml":"dcfc4540e8c6729519a3f38d95779b05c9a796acd0e797ea8607948073c672fc","book.json":"f6b605d80251c1d8950f625c5ffa1d224cdd15cdbb8d4f60eb74fff431311d2d","doc/Clone.md":"7a3f75f616f9d814031d3f3bf1f2e58f030ccb8b836d4d41e71cfe9ec824c66c","doc/Debug.md":"a9fb36486a8a010eea54de528e304b293f55edad83bb6f92f44f4421bdaff946","doc/Default.md":"f453b14cf4e6490eb3c73699fc4af61f8c45af300d475ff9d6b4b085feea7431","doc/Hash.md":"42656b09522ad4ffca60947f2e7c6bc3ad4cf6b4fceffbc6780bf6004d848480","doc/README.md":"65083885730ec3f105db5bf2e8d1b5498eca7857bc35e56275f9ad96615f3749","doc/SUMMARY.md":"2808a6f15821e2588bf32bd2e46475d347fa5cf58b32e60b872dd33354f5fe4e","doc/cmp.md":"21ebfa16067e815fdd23e93a3086b5aea43e6163ef94968044e3713e7b9e1187","doc/debug-transparent-orig.rs":"54017bd5bf08e0a28cb7cc44abeef52419514a5c6dcb0284dfc059537e93dde9","doc/debug-transparent.rs":"bd864da9e0a3e2d1ac5cfa418dac5d54734a2ab2154c9cba69296c67e35d1f5c","doc/default-enum-orig.rs":"069f6bc6a40a08819a6dfc173c066ea5e006cb521678ce5525b2767d635f94a7","doc/default-enum.rs":"85f2a96c965e3ed25eb95bfabbef8c3d6817db8d8f14d11260b748550df54d9d","doc/default-value-orig.rs":"1b95a7c76be35c1d23d1b1835e3e3fbe61b0e34de1208ee8945c7bef77c9cdd2","doc/default-value.rs":"eeab75ded762713153def8c5bd57db5e02c326101a2ff7d6955eff4302bc9a1e","doc/eq-ignore-orig.rs":"7adeffc02847edd7919b322804dc30a66990b278dd0f358a9dcc15f32826cfe2","doc/eq-ignore.rs":"d5b69842284b4e4e047fb2ecb99629b5bea0989ae6e856f3de6519004bd0420c","doc/styles/website.css":"5aa8dfc3c73061bb3f01172057613b623c038c3c3df65be7456711279f71f2dc","src/ast.rs":"7b57f0f50dce443a5ad9445b3642327d4925e5f357582c87bef586fa10e310e6","src/attr.rs":"5d93cd57967cec64ee2b391f872321d720b11af44e69e03458dab5de97f18e7d","src/bound.rs":"a8b8023aa67d38bbc1507ef3b49e7fe88cdebda10b408372c464d568f58b083e","src/clone.rs":"4fbba121e36ee4099a05eca337baa623edc5681112309c00c842515192d871fd","src/cmp.rs":"6f8357d33b19611165c0984024a27970940346244c55915f904d493fbb6bb600","src/debug.rs":"545a3e1e9dc566ee30554265495864e296c406e09f90900f2b46b8f37dabc09b","src/default.rs":"fc3e553a5ed104b5d43b21249c123a555098fb848b88e17815833f3941ad5e38","src/hash.rs":"40add40bef0ea2adfea4e8cf5069fd1f999960af619721ebb59cb4a3370e24fe","src/lib.rs":"c231a611075813609899c708e4b75b83c30311d8bd4a2fda69f713402c593767","src/matcher.rs":"4073f321f2492db552936d625f2b644f8352933f45aefec9a994d327d3f75a68","src/paths.rs":"94e76fdc5e7355c46766420e22fc79be9870f1cc2ecff9b84df3b00bd316bbac","src/utils.rs":"a14bd907e2b39f30e42b19e869a360f45f35bcf69f2c5eec6a237f53b02a24c9","tests/compile-fail/derive-debug.rs":"1cce8f5612cf7502cfaccdde74ae3c1c965795fab0b7586ac3619f3852433846","tests/compile-fail/derive-debug.stderr":"fa07fdfbcb2dd1ffeef63698b69daba7617059433b68596aa295c8dd890be851","tests/compile-fail/derive-partial-ord.rs":"5bc715422b33ecef76151ec5c99b10241fdac32116016f67e0dc64efee7a0e81","tests/compile-fail/derive-partial-ord.stderr":"5ea6bd3d52836b70d91e7bdd72cec08aa5690472a7f908b6234eec5648f74c0e","tests/compile-fail/invalid-attribute.rs":"4fa02ae9be8aefc4d4045aa0c50d30845b4d49b1048063ee5b0db99c3b16d0c1","tests/compile-fail/invalid-attribute.stderr":"593106861246871b34b4da72e2d6ba5c6759b298d87c68ff720a9bc7b2cfa193","tests/compile-fail/unknown-attribute.rs":"a746db58ff8e191b75f8a9c10c2eefc86b0f63b729fc8b140a7dd0b6c138ae2f","tests/compile-fail/unknown-attribute.stderr":"d5b24c84484677b618cea25d6896ac85a709e9ddfe907c30bc12afb443a929a5","tests/compile-fail/unknown-derive.rs":"84a4917e3ce627cc3f91930868e383d5f095730dc226e6c60563f3450b473aa0","tests/compile-fail/unknown-derive.stderr":"6e789593968794358d94f463f605491a79820b6c2de84cd46d4efa7ab01106ac","tests/compile-test.rs":"31c30e57d302f7540d721a3bc8381491ecf5441db4ec57a7fac1399d7e4de770","tests/derive-clone-generics.rs":"475f1d3bd1f3b0e916f9ee9f88ae373e64c9a68297a0d46cfc6c44e981a1a209","tests/derive-clone.rs":"8a2e1724079c7d8455e424ef905019332b2aedc9c974615a652ae011c5f8e511","tests/derive-debug-bounds.rs":"b091c1a8e0365f3f13a9bc527b93d37dddd68c62a0a51c4aa80e80f18f6d1d94","tests/derive-debug-generics.rs":"480172b9006c5e82743b6ddced8d16c0a76e650f7ad48a15206b4812f5e736b3","tests/derive-debug-transparent.rs":"955ec08fa7b72072f02aaf7f0c01e90b2d2e0d5b905bff30e17a872dcbeccbae","tests/derive-debug.rs":"70bcdfe8f755538de0abaea584dd2ecd75ed2b548d6b0213a4a0f4e124dbe29a","tests/derive-default-bounds.rs":"c4444ff95e56cee027f767c06750e5311b94e3b31e7d1048093cc944160920f7","tests/derive-default.rs":"4730ce9cc728124f9f132f222030ea303b215d8710d2f46e0d6dc03f06aa81ba","tests/derive-eq.rs":"eb53df8623d72e2ac4dc7d982f38beeed349120fc55d61321fd186d58ffc2c0d","tests/derive-hash.rs":"2ca685c9b23c0a4ecac7a49a7373c2cbc2ad9b6c3cf11d041ea9d47e734415ee","tests/derive-ord.rs":"4bffd12e1c27afd3eabd605e008eed2d0e887eae17cd16bf6b99d6c685bb88ef","tests/derive-partial-eq.rs":"a4ecac732c498f9c1a2bd30135f30187fb891d5bbb866b8f910a49340a47e498","tests/issue-37-turbofish.rs":"a764c62bac99c8b3cbece751842cecebdb095eda82f1799854a91a45519a79aa","tests/issue-55.rs":"cd9d06c0c89343971459c8564bcaa7d97840e8a62d1e5641b9a2fd6a2502a7be","tests/issue-57.rs":"7aa8e493630af3734167f1d682b82b167337efd2dcb15a799e8aa0f40832ddaa","tests/issue-58.rs":"2564dabadb4a3793a37d0eb574018aca2232b446f80971a6ecf86c34a35cabea","tests/issue-67.rs":"e751ea16cd998b25f6b1c184e1fb3bac851fc5a12c840bcc11f13f2c3aa4f24c","tests/rustc-class-implement-traits.rs":"4298d805de0f80b2f4092471b3c77250d085aee240bd6d8d5c48700ba36b88c0","tests/rustc-deriving-bounds.rs":"5b36074a476b7ecf1819d3c69d869bf938aa167f54732fd1fd8738fbe0610773","tests/rustc-deriving-clone-array.rs":"66c7d2275578f52e5cd9a64fbf43f1d68a52b7eeabd456509dbb430ef180cf3d","tests/rustc-deriving-clone-enum.rs":"44cdb8703c5b7e14a3921867d638065aacbed0ff0772249aaba3806f9b5d57aa","tests/rustc-deriving-clone-generic-enum.rs":"939c754f019026a60f2ef6320a207261400da08cb8a3a90792b34d95ce7b1291","tests/rustc-deriving-clone-generic-tuple-struct.rs":"e88751ff59207c2b67d462af99437479eea90d1f796304c6f8677e7391b09407","tests/rustc-deriving-clone-struct.rs":"c95aa16a2391e8499010e27e6264b7f32ea845405bd0d56eb7e3f39813ece206","tests/rustc-deriving-clone-tuple-struct.rs":"85464fc39ac16fd84d0fc2e47a54a22ebeb01972c0418b7b9c78801efbd22a3c","tests/rustc-deriving-cmp-generic-enum.rs":"6f232696e343f8185ac177bcc66625dc5b3dad23d58fbd264b70be3e29b70726","tests/rustc-deriving-cmp-generic-struct-enum.rs":"b91090b31ee52cb8a07a8393c7a68df0a05ecb4af7d6cce6485c44e102402237","tests/rustc-deriving-cmp-generic-struct.rs":"7d95b78821c7b80da4d76678d7da148ce7575fe0be4c2abb70496c67def06ea7","tests/rustc-deriving-cmp-generic-tuple-struct.rs":"3f61566dd2524d2bc4feabe5605ba4e2f2ebf24fb3d1507bee287e582e96ac6c","tests/rustc-deriving-copyclone.rs":"a8ba84c86dc487650f62a6c31b1ccb13e3b7406cec1b27ea2f07db8acc058a8f","tests/rustc-deriving-default-box.rs":"002f32d294f3e837b2fc98b823248c1131c650b4bbe74ad945c2a6101fa55edf","tests/rustc-deriving-enum-single-variant.rs":"bd3ddd0d1e0244b5632b0292301e8690334b1aff4f4f3d8be1ceaaa96c759e24","tests/rustc-deriving-hash.rs":"cff2f79a233dab9c5bb6ce7fac883b099cd3babed049064e0226787c47674853","tests/rustc-deriving-in-fn.rs":"8cd53d58a22aa1d5b9a7f26b7fb976e0d55dfd23de181d264964e8a29f126a69","tests/rustc-deriving-meta-multiple.rs":"3cef03c23f548b4c48225936c4430e41c04330dfe59bef2bfc6292a3f35b6db3","tests/rustc-deriving-meta.rs":"db3db667ac8533621a13b7a2720db206bc8c81a5fd15217c1dfc5dfa76f1fcc4","tests/rustc-deriving-show-2.rs":"f4cb4dbb327133e90cef784e9ab2591279d06554c7ae0a413a01f6559ee5aa2b","tests/rustc-deriving-show.rs":"198a6c7e12548c45386c14e0a34b00cd41b0457b283eda7ac3d8d4668be9d5ca","tests/rustc-deriving-via-extension-hash-enum.rs":"d3745842c76149ac0dd44afab1b0dd1fda45b8e209fa5b2194bc8ed3f4462369","tests/rustc-deriving-via-extension-hash-struct.rs":"2d42887c49714c0c58a957e95784c6f6ff97fabf8377b4e58ef7b2fb7cf0ea93","tests/rustc-deriving-via-extension-type-params.rs":"c26b31b763b0872b3a11a690e0694a98a1bdc4f305dec05af514f87c2060e62a","tests/rustc-expr-copy.rs":"35c8658a331c1153fc3540125eba9866561ecc9633f82782bd432697a17534c6","tests/rustc-exterior.rs":"cd34d539dae467f27942af90c8007986608f70cfaed020aa8e4ed73b42220ba3","tests/rustc-issue-12860.rs":"4b937ed4c357a019ccd8aea93dd544ae3f40ec7c368fca6312547ac787b10cf4","tests/rustc-issue-13434.rs":"030a2a7d47e53c2153b9b7ef072ba12aa8a6fef0ec511cfcd0c9d09968c41c07","tests/rustc-issue-16530.rs":"4fbe95ca9cffb9dd2b8a60f98ce64996eb8611e2881dcdff4da111563c3eed6d","tests/rustc-issue-19037.rs":"8728e176d24ae0803ef93ef4c81d17a7fd0c7dd84f175a345c6de7ca09c95069","tests/rustc-issue-19102.rs":"7c08c4a3625d585e8f7218b5864912c9d9b02ef81659e601849f22b4bf2fec62","tests/rustc-issue-19135.rs":"537227d0146be2093be0f4641a9860a68bc5e4660ccd30d2e2a10b39794f4c1f","tests/rustc-issue-19358.rs":"38d50e72f619a6a7214094f103ef04cbe4f6fcbf6a11eab7c247a53e60ce3f02","tests/rustc-issue-21402.rs":"842431d5dbcdb72ab20749480f4334a9a63d68357780469fa28755cda4072f80","tests/rustc-issue-23649-3.rs":"dc66e6707881cf01dc8cd499ea5eae989a724885716b94079f869175c3770bf1","tests/rustc-issue-24085.rs":"678c488cceabbc0d8b4991bda976f635908b52e1bcbe77e0b7d399cde39a825d","tests/rustc-issue-25394.rs":"643e7f990acc72eaba9403d515c4762393cdee50398cdc9231c841682717ea5d","tests/rustc-issue-28561.rs":"cd89a6eebfba6a579dab6c1158a31c3e1165f66fea08fbf24dd455570f720066","tests/rustc-issue-29030.rs":"416deb2a9a416e24f7e0a99b5b419c3c7f188a01a9ec6d7e0eac74cc4bc6f970","tests/rustc-issue-29540.rs":"d7b28cf54f8346215ebf909fab1cab9b60aed93d3089d23d7818e557daae9fdb","tests/rustc-issue-29710.rs":"5b6ba4496f31faa4d419975fe0f059bee923a3fb4053315c5a78d512fa5ba2ea","tests/rustc-issue-32292.rs":"e2825020deff6b73bdc51b452a34520b30344cce33efe40242baa599b7999e77","tests/rustc-issue-3935.rs":"1460907d4f5cda59b48a7c1a449b376a0797d7fd14ea4971484705d34c79a0fe","tests/rustc-issue-42453.rs":"a28b83ea4dbe1ae6ea6e4614cf49235f646ff6b8db6c5fa658ad6a34cada5baa","tests/rustc-issue-58319.rs":"47545e8180b3cbfdc45cf2c7d0d810dc0ebdd154fb0fae087ab078d2f2d87ebe","tests/rustc-issue-6341.rs":"7563bdc3556cfbfd15d61911f2bf45ba9e2334316d9939aacbd150b36ad461e1","tests/rustc-typeclasses-eq-example.rs":"726aa79f0291be4842813d87c629b5e528963773d275f6ad4289c6bc75511c9b","tests/rustc-zero-sized-btreemap-insert.rs":"2da53be3a7fe9cb2f66829d2ea798bc4024f1625e52f85d5b3087a3e3bc82fa3"},"package":"cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f"} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/BUILD b/third_party/cargo/vendor/derivative-2.1.1/BUILD new file mode 100644 index 0000000..8972356 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/BUILD @@ -0,0 +1,112 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "MIT,Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "compile-test" with type "test" omitted + +rust_library( + name = "derivative", + crate_root = "src/lib.rs", + crate_type = "proc-macro", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/proc-macro2-1.0.17:proc_macro2", + "//third_party/cargo/vendor/quote-1.0.6:quote", + "//third_party/cargo/vendor/syn-1.0.27:syn", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "2.1.1", + crate_features = [ + "use_core", + ], +) + +# Unsupported target "derive-clone" with type "test" omitted +# Unsupported target "derive-clone-generics" with type "test" omitted +# Unsupported target "derive-debug" with type "test" omitted +# Unsupported target "derive-debug-bounds" with type "test" omitted +# Unsupported target "derive-debug-generics" with type "test" omitted +# Unsupported target "derive-debug-transparent" with type "test" omitted +# Unsupported target "derive-default" with type "test" omitted +# Unsupported target "derive-default-bounds" with type "test" omitted +# Unsupported target "derive-eq" with type "test" omitted +# Unsupported target "derive-hash" with type "test" omitted +# Unsupported target "derive-ord" with type "test" omitted +# Unsupported target "derive-partial-eq" with type "test" omitted +# Unsupported target "issue-37-turbofish" with type "test" omitted +# Unsupported target "issue-55" with type "test" omitted +# Unsupported target "issue-57" with type "test" omitted +# Unsupported target "issue-58" with type "test" omitted +# Unsupported target "issue-67" with type "test" omitted +# Unsupported target "rustc-class-implement-traits" with type "test" omitted +# Unsupported target "rustc-deriving-bounds" with type "test" omitted +# Unsupported target "rustc-deriving-clone-array" with type "test" omitted +# Unsupported target "rustc-deriving-clone-enum" with type "test" omitted +# Unsupported target "rustc-deriving-clone-generic-enum" with type "test" omitted +# Unsupported target "rustc-deriving-clone-generic-tuple-struct" with type "test" omitted +# Unsupported target "rustc-deriving-clone-struct" with type "test" omitted +# Unsupported target "rustc-deriving-clone-tuple-struct" with type "test" omitted +# Unsupported target "rustc-deriving-cmp-generic-enum" with type "test" omitted +# Unsupported target "rustc-deriving-cmp-generic-struct" with type "test" omitted +# Unsupported target "rustc-deriving-cmp-generic-struct-enum" with type "test" omitted +# Unsupported target "rustc-deriving-cmp-generic-tuple-struct" with type "test" omitted +# Unsupported target "rustc-deriving-copyclone" with type "test" omitted +# Unsupported target "rustc-deriving-default-box" with type "test" omitted +# Unsupported target "rustc-deriving-enum-single-variant" with type "test" omitted +# Unsupported target "rustc-deriving-hash" with type "test" omitted +# Unsupported target "rustc-deriving-in-fn" with type "test" omitted +# Unsupported target "rustc-deriving-meta" with type "test" omitted +# Unsupported target "rustc-deriving-meta-multiple" with type "test" omitted +# Unsupported target "rustc-deriving-show" with type "test" omitted +# Unsupported target "rustc-deriving-show-2" with type "test" omitted +# Unsupported target "rustc-deriving-via-extension-hash-enum" with type "test" omitted +# Unsupported target "rustc-deriving-via-extension-hash-struct" with type "test" omitted +# Unsupported target "rustc-deriving-via-extension-type-params" with type "test" omitted +# Unsupported target "rustc-expr-copy" with type "test" omitted +# Unsupported target "rustc-exterior" with type "test" omitted +# Unsupported target "rustc-issue-12860" with type "test" omitted +# Unsupported target "rustc-issue-13434" with type "test" omitted +# Unsupported target "rustc-issue-16530" with type "test" omitted +# Unsupported target "rustc-issue-19037" with type "test" omitted +# Unsupported target "rustc-issue-19102" with type "test" omitted +# Unsupported target "rustc-issue-19135" with type "test" omitted +# Unsupported target "rustc-issue-19358" with type "test" omitted +# Unsupported target "rustc-issue-21402" with type "test" omitted +# Unsupported target "rustc-issue-23649-3" with type "test" omitted +# Unsupported target "rustc-issue-24085" with type "test" omitted +# Unsupported target "rustc-issue-25394" with type "test" omitted +# Unsupported target "rustc-issue-28561" with type "test" omitted +# Unsupported target "rustc-issue-29030" with type "test" omitted +# Unsupported target "rustc-issue-29540" with type "test" omitted +# Unsupported target "rustc-issue-29710" with type "test" omitted +# Unsupported target "rustc-issue-32292" with type "test" omitted +# Unsupported target "rustc-issue-3935" with type "test" omitted +# Unsupported target "rustc-issue-42453" with type "test" omitted +# Unsupported target "rustc-issue-58319" with type "test" omitted +# Unsupported target "rustc-issue-6341" with type "test" omitted +# Unsupported target "rustc-typeclasses-eq-example" with type "test" omitted +# Unsupported target "rustc-zero-sized-btreemap-insert" with type "test" omitted diff --git a/third_party/cargo/vendor/derivative-2.1.1/CHANGELOG.md b/third_party/cargo/vendor/derivative-2.1.1/CHANGELOG.md new file mode 100644 index 0000000..ebd66f6 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/CHANGELOG.md @@ -0,0 +1,60 @@ +# Change Log +All notable changes to this project will be documented in this file. + +## 2.1.1 +* Improve error reporting. ([#70]) +* Fix a Clippy warning in generated code. ([#71]). + +## 2.1.0 +* `feature_allow_slow_enum` is not required anymore on `enum` with `PartialEq`. ([#64]) +* `PartialEq` generates more efficient code for C-like `enum`. ([#65]) +* Fix issue with deriving `Hash` on generic `enums` #68. ([#68]) + +## 2.0.2 +* Fix a bug with `format_with` on `Debug` derives with generic types with trait bounds. + +## 2.0.1 +* Fix a hygiene bug with `Debug`. ([#60]) + +## 2.0.0 +This release should be compatible with version 1.*, but now requires rustc version 1.34 or later. +* Update `syn`, `quote`, and `proc-macro2` dependencies. ([#59]) + +## 1.0.4 +This is the last version to support rustc versions 1.15 to 1.33. + +* Implement `PartialOrd` and `Ord` deriving. + +## 1.0.3 +* Do not require `syn`'s `full` feature anymore. ([#38], [#45]) +* Fix an issue with using `#[derivative(Debug(format_with = "…"))]` on non-generic types. ([#40]) +* Fix some warnings in the library with recent versions of `rustc`. +* Fix some `clippy::pedantic` warnings in generated code. ([#46]) + +## 1.0.2 +* Add `use_core` feature to make `Derivative` usable in `core` crates. + +## 1.0.1 +* Updated `syn` to `0.15`. ([#25]) +* Updated `quote` to `0.6`. ([#25]) + +## 1.0.0 +* Make stable. + +## 0.3.1 +* Fix a warning in `derivative(Debug)`. +* Remove all `feature`s, this makes the crate usable on `beta`. + +[#25]: https://github.com/mcarton/rust-derivative/issues/25 +[#38]: https://github.com/mcarton/rust-derivative/pull/38 +[#40]: https://github.com/mcarton/rust-derivative/pull/40 +[#45]: https://github.com/mcarton/rust-derivative/pull/45 +[#46]: https://github.com/mcarton/rust-derivative/pull/46 +[#59]: https://github.com/mcarton/rust-derivative/pull/59 +[#60]: https://github.com/mcarton/rust-derivative/pull/60 +[#61]: https://github.com/mcarton/rust-derivative/pull/61 +[#64]: https://github.com/mcarton/rust-derivative/pull/64 +[#65]: https://github.com/mcarton/rust-derivative/pull/65 +[#68]: https://github.com/mcarton/rust-derivative/pull/68 +[#70]: https://github.com/mcarton/rust-derivative/pull/70 +[#71]: https://github.com/mcarton/rust-derivative/pull/71 \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/CONTRIBUTING.md b/third_party/cargo/vendor/derivative-2.1.1/CONTRIBUTING.md new file mode 100644 index 0000000..481718d --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/CONTRIBUTING.md @@ -0,0 +1,14 @@ +Contributions are welcome! + +There are several ways you can contribute: + +* Submit ideas and feature requests on the [issue tracker]. +* File bug reports on the [issue tracker]. Include as much details as you can + and, ideally, a self-contained example if you can make one. +* Improve the [documentation]. It consists of markdown files in the [doc](doc) + directory. It uses [gitbook] to generate the website. +* Implement something, fix bugs, etc. You know the deal. + +[documentation]: https://mcarton.github.io/rust-derivative/ +[gitbook]: https://github.com/GitbookIO/gitbook +[issue tracker]: https://github.com/mcarton/rust-derivative/issues diff --git a/third_party/cargo/vendor/derivative-2.1.1/Cargo.toml b/third_party/cargo/vendor/derivative-2.1.1/Cargo.toml new file mode 100644 index 0000000..a15d45a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/Cargo.toml @@ -0,0 +1,45 @@ +# 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 = "derivative" +version = "2.1.1" +authors = ["mcarton "] +description = "A set of alternative `derive` attributes for Rust" +documentation = "https://mcarton.github.io/rust-derivative/" +readme = "README.md" +keywords = ["derive", "macro", "macro1-1", "plugin"] +categories = ["rust-patterns"] +license = "MIT/Apache-2.0" +repository = "https://github.com/mcarton/rust-derivative" + +[lib] +proc-macro = true +[dependencies.proc-macro2] +version = "1.0" + +[dependencies.quote] +version = "1.0" + +[dependencies.syn] +version = "1.0.3" +features = ["visit", "extra-traits"] +[dev-dependencies.trybuild] +version = "1.0.18" + +[features] +use_core = [] +[badges.appveyor] +repository = "mcarton/rust-derivative" + +[badges.travis-ci] +repository = "mcarton/rust-derivative" diff --git a/third_party/cargo/vendor/deflate-0.8.3/LICENSE-APACHE b/third_party/cargo/vendor/derivative-2.1.1/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/deflate-0.8.3/LICENSE-APACHE rename to third_party/cargo/vendor/derivative-2.1.1/LICENSE-APACHE diff --git a/third_party/cargo/vendor/derivative-2.1.1/LICENSE-MIT b/third_party/cargo/vendor/derivative-2.1.1/LICENSE-MIT new file mode 100644 index 0000000..bd77480 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/LICENSE-MIT @@ -0,0 +1,19 @@ +Copyright (c) 2016 Martin Carton + +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/third_party/cargo/vendor/derivative-2.1.1/Makefile b/third_party/cargo/vendor/derivative-2.1.1/Makefile new file mode 100644 index 0000000..001c0ff --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/Makefile @@ -0,0 +1,7 @@ +publish_doc: + ./node_modules/gitbook-cli/bin/gitbook.js build + rm -fr /tmp/_book + git clone --branch gh-pages --single-branch git@github.com:mcarton/rust-derivative.git /tmp/_book + rm -rf /tmp/_book/* + mv _book/* /tmp/_book + cd /tmp/_book; git add .; git com -am Autogenerate; git push -f diff --git a/third_party/cargo/vendor/derivative-2.1.1/README.md b/third_party/cargo/vendor/derivative-2.1.1/README.md new file mode 100644 index 0000000..865fe0d --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/README.md @@ -0,0 +1,56 @@ +# Derivative + +[![Travis](https://travis-ci.org/mcarton/rust-derivative.svg?branch=master)](https://travis-ci.org/mcarton/rust-derivative) +[![Build status](https://ci.appveyor.com/api/projects/status/github/mcarton/rust-derivative?svg=true&branch=master)](https://ci.appveyor.com/project/mcarton/rust-derivative) +[![Crates.io](https://img.shields.io/crates/v/derivative.svg?maxAge=3600)](https://crates.io/crates/derivative) +[![Crates.io](https://img.shields.io/crates/l/derivative.svg?maxAge=3600)](https://github.com/mcarton/rust-derivative#license) + +This crate provides a set of alternative customizable `#[derive]` attributes for Rust. + +## [Documentation][documentation] +## Stability + +This crate is stable and follows semver. It requires *rustc 1.34 or later* and changing the minimal rustc version will be considered a semver breaking change. + +## What it does + +```rust +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: u8, + #[derivative(Debug="ignore")] + bar: u8, +} + +// Prints `Foo { foo: 42 }` +println!("{:?}", Foo { foo: 42, bar: 1 }); +``` + +Check the [documentation] for more! + +## License + +Licensed under either of + * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or + ) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or ) + +at your option. + +## Acknowledgements + +This is inspired from how [`serde`] wonderfully handles attributes. +This also takes some code and ideas from `serde` itself. + +Some tests are directly adapted from `rustc`'s tests. + +## 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. + +[`serde`]: https://crates.io/crates/serde +[documentation]: https://mcarton.github.io/rust-derivative/ +[rustc]: https://github.com/rust-lang/rust diff --git a/third_party/cargo/vendor/derivative-2.1.1/appveyor.yml b/third_party/cargo/vendor/derivative-2.1.1/appveyor.yml new file mode 100644 index 0000000..cbf89de --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/appveyor.yml @@ -0,0 +1,44 @@ +environment: + global: + PROJECT_NAME: rust-derivative + matrix: + # Prioritize 64-bit builds over 32-bit to get clippy checks sooner + - TARGET: x86_64-pc-windows-msvc + - TARGET: x86_64-pc-windows-gnu + MSYS2_BITS: 64 + - TARGET: i686-pc-windows-msvc + - TARGET: i686-pc-windows-gnu + MSYS2_BITS: 32 + +configuration: + - 1.34.0 # Minimum supported version + - stable + - nightly + - beta + +install: + - curl -sSf -o rustup-init.exe https://win.rustup.rs/ + - rustup-init.exe -y --default-host %TARGET% --default-toolchain %CONFIGURATION% + # Some toolchains don't ship clippy, so handle this case to not break the build + - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;C:\Users\appveyor\.rustup\toolchains\%CONFIGURATION%-%TARGET%\bin + - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin + # Only install `clippy` for 64-bit targets; for reasoning see + # + - if not "x%TARGET:x86_64=%" == "x%TARGET%" rustup component add clippy-preview && set HAS_CLIPPY=y || cd . + - rustc -V + - cargo -V + - if defined HAS_CLIPPY cargo clippy -V + +build: false + +test_script: + - cargo build --verbose + - cargo test --verbose + - cargo clean + - cargo test --verbose --features=use_core + - if defined HAS_CLIPPY cargo clippy --verbose --features=use_core + + - if "%CONFIGURATION%" == "nightly" cargo update -Z minimal-versions + - if "%CONFIGURATION%" == "nightly" cargo build --verbose + - if "%CONFIGURATION%" == "nightly" cargo test --verbose + - if "%CONFIGURATION%" == "nightly" cargo test --verbose --features=use_core diff --git a/third_party/cargo/vendor/derivative-2.1.1/book.json b/third_party/cargo/vendor/derivative-2.1.1/book.json new file mode 100644 index 0000000..d356a4f --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/book.json @@ -0,0 +1,12 @@ +{ + "root": "doc", + "title": "Derivative", + "language": "en", + "plugins": ["-search", "-sharing", "codesnippet", "edit-link", "anchors"], + "pluginsConfig": { + "edit-link": { + "base": "https://github.com/mcarton/rust-derivative/tree/master/doc", + "label": "Edit" + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/Clone.md b/third_party/cargo/vendor/derivative-2.1.1/doc/Clone.md new file mode 100644 index 0000000..5dcd503 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/Clone.md @@ -0,0 +1,38 @@ +# Custom attributes + +The `Copy` and `Clone` traits support the following attributes: + +* **Container attributes** + * [`(bound="")`](#custom-bound) + * [`Clone(clone_from="true")`](#clone-from) +* **Field attributes** + * [`(bound="")`](#custom-bound) + +# `clone_from` + +The [`Clone`] trait has a default implementation for [`clone_from`] and +`derive(Clone)` never implements that method. *derivative* can implement it if +asked explicitly. + +Note that while the generated implementation is good for structures, it might +not be very efficient for enumerations. What it does is check if both `self` +and the clone-from value have the same variant, if they have, use `clone_from` +on the members, otherwise fallback to `*self = other.clone();`. Ask yourself if +you really need this. + +# Custom bound +As most other traits, `Copy` and `Debug` support a custom bound on container +and fields. See [`Debug`'s documentation](Debug.md#custom-bound) for more +information. + +# Limitations + +*rustc* can optimize `derive(Clone, Copy)` to generate faster, smaller code. +So does *derivative*. But *rustc* does not know about `derivative(Copy)` and +would not optimize `#[derivative(Copy)] #[derive(Clone)]`. +To avoid that issue, you should avoid deriving `Clone` using *rustc*'s default +`derive` and `Copy` using `derivative`. *derivative* will error if it detects +that, but can't always do it. + +[`Clone`]: https://doc.rust-lang.org/std/clone/trait.Clone.html +[`clone_from`]: https://doc.rust-lang.org/std/clone/trait.Clone.html#method.clone_from diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/Debug.md b/third_party/cargo/vendor/derivative-2.1.1/doc/Debug.md new file mode 100644 index 0000000..cae5286 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/Debug.md @@ -0,0 +1,111 @@ +# Custom attributes +The `Debug` trait supports the following attributes: + +* **Container attributes** + * [`Debug(bound="")`](#custom-bound) + * [`Debug="transparent"`](#hiding-newtypes) +* **Variant attributes** + * [`Debug="transparent"`](#hiding-newtypes) +* **Field attributes** + * [`Debug(bound="")`](#custom-bound) + * [`Debug(format_with="")`](#format-with) + * [`Debug="ignore"`](#ignoring-a-field) + +# Ignoring a field + +You can use *derivative* to hide fields from a structure or enumeration `Debug` +implementation: + +```rust +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: u8, + #[derivative(Debug="ignore")] + bar: u8, +} + +println!("{:?}", Foo { foo: 42, bar: 1 }); // Foo { foo: 42 } +``` + +# Hiding newtypes + +You can use *derivative* to automatically unwrap newtypes and enumeration +variants with only one field: + +```rust +#[derive(Derivative)] +#[derivative(Debug="transparent")] +struct A(isize); + +#[derive(Derivative)] +#[derivative(Debug)] +enum C { + Foo(u8), + #[derivative(Debug="transparent")] + Bar(u8), +} + +println!("{:?}", A(42)); // 42 +println!("{:?}", C::Bar(42)); // 42 + +// But: +println!("{:?}", C::Foo(42)); // Foo(42) +``` + +# Format with + +You can pass a field to a format function: + +```rust +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: u32, + #[derivative(Debug(format_with="path::to::my_fmt_fn"))] + bar: SomeTypeThatMightNotBeDebug, +} +``` + +The field `bar` will be displayed with `path::to::my_fmt_fn(&bar, &mut fmt)` +where `fmt` is the current [`Formatter`]. + +The function must the following prototype: + +```rust +fn fmt(&T, &mut std::fmt::Formatter) -> Result<(), std::fmt::Error>; +``` + +# Custom bound + +Usually, *derivative* will add a `T: Debug` bound for each type parameter `T` +of the current type. If you do not want that, you can specify an explicit bound: + +* Either on the type. This replaces all bounds: + +```rust +#[derive(Derivative)] +#[derivative(Debug(bound="T: Debug, U:MyDebug")] +struct Foo { + foo: T, + #[derivative(Debug(format_with="MyDebug::my_fmt"))] + bar: U, +} +``` + +* Or on a field. This replaces the bound *derivative* guessed for that field. The example below is equivalent to the above: + +```rust +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: T, + #[derivative(Debug(format_with="MyDebug::my_fmt", bound="U: MyDebug"))] + bar: U, +} +``` + +With `bound=""` it is possible to remove any bound for the type. This is useful +if your type contains a `Foo` that is `Debug` even if `T` is not. + +[`Formatter`]: https://doc.rust-lang.org/std/fmt/struct.Formatter.html diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/Default.md b/third_party/cargo/vendor/derivative-2.1.1/doc/Default.md new file mode 100644 index 0000000..9c00e67 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/Default.md @@ -0,0 +1,96 @@ +# Custom attributes +The `Default` trait supports the following attributes: + +* **Container attributes** + * [`Default(bound="")`](#custom-bound) + * [`Default="new"`](#new-function) +* **Variant attributes** + * [`Default`](#default-enumeration) +* **Field attributes** + * [`Default(bound="")`](#custom-bound) + * [`Default(value="")`](#ignoring-a-field) + +# Default enumeration + +You can use *derivative* to derive a default implementation on enumerations! +This does not work with *rustc*'s `#[derive(Default)]`. +All you need is to specify what variant is the default value: + +```rust +#[derive(Debug, Derivative)] +#[derivative(Default)] +enum Enum { + A, + #[derivative(Default)] + B, +} + +println!("{:?}", Enum::default()); // B +``` + +# Setting the value of a field + +You can use *derivative* to change the default value of a field in a `Default` +implementation: + +```rust +#[derive(Debug, Derivative)] +#[derivative(Default)] +struct Foo { + foo: u8, + #[derivative(Default(value="42"))] + bar: u8, +} + +println!("{:?}", Foo::default()); // Foo { foo: 0, bar: 42 } +``` + +# `new` function + +You can use *derivative* to derive a convenience `new` method for your type +that calls `Default::default`: + +```rust +#[derive(Debug, Derivative)] +#[derivative(Default(new="true"))] +struct Foo { + foo: u8, + bar: u8, +} + +println!("{:?}", Foo::new()); // Foo { foo: 0, bar: 0 } +``` + +# Custom bound + +The following does not work because `derive` adds a `T: Default` bound on the +`impl Default for Foo`: + +```rust +#[derive(Default)] +struct Foo { + foo: Option, +} + +struct NonDefault; + +Foo::::default() // gives: +// error: no associated item named `default` found for type `Foo` in the current scope +// = note: the method `default` exists but the following trait bounds were not satisfied: `NonDefault : std::default::Default` +``` + +That bound however is useless as `Option: Default` for any `T`. +`derivative` allows you to explicitly specify a bound if the inferred one is not +correct: + +```rust +#[derive(Derivative)] +#[derivative(Default(bound=""))] // don't need any bound +struct Foo { + foo: Option, +} + +struct NonDefault; + +Foo::::default() // works! +``` diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/Hash.md b/third_party/cargo/vendor/derivative-2.1.1/doc/Hash.md new file mode 100644 index 0000000..534a775 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/Hash.md @@ -0,0 +1,65 @@ +# Custom attributes +The `Hash` trait supports the following attributes: + +* **Container attributes** + * [`Hash(bound="")`](#custom-bound) +* **Field attributes** + * [`Hash(bound="")`](#custom-bound) + * [`Hash(format_with="")`](#hash-with) + * [`Hash="ignore"`](#ignoring-a-field) + +# Ignoring a field + +You can use *derivative* to ignore fields from a `Hash` implementation: + +```rust +#[derive(Derivative)] +#[derivative(Hash)] +struct Foo { + foo: u8, + #[derivative(Hash="ignore")] + bar: i32, +} + +#[derive(Hash)] +struct Bar { + foo: u8, +} + +assert_eq!(hash(Foo { foo: 42, bar: -1337 }), hash(Bar { foo: 42 })); +``` + +# Hash with + +You can pass a field to a hash function: + +```rust +#[derive(Derivative)] +#[derivative(Hash)] +struct Foo { + foo: u32, + #[derivative(Hash(hash_with="path::to::my_hash_fn"))] + bar: SomeTypeThatMightNotBeHash, +} +``` + +The field `bar` will be hashed with `path::to::my_hash_fn(&bar, &mut state)` +where `state` is the current [`Hasher`]. + +The function must the following prototype: + +```rust +fn my_hash_fn(&T, state: &mut H) where H: Hasher; +``` + +# Limitations + +On structure, `derivative(Hash)` will produce the same hash as `derive(Hash)`. +On unions however, it will produces the same hashes *only for unitary +variants*! + +# Custom bound +As most other traits, `Hash` supports a custom bound on container and fields. +See [`Debug`'s documentation](Debug.md#custom-bound) for more information. + +[`Hasher`]: https://doc.rust-lang.org/std/hash/trait.Hasher.html diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/README.md b/third_party/cargo/vendor/derivative-2.1.1/doc/README.md new file mode 100644 index 0000000..16d266b --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/README.md @@ -0,0 +1,42 @@ +# Derivative + +This crate provides a set of alternative `#[derive]` attributes for Rust. + +## Examples + +*derivative* uses attributes to make it possible to derive more implementations +than the built-in `derive(Trait)`. Here are a few examples of stuffs you cannot +just `derive`. + +You can derive `Default` on enumerations: + +| With *derivative* | [Original][default-enum-source] | +|-------------------|---------------------------------| +| {% codesnippet "default-enum.rs" %}{% endcodesnippet %} | {% codesnippet "default-enum-orig.rs" %}{% endcodesnippet %} | + + +You can use different default values for some fields: + +| With *derivative* | [Original][default-value-source] | +|-------------------|---------------------------------| +| {% codesnippet "default-value.rs" %}{% endcodesnippet %} | {% codesnippet "default-value-orig.rs" %}{% endcodesnippet %} | + + +Want a transparent `Debug` implementation for your wrapper? We got that: + +| With *derivative* | [Original][transparent-source] | +|-------------------|---------------------------------| +| {% codesnippet "debug-transparent.rs" %}{% endcodesnippet %} | {% codesnippet "debug-transparent-orig.rs" %}{% endcodesnippet %} | + + +Need to ignore a field? We got that too: + +| With *derivative* | [Original][eq-ignore-source] | +|-------------------|---------------------------------| +| {% codesnippet "eq-ignore.rs" %}{% endcodesnippet %} | {% codesnippet "eq-ignore-orig.rs" %}{% endcodesnippet %} | + + +[default-value-source]: https://github.com/rust-lang-nursery/regex/blob/3cfef1e79d135a3e8a670aff53e7fabef453a3e1/src/re_builder.rs#L12-L39 +[default-enum-source]: https://github.com/rust-lang/rust/blob/16eeeac783d2ede28e09f2a433c612dea309fe33/src/libcore/option.rs#L714-L718 +[transparent-source]: https://github.com/rust-lang/rust/blob/5457c35ece57bbc4a65baff239a02d6abb81c8a2/src/libcore/num/mod.rs#L46-L54 +[eq-ignore-source]: https://github.com/steveklabnik/semver/blob/baa0fbb57c80a7fb344fbeedac24a28439ddf5b5/src/version.rs#L196-L205 diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/SUMMARY.md b/third_party/cargo/vendor/derivative-2.1.1/doc/SUMMARY.md new file mode 100644 index 0000000..591048a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/SUMMARY.md @@ -0,0 +1,25 @@ +# Summary + +* [Overview](README.md) +* [`Copy` and `Clone` traits](Clone.md) + * [`clone_from`](Clone.md#clone-from) + * [Custom bound](Clone.md#custom-bound) +* [`Debug` trait](Debug.md) + * [Hiding fields](Debug.md#ignoring-a-field) + * [Hiding newtypes](Debug.md#hiding-newtypes) + * [Alternative format function](Debug.md#format-with) + * [Custom bound](Debug.md#custom-bound) +* [`Default` trait](Default.md) + * [Default enumeration](Default.md#default-enumeration) + * [Setting the value of a field](Default.md#setting-the-value-of-a-field) + * [`new` function](Default.md#new-function) + * [Custom bound](Default.md#custom-bound) +* [`Hash` trait](Hash.md) + * [Ignoring fields](Hash.md#ignoring-a-field) + * [Alternative hash function](Debug.md#hash-with) + * [Custom bound](Hash.md#custom-bound) +* [Comparison traits](cmp.md) + * [Note about enumerations](cmp.md#enumerations) + * [Ignoring fields](cmp.md#ignoring-a-field) + * [Alternative comparison function](cmp.md#compare-with) + * [Custom bound](cmp.md#custom-bound) diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/cmp.md b/third_party/cargo/vendor/derivative-2.1.1/doc/cmp.md new file mode 100644 index 0000000..807499e --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/cmp.md @@ -0,0 +1,93 @@ +# Custom attributes +The `PartialEq`, `Eq`, `PartialOrd` and `Eq` and traits support the following attributes: + +* **Container attributes** + * [`(bound="")`](#custom-bound) +* **Field attributes** + * [`(bound="")`](#custom-bound) + +The `PartialEq`, `PartialOrd` and `Ord` traits also supports the following attributes: + +* **Container attributes** + * [`="feature_allow_slow_enum"`](#enumerations) +* **Field attributes** + * [`="ignore"`](#ignoring-a-field) + * [`(compare_with="")`](#compare-with) + +(These attributes are not relevant for `Eq` which is just a marker trait.) + +# Enumerations + +Unfortunately, there is no way for derivative to derive `PartialOrd` or `Ord` on +enumerations as efficiently as the built-in `derive(…)` yet. + +If you want to use derivative on enumerations anyway, you can add + +```rust +#[derivative(PartialOrd="feature_allow_slow_enum")] +``` + +to your enumeration. This acts as a “feature-gate”. + +This attribute is also allowed for `PartialEq` for historical reason. It is not +necessary anymore as of v2.1.0. It was never necessary nor allowed for `Eq`. + +# Ignoring a field + +You can use *derivative* to ignore a field when comparing: + +```rust +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Foo { + foo: u8, + #[derivative(PartialEq="ignore")] + bar: u8, +} + +assert!(Foo { foo: 0, bar: 42 } == Foo { foo: 0, bar: 7}); +assert!(Foo { foo: 42, bar: 0 } != Foo { foo: 7, bar: 0}); +``` + +# Compare with + +Usually fields are compared using `==`, `PartialOrd::partial_cmp` or `Ord::cmp`. You can use an alternative comparison +function if you like: + +```rust +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Foo { + foo: u32, + #[derivative(PartialEq(compare_with="path::to::my_cmp_fn"))] + bar: SomeTypeThatMightNotBePartialEq, +} +``` + +`foo` will be compared with `==` and `bar` will be compared with +`path::to::my_cmp_fn` which must have the following prototype: + +| Trait | Signature | +|--------------|-----------| +| `PartialEq` | `fn my_cmp_fn(&T, &T) -> bool;` +| `PartialOrd` | `fn my_cmp_fn(&T, &T) -> std::option::Option;` +| `Ord` | `fn my_cmp_fn(&T, &T) -> std::cmp::Ordering;` + +# Custom bound + +Usually if you derive `CmpTrait`, a `T: CmpTrait` bound is added for each type parameter `T`. You can use +override this behavior if the inferred bound is not correct for you. + +Eg. comparing raw pointers does not require the type to be `Eq`, so you could +use: + +```rust +#[derive(Derivative)] +#[derivative(Eq)] +struct WithPtr { + #[derivative(Eq(bound=""))] + foo: *const T +} +``` + +See [`Default`'s documentation](./Default.md#custom-bound) for more details. diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent-orig.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent-orig.rs new file mode 100644 index 0000000..df41c89 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent-orig.rs @@ -0,0 +1,7 @@ +pub struct Wrapping(pub T); + +impl fmt::Debug for Wrapping { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.0.fmt(f) + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent.rs new file mode 100644 index 0000000..2c1628c --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/debug-transparent.rs @@ -0,0 +1,3 @@ +#[derive(Derivative)] +#[derivative(Debug="transparent")] +pub struct Wrapping(pub T); diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/default-enum-orig.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/default-enum-orig.rs new file mode 100644 index 0000000..7d5b126 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/default-enum-orig.rs @@ -0,0 +1,14 @@ +pub enum Option { + /// No value + None, + /// Some value `T` + Some(T), +} + +impl Default for Option { + /// Returns None. + #[inline] + fn default() -> Option { + None + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/default-enum.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/default-enum.rs new file mode 100644 index 0000000..51f10f5 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/default-enum.rs @@ -0,0 +1,9 @@ +#[derive(Derivative)] +#[derivative(Default(bound=""))] +pub enum Option { + #[derivative(Default)] + /// No value + None, + /// Some value `T` + Some(T), +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/default-value-orig.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/default-value-orig.rs new file mode 100644 index 0000000..2c21169 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/default-value-orig.rs @@ -0,0 +1,28 @@ +#[derive(Default)] +pub struct RegexOptions { + pub pats: Vec<String>, + pub size_limit: usize, + pub dfa_size_limit: usize, + pub case_insensitive: bool, + pub multi_line: bool, + pub dot_matches_new_line: bool, + pub swap_greed: bool, + pub ignore_whitespace: bool, + pub unicode: bool, +} + +impl Default for RegexOptions { + fn default() -> Self { + RegexOptions { + pats: vec![], + size_limit: 10 * (1<<20), + dfa_size_limit: 2 * (1<<20), + case_insensitive: false, + multi_line: false, + dot_matches_new_line: false, + swap_greed: false, + ignore_whitespace: false, + unicode: true, + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/default-value.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/default-value.rs new file mode 100644 index 0000000..d4fdcb1 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/default-value.rs @@ -0,0 +1,16 @@ +#[derive(Derivative)] +#[derivative(Default)] +pub struct RegexOptions { + pub pats: Vec<String>, + #[derivative(Default(value="10 * (1<<20)"))] + pub size_limit: usize, + #[derivative(Default(value="2 * (1<<20)"))] + pub dfa_size_limit: usize, + pub case_insensitive: bool, + pub multi_line: bool, + pub dot_matches_new_line: bool, + pub swap_greed: bool, + pub ignore_whitespace: bool, + #[derivative(Default(value="true"))] + pub unicode: bool, +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore-orig.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore-orig.rs new file mode 100644 index 0000000..c54a6b4 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore-orig.rs @@ -0,0 +1,37 @@ +pub struct Version { + /// The major version. + pub major: u64, + /// The minor version. + pub minor: u64, + /// The patch version. + pub patch: u64, + /// The pre-release version identifier. + pub pre: Vec, + /// The build metadata, ignored when + /// determining version precedence. + pub build: Vec, +} + +impl cmp::PartialEq for Version { + #[inline] + fn eq(&self, other: &Version) -> bool { + // We should ignore build metadata + // here, otherwise versions v1 and + // v2 can exist such that !(v1 < v2) + // && !(v1 > v2) && v1 != v2, which + // violate strict total ordering rules. + self.major == other.major && + self.minor == other.minor && + self.patch == other.patch && + self.pre == other.pre + } +} + +impl hash::Hash for Version { + fn hash(&self, into: &mut H) { + self.major.hash(into); + self.minor.hash(into); + self.patch.hash(into); + self.pre.hash(into); + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore.rs b/third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore.rs new file mode 100644 index 0000000..61eb24d --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/eq-ignore.rs @@ -0,0 +1,22 @@ +#[derive(Derivative)] +#[derivative(PartialEq, Hash)] +pub struct Version { + /// The major version. + pub major: u64, + /// The minor version. + pub minor: u64, + /// The patch version. + pub patch: u64, + /// The pre-release version identifier. + pub pre: Vec, + // We should ignore build metadata + // here, otherwise versions v1 and + // v2 can exist such that !(v1 < v2) + // && !(v1 > v2) && v1 != v2, which + // violate strict total ordering rules. + #[derivative(PartialEq="ignore")] + #[derivative(Hash="ignore")] + /// The build metadata, ignored when + /// determining version precedence. + pub build: Vec, +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/doc/styles/website.css b/third_party/cargo/vendor/derivative-2.1.1/doc/styles/website.css new file mode 100644 index 0000000..55351de --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/doc/styles/website.css @@ -0,0 +1,11 @@ +code .hljs-meta { + color: #969896 +} + +code .hljs-meta-string { + color: #183691 +} + +code .hljs-title { + color: #a71d5d !important +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/ast.rs b/third_party/cargo/vendor/derivative-2.1.1/src/ast.rs new file mode 100644 index 0000000..2c31ab6 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/ast.rs @@ -0,0 +1,153 @@ +use attr; +use proc_macro2; +use syn; +use syn::spanned::Spanned as SynSpanned; + +#[derive(Debug)] +pub struct Input<'a> { + pub attrs: attr::Input, + pub body: Body<'a>, + pub generics: &'a syn::Generics, + pub ident: syn::Ident, + pub span: proc_macro2::Span, +} + +#[derive(Debug)] +pub enum Body<'a> { + Enum(Vec>), + Struct(Style, Vec>), +} + +#[derive(Debug)] +pub struct Variant<'a> { + pub attrs: attr::Input, + pub fields: Vec>, + pub ident: syn::Ident, + pub style: Style, +} + +#[derive(Debug)] +pub struct Field<'a> { + pub attrs: attr::Field, + pub ident: Option, + pub ty: &'a syn::Type, + pub span: proc_macro2::Span, +} + +#[derive(Clone, Copy, Debug)] +pub enum Style { + Struct, + Tuple, + Unit, +} + +impl<'a> Input<'a> { + pub fn from_ast( + item: &'a syn::DeriveInput, + errors: &mut proc_macro2::TokenStream, + ) -> Result, ()> { + let attrs = attr::Input::from_ast(&item.attrs, errors)?; + + let body = match item.data { + syn::Data::Enum(syn::DataEnum { ref variants, .. }) => { + Body::Enum(enum_from_ast(variants, errors)?) + } + syn::Data::Struct(syn::DataStruct { ref fields, .. }) => { + let (style, fields) = struct_from_ast(fields, errors)?; + Body::Struct(style, fields) + } + syn::Data::Union(..) => { + errors.extend( + syn::Error::new_spanned(item, "derivative does not support unions") + .to_compile_error() + ); + return Err(()); + } + }; + + Ok(Input { + attrs, + body, + generics: &item.generics, + ident: item.ident.clone(), + span: item.span(), + }) + } + + /// Checks whether this type is an enum with only unit variants. + pub fn is_trivial_enum(&self) -> bool { + match &self.body { + Body::Enum(e) => e.iter().all(|v| v.is_unit()), + Body::Struct(..) => false, + } + } +} + +impl<'a> Body<'a> { + pub fn all_fields(&self) -> Vec<&Field> { + match *self { + Body::Enum(ref variants) => variants + .iter() + .flat_map(|variant| variant.fields.iter()) + .collect(), + Body::Struct(_, ref fields) => fields.iter().collect(), + } + } +} + +impl<'a> Variant<'a> { + /// Checks whether this variant is a unit variant. + pub fn is_unit(&self) -> bool { + self.fields.is_empty() + } +} + +fn enum_from_ast<'a>( + variants: &'a syn::punctuated::Punctuated, + errors: &mut proc_macro2::TokenStream, +) -> Result>, ()> { + variants + .iter() + .map(|variant| { + let (style, fields) = struct_from_ast(&variant.fields, errors)?; + Ok(Variant { + attrs: attr::Input::from_ast(&variant.attrs, errors)?, + fields, + ident: variant.ident.clone(), + style, + }) + }) + .collect() +} + +fn struct_from_ast<'a>( + fields: &'a syn::Fields, + errors: &mut proc_macro2::TokenStream, +) -> Result<(Style, Vec>), ()> { + match *fields { + syn::Fields::Named(ref fields) => { + Ok((Style::Struct, fields_from_ast(&fields.named, errors)?)) + } + syn::Fields::Unnamed(ref fields) => { + Ok((Style::Tuple, fields_from_ast(&fields.unnamed, errors)?)) + } + syn::Fields::Unit => Ok((Style::Unit, Vec::new())), + } +} + +fn fields_from_ast<'a>( + fields: &'a syn::punctuated::Punctuated, + errors: &mut proc_macro2::TokenStream, +) -> Result>, ()> { + fields + .iter() + .map(|field| { + Ok(Field { + attrs: attr::Field::from_ast(field, errors)?, + ident: field.ident.clone(), + ty: &field.ty, + span: field.span(), + }) + }) + .collect() +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/attr.rs b/third_party/cargo/vendor/derivative-2.1.1/src/attr.rs new file mode 100644 index 0000000..d77560a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/attr.rs @@ -0,0 +1,873 @@ +use proc_macro2; +use syn; +use syn::spanned::Spanned; + +/// Represent the `derivative` attributes on the input type (`struct`/`enum`). +#[derive(Debug, Default)] +pub struct Input { + /// Whether `Clone` is present and its specific attributes. + pub clone: Option, + /// Whether `Copy` is present and its specific attributes. + pub copy: Option, + /// Whether `Debug` is present and its specific attributes. + pub debug: Option, + /// Whether `Default` is present and its specific attributes. + pub default: Option, + /// Whether `Eq` is present and its specific attributes. + pub eq: Option, + /// Whether `Hash` is present and its specific attributes. + pub hash: Option, + /// Whether `PartialEq` is present and its specific attributes. + pub partial_eq: Option, + /// Whether `PartialOrd` is present and its specific attributes. + pub partial_ord: Option, + /// Whether `Ord` is present and its specific attributes. + pub ord: Option, +} + +#[derive(Debug, Default)] +/// Represent the `derivative` attributes on a field. +pub struct Field { + /// The parameters for `Clone`. + clone: FieldClone, + /// The parameters for `Copy`. + copy_bound: Option>, + /// The parameters for `Debug`. + debug: FieldDebug, + /// The parameters for `Default`. + default: FieldDefault, + /// The parameters for `Eq`. + eq_bound: Option>, + /// The parameters for `Hash`. + hash: FieldHash, + /// The parameters for `PartialEq`. + partial_eq: FieldPartialEq, + /// The parameters for `PartialOrd`. + partial_ord: FieldPartialOrd, + /// The parameters for `Ord`. + ord: FieldOrd, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Clone(…))` attributes on an input. +pub struct InputClone { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// Whether the implementation should have an explicit `clone_from`. + pub clone_from: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Clone(…))` attributes on an input. +pub struct InputCopy { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Debug(…))` attributes on an input. +pub struct InputDebug { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// Whether the type is marked `transparent`. + pub transparent: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Default(…))` attributes on an input. +pub struct InputDefault { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// Whether the type is marked with `new`. + pub new: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Eq(…))` attributes on an input. +pub struct InputEq { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Hash(…))` attributes on an input. +pub struct InputHash { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(PartialEq(…))` attributes on an input. +pub struct InputPartialEq { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(PartialOrd(…))` attributes on an input. +pub struct InputPartialOrd { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// Allow `derivative(PartialOrd)` on enums: + on_enum: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Ord(…))` attributes on an input. +pub struct InputOrd { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// Allow `derivative(Ord)` on enums: + on_enum: bool, +} + +#[derive(Debug, Default)] +/// Represents the `derivative(Clone(…))` attributes on a field. +pub struct FieldClone { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The `clone_with` attribute if present and the path to the cloning function. + clone_with: Option, +} + +#[derive(Debug, Default)] +/// Represents the `derivative(Debug(…))` attributes on a field. +pub struct FieldDebug { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The `format_with` attribute if present and the path to the formatting function. + format_with: Option, + /// Whether the field is to be ignored from output. + ignore: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Default(…))` attributes on a field. +pub struct FieldDefault { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The default value for the field if present. + pub value: Option, +} + +#[derive(Debug, Default)] +/// Represents the `derivative(Hash(…))` attributes on a field. +pub struct FieldHash { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The `hash_with` attribute if present and the path to the hashing function. + hash_with: Option, + /// Whether the field is to be ignored when hashing. + ignore: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(PartialEq(…))` attributes on a field. +pub struct FieldPartialEq { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The `compare_with` attribute if present and the path to the comparison function. + compare_with: Option, + /// Whether the field is to be ignored when comparing. + ignore: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(PartialOrd(…))` attributes on a field. +pub struct FieldPartialOrd { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The `compare_with` attribute if present and the path to the comparison function. + compare_with: Option, + /// Whether the field is to be ignored when comparing. + ignore: bool, +} + +#[derive(Debug, Default)] +/// Represent the `derivative(Ord(…))` attributes on a field. +pub struct FieldOrd { + /// The `bound` attribute if present and the corresponding bounds. + bounds: Option>, + /// The `compare_with` attribute if present and the path to the comparison function. + compare_with: Option, + /// Whether the field is to be ignored when comparing. + ignore: bool, +} + +macro_rules! for_all_attr { + ($errors:ident; for ($name:ident, $value:ident) in $attrs:expr; $($body:tt)*) => { + for meta_items in $attrs.iter() { + let meta_items = derivative_attribute(meta_items.parse_meta(), $errors); + if let Some(meta_items) = meta_items { + for meta_item in meta_items.iter() { + let meta_item = read_items(meta_item, $errors); + let MetaItem($name, $value) = try!(meta_item); + match $name.to_string().as_ref() { + $($body)* + } + } + } + } + }; +} + +macro_rules! match_attributes { + ($errors:ident for $trait:expr; let Some($name:ident) = $unwrapped:expr; for $value:ident in $values:expr; $($body:tt)* ) => { + let mut $name = $unwrapped.take().unwrap_or_default(); + + match_attributes! { + $errors for $trait; + for $value in $values; + $($body)* + } + + $unwrapped = Some($name); + }; + + ($errors:ident for $trait:expr; for $value:ident in $values:expr; $($body:tt)* ) => { + for (name, $value) in $values { + match name { + Some(ident) => { + match ident.to_string().as_ref() { + $($body)* + unknown => { + let message = format!("Unknown attribute `{}` for trait `{}`", unknown, $trait); + $errors.extend(quote_spanned! {ident.span()=> + compile_error!(#message); + }); + } + } + } + None => { + let value = $value.expect("Expected value to be passed"); + match value.value().as_ref() { + $($body)* + unknown => { + let message = format!("Unknown attribute `{}` for trait `{}`", unknown, $trait); + let span = value.span(); + $errors.extend(quote_spanned! {span=> + compile_error!(#message); + }); + } + } + } + } + } + }; +} + +impl Input { + /// Parse the `derivative` attributes on a type. + #[allow(clippy::cognitive_complexity)] // mostly macros + pub fn from_ast( + attrs: &[syn::Attribute], + errors: &mut proc_macro2::TokenStream, + ) -> Result { + let mut input = Input::default(); + + for_all_attr! { + errors; + for (name, values) in attrs; + "Clone" => { + match_attributes! { + errors for "Clone"; + let Some(clone) = input.clone; + for value in values; + "bound" => parse_bound(&mut clone.bounds, value, errors), + "clone_from" => { + clone.clone_from = parse_boolean_meta_item(value, true, "clone_from", errors); + } + } + } + "Copy" => { + match_attributes! { + errors for "Copy"; + let Some(copy) = input.copy; + for value in values; + "bound" => parse_bound(&mut copy.bounds, value, errors), + } + } + "Debug" => { + match_attributes! { + errors for "Debug"; + let Some(debug) = input.debug; + for value in values; + "bound" => parse_bound(&mut debug.bounds, value, errors), + "transparent" => { + debug.transparent = parse_boolean_meta_item(value, true, "transparent", errors); + } + } + } + "Default" => { + match_attributes! { + errors for "Default"; + let Some(default) = input.default; + for value in values; + "bound" => parse_bound(&mut default.bounds, value, errors), + "new" => { + default.new = parse_boolean_meta_item(value, true, "new", errors); + } + } + } + "Eq" => { + match_attributes! { + errors for "Eq"; + let Some(eq) = input.eq; + for value in values; + "bound" => parse_bound(&mut eq.bounds, value, errors), + } + } + "Hash" => { + match_attributes! { + errors for "Hash"; + let Some(hash) = input.hash; + for value in values; + "bound" => parse_bound(&mut hash.bounds, value, errors), + } + } + "PartialEq" => { + match_attributes! { + errors for "PartialEq"; + let Some(partial_eq) = input.partial_eq; + for value in values; + "bound" => parse_bound(&mut partial_eq.bounds, value, errors), + "feature_allow_slow_enum" => (), // backward compatibility, now unnecessary + } + } + "PartialOrd" => { + match_attributes! { + errors for "PartialOrd"; + let Some(partial_ord) = input.partial_ord; + for value in values; + "bound" => parse_bound(&mut partial_ord.bounds, value, errors), + "feature_allow_slow_enum" => { + partial_ord.on_enum = parse_boolean_meta_item(value, true, "feature_allow_slow_enum", errors); + } + } + } + "Ord" => { + match_attributes! { + errors for "Ord"; + let Some(ord) = input.ord; + for value in values; + "bound" => parse_bound(&mut ord.bounds, value, errors), + "feature_allow_slow_enum" => { + ord.on_enum = parse_boolean_meta_item(value, true, "feature_allow_slow_enum", errors); + } + } + } + unknown => { + let message = format!("deriving `{}` is not supported by derivative", unknown); + errors.extend(quote_spanned! {name.span()=> + compile_error!(#message); + }); + } + } + + Ok(input) + } + + pub fn clone_bound(&self) -> Option<&[syn::WherePredicate]> { + self.clone + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn clone_from(&self) -> bool { + self.clone.as_ref().map_or(false, |d| d.clone_from) + } + + pub fn copy_bound(&self) -> Option<&[syn::WherePredicate]> { + self.copy + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn debug_bound(&self) -> Option<&[syn::WherePredicate]> { + self.debug + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn debug_transparent(&self) -> bool { + self.debug.as_ref().map_or(false, |d| d.transparent) + } + + pub fn default_bound(&self) -> Option<&[syn::WherePredicate]> { + self.default + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn eq_bound(&self) -> Option<&[syn::WherePredicate]> { + self.eq + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn hash_bound(&self) -> Option<&[syn::WherePredicate]> { + self.hash + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn partial_eq_bound(&self) -> Option<&[syn::WherePredicate]> { + self.partial_eq + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn partial_ord_bound(&self) -> Option<&[syn::WherePredicate]> { + self.partial_ord + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn ord_bound(&self) -> Option<&[syn::WherePredicate]> { + self.ord + .as_ref() + .and_then(|d| d.bounds.as_ref().map(Vec::as_slice)) + } + + pub fn partial_ord_on_enum(&self) -> bool { + self.partial_ord.as_ref().map_or(false, |d| d.on_enum) + } + + pub fn ord_on_enum(&self) -> bool { + self.ord.as_ref().map_or(false, |d| d.on_enum) + } +} + +impl Field { + /// Parse the `derivative` attributes on a type. + #[allow(clippy::cognitive_complexity)] // mostly macros + pub fn from_ast( + field: &syn::Field, + errors: &mut proc_macro2::TokenStream, + ) -> Result { + let mut out = Field::default(); + + for_all_attr! { + errors; + for (name, values) in field.attrs; + "Clone" => { + match_attributes! { + errors for "Clone"; + for value in values; + "bound" => parse_bound(&mut out.clone.bounds, value, errors), + "clone_with" => { + let path = value.expect("`clone_with` needs a value"); + out.clone.clone_with = parse_str_lit(&path, errors).ok(); + } + } + } + "Debug" => { + match_attributes! { + errors for "Debug"; + for value in values; + "bound" => parse_bound(&mut out.debug.bounds, value, errors), + "format_with" => { + let path = value.expect("`format_with` needs a value"); + out.debug.format_with = parse_str_lit(&path, errors).ok(); + } + "ignore" => { + out.debug.ignore = parse_boolean_meta_item(value, true, "ignore", errors); + } + } + } + "Default" => { + match_attributes! { + errors for "Default"; + for value in values; + "bound" => parse_bound(&mut out.default.bounds, value, errors), + "value" => { + let value = value.expect("`value` needs a value"); + out.default.value = parse_str_lit(&value, errors).ok(); + } + } + } + "Eq" => { + match_attributes! { + errors for "Eq"; + for value in values; + "bound" => parse_bound(&mut out.eq_bound, value, errors), + } + } + "Hash" => { + match_attributes! { + errors for "Hash"; + for value in values; + "bound" => parse_bound(&mut out.hash.bounds, value, errors), + "hash_with" => { + let path = value.expect("`hash_with` needs a value"); + out.hash.hash_with = parse_str_lit(&path, errors).ok(); + } + "ignore" => { + out.hash.ignore = parse_boolean_meta_item(value, true, "ignore", errors); + } + } + } + "PartialEq" => { + match_attributes! { + errors for "PartialEq"; + for value in values; + "bound" => parse_bound(&mut out.partial_eq.bounds, value, errors), + "compare_with" => { + let path = value.expect("`compare_with` needs a value"); + out.partial_eq.compare_with = parse_str_lit(&path, errors).ok(); + } + "ignore" => { + out.partial_eq.ignore = parse_boolean_meta_item(value, true, "ignore", errors); + } + } + } + "PartialOrd" => { + match_attributes! { + errors for "PartialOrd"; + for value in values; + "bound" => parse_bound(&mut out.partial_ord.bounds, value, errors), + "compare_with" => { + let path = value.expect("`compare_with` needs a value"); + out.partial_ord.compare_with = parse_str_lit(&path, errors).ok(); + } + "ignore" => { + out.partial_ord.ignore = parse_boolean_meta_item(value, true, "ignore", errors); + } + } + } + "Ord" => { + match_attributes! { + errors for "Ord"; + for value in values; + "bound" => parse_bound(&mut out.ord.bounds, value, errors), + "compare_with" => { + let path = value.expect("`compare_with` needs a value"); + out.ord.compare_with = parse_str_lit(&path, errors).ok(); + } + "ignore" => { + out.ord.ignore = parse_boolean_meta_item(value, true, "ignore", errors); + } + } + } + unknown => { + let message = format!("deriving `{}` is not supported by derivative", unknown); + errors.extend(quote_spanned! {name.span()=> + compile_error!(#message); + }); + } + } + + Ok(out) + } + + pub fn clone_bound(&self) -> Option<&[syn::WherePredicate]> { + self.clone.bounds.as_ref().map(Vec::as_slice) + } + + pub fn clone_with(&self) -> Option<&syn::Path> { + self.clone.clone_with.as_ref() + } + + pub fn copy_bound(&self) -> Option<&[syn::WherePredicate]> { + self.copy_bound.as_ref().map(Vec::as_slice) + } + + pub fn debug_bound(&self) -> Option<&[syn::WherePredicate]> { + self.debug.bounds.as_ref().map(Vec::as_slice) + } + + pub fn debug_format_with(&self) -> Option<&syn::Path> { + self.debug.format_with.as_ref() + } + + pub fn ignore_debug(&self) -> bool { + self.debug.ignore + } + + pub fn ignore_hash(&self) -> bool { + self.hash.ignore + } + + pub fn default_bound(&self) -> Option<&[syn::WherePredicate]> { + self.default.bounds.as_ref().map(Vec::as_slice) + } + + pub fn default_value(&self) -> Option<&proc_macro2::TokenStream> { + self.default.value.as_ref() + } + + pub fn eq_bound(&self) -> Option<&[syn::WherePredicate]> { + self.eq_bound.as_ref().map(Vec::as_slice) + } + + pub fn hash_bound(&self) -> Option<&[syn::WherePredicate]> { + self.hash.bounds.as_ref().map(Vec::as_slice) + } + + pub fn hash_with(&self) -> Option<&syn::Path> { + self.hash.hash_with.as_ref() + } + + pub fn partial_eq_bound(&self) -> Option<&[syn::WherePredicate]> { + self.partial_eq.bounds.as_ref().map(Vec::as_slice) + } + + pub fn partial_ord_bound(&self) -> Option<&[syn::WherePredicate]> { + self.partial_ord.bounds.as_ref().map(Vec::as_slice) + } + + pub fn ord_bound(&self) -> Option<&[syn::WherePredicate]> { + self.ord.bounds.as_ref().map(Vec::as_slice) + } + + pub fn partial_eq_compare_with(&self) -> Option<&syn::Path> { + self.partial_eq.compare_with.as_ref() + } + + pub fn partial_ord_compare_with(&self) -> Option<&syn::Path> { + self.partial_ord.compare_with.as_ref() + } + + pub fn ord_compare_with(&self) -> Option<&syn::Path> { + self.ord.compare_with.as_ref() + } + + pub fn ignore_partial_eq(&self) -> bool { + self.partial_eq.ignore + } + + pub fn ignore_partial_ord(&self) -> bool { + self.partial_ord.ignore + } + + pub fn ignore_ord(&self) -> bool { + self.ord.ignore + } +} + +/// Represent an attribute. +/// +/// We only have a limited set of possible attributes: +/// +/// * `#[derivative(Debug)]` is represented as `(Debug, [])`; +/// * `#[derivative(Debug="foo")]` is represented as `(Debug, [(None, Some("foo"))])`; +/// * `#[derivative(Debug(foo="bar")]` is represented as `(Debug, [(Some(foo), Some("bar"))])`. +struct MetaItem<'a>( + &'a syn::Ident, + Vec<(Option<&'a syn::Ident>, Option<&'a syn::LitStr>)>, +); + +/// Parse an arbitrary item for our limited `MetaItem` subset. +fn read_items<'a>(item: &'a syn::NestedMeta, errors: &mut proc_macro2::TokenStream) -> Result, ()> { + let item = match *item { + syn::NestedMeta::Meta(ref item) => item, + syn::NestedMeta::Lit(ref lit) => { + errors.extend(quote_spanned! {lit.span()=> + compile_error!("expected meta-item but found literal"); + }); + + return Err(()); + } + }; + match *item { + syn::Meta::Path(ref path) => match path.get_ident() { + Some(name) => Ok(MetaItem(name, Vec::new())), + None => { + errors.extend(quote_spanned! {path.span()=> + compile_error!("expected derivative attribute to be a string, but found a path"); + }); + + Err(()) + } + }, + syn::Meta::List(syn::MetaList { + ref path, + nested: ref values, + .. + }) => { + let values = values + .iter() + .map(|value| { + if let syn::NestedMeta::Meta(syn::Meta::NameValue(syn::MetaNameValue { + ref path, + lit: ref value, + .. + })) = *value + { + let (name, value) = ensure_str_lit(&path, &value, errors)?; + + Ok((Some(name), Some(value))) + } else { + errors.extend(quote_spanned! {value.span()=> + compile_error!("expected named value"); + }); + + Err(()) + } + }) + .collect::>()?; + + let name = match path.get_ident() { + Some(name) => name, + None => { + errors.extend(quote_spanned! {path.span()=> + compile_error!("expected derivative attribute to be a string, but found a path"); + }); + + return Err(()); + } + }; + + Ok(MetaItem(name, values)) + } + syn::Meta::NameValue(syn::MetaNameValue { + ref path, + lit: ref value, + .. + }) => { + let (name, value) = ensure_str_lit(&path, &value, errors)?; + + Ok(MetaItem(name, vec![(None, Some(value))])) + } + } +} + +/// Filter the `derivative` items from an attribute. +fn derivative_attribute( + meta: syn::parse::Result, + errors: &mut proc_macro2::TokenStream, +) -> Option> { + match meta { + Ok(syn::Meta::List(syn::MetaList { + path, nested: mis, .. + })) => { + if path + .get_ident() + .map_or(false, |ident| ident == "derivative") + { + Some(mis) + } else { + None + } + } + Ok(_) => None, + Err(e) => { + let message = format!("invalid attribute: {}", e); + errors.extend(quote_spanned! {e.span()=> + compile_error!(#message); + }); + + None + } + } +} + +/// Parse an item value as a boolean. Accepted values are the string literal `"true"` and +/// `"false"`. The `default` parameter specifies what the value of the boolean is when only its +/// name is specified (eg. `Debug="ignore"` is equivalent to `Debug(ignore="true")`). The `name` +/// parameter is used for error reporting. +fn parse_boolean_meta_item( + item: Option<&syn::LitStr>, + default: bool, + name: &str, + errors: &mut proc_macro2::TokenStream, +) -> bool { + if let Some(item) = item.as_ref() { + match item.value().as_ref() { + "true" => true, + "false" => false, + val => { + if val == name { + true + } else { + let message = format!( + r#"expected `"true"` or `"false"` for `{}`, got `{}`"#, + name, val + ); + errors.extend(quote_spanned! {item.span()=> + compile_error!(#message); + }); + + default + } + } + } + } else { + default + } +} + +/// Parse a `bound` item. +fn parse_bound( + opt_bounds: &mut Option>, + value: Option<&syn::LitStr>, + errors: &mut proc_macro2::TokenStream, +) { + let bound = value.expect("`bound` needs a value"); + let bound_value = bound.value(); + + *opt_bounds = if !bound_value.is_empty() { + let where_string = syn::LitStr::new(&format!("where {}", bound_value), bound.span()); + + let bounds = parse_str_lit::(&where_string, errors) + .map(|wh| wh.predicates.into_iter().collect()); + + match bounds { + Ok(bounds) => Some(bounds), + Err(_) => { + errors.extend(quote_spanned! {where_string.span()=> + compile_error!("could not parse bound"); + }); + + None + } + } + } else { + Some(vec![]) + }; +} + +fn parse_str_lit(value: &syn::LitStr, errors: &mut proc_macro2::TokenStream) -> Result +where + T: syn::parse::Parse, +{ + match value.parse() { + Ok(value) => Ok(value), + Err(e) => { + let message = format!("could not parse string literal: {}", e); + errors.extend(quote_spanned! {value.span()=> + compile_error!(#message); + }); + Err(()) + } + } +} + +fn ensure_str_lit<'a>( + attr_path: &'a syn::Path, + lit: &'a syn::Lit, + errors: &mut proc_macro2::TokenStream, +) -> Result<(&'a syn::Ident, &'a syn::LitStr), ()> { + let attr_name = match attr_path.get_ident() { + Some(attr_name) => attr_name, + None => { + errors.extend(quote_spanned! {attr_path.span()=> + compile_error!("expected derivative attribute to be a string, but found a path"); + }); + return Err(()); + } + }; + + if let syn::Lit::Str(ref lit) = *lit { + Ok((attr_name, lit)) + } else { + let message = format!( + "expected derivative {} attribute to be a string: `{} = \"...\"`", + attr_name, attr_name + ); + errors.extend(quote_spanned! {lit.span()=> + compile_error!(#message); + }); + Err(()) + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/bound.rs b/third_party/cargo/vendor/derivative-2.1.1/src/bound.rs new file mode 100644 index 0000000..fa06488 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/bound.rs @@ -0,0 +1,174 @@ +/* This file incorporates work covered by the following copyright and + * permission notice: + * Copyright 2016 The serde Developers. See + * https://github.com/serde-rs/serde/blob/3f28a9324042950afa80354722aeeee1a55cbfa3/README.md#license. + * + * Licensed under the Apache License, Version 2.0 or the MIT license + * , at your + * option. This file may not be copied, modified, or distributed + * except according to those terms. + */ + +use ast; +use attr; +use std::collections::HashSet; +use syn::{self, visit, GenericParam}; + +// use internals::ast::Item; +// use internals::attr; + +/// Remove the default from every type parameter because in the generated `impl`s +/// they look like associated types: "error: associated type bindings are not +/// allowed here". +pub fn without_defaults(generics: &syn::Generics) -> syn::Generics { + syn::Generics { + params: generics + .params + .iter() + .map(|generic_param| match *generic_param { + GenericParam::Type(ref ty_param) => syn::GenericParam::Type(syn::TypeParam { + default: None, + ..ty_param.clone() + }), + ref param => param.clone(), + }) + .collect(), + ..generics.clone() + } +} + +pub fn with_where_predicates( + generics: &syn::Generics, + predicates: &[syn::WherePredicate], +) -> syn::Generics { + let mut cloned = generics.clone(); + cloned + .make_where_clause() + .predicates + .extend(predicates.iter().cloned()); + cloned +} + +pub fn with_where_predicates_from_fields( + item: &ast::Input, + generics: &syn::Generics, + from_field: F, +) -> syn::Generics +where + F: Fn(&attr::Field) -> Option<&[syn::WherePredicate]>, +{ + let mut cloned = generics.clone(); + { + let fields = item.body.all_fields(); + let field_where_predicates = fields + .iter() + .flat_map(|field| from_field(&field.attrs)) + .flat_map(|predicates| predicates.to_vec()); + + cloned + .make_where_clause() + .predicates + .extend(field_where_predicates); + } + cloned +} + +/// Puts the given bound on any generic type parameters that are used in fields +/// for which filter returns true. +/// +/// For example, the following structure needs the bound `A: Debug, B: Debug`. +/// +/// ```ignore +/// struct S<'b, A, B: 'b, C> { +/// a: A, +/// b: Option<&'b B> +/// #[derivative(Debug="ignore")] +/// c: C, +/// } +/// ``` +pub fn with_bound( + item: &ast::Input, + generics: &syn::Generics, + filter: F, + bound: &syn::Path, +) -> syn::Generics +where + F: Fn(&attr::Field) -> bool, +{ + #[derive(Debug)] + struct FindTyParams { + /// Set of all generic type parameters on the current struct (A, B, C in + /// the example). Initialized up front. + all_ty_params: HashSet, + /// Set of generic type parameters used in fields for which filter + /// returns true (A and B in the example). Filled in as the visitor sees + /// them. + relevant_ty_params: HashSet, + } + impl<'ast> visit::Visit<'ast> for FindTyParams { + fn visit_path(&mut self, path: &'ast syn::Path) { + if is_phantom_data(path) { + // Hardcoded exception, because `PhantomData` implements + // most traits whether or not `T` implements it. + return; + } + if path.leading_colon.is_none() && path.segments.len() == 1 { + let id = &path.segments[0].ident; + if self.all_ty_params.contains(id) { + self.relevant_ty_params.insert(id.clone()); + } + } + visit::visit_path(self, path); + } + } + + let all_ty_params: HashSet<_> = generics + .type_params() + .map(|ty_param| ty_param.ident.clone()) + .collect(); + + let relevant_tys = item + .body + .all_fields() + .into_iter() + .filter(|field| { + if let syn::Type::Path(syn::TypePath { ref path, .. }) = *field.ty { + !is_phantom_data(path) + } else { + true + } + }) + .filter(|field| filter(&field.attrs)) + .map(|field| &field.ty); + + let mut visitor = FindTyParams { + all_ty_params, + relevant_ty_params: HashSet::new(), + }; + for ty in relevant_tys { + visit::visit_type(&mut visitor, ty); + } + + let mut cloned = generics.clone(); + { + let relevant_where_predicates = generics + .type_params() + .map(|ty_param| &ty_param.ident) + .filter(|id| visitor.relevant_ty_params.contains(id)) + .map(|id| -> syn::WherePredicate { parse_quote!( #id : #bound ) }); + + cloned + .make_where_clause() + .predicates + .extend(relevant_where_predicates); + } + cloned +} + +fn is_phantom_data(path: &syn::Path) -> bool { + match path.segments.last() { + Some(path) if path.ident == "PhantomData" => true, + _ => false, + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/clone.rs b/third_party/cargo/vendor/derivative-2.1.1/src/clone.rs new file mode 100644 index 0000000..39434b5 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/clone.rs @@ -0,0 +1,195 @@ +use proc_macro2; + +use ast; +use attr; +use matcher; +use syn; +use utils; + +/// Derive `Copy` for `input`. +pub fn derive_copy(input: &ast::Input) -> proc_macro2::TokenStream { + let name = &input.ident; + + let copy_trait_path = copy_trait_path(); + let generics = utils::build_impl_generics( + input, + ©_trait_path, + |attrs| attrs.copy_bound().is_none(), + |field| field.copy_bound(), + |input| input.copy_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #copy_trait_path for #name #ty_generics #where_clause {} + } +} + +/// Derive `Clone` for `input`. +pub fn derive_clone(input: &ast::Input) -> proc_macro2::TokenStream { + let name = &input.ident; + + let clone_trait_path = clone_trait_path(); + let generics = utils::build_impl_generics( + input, + &clone_trait_path, + needs_clone_bound, + |field| field.clone_bound(), + |input| input.clone_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let is_copy = input.attrs.copy.is_some(); + if is_copy && input.generics.type_params().count() == 0 { + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #clone_trait_path for #name #ty_generics #where_clause { + fn clone(&self) -> Self { + *self + } + } + } + } else { + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__arg", + |arm_path, _, _, style, _, bis| { + let field_clones = bis.iter().map(|bi| { + let arg = &bi.ident; + + let clone = if let Some(clone_with) = bi.field.attrs.clone_with() { + quote!(#clone_with(#arg)) + } else { + quote!(#arg.clone()) + }; + + if let Some(ref name) = bi.field.ident { + quote! { + #name: #clone + } + } else { + clone + } + }); + + match style { + ast::Style::Struct => { + quote! { + #arm_path { + #(#field_clones),* + } + } + } + ast::Style::Tuple => { + quote! { + #arm_path (#(#field_clones),*) + } + } + ast::Style::Unit => { + quote! { + #arm_path + } + } + } + }, + ); + + let clone_from = if input.attrs.clone_from() { + Some( + matcher::Matcher::new(matcher::BindingStyle::RefMut).build_arms( + input, + "__arg", + |outer_arm_path, _, _, _, _, outer_bis| { + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__other", + |inner_arm_path, _, _, _, _, inner_bis| { + if outer_arm_path == inner_arm_path { + let field_clones = outer_bis.iter().zip(inner_bis).map( + |(outer_bi, inner_bi)| { + let outer = &outer_bi.ident; + let inner = &inner_bi.ident; + + quote!(#outer.clone_from(#inner);) + }, + ); + + quote! { + #(#field_clones)* + return; + } + } else { + quote!() + } + }, + ); + + quote! { + match *other { + #body + } + } + }, + ), + ) + } else { + None + }; + + let clone_from = clone_from.map(|body| { + // Enumerations are only cloned-from if both variants are the same. + // If they are different, fallback to normal cloning. + let fallback = if let ast::Body::Enum(_) = input.body { + Some(quote!(*self = other.clone();)) + } else { + None + }; + + quote! { + fn clone_from(&mut self, other: &Self) { + match *self { + #body + } + + #fallback + } + } + }); + + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #clone_trait_path for #name #ty_generics #where_clause { + fn clone(&self) -> Self { + match *self { + #body + } + } + + #clone_from + } + } + } +} + +fn needs_clone_bound(attrs: &attr::Field) -> bool { + attrs.clone_bound().is_none() +} + +/// Return the path of the `Clone` trait, that is `::std::clone::Clone`. +fn clone_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::clone::Clone) + } else { + parse_quote!(::std::clone::Clone) + } +} + +/// Return the path of the `Copy` trait, that is `::std::marker::Copy`. +fn copy_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::marker::Copy) + } else { + parse_quote!(::std::marker::Copy) + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/cmp.rs b/third_party/cargo/vendor/derivative-2.1.1/src/cmp.rs new file mode 100644 index 0000000..0bfb766 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/cmp.rs @@ -0,0 +1,346 @@ +// https://github.com/rust-lang/rust/issues/13101 + +use proc_macro2; + +use ast; +use attr; +use matcher; +use paths; +use syn; +use utils; + +/// Derive `Eq` for `input`. +pub fn derive_eq(input: &ast::Input) -> proc_macro2::TokenStream { + let name = &input.ident; + + let eq_trait_path = eq_trait_path(); + let generics = utils::build_impl_generics( + input, + &eq_trait_path, + needs_eq_bound, + |field| field.eq_bound(), + |input| input.eq_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #eq_trait_path for #name #ty_generics #where_clause {} + } +} + +/// Derive `PartialEq` for `input`. +pub fn derive_partial_eq(input: &ast::Input) -> proc_macro2::TokenStream { + let discriminant_cmp = if let ast::Body::Enum(_) = input.body { + let discriminant_path = paths::discriminant_path(); + + quote!((#discriminant_path(&*self) == #discriminant_path(&*other))) + } else { + quote!(true) + }; + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_2_arms( + (input, "__self"), + (input, "__other"), + |_, _, _, (left_variant, right_variant)| { + let cmp = left_variant.iter().zip(&right_variant).map(|(o, i)| { + let outer_name = &o.ident; + let inner_name = &i.ident; + + if o.field.attrs.ignore_partial_eq() { + None + } else if let Some(compare_fn) = o.field.attrs.partial_eq_compare_with() { + Some(quote!(&& #compare_fn(#outer_name, #inner_name))) + } else { + Some(quote!(&& #outer_name == #inner_name)) + } + }); + + quote!(true #(#cmp)*) + }, + ); + + let name = &input.ident; + + let partial_eq_trait_path = partial_eq_trait_path(); + let generics = utils::build_impl_generics( + input, + &partial_eq_trait_path, + needs_partial_eq_bound, + |field| field.partial_eq_bound(), + |input| input.partial_eq_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let match_fields = if input.is_trivial_enum() { + quote!(true) + } else { + quote! { + match (&*self, &*other) { + #body + _ => unreachable!(), + } + } + }; + + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #partial_eq_trait_path for #name #ty_generics #where_clause { + fn eq(&self, other: &Self) -> bool { + #discriminant_cmp && #match_fields + } + } + } +} + +/// Derive `PartialOrd` for `input`. +pub fn derive_partial_ord(input: &ast::Input, errors: &mut proc_macro2::TokenStream) -> proc_macro2::TokenStream { + if let ast::Body::Enum(_) = input.body { + if !input.attrs.partial_ord_on_enum() { + let message = "can't use `#[derivative(PartialOrd)]` on an enumeration without \ + `feature_allow_slow_enum`; see the documentation for more details"; + errors.extend( + syn::Error::new(input.span, message).to_compile_error() + ); + } + } + + let option_path = option_path(); + let ordering_path = ordering_path(); + + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__self", + |_, n, _, _, _, outer_bis| { + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__other", + |_, m, _, _, _, inner_bis| match n.cmp(&m) { + ::std::cmp::Ordering::Less => quote!(#option_path::Some(#ordering_path::Less)), + ::std::cmp::Ordering::Greater => { + quote!(#option_path::Some(#ordering_path::Greater)) + } + ::std::cmp::Ordering::Equal => { + let equal_path = quote!(#ordering_path::Equal); + outer_bis + .iter() + .rev() + .zip(inner_bis.into_iter().rev()) + .fold(quote!(#option_path::Some(#equal_path)), |acc, (o, i)| { + let outer_name = &o.ident; + let inner_name = &i.ident; + + if o.field.attrs.ignore_partial_ord() { + acc + } else { + let cmp_fn = o + .field + .attrs + .partial_ord_compare_with() + .map(|f| quote!(#f)) + .unwrap_or_else(|| { + let path = partial_ord_trait_path(); + quote!(#path::partial_cmp) + }); + + quote!(match #cmp_fn(&(*#outer_name), &(*#inner_name)) { + #option_path::Some(#equal_path) => #acc, + __derive_ordering_other => __derive_ordering_other, + }) + } + }) + } + }, + ); + + quote! { + match *other { + #body + } + + } + }, + ); + + let name = &input.ident; + + let partial_ord_trait_path = partial_ord_trait_path(); + let generics = utils::build_impl_generics( + input, + &partial_ord_trait_path, + needs_partial_ord_bound, + |field| field.partial_ord_bound(), + |input| input.partial_ord_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #partial_ord_trait_path for #name #ty_generics #where_clause { + fn partial_cmp(&self, other: &Self) -> #option_path<#ordering_path> { + match *self { + #body + } + } + } + } +} + +/// Derive `Ord` for `input`. +pub fn derive_ord(input: &ast::Input, errors: &mut proc_macro2::TokenStream) -> proc_macro2::TokenStream { + if let ast::Body::Enum(_) = input.body { + if !input.attrs.ord_on_enum() { + let message = "can't use `#[derivative(Ord)]` on an enumeration without \ + `feature_allow_slow_enum`; see the documentation for more details"; + errors.extend( + syn::Error::new(input.span, message).to_compile_error() + ); + } + } + + let ordering_path = ordering_path(); + + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__self", + |_, n, _, _, _, outer_bis| { + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__other", + |_, m, _, _, _, inner_bis| match n.cmp(&m) { + ::std::cmp::Ordering::Less => quote!(#ordering_path::Less), + ::std::cmp::Ordering::Greater => quote!(#ordering_path::Greater), + ::std::cmp::Ordering::Equal => { + let equal_path = quote!(#ordering_path::Equal); + outer_bis + .iter() + .rev() + .zip(inner_bis.into_iter().rev()) + .fold(quote!(#equal_path), |acc, (o, i)| { + let outer_name = &o.ident; + let inner_name = &i.ident; + + if o.field.attrs.ignore_ord() { + acc + } else { + let cmp_fn = o + .field + .attrs + .ord_compare_with() + .map(|f| quote!(#f)) + .unwrap_or_else(|| { + let path = ord_trait_path(); + quote!(#path::cmp) + }); + + quote!(match #cmp_fn(&(*#outer_name), &(*#inner_name)) { + #equal_path => #acc, + __derive_ordering_other => __derive_ordering_other, + }) + } + }) + } + }, + ); + + quote! { + match *other { + #body + } + + } + }, + ); + + let name = &input.ident; + + let ord_trait_path = ord_trait_path(); + let generics = utils::build_impl_generics( + input, + &ord_trait_path, + needs_ord_bound, + |field| field.ord_bound(), + |input| input.ord_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #ord_trait_path for #name #ty_generics #where_clause { + fn cmp(&self, other: &Self) -> #ordering_path { + match *self { + #body + } + } + } + } +} + +fn needs_partial_eq_bound(attrs: &attr::Field) -> bool { + !attrs.ignore_partial_eq() && attrs.partial_eq_bound().is_none() +} + +fn needs_partial_ord_bound(attrs: &attr::Field) -> bool { + !attrs.ignore_partial_ord() && attrs.partial_ord_bound().is_none() +} + +fn needs_ord_bound(attrs: &attr::Field) -> bool { + !attrs.ignore_ord() && attrs.ord_bound().is_none() +} + +fn needs_eq_bound(attrs: &attr::Field) -> bool { + !attrs.ignore_partial_eq() && attrs.eq_bound().is_none() +} + +/// Return the path of the `Eq` trait, that is `::std::cmp::Eq`. +fn eq_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::cmp::Eq) + } else { + parse_quote!(::std::cmp::Eq) + } +} + +/// Return the path of the `PartialEq` trait, that is `::std::cmp::PartialEq`. +fn partial_eq_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::cmp::PartialEq) + } else { + parse_quote!(::std::cmp::PartialEq) + } +} + +/// Return the path of the `PartialOrd` trait, that is `::std::cmp::PartialOrd`. +fn partial_ord_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::cmp::PartialOrd) + } else { + parse_quote!(::std::cmp::PartialOrd) + } +} + +/// Return the path of the `Ord` trait, that is `::std::cmp::Ord`. +fn ord_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::cmp::Ord) + } else { + parse_quote!(::std::cmp::Ord) + } +} + +/// Return the path of the `Option` trait, that is `::std::option::Option`. +fn option_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::option::Option) + } else { + parse_quote!(::std::option::Option) + } +} + +/// Return the path of the `Ordering` trait, that is `::std::cmp::Ordering`. +fn ordering_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::cmp::Ordering) + } else { + parse_quote!(::std::cmp::Ordering) + } +} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/debug.rs b/third_party/cargo/vendor/derivative-2.1.1/src/debug.rs new file mode 100644 index 0000000..6db31c6 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/debug.rs @@ -0,0 +1,205 @@ +use proc_macro2; + +use ast; +use attr; +use matcher; +use syn; +use syn::spanned::Spanned; +use utils; + +pub fn derive(input: &ast::Input) -> proc_macro2::TokenStream { + let debug_trait_path = debug_trait_path(); + let fmt_path = fmt_path(); + + let formatter = quote_spanned! {input.span=> __f}; + + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__arg", + |_, _, arm_name, style, attrs, bis| { + let field_prints = bis.iter().filter_map(|bi| { + if bi.field.attrs.ignore_debug() { + return None; + } + + if attrs.debug_transparent() { + return Some(quote_spanned! {arm_name.span()=> + #debug_trait_path::fmt(__arg_0, #formatter) + }); + } + + let arg = &bi.ident; + + let dummy_debug = bi.field.attrs.debug_format_with().map(|format_fn| { + format_with(bi.field, &arg, format_fn, input.generics.clone()) + }); + + let builder = if let Some(ref name) = bi.field.ident { + let name = name.to_string(); + quote_spanned! {arm_name.span()=> + #dummy_debug + let _ = __debug_trait_builder.field(#name, &#arg); + } + } else { + quote_spanned! {arm_name.span()=> + #dummy_debug + let _ = __debug_trait_builder.field(&#arg); + } + }; + + Some(builder) + }); + + let method = match style { + ast::Style::Struct => "debug_struct", + ast::Style::Tuple | ast::Style::Unit => "debug_tuple", + }; + let method = syn::Ident::new(method, proc_macro2::Span::call_site()); + + if attrs.debug_transparent() { + quote_spanned! {arm_name.span()=> + #(#field_prints)* + } + } else { + let name = arm_name.to_string(); + quote_spanned! {arm_name.span()=> + let mut __debug_trait_builder = #formatter.#method(#name); + #(#field_prints)* + __debug_trait_builder.finish() + } + } + }, + ); + + let name = &input.ident; + + let generics = utils::build_impl_generics( + input, + &debug_trait_path, + needs_debug_bound, + |field| field.debug_bound(), + |input| input.debug_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + // don't attach a span to prevent issue #58 + let match_self = quote!(match *self); + quote_spanned! {input.span=> + #[allow(unused_qualifications)] + impl #impl_generics #debug_trait_path for #name #ty_generics #where_clause { + fn fmt(&self, #formatter: &mut #fmt_path::Formatter) -> #fmt_path::Result { + #match_self { + #body + } + } + } + } +} + +fn needs_debug_bound(attrs: &attr::Field) -> bool { + !attrs.ignore_debug() && attrs.debug_bound().is_none() +} + +/// Return the path of the `Debug` trait, that is `::std::fmt::Debug`. +fn debug_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::fmt::Debug) + } else { + parse_quote!(::std::fmt::Debug) + } +} + +/// Return the path of the `fmt` module, that is `::std::fmt`. +fn fmt_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::fmt) + } else { + parse_quote!(::std::fmt) + } +} + +/// Return the path of the `PhantomData` type, that is `::std::marker::PhantomData`. +fn phantom_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::marker::PhantomData) + } else { + parse_quote!(::std::marker::PhantomData) + } +} + +fn format_with( + f: &ast::Field, + arg_n: &syn::Ident, + format_fn: &syn::Path, + mut generics: syn::Generics, +) -> proc_macro2::TokenStream { + let debug_trait_path = debug_trait_path(); + let fmt_path = fmt_path(); + let phantom_path = phantom_path(); + + generics + .make_where_clause() + .predicates + .extend(f.attrs.debug_bound().unwrap_or(&[]).iter().cloned()); + + generics + .params + .push(syn::GenericParam::Lifetime(syn::LifetimeDef::new( + parse_quote!('_derivative), + ))); + let where_predicates = generics + .type_params() + .map(|ty| { + let mut bounds = syn::punctuated::Punctuated::new(); + bounds.push(syn::TypeParamBound::Lifetime(syn::Lifetime::new( + "'_derivative", + proc_macro2::Span::call_site(), + ))); + + let path = syn::Path::from(syn::PathSegment::from(ty.ident.clone())); + + syn::WherePredicate::Type(syn::PredicateType { + lifetimes: None, + bounded_ty: syn::Type::Path(syn::TypePath { + qself: None, + path, + }), + colon_token: Default::default(), + bounds, + }) + }) + .collect::>(); + generics + .make_where_clause() + .predicates + .extend(where_predicates); + + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let ty = f.ty; + + // Leave off the type parameter bounds, defaults, and attributes + let phantom = generics.type_params().map(|tp| &tp.ident); + + let mut ctor_generics = generics.clone(); + *ctor_generics + .lifetimes_mut() + .last() + .expect("There must be a '_derivative lifetime") = syn::LifetimeDef::new(parse_quote!('_)); + let (_, ctor_ty_generics, _) = ctor_generics.split_for_impl(); + let ctor_ty_generics = ctor_ty_generics.as_turbofish(); + + quote_spanned!(format_fn.span()=> + let #arg_n = { + struct Dummy #impl_generics (&'_derivative #ty, #phantom_path <(#(#phantom,)*)>) #where_clause; + + impl #impl_generics #debug_trait_path for Dummy #ty_generics #where_clause { + fn fmt(&self, __f: &mut #fmt_path::Formatter) -> #fmt_path::Result { + #format_fn(&self.0, __f) + } + } + + Dummy #ctor_ty_generics (#arg_n, #phantom_path) + }; + ) +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/default.rs b/third_party/cargo/vendor/derivative-2.1.1/src/default.rs new file mode 100644 index 0000000..f369475 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/default.rs @@ -0,0 +1,120 @@ +use proc_macro2; + +use ast; +use attr; +use syn; +use utils; + +/// Derive `Default` for `input`. +pub fn derive(input: &ast::Input, default: &attr::InputDefault) -> proc_macro2::TokenStream { + fn make_variant_data( + variant_name: &proc_macro2::TokenStream, + style: ast::Style, + fields: &[ast::Field], + ) -> proc_macro2::TokenStream { + let default_trait_path = default_trait_path(); + + match style { + ast::Style::Struct => { + let mut defaults = Vec::new(); + + for f in fields { + let name = f + .ident + .as_ref() + .expect("A structure field must have a name"); + let default = f + .attrs + .default_value() + .map_or_else(|| quote!(#default_trait_path::default()), |v| quote!(#v)); + + defaults.push(quote!(#name: #default)); + } + + quote!(#variant_name { #(#defaults),* }) + } + ast::Style::Tuple => { + let mut defaults = Vec::new(); + + for f in fields { + let default = f + .attrs + .default_value() + .map_or_else(|| quote!(#default_trait_path::default()), |v| quote!(#v)); + + defaults.push(default); + } + + quote!(#variant_name ( #(#defaults),* )) + } + ast::Style::Unit => quote!(#variant_name), + } + } + + let name = &input.ident; + let default_trait_path = default_trait_path(); + let generics = utils::build_impl_generics( + input, + &default_trait_path, + |attrs| attrs.default_bound().is_none(), + |field| field.default_bound(), + |input| input.default_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let body = match input.body { + ast::Body::Enum(ref data) => { + let arms = data.iter().filter_map(|variant| { + if variant.attrs.default.is_some() { + let vname = &variant.ident; + + Some(make_variant_data( + "e!(#name::#vname), + variant.style, + &variant.fields, + )) + } else { + None + } + }); + + quote!(#(#arms),*) + } + ast::Body::Struct(style, ref vd) => make_variant_data("e!(#name), style, vd), + }; + + let new_fn = if default.new { + Some(quote!( + #[allow(unused_qualifications)] + impl #impl_generics #name #ty_generics #where_clause { + /// Creates a default value for this type. + #[inline] + pub fn new() -> Self { + ::default() + } + } + )) + } else { + None + }; + + quote!( + #new_fn + + #[allow(unused_qualifications)] + impl #impl_generics #default_trait_path for #name #ty_generics #where_clause { + fn default() -> Self { + #body + } + } + ) +} + +/// Return the path of the `Default` trait, that is `::std::default::Default`. +fn default_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::default::Default) + } else { + parse_quote!(::std::default::Default) + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/hash.rs b/third_party/cargo/vendor/derivative-2.1.1/src/hash.rs new file mode 100644 index 0000000..be9ba84 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/hash.rs @@ -0,0 +1,97 @@ +use proc_macro2; + +use ast; +use attr; +use matcher; +use paths; +use syn; +use utils; + +pub fn derive(input: &ast::Input) -> proc_macro2::TokenStream { + let hasher_trait_path = hasher_trait_path(); + let hash_trait_path = hash_trait_path(); + + let discriminant = if let ast::Body::Enum(_) = input.body { + let discriminant = paths::discriminant_path(); + Some(quote!( + #hash_trait_path::hash(&#discriminant(self), __state); + )) + } else { + None + }; + + let body = matcher::Matcher::new(matcher::BindingStyle::Ref).build_arms( + input, + "__arg", + |_, _, _, _, _, bis| { + let field_prints = bis.iter().filter_map(|bi| { + if bi.field.attrs.ignore_hash() { + return None; + } + + let arg = &bi.ident; + + if let Some(hash_with) = bi.field.attrs.hash_with() { + Some(quote! { + #hash_with(#arg, __state); + }) + } else { + Some(quote! { + #hash_trait_path::hash(#arg, __state); + }) + } + }); + + quote! { + #(#field_prints)* + } + }, + ); + + let name = &input.ident; + let generics = utils::build_impl_generics( + input, + &hash_trait_path, + needs_hash_bound, + |field| field.hash_bound(), + |input| input.hash_bound(), + ); + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + + let hasher_ty_parameter = utils::hygienic_type_parameter(input, "__H"); + quote! { + #[allow(unused_qualifications)] + impl #impl_generics #hash_trait_path for #name #ty_generics #where_clause { + fn hash<#hasher_ty_parameter>(&self, __state: &mut #hasher_ty_parameter) + where #hasher_ty_parameter: #hasher_trait_path + { + #discriminant + match *self { + #body + } + } + } + } +} + +fn needs_hash_bound(attrs: &attr::Field) -> bool { + !attrs.ignore_hash() && attrs.hash_bound().is_none() +} + +/// Return the path of the `Hash` trait, that is `::std::hash::Hash`. +fn hash_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::hash::Hash) + } else { + parse_quote!(::std::hash::Hash) + } +} + +/// Return the path of the `Hasher` trait, that is `::std::hash::Hasher`. +fn hasher_trait_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::hash::Hasher) + } else { + parse_quote!(::std::hash::Hasher) + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/lib.rs b/third_party/cargo/vendor/derivative-2.1.1/src/lib.rs new file mode 100644 index 0000000..3384a4d --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/lib.rs @@ -0,0 +1,89 @@ +// We need to support Rust 1.34 to stable +#![allow(deprecated)] + +#![allow(clippy::mem_replace_with_default)] // needs rustc 1.40 +#![allow(clippy::option_as_ref_deref)] // needs rustc 1.40 + +extern crate proc_macro; +extern crate proc_macro2; +#[macro_use] +extern crate syn; + +#[macro_use] +extern crate quote; + +mod ast; +mod attr; +mod bound; +mod clone; +mod cmp; +mod debug; +mod default; +mod hash; +mod matcher; +mod paths; +mod utils; + +use proc_macro::TokenStream; + +fn derive_impls( + input: &mut ast::Input, + errors: &mut proc_macro2::TokenStream, +) -> proc_macro2::TokenStream { + let mut tokens = proc_macro2::TokenStream::new(); + + if input.attrs.clone.is_some() { + tokens.extend(clone::derive_clone(input)); + } + if input.attrs.copy.is_some() { + tokens.extend(clone::derive_copy(input)); + } + if input.attrs.debug.is_some() { + tokens.extend(debug::derive(input)); + } + if let Some(ref default) = input.attrs.default { + tokens.extend(default::derive(input, default)); + } + if input.attrs.eq.is_some() { + tokens.extend(cmp::derive_eq(input)); + } + if input.attrs.hash.is_some() { + tokens.extend(hash::derive(input)); + } + if input.attrs.partial_eq.is_some() { + tokens.extend(cmp::derive_partial_eq(input)); + } + if input.attrs.partial_ord.is_some() { + tokens.extend(cmp::derive_partial_ord(input, errors)); + } + if input.attrs.ord.is_some() { + tokens.extend(cmp::derive_ord(input, errors)); + } + + tokens.extend(std::mem::replace( + errors, + Default::default(), + )); + + tokens +} + +#[cfg_attr(not(test), proc_macro_derive(Derivative, attributes(derivative)))] +pub fn derivative(input: TokenStream) -> TokenStream { + let mut errors = proc_macro2::TokenStream::new(); + + let mut output = match syn::parse::(input) { + Ok(parsed) => { + ast::Input::from_ast(&parsed, &mut errors) + .map(|mut input| derive_impls(&mut input, &mut errors)) + .unwrap_or_default() + }, + Err(error) => { + errors.extend(error.to_compile_error()); + Default::default() + } + }; + + output.extend(errors); + output.into() +} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/matcher.rs b/third_party/cargo/vendor/derivative-2.1.1/src/matcher.rs new file mode 100644 index 0000000..746b4c4 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/matcher.rs @@ -0,0 +1,266 @@ +#![allow(dead_code)] // TODO: remove + +// This is inspired from `synstructure`, but `synstructure` is not adapted in severals ways +// including: +// * `&mut` everywhere +// * not generic, we use our own `ast`, `synstructure` only knows about `syn` +// * missing information (what arm are we in?, what attributes? etc.) + +use proc_macro2::{self, TokenStream}; +use quote::ToTokens; +use syn; + +use ast; +use attr; +use quote; + +/// The type of binding to use when generating a pattern. +#[derive(Debug, Copy, Clone)] +pub enum BindingStyle { + /// `x` + Move, + /// `mut x` + MoveMut, + /// `ref x` + Ref, + /// `ref mut x` + RefMut, +} + +impl quote::ToTokens for BindingStyle { + fn to_tokens(&self, tokens: &mut TokenStream) { + match *self { + BindingStyle::Move => (), + BindingStyle::MoveMut => tokens.extend(quote!(mut)), + BindingStyle::Ref => tokens.extend(quote!(ref)), + BindingStyle::RefMut => { + tokens.extend(quote!(ref mut)); + } + } + } +} + +#[derive(Debug)] +pub struct BindingInfo<'a> { + pub ident: syn::Ident, + pub field: &'a ast::Field<'a>, +} + +#[derive(Debug)] +pub struct CommonVariant<'a> { + path: syn::Path, + name: &'a syn::Ident, + style: ast::Style, + attrs: &'a attr::Input, +} + +pub struct Matcher { + binding_name: String, + binding_style: BindingStyle, +} + +impl Matcher { + pub fn new(style: BindingStyle) -> Self { + Matcher { + binding_name: "__arg".into(), + binding_style: style, + } + } + + pub fn with_name(self, name: String) -> Self { + Matcher { + binding_name: name, + ..self + } + } + + pub fn build_arms(self, input: &ast::Input, binding_name: &str, f: F) -> TokenStream + where + F: Fn( + syn::Path, + usize, + &syn::Ident, + ast::Style, + &attr::Input, + Vec, + ) -> TokenStream, + { + let variants = self.build_match_pattern(input, binding_name); + + // Now that we have the patterns, generate the actual branches of the match + // expression + let mut t = TokenStream::new(); + for (i, (variant, (pat, bindings))) in variants.into_iter().enumerate() { + let body = f( + variant.path, + i, + variant.name, + variant.style, + variant.attrs, + bindings, + ); + quote!(#pat => { #body }).to_tokens(&mut t); + } + + t + } + + pub fn build_2_arms( + self, + left: (&ast::Input, &str), + right: (&ast::Input, &str), + f: F, + ) -> TokenStream + where + F: Fn( + usize, + CommonVariant, + CommonVariant, + (Vec, Vec), + ) -> TokenStream, + { + let left_variants = self.build_match_pattern(left.0, left.1); + let right_variants = self.build_match_pattern(right.0, right.1); + + assert_eq!(left_variants.len(), right_variants.len()); + + // Now that we have the patterns, generate the actual branches of the match + // expression + let mut t = TokenStream::new(); + for (i, (left, right)) in left_variants.into_iter().zip(right_variants).enumerate() { + let (left, (left_pat, left_bindings)) = left; + let (right, (right_pat, right_bindings)) = right; + + let body = f(i, left, right, (left_bindings, right_bindings)); + quote!((#left_pat, #right_pat) => { #body }).to_tokens(&mut t); + } + + t + } + + /// Generate patterns for matching against all of the variants + pub fn build_match_pattern<'a>( + &self, + input: &'a ast::Input, + binding_name: &str, + ) -> Vec<(CommonVariant<'a>, (TokenStream, Vec>))> { + let ident = &input.ident; + + match input.body { + ast::Body::Enum(ref variants) => variants + .iter() + .map(|variant| { + let variant_ident = &variant.ident; + let path = parse_quote!(#ident::#variant_ident); + + let pat = self.build_match_pattern_impl( + &path, + variant.style, + &variant.fields, + binding_name, + ); + + ( + CommonVariant { + path, + name: variant_ident, + style: variant.style, + attrs: &variant.attrs, + }, + pat, + ) + }) + .collect(), + ast::Body::Struct(style, ref vd) => { + let path = parse_quote!(#ident); + vec![( + CommonVariant { + path, + name: ident, + style, + attrs: &input.attrs, + }, + self.build_match_pattern_impl(ident, style, vd, binding_name), + )] + } + } + } + + fn build_match_pattern_impl<'a, N>( + &self, + name: &N, + style: ast::Style, + fields: &'a [ast::Field<'a>], + binding_name: &str, + ) -> (TokenStream, Vec>) + where + N: quote::ToTokens, + { + let (stream, matches) = match style { + ast::Style::Unit => (TokenStream::new(), Vec::new()), + ast::Style::Tuple => { + let (stream, matches) = fields.iter().enumerate().fold( + (TokenStream::new(), Vec::new()), + |(stream, matches), field| { + self.build_inner_pattern( + (stream, matches), + field, + binding_name, + |_, ident, binding| quote!(#binding #ident ,), + ) + }, + ); + + (quote! { ( #stream ) }, matches) + } + ast::Style::Struct => { + let (stream, matches) = fields.iter().enumerate().fold( + (TokenStream::new(), Vec::new()), + |(stream, matches), field| { + self.build_inner_pattern( + (stream, matches), + field, + binding_name, + |field, ident, binding| { + let field_name = field.ident.as_ref().unwrap(); + quote!(#field_name : #binding #ident ,) + }, + ) + }, + ); + + (quote! { { #stream } }, matches) + } + }; + + let mut all_tokens = TokenStream::new(); + name.to_tokens(&mut all_tokens); + all_tokens.extend(stream); + + (all_tokens, matches) + } + + fn build_inner_pattern<'a>( + &self, + (mut stream, mut matches): (TokenStream, Vec>), + (i, field): (usize, &'a ast::Field), + binding_name: &str, + f: impl FnOnce(&ast::Field, &syn::Ident, BindingStyle) -> TokenStream, + ) -> (TokenStream, Vec>) { + let binding_style = self.binding_style; + + let ident: syn::Ident = syn::Ident::new( + &format!("{}_{}", binding_name, i), + proc_macro2::Span::call_site(), + ); + + f(field, &ident, binding_style).to_tokens(&mut stream); + + matches.push(BindingInfo { + ident, + field, + }); + + (stream, matches) + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/paths.rs b/third_party/cargo/vendor/derivative-2.1.1/src/paths.rs new file mode 100644 index 0000000..7a6ec7d --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/paths.rs @@ -0,0 +1,10 @@ +//! Contains some standard paths. + +/// Return the path of the `discriminant` function, that is `::std::mem::discriminant`. +pub fn discriminant_path() -> syn::Path { + if cfg!(feature = "use_core") { + parse_quote!(::core::mem::discriminant) + } else { + parse_quote!(::std::mem::discriminant) + } +} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/src/utils.rs b/third_party/cargo/vendor/derivative-2.1.1/src/utils.rs new file mode 100644 index 0000000..9db21f5 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/src/utils.rs @@ -0,0 +1,43 @@ +use proc_macro2; + +use ast; +use attr; +use bound; +use syn; + +/// Make generic with all the generics in the input, plus a bound `T: ` for each +/// generic field type that will be shown. +pub fn build_impl_generics( + item: &ast::Input, + trait_path: &syn::Path, + needs_debug_bound: F, + field_bound: G, + input_bound: H, +) -> syn::Generics +where + F: Fn(&attr::Field) -> bool, + G: Fn(&attr::Field) -> Option<&[syn::WherePredicate]>, + H: Fn(&attr::Input) -> Option<&[syn::WherePredicate]>, +{ + let generics = bound::without_defaults(item.generics); + let generics = bound::with_where_predicates_from_fields(item, &generics, field_bound); + + match input_bound(&item.attrs) { + Some(predicates) => bound::with_where_predicates(&generics, predicates), + None => bound::with_bound(item, &generics, needs_debug_bound, trait_path), + } +} + +/// Construct a name for the inner type parameter that can't collide with any +/// type parameters of the item. This is achieved by starting with a base and +/// then concatenating the names of all other type parameters. +pub fn hygienic_type_parameter(item: &ast::Input, base: &str) -> syn::Ident { + let mut typaram = String::with_capacity(150); + typaram.push_str(base); + let typaram = item.generics.type_params().fold(typaram, |mut acc, ty| { + acc.push_str(&format!("{}", &ty.ident)); + acc + }); + + syn::Ident::new(&typaram, proc_macro2::Span::call_site()) +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.rs new file mode 100644 index 0000000..82822a8 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.rs @@ -0,0 +1,15 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: T, + #[derivative(Debug(format_with="std::fmt::Debug::fmt"))] + bar: U, +} + +fn main() {} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.stderr b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.stderr new file mode 100644 index 0000000..e265e34 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-debug.stderr @@ -0,0 +1,12 @@ +error[E0277]: `U` doesn't implement `std::fmt::Debug` + --> $DIR/derive-debug.rs:11:36 + | +7 | #[derive(Derivative)] + | - help: consider further restricting type parameter `U`: `, U: std::fmt::Debug` +... +11 | #[derivative(Debug(format_with="std::fmt::Debug::fmt"))] + | ^^^^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug` + | + = help: the trait `std::fmt::Debug` is not implemented for `U` + = note: required because of the requirements on the impl of `std::fmt::Debug` for `&U` + = note: required by `std::fmt::Debug::fmt` diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.rs new file mode 100644 index 0000000..619788b --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.rs @@ -0,0 +1,11 @@ +#[macro_use] +extern crate derivative; + +#[derive(Derivative, PartialEq)] +#[derivative(PartialOrd)] +enum Option { + Some, + None, +} + +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.stderr b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.stderr new file mode 100644 index 0000000..5786998 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/derive-partial-ord.stderr @@ -0,0 +1,5 @@ +error: can't use `#[derivative(PartialOrd)]` on an enumeration without `feature_allow_slow_enum`; see the documentation for more details + --> $DIR/derive-partial-ord.rs:5:1 + | +5 | #[derivative(PartialOrd)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.rs new file mode 100644 index 0000000..b034123 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.rs @@ -0,0 +1,23 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Clone = not_a_string)] +struct Foo1; + +#[derive(Derivative)] +#[derivative(Clone = 1+2)] +struct Foo2; + +#[derive(Derivative)] +#[derivative(Default(new = "True"))] +struct Foo3; + +#[derive(Derivative)] +#[derivative(Debug(bound))] +struct Foo4; + +fn main() {} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.stderr b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.stderr new file mode 100644 index 0000000..e3e0bb7 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/invalid-attribute.stderr @@ -0,0 +1,23 @@ +error: invalid attribute: expected literal + --> $DIR/invalid-attribute.rs:8:22 + | +8 | #[derivative(Clone = not_a_string)] + | ^^^^^^^^^^^^ + +error: invalid attribute: expected `,` + --> $DIR/invalid-attribute.rs:12:23 + | +12 | #[derivative(Clone = 1+2)] + | ^ + +error: expected `"true"` or `"false"` for `new`, got `True` + --> $DIR/invalid-attribute.rs:16:28 + | +16 | #[derivative(Default(new = "True"))] + | ^^^^^^ + +error: expected named value + --> $DIR/invalid-attribute.rs:20:20 + | +20 | #[derivative(Debug(bound))] + | ^^^^^ diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.rs new file mode 100644 index 0000000..31cdaf4 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.rs @@ -0,0 +1,15 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Clone = "does_not_exist")] +struct Foo; + +#[derive(Derivative)] +#[derivative(Clone(does_not_exist = "true"))] +struct Bar; + +fn main() {} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.stderr b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.stderr new file mode 100644 index 0000000..5383a2f --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-attribute.stderr @@ -0,0 +1,11 @@ +error: Unknown attribute `does_not_exist` for trait `Clone` + --> $DIR/unknown-attribute.rs:8:22 + | +8 | #[derivative(Clone = "does_not_exist")] + | ^^^^^^^^^^^^^^^^ + +error: Unknown attribute `does_not_exist` for trait `Clone` + --> $DIR/unknown-attribute.rs:12:20 + | +12 | #[derivative(Clone(does_not_exist = "true"))] + | ^^^^^^^^^^^^^^ diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.rs new file mode 100644 index 0000000..0a9a689 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.rs @@ -0,0 +1,22 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(DoesNotExist1)] +struct Foo; + +#[derive(Derivative)] +#[derivative(DoesNotExist2(with_some="argument"))] +struct Bar; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Baz { + #[derivative(DoesNotExist3)] + _baz: (), +} + +fn main() {} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.stderr b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.stderr new file mode 100644 index 0000000..2d83f18 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-fail/unknown-derive.stderr @@ -0,0 +1,17 @@ +error: deriving `DoesNotExist1` is not supported by derivative + --> $DIR/unknown-derive.rs:8:14 + | +8 | #[derivative(DoesNotExist1)] + | ^^^^^^^^^^^^^ + +error: deriving `DoesNotExist2` is not supported by derivative + --> $DIR/unknown-derive.rs:12:14 + | +12 | #[derivative(DoesNotExist2(with_some="argument"))] + | ^^^^^^^^^^^^^ + +error: deriving `DoesNotExist3` is not supported by derivative + --> $DIR/unknown-derive.rs:18:18 + | +18 | #[derivative(DoesNotExist3)] + | ^^^^^^^^^^^^^ diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/compile-test.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-test.rs new file mode 100644 index 0000000..361332a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/compile-test.rs @@ -0,0 +1,9 @@ +extern crate trybuild; + +#[test] +#[ignore] +fn compile_test() { + let t = trybuild::TestCases::new(); + let pattern = std::env::var("DERIVATIVE_TEST_FILTER").unwrap_or_else(|_| String::from("*.rs")); + t.compile_fail(format!("tests/compile-fail/{}", pattern)); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone-generics.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone-generics.rs new file mode 100644 index 0000000..96919f9 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone-generics.rs @@ -0,0 +1,29 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::marker::PhantomData; + +struct NoClone; + +#[derive(Derivative)] +#[derivative(Clone, PartialEq)] +struct PhantomField { + foo: PhantomData, +} + +#[derive(Derivative)] +#[derivative(Clone, PartialEq)] +struct PhantomTuple { + foo: PhantomData<(T,)>, +} + +#[test] +fn main() { + let phantom_field = PhantomField:: { foo: Default::default() }; + let phantom_tuple = PhantomTuple:: { foo: Default::default() }; + assert!(phantom_field == phantom_field.clone()); + assert!(phantom_tuple == phantom_tuple.clone()); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone.rs new file mode 100755 index 0000000..c83a2db --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-clone.rs @@ -0,0 +1,64 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Clone)] +struct Foo { + foo: u8, + #[derivative(Clone(clone_with="seventh"))] + bar: u8, +} + +fn seventh(a: &u8) -> u8 { + a/7 +} + +#[derive(Debug, PartialEq)] +struct EvilCloneFrom(u8); + +impl Clone for EvilCloneFrom { + fn clone(&self) -> Self { + EvilCloneFrom(self.0) + } + + fn clone_from(&mut self, _: &Self) { + self.0 = 42; + } +} + +#[derive(Derivative)] +#[derivative(Clone(clone_from="true"))] +struct StructWithCloneFrom(EvilCloneFrom); + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Clone(clone_from="true"))] +enum EnumWithCloneFrom { + Evil(EvilCloneFrom), + Good(u32), + None +} + +#[test] +fn main() { + let foo = Foo { foo: 31, bar: 42 }; + assert_eq!(Foo { foo: 31, bar: 6 }, foo.clone()); + + let mut foo = StructWithCloneFrom(EvilCloneFrom(27)); + foo.clone_from(&StructWithCloneFrom(EvilCloneFrom(0))); + assert_eq!((foo.0).0, 42); + + let mut foo = EnumWithCloneFrom::Evil(EvilCloneFrom(27)); + foo.clone_from(&EnumWithCloneFrom::Evil(EvilCloneFrom(0))); + assert_eq!(foo, EnumWithCloneFrom::Evil(EvilCloneFrom(42))); + + let mut foo = EnumWithCloneFrom::Evil(EvilCloneFrom(27)); + foo.clone_from(&EnumWithCloneFrom::None); + assert_eq!(foo, EnumWithCloneFrom::None); + + let mut foo = EnumWithCloneFrom::Good(27); + foo.clone_from(&EnumWithCloneFrom::None); + assert_eq!(foo, EnumWithCloneFrom::None); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-bounds.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-bounds.rs new file mode 100644 index 0000000..3a9c7bc --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-bounds.rs @@ -0,0 +1,83 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::fmt::{Formatter, Result as FmtResult}; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: T, + #[derivative(Debug(format_with="MyDebug::my_fmt", bound="U: MyDebug"))] + bar: U, +} + +#[derive(Derivative)] +#[derivative(Debug(bound="T: std::fmt::Debug, U:MyDebug"))] +struct Foo2 { + foo: T, + #[derivative(Debug(format_with="MyDebug::my_fmt"))] + bar: U, +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct Bar ( + T, + #[derivative(Debug(format_with="MyDebug::my_fmt", bound="U: MyDebug"))] + U, +); + +#[derive(Derivative)] +#[derivative(Debug(bound="T: std::fmt::Debug, U:MyDebug"))] +struct Bar2 ( + T, + #[derivative(Debug(format_with="MyDebug::my_fmt"))] + U, +); + +struct NoDebug; + +struct GenericNeedsNoDebug(T); +impl std::fmt::Debug for GenericNeedsNoDebug { + fn fmt(&self, f: &mut std::fmt::Formatter) -> FmtResult { + f.write_str("GenericNeedsNoDebug") + } +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct TestUnneededBound( // Test that we don't add T: Debug + #[derivative(Debug(bound=""))] GenericNeedsNoDebug, +); + +trait MyDebug { + fn my_fmt(&self, f: &mut Formatter) -> FmtResult { + f.write_str("MyDebug") + } +} + +impl MyDebug for i32 { } +impl<'a, T> MyDebug for &'a T { } + + +trait ToDebug { + fn to_show(&self) -> String; +} + +impl ToDebug for T { + fn to_show(&self) -> String { + format!("{:?}", self) + } +} + +#[test] +fn main() { + assert_eq!(Foo { foo: 42, bar: 0 }.to_show(), "Foo { foo: 42, bar: MyDebug }".to_string()); + assert_eq!(Foo2 { foo: 42, bar: 0 }.to_show(), "Foo2 { foo: 42, bar: MyDebug }".to_string()); + assert_eq!(Bar(42, 0).to_show(), "Bar(42, MyDebug)".to_string()); + assert_eq!(Bar2(42, 0).to_show(), "Bar2(42, MyDebug)".to_string()); + assert_eq!(TestUnneededBound(GenericNeedsNoDebug(NoDebug)).to_show(), "TestUnneededBound(GenericNeedsNoDebug)".to_string()); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-generics.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-generics.rs new file mode 100644 index 0000000..a750e88 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-generics.rs @@ -0,0 +1,91 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::marker::PhantomData; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: T, + #[derivative(Debug="ignore")] + bar: U, +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct Bar ( + T, + #[derivative(Debug="ignore")] + U, +); + +#[derive(Derivative)] +#[derivative(Debug)] +enum C { + C1(T), + C2(#[derivative(Debug="ignore")] U), + C3(String), +} + +#[derive(Derivative)] +#[derivative(Debug)] +enum D { + D1{ + #[derivative(Debug="ignore")] + a: U + } +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct F(#[derivative(Debug="ignore")] U); + +#[derive(Derivative)] +#[derivative(Debug)] +struct G(isize, #[derivative(Debug="ignore")] U); + +#[derive(Derivative)] +#[derivative(Debug)] +struct J(#[derivative(Debug="ignore")] U); + +struct NoDebug; + +trait ToDebug { + fn to_show(&self) -> String; +} + +impl ToDebug for T { + fn to_show(&self) -> String { + format!("{:?}", self) + } +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct PhantomField { + foo: PhantomData, +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct PhantomTuple { + foo: PhantomData<(T,)>, +} + +#[test] +fn main() { + assert_eq!(Foo { foo: 42, bar: NoDebug }.to_show(), "Foo { foo: 42 }".to_string()); + assert_eq!(Bar(42, NoDebug).to_show(), "Bar(42)".to_string()); + assert_eq!(C::C1::(12).to_show(), "C1(12)".to_string()); + assert_eq!(C::C2::(NoDebug).to_show(), "C2".to_string()); + assert_eq!(C::C3::("foo".to_string()).to_show(), "C3(\"foo\")".to_string()); + assert_eq!(D::D1 { a: NoDebug }.to_show(), "D1".to_string()); + assert_eq!(F(NoDebug).to_show(), "F".to_string()); + assert_eq!(G(42, NoDebug).to_show(), "G(42)".to_string()); + assert_eq!(J(NoDebug).to_show(), "J".to_string()); + assert_eq!(&format!("{:?}", PhantomField:: { foo: Default::default() }), "PhantomField { foo: PhantomData }"); + assert_eq!(&format!("{:?}", PhantomTuple:: { foo: Default::default() }), "PhantomTuple { foo: PhantomData }"); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-transparent.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-transparent.rs new file mode 100644 index 0000000..fcbc587 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug-transparent.rs @@ -0,0 +1,39 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug="transparent")] +struct A(isize); + +#[derive(Derivative)] +#[derivative(Debug="transparent")] +struct B([isize; 1]); + +#[derive(Derivative)] +#[derivative(Debug)] +enum C { + Foo(u8), + #[derivative(Debug="transparent")] + Bar(u8), +} + +trait ToDebug { + fn to_show(&self) -> String; +} + +impl ToDebug for T { + fn to_show(&self) -> String { + format!("{:?}", self) + } +} + +#[test] +fn main() { + assert_eq!(A(42).to_show(), "42".to_string()); + assert_eq!(B([42]).to_show(), "[42]".to_string()); + assert_eq!(C::Foo(42).to_show(), "Foo(42)".to_string()); + assert_eq!(C::Bar(42).to_show(), "42".to_string()); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug.rs new file mode 100644 index 0000000..f37a8ed --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-debug.rs @@ -0,0 +1,75 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: u8, + #[derivative(Debug="ignore")] + bar: u8, +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct Bar ( + u8, + #[derivative(Debug="ignore")] + u8, +); + +#[derive(Derivative)] +#[derivative(Debug)] +enum C { + C1(isize), + C2(#[derivative(Debug="ignore")] i32), + C3(String), +} + +#[derive(Derivative)] +#[derivative(Debug)] +enum D { + D1 { + #[derivative(Debug="ignore")] + a: isize + } +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct F(#[derivative(Debug="ignore")] isize); + +#[derive(Derivative)] +#[derivative(Debug)] +struct G(isize, #[derivative(Debug="ignore")] isize); + +#[derive(Derivative)] +#[derivative(Debug)] +struct J(#[derivative(Debug="ignore")] NoDebug); + +struct NoDebug; + +trait ToDebug { + fn to_show(&self) -> String; +} + +impl ToDebug for T { + fn to_show(&self) -> String { + format!("{:?}", self) + } +} + +#[test] +fn main() { + assert_eq!(Foo { foo: 42, bar: 1 }.to_show(), "Foo { foo: 42 }".to_string()); + assert_eq!(Bar(42, 1).to_show(), "Bar(42)".to_string()); + assert_eq!(C::C1(12).to_show(), "C1(12)".to_string()); + assert_eq!(C::C2(12).to_show(), "C2".to_string()); + assert_eq!(C::C3("foo".to_string()).to_show(), "C3(\"foo\")".to_string()); + assert_eq!(D::D1 { a: 42 }.to_show(), "D1".to_string()); + assert_eq!(F(42).to_show(), "F".to_string()); + assert_eq!(G(42, 0).to_show(), "G(42)".to_string()); + assert_eq!(J(NoDebug).to_show(), "J".to_string()); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-default-bounds.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-default-bounds.rs new file mode 100755 index 0000000..fda2efc --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-default-bounds.rs @@ -0,0 +1,42 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default="new")] +struct Foo { + foo: T, + #[derivative(Default(value="min()", bound="U: std::ops::Not, U: Default"))] + bar: U, +} + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default(bound="T: Default, U: std::ops::Not, U: Default", new="true"))] +struct Bar { + foo: T, + #[derivative(Default(value="min()"))] + bar: U, +} + +fn min>() -> T { + !T::default() +} + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default(bound=""))] +struct WithOption { + foo: Option, +} + +struct NonDefault; + +#[test] +fn main() { + assert_eq!(Foo::default(), Foo { foo: 0u8, bar: 0xffu8 }); + assert_eq!(Bar::default(), Bar { foo: 0u8, bar: 0xffu8 }); + assert_eq!(Foo::new(), Foo { foo: 0u8, bar: 0xffu8 }); + assert_eq!(Bar::new(), Bar { foo: 0u8, bar: 0xffu8 }); + WithOption::::default(); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-default.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-default.rs new file mode 100644 index 0000000..34e0806 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-default.rs @@ -0,0 +1,78 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default="new")] +struct Foo { + foo: u8, + #[derivative(Default(value="42"))] + bar: u8, +} + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default(new="true"))] +struct Bar ( + u8, + #[derivative(Default(value="42"))] + u8, +); + +#[derive(Debug, PartialEq)] +struct B1(u8, u8); +#[derive(Debug, PartialEq)] +struct B2{a:u8, b:u8} + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default(new="true"))] +struct Baz ( + #[derivative(Default(value="[1,2]"))] + [u8;2], + #[derivative(Default(value="[3;2]"))] + [u8;2], + #[derivative(Default(value="(4,5)"))] + (u8, u8), + #[derivative(Default(value="B1(6,7)"))] + B1, + #[derivative(Default(value="B2{a:8,b:9}"))] + B2, +); + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default)] +enum Enum1 { + #[allow(dead_code)] + A, + #[derivative(Default)] + B, +} + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default)] +enum Enum2 { + #[derivative(Default)] + A, + #[allow(dead_code)] + B, +} + +#[derive(Debug, Derivative, PartialEq)] +#[derivative(Default)] +struct A(#[derivative(Default(value="NoDefault"))] NoDefault); + +#[derive(Debug, PartialEq)] +struct NoDefault; + +#[test] +fn main() { + assert_eq!(Foo::default(), Foo { foo: 0, bar: 42 }); + assert_eq!(Foo::new(), Foo { foo: 0, bar: 42 }); + assert_eq!(Bar::default(), Bar(0, 42)); + assert_eq!(Bar::new(), Bar(0, 42)); + assert_eq!(Baz::new(), Baz([1,2], [3,3], (4,5), B1(6,7), B2{a:8,b:9})); + assert_eq!(A::default(), A(NoDefault)); + assert_eq!(Enum1::default(), Enum1::B); + assert_eq!(Enum2::default(), Enum2::A); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-eq.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-eq.rs new file mode 100644 index 0000000..e5219ed --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-eq.rs @@ -0,0 +1,48 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative, PartialEq)] +#[derivative(Eq)] +struct Foo { + foo: u8 +} + +#[derive(Derivative)] +#[derivative(Eq)] +struct WithPtr { + #[derivative(Eq(bound=""))] + foo: *const T +} + +impl PartialEq for WithPtr { + fn eq(&self, other: &Self) -> bool { + self.foo == other.foo + } +} + +trait SomeTrait {} +struct SomeType { + #[allow(dead_code)] + foo: u8 +} +impl SomeTrait for SomeType {} + +fn assert_eq(_: T) {} + +#[test] +fn main() { + assert!(Foo { foo: 7 } == Foo { foo: 7 }); + assert!(Foo { foo: 7 } != Foo { foo: 42 }); + + assert_eq(Foo { foo: 7 }); + + let ptr1: *const dyn SomeTrait = &SomeType { foo: 0 }; + let ptr2: *const dyn SomeTrait = &SomeType { foo: 1 }; + assert!(WithPtr { foo: ptr1 } == WithPtr { foo: ptr1 }); + assert!(WithPtr { foo: ptr1 } != WithPtr { foo: ptr2 }); + + assert_eq(WithPtr { foo: ptr1 }); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-hash.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-hash.rs new file mode 100755 index 0000000..e7d057a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-hash.rs @@ -0,0 +1,134 @@ +//! This tests that we compute the same hash as `derive(Hash)`. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +macro_rules! define { + ($kw:tt $($rest:tt)*) => { + #[derive(Derivative)] + #[derivative(Hash)] + $kw Ours $($rest)* + + #[derive(Hash)] + $kw Theirs $($rest)* + } +} + +struct FakeHasher<'a>(&'a mut Vec); +impl<'a> ::std::hash::Hasher for FakeHasher<'a> { + fn finish(&self) -> u64 { + unimplemented!() + } + + fn write(&mut self, bytes: &[u8]) { + self.0.extend(bytes); + } +} + +fn fake_hash(e: E) -> Vec { + let mut v = Vec::new(); + e.hash(&mut FakeHasher(&mut v)); + v +} + +#[test] +fn main() { + { + define! { + struct; + } + + assert_eq!(fake_hash(Ours), fake_hash(Theirs)); + } + + { + define! { + struct { + foo: u8 + } + } + + assert_eq!(fake_hash(Ours { foo: 0 }), fake_hash(Theirs { foo: 0 })); + assert_eq!(fake_hash(Ours { foo: 42 }), fake_hash(Theirs { foo: 42 })); + } + + { + define! { + struct<'a> { + foo: u8, + bar: &'a str, + } + } + + assert_eq!(fake_hash(Ours { foo: 0, bar: "bar" }), fake_hash(Theirs { foo: 0, bar: "bar" })); + assert_eq!(fake_hash(Ours { foo: 42, bar: "bar" }), fake_hash(Theirs { foo: 42, bar: "bar" })); + } + + { + define! { + struct<'a> (u8, &'a str); + } + + assert_eq!(fake_hash(Ours ( 0, "bar" )), fake_hash(Theirs ( 0, "bar" ))); + assert_eq!(fake_hash(Ours ( 42, "bar" )), fake_hash(Theirs ( 42, "bar" ))); + } + + { + define! { + enum { + A, B, C + } + } + + assert_eq!(fake_hash(Ours::A), fake_hash(Theirs::A)); + assert_eq!(fake_hash(Ours::B), fake_hash(Theirs::B)); + assert_eq!(fake_hash(Ours::C), fake_hash(Theirs::C)); + } + + { + define! { + enum { + A, B = 42, C + } + } + + assert_eq!(fake_hash(Ours::A), fake_hash(Theirs::A)); + assert_eq!(fake_hash(Ours::B), fake_hash(Theirs::B)); + assert_eq!(fake_hash(Ours::C), fake_hash(Theirs::C)); + } + + { + define! { + enum { + A, B = 42, C=1 + } + } + + assert_eq!(fake_hash(Ours::A), fake_hash(Theirs::A)); + assert_eq!(fake_hash(Ours::B), fake_hash(Theirs::B)); + assert_eq!(fake_hash(Ours::C), fake_hash(Theirs::C)); + } + + { + #[derive(Derivative)] + #[derivative(Hash)] + struct Ours<'a> { + foo: u8, + #[derivative(Hash="ignore")] + bar: &'a str, + baz: i64, + } + + #[derive(Hash)] + struct Theirs { + foo: u8, + baz: i64, + } + + assert_eq!(fake_hash(Ours { foo: 0, bar: "bar", baz: 312 }), fake_hash(Theirs { foo: 0, baz: 312 })); + assert_eq!(fake_hash(Ours { foo: 42, bar: "bar", baz: 312 }), fake_hash(Theirs { foo: 42, baz: 312 })); + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-ord.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-ord.rs new file mode 100644 index 0000000..93913d0 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-ord.rs @@ -0,0 +1,260 @@ +#[cfg(feature = "use_core")] +extern crate core; + +use std::marker::PhantomData; + +#[macro_use] +extern crate derivative; + +#[derive(PartialEq, Eq, Derivative)] +#[derivative(PartialOrd, Ord)] +struct Foo { + foo: u8, +} + +#[derive(PartialEq, Eq, Derivative)] +#[derivative( + PartialOrd = "feature_allow_slow_enum", + Ord = "feature_allow_slow_enum" +)] +enum Option { + None, + Some(T), +} + +#[derive(Derivative)] +#[derivative(PartialEq, PartialOrd, Ord, Eq)] +struct WithPtr { + #[derivative(PartialEq(bound = ""))] + #[derivative(PartialOrd(bound = ""))] + #[derivative(Ord(bound = ""))] + #[derivative(Eq(bound = ""))] + foo: *const T, +} + +#[derive(PartialEq, Eq, Derivative)] +#[derivative(PartialOrd, Ord)] +struct Empty; + +#[derive(PartialEq, Eq, Derivative)] +#[derivative(PartialOrd, Ord)] +struct AllIgnored { + #[derivative(PartialOrd = "ignore")] + #[derivative(Ord = "ignore")] + foo: u8, +} + +#[derive(PartialEq, Eq, Derivative)] +#[derivative(PartialOrd, Ord)] +struct OneIgnored { + #[derivative(PartialOrd = "ignore")] + #[derivative(Ord = "ignore")] + foo: u8, + bar: u8, +} + +#[derive(PartialEq, Eq, Derivative)] +#[derivative(PartialOrd, Ord)] +struct Tenth( + #[derivative( + PartialOrd(compare_with = "partial_cmp_tenth"), + Ord(compare_with = "cmp_tenth") + )] + u8, +); + +fn partial_cmp_tenth(lhs: &u8, rhs: &u8) -> std::option::Option { + if *lhs == 0 { + None + } else { + Some((lhs / 10).cmp(&(rhs / 10))) + } +} +fn cmp_tenth(lhs: &u8, rhs: &u8) -> std::cmp::Ordering { + (lhs / 10).cmp(&(rhs / 10)) +} + +#[derive(Derivative)] +#[derivative(PartialOrd, Ord, PartialEq, Eq)] +struct Generic( + #[derivative( + PartialEq = "ignore", + PartialOrd(compare_with = "dummy_partial_cmp", bound = ""), + Ord(compare_with = "dummy_cmp", bound = "") + )] + T, +); + +fn dummy_partial_cmp(_: &T, _: &T) -> std::option::Option { + Some(std::cmp::Ordering::Less) +} +fn dummy_cmp(_: &T, _: &T) -> std::cmp::Ordering { + std::cmp::Ordering::Less +} + +struct NonPartialOrd; + +#[derive(Derivative)] +#[derivative(PartialEq, PartialOrd, Ord, Eq)] +struct GenericIgnore { + f: u32, + #[derivative(PartialEq = "ignore")] + #[derivative(PartialOrd = "ignore")] + #[derivative(Ord = "ignore")] + t: PhantomData, +} + +trait SomeTrait {} +struct SomeType { + #[allow(dead_code)] + foo: u8, +} +impl SomeTrait for SomeType {} + +#[test] +fn main() { + use std::cmp::Ordering; + + assert_eq!( + Foo { foo: 7 }.partial_cmp(&Foo { foo: 42 }), + Some(Ordering::Less) + ); + assert_eq!( + Foo { foo: 42 }.partial_cmp(&Foo { foo: 42 }), + Some(Ordering::Equal) + ); + assert_eq!( + Foo { foo: 42 }.partial_cmp(&Foo { foo: 7 }), + Some(Ordering::Greater) + ); + assert_eq!(Foo { foo: 7 }.cmp(&Foo { foo: 42 }), Ordering::Less); + assert_eq!(Foo { foo: 42 }.cmp(&Foo { foo: 42 }), Ordering::Equal); + assert_eq!(Foo { foo: 42 }.cmp(&Foo { foo: 7 }), Ordering::Greater); + + let pointers: [*const dyn SomeTrait; 2] = [&SomeType { foo: 1 }, &SomeType { foo: 0 }]; + let ptr1: *const dyn SomeTrait = pointers[0]; + let ptr2: *const dyn SomeTrait = pointers[1]; + let (ptr1, ptr2) = (std::cmp::min(ptr1, ptr2), std::cmp::max(ptr1, ptr2)); + assert_eq!( + WithPtr { foo: ptr1 }.partial_cmp(&WithPtr { foo: ptr1 }), + Some(Ordering::Equal) + ); + assert_eq!( + WithPtr { foo: ptr1 }.cmp(&WithPtr { foo: ptr1 }), + Ordering::Equal + ); + assert_eq!( + WithPtr { foo: ptr1 }.partial_cmp(&WithPtr { foo: ptr2 }), + Some(Ordering::Less) + ); + assert_eq!( + WithPtr { foo: ptr1 }.cmp(&WithPtr { foo: ptr2 }), + Ordering::Less + ); + + assert_eq!(Empty.partial_cmp(&Empty), Some(Ordering::Equal)); + assert_eq!( + AllIgnored { foo: 0 }.partial_cmp(&AllIgnored { foo: 42 }), + Some(Ordering::Equal) + ); + assert_eq!( + OneIgnored { foo: 0, bar: 6 }.partial_cmp(&OneIgnored { foo: 42, bar: 7 }), + Some(Ordering::Less) + ); + assert_eq!( + OneIgnored { foo: 0, bar: 6 }.partial_cmp(&OneIgnored { foo: 42, bar: 6 }), + Some(Ordering::Equal) + ); + assert_eq!( + OneIgnored { foo: 0, bar: 7 }.partial_cmp(&OneIgnored { foo: 42, bar: 6 }), + Some(Ordering::Greater) + ); + assert_eq!(Empty.cmp(&Empty), Ordering::Equal); + assert_eq!( + AllIgnored { foo: 0 }.cmp(&AllIgnored { foo: 42 }), + Ordering::Equal + ); + assert_eq!( + OneIgnored { foo: 0, bar: 6 }.cmp(&OneIgnored { foo: 42, bar: 7 }), + Ordering::Less + ); + assert_eq!( + OneIgnored { foo: 0, bar: 6 }.cmp(&OneIgnored { foo: 42, bar: 6 }), + Ordering::Equal + ); + assert_eq!( + OneIgnored { foo: 0, bar: 7 }.cmp(&OneIgnored { foo: 42, bar: 6 }), + Ordering::Greater + ); + + assert_eq!( + Option::None::.partial_cmp(&Option::Some(7)), + Some(Ordering::Less) + ); + assert_eq!( + Option::Some(6).partial_cmp(&Option::Some(7)), + Some(Ordering::Less) + ); + assert_eq!( + Option::Some(42).partial_cmp(&Option::Some(42)), + Some(Ordering::Equal) + ); + assert_eq!( + Option::None::.partial_cmp(&Option::None::), + Some(Ordering::Equal) + ); + assert_eq!( + Option::Some(7).partial_cmp(&Option::Some(6)), + Some(Ordering::Greater) + ); + assert_eq!( + Option::Some(7).partial_cmp(&Option::None::), + Some(Ordering::Greater) + ); + assert_eq!(Option::None::.cmp(&Option::Some(7)), Ordering::Less); + assert_eq!(Option::Some(6).cmp(&Option::Some(7)), Ordering::Less); + assert_eq!(Option::Some(42).cmp(&Option::Some(42)), Ordering::Equal); + assert_eq!(Option::None::.cmp(&Option::None::), Ordering::Equal); + assert_eq!(Option::Some(7).cmp(&Option::Some(6)), Ordering::Greater); + assert_eq!(Option::Some(7).cmp(&Option::None::), Ordering::Greater); + + assert_eq!(Tenth(0).partial_cmp(&Tenth(67)), None); + assert_eq!(Tenth(42).partial_cmp(&Tenth(67)), Some(Ordering::Less)); + assert_eq!(Tenth(60).partial_cmp(&Tenth(67)), Some(Ordering::Equal)); + assert_eq!(Tenth(100).partial_cmp(&Tenth(67)), Some(Ordering::Greater)); + assert_eq!(Tenth(42).cmp(&Tenth(67)), Ordering::Less); + assert_eq!(Tenth(60).cmp(&Tenth(67)), Ordering::Equal); + assert_eq!(Tenth(100).cmp(&Tenth(67)), Ordering::Greater); + + assert_eq!( + Generic(SomeType { foo: 0 }).partial_cmp(&Generic(SomeType { foo: 0 })), + Some(Ordering::Less) + ); + assert_eq!( + Generic(SomeType { foo: 0 }).cmp(&Generic(SomeType { foo: 0 })), + Ordering::Less + ); + + assert_eq!( + GenericIgnore { + f: 123, + t: PhantomData::::default() + } + .cmp(&GenericIgnore { + f: 123, + t: PhantomData::::default() + }), + Ordering::Equal + ); + assert_eq!( + GenericIgnore { + f: 123, + t: PhantomData::::default() + } + .partial_cmp(&GenericIgnore { + f: 123, + t: PhantomData::::default() + }), + Some(Ordering::Equal) + ); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/derive-partial-eq.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-partial-eq.rs new file mode 100644 index 0000000..8a8f228 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/derive-partial-eq.rs @@ -0,0 +1,146 @@ +#[cfg(feature = "use_core")] +extern crate core; + +use std::marker::PhantomData; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Foo { + foo: u8, +} + +/// Test for backward compatibility. +#[derive(Derivative)] +#[derivative(PartialEq = "feature_allow_slow_enum")] +#[allow(unused)] +enum AllowsFeature { + Some(T), + None, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +enum Option { + Some(T), + None, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +enum SimpleEnum { + Some, + None, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +enum UnitEnum { + Single, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct WithPtr { + #[derivative(PartialEq(bound = ""))] + foo: *const T, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Empty; + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct AllIgnored { + #[derivative(PartialEq = "ignore")] + foo: u8, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct OneIgnored { + #[derivative(PartialEq = "ignore")] + foo: u8, + bar: u8, +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Parity(#[derivative(PartialEq(compare_with = "same_parity"))] u8); + +fn same_parity(lhs: &u8, rhs: &u8) -> bool { + lhs % 2 == rhs % 2 +} + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Generic(#[derivative(PartialEq(compare_with = "dummy_cmp", bound = ""))] T); + +fn dummy_cmp(_: &T, _: &T) -> bool { + true +} + +struct NonPartialEq; + +#[derive(Derivative)] +#[derivative(PartialEq, Eq)] +struct GenericIgnore { + f: u32, + #[derivative(PartialEq = "ignore")] + t: PhantomData, +} + +trait SomeTrait {} +struct SomeType { + #[allow(dead_code)] + foo: u8, +} +impl SomeTrait for SomeType {} + +#[test] +fn main() { + assert!(Foo { foo: 7 } == Foo { foo: 7 }); + assert!(Foo { foo: 7 } != Foo { foo: 42 }); + + let ptr1: *const dyn SomeTrait = &SomeType { foo: 0 }; + let ptr2: *const dyn SomeTrait = &SomeType { foo: 1 }; + assert!(WithPtr { foo: ptr1 } == WithPtr { foo: ptr1 }); + assert!(WithPtr { foo: ptr1 } != WithPtr { foo: ptr2 }); + + assert!(Empty == Empty); + assert!(AllIgnored { foo: 0 } == AllIgnored { foo: 42 }); + assert!(OneIgnored { foo: 0, bar: 6 } == OneIgnored { foo: 42, bar: 6 }); + assert!(OneIgnored { foo: 0, bar: 6 } != OneIgnored { foo: 42, bar: 7 }); + + assert!(Option::Some(42) == Option::Some(42)); + assert!(Option::Some(0) != Option::Some(42)); + assert!(Option::Some(42) != Option::None); + assert!(Option::None != Option::Some(42)); + assert!(Option::None:: == Option::None::); + + assert!(SimpleEnum::Some == SimpleEnum::Some); + assert!(SimpleEnum::None == SimpleEnum::None); + assert!(SimpleEnum::Some != SimpleEnum::None); + assert!(SimpleEnum::None != SimpleEnum::Some); + + assert!(UnitEnum::Single == UnitEnum::Single); + + assert!(Parity(3) == Parity(7)); + assert!(Parity(2) == Parity(42)); + assert!(Parity(3) != Parity(42)); + assert!(Parity(2) != Parity(7)); + + assert!(Generic(SomeType { foo: 0 }) == Generic(SomeType { foo: 0 })); + assert!( + GenericIgnore { + f: 123, + t: PhantomData::::default() + } == GenericIgnore { + f: 123, + t: PhantomData::::default() + } + ); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/issue-37-turbofish.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-37-turbofish.rs new file mode 100644 index 0000000..4e634b8 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-37-turbofish.rs @@ -0,0 +1,12 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +pub struct A { + #[derivative(Debug(format_with = "std::fmt::Debug::fmt"))] + v: u64, +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/issue-55.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-55.rs new file mode 100644 index 0000000..ceac0ef --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-55.rs @@ -0,0 +1,21 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +trait Foo {} + +fn fmt(_: &T, _: &mut std::fmt::Formatter) -> std::fmt::Result { + unimplemented!() +} + +#[derive(Debug)] +struct Qux<'a, T: Foo>(&'a T); + +#[derive(Derivative)] +#[derivative(Debug)] +struct Bar<'a, T: Foo>(#[derivative(Debug(format_with="fmt"))] Qux<'a, T>); + +fn main() { +} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/issue-57.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-57.rs new file mode 100644 index 0000000..e3dc650 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-57.rs @@ -0,0 +1,19 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +macro_rules! gen { + ($name:ident) => { + #[derive(Derivative)] + #[derivative(Debug)] + pub struct $name { + a: i32 + } + }; +} + +gen!(Test); + +fn main() {} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/issue-58.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-58.rs new file mode 100644 index 0000000..14673b2 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-58.rs @@ -0,0 +1,18 @@ +#![forbid(clippy::all)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Default, Derivative)] +#[derivative(Debug)] +pub struct Foo { + foo: u8, +} + +fn main() { + let foo1 = Foo::default(); + println!("foo = {:?}", foo1); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/issue-67.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-67.rs new file mode 100644 index 0000000..76e2b9e --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/issue-67.rs @@ -0,0 +1,11 @@ +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Hash)] +enum Enumeration { + _Variant(T), +} \ No newline at end of file diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-class-implement-traits.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-class-implement-traits.rs new file mode 100644 index 0000000..5c79305 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-class-implement-traits.rs @@ -0,0 +1,80 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_camel_case_types)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +trait noisy { + fn speak(&mut self); +} + +#[derive(Derivative)] +#[derivative(Clone)] +struct cat { + meows : usize, + + how_hungry : isize, + name : String, +} + +impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { + self.how_hungry += 1; + } + } +} + +impl cat { + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } else { + println!("Not hungry!"); + return false; + } + } +} + +impl noisy for cat { + fn speak(&mut self) { self.meow(); } +} + +fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name.clone() + } +} + + +fn make_speak(mut c: C) { + c.speak(); +} + +#[test] +fn main() { + let mut nyan = cat(0_usize, 2, "nyan".to_string()); + nyan.eat(); + assert!((!nyan.eat())); + for _ in 1_usize..10_usize { + make_speak(nyan.clone()); + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-bounds.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-bounds.rs new file mode 100644 index 0000000..7be0c57 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-bounds.rs @@ -0,0 +1,24 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Copy, Clone)] +struct Test; + +#[test] +fn main() { + let _ = Test; +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-array.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-array.rs new file mode 100644 index 0000000..446eb49 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-array.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// test for issue #30244 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Copy, Clone)] +#[allow(dead_code)] +struct Array { + arr: [[u8; 256]; 4] +} + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-enum.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-enum.rs new file mode 100644 index 0000000..0464d97 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-enum.rs @@ -0,0 +1,32 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Clone)] +enum E { + A, + B(()), + C, +} + +#[test] +fn main() { + let _ = E::A.clone(); + let _ = E::B(()).clone(); + let _ = E::C.clone(); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-enum.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-enum.rs new file mode 100644 index 0000000..58b9b1e --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-enum.rs @@ -0,0 +1,31 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Clone)] +#[allow(dead_code)] +enum E { + A(T), + B(T,U), + C +} + +#[test] +fn main() { + let _ = E::A::(1).clone(); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-tuple-struct.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-tuple-struct.rs new file mode 100644 index 0000000..e1cc224 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-generic-tuple-struct.rs @@ -0,0 +1,26 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Clone)] +struct S(T, ()); + +#[test] +fn main() { + let _ = S(1, ()).clone(); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-struct.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-struct.rs new file mode 100644 index 0000000..aa2f75b --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-struct.rs @@ -0,0 +1,45 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Default, Derivative)] +#[derivative(Clone)] +struct S { + _int: isize, + _i8: i8, + _i16: i16, + _i32: i32, + _i64: i64, + + _uint: usize, + _u8: u8, + _u16: u16, + _u32: u32, + _u64: u64, + + _f32: f32, + _f64: f64, + + _bool: bool, + _char: char, + _nil: () +} + +#[test] +fn main() { + let _ = S::default().clone(); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-tuple-struct.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-tuple-struct.rs new file mode 100644 index 0000000..f5815d6 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-clone-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Clone)] +struct S((), ()); + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-enum.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-enum.rs new file mode 100644 index 0000000..c18ba22 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-enum.rs @@ -0,0 +1,68 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-pretty-expanded FIXME #15189 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative( + PartialEq = "feature_allow_slow_enum", + Eq, + PartialOrd = "feature_allow_slow_enum", + Ord = "feature_allow_slow_enum" +)] +enum E { + E0, + E1(T), + E2(T, T), +} + +#[test] +fn main() { + let e0 = E::E0; + let e11 = E::E1(1); + let e12 = E::E1(2); + let e21 = E::E2(1, 1); + let e22 = E::E2(1, 2); + + // in order for both PartialOrd and Ord + let es = [e0, e11, e12, e21, e22]; + + for (i, e1) in es.iter().enumerate() { + for (j, e2) in es.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let lt = i < j; + let le = i <= j; + let gt = i > j; + let ge = i >= j; + + // PartialEq + assert_eq!(*e1 == *e2, eq); + assert_eq!(*e1 != *e2, !eq); + + // PartialOrd + assert_eq!(*e1 < *e2, lt); + assert_eq!(*e1 > *e2, gt); + + assert_eq!(*e1 <= *e2, le); + assert_eq!(*e1 >= *e2, ge); + + // Ord + assert_eq!(e1.cmp(e2), ord); + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct-enum.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct-enum.rs new file mode 100644 index 0000000..780ef3a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct-enum.rs @@ -0,0 +1,66 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-pretty-expanded FIXME #15189 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative( + PartialEq = "feature_allow_slow_enum", + Eq, + PartialOrd = "feature_allow_slow_enum", + Ord = "feature_allow_slow_enum" +)] +enum ES { + ES1 { x: T }, + ES2 { x: T, y: T }, +} + + +pub fn main() { + let (es11, es12, es21, es22) = ( + ES::ES1 { x: 1 }, + ES::ES1 { x: 2 }, + ES::ES2 { x: 1, y: 1 }, + ES::ES2 { x: 1, y: 2 }, + ); + + // in order for both PartialOrd and Ord + let ess = [es11, es12, es21, es22]; + + for (i, es1) in ess.iter().enumerate() { + for (j, es2) in ess.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let (lt, le) = (i < j, i <= j); + let (gt, ge) = (i > j, i >= j); + + // PartialEq + assert_eq!(*es1 == *es2, eq); + assert_eq!(*es1 != *es2, !eq); + + // PartialOrd + assert_eq!(*es1 < *es2, lt); + assert_eq!(*es1 > *es2, gt); + + assert_eq!(*es1 <= *es2, le); + assert_eq!(*es1 >= *es2, ge); + + // Ord + assert_eq!(es1.cmp(es2), ord); + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct.rs new file mode 100644 index 0000000..2c38728 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-struct.rs @@ -0,0 +1,58 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-pretty-expanded FIXME #15189 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq, Eq, PartialOrd, Ord)] +struct S { + x: T, + y: T, +} + +pub fn main() { + let s1 = S { x: 1, y: 1 }; + let s2 = S { x: 1, y: 2 }; + + // in order for both PartialOrd and Ord + let ss = [s1, s2]; + + for (i, s1) in ss.iter().enumerate() { + for (j, s2) in ss.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let lt = i < j; + let le = i <= j; + let gt = i > j; + let ge = i >= j; + + // PartialEq + assert_eq!(*s1 == *s2, eq); + assert_eq!(*s1 != *s2, !eq); + + // PartialOrd + assert_eq!(*s1 < *s2, lt); + assert_eq!(*s1 > *s2, gt); + + assert_eq!(*s1 <= *s2, le); + assert_eq!(*s1 >= *s2, ge); + + // Ord + assert_eq!(s1.cmp(s2), ord); + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-tuple-struct.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-tuple-struct.rs new file mode 100644 index 0000000..ffcb177 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-cmp-generic-tuple-struct.rs @@ -0,0 +1,55 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-pretty-expanded FIXME #15189 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq, Eq, PartialOrd, Ord)] +struct TS(T, T); + +pub fn main() { + let ts1 = TS(1, 1); + let ts2 = TS(1, 2); + + // in order for both PartialOrd and Ord + let tss = [ts1, ts2]; + + for (i, ts1) in tss.iter().enumerate() { + for (j, ts2) in tss.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let lt = i < j; + let le = i <= j; + let gt = i > j; + let ge = i >= j; + + // PartialEq + assert_eq!(*ts1 == *ts2, eq); + assert_eq!(*ts1 != *ts2, !eq); + + // PartialOrd + assert_eq!(*ts1 < *ts2, lt); + assert_eq!(*ts1 > *ts2, gt); + + assert_eq!(*ts1 <= *ts2, le); + assert_eq!(*ts1 >= *ts2, ge); + + // Ord + assert_eq!(ts1.cmp(ts2), ord); + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-copyclone.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-copyclone.rs new file mode 100644 index 0000000..acf6be4 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-copyclone.rs @@ -0,0 +1,59 @@ +// Copyright 2016 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +//! Test that #[derive(Copy, Clone)] produces a shallow copy +//! even when a member violates RFC 1521 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::sync::atomic::{AtomicBool, Ordering}; + +/// A struct that pretends to be Copy, but actually does something +/// in its Clone impl +#[derive(Copy)] +struct Liar; + +/// Static cooperating with the rogue Clone impl +static CLONED: AtomicBool = AtomicBool::new(false); + +impl Clone for Liar { + fn clone(&self) -> Self { + // this makes Clone vs Copy observable + CLONED.store(true, Ordering::SeqCst); + + *self + } +} + +/// This struct is actually Copy... at least, it thinks it is! +#[derive(Copy, Clone)] +struct TheirTheir(Liar); + +#[derive(Derivative)] +#[derivative(Copy, Clone)] +struct OurOur1(Liar); +#[derive(Derivative)] +#[derivative(Clone, Copy)] +struct OurOur2(Liar); + +#[test] +fn main() { + let _ = TheirTheir(Liar).clone(); + assert!(!CLONED.load(Ordering::SeqCst), "TheirTheir"); + + let _ = OurOur1(Liar).clone(); + assert!(!CLONED.load(Ordering::SeqCst), "OurOur1"); + let _ = OurOur2(Liar).clone(); + assert!(!CLONED.load(Ordering::SeqCst), "OurOur2"); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-default-box.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-default-box.rs new file mode 100644 index 0000000..adcdd92 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-default-box.rs @@ -0,0 +1,30 @@ +// Copyright 2013-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::default::Default; + +#[derive(Derivative)] +#[derivative(Default)] +struct A { + foo: Box<[bool]>, +} + +#[test] +fn main() { + let a: A = Default::default(); + let b: Box<[_]> = Box::<[bool; 0]>::new([]); + assert_eq!(a.foo, b); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-enum-single-variant.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-enum-single-variant.rs new file mode 100644 index 0000000..70b647c --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-enum-single-variant.rs @@ -0,0 +1,30 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +pub type TaskId = isize; + +#[derive(Derivative)] +#[derivative(PartialEq="feature_allow_slow_enum")] +pub enum Task { + TaskHandle(TaskId) +} + +#[test] +fn main() { + let _ = Task::TaskHandle(42); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-hash.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-hash.rs new file mode 100644 index 0000000..f5373c1 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-hash.rs @@ -0,0 +1,83 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_camel_case_types)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::hash::{Hash, Hasher}; +use std::collections::hash_map::DefaultHasher; + +#[derive(Derivative)] +#[derivative(Hash)] +struct Person { + id: u16, + name: String, + phone: u64, +} + +// test for hygiene name collisions +#[derive(Derivative)] +#[derivative(Hash)] struct __H__H; +#[derive(Derivative)] +#[allow(dead_code)] #[derivative(Hash)] struct Collision<__H> ( __H ); +// TODO(rustc) #[derivative(Hash)] enum Collision<__H> { __H { __H__H: __H } } + +#[derive(Derivative)] +#[derivative(Hash)] +enum E { A=1, B } + +fn hash(t: &T) -> u64 { + let mut s = DefaultHasher::new(); + t.hash(&mut s); + s.finish() +} + +struct FakeHasher<'a>(&'a mut Vec); +impl<'a> Hasher for FakeHasher<'a> { + fn finish(&self) -> u64 { + unimplemented!() + } + + fn write(&mut self, bytes: &[u8]) { + self.0.extend(bytes); + } +} + +fn fake_hash(v: &mut Vec, e: E) { + e.hash(&mut FakeHasher(v)); +} + +#[test] +fn main() { + let person1 = Person { + id: 5, + name: "Janet".to_string(), + phone: 555_666_7777 + }; + let person2 = Person { + id: 5, + name: "Bob".to_string(), + phone: 555_666_7777 + }; + assert_eq!(hash(&person1), hash(&person1)); + assert!(hash(&person1) != hash(&person2)); + + // test #21714 + let mut va = vec![]; + let mut vb = vec![]; + fake_hash(&mut va, E::A); + fake_hash(&mut vb, E::B); + assert!(va != vb); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-in-fn.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-in-fn.rs new file mode 100644 index 0000000..7d38e74 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-in-fn.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[test] +fn main() { + #[derive(Derivative)] + #[derivative(Debug)] + struct Foo { + foo: isize, + } + + let f = Foo { foo: 10 }; + format!("{:?}", f); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta-multiple.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta-multiple.rs new file mode 100644 index 0000000..ed57d31 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta-multiple.rs @@ -0,0 +1,40 @@ +// Copyright 2013-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::hash::Hash; + +// testing multiple separate deriving attributes +#[derive(Derivative)] +#[derivative(PartialEq)] +#[derivative(Clone)] +#[derivative(Hash)] +struct Foo { + bar: usize, + baz: isize +} + +fn hash(_t: &T) {} + +#[test] +fn main() { + let a = Foo {bar: 4, baz: -3}; + + let _ = a == a; // check for PartialEq impl w/o testing its correctness + let _ = a.clone(); // check for Clone impl w/o testing its correctness + hash(&a); // check for Hash impl w/o testing its correctness +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta.rs new file mode 100644 index 0000000..546e0dc --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-meta.rs @@ -0,0 +1,37 @@ +// Copyright 2013-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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::hash::Hash; + +#[derive(Derivative)] +#[derivative(PartialEq, Clone, Hash)] +struct Foo { + bar: usize, + baz: isize +} + +fn hash(_t: &T) {} + +#[test] +fn main() { + let a = Foo {bar: 4, baz: -3}; + + let _ = a == a; // check for PartialEq impl w/o testing its correctness + let _ = a.clone(); // check for Clone impl w/o testing its correctness + hash(&a); // check for Hash impl w/o testing its correctness +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show-2.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show-2.rs new file mode 100644 index 0000000..5863f5e --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show-2.rs @@ -0,0 +1,75 @@ +#![allow(dead_code)] +#![deny(unused_variables)] // We used to generate warning: unused variable: `f` + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::fmt; + +#[derive(Derivative)] +#[derivative(Debug)] +enum A {} +#[derive(Derivative)] +#[derivative(Debug)] +enum B { B1, B2, B3 } + +#[derive(Derivative)] +#[derivative(Debug)] +enum C { C1(isize), C2(B), C3(String) } + +#[derive(Derivative)] +#[derivative(Debug)] +enum D { D1{ a: isize } } + +#[derive(Derivative)] +#[derivative(Debug)] +struct E; +#[derive(Derivative)] +#[derivative(Debug)] +struct F(isize); +#[derive(Derivative)] +#[derivative(Debug)] +struct G(isize, isize); +#[derive(Derivative)] +#[derivative(Debug)] +struct H { a: isize } +#[derive(Derivative)] +#[derivative(Debug)] +struct I { a: isize, b: isize } +#[derive(Derivative)] +#[derivative(Debug)] +struct J(Custom); + +struct Custom; +impl fmt::Debug for Custom { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "yay") + } +} + +trait ToDebug { + fn to_show(&self) -> String; +} + +impl ToDebug for T { + fn to_show(&self) -> String { + format!("{:?}", self) + } +} + +#[test] +fn main() { + assert_eq!(B::B1.to_show(), "B1".to_string()); + assert_eq!(B::B2.to_show(), "B2".to_string()); + assert_eq!(C::C1(3).to_show(), "C1(3)".to_string()); + assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_string()); + assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2 }".to_string()); + assert_eq!(E.to_show(), "E".to_string()); + assert_eq!(F(3).to_show(), "F(3)".to_string()); + assert_eq!(G(3, 4).to_show(), "G(3, 4)".to_string()); + assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2, b: 4 }".to_string()); + assert_eq!(J(Custom).to_show(), "J(yay)".to_string()); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show.rs new file mode 100644 index 0000000..525d602 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-show.rs @@ -0,0 +1,51 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Unit; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Tuple(isize, usize); + +#[derive(Derivative)] +#[derivative(Debug)] +struct Struct { x: isize, y: usize } + +#[derive(Derivative)] +#[derivative(Debug)] +enum Enum { + Nullary, + Variant(isize, usize), + StructVariant { x: isize, y : usize } +} + +macro_rules! t { + ($x:expr, $expected:expr) => { + assert_eq!(format!("{:?}", $x), $expected.to_string()) + } +} + +#[test] +fn main() { + t!(Unit, "Unit"); + t!(Tuple(1, 2), "Tuple(1, 2)"); + t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }"); + t!(Enum::Nullary, "Nullary"); + t!(Enum::Variant(1, 2), "Variant(1, 2)"); + t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }"); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-enum.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-enum.rs new file mode 100644 index 0000000..c534858 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-enum.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Hash)] +#[allow(dead_code)] +enum Foo { + Bar(isize, char), + Baz(char, isize) +} + +#[derive(Derivative)] +#[derivative(Hash)] +#[allow(dead_code)] +enum A { + B, + C, + D, + E +} + +#[test] +fn main(){} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-struct.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-struct.rs new file mode 100644 index 0000000..c8538c9 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-hash-struct.rs @@ -0,0 +1,34 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::collections::hash_map::DefaultHasher; + +#[derive(Derivative)] +#[derivative(Hash)] +struct Foo { + x: isize, + y: isize, + z: isize +} + +#[test] +fn main() { + use std::hash::Hash; + let mut hasher = DefaultHasher::new(); + let _ = Foo { x: 0, y: 0, z: 0 }.hash(&mut hasher); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-type-params.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-type-params.rs new file mode 100644 index 0000000..9fb62ce --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-deriving-via-extension-type-params.rs @@ -0,0 +1,33 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq, Hash, Debug)] +struct Foo { + x: isize, + y: T, + z: isize +} + +#[test] +fn main() { + let a = Foo { x: 1, y: 2.0f64, z: 3 }; + let b = Foo { x: 1, y: 2.0f64, z: 3 }; + assert_eq!(a, b); + assert!(!(a != b)); + assert!(a.eq(&b)); + assert!(!a.ne(&b)); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-expr-copy.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-expr-copy.rs new file mode 100644 index 0000000..ab3ae91 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-expr-copy.rs @@ -0,0 +1,35 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + + +fn f(arg: &mut A) { + arg.a = 100; +} + +#[derive(Derivative)] +#[derivative(Copy, Clone)] +struct A { a: isize } + +#[test] +fn main() { + let mut x = A {a: 10}; + f(&mut x); + assert_eq!(x.a, 100); + x.a = 20; + let mut y = x; + f(&mut y); + assert_eq!(x.a, 20); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-exterior.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-exterior.rs new file mode 100644 index 0000000..ec59daa --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-exterior.rs @@ -0,0 +1,41 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +use std::cell::Cell; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Copy, Clone)] +struct Point {x: isize, y: isize, z: isize} + +fn f(p: &Cell) { + assert_eq!(p.get().z, 12); + p.set(Point {x: 10, y: 11, z: 13}); + assert_eq!(p.get().z, 13); +} + +#[test] +fn main() { + let a: Point = Point {x: 10, y: 11, z: 12}; + let b: &Cell = &Cell::new(a); + assert_eq!(b.get().z, 12); + f(b); + assert_eq!(a.x, 10); + assert_eq!(a.y, 11); + assert_eq!(a.z, 12); + assert_eq!(b.get().x, 10); + assert_eq!(b.get().y, 11); + assert_eq!(b.get().z, 13); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-12860.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-12860.rs new file mode 100644 index 0000000..f0d5602 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-12860.rs @@ -0,0 +1,67 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +use std::collections::HashSet; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Hash)] +#[derive(Copy, Clone, PartialEq, Eq)] +struct XYZ { + x: isize, + y: isize, + z: isize +} + +#[test] +fn main() { + let mut connected = HashSet::new(); + let mut border = HashSet::new(); + + let middle = XYZ{x: 0, y: 0, z: 0}; + border.insert(middle); + + while !border.is_empty() && connected.len() < 10000 { + let choice = *(border.iter().next().unwrap()); + border.remove(&choice); + connected.insert(choice); + + let cxp = XYZ{x: choice.x + 1, y: choice.y, z: choice.z}; + let cxm = XYZ{x: choice.x - 1, y: choice.y, z: choice.z}; + let cyp = XYZ{x: choice.x, y: choice.y + 1, z: choice.z}; + let cym = XYZ{x: choice.x, y: choice.y - 1, z: choice.z}; + let czp = XYZ{x: choice.x, y: choice.y, z: choice.z + 1}; + let czm = XYZ{x: choice.x, y: choice.y, z: choice.z - 1}; + + if !connected.contains(&cxp) { + border.insert(cxp); + } + if !connected.contains(&cxm){ + border.insert(cxm); + } + if !connected.contains(&cyp){ + border.insert(cyp); + } + if !connected.contains(&cym) { + border.insert(cym); + } + if !connected.contains(&czp){ + border.insert(czp); + } + if !connected.contains(&czm) { + border.insert(czm); + } + } +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-13434.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-13434.rs new file mode 100644 index 0000000..f2ccab5 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-13434.rs @@ -0,0 +1,38 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct MyStruct; + +trait Repro { + fn repro(self, s: MyStruct) -> String; +} + +impl Repro for F where F: FnOnce(MyStruct) -> String { + fn repro(self, s: MyStruct) -> String { + self(s) + } +} + +fn do_stuff(r: R) -> String { + r.repro(MyStruct) +} + +#[test] +fn main() { + assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-16530.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-16530.rs new file mode 100644 index 0000000..3cf55c6 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-16530.rs @@ -0,0 +1,32 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(deprecated)] + +#[cfg(feature = "use_core")] +extern crate core; + +use std::hash::{SipHasher, Hasher, Hash}; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Hash)] +struct Empty; + +#[test] +fn main() { + let mut s1 = SipHasher::new_with_keys(0, 0); + Empty.hash(&mut s1); + let mut s2 = SipHasher::new_with_keys(0, 0); + Empty.hash(&mut s2); + assert_eq!(s1.finish(), s2.finish()); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19037.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19037.rs new file mode 100644 index 0000000..06f461a --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19037.rs @@ -0,0 +1,38 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +struct Str([u8]); + +#[derive(Derivative)] +#[derivative(Clone)] +struct CharSplits<'a, Sep> { + string: &'a Str, + sep: Sep, + allow_trailing_empty: bool, + only_ascii: bool, + finished: bool, +} + +fn clone(s: &Str) -> &Str { + Clone::clone(&s) +} + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19102.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19102.rs new file mode 100644 index 0000000..8530b84 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19102.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(unused_qualifications)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq="feature_allow_slow_enum")] +pub enum A { + B, +} + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19135.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19135.rs new file mode 100644 index 0000000..a73625c --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19135.rs @@ -0,0 +1,30 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +use std::marker::PhantomData; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct LifetimeStruct<'a>(PhantomData<&'a ()>); + +#[test] +fn main() { + takes_hrtb_closure(|lts| println!("{:?}", lts)); +} + +fn takes_hrtb_closureFnMut(LifetimeStruct<'a>)>(mut f: F) { + f(LifetimeStruct(PhantomData)); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19358.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19358.rs new file mode 100644 index 0000000..6f528ad --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-19358.rs @@ -0,0 +1,38 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +trait Trait { fn dummy(&self) { } } + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Foo { + foo: T, +} + +#[derive(Derivative)] +#[derivative(Debug)] +struct Bar where T: Trait { + bar: T, +} + +impl Trait for isize {} + +#[test] +fn main() { + let a = Foo { foo: 12 }; + let b = Bar { bar: 12 }; + println!("{:?} {:?}", a, b); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-21402.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-21402.rs new file mode 100644 index 0000000..6e95117 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-21402.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Hash)] +#[allow(dead_code)] +struct Foo { + a: Vec, + b: (bool, bool), + c: [bool; 2], +} + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-23649-3.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-23649-3.rs new file mode 100644 index 0000000..1437fe1 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-23649-3.rs @@ -0,0 +1,23 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[allow(dead_code)] +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Slice { slice: [u8] } + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-24085.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-24085.rs new file mode 100644 index 0000000..cf78344 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-24085.rs @@ -0,0 +1,36 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for #24085. Errors were occurring in region +// inference due to the requirement that `'a:b'`, which was getting +// incorrectly translated in connection with the closure below. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Copy,Clone)] +#[allow(dead_code)] +struct Path<'a:'b, 'b> { + x: &'a i32, + tail: Option<&'b Path<'a, 'b>> +} + +#[allow(dead_code, unconditional_recursion)] +fn foo<'a,'b,F>(p: Path<'a, 'b>, mut f: F) + where F: for<'c> FnMut(Path<'a, 'c>) { + foo(p, |x| f(x)) +} + +#[test] +fn main() { } diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-25394.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-25394.rs new file mode 100644 index 0000000..7f75ef9 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-25394.rs @@ -0,0 +1,26 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Row([T]); + +fn use_row(_: &Row) {} + +#[test] +fn main() { + let _ = use_row; +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-28561.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-28561.rs new file mode 100644 index 0000000..772625f --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-28561.rs @@ -0,0 +1,134 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug, Default, Eq, Hash, PartialEq)] +// TODO: Ord, PartialOrd +struct Array { + f00: [T; 00], + f01: [T; 01], + f02: [T; 02], + f03: [T; 03], + f04: [T; 04], + f05: [T; 05], + f06: [T; 06], + f07: [T; 07], + f08: [T; 08], + f09: [T; 09], + f10: [T; 10], + f11: [T; 11], + f12: [T; 12], + f13: [T; 13], + f14: [T; 14], + f15: [T; 15], + f16: [T; 16], + f17: [T; 17], + f18: [T; 18], + f19: [T; 19], + f20: [T; 20], + f21: [T; 21], + f22: [T; 22], + f23: [T; 23], + f24: [T; 24], + f25: [T; 25], + f26: [T; 26], + f27: [T; 27], + f28: [T; 28], + f29: [T; 29], + f30: [T; 30], + f31: [T; 31], + f32: [T; 32], +} + +// FIXME(#7622): merge with `Array` once `[T; N]: Clone` where `T: Clone` +#[derive(Derivative)] +#[derivative(Clone, Copy)] +struct CopyArray { + f00: [T; 00], + f01: [T; 01], + f02: [T; 02], + f03: [T; 03], + f04: [T; 04], + f05: [T; 05], + f06: [T; 06], + f07: [T; 07], + f08: [T; 08], + f09: [T; 09], + f10: [T; 10], + f11: [T; 11], + f12: [T; 12], + f13: [T; 13], + f14: [T; 14], + f15: [T; 15], + f16: [T; 16], + f17: [T; 17], + f18: [T; 18], + f19: [T; 19], + f20: [T; 20], + f21: [T; 21], + f22: [T; 22], + f23: [T; 23], + f24: [T; 24], + f25: [T; 25], + f26: [T; 26], + f27: [T; 27], + f28: [T; 28], + f29: [T; 29], + f30: [T; 30], + f31: [T; 31], + f32: [T; 32], +} + +#[derive(Derivative)] +#[derivative(Clone, Copy, Debug, Eq, Hash, PartialEq)] +// TODO: Ord, PartialOrd +struct Fn { + f00: fn(), + f01: fn(A), + f02: fn(A, B), + f03: fn(A, B, C), + f04: fn(A, B, C, D), + f05: fn(A, B, C, D, E), + f06: fn(A, B, C, D, E, F), + f07: fn(A, B, C, D, E, F, G), + f08: fn(A, B, C, D, E, F, G, H), + f09: fn(A, B, C, D, E, F, G, H, I), + f10: fn(A, B, C, D, E, F, G, H, I, J), + f11: fn(A, B, C, D, E, F, G, H, I, J, K), + f12: fn(A, B, C, D, E, F, G, H, I, J, K, L), +} + +#[derive(Derivative)] +#[derivative(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)] +// TODO: Ord, PartialOrd +struct Tuple { + f00: (), + f01: (A,), + f02: (A, B), + f03: (A, B, C), + f04: (A, B, C, D), + f05: (A, B, C, D, E), + f06: (A, B, C, D, E, F), + f07: (A, B, C, D, E, F, G), + f08: (A, B, C, D, E, F, G, H), + f09: (A, B, C, D, E, F, G, H, I), + f10: (A, B, C, D, E, F, G, H, I, J), + f11: (A, B, C, D, E, F, G, H, I, J, K), + f12: (A, B, C, D, E, F, G, H, I, J, K, L), +} + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29030.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29030.rs new file mode 100644 index 0000000..159f7df --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29030.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct Message<'a, P: 'a = &'a [u8]> { + header: &'a [u8], + payload: P, +} + +#[test] +fn main() { + Message { header: &[1], payload: &[1] }; +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29540.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29540.rs new file mode 100644 index 0000000..3b1fcf7 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29540.rs @@ -0,0 +1,509 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +pub struct Config { + pub name: String, + pub cluster: String, + pub debug_none: String, + pub debug_lockdep: String, + pub debug_context: String, + pub debug_crush: String, + pub debug_mds: String, + pub debug_mds_balancer: String, + pub debug_mds_locker: String, + pub debug_mds_log: String, + pub debug_mds_log_expire: String, + pub debug_mds_migrator: String, + pub debug_buffer: String, + pub debug_timer: String, + pub debug_filer: String, + pub debug_striper: String, + pub debug_objecter: String, + pub debug_rados: String, + pub debug_rbd: String, + pub debug_journaler: String, + pub debug_objectcacher: String, + pub debug_client: String, + pub debug_osd: String, + pub debug_optracker: String, + pub debug_objclass: String, + pub debug_filestore: String, + pub debug_keyvaluestore: String, + pub debug_journal: String, + pub debug_ms: String, + pub debug_mon: String, + pub debug_monc: String, + pub debug_paxos: String, + pub debug_tp: String, + pub debug_auth: String, + pub debug_crypto: String, + pub debug_finisher: String, + pub debug_heartbeatmap: String, + pub debug_perfcounter: String, + pub debug_rgw: String, + pub debug_civetweb: String, + pub debug_javaclient: String, + pub debug_asok: String, + pub debug_throttle: String, + pub host: String, + pub fsid: String, + pub public_addr: String, + pub cluster_addr: String, + pub public_network: String, + pub cluster_network: String, + pub num_client: String, + pub monmap: String, + pub mon_host: String, + pub lockdep: String, + pub run_dir: String, + pub admin_socket: String, + pub daemonize: String, + pub pid_file: String, + pub chdir: String, + pub max_open_files: String, + pub restapi_log_level: String, + pub restapi_base_url: String, + pub fatal_signal_handlers: String, + pub log_file: String, + pub log_max_new: String, + pub log_max_recent: String, + pub log_to_stderr: String, + pub err_to_stderr: String, + pub log_to_syslog: String, + pub err_to_syslog: String, + pub log_flush_on_exit: String, + pub log_stop_at_utilization: String, + pub clog_to_monitors: String, + pub clog_to_syslog: String, + pub clog_to_syslog_level: String, + pub clog_to_syslog_facility: String, + pub mon_cluster_log_to_syslog: String, + pub mon_cluster_log_to_syslog_level: String, + pub mon_cluster_log_to_syslog_facility: String, + pub mon_cluster_log_file: String, + pub mon_cluster_log_file_level: String, + pub key: String, + pub keyfile: String, + pub keyring: String, + pub heartbeat_interval: String, + pub heartbeat_file: String, + pub heartbeat_inject_failure: String, + pub perf: String, + pub ms_tcp_nodelay: String, + pub ms_tcp_rcvbuf: String, + pub ms_initial_backoff: String, + pub ms_max_backoff: String, + pub ms_nocrc: String, + pub ms_die_on_bad_msg: String, + pub ms_die_on_unhandled_msg: String, + pub ms_die_on_old_message: String, + pub ms_dispatch_throttle_bytes: String, + pub ms_bind_ipv6: String, + pub ms_bind_port_min: String, + pub ms_bind_port_max: String, + pub ms_rwthread_stack_bytes: String, + pub ms_tcp_read_timeout: String, + pub ms_pq_max_tokens_per_priority: String, + pub ms_pq_min_cost: String, + pub ms_inject_socket_failures: String, + pub ms_inject_delay_type: String, + pub ms_inject_delay_msg_type: String, + pub ms_inject_delay_max: String, + pub ms_inject_delay_probability: String, + pub ms_inject_internal_delays: String, + pub ms_dump_on_send: String, + pub inject_early_sigterm: String, + pub mon_data: String, + pub mon_initial_members: String, + pub mon_sync_fs_threshold: String, + pub mon_compact_on_start: String, + pub mon_compact_on_bootstrap: String, + pub mon_compact_on_trim: String, + pub mon_tick_interval: String, + pub mon_subscribe_interval: String, + pub mon_delta_reset_interval: String, + pub mon_osd_laggy_halflife: String, + pub mon_osd_laggy_weight: String, + pub mon_osd_adjust_heartbeat_grace: String, + pub mon_osd_adjust_down_out_interval: String, + pub mon_osd_auto_mark_in: String, + pub mon_osd_auto_mark_auto_out_in: String, + pub mon_osd_auto_mark_new_in: String, + pub mon_osd_down_out_interval: String, + pub mon_osd_down_out_subtree_limit: String, + pub mon_osd_min_up_ratio: String, + pub mon_osd_min_in_ratio: String, + pub mon_osd_max_op_age: String, + pub mon_osd_max_split_count: String, + pub mon_osd_allow_primary_temp: String, + pub mon_osd_allow_primary_affinity: String, + pub mon_stat_smooth_intervals: String, + pub mon_lease: String, + pub mon_lease_renew_interval: String, + pub mon_lease_ack_timeout: String, + pub mon_clock_drift_allowed: String, + pub mon_clock_drift_warn_backoff: String, + pub mon_timecheck_interval: String, + pub mon_accept_timeout: String, + pub mon_pg_create_interval: String, + pub mon_pg_stuck_threshold: String, + pub mon_pg_warn_min_per_osd: String, + pub mon_pg_warn_max_object_skew: String, + pub mon_pg_warn_min_objects: String, + pub mon_pg_warn_min_pool_objects: String, + pub mon_cache_target_full_warn_ratio: String, + pub mon_osd_full_ratio: String, + pub mon_osd_nearfull_ratio: String, + pub mon_globalid_prealloc: String, + pub mon_osd_report_timeout: String, + pub mon_force_standby_active: String, + pub mon_warn_on_old_mons: String, + pub mon_warn_on_legacy_crush_tunables: String, + pub mon_warn_on_osd_down_out_interval_zero: String, + pub mon_warn_on_cache_pools_without_hit_sets: String, + pub mon_min_osdmap_epochs: String, + pub mon_max_pgmap_epochs: String, + pub mon_max_log_epochs: String, + pub mon_max_mdsmap_epochs: String, + pub mon_max_osd: String, + pub mon_probe_timeout: String, + pub mon_slurp_timeout: String, + pub mon_slurp_bytes: String, + pub mon_client_bytes: String, + pub mon_daemon_bytes: String, + pub mon_max_log_entries_per_event: String, + pub mon_health_data_update_interval: String, + pub mon_data_avail_crit: String, + pub mon_data_avail_warn: String, + pub mon_config_key_max_entry_size: String, + pub mon_sync_timeout: String, + pub mon_sync_max_payload_size: String, + pub mon_sync_debug: String, + pub mon_sync_debug_leader: String, + pub mon_sync_debug_provider: String, + pub mon_sync_debug_provider_fallback: String, + pub mon_inject_sync_get_chunk_delay: String, + pub mon_osd_min_down_reporters: String, + pub mon_osd_min_down_reports: String, + pub mon_osd_force_trim_to: String, + pub mon_mds_force_trim_to: String, + pub mon_advanced_debug_mode: String, + pub mon_debug_dump_transactions: String, + pub mon_debug_dump_location: String, + pub mon_sync_provider_kill_at: String, + pub mon_sync_requester_kill_at: String, + pub mon_leveldb_write_buffer_size: String, + pub mon_leveldb_cache_size: String, + pub mon_leveldb_block_size: String, + pub mon_leveldb_bloom_size: String, + pub mon_leveldb_max_open_files: String, + pub mon_leveldb_compression: String, + pub mon_leveldb_paranoid: String, + pub mon_leveldb_log: String, + pub mon_leveldb_size_warn: String, + pub mon_force_quorum_join: String, + pub paxos_stash_full_interval: String, + pub paxos_max_join_drift: String, + pub paxos_propose_interval: String, + pub paxos_min_wait: String, + pub paxos_min: String, + pub paxos_trim_min: String, + pub paxos_trim_max: String, + pub paxos_service_trim_min: String, + pub paxos_service_trim_max: String, + pub paxos_kill_at: String, + pub clock_offset: String, + pub auth_cluster_required: String, + pub auth_service_required: String, + pub auth_client_required: String, + pub auth_supported: String, + pub cephx_require_signatures: String, + pub cephx_cluster_require_signatures: String, + pub cephx_service_require_signatures: String, + pub cephx_sign_messages: String, + pub auth_mon_ticket_ttl: String, + pub auth_service_ticket_ttl: String, + pub auth_debug: String, + pub mon_client_hunt_interval: String, + pub mon_client_ping_interval: String, + pub mon_client_ping_timeout: String, + pub mon_client_hunt_interval_backoff: String, + pub mon_client_hunt_interval_max_multiple: String, + pub mon_client_max_log_entries_per_message: String, + pub mon_max_pool_pg_num: String, + pub mon_pool_quota_warn_threshold: String, + pub mon_pool_quota_crit_threshold: String, + pub client_cache_size: String, + pub client_cache_mid: String, + pub client_use_random_mds: String, + pub client_mount_timeout: String, + pub client_tick_interval: String, + pub client_trace: String, + pub client_readahead_min: String, + pub client_readahead_max_bytes: String, + pub client_readahead_max_periods: String, + pub client_snapdir: String, + pub client_mountpoint: String, + pub client_notify_timeout: String, + pub osd_client_watch_timeout: String, + pub client_caps_release_delay: String, + pub client_oc: String, + pub client_oc_size: String, + pub client_oc_max_dirty: String, + pub client_oc_target_dirty: String, + pub client_oc_max_dirty_age: String, + pub client_oc_max_objects: String, + pub client_debug_force_sync_read: String, + pub client_debug_inject_tick_delay: String, + pub client_max_inline_size: String, + pub fuse_use_invalidate_cb: String, + pub fuse_allow_other: String, + pub fuse_default_permissions: String, + pub fuse_big_writes: String, + pub fuse_atomic_o_trunc: String, + pub fuse_debug: String, + pub fuse_multithreaded: String, + pub crush_location: String, + pub objecter_tick_interval: String, + pub objecter_timeout: String, + pub objecter_inflight_op_bytes: String, + pub objecter_inflight_ops: String, + pub journaler_allow_split_entries: String, + pub journaler_write_head_interval: String, + pub journaler_prefetch_periods: String, + pub journaler_prezero_periods: String, + pub journaler_batch_interval: String, + pub journaler_batch_max: String, + pub mds_data: String, + pub mds_max_file_size: String, + pub mds_cache_size: String, + pub mds_cache_mid: String, + pub mds_mem_max: String, + pub mds_dir_max_commit_size: String, + pub mds_decay_halflife: String, + pub mds_beacon_interval: String, + pub mds_beacon_grace: String, + pub mds_enforce_unique_name: String, + pub mds_blacklist_interval: String, + pub mds_session_timeout: String, + pub mds_freeze_tree_timeout: String, + pub mds_session_autoclose: String, + pub mds_reconnect_timeout: String, + pub mds_tick_interval: String, + pub mds_dirstat_min_interval: String, + pub mds_scatter_nudge_interval: String, + pub mds_client_prealloc_inos: String, + pub mds_early_reply: String, + pub mds_default_dir_hash: String, + pub mds_log: String, + pub mds_log_skip_corrupt_events: String, + pub mds_log_max_events: String, + pub mds_log_segment_size: String, + pub mds_log_max_segments: String, + pub mds_log_max_expiring: String, + pub mds_bal_sample_interval: String, + pub mds_bal_replicate_threshold: String, + pub mds_bal_unreplicate_threshold: String, + pub mds_bal_frag: String, + pub mds_bal_split_size: String, + pub mds_bal_split_rd: String, + pub mds_bal_split_wr: String, + pub mds_bal_split_bits: String, + pub mds_bal_merge_size: String, + pub mds_bal_merge_rd: String, + pub mds_bal_merge_wr: String, + pub mds_bal_interval: String, + pub mds_bal_fragment_interval: String, + pub mds_bal_idle_threshold: String, + pub mds_bal_max: String, + pub mds_bal_max_until: String, + pub mds_bal_mode: String, + pub mds_bal_min_rebalance: String, + pub mds_bal_min_start: String, + pub mds_bal_need_min: String, + pub mds_bal_need_max: String, + pub mds_bal_midchunk: String, + pub mds_bal_minchunk: String, + pub mds_bal_target_removal_min: String, + pub mds_bal_target_removal_max: String, + pub mds_replay_interval: String, + pub mds_shutdown_check: String, + pub mds_thrash_exports: String, + pub mds_thrash_fragments: String, + pub mds_dump_cache_on_map: String, + pub mds_dump_cache_after_rejoin: String, + pub mds_verify_scatter: String, + pub mds_debug_scatterstat: String, + pub mds_debug_frag: String, + pub mds_debug_auth_pins: String, + pub mds_debug_subtrees: String, + pub mds_kill_mdstable_at: String, + pub mds_kill_export_at: String, + pub mds_kill_import_at: String, + pub mds_kill_link_at: String, + pub mds_kill_rename_at: String, + pub mds_kill_openc_at: String, + pub mds_kill_journal_at: String, + pub mds_kill_journal_expire_at: String, + pub mds_kill_journal_replay_at: String, + pub mds_kill_create_at: String, + pub mds_open_remote_link_mode: String, + pub mds_inject_traceless_reply_probability: String, + pub mds_wipe_sessions: String, + pub mds_wipe_ino_prealloc: String, + pub mds_skip_ino: String, + pub max_mds: String, + pub mds_standby_for_name: String, + pub mds_standby_for_rank: String, + pub mds_standby_replay: String, + pub osd_compact_leveldb_on_mount: String, + pub osd_max_backfills: String, + pub osd_backfill_full_ratio: String, + pub osd_backfill_retry_interval: String, + pub osd_agent_max_ops: String, + pub osd_agent_min_evict_effort: String, + pub osd_agent_quantize_effort: String, + pub osd_agent_delay_time: String, + pub osd_agent_hist_halflife: String, + pub osd_agent_slop: String, + pub osd_uuid: String, + pub osd_data: String, + pub osd_journal: String, + pub osd_journal_size: String, + pub osd_max_write_size: String, + pub osd_max_pgls: String, + pub osd_client_message_size_cap: String, + pub osd_client_message_cap: String, + pub osd_pg_bits: String, + pub osd_pgp_bits: String, + pub osd_crush_chooseleaf_type: String, + pub osd_pool_default_crush_rule: String, + pub osd_pool_default_crush_replicated_ruleset: String, + pub osd_pool_erasure_code_stripe_width: String, + pub osd_pool_default_size: String, + pub osd_pool_default_min_size: String, + pub osd_pool_default_pg_num: String, + pub osd_pool_default_pgp_num: String, + pub osd_pool_default_erasure_code_directory: String, + pub osd_pool_default_erasure_code_profile: String, + pub osd_erasure_code_plugins: String, + pub osd_pool_default_flags: String, + pub osd_pool_default_flag_hashpspool: String, + pub osd_pool_default_hit_set_bloom_fpp: String, + pub osd_pool_default_cache_target_dirty_ratio: String, + pub osd_pool_default_cache_target_full_ratio: String, + pub osd_pool_default_cache_min_flush_age: String, + pub osd_pool_default_cache_min_evict_age: String, + pub osd_hit_set_min_size: String, + pub osd_hit_set_max_size: String, + pub osd_hit_set_namespace: String, + pub osd_tier_default_cache_mode: String, + pub osd_tier_default_cache_hit_set_count: String, + pub osd_tier_default_cache_hit_set_period: String, + pub osd_tier_default_cache_hit_set_type: String, + pub osd_map_dedup: String, + pub osd_map_max_advance: String, + pub osd_map_cache_size: String, + pub osd_map_message_max: String, + pub osd_map_share_max_epochs: String, + pub osd_op_threads: String, + pub osd_peering_wq_batch_size: String, + pub osd_op_pq_max_tokens_per_priority: String, + pub osd_op_pq_min_cost: String, + pub osd_disk_threads: String, + pub osd_disk_thread_ioprio_class: String, + pub osd_disk_thread_ioprio_priority: String, + pub osd_recovery_threads: String, + pub osd_recover_clone_overlap: String, + pub osd_recover_clone_overlap_limit: String, + pub osd_backfill_scan_min: String, + pub osd_backfill_scan_max: String, + pub osd_op_thread_timeout: String, + pub osd_recovery_thread_timeout: String, + pub osd_snap_trim_thread_timeout: String, + pub osd_snap_trim_sleep: String, + pub osd_scrub_thread_timeout: String, + pub osd_scrub_finalize_thread_timeout: String, + pub osd_scrub_invalid_stats: String, + pub osd_remove_thread_timeout: String, + pub osd_command_thread_timeout: String, + pub osd_age: String, + pub osd_age_time: String, + pub osd_heartbeat_addr: String, + pub osd_heartbeat_interval: String, + pub osd_heartbeat_grace: String, + pub osd_heartbeat_min_peers: String, + pub osd_pg_max_concurrent_snap_trims: String, + pub osd_heartbeat_min_healthy_ratio: String, + pub osd_mon_heartbeat_interval: String, + pub osd_mon_report_interval_max: String, + pub osd_mon_report_interval_min: String, + pub osd_pg_stat_report_interval_max: String, + pub osd_mon_ack_timeout: String, + pub osd_default_data_pool_replay_window: String, + pub osd_preserve_trimmed_log: String, + pub osd_auto_mark_unfound_lost: String, + pub osd_recovery_delay_start: String, + pub osd_recovery_max_active: String, + pub osd_recovery_max_single_start: String, + pub osd_recovery_max_chunk: String, + pub osd_copyfrom_max_chunk: String, + pub osd_push_per_object_cost: String, + pub osd_max_push_cost: String, + pub osd_max_push_objects: String, + pub osd_recovery_forget_lost_objects: String, + pub osd_max_scrubs: String, + pub osd_scrub_load_threshold: String, + pub osd_scrub_min_interval: String, + pub osd_scrub_max_interval: String, + pub osd_scrub_chunk_min: String, + pub osd_scrub_chunk_max: String, + pub osd_scrub_sleep: String, + pub osd_deep_scrub_interval: String, + pub osd_deep_scrub_stride: String, + pub osd_scan_list_ping_tp_interval: String, + pub osd_auto_weight: String, + pub osd_class_dir: String, + pub osd_open_classes_on_start: String, + pub osd_check_for_log_corruption: String, + pub osd_use_stale_snap: String, + pub osd_rollback_to_cluster_snap: String, + pub osd_default_notify_timeout: String, + pub osd_kill_backfill_at: String, + pub osd_pg_epoch_persisted_max_stale: String, + pub osd_min_pg_log_entries: String, + pub osd_max_pg_log_entries: String, + pub osd_op_complaint_time: String, + pub osd_command_max_records: String, + pub osd_op_log_threshold: String, + pub osd_verify_sparse_read_holes: String, + pub osd_debug_drop_ping_probability: String, + pub osd_debug_drop_ping_duration: String, + pub osd_debug_drop_pg_create_probability: String, + pub osd_debug_drop_pg_create_duration: String, + pub osd_debug_drop_op_probability: String, + pub osd_debug_op_order: String, + pub osd_debug_verify_snaps_on_info: String, + pub osd_debug_verify_stray_on_activate: String, + pub osd_debug_skip_full_check_in_backfill_reservation: String, + pub osd_debug_reject_backfill_probability: String, + pub osd_enable_op_tracker: String, +} + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29710.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29710.rs new file mode 100644 index 0000000..d2198ed --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-29710.rs @@ -0,0 +1,29 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(unused_results)] +#![allow(dead_code)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct A(usize); + +#[derive(Derivative)] +#[derivative(Debug)] +struct B { a: usize } + +#[test] +fn main() {} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-32292.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-32292.rs new file mode 100644 index 0000000..6d4be38 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-32292.rs @@ -0,0 +1,27 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(warnings)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Hash, Eq, PartialEq, Debug, Clone, Copy)] +// TODO: Ord, PartialOrd +struct Foo; + +#[test] +fn main() { + let _ = Foo; +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-3935.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-3935.rs new file mode 100644 index 0000000..a63e6a7 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-3935.rs @@ -0,0 +1,29 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct Bike { + name: String, +} + +#[test] +fn main() { + let town_bike = Bike { name: "schwinn".to_string() }; + let my_bike = Bike { name: "surly".to_string() }; + + assert!(town_bike != my_bike); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-42453.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-42453.rs new file mode 100644 index 0000000..bd349de --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-42453.rs @@ -0,0 +1,28 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(warnings)] + +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(Debug)] +struct builder; + +fn main() { + +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-58319.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-58319.rs new file mode 100644 index 0000000..4bb0077 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-58319.rs @@ -0,0 +1,644 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(warnings)] + +#![allow(dead_code)] +#![allow(non_camel_case_types)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +fn main() {} + +#[derive(Derivative)] +#[derivative(Clone)] +pub struct Little; + +#[derive(Clone)] +pub struct Big( + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, + Little, +); diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-6341.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-6341.rs new file mode 100644 index 0000000..674f191 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-issue-6341.rs @@ -0,0 +1,30 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// pretty-expanded FIXME #23616 + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +#[derive(Derivative)] +#[derivative(PartialEq)] +struct A { x: usize } + +impl Drop for A { + fn drop(&mut self) {} +} + +#[test] +fn main() { + A { x: 42 }; +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-typeclasses-eq-example.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-typeclasses-eq-example.rs new file mode 100644 index 0000000..8b43551 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-typeclasses-eq-example.rs @@ -0,0 +1,83 @@ +// Copyright 2012 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_snake_case)] +#![allow(non_camel_case_types)] + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +// Example from lkuper's intern talk, August 2012. +use Color::{cyan, magenta, yellow, black}; +use ColorTree::{leaf, branch}; + +trait Equal { + fn isEq(&self, a: &Self) -> bool; +} + +#[derive(Derivative)] +#[derivative(Clone, Copy)] +enum Color { cyan, magenta, yellow, black } + +impl Equal for Color { + fn isEq(&self, a: &Color) -> bool { + match (*self, *a) { + (cyan, cyan) => { true } + (magenta, magenta) => { true } + (yellow, yellow) => { true } + (black, black) => { true } + _ => { false } + } + } +} + +#[derive(Derivative)] +#[derivative(Clone)] +enum ColorTree { + leaf(Color), + branch(Box, Box) +} + +impl Equal for ColorTree { + fn isEq(&self, a: &ColorTree) -> bool { + match (self, a) { + (&leaf(ref x), &leaf(ref y)) => { x.isEq(&(*y).clone()) } + (&branch(ref l1, ref r1), &branch(ref l2, ref r2)) => { + (*l1).isEq(&(**l2).clone()) && (*r1).isEq(&(**r2).clone()) + } + _ => { false } + } + } +} + +#[test] +fn main() { + assert!(cyan.isEq(&cyan)); + assert!(magenta.isEq(&magenta)); + assert!(!cyan.isEq(&yellow)); + assert!(!magenta.isEq(&cyan)); + + assert!(leaf(cyan).isEq(&leaf(cyan))); + assert!(!leaf(cyan).isEq(&leaf(yellow))); + + assert!(branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))) + .isEq(&branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))))); + + assert!(branch(Box::new(leaf(black)), Box::new(leaf(cyan))) + .isEq(&branch(Box::new(leaf(black)), Box::new(leaf(cyan))))); + + assert!(!branch(Box::new(leaf(magenta)), Box::new(leaf(cyan))) + .isEq(&branch(Box::new(leaf(magenta)), Box::new(leaf(magenta))))); + + println!("Assertions all succeeded!"); +} diff --git a/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-zero-sized-btreemap-insert.rs b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-zero-sized-btreemap-insert.rs new file mode 100644 index 0000000..b6329f5 --- /dev/null +++ b/third_party/cargo/vendor/derivative-2.1.1/tests/rustc-zero-sized-btreemap-insert.rs @@ -0,0 +1,41 @@ +// Copyright 2013 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(feature = "use_core")] +extern crate core; + +#[macro_use] +extern crate derivative; + +use std::collections::BTreeMap; +use std::iter::Iterator; + +#[derive(Derivative)] +#[derive(Ord, PartialOrd)] +#[derivative(Eq, Hash, Debug, PartialEq)] +// TODO: Ord, PartialOrd +struct Zst; + +#[test] +fn main() { + const N: usize = 8; + + for len in 0..N { + let mut tester = BTreeMap::new(); + assert_eq!(tester.len(), 0); + for _ in 0..len { + tester.insert(Zst, ()); + } + assert_eq!(tester.len(), if len == 0 { 0 } else { 1 }); + assert_eq!(tester.iter().count(), if len == 0 { 0 } else { 1 }); + assert_eq!(tester.get(&Zst).is_some(), len > 0); + tester.clear(); + } +} diff --git a/third_party/cargo/vendor/dlib-0.4.1/.cargo-checksum.json b/third_party/cargo/vendor/dlib-0.4.1/.cargo-checksum.json deleted file mode 100644 index 3c4a555..0000000 --- a/third_party/cargo/vendor/dlib-0.4.1/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"524bcad39403900e9789765368e3314f0852ec11a85238122301acaa9e97eb78","LICENSE.txt":"10e5daea68c3ab7da6468ea51860e9d4ac87ea6a9a2d34127beff17b7193b618","README.md":"1c0305cb5f45f0381423fde9f460f8855c486583cb9a9a72643c97295b6223cc","src/lib.rs":"93f12f1151ab5b49352048273f2d7c0a2099cb23c8ba0ec99b3c63deba69ece0"},"package":"77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a"} \ No newline at end of file diff --git a/third_party/cargo/vendor/dlib-0.4.2/.cargo-checksum.json b/third_party/cargo/vendor/dlib-0.4.2/.cargo-checksum.json new file mode 100644 index 0000000..828c6ad --- /dev/null +++ b/third_party/cargo/vendor/dlib-0.4.2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"639ec8b59077d6cf229404c467a9d71ad0fef08465ad59015c976eeb1aa7afe4","LICENSE.txt":"10e5daea68c3ab7da6468ea51860e9d4ac87ea6a9a2d34127beff17b7193b618","README.md":"1c0305cb5f45f0381423fde9f460f8855c486583cb9a9a72643c97295b6223cc","src/lib.rs":"93f12f1151ab5b49352048273f2d7c0a2099cb23c8ba0ec99b3c63deba69ece0"},"package":"b11f15d1e3268f140f68d390637d5e76d849782d971ae7063e0da69fe9709a76"} \ No newline at end of file diff --git a/third_party/cargo/vendor/dlib-0.4.1/BUILD b/third_party/cargo/vendor/dlib-0.4.2/BUILD similarity index 89% rename from third_party/cargo/vendor/dlib-0.4.1/BUILD rename to third_party/cargo/vendor/dlib-0.4.2/BUILD index d72b6ce..75a9585 100644 --- a/third_party/cargo/vendor/dlib-0.4.1/BUILD +++ b/third_party/cargo/vendor/dlib-0.4.2/BUILD @@ -31,12 +31,12 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libloading-0.5.2:libloading", + "//third_party/cargo/vendor/libloading-0.6.2:libloading", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.4.1", + version = "0.4.2", crate_features = [ "dlopen", ], diff --git a/third_party/cargo/vendor/dlib-0.4.1/Cargo.toml b/third_party/cargo/vendor/dlib-0.4.2/Cargo.toml similarity index 90% rename from third_party/cargo/vendor/dlib-0.4.1/Cargo.toml rename to third_party/cargo/vendor/dlib-0.4.2/Cargo.toml index ac817b2..f1f8003 100644 --- a/third_party/cargo/vendor/dlib-0.4.1/Cargo.toml +++ b/third_party/cargo/vendor/dlib-0.4.2/Cargo.toml @@ -3,7 +3,7 @@ # 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 +# 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 @@ -12,13 +12,13 @@ [package] name = "dlib" -version = "0.4.1" +version = "0.4.2" authors = ["Victor Berger "] description = "Helper macros for handling manually loading optional system libraries." license = "MIT" repository = "https://github.com/vberger/dlib" [dependencies.libloading] -version = "0.5.0" +version = "0.6" [features] dlopen = [] diff --git a/third_party/cargo/vendor/dlib-0.4.1/LICENSE.txt b/third_party/cargo/vendor/dlib-0.4.2/LICENSE.txt similarity index 100% rename from third_party/cargo/vendor/dlib-0.4.1/LICENSE.txt rename to third_party/cargo/vendor/dlib-0.4.2/LICENSE.txt diff --git a/third_party/cargo/vendor/dlib-0.4.1/README.md b/third_party/cargo/vendor/dlib-0.4.2/README.md similarity index 100% rename from third_party/cargo/vendor/dlib-0.4.1/README.md rename to third_party/cargo/vendor/dlib-0.4.2/README.md diff --git a/third_party/cargo/vendor/dlib-0.4.1/src/lib.rs b/third_party/cargo/vendor/dlib-0.4.2/src/lib.rs similarity index 100% rename from third_party/cargo/vendor/dlib-0.4.1/src/lib.rs rename to third_party/cargo/vendor/dlib-0.4.2/src/lib.rs diff --git a/third_party/cargo/vendor/env_logger-0.6.2/.cargo-checksum.json b/third_party/cargo/vendor/env_logger-0.6.2/.cargo-checksum.json index f4c02e3..e5514ae 100644 --- a/third_party/cargo/vendor/env_logger-0.6.2/.cargo-checksum.json +++ b/third_party/cargo/vendor/env_logger-0.6.2/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"7c044d74477515ab39287a4caff27eb96daebaed8b9f9b6a1d1c081a7b42d4a7","Cargo.toml":"b60137f1fd54001ca4d8be1d0bbec154225a44c8f4fa3576078bdad55216d357","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"0e231c1c4ad51ff0239062297bdaa69aeb34a8692e3f814188ce1e0ade8583d5","examples/custom_default_format.rs":"799c439f61cb711078f8aa584db537a5758c25b90d44767849dae2ad3822885c","examples/custom_format.rs":"ac8323e2febf8b8ff7238bd254fbbbfb3183da5af84f7f3a261fd9ad892c9ab6","examples/custom_logger.rs":"99fb3c9761ad4c5fe73f4ec2a2bd44b4acf6d1f7b7cfaa16bf0373665d3e2a4b","examples/default.rs":"ac96427611784d310704f738c7a29ebddd7930c8a70ad3c464c4d3eae4cf74a3","examples/direct_logger.rs":"549f6a10e0903d06aca2cc7ba82415b07a23392676101c9bc7aa72b4a9b0b9e2","examples/filters_from_code.rs":"84bd82803683d19ae96f85edcf4ee38cda028c2dbde923dddecc8563453b18e2","src/filter/mod.rs":"de471579c5db400c5ed11b9d7c9fc62686068b42798c58f7165806319ab7ec09","src/filter/regex.rs":"5fff47d1d4d0aa3f2bab90636127d3e72aebf800c3b78faba99637220ffdf865","src/filter/string.rs":"52bbd047c31a1afdb3cd1c11629b956f21b3f47bf22e06421baf3d693a045e59","src/fmt/humantime/extern_impl.rs":"cd2538e7a03fd3ad6c843af3c3d4016ca96cadaefee32cf9b37329c4787e6552","src/fmt/humantime/mod.rs":"408496eb21344c654b9e06da2a2df86de56e427147bb7f7b47851e0da976c003","src/fmt/humantime/shim_impl.rs":"7c2fdf4031f5568b716df14842b0d32bc03ff398763f4849960df7f9632a5bb2","src/fmt/mod.rs":"5104dad2fd14bc18ab6ab46e7c2bc5752b509d9fc934fb99f0ebc126728f8f04","src/fmt/writer/atty.rs":"3e9fd61d291d0919f7aa7119a26dd15d920df8783b4ae57bcf2c3cb6f3ff06b5","src/fmt/writer/mod.rs":"583f6616e0cf21955a530baa332fb7a99bf4fcd418a2367bbd1e733a06a22318","src/fmt/writer/termcolor/extern_impl.rs":"15e048be128568abcdd0ce99dafffe296df26131d4aa05921585761d31c11db5","src/fmt/writer/termcolor/mod.rs":"a3cf956aec030e0f940e4eaefe58d7703857eb900022286e328e05e5f61de183","src/fmt/writer/termcolor/shim_impl.rs":"bdd479c4e933b14ba02a3c1a9fe30eb51bcdf600e23cebd044d68683fdaad037","src/lib.rs":"2c5ab92ee141022f3e657b0f81e84e5ee4e7fad9fb648204e00ed4fb03d4166f","tests/init-twice-retains-filter.rs":"00524ce0f6779981b695bad1fdd244f87b76c126aeccd8b4ff77ef9e6325478b","tests/log-in-log.rs":"41126910998adfbac771c2a1237fecbc5437344f8e4dfc2f93235bab764a087e","tests/regexp_filter.rs":"44aa6c39de894be090e37083601e501cfffb15e3c0cd36209c48abdf3e2cb120"},"package":"aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"} \ No newline at end of file +{"files":{"CHANGELOG.md":"7c044d74477515ab39287a4caff27eb96daebaed8b9f9b6a1d1c081a7b42d4a7","Cargo.lock":"132c1f881b80a79314567a6993141c6204495fec144cdcec1729f2a3e0fec18b","Cargo.toml":"b60137f1fd54001ca4d8be1d0bbec154225a44c8f4fa3576078bdad55216d357","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"0e231c1c4ad51ff0239062297bdaa69aeb34a8692e3f814188ce1e0ade8583d5","examples/custom_default_format.rs":"799c439f61cb711078f8aa584db537a5758c25b90d44767849dae2ad3822885c","examples/custom_format.rs":"ac8323e2febf8b8ff7238bd254fbbbfb3183da5af84f7f3a261fd9ad892c9ab6","examples/custom_logger.rs":"99fb3c9761ad4c5fe73f4ec2a2bd44b4acf6d1f7b7cfaa16bf0373665d3e2a4b","examples/default.rs":"ac96427611784d310704f738c7a29ebddd7930c8a70ad3c464c4d3eae4cf74a3","examples/direct_logger.rs":"549f6a10e0903d06aca2cc7ba82415b07a23392676101c9bc7aa72b4a9b0b9e2","examples/filters_from_code.rs":"84bd82803683d19ae96f85edcf4ee38cda028c2dbde923dddecc8563453b18e2","src/filter/mod.rs":"de471579c5db400c5ed11b9d7c9fc62686068b42798c58f7165806319ab7ec09","src/filter/regex.rs":"5fff47d1d4d0aa3f2bab90636127d3e72aebf800c3b78faba99637220ffdf865","src/filter/string.rs":"52bbd047c31a1afdb3cd1c11629b956f21b3f47bf22e06421baf3d693a045e59","src/fmt/humantime/extern_impl.rs":"cd2538e7a03fd3ad6c843af3c3d4016ca96cadaefee32cf9b37329c4787e6552","src/fmt/humantime/mod.rs":"408496eb21344c654b9e06da2a2df86de56e427147bb7f7b47851e0da976c003","src/fmt/humantime/shim_impl.rs":"7c2fdf4031f5568b716df14842b0d32bc03ff398763f4849960df7f9632a5bb2","src/fmt/mod.rs":"5104dad2fd14bc18ab6ab46e7c2bc5752b509d9fc934fb99f0ebc126728f8f04","src/fmt/writer/atty.rs":"3e9fd61d291d0919f7aa7119a26dd15d920df8783b4ae57bcf2c3cb6f3ff06b5","src/fmt/writer/mod.rs":"583f6616e0cf21955a530baa332fb7a99bf4fcd418a2367bbd1e733a06a22318","src/fmt/writer/termcolor/extern_impl.rs":"15e048be128568abcdd0ce99dafffe296df26131d4aa05921585761d31c11db5","src/fmt/writer/termcolor/mod.rs":"a3cf956aec030e0f940e4eaefe58d7703857eb900022286e328e05e5f61de183","src/fmt/writer/termcolor/shim_impl.rs":"bdd479c4e933b14ba02a3c1a9fe30eb51bcdf600e23cebd044d68683fdaad037","src/lib.rs":"2c5ab92ee141022f3e657b0f81e84e5ee4e7fad9fb648204e00ed4fb03d4166f","tests/init-twice-retains-filter.rs":"00524ce0f6779981b695bad1fdd244f87b76c126aeccd8b4ff77ef9e6325478b","tests/log-in-log.rs":"41126910998adfbac771c2a1237fecbc5437344f8e4dfc2f93235bab764a087e","tests/regexp_filter.rs":"44aa6c39de894be090e37083601e501cfffb15e3c0cd36209c48abdf3e2cb120"},"package":"aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3"} \ No newline at end of file diff --git a/third_party/cargo/vendor/env_logger-0.6.2/BUILD b/third_party/cargo/vendor/env_logger-0.6.2/BUILD index b353448..1c4e761 100644 --- a/third_party/cargo/vendor/env_logger-0.6.2/BUILD +++ b/third_party/cargo/vendor/env_logger-0.6.2/BUILD @@ -39,7 +39,7 @@ rust_library( "//third_party/cargo/vendor/atty-0.2.14:atty", "//third_party/cargo/vendor/humantime-1.3.0:humantime", "//third_party/cargo/vendor/log-0.4.8:log", - "//third_party/cargo/vendor/regex-1.3.5:regex", + "//third_party/cargo/vendor/regex-1.3.9:regex", "//third_party/cargo/vendor/termcolor-1.1.0:termcolor", ], rustc_flags = [ diff --git a/third_party/cargo/vendor/env_logger-0.6.2/Cargo.lock b/third_party/cargo/vendor/env_logger-0.6.2/Cargo.lock new file mode 100644 index 0000000..565fc3a --- /dev/null +++ b/third_party/cargo/vendor/env_logger-0.6.2/Cargo.lock @@ -0,0 +1,212 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "env_logger" +version = "0.6.2" +dependencies = [ + "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "humantime" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lazy_static" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_syscall" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termcolor" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (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.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ucd-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +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-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.4 (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" + +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" +"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" +"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d" +"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" +"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"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-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/.cargo-checksum.json b/third_party/cargo/vendor/flatbuffers-0.6.1/.cargo-checksum.json new file mode 100644 index 0000000..d8e94da --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"9856cc9d1b192a10e85c084ecea7a453955ecce05edb72cc505394c3acefcd5c","src/builder.rs":"369559de6f83c2f524c81fcbe682dfb7b3bd4d5b0ecf5f9c5f9fad351e05481c","src/endian_scalar.rs":"5ad614772e0d98c852f08882d5501e8724ea5784596a9e69bce200e1d428ece9","src/follow.rs":"63e463e23f4f091c2d08ad414755c17eb33a16c26dae0b2aa67b12b5f16412fe","src/lib.rs":"1012d970333c72c923bffc65e566d35050f8e9382a7e31df134c419a1ccd0d53","src/primitives.rs":"fc7489641f0374c613d6e8aaf01c6da4b6e01c16a347ae78c891bdafd5f32ba7","src/push.rs":"cfb7d8615225569e2524be50f8bc1d6f9d2a492ca952973c05d80194d175cc1e","src/table.rs":"f625f336882da2b76fbd5b1b244545d785e15ef180a09ed5fc290065f4ff39bd","src/vector.rs":"785a37eea4202c4bc3d79c9684d5862d859e6f42dcf09f360b64b028a9009fe0","src/vtable.rs":"f5707cbebc3906dba4fbec3a054c84ca203aed67dd86ec44fcbd056040d15153","src/vtable_writer.rs":"53a0a9cd657f3ce8386a43358ac3356a8c9783fc5b86ea1ef1d2ebbd2d84db6c"},"package":"a788f068dd10687940565bf4b5480ee943176cbd114b12e811074bcf7c04e4b9"} \ No newline at end of file diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/BUILD b/third_party/cargo/vendor/flatbuffers-0.6.1/BUILD new file mode 100644 index 0000000..c520ff7 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "flatbuffers", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/smallvec-1.4.0:smallvec", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.6.1", + crate_features = [ + ], +) + diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/Cargo.toml b/third_party/cargo/vendor/flatbuffers-0.6.1/Cargo.toml new file mode 100644 index 0000000..528fef4 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/Cargo.toml @@ -0,0 +1,24 @@ +# 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 = "flatbuffers" +version = "0.6.1" +authors = ["Robert Winslow ", "FlatBuffers Maintainers"] +description = "Official FlatBuffers Rust runtime library." +homepage = "https://google.github.io/flatbuffers/" +keywords = ["flatbuffers", "serialization", "zero-copy"] +categories = ["encoding", "data-structures", "memory-management"] +license = "Apache-2.0" +repository = "https://github.com/google/flatbuffers" +[dependencies.smallvec] +version = "1.0" diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/builder.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/builder.rs new file mode 100644 index 0000000..0b20f9e --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/builder.rs @@ -0,0 +1,698 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +extern crate smallvec; + +use std::cmp::max; +use std::marker::PhantomData; +use std::ptr::write_bytes; +use std::slice::from_raw_parts; + +use endian_scalar::{emplace_scalar, read_scalar_at}; +use primitives::*; +use push::{Push, PushAlignment}; +use table::Table; +use vector::{SafeSliceAccess, Vector}; +use vtable::{field_index_to_field_offset, VTable}; +use vtable_writer::VTableWriter; + +pub const N_SMALLVEC_STRING_VECTOR_CAPACITY: usize = 16; + +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +struct FieldLoc { + off: UOffsetT, + id: VOffsetT, +} + +/// FlatBufferBuilder builds a FlatBuffer through manipulating its internal +/// state. It has an owned `Vec` that grows as needed (up to the hardcoded +/// limit of 2GiB, which is set by the FlatBuffers format). +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct FlatBufferBuilder<'fbb> { + owned_buf: Vec, + head: usize, + + field_locs: Vec, + written_vtable_revpos: Vec, + + nested: bool, + finished: bool, + + min_align: usize, + + _phantom: PhantomData<&'fbb ()>, +} + +impl<'fbb> FlatBufferBuilder<'fbb> { + /// Create a FlatBufferBuilder that is ready for writing. + pub fn new() -> Self { + Self::new_with_capacity(0) + } + + /// Create a FlatBufferBuilder that is ready for writing, with a + /// ready-to-use capacity of the provided size. + /// + /// The maximum valid value is `FLATBUFFERS_MAX_BUFFER_SIZE`. + pub fn new_with_capacity(size: usize) -> Self { + // we need to check the size here because we create the backing buffer + // directly, bypassing the typical way of using grow_owned_buf: + assert!( + size <= FLATBUFFERS_MAX_BUFFER_SIZE, + "cannot initialize buffer bigger than 2 gigabytes" + ); + + FlatBufferBuilder { + owned_buf: vec![0u8; size], + head: size, + + field_locs: Vec::new(), + written_vtable_revpos: Vec::new(), + + nested: false, + finished: false, + + min_align: 0, + + _phantom: PhantomData, + } + } + + /// Reset the FlatBufferBuilder internal state. Use this method after a + /// call to a `finish` function in order to re-use a FlatBufferBuilder. + /// + /// This function is the only way to reset the `finished` state and start + /// again. + /// + /// If you are using a FlatBufferBuilder repeatedly, make sure to use this + /// function, because it re-uses the FlatBufferBuilder's existing + /// heap-allocated `Vec` internal buffer. This offers significant speed + /// improvements as compared to creating a new FlatBufferBuilder for every + /// new object. + pub fn reset(&mut self) { + // memset only the part of the buffer that could be dirty: + { + let to_clear = self.owned_buf.len() - self.head; + let ptr = (&mut self.owned_buf[self.head..]).as_mut_ptr(); + unsafe { + write_bytes(ptr, 0, to_clear); + } + } + + self.head = self.owned_buf.len(); + self.written_vtable_revpos.clear(); + + self.nested = false; + self.finished = false; + + self.min_align = 0; + } + + /// Destroy the FlatBufferBuilder, returning its internal byte vector + /// and the index into it that represents the start of valid data. + pub fn collapse(self) -> (Vec, usize) { + (self.owned_buf, self.head) + } + + /// Push a Push'able value onto the front of the in-progress data. + /// + /// This function uses traits to provide a unified API for writing + /// scalars, tables, vectors, and WIPOffsets. + #[inline] + pub fn push(&mut self, x: P) -> WIPOffset { + let sz = P::size(); + self.align(sz, P::alignment()); + self.make_space(sz); + { + let (dst, rest) = (&mut self.owned_buf[self.head..]).split_at_mut(sz); + x.push(dst, rest); + } + WIPOffset::new(self.used_space() as UOffsetT) + } + + /// Push a Push'able value onto the front of the in-progress data, and + /// store a reference to it in the in-progress vtable. If the value matches + /// the default, then this is a no-op. + #[inline] + pub fn push_slot(&mut self, slotoff: VOffsetT, x: X, default: X) { + self.assert_nested("push_slot"); + if x == default { + return; + } + self.push_slot_always(slotoff, x); + } + + /// Push a Push'able value onto the front of the in-progress data, and + /// store a reference to it in the in-progress vtable. + #[inline] + pub fn push_slot_always(&mut self, slotoff: VOffsetT, x: X) { + self.assert_nested("push_slot_always"); + let off = self.push(x); + self.track_field(slotoff, off.value()); + } + + /// Retrieve the number of vtables that have been serialized into the + /// FlatBuffer. This is primarily used to check vtable deduplication. + #[inline] + pub fn num_written_vtables(&self) -> usize { + self.written_vtable_revpos.len() + } + + /// Start a Table write. + /// + /// Asserts that the builder is not in a nested state. + /// + /// Users probably want to use `push_slot` to add values after calling this. + #[inline] + pub fn start_table(&mut self) -> WIPOffset { + self.assert_not_nested( + "start_table can not be called when a table or vector is under construction", + ); + self.nested = true; + + WIPOffset::new(self.used_space() as UOffsetT) + } + + /// End a Table write. + /// + /// Asserts that the builder is in a nested state. + #[inline] + pub fn end_table( + &mut self, + off: WIPOffset, + ) -> WIPOffset { + self.assert_nested("end_table"); + + let o = self.write_vtable(off); + + self.nested = false; + self.field_locs.clear(); + + WIPOffset::new(o.value()) + } + + /// Start a Vector write. + /// + /// Asserts that the builder is not in a nested state. + /// + /// Most users will prefer to call `create_vector`. + /// Speed optimizing users who choose to create vectors manually using this + /// function will want to use `push` to add values. + #[inline] + pub fn start_vector(&mut self, num_items: usize) { + self.assert_not_nested( + "start_vector can not be called when a table or vector is under construction", + ); + self.nested = true; + self.align(num_items * T::size(), T::alignment().max_of(SIZE_UOFFSET)); + } + + /// End a Vector write. + /// + /// Note that the `num_elems` parameter is the number of written items, not + /// the byte count. + /// + /// Asserts that the builder is in a nested state. + #[inline] + pub fn end_vector(&mut self, num_elems: usize) -> WIPOffset> { + self.assert_nested("end_vector"); + self.nested = false; + let o = self.push::(num_elems as UOffsetT); + WIPOffset::new(o.value()) + } + + /// Create a utf8 string. + /// + /// The wire format represents this as a zero-terminated byte vector. + #[inline] + pub fn create_string<'a: 'b, 'b>(&'a mut self, s: &'b str) -> WIPOffset<&'fbb str> { + self.assert_not_nested( + "create_string can not be called when a table or vector is under construction", + ); + WIPOffset::new(self.create_byte_string(s.as_bytes()).value()) + } + + /// Create a zero-terminated byte vector. + #[inline] + pub fn create_byte_string(&mut self, data: &[u8]) -> WIPOffset<&'fbb [u8]> { + self.assert_not_nested( + "create_byte_string can not be called when a table or vector is under construction", + ); + self.align(data.len() + 1, PushAlignment::new(SIZE_UOFFSET)); + self.push(0u8); + self.push_bytes_unprefixed(data); + self.push(data.len() as UOffsetT); + WIPOffset::new(self.used_space() as UOffsetT) + } + + /// Create a vector by memcpy'ing. This is much faster than calling + /// `create_vector`, but the underlying type must be represented as + /// little-endian on the host machine. This property is encoded in the + /// type system through the SafeSliceAccess trait. The following types are + /// always safe, on any platform: bool, u8, i8, and any + /// FlatBuffers-generated struct. + #[inline] + pub fn create_vector_direct<'a: 'b, 'b, T: SafeSliceAccess + Push + Sized + 'b>( + &'a mut self, + items: &'b [T], + ) -> WIPOffset> { + self.assert_not_nested( + "create_vector_direct can not be called when a table or vector is under construction", + ); + let elem_size = T::size(); + self.align(items.len() * elem_size, T::alignment().max_of(SIZE_UOFFSET)); + + let bytes = { + let ptr = items.as_ptr() as *const T as *const u8; + unsafe { from_raw_parts(ptr, items.len() * elem_size) } + }; + self.push_bytes_unprefixed(bytes); + self.push(items.len() as UOffsetT); + + WIPOffset::new(self.used_space() as UOffsetT) + } + + /// Create a vector of strings. + /// + /// Speed-sensitive users may wish to reduce memory usage by creating the + /// vector manually: use `start_vector`, `push`, and `end_vector`. + #[inline] + pub fn create_vector_of_strings<'a, 'b>( + &'a mut self, + xs: &'b [&'b str], + ) -> WIPOffset>> { + self.assert_not_nested("create_vector_of_strings can not be called when a table or vector is under construction"); + // internally, smallvec can be a stack-allocated or heap-allocated vector: + // if xs.len() > N_SMALLVEC_STRING_VECTOR_CAPACITY then it will overflow to the heap. + let mut offsets: smallvec::SmallVec<[WIPOffset<&str>; N_SMALLVEC_STRING_VECTOR_CAPACITY]> = + smallvec::SmallVec::with_capacity(xs.len()); + unsafe { + offsets.set_len(xs.len()); + } + + // note that this happens in reverse, because the buffer is built back-to-front: + for (i, &s) in xs.iter().enumerate().rev() { + let o = self.create_string(s); + offsets[i] = o; + } + self.create_vector(&offsets[..]) + } + + /// Create a vector of Push-able objects. + /// + /// Speed-sensitive users may wish to reduce memory usage by creating the + /// vector manually: use `start_vector`, `push`, and `end_vector`. + #[inline] + pub fn create_vector<'a: 'b, 'b, T: Push + Copy + 'b>( + &'a mut self, + items: &'b [T], + ) -> WIPOffset> { + let elem_size = T::size(); + self.align(items.len() * elem_size, T::alignment().max_of(SIZE_UOFFSET)); + for i in (0..items.len()).rev() { + self.push(items[i]); + } + WIPOffset::new(self.push::(items.len() as UOffsetT).value()) + } + + /// Get the byte slice for the data that has been written, regardless of + /// whether it has been finished. + #[inline] + pub fn unfinished_data(&self) -> &[u8] { + &self.owned_buf[self.head..] + } + /// Get the byte slice for the data that has been written after a call to + /// one of the `finish` functions. + #[inline] + pub fn finished_data(&self) -> &[u8] { + self.assert_finished("finished_bytes cannot be called when the buffer is not yet finished"); + &self.owned_buf[self.head..] + } + /// Assert that a field is present in the just-finished Table. + /// + /// This is somewhat low-level and is mostly used by the generated code. + #[inline] + pub fn required( + &self, + tab_revloc: WIPOffset, + slot_byte_loc: VOffsetT, + assert_msg_name: &'static str, + ) { + let idx = self.used_space() - tab_revloc.value() as usize; + let tab = Table::new(&self.owned_buf[self.head..], idx); + let o = tab.vtable().get(slot_byte_loc) as usize; + assert!(o != 0, "missing required field {}", assert_msg_name); + } + + /// Finalize the FlatBuffer by: aligning it, pushing an optional file + /// identifier on to it, pushing a size prefix on to it, and marking the + /// internal state of the FlatBufferBuilder as `finished`. Afterwards, + /// users can call `finished_data` to get the resulting data. + #[inline] + pub fn finish_size_prefixed(&mut self, root: WIPOffset, file_identifier: Option<&str>) { + self.finish_with_opts(root, file_identifier, true); + } + + /// Finalize the FlatBuffer by: aligning it, pushing an optional file + /// identifier on to it, and marking the internal state of the + /// FlatBufferBuilder as `finished`. Afterwards, users can call + /// `finished_data` to get the resulting data. + #[inline] + pub fn finish(&mut self, root: WIPOffset, file_identifier: Option<&str>) { + self.finish_with_opts(root, file_identifier, false); + } + + /// Finalize the FlatBuffer by: aligning it and marking the internal state + /// of the FlatBufferBuilder as `finished`. Afterwards, users can call + /// `finished_data` to get the resulting data. + #[inline] + pub fn finish_minimal(&mut self, root: WIPOffset) { + self.finish_with_opts(root, None, false); + } + + #[inline] + fn used_space(&self) -> usize { + self.owned_buf.len() - self.head as usize + } + + #[inline] + fn track_field(&mut self, slot_off: VOffsetT, off: UOffsetT) { + let fl = FieldLoc { id: slot_off, off }; + self.field_locs.push(fl); + } + + /// Write the VTable, if it is new. + fn write_vtable( + &mut self, + table_tail_revloc: WIPOffset, + ) -> WIPOffset { + self.assert_nested("write_vtable"); + + // Write the vtable offset, which is the start of any Table. + // We fill its value later. + let object_revloc_to_vtable: WIPOffset = + WIPOffset::new(self.push::(0xF0F0_F0F0 as UOffsetT).value()); + + // Layout of the data this function will create when a new vtable is + // needed. + // -------------------------------------------------------------------- + // vtable starts here + // | x, x -- vtable len (bytes) [u16] + // | x, x -- object inline len (bytes) [u16] + // | x, x -- zero, or num bytes from start of object to field #0 [u16] + // | ... + // | x, x -- zero, or num bytes from start of object to field #n-1 [u16] + // vtable ends here + // table starts here + // | x, x, x, x -- offset (negative direction) to the vtable [i32] + // | aka "vtableoffset" + // | -- table inline data begins here, we don't touch it -- + // table ends here -- aka "table_start" + // -------------------------------------------------------------------- + // + // Layout of the data this function will create when we re-use an + // existing vtable. + // + // We always serialize this particular vtable, then compare it to the + // other vtables we know about to see if there is a duplicate. If there + // is, then we erase the serialized vtable we just made. + // We serialize it first so that we are able to do byte-by-byte + // comparisons with already-serialized vtables. This 1) saves + // bookkeeping space (we only keep revlocs to existing vtables), 2) + // allows us to convert to little-endian once, then do + // fast memcmp comparisons, and 3) by ensuring we are comparing real + // serialized vtables, we can be more assured that we are doing the + // comparisons correctly. + // + // -------------------------------------------------------------------- + // table starts here + // | x, x, x, x -- offset (negative direction) to an existing vtable [i32] + // | aka "vtableoffset" + // | -- table inline data begins here, we don't touch it -- + // table starts here: aka "table_start" + // -------------------------------------------------------------------- + + // fill the WIP vtable with zeros: + let vtable_byte_len = get_vtable_byte_len(&self.field_locs); + self.make_space(vtable_byte_len); + + // compute the length of the table (not vtable!) in bytes: + let table_object_size = object_revloc_to_vtable.value() - table_tail_revloc.value(); + debug_assert!(table_object_size < 0x10000); // vTable use 16bit offsets. + + // Write the VTable (we may delete it afterwards, if it is a duplicate): + let vt_start_pos = self.head; + let vt_end_pos = self.head + vtable_byte_len; + { + // write the vtable header: + let vtfw = &mut VTableWriter::init(&mut self.owned_buf[vt_start_pos..vt_end_pos]); + vtfw.write_vtable_byte_length(vtable_byte_len as VOffsetT); + vtfw.write_object_inline_size(table_object_size as VOffsetT); + + // serialize every FieldLoc to the vtable: + for &fl in self.field_locs.iter() { + let pos: VOffsetT = (object_revloc_to_vtable.value() - fl.off) as VOffsetT; + debug_assert_eq!( + vtfw.get_field_offset(fl.id), + 0, + "tried to write a vtable field multiple times" + ); + vtfw.write_field_offset(fl.id, pos); + } + } + let dup_vt_use = { + let this_vt = VTable::init(&self.owned_buf[..], self.head); + self.find_duplicate_stored_vtable_revloc(this_vt) + }; + + let vt_use = match dup_vt_use { + Some(n) => { + VTableWriter::init(&mut self.owned_buf[vt_start_pos..vt_end_pos]).clear(); + self.head += vtable_byte_len; + n + } + None => { + let new_vt_use = self.used_space() as UOffsetT; + self.written_vtable_revpos.push(new_vt_use); + new_vt_use + } + }; + + { + let n = self.head + self.used_space() - object_revloc_to_vtable.value() as usize; + let saw = read_scalar_at::(&self.owned_buf, n); + debug_assert_eq!(saw, 0xF0F0_F0F0); + emplace_scalar::( + &mut self.owned_buf[n..n + SIZE_SOFFSET], + vt_use as SOffsetT - object_revloc_to_vtable.value() as SOffsetT, + ); + } + + self.field_locs.clear(); + + object_revloc_to_vtable + } + + #[inline] + fn find_duplicate_stored_vtable_revloc(&self, needle: VTable) -> Option { + for &revloc in self.written_vtable_revpos.iter().rev() { + let o = VTable::init( + &self.owned_buf[..], + self.head + self.used_space() - revloc as usize, + ); + if needle == o { + return Some(revloc); + } + } + None + } + + // Only call this when you know it is safe to double the size of the buffer. + #[inline] + fn grow_owned_buf(&mut self) { + let old_len = self.owned_buf.len(); + let new_len = max(1, old_len * 2); + + let starting_active_size = self.used_space(); + + let diff = new_len - old_len; + self.owned_buf.resize(new_len, 0); + self.head += diff; + + let ending_active_size = self.used_space(); + debug_assert_eq!(starting_active_size, ending_active_size); + + if new_len == 1 { + return; + } + + // calculate the midpoint, and safely copy the old end data to the new + // end position: + let middle = new_len / 2; + { + let (left, right) = &mut self.owned_buf[..].split_at_mut(middle); + right.copy_from_slice(left); + } + // finally, zero out the old end data. + { + let ptr = (&mut self.owned_buf[..middle]).as_mut_ptr(); + unsafe { + write_bytes(ptr, 0, middle); + } + } + } + + // with or without a size prefix changes how we load the data, so finish* + // functions are split along those lines. + fn finish_with_opts( + &mut self, + root: WIPOffset, + file_identifier: Option<&str>, + size_prefixed: bool, + ) { + self.assert_not_finished("buffer cannot be finished when it is already finished"); + self.assert_not_nested( + "buffer cannot be finished when a table or vector is under construction", + ); + self.written_vtable_revpos.clear(); + + let to_align = { + // for the root offset: + let a = SIZE_UOFFSET; + // for the size prefix: + let b = if size_prefixed { SIZE_UOFFSET } else { 0 }; + // for the file identifier (a string that is not zero-terminated): + let c = if file_identifier.is_some() { + FILE_IDENTIFIER_LENGTH + } else { + 0 + }; + a + b + c + }; + + { + let ma = PushAlignment::new(self.min_align); + self.align(to_align, ma); + } + + if let Some(ident) = file_identifier { + debug_assert_eq!(ident.len(), FILE_IDENTIFIER_LENGTH); + self.push_bytes_unprefixed(ident.as_bytes()); + } + + self.push(root); + + if size_prefixed { + let sz = self.used_space() as UOffsetT; + self.push::(sz); + } + self.finished = true; + } + + #[inline] + fn align(&mut self, len: usize, alignment: PushAlignment) { + self.track_min_align(alignment.value()); + let s = self.used_space() as usize; + self.make_space(padding_bytes(s + len, alignment.value())); + } + + #[inline] + fn track_min_align(&mut self, alignment: usize) { + self.min_align = max(self.min_align, alignment); + } + + #[inline] + fn push_bytes_unprefixed(&mut self, x: &[u8]) -> UOffsetT { + let n = self.make_space(x.len()); + self.owned_buf[n..n + x.len()].copy_from_slice(x); + + n as UOffsetT + } + + #[inline] + fn make_space(&mut self, want: usize) -> usize { + self.ensure_capacity(want); + self.head -= want; + self.head + } + + #[inline] + fn ensure_capacity(&mut self, want: usize) -> usize { + if self.unused_ready_space() >= want { + return want; + } + assert!( + want <= FLATBUFFERS_MAX_BUFFER_SIZE, + "cannot grow buffer beyond 2 gigabytes" + ); + + while self.unused_ready_space() < want { + self.grow_owned_buf(); + } + want + } + #[inline] + fn unused_ready_space(&self) -> usize { + self.head + } + #[inline] + fn assert_nested(&self, fn_name: &'static str) { + // we don't assert that self.field_locs.len() >0 because the vtable + // could be empty (e.g. for empty tables, or for all-default values). + debug_assert!( + self.nested, + format!( + "incorrect FlatBufferBuilder usage: {} must be called while in a nested state", + fn_name + ) + ); + } + #[inline] + fn assert_not_nested(&self, msg: &'static str) { + debug_assert!(!self.nested, msg); + } + #[inline] + fn assert_finished(&self, msg: &'static str) { + debug_assert!(self.finished, msg); + } + #[inline] + fn assert_not_finished(&self, msg: &'static str) { + debug_assert!(!self.finished, msg); + } +} + +/// Compute the length of the vtable needed to represent the provided FieldLocs. +/// If there are no FieldLocs, then provide the minimum number of bytes +/// required: enough to write the VTable header. +#[inline] +fn get_vtable_byte_len(field_locs: &[FieldLoc]) -> usize { + let max_voffset = field_locs.iter().map(|fl| fl.id).max(); + match max_voffset { + None => field_index_to_field_offset(0) as usize, + Some(mv) => mv as usize + SIZE_VOFFSET, + } +} + +#[inline] +fn padding_bytes(buf_size: usize, scalar_size: usize) -> usize { + // ((!buf_size) + 1) & (scalar_size - 1) + (!buf_size).wrapping_add(1) & (scalar_size.wrapping_sub(1)) +} + +impl<'fbb> Default for FlatBufferBuilder<'fbb> { + fn default() -> Self { + Self::new_with_capacity(0) + } +} diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/endian_scalar.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/endian_scalar.rs new file mode 100644 index 0000000..df0b384 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/endian_scalar.rs @@ -0,0 +1,179 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use std::mem::size_of; + +/// Trait for values that must be stored in little-endian byte order, but +/// might be represented in memory as big-endian. Every type that implements +/// EndianScalar is a valid FlatBuffers scalar value. +/// +/// The Rust stdlib does not provide a trait to represent scalars, so this trait +/// serves that purpose, too. +/// +/// Note that we do not use the num-traits crate for this, because it provides +/// "too much". For example, num-traits provides i128 support, but that is an +/// invalid FlatBuffers type. +pub trait EndianScalar: Sized + PartialEq + Copy + Clone { + fn to_little_endian(self) -> Self; + fn from_little_endian(self) -> Self; +} + +/// Macro for implementing a no-op endian conversion. This is used for types +/// that are one byte wide. +macro_rules! impl_endian_scalar_noop { + ($ty:ident) => { + impl EndianScalar for $ty { + #[inline] + fn to_little_endian(self) -> Self { + self + } + #[inline] + fn from_little_endian(self) -> Self { + self + } + } + }; +} + +/// Macro for implementing an endian conversion using the stdlib `to_le` and +/// `from_le` functions. This is used for integer types. It is not used for +/// floats, because the `to_le` and `from_le` are not implemented for them in +/// the stdlib. +macro_rules! impl_endian_scalar_stdlib_le_conversion { + ($ty:ident) => { + impl EndianScalar for $ty { + #[inline] + fn to_little_endian(self) -> Self { + Self::to_le(self) + } + #[inline] + fn from_little_endian(self) -> Self { + Self::from_le(self) + } + } + }; +} + +impl_endian_scalar_noop!(bool); +impl_endian_scalar_noop!(u8); +impl_endian_scalar_noop!(i8); + +impl_endian_scalar_stdlib_le_conversion!(u16); +impl_endian_scalar_stdlib_le_conversion!(u32); +impl_endian_scalar_stdlib_le_conversion!(u64); +impl_endian_scalar_stdlib_le_conversion!(i16); +impl_endian_scalar_stdlib_le_conversion!(i32); +impl_endian_scalar_stdlib_le_conversion!(i64); + +impl EndianScalar for f32 { + /// Convert f32 from host endian-ness to little-endian. + #[inline] + fn to_little_endian(self) -> Self { + #[cfg(target_endian = "little")] + { + self + } + #[cfg(not(target_endian = "little"))] + { + byte_swap_f32(self) + } + } + /// Convert f32 from little-endian to host endian-ness. + #[inline] + fn from_little_endian(self) -> Self { + #[cfg(target_endian = "little")] + { + self + } + #[cfg(not(target_endian = "little"))] + { + byte_swap_f32(self) + } + } +} + +impl EndianScalar for f64 { + /// Convert f64 from host endian-ness to little-endian. + #[inline] + fn to_little_endian(self) -> Self { + #[cfg(target_endian = "little")] + { + self + } + #[cfg(not(target_endian = "little"))] + { + byte_swap_f64(self) + } + } + /// Convert f64 from little-endian to host endian-ness. + #[inline] + fn from_little_endian(self) -> Self { + #[cfg(target_endian = "little")] + { + self + } + #[cfg(not(target_endian = "little"))] + { + byte_swap_f64(self) + } + } +} + +/// Swaps the bytes of an f32. +#[allow(dead_code)] +#[inline] +pub fn byte_swap_f32(x: f32) -> f32 { + f32::from_bits(x.to_bits().swap_bytes()) +} + +/// Swaps the bytes of an f64. +#[allow(dead_code)] +#[inline] +pub fn byte_swap_f64(x: f64) -> f64 { + f64::from_bits(x.to_bits().swap_bytes()) +} + +/// Place an EndianScalar into the provided mutable byte slice. Performs +/// endian conversion, if necessary. +#[inline] +pub fn emplace_scalar(s: &mut [u8], x: T) { + let sz = size_of::(); + let mut_ptr = (&mut s[..sz]).as_mut_ptr() as *mut T; + let val = x.to_little_endian(); + unsafe { + *mut_ptr = val; + } +} + +/// Read an EndianScalar from the provided byte slice at the specified location. +/// Performs endian conversion, if necessary. +#[inline] +pub fn read_scalar_at(s: &[u8], loc: usize) -> T { + let buf = &s[loc..loc + size_of::()]; + read_scalar(buf) +} + +/// Read an EndianScalar from the provided byte slice. Performs endian +/// conversion, if necessary. +#[inline] +pub fn read_scalar(s: &[u8]) -> T { + let sz = size_of::(); + + let p = (&s[..sz]).as_ptr() as *const T; + let x = unsafe { *p }; + + x.from_little_endian() +} diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/follow.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/follow.rs new file mode 100644 index 0000000..4d3eff7 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/follow.rs @@ -0,0 +1,62 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use std::marker::PhantomData; + +/// Follow is a trait that allows us to access FlatBuffers in a declarative, +/// type safe, and fast way. They compile down to almost no code (after +/// optimizations). Conceptually, Follow lifts the offset-based access +/// patterns of FlatBuffers data into the type system. This trait is used +/// pervasively at read time, to access tables, vtables, vectors, strings, and +/// all other data. At this time, Follow is not utilized much on the write +/// path. +/// +/// Writing a new Follow implementation primarily involves deciding whether +/// you want to return data (of the type Self::Inner) or do you want to +/// continue traversing the FlatBuffer. +pub trait Follow<'a> { + type Inner; + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner; +} + +/// Execute a follow as a top-level function. +#[allow(dead_code)] +#[inline] +pub fn lifted_follow<'a, T: Follow<'a>>(buf: &'a [u8], loc: usize) -> T::Inner { + T::follow(buf, loc) +} + +/// FollowStart wraps a Follow impl in a struct type. This can make certain +/// programming patterns more ergonomic. +#[derive(Debug)] +pub struct FollowStart(PhantomData); +impl<'a, T: Follow<'a> + 'a> FollowStart { + #[inline] + pub fn new() -> Self { + Self { 0: PhantomData } + } + #[inline] + pub fn self_follow(&'a self, buf: &'a [u8], loc: usize) -> T::Inner { + T::follow(buf, loc) + } +} +impl<'a, T: Follow<'a>> Follow<'a> for FollowStart { + type Inner = T::Inner; + #[inline] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + T::follow(buf, loc) + } +} diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/lib.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/lib.rs new file mode 100644 index 0000000..ef54132 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/lib.rs @@ -0,0 +1,54 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +//! # FlatBuffers +//! +//! A library for memory-efficient serialization of data. +//! +//! This crate provides runtime support for the FlatBuffers format in the Rust programming language. +//! To use this crate, first generate code with the `flatc` compiler, as described here: https://google.github.io/flatbuffers/ +//! Then, include that code into your project. +//! Finally, add this crate to your `Cargo.toml`. +//! +//! At this time, Rust support is experimental, and APIs may change between minor versions. +//! +//! At this time, to generate Rust code, you will need the latest `master` version of `flatc`, available from here: https://github.com/google/flatbuffers +//! (On OSX, you can install FlatBuffers from `HEAD` with the Homebrew package manager.) + +mod builder; +mod endian_scalar; +mod follow; +mod primitives; +mod push; +mod table; +mod vector; +mod vtable; +mod vtable_writer; + +pub use builder::FlatBufferBuilder; +pub use endian_scalar::{ + byte_swap_f32, byte_swap_f64, emplace_scalar, read_scalar, read_scalar_at, EndianScalar, +}; +pub use follow::{Follow, FollowStart}; +pub use primitives::*; +pub use push::Push; +pub use table::{buffer_has_identifier, get_root, get_size_prefixed_root, Table}; +pub use vector::{follow_cast_ref, SafeSliceAccess, Vector}; +pub use vtable::field_index_to_field_offset; + +// TODO(rw): Unify `create_vector` and `create_vector_direct` by using +// `Into>`. +// TODO(rw): Split fill ops in builder into fill_small, fill_big like in C++. diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/primitives.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/primitives.rs new file mode 100644 index 0000000..06a22ea --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/primitives.rs @@ -0,0 +1,325 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use std::marker::PhantomData; +use std::mem::size_of; +use std::ops::Deref; + +use endian_scalar::{emplace_scalar, read_scalar, read_scalar_at}; +use follow::Follow; +use push::Push; + +pub const FLATBUFFERS_MAX_BUFFER_SIZE: usize = (1u64 << 31) as usize; + +pub const FILE_IDENTIFIER_LENGTH: usize = 4; + +pub const VTABLE_METADATA_FIELDS: usize = 2; + +pub const SIZE_U8: usize = size_of::(); +pub const SIZE_I8: usize = size_of::(); + +pub const SIZE_U16: usize = size_of::(); +pub const SIZE_I16: usize = size_of::(); + +pub const SIZE_U32: usize = size_of::(); +pub const SIZE_I32: usize = size_of::(); + +pub const SIZE_U64: usize = size_of::(); +pub const SIZE_I64: usize = size_of::(); + +pub const SIZE_F32: usize = size_of::(); +pub const SIZE_F64: usize = size_of::(); + +pub const SIZE_SOFFSET: usize = SIZE_I32; +pub const SIZE_UOFFSET: usize = SIZE_U32; +pub const SIZE_VOFFSET: usize = SIZE_I16; + +pub const SIZE_SIZEPREFIX: usize = SIZE_UOFFSET; + +/// SOffsetT is an i32 that is used by tables to reference their vtables. +pub type SOffsetT = i32; + +/// UOffsetT is a u32 that is used by pervasively to represent both pointers +/// and lengths of vectors. +pub type UOffsetT = u32; + +/// VOffsetT is a i32 that is used by vtables to store field data. +pub type VOffsetT = i16; + +/// TableFinishedWIPOffset marks a WIPOffset as being for a finished table. +#[derive(Clone, Copy)] +pub struct TableFinishedWIPOffset {} + +/// TableUnfinishedWIPOffset marks a WIPOffset as being for an unfinished table. +#[derive(Clone, Copy)] +pub struct TableUnfinishedWIPOffset {} + +/// UnionWIPOffset marks a WIPOffset as being for a union value. +#[derive(Clone, Copy)] +pub struct UnionWIPOffset {} + +/// VTableWIPOffset marks a WIPOffset as being for a vtable. +#[derive(Clone, Copy)] +pub struct VTableWIPOffset {} + +/// WIPOffset contains an UOffsetT with a special meaning: it is the location of +/// data relative to the *end* of an in-progress FlatBuffer. The +/// FlatBufferBuilder uses this to track the location of objects in an absolute +/// way. The impl of Push converts a WIPOffset into a ForwardsUOffset. +#[derive(Debug)] +pub struct WIPOffset(UOffsetT, PhantomData); + +// We cannot use derive for these two impls, as the derived impls would only +// implement `Copy` and `Clone` for `T: Copy` and `T: Clone` respectively. +// However `WIPOffset` can always be copied, no matter that `T` you +// have. +impl Copy for WIPOffset {} +impl Clone for WIPOffset { + #[inline(always)] + fn clone(&self) -> Self { + *self + } +} + +impl PartialEq for WIPOffset { + fn eq(&self, o: &WIPOffset) -> bool { + self.value() == o.value() + } +} + +impl Deref for WIPOffset { + type Target = UOffsetT; + #[inline] + fn deref(&self) -> &UOffsetT { + &self.0 + } +} +impl<'a, T: 'a> WIPOffset { + /// Create a new WIPOffset. + #[inline] + pub fn new(o: UOffsetT) -> WIPOffset { + WIPOffset { + 0: o, + 1: PhantomData, + } + } + + /// Return a wrapped value that brings its meaning as a union WIPOffset + /// into the type system. + #[inline(always)] + pub fn as_union_value(self) -> WIPOffset { + WIPOffset::new(self.0) + } + /// Get the underlying value. + #[inline(always)] + pub fn value(self) -> UOffsetT { + self.0 + } +} + +impl Push for WIPOffset { + type Output = ForwardsUOffset; + + #[inline(always)] + fn push(&self, dst: &mut [u8], rest: &[u8]) { + let n = (SIZE_UOFFSET + rest.len() - self.value() as usize) as UOffsetT; + emplace_scalar::(dst, n); + } +} + +impl Push for ForwardsUOffset { + type Output = Self; + + #[inline(always)] + fn push(&self, dst: &mut [u8], rest: &[u8]) { + self.value().push(dst, rest); + } +} + +/// ForwardsUOffset is used by Follow to traverse a FlatBuffer: the pointer +/// is incremented by the value contained in this type. +#[derive(Debug)] +pub struct ForwardsUOffset(UOffsetT, PhantomData); + +// We cannot use derive for these two impls, as the derived impls would only +// implement `Copy` and `Clone` for `T: Copy` and `T: Clone` respectively. +// However `ForwardsUOffset` can always be copied, no matter that `T` you +// have. +impl Copy for ForwardsUOffset {} +impl Clone for ForwardsUOffset { + #[inline(always)] + fn clone(&self) -> Self { + *self + } +} + +impl ForwardsUOffset { + #[inline(always)] + pub fn value(self) -> UOffsetT { + self.0 + } +} + +impl<'a, T: Follow<'a>> Follow<'a> for ForwardsUOffset { + type Inner = T::Inner; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let slice = &buf[loc..loc + SIZE_UOFFSET]; + let off = read_scalar::(slice) as usize; + T::follow(buf, loc + off) + } +} + +/// ForwardsVOffset is used by Follow to traverse a FlatBuffer: the pointer +/// is incremented by the value contained in this type. +#[derive(Debug)] +pub struct ForwardsVOffset(VOffsetT, PhantomData); +impl ForwardsVOffset { + #[inline(always)] + pub fn value(&self) -> VOffsetT { + self.0 + } +} + +impl<'a, T: Follow<'a>> Follow<'a> for ForwardsVOffset { + type Inner = T::Inner; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let slice = &buf[loc..loc + SIZE_VOFFSET]; + let off = read_scalar::(slice) as usize; + T::follow(buf, loc + off) + } +} + +impl Push for ForwardsVOffset { + type Output = Self; + + #[inline] + fn push(&self, dst: &mut [u8], rest: &[u8]) { + self.value().push(dst, rest); + } +} + +/// ForwardsSOffset is used by Follow to traverse a FlatBuffer: the pointer +/// is incremented by the *negative* of the value contained in this type. +#[derive(Debug)] +pub struct BackwardsSOffset(SOffsetT, PhantomData); +impl BackwardsSOffset { + #[inline(always)] + pub fn value(&self) -> SOffsetT { + self.0 + } +} + +impl<'a, T: Follow<'a>> Follow<'a> for BackwardsSOffset { + type Inner = T::Inner; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let slice = &buf[loc..loc + SIZE_SOFFSET]; + let off = read_scalar::(slice); + T::follow(buf, (loc as SOffsetT - off) as usize) + } +} + +impl Push for BackwardsSOffset { + type Output = Self; + + #[inline] + fn push(&self, dst: &mut [u8], rest: &[u8]) { + self.value().push(dst, rest); + } +} + +/// SkipSizePrefix is used by Follow to traverse a FlatBuffer: the pointer is +/// incremented by a fixed constant in order to skip over the size prefix value. +pub struct SkipSizePrefix(PhantomData); +impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipSizePrefix { + type Inner = T::Inner; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + T::follow(buf, loc + SIZE_SIZEPREFIX) + } +} + +/// SkipRootOffset is used by Follow to traverse a FlatBuffer: the pointer is +/// incremented by a fixed constant in order to skip over the root offset value. +pub struct SkipRootOffset(PhantomData); +impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipRootOffset { + type Inner = T::Inner; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + T::follow(buf, loc + SIZE_UOFFSET) + } +} + +/// FileIdentifier is used by Follow to traverse a FlatBuffer: the pointer is +/// dereferenced into a byte slice, whose bytes are the file identifer value. +pub struct FileIdentifier; +impl<'a> Follow<'a> for FileIdentifier { + type Inner = &'a [u8]; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + &buf[loc..loc + FILE_IDENTIFIER_LENGTH] + } +} + +/// SkipFileIdentifier is used by Follow to traverse a FlatBuffer: the pointer +/// is incremented by a fixed constant in order to skip over the file +/// identifier value. +pub struct SkipFileIdentifier(PhantomData); +impl<'a, T: Follow<'a> + 'a> Follow<'a> for SkipFileIdentifier { + type Inner = T::Inner; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + T::follow(buf, loc + FILE_IDENTIFIER_LENGTH) + } +} + +impl<'a> Follow<'a> for bool { + type Inner = bool; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + read_scalar_at::(buf, loc) != 0 + } +} + +/// Follow trait impls for primitive types. +/// +/// Ideally, these would be implemented as a single impl using trait bounds on +/// EndianScalar, but implementing Follow that way causes a conflict with +/// other impls. +macro_rules! impl_follow_for_endian_scalar { + ($ty:ident) => { + impl<'a> Follow<'a> for $ty { + type Inner = $ty; + #[inline(always)] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + read_scalar_at::<$ty>(buf, loc) + } + } + }; +} + +impl_follow_for_endian_scalar!(u8); +impl_follow_for_endian_scalar!(u16); +impl_follow_for_endian_scalar!(u32); +impl_follow_for_endian_scalar!(u64); +impl_follow_for_endian_scalar!(i8); +impl_follow_for_endian_scalar!(i16); +impl_follow_for_endian_scalar!(i32); +impl_follow_for_endian_scalar!(i64); +impl_follow_for_endian_scalar!(f32); +impl_follow_for_endian_scalar!(f64); diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/push.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/push.rs new file mode 100644 index 0000000..1863058 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/push.rs @@ -0,0 +1,80 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use std::cmp::max; +use std::mem::{align_of, size_of}; + +use endian_scalar::emplace_scalar; + +/// Trait to abstract over functionality needed to write values (either owned +/// or referenced). Used in FlatBufferBuilder and implemented for generated +/// types. +pub trait Push: Sized { + type Output; + fn push(&self, dst: &mut [u8], _rest: &[u8]); + #[inline] + fn size() -> usize { + size_of::() + } + #[inline] + fn alignment() -> PushAlignment { + PushAlignment::new(align_of::()) + } +} + +/// Ensure Push alignment calculations are typesafe (because this helps reduce +/// implementation issues when using FlatBufferBuilder::align). +pub struct PushAlignment(usize); +impl PushAlignment { + #[inline] + pub fn new(x: usize) -> Self { + PushAlignment { 0: x } + } + #[inline] + pub fn value(&self) -> usize { + self.0 + } + #[inline] + pub fn max_of(&self, o: usize) -> Self { + PushAlignment::new(max(self.0, o)) + } +} + +/// Macro to implement Push for EndianScalar types. +macro_rules! impl_push_for_endian_scalar { + ($ty:ident) => { + impl Push for $ty { + type Output = $ty; + + #[inline] + fn push(&self, dst: &mut [u8], _rest: &[u8]) { + emplace_scalar::<$ty>(dst, *self); + } + } + }; +} + +impl_push_for_endian_scalar!(bool); +impl_push_for_endian_scalar!(u8); +impl_push_for_endian_scalar!(i8); +impl_push_for_endian_scalar!(u16); +impl_push_for_endian_scalar!(i16); +impl_push_for_endian_scalar!(u32); +impl_push_for_endian_scalar!(i32); +impl_push_for_endian_scalar!(u64); +impl_push_for_endian_scalar!(i64); +impl_push_for_endian_scalar!(f32); +impl_push_for_endian_scalar!(f64); diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/table.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/table.rs new file mode 100644 index 0000000..397d24c --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/table.rs @@ -0,0 +1,77 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use follow::Follow; +use primitives::*; +use vtable::VTable; + +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct Table<'a> { + pub buf: &'a [u8], + pub loc: usize, +} + +impl<'a> Table<'a> { + #[inline] + pub fn new(buf: &'a [u8], loc: usize) -> Self { + Table { buf, loc } + } + #[inline] + pub fn vtable(&self) -> VTable<'a> { + >>::follow(self.buf, self.loc) + } + #[inline] + pub fn get + 'a>( + &self, + slot_byte_loc: VOffsetT, + default: Option, + ) -> Option { + let o = self.vtable().get(slot_byte_loc) as usize; + if o == 0 { + return default; + } + Some(::follow(self.buf, self.loc + o)) + } +} + +impl<'a> Follow<'a> for Table<'a> { + type Inner = Table<'a>; + #[inline] + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Table { buf, loc } + } +} + +#[inline] +pub fn get_root<'a, T: Follow<'a> + 'a>(data: &'a [u8]) -> T::Inner { + >::follow(data, 0) +} +#[inline] +pub fn get_size_prefixed_root<'a, T: Follow<'a> + 'a>(data: &'a [u8]) -> T::Inner { + >>::follow(data, 0) +} +#[inline] +pub fn buffer_has_identifier(data: &[u8], ident: &str, size_prefixed: bool) -> bool { + assert_eq!(ident.len(), FILE_IDENTIFIER_LENGTH); + + let got = if size_prefixed { + >>::follow(data, 0) + } else { + >::follow(data, 0) + }; + + ident.as_bytes() == got +} diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/vector.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/vector.rs new file mode 100644 index 0000000..354aec7 --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/vector.rs @@ -0,0 +1,275 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use std::iter::{DoubleEndedIterator, ExactSizeIterator, FusedIterator}; +use std::marker::PhantomData; +use std::mem::size_of; +use std::slice::from_raw_parts; +use std::str::from_utf8_unchecked; + +use endian_scalar::read_scalar_at; +#[cfg(target_endian = "little")] +use endian_scalar::EndianScalar; +use follow::Follow; +use primitives::*; + +#[derive(Debug)] +pub struct Vector<'a, T: 'a>(&'a [u8], usize, PhantomData); + +// We cannot use derive for these two impls, as it would only implement Copy +// and Clone for `T: Copy` and `T: Clone` respectively. However `Vector<'a, T>` +// can always be copied, no matter that `T` you have. +impl<'a, T> Copy for Vector<'a, T> {} +impl<'a, T> Clone for Vector<'a, T> { + fn clone(&self) -> Self { + *self + } +} + +impl<'a, T: 'a> Vector<'a, T> { + #[inline(always)] + pub fn new(buf: &'a [u8], loc: usize) -> Self { + Vector { + 0: buf, + 1: loc, + 2: PhantomData, + } + } + + #[inline(always)] + pub fn len(&self) -> usize { + read_scalar_at::(&self.0, self.1) as usize + } + #[inline(always)] + pub fn is_empty(&self) -> bool { + self.len() == 0 + } +} + +impl<'a, T: Follow<'a> + 'a> Vector<'a, T> { + #[inline(always)] + pub fn get(&self, idx: usize) -> T::Inner { + debug_assert!(idx < read_scalar_at::(&self.0, self.1) as usize); + let sz = size_of::(); + debug_assert!(sz > 0); + T::follow(self.0, self.1 as usize + SIZE_UOFFSET + sz * idx) + } + + #[inline(always)] + pub fn iter(&self) -> VectorIter<'a, T> { + VectorIter::new(*self) + } +} + +pub trait SafeSliceAccess {} +impl<'a, T: SafeSliceAccess + 'a> Vector<'a, T> { + pub fn safe_slice(self) -> &'a [T] { + let buf = self.0; + let loc = self.1; + let sz = size_of::(); + debug_assert!(sz > 0); + let len = read_scalar_at::(&buf, loc) as usize; + let data_buf = &buf[loc + SIZE_UOFFSET..loc + SIZE_UOFFSET + len * sz]; + let ptr = data_buf.as_ptr() as *const T; + let s: &'a [T] = unsafe { from_raw_parts(ptr, len) }; + s + } +} + +impl SafeSliceAccess for u8 {} +impl SafeSliceAccess for i8 {} +impl SafeSliceAccess for bool {} + +#[cfg(target_endian = "little")] +mod le_safe_slice_impls { + impl super::SafeSliceAccess for u16 {} + impl super::SafeSliceAccess for u32 {} + impl super::SafeSliceAccess for u64 {} + + impl super::SafeSliceAccess for i16 {} + impl super::SafeSliceAccess for i32 {} + impl super::SafeSliceAccess for i64 {} + + impl super::SafeSliceAccess for f32 {} + impl super::SafeSliceAccess for f64 {} +} + +#[cfg(target_endian = "little")] +pub use self::le_safe_slice_impls::*; + +pub fn follow_cast_ref<'a, T: Sized + 'a>(buf: &'a [u8], loc: usize) -> &'a T { + let sz = size_of::(); + let buf = &buf[loc..loc + sz]; + let ptr = buf.as_ptr() as *const T; + unsafe { &*ptr } +} + +impl<'a> Follow<'a> for &'a str { + type Inner = &'a str; + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let len = read_scalar_at::(&buf, loc) as usize; + let slice = &buf[loc + SIZE_UOFFSET..loc + SIZE_UOFFSET + len]; + unsafe { from_utf8_unchecked(slice) } + } +} + +#[cfg(target_endian = "little")] +fn follow_slice_helper(buf: &[u8], loc: usize) -> &[T] { + let sz = size_of::(); + debug_assert!(sz > 0); + let len = read_scalar_at::(&buf, loc) as usize; + let data_buf = &buf[loc + SIZE_UOFFSET..loc + SIZE_UOFFSET + len * sz]; + let ptr = data_buf.as_ptr() as *const T; + let s: &[T] = unsafe { from_raw_parts(ptr, len) }; + s +} + +/// Implement direct slice access if the host is little-endian. +#[cfg(target_endian = "little")] +impl<'a, T: EndianScalar> Follow<'a> for &'a [T] { + type Inner = &'a [T]; + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + follow_slice_helper::(buf, loc) + } +} + +/// Implement Follow for all possible Vectors that have Follow-able elements. +impl<'a, T: Follow<'a> + 'a> Follow<'a> for Vector<'a, T> { + type Inner = Vector<'a, T>; + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Vector::new(buf, loc) + } +} + +#[derive(Debug)] +pub struct VectorIter<'a, T: 'a> { + buf: &'a [u8], + loc: usize, + remaining: usize, + phantom: PhantomData, +} + +impl<'a, T: 'a> VectorIter<'a, T> { + #[inline] + pub fn new(inner: Vector<'a, T>) -> Self { + VectorIter { + buf: inner.0, + // inner.1 is the location of the data for the vector. + // The first SIZE_UOFFSET bytes is the length. We skip + // that to get to the actual vector content. + loc: inner.1 + SIZE_UOFFSET, + remaining: inner.len(), + phantom: PhantomData, + } + } +} + +impl<'a, T: Follow<'a> + 'a> Clone for VectorIter<'a, T> { + #[inline] + fn clone(&self) -> Self { + VectorIter { + buf: self.buf, + loc: self.loc, + remaining: self.remaining, + phantom: self.phantom, + } + } +} + +impl<'a, T: Follow<'a> + 'a> Iterator for VectorIter<'a, T> { + type Item = T::Inner; + + #[inline] + fn next(&mut self) -> Option { + let sz = size_of::(); + debug_assert!(sz > 0); + + if self.remaining == 0 { + None + } else { + let result = T::follow(self.buf, self.loc); + self.loc += sz; + self.remaining -= 1; + Some(result) + } + } + + #[inline] + fn nth(&mut self, n: usize) -> Option { + let sz = size_of::(); + debug_assert!(sz > 0); + + self.remaining = self.remaining.saturating_sub(n); + + // Note that this might overflow, but that is okay because + // in that case self.remaining will have been set to zero. + self.loc = self.loc.wrapping_add(sz * n); + + self.next() + } + + #[inline] + fn size_hint(&self) -> (usize, Option) { + (self.remaining, Some(self.remaining)) + } +} + +impl<'a, T: Follow<'a> + 'a> DoubleEndedIterator for VectorIter<'a, T> { + #[inline] + fn next_back(&mut self) -> Option { + let sz = size_of::(); + debug_assert!(sz > 0); + + if self.remaining == 0 { + None + } else { + self.remaining -= 1; + Some(T::follow(self.buf, self.loc + sz * self.remaining)) + } + } + + #[inline] + fn nth_back(&mut self, n: usize) -> Option { + self.remaining = self.remaining.saturating_sub(n); + self.next_back() + } +} + +impl<'a, T: 'a + Follow<'a>> ExactSizeIterator for VectorIter<'a, T> { + #[inline] + fn len(&self) -> usize { + self.remaining + } +} + +impl<'a, T: 'a + Follow<'a>> FusedIterator for VectorIter<'a, T> {} + +impl<'a, T: Follow<'a> + 'a> IntoIterator for Vector<'a, T> { + type Item = T::Inner; + type IntoIter = VectorIter<'a, T>; + #[inline] + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +impl<'a, 'b, T: Follow<'a> + 'a> IntoIterator for &'b Vector<'a, T> { + type Item = T::Inner; + type IntoIter = VectorIter<'a, T>; + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable.rs new file mode 100644 index 0000000..f8f266a --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable.rs @@ -0,0 +1,91 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use endian_scalar::read_scalar_at; +use follow::Follow; +use primitives::*; + +/// VTable encapsulates read-only usage of a vtable. It is only to be used +/// by generated code. +#[derive(Debug)] +pub struct VTable<'a> { + buf: &'a [u8], + loc: usize, +} + +impl<'a> PartialEq for VTable<'a> { + fn eq(&self, other: &VTable) -> bool { + self.as_bytes().eq(other.as_bytes()) + } +} + +impl<'a> VTable<'a> { + pub fn init(buf: &'a [u8], loc: usize) -> Self { + VTable { buf, loc } + } + pub fn num_fields(&self) -> usize { + (self.num_bytes() / SIZE_VOFFSET) - 2 + } + pub fn num_bytes(&self) -> usize { + read_scalar_at::(self.buf, self.loc) as usize + } + pub fn object_inline_num_bytes(&self) -> usize { + let n = read_scalar_at::(self.buf, self.loc + SIZE_VOFFSET); + n as usize + } + pub fn get_field(&self, idx: usize) -> VOffsetT { + // TODO(rw): distinguish between None and 0? + if idx > self.num_fields() { + return 0; + } + read_scalar_at::( + self.buf, + self.loc + SIZE_VOFFSET + SIZE_VOFFSET + SIZE_VOFFSET * idx, + ) + } + pub fn get(&self, byte_loc: VOffsetT) -> VOffsetT { + // TODO(rw): distinguish between None and 0? + if byte_loc as usize >= self.num_bytes() { + return 0; + } + read_scalar_at::(self.buf, self.loc + byte_loc as usize) + } + pub fn as_bytes(&self) -> &[u8] { + let len = self.num_bytes(); + &self.buf[self.loc..self.loc + len] + } +} + +#[allow(dead_code)] +pub fn field_index_to_field_offset(field_id: VOffsetT) -> VOffsetT { + // Should correspond to what end_table() below builds up. + let fixed_fields = 2; // Vtable size and Object Size. + ((field_id + fixed_fields) * (SIZE_VOFFSET as VOffsetT)) as VOffsetT +} + +#[allow(dead_code)] +pub fn field_offset_to_field_index(field_o: VOffsetT) -> VOffsetT { + debug_assert!(field_o >= 2); + let fixed_fields = 2; // VTable size and Object Size. + (field_o / (SIZE_VOFFSET as VOffsetT)) - fixed_fields +} + +impl<'a> Follow<'a> for VTable<'a> { + type Inner = VTable<'a>; + fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + VTable::init(buf, loc) + } +} diff --git a/third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable_writer.rs b/third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable_writer.rs new file mode 100644 index 0000000..f065fdd --- /dev/null +++ b/third_party/cargo/vendor/flatbuffers-0.6.1/src/vtable_writer.rs @@ -0,0 +1,84 @@ +/* + * Copyright 2018 Google Inc. All rights reserved. + * + * 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. + */ + +use std::ptr::write_bytes; + +use endian_scalar::{emplace_scalar, read_scalar_at}; +use primitives::*; + +/// VTableWriter compartmentalizes actions needed to create a vtable. +#[derive(Debug)] +pub struct VTableWriter<'a> { + buf: &'a mut [u8], +} + +impl<'a> VTableWriter<'a> { + #[inline(always)] + pub fn init(buf: &'a mut [u8]) -> Self { + VTableWriter { buf } + } + + /// Writes the vtable length (in bytes) into the vtable. + /// + /// Note that callers already need to have computed this to initialize + /// a VTableWriter. + /// + /// In debug mode, asserts that the length of the underlying data is equal + /// to the provided value. + #[inline(always)] + pub fn write_vtable_byte_length(&mut self, n: VOffsetT) { + emplace_scalar::(&mut self.buf[..SIZE_VOFFSET], n); + debug_assert_eq!(n as usize, self.buf.len()); + } + + /// Writes an object length (in bytes) into the vtable. + #[inline(always)] + pub fn write_object_inline_size(&mut self, n: VOffsetT) { + emplace_scalar::(&mut self.buf[SIZE_VOFFSET..2 * SIZE_VOFFSET], n); + } + + /// Gets an object field offset from the vtable. Only used for debugging. + /// + /// Note that this expects field offsets (which are like pointers), not + /// field ids (which are like array indices). + #[inline(always)] + pub fn get_field_offset(&self, vtable_offset: VOffsetT) -> VOffsetT { + let idx = vtable_offset as usize; + read_scalar_at::(&self.buf, idx) + } + + /// Writes an object field offset into the vtable. + /// + /// Note that this expects field offsets (which are like pointers), not + /// field ids (which are like array indices). + #[inline(always)] + pub fn write_field_offset(&mut self, vtable_offset: VOffsetT, object_data_offset: VOffsetT) { + let idx = vtable_offset as usize; + emplace_scalar::(&mut self.buf[idx..idx + SIZE_VOFFSET], object_data_offset); + } + + /// Clears all data in this VTableWriter. Used to cleanly undo a + /// vtable write. + #[inline(always)] + pub fn clear(&mut self) { + // This is the closest thing to memset in Rust right now. + let len = self.buf.len(); + let p = self.buf.as_mut_ptr() as *mut u8; + unsafe { + write_bytes(p, 0, len); + } + } +} diff --git a/third_party/cargo/vendor/fnv-1.0.6/.cargo-checksum.json b/third_party/cargo/vendor/fnv-1.0.6/.cargo-checksum.json deleted file mode 100644 index b1fb191..0000000 --- a/third_party/cargo/vendor/fnv-1.0.6/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"8a89e16dc6b373aa151fb2d1221c699b39b1dd5599aa616897fa85511b71104f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"65fdb6c76cd61612070c066eec9ecdb30ee74fb27859d0d9af58b9f499fd0c3e","README.md":"9398b0785fdaf32fe61dca3d6f16e69cf53ab2911c9435053d1ec962cd92b8fa","lib.rs":"0303c8c75e9cf35f5379f67cfc003ba0b51e9643dc8f3bd346322595d7685d97"},"package":"2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"} \ No newline at end of file diff --git a/third_party/cargo/vendor/fnv-1.0.7/.cargo-checksum.json b/third_party/cargo/vendor/fnv-1.0.7/.cargo-checksum.json new file mode 100644 index 0000000..1c01691 --- /dev/null +++ b/third_party/cargo/vendor/fnv-1.0.7/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"0854ced32611c6389356c0b43ae663da9d4480376c5f0825b82eb442dd84e8d8","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"65fdb6c76cd61612070c066eec9ecdb30ee74fb27859d0d9af58b9f499fd0c3e","README.md":"7653d488c5bdf93a3069bf41770650897b85815521f67f69a4a90d0fefb4fa1f","lib.rs":"32bf17ff841b4c285985d9e9df79c5099318c11bf0436ee8582dec30fc9ec826"},"package":"3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"} \ No newline at end of file diff --git a/third_party/cargo/vendor/fnv-1.0.6/BUILD b/third_party/cargo/vendor/fnv-1.0.7/BUILD similarity index 92% rename from third_party/cargo/vendor/fnv-1.0.6/BUILD rename to third_party/cargo/vendor/fnv-1.0.7/BUILD index d0e714a..5932d91 100644 --- a/third_party/cargo/vendor/fnv-1.0.6/BUILD +++ b/third_party/cargo/vendor/fnv-1.0.7/BUILD @@ -35,8 +35,10 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "1.0.6", + version = "1.0.7", crate_features = [ + "default", + "std", ], ) diff --git a/third_party/cargo/vendor/fnv-1.0.6/Cargo.toml b/third_party/cargo/vendor/fnv-1.0.7/Cargo.toml similarity index 88% rename from third_party/cargo/vendor/fnv-1.0.6/Cargo.toml rename to third_party/cargo/vendor/fnv-1.0.7/Cargo.toml index 1157799..27e339c 100644 --- a/third_party/cargo/vendor/fnv-1.0.6/Cargo.toml +++ b/third_party/cargo/vendor/fnv-1.0.7/Cargo.toml @@ -3,7 +3,7 @@ # 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 +# 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 @@ -12,7 +12,7 @@ [package] name = "fnv" -version = "1.0.6" +version = "1.0.7" authors = ["Alex Crichton "] description = "Fowler–Noll–Vo hash function" documentation = "https://doc.servo.org/fnv/" @@ -23,3 +23,7 @@ repository = "https://github.com/servo/rust-fnv" [lib] name = "fnv" path = "lib.rs" + +[features] +default = ["std"] +std = [] diff --git a/third_party/cargo/vendor/fnv-1.0.6/LICENSE-APACHE b/third_party/cargo/vendor/fnv-1.0.7/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/fnv-1.0.6/LICENSE-APACHE rename to third_party/cargo/vendor/fnv-1.0.7/LICENSE-APACHE diff --git a/third_party/cargo/vendor/fnv-1.0.6/LICENSE-MIT b/third_party/cargo/vendor/fnv-1.0.7/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/fnv-1.0.6/LICENSE-MIT rename to third_party/cargo/vendor/fnv-1.0.7/LICENSE-MIT diff --git a/third_party/cargo/vendor/fnv-1.0.6/README.md b/third_party/cargo/vendor/fnv-1.0.7/README.md similarity index 97% rename from third_party/cargo/vendor/fnv-1.0.6/README.md rename to third_party/cargo/vendor/fnv-1.0.7/README.md index 6a4c4ae..f2df52f 100644 --- a/third_party/cargo/vendor/fnv-1.0.6/README.md +++ b/third_party/cargo/vendor/fnv-1.0.7/README.md @@ -78,4 +78,4 @@ set.insert(2); [chongo]: http://www.isthe.com/chongo/tech/comp/fnv/index.html [faq]: https://www.rust-lang.org/en-US/faq.html#why-are-rusts-hashmaps-slow -[graphs]: http://cglab.ca/~abeinges/blah/hash-rs/ +[graphs]: https://cglab.ca/~abeinges/blah/hash-rs/ diff --git a/third_party/cargo/vendor/fnv-1.0.6/lib.rs b/third_party/cargo/vendor/fnv-1.0.7/lib.rs similarity index 92% rename from third_party/cargo/vendor/fnv-1.0.6/lib.rs rename to third_party/cargo/vendor/fnv-1.0.7/lib.rs index eaf3d44..25dd6d5 100644 --- a/third_party/cargo/vendor/fnv-1.0.6/lib.rs +++ b/third_party/cargo/vendor/fnv-1.0.7/lib.rs @@ -21,53 +21,66 @@ //! denial-of-service attacks, and can assume that its inputs are going to be //! small—a perfect use case for FNV. //! -//! -//! ## Using FNV in a `HashMap` -//! -//! The `FnvHashMap` type alias is the easiest way to use the standard library’s -//! `HashMap` with FNV. -//! -//! ```rust -//! use fnv::FnvHashMap; -//! -//! let mut map = FnvHashMap::default(); -//! map.insert(1, "one"); -//! map.insert(2, "two"); -//! -//! map = FnvHashMap::with_capacity_and_hasher(10, Default::default()); -//! map.insert(1, "one"); -//! map.insert(2, "two"); -//! ``` -//! -//! Note, the standard library’s `HashMap::new` and `HashMap::with_capacity` -//! are only implemented for the `RandomState` hasher, so using `Default` to -//! get the hasher is the next best option. -//! -//! ## Using FNV in a `HashSet` -//! -//! Similarly, `FnvHashSet` is a type alias for the standard library’s `HashSet` -//! with FNV. -//! -//! ```rust -//! use fnv::FnvHashSet; -//! -//! let mut set = FnvHashSet::default(); -//! set.insert(1); -//! set.insert(2); -//! -//! set = FnvHashSet::with_capacity_and_hasher(10, Default::default()); -//! set.insert(1); -//! set.insert(2); -//! ``` +#![cfg_attr(feature = "std", doc = r#" + +## Using FNV in a `HashMap` + +The `FnvHashMap` type alias is the easiest way to use the standard library’s +`HashMap` with FNV. + +```rust +use fnv::FnvHashMap; + +let mut map = FnvHashMap::default(); +map.insert(1, "one"); +map.insert(2, "two"); + +map = FnvHashMap::with_capacity_and_hasher(10, Default::default()); +map.insert(1, "one"); +map.insert(2, "two"); +``` + +Note, the standard library’s `HashMap::new` and `HashMap::with_capacity` +are only implemented for the `RandomState` hasher, so using `Default` to +get the hasher is the next best option. + +## Using FNV in a `HashSet` + +Similarly, `FnvHashSet` is a type alias for the standard library’s `HashSet` +with FNV. + +```rust +use fnv::FnvHashSet; + +let mut set = FnvHashSet::default(); +set.insert(1); +set.insert(2); + +set = FnvHashSet::with_capacity_and_hasher(10, Default::default()); +set.insert(1); +set.insert(2); +``` +"#)] //! //! [chongo]: http://www.isthe.com/chongo/tech/comp/fnv/index.html //! [faq]: https://www.rust-lang.org/en-US/faq.html#why-are-rusts-hashmaps-slow -//! [graphs]: http://cglab.ca/~abeinges/blah/hash-rs/ +//! [graphs]: https://cglab.ca/~abeinges/blah/hash-rs/ +#![cfg_attr(not(feature = "std"), no_std)] +#[cfg(all(not(feature = "std"), test))] +extern crate alloc; + +#[cfg(feature = "std")] use std::default::Default; +#[cfg(feature = "std")] use std::hash::{Hasher, BuildHasherDefault}; +#[cfg(feature = "std")] use std::collections::{HashMap, HashSet}; +#[cfg(not(feature = "std"))] +use core::default::Default; +#[cfg(not(feature = "std"))] +use core::hash::{Hasher, BuildHasherDefault}; /// An implementation of the Fowler–Noll–Vo hash function. /// @@ -115,16 +128,21 @@ impl Hasher for FnvHasher { pub type FnvBuildHasher = BuildHasherDefault; /// A `HashMap` using a default FNV hasher. +#[cfg(feature = "std")] pub type FnvHashMap = HashMap; /// A `HashSet` using a default FNV hasher. +#[cfg(feature = "std")] pub type FnvHashSet = HashSet; #[cfg(test)] mod test { use super::*; + #[cfg(feature = "std")] use std::hash::Hasher; + #[cfg(not(feature = "std"))] + use alloc::vec::Vec; fn fnv1a(bytes: &[u8]) -> u64 { let mut hasher = FnvHasher::default(); diff --git a/third_party/cargo/vendor/half-1.5.0/.cargo-checksum.json b/third_party/cargo/vendor/half-1.5.0/.cargo-checksum.json deleted file mode 100644 index 749c446..0000000 --- a/third_party/cargo/vendor/half-1.5.0/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"b50f45ccb811c5966c6b59fc031d0d66e91053723399a16b35b5ed3d62a63237","Cargo.toml":"466889496dffe19f3597c41853744b058dbc25b79eea257e1f8a3305891e0831","LICENSE-APACHE":"c144680885b29e4719e2a51f0aab5439a1e02d980692b5aaf086cae12727f28b","LICENSE-MIT":"54c0366c7f8643c8502618e7f02b4176f28c834a6b0315b969477720b65e183f","README.md":"a28ac0d5763a5b229a3f4f533f732a2d7bc91fbde44f062e750a632734c3d40f","appveyor.yml":"0cb2779da07ddbfb85f905f972017bc8f5fba8bc6575134d90e36cf5672046ac","benches/convert.rs":"eb47a49fd607b3ac07f620c41a1aa37c8492dd907ea408692b58e814fed27848","src/bfloat.rs":"b4b1200d55ea91e30f9fb3d49a9bd69fcbe5ca4c268f241963db0040a5b8525d","src/bfloat/convert.rs":"e41be00501e9f416ab48daba2a98dd73f3e5ababb44a8d24ca3b52d25b76ce44","src/binary16.rs":"19b2364c362b333e2ae4c8180d51aee12431142f17e356ddd737cd8b3ed9327c","src/binary16/convert.rs":"85a9e4b670a3043746365c443a1546333a160ae2a9312f0e64863a21b547ee00","src/lib.rs":"6130a7eb41deee9e374d3d63e5baa729ddf689cf86257042bea245d9f0f50ab5","src/slice.rs":"14b29e28dac3aea172f7964f7f659a1cc85c4e7e51d06961768e82f79a76c1fe","src/vec.rs":"dd902e515126a71cfc5892c3cb0361c2a85874f22d3646fbd433098db73f2a96","tests/version-numbers.rs":"73301b7bfe500eada5ede66f0dce89bd3e354af50a8e7a123b02931cd5eb8e16"},"package":"f36b5f248235f45773d4944f555f83ea61fe07b18b561ccf99d7483d7381e54d"} \ No newline at end of file diff --git a/third_party/cargo/vendor/half-1.6.0/.cargo-checksum.json b/third_party/cargo/vendor/half-1.6.0/.cargo-checksum.json new file mode 100644 index 0000000..54419fa --- /dev/null +++ b/third_party/cargo/vendor/half-1.6.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"041a3a9e2de8d49834819183c77d45c246fef1714e40af3c043792d0e48c5f1c","Cargo.toml":"fff24bbc7fca14e1bff25cf9b53ef6351c3cb91e27f7cc9f9e3dd3570f0a643d","LICENSE-APACHE":"c144680885b29e4719e2a51f0aab5439a1e02d980692b5aaf086cae12727f28b","LICENSE-MIT":"54c0366c7f8643c8502618e7f02b4176f28c834a6b0315b969477720b65e183f","README.md":"a28ac0d5763a5b229a3f4f533f732a2d7bc91fbde44f062e750a632734c3d40f","appveyor.yml":"0cb2779da07ddbfb85f905f972017bc8f5fba8bc6575134d90e36cf5672046ac","benches/convert.rs":"eb47a49fd607b3ac07f620c41a1aa37c8492dd907ea408692b58e814fed27848","src/bfloat.rs":"78540b49248728f93f25dac07d9df705efc77ddf4c6942bd026080189fbc94bf","src/bfloat/convert.rs":"e41be00501e9f416ab48daba2a98dd73f3e5ababb44a8d24ca3b52d25b76ce44","src/binary16.rs":"adb5f62da29bab7ed8283d3e3f415d1802eefa09347762f893122e054fa4a3bf","src/binary16/convert.rs":"85a9e4b670a3043746365c443a1546333a160ae2a9312f0e64863a21b547ee00","src/lib.rs":"256e03f246516ae9513b3684ffd6ca89729838e8beca831bc11218286c9a4d8e","src/slice.rs":"14b29e28dac3aea172f7964f7f659a1cc85c4e7e51d06961768e82f79a76c1fe","src/vec.rs":"dd902e515126a71cfc5892c3cb0361c2a85874f22d3646fbd433098db73f2a96","tests/version-numbers.rs":"6a9cf4ddc12121a8926897a5abca44efbd137f4e0a0def171d18395e853c647a"},"package":"d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177"} \ No newline at end of file diff --git a/third_party/cargo/vendor/half-1.5.0/BUILD b/third_party/cargo/vendor/half-1.6.0/BUILD similarity index 97% rename from third_party/cargo/vendor/half-1.5.0/BUILD rename to third_party/cargo/vendor/half-1.6.0/BUILD index f43f5fd..ed204dd 100644 --- a/third_party/cargo/vendor/half-1.5.0/BUILD +++ b/third_party/cargo/vendor/half-1.6.0/BUILD @@ -36,7 +36,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "1.5.0", + version = "1.6.0", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/half-1.5.0/CHANGELOG.md b/third_party/cargo/vendor/half-1.6.0/CHANGELOG.md similarity index 83% rename from third_party/cargo/vendor/half-1.5.0/CHANGELOG.md rename to third_party/cargo/vendor/half-1.6.0/CHANGELOG.md index 8b55c60..3488747 100644 --- a/third_party/cargo/vendor/half-1.5.0/CHANGELOG.md +++ b/third_party/cargo/vendor/half-1.6.0/CHANGELOG.md @@ -5,9 +5,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] + +## [1.6.0] - 2020-05-09 +### Added +- Added `LOG2_10` and `LOG10_2` constants to both `f16` and `bf16`, which were added to `f32` and + `f64` in the standard library in 1.43.0. By [@tspiteri]. +- Added `to_le/be/ne_bytes` and `from_le/be/ne_bytes` to both `f16` and `bf16`, which were added to + the standard library in 1.40.0. By [@bzm3r]. + ## [1.5.0] - 2020-03-03 ### Added -- Added the `alloc` feature to support the `alloc` crate in `no_std` environments. By [@zserik]. The `vec` module is now available with either `alloc` or `std` feature. +- Added the `alloc` feature to support the `alloc` crate in `no_std` environments. By [@zserik]. The + `vec` module is now available with either `alloc` or `std` feature. ## [1.4.1] - 2020-02-10 ### Fixed @@ -39,17 +48,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Changed - Minimum rustc version bumped to 1.32. -- Runtime target host feature detection is now used if both `std` and `use-intrinsics` features are enabled - and the compile target host does not support required features. -- When `use-intrinsics` feature is enabled, will now always compile and run without error correctly regardless - of compile target options. +- Runtime target host feature detection is now used if both `std` and `use-intrinsics` features are + enabled and the compile target host does not support required features. +- When `use-intrinsics` feature is enabled, will now always compile and run without error correctly + regardless of compile target options. ### Deprecated -- `consts` module and all its constants have been deprecated; use the associated constants on `f16` instead. +- `consts` module and all its constants have been deprecated; use the associated constants on `f16` + instead. - `slice::from_bits` has been deprecated; use `slice::HalfBitsSliceExt::reinterpret_cast` instead. -- `slice::from_bits_mut` has been deprecated; use `slice::HalfBitsSliceExt::reinterpret_cast_mut` instead. +- `slice::from_bits_mut` has been deprecated; use `slice::HalfBitsSliceExt::reinterpret_cast_mut` + instead. - `slice::to_bits` has been deprecated; use `slice::HalfFloatSliceExt::reinterpret_cast` instead. -- `slice::to_bits_mut` has been deprecated; use `slice::HalfFloatSliceExt::reinterpret_cast_mut` instead. +- `slice::to_bits_mut` has been deprecated; use `slice::HalfFloatSliceExt::reinterpret_cast_mut` + instead. - `vec::from_bits` has been deprecated; use `vec::HalfBitsVecExt::reinterpret_into` instead. - `vec::to_bits` has been deprecated; use `vec::HalfFloatVecExt::reinterpret_into` instead. @@ -62,12 +74,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [1.3.0] - 2018-10-02 ### Added - `slice::from_bits_mut` and `slice::to_bits_mut` for conversion between mutable `u16` and `f16` -slices. Fixes [#16], by [@johannesvollmer]. + slices. Fixes [#16], by [@johannesvollmer]. ## [1.2.0] - 2018-09-03 ### Added -- `slice` and optional `vec` (only included with `std` feature) modules for conversions between `u16` and `f16` -buffers. Fixes [#14], by [@johannesvollmer]. +- `slice` and optional `vec` (only included with `std` feature) modules for conversions between + `u16` and `f16` buffers. Fixes [#14], by [@johannesvollmer]. - `to_bits` added to replace `as_bits`. Fixes [#12], by [@tspiteri]. ### Fixed - `serde` optional dependency no longer uses its default `std` feature. @@ -77,7 +89,8 @@ buffers. Fixes [#14], by [@johannesvollmer]. ## [1.1.2] - 2018-07-12 ### Fixed -- Fixed compilation error in 1.1.1 on rustc < 1.27, now compiles again on rustc >= 1.10. Fixes [#11]. +- Fixed compilation error in 1.1.1 on rustc < 1.27, now compiles again on rustc >= 1.10. Fixes + [#11]. ## [1.1.1] - 2018-06-24 - **Yanked** ### ***Yanked*** @@ -92,12 +105,13 @@ buffers. Fixes [#14], by [@johannesvollmer]. ## [1.0.2] - 2018-01-12 ### Changed - Update behavior of `is_sign_positive` and `is_sign_negative` to match the IEEE754 conforming -behavior of the standard library since Rust 1.20.0. Fixes [#3], by [@tspiteri]. + behavior of the standard library since Rust 1.20.0. Fixes [#3], by [@tspiteri]. - Small optimization on `is_nan` and `is_infinite` from [@tspiteri]. ### Fixed -- Fix comparisons of +0 to -0 and comparisons involving negative numbers. Fixes [#2], by [@tspiteri]. +- Fix comparisons of +0 to -0 and comparisons involving negative numbers. Fixes [#2], by + [@tspiteri]. - Fix loss of sign when converting `f16` and `f32` to `f16`, and case where `f64` NaN could be -converted to `f16` infinity instead of NaN. Fixes [#5], by [@tspiteri]. + converted to `f16` infinity instead of NaN. Fixes [#5], by [@tspiteri]. ## [1.0.1] - 2017-08-30 ### Added @@ -138,8 +152,11 @@ converted to `f16` infinity instead of NaN. Fixes [#5], by [@tspiteri]. [@johannesvollmer]: https://github.com/johannesvollmer [@jfrimmel]: https://github.com/jfrimmel [@zserik]: https://github.com/zserik +[@bzm3r]: https://github.com/bzm3r -[Unreleased]: https://github.com/starkat99/half-rs/compare/v1.5.0...HEAD + +[Unreleased]: https://github.com/starkat99/half-rs/compare/v1.6.0...HEAD +[1.6.0]: https://github.com/starkat99/half-rs/compare/v1.5.0...v1.6.0 [1.5.0]: https://github.com/starkat99/half-rs/compare/v1.4.1...v1.5.0 [1.4.1]: https://github.com/starkat99/half-rs/compare/v1.4.0...v1.4.1 [1.4.0]: https://github.com/starkat99/half-rs/compare/v1.3.1...v1.4.0 diff --git a/third_party/cargo/vendor/half-1.5.0/Cargo.toml b/third_party/cargo/vendor/half-1.6.0/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/half-1.5.0/Cargo.toml rename to third_party/cargo/vendor/half-1.6.0/Cargo.toml index 8330bbe..c122803 100644 --- a/third_party/cargo/vendor/half-1.5.0/Cargo.toml +++ b/third_party/cargo/vendor/half-1.6.0/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "half" -version = "1.5.0" +version = "1.6.0" authors = ["Kathryn Long "] description = "Half-precision floating point f16 and bf16 types for Rust implementing the IEEE 754-2008 standard binary16 and bfloat16 types." readme = "README.md" diff --git a/third_party/cargo/vendor/half-1.5.0/LICENSE-APACHE b/third_party/cargo/vendor/half-1.6.0/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/LICENSE-APACHE rename to third_party/cargo/vendor/half-1.6.0/LICENSE-APACHE diff --git a/third_party/cargo/vendor/half-1.5.0/LICENSE-MIT b/third_party/cargo/vendor/half-1.6.0/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/LICENSE-MIT rename to third_party/cargo/vendor/half-1.6.0/LICENSE-MIT diff --git a/third_party/cargo/vendor/half-1.5.0/README.md b/third_party/cargo/vendor/half-1.6.0/README.md similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/README.md rename to third_party/cargo/vendor/half-1.6.0/README.md diff --git a/third_party/cargo/vendor/half-1.5.0/appveyor.yml b/third_party/cargo/vendor/half-1.6.0/appveyor.yml similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/appveyor.yml rename to third_party/cargo/vendor/half-1.6.0/appveyor.yml diff --git a/third_party/cargo/vendor/half-1.5.0/benches/convert.rs b/third_party/cargo/vendor/half-1.6.0/benches/convert.rs similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/benches/convert.rs rename to third_party/cargo/vendor/half-1.6.0/benches/convert.rs diff --git a/third_party/cargo/vendor/half-1.5.0/src/bfloat.rs b/third_party/cargo/vendor/half-1.6.0/src/bfloat.rs similarity index 90% rename from third_party/cargo/vendor/half-1.5.0/src/bfloat.rs rename to third_party/cargo/vendor/half-1.6.0/src/bfloat.rs index d0603c4..09ad035 100644 --- a/third_party/cargo/vendor/half-1.5.0/src/bfloat.rs +++ b/third_party/cargo/vendor/half-1.6.0/src/bfloat.rs @@ -64,6 +64,107 @@ impl bf16 { self.0 } + /// Return the memory representation of the underlying bit representation as a byte array in + /// little-endian byte order. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let bytes = bf16::from_f32(12.5).to_le_bytes(); + /// assert_eq!(bytes, [0x48, 0x41]); + /// ``` + #[inline] + pub fn to_le_bytes(self) -> [u8; 2] { + self.0.to_le_bytes() + } + + /// Return the memory representation of the underlying bit representation as a byte array in + /// big-endian (network) byte order. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let bytes = bf16::from_f32(12.5).to_be_bytes(); + /// assert_eq!(bytes, [0x41, 0x48]); + /// ``` + #[inline] + pub fn to_be_bytes(self) -> [u8; 2] { + self.0.to_be_bytes() + } + + /// Return the memory representation of the underlying bit representation as a byte array in + /// native byte order. + /// + /// As the target platform's native endianness is used, portable code should use `to_be_bytes` + /// or `to_le_bytes`, as appropriate, instead. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let bytes = bf16::from_f32(12.5).to_ne_bytes(); + /// assert_eq!(bytes, if cfg!(target_endian = "big") { + /// [0x41, 0x48] + /// } else { + /// [0x48, 0x41] + /// }); + /// ``` + #[inline] + pub fn to_ne_bytes(self) -> [u8; 2] { + self.0.to_ne_bytes() + } + + /// Create a floating point value from its representation as a byte array in little endian. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let value = bf16::from_le_bytes([0x48, 0x41]); + /// assert_eq!(value, bf16::from_f32(12.5)); + /// ``` + #[inline] + pub fn from_le_bytes(bytes: [u8; 2]) -> bf16 { + bf16::from_bits(u16::from_le_bytes(bytes)) + } + + /// Create a floating point value from its representation as a byte array in big endian. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let value = bf16::from_be_bytes([0x41, 0x48]); + /// assert_eq!(value, bf16::from_f32(12.5)); + /// ``` + #[inline] + pub fn from_be_bytes(bytes: [u8; 2]) -> bf16 { + bf16::from_bits(u16::from_be_bytes(bytes)) + } + + /// Create a floating point value from its representation as a byte array in native endian. + /// + /// As the target platform's native endianness is used, portable code likely wants to use + /// `from_be_bytes` or `from_le_bytes`, as appropriate instead. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let value = bf16::from_ne_bytes(if cfg!(target_endian = "big") { + /// [0x41, 0x48] + /// } else { + /// [0x48, 0x41] + /// }); + /// assert_eq!(value, bf16::from_f32(12.5)); + /// ``` + #[inline] + pub fn from_ne_bytes(bytes: [u8; 2]) -> bf16 { + bf16::from_bits(u16::from_ne_bytes(bytes)) + } + /// Converts a [`bf16`](struct.bf16.html) value into an `f32` value. /// /// This conversion is lossless as all values can be represented exactly in `f32`. @@ -344,8 +445,12 @@ impl bf16 { pub const LN_2: bf16 = bf16(0x3F31u16); /// [`bf16`](struct.bf16.html) 𝗅𝗈𝗀₁₀ℯ pub const LOG10_E: bf16 = bf16(0x3EDEu16); + /// [`bf16`](struct.bf16.html) 𝗅𝗈𝗀₁₀2 + pub const LOG10_2: bf16 = bf16(0x3E9Au16); /// [`bf16`](struct.bf16.html) 𝗅𝗈𝗀₂ℯ pub const LOG2_E: bf16 = bf16(0x3FB9u16); + /// [`bf16`](struct.bf16.html) 𝗅𝗈𝗀₂10 + pub const LOG2_10: bf16 = bf16(0x4055u16); /// [`bf16`](struct.bf16.html) √2 pub const SQRT_2: bf16 = bf16(0x3FB5u16); } @@ -553,7 +658,11 @@ mod test { let ln_10 = bf16::from_f32(core::f32::consts::LN_10); let ln_2 = bf16::from_f32(core::f32::consts::LN_2); let log10_e = bf16::from_f32(core::f32::consts::LOG10_E); + // core::f32::consts::LOG10_2 requires rustc 1.43.0 + let log10_2 = bf16::from_f32(2f32.log10()); let log2_e = bf16::from_f32(core::f32::consts::LOG2_E); + // core::f32::consts::LOG2_10 requires rustc 1.43.0 + let log2_10 = bf16::from_f32(10f32.log2()); let sqrt_2 = bf16::from_f32(core::f32::consts::SQRT_2); assert_eq!(bf16::E, e); @@ -570,7 +679,9 @@ mod test { assert_eq!(bf16::LN_10, ln_10); assert_eq!(bf16::LN_2, ln_2); assert_eq!(bf16::LOG10_E, log10_e); + assert_eq!(bf16::LOG10_2, log10_2); assert_eq!(bf16::LOG2_E, log2_e); + assert_eq!(bf16::LOG2_10, log2_10); assert_eq!(bf16::SQRT_2, sqrt_2); } @@ -605,7 +716,11 @@ mod test { let ln_10 = bf16::from_f64(core::f64::consts::LN_10); let ln_2 = bf16::from_f64(core::f64::consts::LN_2); let log10_e = bf16::from_f64(core::f64::consts::LOG10_E); + // core::f64::consts::LOG10_2 requires rustc 1.43.0 + let log10_2 = bf16::from_f64(2f64.log10()); let log2_e = bf16::from_f64(core::f64::consts::LOG2_E); + // core::f64::consts::LOG2_10 requires rustc 1.43.0 + let log2_10 = bf16::from_f64(10f64.log2()); let sqrt_2 = bf16::from_f64(core::f64::consts::SQRT_2); assert_eq!(bf16::E, e); @@ -622,7 +737,9 @@ mod test { assert_eq!(bf16::LN_10, ln_10); assert_eq!(bf16::LN_2, ln_2); assert_eq!(bf16::LOG10_E, log10_e); + assert_eq!(bf16::LOG10_2, log10_2); assert_eq!(bf16::LOG2_E, log2_e); + assert_eq!(bf16::LOG2_10, log2_10); assert_eq!(bf16::SQRT_2, sqrt_2); } diff --git a/third_party/cargo/vendor/half-1.5.0/src/bfloat/convert.rs b/third_party/cargo/vendor/half-1.6.0/src/bfloat/convert.rs similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/src/bfloat/convert.rs rename to third_party/cargo/vendor/half-1.6.0/src/bfloat/convert.rs diff --git a/third_party/cargo/vendor/half-1.5.0/src/binary16.rs b/third_party/cargo/vendor/half-1.6.0/src/binary16.rs similarity index 92% rename from third_party/cargo/vendor/half-1.5.0/src/binary16.rs rename to third_party/cargo/vendor/half-1.6.0/src/binary16.rs index e440e5d..d5164f0 100644 --- a/third_party/cargo/vendor/half-1.5.0/src/binary16.rs +++ b/third_party/cargo/vendor/half-1.6.0/src/binary16.rs @@ -291,6 +291,107 @@ impl f16 { self.0 } + /// Return the memory representation of the underlying bit representation as a byte array in + /// little-endian byte order. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let bytes = f16::from_f32(12.5).to_le_bytes(); + /// assert_eq!(bytes, [0x40, 0x4A]); + /// ``` + #[inline] + pub fn to_le_bytes(self) -> [u8; 2] { + self.0.to_le_bytes() + } + + /// Return the memory representation of the underlying bit representation as a byte array in + /// big-endian (network) byte order. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let bytes = f16::from_f32(12.5).to_be_bytes(); + /// assert_eq!(bytes, [0x4A, 0x40]); + /// ``` + #[inline] + pub fn to_be_bytes(self) -> [u8; 2] { + self.0.to_be_bytes() + } + + /// Return the memory representation of the underlying bit representation as a byte array in + /// native byte order. + /// + /// As the target platform's native endianness is used, portable code should use `to_be_bytes` + /// or `to_le_bytes`, as appropriate, instead. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let bytes = f16::from_f32(12.5).to_ne_bytes(); + /// assert_eq!(bytes, if cfg!(target_endian = "big") { + /// [0x4A, 0x40] + /// } else { + /// [0x40, 0x4A] + /// }); + /// ``` + #[inline] + pub fn to_ne_bytes(self) -> [u8; 2] { + self.0.to_ne_bytes() + } + + /// Create a floating point value from its representation as a byte array in little endian. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let value = f16::from_le_bytes([0x40, 0x4A]); + /// assert_eq!(value, f16::from_f32(12.5)); + /// ``` + #[inline] + pub fn from_le_bytes(bytes: [u8; 2]) -> f16 { + f16::from_bits(u16::from_le_bytes(bytes)) + } + + /// Create a floating point value from its representation as a byte array in big endian. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let value = f16::from_be_bytes([0x4A, 0x40]); + /// assert_eq!(value, f16::from_f32(12.5)); + /// ``` + #[inline] + pub fn from_be_bytes(bytes: [u8; 2]) -> f16 { + f16::from_bits(u16::from_be_bytes(bytes)) + } + + /// Create a floating point value from its representation as a byte array in native endian. + /// + /// As the target platform's native endianness is used, portable code likely wants to use + /// `from_be_bytes` or `from_le_bytes`, as appropriate instead. + /// + /// # Examples + /// + /// ```rust + /// # use half::prelude::*; + /// let value = f16::from_ne_bytes(if cfg!(target_endian = "big") { + /// [0x4A, 0x40] + /// } else { + /// [0x40, 0x4A] + /// }); + /// assert_eq!(value, f16::from_f32(12.5)); + /// ``` + #[inline] + pub fn from_ne_bytes(bytes: [u8; 2]) -> f16 { + f16::from_bits(u16::from_ne_bytes(bytes)) + } + /// Converts a [`f16`](struct.f16.html) into the underlying bit representation. #[deprecated(since = "1.2.0", note = "renamed to [`to_bits`](#method.to_bits)")] #[inline] @@ -581,8 +682,12 @@ impl f16 { pub const LN_2: f16 = f16(0x398Cu16); /// [`f16`](struct.f16.html) 𝗅𝗈𝗀₁₀ℯ pub const LOG10_E: f16 = f16(0x36F3u16); + /// [`f16`](struct.f16.html) 𝗅𝗈𝗀₁₀2 + pub const LOG10_2: f16 = f16(0x34D1u16); /// [`f16`](struct.f16.html) 𝗅𝗈𝗀₂ℯ pub const LOG2_E: f16 = f16(0x3DC5u16); + /// [`f16`](struct.f16.html) 𝗅𝗈𝗀₂10 + pub const LOG2_10: f16 = f16(0x42A5u16); /// [`f16`](struct.f16.html) √2 pub const SQRT_2: f16 = f16(0x3DA8u16); } @@ -842,7 +947,11 @@ mod test { let ln_10 = f16::from_f32(core::f32::consts::LN_10); let ln_2 = f16::from_f32(core::f32::consts::LN_2); let log10_e = f16::from_f32(core::f32::consts::LOG10_E); + // core::f32::consts::LOG10_2 requires rustc 1.43.0 + let log10_2 = f16::from_f32(2f32.log10()); let log2_e = f16::from_f32(core::f32::consts::LOG2_E); + // core::f32::consts::LOG2_10 requires rustc 1.43.0 + let log2_10 = f16::from_f32(10f32.log2()); let sqrt_2 = f16::from_f32(core::f32::consts::SQRT_2); assert_eq!(f16::E, e); @@ -859,7 +968,9 @@ mod test { assert_eq!(f16::LN_10, ln_10); assert_eq!(f16::LN_2, ln_2); assert_eq!(f16::LOG10_E, log10_e); + assert_eq!(f16::LOG10_2, log10_2); assert_eq!(f16::LOG2_E, log2_e); + assert_eq!(f16::LOG2_10, log2_10); assert_eq!(f16::SQRT_2, sqrt_2); } @@ -896,7 +1007,11 @@ mod test { let ln_10 = f16::from_f64(core::f64::consts::LN_10); let ln_2 = f16::from_f64(core::f64::consts::LN_2); let log10_e = f16::from_f64(core::f64::consts::LOG10_E); + // core::f64::consts::LOG10_2 requires rustc 1.43.0 + let log10_2 = f16::from_f64(2f64.log10()); let log2_e = f16::from_f64(core::f64::consts::LOG2_E); + // core::f64::consts::LOG2_10 requires rustc 1.43.0 + let log2_10 = f16::from_f64(10f64.log2()); let sqrt_2 = f16::from_f64(core::f64::consts::SQRT_2); assert_eq!(f16::E, e); @@ -913,7 +1028,9 @@ mod test { assert_eq!(f16::LN_10, ln_10); assert_eq!(f16::LN_2, ln_2); assert_eq!(f16::LOG10_E, log10_e); + assert_eq!(f16::LOG10_2, log10_2); assert_eq!(f16::LOG2_E, log2_e); + assert_eq!(f16::LOG2_10, log2_10); assert_eq!(f16::SQRT_2, sqrt_2); } diff --git a/third_party/cargo/vendor/half-1.5.0/src/binary16/convert.rs b/third_party/cargo/vendor/half-1.6.0/src/binary16/convert.rs similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/src/binary16/convert.rs rename to third_party/cargo/vendor/half-1.6.0/src/binary16/convert.rs diff --git a/third_party/cargo/vendor/half-1.5.0/src/lib.rs b/third_party/cargo/vendor/half-1.6.0/src/lib.rs similarity index 98% rename from third_party/cargo/vendor/half-1.5.0/src/lib.rs rename to third_party/cargo/vendor/half-1.6.0/src/lib.rs index b140381..de35758 100644 --- a/third_party/cargo/vendor/half-1.5.0/src/lib.rs +++ b/third_party/cargo/vendor/half-1.6.0/src/lib.rs @@ -66,7 +66,7 @@ ), feature(stdsimd, f16c_target_feature) )] -#![doc(html_root_url = "https://docs.rs/half/1.5.0")] +#![doc(html_root_url = "https://docs.rs/half/1.6.0")] #[cfg(all(feature = "alloc", not(feature = "std")))] extern crate alloc; diff --git a/third_party/cargo/vendor/half-1.5.0/src/slice.rs b/third_party/cargo/vendor/half-1.6.0/src/slice.rs similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/src/slice.rs rename to third_party/cargo/vendor/half-1.6.0/src/slice.rs diff --git a/third_party/cargo/vendor/half-1.5.0/src/vec.rs b/third_party/cargo/vendor/half-1.6.0/src/vec.rs similarity index 100% rename from third_party/cargo/vendor/half-1.5.0/src/vec.rs rename to third_party/cargo/vendor/half-1.6.0/src/vec.rs diff --git a/third_party/cargo/vendor/half-1.5.0/tests/version-numbers.rs b/third_party/cargo/vendor/half-1.6.0/tests/version-numbers.rs similarity index 61% rename from third_party/cargo/vendor/half-1.5.0/tests/version-numbers.rs rename to third_party/cargo/vendor/half-1.6.0/tests/version-numbers.rs index 288592d..ff9860c 100644 --- a/third_party/cargo/vendor/half-1.5.0/tests/version-numbers.rs +++ b/third_party/cargo/vendor/half-1.6.0/tests/version-numbers.rs @@ -7,3 +7,8 @@ fn test_readme_deps() { fn test_html_root_url() { version_sync::assert_html_root_url_updated!("src/lib.rs"); } + +#[test] +fn test_changelog_version() { + version_sync::assert_contains_regex!("CHANGELOG.md", "^## \\[{version}\\]"); +} diff --git a/third_party/cargo/vendor/hermit-abi-0.1.13/.cargo-checksum.json b/third_party/cargo/vendor/hermit-abi-0.1.13/.cargo-checksum.json new file mode 100644 index 0000000..d074526 --- /dev/null +++ b/third_party/cargo/vendor/hermit-abi-0.1.13/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"18986dbde2bc6661b0e4232f4c122a54a76481dce0dbbb04d93b5f3d5b292aed","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"8c4278de40812c689d00e854a052ff47e1abf0c03441537b3a9d7ee9a8c94617","rust-toolchain":"58bea07cb6d97f9cfcd5c8f98b1feca0fb81cce5b0bf29a8e70ed2641956e9a6","src/lib.rs":"88b33230d4dea4b5f87b9a6f58903e70f68847b932ae560543410de2aeec99c7","src/tcpstream.rs":"73807a89635126a347da53ee7ffd07795e107e9dd98cd7d5914bc9f1ef4f5a8d"},"package":"91780f809e750b0a89f5544be56617ff6b1227ee485bcb06ebe10cdf89bd3b71"} \ No newline at end of file diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/BUILD b/third_party/cargo/vendor/hermit-abi-0.1.13/BUILD similarity index 90% rename from third_party/cargo/vendor/hermit-abi-0.1.8/BUILD rename to third_party/cargo/vendor/hermit-abi-0.1.13/BUILD index f5e6a36..841f2fb 100644 --- a/third_party/cargo/vendor/hermit-abi-0.1.8/BUILD +++ b/third_party/cargo/vendor/hermit-abi-0.1.13/BUILD @@ -31,12 +31,12 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.8", + version = "0.1.13", crate_features = [ "default", ], diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/Cargo.toml b/third_party/cargo/vendor/hermit-abi-0.1.13/Cargo.toml similarity index 95% rename from third_party/cargo/vendor/hermit-abi-0.1.8/Cargo.toml rename to third_party/cargo/vendor/hermit-abi-0.1.13/Cargo.toml index 8d5b2fd..c8c47da 100644 --- a/third_party/cargo/vendor/hermit-abi-0.1.8/Cargo.toml +++ b/third_party/cargo/vendor/hermit-abi-0.1.13/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "hermit-abi" -version = "0.1.8" +version = "0.1.13" authors = ["Stefan Lankes"] description = "hermit-abi is small interface to call functions from the unikernel RustyHermit.\nIt is used to build the target `x86_64-unknown-hermit`.\n" readme = "README.md" @@ -21,6 +21,7 @@ categories = ["os"] license = "MIT/Apache-2.0" repository = "https://github.com/hermitcore/rusty-hermit" [package.metadata.docs.rs] +default-target = "x86_64-unknown-hermit" features = ["docs"] [dependencies.compiler_builtins] version = "0.1.0" diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/LICENSE-APACHE b/third_party/cargo/vendor/hermit-abi-0.1.13/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/hermit-abi-0.1.8/LICENSE-APACHE rename to third_party/cargo/vendor/hermit-abi-0.1.13/LICENSE-APACHE diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/LICENSE-MIT b/third_party/cargo/vendor/hermit-abi-0.1.13/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/hermit-abi-0.1.8/LICENSE-MIT rename to third_party/cargo/vendor/hermit-abi-0.1.13/LICENSE-MIT diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/README.md b/third_party/cargo/vendor/hermit-abi-0.1.13/README.md similarity index 67% rename from third_party/cargo/vendor/hermit-abi-0.1.8/README.md rename to third_party/cargo/vendor/hermit-abi-0.1.13/README.md index a2874fe..86b9283 100644 --- a/third_party/cargo/vendor/hermit-abi-0.1.8/README.md +++ b/third_party/cargo/vendor/hermit-abi-0.1.13/README.md @@ -1,6 +1,7 @@ # hermit-abi [![Crates.io](https://img.shields.io/crates/v/hermit-abi.svg)](https://crates.io/crates/hermit-abi) +[![Documentation](https://docs.rs/hermit-abi/badge.svg)](https://docs.rs/hermit-abi) [![License](https://img.shields.io/crates/l/hermit-abi.svg)](https://img.shields.io/crates/l/hermit-abi.svg) This is small interface to call functions from the unikernel [RustyHermit](https://github.com/hermitcore/libhermit-rs). @@ -15,3 +16,7 @@ Licensed under either of * 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. \ No newline at end of file diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/rust-toolchain b/third_party/cargo/vendor/hermit-abi-0.1.13/rust-toolchain similarity index 100% rename from third_party/cargo/vendor/hermit-abi-0.1.8/rust-toolchain rename to third_party/cargo/vendor/hermit-abi-0.1.13/rust-toolchain diff --git a/third_party/cargo/vendor/hermit-abi-0.1.13/src/lib.rs b/third_party/cargo/vendor/hermit-abi-0.1.13/src/lib.rs new file mode 100644 index 0000000..d37988c --- /dev/null +++ b/third_party/cargo/vendor/hermit-abi-0.1.13/src/lib.rs @@ -0,0 +1,393 @@ +//! `hermit-abi` is small interface to call functions from the unikernel +//! [RustyHermit](https://github.com/hermitcore/libhermit-rs). + +#![cfg_attr(feature = "rustc-dep-of-std", no_std)] +#![feature(const_raw_ptr_to_usize_cast)] +extern crate libc; + +pub mod tcpstream; + +use libc::c_void; + +// sysmbols, which are part of the library operating system +extern "C" { + fn sys_get_processor_count() -> usize; + fn sys_malloc(size: usize, align: usize) -> *mut u8; + fn sys_realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8; + fn sys_free(ptr: *mut u8, size: usize, align: usize); + fn sys_init_queue(ptr: usize) -> i32; + fn sys_notify(id: usize, count: i32) -> i32; + fn sys_add_queue(id: usize, timeout_ns: i64) -> i32; + fn sys_wait(id: usize) -> i32; + fn sys_destroy_queue(id: usize) -> i32; + fn sys_read(fd: i32, buf: *mut u8, len: usize) -> isize; + fn sys_write(fd: i32, buf: *const u8, len: usize) -> isize; + fn sys_close(fd: i32) -> i32; + fn sys_sem_init(sem: *mut *const c_void, value: u32) -> i32; + fn sys_sem_destroy(sem: *const c_void) -> i32; + fn sys_sem_post(sem: *const c_void) -> i32; + fn sys_sem_trywait(sem: *const c_void) -> i32; + fn sys_sem_timedwait(sem: *const c_void, ms: u32) -> i32; + fn sys_recmutex_init(recmutex: *mut *const c_void) -> i32; + fn sys_recmutex_destroy(recmutex: *const c_void) -> i32; + fn sys_recmutex_lock(recmutex: *const c_void) -> i32; + fn sys_recmutex_unlock(recmutex: *const c_void) -> i32; + fn sys_getpid() -> u32; + fn sys_exit(arg: i32) -> !; + fn sys_abort() -> !; + fn sys_usleep(usecs: u64); + fn sys_spawn( + id: *mut Tid, + func: extern "C" fn(usize), + arg: usize, + prio: u8, + core_id: isize, + ) -> i32; + fn sys_spawn2( + func: extern "C" fn(usize), + arg: usize, + prio: u8, + stack_size: usize, + core_id: isize, + ) -> Tid; + fn sys_join(id: Tid) -> i32; + fn sys_yield(); + fn sys_clock_gettime(clock_id: u64, tp: *mut timespec) -> i32; + fn sys_open(name: *const i8, flags: i32, mode: i32) -> i32; + fn sys_unlink(name: *const i8) -> i32; + fn sys_network_init() -> i32; +} + +/// A thread handle type +pub type Tid = u32; + +/// Priority of a thread +#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Copy)] +pub struct Priority(u8); + +impl Priority { + pub const fn into(self) -> u8 { + self.0 + } + + pub const fn from(x: u8) -> Self { + Priority(x) + } +} + +pub const HIGH_PRIO: Priority = Priority::from(3); +pub const NORMAL_PRIO: Priority = Priority::from(2); +pub const LOW_PRIO: Priority = Priority::from(1); + +/// A handle, identifying a socket +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Hash)] +pub struct Handle(usize); + +pub const NSEC_PER_SEC: u64 = 1_000_000_000; +pub const CLOCK_REALTIME: u64 = 1; +pub const CLOCK_MONOTONIC: u64 = 4; +pub const STDIN_FILENO: libc::c_int = 0; +pub const STDOUT_FILENO: libc::c_int = 1; +pub const STDERR_FILENO: libc::c_int = 2; +pub const O_RDONLY: i32 = 0o0; +pub const O_WRONLY: i32 = 0o1; +pub const O_RDWR: i32 = 0o2; +pub const O_CREAT: i32 = 0o100; +pub const O_EXCL: i32 = 0o200; +pub const O_TRUNC: i32 = 0o1000; +pub const O_APPEND: i32 = 0o2000; + +/// returns true if file descriptor `fd` is a tty +pub fn isatty(_fd: libc::c_int) -> bool { + false +} + +/// intialize the network stack +pub fn network_init() -> i32 { + unsafe { sys_network_init() } +} + +/// `timespec` is used by `clock_gettime` to retrieve the +/// current time +#[derive(Copy, Clone, Debug)] +#[repr(C)] +pub struct timespec { + /// seconds + pub tv_sec: i64, + /// nanoseconds + pub tv_nsec: i64, +} + +/// determines the number of activated processors +#[inline(always)] +pub unsafe fn get_processor_count() -> usize { + sys_get_processor_count() +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn malloc(size: usize, align: usize) -> *mut u8 { + sys_malloc(size, align) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8 { + sys_realloc(ptr, size, align, new_size) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn free(ptr: *mut u8, size: usize, align: usize) { + sys_free(ptr, size, align) +} + +#[inline(always)] +pub unsafe fn notify(id: usize, count: i32) -> i32 { + sys_notify(id, count) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn add_queue(id: usize, timeout_ns: i64) -> i32 { + sys_add_queue(id, timeout_ns) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn wait(id: usize) -> i32 { + sys_wait(id) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn init_queue(id: usize) -> i32 { + sys_init_queue(id) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn destroy_queue(id: usize) -> i32 { + sys_destroy_queue(id) +} + +/// read from a file descriptor +/// +/// read() attempts to read `len` bytes of data from the object +/// referenced by the descriptor `fd` into the buffer pointed +/// to by `buf`. +#[inline(always)] +pub unsafe fn read(fd: i32, buf: *mut u8, len: usize) -> isize { + sys_read(fd, buf, len) +} + +/// write to a file descriptor +/// +/// write() attempts to write `len` of data to the object +/// referenced by the descriptor `fd` from the +/// buffer pointed to by `buf`. +#[inline(always)] +pub unsafe fn write(fd: i32, buf: *const u8, len: usize) -> isize { + sys_write(fd, buf, len) +} + +/// close a file descriptor +/// +/// The close() call deletes a file descriptor `fd` from the object +/// reference table. +#[inline(always)] +pub unsafe fn close(fd: i32) -> i32 { + sys_close(fd) +} + +/// sem_init() initializes the unnamed semaphore at the address +/// pointed to by `sem`. The `value` argument specifies the +/// initial value for the semaphore. +#[inline(always)] +pub unsafe fn sem_init(sem: *mut *const c_void, value: u32) -> i32 { + sys_sem_init(sem, value) +} + +/// sem_destroy() frees the unnamed semaphore at the address +/// pointed to by `sem`. +#[inline(always)] +pub unsafe fn sem_destroy(sem: *const c_void) -> i32 { + sys_sem_destroy(sem) +} + +/// sem_post() increments the semaphore pointed to by `sem`. +/// If the semaphore's value consequently becomes greater +/// than zero, then another thread blocked in a sem_wait call +/// will be woken up and proceed to lock the semaphore. +#[inline(always)] +pub unsafe fn sem_post(sem: *const c_void) -> i32 { + sys_sem_post(sem) +} + +/// try to decrement a semaphore +/// +/// sem_trywait() is the same as sem_timedwait(), except that +/// if the decrement cannot be immediately performed, then call +/// returns a negative value instead of blocking. +#[inline(always)] +pub unsafe fn sem_trywait(sem: *const c_void) -> i32 { + sys_sem_trywait(sem) +} + +/// decrement a semaphore +/// +/// sem_timedwait() decrements the semaphore pointed to by `sem`. +/// If the semaphore's value is greater than zero, then the +/// the function returns immediately. If the semaphore currently +/// has the value zero, then the call blocks until either +/// it becomes possible to perform the decrement of the time limit +/// to wait for the semaphore is expired. A time limit `ms` of +/// means infinity waiting time. +#[inline(always)] +pub unsafe fn sem_timedwait(sem: *const c_void, ms: u32) -> i32 { + sys_sem_timedwait(sem, ms) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn recmutex_init(recmutex: *mut *const c_void) -> i32 { + sys_recmutex_init(recmutex) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn recmutex_destroy(recmutex: *const c_void) -> i32 { + sys_recmutex_destroy(recmutex) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn recmutex_lock(recmutex: *const c_void) -> i32 { + sys_recmutex_lock(recmutex) +} + +#[doc(hidden)] +#[inline(always)] +pub unsafe fn recmutex_unlock(recmutex: *const c_void) -> i32 { + sys_recmutex_unlock(recmutex) +} + +/// Determines the id of the current thread +#[inline(always)] +pub unsafe fn getpid() -> u32 { + sys_getpid() +} + +/// cause normal termination and return `arg` +/// to the host system +#[inline(always)] +pub unsafe fn exit(arg: i32) -> ! { + sys_exit(arg) +} + +/// cause abnormal termination +#[inline(always)] +pub unsafe fn abort() -> ! { + sys_abort() +} + +/// suspend execution for microsecond intervals +/// +/// The usleep() function suspends execution of the calling +/// thread for (at least) `usecs` microseconds. +#[inline(always)] +pub unsafe fn usleep(usecs: u64) { + sys_usleep(usecs) +} + +/// spawn a new thread +/// +/// spawn() starts a new thread. The new thread starts execution +/// by invoking `func(usize)`; `arg` is passed as the argument +/// to `func`. `prio` defines the priority of the new thread, +/// which can be between `LOW_PRIO` and `HIGH_PRIO`. +/// `core_id` defines the core, where the thread is located. +/// A negative value give the operating system the possibility +/// to select the core by its own. +#[inline(always)] +pub unsafe fn spawn( + id: *mut Tid, + func: extern "C" fn(usize), + arg: usize, + prio: u8, + core_id: isize, +) -> i32 { + sys_spawn(id, func, arg, prio, core_id) +} + +/// spawn a new thread with user-specified stack size +/// +/// spawn2() starts a new thread. The new thread starts execution +/// by invoking `func(usize)`; `arg` is passed as the argument +/// to `func`. `prio` defines the priority of the new thread, +/// which can be between `LOW_PRIO` and `HIGH_PRIO`. +/// `core_id` defines the core, where the thread is located. +/// A negative value give the operating system the possibility +/// to select the core by its own. +/// In contrast to spawn(), spawn2() is able to define the +/// stack size. +#[inline(always)] +pub unsafe fn spawn2( + func: extern "C" fn(usize), + arg: usize, + prio: u8, + stack_size: usize, + core_id: isize, +) -> Tid { + sys_spawn2(func, arg, prio, stack_size, core_id) +} + +/// join with a terminated thread +/// +/// The join() function waits for the thread specified by `id` +/// to terminate. +#[inline(always)] +pub unsafe fn join(id: Tid) -> i32 { + sys_join(id) +} + +/// yield the processor +/// +/// causes the calling thread to relinquish the CPU. The thread +/// is moved to the end of the queue for its static priority. +#[inline(always)] +pub unsafe fn yield_now() { + sys_yield() +} + +/// get current time +/// +/// The clock_gettime() functions allow the calling thread +/// to retrieve the value used by a clock which is specified +/// by `clock_id`. +/// +/// `CLOCK_REALTIME`: the system's real time clock, +/// expressed as the amount of time since the Epoch. +/// +/// `CLOCK_MONOTONIC`: clock that increments monotonically, +/// tracking the time since an arbitrary point +#[inline(always)] +pub unsafe fn clock_gettime(clock_id: u64, tp: *mut timespec) -> i32 { + sys_clock_gettime(clock_id, tp) +} + +/// open and possibly create a file +/// +/// The open() system call opens the file specified by `name`. +/// If the specified file does not exist, it may optionally +/// be created by open(). +#[inline(always)] +pub unsafe fn open(name: *const i8, flags: i32, mode: i32) -> i32 { + sys_open(name, flags, mode) +} + +/// delete the file it refers to `name` +#[inline(always)] +pub unsafe fn unlink(name: *const i8) -> i32 { + sys_unlink(name) +} diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/src/tcpstream.rs b/third_party/cargo/vendor/hermit-abi-0.1.13/src/tcpstream.rs similarity index 97% rename from third_party/cargo/vendor/hermit-abi-0.1.8/src/tcpstream.rs rename to third_party/cargo/vendor/hermit-abi-0.1.13/src/tcpstream.rs index 5c56c69..d8f31b7 100644 --- a/third_party/cargo/vendor/hermit-abi-0.1.8/src/tcpstream.rs +++ b/third_party/cargo/vendor/hermit-abi-0.1.13/src/tcpstream.rs @@ -1,3 +1,5 @@ +//! `tcpstream` provide an interface to the network stack + use crate::Handle; extern "Rust" { @@ -23,6 +25,7 @@ pub fn connect(ip: &[u8], port: u16, timeout: Option) -> Result unsafe { sys_tcp_stream_connect(ip, port, timeout) } } +/// Close a TCP connection #[inline(always)] pub fn close(handle: Handle) -> Result<(), ()> { unsafe { sys_tcp_stream_close(handle) } diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/.cargo-checksum.json b/third_party/cargo/vendor/hermit-abi-0.1.8/.cargo-checksum.json deleted file mode 100644 index 60c7c64..0000000 --- a/third_party/cargo/vendor/hermit-abi-0.1.8/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"2e4b04883e580c992d4f2a370e482ca7a49792b70d784cdbf65b667bd40e8053","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"813151bae1178f5f322aa33c46c46199e1e9c23a108bb2f3e4e5a45df3b7ef26","rust-toolchain":"58bea07cb6d97f9cfcd5c8f98b1feca0fb81cce5b0bf29a8e70ed2641956e9a6","src/lib.rs":"2069b14dd2ac2d536aea06e6bfd3cd9c6e3baedad4a7bb7c460ae1b4a6087ada","src/tcpstream.rs":"5c951174ea3ea5f70bc5a86997459e1d601e08a08dd72fbf909453b7798c1407"},"package":"1010591b26bbfe835e9faeabeb11866061cc7dcebffd56ad7d0942d0e61aefd8"} \ No newline at end of file diff --git a/third_party/cargo/vendor/hermit-abi-0.1.8/src/lib.rs b/third_party/cargo/vendor/hermit-abi-0.1.8/src/lib.rs deleted file mode 100644 index caf1400..0000000 --- a/third_party/cargo/vendor/hermit-abi-0.1.8/src/lib.rs +++ /dev/null @@ -1,238 +0,0 @@ -#![feature(const_raw_ptr_to_usize_cast)] -#![cfg_attr(feature = "rustc-dep-of-std", no_std)] -extern crate libc; - -pub mod tcpstream; - -use libc::c_void; - -extern "C" { - fn _start(); - fn sys_get_processor_count() -> usize; - fn sys_malloc(size: usize, align: usize) -> *mut u8; - fn sys_realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8; - fn sys_free(ptr: *mut u8, size: usize, align: usize); - fn sys_notify(id: usize, count: i32) -> i32; - fn sys_add_queue(id: usize, timeout_ns: i64) -> i32; - fn sys_wait(id: usize) -> i32; - fn sys_destroy_queue(id: usize) -> i32; - fn sys_read(fd: i32, buf: *mut u8, len: usize) -> isize; - fn sys_write(fd: i32, buf: *const u8, len: usize) -> isize; - fn sys_close(fd: i32) -> i32; - fn sys_sem_init(sem: *mut *const c_void, value: u32) -> i32; - fn sys_sem_destroy(sem: *const c_void) -> i32; - fn sys_sem_post(sem: *const c_void) -> i32; - fn sys_sem_trywait(sem: *const c_void) -> i32; - fn sys_sem_timedwait(sem: *const c_void, ms: u32) -> i32; - fn sys_recmutex_init(recmutex: *mut *const c_void) -> i32; - fn sys_recmutex_destroy(recmutex: *const c_void) -> i32; - fn sys_recmutex_lock(recmutex: *const c_void) -> i32; - fn sys_recmutex_unlock(recmutex: *const c_void) -> i32; - fn sys_getpid() -> u32; - fn sys_exit(arg: i32) -> !; - fn sys_abort() -> !; - fn sys_usleep(usecs: u64); - fn sys_spawn( - id: *mut Tid, - func: extern "C" fn(usize), - arg: usize, - prio: u8, - core_id: isize, - ) -> i32; - fn sys_join(id: Tid) -> i32; - fn sys_yield(); - fn sys_clock_gettime(clock_id: u64, tp: *mut timespec) -> i32; - fn sys_open(name: *const i8, flags: i32, mode: i32) -> i32; - fn sys_unlink(name: *const i8) -> i32; - fn sys_network_init() -> i32; -} - -pub type Tid = u32; - -/// A handle, identifying a socket -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Hash)] -pub struct Handle(usize); - -pub const NSEC_PER_SEC: u64 = 1_000_000_000; -pub const CLOCK_REALTIME: u64 = 1; -pub const CLOCK_MONOTONIC: u64 = 4; -pub const STDIN_FILENO: libc::c_int = 0; -pub const STDOUT_FILENO: libc::c_int = 1; -pub const STDERR_FILENO: libc::c_int = 2; - -/// returns true if this is a tty -pub fn isatty(_fd: libc::c_int) -> bool { - false -} - -/// intialize the network stack -pub fn network_init() -> i32 { - unsafe { sys_network_init() } -} - -#[derive(Copy, Clone, Debug)] -#[repr(C)] -pub struct timespec { - pub tv_sec: i64, - pub tv_nsec: i64, -} - -pub unsafe fn call_start() { - _start(); -} - -#[inline(always)] -pub unsafe fn get_processor_count() -> usize { - sys_get_processor_count() -} - -#[inline(always)] -pub unsafe fn malloc(size: usize, align: usize) -> *mut u8 { - sys_malloc(size, align) -} - -#[inline(always)] -pub unsafe fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8 { - sys_realloc(ptr, size, align, new_size) -} - -#[inline(always)] -pub unsafe fn free(ptr: *mut u8, size: usize, align: usize) { - sys_free(ptr, size, align) -} - -#[inline(always)] -pub unsafe fn notify(id: usize, count: i32) -> i32 { - sys_notify(id, count) -} - -#[inline(always)] -pub unsafe fn add_queue(id: usize, timeout_ns: i64) -> i32 { - sys_add_queue(id, timeout_ns) -} - -#[inline(always)] -pub unsafe fn wait(id: usize) -> i32 { - sys_wait(id) -} - -#[inline(always)] -pub unsafe fn destroy_queue(id: usize) -> i32 { - sys_destroy_queue(id) -} - -#[inline(always)] -pub unsafe fn read(fd: i32, buf: *mut u8, len: usize) -> isize { - sys_read(fd, buf, len) -} - -#[inline(always)] -pub unsafe fn write(fd: i32, buf: *const u8, len: usize) -> isize { - sys_write(fd, buf, len) -} - -#[inline(always)] -pub unsafe fn close(fd: i32) -> i32 { - sys_close(fd) -} - -#[inline(always)] -pub unsafe fn sem_init(sem: *mut *const c_void, value: u32) -> i32 { - sys_sem_init(sem, value) -} - -#[inline(always)] -pub unsafe fn sem_destroy(sem: *const c_void) -> i32 { - sys_sem_destroy(sem) -} - -#[inline(always)] -pub unsafe fn sem_post(sem: *const c_void) -> i32 { - sys_sem_post(sem) -} - -#[inline(always)] -pub unsafe fn sem_trywait(sem: *const c_void) -> i32 { - sys_sem_trywait(sem) -} - -#[inline(always)] -pub unsafe fn sem_timedwait(sem: *const c_void, ms: u32) -> i32 { - sys_sem_timedwait(sem, ms) -} - -#[inline(always)] -pub unsafe fn recmutex_init(recmutex: *mut *const c_void) -> i32 { - sys_recmutex_init(recmutex) -} - -#[inline(always)] -pub unsafe fn recmutex_destroy(recmutex: *const c_void) -> i32 { - sys_recmutex_destroy(recmutex) -} - -#[inline(always)] -pub unsafe fn recmutex_lock(recmutex: *const c_void) -> i32 { - sys_recmutex_lock(recmutex) -} - -#[inline(always)] -pub unsafe fn recmutex_unlock(recmutex: *const c_void) -> i32 { - sys_recmutex_unlock(recmutex) -} - -#[inline(always)] -pub unsafe fn getpid() -> u32 { - sys_getpid() -} - -#[inline(always)] -pub unsafe fn exit(arg: i32) -> ! { - sys_exit(arg) -} - -#[inline(always)] -pub unsafe fn abort() -> ! { - sys_abort() -} - -#[inline(always)] -pub unsafe fn usleep(usecs: u64) { - sys_usleep(usecs) -} - -#[inline(always)] -pub unsafe fn spawn( - id: *mut Tid, - func: extern "C" fn(usize), - arg: usize, - prio: u8, - core_id: isize, -) -> i32 { - sys_spawn(id, func, arg, prio, core_id) -} - -#[inline(always)] -pub unsafe fn join(id: Tid) -> i32 { - sys_join(id) -} - -#[inline(always)] -pub unsafe fn yield_now() { - sys_yield() -} - -#[inline(always)] -pub unsafe fn clock_gettime(clock_id: u64, tp: *mut timespec) -> i32 { - sys_clock_gettime(clock_id, tp) -} - -#[inline(always)] -pub unsafe fn open(name: *const i8, flags: i32, mode: i32) -> i32 { - sys_open(name, flags, mode) -} - -#[inline(always)] -pub unsafe fn unlink(name: *const i8) -> i32 { - sys_unlink(name) -} diff --git a/third_party/cargo/vendor/image-0.23.1/.cargo-checksum.json b/third_party/cargo/vendor/image-0.23.1/.cargo-checksum.json deleted file mode 100644 index 1ef73eb..0000000 --- a/third_party/cargo/vendor/image-0.23.1/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGES.md":"dee82ba69c71d16976e4df018f3a56e58baa40ffc5028a4b478e16fc6b25e541","Cargo.toml":"81d65217ea44d987d1e5389351f8669bfc66422ea3bcfc1174d4f337ced86c7a","Cargo.toml.public-private-dependencies":"8b82061ac3f8f7a56db99602624feba88b57e186a28211a595ad0bf9793bda75","LICENSE":"c7766d2e29f88a4be81b6ac6216c62d2d0918c7d3f2fc98be6fecac8f6595e60","README.md":"158142dfeb18af87b49416dc65568d6a38be0d2359910a4a1a1485afe4212d3b","benches/README.md":"87b2ea4d1cea80c1e24fc18f1222a7ee1a38f5a92e98110bb84a4827fb997b62","benches/encode_bmp.rs":"1ac82444a9a3a47ed1dd6c16b24ec82bab28cfb675ee3758e35e5bff3a042d5f","benches/encode_jpeg.rs":"8f2bdae3c81880bb93254147634b29b457adda640c04d3efeb218b506d328446","benches/load.rs":"e844d7bc82bd1fc0b8f7026d86891edfe7d53dd916f7263bc6f6cdd03520424a","docs/2019-04-23-memory-unsafety.md":"b59a9af84bdb5efa1bc1f33c8aa22ff42590701817fb03f55ca2dd50af91bb8d","release.sh":"70f8d6272ab65f5ca80ac95e6ceeeb5041f9c183c87a1fdac2b7f2d16e0827d4","src/animation.rs":"a1dbca0b1ba572b9ea7cfb0126b650bded565be608a25c45df6d871be7b2f525","src/bmp/decoder.rs":"7669326001535346158cbf278434bee8f5d03679fae99aea52e906bb5b1ce9d3","src/bmp/encoder.rs":"2981141c6b8ba5ef0803d817afc5d17d30462a4cb91b84313d0a8ac6497bf2b1","src/bmp/mod.rs":"a56f9e8893f05dae04bccc2c16fd9ae452c3000fec8afa0bec4e2f03f9dff4de","src/buffer.rs":"d234667cb4414c3c7b3ab624d2cbb3c1730262ca3cf76a6619bbf8af79364be4","src/color.rs":"fa1efe184745e1468bf4fee22933791ae5aedb52fe8a6c592c97fdb96fe6190e","src/dds.rs":"e7fb15c39504f98d61e1c2d1e1faf1bde23c8ba15acb8c6eb641d20a08ba7e8a","src/dxt.rs":"c15a176714ee663eb30519fcb1243dd69448fb3e040f7a81aa5c4299751571ff","src/dynimage.rs":"567fc356aa3de88868d42ce4b9d033fa1da2d8da1c6f6c398af913a3953c7207","src/error.rs":"b8a1f6f6867f8dced4d8d740e76eb831fba25cbbd9bac0e42b224584915fa07e","src/flat.rs":"b201db426e875fe73c1750acbe5c11edbbf06921a86729940ce908f92956a771","src/gif.rs":"0b25d20fb6cdc1fc2bf1dd9680aa5d8f5452363d3161e159d8512fca93dcd2eb","src/hdr/decoder.rs":"2f0d23aa1a724ed6b7a5f18840f48e812f5beb08bd98f54b4515a3144b8a6d7d","src/hdr/encoder.rs":"e4321c404ef83606238581843a2a5889a12715f8fa070667563e329b419d529e","src/hdr/mod.rs":"96eb63b7e43f117cb46b8ffe705b477426dde75881f2dea63cab29ffd820e01d","src/ico/decoder.rs":"07e216926b2a400bab69960a7dab2e7914007f5ac67a9b2b229d5dc0a551f610","src/ico/encoder.rs":"f8258df0912d62b572236f824260eb6dccd3415cc47ee79ff3c210474ab50c6f","src/ico/mod.rs":"fc9b65fd6e6eaab9f4dc6120f3bdca5d40046669e4d3ae6f8feb21bfeac3536d","src/image.rs":"8de97d15dd850da89904e58feb40a3ca2cb9616806e4e5ce517409bd07d91c86","src/imageops/affine.rs":"cc512b3a1dd726e894ab97cf961dd570f9f894391be938e84a887d3df3cdc5c6","src/imageops/colorops.rs":"e91c86197881ef3788952350429e56a4c268136c4db7d901ab7893d95ae49d1c","src/imageops/mod.rs":"87e995c18fdc135da110edfff2f55e55b45a3e0601ad02cbf55cdd38f7a2f9b2","src/imageops/sample.rs":"b9bf128a610004c5322070a0440cd707bec0f21401df7b9c38b614ea90661f06","src/io/free_functions.rs":"4bc3a3ee3aa518889d9fc074255b2c28e700a531c0ed92a926e7bee0c9ddd505","src/io/mod.rs":"5a40ee3fefc65dc58d4fa807e612ac07a8f69a4a7fe36e7d2daef635a0179522","src/io/reader.rs":"e035ed5e62f9858362c0fea2c077c641ba3eaef44ce5f7dc4bb858219cc88ed4","src/jpeg/decoder.rs":"226d05f520493b120f7d2c3e4b53c3bbc6e26a77c41c9db01c977bdbffe226d5","src/jpeg/encoder.rs":"02e3411ba2092d795827f9fb6a5f9472a20414a1ca6eafc33e297d661772dfa9","src/jpeg/entropy.rs":"20b32f69ffddf5896f55fec53467714b1cb97b77d6e24f9c5e5ad8bc69b6f32b","src/jpeg/mod.rs":"47aa20129bf42be988eeb21d4124cbc2ea0b37095ab41a5050ad4f7fb3e241df","src/jpeg/transform.rs":"8ec387f48010f634b220ff2ea6c0032b9dd1d52cd9faa09d276c3c73fa06ad07","src/lib.rs":"2d6f1e7bd4d8469f5a3eeb6124ca390829007034ef7966ecf1312f2c22b03d28","src/math/mod.rs":"6f41513b5867d2e64e45b3ef83c9196e51c6cd7fe143bfc983df21d64f6525df","src/math/nq.rs":"1a6ec15ed7f765a219b14ce648cded1394afc3b430e33a4b8c462e0888ad93b3","src/math/rect.rs":"10a6f8c76988ff7583f2824be6c3fe005a171777080e3ad0cbe169c6dc574edd","src/math/utils.rs":"2ae7ac728c6831559da97ed31d133cad81b3b5fe64998829b5579f34330a548e","src/png.rs":"fbf3a32ee1b7171ea54b56dcbea7d91b51f2c359cce0abc60092556bc45f9bd9","src/pnm/autobreak.rs":"f52a14475c13c1a360f95cd53835d8a234c9b1fa8b675442d0485c5eaa42dfc6","src/pnm/decoder.rs":"6d80a824c02d76b5f669b5bd250466edb5c06b5bcbe2b8f55fc5cdb818ed268c","src/pnm/encoder.rs":"1bc4c995005bb7fdc7b66bdf666269114a3edd923f0ae4032c8a151952bc89a3","src/pnm/header.rs":"81a0cf72c3b113b490054f4f2201b448cbb1fed63fc1354e457a94294bf3761f","src/pnm/mod.rs":"8768272601e7acbae04384b63889153fcea55bbdaee3a31a869a9c53dd11f11a","src/tga/decoder.rs":"8d1e698c91a781c3841d4b13f3abb060c5e4da4ed1c3cc472dea6d04bf4c4149","src/tga/mod.rs":"ca7e63484eef94b6ac2afd87bedc823dce955b7bda9144e78cac0a8839984a4a","src/tiff.rs":"727c3364a34bdb72f558192133930edfda043419767fc175b220578cd6157eb4","src/traits.rs":"f750190405f6e2245154067c41768cee71aadcbc3fe65647f99c96f783e86c0d","src/utils/mod.rs":"d60515c2fbbdfe1325750774b3dffab0faf6d7d2ac775c6cf6452f679325f002","src/webp/decoder.rs":"85314502ae38f81947d69d9fd5c094db2b7444189d17524b0b2fe99f3b2b1e6e","src/webp/mod.rs":"4ac8a930ccb1e2be5b6792cd33562c1e0c5a06f57216ca1030d6eec30d32348a","src/webp/transform.rs":"26e747e1bff0a8b88125ffc6d2a6e27ec2fcd1246a7d0e66c49f58ee80cc4847","src/webp/vp8.rs":"6a55c58c9c81e48ac8e4c10575496f8e0ec70889756556492614c1e080c8b70f"},"package":"403f0c29211dc50a78eb53eeeae87945d44cb63071881834212f36677fccb2b4"} \ No newline at end of file diff --git a/third_party/cargo/vendor/image-0.23.1/benches/encode_bmp.rs b/third_party/cargo/vendor/image-0.23.1/benches/encode_bmp.rs deleted file mode 100644 index a954f30..0000000 --- a/third_party/cargo/vendor/image-0.23.1/benches/encode_bmp.rs +++ /dev/null @@ -1,146 +0,0 @@ -extern crate criterion; - -use criterion::{Bencher, Criterion, ParameterizedBenchmark, criterion_group, criterion_main}; -use image::{ColorType, bmp::BMPEncoder}; - -use std::fs::File; -use std::io::BufWriter; - -fn encode_gray_test(criterion: &mut Criterion) { - let counts = vec![100usize, 200, 400, 800, 1200]; - fn raw_vec(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - let mut v = vec![0; s * s / 4 + 4096 + s * 4]; - b.iter(|| { - v.clear(); - let mut x = BMPEncoder::new(&mut v); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::L8).unwrap(); - } - ) - } - - fn buf_vec(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - let mut v = vec![0; s * s / 4 + 4096 + s * 4]; - b.iter(|| { - v.clear(); - let mut buf = BufWriter::new(&mut v); - let mut x = BMPEncoder::new(&mut buf); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::L8).unwrap(); - } - ) - } - - fn buf_file(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - b.iter(|| { - let mut f = File::open("temp.bmp").unwrap(); - let mut buf = BufWriter::new(&mut f); - let mut x = BMPEncoder::new(&mut buf); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::L8).unwrap(); - } - ) - } - - criterion.bench("encode_gray", - ParameterizedBenchmark::new("raw_vec", raw_vec, counts) - .with_function("buf_vec", buf_vec) - .with_function("buf_file", buf_file)); -} - -fn encode_rgb_test(criterion: &mut Criterion) { - let counts = vec![100usize, 200, 400, 800, 1200]; - fn raw_vec(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - let mut v = vec![0; s * s / 4 + 4096 + s * 4]; - b.iter(|| { - v.clear(); - let mut x = BMPEncoder::new(&mut v); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::Rgb8).unwrap(); - } - ) - } - - fn buf_vec(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - let mut v = vec![0; s * s / 4 + 4096 + s * 4]; - b.iter(|| { - v.clear(); - let mut buf = BufWriter::new(&mut v); - let mut x = BMPEncoder::new(&mut buf); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::Rgb8).unwrap(); - } - ) - } - - fn buf_file(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - b.iter(|| { - let mut f = File::open("temp.bmp").unwrap(); - let mut buf = BufWriter::new(&mut f); - let mut x = BMPEncoder::new(&mut buf); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::Rgb8).unwrap(); - } - ) - } - - criterion.bench("encode_rgb", - ParameterizedBenchmark::new("raw_vec", raw_vec, counts) - .with_function("buf_vec", buf_vec) - .with_function("buf_file", buf_file)); -} - -fn encode_rgba_test(criterion: &mut Criterion) { - let counts = vec![100usize, 200, 400, 800, 1200]; - fn raw_vec(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - let mut v = vec![0; s * s / 4 + 4096 + s * 4]; - b.iter(|| { - v.clear(); - let mut x = BMPEncoder::new(&mut v); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::Rgba8).unwrap(); - } - ) - } - - fn buf_vec(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - let mut v = vec![0; s * s / 4 + 4096 + s * 4]; - b.iter(|| { - v.clear(); - let mut buf = BufWriter::new(&mut v); - let mut x = BMPEncoder::new(&mut buf); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::Rgba8).unwrap(); - } - ) - } - - fn buf_file(b: &mut Bencher, s: &usize) { - let s = *s; - let im = vec![0; s * s]; - b.iter(|| { - let mut f = File::open("temp.bmp").unwrap(); - let mut buf = BufWriter::new(&mut f); - let mut x = BMPEncoder::new(&mut buf); - x.encode(&im, (s / 2) as u32, (s / 2) as u32, ColorType::Rgba8).unwrap(); - } - ) - } - - criterion.bench("encode_rgba", - ParameterizedBenchmark::new("raw_vec", raw_vec, counts) - .with_function("buf_vec", buf_vec) - .with_function("buf_file", buf_file)); -} - -criterion_group!(benches, encode_gray_test); -criterion_main!(benches); - diff --git a/third_party/cargo/vendor/image-0.23.1/benches/encode_jpeg.rs b/third_party/cargo/vendor/image-0.23.1/benches/encode_jpeg.rs deleted file mode 100644 index 33e2586..0000000 --- a/third_party/cargo/vendor/image-0.23.1/benches/encode_jpeg.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![cfg(feature = "benchmarks")] -#![feature(test)] -extern crate image; -extern crate test; - -use test::Bencher; - -const W: u32 = 1000; -const H: u32 = 1000; - -fn run_benchmark(b: &mut Bencher, color_type: image::ColorType) { - let mut v = Vec::with_capacity((W * H) as usize); - let i = vec![0; (W * H) as usize]; - - b.iter(|| { - v.clear(); - let mut e = image::jpeg::JPEGEncoder::new(&mut v); - e.encode(&i[..], W, H, color_type).unwrap(); - }); -} - -#[bench] -fn bench_rgb(b: &mut Bencher) { - run_benchmark(b, image::ColorType::Rgb8); -} - -#[bench] -fn bench_gray(b: &mut Bencher) { - run_benchmark(b, image::ColorType::L8); -} diff --git a/third_party/cargo/vendor/image-0.23.1/benches/load.rs b/third_party/cargo/vendor/image-0.23.1/benches/load.rs deleted file mode 100644 index 4b2d79e..0000000 --- a/third_party/cargo/vendor/image-0.23.1/benches/load.rs +++ /dev/null @@ -1,84 +0,0 @@ -#![cfg(feature = "benchmarks")] -#![feature(test)] - -extern crate image; -extern crate test; - -use image::ImageFormat; -use std::io::Read; -use std::{fs, path}; - -struct BenchDef<'a> { - dir: &'a [&'a str], - format: ImageFormat, -} - -const IMAGE_DIR: [&'static str; 3] = [".", "tests", "images"]; -const BMP: BenchDef<'static> = BenchDef { - dir: &["bmp", "images"], - format: ImageFormat::Bmp, -}; - -fn bench_load(b: &mut test::Bencher, def: &BenchDef, filename: &str) { - let mut path: path::PathBuf = IMAGE_DIR.iter().collect(); - for d in def.dir { - path.push(d); - } - path.push(filename); - let mut fin = fs::File::open(path).unwrap(); - let mut buf = Vec::new(); - fin.read_to_end(&mut buf).unwrap(); - b.iter(|| { - image::load_from_memory_with_format(&buf, def.format).unwrap(); - }) -} - -#[bench] -fn bench_load_bmp_1bit(b: &mut test::Bencher) { - bench_load(b, &BMP, "Core_1_Bit.bmp"); -} - -#[bench] -fn bench_load_bmp_4bit(b: &mut test::Bencher) { - bench_load(b, &BMP, "Core_4_Bit.bmp"); -} - -#[bench] -fn bench_load_bmp_8bit(b: &mut test::Bencher) { - bench_load(b, &BMP, "Core_8_Bit.bmp"); -} - -#[bench] -fn bench_load_bmp_16bit(b: &mut test::Bencher) { - bench_load(b, &BMP, "rgb16.bmp"); -} - -#[bench] -fn bench_load_bmp_24bit(b: &mut test::Bencher) { - bench_load(b, &BMP, "rgb24.bmp"); -} - -#[bench] -fn bench_load_bmp_32bit(b: &mut test::Bencher) { - bench_load(b, &BMP, "rgb32.bmp"); -} - -#[bench] -fn bench_load_bmp_4rle(b: &mut test::Bencher) { - bench_load(b, &BMP, "pal4rle.bmp"); -} - -#[bench] -fn bench_load_bmp_8rle(b: &mut test::Bencher) { - bench_load(b, &BMP, "pal8rle.bmp"); -} - -#[bench] -fn bench_load_bmp_16bf(b: &mut test::Bencher) { - bench_load(b, &BMP, "rgb16-565.bmp"); -} - -#[bench] -fn bench_load_bmp_32bf(b: &mut test::Bencher) { - bench_load(b, &BMP, "rgb32bf.bmp"); -} diff --git a/third_party/cargo/vendor/image-0.23.1/src/lib.rs b/third_party/cargo/vendor/image-0.23.1/src/lib.rs deleted file mode 100644 index bab0cff..0000000 --- a/third_party/cargo/vendor/image-0.23.1/src/lib.rs +++ /dev/null @@ -1,141 +0,0 @@ -//! This crate provides native rust implementations of -//! image encoders and decoders and basic image manipulation -//! functions. - -#![warn(missing_docs)] -#![warn(unused_qualifications)] -#![deny(unreachable_pub)] -#![deny(deprecated)] -#![deny(missing_copy_implementations)] -#![cfg_attr(all(test, feature = "benchmarks"), feature(test))] -// it's a bit of a pain otherwise -#![allow(clippy::many_single_char_names)] - -#[cfg(all(test, feature = "benchmarks"))] -extern crate test; - -#[cfg(test)] -#[macro_use] -extern crate quickcheck; - -use std::io::Write; - -pub use crate::color::{ColorType, ExtendedColorType}; - -pub use crate::color::{Luma, LumaA, Rgb, Rgba, Bgr, Bgra}; - -pub use crate::error::{ImageError, ImageResult}; - -pub use crate::image::{AnimationDecoder, - GenericImage, - GenericImageView, - ImageDecoder, - ImageDecoderExt, - ImageEncoder, - ImageFormat, - ImageOutputFormat, - Progress, - // Iterators - Pixels, - SubImage}; - -pub use crate::buffer::{ConvertBuffer, - GrayAlphaImage, - GrayImage, - // Image types - ImageBuffer, - Pixel, - RgbImage, - RgbaImage, - }; - -pub use crate::flat::FlatSamples; - -// Traits -pub use crate::traits::Primitive; - -// Opening and loading images -pub use crate::io::free_functions::{guess_format, load}; -pub use crate::dynimage::{load_from_memory, load_from_memory_with_format, open, - save_buffer, save_buffer_with_format, image_dimensions}; - -pub use crate::dynimage::DynamicImage; - -pub use crate::animation::{Delay, Frame, Frames}; - -// More detailed error type -pub mod error; - -// Math utils -pub mod math; - -// Image processing functions -pub mod imageops; - -// Io bindings -pub mod io; - -// Buffer representations for ffi. -pub mod flat; - -// Image codecs -#[cfg(feature = "bmp")] -pub mod bmp; -#[cfg(feature = "dds")] -pub mod dds; -#[cfg(feature = "dxt")] -pub mod dxt; -#[cfg(feature = "gif")] -pub mod gif; -#[cfg(feature = "hdr")] -pub mod hdr; -#[cfg(feature = "ico")] -pub mod ico; -#[cfg(feature = "jpeg")] -pub mod jpeg; -#[cfg(feature = "png")] -pub mod png; -#[cfg(feature = "pnm")] -pub mod pnm; -#[cfg(feature = "tga")] -pub mod tga; -#[cfg(feature = "tiff")] -pub mod tiff; -#[cfg(feature = "webp")] -pub mod webp; - -mod animation; -mod buffer; -mod color; -mod dynimage; -mod image; -mod traits; -mod utils; - -// Can't use the macro-call itself within the `doc` attribute. So force it to eval it as part of -// the macro invocation. -// -// The inspiration for the macro and implementation is from -// -// -// MIT License -// -// Copyright (c) 2018 Guillaume Gomez -macro_rules! insert_as_doc { - { $content:expr } => { - #[doc = $content] extern { } - } -} - -// Provides the README.md as doc, to ensure the example works! -//insert_as_doc!(include_str!("../README.md")); - -// Copies data from `src` to `dst` -// -// Panics if the length of `dst` is less than the length of `src`. -#[inline] -fn copy_memory(src: &[u8], mut dst: &mut [u8]) { - let len_src = src.len(); - assert!(dst.len() >= len_src); - dst.write_all(src).unwrap(); -} diff --git a/third_party/cargo/vendor/image-0.23.1/src/traits.rs b/third_party/cargo/vendor/image-0.23.1/src/traits.rs deleted file mode 100644 index 6e558d4..0000000 --- a/third_party/cargo/vendor/image-0.23.1/src/traits.rs +++ /dev/null @@ -1,75 +0,0 @@ -//! This module provides useful traits that were deprecated in rust - -// Note copied from the stdlib under MIT license - -use num_traits::{Bounded, Num, NumCast}; -use std::ops::AddAssign; - -/// Types which are safe to treat as an immutable byte slice in a pixel layout -/// for image encoding. -pub trait EncodableLayout: seals::EncodableLayout { - /// Get the bytes of this value. - fn as_bytes(&self) -> &[u8]; -} - -impl EncodableLayout for [u8] { - fn as_bytes(&self) -> &[u8] { - bytemuck::cast_slice(self) - } -} - -impl EncodableLayout for [u16] { - fn as_bytes(&self) -> &[u8] { - bytemuck::cast_slice(self) - } -} - -/// Primitive trait from old stdlib -pub trait Primitive: Copy + NumCast + Num + PartialOrd + Clone + Bounded {} - -impl Primitive for usize {} -impl Primitive for u8 {} -impl Primitive for u16 {} -impl Primitive for u32 {} -impl Primitive for u64 {} -impl Primitive for isize {} -impl Primitive for i8 {} -impl Primitive for i16 {} -impl Primitive for i32 {} -impl Primitive for i64 {} -impl Primitive for f32 {} -impl Primitive for f64 {} - -/// An Enlargable::Larger value should be enough to calculate -/// the sum (average) of a few hundred or thousand Enlargeable values. -pub trait Enlargeable: Sized + Bounded + NumCast { - type Larger: Primitive + AddAssign + 'static; - - fn clamp_from(n: Self::Larger) -> Self { - // Note: Only unsigned value types supported. - if n > NumCast::from(Self::max_value()).unwrap() { - Self::max_value() - } else { - NumCast::from(n).unwrap() - } - } -} - -impl Enlargeable for u8 { - type Larger = u32; -} -impl Enlargeable for u16 { - type Larger = u32; -} -impl Enlargeable for u32 { - type Larger = u64; -} - - -/// Private module for supertraits of sealed traits. -mod seals { - pub trait EncodableLayout {} - - impl EncodableLayout for [u8] {} - impl EncodableLayout for [u16] {} -} diff --git a/third_party/cargo/vendor/image-0.23.1/src/webp/decoder.rs b/third_party/cargo/vendor/image-0.23.1/src/webp/decoder.rs deleted file mode 100644 index e2c7073..0000000 --- a/third_party/cargo/vendor/image-0.23.1/src/webp/decoder.rs +++ /dev/null @@ -1,141 +0,0 @@ -use byteorder::{LittleEndian, ReadBytesExt}; -use std::convert::TryFrom; -use std::default::Default; -use std::io::{self, Cursor, Read}; -use std::marker::PhantomData; -use std::mem; - -use crate::error::{DecodingError, ImageError, ImageResult}; -use crate::image::{ImageDecoder, ImageFormat}; - -use crate::color; - -use super::vp8::Frame; -use super::vp8::Vp8Decoder; - -/// WebP Image format decoder. Currently only supportes the luma channel (meaning that decoded -/// images will be grayscale). -pub struct WebPDecoder { - r: R, - frame: Frame, - have_frame: bool, -} - -impl WebPDecoder { - /// Create a new WebPDecoder from the Reader ```r```. - /// This function takes ownership of the Reader. - pub fn new(r: R) -> ImageResult> { - let f: Frame = Default::default(); - - let mut decoder = WebPDecoder { - r, - have_frame: false, - frame: f, - }; - decoder.read_metadata()?; - Ok(decoder) - } - - fn read_riff_header(&mut self) -> ImageResult { - let mut riff = Vec::with_capacity(4); - self.r.by_ref().take(4).read_to_end(&mut riff)?; - let size = self.r.read_u32::()?; - let mut webp = Vec::with_capacity(4); - self.r.by_ref().take(4).read_to_end(&mut webp)?; - - if &*riff != b"RIFF" { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - "Invalid RIFF signature".to_string(), - ))); - } - - if &*webp != b"WEBP" { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - "Invalid WEBP signature".to_string(), - ))); - } - - Ok(size) - } - - fn read_vp8_header(&mut self) -> ImageResult<()> { - let mut vp8 = Vec::with_capacity(4); - self.r.by_ref().take(4).read_to_end(&mut vp8)?; - - if &*vp8 != b"VP8 " { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - "Invalid VP8 signature.".to_string(), - ))); - } - - let _len = self.r.read_u32::()?; - - Ok(()) - } - - fn read_frame(&mut self) -> ImageResult<()> { - let mut framedata = Vec::new(); - self.r.read_to_end(&mut framedata)?; - let m = io::Cursor::new(framedata); - - let mut v = Vp8Decoder::new(m); - let frame = v.decode_frame()?; - - self.frame = frame.clone(); - - Ok(()) - } - - fn read_metadata(&mut self) -> ImageResult<()> { - if !self.have_frame { - self.read_riff_header()?; - self.read_vp8_header()?; - self.read_frame()?; - - self.have_frame = true; - } - - Ok(()) - } -} - -/// Wrapper struct around a `Cursor>` -pub struct WebpReader(Cursor>, PhantomData); -impl Read for WebpReader { - fn read(&mut self, buf: &mut [u8]) -> io::Result { - self.0.read(buf) - } - fn read_to_end(&mut self, buf: &mut Vec) -> io::Result { - if self.0.position() == 0 && buf.is_empty() { - mem::swap(buf, self.0.get_mut()); - Ok(buf.len()) - } else { - self.0.read_to_end(buf) - } - } -} - -impl<'a, R: 'a + Read> ImageDecoder<'a> for WebPDecoder { - type Reader = WebpReader; - - fn dimensions(&self) -> (u32, u32) { - (u32::from(self.frame.width), u32::from(self.frame.height)) - } - - fn color_type(&self) -> color::ColorType { - color::ColorType::L8 - } - - fn into_reader(self) -> ImageResult { - Ok(WebpReader(Cursor::new(self.frame.ybuf), PhantomData)) - } - - fn read_image(self, buf: &mut [u8]) -> ImageResult<()> { - assert_eq!(u64::try_from(buf.len()), Ok(self.total_bytes())); - buf.copy_from_slice(&self.frame.ybuf); - Ok(()) - } -} diff --git a/third_party/cargo/vendor/image-0.23.4/.cargo-checksum.json b/third_party/cargo/vendor/image-0.23.4/.cargo-checksum.json new file mode 100644 index 0000000..99052e0 --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGES.md":"74c7d19e3a3db1c196492cdef6e77791179d7e340f97e1f138c225e9d981d3b6","Cargo.toml":"3fd6476112fb7c5d1f899e15ce55185f3f5aaa78dcbeb4d077ca05cbb94db628","Cargo.toml.public-private-dependencies":"5ba94f529e94c7f735e92717f93068e3e2ab4a6767e340bd0e0552856378f663","LICENSE":"c7766d2e29f88a4be81b6ac6216c62d2d0918c7d3f2fc98be6fecac8f6595e60","README.md":"bade1e48347a9ad58d5a91281e7981e8d58b3527cded6f4653c49506bb0f47ad","benches/README.md":"87b2ea4d1cea80c1e24fc18f1222a7ee1a38f5a92e98110bb84a4827fb997b62","benches/decode.rs":"2da1d892d16af0faa3aed7bdb3b5af8550efd5619204071b2afce532f70ada86","benches/encode.rs":"11892d0cc955ec69b56a79539b0fec6c257c925d2bcc572d6d936f9e11f927a2","docs/2019-04-23-memory-unsafety.md":"b59a9af84bdb5efa1bc1f33c8aa22ff42590701817fb03f55ca2dd50af91bb8d","release.sh":"70f8d6272ab65f5ca80ac95e6ceeeb5041f9c183c87a1fdac2b7f2d16e0827d4","src/animation.rs":"cd4e81bf81f26c6e2ee4620dc4eb37045c782eb7bc6801b7edd2336478e96801","src/bmp/decoder.rs":"cec72a8559ffbcf1b01db868b5c6273db7480f1fc7dcc0ca508d808d82668687","src/bmp/encoder.rs":"c27671deffd4eaf5689beaa6035cd18eac3fe67d08ad02b88e9a1fb316a9e5c3","src/bmp/mod.rs":"a56f9e8893f05dae04bccc2c16fd9ae452c3000fec8afa0bec4e2f03f9dff4de","src/buffer.rs":"0c6512715a5ec2be12ad093d7b8e4fefdb829df0710c5c7e29e234cf3dd5d286","src/color.rs":"6315071143604b6d484d590a31b8468379b2752e5953b0e4dc4b00507d298f96","src/dds.rs":"39e34410ca5c71dc17fe00ec8cb030aec56966249a8816935494a904ca20bde7","src/dxt.rs":"eddae1adcfa4cbef1096cec90aea1338a4042e1e26f56fc60e3d9f3558bf44d7","src/dynimage.rs":"54ea33398b540fb920bd674212f06895470016d2040c24a0e8a81987f960673e","src/error.rs":"5213b66822985bbaaadd3fb2962e8ec2163e38214c04e22eb6d376d020d6be80","src/farbfeld.rs":"9d8f41e70893858477a40d5b6c1c9eeebbd1de35d2b893855d334ac68f47ba4a","src/flat.rs":"c73b01f06abe9577cdbf0b124f771d9d7afa4670c1ebfc630bb337229d8229e5","src/gif.rs":"3a508cd90fdd346c5f3d80dfa241e696321cc67ef25eb03ebb0b19113eccfa19","src/hdr/decoder.rs":"29e953dbb41ae34fd67878c8322599f17bcf14d5738b07ceb3d3e53db8d5d330","src/hdr/encoder.rs":"e4321c404ef83606238581843a2a5889a12715f8fa070667563e329b419d529e","src/hdr/mod.rs":"96eb63b7e43f117cb46b8ffe705b477426dde75881f2dea63cab29ffd820e01d","src/ico/decoder.rs":"4795b563f8906222b01fc95d8450b034caf9d5e206d60f68f929c3d5980842a1","src/ico/encoder.rs":"f8258df0912d62b572236f824260eb6dccd3415cc47ee79ff3c210474ab50c6f","src/ico/mod.rs":"fc9b65fd6e6eaab9f4dc6120f3bdca5d40046669e4d3ae6f8feb21bfeac3536d","src/image.rs":"f18923d872051a763c7e1a14be3a97aef95a7e81f34f9de501671c087f6f71d9","src/imageops/affine.rs":"99a9884acd5a360d9487157b64472d3973515b238acd9598172399cc963be694","src/imageops/colorops.rs":"e398d66381873b72628dddb578901f12f75d630c51ae23f414b56feadea87791","src/imageops/mod.rs":"ed68789c6eccdeffcf70bb6123f5d5b34b0a3aa465b8f97305803e4164d0db4d","src/imageops/sample.rs":"0b0883a17af34ad44716c6fcf4677002bfbe87d5d7c57dadb53c463315ea0936","src/io/free_functions.rs":"e9f8a89efc4c0a178e912beb99168cb9dabdfa6b75d10aa03d9833321bed859a","src/io/mod.rs":"5a40ee3fefc65dc58d4fa807e612ac07a8f69a4a7fe36e7d2daef635a0179522","src/io/reader.rs":"51a9b1f1669aaef0e44ce88bfc0b12ac16a2ad0f863adc2f8a9c789c7679d6cb","src/jpeg/decoder.rs":"b0f4eb1bfae2c5f95408a98260a695f5fdfa39eab2d6b1b2cde79111311ced28","src/jpeg/encoder.rs":"64449243663b547fb103b4b1a5ef3e3fcc9bf24148a92cb0bcc6605d8a7d87c7","src/jpeg/entropy.rs":"20b32f69ffddf5896f55fec53467714b1cb97b77d6e24f9c5e5ad8bc69b6f32b","src/jpeg/mod.rs":"47aa20129bf42be988eeb21d4124cbc2ea0b37095ab41a5050ad4f7fb3e241df","src/jpeg/transform.rs":"8ec387f48010f634b220ff2ea6c0032b9dd1d52cd9faa09d276c3c73fa06ad07","src/lib.rs":"512176756079c62730dffb09891d3211dd1ae1efe9b881e84d96a9402067cb41","src/math/mod.rs":"6f41513b5867d2e64e45b3ef83c9196e51c6cd7fe143bfc983df21d64f6525df","src/math/nq.rs":"1a6ec15ed7f765a219b14ce648cded1394afc3b430e33a4b8c462e0888ad93b3","src/math/rect.rs":"10a6f8c76988ff7583f2824be6c3fe005a171777080e3ad0cbe169c6dc574edd","src/math/utils.rs":"2ae7ac728c6831559da97ed31d133cad81b3b5fe64998829b5579f34330a548e","src/png.rs":"43d87cb79b777dad1c7a93f09f25ad6a8b5a1513981f1594ff36a88de452bb47","src/pnm/autobreak.rs":"f52a14475c13c1a360f95cd53835d8a234c9b1fa8b675442d0485c5eaa42dfc6","src/pnm/decoder.rs":"55730aeeb5e8591963c7638440157997d5e5eaeda53d7dc1b4e8ee99791948a2","src/pnm/encoder.rs":"1bc4c995005bb7fdc7b66bdf666269114a3edd923f0ae4032c8a151952bc89a3","src/pnm/header.rs":"55fb74da6942608a292aec55795231f25b6444fbcef97ee7c4ee0583ac88a52a","src/pnm/mod.rs":"8768272601e7acbae04384b63889153fcea55bbdaee3a31a869a9c53dd11f11a","src/tga/decoder.rs":"7c2030f22fe7d7f59caaa905f50bba42f194ae23a6d7305ffcee6042fcc5c788","src/tga/mod.rs":"ca7e63484eef94b6ac2afd87bedc823dce955b7bda9144e78cac0a8839984a4a","src/tiff.rs":"727c3364a34bdb72f558192133930edfda043419767fc175b220578cd6157eb4","src/traits.rs":"9fb8f4c1e6d14dbbcd8301e7ee5e4e85cf152a8c265c9632a03b29dd7f1ce1f3","src/utils/mod.rs":"d60515c2fbbdfe1325750774b3dffab0faf6d7d2ac775c6cf6452f679325f002","src/webp/decoder.rs":"2009d52e2ca209afd2834461a9ff584e5c8d8f977f1fcd5ca6da185a324097e9","src/webp/mod.rs":"4ac8a930ccb1e2be5b6792cd33562c1e0c5a06f57216ca1030d6eec30d32348a","src/webp/transform.rs":"26e747e1bff0a8b88125ffc6d2a6e27ec2fcd1246a7d0e66c49f58ee80cc4847","src/webp/vp8.rs":"e52377e329ec1a19ca672e9678368372ca4179706a7820258f30617bda36b7c8"},"package":"9117f4167a8f21fa2bb3f17a652a760acd7572645281c98e3b612a26242c96ee"} \ No newline at end of file diff --git a/third_party/cargo/vendor/image-0.23.1/BUILD b/third_party/cargo/vendor/image-0.23.4/BUILD similarity index 79% rename from third_party/cargo/vendor/image-0.23.1/BUILD rename to third_party/cargo/vendor/image-0.23.4/BUILD index 40e55f8..627422f 100644 --- a/third_party/cargo/vendor/image-0.23.1/BUILD +++ b/third_party/cargo/vendor/image-0.23.4/BUILD @@ -23,8 +23,8 @@ load( ) -# Unsupported target "BMPEncoder" with type "bench" omitted -# Unsupported target "encode_jpeg" with type "bench" omitted +# Unsupported target "decode" with type "bench" omitted +# Unsupported target "encode" with type "bench" omitted rust_library( name = "image", @@ -36,23 +36,24 @@ rust_library( "//third_party/cargo/vendor/bytemuck-1.2.0:bytemuck", "//third_party/cargo/vendor/byteorder-1.3.4:byteorder", "//third_party/cargo/vendor/gif-0.10.3:gif", - "//third_party/cargo/vendor/jpeg-decoder-0.1.18:jpeg_decoder", + "//third_party/cargo/vendor/jpeg-decoder-0.1.19:jpeg_decoder", "//third_party/cargo/vendor/num-iter-0.1.40:num_iter", - "//third_party/cargo/vendor/num-rational-0.2.3:num_rational", + "//third_party/cargo/vendor/num-rational-0.2.4:num_rational", "//third_party/cargo/vendor/num-traits-0.2.11:num_traits", - "//third_party/cargo/vendor/png-0.16.1:png", + "//third_party/cargo/vendor/png-0.16.3:png", "//third_party/cargo/vendor/scoped_threadpool-0.1.9:scoped_threadpool", "//third_party/cargo/vendor/tiff-0.4.0:tiff", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.23.1", + version = "0.23.4", crate_features = [ "bmp", "dds", "default", "dxt", + "farbfeld", "gif", "hdr", "ico", @@ -67,4 +68,3 @@ rust_library( ], ) -# Unsupported target "load" with type "bench" omitted diff --git a/third_party/cargo/vendor/image-0.23.1/CHANGES.md b/third_party/cargo/vendor/image-0.23.4/CHANGES.md similarity index 93% rename from third_party/cargo/vendor/image-0.23.1/CHANGES.md rename to third_party/cargo/vendor/image-0.23.4/CHANGES.md index 40f2f3e..6fe7c89 100644 --- a/third_party/cargo/vendor/image-0.23.1/CHANGES.md +++ b/third_party/cargo/vendor/image-0.23.4/CHANGES.md @@ -10,6 +10,26 @@ Rust image aims to be a pure-Rust implementation of various popular image format ## Changes +### Version 0.23.4 + +- Improved the performance of decoding animated gifs +- Added `crop_imm` which functions like `crop` but on a shared reference +- The gif `DisposalMethod::Any` is treated as `Keep`, consistent with browsers +- Most errors no longer allocate a string, instead implement Display. +- Add some implementations of `Error::source` + +### Version 0.23.3 + +- Added `ColorType::has_alpha` to facilitate lossless conversion +- Recognize extended WebP formats for decoding +- Added decoding and encoding for the `farbfeld` format +- Export named iterator types created from various `ImageBuffer` methods +- Error in jpeg encoder for images larger than 65536 pixels, fixes panic + +### Version 0.23.2 + +- The dependency on `jpeg-decoder` now reflects minimum requirements. + ### Version 0.23.1 - Fix cmyk_to_rgb (jpeg) causing off by one rounding errors. diff --git a/third_party/cargo/vendor/image-0.23.1/Cargo.toml b/third_party/cargo/vendor/image-0.23.4/Cargo.toml similarity index 90% rename from third_party/cargo/vendor/image-0.23.1/Cargo.toml rename to third_party/cargo/vendor/image-0.23.4/Cargo.toml index 3e64e85..149db10 100644 --- a/third_party/cargo/vendor/image-0.23.1/Cargo.toml +++ b/third_party/cargo/vendor/image-0.23.4/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "image" -version = "0.23.1" +version = "0.23.4" authors = ["The image-rs Developers"] exclude = ["src/png/testdata/*", "examples/*", "tests/*"] description = "Imaging library written in Rust. Provides basic filters and decoders for the most common image formats." @@ -29,8 +29,13 @@ name = "image" path = "./src/lib.rs" [[bench]] -name = "BMPEncoder" -path = "benches/encode_bmp.rs" +name = "decode" +path = "benches/decode.rs" +harness = false + +[[bench]] +name = "encode" +path = "benches/encode.rs" harness = false [dependencies.bytemuck] version = "1" @@ -43,7 +48,7 @@ version = "0.10.0" optional = true [dependencies.jpeg] -version = "0.1" +version = "0.1.17" optional = true default-features = false package = "jpeg-decoder" @@ -88,8 +93,9 @@ version = "0.9" benchmarks = [] bmp = [] dds = ["dxt"] -default = ["gif", "jpeg", "ico", "png", "pnm", "tga", "tiff", "webp", "bmp", "hdr", "dxt", "dds", "jpeg_rayon"] +default = ["gif", "jpeg", "ico", "png", "pnm", "tga", "tiff", "webp", "bmp", "hdr", "dxt", "dds", "farbfeld", "jpeg_rayon"] dxt = [] +farbfeld = [] hdr = ["scoped_threadpool"] ico = ["bmp", "png"] jpeg_rayon = ["jpeg/rayon"] diff --git a/third_party/cargo/vendor/image-0.23.1/Cargo.toml.public-private-dependencies b/third_party/cargo/vendor/image-0.23.4/Cargo.toml.public-private-dependencies similarity index 91% rename from third_party/cargo/vendor/image-0.23.1/Cargo.toml.public-private-dependencies rename to third_party/cargo/vendor/image-0.23.4/Cargo.toml.public-private-dependencies index 6d71d55..281b028 100644 --- a/third_party/cargo/vendor/image-0.23.1/Cargo.toml.public-private-dependencies +++ b/third_party/cargo/vendor/image-0.23.4/Cargo.toml.public-private-dependencies @@ -2,7 +2,7 @@ cargo-features = ["public-dependency"] [package] name = "image" -version = "0.23.0-preview.0" +version = "0.23.2" edition = "2018" license = "MIT" description = "Imaging library written in Rust. Provides basic filters and decoders for the most common image formats." @@ -31,7 +31,7 @@ num-rational = "0.2.1" # Public due to Pixel, otherwise quite useless. num-traits = { version = "0.2.0", public = true } gif = { version = "0.10.0", optional = true } -jpeg = { package = "jpeg-decoder", version = "0.1", default-features = false, optional = true } +jpeg = { package = "jpeg-decoder", version = "0.1.17", default-features = false, optional = true } png = { version = "0.16.0", optional = true } scoped_threadpool = { version = "0.1", optional = true } tiff = { version = "0.4.0", optional = true } diff --git a/third_party/cargo/vendor/image-0.23.1/LICENSE b/third_party/cargo/vendor/image-0.23.4/LICENSE similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/LICENSE rename to third_party/cargo/vendor/image-0.23.4/LICENSE diff --git a/third_party/cargo/vendor/image-0.23.1/README.md b/third_party/cargo/vendor/image-0.23.4/README.md similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/README.md rename to third_party/cargo/vendor/image-0.23.4/README.md index 22808f9..7ec4b83 100644 --- a/third_party/cargo/vendor/image-0.23.1/README.md +++ b/third_party/cargo/vendor/image-0.23.4/README.md @@ -31,6 +31,8 @@ https://docs.rs/image | WebP | Lossy(Luma channel only) | No | | PNM | PBM, PGM, PPM, standard PAM | Yes | | DDS | DXT1, DXT3, DXT5 | No | +| TGA | Yes | No | +| farbfeld | Yes | Yes | ### 2.2 The `ImageDecoder` and `ImageDecoderExt` Traits diff --git a/third_party/cargo/vendor/image-0.23.1/benches/README.md b/third_party/cargo/vendor/image-0.23.4/benches/README.md similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/benches/README.md rename to third_party/cargo/vendor/image-0.23.4/benches/README.md diff --git a/third_party/cargo/vendor/image-0.23.4/benches/decode.rs b/third_party/cargo/vendor/image-0.23.4/benches/decode.rs new file mode 100644 index 0000000..633ff4e --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/benches/decode.rs @@ -0,0 +1,123 @@ +use std::{iter, fs, path}; + +use image::ImageFormat; +use criterion::{Criterion, criterion_group, criterion_main}; + +#[derive(Clone, Copy)] +struct BenchDef { + dir: &'static [&'static str], + files: &'static [&'static str], + format: ImageFormat, +} + +fn load_all(c: &mut Criterion) { + const BENCH_DEFS: &'static [BenchDef] = &[ + BenchDef { + dir: &["bmp", "images"], + files: &[ + "Core_1_Bit.bmp", + "Core_4_Bit.bmp", + "Core_8_Bit.bmp", + "rgb16.bmp", + "rgb24.bmp", + "rgb32.bmp", + "pal4rle.bmp", + "pal8rle.bmp", + "rgb16-565.bmp", + "rgb32bf.bmp", + ], + format: ImageFormat::Bmp, + }, + BenchDef { + dir: &["gif", "simple"], + files: &[ + "alpha_gif_a.gif", + "sample_1.gif", + ], + format: ImageFormat::Gif, + }, + BenchDef { + dir: &["hdr", "images"], + files: &[ + "image1.hdr", + "rgbr4x4.hdr", + ], + format: ImageFormat::Hdr, + }, + BenchDef { + dir: &["ico", "images"], + files: &[ + "bmp-24bpp-mask.ico", + "bmp-32bpp-alpha.ico", + "png-32bpp-alpha.ico", + "smile.ico", + ], + format: ImageFormat::Ico, + }, + BenchDef { + dir: &["jpg", "progressive"], + files: &[ + "3.jpg", + "cat.jpg", + "test.jpg", + ], + format: ImageFormat::Jpeg, + }, + // TODO: pnm + // TODO: png + BenchDef { + dir: &["tga", "testsuite"], + files: &[ + "cbw8.tga", + "ctc24.tga", + "ubw8.tga", + "utc24.tga", + ], + format: ImageFormat::Tga, + }, + BenchDef { + dir: &["tiff", "testsuite"], + files: &[ + "hpredict.tiff", + "hpredict_packbits.tiff", + "mandrill.tiff", + "rgb-3c-16b.tiff", + ], + format: ImageFormat::Tiff, + }, + BenchDef { + dir: &["webp", "images"], + files: &[ + "simple-gray.webp", + "simple-rgb.webp", + "vp8x-gray.webp", + "vp8x-rgb.webp", + ], + format: ImageFormat::WebP, + }, + ]; + + for bench in BENCH_DEFS { + bench_load(c, bench); + } +} + +criterion_group!(benches, load_all); +criterion_main!(benches); + +fn bench_load(c: &mut Criterion, def: &BenchDef) { + let group_name = format!("load-{:?}", def.format); + let mut group = c.benchmark_group(&group_name); + let paths = IMAGE_DIR.iter().chain(def.dir); + + for file_name in def.files { + let path: path::PathBuf = paths.clone().chain(iter::once(file_name)).collect(); + let buf = fs::read(path).unwrap(); + group.bench_function(file_name.to_owned(), |b| b.iter(|| { + image::load_from_memory_with_format(&buf, def.format).unwrap(); + })); + } +} + +const IMAGE_DIR: [&'static str; 3] = [".", "tests", "images"]; + diff --git a/third_party/cargo/vendor/image-0.23.4/benches/encode.rs b/third_party/cargo/vendor/image-0.23.4/benches/encode.rs new file mode 100644 index 0000000..59f954a --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/benches/encode.rs @@ -0,0 +1,122 @@ +extern crate criterion; + +use criterion::{BenchmarkId, Criterion, criterion_group, criterion_main}; +use image::{ColorType, bmp::BMPEncoder, jpeg::JPEGEncoder}; + +use std::fs::File; +use std::io::{BufWriter, Write, Seek, SeekFrom}; + +trait Encoder { + fn encode_raw(&self, into: &mut Vec, im: &[u8], dims: u32, color: ColorType); + fn encode_bufvec(&self, into: &mut Vec, im: &[u8], dims: u32, color: ColorType); + fn encode_file(&self, file: &File, im: &[u8], dims: u32, color: ColorType); +} + +#[derive(Clone, Copy)] +struct BenchDef { + with: &'static dyn Encoder, + name: &'static str, + sizes: &'static [u32], + colors: &'static [ColorType], +} + +fn encode_all(c: &mut Criterion) { + const BENCH_DEFS: &'static [BenchDef] = &[ + BenchDef { + with: &Bmp, + name: "bmp", + sizes: &[100u32, 200, 400], + colors: &[ColorType::L8, ColorType::Rgb8, ColorType::Rgba8], + }, + BenchDef { + with: &Jpeg, + name: "jpeg", + sizes: &[64u32, 128, 256], + colors: &[ColorType::L8, ColorType::Rgb8, ColorType::Rgba8], + }, + ]; + + for definition in BENCH_DEFS { + encode_definition(c, definition) + } +} + +criterion_group!(benches, encode_all); +criterion_main!(benches); + +type BenchGroup<'a> = criterion::BenchmarkGroup<'a, criterion::measurement::WallTime>; + +/// Benchmarks encoding a zeroed image. +/// +/// For compressed formats this is surely not representative of encoding a normal image but it's a +/// start for benchmarking. +fn encode_zeroed(group: &mut BenchGroup, with: &dyn Encoder, size: u32, color: ColorType) { + let bytes = size as usize * usize::from(color.bytes_per_pixel()); + let im = vec![0; bytes * bytes]; + + group.bench_with_input(BenchmarkId::new(format!("zero-{:?}-rawvec", color), size), &im, |b, image| { + let mut v = vec![]; + with.encode_raw(&mut v, &im, size, color); + b.iter(|| with.encode_raw(&mut v, image, size, color)); + }); + group.bench_with_input(BenchmarkId::new(format!("zero-{:?}-bufvec", color), size), &im, |b, image| { + let mut v = vec![]; + with.encode_raw(&mut v, &im, size, color); + b.iter(|| with.encode_bufvec(&mut v, image, size, color)); + }); + group.bench_with_input(BenchmarkId::new(format!("zero-{:?}-file", color), size), &im, |b, image| { + let file = File::create("temp.bmp").unwrap(); + b.iter(|| with.encode_file(&file, image, size, color)); + }); +} + +fn encode_definition(criterion: &mut Criterion, def: &BenchDef) { + let mut group = criterion.benchmark_group(format!("encode-{}", def.name)); + + for &color in def.colors { + for &size in def.sizes { + encode_zeroed(&mut group, def.with, size, color); + } + } +} + +struct Bmp; + +struct Jpeg; + +trait EncoderBase { + fn encode(&self, into: impl Write, im: &[u8], dims: u32, color: ColorType); +} + +impl Encoder for T { + fn encode_raw(&self, into: &mut Vec, im: &[u8], dims: u32, color: ColorType) { + into.clear(); + self.encode(into, im, dims, color); + } + + fn encode_bufvec(&self, into: &mut Vec, im: &[u8], dims: u32, color: ColorType) { + into.clear(); + let buf = BufWriter::new(into); + self.encode(buf, im, dims, color); + } + + fn encode_file(&self, mut file: &File, im: &[u8], dims: u32, color: ColorType) { + file.seek(SeekFrom::Start(0)).unwrap(); + let buf = BufWriter::new(file); + self.encode(buf, im, dims, color); + } +} + +impl EncoderBase for Bmp { + fn encode(&self, mut into: impl Write, im: &[u8], size: u32, color: ColorType) { + let mut x = BMPEncoder::new(&mut into); + x.encode(im, size, size, color).unwrap(); + } +} + +impl EncoderBase for Jpeg { + fn encode(&self, mut into: impl Write, im: &[u8], size: u32, color: ColorType) { + let mut x = JPEGEncoder::new(&mut into); + x.encode(im, size, size, color).unwrap(); + } +} diff --git a/third_party/cargo/vendor/image-0.23.1/docs/2019-04-23-memory-unsafety.md b/third_party/cargo/vendor/image-0.23.4/docs/2019-04-23-memory-unsafety.md similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/docs/2019-04-23-memory-unsafety.md rename to third_party/cargo/vendor/image-0.23.4/docs/2019-04-23-memory-unsafety.md diff --git a/third_party/cargo/vendor/image-0.23.1/release.sh b/third_party/cargo/vendor/image-0.23.4/release.sh similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/release.sh rename to third_party/cargo/vendor/image-0.23.4/release.sh diff --git a/third_party/cargo/vendor/image-0.23.1/src/animation.rs b/third_party/cargo/vendor/image-0.23.4/src/animation.rs similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/src/animation.rs rename to third_party/cargo/vendor/image-0.23.4/src/animation.rs index a10c0f6..33b8177 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/animation.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/animation.rs @@ -3,7 +3,7 @@ use std::time::Duration; use num_rational::Ratio; -use crate::buffer::RgbaImage; +use crate::RgbaImage; use crate::error::ImageResult; /// An implementation dependent iterator, reading the frames as requested diff --git a/third_party/cargo/vendor/image-0.23.1/src/bmp/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/bmp/decoder.rs similarity index 86% rename from third_party/cargo/vendor/image-0.23.1/src/bmp/decoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/bmp/decoder.rs index d7adf4f..95b1092 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/bmp/decoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/bmp/decoder.rs @@ -3,8 +3,8 @@ use std::io::{self, Cursor, Read, Seek, SeekFrom}; use std::iter::{repeat, Iterator, Rev}; use std::marker::PhantomData; use std::slice::ChunksMut; -use std::{cmp, mem}; -use std::cmp::Ordering; +use std::{error, fmt, mem}; +use std::cmp::{self, Ordering}; use byteorder::{LittleEndian, ReadBytesExt}; @@ -109,17 +109,131 @@ impl<'a> Iterator for RowIterator<'a> { } } +/// All errors that can occur when attempting to parse a BMP +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum DecoderError { + // We ran out of data while we still had rows to fill in. + RleDataTooShort, + + /// The bitfield mask interleaves set and unset bits + BitfieldMaskNonContiguous, + /// Bitfield mask invalid (e.g. too long for specified type) + BitfieldMaskInvalid, + /// Bitfield (of the specified width – 16- or 32-bit) mask not present + BitfieldMaskMissing(u32), + /// Bitfield (of the specified width – 16- or 32-bit) masks not present + BitfieldMasksMissing(u32), + + /// BMP's "BM" signature wrong or missing + BmpSignatureInvalid, + /// More than the exactly one allowed plane specified by the format + MoreThanOnePlane, + /// Invalid amount of bits per channel for the specified image type + InvalidChannelWidth(ChannelWidthError, u16), + + /// The width is negative + NegativeWidth(i32), + /// One of the dimensions is larger than a soft limit + ImageTooLarge(i32, i32), + /// The height is `i32::min_value()` + /// + /// General negative heights specify top-down DIBs + InvalidHeight, + + /// Specified image type is invalid for top-down BMPs (i.e. is compressed) + ImageTypeInvalidForTopDown(u32), + /// Image type not currently recognized by the decoder + ImageTypeUnknown(u32), + + /// Bitmap header smaller than the core header + HeaderTooSmall(u32), + + /// The palette is bigger than allowed by the bit count of the BMP + PaletteSizeExceeded { + colors_used: u32, + bit_count: u16, + } +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DecoderError::RleDataTooShort => + f.write_str("Not enough RLE data"), + DecoderError::BitfieldMaskNonContiguous => + f.write_str("Non-contiguous bitfield mask"), + DecoderError::BitfieldMaskInvalid => + f.write_str("Invalid bitfield mask"), + DecoderError::BitfieldMaskMissing(bb) => + f.write_fmt(format_args!("Missing {}-bit bitfield mask", bb)), + DecoderError::BitfieldMasksMissing(bb) => + f.write_fmt(format_args!("Missing {}-bit bitfield masks", bb)), + DecoderError::BmpSignatureInvalid => + f.write_str("BMP signature not found"), + DecoderError::MoreThanOnePlane => + f.write_str("More than one plane"), + DecoderError::InvalidChannelWidth(tp, n) => + f.write_fmt(format_args!("Invalid channel bit count for {}: {}", tp, n)), + DecoderError::NegativeWidth(w) => + f.write_fmt(format_args!("Negative width ({})", w)), + DecoderError::ImageTooLarge(w, h) => + f.write_fmt(format_args!("Image too large (one of ({}, {}) > soft limit of {})", w, h, MAX_WIDTH_HEIGHT)), + DecoderError::InvalidHeight => + f.write_str("Invalid height"), + DecoderError::ImageTypeInvalidForTopDown(tp) => + f.write_fmt(format_args!("Invalid image type {} for top-down image.", tp)), + DecoderError::ImageTypeUnknown(tp) => + f.write_fmt(format_args!("Unknown image compression type {}", tp)), + DecoderError::HeaderTooSmall(s) => + f.write_fmt(format_args!("Bitmap header too small ({} bytes)", s)), + DecoderError::PaletteSizeExceeded { colors_used, bit_count } => + f.write_fmt(format_args!("Palette size {} exceeds maximum size for BMP with bit count of {}", colors_used, bit_count)), + } + } +} + +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::Bmp.into(), e)) + } +} + +impl error::Error for DecoderError {} + +/// Distinct image types whose saved channel width can be invalid +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum ChannelWidthError { + /// RGB + Rgb, + /// 8-bit run length encoding + Rle8, + /// 4-bit run length encoding + Rle4, + /// Bitfields (16- or 32-bit) + Bitfields, +} + +impl fmt::Display for ChannelWidthError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(match self { + ChannelWidthError::Rgb => "RGB", + ChannelWidthError::Rle8 => "RLE8", + ChannelWidthError::Rle4 => "RLE4", + ChannelWidthError::Bitfields => "bitfields", + }) + } +} + /// Convenience function to check if the combination of width, length and number of /// channels would result in a buffer that would overflow. fn check_for_overflow(width: i32, length: i32, channels: usize) -> ImageResult<()> { num_bytes(width, length, channels) .map(|_| ()) - .ok_or_else(|| { - ImageError::Decoding(DecodingError::with_message( - ImageFormat::Png.into(), - "Image would require a buffer that is too large to be represented!".to_owned(), - )) - }) + .ok_or_else(|| + ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Bmp.into(), + UnsupportedErrorKind::GenericFeature(format!("Image dimensions ({}x{} w/{} channels) are too large", + width, length, channels))))) } /// Calculate how many many bytes a buffer holding a decoded image with these properties would @@ -370,16 +484,10 @@ impl Bitfield { let mut shift = mask.trailing_zeros(); let mut len = (!(mask >> shift)).trailing_zeros(); if len != mask.count_ones() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Non-contiguous bitfield mask".to_owned(), - ))); + return Err(DecoderError::BitfieldMaskNonContiguous.into()); } if len + shift > max_len { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid bitfield mask".to_owned(), - ))); + return Err(DecoderError::BitfieldMaskInvalid.into()); } if len > 8 { shift += len - 8; @@ -427,10 +535,7 @@ impl Bitfields { a: Bitfield::from_mask(a_mask, max_len)?, }; if bitfields.r.len == 0 || bitfields.g.len == 0 || bitfields.b.len == 0 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Missing bitfield mask".to_owned(), - ))); + return Err(DecoderError::BitfieldMaskMissing(max_len).into()); } Ok(bitfields) } @@ -588,10 +693,7 @@ impl BmpDecoder { self.reader.read_exact(&mut signature)?; if signature != b"BM"[..] { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "BMP signature not found".to_owned(), - ))); + return Err(DecoderError::BmpSignatureInvalid.into()); } // The next 8 bytes represent file size, followed the 4 reserved bytes @@ -617,22 +719,14 @@ impl BmpDecoder { // Number of planes (format specifies that this should be 1). if self.reader.read_u16::()? != 1 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "More than one plane".to_owned(), - ))); + return Err(DecoderError::MoreThanOnePlane.into()); } self.bit_count = self.reader.read_u16::()?; self.image_type = match self.bit_count { 1 | 4 | 8 => ImageType::Palette, 24 => ImageType::RGB24, - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid bit count".to_owned(), - ))) - } + _ => return Err(DecoderError::InvalidChannelWidth(ChannelWidthError::Rgb, self.bit_count).into()), }; Ok(()) @@ -648,24 +742,15 @@ impl BmpDecoder { // Width can not be negative if self.width < 0 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Negative width".to_owned(), - ))); + return Err(DecoderError::NegativeWidth(self.width).into()); } else if self.width > MAX_WIDTH_HEIGHT || self.height > MAX_WIDTH_HEIGHT { // Limit very large image sizes to avoid OOM issues. Images with these sizes are // unlikely to be valid anyhow. - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Image too large".to_owned(), - ))); + return Err(DecoderError::ImageTooLarge(self.width, self.height).into()); } if self.height == i32::min_value() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid height".to_owned(), - ))); + return Err(DecoderError::InvalidHeight.into()); } // A negative height indicates a top-down DIB. @@ -678,10 +763,7 @@ impl BmpDecoder { // Number of planes (format specifies that this should be 1). if self.reader.read_u16::()? != 1 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "More than one plane".to_owned(), - ))); + return Err(DecoderError::MoreThanOnePlane.into()); } self.bit_count = self.reader.read_u16::()?; @@ -689,10 +771,7 @@ impl BmpDecoder { // Top-down dibs can not be compressed. if self.top_down && image_type_u32 != 0 && image_type_u32 != 3 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid image type for top-down image.".to_owned(), - ))); + return Err(DecoderError::ImageTypeInvalidForTopDown(image_type_u32).into()); } self.image_type = match image_type_u32 { 0 => match self.bit_count { @@ -701,40 +780,20 @@ impl BmpDecoder { 24 => ImageType::RGB24, 32 if self.add_alpha_channel => ImageType::RGBA32, 32 => ImageType::RGB32, - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - format!("Invalid RGB bit count {}", self.bit_count), - ))) - } + _ => return Err(DecoderError::InvalidChannelWidth(ChannelWidthError::Rgb, self.bit_count).into()), }, 1 => match self.bit_count { 8 => ImageType::RLE8, - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid RLE8 bit count".to_owned(), - ))) - } + _ => return Err(DecoderError::InvalidChannelWidth(ChannelWidthError::Rle8, self.bit_count).into()), }, 2 => match self.bit_count { 4 => ImageType::RLE4, - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid RLE4 bit count".to_owned(), - ))) - } + _ => return Err(DecoderError::InvalidChannelWidth(ChannelWidthError::Rle4, self.bit_count).into()), }, 3 => match self.bit_count { 16 => ImageType::Bitfields16, 32 => ImageType::Bitfields32, - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Invalid bitfields bit count".to_owned(), - ))) - } + _ => return Err(DecoderError::InvalidChannelWidth(ChannelWidthError::Bitfields, self.bit_count).into()), }, 4 => { // JPEG compression is not implemented yet. @@ -765,10 +824,7 @@ impl BmpDecoder { } _ => { // Unknown compression type. - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - format!("Unknown image compression type {}", image_type_u32), - ))); + return Err(DecoderError::ImageTypeUnknown(image_type_u32).into()) } }; @@ -834,10 +890,7 @@ impl BmpDecoder { BITMAPV5HEADER_SIZE => BMPHeaderType::V5, _ if bmp_header_size < BITMAPCOREHEADER_SIZE => { // Size of any valid header types won't be smaller than core header type. - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Bitmap header is too small".to_owned(), - ))); + return Err(DecoderError::HeaderTooSmall(bmp_header_size).into()); } _ => { return Err(ImageError::Unsupported( @@ -905,13 +958,10 @@ impl BmpDecoder { 0 => Ok(1 << self.bit_count), _ => { if self.colors_used > 1 << self.bit_count { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - format!( - "Palette size {} exceeds maximum size for BMP with bit count of {}", - self.colors_used, self.bit_count - ), - ))); + return Err(DecoderError::PaletteSizeExceeded { + colors_used: self.colors_used, + bit_count: self.bit_count + }.into()); } Ok(self.colors_used as usize) } @@ -1169,10 +1219,10 @@ impl BmpDecoder { let full_image_size = num_bytes(self.width, self.height, self.num_channels()).ok_or_else(|| { - ImageError::Decoding(DecodingError::with_message( + ImageError::Unsupported(UnsupportedError::from_format_and_kind( ImageFormat::Bmp.into(), - "Image buffer would be too large!".to_owned(), - )) + UnsupportedErrorKind::GenericFeature(format!("Image dimensions ({}x{} w/{} channels) are too large", + self.width, self.height, self.num_channels())))) })?; let mut pixel_data = self.create_pixel_data(); let (skip_pixels, skip_rows, eof_hit) = @@ -1328,10 +1378,7 @@ impl BmpDecoder { } } else { // We ran out of data while we still had rows to fill in. - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Not enough RLE data".to_owned(), - ))); + return Err(DecoderError::RleDataTooShort.into()); } } } @@ -1352,20 +1399,14 @@ impl BmpDecoder { ImageType::RLE4 => self.read_rle_data(ImageType::RLE4), ImageType::Bitfields16 => match self.bitfields { Some(_) => self.read_16_bit_pixel_data(None), - None => Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Missing 16-bit bitfield masks".to_owned(), - ))), + None => Err(DecoderError::BitfieldMasksMissing(16).into()), }, ImageType::Bitfields32 => match self.bitfields { Some(R8_G8_B8_COLOR_MASK) => { self.read_full_byte_pixel_data(&FormatFullBytes::Format888) } Some(_) => self.read_32_bit_pixel_data(), - None => Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Bmp.into(), - "Missing 32-bit bitfield masks".to_owned(), - ))), + None => Err(DecoderError::BitfieldMasksMissing(32).into()), }, }?; @@ -1427,7 +1468,7 @@ impl<'a, R: 'a + Read + Seek> ImageDecoderExt<'a> for BmpDecoder { ) -> ImageResult<()> { let start = self.reader.seek(SeekFrom::Current(0))?; image::load_rect(x, y, width, height, buf, progress_callback, self, |_, _| unreachable!(), - |s, buf| { s.read_image_data(buf).map(|_| buf.len()) })?; + |s, buf| s.read_image_data(buf))?; self.reader.seek(SeekFrom::Start(start))?; Ok(()) } diff --git a/third_party/cargo/vendor/image-0.23.1/src/bmp/encoder.rs b/third_party/cargo/vendor/image-0.23.4/src/bmp/encoder.rs similarity index 83% rename from third_party/cargo/vendor/image-0.23.1/src/bmp/encoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/bmp/encoder.rs index 100658c..6979457 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/bmp/encoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/bmp/encoder.rs @@ -256,11 +256,6 @@ mod tests { use crate::image::ImageDecoder; use std::io::Cursor; - #[cfg(feature = "benchmarks")] - use test::{Bencher}; -// #[cfg(feature = "benchmarks")] -// use std::fs::File; - fn round_trip_image(image: &[u8], width: u32, height: u32, c: ColorType) -> Vec { let mut encoded_data = Vec::new(); { @@ -277,74 +272,6 @@ mod tests { buf } - #[cfg(feature = "benchmarks")] - #[bench] - fn bench_encode_rgb(b: &mut Bencher) { - let mut v= Vec::with_capacity(2000 * 2000); - let mut x = BMPEncoder::new(&mut v); - let mut im = vec![0; 2000 * 2000]; - b.iter(|| { - x.encode_rgb(&mut im, 500, 2000, 0, 4); - }); - } - - #[cfg(feature = "benchmarks")] - #[bench] - fn bench_encode_rgba(b: &mut Bencher) { - let mut v= Vec::with_capacity(2000 * 2000); - let mut x = BMPEncoder::new(&mut v); - let mut im = vec![0; 2000 * 2000]; - b.iter(|| { - x.encode_rgba(&mut im, 500, 2000, 0, 4); - }); - } - - #[cfg(feature = "benchmarks")] - #[bench] - fn bench_encode_gray(b: &mut Bencher) { - let mut v: Vec = Vec::with_capacity(2000 * 2000); - let mut x = BMPEncoder::new(& mut v); - let mut im = vec![0; 2000 * 2000]; - b.iter(|| { - x.encode_gray(&mut im, 500, 2000, 0, 4); - }); - } - - #[cfg(feature = "benchmarks")] - #[bench] - fn bench_encode_gray_buf(b: &mut Bencher) { - let mut u: Vec = Vec::with_capacity(2000 * 2000); - let mut v= BufWriter::new(&mut u); - let mut x = BMPEncoder::new(& mut v); - let mut im = vec![0; 2000 * 2000]; - b.iter(|| { - x.encode_gray(&mut im, 500, 2000, 0, 4); - }); - } - -// #[cfg(feature = "benchmarks")] -// #[bench] -// fn bench_encode_gray_buf_file(b: &mut Bencher) { -// let mut file = File::create("temp.bmp").unwrap(); -// let mut v= BufWriter::new(&mut file); -// let mut x = BMPEncoder::new(& mut v); -// let mut im = vec![0; 2000 * 2000]; -// b.iter(|| { -// x.encode_gray(&mut im, 500, 2000, 0, 4); -// }); -// } - -// #[cfg(feature = "benchmarks")] -// #[bench] -// fn bench_encode_gray_file(b: &mut Bencher) { -// let mut file = File::create("temp.bmp").unwrap(); -// let mut x = BMPEncoder::new(& mut file); -// let mut im = vec![0; 2000 * 2000]; -// b.iter(|| { -// x.encode_gray(&mut im, 500, 2000, 0, 4); -// }); -// } - #[test] fn round_trip_single_pixel_rgb() { let image = [255u8, 0, 0]; // single red pixel diff --git a/third_party/cargo/vendor/image-0.23.1/src/bmp/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/bmp/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/bmp/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/bmp/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/buffer.rs b/third_party/cargo/vendor/image-0.23.4/src/buffer.rs similarity index 86% rename from third_party/cargo/vendor/image-0.23.1/src/buffer.rs rename to third_party/cargo/vendor/image-0.23.4/src/buffer.rs index 051fb2a..8ef99f1 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/buffer.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/buffer.rs @@ -1,173 +1,19 @@ +//! Contains the generic `ImageBuffer` struct. use num_traits::Zero; use std::marker::PhantomData; use std::ops::{Deref, DerefMut, Index, IndexMut, Range}; use std::path::Path; use std::slice::{Chunks, ChunksMut}; -use crate::color::{ColorType, FromColor, Luma, LumaA, Rgb, Rgba, Bgr, Bgra}; +use crate::color::{FromColor, Luma, LumaA, Rgb, Rgba, Bgr, Bgra}; use crate::flat::{FlatSamples, SampleLayout}; use crate::dynimage::{save_buffer, save_buffer_with_format}; use crate::error::ImageResult; use crate::image::{GenericImage, GenericImageView, ImageFormat}; use crate::math::Rect; -use crate::traits::{EncodableLayout, Primitive}; +use crate::traits::{EncodableLayout, Pixel}; use crate::utils::expand_packed; -/// A generalized pixel. -/// -/// A pixel object is usually not used standalone but as a view into an image buffer. -pub trait Pixel: Copy + Clone { - /// The underlying subpixel type. - type Subpixel: Primitive; - - /// The number of channels of this pixel type. - const CHANNEL_COUNT: u8; - /// Returns the number of channels of this pixel type. - #[deprecated(note="please use CHANNEL_COUNT associated constant")] - fn channel_count() -> u8 { - Self::CHANNEL_COUNT - } - - /// Returns the components as a slice. - fn channels(&self) -> &[Self::Subpixel]; - - /// Returns the components as a mutable slice - fn channels_mut(&mut self) -> &mut [Self::Subpixel]; - - /// A string that can help to interpret the meaning each channel - /// See [gimp babl](http://gegl.org/babl/). - const COLOR_MODEL: &'static str; - /// Returns a string that can help to interpret the meaning each channel - /// See [gimp babl](http://gegl.org/babl/). - #[deprecated(note="please use COLOR_MODEL associated constant")] - fn color_model() -> &'static str { - Self::COLOR_MODEL - } - - /// ColorType for this pixel format - const COLOR_TYPE: ColorType; - /// Returns the ColorType for this pixel format - #[deprecated(note="please use COLOR_TYPE associated constant")] - fn color_type() -> ColorType { - Self::COLOR_TYPE - } - - /// Returns the channels of this pixel as a 4 tuple. If the pixel - /// has less than 4 channels the remainder is filled with the maximum value - /// - /// TODO deprecate - fn channels4( - &self, - ) -> ( - Self::Subpixel, - Self::Subpixel, - Self::Subpixel, - Self::Subpixel, - ); - - /// Construct a pixel from the 4 channels a, b, c and d. - /// If the pixel does not contain 4 channels the extra are ignored. - /// - /// TODO deprecate - fn from_channels( - a: Self::Subpixel, - b: Self::Subpixel, - c: Self::Subpixel, - d: Self::Subpixel, - ) -> Self; - - /// Returns a view into a slice. - /// - /// Note: The slice length is not checked on creation. Thus the caller has to ensure - /// that the slice is long enough to present panics if the pixel is used later on. - fn from_slice(slice: &[Self::Subpixel]) -> &Self; - - /// Returns mutable view into a mutable slice. - /// - /// Note: The slice length is not checked on creation. Thus the caller has to ensure - /// that the slice is long enough to present panics if the pixel is used later on. - fn from_slice_mut(slice: &mut [Self::Subpixel]) -> &mut Self; - - /// Convert this pixel to RGB - fn to_rgb(&self) -> Rgb; - - /// Convert this pixel to RGB with an alpha channel - fn to_rgba(&self) -> Rgba; - - /// Convert this pixel to luma - fn to_luma(&self) -> Luma; - - /// Convert this pixel to luma with an alpha channel - fn to_luma_alpha(&self) -> LumaA; - - /// Convert this pixel to BGR - fn to_bgr(&self) -> Bgr; - - /// Convert this pixel to BGR with an alpha channel - fn to_bgra(&self) -> Bgra; - - /// Apply the function ```f``` to each channel of this pixel. - fn map(&self, f: F) -> Self - where - F: FnMut(Self::Subpixel) -> Self::Subpixel; - - /// Apply the function ```f``` to each channel of this pixel. - fn apply(&mut self, f: F) - where - F: FnMut(Self::Subpixel) -> Self::Subpixel; - - /// Apply the function ```f``` to each channel except the alpha channel. - /// Apply the function ```g``` to the alpha channel. - fn map_with_alpha(&self, f: F, g: G) -> Self - where - F: FnMut(Self::Subpixel) -> Self::Subpixel, - G: FnMut(Self::Subpixel) -> Self::Subpixel; - - /// Apply the function ```f``` to each channel except the alpha channel. - /// Apply the function ```g``` to the alpha channel. Works in-place. - fn apply_with_alpha(&mut self, f: F, g: G) - where - F: FnMut(Self::Subpixel) -> Self::Subpixel, - G: FnMut(Self::Subpixel) -> Self::Subpixel; - - /// Apply the function ```f``` to each channel except the alpha channel. - fn map_without_alpha(&self, f: F) -> Self - where - F: FnMut(Self::Subpixel) -> Self::Subpixel, - { - let mut this = *self; - this.apply_with_alpha(f, |x| x); - this - } - - /// Apply the function ```f``` to each channel except the alpha channel. - /// Works in place. - fn apply_without_alpha(&mut self, f: F) - where - F: FnMut(Self::Subpixel) -> Self::Subpixel, - { - self.apply_with_alpha(f, |x| x); - } - - /// Apply the function ```f``` to each channel of this pixel and - /// ```other``` pairwise. - fn map2(&self, other: &Self, f: F) -> Self - where - F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel; - - /// Apply the function ```f``` to each channel of this pixel and - /// ```other``` pairwise. Works in-place. - fn apply2(&mut self, other: &Self, f: F) - where - F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel; - - /// Invert this pixel - fn invert(&mut self); - - /// Blend the color of a given pixel into ourself, taking into account alpha channels - fn blend(&mut self, other: &Self); -} - /// Iterate over pixel refs. pub struct Pixels<'a, P: Pixel + 'a> where @@ -497,6 +343,54 @@ where } /// Generic image buffer +/// +/// This is an image parameterised by its Pixel types, represented by a width and height and a +/// container of channel data. It provides direct access to its pixels and implements the +/// [`GenericImageView`] and [`GenericImage`] traits. In many ways, this is the standard buffer +/// implementing those traits. Using this concrete type instead of a generic type parameter has +/// been shown to improve performance. +/// +/// The crate defines a few type aliases with regularly used pixel types for your convenience, such +/// as `RgbImage`, `GrayImage` etc. +/// +/// [`GenericImage`]: trait.GenericImage.html +/// [`GenericImageView`]: trait.GenericImageView.html +/// [`RgbImage`]: type.RgbImage.html +/// [`GrayImage`]: type.GrayImage.html +/// +/// ## Examples +/// +/// Create a simple canvas and paint a small cross. +/// +/// ``` +/// use image::{RgbImage, Rgb}; +/// +/// let mut img = RgbImage::new(32, 32); +/// +/// for x in 15..=17 { +/// for y in 8..24 { +/// img.put_pixel(x, y, Rgb([255, 0, 0])); +/// img.put_pixel(y, x, Rgb([255, 0, 0])); +/// } +/// } +/// ``` +/// +/// Overlays an image on top of a larger background raster. +/// +/// ```no_run +/// use image::{GenericImage, GenericImageView, ImageBuffer, open}; +/// +/// let on_top = open("path/to/some.png").unwrap().into_rgb(); +/// let mut img = ImageBuffer::from_fn(512, 512, |x, y| { +/// if (x + y) % 2 == 0 { +/// image::Rgb([0, 0, 0]) +/// } else { +/// image::Rgb([255, 255, 255]) +/// } +/// }); +/// +/// image::imageops::overlay(&mut img, &on_top, 128, 128); +/// ``` #[derive(Debug)] pub struct ImageBuffer { width: u32, diff --git a/third_party/cargo/vendor/image-0.23.1/src/color.rs b/third_party/cargo/vendor/image-0.23.4/src/color.rs similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/src/color.rs rename to third_party/cargo/vendor/image-0.23.4/src/color.rs index 63fd9fb..e12bdb7 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/color.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/color.rs @@ -1,8 +1,7 @@ use num_traits::{NumCast, ToPrimitive, Zero}; use std::ops::{Index, IndexMut}; -use crate::buffer::Pixel; -use crate::traits::Primitive; +use crate::traits::{Pixel, Primitive}; /// An enumeration over supported color types and bit depths #[derive(Copy, PartialEq, Eq, Debug, Clone, Hash)] @@ -48,6 +47,16 @@ impl ColorType { } } + /// Returns if there is an alpha channel. + pub fn has_alpha(self) -> bool { + use ColorType::*; + match self { + L8 | L16 | Rgb8 | Bgr8 | Rgb16 => false, + La8 | Rgba8 | Bgra8 | La16 | Rgba16 => true, + __NonExhaustive(marker) => match marker._private {}, + } + } + /// Returns the number of bits contained in a pixel of `ColorType` ```c``` (which will always be /// a multiple of 8). pub fn bits_per_pixel(self) -> u16 { diff --git a/third_party/cargo/vendor/image-0.23.1/src/dds.rs b/third_party/cargo/vendor/image-0.23.4/src/dds.rs similarity index 73% rename from third_party/cargo/vendor/image-0.23.1/src/dds.rs rename to third_party/cargo/vendor/image-0.23.4/src/dds.rs index acea6fc..b1b4e8d 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/dds.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/dds.rs @@ -5,6 +5,7 @@ //! # Related Links //! * - Description of the DDS format. +use std::{error, fmt}; use std::io::Read; use byteorder::{LittleEndian, ReadBytesExt}; @@ -12,10 +13,47 @@ use byteorder::{LittleEndian, ReadBytesExt}; use crate::color::ColorType; use crate::dxt::{DxtDecoder, DXTReader, DXTVariant}; use crate::error::{ - DecodingError, ImageError, ImageResult, UnsupportedError, UnsupportedErrorKind, + DecodingError, ImageError, ImageFormatHint, ImageResult, UnsupportedError, UnsupportedErrorKind, }; use crate::image::{ImageDecoder, ImageFormat}; +/// Errors that can occur during decoding and parsing a DDS image +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum DecoderError { + /// Wrong DDS channel width + PixelFormatSizeInvalid(u32), + /// Wrong DDS header size + HeaderSizeInvalid(u32), + /// Wrong DDS header flags + HeaderFlagsInvalid(u32), + + /// DDS "DDS " signature invalid or missing + DdsSignatureInvalid, +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DecoderError::PixelFormatSizeInvalid(s) => + f.write_fmt(format_args!("Invalid DDS PixelFormat size: {}", s)), + DecoderError::HeaderSizeInvalid(s) => + f.write_fmt(format_args!("Invalid DDS header size: {}", s)), + DecoderError::HeaderFlagsInvalid(fs) => + f.write_fmt(format_args!("Invalid DDS header flags: {:#010X}", fs)), + DecoderError::DdsSignatureInvalid => + f.write_str("DDS signature not found"), + } + } +} + +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::Dds.into(), e)) + } +} + +impl error::Error for DecoderError {} + /// Header used by DDS image files #[derive(Debug)] struct Header { @@ -46,10 +84,7 @@ impl PixelFormat { fn from_reader(r: &mut dyn Read) -> ImageResult { let size = r.read_u32::()?; if size != 32 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Dds.into(), - "Invalid DDS PixelFormat size".to_string(), - ))); + return Err(DecoderError::PixelFormatSizeInvalid(size).into()); } Ok(Self { @@ -72,20 +107,14 @@ impl Header { fn from_reader(r: &mut dyn Read) -> ImageResult { let size = r.read_u32::()?; if size != 124 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Dds.into(), - "Invalid DDS header size".to_string(), - ))); + return Err(DecoderError::HeaderSizeInvalid(size).into()); } const REQUIRED_FLAGS: u32 = 0x1 | 0x2 | 0x4 | 0x1000; const VALID_FLAGS: u32 = 0x1 | 0x2 | 0x4 | 0x8 | 0x1000 | 0x20000 | 0x80000 | 0x800000; let flags = r.read_u32::()?; if flags & (REQUIRED_FLAGS | !VALID_FLAGS) != REQUIRED_FLAGS { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Dds.into(), - "Invalid DDS header flags".to_string(), - ))); + return Err(DecoderError::HeaderFlagsInvalid(flags).into()); } let height = r.read_u32::()?; @@ -133,10 +162,7 @@ impl DdsDecoder { let mut magic = [0; 4]; r.read_exact(&mut magic)?; if magic != b"DDS "[..] { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Dds.into(), - "DDS signature not found".to_string(), - ))); + return Err(DecoderError::DdsSignatureInvalid.into()); } let header = Header::from_reader(&mut r)?; @@ -150,10 +176,7 @@ impl DdsDecoder { return Err(ImageError::Unsupported( UnsupportedError::from_format_and_kind( ImageFormat::Dds.into(), - UnsupportedErrorKind::GenericFeature(format!( - "Unsupported DDS FourCC {:?}", - fourcc - )), + UnsupportedErrorKind::GenericFeature(format!("DDS FourCC {:?}", fourcc)), ), )) } @@ -165,7 +188,7 @@ impl DdsDecoder { Err(ImageError::Unsupported( UnsupportedError::from_format_and_kind( ImageFormat::Dds.into(), - UnsupportedErrorKind::GenericFeature("DDS format not supported".to_string()), + UnsupportedErrorKind::Format(ImageFormatHint::Name("DDS".to_string())), ), )) } diff --git a/third_party/cargo/vendor/image-0.23.1/src/dxt.rs b/third_party/cargo/vendor/image-0.23.4/src/dxt.rs similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/src/dxt.rs rename to third_party/cargo/vendor/image-0.23.4/src/dxt.rs index a4684e5..bf21fc6 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/dxt.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/dxt.rs @@ -165,7 +165,7 @@ impl<'a, R: 'a + Read + Seek> ImageDecoderExt<'a> for DxtDecoder { s.inner.seek(SeekFrom::Start(start + scanline * encoded_scanline_bytes))?; Ok(()) }, - |s, buf| s.read_scanline(buf))?; + |s, buf| s.read_scanline(buf).map(|_| ()))?; self.inner.seek(SeekFrom::Start(start))?; Ok(()) } diff --git a/third_party/cargo/vendor/image-0.23.1/src/dynimage.rs b/third_party/cargo/vendor/image-0.23.4/src/dynimage.rs similarity index 96% rename from third_party/cargo/vendor/image-0.23.1/src/dynimage.rs rename to third_party/cargo/vendor/image-0.23.4/src/dynimage.rs index 141de48..e4edbe5 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/dynimage.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/dynimage.rs @@ -15,19 +15,24 @@ use crate::jpeg; use crate::png; #[cfg(feature = "pnm")] use crate::pnm; +#[cfg(feature = "farbfeld")] +use crate::farbfeld; -use crate::buffer::{ +use crate::buffer_::{ BgrImage, BgraImage, ConvertBuffer, GrayAlphaImage, GrayAlpha16Image, - GrayImage, Gray16Image, ImageBuffer, Pixel, RgbImage, Rgb16Image, - RgbaImage, Rgba16Image, + GrayImage, Gray16Image, ImageBuffer, RgbImage, Rgb16Image, RgbaImage, + Rgba16Image, }; use crate::color::{self, IntoColor}; -use crate::error::{ImageError, ImageResult}; +use crate::error::{ImageError, ImageFormatHint, ImageResult, ParameterError, ParameterErrorKind, UnsupportedError, UnsupportedErrorKind}; use crate::flat::FlatSamples; use crate::image; use crate::image::{GenericImage, GenericImageView, ImageDecoder, ImageFormat, ImageOutputFormat}; +#[cfg(feature = "farbfeld")] +use crate::image::ImageEncoder; use crate::io::free_functions; use crate::imageops; +use crate::traits::Pixel; /// A Dynamic Image #[derive(Clone)] @@ -293,11 +298,19 @@ impl DynamicImage { } } - /// Return a cut out of this image delimited by the bounding rectangle. + /// Return a cut-out of this image delimited by the bounding rectangle. + /// + /// Note: this method does *not* modify the object, + /// and its signature will be replaced with `crop_imm()`'s in the 0.24 release pub fn crop(&mut self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage { dynamic_map!(*self, ref mut p => imageops::crop(p, x, y, width, height).to_image()) } + /// Return a cut-out of this image delimited by the bounding rectangle. + pub fn crop_imm(&self, x: u32, y: u32, width: u32, height: u32) -> DynamicImage { + dynamic_map!(*self, ref p => imageops::crop_imm(p, x, y, width, height).to_image()) + } + /// Return a reference to an 8bit RGB image pub fn as_rgb8(&self) -> Option<&RgbImage> { match *self { @@ -747,8 +760,15 @@ impl DynamicImage { Ok(()) } + #[cfg(feature = "farbfeld")] + image::ImageOutputFormat::Farbfeld => { + farbfeld::FarbfeldEncoder::new(w).write_image(&bytes, width, height, color) + } + image::ImageOutputFormat::Unsupported(msg) => { - Err(ImageError::UnsupportedError(msg)) + Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormatHint::Unknown, + UnsupportedErrorKind::Format(ImageFormatHint::Name(msg))))) }, image::ImageOutputFormat::__NonExhaustive(marker) => match marker._private {}, @@ -902,11 +922,16 @@ fn decoder_to_image<'a, I: ImageDecoder<'a>>(decoder: I) -> ImageResult return Err(ImageError::UnsupportedColor(color_type.into())), + _ => return Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormatHint::Unknown, + UnsupportedErrorKind::Color(color_type.into()), + ))), }; match image { Some(image) => Ok(image), - None => Err(ImageError::DimensionError), + None => Err(ImageError::Parameter( + ParameterError::from_kind(ParameterErrorKind::DimensionMismatch) + )) } } diff --git a/third_party/cargo/vendor/image-0.23.1/src/error.rs b/third_party/cargo/vendor/image-0.23.4/src/error.rs similarity index 85% rename from third_party/cargo/vendor/image-0.23.1/src/error.rs rename to third_party/cargo/vendor/image-0.23.4/src/error.rs index 11faeeb..33192f2 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/error.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/error.rs @@ -141,7 +141,6 @@ pub enum ParameterErrorKind { #[derive(Debug)] pub struct DecodingError { format: ImageFormatHint, - message: Option>, underlying: Option>, } @@ -192,37 +191,6 @@ pub enum ImageFormatHint { __NonExhaustive(NonExhaustiveMarker), } -// Internal implementation block for ImageError. -#[allow(non_upper_case_globals)] -#[allow(non_snake_case)] -impl ImageError { - pub(crate) const InsufficientMemory: Self = - ImageError::Limits(LimitError { - kind: LimitErrorKind::InsufficientMemory, - }); - - pub(crate) const DimensionError: Self = - ImageError::Parameter(ParameterError { - kind: ParameterErrorKind::DimensionMismatch, - underlying: None, - }); - - pub(crate) fn UnsupportedError(message: String) -> Self { - ImageError::Unsupported(UnsupportedError::legacy_from_string(message)) - } - - pub(crate) fn UnsupportedColor(color: ExtendedColorType) -> Self { - ImageError::Unsupported(UnsupportedError::from_format_and_kind( - ImageFormatHint::Unknown, - UnsupportedErrorKind::Color(color), - )) - } - - pub(crate) fn FormatError(message: String) -> Self { - ImageError::Decoding(DecodingError::legacy_from_string(message)) - } -} - impl UnsupportedError { /// Create an `UnsupportedError` for an image with details on the unsupported feature. /// @@ -235,14 +203,6 @@ impl UnsupportedError { } } - /// A shorthand for a generic feature without an image format. - pub(crate) fn legacy_from_string(message: String) -> Self { - UnsupportedError { - format: ImageFormatHint::Unknown, - kind: UnsupportedErrorKind::GenericFeature(message), - } - } - /// Returns the corresponding `UnsupportedErrorKind` of the error. pub fn kind(&self) -> UnsupportedErrorKind { self.kind.clone() @@ -262,7 +222,6 @@ impl DecodingError { ) -> Self { DecodingError { format, - message: None, underlying: Some(err.into()), } } @@ -273,7 +232,6 @@ impl DecodingError { pub fn from_format_hint(format: ImageFormatHint) -> Self { DecodingError { format, - message: None, underlying: None, } } @@ -282,36 +240,6 @@ impl DecodingError { pub fn format_hint(&self) -> ImageFormatHint { self.format.clone() } - - /// A shorthand for a string error without an image format. - pub(crate) fn legacy_from_string(message: String) -> Self { - DecodingError { - format: ImageFormatHint::Unknown, - message: Some(message.into_boxed_str()), - underlying: None, - } - } - - /// Not quite legacy but also highly discouraged. - /// This is just since the string typing is prevalent in the `image` decoders... - // TODO: maybe a Cow? A constructor from `&'static str` wouldn't be too bad. - pub(crate) fn with_message( - format: ImageFormatHint, - message: String, - ) -> Self { - DecodingError { - format, - message: Some(message.into_boxed_str()), - underlying: None, - } - } - - fn get_message_or_default(&self) -> &str { - match &self.message { - Some(st) => st, - None => "", - } - } } impl EncodingError { @@ -326,7 +254,7 @@ impl EncodingError { } } - /// Create a `DecodingError` for an image format. + /// Create an `EncodingError` for an image format. /// /// The error will not contain any further information but is very easy to create. pub fn from_format_hint(format: ImageFormatHint) -> Self { @@ -547,25 +475,10 @@ impl fmt::Display for DecodingError { fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> { match &self.underlying { None => match self.format { - ImageFormatHint::Unknown => write!( - fmt, - "Format error: {}", - self.get_message_or_default(), - ), - _ => write!( - fmt, - "Format error decoding {}: {}", - self.format, - self.get_message_or_default(), - ), + ImageFormatHint::Unknown => write!(fmt, "Format error"), + _ => write!(fmt, "Format error decoding {}", self.format), }, - Some(underlying) => write!( - fmt, - "Format error decoding {}: {}\n{}", - self.format, - self.get_message_or_default(), - underlying, - ), + Some(underlying) => write!(fmt, "Format error decoding {}: {}", self.format, underlying), } } } diff --git a/third_party/cargo/vendor/image-0.23.4/src/farbfeld.rs b/third_party/cargo/vendor/image-0.23.4/src/farbfeld.rs new file mode 100644 index 0000000..0e1e252 --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/src/farbfeld.rs @@ -0,0 +1,353 @@ +//! Decoding of farbfeld images +//! +//! farbfeld is a lossless image format which is easy to parse, pipe and compress. +//! +//! It has the following format: +//! +//! | Bytes | Description | +//! |--------|---------------------------------------------------------| +//! | 8 | "farbfeld" magic value | +//! | 4 | 32-Bit BE unsigned integer (width) | +//! | 4 | 32-Bit BE unsigned integer (height) | +//! | [2222] | 4⋅16-Bit BE unsigned integers [RGBA] / pixel, row-major | +//! +//! The RGB-data should be sRGB for best interoperability and not alpha-premultiplied. +//! +//! # Related Links +//! * - the farbfeld specification + +use std::convert::TryFrom; +use std::i64; +use std::io::{self, Seek, SeekFrom, Read, Write, BufReader, BufWriter}; + +use byteorder::{BigEndian, ByteOrder, NativeEndian}; + +use crate::color::ColorType; +use crate::error::{EncodingError, DecodingError, ImageError, ImageResult, UnsupportedError, UnsupportedErrorKind}; +use crate::image::{self, ImageDecoder, ImageDecoderExt, ImageEncoder, ImageFormat, Progress}; + +/// farbfeld Reader +pub struct FarbfeldReader { + width: u32, + height: u32, + inner: BufReader, + /// Relative to the start of the pixel data + current_offset: u64, + cached_byte: Option, +} + +impl FarbfeldReader { + fn new(reader: R) -> ImageResult> { + fn read_dimm(from: &mut R) -> ImageResult { + let mut buf = [0u8; 4]; + from.read_exact(&mut buf).map_err(|err| + ImageError::Decoding(DecodingError::new( + ImageFormat::Farbfeld.into(), + err, + )))?; + Ok(BigEndian::read_u32(&buf)) + } + + let mut inner = BufReader::new(reader); + + let mut magic = [0u8; 8]; + inner.read_exact(&mut magic).map_err(|err| + ImageError::Decoding(DecodingError::new( + ImageFormat::Farbfeld.into(), + err, + )))?; + if &magic != b"farbfeld" { + return Err(ImageError::Decoding(DecodingError::new( + ImageFormat::Farbfeld.into(), + format!("Invalid magic: {:02x?}", magic), + ))); + } + + Ok(FarbfeldReader { + width: read_dimm(&mut inner)?, + height: read_dimm(&mut inner)?, + inner, + current_offset: 0, + cached_byte: None, + }) + } +} + +impl Read for FarbfeldReader { + fn read(&mut self, mut buf: &mut [u8]) -> io::Result { + let mut bytes_written = 0; + if let Some(byte) = self.cached_byte.take() { + buf[0] = byte; + buf = &mut buf[1..]; + bytes_written = 1; + self.current_offset += 1; + } + + if buf.len() == 1 { + buf[0] = cache_byte(&mut self.inner, &mut self.cached_byte)?; + bytes_written += 1; + self.current_offset += 1; + } else { + for channel_out in buf.chunks_exact_mut(2) { + consume_channel(&mut self.inner, channel_out)?; + bytes_written += 2; + self.current_offset += 2; + } + } + + Ok(bytes_written) + } +} + +impl Seek for FarbfeldReader { + fn seek(&mut self, pos: SeekFrom) -> io::Result { + fn parse_offset(original_offset: u64, end_offset: u64, pos: SeekFrom) -> Option { + match pos { + SeekFrom::Start(off) => + i64::try_from(off).ok()?.checked_sub(i64::try_from(original_offset).ok()?), + SeekFrom::End(off) => + if off < i64::try_from(end_offset).unwrap_or(i64::MAX) { + None + } else { + Some(i64::try_from(end_offset.checked_sub(original_offset)?).ok()? + off) + }, + SeekFrom::Current(off) => + if off < i64::try_from(original_offset).unwrap_or(i64::MAX) { + None + } else { + Some(off) + }, + } + } + + let original_offset = self.current_offset; + let end_offset = self.width as u64 * self.height as u64 * 2; + let offset_from_current = parse_offset(original_offset, end_offset, pos) + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "invalid seek to a negative or overflowing position"))?; + + // TODO: convert to seek_relative() once that gets stabilised + self.inner.seek(SeekFrom::Current(offset_from_current))?; + self.current_offset = if offset_from_current < 0 { + original_offset.checked_sub(offset_from_current.wrapping_neg() as u64) + } else { + original_offset.checked_add(offset_from_current as u64) + }.expect("This should've been checked above"); + + if self.current_offset < end_offset && self.current_offset % 2 == 1 { + let curr = self.inner.seek(SeekFrom::Current(-1))?; + cache_byte(&mut self.inner, &mut self.cached_byte)?; + self.inner.seek(SeekFrom::Start(curr))?; + } else { + self.cached_byte = None; + } + + Ok(original_offset) + } +} + +fn consume_channel(from: &mut R, to: &mut [u8]) -> io::Result<()> { + let mut ibuf = [0u8; 2]; + from.read_exact(&mut ibuf)?; + NativeEndian::write_u16(to, BigEndian::read_u16(&ibuf)); + Ok(()) +} + +fn cache_byte(from: &mut R, cached_byte: &mut Option) -> io::Result { + let mut obuf = [0u8; 2]; + consume_channel(from, &mut obuf)?; + *cached_byte = Some(obuf[1]); + Ok(obuf[0]) +} + +/// farbfeld decoder +pub struct FarbfeldDecoder { + reader: FarbfeldReader, +} + +impl FarbfeldDecoder { + /// Creates a new decoder that decodes from the stream ```r``` + pub fn new(r: R) -> ImageResult> { + Ok(FarbfeldDecoder { reader: FarbfeldReader::new(r)? }) + } +} + +impl<'a, R: 'a + Read> ImageDecoder<'a> for FarbfeldDecoder { + type Reader = FarbfeldReader; + + fn dimensions(&self) -> (u32, u32) { + (self.reader.width, self.reader.height) + } + + fn color_type(&self) -> ColorType { + ColorType::Rgba16 + } + + fn into_reader(self) -> ImageResult { + Ok(self.reader) + } + + fn scanline_bytes(&self) -> u64 { + 2 + } +} + +impl<'a, R: 'a + Read + Seek> ImageDecoderExt<'a> for FarbfeldDecoder { + fn read_rect_with_progress( + &mut self, + x: u32, + y: u32, + width: u32, + height: u32, + buf: &mut [u8], + progress_callback: F, + ) -> ImageResult<()> { + // A "scanline" (defined as "shortest non-caching read" in the doc) is just one channel in this case + + let start = self.reader.seek(SeekFrom::Current(0))?; + image::load_rect(x, y, width, height, buf, progress_callback, self, + |s, scanline| s.reader.seek(SeekFrom::Start(scanline * 2)).map(|_| ()), + |s, buf| s.reader.read_exact(buf))?; + self.reader.seek(SeekFrom::Start(start))?; + Ok(()) + } +} + +/// farbfeld encoder +pub struct FarbfeldEncoder { + w: BufWriter, +} + +impl FarbfeldEncoder { + /// Create a new encoder that writes its output to ```w``` + pub fn new(w: W) -> FarbfeldEncoder { + FarbfeldEncoder { w: BufWriter::new(w) } + } + + /// Encodes the image ```data``` (native endian) + /// that has dimensions ```width``` and ```height``` + pub fn encode(self, data: &[u8], width: u32, height: u32) -> ImageResult<()> { + self.encode_impl(data, width, height).map_err(|err| + ImageError::Encoding(EncodingError::new( + ImageFormat::Farbfeld.into(), + err, + ))) + } + + fn encode_impl(mut self, data: &[u8], width: u32, height: u32) -> io::Result<()> { + self.w.write_all(b"farbfeld")?; + + let mut buf = [0u8; 4]; + BigEndian::write_u32(&mut buf, width); + self.w.write_all(&buf)?; + + BigEndian::write_u32(&mut buf, height); + self.w.write_all(&buf)?; + + for channel in data.chunks_exact(2) { + BigEndian::write_u16(&mut buf, NativeEndian::read_u16(channel)); + self.w.write_all(&buf[..2])?; + } + + Ok(()) + } +} + +impl ImageEncoder for FarbfeldEncoder { + fn write_image( + self, + buf: &[u8], + width: u32, + height: u32, + color_type: ColorType, + ) -> ImageResult<()> { + if color_type != ColorType::Rgba16 { + return Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Farbfeld.into(), + UnsupportedErrorKind::Color(color_type.into()), + ))); + } + + self.encode(buf, width, height) + } +} + +#[cfg(test)] +mod tests { + use crate::farbfeld::FarbfeldDecoder; + use crate::ImageDecoderExt; + use std::io::{Cursor, Seek, SeekFrom}; + use byteorder::{ByteOrder, NativeEndian}; + + static RECTANGLE_IN: &[u8] = b"farbfeld\ + \x00\x00\x00\x02\x00\x00\x00\x03\ + \xFF\x01\xFE\x02\xFD\x03\xFC\x04\xFB\x05\xFA\x06\xF9\x07\xF8\x08\ + \xF7\x09\xF6\x0A\xF5\x0B\xF4\x0C\xF3\x0D\xF2\x0E\xF1\x0F\xF0\x10\ + \xEF\x11\xEE\x12\xED\x13\xEC\x14\xEB\x15\xEA\x16\xE9\x17\xE8\x18"; + + #[test] + fn read_rect_1x2() { + static RECTANGLE_OUT: &[u16] = &[0xF30D, 0xF20E, 0xF10F, 0xF010, + 0xEB15, 0xEA16, 0xE917, 0xE818]; + + read_rect(1, 1, 1, 2, RECTANGLE_OUT); + } + + #[test] + fn read_rect_2x2() { + static RECTANGLE_OUT: &[u16] = &[0xFF01, 0xFE02, 0xFD03, 0xFC04, 0xFB05, 0xFA06, 0xF907, 0xF808, + 0xF709, 0xF60A, 0xF50B, 0xF40C, 0xF30D, 0xF20E, 0xF10F, 0xF010]; + + read_rect(0, 0, 2, 2, RECTANGLE_OUT); + } + + #[test] + fn read_rect_2x1() { + static RECTANGLE_OUT: &[u16] = &[0xEF11, 0xEE12, 0xED13, 0xEC14, 0xEB15, 0xEA16, 0xE917, 0xE818]; + + read_rect(0, 2, 2, 1, RECTANGLE_OUT); + } + + #[test] + fn read_rect_2x3() { + static RECTANGLE_OUT: &[u16] = &[0xFF01, 0xFE02, 0xFD03, 0xFC04, 0xFB05, 0xFA06, 0xF907, 0xF808, + 0xF709, 0xF60A, 0xF50B, 0xF40C, 0xF30D, 0xF20E, 0xF10F, 0xF010, + 0xEF11, 0xEE12, 0xED13, 0xEC14, 0xEB15, 0xEA16, 0xE917, 0xE818]; + + read_rect(0, 0, 2, 3, RECTANGLE_OUT); + } + + #[test] + fn read_rect_in_stream() { + static RECTANGLE_OUT: &[u16] = &[0xEF11, 0xEE12, 0xED13, 0xEC14]; + + let mut input = vec![]; + input.extend_from_slice(b"This is a 31-byte-long prologue"); + input.extend_from_slice(RECTANGLE_IN); + let mut input_cur = Cursor::new(input); + input_cur.seek(SeekFrom::Start(31)).unwrap(); + + let mut out_buf = [0u8; 64]; + FarbfeldDecoder::new(input_cur) + .unwrap() + .read_rect(0, 2, 1, 1, &mut out_buf) + .unwrap(); + let exp = degenerate_pixels(RECTANGLE_OUT); + assert_eq!(&out_buf[..exp.len()], &exp[..]); + } + + fn read_rect(x: u32, y: u32, width: u32, height: u32, exp_wide: &[u16]) { + let mut out_buf = [0u8; 64]; + FarbfeldDecoder::new(Cursor::new(RECTANGLE_IN)) + .unwrap() + .read_rect(x, y, width, height, &mut out_buf) + .unwrap(); + let exp = degenerate_pixels(exp_wide); + assert_eq!(&out_buf[..exp.len()], &exp[..]); + } + + fn degenerate_pixels(exp_wide: &[u16]) -> Vec { + let mut exp = vec![0u8; exp_wide.len() * 2]; + NativeEndian::write_u16_into(exp_wide, &mut exp); + exp + } +} diff --git a/third_party/cargo/vendor/image-0.23.1/src/flat.rs b/third_party/cargo/vendor/image-0.23.4/src/flat.rs similarity index 98% rename from third_party/cargo/vendor/image-0.23.1/src/flat.rs rename to third_party/cargo/vendor/image-0.23.4/src/flat.rs index 6df7889..5c22b67 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/flat.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/flat.rs @@ -41,16 +41,17 @@ //! } //! ``` //! -use std::cmp; +use std::{cmp, error, fmt}; use std::ops::{Deref, Index, IndexMut}; use std::marker::PhantomData; use num_traits::Zero; -use crate::buffer::{ImageBuffer, Pixel}; +use crate::ImageBuffer; use crate::color::ColorType; -use crate::error::ImageError; +use crate::error::{ImageError, ImageFormatHint, DecodingError, ParameterError, ParameterErrorKind, UnsupportedError, UnsupportedErrorKind}; use crate::image::{GenericImage, GenericImageView}; +use crate::traits::Pixel; /// A flat buffer over a (multi channel) image. /// @@ -1374,11 +1375,23 @@ impl GenericImage for ViewMut impl From for ImageError { fn from(error: Error) -> ImageError { + #[derive(Debug)] + struct NormalFormRequiredError(NormalForm); + impl fmt::Display for NormalFormRequiredError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "Required sample buffer in normal form {:?}", self.0) + } + } + impl error::Error for NormalFormRequiredError {} + match error { - Error::TooLarge => ImageError::DimensionError, - Error::WrongColor(color) => ImageError::UnsupportedColor(color.into()), - Error::NormalFormRequired(form) => ImageError::FormatError( - format!("Required sample buffer in normal form {:?}", form)), + Error::TooLarge => ImageError::Parameter(ParameterError::from_kind(ParameterErrorKind::DimensionMismatch)), + Error::NormalFormRequired(form) => ImageError::Decoding(DecodingError::new( + ImageFormatHint::Unknown, + NormalFormRequiredError(form))), + Error::WrongColor(color) => ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormatHint::Unknown, + UnsupportedErrorKind::Color(color.into()))), } } } @@ -1419,7 +1432,7 @@ impl PartialOrd for NormalForm { #[cfg(test)] mod tests { use super::*; - use crate::buffer::GrayAlphaImage; + use crate::buffer_::GrayAlphaImage; use crate::color::{LumaA, Rgb}; #[test] diff --git a/third_party/cargo/vendor/image-0.23.1/src/gif.rs b/third_party/cargo/vendor/image-0.23.4/src/gif.rs similarity index 71% rename from third_party/cargo/vendor/image-0.23.1/src/gif.rs rename to third_party/cargo/vendor/image-0.23.4/src/gif.rs index dc6b7e9..579aeeb 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/gif.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/gif.rs @@ -26,9 +26,7 @@ //! ``` #![allow(clippy::while_let_loop)] -use std::clone::Clone; use std::convert::TryInto; -use std::cmp::min; use std::convert::TryFrom; use std::io::{self, Cursor, Read, Write}; use std::marker::PhantomData; @@ -39,10 +37,11 @@ use gif::{DisposalMethod, Frame}; use num_rational::Ratio; use crate::animation; -use crate::buffer::{ImageBuffer, Pixel}; +use crate::ImageBuffer; use crate::color::{ColorType, Rgba}; -use crate::error::{ImageError, ImageResult, ParameterError, ParameterErrorKind}; -use crate::image::{self, AnimationDecoder, ImageDecoder}; +use crate::error::{DecodingError, ImageError, ImageResult, ParameterError, ParameterErrorKind, UnsupportedError, UnsupportedErrorKind}; +use crate::image::{self, AnimationDecoder, ImageDecoder, ImageFormat}; +use crate::traits::Pixel; /// GIF decoder pub struct GifDecoder { @@ -124,8 +123,9 @@ impl<'a, R: 'a + Read> ImageDecoder<'a> for GifDecoder { // See the comments inside `::next` about // the error handling of `from_raw`. let image = ImageBuffer::from_raw(f_width, f_height, &mut *buf).ok_or_else( - || ImageError::UnsupportedError("Image dimensions are too large".into()) - )?; + || ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Gif.into(), + UnsupportedErrorKind::GenericFeature(format!("Image dimensions ({}, {}) are too large", f_width, f_height)))))?; ImageBuffer::from_fn(width, height, |x, y| { let x = x.wrapping_sub(left); @@ -211,95 +211,75 @@ impl Iterator for GifFrameIterator { // correct storage requirement if the result does not fit in `usize`. // on the other hand, `ImageBuffer::from_raw` detects overflow and // reports by returning `None`. - let image_buffer_raw = match ImageBuffer::from_raw(f_width, f_height, vec) { - Some(image_buffer_raw) => image_buffer_raw, + let mut frame_buffer = match ImageBuffer::from_raw(f_width, f_height, vec) { + Some(frame_buffer) => frame_buffer, None => { - return Some(Err(ImageError::UnsupportedError( - "Image dimensions are too large".into(), - ))) + return Some(Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Gif.into(), + UnsupportedErrorKind::GenericFeature(format!("Image dimensions ({}, {}) are too large", f_width, f_height)), + )))) } }; - // if `image_buffer_raw`'s frame exactly matches the entire image, then - // use it directly. - // - // otherwise, `image_buffer_raw` represents a smaller image. - // create a new image of the target size and place - // `image_buffer_raw` within it. the outside region is filled with - // transparent pixels. - let mut image_buffer = - full_image_from_frame(self.width, self.height, image_buffer_raw, left, top); - - // loop over all pixels, checking if any pixels from the non disposed - // frame need to be used - for (x, y, pixel) in image_buffer.enumerate_pixels_mut() { - let previous_img_buffer = &self.non_disposed_frame; - let adjusted_pixel: &mut Rgba = pixel; - let previous_pixel: &Rgba = previous_img_buffer.get_pixel(x, y); - - let pixel_alpha = adjusted_pixel.channels()[3]; - - // If a pixel is not visible then we show the non disposed frame pixel instead + // blend the current frame with the non-disposed frame, then update + // the non-disposed frame according to the disposal method. + fn blend_and_dispose_pixel(dispose: DisposalMethod, + previous: &mut Rgba, current: &mut Rgba) { + let pixel_alpha = current.channels()[3]; if pixel_alpha == 0 { - adjusted_pixel.blend(previous_pixel); + *current = *previous; + } + + match dispose { + DisposalMethod::Any | DisposalMethod::Keep => { + // do not dispose + // (keep pixels from this frame) + // note: the `Any` disposal method is underspecified in the GIF + // spec, but most viewers treat it identically to `Keep` + *previous = *current; + } + DisposalMethod::Background => { + // restore to background color + // (background shows through transparent pixels in the next frame) + *previous = Rgba([0, 0, 0, 0]); + } + DisposalMethod::Previous => { + // restore to previous + // (dispose frames leaving the last none disposal frame) + } } } - let frame = animation::Frame::from_parts( - image_buffer.clone(), 0, 0, animation::Delay::from_ratio(delay), - ); + // if `frame_buffer`'s frame exactly matches the entire image, then + // use it directly, else create a new buffer to hold the composited + // image. + let image_buffer = if (left, top) == (0, 0) + && (self.width, self.height) == frame_buffer.dimensions() { + for (x, y, pixel) in frame_buffer.enumerate_pixels_mut() { + let previous_pixel = self.non_disposed_frame.get_pixel_mut(x, y); + blend_and_dispose_pixel(dispose, previous_pixel, pixel); + } + frame_buffer + } else { + ImageBuffer::from_fn(self.width, self.height, |x, y| { + let frame_x = x.wrapping_sub(left); + let frame_y = y.wrapping_sub(top); + let previous_pixel = self.non_disposed_frame.get_pixel_mut(x, y); - match dispose { - DisposalMethod::Any => { - // do nothing - // (completely replace this frame with the next) - } - DisposalMethod::Keep => { - // do not dispose - // (keep pixels from this frame) - self.non_disposed_frame = image_buffer; - } - DisposalMethod::Background => { - // restore to background color - // (background shows through transparent pixels in the next frame) - for y in top..min(top + f_height, self.height) { - for x in left..min(left + f_width, self.width) { - self.non_disposed_frame.put_pixel(x, y, Rgba([0, 0, 0, 0])); - } + if frame_x < frame_buffer.width() && frame_y < frame_buffer.height() { + let mut pixel = *frame_buffer.get_pixel(frame_x, frame_y); + blend_and_dispose_pixel(dispose, previous_pixel, &mut pixel); + pixel + } else { + // out of bounds, return pixel from previous frame + *previous_pixel } - } - DisposalMethod::Previous => { - // restore to previous - // (dispose frames leaving the last none disposal frame) - } + }) }; - Some(Ok(frame)) - } -} - -/// Given a frame subimage, construct a full image of size -/// `(screen_width, screen_height)` by placing it at the top-left coordinates -/// `(left, top)`. The remaining portion is filled with transparent pixels. -fn full_image_from_frame( - screen_width: u32, - screen_height: u32, - image: crate::RgbaImage, - left: u32, - top: u32, -) -> crate::RgbaImage { - if (left, top) == (0, 0) && (screen_width, screen_height) == (image.width(), image.height()) { - image - } else { - ImageBuffer::from_fn(screen_width, screen_height, |x, y| { - let x = x.wrapping_sub(left); - let y = y.wrapping_sub(top); - if x < image.width() && y < image.height() { - *image.get_pixel(x, y) - } else { - Rgba([0, 0, 0, 0]) - } - }) + Some(Ok(animation::Frame::from_parts( + image_buffer, 0, 0, animation::Delay::from_ratio(delay), + ))) } } @@ -338,7 +318,10 @@ impl Encoder { ColorType::Rgba8 => { self.encode_gif(Frame::from_rgb(width, height, &mut data.to_owned())) }, - _ => Err(ImageError::UnsupportedColor(color.into())), + _ => Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Gif.into(), + UnsupportedErrorKind::Color(color.into()) + ))), } } @@ -386,7 +369,11 @@ impl Encoder { // Create the gif::Frame from the animation::Frame let mut frame = Frame::from_rgba(width, height, &mut *rbga_frame); - frame.delay = (frame_delay / 10).try_into().map_err(|_|ImageError::DimensionError)?; + // Saturate the conversion to u16::MAX instead of returning an error as that + // would require a new special cased variant in ParameterErrorKind which most + // likely couldn't be reused for other cases. This isn't a bad trade-off given + // that the current algorithm is already lossy. + frame.delay = (frame_delay / 10).try_into().unwrap_or(std::u16::MAX); Ok(frame) } @@ -398,7 +385,9 @@ impl Encoder { Some((width, height)) } - inner_dimensions(width, height).ok_or(ImageError::DimensionError) + inner_dimensions(width, height).ok_or(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch + ))) } pub(crate) fn encode_gif(&mut self, frame: Frame) -> ImageResult<()> { @@ -420,7 +409,7 @@ impl ImageError { fn from_gif(err: gif::DecodingError) -> ImageError { use gif::DecodingError::*; match err { - Format(desc) | Internal(desc) => ImageError::FormatError(desc.into()), + err @ Format(_) | err @ Internal(_) => ImageError::Decoding(DecodingError::new(ImageFormat::Gif.into(), err)), Io(io_err) => ImageError::IoError(io_err), } } diff --git a/third_party/cargo/vendor/image-0.23.1/src/hdr/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/hdr/decoder.rs similarity index 80% rename from third_party/cargo/vendor/image-0.23.1/src/hdr/decoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/hdr/decoder.rs index 98ea5c6..0827fe9 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/hdr/decoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/hdr/decoder.rs @@ -6,13 +6,112 @@ use std::convert::TryFrom; use std::io::{self, BufRead, Cursor, Read, Seek}; use std::iter::Iterator; use std::marker::PhantomData; -use std::mem; +use std::{error, fmt, mem}; +use std::num::{ParseFloatError, ParseIntError}; use std::path::Path; use crate::Primitive; use crate::color::{ColorType, Rgb}; -use crate::error::{ImageError, ImageResult, ParameterError, ParameterErrorKind}; -use crate::image::{self, ImageDecoder, ImageDecoderExt, Progress}; +use crate::error::{DecodingError, ImageError, ImageFormatHint, ImageResult, ParameterError, ParameterErrorKind, UnsupportedError, UnsupportedErrorKind}; +use crate::image::{self, ImageDecoder, ImageDecoderExt, ImageFormat, Progress}; + +/// Errors that can occur during decoding and parsing of a HDR image +#[derive(Debug, Clone, PartialEq, Eq)] +enum DecoderError { + /// HDR's "#?RADIANCE" signature wrong or missing + RadianceHdrSignatureInvalid, + /// EOF before end of header + TruncatedHeader, + /// EOF instead of image dimensions + TruncatedDimensions, + + /// A value couldn't be parsed + UnparsableF32(LineType, ParseFloatError), + /// A value couldn't be parsed + UnparsableU32(LineType, ParseIntError), + /// Not enough numbers in line + LineTooShort(LineType), + + /// COLORCORR contains too many numbers in strict mode + ExtraneousColorcorrNumbers, + + /// Dimensions line had too few elements + DimensionsLineTooShort(usize, usize), + /// Dimensions line had too many elements + DimensionsLineTooLong(usize), + + /// The length of a scanline (1) wasn't a match for the specified length (2) + WrongScanlineLength(usize, usize), + /// First pixel of a scanline is a run length marker + FirstPixelRlMarker, +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DecoderError::RadianceHdrSignatureInvalid => + f.write_str("Radiance HDR signature not found"), + DecoderError::TruncatedHeader => + f.write_str("EOF in header"), + DecoderError::TruncatedDimensions => + f.write_str("EOF in dimensions line"), + DecoderError::UnparsableF32(line, pe) => + f.write_fmt(format_args!("Cannot parse {} value as f32: {}", line, pe)), + DecoderError::UnparsableU32(line, pe) => + f.write_fmt(format_args!("Cannot parse {} value as u32: {}", line, pe)), + DecoderError::LineTooShort(line) => + f.write_fmt(format_args!("Not enough numbers in {}", line)), + DecoderError::ExtraneousColorcorrNumbers => + f.write_str("Extra numbers in COLORCORR"), + DecoderError::DimensionsLineTooShort(elements, expected) => + f.write_fmt(format_args!("Dimensions line too short: have {} elements, expected {}", elements, expected)), + DecoderError::DimensionsLineTooLong(expected) => + f.write_fmt(format_args!("Dimensions line too long, expected {} elements", expected)), + DecoderError::WrongScanlineLength(len, expected) => + f.write_fmt(format_args!("Wrong length of decoded scanline: got {}, expected {}", len, expected)), + DecoderError::FirstPixelRlMarker => + f.write_str("First pixel of a scanline shouldn't be run length marker"), + } + } +} + +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::Hdr.into(), e)) + } +} + +impl error::Error for DecoderError { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self { + DecoderError::UnparsableF32(_, err) => Some(err), + DecoderError::UnparsableU32(_, err) => Some(err), + _ => None, + } + } +} + +/// Lines which contain parsable data that can fail +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum LineType { + Exposure, + Pixaspect, + Colorcorr, + DimensionsHeight, + DimensionsWidth, +} + +impl fmt::Display for LineType { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(match self { + LineType::Exposure => "EXPOSURE", + LineType::Pixaspect => "PIXASPECT", + LineType::Colorcorr => "COLORCORR", + LineType::DimensionsHeight => "height dimension", + LineType::DimensionsWidth => "width dimension", + }) + } +} /// Adapter to conform to ```ImageDecoder``` trait #[derive(Debug)] @@ -109,7 +208,7 @@ impl<'a, R: 'a + BufRead + Seek> ImageDecoderExt<'a> for HDRAdapter { progress_callback: F, ) -> ImageResult<()> { image::load_rect(x, y, width, height, buf, progress_callback, self, |_, _| unreachable!(), - |s, buf| s.read_image_data(buf).map(|_| buf.len())) + |s, buf| s.read_image_data(buf)) } } @@ -231,9 +330,7 @@ impl HdrDecoder { let mut signature = [0; SIGNATURE_LENGTH]; r.read_exact(&mut signature)?; if signature != SIGNATURE { - return Err(ImageError::FormatError( - "Radiance HDR signature not found".to_string(), - )); + return Err(DecoderError::RadianceHdrSignatureInvalid.into()); } // no else // skip signature line ending read_line_u8(r)?; @@ -246,7 +343,7 @@ impl HdrDecoder { match read_line_u8(r)? { None => { // EOF before end of header - return Err(ImageError::FormatError("EOF in header".into())); + return Err(DecoderError::TruncatedHeader.into()); } Some(line) => { if line.is_empty() { @@ -268,7 +365,7 @@ impl HdrDecoder { let (width, height) = match read_line_u8(&mut reader)? { None => { // EOF instead of image dimensions - return Err(ImageError::FormatError("EOF in dimensions line".into())); + return Err(DecoderError::TruncatedDimensions.into()); } Some(dimensions) => { let dimensions = String::from_utf8_lossy(&dimensions[..]); @@ -499,9 +596,7 @@ fn decode_component( if rl <= 128 { // sanity check if pos + rl as usize > width { - return Err(ImageError::FormatError( - "Wrong length of decoded scanline".into(), - )); + return Err(DecoderError::WrongScanlineLength(pos + rl as usize, width).into()); } // read values r.read_exact(&mut buf[0..rl as usize])?; @@ -514,9 +609,7 @@ fn decode_component( let rl = rl - 128; // sanity check if pos + rl as usize > width { - return Err(ImageError::FormatError( - "Wrong length of decoded scanline".into(), - )); + return Err(DecoderError::WrongScanlineLength(pos + rl as usize, width).into()); } // fill with same value let value = read_byte(r)?; @@ -528,9 +621,7 @@ fn decode_component( }; } if pos != width { - return Err(ImageError::FormatError( - "Wrong length of decoded scanline".into(), - )); + return Err(DecoderError::WrongScanlineLength(pos, width).into()); } Ok(()) } @@ -558,9 +649,7 @@ fn decode_old_rle( // first pixel in scanline should not be run length marker // it is error if it is if rl_marker(fb).is_some() { - return Err(ImageError::FormatError( - "First pixel of a scanline shouldn't be run length marker".into(), - )); + return Err(DecoderError::FirstPixelRlMarker.into()); } buf[0] = fb; // set first pixel of scanline @@ -581,9 +670,7 @@ fn decode_old_rle( *b = prev_pixel; } } else { - return Err(ImageError::FormatError( - "Wrong length of decoded scanline".into(), - )); + return Err(DecoderError::WrongScanlineLength(x_off + rl, width).into()); }; rl // value to increase x_off by } else { @@ -595,9 +682,7 @@ fn decode_old_rle( }; } if x_off != width { - return Err(ImageError::FormatError( - "Wrong length of decoded scanline".into(), - )); + return Err(DecoderError::WrongScanlineLength(x_off, width).into()); } Ok(()) } @@ -672,7 +757,10 @@ impl HDRMetadata { Some(("FORMAT", val)) => { if val.trim() != "32-bit_rle_rgbe" { // XYZE isn't supported yet - return Err(ImageError::UnsupportedError(limit_string_len(val, 20))); + return Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Hdr.into(), + UnsupportedErrorKind::Format(ImageFormatHint::Name(limit_string_len(val, 20))) + ))); } } Some(("EXPOSURE", val)) => { @@ -682,10 +770,7 @@ impl HDRMetadata { } Err(parse_error) => { if strict { - return Err(ImageError::FormatError(format!( - "Cannot parse EXPOSURE value: {}", - parse_error - ))); + return Err(DecoderError::UnparsableF32(LineType::Exposure, parse_error).into()); } // no else, skip this line in non-strict mode } }; @@ -698,22 +783,17 @@ impl HDRMetadata { } Err(parse_error) => { if strict { - return Err(ImageError::FormatError(format!( - "Cannot parse PIXASPECT value: {}", - parse_error - ))); + return Err(DecoderError::UnparsableF32(LineType::Pixaspect, parse_error).into()); } // no else, skip this line in non-strict mode } }; } Some(("COLORCORR", val)) => { let mut rgbcorr = [1.0, 1.0, 1.0]; - match parse_space_separated_f32(val, &mut rgbcorr, "COLORCORR") { + match parse_space_separated_f32(val, &mut rgbcorr, LineType::Colorcorr) { Ok(extra_numbers) => { if strict && extra_numbers { - return Err(ImageError::FormatError( - "Extra numbers in COLORCORR".into(), - )); + return Err(DecoderError::ExtraneousColorcorrNumbers.into()); } // no else, just ignore extra numbers let (rc, gc, bc) = self.color_correction.unwrap_or((1.0, 1.0, 1.0)); self.color_correction = @@ -738,26 +818,17 @@ impl HDRMetadata { } } -fn parse_space_separated_f32(line: &str, vals: &mut [f32], name: &str) -> ImageResult { +fn parse_space_separated_f32(line: &str, vals: &mut [f32], line_tp: LineType) -> ImageResult { let mut nums = line.split_whitespace(); for val in vals.iter_mut() { if let Some(num) = nums.next() { match num.parse::() { Ok(v) => *val = v, - Err(err) => { - return Err(ImageError::FormatError(format!( - "f32 parse error in {}: {}", - name, - err - ))); - } + Err(err) => return Err(DecoderError::UnparsableF32(line_tp, err).into()), } } else { // not enough numbers in line - return Err(ImageError::FormatError(format!( - "Not enough numbers in {}", - name - ))); + return Err(DecoderError::LineTooShort(line_tp).into()); } } Ok(nums.next().is_some()) @@ -766,23 +837,16 @@ fn parse_space_separated_f32(line: &str, vals: &mut [f32], name: &str) -> ImageR // Parses dimension line "-Y height +X width" // returns (width, height) or error fn parse_dimensions_line(line: &str, strict: bool) -> ImageResult<(u32, u32)> { + const DIMENSIONS_COUNT: usize = 4; + let mut dim_parts = line.split_whitespace(); - let err = "Malformed dimensions line"; - let c1_tag = dim_parts - .next() - .ok_or_else(|| ImageError::FormatError(err.into()))?; - let c1_str = dim_parts - .next() - .ok_or_else(|| ImageError::FormatError(err.into()))?; - let c2_tag = dim_parts - .next() - .ok_or_else(|| ImageError::FormatError(err.into()))?; - let c2_str = dim_parts - .next() - .ok_or_else(|| ImageError::FormatError(err.into()))?; + let c1_tag = dim_parts.next().ok_or_else(|| DecoderError::DimensionsLineTooShort(0, DIMENSIONS_COUNT))?; + let c1_str = dim_parts.next().ok_or_else(|| DecoderError::DimensionsLineTooShort(1, DIMENSIONS_COUNT))?; + let c2_tag = dim_parts.next().ok_or_else(|| DecoderError::DimensionsLineTooShort(2, DIMENSIONS_COUNT))?; + let c2_str = dim_parts.next().ok_or_else(|| DecoderError::DimensionsLineTooShort(3, DIMENSIONS_COUNT))?; if strict && dim_parts.next().is_some() { // extra data in dimensions line - return Err(ImageError::FormatError(err.into())); + return Err(DecoderError::DimensionsLineTooLong(DIMENSIONS_COUNT).into()); } // no else // dimensions line is in the form "-Y 10 +X 20" // There are 8 possible orientations: +Y +X, +X -Y and so on @@ -790,38 +854,21 @@ fn parse_dimensions_line(line: &str, strict: bool) -> ImageResult<(u32, u32)> { ("-Y", "+X") => { // Common orientation (left-right, top-down) // c1_str is height, c2_str is width - let height = c1_str.parse::().into_image_error(err)?; - let width = c2_str.parse::().into_image_error(err)?; + let height = c1_str.parse::().map_err(|pe| DecoderError::UnparsableU32(LineType::DimensionsHeight, pe))?; + let width = c2_str.parse::().map_err(|pe| DecoderError::UnparsableU32(LineType::DimensionsWidth, pe))?; Ok((width, height)) } - _ => Err(ImageError::FormatError(format!( - "Unsupported orientation {} {}", - limit_string_len(c1_tag, 4), - limit_string_len(c2_tag, 4) + _ => Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Hdr.into(), + UnsupportedErrorKind::GenericFeature(format!( + "Orientation {} {}", + limit_string_len(c1_tag, 4), + limit_string_len(c2_tag, 4) + )), ))), } // final expression. Returns value } -trait IntoImageError { - fn into_image_error(self, description: &str) -> ImageResult; -} - -impl IntoImageError for ::std::result::Result { - fn into_image_error(self, description: &str) -> ImageResult { - self.map_err(|err| { - ImageError::FormatError(format!("{} {}", description, err)) - }) - } -} - -impl IntoImageError for ::std::result::Result { - fn into_image_error(self, description: &str) -> ImageResult { - self.map_err(|err| { - ImageError::FormatError(format!("{} {}", description, err)) - }) - } -} - // Returns string with no more than len+3 characters fn limit_string_len(s: &str, len: usize) -> String { let s_char_len = s.chars().count(); diff --git a/third_party/cargo/vendor/image-0.23.1/src/hdr/encoder.rs b/third_party/cargo/vendor/image-0.23.4/src/hdr/encoder.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/hdr/encoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/hdr/encoder.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/hdr/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/hdr/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/hdr/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/hdr/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/ico/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/ico/decoder.rs similarity index 62% rename from third_party/cargo/vendor/image-0.23.1/src/ico/decoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/ico/decoder.rs index 39d189e..ec44240 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/ico/decoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/ico/decoder.rs @@ -2,11 +2,11 @@ use byteorder::{LittleEndian, ReadBytesExt}; use std::convert::TryFrom; use std::io::{self, Cursor, Read, Seek, SeekFrom}; use std::marker::PhantomData; -use std::mem; +use std::{error, fmt, mem}; use crate::color::ColorType; -use crate::error::{ImageError, ImageResult}; -use crate::image::{self, ImageDecoder}; +use crate::error::{DecodingError, ImageError, ImageResult, UnsupportedError, UnsupportedErrorKind}; +use crate::image::{self, ImageDecoder, ImageFormat}; use self::InnerDecoder::*; use crate::bmp::BmpDecoder; @@ -16,6 +16,91 @@ use crate::png::PngDecoder; // The first eight bytes of a PNG file always contain the following (decimal) values: const PNG_SIGNATURE: [u8; 8] = [137, 80, 78, 71, 13, 10, 26, 10]; +/// Errors that can occur during decoding and parsing an ICO image or one of its enclosed images. +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum DecoderError { + /// The ICO directory is empty + NoEntries, + /// The number of color planes (0 or 1), or the horizontal coordinate of the hotspot for CUR files too big. + IcoEntryTooManyPlanesOrHotspot, + /// The bit depth (may be 0 meaning unspecified), or the vertical coordinate of the hotspot for CUR files too big. + IcoEntryTooManyBitsPerPixelOrHotspot, + + /// The entry is in PNG format and specified a length that is shorter than PNG header. + PngShorterThanHeader, + /// The enclosed PNG is not in RGBA, which is invalid: https://blogs.msdn.microsoft.com/oldnewthing/20101022-00/?p=12473/. + PngNotRgba, + + /// The optional mask row, containing 1 bit per pixel, padded to 4 bytes, was too short for this image. + BmpIcoMaskTooShortForImage, + + /// The dimensions specified by the entry does not match the dimensions in the header of the enclosed image. + ImageEntryDimensionMismatch { + /// The mismatched subimage's type + format: IcoEntryImageFormat, + /// The dimensions specified by the entry + entry: (u16, u16), + /// The dimensions of the image itself + image: (u32, u32) + }, +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DecoderError::NoEntries => + f.write_str("ICO directory contains no image"), + DecoderError::IcoEntryTooManyPlanesOrHotspot => + f.write_str("ICO image entry has too many color planes or too large hotspot value"), + DecoderError::IcoEntryTooManyBitsPerPixelOrHotspot => + f.write_str("ICO image entry has too many bits per pixel or too large hotspot value"), + DecoderError::PngShorterThanHeader => + f.write_str("Entry specified a length that is shorter than PNG header!"), + DecoderError::PngNotRgba => + f.write_str("The PNG is not in RGBA format!"), + DecoderError::BmpIcoMaskTooShortForImage => + f.write_str("ICO mask too short for the image"), + DecoderError::ImageEntryDimensionMismatch { format, entry, image } => + f.write_fmt(format_args!("Entry{:?} and {}{:?} dimensions do not match!", entry, format, image)), + } + } +} + +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::Ico.into(), e)) + } +} + +impl error::Error for DecoderError {} + +/// The image formats an ICO may contain +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum IcoEntryImageFormat { + /// PNG in ARGB + Png, + /// BMP with optional alpha mask + Bmp, +} + +impl fmt::Display for IcoEntryImageFormat { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(match self { + IcoEntryImageFormat::Png => "PNG", + IcoEntryImageFormat::Bmp => "BMP", + }) + } +} + +impl Into for IcoEntryImageFormat { + fn into(self) -> ImageFormat { + match self { + IcoEntryImageFormat::Png => ImageFormat::Png, + IcoEntryImageFormat::Bmp => ImageFormat::Bmp, + } + } +} + /// An ico decoder pub struct IcoDecoder { selected_entry: DirEntry, @@ -75,18 +160,14 @@ fn read_entry(r: &mut R) -> ImageResult { // of the hotspot for CUR files. entry.num_color_planes = r.read_u16::()?; if entry.num_color_planes > 256 { - return Err(ImageError::FormatError( - "ICO image entry has a too large color planes/hotspot value".to_string(), - )); + return Err(DecoderError::IcoEntryTooManyPlanesOrHotspot.into()); } // This may be either the bit depth (may be 0 meaning unspecified), // or the vertical coordinate of the hotspot for CUR files. entry.bits_per_pixel = r.read_u16::()?; if entry.bits_per_pixel > 256 { - return Err(ImageError::FormatError( - "ICO image entry has a too large bits per pixel/hotspot value".to_string(), - )); + return Err(DecoderError::IcoEntryTooManyBitsPerPixelOrHotspot.into()); } entry.image_length = r.read_u32::()?; @@ -97,9 +178,7 @@ fn read_entry(r: &mut R) -> ImageResult { /// Find the entry with the highest (color depth, size). fn best_entry(mut entries: Vec) -> ImageResult { - let mut best = entries.pop().ok_or_else(|| ImageError::FormatError( - "ICO directory contains no image".to_string(), - ))?; + let mut best = entries.pop().ok_or_else(|| DecoderError::NoEntries)?; let mut best_score = ( best.bits_per_pixel, @@ -207,27 +286,23 @@ impl<'a, R: 'a + Read + Seek> ImageDecoder<'a> for IcoDecoder { match self.inner_decoder { PNG(decoder) => { if self.selected_entry.image_length < PNG_SIGNATURE.len() as u32 { - return Err(ImageError::FormatError( - "Entry specified a length that is shorter than PNG header!".to_string(), - )); + return Err(DecoderError::PngShorterThanHeader.into()); } // Check if the image dimensions match the ones in the image data. let (width, height) = decoder.dimensions(); if !self.selected_entry.matches_dimensions(width, height) { - return Err(ImageError::FormatError( - "Entry and PNG dimensions do not match!".to_string(), - )); + return Err(DecoderError::ImageEntryDimensionMismatch { + format: IcoEntryImageFormat::Png, + entry: (self.selected_entry.real_width(), self.selected_entry.real_height()), + image: (width, height) + }.into()); } // Embedded PNG images can only be of the 32BPP RGBA format. // https://blogs.msdn.microsoft.com/oldnewthing/20101022-00/?p=12473/ - let color_type = decoder.color_type(); - if let ColorType::Rgba8 = color_type { - } else { - return Err(ImageError::FormatError( - "The PNG is not in RGBA format!".to_string(), - )); + if decoder.color_type() != ColorType::Rgba8 { + return Err(DecoderError::PngNotRgba.into()); } decoder.read_image(buf) @@ -235,14 +310,19 @@ impl<'a, R: 'a + Read + Seek> ImageDecoder<'a> for IcoDecoder { BMP(mut decoder) => { let (width, height) = decoder.dimensions(); if !self.selected_entry.matches_dimensions(width, height) { - return Err(ImageError::FormatError( - "Entry({:?}) and BMP({:?}) dimensions do not match!".to_string(), - )); + return Err(DecoderError::ImageEntryDimensionMismatch { + format: IcoEntryImageFormat::Bmp, + entry: (self.selected_entry.real_width(), self.selected_entry.real_height()), + image: (width, height) + }.into()); } // The ICO decoder needs an alpha channel to apply the AND mask. if decoder.color_type() != ColorType::Rgba8 { - return Err(ImageError::UnsupportedColor(decoder.color_type().into())); + return Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Bmp.into(), + UnsupportedErrorKind::Color(decoder.color_type().into()), + ))); } decoder.read_image_data(buf)?; @@ -259,9 +339,7 @@ impl<'a, R: 'a + Read + Seek> ImageDecoder<'a> for IcoDecoder { let mask_row_bytes = ((width + 31) / 32) * 4; let expected_length = u64::from(mask_row_bytes) * u64::from(height); if mask_length < expected_length { - return Err(ImageError::FormatError( - "ICO mask too short for the image".to_string(), - )); + return Err(DecoderError::BmpIcoMaskTooShortForImage.into()); } for y in 0..height { diff --git a/third_party/cargo/vendor/image-0.23.1/src/ico/encoder.rs b/third_party/cargo/vendor/image-0.23.4/src/ico/encoder.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/ico/encoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/ico/encoder.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/ico/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/ico/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/ico/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/ico/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/image.rs b/third_party/cargo/vendor/image-0.23.4/src/image.rs similarity index 94% rename from third_party/cargo/vendor/image-0.23.1/src/image.rs rename to third_party/cargo/vendor/image-0.23.4/src/image.rs index f761902..d45b77a 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/image.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/image.rs @@ -4,11 +4,13 @@ use std::io; use std::io::Read; use std::ops::{Deref, DerefMut}; use std::path::Path; +use std::usize; -use crate::buffer::{ImageBuffer, Pixel}; +use crate::ImageBuffer; use crate::color::{ColorType, ExtendedColorType}; -use crate::error::{ImageError, ImageResult}; +use crate::error::{ImageError, ImageResult, LimitError, LimitErrorKind, ParameterError, ParameterErrorKind}; use crate::math::Rect; +use crate::traits::Pixel; use crate::animation::Frames; @@ -52,6 +54,9 @@ pub enum ImageFormat { /// An Image in Radiance HDR Format Hdr, + /// An Image in farbfeld Format + Farbfeld, + #[doc(hidden)] __NonExhaustive(crate::utils::NonExhaustiveMarker), } @@ -92,6 +97,10 @@ pub enum ImageOutputFormat { /// An Image in BMP Format Bmp, + #[cfg(feature = "farbfeld")] + /// An Image in farbfeld Format + Farbfeld, + /// A value for signalling an error: An unsupported format was requested // Note: When TryFrom is stabilized, this value should not be needed, and // a TryInto should be used instead of an Into. @@ -116,11 +125,10 @@ impl From for ImageOutputFormat { ImageFormat::Ico => ImageOutputFormat::Ico, #[cfg(feature = "bmp")] ImageFormat::Bmp => ImageOutputFormat::Bmp, + #[cfg(feature = "farbfeld")] + ImageFormat::Farbfeld => ImageOutputFormat::Farbfeld, - f => ImageOutputFormat::Unsupported(format!( - "Image format {:?} not supported for encoding.", - f - )), + f => ImageOutputFormat::Unsupported(format!("{:?}", f)), } } } @@ -204,7 +212,7 @@ pub(crate) fn load_rect<'a, D, F, F1, F2, E>(x: u32, y: u32, width: u32, height: where D: ImageDecoder<'a>, F: Fn(Progress), F1: FnMut(&mut D, u64) -> io::Result<()>, - F2: FnMut(&mut D, &mut [u8]) -> Result, + F2: FnMut(&mut D, &mut [u8]) -> Result<(), E>, ImageError: From, { let (x, y, width, height) = (u64::from(x), u64::from(y), u64::from(width), u64::from(height)); @@ -214,6 +222,10 @@ pub(crate) fn load_rect<'a, D, F, F1, F2, E>(x: u32, y: u32, width: u32, height: let scanline_bytes = decoder.scanline_bytes(); let total_bytes = width * height * bytes_per_pixel; + if buf.len() < usize::try_from(total_bytes).unwrap_or(usize::MAX) { + panic!("output buffer too short\n expected `{}`, provided `{}`", total_bytes, buf.len()); + } + let mut bytes_read = 0u64; let mut current_scanline = 0; let mut tmp = Vec::new(); @@ -255,12 +267,16 @@ pub(crate) fn load_rect<'a, D, F, F1, F2, E>(x: u32, y: u32, width: u32, height: Ok(()) }; - if x + width > u64::from(dimensions.0) || y + height > u64::from(dimensions.0) + if x + width > u64::from(dimensions.0) || y + height > u64::from(dimensions.1) || width == 0 || height == 0 { - return Err(ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } if scanline_bytes > usize::max_value() as u64 { - return Err(ImageError::InsufficientMemory); + return Err(ImageError::Limits(LimitError::from_kind( + LimitErrorKind::InsufficientMemory, + ))); } progress_callback(Progress {current: 0, total: total_bytes}); @@ -421,9 +437,9 @@ pub trait ImageDecoder<'a>: Sized { } } -/// ImageDecoderExt trait +/// Specialized image decoding not be supported by all formats pub trait ImageDecoderExt<'a>: ImageDecoder<'a> + Sized { - /// Read a rectangular section of the image. + /// Decode a rectangular section of the image; see [`read_rect_with_progress()`](#fn.read_rect_with_progress). fn read_rect( &mut self, x: u32, @@ -435,7 +451,18 @@ pub trait ImageDecoderExt<'a>: ImageDecoder<'a> + Sized { self.read_rect_with_progress(x, y, width, height, buf, |_|{}) } - /// Read a rectangular section of the image, periodically reporting progress. + /// Decode a rectangular section of the image, periodically reporting progress. + /// + /// The output buffer will be filled with fields specified by + /// [`ImageDecoder::color_type()`](trait.ImageDecoder.html#fn.color_type), + /// in that order, each field represented in native-endian. + /// + /// The progress callback will be called at least once at the start and the end of decoding, + /// implementations are encouraged to call this more often, + /// with a frequency meaningful for display to the end-user. + /// + /// This function will panic if the output buffer isn't at least + /// `color_type().bytes_per_pixel() * color_type().channel_count() * width * height` bytes long. fn read_rect_with_progress( &mut self, x: u32, @@ -629,7 +656,9 @@ pub trait GenericImage: GenericImageView { // Do bounds checking here so we can use the non-bounds-checking // functions to copy pixels. if self.width() < other.width() + x || self.height() < other.height() + y { - return Err(ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } for i in 0..other.width() { @@ -837,7 +866,7 @@ mod tests { use std::path::Path; use super::{ColorType, ImageDecoder, ImageResult, GenericImage, GenericImageView, load_rect, ImageFormat}; - use crate::buffer::{GrayImage, ImageBuffer}; + use crate::{GrayImage, ImageBuffer}; use crate::color::Rgba; use crate::math::Rect; @@ -929,16 +958,16 @@ mod tests { m.scanline_number = n; Ok(()) } - fn read_scanline(m: &mut MockDecoder, buf: &mut [u8]) -> io::Result { + fn read_scanline(m: &mut MockDecoder, buf: &mut [u8]) -> io::Result<()> { let bytes_read = m.scanline_number * m.scanline_bytes; if bytes_read >= 25 { - return Ok(0); + return Ok(()); } let len = m.scanline_bytes.min(25 - bytes_read); buf[..(len as usize)].copy_from_slice(&DATA[(bytes_read as usize)..][..(len as usize)]); m.scanline_number += 1; - Ok(len as usize) + Ok(()) } for scanline_bytes in 1..30 { diff --git a/third_party/cargo/vendor/image-0.23.1/src/imageops/affine.rs b/third_party/cargo/vendor/image-0.23.4/src/imageops/affine.rs similarity index 92% rename from third_party/cargo/vendor/image-0.23.1/src/imageops/affine.rs rename to third_party/cargo/vendor/image-0.23.4/src/imageops/affine.rs index adaa8b9..5deafb6 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/imageops/affine.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/imageops/affine.rs @@ -1,7 +1,9 @@ //! Functions for performing affine transformations. -use crate::buffer::{ImageBuffer, Pixel}; +use crate::ImageBuffer; use crate::image::{GenericImage, GenericImageView}; +use crate::error::{ImageError, ParameterError, ParameterErrorKind}; +use crate::traits::Pixel; /// Rotate an image 90 degrees clockwise. pub fn rotate90( @@ -50,7 +52,9 @@ pub fn rotate90_in( { let ((w0, h0), (w1, h1)) = (image.dimensions(), destination.dimensions()); if w0 != h1 || h0 != w1 { - return Err(crate::ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } for y in 0..h0 { @@ -73,7 +77,9 @@ pub fn rotate180_in( { let ((w0, h0), (w1, h1)) = (image.dimensions(), destination.dimensions()); if w0 != w1 || h0 != h1 { - return Err(crate::ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } for y in 0..h0 { @@ -96,7 +102,9 @@ pub fn rotate270_in( { let ((w0, h0), (w1, h1)) = (image.dimensions(), destination.dimensions()); if w0 != h1 || h0 != w1 { - return Err(crate::ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } for y in 0..h0 { @@ -143,7 +151,9 @@ pub fn flip_horizontal_in( { let ((w0, h0), (w1, h1)) = (image.dimensions(), destination.dimensions()); if w0 != w1 || h0 != h1 { - return Err(crate::ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } for y in 0..h0 { @@ -166,7 +176,9 @@ pub fn flip_vertical_in( { let ((w0, h0), (w1, h1)) = (image.dimensions(), destination.dimensions()); if w0 != w1 || h0 != h1 { - return Err(crate::ImageError::DimensionError); + return Err(ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + ))); } for y in 0..h0 { @@ -245,8 +257,9 @@ mod test { flip_horizontal, flip_horizontal_in_place, flip_vertical, flip_vertical_in_place, rotate180, rotate180_in_place, rotate270, rotate90, }; - use crate::buffer::{GrayImage, ImageBuffer, Pixel}; + use crate::{GrayImage, ImageBuffer}; use crate::image::GenericImage; + use crate::traits::Pixel; macro_rules! assert_pixels_eq { ($actual:expr, $expected:expr) => {{ diff --git a/third_party/cargo/vendor/image-0.23.1/src/imageops/colorops.rs b/third_party/cargo/vendor/image-0.23.4/src/imageops/colorops.rs similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/src/imageops/colorops.rs rename to third_party/cargo/vendor/image-0.23.4/src/imageops/colorops.rs index 2de5194..5424eab 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/imageops/colorops.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/imageops/colorops.rs @@ -1,13 +1,14 @@ //! Functions for altering and converting the color of pixelbufs -use crate::buffer::{ImageBuffer, Pixel}; +use num_traits::{Num, NumCast}; +use std::f64::consts::PI; + +use crate::ImageBuffer; use crate::color::{Luma, Rgba}; use crate::image::{GenericImage, GenericImageView}; use crate::math::nq; use crate::math::utils::clamp; -use num_traits::{Num, NumCast}; -use std::f64::consts::PI; -use crate::traits::Primitive; +use crate::traits::{Pixel, Primitive}; type Subpixel = <::Pixel as Pixel>::Subpixel; diff --git a/third_party/cargo/vendor/image-0.23.1/src/imageops/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/imageops/mod.rs similarity index 92% rename from third_party/cargo/vendor/image-0.23.1/src/imageops/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/imageops/mod.rs index f0c7fe6..58eae88 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/imageops/mod.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/imageops/mod.rs @@ -2,8 +2,7 @@ use std::cmp; use crate::image::{GenericImage, GenericImageView, SubImage}; - -use crate::buffer::Pixel; +use crate::traits::Pixel; pub use self::sample::FilterType; @@ -36,6 +35,29 @@ pub fn crop( width: u32, height: u32, ) -> SubImage<&mut I> { + let (x, y, width, height) = crop_dimms(image, x, y, width, height); + SubImage::new(image, x, y, width, height) +} + +/// Return an immutable view into an image +pub fn crop_imm( + image: &I, + x: u32, + y: u32, + width: u32, + height: u32, +) -> SubImage<&I> { + let (x, y, width, height) = crop_dimms(image, x, y, width, height); + SubImage::new(image, x, y, width, height) +} + +fn crop_dimms( + image: &I, + x: u32, + y: u32, + width: u32, + height: u32, +) -> (u32, u32, u32, u32) { let (iwidth, iheight) = image.dimensions(); let x = cmp::min(x, iwidth); @@ -44,7 +66,7 @@ pub fn crop( let height = cmp::min(height, iheight - y); let width = cmp::min(width, iwidth - x); - SubImage::new(image, x, y, width, height) + (x, y, width, height) } /// Calculate the region that can be copied from top to bottom. @@ -166,7 +188,7 @@ where mod tests { use super::overlay; - use crate::buffer::ImageBuffer; + use crate::ImageBuffer; use crate::color::Rgb; #[test] diff --git a/third_party/cargo/vendor/image-0.23.1/src/imageops/sample.rs b/third_party/cargo/vendor/image-0.23.4/src/imageops/sample.rs similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/src/imageops/sample.rs rename to third_party/cargo/vendor/image-0.23.4/src/imageops/sample.rs index 6f8a76d..cc07848 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/imageops/sample.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/imageops/sample.rs @@ -7,10 +7,10 @@ use std::f32; use num_traits::{NumCast, ToPrimitive, Zero}; -use crate::buffer::{ImageBuffer, Pixel}; +use crate::ImageBuffer; use crate::image::GenericImageView; use crate::math::utils::clamp; -use crate::traits::{Enlargeable, Primitive}; +use crate::traits::{Enlargeable, Pixel, Primitive}; /// Available Sampling Filters. /// @@ -817,7 +817,7 @@ where #[cfg(test)] mod tests { use super::{resize, FilterType}; - use crate::buffer::{ImageBuffer, RgbImage}; + use crate::{ImageBuffer, RgbImage}; #[cfg(feature = "benchmarks")] use test; diff --git a/third_party/cargo/vendor/image-0.23.1/src/io/free_functions.rs b/third_party/cargo/vendor/image-0.23.4/src/io/free_functions.rs similarity index 96% rename from third_party/cargo/vendor/image-0.23.1/src/io/free_functions.rs rename to third_party/cargo/vendor/image-0.23.4/src/io/free_functions.rs index 227864d..fde27fd 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/io/free_functions.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/io/free_functions.rs @@ -26,6 +26,8 @@ use crate::dds; use crate::tiff; #[cfg(feature = "webp")] use crate::webp; +#[cfg(feature = "farbfeld")] +use crate::farbfeld; use crate::color; use crate::image; @@ -82,6 +84,8 @@ pub fn load(r: R, format: ImageFormat) -> ImageResult DynamicImage::from_decoder(hdr::HDRAdapter::new(BufReader::new(r))?), #[cfg(feature = "pnm")] image::ImageFormat::Pnm => DynamicImage::from_decoder(pnm::PnmDecoder::new(BufReader::new(r))?), + #[cfg(feature = "farbfeld")] + image::ImageFormat::Farbfeld => DynamicImage::from_decoder(farbfeld::FarbfeldDecoder::new(r)?), _ => Err(ImageError::Unsupported(ImageFormatHint::Exact(format).into())), } } @@ -227,6 +231,7 @@ pub(crate) fn guess_format_from_path_impl(path: &Path) -> Result image::ImageFormat::Ico, Some("hdr") => image::ImageFormat::Hdr, Some("pbm") | Some("pam") | Some("ppm") | Some("pgm") => image::ImageFormat::Pnm, + Some("ff") | Some("farbfeld") => image::ImageFormat::Farbfeld, // The original extension is used, instead of _format _ => return match exact_ext { None => Err(PathError::NoExtension), @@ -235,7 +240,7 @@ pub(crate) fn guess_format_from_path_impl(path: &Path) -> Result Reader { /// Remove the current information on the image format. /// /// Note that many operations require format information to be present and will return e.g. an - /// `ImageError::UnsupportedError` when the image format has not been set. + /// `ImageError::Unsupported` when the image format has not been set. pub fn clear_format(&mut self) { self.format = None; } @@ -149,7 +150,7 @@ impl Reader { /// /// ## Usage /// - /// This supplements the path based type deduction from [`open`] with content based deduction. + /// This supplements the path based type deduction from [`open`](Reader::open) with content based deduction. /// This is more common in Linux and UNIX operating systems and also helpful if the path can /// not be directly controlled. /// @@ -187,7 +188,7 @@ impl Reader { /// /// Uses the current format to construct the correct reader for the format. /// - /// If no format was determined, returns an `ImageError::UnsupportedError`. + /// If no format was determined, returns an `ImageError::Unsupported`. pub fn into_dimensions(mut self) -> ImageResult<(u32, u32)> { let format = self.require_format()?; free_functions::image_dimensions_with_format_impl(self.inner, format) @@ -197,7 +198,7 @@ impl Reader { /// /// Uses the current format to construct the correct reader for the format. /// - /// If no format was determined, returns an `ImageError::UnsupportedError`. + /// If no format was determined, returns an `ImageError::Unsupported`. pub fn decode(mut self) -> ImageResult { let format = self.require_format()?; free_functions::load(self.inner, format) @@ -205,6 +206,8 @@ impl Reader { fn require_format(&mut self) -> ImageResult { self.format.ok_or_else(|| - ImageError::UnsupportedError("Unable to determine image format".into())) + ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormatHint::Unknown, + UnsupportedErrorKind::Format(ImageFormatHint::Unknown)))) } } diff --git a/third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs similarity index 99% rename from third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs index 1fcd2f2..1f7d13c 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/jpeg/decoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/jpeg/decoder.rs @@ -126,8 +126,8 @@ impl ImageError { fn from_jpeg(err: jpeg_decoder::Error) -> ImageError { use jpeg_decoder::Error::*; match err { - Format(desc) => { - ImageError::Decoding(DecodingError::with_message(ImageFormat::Jpeg.into(), desc)) + err @ Format(_) => { + ImageError::Decoding(DecodingError::new(ImageFormat::Jpeg.into(), err)) } Unsupported(desc) => ImageError::Unsupported(UnsupportedError::from_format_and_kind( ImageFormat::Jpeg.into(), @@ -145,7 +145,7 @@ impl ImageError { mod tests { #[cfg(feature = "benchmarks")] extern crate test; - + use super::cmyk_to_rgb; #[cfg(feature = "benchmarks")] use test::Bencher; @@ -190,7 +190,7 @@ mod tests { single_pix_correct(cmyk_pixel, rgb_pixel); } } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_cmyk_to_rgb(b: &mut Bencher) { @@ -208,7 +208,7 @@ mod tests { cmyk_to_rgb(&v); }); } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_cmyk_to_rgb_single(b: &mut Bencher) { diff --git a/third_party/cargo/vendor/image-0.23.1/src/jpeg/encoder.rs b/third_party/cargo/vendor/image-0.23.4/src/jpeg/encoder.rs similarity index 94% rename from third_party/cargo/vendor/image-0.23.1/src/jpeg/encoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/jpeg/encoder.rs index 11615b9..5848544 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/jpeg/encoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/jpeg/encoder.rs @@ -1,7 +1,7 @@ #![allow(clippy::too_many_arguments)] use byteorder::{BigEndian, WriteBytesExt}; -use crate::error::{ImageError, ImageResult, UnsupportedError, UnsupportedErrorKind}; +use crate::error::{ImageError, ImageResult, ParameterError, ParameterErrorKind, UnsupportedError, UnsupportedErrorKind}; use crate::math::utils::clamp; use num_iter::range_step; use std::io::{self, Write}; @@ -11,6 +11,7 @@ use crate::image::{ImageEncoder, ImageFormat}; use super::entropy::build_huff_lut; use super::transform; +use std::convert::TryFrom; // Markers // Baseline DCT @@ -448,8 +449,16 @@ impl<'a, W: Write> JPEGEncoder<'a, W> { build_frame_header( &mut buf, 8, - width as u16, - height as u16, + u16::try_from(width).map_err(|_| { + ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + )) + })?, + u16::try_from(height).map_err(|_| { + ImageError::Parameter(ParameterError::from_kind( + ParameterErrorKind::DimensionMismatch, + )) + })?, &self.components[..num_components], ); self.writer.write_segment(SOF0, Some(&buf))?; @@ -836,6 +845,8 @@ mod tests { use crate::color::ColorType; use crate::image::ImageDecoder; use std::io::Cursor; + use crate::ImageError; + use crate::error::ParameterErrorKind::DimensionMismatch; fn decode(encoded: &[u8]) -> Vec { let decoder = JpegDecoder::new(Cursor::new(encoded)) @@ -913,4 +924,25 @@ mod tests { ] ); } + + + #[test] + fn test_image_too_large() { + // JPEG cannot encode images larger than 65,535×65,535 + // create a 65,536×1 8-bit black image buffer + let img = [0; 65_536]; + // Try to encode an image that is too large + let mut encoded = Vec::new(); + let mut encoder = JPEGEncoder::new_with_quality(&mut encoded, 100); + let result = encoder.encode(&img, 65_536, 1, ColorType::L8); + match result { + Err(ImageError::Parameter(err)) => { + assert_eq!(err.kind(), DimensionMismatch) + } + other => { + assert!(false, "Encoding an image that is too large should return a DimensionError \ + it returned {:?} instead", other) + } + } + } } diff --git a/third_party/cargo/vendor/image-0.23.1/src/jpeg/entropy.rs b/third_party/cargo/vendor/image-0.23.4/src/jpeg/entropy.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/jpeg/entropy.rs rename to third_party/cargo/vendor/image-0.23.4/src/jpeg/entropy.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/jpeg/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/jpeg/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/jpeg/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/jpeg/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/jpeg/transform.rs b/third_party/cargo/vendor/image-0.23.4/src/jpeg/transform.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/jpeg/transform.rs rename to third_party/cargo/vendor/image-0.23.4/src/jpeg/transform.rs diff --git a/third_party/cargo/vendor/image-0.23.4/src/lib.rs b/third_party/cargo/vendor/image-0.23.4/src/lib.rs new file mode 100644 index 0000000..51b6d53 --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/src/lib.rs @@ -0,0 +1,252 @@ +//! This crate provides native rust implementations of +//! image encoders and decoders and basic image manipulation +//! functions. +//! +//! Additional documentation can currently also be found in the +//! [README.md file which is most easily viewed on github](https://github.com/image-rs/image/blob/master/README.md). +//! +//! [Jump forward to crate content](#reexports) +//! +//! # Overview +//! +//! There are two core problems for this library provides solutions: a unified interface for images +//! encodings and simple generic buffers for their content. It's possible to use either feature +//! without the other. The focus is on small and stable set of common operations that can be +//! supplemented by other specialized crates. The library also prefers safe solutions with few +//! dependencies. +//! +//! | Format | Decoding | Encoding | +//! | ------ | -------- | -------- | +//! | PNG | All supported color types | Same as decoding | +//! | JPEG | Baseline and progressive | Baseline JPEG | +//! | GIF | Yes | Yes | +//! | BMP | Yes | RGB(8), RGBA(8), Gray(8), GrayA(8) | +//! | ICO | Yes | Yes | +//! | TIFF | Baseline(no fax support) + LZW + PackBits | RGB(8), RGBA(8), Gray(8) | +//! | WebP | Lossy(Luma channel only) | No | +//! | PNM | PBM, PGM, PPM, standard PAM | Yes | +//! | DDS | DXT1, DXT3, DXT5 | No | +//! | TGA | Yes | No | +//! | farbfeld | Yes | Yes | +//! +//! ## Using images decoders +//! +//! There exists a huge variety of image formats that are concerned with efficiently encoding image +//! pixel data and auxiliary meta data for many different purposes. The `image` library provides +//! decoders for many common formats, depending on the active features. The best way to use them +//! depends on your use case. +//! +//! * [`open`] is a very simple way to load images from the file system, automatically deducing the +//! format but offering little customization. +//! * [`load_from_memory`], [`load_from_memory_with_format`] present a similar interface for images +//! whose encoded data is already present in memory. +//! * [`io::Reader`] is a builder providing a superset of the functions. It offers both +//! customization and auto-deduction but is slightly more involved. The main benefit is that the +//! interface is easier to evolve. +//! * [`ImageDecoder`] is a trait for querying meta data and reading image pixels into a generic +//! byte buffer. It also contains a `Read` adaptor for stream reading the pixels. +//! * [`DynamicImage::from_decoder`] can be used for creating a buffer from a single specific or +//! any custom decoder implementing the [`ImageDecoder`] trait. +//! +//! [`open`]: fn.open.html +//! [`load_from_memory`]: fn.load_from_memory.html +//! [`load_from_memory_with_format`]: fn.load_from_memory_with_format.html +//! [`io::Reader`]: io/struct.Reader.html +//! [`DynamicImage::from_decoder`]: enum.DynamicImage.html#method.from_decoder +//! [`ImageDecoder`]: trait.ImageDecoder.html +//! +//! ## Using image encoders +//! +//! Encoding pixel data is supported for the majority of formats but not quite as broadly. +//! +//! * [`DynamicImage::save`] is converse of `open` and stores a `DynamicImage`. +//! * [`DynamicImage::write_to`] can be used to encode an image into any writer, for example into a +//! vector of bytes in memory. +//! * [`save_buffer`], [`save_buffer_with_format`] are a low-level interface for saving an image +//! in the file system where the library initializes the chosen encoder. +//! * [`ImageEncoder`] is a trait for encoding a byte buffer of image data and the inverse of the +//! `ImageDecoder` interface. +//! +//! [`save_buffer`]: #fn.save_buffer.html +//! [`save_buffer_with_format`]: #fn.save_buffer_with_format.html +//! [`DynamicImage::save`]: enum.DynamicImage.html#method.save +//! [`DynamicImage::write_to`]: enum.DynamicImage.html#method.write_to +//! [`ImageEncoder`]: trait.ImageEncoder.html +//! +//! ## Image buffers +//! +//! The library adds containers for channel data which together form some representation of a 2D +//! matrix of pixels. These are all statically typed to avoid misinterpretation of byte data (and +//! since Rust has no standard safe encapsulation for reinterpreting byte slices as another type). +//! The main traits [`GenericImageView`] and [`GenericImage`] model a view on a 2D-matrix of +//! addressable pixels and a buffer of independently accessible pixels respectively. +//! +//! The two main types for owning pixel data are [`ImageBuffer`] and [`DynamicImage`]. Note that +//! the latter is an enum over well-supported pixel types that also offers conversion +//! functionality. +//! +//! Additionally, the [`flat`] module contains items for interoperability with generic channel +//! matrices and foreign interface. While still strict typed these dynamically validate length and +//! other layout assumptions required to provide the trait interface. While quite generic You +//! should be prepared for a bit of boilerplate when using these types. +//! +//! [`GenericImageView`]: trait.GenericImageView.html +//! [`GenericImage`]: trait.GenericImage.html +//! [`ImageBuffer`]: struct.ImageBuffer.html +//! [`DynamicImage`]: enum.DynamicImage.html +//! [`flat`]: flat/index.html + +#![warn(missing_docs)] +#![warn(unused_qualifications)] +#![deny(unreachable_pub)] +#![deny(deprecated)] +#![deny(missing_copy_implementations)] +#![cfg_attr(all(test, feature = "benchmarks"), feature(test))] +// it's a bit of a pain otherwise +#![allow(clippy::many_single_char_names)] + +#[cfg(all(test, feature = "benchmarks"))] +extern crate test; + +#[cfg(test)] +#[macro_use] +extern crate quickcheck; + +use std::io::Write; + +pub use crate::color::{ColorType, ExtendedColorType}; + +pub use crate::color::{Luma, LumaA, Rgb, Rgba, Bgr, Bgra}; + +pub use crate::error::{ImageError, ImageResult}; + +pub use crate::image::{AnimationDecoder, + GenericImage, + GenericImageView, + ImageDecoder, + ImageDecoderExt, + ImageEncoder, + ImageFormat, + ImageOutputFormat, + Progress, + // Iterators + Pixels, + SubImage}; + +pub use crate::buffer_::{ + GrayAlphaImage, + GrayImage, + // Image types + ImageBuffer, + RgbImage, + RgbaImage}; + +pub use crate::flat::FlatSamples; + +// Traits +pub use crate::traits::{Primitive, Pixel}; + +// Opening and loading images +pub use crate::io::free_functions::{guess_format, load}; +pub use crate::dynimage::{load_from_memory, load_from_memory_with_format, open, + save_buffer, save_buffer_with_format, image_dimensions}; + +pub use crate::dynimage::DynamicImage; + +pub use crate::animation::{Delay, Frame, Frames}; + +// More detailed error type +pub mod error; + +/// Iterators and other auxiliary structure for the `ImageBuffer` type. +pub mod buffer { + // Only those not exported at the top-level + pub use crate::buffer_::{ + ConvertBuffer, + EnumeratePixels, + EnumeratePixelsMut, + EnumerateRows, + EnumerateRowsMut, + Pixels, + PixelsMut, + Rows, + RowsMut, + }; +} + +// Math utils +pub mod math; + +// Image processing functions +pub mod imageops; + +// Io bindings +pub mod io; + +// Buffer representations for ffi. +pub mod flat; + +// Image codecs +#[cfg(feature = "bmp")] +pub mod bmp; +#[cfg(feature = "dds")] +pub mod dds; +#[cfg(feature = "dxt")] +pub mod dxt; +#[cfg(feature = "gif")] +pub mod gif; +#[cfg(feature = "hdr")] +pub mod hdr; +#[cfg(feature = "ico")] +pub mod ico; +#[cfg(feature = "jpeg")] +pub mod jpeg; +#[cfg(feature = "png")] +pub mod png; +#[cfg(feature = "pnm")] +pub mod pnm; +#[cfg(feature = "tga")] +pub mod tga; +#[cfg(feature = "tiff")] +pub mod tiff; +#[cfg(feature = "webp")] +pub mod webp; +#[cfg(feature = "farbfeld")] +pub mod farbfeld; + +mod animation; +#[path = "buffer.rs"] +mod buffer_; +mod color; +mod dynimage; +mod image; +mod traits; +mod utils; + +// Can't use the macro-call itself within the `doc` attribute. So force it to eval it as part of +// the macro invocation. +// +// The inspiration for the macro and implementation is from +// +// +// MIT License +// +// Copyright (c) 2018 Guillaume Gomez +//macro_rules! insert_as_doc { +// { $content:expr } => { +// #[doc = $content] extern { } +// } +//} + +// Provides the README.md as doc, to ensure the example works! +//insert_as_doc!(include_str!("../README.md")); + +// Copies data from `src` to `dst` +// +// Panics if the length of `dst` is less than the length of `src`. +#[inline] +fn copy_memory(src: &[u8], mut dst: &mut [u8]) { + let len_src = src.len(); + assert!(dst.len() >= len_src); + dst.write_all(src).unwrap(); +} diff --git a/third_party/cargo/vendor/image-0.23.1/src/math/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/math/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/math/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/math/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/math/nq.rs b/third_party/cargo/vendor/image-0.23.4/src/math/nq.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/math/nq.rs rename to third_party/cargo/vendor/image-0.23.4/src/math/nq.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/math/rect.rs b/third_party/cargo/vendor/image-0.23.4/src/math/rect.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/math/rect.rs rename to third_party/cargo/vendor/image-0.23.4/src/math/rect.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/math/utils.rs b/third_party/cargo/vendor/image-0.23.4/src/math/utils.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/math/utils.rs rename to third_party/cargo/vendor/image-0.23.4/src/math/utils.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/png.rs b/third_party/cargo/vendor/image-0.23.4/src/png.rs similarity index 85% rename from third_party/cargo/vendor/image-0.23.1/src/png.rs rename to third_party/cargo/vendor/image-0.23.4/src/png.rs index d4b083e..dcb26dc 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/png.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/png.rs @@ -10,7 +10,9 @@ use std::convert::TryFrom; use std::io::{self, Read, Write}; use crate::color::{ColorType, ExtendedColorType}; -use crate::error::{DecodingError, ImageError, ImageResult, ParameterError, ParameterErrorKind}; +use crate::error::{ + DecodingError, ImageError, ImageResult, LimitError, LimitErrorKind, ParameterError, ParameterErrorKind, UnsupportedError, UnsupportedErrorKind +}; use crate::image::{ImageDecoder, ImageEncoder, ImageFormat}; /// PNG Reader @@ -97,6 +99,13 @@ pub struct PngDecoder { impl PngDecoder { /// Creates a new decoder that decodes from the stream ```r``` pub fn new(r: R) -> ImageResult> { + fn unsupported_color(ect: ExtendedColorType) -> ImageError { + ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Png.into(), + UnsupportedErrorKind::Color(ect), + )) + } + let limits = png::Limits { bytes: usize::max_value(), }; @@ -118,34 +127,34 @@ impl PngDecoder { (png::ColorType::RGBA, png::BitDepth::Sixteen) => ColorType::Rgba16, (png::ColorType::Grayscale, png::BitDepth::One) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::L1)), + return Err(unsupported_color(ExtendedColorType::L1)), (png::ColorType::GrayscaleAlpha, png::BitDepth::One) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::La1)), + return Err(unsupported_color(ExtendedColorType::La1)), (png::ColorType::RGB, png::BitDepth::One) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Rgb1)), + return Err(unsupported_color(ExtendedColorType::Rgb1)), (png::ColorType::RGBA, png::BitDepth::One) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Rgba1)), + return Err(unsupported_color(ExtendedColorType::Rgba1)), (png::ColorType::Grayscale, png::BitDepth::Two) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::L2)), + return Err(unsupported_color(ExtendedColorType::L2)), (png::ColorType::GrayscaleAlpha, png::BitDepth::Two) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::La2)), + return Err(unsupported_color(ExtendedColorType::La2)), (png::ColorType::RGB, png::BitDepth::Two) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Rgb2)), + return Err(unsupported_color(ExtendedColorType::Rgb2)), (png::ColorType::RGBA, png::BitDepth::Two) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Rgba2)), + return Err(unsupported_color(ExtendedColorType::Rgba2)), (png::ColorType::Grayscale, png::BitDepth::Four) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::L4)), + return Err(unsupported_color(ExtendedColorType::L4)), (png::ColorType::GrayscaleAlpha, png::BitDepth::Four) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::La4)), + return Err(unsupported_color(ExtendedColorType::La4)), (png::ColorType::RGB, png::BitDepth::Four) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Rgb4)), + return Err(unsupported_color(ExtendedColorType::Rgb4)), (png::ColorType::RGBA, png::BitDepth::Four) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Rgba4)), + return Err(unsupported_color(ExtendedColorType::Rgba4)), (png::ColorType::Indexed, bits) => - return Err(ImageError::UnsupportedColor(ExtendedColorType::Unknown(bits as u8))), + return Err(unsupported_color(ExtendedColorType::Unknown(bits as u8))), }; Ok(PngDecoder { color_type, reader }) @@ -205,7 +214,7 @@ impl PNGEncoder { PNGEncoder { w } } - /// Encodes the image ```image``` + /// Encodes the image ```data``` /// that has dimensions ```width``` and ```height``` /// and ```ColorType``` ```c``` pub fn encode(self, data: &[u8], width: u32, height: u32, color: ColorType) -> ImageResult<()> { @@ -218,7 +227,10 @@ impl PNGEncoder { ColorType::Rgb16 => (png::ColorType::RGB,png::BitDepth::Sixteen), ColorType::Rgba8 => (png::ColorType::RGBA, png::BitDepth::Eight), ColorType::Rgba16 => (png::ColorType::RGBA,png::BitDepth::Sixteen), - _ => return Err(ImageError::UnsupportedColor(color.into())), + _ => return Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Png.into(), + UnsupportedErrorKind::Color(color.into()), + ))), }; let mut encoder = png::Encoder::new(self.w, width, height); @@ -266,11 +278,13 @@ impl ImageError { use png::DecodingError::*; match err { IoError(err) => ImageError::IoError(err), - Format(message) => ImageError::Decoding(DecodingError::with_message( + err @ Format(_) => ImageError::Decoding(DecodingError::new( ImageFormat::Png.into(), - message.into_owned(), + err, + )), + LimitsExceeded => ImageError::Limits(LimitError::from_kind( + LimitErrorKind::InsufficientMemory, )), - LimitsExceeded => ImageError::InsufficientMemory, // Other is used when the buffer to `Reader::next_frame` is too small. Other(message) => ImageError::Parameter(ParameterError::from_kind( ParameterErrorKind::Generic(message.into_owned()) diff --git a/third_party/cargo/vendor/image-0.23.1/src/pnm/autobreak.rs b/third_party/cargo/vendor/image-0.23.4/src/pnm/autobreak.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/pnm/autobreak.rs rename to third_party/cargo/vendor/image-0.23.4/src/pnm/autobreak.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/pnm/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/pnm/decoder.rs similarity index 75% rename from third_party/cargo/vendor/image-0.23.1/src/pnm/decoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/pnm/decoder.rs index 9c06d82..98f98ba 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/pnm/decoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/pnm/decoder.rs @@ -18,6 +18,173 @@ use crate::utils; use byteorder::{BigEndian, ByteOrder, NativeEndian}; +/// All errors that can occur when attempting to parse a PNM +#[derive(Debug, Clone)] +enum DecoderError { + /// PNM's "P[123456]" signature wrong or missing + PnmMagicInvalid([u8; 2]), + /// Couldn't parse the specified string as an integer from the specified source + UnparsableValue(ErrorDataSource, String, ParseIntError), + + /// More than the exactly one allowed plane specified by the format + NonAsciiByteInHeader(u8), + /// The PAM header contained a non-ASCII byte + NonAsciiLineInPamHeader, + /// A sample string contained a non-ASCII byte + NonAsciiSample, + + /// The byte after the P7 magic was not 0x0A NEWLINE + NotNewlineAfterP7Magic(u8), + /// The PNM header had too few lines + UnexpectedPnmHeaderEnd, + + /// The specified line was specified twice + HeaderLineDuplicated(PnmHeaderLine), + /// The line with the specified ID was not understood + HeaderLineUnknown(String), + /// At least one of the required lines were missing from the header (are `None` here) + /// + /// Same names as [`PnmHeaderLine`](enum.PnmHeaderLine.html) + #[allow(missing_docs)] + HeaderLineMissing { + height: Option, + width: Option, + depth: Option, + maxval: Option, + }, + + /// Not enough data was provided to the Decoder to decode the image + InputTooShort, + /// Sample raster contained unexpected byte + UnexpectedByteInRaster(u8), + /// Specified sample was out of bounds (e.g. >1 in B&W) + SampleOutOfBounds(u8), + /// The image's maxval exceeds 0xFFFF + MaxvalTooBig(u32), + + /// The specified tuple type supports restricted depths and maxvals, those restrictions were not met + InvalidDepthOrMaxval { + tuple_type: ArbitraryTuplType, + depth: u32, + maxval: u32, + }, + /// The specified tuple type supports restricted depths, those restrictions were not met + InvalidDepth { + tuple_type: ArbitraryTuplType, + depth: u32, + }, + /// The tuple type was not recognised by the parser + TupleTypeUnrecognised, +} + +impl Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DecoderError::PnmMagicInvalid(magic) => + f.write_fmt(format_args!("Expected magic constant for PNM: P1..P7, got [{:#04X?}, {:#04X?}]", magic[0], magic[1])), + DecoderError::UnparsableValue(src, data, err) => + f.write_fmt(format_args!("Error parsing {:?} as {}: {}", data, src, err)), + + DecoderError::NonAsciiByteInHeader(c) => + f.write_fmt(format_args!("Non-ASCII character {:#04X?} in header", c)), + DecoderError::NonAsciiLineInPamHeader => + f.write_str("Non-ASCII line in PAM header"), + DecoderError::NonAsciiSample => + f.write_str("Non-ASCII character where sample value was expected"), + + DecoderError::NotNewlineAfterP7Magic(c) => + f.write_fmt(format_args!("Expected newline after P7 magic, got {:#04X?}", c)), + DecoderError::UnexpectedPnmHeaderEnd => + f.write_str("Unexpected end of PNM header"), + + DecoderError::HeaderLineDuplicated(line) => + f.write_fmt(format_args!("Duplicate {} line", line)), + DecoderError::HeaderLineUnknown(identifier) => + f.write_fmt(format_args!("Unknown header line with identifier {:?}", identifier)), + DecoderError::HeaderLineMissing { height, width, depth, maxval } => + f.write_fmt(format_args!("Missing header line: have height={:?}, width={:?}, depth={:?}, maxval={:?}", height, width, depth, maxval)), + + DecoderError::InputTooShort => + f.write_str("Not enough data was provided to the Decoder to decode the image"), + DecoderError::UnexpectedByteInRaster(c) => + f.write_fmt(format_args!("Unexpected character {:#04X?} within sample raster", c)), + DecoderError::SampleOutOfBounds(val) => + f.write_fmt(format_args!("Sample value {} outside of bounds", val)), + DecoderError::MaxvalTooBig(maxval) => + f.write_fmt(format_args!("Image MAXVAL exceeds {}: {}", 0xFFFF, maxval)), + + DecoderError::InvalidDepthOrMaxval { tuple_type, depth, maxval } => + f.write_fmt(format_args!("Invalid depth ({}) or maxval ({}) for tuple type {}", depth, maxval, tuple_type.name())), + DecoderError::InvalidDepth { tuple_type, depth } => + f.write_fmt(format_args!("Invalid depth ({}) for tuple type {}", depth, tuple_type.name())), + DecoderError::TupleTypeUnrecognised => + f.write_str("Tuple type not recognized"), + } + } +} + +/// Note: should `pnm` be extracted into a separate crate, +/// this will need to be hidden until that crate hits version `1.0`. +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::Pnm.into(), e)) + } +} + +impl error::Error for DecoderError { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self { + DecoderError::UnparsableValue(_, _, err) => Some(err), + _ => None, + } + } +} + +/// Single-value lines in a PNM header +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum PnmHeaderLine { + /// "HEIGHT" + Height, + /// "WIDTH" + Width, + /// "DEPTH" + Depth, + /// "MAXVAL", a.k.a. `maxwhite` + Maxval, +} + +impl Display for PnmHeaderLine { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(match self { + PnmHeaderLine::Height => "HEIGHT", + PnmHeaderLine::Width => "WIDTH", + PnmHeaderLine::Depth => "DEPTH", + PnmHeaderLine::Maxval => "MAXVAL", + }) + } +} + +/// Single-value lines in a PNM header +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] +enum ErrorDataSource { + /// One of the header lines + Line(PnmHeaderLine), + /// Value in the preamble + Preamble, + /// Sample/pixel data + Sample, +} + +impl Display for ErrorDataSource { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ErrorDataSource::Line(l) => l.fmt(f), + ErrorDataSource::Preamble => f.write_str("number in preamble"), + ErrorDataSource::Sample => f.write_str("sample"), + } + } +} + /// Dynamic representation, represents all decodable (sample, depth) combinations. #[derive(Clone, Copy)] enum TupleType { @@ -61,33 +228,16 @@ impl PnmDecoder { pub fn new(read: R) -> ImageResult> { let mut buf = BufReader::new(read); let magic = buf.read_magic_constant()?; - if magic[0] != b'P' { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - format!( - "Expected magic constant for pnm, P1 through P7 instead of {:?}", - magic - ), - ))); - } - let subtype = match magic[1] { - b'1' => PNMSubtype::Bitmap(SampleEncoding::Ascii), - b'2' => PNMSubtype::Graymap(SampleEncoding::Ascii), - b'3' => PNMSubtype::Pixmap(SampleEncoding::Ascii), - b'4' => PNMSubtype::Bitmap(SampleEncoding::Binary), - b'5' => PNMSubtype::Graymap(SampleEncoding::Binary), - b'6' => PNMSubtype::Pixmap(SampleEncoding::Binary), - b'7' => PNMSubtype::ArbitraryMap, - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - format!( - "Expected magic constant for pnm, P1 through P7 instead of {:?}", - magic - ), - ))); - } + let subtype = match magic { + [b'P', b'1'] => PNMSubtype::Bitmap(SampleEncoding::Ascii), + [b'P', b'2'] => PNMSubtype::Graymap(SampleEncoding::Ascii), + [b'P', b'3'] => PNMSubtype::Pixmap(SampleEncoding::Ascii), + [b'P', b'4'] => PNMSubtype::Bitmap(SampleEncoding::Binary), + [b'P', b'5'] => PNMSubtype::Graymap(SampleEncoding::Binary), + [b'P', b'6'] => PNMSubtype::Pixmap(SampleEncoding::Binary), + [b'P', b'7'] => PNMSubtype::ArbitraryMap, + _ => Err(DecoderError::PnmMagicInvalid(magic))?, }; match subtype { @@ -195,12 +345,7 @@ trait HeaderReader: BufRead { break; // We're done as we already have some content } } - Ok(byte) if !byte.is_ascii() => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - format!("Non ascii character {} in header", byte), - ))); - }, + Ok(byte) if !byte.is_ascii() => Err(DecoderError::NonAsciiByteInHeader(byte))?, Ok(byte) => { bytes.push(byte); }, @@ -214,12 +359,12 @@ trait HeaderReader: BufRead { if !bytes.as_slice().is_ascii() { // We have only filled the buffer with characters for which `byte.is_ascii()` holds. - unreachable!("Non ascii character should have returned sooner") + unreachable!("Non-ASCII character should have returned sooner") } let string = String::from_utf8(bytes) // We checked the precondition ourselves a few lines before, `bytes.as_slice().is_ascii()`. - .unwrap_or_else(|_| unreachable!("Only ascii characters should be decoded")); + .unwrap_or_else(|_| unreachable!("Only ASCII characters should be decoded")); Ok(string) } @@ -234,7 +379,7 @@ trait HeaderReader: BufRead { fn read_next_u32(&mut self) -> ImageResult { let s = self.read_next_string()?; s.parse::() - .map_err(|err| PrimitiveParseError::NumberInPreamble(s.to_owned(), err).into()) + .map_err(|err| DecoderError::UnparsableValue(ErrorDataSource::Preamble, s, err).into()) } fn read_bitmap_header(&mut self, encoding: SampleEncoding) -> ImageResult { @@ -276,16 +421,21 @@ trait HeaderReader: BufRead { } fn read_arbitrary_header(&mut self) -> ImageResult { + fn parse_single_value_line(line_val: &mut Option, rest: &str, line: PnmHeaderLine) -> ImageResult<()> { + if line_val.is_some() { + return Err(DecoderError::HeaderLineDuplicated(line).into()); + } else { + let v = rest.trim().parse().map_err(|err| DecoderError::UnparsableValue(ErrorDataSource::Line(line), rest.to_owned(), err))?; + *line_val = Some(v); + Ok(()) + } + } + match self.bytes().next() { None => return Err(ImageError::IoError(io::ErrorKind::UnexpectedEof.into())), Some(Err(io)) => return Err(ImageError::IoError(io)), Some(Ok(b'\n')) => (), - Some(Ok(c)) => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - format!("Expected newline after P7 magic instead of {}", c), - ))) - } + Some(Ok(c)) => return Err(DecoderError::NotNewlineAfterP7Magic(c).into()), } let mut line = String::new(); @@ -298,81 +448,23 @@ trait HeaderReader: BufRead { line.truncate(0); let len = self.read_line(&mut line)?; if len == 0 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Unexpected end of pnm header".to_string(), - ))); + return Err(DecoderError::UnexpectedPnmHeaderEnd.into()); } if line.as_bytes()[0] == b'#' { continue; } if !line.is_ascii() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Only ascii characters allowed in pam header".to_string(), - ))); + return Err(DecoderError::NonAsciiLineInPamHeader.into()); } #[allow(deprecated)] let (identifier, rest) = line.trim_left() .split_at(line.find(char::is_whitespace).unwrap_or_else(|| line.len())); match identifier { "ENDHDR" => break, - "HEIGHT" => { - if height.is_some() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Duplicate HEIGHT line".to_string(), - ))); - } else { - let h = rest - .trim() - .parse::() - .map_err(|err| PrimitiveParseError::Height(rest.to_owned(), err))?; - height = Some(h); - } - } - "WIDTH" => { - if width.is_some() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Duplicate WIDTH line".to_string(), - ))); - } else { - let w = rest - .trim() - .parse::() - .map_err(|err| PrimitiveParseError::Width(rest.to_owned(), err))?; - width = Some(w); - } - } - "DEPTH" => { - if depth.is_some() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Duplicate DEPTH line".to_string(), - ))); - } else { - let d = rest - .trim() - .parse::() - .map_err(|err| PrimitiveParseError::Depth(rest.to_owned(), err))?; - depth = Some(d); - } - } - "MAXVAL" => { - if maxval.is_some() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Duplicate MAXVAL line".to_string(), - ))); - } else { - let m = rest - .trim() - .parse::() - .map_err(|err| PrimitiveParseError::Maxval(rest.to_owned(), err))?; - maxval = Some(m); - } - } + "HEIGHT" => parse_single_value_line(&mut height, rest, PnmHeaderLine::Height)?, + "WIDTH" => parse_single_value_line(&mut width, rest, PnmHeaderLine::Width)?, + "DEPTH" => parse_single_value_line(&mut depth, rest, PnmHeaderLine::Depth)?, + "MAXVAL" => parse_single_value_line(&mut maxval, rest, PnmHeaderLine::Maxval)?, "TUPLTYPE" => { let identifier = rest.trim(); if tupltype.is_some() { @@ -386,49 +478,19 @@ trait HeaderReader: BufRead { tupltype = Some(identifier.to_string()); } } - _ => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Unknown header line".to_string(), - ))) - } + _ => return Err(DecoderError::HeaderLineUnknown(identifier.to_string()).into()), } } let (h, w, d, m) = match (height, width, depth, maxval) { - (None, _, _, _) => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Expected one HEIGHT line".to_string(), - ))) - } - (_, None, _, _) => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Expected one WIDTH line".to_string(), - ))) - } - (_, _, None, _) => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Expected one DEPTH line".to_string(), - ))) - } - (_, _, _, None) => { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Expected one MAXVAL line".to_string(), - ))) - } (Some(h), Some(w), Some(d), Some(m)) => (h, w, d, m), + _ => return Err(DecoderError::HeaderLineMissing { height, width, depth, maxval }.into()), }; let tupltype = match tupltype { None => None, Some(ref t) if t == "BLACKANDWHITE" => Some(ArbitraryTuplType::BlackAndWhite), - Some(ref t) if t == "BLACKANDWHITE_ALPHA" => { - Some(ArbitraryTuplType::BlackAndWhiteAlpha) - } + Some(ref t) if t == "BLACKANDWHITE_ALPHA" => Some(ArbitraryTuplType::BlackAndWhiteAlpha), Some(ref t) if t == "GRAYSCALE" => Some(ArbitraryTuplType::Grayscale), Some(ref t) if t == "GRAYSCALE_ALPHA" => Some(ArbitraryTuplType::GrayscaleAlpha), Some(ref t) if t == "RGB" => Some(ArbitraryTuplType::RGB), @@ -511,13 +573,6 @@ impl<'a, R: 'a + Read> ImageDecoder<'a> for PnmDecoder { } } -fn err_input_is_too_short() -> ImageError { - ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Not enough data was provided to the Decoder to decode the image".to_string(), - )) -} - impl PnmDecoder { fn read_samples(&mut self, components: u32) -> ImageResult> { match self.subtype().sample_encoding() { @@ -535,7 +590,7 @@ impl PnmDecoder { .read_to_end(&mut bytes)?; if bytes.len() != bytecount { - return Err(err_input_is_too_short()); + return Err(DecoderError::InputTooShort.into()); } let samples = S::from_bytes(&bytes, width, height, components)?; @@ -573,19 +628,15 @@ fn read_separated_ascii>(reader: &mut dyn Read) .collect::, _>>()?; if !token.is_ascii() { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Non ascii character where sample value was expected".to_string(), - ))); + return Err(DecoderError::NonAsciiSample.into()); } let string = str::from_utf8(&token) - // We checked the precondition ourselves a few lines before, `token.is_ascii()`. - .unwrap_or_else(|_| unreachable!("Only ascii characters should be decoded")); + // We checked the precondition ourselves a few lines before with `token.is_ascii()`. + .unwrap_or_else(|_| unreachable!("Only ASCII characters should be decoded")); - string - .parse() - .map_err(|err| PrimitiveParseError::Sample(string.to_owned(), err).into()) + string.parse() + .map_err(|err| DecoderError::UnparsableValue(ErrorDataSource::Sample, string.to_owned(), err).into()) } impl Sample for U8 { @@ -694,16 +745,13 @@ impl Sample for PbmBit { | Ok(b'\x0c') | Ok(b'\r') | Ok(b' ') => None, - Ok(c) => Some(Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - format!("Unexpected character {} within sample raster", c), - )))), + Ok(c) => Some(Err(DecoderError::UnexpectedByteInRaster(c).into())), }) .take(count) .collect::>>()?; if raw_samples.len() < count { - return Err(err_input_is_too_short()) + return Err(DecoderError::InputTooShort.into()); } Ok(raw_samples) @@ -726,11 +774,8 @@ impl Sample for BWBit { let values = U8::from_bytes(bytes, width, height, samples)?; if let Some(val) = values.iter().find(|&val| *val > 1) { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - format!("Sample value {} outside of bounds", val), - ))); - }; + return Err(DecoderError::SampleOutOfBounds(*val).into()); + } Ok(values) } @@ -740,7 +785,7 @@ impl Sample for BWBit { _height: u32, _samples: u32, ) -> ImageResult> { - unreachable!("BW bits from anymaps are never encoded as ascii") + unreachable!("BW bits from anymaps are never encoded as ASCII") } } @@ -755,10 +800,7 @@ impl DecodableImageHeader for GraymapHeader { match self.maxwhite { v if v <= 0xFF => Ok(TupleType::GrayU8), v if v <= 0xFFFF => Ok(TupleType::GrayU16), - _ => Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Image maxval is not less or equal to 65535".to_string(), - ))), + _ => Err(DecoderError::MaxvalTooBig(self.maxwhite).into()), } } } @@ -768,10 +810,7 @@ impl DecodableImageHeader for PixmapHeader { match self.maxval { v if v <= 0xFF => Ok(TupleType::RGBU8), v if v <= 0xFFFF => Ok(TupleType::RGBU16), - _ => Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Image maxval is not less or equal to 65535".to_string(), - ))), + _ => Err(DecoderError::MaxvalTooBig(self.maxval).into()), } } } @@ -780,19 +819,24 @@ impl DecodableImageHeader for ArbitraryHeader { fn tuple_type(&self) -> ImageResult { match self.tupltype { None if self.depth == 1 => Ok(TupleType::GrayU8), - None if self.depth == 2 => Err(ImageError::UnsupportedColor(ExtendedColorType::La8)), + None if self.depth == 2 => Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Pnm.into(), + UnsupportedErrorKind::Color(ExtendedColorType::La8), + ))), None if self.depth == 3 => Ok(TupleType::RGBU8), - None if self.depth == 4 => Err(ImageError::UnsupportedColor(ExtendedColorType::Rgba8)), + None if self.depth == 4 => Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::Pnm.into(), + UnsupportedErrorKind::Color(ExtendedColorType::Rgba8), + ))), Some(ArbitraryTuplType::BlackAndWhite) if self.maxval == 1 && self.depth == 1 => { Ok(TupleType::BWBit) } - Some(ArbitraryTuplType::BlackAndWhite) => { - Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Invalid depth or maxval for tuple type BLACKANDWHITE".to_string(), - ))) - } + Some(ArbitraryTuplType::BlackAndWhite) => Err(DecoderError::InvalidDepthOrMaxval { + tuple_type: ArbitraryTuplType::BlackAndWhite, + maxval: self.maxval, + depth: self.depth, + }.into()), Some(ArbitraryTuplType::Grayscale) if self.depth == 1 && self.maxval <= 0xFF => { Ok(TupleType::GrayU8) @@ -800,12 +844,11 @@ impl DecodableImageHeader for ArbitraryHeader { Some(ArbitraryTuplType::Grayscale) if self.depth <= 1 && self.maxval <= 0xFFFF => { Ok(TupleType::GrayU16) } - Some(ArbitraryTuplType::Grayscale) => { - Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Invalid depth or maxval for tuple type GRAYSCALE".to_string(), - ))) - } + Some(ArbitraryTuplType::Grayscale) => Err(DecoderError::InvalidDepthOrMaxval { + tuple_type: ArbitraryTuplType::Grayscale, + maxval: self.maxval, + depth: self.depth, + }.into()), Some(ArbitraryTuplType::RGB) if self.depth == 3 && self.maxval <= 0xFF => { Ok(TupleType::RGBU8) @@ -813,15 +856,16 @@ impl DecodableImageHeader for ArbitraryHeader { Some(ArbitraryTuplType::RGB) if self.depth == 3 && self.maxval <= 0xFFFF => { Ok(TupleType::RGBU16) } - Some(ArbitraryTuplType::RGB) => Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Invalid depth for tuple type RGB".to_string(), - ))), + Some(ArbitraryTuplType::RGB) => Err(DecoderError::InvalidDepth { + tuple_type: ArbitraryTuplType::RGB, + depth: self.depth, + }.into()), Some(ArbitraryTuplType::BlackAndWhiteAlpha) => { - Err(ImageError::Decoding(DecodingError::with_message( + Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( ImageFormat::Pnm.into(), - "Unsupported color type: BlackAndWhiteAlpha".to_string(), + UnsupportedErrorKind::GenericFeature( + format!("Color type {}", ArbitraryTuplType::BlackAndWhiteAlpha.name())), ))) } Some(ArbitraryTuplType::GrayscaleAlpha) => Err(ImageError::Unsupported( @@ -840,72 +884,16 @@ impl DecodableImageHeader for ArbitraryHeader { UnsupportedError::from_format_and_kind( ImageFormat::Pnm.into(), UnsupportedErrorKind::GenericFeature(format!( - "Tuple type {:?} not supported", + "Tuple type {:?}", custom )), ), )), - None => Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::Pnm.into(), - "Tuple type not recognized".to_string(), - ))), + None => Err(DecoderError::TupleTypeUnrecognised.into()), } } } -/// An internal error type for primitive value. -#[derive(Debug, Clone)] -enum PrimitiveParseError { - /// Failed to parse a value in preamble. - NumberInPreamble(String, ParseIntError), - /// Failed to parse height. - Height(String, ParseIntError), - /// Failed to parse width. - Width(String, ParseIntError), - /// Failed to parse depth. - Depth(String, ParseIntError), - /// Failed to parse maxval. - Maxval(String, ParseIntError), - /// Failed to parse a sample. - Sample(String, ParseIntError), -} - -impl Display for PrimitiveParseError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - PrimitiveParseError::NumberInPreamble(s, err) => { - write!(f, "Error parsing number {:?} in preamble: {}", s, err) - } - PrimitiveParseError::Height(s, err) => write!(f, "Invalid height {:?}: {}", s, err), - PrimitiveParseError::Width(s, err) => write!(f, "Invalid width {:?}: {}", s, err), - PrimitiveParseError::Depth(s, err) => write!(f, "Invalid depth {:?}: {}", s, err), - PrimitiveParseError::Maxval(s, err) => write!(f, "Invalid maxval {:?}: {}", s, err), - PrimitiveParseError::Sample(s, err) => { - write!(f, "Error parsing {:?} as a sample: {}", s, err) - } - } - } -} - -impl error::Error for PrimitiveParseError { - fn source(&self) -> Option<&(dyn error::Error + 'static)> { - match self { - PrimitiveParseError::NumberInPreamble(_, err) => Some(err), - PrimitiveParseError::Height(_, err) => Some(err), - PrimitiveParseError::Width(_, err) => Some(err), - PrimitiveParseError::Depth(_, err) => Some(err), - PrimitiveParseError::Maxval(_, err) => Some(err), - PrimitiveParseError::Sample(_, err) => Some(err), - } - } -} - -impl From for ImageError { - fn from(e: PrimitiveParseError) -> ImageError { - ImageError::Decoding(DecodingError::new(ImageFormat::Pnm.into(), e)) - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/third_party/cargo/vendor/image-0.23.1/src/pnm/encoder.rs b/third_party/cargo/vendor/image-0.23.4/src/pnm/encoder.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/pnm/encoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/pnm/encoder.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/pnm/header.rs b/third_party/cargo/vendor/image-0.23.4/src/pnm/header.rs similarity index 87% rename from third_party/cargo/vendor/image-0.23.1/src/pnm/header.rs rename to third_party/cargo/vendor/image-0.23.4/src/pnm/header.rs index 927d8fa..0f01ccd 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/pnm/header.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/pnm/header.rs @@ -1,4 +1,4 @@ -use std::io; +use std::{fmt, io}; /// The kind of encoding used to store sample values #[derive(Clone, Copy, PartialEq, Eq, Debug)] @@ -133,6 +133,20 @@ pub enum ArbitraryTuplType { Custom(String), } +impl ArbitraryTuplType { + pub(crate) fn name(&self) -> &str { + match self { + ArbitraryTuplType::BlackAndWhite => "BLACKANDWHITE", + ArbitraryTuplType::BlackAndWhiteAlpha => "BLACKANDWHITE_ALPHA", + ArbitraryTuplType::Grayscale => "GRAYSCALE", + ArbitraryTuplType::GrayscaleAlpha => "GRAYSCALE_ALPHA", + ArbitraryTuplType::RGB => "RGB", + ArbitraryTuplType::RGBAlpha => "RGB_ALPHA", + ArbitraryTuplType::Custom(custom) => custom, + } + } +} + impl PNMSubtype { /// Get the two magic constant bytes corresponding to this format subtype. pub fn magic_constant(self) -> &'static [u8; 2] { @@ -279,32 +293,20 @@ impl PNMHeader { }), .. } => { - #[allow(unused_assignments)] - // Declared here so its lifetime exceeds the matching. This is a trivial - // constructor, no allocation takes place and in the custom case we must allocate - // regardless due to borrow. Still, the warnings checker does pick this up :/ - // Could use std::borrow::Cow instead but that really doesn't achieve anything but - // increasing type complexity. - let mut custom_fallback = String::new(); - - let tupltype = match *tupltype { - None => "", - Some(ArbitraryTuplType::BlackAndWhite) => "TUPLTYPE BLACKANDWHITE\n", - Some(ArbitraryTuplType::BlackAndWhiteAlpha) => "TUPLTYPE BLACKANDWHITE_ALPHA\n", - Some(ArbitraryTuplType::Grayscale) => "TUPLTYPE GRAYSCALE\n", - Some(ArbitraryTuplType::GrayscaleAlpha) => "TUPLTYPE GRAYSCALE_ALPHA\n", - Some(ArbitraryTuplType::RGB) => "TUPLTYPE RGB\n", - Some(ArbitraryTuplType::RGBAlpha) => "TUPLTYPE RGB_ALPHA\n", - Some(ArbitraryTuplType::Custom(ref custom)) => { - custom_fallback = format!("TUPLTYPE {}", custom); - &custom_fallback + struct TupltypeWriter<'a>(&'a Option); + impl<'a> fmt::Display for TupltypeWriter<'a> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self.0 { + Some(tt) => write!(f, "TUPLTYPE {}\n", tt.name()), + None => Ok(()), + } } - }; + } writeln!( writer, "\nWIDTH {}\nHEIGHT {}\nDEPTH {}\nMAXVAL {}\n{}ENDHDR", - width, height, depth, maxval, tupltype + width, height, depth, maxval, TupltypeWriter(tupltype) ) } } diff --git a/third_party/cargo/vendor/image-0.23.1/src/pnm/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/pnm/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/pnm/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/pnm/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/tga/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/tga/decoder.rs similarity index 91% rename from third_party/cargo/vendor/image-0.23.1/src/tga/decoder.rs rename to third_party/cargo/vendor/image-0.23.4/src/tga/decoder.rs index 29145e1..f4ffa43 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/tga/decoder.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/tga/decoder.rs @@ -3,9 +3,9 @@ use std::convert::TryFrom; use std::io; use std::io::{Read, Seek}; -use crate::color::ColorType; -use crate::error::{ImageError, ImageResult}; -use crate::image::{ImageDecoder, ImageReadBuffer}; +use crate::color::{ColorType, ExtendedColorType}; +use crate::error::{ImageError, ImageResult, UnsupportedError, UnsupportedErrorKind}; +use crate::image::{ImageDecoder, ImageFormat, ImageReadBuffer}; enum ImageType { NoImageData = 0, @@ -221,16 +221,18 @@ impl TgaDecoder { /// Loads the color information for the decoder /// /// To keep things simple, we won't handle bit depths that aren't divisible - /// by 8 and are less than 32. + /// by 8 and are larger than 32. fn read_color_information(&mut self) -> ImageResult<()> { - if self.header.pixel_depth % 8 != 0 { - return Err(ImageError::UnsupportedError( - "Bit depth must be divisible by 8".to_string(), - )); - } - if self.header.pixel_depth > 32 { - return Err(ImageError::UnsupportedError( - "Bit depth must be less than 32".to_string(), + if self.header.pixel_depth % 8 != 0 || self.header.pixel_depth > 32 { + // Bit depth must be divisible by 8, and must be less than or equal + // to 32. + return Err(ImageError::Unsupported( + UnsupportedError::from_format_and_kind( + ImageFormat::Tga.into(), + UnsupportedErrorKind::Color(ExtendedColorType::Unknown( + self.header.pixel_depth, + )), + ), )); } @@ -240,8 +242,13 @@ impl TgaDecoder { self.header.map_entry_size } else { if num_alpha_bits > self.header.pixel_depth { - return Err(ImageError::UnsupportedError( - format!("Color format not supported. Alpha bits: {}", num_alpha_bits), + return Err(ImageError::Unsupported( + UnsupportedError::from_format_and_kind( + ImageFormat::Tga.into(), + UnsupportedErrorKind::Color(ExtendedColorType::Unknown( + self.header.pixel_depth, + )), + ), )); } @@ -258,10 +265,14 @@ impl TgaDecoder { (8, 8, false) => self.color_type = ColorType::La8, (0, 8, false) => self.color_type = ColorType::L8, _ => { - return Err(ImageError::UnsupportedError(format!( - "Color format not supported. Bit depth: {}, Alpha bits: {}", - other_channel_bits, num_alpha_bits - ))) + return Err(ImageError::Unsupported( + UnsupportedError::from_format_and_kind( + ImageFormat::Tga.into(), + UnsupportedErrorKind::Color(ExtendedColorType::Unknown( + self.header.pixel_depth, + )), + ), + )) } } Ok(()) diff --git a/third_party/cargo/vendor/image-0.23.1/src/tga/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/tga/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/tga/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/tga/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/tiff.rs b/third_party/cargo/vendor/image-0.23.4/src/tiff.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/tiff.rs rename to third_party/cargo/vendor/image-0.23.4/src/tiff.rs diff --git a/third_party/cargo/vendor/image-0.23.4/src/traits.rs b/third_party/cargo/vendor/image-0.23.4/src/traits.rs new file mode 100644 index 0000000..cdd1324 --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/src/traits.rs @@ -0,0 +1,231 @@ +//! This module provides useful traits that were deprecated in rust + +// Note copied from the stdlib under MIT license + +use num_traits::{Bounded, Num, NumCast}; +use std::ops::AddAssign; + +use crate::color::{ColorType, Luma, LumaA, Rgb, Rgba, Bgr, Bgra}; + +/// Types which are safe to treat as an immutable byte slice in a pixel layout +/// for image encoding. +pub trait EncodableLayout: seals::EncodableLayout { + /// Get the bytes of this value. + fn as_bytes(&self) -> &[u8]; +} + +impl EncodableLayout for [u8] { + fn as_bytes(&self) -> &[u8] { + bytemuck::cast_slice(self) + } +} + +impl EncodableLayout for [u16] { + fn as_bytes(&self) -> &[u8] { + bytemuck::cast_slice(self) + } +} + +/// Primitive trait from old stdlib +pub trait Primitive: Copy + NumCast + Num + PartialOrd + Clone + Bounded {} + +impl Primitive for usize {} +impl Primitive for u8 {} +impl Primitive for u16 {} +impl Primitive for u32 {} +impl Primitive for u64 {} +impl Primitive for isize {} +impl Primitive for i8 {} +impl Primitive for i16 {} +impl Primitive for i32 {} +impl Primitive for i64 {} +impl Primitive for f32 {} +impl Primitive for f64 {} + +/// An Enlargable::Larger value should be enough to calculate +/// the sum (average) of a few hundred or thousand Enlargeable values. +pub trait Enlargeable: Sized + Bounded + NumCast { + type Larger: Primitive + AddAssign + 'static; + + fn clamp_from(n: Self::Larger) -> Self { + // Note: Only unsigned value types supported. + if n > NumCast::from(Self::max_value()).unwrap() { + Self::max_value() + } else { + NumCast::from(n).unwrap() + } + } +} + +impl Enlargeable for u8 { + type Larger = u32; +} +impl Enlargeable for u16 { + type Larger = u32; +} +impl Enlargeable for u32 { + type Larger = u64; +} + +/// A generalized pixel. +/// +/// A pixel object is usually not used standalone but as a view into an image buffer. +pub trait Pixel: Copy + Clone { + /// The underlying subpixel type. + type Subpixel: Primitive; + + /// The number of channels of this pixel type. + const CHANNEL_COUNT: u8; + /// Returns the number of channels of this pixel type. + #[deprecated(note="please use CHANNEL_COUNT associated constant")] + fn channel_count() -> u8 { + Self::CHANNEL_COUNT + } + + /// Returns the components as a slice. + fn channels(&self) -> &[Self::Subpixel]; + + /// Returns the components as a mutable slice + fn channels_mut(&mut self) -> &mut [Self::Subpixel]; + + /// A string that can help to interpret the meaning each channel + /// See [gimp babl](http://gegl.org/babl/). + const COLOR_MODEL: &'static str; + /// Returns a string that can help to interpret the meaning each channel + /// See [gimp babl](http://gegl.org/babl/). + #[deprecated(note="please use COLOR_MODEL associated constant")] + fn color_model() -> &'static str { + Self::COLOR_MODEL + } + + /// ColorType for this pixel format + const COLOR_TYPE: ColorType; + /// Returns the ColorType for this pixel format + #[deprecated(note="please use COLOR_TYPE associated constant")] + fn color_type() -> ColorType { + Self::COLOR_TYPE + } + + /// Returns the channels of this pixel as a 4 tuple. If the pixel + /// has less than 4 channels the remainder is filled with the maximum value + /// + /// TODO deprecate + fn channels4( + &self, + ) -> ( + Self::Subpixel, + Self::Subpixel, + Self::Subpixel, + Self::Subpixel, + ); + + /// Construct a pixel from the 4 channels a, b, c and d. + /// If the pixel does not contain 4 channels the extra are ignored. + /// + /// TODO deprecate + fn from_channels( + a: Self::Subpixel, + b: Self::Subpixel, + c: Self::Subpixel, + d: Self::Subpixel, + ) -> Self; + + /// Returns a view into a slice. + /// + /// Note: The slice length is not checked on creation. Thus the caller has to ensure + /// that the slice is long enough to present panics if the pixel is used later on. + fn from_slice(slice: &[Self::Subpixel]) -> &Self; + + /// Returns mutable view into a mutable slice. + /// + /// Note: The slice length is not checked on creation. Thus the caller has to ensure + /// that the slice is long enough to present panics if the pixel is used later on. + fn from_slice_mut(slice: &mut [Self::Subpixel]) -> &mut Self; + + /// Convert this pixel to RGB + fn to_rgb(&self) -> Rgb; + + /// Convert this pixel to RGB with an alpha channel + fn to_rgba(&self) -> Rgba; + + /// Convert this pixel to luma + fn to_luma(&self) -> Luma; + + /// Convert this pixel to luma with an alpha channel + fn to_luma_alpha(&self) -> LumaA; + + /// Convert this pixel to BGR + fn to_bgr(&self) -> Bgr; + + /// Convert this pixel to BGR with an alpha channel + fn to_bgra(&self) -> Bgra; + + /// Apply the function ```f``` to each channel of this pixel. + fn map(&self, f: F) -> Self + where + F: FnMut(Self::Subpixel) -> Self::Subpixel; + + /// Apply the function ```f``` to each channel of this pixel. + fn apply(&mut self, f: F) + where + F: FnMut(Self::Subpixel) -> Self::Subpixel; + + /// Apply the function ```f``` to each channel except the alpha channel. + /// Apply the function ```g``` to the alpha channel. + fn map_with_alpha(&self, f: F, g: G) -> Self + where + F: FnMut(Self::Subpixel) -> Self::Subpixel, + G: FnMut(Self::Subpixel) -> Self::Subpixel; + + /// Apply the function ```f``` to each channel except the alpha channel. + /// Apply the function ```g``` to the alpha channel. Works in-place. + fn apply_with_alpha(&mut self, f: F, g: G) + where + F: FnMut(Self::Subpixel) -> Self::Subpixel, + G: FnMut(Self::Subpixel) -> Self::Subpixel; + + /// Apply the function ```f``` to each channel except the alpha channel. + fn map_without_alpha(&self, f: F) -> Self + where + F: FnMut(Self::Subpixel) -> Self::Subpixel, + { + let mut this = *self; + this.apply_with_alpha(f, |x| x); + this + } + + /// Apply the function ```f``` to each channel except the alpha channel. + /// Works in place. + fn apply_without_alpha(&mut self, f: F) + where + F: FnMut(Self::Subpixel) -> Self::Subpixel, + { + self.apply_with_alpha(f, |x| x); + } + + /// Apply the function ```f``` to each channel of this pixel and + /// ```other``` pairwise. + fn map2(&self, other: &Self, f: F) -> Self + where + F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel; + + /// Apply the function ```f``` to each channel of this pixel and + /// ```other``` pairwise. Works in-place. + fn apply2(&mut self, other: &Self, f: F) + where + F: FnMut(Self::Subpixel, Self::Subpixel) -> Self::Subpixel; + + /// Invert this pixel + fn invert(&mut self); + + /// Blend the color of a given pixel into ourself, taking into account alpha channels + fn blend(&mut self, other: &Self); +} + +/// Private module for supertraits of sealed traits. +mod seals { + pub trait EncodableLayout {} + + impl EncodableLayout for [u8] {} + impl EncodableLayout for [u16] {} +} diff --git a/third_party/cargo/vendor/image-0.23.1/src/utils/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/utils/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/utils/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/utils/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.4/src/webp/decoder.rs b/third_party/cargo/vendor/image-0.23.4/src/webp/decoder.rs new file mode 100644 index 0000000..5a81352 --- /dev/null +++ b/third_party/cargo/vendor/image-0.23.4/src/webp/decoder.rs @@ -0,0 +1,184 @@ +use byteorder::{LittleEndian, ReadBytesExt}; +use std::convert::TryFrom; +use std::default::Default; +use std::{error, fmt, mem}; +use std::io::{self, Cursor, Read}; +use std::marker::PhantomData; + +use crate::error::{DecodingError, ImageError, ImageResult, UnsupportedError, UnsupportedErrorKind}; +use crate::image::{ImageDecoder, ImageFormat}; + +use crate::color; + +use super::vp8::Frame; +use super::vp8::Vp8Decoder; + +/// All errors that can occur when attempting to parse a WEBP container +#[derive(Debug, Clone, Copy)] +enum DecoderError { + /// RIFF's "RIFF" signature not found or invalid + RiffSignatureInvalid([u8; 4]), + /// WebP's "WEBP" signature not found or invalid + WebpSignatureInvalid([u8; 4]), +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + struct SignatureWriter([u8; 4]); + impl fmt::Display for SignatureWriter { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "[{:#04X?}, {:#04X?}, {:#04X?}, {:#04X?}]", self.0[0], self.0[1], self.0[2], self.0[3]) + } + } + + match self { + DecoderError::RiffSignatureInvalid(riff) => + f.write_fmt(format_args!("Invalid RIFF signature: {}", SignatureWriter(*riff))), + DecoderError::WebpSignatureInvalid(webp) => + f.write_fmt(format_args!("Invalid WebP signature: {}", SignatureWriter(*webp))), + } + } +} + +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::WebP.into(), e)) + } +} + +impl error::Error for DecoderError {} + +/// WebP Image format decoder. Currently only supportes the luma channel (meaning that decoded +/// images will be grayscale). +pub struct WebPDecoder { + r: R, + frame: Frame, + have_frame: bool, +} + +impl WebPDecoder { + /// Create a new WebPDecoder from the Reader ```r```. + /// This function takes ownership of the Reader. + pub fn new(r: R) -> ImageResult> { + let f: Frame = Default::default(); + + let mut decoder = WebPDecoder { + r, + have_frame: false, + frame: f, + }; + decoder.read_metadata()?; + Ok(decoder) + } + + fn read_riff_header(&mut self) -> ImageResult { + let mut riff = [0; 4]; + self.r.read_exact(&mut riff)?; + if &riff != b"RIFF" { + return Err(DecoderError::RiffSignatureInvalid(riff).into()); + } + + let size = self.r.read_u32::()?; + + let mut webp = [0; 4]; + self.r.read_exact(&mut webp)?; + if &webp != b"WEBP" { + return Err(DecoderError::WebpSignatureInvalid(webp).into()); + } + + Ok(size) + } + + fn read_vp8_header(&mut self) -> ImageResult { + loop { + let mut chunk = [0; 4]; + self.r.read_exact(&mut chunk)?; + + match &chunk { + b"VP8 " => { + let len = self.r.read_u32::()?; + return Ok(len); + } + b"ALPH" | b"VP8L" | b"ANIM" | b"ANMF" => { + // Alpha, Lossless and Animation isn't supported + return Err(ImageError::Unsupported(UnsupportedError::from_format_and_kind( + ImageFormat::WebP.into(), + UnsupportedErrorKind::GenericFeature(chunk.iter().map(|&b| b as char).collect()), + ))); + } + _ => { + let mut len = self.r.read_u32::()?; + if len % 2 != 0 { + // RIFF chunks containing an uneven number of bytes append + // an extra 0x00 at the end of the chunk + len += 1; + } + io::copy(&mut self.r.by_ref().take(len as u64), &mut io::sink())?; + } + } + } + } + + fn read_frame(&mut self, len: u32) -> ImageResult<()> { + let mut framedata = Vec::new(); + self.r.by_ref().take(len as u64).read_to_end(&mut framedata)?; + let m = io::Cursor::new(framedata); + + let mut v = Vp8Decoder::new(m); + let frame = v.decode_frame()?; + + self.frame = frame.clone(); + + Ok(()) + } + + fn read_metadata(&mut self) -> ImageResult<()> { + if !self.have_frame { + self.read_riff_header()?; + let len = self.read_vp8_header()?; + self.read_frame(len)?; + + self.have_frame = true; + } + + Ok(()) + } +} + +/// Wrapper struct around a `Cursor>` +pub struct WebpReader(Cursor>, PhantomData); +impl Read for WebpReader { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + self.0.read(buf) + } + fn read_to_end(&mut self, buf: &mut Vec) -> io::Result { + if self.0.position() == 0 && buf.is_empty() { + mem::swap(buf, self.0.get_mut()); + Ok(buf.len()) + } else { + self.0.read_to_end(buf) + } + } +} + +impl<'a, R: 'a + Read> ImageDecoder<'a> for WebPDecoder { + type Reader = WebpReader; + + fn dimensions(&self) -> (u32, u32) { + (u32::from(self.frame.width), u32::from(self.frame.height)) + } + + fn color_type(&self) -> color::ColorType { + color::ColorType::L8 + } + + fn into_reader(self) -> ImageResult { + Ok(WebpReader(Cursor::new(self.frame.ybuf), PhantomData)) + } + + fn read_image(self, buf: &mut [u8]) -> ImageResult<()> { + assert_eq!(u64::try_from(buf.len()), Ok(self.total_bytes())); + buf.copy_from_slice(&self.frame.ybuf); + Ok(()) + } +} diff --git a/third_party/cargo/vendor/image-0.23.1/src/webp/mod.rs b/third_party/cargo/vendor/image-0.23.4/src/webp/mod.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/webp/mod.rs rename to third_party/cargo/vendor/image-0.23.4/src/webp/mod.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/webp/transform.rs b/third_party/cargo/vendor/image-0.23.4/src/webp/transform.rs similarity index 100% rename from third_party/cargo/vendor/image-0.23.1/src/webp/transform.rs rename to third_party/cargo/vendor/image-0.23.4/src/webp/transform.rs diff --git a/third_party/cargo/vendor/image-0.23.1/src/webp/vp8.rs b/third_party/cargo/vendor/image-0.23.4/src/webp/vp8.rs similarity index 96% rename from third_party/cargo/vendor/image-0.23.1/src/webp/vp8.rs rename to third_party/cargo/vendor/image-0.23.4/src/webp/vp8.rs index c97346c..d63781b 100644 --- a/third_party/cargo/vendor/image-0.23.1/src/webp/vp8.rs +++ b/third_party/cargo/vendor/image-0.23.4/src/webp/vp8.rs @@ -14,7 +14,7 @@ use byteorder::{LittleEndian, ReadBytesExt}; use std::default::Default; -use std::cmp; +use std::{cmp, error, fmt}; use std::io::Read; use super::transform; @@ -665,6 +665,54 @@ static AC_QUANT: [i16; 128] = [ static ZIGZAG: [u8; 16] = [0, 1, 4, 8, 5, 2, 3, 6, 9, 12, 13, 10, 7, 11, 14, 15]; +/// All errors that can occur when attempting to parse a VP8 codec inside WebP +#[derive(Debug, Clone, Copy)] +enum DecoderError { + /// VP8's `[0x9D, 0x01, 0x2A]` magic not found or invalid + Vp8MagicInvalid([u8; 3]), + + /// Decoder initialisation wasn't provided with enough data + NotEnoughInitData, + + /// At time of writing, only the YUV colour-space encoded as `0` is specified + ColorSpaceInvalid(u8), + /// LUMA prediction mode was not recognised + LumaPredictionModeInvalid(i8), + /// Intra-prediction mode was not recognised + IntraPredictionModeInvalid(i8), + /// Chroma prediction mode was not recognised + ChromaPredictionModeInvalid(i8), +} + +impl fmt::Display for DecoderError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + DecoderError::Vp8MagicInvalid(tag) => + f.write_fmt(format_args!("Invalid VP8 magic: [{:#04X?}, {:#04X?}, {:#04X?}]", tag[0], tag[1], tag[2])), + + DecoderError::NotEnoughInitData => + f.write_str("Expected at least 2 bytes of VP8 decoder initialization data"), + + DecoderError::ColorSpaceInvalid(cs) => + f.write_fmt(format_args!("Invalid non-YUV VP8 color space {}", cs)), + DecoderError::LumaPredictionModeInvalid(pm) => + f.write_fmt(format_args!("Invalid VP8 LUMA prediction mode {}", pm)), + DecoderError::IntraPredictionModeInvalid(i) => + f.write_fmt(format_args!("Invalid VP8 intra-prediction mode {}", i)), + DecoderError::ChromaPredictionModeInvalid(c) => + f.write_fmt(format_args!("Invalid VP8 chroma prediction mode {}", c)), + } + } +} + +impl From for ImageError { + fn from(e: DecoderError) -> ImageError { + ImageError::Decoding(DecodingError::new(ImageFormat::WebP.into(), e)) + } +} + +impl error::Error for DecoderError {} + struct BoolReader { buf: Vec, index: usize, @@ -687,10 +735,7 @@ impl BoolReader { pub(crate) fn init(&mut self, buf: Vec) -> ImageResult<()> { if buf.len() < 2 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - "Expected at least 2 bytes of decoder initialization data".to_owned(), - ))); + return Err(DecoderError::NotEnoughInitData.into()); } self.buf = buf; @@ -1112,10 +1157,7 @@ impl Vp8Decoder { self.r.read_exact(&mut tag)?; if tag != [0x9d, 0x01, 0x2a] { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - format!("Invalid magic bytes {:?} for vp8", tag), - ))); + return Err(DecoderError::Vp8MagicInvalid(tag).into()); } let w = self.r.read_u16::()?; @@ -1149,10 +1191,7 @@ impl Vp8Decoder { self.frame.pixel_type = self.b.read_literal(1); if color_space != 0 { - return Err(ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - "Only YUV color space is specified.".to_string(), - ))); + return Err(DecoderError::ColorSpaceInvalid(color_space).into()); } } @@ -1182,9 +1221,7 @@ impl Vp8Decoder { return Err(ImageError::Unsupported( UnsupportedError::from_format_and_kind( ImageFormat::WebP.into(), - UnsupportedErrorKind::GenericFeature( - "Frames that are not keyframes are not supported".to_owned(), - ), + UnsupportedErrorKind::GenericFeature("Non-keyframe frames".to_owned()), ), )); } else { @@ -1209,9 +1246,7 @@ impl Vp8Decoder { return Err(ImageError::Unsupported( UnsupportedError::from_format_and_kind( ImageFormat::WebP.into(), - UnsupportedErrorKind::GenericFeature( - "Frames that are not keyframes are not supported".to_owned(), - ), + UnsupportedErrorKind::GenericFeature("Non-keyframe frames".to_owned()), ), )); } else { @@ -1247,9 +1282,7 @@ impl Vp8Decoder { return Err(ImageError::Unsupported( UnsupportedError::from_format_and_kind( ImageFormat::WebP.into(), - UnsupportedErrorKind::GenericFeature( - "VP8 inter prediction is not implemented yet".to_owned(), - ), + UnsupportedErrorKind::GenericFeature("VP8 inter-prediction".to_owned()), ), )); } @@ -1258,12 +1291,8 @@ impl Vp8Decoder { // intra prediction let luma = self.b .read_with_tree(&KEYFRAME_YMODE_TREE, &KEYFRAME_YMODE_PROBS, 0); - mb.luma_mode = LumaMode::from_i8(luma).ok_or_else(|| { - ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - format!("Invalid luma prediction mode {}", luma), - )) - })?; + mb.luma_mode = LumaMode::from_i8(luma) + .ok_or_else(|| DecoderError::LumaPredictionModeInvalid(luma))?; match mb.luma_mode.into_intra() { // `LumaMode::B` - This is predicted individually @@ -1277,12 +1306,8 @@ impl Vp8Decoder { &KEYFRAME_BPRED_MODE_PROBS[top as usize][left as usize], 0, ); - let bmode = IntraMode::from_i8(intra).ok_or_else(|| { - ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - format!("Invalid intra prediction mode {}", intra), - )) - })?; + let bmode = IntraMode::from_i8(intra) + .ok_or_else(|| DecoderError::IntraPredictionModeInvalid(intra))?; mb.bpred[x + y * 4] = bmode; self.top[mbx].bpred[12 + x] = bmode; @@ -1300,12 +1325,8 @@ impl Vp8Decoder { let chroma = self.b .read_with_tree(&KEYFRAME_UV_MODE_TREE, &KEYFRAME_UV_MODE_PROBS, 0); - mb.chroma_mode = ChromaMode::from_i8(chroma).ok_or_else(|| { - ImageError::Decoding(DecodingError::with_message( - ImageFormat::WebP.into(), - format!("Invalid chroma prediction mode {}", chroma), - )) - })?; + mb.chroma_mode = ChromaMode::from_i8(chroma) + .ok_or_else(|| DecoderError::ChromaPredictionModeInvalid(chroma))?; } self.top[mbx].chroma_mode = mb.chroma_mode; @@ -1339,7 +1360,7 @@ impl Vp8Decoder { rb.copy_from_slice(&resdata[i * 16..i * 16 + 16]); let y0 = 1 + y * 4; let x0 = 1 + x * 4; - + add_residue(&mut ws, &rb, y0, x0, stride); } } @@ -2019,13 +2040,18 @@ mod test { #[cfg(feature = "benchmarks")] extern crate test; - use super::{top_pixels, edge_pixels, avg2, avg3, predict_bvepred, predict_brdpred, predict_bldpred, predict_bhepred, add_residue, IntraMode, predict_4x4}; + use super::{top_pixels, edge_pixels, avg2, avg3, predict_bvepred, predict_brdpred, predict_bldpred, predict_bhepred, add_residue}; + #[cfg(feature = "benchmarks")] + use super::{IntraMode, predict_4x4}; #[cfg(feature = "benchmarks")] use test::{Bencher, black_box}; + #[cfg(feature = "benchmarks")] const W: usize = 256; + #[cfg(feature = "benchmarks")] const H: usize = 256; - + + #[cfg(feature = "benchmarks")] fn make_sample_image() -> Vec { let mut v = Vec::with_capacity((W * H * 4) as usize); for c in 0u8..=255 { @@ -2038,7 +2064,7 @@ mod test { } v } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_predict_4x4(b: &mut Bencher) { @@ -2051,12 +2077,12 @@ mod test { IntraMode::HD, IntraMode::HU, IntraMode::TM, IntraMode::VE, IntraMode::HE, IntraMode::DC, IntraMode::LD, IntraMode::RD ]; - + b.iter(|| { black_box(predict_4x4(& mut v, W * 2, &modes, &res_data)); }); } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_predict_bvepred(b: &mut Bencher) { @@ -2076,7 +2102,7 @@ mod test { black_box(predict_bldpred(black_box(&mut v), 5, 5, W * 2)); }); } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_predict_brdpred(b: &mut Bencher) { @@ -2086,7 +2112,7 @@ mod test { black_box(predict_brdpred(black_box(&mut v), 5, 5, W * 2)); }); } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_predict_bhepred(b: &mut Bencher) { @@ -2106,7 +2132,7 @@ mod test { black_box(top_pixels(black_box(&v), 5, 5, W * 2)); }); } - + #[cfg(feature = "benchmarks")] #[bench] fn bench_edge_pixels(b: &mut Bencher) { @@ -2166,7 +2192,7 @@ mod test { assert_eq!(e7, 8); assert_eq!(e8, 9); } - + #[test] fn test_top_pixels() { let im = vec![1, 2, 3, 4, 5, 6, 7, 8, @@ -2187,7 +2213,7 @@ mod test { assert_eq!(e6, 7); assert_eq!(e7, 8); } - + #[test] fn test_add_residue() { let mut pblock = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; diff --git a/third_party/cargo/vendor/instant-0.1.2/.cargo-checksum.json b/third_party/cargo/vendor/instant-0.1.2/.cargo-checksum.json deleted file mode 100644 index cc19f88..0000000 --- a/third_party/cargo/vendor/instant-0.1.2/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"AUTHORS":"8bd4ba3271fa2f69d6897a0b14467b525adaecc4d7515698c801d07f32692c25","Cargo.toml":"2e54559f046abcd0a53e04a2a1c42018833ab14a0e9c63ece65c36110a3f0950","LICENSE":"cafd574024390a2f68d29f16725abee480a0b8eba39ecd8dc78014182451894f","README.md":"0ad5ccab7013dfd9db7bfaa38418d54237e5a37292f90cdcafd8679fbfbfc665","src/lib.rs":"211b588bb30add5962638c928a524f22dd06a81bc8d00ec4361985585ce22942","src/native.rs":"5c27a81932328b6c3ba4cbb86b754502fa91a38d1592e43e0219bc0c5a2fde8f","src/wasm.rs":"702765f59745a5fb4e96305a1fcdfc1f92b43032ead7e8a6e0a86cda937f88a8","tests/wasm.rs":"555194607537911ae8f85d83cfce20e78ea2cb9ffc7b8bf39e72446c173180f5"},"package":"6c346c299e3fe8ef94dc10c2c0253d858a69aac1245157a3bf4125915d528caf"} \ No newline at end of file diff --git a/third_party/cargo/vendor/instant-0.1.2/src/lib.rs b/third_party/cargo/vendor/instant-0.1.2/src/lib.rs deleted file mode 100644 index 3e4caaf..0000000 --- a/third_party/cargo/vendor/instant-0.1.2/src/lib.rs +++ /dev/null @@ -1,42 +0,0 @@ -#[cfg(all(any(target_arch = "wasm32", target_arch = "asmjs"), feature = "stdweb"))] -#[macro_use] -extern crate stdweb; - -#[cfg(any( - not(any(target_arch = "wasm32", target_arch = "asmjs")), - not(any(feature = "stdweb", feature = "wasm-bindgen")) -))] -pub use crate::native::Instant; - -#[cfg(all( - any(target_arch = "wasm32", target_arch = "asmjs"), - any(feature = "stdweb", feature = "wasm-bindgen") -))] -pub use crate::wasm::Instant; - -#[cfg(any( - not(any(target_arch = "wasm32", target_arch = "asmjs")), - not(any(feature = "stdweb", feature = "wasm-bindgen")) -))] -#[cfg(feature = "now")] -pub use crate::native::now; - -#[cfg(all( - any(target_arch = "wasm32", target_arch = "asmjs"), - any(feature = "stdweb", feature = "wasm-bindgen") -))] -#[cfg(feature = "now")] -pub use crate::wasm::now; - -pub use std::time::Duration; - -#[cfg(any( - not(any(target_arch = "wasm32", target_arch = "asmjs")), - not(any(feature = "stdweb", feature = "wasm-bindgen")) -))] -mod native; -#[cfg(all( - any(target_arch = "wasm32", target_arch = "asmjs"), - any(feature = "stdweb", feature = "wasm-bindgen") -))] -mod wasm; diff --git a/third_party/cargo/vendor/instant-0.1.2/tests/wasm.rs b/third_party/cargo/vendor/instant-0.1.2/tests/wasm.rs deleted file mode 100644 index f5bfe93..0000000 --- a/third_party/cargo/vendor/instant-0.1.2/tests/wasm.rs +++ /dev/null @@ -1,21 +0,0 @@ -extern crate wasm_bindgen_test; - -use instant::Instant; -use std::time::Duration; -use wasm_bindgen_test::*; - -wasm_bindgen_test_configure!(run_in_browser); -// run these tests using: wasm-pack test --chrome --headless -- --features wasm-bindgen - -#[wasm_bindgen_test] -fn test_instant_now() { - let now = Instant::now(); - assert!(now.elapsed().as_nanos() > 0); -} - -#[wasm_bindgen_test] -fn test_duration() { - let now = Instant::now(); - let one_sec = Duration::from_secs(1); - assert!(now.elapsed() < one_sec); -} diff --git a/third_party/cargo/vendor/instant-0.1.4/.cargo-checksum.json b/third_party/cargo/vendor/instant-0.1.4/.cargo-checksum.json new file mode 100644 index 0000000..a8f34d8 --- /dev/null +++ b/third_party/cargo/vendor/instant-0.1.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"AUTHORS":"8bd4ba3271fa2f69d6897a0b14467b525adaecc4d7515698c801d07f32692c25","Cargo.toml":"9cf35d94b1f360e447504b849cfe56acb8a411197d770a0d85960d239442fabd","LICENSE":"cafd574024390a2f68d29f16725abee480a0b8eba39ecd8dc78014182451894f","README.md":"8302eaaada69941829b5cf459e6b0ff9436e001a670b7f1521ae994c3920f4ca","src/lib.rs":"29cbf654d87eff8eae6bc09e0ac5e4c830f3d3518d38d4fdcf0de99c195fe26a","src/native.rs":"5c27a81932328b6c3ba4cbb86b754502fa91a38d1592e43e0219bc0c5a2fde8f","src/wasm.rs":"5029ad3dc3efcb3bbadf818e67e5f7283f46452b564b75abebc55100c18e86c3","tests/wasm.rs":"2f30a8260fe266c8c40bd14397132763d016871c57cc708b433934c1c6300447"},"package":"7777a24a1ce5de49fcdde84ec46efa487c3af49d5b6e6e0a50367cc5c1096182"} \ No newline at end of file diff --git a/third_party/cargo/vendor/instant-0.1.2/AUTHORS b/third_party/cargo/vendor/instant-0.1.4/AUTHORS similarity index 100% rename from third_party/cargo/vendor/instant-0.1.2/AUTHORS rename to third_party/cargo/vendor/instant-0.1.4/AUTHORS diff --git a/third_party/cargo/vendor/instant-0.1.2/BUILD b/third_party/cargo/vendor/instant-0.1.4/BUILD similarity index 97% rename from third_party/cargo/vendor/instant-0.1.2/BUILD rename to third_party/cargo/vendor/instant-0.1.4/BUILD index 6b08485..ff4875f 100644 --- a/third_party/cargo/vendor/instant-0.1.2/BUILD +++ b/third_party/cargo/vendor/instant-0.1.4/BUILD @@ -36,7 +36,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.2", + version = "0.1.4", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/instant-0.1.2/Cargo.toml b/third_party/cargo/vendor/instant-0.1.4/Cargo.toml similarity index 71% rename from third_party/cargo/vendor/instant-0.1.2/Cargo.toml rename to third_party/cargo/vendor/instant-0.1.4/Cargo.toml index c632726..77645d2 100644 --- a/third_party/cargo/vendor/instant-0.1.2/Cargo.toml +++ b/third_party/cargo/vendor/instant-0.1.4/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "instant" -version = "0.1.2" +version = "0.1.4" authors = ["sebcrozet "] description = "A partial replacement for std::time::Instant that works on WASM too." readme = "README.md" @@ -28,11 +28,20 @@ version = "0.2" [features] now = ["time"] -wasm-bindgen = ["web-sys"] +wasm-bindgen = ["js-sys", "wasm-bindgen_rs", "web-sys"] +[target.asmjs-unknown-emscripten.dependencies.js-sys] +version = "0.3" +optional = true + [target.asmjs-unknown-emscripten.dependencies.stdweb] version = "0.4" optional = true +[target.asmjs-unknown-emscripten.dependencies.wasm-bindgen_rs] +version = "0.2" +optional = true +package = "wasm-bindgen" + [target.asmjs-unknown-emscripten.dependencies.web-sys] version = "0.3" features = ["Window", "Performance", "PerformanceTiming"] @@ -40,18 +49,36 @@ optional = true [target."cfg(not(any(feature = \"stdweb\", feature = \"wasm-bindgen\")))".dependencies.time] version = "0.1" optional = true +[target.wasm32-unknown-emscripten.dependencies.js-sys] +version = "0.3" +optional = true + [target.wasm32-unknown-emscripten.dependencies.stdweb] version = "0.4" optional = true +[target.wasm32-unknown-emscripten.dependencies.wasm-bindgen_rs] +version = "0.2" +optional = true +package = "wasm-bindgen" + [target.wasm32-unknown-emscripten.dependencies.web-sys] version = "0.3" features = ["Window", "Performance", "PerformanceTiming"] optional = true +[target.wasm32-unknown-unknown.dependencies.js-sys] +version = "0.3" +optional = true + [target.wasm32-unknown-unknown.dependencies.stdweb] version = "0.4" optional = true +[target.wasm32-unknown-unknown.dependencies.wasm-bindgen_rs] +version = "0.2" +optional = true +package = "wasm-bindgen" + [target.wasm32-unknown-unknown.dependencies.web-sys] version = "0.3" features = ["Window", "Performance", "PerformanceTiming"] diff --git a/third_party/cargo/vendor/instant-0.1.2/LICENSE b/third_party/cargo/vendor/instant-0.1.4/LICENSE similarity index 100% rename from third_party/cargo/vendor/instant-0.1.2/LICENSE rename to third_party/cargo/vendor/instant-0.1.4/LICENSE diff --git a/third_party/cargo/vendor/instant-0.1.2/README.md b/third_party/cargo/vendor/instant-0.1.4/README.md similarity index 82% rename from third_party/cargo/vendor/instant-0.1.2/README.md rename to third_party/cargo/vendor/instant-0.1.4/README.md index d12e653..28f6bdd 100644 --- a/third_party/cargo/vendor/instant-0.1.2/README.md +++ b/third_party/cargo/vendor/instant-0.1.4/README.md @@ -15,7 +15,7 @@ as long as you are not targeting wasm32. This allows for portable code that will ### The feature `now`. By enabling the feature `now` the function `instant::now()` will be exported and will either: -* Call `performance.now()` when compiling for a WASM platform with the features **stdweb** or **wasm-bindgen** enabled. +* Call `performance.now()` when compiling for a WASM platform with the features **stdweb** or **wasm-bindgen** enabled, or using a custom javascript function. * Call `time::precise_time_s() * 1000.0` otherwise. The result is expressed in milliseconds. @@ -99,3 +99,26 @@ fn my_function() { let now_milliseconds = instant::now(); // In milliseconds. } ``` + +### Using the feature `now` without `stdweb` or `wasm-bindgen`. +_Cargo.toml_: +```toml +[dependencies] +instant = { version = "0.", features = [ "now" ] } +``` + +_lib.rs_: +```rust +fn my_function() { + // Will use the 'now' javascript implementation. + let now_instant = instant::Instant::new(); + let now_milliseconds = instant::now(); // In milliseconds. +} +``` + +_javascript WASM bindings file_: +```js +function now() { + return Date.now() / 1000.0; +} +``` diff --git a/third_party/cargo/vendor/instant-0.1.4/src/lib.rs b/third_party/cargo/vendor/instant-0.1.4/src/lib.rs new file mode 100644 index 0000000..dec692e --- /dev/null +++ b/third_party/cargo/vendor/instant-0.1.4/src/lib.rs @@ -0,0 +1,24 @@ +#[cfg(all(any(target_arch = "wasm32", target_arch = "asmjs"), feature = "stdweb"))] +#[macro_use] +extern crate stdweb; + +#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] +pub use crate::native::Instant; + +#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] +pub use crate::wasm::Instant; + +#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] +#[cfg(feature = "now")] +pub use crate::native::now; + +#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] +#[cfg(feature = "now")] +pub use crate::wasm::now; + +pub use std::time::Duration; + +#[cfg(not(any(target_arch = "wasm32", target_arch = "asmjs")))] +mod native; +#[cfg(any(target_arch = "wasm32", target_arch = "asmjs"))] +mod wasm; diff --git a/third_party/cargo/vendor/instant-0.1.2/src/native.rs b/third_party/cargo/vendor/instant-0.1.4/src/native.rs similarity index 100% rename from third_party/cargo/vendor/instant-0.1.2/src/native.rs rename to third_party/cargo/vendor/instant-0.1.4/src/native.rs diff --git a/third_party/cargo/vendor/instant-0.1.2/src/wasm.rs b/third_party/cargo/vendor/instant-0.1.4/src/wasm.rs similarity index 54% rename from third_party/cargo/vendor/instant-0.1.2/src/wasm.rs rename to third_party/cargo/vendor/instant-0.1.4/src/wasm.rs index 24a6b7c..4c6835d 100644 --- a/third_party/cargo/vendor/instant-0.1.2/src/wasm.rs +++ b/third_party/cargo/vendor/instant-0.1.4/src/wasm.rs @@ -1,8 +1,8 @@ use std::ops::{Add, AddAssign, Sub, SubAssign}; use std::time::Duration; -#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] -pub struct Instant(f64); +#[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Hash)] +pub struct Instant(Duration); impl Ord for Instant { fn cmp(&self, other: &Self) -> std::cmp::Ordering { @@ -15,7 +15,7 @@ impl Eq for Instant {} impl Instant { #[inline] pub fn now() -> Self { - Instant(now()) + Instant(duration_from_f64(now())) } #[inline] @@ -24,13 +24,29 @@ impl Instant { earlier.0 <= self.0, "`earlier` cannot be later than `self`." ); - duration_from_f64(self.0 - earlier.0) + self.0 - earlier.0 } #[inline] pub fn elapsed(&self) -> Duration { Self::now().duration_since(*self) } + + /// Returns `Some(t)` where `t` is the time `self + duration` if `t` can be represented as + /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` + /// otherwise. + #[inline] + pub fn checked_add(&self, duration: Duration) -> Option { + self.0.checked_add(duration).map(Instant) + } + + /// Returns `Some(t)` where `t` is the time `self - duration` if `t` can be represented as + /// `Instant` (which means it's inside the bounds of the underlying data structure), `None` + /// otherwise. + #[inline] + pub fn checked_sub(&self, duration: Duration) -> Option { + self.0.checked_sub(duration).map(Instant) + } } impl Add for Instant { @@ -38,14 +54,14 @@ impl Add for Instant { #[inline] fn add(self, rhs: Duration) -> Self { - Instant(self.0 + duration_to_f64(rhs)) + Instant(self.0 + rhs) } } impl AddAssign for Instant { #[inline] fn add_assign(&mut self, rhs: Duration) { - self.0 += duration_to_f64(rhs) + self.0 += rhs } } @@ -54,7 +70,7 @@ impl Sub for Instant { #[inline] fn sub(self, rhs: Duration) -> Self { - Instant(self.0 - duration_to_f64(rhs)) + Instant(self.0 - rhs) } } @@ -70,7 +86,7 @@ impl Sub for Instant { impl SubAssign for Instant { #[inline] fn sub_assign(&mut self, rhs: Duration) { - self.0 -= duration_to_f64(rhs) + self.0 -= rhs } } @@ -95,9 +111,23 @@ pub fn now() -> f64 { #[cfg(feature = "wasm-bindgen")] pub fn now() -> f64 { - web_sys::window() - .expect("should have a window in this context") - .performance() - .expect("performance should be available") + use wasm_bindgen_rs::prelude::*; + use wasm_bindgen_rs::JsCast; + js_sys::Reflect::get(&js_sys::global(), &JsValue::from_str("performance")) + .expect("failed to get performance from global object") + .unchecked_into::() .now() } + +// The JS now function is in a module so it won't have to be renamed +#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))] +mod js { + extern "C" { + pub fn now() -> f64; + } +} +// Make the unsafe extern function "safe" so it can be called like the other 'now' functions +#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))] +pub fn now() -> f64 { + unsafe { js::now() } +} diff --git a/third_party/cargo/vendor/instant-0.1.4/tests/wasm.rs b/third_party/cargo/vendor/instant-0.1.4/tests/wasm.rs new file mode 100644 index 0000000..b1577ad --- /dev/null +++ b/third_party/cargo/vendor/instant-0.1.4/tests/wasm.rs @@ -0,0 +1,46 @@ +extern crate wasm_bindgen_test; + +use instant::Instant; +use std::time::Duration; +use wasm_bindgen_test::*; + +wasm_bindgen_test_configure!(run_in_browser); +// run these tests using: wasm-pack test --chrome --headless -- --features wasm-bindgen + +#[wasm_bindgen_test] +fn test_instant_now() { + let now = Instant::now(); + assert!(now.elapsed().as_nanos() > 0); +} + +#[wasm_bindgen_test] +fn test_duration() { + let now = Instant::now(); + let one_sec = Duration::from_secs(1); + assert!(now.elapsed() < one_sec); +} + +// Duration::new will overflow when you have u64::MAX seconds and one billion nanoseconds. +// +const ONE_BILLION: u32 = 1_000_000_000; + +#[wasm_bindgen_test] +fn test_checked_add() { + let now = Instant::now(); + + assert!(now.checked_add(Duration::from_millis(1)).is_some()); + assert_eq!( + None, + now.checked_add(Duration::new(u64::MAX, ONE_BILLION - 1)) + ); +} + +#[wasm_bindgen_test] +fn test_checked_sub() { + let now = Instant::now(); + + assert!(now.checked_sub(Duration::from_millis(1)).is_some()); + assert!(now + .checked_sub(Duration::new(u64::MAX, ONE_BILLION - 1)) + .is_none()); +} diff --git a/third_party/cargo/vendor/iovec-0.1.4/BUILD b/third_party/cargo/vendor/iovec-0.1.4/BUILD index 7f484a7..5251478 100644 --- a/third_party/cargo/vendor/iovec-0.1.4/BUILD +++ b/third_party/cargo/vendor/iovec-0.1.4/BUILD @@ -31,7 +31,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/jni-sys-0.3.0/.cargo-checksum.json b/third_party/cargo/vendor/jni-sys-0.3.0/.cargo-checksum.json new file mode 100644 index 0000000..cfb3537 --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"627714c0fd46e3f8e1f4f2f972d92700197ca192eb37c5506db55121c7ec43e3","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"1d85bd754b04ceec93e98e890edd1fa3c6a22e81bcb32135806beeccefa51cd1","README.md":"c6e51f0a8d430937f10493ca3ca5952820ef257ee62259b2cdd566c89479c3d6","appveyor.yml":"5589fa4fefa0da3a033512357b1a72462ffb336538199af591f28b3ccbec3f9b","src/lib.rs":"2a0c67b31bc16945ca917c6ff8e9e4e7f367456895d4b6c6e54f8608853600f2"},"package":"8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"} \ No newline at end of file diff --git a/third_party/cargo/vendor/android_glue-0.2.3/BUILD b/third_party/cargo/vendor/jni-sys-0.3.0/BUILD similarity index 90% rename from third_party/cargo/vendor/android_glue-0.2.3/BUILD rename to third_party/cargo/vendor/jni-sys-0.3.0/BUILD index 1ee45d8..1d586a2 100644 --- a/third_party/cargo/vendor/android_glue-0.2.3/BUILD +++ b/third_party/cargo/vendor/jni-sys-0.3.0/BUILD @@ -12,7 +12,7 @@ package(default_visibility = [ ]) licenses([ - "notice", # "MIT" + "notice", # "MIT,Apache-2.0" ]) load( @@ -25,7 +25,7 @@ load( rust_library( - name = "android_glue", + name = "jni_sys", crate_root = "src/lib.rs", crate_type = "lib", edition = "2015", @@ -35,7 +35,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.3", + version = "0.3.0", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/jni-sys-0.3.0/Cargo.toml b/third_party/cargo/vendor/jni-sys-0.3.0/Cargo.toml new file mode 100644 index 0000000..c9ffc3c --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/Cargo.toml @@ -0,0 +1,30 @@ +# 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 = "jni-sys" +version = "0.3.0" +authors = ["Steven Fackler "] +description = "Rust definitions corresponding to jni.h" +documentation = "https://docs.rs/jni-sys/0.3.0/jni_sys" +readme = "README.md" +keywords = ["java", "jni"] +categories = ["external-ffi-bindings"] +license = "MIT/Apache-2.0" +repository = "https://github.com/sfackler/rust-jni-sys" + +[dependencies] +[badges.travis-ci] +repository = "sfackler/rust-jni-sys" + +[badges.appveyor] +repository = "sfackler/rust-jni-sys" diff --git a/third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-APACHE b/third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-APACHE new file mode 100644 index 0000000..8f71f43 --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/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/third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-MIT b/third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-MIT new file mode 100644 index 0000000..2008402 --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/LICENSE-MIT @@ -0,0 +1,19 @@ +Copyright (c) 2015 The rust-jni-sys 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/third_party/cargo/vendor/jni-sys-0.3.0/README.md b/third_party/cargo/vendor/jni-sys-0.3.0/README.md new file mode 100644 index 0000000..7b41625 --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/README.md @@ -0,0 +1,24 @@ +# jni-sys + +[![Build Status](https://travis-ci.org/sfackler/rust-jni-sys.svg?branch=master)](https://travis-ci.org/sfackler/rust-jni-sys) [![Build status](https://ci.appveyor.com/api/projects/status/o59i8b5dwcyswtq3/branch/master?svg=true)](https://ci.appveyor.com/project/sfackler/rust-jni-sys/branch/master) + + +[Documentation](https://docs.rs/jni-sys) + +Rust definitions corresponding to jni.h. + +## 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. diff --git a/third_party/cargo/vendor/jni-sys-0.3.0/appveyor.yml b/third_party/cargo/vendor/jni-sys-0.3.0/appveyor.yml new file mode 100644 index 0000000..a5d0e21 --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/appveyor.yml @@ -0,0 +1,19 @@ +environment: + matrix: + - TARGET: i686-pc-windows-msvc + JAVA_HOME: C:\Program Files (x86)\Java\jdk1.8.0 + - TARGET: x86_64-pc-windows-msvc + JAVA_HOME: C:\Program Files\Java\jdk1.8.0 +install: +- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe +- rustup-init.exe -y --default-host %TARGET% +- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin;%JAVA_HOME%\jre\bin\server +- rustc -V +- cargo -V +build: false +test_script: +- cargo build --target %TARGET% +#- cargo run --target %TARGET% -p systest +cache: +- target +- C:\Users\appveyor\.cargo\registry diff --git a/third_party/cargo/vendor/jni-sys-0.3.0/src/lib.rs b/third_party/cargo/vendor/jni-sys-0.3.0/src/lib.rs new file mode 100644 index 0000000..fd2a8f9 --- /dev/null +++ b/third_party/cargo/vendor/jni-sys-0.3.0/src/lib.rs @@ -0,0 +1,1515 @@ +#![doc(html_root_url="https://docs.rs/jni-sys/0.3.0")] +#![allow(non_snake_case, non_camel_case_types)] + +use std::os::raw::c_void; +use std::os::raw::c_char; + +// FIXME is this sufficiently correct? +pub type va_list = *mut c_void; + +pub type jint = i32; +pub type jlong = i64; +pub type jbyte = i8; +pub type jboolean = u8; +pub type jchar = u16; +pub type jshort = i16; +pub type jfloat = f32; +pub type jdouble = f64; +pub type jsize = jint; + +pub enum _jobject {} +pub type jobject = *mut _jobject; +pub type jclass = jobject; +pub type jthrowable = jobject; +pub type jstring = jobject; +pub type jarray = jobject; +pub type jbooleanArray = jarray; +pub type jbyteArray = jarray; +pub type jcharArray = jarray; +pub type jshortArray = jarray; +pub type jintArray = jarray; +pub type jlongArray = jarray; +pub type jfloatArray = jarray; +pub type jdoubleArray = jarray; +pub type jobjectArray = jarray; +pub type jweak = jobject; + +#[repr(C)] +#[derive(Copy)] +pub union jvalue { + pub z: jboolean, + pub b: jbyte, + pub c: jchar, + pub s: jshort, + pub i: jint, + pub j: jlong, + pub f: jfloat, + pub d: jdouble, + pub l: jobject, +} + +impl Clone for jvalue { + fn clone(&self) -> Self { + *self + } +} + +pub enum _jfieldID {} +pub type jfieldID = *mut _jfieldID; +pub enum _jmethodID {} +pub type jmethodID = *mut _jmethodID; + +#[derive(Clone, Copy)] +#[repr(C)] +pub enum jobjectRefType { + JNIInvalidRefType = 0, + JNILocalRefType = 1, + JNIGlobalRefType = 2, + JNIWeakGlobalRefType = 3, +} + +pub const JNI_FALSE: jboolean = 0; +pub const JNI_TRUE: jboolean = 1; + +pub const JNI_OK: jint = 0; +pub const JNI_ERR: jint = -1; +pub const JNI_EDETACHED: jint = -2; +pub const JNI_EVERSION: jint = -3; +pub const JNI_ENOMEM: jint = -4; +pub const JNI_EEXIST: jint = -5; +pub const JNI_EINVAL: jint = -6; + +pub const JNI_COMMIT: jint = 1; +pub const JNI_ABORT: jint = 2; + +pub const JNI_VERSION_1_1: jint = 0x00010001; +pub const JNI_VERSION_1_2: jint = 0x00010002; +pub const JNI_VERSION_1_4: jint = 0x00010004; +pub const JNI_VERSION_1_6: jint = 0x00010006; +pub const JNI_VERSION_1_8: jint = 0x00010008; + +#[repr(C)] +#[derive(Copy)] +pub struct JNINativeMethod { + pub name: *mut c_char, + pub signature: *mut c_char, + pub fnPtr: *mut c_void, +} + +impl Clone for JNINativeMethod { + fn clone(&self) -> Self { + *self + } +} + +pub type JNIEnv = *const JNINativeInterface_; +pub type JavaVM = *const JNIInvokeInterface_; + +#[repr(C)] +#[derive(Copy)] +pub struct JNINativeInterface_ { + pub reserved0: *mut c_void, + pub reserved1: *mut c_void, + pub reserved2: *mut c_void, + pub reserved3: *mut c_void, + pub GetVersion: Option jint>, + pub DefineClass: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + name: *const c_char, + loader: jobject, + buf: *const jbyte, + len: jsize) + -> jclass, + >, + pub FindClass: + Option jclass>, + pub FromReflectedMethod: + Option jmethodID>, + pub FromReflectedField: + Option jfieldID>, + pub ToReflectedMethod: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + cls: jclass, + methodID: jmethodID, + isStatic: jboolean) + -> jobject, + >, + pub GetSuperclass: Option jclass>, + pub IsAssignableFrom: + Option jboolean>, + pub ToReflectedField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + cls: jclass, + fieldID: jfieldID, + isStatic: jboolean) + -> jobject, + >, + pub Throw: Option jint>, + pub ThrowNew: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + msg: *const c_char) + -> jint, + >, + pub ExceptionOccurred: Option jthrowable>, + pub ExceptionDescribe: Option, + pub ExceptionClear: Option, + pub FatalError: Option !>, + pub PushLocalFrame: Option jint>, + pub PopLocalFrame: + Option jobject>, + pub NewGlobalRef: Option jobject>, + pub DeleteGlobalRef: Option, + pub DeleteLocalRef: Option, + pub IsSameObject: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj1: jobject, + obj2: jobject) + -> jboolean, + >, + pub NewLocalRef: Option jobject>, + pub EnsureLocalCapacity: + Option jint>, + pub AllocObject: Option jobject>, + pub NewObject: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jobject, + >, + pub NewObjectV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jobject, + >, + pub NewObjectA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jobject, + >, + pub GetObjectClass: Option jclass>, + pub IsInstanceOf: + Option jboolean>, + pub GetMethodID: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + name: *const c_char, + sig: *const c_char) + -> jmethodID, + >, + pub CallObjectMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jobject, + >, + pub CallObjectMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jobject, + >, + pub CallObjectMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jobject, + >, + pub CallBooleanMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jboolean, + >, + pub CallBooleanMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jboolean, + >, + pub CallBooleanMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jboolean, + >, + pub CallByteMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jbyte, + >, + pub CallByteMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jbyte, + >, + pub CallByteMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jbyte, + >, + pub CallCharMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jchar, + >, + pub CallCharMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jchar, + >, + pub CallCharMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jchar, + >, + pub CallShortMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jshort, + >, + pub CallShortMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jshort, + >, + pub CallShortMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jshort, + >, + pub CallIntMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jint, + >, + pub CallIntMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jint, + >, + pub CallIntMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jint, + >, + pub CallLongMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jlong, + >, + pub CallLongMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jlong, + >, + pub CallLongMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jlong, + >, + pub CallFloatMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jfloat, + >, + pub CallFloatMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jfloat, + >, + pub CallFloatMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jfloat, + >, + pub CallDoubleMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + ...) + -> jdouble, + >, + pub CallDoubleMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list) + -> jdouble, + >, + pub CallDoubleMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue) + -> jdouble, + >, + pub CallVoidMethod: + Option, + pub CallVoidMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: va_list), + >, + pub CallVoidMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + methodID: jmethodID, + args: *const jvalue), + >, + pub CallNonvirtualObjectMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jobject, + >, + pub CallNonvirtualObjectMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jobject, + >, + pub CallNonvirtualObjectMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jobject, + >, + pub CallNonvirtualBooleanMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jboolean, + >, + pub CallNonvirtualBooleanMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jboolean, + >, + pub CallNonvirtualBooleanMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jboolean, + >, + pub CallNonvirtualByteMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jbyte, + >, + pub CallNonvirtualByteMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jbyte, + >, + pub CallNonvirtualByteMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jbyte, + >, + pub CallNonvirtualCharMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jchar, + >, + pub CallNonvirtualCharMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jchar, + >, + pub CallNonvirtualCharMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jchar, + >, + pub CallNonvirtualShortMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jshort, + >, + pub CallNonvirtualShortMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jshort, + >, + pub CallNonvirtualShortMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jshort, + >, + pub CallNonvirtualIntMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jint, + >, + pub CallNonvirtualIntMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jint, + >, + pub CallNonvirtualIntMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jint, + >, + pub CallNonvirtualLongMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jlong, + >, + pub CallNonvirtualLongMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jlong, + >, + pub CallNonvirtualLongMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jlong, + >, + pub CallNonvirtualFloatMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jfloat, + >, + pub CallNonvirtualFloatMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jfloat, + >, + pub CallNonvirtualFloatMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jfloat, + >, + pub CallNonvirtualDoubleMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...) + -> jdouble, + >, + pub CallNonvirtualDoubleMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jdouble, + >, + pub CallNonvirtualDoubleMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jdouble, + >, + pub CallNonvirtualVoidMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + ...), + >, + pub CallNonvirtualVoidMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: va_list), + >, + pub CallNonvirtualVoidMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue), + >, + pub GetFieldID: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + name: *const c_char, + sig: *const c_char) + -> jfieldID, + >, + pub GetObjectField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jobject, + >, + pub GetBooleanField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jboolean, + >, + pub GetByteField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jbyte, + >, + pub GetCharField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jchar, + >, + pub GetShortField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jshort, + >, + pub GetIntField: + Option jint>, + pub GetLongField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jlong, + >, + pub GetFloatField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jfloat, + >, + pub GetDoubleField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID) + -> jdouble, + >, + pub SetObjectField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jobject), + >, + pub SetBooleanField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jboolean), + >, + pub SetByteField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jbyte), + >, + pub SetCharField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jchar), + >, + pub SetShortField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jshort), + >, + pub SetIntField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jint), + >, + pub SetLongField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jlong), + >, + pub SetFloatField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jfloat), + >, + pub SetDoubleField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + obj: jobject, + fieldID: jfieldID, + val: jdouble), + >, + pub GetStaticMethodID: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + name: *const c_char, + sig: *const c_char) + -> jmethodID, + >, + pub CallStaticObjectMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jobject, + >, + pub CallStaticObjectMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jobject, + >, + pub CallStaticObjectMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jobject, + >, + pub CallStaticBooleanMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jboolean, + >, + pub CallStaticBooleanMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jboolean, + >, + pub CallStaticBooleanMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jboolean, + >, + pub CallStaticByteMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jbyte, + >, + pub CallStaticByteMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jbyte, + >, + pub CallStaticByteMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jbyte, + >, + pub CallStaticCharMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jchar, + >, + pub CallStaticCharMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jchar, + >, + pub CallStaticCharMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jchar, + >, + pub CallStaticShortMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jshort, + >, + pub CallStaticShortMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jshort, + >, + pub CallStaticShortMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jshort, + >, + pub CallStaticIntMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jint, + >, + pub CallStaticIntMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jint, + >, + pub CallStaticIntMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jint, + >, + pub CallStaticLongMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jlong, + >, + pub CallStaticLongMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jlong, + >, + pub CallStaticLongMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jlong, + >, + pub CallStaticFloatMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jfloat, + >, + pub CallStaticFloatMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jfloat, + >, + pub CallStaticFloatMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jfloat, + >, + pub CallStaticDoubleMethod: Option< + unsafe extern "C" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + ...) + -> jdouble, + >, + pub CallStaticDoubleMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: va_list) + -> jdouble, + >, + pub CallStaticDoubleMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methodID: jmethodID, + args: *const jvalue) + -> jdouble, + >, + pub CallStaticVoidMethod: + Option, + pub CallStaticVoidMethodV: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + cls: jclass, + methodID: jmethodID, + args: va_list), + >, + pub CallStaticVoidMethodA: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + cls: jclass, + methodID: jmethodID, + args: *const jvalue), + >, + pub GetStaticFieldID: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + name: *const c_char, + sig: *const c_char) + -> jfieldID, + >, + pub GetStaticObjectField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jobject, + >, + pub GetStaticBooleanField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jboolean, + >, + pub GetStaticByteField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jbyte, + >, + pub GetStaticCharField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jchar, + >, + pub GetStaticShortField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jshort, + >, + pub GetStaticIntField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jint, + >, + pub GetStaticLongField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jlong, + >, + pub GetStaticFloatField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jfloat, + >, + pub GetStaticDoubleField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID) + -> jdouble, + >, + pub SetStaticObjectField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jobject), + >, + pub SetStaticBooleanField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jboolean), + >, + pub SetStaticByteField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jbyte), + >, + pub SetStaticCharField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jchar), + >, + pub SetStaticShortField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jshort), + >, + pub SetStaticIntField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jint), + >, + pub SetStaticLongField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jlong), + >, + pub SetStaticFloatField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jfloat), + >, + pub SetStaticDoubleField: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + fieldID: jfieldID, + value: jdouble), + >, + pub NewString: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + unicode: *const jchar, + len: jsize) + -> jstring, + >, + pub GetStringLength: Option jsize>, + pub GetStringChars: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + str: jstring, + isCopy: *mut jboolean) + -> *const jchar, + >, + pub ReleaseStringChars: + Option, + pub NewStringUTF: + Option jstring>, + pub GetStringUTFLength: + Option jsize>, + pub GetStringUTFChars: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + str: jstring, + isCopy: *mut jboolean) + -> *const c_char, + >, + pub ReleaseStringUTFChars: + Option, + pub GetArrayLength: Option jsize>, + pub NewObjectArray: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + len: jsize, + clazz: jclass, + init: jobject) + -> jobjectArray, + >, + pub GetObjectArrayElement: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jobjectArray, + index: jsize) + -> jobject, + >, + pub SetObjectArrayElement: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jobjectArray, + index: jsize, + val: jobject), + >, + pub NewBooleanArray: + Option jbooleanArray>, + pub NewByteArray: Option jbyteArray>, + pub NewCharArray: Option jcharArray>, + pub NewShortArray: + Option jshortArray>, + pub NewIntArray: Option jintArray>, + pub NewLongArray: Option jlongArray>, + pub NewFloatArray: + Option jfloatArray>, + pub NewDoubleArray: + Option jdoubleArray>, + pub GetBooleanArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbooleanArray, + isCopy: *mut jboolean) + -> *mut jboolean, + >, + pub GetByteArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbyteArray, + isCopy: *mut jboolean) + -> *mut jbyte, + >, + pub GetCharArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jcharArray, + isCopy: *mut jboolean) + -> *mut jchar, + >, + pub GetShortArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jshortArray, + isCopy: *mut jboolean) + -> *mut jshort, + >, + pub GetIntArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jintArray, + isCopy: *mut jboolean) + -> *mut jint, + >, + pub GetLongArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jlongArray, + isCopy: *mut jboolean) + -> *mut jlong, + >, + pub GetFloatArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jfloatArray, + isCopy: *mut jboolean) + -> *mut jfloat, + >, + pub GetDoubleArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jdoubleArray, + isCopy: *mut jboolean) + -> *mut jdouble, + >, + pub ReleaseBooleanArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbooleanArray, + elems: *mut jboolean, + mode: jint), + >, + pub ReleaseByteArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbyteArray, + elems: *mut jbyte, + mode: jint), + >, + pub ReleaseCharArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jcharArray, + elems: *mut jchar, + mode: jint), + >, + pub ReleaseShortArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jshortArray, + elems: *mut jshort, + mode: jint), + >, + pub ReleaseIntArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jintArray, + elems: *mut jint, + mode: jint), + >, + pub ReleaseLongArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jlongArray, + elems: *mut jlong, + mode: jint), + >, + pub ReleaseFloatArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jfloatArray, + elems: *mut jfloat, + mode: jint), + >, + pub ReleaseDoubleArrayElements: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jdoubleArray, + elems: *mut jdouble, + mode: jint), + >, + pub GetBooleanArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbooleanArray, + start: jsize, + l: jsize, + buf: *mut jboolean), + >, + pub GetByteArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbyteArray, + start: jsize, + len: jsize, + buf: *mut jbyte), + >, + pub GetCharArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jcharArray, + start: jsize, + len: jsize, + buf: *mut jchar), + >, + pub GetShortArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jshortArray, + start: jsize, + len: jsize, + buf: *mut jshort), + >, + pub GetIntArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jintArray, + start: jsize, + len: jsize, + buf: *mut jint), + >, + pub GetLongArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jlongArray, + start: jsize, + len: jsize, + buf: *mut jlong), + >, + pub GetFloatArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jfloatArray, + start: jsize, + len: jsize, + buf: *mut jfloat), + >, + pub GetDoubleArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jdoubleArray, + start: jsize, + len: jsize, + buf: *mut jdouble), + >, + pub SetBooleanArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbooleanArray, + start: jsize, + l: jsize, + buf: *const jboolean), + >, + pub SetByteArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jbyteArray, + start: jsize, + len: jsize, + buf: *const jbyte), + >, + pub SetCharArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jcharArray, + start: jsize, + len: jsize, + buf: *const jchar), + >, + pub SetShortArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jshortArray, + start: jsize, + len: jsize, + buf: *const jshort), + >, + pub SetIntArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jintArray, + start: jsize, + len: jsize, + buf: *const jint), + >, + pub SetLongArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jlongArray, + start: jsize, + len: jsize, + buf: *const jlong), + >, + pub SetFloatArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jfloatArray, + start: jsize, + len: jsize, + buf: *const jfloat), + >, + pub SetDoubleArrayRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jdoubleArray, + start: jsize, + len: jsize, + buf: *const jdouble), + >, + pub RegisterNatives: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + clazz: jclass, + methods: *const JNINativeMethod, + nMethods: jint) + -> jint, + >, + pub UnregisterNatives: + Option jint>, + pub MonitorEnter: Option jint>, + pub MonitorExit: Option jint>, + pub GetJavaVM: + Option jint>, + pub GetStringRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + str: jstring, + start: jsize, + len: jsize, + buf: *mut jchar), + >, + pub GetStringUTFRegion: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + str: jstring, + start: jsize, + len: jsize, + buf: *mut c_char), + >, + pub GetPrimitiveArrayCritical: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jarray, + isCopy: *mut jboolean) + -> *mut c_void, + >, + pub ReleasePrimitiveArrayCritical: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + array: jarray, + carray: *mut c_void, + mode: jint), + >, + pub GetStringCritical: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + string: jstring, + isCopy: *mut jboolean) + -> *const jchar, + >, + pub ReleaseStringCritical: + Option, + pub NewWeakGlobalRef: + Option jweak>, + pub DeleteWeakGlobalRef: Option, + pub ExceptionCheck: Option jboolean>, + pub NewDirectByteBuffer: Option< + unsafe extern "system" fn(env: *mut JNIEnv, + address: *mut c_void, + capacity: jlong) + -> jobject, + >, + pub GetDirectBufferAddress: + Option *mut c_void>, + pub GetDirectBufferCapacity: + Option jlong>, + pub GetObjectRefType: + Option jobjectRefType>, +} + +impl Clone for JNINativeInterface_ { + fn clone(&self) -> Self { + *self + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct JNIEnv_ { + pub functions: *const JNINativeInterface_, +} + +impl Clone for JNIEnv_ { + fn clone(&self) -> Self { + *self + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct JavaVMOption { + pub optionString: *mut c_char, + pub extraInfo: *mut c_void, +} + +impl Clone for JavaVMOption { + fn clone(&self) -> Self { + *self + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} + +impl Clone for JavaVMInitArgs { + fn clone(&self) -> Self { + *self + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *mut c_char, + pub group: jobject, +} + +impl Clone for JavaVMAttachArgs { + fn clone(&self) -> Self { + *self + } +} + +#[repr(C)] +#[derive(Copy)] +pub struct JNIInvokeInterface_ { + pub reserved0: *mut c_void, + pub reserved1: *mut c_void, + pub reserved2: *mut c_void, + pub DestroyJavaVM: Option jint>, + pub AttachCurrentThread: Option< + unsafe extern "system" fn(vm: *mut JavaVM, + penv: *mut *mut c_void, + args: *mut c_void) + -> jint, + >, + pub DetachCurrentThread: Option jint>, + pub GetEnv: Option< + unsafe extern "system" fn(vm: *mut JavaVM, + penv: *mut *mut c_void, + version: jint) + -> jint, + >, + pub AttachCurrentThreadAsDaemon: Option< + unsafe extern "system" fn(vm: *mut JavaVM, + penv: *mut *mut c_void, + args: *mut c_void) + -> jint, + >, +} + +impl Clone for JNIInvokeInterface_ { + fn clone(&self) -> Self { + *self + } +} + +extern "system" { + pub fn JNI_GetDefaultJavaVMInitArgs(args: *mut c_void) -> jint; + pub fn JNI_CreateJavaVM( + pvm: *mut *mut JavaVM, + penv: *mut *mut c_void, + args: *mut c_void, + ) -> jint; + pub fn JNI_GetCreatedJavaVMs(vmBuf: *mut *mut JavaVM, bufLen: jsize, nVMs: *mut jsize) -> jint; +} diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/.cargo-checksum.json b/third_party/cargo/vendor/jpeg-decoder-0.1.18/.cargo-checksum.json deleted file mode 100644 index 9c6660d..0000000 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"8556ae16622df3466668fda8ada1a2ac8e5724c0b495b057c090726ee1aece30","Cargo.lock":"f89c170b86ae09d78ab8f184030275bf3a37b8345d0046757dfe5aa72adf5b81","Cargo.toml":"81ae752999a26c4d77dcce71710d57d80423330c2438d34db3c47b1f3c3064dc","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"22b83fb92a50418c7df9564b9c179fa2a0e74f293bc58b72dd7e218fc0902143","README.md":"3a164f4d2e2795bb9039457b1f9f10ee9f11999a2f6e76affecd03cc5cadf272","appveyor.yml":"5861c1d97075d4a09aea38b0ade35c0a03498f41cdc4f8754122b3793ddb6493","benches/decoding_benchmark.rs":"cd7a790785cda71c8959788d59dca6268618788d986504915c80e552d4dacc99","benches/tower.jpg":"40b5ae0df66540ba3ac60edf2840b4b8edd0500706105f3b63083e3a8993119a","benches/tower_progressive.jpg":"e87bac231e2c11b1aef6981358189ad5c51f67069a43131b1512ed823a7607c6","examples/decode.rs":"713d62790e28d2350174a9fc9a569120437f7425be65753dc700987f851da953","src/decoder.rs":"90d2b4d28da3c1a87ce0dd57fc0b9aa1db22856bc76086c11905e864bf71376b","src/error.rs":"f0ff276799a44416f1a52aa4fcfe4acd4e08bd82a93d5b30846a1b45cb2a28be","src/huffman.rs":"4e90e96e3e35f4f3e076470053a57dc4597c1eba7111b80f91a25052c37876eb","src/idct.rs":"3f3262c1e5f187e1c223cf94d215cb0375d705f1c3031ca1f96ae49486f8cc73","src/lib.rs":"8fe73ef99b9297d2d30e1ba62074b2f02a01c78c227d428b2c0db85708b22651","src/marker.rs":"315e7f87d81c70d1faaff7480c6288ed1e970fcc0fa6328410aca216d67b0139","src/parser.rs":"e72a2968d72300112990090da84b56fee0806a2773abe6b92d6406494b3a02d8","src/upsampler.rs":"2bc768519ff3eb98d1aeb1731a7c3b65ab9f2812b41145f60b10b2f73561a9b5","src/worker/immediate.rs":"9953ea2274c5380fd83f65d639d55a80f1f48080b57917208094f82e2e6bb60f","src/worker/mod.rs":"863afcbd69b588ea61e131e85a7130d64a6573355cc5693b7144fb7039694c98","src/worker/threaded.rs":"765e8a3754e11f0ac6d36efa309d6f3f54d3104ca91c4cc0a125a47e61c66014"},"package":"0256f0aec7352539102a9efbcb75543227b7ab1117e0f95450023af730128451"} \ No newline at end of file diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/idct.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/idct.rs deleted file mode 100644 index 7d12fca..0000000 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/idct.rs +++ /dev/null @@ -1,315 +0,0 @@ -// Malicious JPEG files can cause operations in the idct to overflow. -// One example is tests/crashtest/images/imagetestsuite/b0b8914cc5f7a6eff409f16d8cc236c5.jpg -// That's why wrapping operators are needed. -use crate::parser::Dimensions; - -pub(crate) fn choose_idct_size(full_size: Dimensions, requested_size: Dimensions) -> usize { - fn scaled(len: u16, scale: usize) -> u16 { ((len as u32 * scale as u32 - 1) / 8 + 1) as u16 } - - for &scale in &[1, 2, 4] { - if scaled(full_size.width, scale) >= requested_size.width || scaled(full_size.height, scale) >= requested_size.height { - return scale; - } - } - - return 8; -} - -#[test] -fn test_choose_idct_size() { - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 200, height: 200}), 1); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 500, height: 500}), 1); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 684, height: 456}), 1); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 999, height: 456}), 1); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 684, height: 999}), 1); - assert_eq!(choose_idct_size(Dimensions{width: 500, height: 333}, Dimensions{width: 63, height: 42}), 1); - - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 685, height: 999}), 2); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 1000, height: 1000}), 2); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 1400, height: 1400}), 4); - - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 5472, height: 3648}), 8); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 16384, height: 16384}), 8); - assert_eq!(choose_idct_size(Dimensions{width: 1, height: 1}, Dimensions{width: 65535, height: 65535}), 8); - assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 16384, height: 16384}), 8); -} - -pub(crate) fn dequantize_and_idct_block(scale: usize, coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { - match scale { - 8 => dequantize_and_idct_block_8x8(coefficients, quantization_table, output_linestride, output), - 4 => dequantize_and_idct_block_4x4(coefficients, quantization_table, output_linestride, output), - 2 => dequantize_and_idct_block_2x2(coefficients, quantization_table, output_linestride, output), - 1 => dequantize_and_idct_block_1x1(coefficients, quantization_table, output_linestride, output), - _ => panic!("Unsupported IDCT scale {}/8", scale), - } -} - -// This is based on stb_image's 'stbi__idct_block'. -fn dequantize_and_idct_block_8x8(coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { - debug_assert_eq!(coefficients.len(), 64); - - let mut temp = [0i32; 64]; - - // columns - for i in 0 .. 8 { - // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing - if coefficients[i + 8] == 0 && coefficients[i + 16] == 0 && coefficients[i + 24] == 0 && - coefficients[i + 32] == 0 && coefficients[i + 40] == 0 && coefficients[i + 48] == 0 && - coefficients[i + 56] == 0 { - let dcterm = (coefficients[i] as i32 * quantization_table[i] as i32).wrapping_shl(2); - temp[i] = dcterm; - temp[i + 8] = dcterm; - temp[i + 16] = dcterm; - temp[i + 24] = dcterm; - temp[i + 32] = dcterm; - temp[i + 40] = dcterm; - temp[i + 48] = dcterm; - temp[i + 56] = dcterm; - } - else { - let s0 = coefficients[i] as i32 * quantization_table[i] as i32; - let s1 = coefficients[i + 8] as i32 * quantization_table[i + 8] as i32; - let s2 = coefficients[i + 16] as i32 * quantization_table[i + 16] as i32; - let s3 = coefficients[i + 24] as i32 * quantization_table[i + 24] as i32; - let s4 = coefficients[i + 32] as i32 * quantization_table[i + 32] as i32; - let s5 = coefficients[i + 40] as i32 * quantization_table[i + 40] as i32; - let s6 = coefficients[i + 48] as i32 * quantization_table[i + 48] as i32; - let s7 = coefficients[i + 56] as i32 * quantization_table[i + 56] as i32; - - let p2 = s2; - let p3 = s6; - let p1 = p2.wrapping_add(p3).wrapping_mul(stbi_f2f(0.5411961)); - let t2 = p1.wrapping_add(p3.wrapping_mul(stbi_f2f(-1.847759065))); - let t3 = p1.wrapping_add(p2.wrapping_mul(stbi_f2f(0.765366865))); - let p2 = s0; - let p3 = s4; - let t0 = stbi_fsh(p2.wrapping_add(p3)); - let t1 = stbi_fsh(p2.wrapping_sub(p3)); - let x0 = t0.wrapping_add(t3); - let x3 = t0.wrapping_sub(t3); - let x1 = t1.wrapping_add(t2); - let x2 = t1.wrapping_sub(t2); - let t0 = s7; - let t1 = s5; - let t2 = s3; - let t3 = s1; - let p3 = t0.wrapping_add(t2); - let p4 = t1.wrapping_add(t3); - let p1 = t0.wrapping_add(t3); - let p2 = t1.wrapping_add(t2); - let p5 = p3.wrapping_add(p4).wrapping_mul(stbi_f2f(1.175875602)); - let t0 = t0.wrapping_mul(stbi_f2f(0.298631336)); - let t1 = t1.wrapping_mul(stbi_f2f(2.053119869)); - let t2 = t2.wrapping_mul(stbi_f2f(3.072711026)); - let t3 = t3.wrapping_mul(stbi_f2f(1.501321110)); - let p1 = p5.wrapping_add(p1.wrapping_mul(stbi_f2f(-0.899976223))); - let p2 = p5.wrapping_add(p2.wrapping_mul(stbi_f2f(-2.562915447))); - let p3 = p3.wrapping_mul(stbi_f2f(-1.961570560)); - let p4 = p4.wrapping_mul(stbi_f2f(-0.390180644)); - let t3 = t3.wrapping_add(p1.wrapping_add(p4)); - let t2 = t2.wrapping_add(p2.wrapping_add(p3)); - let t1 = t1.wrapping_add(p2.wrapping_add(p4)); - let t0 = t0.wrapping_add(p1.wrapping_add(p3)); - - // constants scaled things up by 1<<12; let's bring them back - // down, but keep 2 extra bits of precision - let x0 = x0.wrapping_add(512); - let x1 = x1.wrapping_add(512); - let x2 = x2.wrapping_add(512); - let x3 = x3.wrapping_add(512); - - temp[i] = x0.wrapping_add(t3).wrapping_shr(10); - temp[i + 56] = x0.wrapping_sub(t3).wrapping_shr(10); - temp[i + 8] = x1.wrapping_add(t2).wrapping_shr(10); - temp[i + 48] = x1.wrapping_sub(t2).wrapping_shr(10); - temp[i + 16] = x2.wrapping_add(t1).wrapping_shr(10); - temp[i + 40] = x2.wrapping_sub(t1).wrapping_shr(10); - temp[i + 24] = x3.wrapping_add(t0).wrapping_shr(10); - temp[i + 32] = x3.wrapping_sub(t0).wrapping_shr(10); - } - } - - for i in 0 .. 8 { - // no fast case since the first 1D IDCT spread components out - let s0 = temp[i * 8]; - let s1 = temp[i * 8 + 1]; - let s2 = temp[i * 8 + 2]; - let s3 = temp[i * 8 + 3]; - let s4 = temp[i * 8 + 4]; - let s5 = temp[i * 8 + 5]; - let s6 = temp[i * 8 + 6]; - let s7 = temp[i * 8 + 7]; - - let p2 = s2; - let p3 = s6; - let p1 = p2.wrapping_add(p3).wrapping_mul(stbi_f2f(0.5411961)); - let t2 = p1.wrapping_add(p3.wrapping_mul(stbi_f2f(-1.847759065))); - let t3 = p1.wrapping_add(p2.wrapping_mul(stbi_f2f(0.765366865))); - let p2 = s0; - let p3 = s4; - let t0 = stbi_fsh(p2.wrapping_add(p3)); - let t1 = stbi_fsh(p2.wrapping_sub(p3)); - let x0 = t0.wrapping_add(t3); - let x3 = t0.wrapping_sub(t3); - let x1 = t1.wrapping_add(t2); - let x2 = t1.wrapping_sub(t2); - let t0 = s7; - let t1 = s5; - let t2 = s3; - let t3 = s1; - let p3 = t0.wrapping_add(t2); - let p4 = t1.wrapping_add(t3); - let p1 = t0.wrapping_add(t3); - let p2 = t1.wrapping_add(t2); - let p5 = p3.wrapping_add(p4).wrapping_mul(stbi_f2f(1.175875602)); - let t0 = t0.wrapping_mul(stbi_f2f(0.298631336)); - let t1 = t1.wrapping_mul(stbi_f2f(2.053119869)); - let t2 = t2.wrapping_mul(stbi_f2f(3.072711026)); - let t3 = t3.wrapping_mul(stbi_f2f(1.501321110)); - let p1 = p5.wrapping_add(p1.wrapping_mul(stbi_f2f(-0.899976223))); - let p2 = p5.wrapping_add(p2.wrapping_mul(stbi_f2f(-2.562915447))); - let p3 = p3.wrapping_mul(stbi_f2f(-1.961570560)); - let p4 = p4.wrapping_mul(stbi_f2f(-0.390180644)); - let t3 = t3.wrapping_add(p1.wrapping_add(p4)); - let t2 = t2.wrapping_add(p2.wrapping_add(p3)); - let t1 = t1.wrapping_add(p2.wrapping_add(p4)); - let t0 = t0.wrapping_add(p1.wrapping_add(p3)); - - // constants scaled things up by 1<<12, plus we had 1<<2 from first - // loop, plus horizontal and vertical each scale by sqrt(8) so together - // we've got an extra 1<<3, so 1<<17 total we need to remove. - // so we want to round that, which means adding 0.5 * 1<<17, - // aka 65536. Also, we'll end up with -128 to 127 that we want - // to encode as 0..255 by adding 128, so we'll add that before the shift - let x0 = x0.wrapping_add(65536 + (128 << 17)); - let x1 = x1.wrapping_add(65536 + (128 << 17)); - let x2 = x2.wrapping_add(65536 + (128 << 17)); - let x3 = x3.wrapping_add(65536 + (128 << 17)); - - output[i * output_linestride] = stbi_clamp(x0.wrapping_add(t3).wrapping_shr(17)); - output[i * output_linestride + 7] = stbi_clamp(x0.wrapping_sub(t3).wrapping_shr(17)); - output[i * output_linestride + 1] = stbi_clamp(x1.wrapping_add(t2).wrapping_shr(17)); - output[i * output_linestride + 6] = stbi_clamp(x1.wrapping_sub(t2).wrapping_shr(17)); - output[i * output_linestride + 2] = stbi_clamp(x2.wrapping_add(t1).wrapping_shr(17)); - output[i * output_linestride + 5] = stbi_clamp(x2.wrapping_sub(t1).wrapping_shr(17)); - output[i * output_linestride + 3] = stbi_clamp(x3.wrapping_add(t0).wrapping_shr(17)); - output[i * output_linestride + 4] = stbi_clamp(x3.wrapping_sub(t0).wrapping_shr(17)); - } -} - -// 4x4 and 2x2 IDCT based on Rakesh Dugad and Narendra Ahuja: "A Fast Scheme for Image Size Change in the Compressed Domain" (2001). -// http://sylvana.net/jpegcrop/jidctred/ -fn dequantize_and_idct_block_4x4(coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { - debug_assert_eq!(coefficients.len(), 64); - let mut temp = [0i32; 4*4]; - - const CONST_BITS: u32 = 12; - const PASS1_BITS: u32 = 2; - const FINAL_BITS: u32 = CONST_BITS + PASS1_BITS + 3; - - // columns - for i in 0 .. 4 { - let s0 = coefficients[i + 8*0] as i32 * quantization_table[i + 8*0] as i32; - let s1 = coefficients[i + 8*1] as i32 * quantization_table[i + 8*1] as i32; - let s2 = coefficients[i + 8*2] as i32 * quantization_table[i + 8*2] as i32; - let s3 = coefficients[i + 8*3] as i32 * quantization_table[i + 8*3] as i32; - - let x0 = s0.wrapping_add(s2).wrapping_shl(PASS1_BITS); - let x2 = s0.wrapping_sub(s2).wrapping_shl(PASS1_BITS); - - let p1 = s1.wrapping_add(s3).wrapping_mul(stbi_f2f(0.541196100)); - let t0 = p1.wrapping_add(s3.wrapping_mul(stbi_f2f(-1.847759065))).wrapping_add(512).wrapping_shr(CONST_BITS - PASS1_BITS); - let t2 = p1.wrapping_add(s1.wrapping_mul(stbi_f2f( 0.765366865))).wrapping_add(512).wrapping_shr(CONST_BITS - PASS1_BITS); - - temp[i + 4*0] = x0.wrapping_add(t2); - temp[i + 4*3] = x0.wrapping_sub(t2); - temp[i + 4*1] = x2.wrapping_add(t0); - temp[i + 4*2] = x2.wrapping_sub(t0); - } - - for i in 0 .. 4 { - let s0 = temp[i * 4 + 0]; - let s1 = temp[i * 4 + 1]; - let s2 = temp[i * 4 + 2]; - let s3 = temp[i * 4 + 3]; - - let x0 = s0.wrapping_add(s2).wrapping_shl(CONST_BITS); - let x2 = s0.wrapping_sub(s2).wrapping_shl(CONST_BITS); - - let p1 = s1.wrapping_add(s3).wrapping_mul(stbi_f2f(0.541196100)); - let t0 = p1.wrapping_add(s3.wrapping_mul(stbi_f2f(-1.847759065))); - let t2 = p1.wrapping_add(s1.wrapping_mul(stbi_f2f(0.765366865))); - - // constants scaled things up by 1<<12, plus we had 1<<2 from first - // loop, plus horizontal and vertical each scale by sqrt(8) so together - // we've got an extra 1<<3, so 1<<17 total we need to remove. - // so we want to round that, which means adding 0.5 * 1<<17, - // aka 65536. Also, we'll end up with -128 to 127 that we want - // to encode as 0..255 by adding 128, so we'll add that before the shift - let x0 = x0.wrapping_add((1 << (FINAL_BITS - 1)) + (128 << FINAL_BITS)); - let x2 = x2.wrapping_add((1 << (FINAL_BITS - 1)) + (128 << FINAL_BITS)); - - output[i * output_linestride + 0] = stbi_clamp(x0.wrapping_add(t2).wrapping_shr(FINAL_BITS)); - output[i * output_linestride + 3] = stbi_clamp(x0.wrapping_sub(t2).wrapping_shr(FINAL_BITS)); - output[i * output_linestride + 1] = stbi_clamp(x2.wrapping_add(t0).wrapping_shr(FINAL_BITS)); - output[i * output_linestride + 2] = stbi_clamp(x2.wrapping_sub(t0).wrapping_shr(FINAL_BITS)); - } -} - -fn dequantize_and_idct_block_2x2(coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { - debug_assert_eq!(coefficients.len(), 64); - - const SCALE_BITS: u32 = 3; - - // Column 0 - let s00 = coefficients[8*0] as i32 * quantization_table[8*0] as i32; - let s10 = coefficients[8*1] as i32 * quantization_table[8*1] as i32; - - let x0 = s00.wrapping_add(s10); - let x2 = s00.wrapping_sub(s10); - - // Column 1 - let s01 = coefficients[8*0+1] as i32 * quantization_table[8*0+1] as i32; - let s11 = coefficients[8*1+1] as i32 * quantization_table[8*1+1] as i32; - - let x1 = s01.wrapping_add(s11); - let x3 = s01.wrapping_sub(s11); - - let x0 = x0.wrapping_add((1 << (SCALE_BITS-1)) + (128 << SCALE_BITS)); - let x2 = x2.wrapping_add((1 << (SCALE_BITS-1)) + (128 << SCALE_BITS)); - - // Row 0 - output[0] = stbi_clamp(x0.wrapping_add(x1).wrapping_shr(SCALE_BITS)); - output[1] = stbi_clamp(x0.wrapping_sub(x1).wrapping_shr(SCALE_BITS)); - - // Row 1 - output[output_linestride + 0] = stbi_clamp(x2.wrapping_add(x3).wrapping_shr(SCALE_BITS)); - output[output_linestride + 1] = stbi_clamp(x2.wrapping_sub(x3).wrapping_shr(SCALE_BITS)); -} - -fn dequantize_and_idct_block_1x1(coefficients: &[i16], quantization_table: &[u16; 64], _output_linestride: usize, output: &mut [u8]) { - debug_assert_eq!(coefficients.len(), 64); - - let s0 = (coefficients[0] as i32 * quantization_table[0] as i32).wrapping_add(128 * 8) / 8; - output[0] = stbi_clamp(s0); -} - -// take a -128..127 value and stbi__clamp it and convert to 0..255 -fn stbi_clamp(x: i32) -> u8 -{ - // trick to use a single test to catch both cases - if x as u32 > 255 { - if x < 0 { return 0; } - if x > 255 { return 255; } - } - - x as u8 -} - -fn stbi_f2f(x: f32) -> i32 { - (x * 4096.0 + 0.5) as i32 -} - -fn stbi_fsh(x: i32) -> i32 { - x << 12 -} diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.19/.cargo-checksum.json b/third_party/cargo/vendor/jpeg-decoder-0.1.19/.cargo-checksum.json new file mode 100644 index 0000000..f8baff4 --- /dev/null +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"8b257f3f6ad4fc883908d06f0513eef0a78214bf4888676c3bbdbbe34c9fb41f","Cargo.lock":"ee226b385d11cccaae88f5e5e41851dea49a61b491d4bc5859299fdf7b20d0d8","Cargo.toml":"1184d5a68a143728645154933847faa8608f50c01f0c32f27a7767fbbcdd0bce","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"22b83fb92a50418c7df9564b9c179fa2a0e74f293bc58b72dd7e218fc0902143","README.md":"fc5c09eb92c453ff778ee5fa585d7509dcf36e3499c2e560a8922d38c0d4c651","appveyor.yml":"5861c1d97075d4a09aea38b0ade35c0a03498f41cdc4f8754122b3793ddb6493","benches/decoding_benchmark.rs":"047d3ac829ae15d931922f2ebeb614fdbf09994bd144e255f7800fa92b627ea8","benches/tower.jpg":"40b5ae0df66540ba3ac60edf2840b4b8edd0500706105f3b63083e3a8993119a","benches/tower_grayscale.jpg":"90519862a5bc59ca5702ff802a2f16e8cdcd28b124f891bb03556b920742d94e","benches/tower_progressive.jpg":"e87bac231e2c11b1aef6981358189ad5c51f67069a43131b1512ed823a7607c6","examples/decode.rs":"6526ad8c03f230c96f2f2fb10a2cba01fc367e98c59ab5f5433d0fab4bf41bbf","src/decoder.rs":"83c416dc2588673dd6b8531948f4670904ad9376278f04dc303b6ba5b04deba7","src/error.rs":"6c6592579922a930001bea37ec32c3f7b135210df06ec055b9bbd3b6527723f7","src/huffman.rs":"4e90e96e3e35f4f3e076470053a57dc4597c1eba7111b80f91a25052c37876eb","src/idct.rs":"b582c950b286fbff7c20073aa2d572f3c9e85fe0d74f62ff8e9325362ca2707e","src/lib.rs":"8fe73ef99b9297d2d30e1ba62074b2f02a01c78c227d428b2c0db85708b22651","src/marker.rs":"315e7f87d81c70d1faaff7480c6288ed1e970fcc0fa6328410aca216d67b0139","src/parser.rs":"e9e55d8e62b1c652f74478793f31ac9c0a08bd1849788c17172d08634e4bca23","src/upsampler.rs":"2bc768519ff3eb98d1aeb1731a7c3b65ab9f2812b41145f60b10b2f73561a9b5","src/worker/immediate.rs":"9953ea2274c5380fd83f65d639d55a80f1f48080b57917208094f82e2e6bb60f","src/worker/mod.rs":"863afcbd69b588ea61e131e85a7130d64a6573355cc5693b7144fb7039694c98","src/worker/threaded.rs":"765e8a3754e11f0ac6d36efa309d6f3f54d3104ca91c4cc0a125a47e61c66014"},"package":"5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704"} \ No newline at end of file diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/BUILD b/third_party/cargo/vendor/jpeg-decoder-0.1.19/BUILD similarity index 97% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/BUILD rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/BUILD index cc082b6..6f50c1a 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/BUILD +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/BUILD @@ -39,7 +39,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.1.18", + version = "0.1.19", crate_features = [ "rayon", ], diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/CHANGELOG.md b/third_party/cargo/vendor/jpeg-decoder-0.1.19/CHANGELOG.md similarity index 92% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/CHANGELOG.md rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/CHANGELOG.md index f8c2daf..71412ee 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/CHANGELOG.md +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/CHANGELOG.md @@ -4,6 +4,12 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +## v0.1.19 (2020-04-27) +- Fix decoding returning too much image data +- Fix recognizing padding in marker segments +- Several decode performance improvements +- Remove use of deprecated `Error::description` + ## v0.1.18 (2019-12-10) - Fix two bugs causing panics introduced in 0.1.17. diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/Cargo.lock b/third_party/cargo/vendor/jpeg-decoder-0.1.19/Cargo.lock similarity index 92% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/Cargo.lock rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/Cargo.lock index d7ad480..df2eb87 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/Cargo.lock +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/Cargo.lock @@ -10,7 +10,7 @@ name = "atty" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (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.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -63,6 +63,14 @@ dependencies = [ "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "criterion" version = "0.3.0" @@ -158,7 +166,7 @@ dependencies = [ [[package]] name = "deflate" -version = "0.7.20" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -176,7 +184,7 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -185,7 +193,7 @@ name = "hermit-abi" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -211,11 +219,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "jpeg-decoder" -version = "0.1.18" +version = "0.1.19" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "png 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -227,7 +235,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.65" +version = "0.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -235,7 +243,7 @@ name = "memchr" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -246,25 +254,6 @@ dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "num-integer" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-iter" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "num-traits" version = "0.2.10" @@ -279,18 +268,18 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "png" -version = "0.14.1" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -517,6 +506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" "checksum criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "938703e165481c8d612ea3479ac8342e5615185db37765162e762ec3523e2fc6" "checksum criterion-plot 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eccdc6ce8bbe352ca89025bee672aa6d24f4eb8c53e3a8b5d1bc58011da072a2" "checksum crossbeam-deque 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3aa945d63861bfe624b55d153a39684da1e8c0bc8fba932f7ee3a3c16cea3ca" @@ -525,7 +515,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-utils 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ce446db02cdc3165b94ae73111e570793400d0794e46125cc4056c81cbb039f4" "checksum csv 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37519ccdfd73a75821cac9319d4fce15a81b9fcf75f951df5b9988aa3a0af87d" "checksum csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9b5cadb6b25c77aeff80ba701712494213f4a8418fcda2ee11b6560c3ad0bf4c" -"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" +"checksum deflate 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" "checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" @@ -533,14 +523,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "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 libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" +"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" -"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" -"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" "checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4" "checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72" -"checksum png 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63daf481fdd0defa2d1d2be15c674fbfa1b0fd71882c303a91f9a79b3252c359" +"checksum png 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2c68a431ed29933a4eb5709aca9800989758c97759345860fa5db3cfced0b65d" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/Cargo.toml b/third_party/cargo/vendor/jpeg-decoder-0.1.19/Cargo.toml similarity index 96% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/Cargo.toml rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/Cargo.toml index 3fe75f1..139c765 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/Cargo.toml +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "jpeg-decoder" -version = "0.1.18" +version = "0.1.19" authors = ["Ulf Nilsson "] exclude = ["tests/*"] description = "JPEG decoder" @@ -35,7 +35,7 @@ optional = true version = "0.3" [dev-dependencies.png] -version = "0.14" +version = "0.16" [dev-dependencies.walkdir] version = "2.0" diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/LICENSE-APACHE b/third_party/cargo/vendor/jpeg-decoder-0.1.19/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/LICENSE-APACHE rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/LICENSE-APACHE diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/LICENSE-MIT b/third_party/cargo/vendor/jpeg-decoder-0.1.19/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/LICENSE-MIT rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/LICENSE-MIT diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/README.md b/third_party/cargo/vendor/jpeg-decoder-0.1.19/README.md similarity index 86% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/README.md rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/README.md index cf8eb57..33524ae 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/README.md +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/README.md @@ -1,6 +1,6 @@ # jpeg-decoder -[![Travis Build Status](https://travis-ci.org/image-rs/jpeg-decoder.svg?branch=master)](https://travis-ci.org/image-rs/jpeg-decoder) +[![Rust CI](https://github.com/image-rs/jpeg-decoder/workflows/Rust%20CI/badge.svg)](https://github.com/image-rs/jpeg-decoder/actions) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/k65rrkd0f8yb4o9w/branch/master?svg=true)](https://ci.appveyor.com/project/kaksmet/jpeg-decoder/branch/master) [![Crates.io](https://img.shields.io/crates/v/jpeg-decoder.svg)](https://crates.io/crates/jpeg-decoder) diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/appveyor.yml b/third_party/cargo/vendor/jpeg-decoder-0.1.19/appveyor.yml similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/appveyor.yml rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/appveyor.yml diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/benches/decoding_benchmark.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/decoding_benchmark.rs similarity index 86% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/benches/decoding_benchmark.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/decoding_benchmark.rs index c80a16f..6b62651 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/benches/decoding_benchmark.rs +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/decoding_benchmark.rs @@ -26,6 +26,10 @@ fn main() { read_image(include_bytes!("tower_progressive.jpg")) })); + c.bench_function("decode a 512x512 grayscale JPEG", |b| b.iter(|| { + read_image(include_bytes!("tower_grayscale.jpg")) + })); + c.bench_function("extract metadata from an image", |b| b.iter(|| { read_metadata(include_bytes!("tower.jpg")) })); diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/benches/tower.jpg b/third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/tower.jpg similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/benches/tower.jpg rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/tower.jpg diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/tower_grayscale.jpg b/third_party/cargo/vendor/jpeg-decoder-0.1.19/benches/tower_grayscale.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bf20f9c077c8c5e5d17bb5aebb207f9b5a37bdad GIT binary patch literal 54254 zcmc$_c|4Tg`#5}$!5~>`)TqH^$-a!Ov5ln+vKw1S7-BHCvCCSj_q@j*X%bU*qRm=_ z%F=?eln_Fsnj~9@o}0?M&+>hq@ALcTH)dYzr#n=iKM`G4Nvy;5mvj!T}Hn z1TX~ufFExWefr_VlK^093P=F}zy@$YxB;fE5&)cq@NAX2zc0uvVXf= z0FeNoTX2vHg5JXC1nbu!id$tkSgvE*{R;=AK1T$Yx9|br*?FQ<=BRR%wu* zI1nZ%kPZPjevXLgWIEF}f4_9-Has*P_D^5w?7zx90FchHjUSVKYK!My0AMp-z-D_D6{-3BS1LoKX4Fj^8=Ey?f{=<;LrWH6%^D^Xa#i@HFYJ`ZOi-#0{}?^ zXy^AJ&81B`P}a$xPaaTi==*Ii1c3mcq*@}EyoGmtIqFk7i%KxV(J z2x@1O5cKAstxRT{wV!qZeHE$>O0((XO!}K}<}G_{!mYs4rb;${pm0#WPo}tI03Z%pdJAt8zH18(NIc$xL!^sA+D#p>|AYe? zzn-F-&wq3Y)>t9GEy4;mZATz<@}CHVe)=;4nIOL{4qaf{_6qm_$ZPZSFLCta&y27s z0XWtlL%?Bxjg=L~%EAVN!Pwc^I5^=uId|;f`P!<+uW)M4iGhmr{ zS#}*j>$2{)bcG2A!WHAwuCj^f-D=^pdhtb6$t@^>ony~l1phv^5ZpaZdU_GP$-yC^Vc`*xr_UswJ$L>uN_xhH%&d#qmuT1W z3kr*hOG?Xb->IsusjaKO`{3cD*0%PJ$4`2C`}$wL8hAbUc6?&;-PH8^nGbVc=NA^2 zmcOm6ZpsBl^G~t1CHptIctN?Cn3uuZujOkv;;%FE1h0L{8f*AnI$xLa5;o(-;- zcJ)>ZyNHt27e2S37aV&;mEVfZZHl%f+5b+kg#RPSwgvk~u0enk3Wgvrlo!wjp0vtI z4ivUV6`xmv-y?o2Yz36yb;WKM;jMw$g{|6fx461zmXr(>bI7>n3dIS3^Yf;n#;FzuE_)4GL5{MZ zc^TjU2UVXlM-cR(w@WFUsTJJ z&jn7T%vd!yHJL~f>H@gfzk6RPnpM?)V|uQZ(4;MWYC4AyKP1q_?Wg(4316|}2jGyK z#apcxx=|$xS`JjT^Iub(LpZS13gxfK05#N#5*gaktlO_As{uu|FFPL&5tJxJ>!bKL zYoLkb3@FE|)SEM1GI4sH4MwwuIr z^23x1H9$eG)Z{em1OA5Bl^zXD>&YM~h=8b@LB!P9v*%W-=cK4VKfeep{@eKN>lOa2 z#cuP6XV=j0(9kn-;n*BOt$A91L-@77j6chSxyaLzIUB;a$M(Feec8@Xe2mO`@(KNf zbFnRQarITkU$OT$?g_T>#Z0e$_F)tbS>1L$zo2~Cr{5qM3`;O@$K)M*GW9#IASVweK)g)L00iS_aDGwx!kKY+_+WuZOo&}X9FJ(aF}7H zzfTlKsQ7&t?OXCHC|Pg&c&f`0@wiJ;weS4x>+unzsp`wC_?_32kOK)_`WG}SM+aZrJWzMCJF~aOyTRee`L(15W|W;qi0FzA0>2zd zZVh+t9jTu!kq){Nl5JZ>y?)KPK5#Sx&!`MDtFP;stx%qk%`WVt($_0I2J}8_0oqqW z_WQhgXpJvQ+0SR5o0-qKt26K6s?zRa#>S>LQA$*SBGx|MdDwQiNebPh#n*J2SW^YNs!xkTgiz9&&?n zd-yjUtk;-gCvZO0#?;CuN=q@KvZ~uR6@k^V_cMxNQ*EggNb^T* zb4}ZLtn!cp**E+-tgA^@e+RrlO^)_T@OWL&=lE-i$pNff+|KJhMMF+|&sFXji83N2 zp7D{^z3I8^l52!`uQcm??)Ke)peiRb6W{1}a+4Zhf>KG>ieKx4&B{Q;2g%SiJF&Mn zb`M_BB7OEudxQOW`)hLsbzQo+=6=mRx6}^)xW|Y}6VkeZyVYsfVc3BTTVh-2oEb`-xhn$a2LCPj`aVLY@7bb9vT z6q+;FsmBy!LRQ>)U?bgW3>_{_| z35so`(X{tEXaALF#+*StayT%#;bwWUtrW+>5Q#2)kb#!cg}zzi>j9}xmCbY>GGVX} zr-UwgFGOo~_Mh2xhw0hrKq!#AIITZ>)abGiyWt~4=KJ5e%^Ef`%L{!RS}%mY{8(Jx zE?S0sDvv(vi*z9XoEs`h`*P9`-7wD;51E|nvx*2WO`wFMg87EJy0}kLMvg7yd)SN8 z{9c$}`KyKJQ@+Qhmy^#O;2Ly_vc5;Gv{m*D=OND{3b)hVhx31sxFMoGY^4;DuHb>u zgy?%NE`KjvH-Fah;;E>KbxvkSJ0XWWQYE8#IJ)R#;O%F6Ulk`#x2q(v3_0ePh`I-u zT1R{zx{$VUN-%1w{=)u@v{#aHj)GZDJd<}aZQsk#a}5B{ULS%_>><*gHW03}HqaLqg%hx73=3rrfSKYhlXL3sZ>?kij2YiHx4 z@TFzr-ikD8P}|?neCsgS#rNvklm&+O^rx5C$6bZ8ZQ{lPXJ;MSZo41NOuBORqD$c$ z>qXQXQX-gQ901=Q@2(ZTaA1Io;U0g5ahXhLE!HvWa|8T?e1cg zz^J9DIz}}^{kZzp9M587t^mDw{AGyYIW28yQ(Twrw5C9asz*)tWD#V6zP*6II%_acPIH5 zWDXvbfKPZ!H1k8#W2(iPDAh`hCPQ(btxwjED6)U*%-Ux_XIy6lV_x`CR9~_gV#nO= z)VTlt>}EL5cJS1xPt*4!Ik_@V&YqynnqDv>B9dO6J;pBbrPc9~o>74q&Zwx1%dp_^ zRH>Z(L`I%po2Nu81m7Iz)d9^h}e19$X#;0$RoAb~|Q$etk99Tuuxp_E)ziAz5weuB$l7 z#69y|Q6{O5nX*q^0pPsq3$OM+*<0v`YyWCFG=~^iSrRJJQJ&S1u3=4Fqra;;qcQ!3$x=v1-?iK%Nf_u7a?{XANL=BxEIOS|XxjqhIm z{#UE+RlS+wJa9OvzRR#XHnOccS1rw2@luZ8fOdDI+lbqQZQQkteG+dLv^VayX)@N@ zZe&X5->IQF)}#-%{u6jIji&KUF|t#Q?o&pzbfDAxZgv+ z%gGcSTLKoKE3eYM_TpblJIzvdFP%kSI%e%jY*U)a)n4tNxobcPPTci(5hcRiM&DBX zCV3RIy4LUDxNDNucc(P`?30HMU#~1TSQ+~@bCOo#nKz*G<)xJlrb_zEU+$e7fW#CJ zQF&)+t&R6z_^YG?Jq1J&_Vce|L}keLVz?qXe*j6Oq{^}6Zw;I065 z+vFezp8UO~m&TKXHIjnZ^KgQ};Zp>vUz$ zB(--^6PLQB7bo5BHsX)}Ct@8h*Cm}B%xSSMfxa;Axzc8c>7 zyVJ*N!XJNZ^UiqF?(dsCw@1v_HKKX-r4;$Sqh-_;xvP~%<*mCl-lb-Wa=Ig97e8_{ zsfI#>D>~X;n@dpjDdtJ{`)r5N^Qt*luEw>QmwwdkbNPDWiG%|E$~UBYu*xp#%9XYp z(pA^1$7GM7GSjjXvFqd%?_6cC%fyx2KY;K>l~h`1>B!&n>MrjL)h2Fsc@NiCz=gf? zPntfIeLO}@?yGmdLX$nJs!Z_JNXNaKr1s5*em$0bh$r4~b$X?r?b%iLK$1+{?z*z+ zrWF;3k!c1;a}m;=^PoXZVDAs0!nXI$EzPI8_g-~dGbNwTyuuu$1dwY58YQmXx$Ggl zTJ~6&^@s>Y#2=Q^d$?(6k!2)6?idV;fkJDqDq9*Ia;^QGZZ31@XoivWC46Gc8P6Fr zpTGawrzG>$=%x#d^su<8ha%D08G8T+fK{ zke05Wx|eEnz*W?7K=91zcD`7%zR%aQT$wK)sUJb-d@=YcK7Wl;d{@bI`0R(TBwdlL z_kVdKtXD49U# zovF9h4F8ULaDC`#6TgT^ZcN<*pXbBX_}lmLRI_R!z0BrT4~G&OxKkKw*kU4PDI_mF|KKH&A{P9}!YEfgH}LLWmDNo(joNU{Dp z5q}6r9U?%L~4OXaDgMIw6S$3e?7w0D3Eal~2hqll7>o_@4=GIri?)adH8y`l09U7JR*Mc-{!N;`G{+< zhc%Jpf&J&*`}R4;uR(32Y!e+j>~=WF!keR?0!rT&C9&mFs#`84`O6;viM}m{Zh%KnFzAiHxX7p|Z86#M zv)||jyvA5ZndVrFEPG<_{ zO{|e0!Qam>Z0=j%%LLT#!zz%_{MVI2|Rp(VbV_CkUP9zS#V&y2l=xM`4| zO2hdRTzySE{5*rbu*x!M6p8e!n?D=2u{URcAT$49Fs&(}{0YGx!DN)X2g)5B-osK4 zGK%Q;E3~#V?>`jVOzQEF zHuaXCEQsO1BlCA175Xz&QQ)-yTUDF7{{wZK$6{)> zul*5l!tmS514`g|;V<-mZ~9l7WB<@7t14jrr1_(1n+CthA9O2^U@w1nEZ*O5(|R5# zf`5pwM@SIrAsrRsha$KJ1cS9-y#AHsA5H`hzb!YzT6p;fZ|2qjFXF>elshrV19S{f zkl^18wlTMfe<$TF_ui^(O?fESkYIljm@)!GJbn@X3+6Vxofk3KL(kRM)eltduO}!6 z8RfPKBL5dY|3b0N=MN`0@>5bFk#Iy`5>`?9SLgq|d7B!)DcE69S(_6V7;sp8u&bZD zYtZlM`ajyYDUCL#b$>9+xVjO2iNO&@pdG@oX1}`q@2&qM@ox`R#>k*l&@w2rs*IAF zqT2t!>^Jr{I|B>6iN7D1_Cwq~tUOL)^?womJN&;AU{Q)-hhWEO83ko!^nW4!C)I!q zb$x@k`!OSidboycdY`W=isbRz-Tn>h&t891V-Kmy976xm*>=O9*qaFkGzcjGtDyGt z{)o)xEWNdC1v~kt`A?$F$@C}DKkK%CX#Q#4rupx-0wtHZevkFv zIs8Te7xi1Kj6YWO;7b1|4BRb%`v&>#-33_L-k*5*ft!+`&E3b=#SADD)8-faFoRzf zw#_RJEF3TxD;p;VC+7~19Xob%?c&+V#mlv02hScJ-raCMK0Z$Fy@)+<#4b1=9K2Jp zgN+HimjZ$C0^qF!0q`OUzyw}A_tK)7i?^a~U)c959S%yELx_nh{zsY#D`ITA7T%12iNojC*YB9(1=_Gx5*^q@Z>52l zesrawNYfzgUBu@YsZ5-iRO-8!3nVD)`>E%aaY7Ed+>zIm@=h~M?d}sN_}jG|n8v23 z$8(1RTZE1t#T<;&j=bQ++iI_yvs?hcW^~M0(M!c?buKPFJ5D#ZdFj8sudh(=tb3J3 zlXGcfQ5SYopsCSJQF0|*;LaMJy=roPneXVO$@q3}K1FQIcpL^;UTRf#o(x;LYS1fm zRF`SY9mMifrmWtvYFs;coe8TT(GFWDvb0PFNkY=!w2vgwdDzxx%5ri?3Fdw;9vAFg z#P3Me{p2;2jP(v|i*1!p#l=Wn5K6}O#W5JT<}yXKHCyE%_A#SF1nNf9pzssWA6qiz~igdo|86;6a0*M-0(&}roASn z-y7Yg(Z?dn?VH=zA2pYfVVconh7p`fv^?Dnztswf{r(&#N}zeG3BE3stgY3aHQ#>` z(Na{VG#Wo|gy}NFUbqw$Kd{UicSv%nIF3tEX;udk0l4KaMunBP?XEEmEP?X#Ia^F7 z1Ymux)>3yj(ny$$_m_r>o+WjC47*TZ3FOR+|`B@G!=5`Rh8~&swF4Ef&PGv7A_%E3nkv zDMQvVZ3r#Gkw+3OxZ6k4OemfJxozjc7SPUCbn#^N8x~(ktxaa%s3!ixk9)&z@tKX3 zxUZiuQ(OP|v|o{5w;9R77xWCBDp{iD%@@Gl9b2e!yve^%2HK_u>aks`RqTYVzVk>F zccU0SC(ztg{Jn&~fzSx;#)k=I;Q*x#Q?2|2pyRV7B<*udLY!*W4}ibGI{61MV~_<4 zG_}*Hdt9_TXU+1?vT_aKR`*C;WAik&kFtaiI@L!QLiY1@zf7oK-dLb~B@cvl>L8cK zb4QfoDXP8Au0u4YX|0X^7X#dpaNd!)d-1chLS`PVIaBLhy3Fyq7HrI4U;$ER0sdL@ zlM$_Es_ELDTJ#^lD|qwpYk=c+<72oBbm03^!R}<(x3Zz9v5mF>wtWWoEaS6APrFu< zRf+85DQc{@2bB9pqe8>;sP&x?fIr`FM_{`*M~)?xGcQ+?Wo*($iiV7fc^@4c^9#=%|VrAwtomvAVWarfbesL4~=R_NRX z_%!My4Kf^BTt(Qpz>EYm@IwzK@?xtG2wFqhuwH{fv7L~k6I0oiEv+cE_G&RCGF^fL z5PV%!W{CR2!l|hJ5jUKxw*Gz)Cgi-304ggVbZAij+DutcrP%7gFMD%N&0Ck(iZUsU zB*cAz#YXBIAdvltX6RI^^FZa<=d3#obx+S(mnWDDG*z>Ni?2(i1r>`>2tr5-+i*B^ z&F0!%-e86tmr|S;d;DOz%NPyJ?fsDUm)TCdspMPNoDj{e%K(eIG z@GAa5WBquxQxq*+d}l5(QG6>&}Cgr<2z^gPFr)i&uMjC)22*vle(LqPfyslzX|L zgu7FLelVg-szeG~UnUaJWwbhe#u+0tlBmbtK1A~wN`5_SQ+t}q0Z4b>S}DGHVdW~$ zKpfs7_-5@ndPu0+!Z~VkAD=>u)`yxbK2eWEj)J_{k#c{L8DrQqjgYpS?>Um5!dNJ` z9$VKB@D3d}=6xT5ygMesa644mEcgQ`2>g7Ab3$zzia;>t4U3mnEz09_c1h?&EWzjU zMrd+u-Hoa+=rqHoiaB7@MT1d)*fIfW=1)9$YDs~0id zaF)r~o-BnZ{LsQw8vb#sm|j%a>T^~NF0X+=nnyTO>hWv2Z$_J{WiQQ+jwI#(03H{= zW73!anZ#5*;QfTwb^4-l%IYdS zO@e(9r;>xDGTFt4KI&Mp#`a`eo*j>Cn8?Ai)8I>d_OKykKyL!xA1x!vz_hQ>aau_b z;sjKn`(-vP3~6~s9J}EAZC1xQ=2}5~#!#d4aA3*+C5pUCj3akrCg5)qjxDq0NAUAr zNk|ANE6iSxW6t;@71F7`zf(?3-EH(!(v{5Ngs$tiD_IR(M6{Bl@AX1nAO4gEPkVSe z^G!Nrbxa7HF%zOY=*!)wmW$}240FG5&8ckXjRlsDW}&GPPTu)N`ay1A4sR~|P~|5C z{vQCmW(<%Rdi(>>cAzW51p7r@JnI=oc8gqKQ%5sm_Om3ZqXo{qqPb3#N*m6_5zokw zb0|kIJ!Y8ui;U8a<_p1}d_S2`2SzS)>FRe2_yi3R>BSLcfn!^Zmdt$IEi&nr^(-L3 zyt`AjN%y#pQeH}-p@kVs5PU`G=!A$*Saadcw2ehawyw9h(Uj!AF9C|--^$t`YTAto zY7@)(J51zYwaWdNG0!Es!DCITWs12sxVBgyzCsBBZ=DmK!?~zqe%W z2jI>0eTo`36&D8?$g9}V78J2k<^)Xv=Tpyh>11d6i{QVrE9BH^y+(bNFUHUfY5u(0 z1vR4X&>m4g`&~f0I5p2~0q^7XT16{pxN5HI_Ho_t2TWJpY(-1kxvUl5B-n|F2l_F- z?-39Spm7ynf4}rJFu3Lme>FU*fa>a&q}ew7=>bkUet;{2k8<}fk%sys%s5eZr|;0# z0BSBU9#_D*#CKRc8OAWeAt-c=U@o|@arvrNWIfTiU$M!X?ORL1UR3V%fQ3bd3AaW2 z$R&Zg@vI&Uy;AF(^7*k-R+6hX^(`#hHG9}kQ&a9sN{D~ZdM{-NXAxXcW|^HeM_{yO zd{Ml~;GM1+wT-?9xu!DiIa6^3YZiOqb2;l$dSSwMb)(xya+}qb^N|FE8vWo~Q#;8a zjTp(>LUr_m25_nQ1^5%rFmRnU8Up=jeiA6IayzTTif&cWfxAQ}La@Y7-!z}YNmudJ zvN@B<8XSdAf*Q~FVld;Ug+wxzidbQot9Cg{^wKWF!m6dRp#)&O)Xps(7oc_4=T@w^ zX^80I;>DPY>IJs%)0~FS@3RXg-99SJTPk`Q9z$pdD6!yWtE^nj?E2!qM7OI9K$psPTzRPMJ8`qS z6QWd?b9$+$?gWKim?9L()((Y3sL$bnEx?P~+PdOeFxb~iIKo2P8M*?uHi%LIhmh;~ zD)_+yZp#VbRQ`^l-H@}AvCm-M?w&)Gz3FTSKF7ce#wZ`){?*jdX&tR=!lhj;gCxME z#sX>fqRDDygL@l|bTCV07LeujkJm~Jga!-bAdiujwIcEBofgPsCA(ol?Q=ZJQ{er8 z(d=RYVJt(Bj#%pjP6c?itT&dlY1dY3?qZuYwN9fkWenp7(F5ESsJfN$)AL`kQuT}t z$+DoRXi1lxx%O5LMea_-o3z18miI)e74x)<68Y(?2HvK3F@^5$5_ZA5dumALZB0xK z8Yv~g_0^{M(%5r{_n*LKLN*M)KPd3JEq&w=YnraaY`q8?=CSyBWj1_?RA@g zvssfQaE{r1Q{b%OY*&y`=?8702DXpRDgBHJxy8Q`oJ(n)Az{dZ2d6q8*9KvnR@~7* zK#<{Qg)8C&pCTetyIH^NVukuH&A&e$zwh+qiI9ko0!Hp(0#4uK0vWt#>s_bW>l8L? zy;pNQss0Brcf@6WmJ$W4qldMsSPf556d>4#a6kt;m7a3S@+-L=T%xVvExUckbGZc< zYQ_lF2uufbso?MQ7zse|A-rZH)Rf~)N*=WzQf;7iFtsbZ$RcC72bxE5x8ev#jp3z$ z<%9VyEcKJ)2hB0+PXJ15!Xpc&fOvs|k*cT`!TnVt}4Q#Nm8C&E9T zREOz`^#)eSCh~r2E3L{yK&&lnr>c26W2OE|6}M=*NXSF2R@45|{KO2m0kmXEpEjl@JNG$NteLsYI zMs;@RXR`MBSf*9+hfN$e7T?Gh9k`Xyi%*W$dn3o0W|CUa$tgol6-_O0UyI1*uMldk zy7FE6g`7NOZpFsT%I0mai>}snkH+IL zT@pj_%~MHDnwIZQFKB<%J>egz;e;FPtufb!CdyzolznIvJ>3)UWH$InE&G4a%zX)j* z{%Cr$;lmCMML#>VIh*lchUR8C2e!5_-VYt0^=8Hu?q7iDe1f}hS6i5`)bp1~VbOX; zO6w&6d7%u&>6tfJj9gkODo^A`PLZLs#dd4PXCT z7%(Y&CVWB$T9=CHdYgZ^hj#zsTU@>Pk@xcpvqu^i6Gq+-4!ajvj=KiS@8!>_aRn-a z?pv5%SI`jLIkV@LfKZ>+0;9VBqHcSMeYdA;_&q<_8`frG-@Cu}@;v?^m?ulHX|aWp z1_L`If3RS2mZ6OEX@x)p`rB@wb;Hs7jCkS2`!4;yi~yIs5O(>7E?t5 zqVPMamNxoGj~OGWCvqpB!*jpmZ6>A)BrWHUD=5UkUMAHO7$#vY{A>6&^L4MsqVWS3 zTF5~)OY1g^@M(b( zAbz1>ufV+?_Jo}lPHD+~QaMZGX=dIJdN=}?>701`?&W-c-zC1+{UQEijVvX9XVGK@ zS2qT=a2^>?4X;roCr22c_$X=AD=h)n11j?6Z5Fvwp5MKGTui0iD!Axs`OK}h<%{O~ zN7~%(`V`Zm-!U%jlbAni$$KW|YWmO#-9@N#@aO7+nY$HBO})1q3VXb3<1)zVPOUpw zA0IqqItdpS*I3~!sy~av6tUU~Bq=t8tQ?&d;E6c+!A2 zOxe&P9boV1L{7>n7NyR6*kfHH?9Kwk%NcI*!~5xLCjnkV4hLYRg4xNOE4J zPcwGl>NzC1-t<;bn_ZwM>suUePt$#S9-z6$M)K((7&JGzNAA7sGeRmlysZj~WF4nz zK3$xGB;OC95tX;9{3I$_lH{NYu8x%?~77k55(azHfaaf=pg1mS-gy5VU8nV#xBzmOg!@?3dg)k3oOUA$SbDtr zoIXKwG!$}ppNQlpnA&lo2P|u`1I5(u&rdhO!R!ngxo&zY8|gle1NlW>t7|i5(K@$W zw3~9X!OFV1JF-xy(TYm7A&q&CP8GX!zf5yhfaLpsD=Xt42YHNRO;TEZr*_Y6MT|Yiu zuck47(awN~<@zwl@-jC#DMrh=t*5`J&y1mdjB!Iy!t`OKn=3M`j9&V6@ExliA|v{tm8q&hY7@IKQq5E}gfR?hLfAOF+Y( z+X$0H8o`TNridY`ReO_)E}&Jyq2Se~9qAF#x?iV=&J_LwP)4$}?l%Xw+77BIv2(g9 z)SjVH*xGX(G_X_b#H=wwG#*Sg;NmF=TSZ!(0CWE?vI)5r5;&Anh?r>7c3|s(ftxwO zg(pkhBFf#>%!He>#(u0yYj#H}(YWETHe#aMdTE)<*iyb1^NZwWDu;)eF1)!7Qe-Eb z${f?L!#CTh8M;zrmD|m*hO=zW#l1R;;cd|~E72QOH52^#E->&p$%Upcxu@wBv3DXw zdz*#GxMz8VnnBnB_)=v3bc*-ex&4Q8M++kz9eS#7yuCYIDt2AMnUr>NCEqjslhAgWI=b1~affsG(T%D3GIqRL> zuK?RQKN!c>JZo1)C0kiX&&}J#Q;yazso2jhe~^W`E|B4Man zfgXr!Ih_l>nrfA;%lDcdEcW*sSnb`B#-O<>M8zyfK(eP26cupT#RJiYY2nS{Qwd6W z;LE9@3=`_|IMpRuLVBi)7{`%AQKcp;nfob5mkZU_HYya0Q>Su+VyYltA#2ZB9cyq} zA2I_BXLb4W{cB>Yt!|)b3I>RY8JlGC5V#BDlGrh4jwr%mt042%amck7Hh1{JWImF` z>Lr<1Vb(iqosaB!O=Ftxis_Fs7bun3In?y>X0F5uu1uf(ZwN;(Tg^PJU>$k>`maZ^ zS5Drq_tbat_rrQqf-iWxA|F{zM+lyMgB2G&G*-JPIdaCN1nHrxNPn zOG^{9C@!U0+%T))0;Jo|TW>zko30RZAt5KU8=e`{57O(^#tt-yW?FHWKG1raj^)@b<|;MWfBERpIKy=<#jvUGKvQ2eL-FhAGs7izl-KdKoIR(?-r+b1oQ1U! z5jn_O#8tb~3q^aS7t5r`R0|%a7~*x$YL;kmO`0n!nxTs~CL%49HOOWO#dQq3J3zEg zidQ!itvH57@m`9zt|4qBL7|Ednl1?kmoz8(+ay^gs)5)+DsSihplgZDLU~0}6!&>B zc}OOLnU-K(UKKcNWtXv7Nr^jT<2zlAs@E!=ptxeD({uz!7M6OUh;j?8gye_SlX(lz z%Ui&gczXrPYUWJwjrJyeXHW!+Yhb&wgp7Ho3?ySDsUCc-YZ5IHm z9NrBU`8&J4AA}DPdKgip-QF-G$2DVV$8{aYv!hy7Quhwsk)JVqa;By0D=wmYPfFoJ z#q`cC0N>+fHu)Ozzp^?Z_wd)$fQ>P?CHZlN{Rhlz}wOSyT7`pt*kDSJmhkJK`uOz90M0l4H!#p3|vb2SIoAbrF_ z?@$hJM-kj5wgNFBGM?E#-rr$-@vrzD zH%r*5laseUb;K&xf2l276wEfhB5lW6D`4WE{{dm0XkTMe_~v4t=37(Np<_&E_oz89uDG91Y18-wJyKUdKC zRcivDwGAahgB0@1}QYJMQ$LB^_u!gr& zDLNB0U9EF`_6xU`ug73I5!17?rg(Aa#7OCGff60v@*TNR>yi?pWNUg#wL)BK#Cl0P zq6nr{ItJ0*uSSs!N(Rn3(2>-m(LF}~9to{9)A50y=|JJ1U)Bke6S6iPq&rU}1 zR8;wjD3x02l}RM!@ZJN2`T`w{zs(9}KELC2x4fd(6np#2-+jrdmt$IlpAcH~3T{4d zsm-#JaXeUK&RKmqnKHLqx9Q%Vb2beP6b+5@S$n@PDDJ!;vzTP0M{Q+8 zs~08Dr>pBXK(E{>H$0U)66>wXY2(r(4u9mrJEv8UCAG-Zjt+#%}bUi)N zOsBaF1<~PWj>5lgVJsBZLd7%e*PF`6vn`lb*Ru6IHUbBG}`~Yl&T5i5NamIM1 zK`jMe_x#a~?`Dqk^a9G`sqFkDIQH%LymuK%LvaC@Hp<$+9UC)0equ4C`kdv=p^LUz zgU|bwJFUA4WjQ+dg}+{0RiKl0RGV=?I{nnI3uX2DyQ0bsG|yX8UCxT|^~+PI8%4TU zwId4<$c-{pMk{mZa#1;TD$Po(6X241K-N7z8aQvcZz8N(s~#yRNx=4zka!uGtHFmc ztHFrna%fP_nl*SJ2)@-}31SycDpvM=Xn_-g^Ps^6JJ5wqNKn)TcR#5)0c0C$999C# zoMQoKj;Ef8bv+K`X-_4<{3EM%2Lesq)TSzgnW1&u8`t|Iq$+*@k51IVHZG7XjF@xQ zAi5k;&{hR4?P9)e#IE)`f^_Z100!y{S{EiXt9v{@dEv<T;6PM zReqPV_SY+;4Cl{qbMLcW%SJb4?3wuk*O@mS<_+Gehz;aQ7qcFfKCXFE)hPkZGnA4X zNGWxeRedu!Fjix0qI&9D1bTfwrO9=b z60X-622)O$Xo8dYS8Yh}IH^F&Z6$+?ZA$p~3{!&`NtbDr2<9NQmC`{-0jy=C4?a$l zV;50g3Z#aW4sgFrYWUvIGOV`H$9TME!D_C2zKeJh{0G9p(hN+uw?2Ak%?bs+ezs-R zHyar}Snhwbd+_dl9Sr>-mmxTxU}mlHwa8v;7ae#rlv0SKFy*X&IKTehskB2Y*{AN7 zK^TJhOimDX-`#Y*7q<>SRNXa3eHmTJ424DITAk{pTeSB0$ zN{=U|x&vQ>DNJRj#~HM0M&;mbFyl4cT#Jp`MUnS=?fYw!l+4e5{`$VH@RD2dOHVgo zGDnip-AYo5IdIp6_M2nJsqQ>`U%3a|_ZyyV|THws3sboH)2E zRvv%R?$EAgLX~lZmbb7X$sdDjJ$%rRyl#L*dI^Yp%XzP{u7}Br4m@yS{H-@@u3LV(W6WRZ~|Dz z#T8Io!wc-zo?A~h!nDpsy5eAbVtVUd9?PwkYx`2Ko)b=LSeF<)96Dalr^`q)_fxwb zMDOmjKRf_Nh<@~XY2uUh()iP@cD*A>_Y@?@Dq}9Z#KOQMd@Crk%h|U$9?6bX$+T`2Jpex&rxx@ijE^ihR%g*<_Q8^`F(~{b+jL5(PVC6tI0E>ZH|k{i z4PfoLowzbHM@&o=2{u%1?{peBGCGx|6mOJDbF~N0IKJrb52RYw!h}=|5z`c1GQ&{* zRIY^e5^|kb_VwXN!j%nE*}B!|b_`uh26a5WL||p9_zo<$FMD^gblOEsDI0gmauE+? z^GKnXd7{zMB#?oB7kHefSQ|Ve@c;k#3M5O1CTzt zf9Xb^`on9h=Edq)LrU)&&)Y?2unE^Cdw0inhtc@H(})_-xMvY97xWHGi4tWO;L$egi5{g5J1p&6qVQ_U3R|vjXx!yJ5UVw@*T+FRXLrl-pN%SS477A*`I#=tyn(z;7)&H}&o|4?+6aZP`1 z7$2RYlz_B!cS+ai?r!PsEUggW23uEKpM$Wju7eYlJNiRdA~RNoZmU;zVGXM zUB`fFL7|TAOp|E+TF`b|7bqv9x5Kmw=KQhRNzwNE$*a1T?#K+iQ7 zy+UC(&*gfjt|utT&Xa|{9D$c=?1CYc511C;?Cg?<)aKH*O` zAaw1`=KUWa_*B@dZeIAAOW~uYr}_ZF%4cQ^D#tWtS4NVTOxXk2gCNJgenM=rv98gT z;uiO4oG?kvX7H9)JFRj}m&Q&yw;eDabNcK}InbD`emJD&N(bS5X!CM=vC~*Xpvp#r zIdkppyRphOxzo>Y!F{JHeSJh_YYjb%Jzp#)iN2OX9|cb>vKw_t;=W97mY5Aj8$Ol2agEgSxlbV{{Tt+$|h61hN(~YGM+O z+v&XqZR3k>CF>JFd=={4@HaM7`F^kG8GxWkR8r4e>5NRbwQ|J<47v`O&*hg>*jR7# zP*?xpNhLn&LUPj-^uZF=hhBj^V&1rgY_$j^(!13Z8=e#sqDYwVHx~XYEofXBtOBAt z%*3ZJ-A+$Z^%Z>Hc48biM$h~QI66UatkU6bq=M4gH>+bIvOVf0t8105nMFnn-^s=w zBW5Ueb1B77RB|Awlp&mS(B9Wd?gw}HX~wx+(GVZc^*y}9gPGgD$am{klU4>wB&FjS)viK7h>x*x5S{A)=9K9MZSkGaTBFTPu#Q_VcEGrqg_-55 zdK8eF~Iro-@K=IAn-dx}56_rOj@}uN-MP+(J#j5@hEbEJt zlxsT9J=AV-&W{GaQj1#jlW*bipyCf;7o!pX=gRq)4G%M``k4M_reCPYM=QV!7*r0H zAVDoYJ{sbD`N%Eu-^G8g%B>B!1}Dmlxy1|xnaAO10r2kVg!Il(Ir+vPSJ}i9jeDg zv8wB;9u<|@7tkbX<;w2MYLI%jZ~x9H)X^Ccq`KD`JLRr@beh$%7zP|bs4Unf>OJ@+ zQO(Z}AEq^oag(*XZ0&jB-jI|@E&c~kYCn|4dgm-3f2FGf8!A=$50I4_k^XnYEDc4z z#py^tI*4@N2mh@t-6wGBn19iaIG?}Jgyxq9{q1I%N(eJ2@;gfXXlHQC3u$Uy!#D3)srgr5xB z)|bT3qmYnUP;W0~lded-2BG0V28}Q#1qCH{OZUL;rC@(m6;!{H{H9ojgL5yKwtVF` zvT9saG9`=BdWbt2T5IZ9Ig)4JxrSR}1{dW$xUSmd}`6vDRyz3!*)C zhU|HDNlMk zGbV&YvP0TLK5pYDmY@Vnj=dgHn|wEAeX#h}k%pJdJRe(20D5A7)e16u-SuRTvaixe z??m2GjBNZu;aq~c94|HBtpkVL+DLmfm~4DQmx2H?vYS$*-fT%~nJ)492OnnmlADV| zXY#5-iA{Gp(bl0%)@JcT|W9^pp^-I8HKutf;*Pa+haw#Y8t$B!f7Z*j7L;coUS-TWBU7TK80|Irxd zbqF%z$yYUbrfS;F$(4L>8!;?V3#t{;GQim_=MYhp*^Ghr;1}=h)_Fr8=ZN=CUCD7W zC$Vs;`eE7vLuleK*Vqi1FKGGOOg=~~hMuErJo9y{qkg*IA`?7qdDJ?uWNdEO_q?C0 zYDsbO3%?AcR>0%5&?1?3A*-$I7__M2STtz(M#qxL%>me&fVG?H?m)B zSn%@#4-4dh#pma1<=>(k@e;$c@ndLTK(`u1#Yx69tc|LODa7flwacYZ_bfYJhENti zKhtu7!|FMjmb|PwzQc;}t!}01#grT90{9y){2`h(d+obhG@`(OD?hD$NV@wCVYIpE zZrrzY1Jn=7s9&J@{a-EOv`?^njx1l6M~P%fy~-M_;X(J6_$p+e)KnBvhn`2x;lL%Y zjnayyqqv}CK`@XijsKMGq$>O1;yYb}}dj=Nq zs8D)>lMxj|{Gq<2GfqW_Yd9aMki5=JbLpLhTbEQg=^jB9IRc_4EM9M2x+{`R$MP?`D_QVGG|~@VEQx ze07a7n~p1Dv(olB+o0wUEbXn7!ws|y9UraWPWr+7F#7V-8=1zr?|c%7(>fANhF2@`>uGTC>A*I za!C54l>XgaC7x<+2ujiJ$t|lVHLCag3#&+;-FbE)82%ldUz2Vtb5uUacnNe~OU3HLv-TqOA_S=OPeVSd^HAS~M9$ovoR zw~lk4H!g9J`umirncSU@(1cfdd@ozHAkWi79%k;24#VEuzaE3i2-cpq&cmdJTA7Y& zE0 zR!5}|{zh}%R$X2ByIeJ#N1EU9xX>Mi$Z=f6DVZiL;f!+B;fwzaSQFHHzM&Kh0fmv) zI21UGWjr~M%3V(hEf0mgO3p9tjzIAr<-hWaA=!VS4i5W$?Ll#)XVJ7RjmKax>@D}`b+K$?|en zgg>All!7@UmI-{T%d7IX#jSIr!Qus)uF0zd!3U4 zx=w&9aZ|>MS~{t(-Umr>YVnKj_z!LBjYlv-lrvJ||Jr2U zFX#ij)EF>Q^$$~&g|*ujzpAu$fPS6spfYMWuekLFXEQtE8a=6;vbH=5|JrKH8%+g> z8SS@Dlq9qkxCUpAzy>b4NUnZvvam5RfAr|E$K5V~a7j>NDf*9+kHxtj)AvwEg+eLB z8GMb}WOaJ5qVg&P-k0ko>kB;UR?2XWhZ~X)G2~Vfq{%^FJy&>cTxg=d6!zRqlb_-^ zhBuSS15o{8upO%HC$|t38fM4qpVXd?*D}P=hnbN;h)16jS z$i$HMmY|u7B%-id)hS0-;d(7q&%Kx7=wYFGW(2mXof7C7DV6bgD<3mY0jSHa*Nv9V zP&mRVUwdb~|8VVVV9~qq2Md94Bn8ytC1l- z=B>BTLAm~2D2x6`k(;uNE7o2MnjcD(-;=qAy$Y*1F57voI4+LO4*>+7sQ79+Y^KX! z=y;Q17PGq3d>(n!i;=F(Qj>1bai*%oz`2E?(a!Jf@bJm%G)m8&dXuNe060 zWae*ufrwKfg<7>@HhOY-l^$v=={$NevayHRw)|p#H-(6WzbuBLg7DwS>?xV7ijby- z+aB4u>`v~W#x?hc!ONa6dRl*j0zN2N>07IhDkUq#9^!7iT9HS*!zd3d#Ag1e8C%2W zt+4XXvkvR$DV}agS;kvctx^m^05c)Ff4k1SIqit{zPV;+WU6i;;SvQTBERr)h;WQ< zF#WZQk?BURA@2|&qsJaykNE^Nj8yZGy2nKE0FrxU_tvl{GRi0e$vz*}n#ry$hK`yT zK^{L<*L~`7FFSbi45>pHixHbe>HmU#TE(^Fp8Yo5h;2OJ!5JGn(5nJ%waKPyK}hX@ zrL5MhvmiPGeLfXOjxrgQ<;CUHP5n{=lVQ|0%kFP!RW#Ey;5PCvcADdZD<$mJ$R0Y5 z|2;j;AEQ_}VXR5xaXX<&>4GPHd@VsqLPw*&wxn7>z%AM6L)7(X-%p&_ns}y7ekvi}XNqSpC_>aD?{Y1oI_m z1QSzCIL`6Pm=qaT{Ai!6&5|bGKvLO zGRK(GjHtDv-QV{UQ#NGn;P7D^jO^EhS9GH`H%aJbMhN}nnHx(;Zg z&~g7(*4#$o>hl^L%I73-Mr~xzMVypH^-tS}h|Bn}(7&eTSym}tqxm(q$jiD(-(sl! zp)vs4PX*j2;rQtp_fu?d!b5raP%FH)rEGsqMZ?MB(G%O{M$%@q8e5|({A)K~Hh%3= z$~R;AuH-)!JwAapCW>(6{_TT_Ca}|S^!Mo9`3DSZE$QFh{x)Ix!n4EepQFF{1)d6oJ!@aLGLe-UJ^y;GT zAqZ40m|8|Hxnbm4mTDyB<2%XU@t_C3hfZW_*xi>kf#m(PWVz>lJ+zlPxA6Buv>0;9 zurLl?4B<_}xaa;LJAOggNlFy|f$0n?&ZDh*UG6tOu(5C=bvwx)gE9yI-a^LZp&XLo z26#m+x~QVkkY<56-cZsuxUwHTmkM70%I5{}=X1Hh7BVLb?D7kQ9&rVn5;y}Q(b15( zCl~V8KGOf(f859pp2F6==dDN)QLiEJUPKwc8;R9nGKOMWqMjF7{A(J=TeQT}Eg4@~ z@MP68%i7(aaP@YJvA6sJU?Z^?Eo-XY6FcW6E6Eqri?tI&Ytk*!GAsW9=32k-QcU#m zZe6ZGJshbW+A>UEk3^hv8R!sqYVRqU$v#U*X|Hd~wO-2mQWBvz$iXk;gMg<0zJ)`u z{44^0YyAfxo@4mf-vgvB&lX7(ijd8IG5EoEhcAfdp*U``Z z-$076CL1j*|5?p#vS`8W3rk%Y(hCZFN9&Zhbeu%2Q8g&l$s=O;1;0co?ZG!fx@)qH z3;hO!;e)}-Lj~p*s0Nac|3036vGhHTmkSbQIdnjI$U{%$ZDN5_t|z-F*k_1UGxNl# zjft$a$lEO(B|wT-8p$jqV+do7ooTX7ideg~Zsym8*@YAnDVtK>!pOEAWRdwPg9r@l zj55E_&`OlCueeBarvBMiV`5l!H)cky~#R3?ZD%leMj(-2~q$@YtB7ryMXlG(|$Tkz)Pn*!q9;L1PRzfxK6 z`Qz~a>p-s+GJU4w4L{_-Lap=L3Zc=>qU+h#6lmoBuY(hPw7W`V)OFk)lmgE%x$)(cWSh!{}=rV2fnAhmn3S#lM)A-71h9g!c1q<|XU!Y6T zmuXMwkabssZ&-|^{2NK>h>(*>o6}Z4|N?Ln3a|F#1w7M zLaI5du~=;reCkW~k~7l~pq5{c5Iv_bJdFBu!Mb8jf8N_Ozo*^VnJBGJ9hdVu_`NY? zZBAvG^3u@I?@EqV#60`ab|0`U_*^E^?DtaMhyT6v`}i zxhi`-j`1DZw1;?NJXixh4!VE7ndDr@{mv+wNq7?ME#47xoTXF_Rw=M@$n>!>KJ$37 zz7RKyR^cE7pic2_>xBPp=ncgwIpTiLmm9 z8#ekIG|4P*78p4kvJ=QF0%g9mMsj8em^|Gvrc5%}ZVK3wM=tRt%FP&5d3ZtghLBCkfM|5Dg4 z4;#nc55OGK1K<3p*?rK`om!02^kj+PPpk;lrbWZVx1y^UQL3KE4{{W))GWRoI*|h} z=>n`sf7E_In97!l+(Iq) zu|-)OQ(i#=9b@L}r9Nk*&;Sld|%>_==U7x&}JJNe9{7})bsOY+2Ou@>6 zEm&qSvF#PS5~DWwbr>@+|GaMa1;wDW!g{~(ZFBwnxBOZB!;2iBF)^nkj}Bxzp{iYv z+D#&pcIpTu%gS4+NsG@iM{}VJOl@V%mT&?yXcri-XIG(0wyhn;N0;h)j1=0kj(O-U z5jLmST|Riw+G3fik!S<6n{%fOQe}PmjjCyZ3#QYTrA9WTJTUMr?kQtn2GtjJa8I78 zBk?1#u`(aukrpG4aCZr^9H`@_z;vdPg<3Y6&7y1}$byUL`wp@@RH}G2HI1*1ZQ#ac z`%fH*c=;t~kgfjZeObK&ITsyX6~T3dKqTj)bn{bw5ql=ej2(;2$;J}wAp2ln&Z5ZSs{akoo^gjo~QBnOGHlWW3E^GQ#BKA!Y90^J$pYxLQx-o({|KZ zEW;qDeF|Pcrx=s{acv@g<@r^d6cCcAEg59}+RQyU1Z_zTWB8f6LXvz~I|bVIAAtA3 zckn-e;L!ByT_Qtx588~C${%>jI+gpoRGoF#AgwwA8__GR<|dQS5<{gm%+&Twnq=a7 z3Ri|qrp21lee*lz`<4ZB@`P^xfF4MlptW*&jOT0iQyM%8aS}T+E<#aMFR8xU<2|_c zX2hbcJxM34TKKD0XZmcsq>c~?UXF*0W~pBqe>+x=_;uEU`vBLz2;YmakQITDni}H? zZvMUjsczz9;41NT&38{Uj!(m`CnM`|-Kf=K=aADu=}{4+^6IG3Kjej9#hD>J4il(Y zkw|XRx7+rVII z(~D~O#_Ojfptg2b&lR{0C;wb=)lhzaoXz|p@PY=Ncrj3(+*(iOn%j9d_BH2i@NJ31 z#scO@tIOqxFsCP*h|;4`on&v8y0kcq0=sIQEHtFlnFjx}SEgoM_+HA6hB$I3LmGzf)g0Ka1crZbL&wn=L}}=~unF$hQ^LPp z-ZvMchMEVW5jWhm+QX(VQI&j$#Qd^|k zx7Kr71n7jWblzhLb|d{B_^DlbuUwYO=heqfI35NybgA?f%n;m`;}Ow_%OwynRc z7#a1Y72{bLb7Zk$Q!4yQljFt+U8U7EnSMPlg)&0_sh!z&Gt+|jrb6_7SQ%RgwHr8F zFLdngPf)=RGS{JY<*4z@0=G>SN}YI<>elj6vf{7vdV*d7f&hZ!hSpy-tOgaY(tjB? zc;i3ZN!oY3-=_bqBRTAYYH$bre*jSGzrzdcBO$u)m4{)42{n*HlF*ztnkI~I94$}U zab(ieZ!wr~WUBKoQ%SvUxDrho@-g6JUNEF75Myko*^w9R$KNGt{}Dzsn|YO%Ya8_; z&wJ3krkDl`Tqoc-?HPRH829|DA-}t>>R2(_bTjt^r7HEq`vm?cod0wBesUqa-Kd zr(#5Fch>RqwXpN!iSiX#-a=aEBv&EmkvnqwiDh zCRKs7{n_ig_Mi`WeF1tcz)iYUKQ;QF;{BK=i)a!sKk0I1Dld*tABWH+FN~T{ez%~q zov7P?3 zK8cED-!u8tBb6MG)OVEgjx(;{X-N^|pLvvdrb>=VrpEZ+Qakf9oPRfN-ESM16PEZdv}ID?YN$D;9{`x)g{RDs}Ut_SH|a<7B>cM!!~;O$PM{k6ivX~Snzz9|IuB3 z&E!sLXl20Gt|CV=sW51|AoQy?kw8%tm)-ePxTLh1*-h7pwI>o>ibuA%P2!NymEjVe;yRLuHlgis%O%vUOt!J>{uIw-WA#y*)I zR2|8|{$PNyn-YhTF`8&zUY9kZMC_2!6HT_L;cRhe#R#hPueuy|Ll4JCH+ehM8TTQ4 z0rPL=Fa0WGrcvoibJEx$HARCRl%&4Z;xMq~3w1z;pn|sY9qB;=mmFKky4WvtX?tDp zGEf%ytrjT*B+6?~xcxp?2PEqJn`|(&tUeehoCDux8T+h7pu30&k^9jckXb9`kvBIu!hSVm+6m{4v!3-2Z|^|g zQrDlzh1NXor8K$zh_*l{U<$ut$_BaxP4ECDfcL|1mT8L{!^$NdxQl_g!W9Q^re&jr z%0-$z82BIH)LtNi>%iv6zbt?Fy{F4k2J=!dg^9kJuxpExQQqd~zI&I_Pfz|Q)+x<; zZP;;Tp)@8Fw03igb0L8!V3k`*+1`uKfw)%n5=ub~kTK>*r7Q(6cFXpEC-%C5R5c-5 zdStJPvh`&@4aydhd^8hna>k**Mm^sr~@KQ;5x+Y&2Np)?70<(*XRI$T+BOk))fEP!VVf@>vS3! zyL%D)ne6M^TBmw6HRiny6Kdo}8U^`F4}*5pqj7&xeuPZbI+WGg;1cy#Q@&L7@tp_KZ!Mj-KxK8)XF1Q6U048SMevY?#^^*^f5N8yvZ&uIbtCkC)ic* zm8r#<4VGQ{;mIg$|I82#FoTT(@NY})pro6*+Nk86H=_QaaEW0qw54~G*-3~cf?$3% zKJwzW529~^hc{y)Y{OC;x3^6|?#~uZ^O3s9h_g`X>g)l=_lqR&&X0N~*jG}`Q)13l znB&|v7p=!%0G$wgFht#(ZEG{lS25$2W5mOX?~3G+L~~-1c&8yreA?IaA7#fou+J(T zv;V19>vd;GzT@MuSEgczxU;G-^$JQp%g;R!AN1zW1;hnY6R3I;ME`V<`|$66(y_Z6 z@e4Rz79xFxbhVZUbV~XCI&7$>_Wsj#I=4M~)XtXC!&x2SVQ*U3exYk~4V&KVNwsY@ z*T=4oY!|wl&B(^CECuug>Y$ytI|=4Dqc_~|^5)+zHEY8V$2SCDMZgZBjITOUR{67n ziZrPBRXvjV945oPW8U>t-n%L*$!jkeHhhZt&U(?5nb!MB~G`_ybTB25VM6##y~|PgK>DfwhCS zT6kdT>i_4tT%c9gFw)iFvbOwi*W(9$)MzX_B@f0lHsqIN3%G;-4WcKPRIRY>m+wb! zp;a8BD`@yI-gXrIN`F^_q>1y-?JHGrOfkwcQ!9<(Nj}y2TAtJ6QxZ(#6Hb%KRUcES zP%Ix>$*T;YxX6{spYN83JWN9bku28}!*dD~WSiJmBuK%E?L2;L@*tF^&|aiL!gb6q z7Ib2W4t|<#J1_*g=xTF8{gJ80x>cN`MD4pt!{0DEXs~@!H<%Fw?VEw zEAdW{v2<>%4utxs`}!-IBq^15@fZf%pp>cH8^J%B$w$>f6H=5D|Ek!ewkFx{6nW`XhGfzZPu?i+RSg1|e!Uw$WVc&0W*9 zoiDZoS0^egtjG3%ZN^APvllz%t3j*$l8PAF(-Jg(T=A8s0hHHWo-ehR&YD9~%E9ZZ z0o#HPW~Eei;%tA*C@Z&;iH18m{j9T(th`Hx6Ux_R3K5IONXzWG0}_EwK0i9E?gw)q ziGO^vErg<|(xi3^sj>gi$MhfIn8o|rAb;q{S~%cLdyFtF|Ij#7i|Pw7Ubwr{vt9D4->BK zM%W#}ACI#yzlZFm9)gt2$levwb%oC#A%fIkD&#}06)>Crfbpg{S_k(i6W(@@I~=fJ zZ@5fD$q|IX{Q>rQ;o*H1qBE%MRE0#GvC)-!LX+)>ajGwIvS!TT#u_!>_KzN^ zwdl@jn3`VS`E+ZD^sFr|Y7WnQ4EMutJf)O!X2T>Y+YkQsAE5FiaI_Py9Vh*Ecl}5m zaa`O5#^Wh9R7>tECY%#ivHx}o5U0JIJkz;{p4YsweYSC@`h5Ft6kJ_1jY*sq$@5$l zvJdWtkY!n>_h#k;Ky(9wx7;Vk^_Mp&7L z-o75il>i;R`**`Cvzw;*5WQHfm>QO-r%%cX>2FQ>9%dm&S?XH)UKuTPdq(cI>~R5W zNPk?<9j7+rV@beGR?XVK62hPy-q9T5!hO;6!K^8OxPD|3nz@R>{gUU4+uVH3G(q)7 zD*c;eyD5NNH3rQd8$LBNYH!t1d>!-*dNl6HylRt#n`D^T8{u(VP_ixnHKU+Z#yp42 z{Hv;qUJrAUTH0o%ATuV5z&Nw_DNaw{JdKQa4L$8klVg5KoMniAHT~Yz4ElZb fa zWKcbcdYeYne~OukF8#qjF662QXUP4;@3%H0P}O$+Bmjj{fHN|+-tu2%2`=5u;yfU6d{bM^bPQvAE7pe9 z?RVmA#f?nOyzW6m*Q#Y6b8~x}@!J=l1V`|RLg>x=-RKj*6>SHP)E3m#N*!v@_U;UetS@m&@>%i# z@c}wqx*s(8$gOjS@)mIYEWL3v*n$8%{)*9&uuZSlsB{>($N-M2NmI4z(ZU#*s-MBG z35HV!tgN)3T1h44&h%NmO(FDbw^jL!eu51B%On-t`{w4kFsa{pY0XL)7E0(HxRCMD z$KDSAd;?$_f2obucQSK?f-xUzPl*Z};vV%EPjszCPKHjqNGAP0lxSTF#Vz9lk7*o> z+y(;9J``FM-*|q><_d@J@9r+DwEg4p6i8ReR`O69`_9?UO;JEXQD0pPhu?3Ato%I@ znM8@vOLXQc^VGw0P&jn@;8`OEhhE;a$KXdDX=keP_b3>OOBcZr=*Mg`@zr5SvGLK% zdr4)#JSA%~sg)DArsD2h(%nfroXeQ4dc#7(G!{-hK7>89Bgeo=JnRQe+y;A(w)%QJQ9>8LWX zhKgPa!4w?jMx1S%*LXnD@*?%_lMU*M59tQ zHqjQ7r_)|1*td_3jZUI6kjDR;YmmL`^^wO{M*KXWjd-g2E23RgXe9Hw+KPEKvTV>e zedX=i+A8+7P_e;lN30&aLxC8dXti55f6p2V{kB8x{CSJ}l;lMLHP&gK6EiFO^x#*c zEH{8Tc$pE{hrc>xE3-lb*RxrcmAa|(5067|{&$meC_69>R0%~aiiWA1F0Z=v zMs5e)&1U7jZSF!=4=7M99;_x`fftrKpZKl|_e>|>bLUHoj%X*1w|dIqewdqN6!aoV z8N|J4mZhSit$gQxepI}A_)uH^J6A^eiFJCaJAhdJMK>;!>0naV0(FtD#~zMEO|aIJ z%#iD!vV_%l!zC2DZut@XEi+w(h40&q4891FV^WOl8;o2-fJ4>)=xb`2XN4yvtrky8 zy5r7l}|mlfHFS0OT1_FF7wy6 zlC}2J)nL+34d(_HsXurGPr?v2^yPt)8mi`IEf%exv?P)x4BvC2=pn8+=}+Rdlhd*0 z3%zA9SFVLMcUSU-jrPLm6l)EiS(cVQWbKGwUH)ulTjFvD6`+n8g5};OttXw(W)j#k z{1xsxO97@e-`0Mg5gs?RA{A2}?e0-!XRow@ZcAfZ#%`qYI-@W`sgbgj}03wNPzlAByQy zvQeHH{>7p8Ro0?{k4#d#Q_sKq=3>sXb_Bf2U7E#oJHG7rW2AsSn0aw`I~kF*iKE*K zZWPv2LME>}4VPc4GJ~n^_!*poes)B}_(*JFnTGN#eWov5vTsq!V=EZ(S`rZ5D5sj> zj1hFyB%e~jVZ$Wc^Js3p+)SQg>}+lGXTnLx1Xt1sq=5|tIYu#9N~O<%OxB?F@JS|< zp5R6>2U8~)4}VBxFqPed?qU>;6X&3h6IUjqZ9X_SJ?XZ&Js)9c|Htzw_Dd*~CawK9 zFM@izsdaYzmZ#Jmd7DtI77SmpcB4Sn+!Ofw!dE@OYgF;Vx~D+|#J2LQ;aOuF6>|^% z`iml9IAmCZdf5x}IF&TzGb#B$`@fd#qgI17iHy=r)E^Dt3>mkVY>69aS@@&fmGK$N zH0bRw3StBb?ncV4jS34h%q^yw{j~huytYIisfs)d7>rk`3#X37*<2rDBs&|eEZr_v z*VaapJY9GNnLa1;exT=3qvV~+LsOwa7q>H~*SDI4HP4o<3UTXvNT>Z`o2uv+TNF)5 z6pBfLL;0(l@37E%#7J$sEm$jKxbo_+d_1f#S&hkdEdzI&a;yE8tHz1>X?)s&Td3L2 zb0=}XmHZqye_RzC*C8b_O(n9PG-T&a-epOUgj>?~dVfX=G>dk0xsWK@AsH;@S1CWW zJ6(A#w)s(`8)SMT?wF#lN2W%6rOvvwR!{J%o#rxVJ40=xbiY^l8q(zN?M?eA&oU5C zu}f+jkp;kjY`3C_#c_YIQ14r8Kn0=nr(^d#CZ<-7+|;LLo?adFs>?wl+)4S*iGJ*; z!7;Hm_<8IYMR0m2#)ZtWp_&Pr# zr{VAA;khDR30BpJZ_}z`Kv>jRGx%K~}6argGx`5y)3r4pCfa1cjXb1o1r8C;v&v$;SV)sKR~m@B}`E zZ!MM;A0TB)DsHgz9NU)nwDt`9TV4HGsyd#FuKgAQ@C4PY}p(Lm8sRb<@3b<2A()DHIpb;{`LR) znK)4XZ$QAM>FT==2~a0T3CT#4%FfL#cxUFf>$`kfQJK=q52C?7g+GVVVLBo{-*g)b zE1n%mWVI2{fTg5or)bQYQ22p~s>dWk#be!2)T@S)U@x=PWrD(6!Vou(v$Mg;;YZm& zh8ERkD+9B6mRS=O#HsO|R^$mR!GeovG;Xxx%e&lC9q!&u>Pag7^2q-H1HFx{N41$P zi=H#Uwtg6zqZwJukQf&mv|<_eLG&doCDODG^AK6MP}OGc+mlc-HLLEkc6@H`X# zE6dIDlI)H9-&$VsZ@$bQaTq!?f(fI!PqOlj*S>0qHg#xBuM&up_5lJbB3eNj(21U~u5nTD~wpR$NnasA2v_mPbI+_!q{a?}xh@X%Vs$PQ!b4P;>U}I(p2NLN#DG|8GfX&GxWS zo~fPQvyAnPUO~ok%Ce)6pu$kyYid{842`47IQBcLbp^5pL(D&DYX{7i@@p-LXVQl* z#S2Cqwg+ekagtY|?i1pz8&UP@aBpJU%-(i=(|)x%gVv35lLq`CZepD0k@vDq-Hj_}&}cf7>rP?X{r3;KM&@^e$?PVLsO7&gV<#5N?EtlI4X76+-$sZOGd38qpuKITPtQ}6vWYCy8 z_U|*^)o^&cC$mkecVE_E8V;g|Vlg zd)rfEx1Xh2wvcxE@VY@37Dls^*%Z-GSqPPrf7$9!k>%!G)SIpk24J1iQiQ>`Mp}M>SZ(8Q`+hdCx2`tIIBqrf5*C^ zcDGR7Jo-hU7e`94jvP*remIePUnr<3?&RTPLKOU&rm3~d-x=!i#`Ae+#1wgu?q=dU z7$CW#krYmzPsuCQ*Po^t^Z8pkR4R3X-RzaetF6E_E~xRD@xj;HZUpZ~ZDjM3Xz<19 z8-5Z^rNs@!9ZALAY6TIk(h0dyTtFC3T$sdR%Ih|ncEECF^@lf& z7}kWR6R#dv(2vDuC2PFEMD<#VR#v9MnW)aw+0X0s`sF4|M^JZRx|o`wt$rXQGMuepIJ0#OfLgbP_jT0-_dCGu~f7%Ansj)K5b`ea+u` zKKyS0qujhF(H8M~{rBWA%tkdPrKG2NIBTHtKryGewrE0KXi9v!lZ3&j@L|^*=*BZ= zz96>BTj-sz?F`uh#)U%f3#?cu929_dp`}_ZD$`=obLgW*t&Zr)q zSuk`xE31thJk2&(X{;HIQ>JqZmCx2Upu(&KR27^^_hYwwP2okJ8PDbKl1KB>OW>tA z7DDkY{JBVg)c6st6XXE$VRr~S?+Me#%Uiw4kcLcrX56%H^>HJs*|D6zU{!_M4HAB` z4Yzl@DKLu(k)=J=1``5L?wYUA_Aw_c>$jqnBMIx!IMI~iMsRlFlR80SJgly^GtrbP z%d?g(o6DD%(o@00Zp?nLgX*&1a{KjWW_3-?jYFBTr@vFMH<=&x`&h!(>Ny5R#g8OK z#^*zk)Vb`>N-pMsk4QED_B_`7HCr1NQu`B(&IGz*Z0WJRUSKdd``=rSKyhNvq3#Aa zWUP~Q&sX)leHf9AfiJ!hG;N`G#4*@3>6qR#H)_SpHdsSVCHTWX>=RS8H_U&%McVj5 zOG$w+V_HyU=iC1Py+A_0NgBwIft`u~K9DjOKKy4Df$2A4s7xK8c;$*kUphmulB5D~ zz?>gY2fomG9sO5L(X=yVC4_cX%GRwN!%7JTXBl1OnLr9aCzae7FyI9T&${~SO}d#| zPu}85UTGzLzs(sNNg!mNNIc^JR;2r6e3PCI4}Nj}nXHzLH0EunLk3}p-;i4)1NZG- z#o^|>ZuE(T#7ftK26;B-HVO%S?lFvx0Atv8&!=x{F1OKVyA$cHai(fku5KWhw*o|r zkfR@`amtOn0>I-S*V;O7;)|x2POvuyTbW)s#IFbegB46OAwH1I&Bjgu8SlpP(ta)U z*H@n|&izv4$YT&n2xIEnr#Q!}Ac36o@(pf*vEHhhxWyZ)PIF6kJDk!7n%6u*>ZIv@ zp17HZnInRW9_^VQ)t3H|jPvb+eXHXS5WHdQ-6$PW!fPw-BJMMBY9O+eSMuSLD&Vtv z!H~8IJGPUP%GU;^5EM!=GHAI_@0HS zO>uW{lE#T;1d=toyDUKO2(51!OtXbez!ALf%He32F(ihibRxNha} z-%oGi1)*VQYakafN4I$8+j(7>AdC&Y$F{+w{xP~@+f9bkQR(ehMz(8lY_bU%)fdaz z{J2>}XJ{KnPX+s9Bzg}__}S5YZEI_%Y5iAe`FSIiWzqVUF$uaPy9IwYF%S;KAZ|Pp z$-x;Nd&3<+Tz0y@)6Si#>Tw^<&u=?jSx*jIB2_N9jfPx#W+FVa%VAU>AG+y&rSQwF zbk3}})h;i*Iq9od9WOK)7Fn-ZSq3Cik1WXeX(c#CjCn}yh{JmiTy@TsbJ0CH)LL$r zVf-Jet>sf^uSMi5`RcMX8<6b=RrB4Dl9DhdEm|&@<5ji)09Qq#>peANpz2pG`Gi}w zmMJEhB_`d0W@5!~f;WwamyN3GJuQc`{6wnj67<4!aDwJkxq+;$;wu=D+F2$*C2fIZ zDCLL@jgU!FTOVO~JK`Rd*7`-S#L3t>U=kv40 zYaFqn<)6(vzzkV^A$MaWcCS{OsI0W*vX4`_wy?grQJZ5pVz0EZ0N@q_YkIH-6rL-y z9jrcMUg~?IefCF-I%Aclts#Vx3uwr-s9#8(VKfQEydswx768hYM zELRXo8498D3XpIQ2j0FV>*$T1qh>AHZOn4GhSugYB0L0ajBZdAfFF~L626`=qXl_= zGOfar1h>s3?I9%&3m`ZuS9+XAa!%5D$>7%mUe7(P=j3O)mg!+Of;0u*TWzBoceXRw z`K-fm1Cpd}!`(%qEIh@VED!1P2u2>Fsgmb7#A_PO#M*#S zcW)dM#Hf!^e;dw7(n`Hk0lDi3~;53irFQJ1K zWeXu)%ENXJHwNEWK8c$C*53B{ZEWr}75@Oi&X*}Hw@`&?5g&GO>e#~yN`e)z2uKMQ)@8X%v5d-!uuR{Aa@*mcdmtn z>sZS?n_4-FN#)2fx0Us0f=CKZKp^1b@97$TziDr$UG16`p5@iH1rdcCQwm(hFjtU0 zB$8z3kjGi-OW1F1$w<*&=mP9lZUJyfKHnUV@7}cOB72r+3zFF(L-ql3PbcI4gFUOY zr2uZCK+U*~osR(Uf5-X7dVfPrYIMm~+Bih^%Fj5NSyn*N@<;HQE}A7s-NY9KV{;rKu^3<-OP0qYImgr6-%Gpe z3ym7!-D!7M5FnH@N9Jt`%0H-MX*YiWs4iS&|u0gBu~iY^Vj;FZ6?)WSaB86Se&-re?m=ZZwHMCpdXpDCgRj zQ8~aa6)@TQ5_7+9J^h!XdILu2K8^kuy)}0&&c5jS$`URl6EYUrDHsl_HAGknYAKI1Aef?u-?MeDC5Pi(O^c_VX`Q zYDuTrw6M$kJVh)4<74Uap$9AgR&O!AV4+>dIINFD_$}AIEnbaBrutV<)~%ZKT*cI# zQ!d!1hzuxYcJk%HEJ=@fBrgL5SEX7047!rTt-5bP>Rz^n&f`!Q7g4r@5!-CpEaEo) zQ3Z)^(claY*aO$>{{Z%L_<69K?xX74=}zKFytY*(i7aq!$;m9)%N*p_Jm32}JUdh7 zS#=LrSX>T7klx#O`9Jt<{{WF%&ZqbU*EEKT9;rj_Nj^-s@F_KFH*07Rp%Je7PbFFr{0| z%BB>4k`$NE$~`@-r$g#@S~j7n>i2P3-?pB*cBf$(D>@JYM8S?2Hqff1gT~zC3io@s zv@2&@sM+Av0Y$h;e5NtwaHyr9^)O($I8mH01RCJ*ze}|IJ$2{jFD`XEZ5ybJR`7me zDEz3T+^e!lJmLvcA#C^C=MldRUtq%^nl+Jo5nO;`f=w{ZT(QZ)2a4ljRgG)?P1pK2 zNwO}ba8gFb5;WXKeb2D{&)YoLolp3Uv1lV}T{?LrXLVx1b}D3rf7UX1Qn5=bnV!O7YyyEXmK{6eT~=a%G>4CDpCUhVoq5I5v^Kg(Q> zRJMM~X=I7-11OaKsS+{-Y29`!ZrzNI2I2Mgtfx-u&!=mRc|6YyL=hOZ+7=YS#?n|F z*iuUpGm>$^2dCCOdivhIJNb9!-DCMoQ&-w0Aoq~wv}mN6jzsSbi27$Ipvgz8r%nwV%$WHwS3LxSg9%r zVs{+ZYVP9UF9pt_6~Kbv6?;2~OItiZ-~$`KEE7AF2cNkA0N3qXo{83TY5G~UV6$2syP|d&$Y8*6>^86V?aw?qJ>8mh6}`jn zct%-Js3$nVCm!9;9RC1n+BHi^u5WK{73PS+`_^{jt}g8QPTtPODf?3s40o+3#ZI<|r?fkZQ4H6Ymr%&C+S^F6%OTou70Cfkeb4qa z^OeQiy*+hc-AiGt!=-Aj!qUNIf;fwVg^A2$NDrj<$7ah8Yp>K+dNr=0ZE(q|URp&6 zmL;%w{HKteo117Hrx& z5A{D^brru(bhd?YuJv#-MW|cdtWsFmLx8I6a#ad$bvuqh44Zc_R{KN4&%swucprCh z)E#;t>YYN@N{aGZ-9i_8YcDB^%E1UK!B_J8T1>a0*;YJazK(S(<_*PL}*fBa|Y z=K)WN_ z_+A-QV{TW{y9kiGdoO}th}ktjdOxk^yV5mD?~FOubDCey4(K zc~;^py*l(fmjs>eWH}tjFkIvjwV023^g*fV*1bBqPf_YHURXtPut{%u1dORV<7bx4 z3zEvpz!SIzD~xh|@4?=))4GeNAcD_P8iBXp31$u)6mpn5)mY;IX9Kq&9E$WE*)>Zb z&N!gRD}wgyT3B4qjQLSKm_3dGKkZ*WYyLdy@2IEc?$Xr+#6c8sk5c-HEuP~Wd-48j z#=4iPbzA$p_iM+zxVTR`AuNtTDgetI93Drhh}t`m@1nm}-C0R-b$xGm)5yY0TVPeC zolq{~s=$W~cQE&5Qp1enY15*CH0IQ#vuGOd4@|DonArNUf_5qHFg=0x#cDc+mvPk6 zO>Avulr$ zxUW3BTO%w}D0t>sgx*oYIRuOVzysSS9_NlLt3A^}YZMS(LM{>&VIf`Kt-0I5=PUyp zupIJE4t7Xplsv0~is^<)08ZEeLU2^z0&(+_IK^&07e{rdLp`O0(OnjmO2n8g4qP8G zRAZd7sLyg(4EGsZtxnnG)~vLvqZOspQQO@`eBs5;50**B25p7 z`i13q+QwLX+gn>(=@ux%qYO(LmjTY;6#BANjsrI}*4Fi($=}^-g6(c@2)T$oq^sqy z1p1gWVMusLEXO2|)7)2gPt^5K;x}KOMus_Kj@@RKEU88zP!s?K-bio=IsRcRyMV4O zQgLUYT!=IqdpPDz)5B!X>o{%1FkQ|zuF%7FHw*^g)|oA)u?3<_Zw#75QU->5VIvnp z#DoPv0z5|JEx=aD0~jlx(o)(vH|dDh+Ps#)q?4RHY@}r)BXX!#U^gkw0Na8Atjz7F zz04+Shl)wsIV4M02wC?ZNY5i1fgYs?l2{yL!7px78C8#$8iVPV1-$S^0}=^dFms%I z5_a>0n*!j7q%4gn+Nuav7{DqB?s7&59sdAf)4Gpxltx7|5D4LOoB}>h5AA?|Zln5h z>dGcJIL0zZ$fvnxRNAe-C)+vr1NO~kZ1pL>F1~c~BxHq=!4d%w2fA+Da!xW=+k@O! zLL0ozJnY*8fPa(%jN{w^j^`K{?sz=oy{MQavUj#*c#tZVb{pJd^*{PJ*d?ewfw%7bf_VpujtGCe(xe#C$N z#<7nhIAz?~3yg}~d=cuT=`O$1uVvV=ZYbVms$76_3Z0F|>Q&~x{^;KnlIu{{t~F`& zJv&2>QFt_IVAAa*xRM23%JL|-U7>+S+z+Jg7&y&yU;ZOHUrQ0Z7Vux8EL+RcEs>)E z2>{?Pd|(rd_uK3`)_;l3KH>!t=r)E-u~d}=Ib47b03U967(e2V;zk>Jq-c768RL!j zadOL*?6~0MmcYks5n6kA^`Ywe<<-ullEE)%B!W%i+-$;veJAugW7UkaagZ^?sNMAc z09-?Ht;c@LcM47|)neXY8%SxDj!0}WsUP`);{ey4>Q?%G%U+u4ZE77ZX{7QZj@sIG znn@jY`keB|l|1*#G zEDuud1J62}!%b(z?z7PRFzMKB()UjW_WnsQ{!EV98`&2gh~LbS@wJSg4bI4~_iy3T zN3`%R;!h2FdecYz)M5v|)g21lUdrJ>c2hBOqj&*8!VW$1cHhJsbv?gEb$OC)CR;<( zw=E+iQb!_;uE4ox1m|{1_#9VPsP6T>D^ciMRnhJL05h*cJlBw$hB8}uX%i5kRm6{( z2moLc?mLYqsIs0h^yITaHMxqya?Lyq9sm+<$zU;$em%z{-)_;mvq|a+Z{gE#qP&vE zUnb=v&SHLW2sq&2;EoOs4+gTR%t*i_6M@BH;OmVVSQ9Gj0bqD+d#iW& z`i$oKCg^pxw|8M@4r8>5UglXP+2u0@WlRNa#D@0cgU?`oKKyU^QFW&3{UJT>lVhyf z++D~CjwuB0+v7vNSfd9RDgh*c*zy*)od?5j3M253rR@5f!JeFw>!@vwta_e?i51u+ zxDt8ZQn+!nVYe|PjPA*=i2nc(KZg#Z@C&N{0Eg-c=jnH4pG?%F7+K>D=yQREU~sIX z8%XRGqi6Q7!p~keiMfLB}on&^$=ronBO@hbJ<6{bcLOsnWznIXSJ5%CkUMZ+^**1|{d1vf`c?k-gLSp^5jwnbTer65;g~R7ZtQmB z02MpM_u^|yQ*Q8S_v8(z;%Os|SyO6c1y($cNzc!G=8NCNrMv03tEbq=w~Ud<7F(#y zXzGoe`T^PtH@GjxmFQS>BlO zp8a~gq1A5YpHI27wi8b%jYM)RZRQ0EffO^6Fi82|i~-`B`(9gWk+rO@qw~T)Ok}E! zt%eu?YT$Ml!E|1Toj;;QHO2aC zw=>SyM(S4GDgpv322yfah|1)F&)j4+i)hw6+1Uh0(U=@#4G?C?J@CIDKVB=Pq1jtC z!PoUD#KJUYM@LzFfS@Y?;FreGdmmSSrEMcdx4P7SGb*FXB70+Vxt4i7ML^1oF%6Ol z9+QH3Ji5$V%u@EM?J;>>cC1)p?^TX8wYSbLBFF~X3n{1Vt{4mORsC*am%$6E6>C}EyIAy><2B)U+mE=wx_efWMyvB>T# zn^0iTTtRSdVo~*>}7VGlaa_y zbHK(4uKZJeVg-py$O8qH$SoqWjOQR8_#MwYW4;bcM%D*TX|v02<=1Fay$C3nR$;b0 zZelRm1Gqi%O-;Hd~yU8c!B|n)4 zJ9DuA04Np5r*;WuExXbOEx2Oz$WDu8e42UFY_8p+V;l(S3T9`SG|j5TEVnk1%^UeqTU$n}1o$e<%B_&R$i$rP%Puf8jqi9;3a%(Z$TuLSp3tNd`NF-7S+yF6*>26qnc8)T<__X$NL3olw`W@5Ak}>JW^zP56w{gyJc)_f0s;;+E zXUmQlCu9R@Rn9=#FbNpP0OJ60ipJbu$jRow7&L&y*+Gc`JFrG`fL9~?*GBb&Tph)W z6P%R*9QPv}5uU_%td*m;EaTU`{sPF)N05=2mW1qc3UNq5!Y_iA#>>QJW!1|x3{j04rfpf4HT;rD*_8s}I z&W9UC)Nn+mKQU$sreZ?w&jg>p{p;Jb3$}w%nB7k_?w3Z{PQw0X`*bQ;C>Z@=a6i*6 zS?KKANuyOEo=^+Ki?xGe)C!E?_6M8}{0!Gh(!yf}vRgZd{J$@7Qb9o{tf^=99I(rL zAE2)F)U#YqByow|CPw~N!@%PTq<6q8jOUC11`T-!i1XZO9a%YwS(PP*DFVtcSI`$2 z$@gAA4!ugCw004IUGu5xUS4Qe<-A3kl3rH{ZWevCU^1d?> zAmNKnV~KeR3lp~uUt@j}yb^B?yeZUr!(9oX1=0LWY7Q*mdwF}r0O(<^FrgPt?EduO-rynZI`JiiS3?-<;@J^Om4$NN{B z{x5p!9*ogEKhn%Fkc&_9AD>aAk{rY{x zvl!7Xywq^nEZJ4T83!jg0ATMv6L{fgCskO_)lM|4X{}lt$F=hu$sujXV~v@DoxzU- z0673)f+_rbv$yL>FXPgz=C+Ndg=V{7I&fB9>4$N+1u8&Lao+=hUV~%f4wIm?`bT>A&j$Kh$48%0)T{!sYF760J1yGJmK&F_ zMcOun9{r9x8u_E~z>6-g(%UbsBDmf}%QU4*FXka2fYK-j-)ikF6^Y}Knb!1}?>Z;J zNdEvL*KCX*WMqwiO4)OdWdxI+Fe}i17k&xD<7eT}{a(z-ZBSg2mOnTa*EUG6J4?G@_na3b^4?HId56ph2{sN&f(!Ayj&M1CiW}R!>0c_M25$E=YmZS1jy{v>r3bIZ{|)4|9`_ zago+9jm4U^%wl<-WHG_!G;Qh24sv-_B$38O?%Bxc>JV8i;#biN!yYE1D5wS z&(`|QwXoByue{YRcO+3v&^(eMKBaXTQ;arAz`*@OAm{X(c%rb4TIqw)$OMwW5INnz?_J$ubd06~`EFTOGcTZ=vvLUd1@`0)`6HU+ zhEL1Oa4i%?Bx;NvMmQw0u?1V4l5jaV0OVku-KZ{;O^z7#3`Gn!`<%3SP3nbJ0LtJJ z0nP?6Ti9n=*6s-|SW0hhoOvP>mfE|Srem}cq!r+|0k{CS8pl-X!qZ69G;0%U=E)d~ zahqhWsLQomV2~LKsW~{n-`^pIQ>E;*)zh@yC-|MjQ0bAZ&m)8_=CphFHZTjR8&vX1 z#~IvDZ}{cbfpqpdeuUO46OJ%J4It+P4S!MT-lpo8zLv`I zWR4d)Xt!Hkk;ocTBdKjt-bIph0oZ_0 zd0w^$XZ4;kq;Xu@&tF;EbsHGug;UM)M2B-s>}@&yX9yGEs-m0^e5w+oU%7}lbm&i3jkS&?RSD$rUtoP5RyaWXdL zz$!DzB~N_g8jiY;YSJ5|B(oepn1^$mo>(0F4{rJR=LiThx`_iSu>ps_*0Vp7@^t&j z<+lfKml`<~%S3Patx89D)7vO4b$GqG@;XS}~468*m8rIQIDBrq%q-i;i=QtruuK z-Ri-+0!PjUeZEinS9_+GSL!IGwhbh)5hx0KV;@hGUiG9~L;nB}$jbt`OVmi)&wb<@ zXozg*9QzUv^<;|fM`Dv)2}Al=5xqAndYOngQb|6A&Nu&CYN>;OpJWD87143g(a5*`iXo1KRbDZSnyZ#+5?D|)cV{;@^KA{pHD3Wo>{XBvO8Mzqrk({uu zjMs~%b$?K)dAG?dk;MCka%Bf62k-OmUqw%AY1A_GuR|NVy(Yr@Qi-RWuxE`Ed2_jd z1duii`a?1jJvH?;pN}i2>h^sfX{+l~Y1Wp|WAZvhw8|g|1RyzV5WtPZjkpI4t$^73 z-l4fYOQmWySK5`YQW0%wCHq4L$r3k=BN(<7RsjKHo33ae zXtvtK0@7nHlCIuLv5{6ivLGMTl0$J=PZ9qB4Z7!xFll!ERn(d`p=qW{(py_cqRRpW zW`(@7vg;*BkO1dCrp|cB&NiQgJuSMfE}69P3r>#NbqTEt#__YkaHdsDT(pc#o|Oei z+;YPMcOA9-6zTemT2z+4Bv@TbdM1_#_9A8C*v%3Jk&7_gN#x*TAY+}6slN*?)tyaw z)C<=79jtd&&37C+cnb?h8nU^JZ#*xSGlE8QlC{;J@R22o1dpvWYt)7mx-u3q??#gX zO`x#YGC^#d^UiUPd+@8m-mmc2LAkZiH7=c!8=$h8CW?6@X$pcQ3XG~j-GhKK6?x*m zVEka}z9B`bbetNS=$Rl(Z#I`>AX(SVk8(P+j&|-V-{*|h?P;oMHaZVV>00+(Erzwz z`fOKC9-pR3gb)1W50}XfRDPV}%Q^0I>a+N}Yi-l|Wu3=U>9-bk(?KlPbJ$M_oTS23 z5#ZnqDv#>nPI7zv9pdMOeKTp|=Tzzmc$)5)sb9^iM+|7q5=kLflLQ}L8J{Nr5ZL~n zJ3TShQd(I}qFcDP({3RpEmA)&5~?=c1Zr7SFph6-n7UZok}N3(8DB!SIj_N6acbkrPdB zs?#e;8BLA3U4oUyePkSS$OP`@wH}7hrs>|dwl~+1%{9QhoUCf<@r*!8A(cr7xyLzd z9s?8UmeR#_cVP@!c;%N5GDu?}fO4um)NKHq`=)(}=yfH$(gSV1wCA2YK_#~Ic^s;M zxBxNdCu)pi9mq9Lq-l`(&{@c&JSFEyCK56>-LAp51Nun7B}w4zBZ1%7wApm6LQl)w z2wLLLO!DoFix`GSw}iUx&tZ}P#xPg`>aBYE3+XKHZKsavGV(~WPiN{Lr9Pz2?6KSL zgX#y28p*zxbvr8y*;%F4jDB*UkV49K94RESr~%mIdbY9l~T&SkEx{}7u?$^q?NX)Hm9NRW=v4neYO8%?>I|U;o zRzvu^-OSNTAwj@faUNY&h*6Ah;x8=B zgfk>5f>nmnxn{>4al!NpFAsIiPTxek)jC#dd#NrV({1Iou#siBnbpYNPSxJbKAGG} zY=d5V*Pq2YGsH{&mDVkdoz|Qqw2s}e{D|2WUA!?KrjWND#CrjZRDCCZ)|%b6k)&Hq zaea2Kh_SKVm0je3IczGwr{62_TjxQ368u5xdpmtj*QIq0OGum;)_BZO#XAQm!3l7{ z2^E+0j@iyLU9TNH7V2*ax?;?AE}K4=ajUvK5Zzs^#D+DR4a~(Ey(Q+r+;f%Xe@U*7 zPjnwh>bg=(bqt13%Hg>T+U<^G+aRWIS#~ks!^-qC1zOT-eZeW;Otn)0&e7JX)^e)gw;k8eH{$R#Q z^=Ze!Zl!%@-%o>1xyigv_$XE5$z8v*j|# zBOv4d05)=dp4HQf!|Rkp>tLJy`W%WMiKA=X&V^Oe zQh-M|@czHMOZ|T3qg}D9`ARYg8%H@Kzd1kk?^_>)%wp5^xf)p_3aY@NBmQo3I~)eB zE=OnA{Mmo5Wh?+BV|OD2=ls{cYFD2A5dk4w6o-y3Meh@_Qd8v@5M_D=X29Ji;ndzVP~_o`?eMH6Zl9({njON+L* z246NZr_qLN0qZy)PkajY-n8-iLDO4L9W?0Lg~OMYeL^{*wzUYd4U&z!jE4>uBpG6) z4&yvsKcaZ^)?n%~^-Y&Y*@Qorx1UIbrzr*ubM$9vY! z_Se#Nl)C-c4jLWVt_tYeaCML z#_Z%(^{0ZCIx+HfG>zoA=&5>o7+U5fl4zFZDW*~B8QKnb;{=_j9B&rBDB1K!Oz65r zf(4q=%GwBQ+`IEJi?A1o@j^wnwr4 zuZ&iK_>}6)ey8b9nT`!29-G&Ty~XyI6D;Vlw2C1jaTiZX61#^ z23U?ajAwQ|&nLD}4EjcLdh~|M3yGEXgdEGfs6xX8md*eS-+zIe8qqXOS6kQhN4K)I zf(VN=6Fjw7sLnD}1Pkf* zW5@ss*L7aKveA(vLYF_yTYZTO@a2ZkWyu5(psoSIRmN~yx*Y>Pwba`7fvmSr-A83_ zb9UDfEDq7UGKe-X!j(DL*(^%7*2jETp~ly9H0EZK-u5e;NYX~6?c5c~W)JVXp4{gk zcICg+tgUY)iVL)cce68wk{6V)RXGQRL;8u@SJmqK41T55nq$4((Ok)IZd&15HC6=r z69ffQxRaC40m$9hh1IqAZtS{}JFm*f)|RUZ#d1`#u#zQ>gL-!EEUUmc0FO&^Mb^J# z(wa`NMf`EJj-=b}C;5g`C|rff!2l34dz@sDGBNe;htzsStXr4N-x{g6w2j*5dDs=5 zvQ(>J4Cf_A2^{l9hQtSG@pRO&W@x z$eU&4k^eT#6uw36>vx@k**F%UD(HJ z`=iG1#J026pNH=ad`q>SKs3#6&RJx(GTT8l+;K?K##OWGQ@wJT;FHJ$9|d*4UuvEq z^(FrRP-@q2bE{w68;h%lB(pKV11Bc{0Hfdm@mVgL>if>0)O7t`(rN6jtlx6WZzk7e zJTis{jl(K_ho1HNoA@H@J!a#>nRN2@vf1g-MAood$kz}2=aNnCs>Gme#fDUIoNmTX z#(#`Bx{Ln+dL2bBxz#7At!{5wbcK?0BHG#hehFeg2pd;x?Esvyj!$ee`R7k+&|7s+ zOmIMs`irmcwH-9v3w2ndA}l^qJ9Uk=#y*jZ z4n4*W1vvGqUZ909tW1J9mF)ijoZFqk$&lMf$|+EoP9`-23NQoSJ0n_KOdy)d)}bXt#pYE#CC?}OTBMiXygJmXunv9 z29cHHVsJTJV+oVn@GJ2zZ`U1Jg}1tCj-Vk`xYp)Xj@{%>DZyy+#IraffC8pRYV+=@ z@o03vi#=1*vES?MZknr00_l3lj@gC-VdL_gJ_boUhDX-CpIDY_yQwa2+4UJ^CRtiX zF4r04mSddm_a`~Y?^wM?>rB)-hf|i?(g;2^UZSREiX}P$wG)(Tlq&hk+!xm zkEl`m=Ckv7fqB!tBc$DaS};E*EbTU2Da^|>(zK-))VLDE!vW4d)sgVeskGTTTU5Eb zzm^FsB|&clFo`FSuy#$Qrb3u-a>}oO>yf}U*wuCZpVoXtwp}{f{{TtR8qzy^^?3>Y zbHJ))1d=u@?8gLp4;af^pmXW~&n0G5g5Oe}c>LzKlK%5dg<~wLSoxDQf2(fXZX}Y*2e755_}$|S8m;e7 zTI+Y3{;P0CEwm^SU(G2*c-PBVw=v6mkDfRtww{pd-xl>fbxx(O>)HjqmE_BM$EPH3 z;o>OFky46(_L-U+P_cVBvM;y4W*^Da)(&Tl{YOK zuwdkd+y|k-BX2%pJbCdOM!tc%)XM~SC1Sf8lvbPGXto=*c$zZf4}=A{W()x(8*i@o zJK_&mTzFTe!1kVQwRpC7Hme?`Z4(HvzEOWVaNsq@6L|~>AU7mu>c0*=Zm{Y8hUw|L z-sT+_Q`VYkV76dYoCe4WyGH^u86<`MT#ohRUNrtG`bSdgevH-h`;Rc`w;H{r&5Xxo z)O$**zm!IB>kBf2jls|kNydTVm*PW6>dy{k((HPE{{W{t>IDxq{;Rsr@}ZBH5R5wR zmGaQyB8nIXA%}D0I>a#Q8WKR7)s@bn4AUXEnZiuUo?4TD&4u-*8=Qf=fHPU1f!E${ zg1WS}YboKiw@IdzZkb$exKtZQmcWvw9Aot<$m|VZ`p>PrRqAbX_g z9KJxv1Q17h+WJn*QrAt~I(#vut)!7GmlMnuDILHDG=I|U1d;kz)HAe*B2=w2^2|_oGw{#I0SYbvDzlTsb1UOLS+&ZjyaWf<%r&@`$-^n z&Tu)unGQ(a3otI< zVn?X^$Kpd%xzaUjPM6X3{Ynv~!!)gUvY4k!i>DHhrC1OG`B+`pt__S#1@>*UU+H3pUnCUH3K{7*=2hJa7TfdVi<-*5fbKj085)M||yda~!ia zB>+T)S=c)~hbne}10QT1)5G3`>)#MMt@Q4RyGwhRt(xNQ3GWTKxPm5ED2;=eLYD(0 zvp=W|=Wgo%00%r*ewsZ~1&)_vqRaVsBfb~lPv@@y>}G6$;a4EG6%XsctPfcJ6u%KR z8a39fbD~>oaq28&NUb#sJHIrvQZo@79{yC1j19+f;2tsK-7T(lJ>IQ0m8{xZX;SHT zato_rq(fzQ1jxm<$+9$jtDU=C`ar+{C<9=VN1pSjv@6R+7Z;0l4WxGGaWb^h#~2C* z0Xb~)S0g$4Z#P{-(@^z~Rtu4JX>gi^&|F)V5L&?zkTENalBBC`CyYKl`RMqGWu#m6 zrJj;Chr7Ejt8Z^Bd15W`N#&8~AcG`C6VG$NBpS=~r%u>w9UrECUIWxN?_^_$+g-(P zxs|mdrCL;ALNu8xjoVR8;(yDY7>Vq)VVSh33#1@vp3Zu_f~ zr{&Ug>61;KSoFIsO7hsWuOyI0(<`?3X$Au#Zf{l`kfd#1?^SfxwV_+ht!g)Vb(Qt5 zW0qeh))k=)#iIcK05Lxd803WWj9a?Uq*Sc!*^HJ8VwJka;tD8umP>Z@mA=+WI z49AHTS8FiGy5I%K^oLGfE`y_4YCS-@evQ;t*K%nV>tgS9bR(MK94S^Rn_dog5OC@h zzeyY3xoM*6{vS(i)3C*Ontrbsxt=H_X>P5WO`FwQZp9JgVnsMygN&T{K+~-H>t!XJ-}o0SR)17MsW?pWCB9O#P<7Fdcm~-LK`cGi;UtH?a$Nbf6aR5h2AT5ze2+H z`ae?ZJwDAEz$3MtqGm!em?}pBM;wwcKpc`WeQ(v*-C?O-NhFt7S2N72E^elku6C;i zP)i2~YbpIipO2=IZ=zjGsyZ#Up)Apz&6nIpJ^uhkYnM;yyUQIyQTbcJF5VgY0h|(j zBOl(gIxW=tcAU@%rgoBFGj>26?HqHQai8A1^GMQ7BD4)`;S=aY>80PF8rE|HbGcT$T{jT7@W*CpYM+XA^$8A9BQkJd5Y>&{1O zs&4LVwcE@4izgb*%#OEvqrv%1ayxx%rzWP--(GHn6V#0taq+A6m`mcMlcAt3sj7NI#N}`5+&UraqO}nhR^W1XoKG zsxlc~HdBleJAw2++PWI9i+`#c1&pHsX=)WCD$TsX9_|4o_W1T6O6=Hlo$MC3CiWJG zE4C>vBbFi#Mo1+20ztXeXCr0WYl6H>M&sG2#BXn`!IU|qnQEAXO@!ZRp9yqdc zqsv5JrZP$Wf&TzCwnw4dM;?^YURoKgfrS2I+DX;W?j$mn18EFF0eQ=0^UmEKrKHPa zsM}4``ZCXS(G<9`uvk2WMU6_v0Q3g(%W=l(BqVc+!&|{|VQP?A>O#jJOS?vn-ei$l zy}G$pZKaCKCP@VPurbLywvlN)kB9od@T>K;y@-B!?luk1?uI>wunCx0fH@nRpH@eU z_%qZRotCq8)HZisPP1uvmjYPPK_*k?rdSTj*24>s0A?7+73jA;N!2&Us9IfJW^I3O z@gpQYW6GiP<%eQQs8fM}J1&1nBa{9v>zge$!%fpVp7Tqyu-Yx)if8hp+l_@+l?=Gy zfCOaV`_>bxtf%WaUr^L#j!jZ)nQpEw$Y*I9PFoo~4aBhepL}zQ)pYGf>3F(h1-97X zS$PpcxjPhNj!8NH0L*iq^|fDW8jO0ivs+z7Z*8XC-brjsS&>Af05CxW0Hgb!*~MY{ z3d(+zytJO>?WapMZ_A`lAZ2qaNt~4+ciV-=K|GA+vpq$r-}NSgd1Y~bB)2!)B%Vi? z5z6Z?n4p0cR04PkJAiv|bsbNno@TRqIU#3_S!Ryp77w_wEE{eP3-F~ez|Ucgi=*SW z(QU22HD+#DK@2Yvva}KeJC|~@(_W820js}v&AzU&~xH9hwpcM>cIUMr1?OfVFP5xHKRJe{L zx`K0mYdwTsT&8V`1WxRy`9aZ0_Z*ONdC5-}u`a)Jth~{s^y>LUW(gZSK2y35eMMFu zR{;bB`}@8yMif>G@2<5k2kkWtO3^KY>UPp;Y}2Or%Dx+w$R`^!&UwhkIj&C+KMpp& zBlQ0ON9)?hQZ0_3)Q3{Kzi7O)lTVJyR8ke(gjqJW?6DY07ivD!j3-Xp+v-|Ga%q-Q z$6(SkB(EB8pPYG)V*oR^1hDRNTP~a89=*`L1Fh&55k>h;Z&qL1b zmd@Tl$jiM6X9odDz$AtrztC5IsI?f3c5sA>Dd89@k%V^xl|GDvk1&z{0Mv8vIr=N9 zE;=gpb*&pxlEV2_m1T-1;4&0(%8+*>GLwVt?~Hmq_l{bz=*yiS_|sYGcQEQft=a~7 z<(cAyDL^tqyN3S&=`%J?9f{F;BgKtp!>Rge<3ZFlC}h$u+FOf3GZ>|q%Ww-Ah}v@p zmW1+1P&mNC@dv17*CmG1d#j7{Y||CHo?kv+E!dTaNWl6R1%i$@OCdb5tanOv?Z1Tm zU8i-Q@c4BIbZfD91(m@e9E^z6w{XC)!()bA`(Wt3C*t<2tMw03N2+wzi+9tS#pTAM zaV3CDN%XsmrdY(VPFu~|q#~HhFxpt~eO2l@maErZCUu^N(Y-q#PHE8TmtuJOy8Z_e zTuBrgL{m-yNe(0|V_3%4azI>?+Saqv+Q&oqa~6rzUP|h=SLQgTvAQ!v%o$x+u)`HG z%{K~FvQXpzLG{l7KM);5p=iBna~_>xtKI4rH#f6en+W4J@y2|pJh}e>_=STPTuL7R zAsvW5VJD5+?}&a8bf-^i_V%XlNtWtW)>1GoFCuaTUV9J;EBwq6`j=rmf=;;iYYdTO zVT&%%r*SM!J-&GO{{R`UsXq?ih@Oe){{RfGblrENG|r{h^!cQo+U8q$Ri4?%Bs`9c z`;?gn=^%oGJd<9FuK3^JM4c&de{It}H!iGhjF-Ap)|TR5%d0$cK*S>utL6TkxWQJ& z4r}IDx9Iqvq~p|QPLR~Pdr8sbYZIp#E#7sejB#hG8cP9|emZYgFq!O3Saj zJnFq(dqH_|sB3nYcCh(u%!R}D1P@*#0OP+OCcOFd`;Xvv`h2$1TCKeET`!(7D~Bl- z^T;^^^E*k=( encoder.set(png::ColorType::Grayscale), - jpeg::PixelFormat::RGB24 => encoder.set(png::ColorType::RGB), + jpeg::PixelFormat::L8 => encoder.set_color(png::ColorType::Grayscale), + jpeg::PixelFormat::RGB24 => encoder.set_color(png::ColorType::RGB), jpeg::PixelFormat::CMYK32 => { data = cmyk_to_rgb(&mut data); - encoder.set(png::ColorType::RGB) + encoder.set_color(png::ColorType::RGB) }, }; diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/decoder.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/decoder.rs similarity index 94% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/decoder.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/decoder.rs index 4159547..5d956ca 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/decoder.rs +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/decoder.rs @@ -346,7 +346,7 @@ impl Decoder { } let frame = self.frame.as_ref().unwrap(); - compute_image(&frame.components, &planes, frame.output_size, self.is_jfif, self.color_transform) + compute_image(&frame.components, planes, frame.output_size, self.is_jfif, self.color_transform) } fn read_marker(&mut self) -> Result { @@ -362,7 +362,14 @@ impl Decoder { // byte which is not equal to 0 or X’FF’ (see Table B.1). Any marker may // optionally be preceded by any number of fill bytes, which are bytes // assigned code X’FF’. - let byte = self.reader.read_u8()?; + let mut byte = self.reader.read_u8()?; + + // Section B.1.1.2 + // "Any marker may optionally be preceded by any number of fill bytes, which are bytes assigned code X’FF’." + while byte == 0xFF { + byte = self.reader.read_u8()?; + } + if byte != 0x00 && byte != 0xFF { return Ok(Marker::from_u8(byte).unwrap()); } @@ -766,7 +773,7 @@ fn refine_non_zeroes(reader: &mut R, } fn compute_image(components: &[Component], - data: &[Vec], + mut data: Vec>, output_size: Dimensions, is_jfif: bool, color_transform: Option) -> Result> { @@ -776,24 +783,29 @@ fn compute_image(components: &[Component], if components.len() == 1 { let component = &components[0]; - - if component.size.width % 8 == 0 && component.size.height % 8 == 0 { - return Ok(data[0].clone()) - } + let mut decoded: Vec = data.remove(0); let width = component.size.width as usize; let height = component.size.height as usize; - - let mut buffer = vec![0u8; width * height]; + let size = width * height; let line_stride = component.block_size.width as usize * component.dct_scale; - for y in 0 .. height { - for x in 0 .. width { - buffer[y * width + x] = data[0][y * line_stride + x]; + // if the image width is a multiple of the block size, + // then we don't have to move bytes in the decoded data + if usize::from(output_size.width) != line_stride { + let mut buffer = vec![0u8; width]; + // The first line already starts at index 0, so we need to move only lines 1..height + for y in 1..height { + let destination_idx = y * width; + let source_idx = y * line_stride; + // We could use copy_within, but we need to support old rust versions + buffer.copy_from_slice(&decoded[source_idx..][..width]); + let destination = &mut decoded[destination_idx..][..width]; + destination.copy_from_slice(&buffer); } } - - Ok(buffer) + decoded.resize(size, 0); + Ok(decoded) } else { compute_image_parallel(components, data, output_size, is_jfif, color_transform) @@ -802,10 +814,10 @@ fn compute_image(components: &[Component], #[cfg(feature="rayon")] fn compute_image_parallel(components: &[Component], - data: &[Vec], - output_size: Dimensions, - is_jfif: bool, - color_transform: Option) -> Result> { + data: Vec>, + output_size: Dimensions, + is_jfif: bool, + color_transform: Option) -> Result> { use rayon::prelude::*; let color_convert_func = choose_color_convert_func(components.len(), is_jfif, color_transform)?; @@ -817,7 +829,7 @@ fn compute_image_parallel(components: &[Component], .with_max_len(1) .enumerate() .for_each(|(row, line)| { - upsampler.upsample_and_interleave_row(data, row, output_size.width as usize, line); + upsampler.upsample_and_interleave_row(&data, row, output_size.width as usize, line); color_convert_func(line, output_size.width as usize); }); @@ -826,10 +838,10 @@ fn compute_image_parallel(components: &[Component], #[cfg(not(feature="rayon"))] fn compute_image_parallel(components: &[Component], - data: &[Vec], - output_size: Dimensions, - is_jfif: bool, - color_transform: Option) -> Result> { + data: Vec>, + output_size: Dimensions, + is_jfif: bool, + color_transform: Option) -> Result> { let color_convert_func = choose_color_convert_func(components.len(), is_jfif, color_transform)?; let upsampler = Upsampler::new(components, output_size.width, output_size.height)?; let line_size = output_size.width as usize * components.len(); @@ -837,7 +849,7 @@ fn compute_image_parallel(components: &[Component], for (row, line) in image.chunks_mut(line_size) .enumerate() { - upsampler.upsample_and_interleave_row(data, row, output_size.width as usize, line); + upsampler.upsample_and_interleave_row(&data, row, output_size.width as usize, line); color_convert_func(line, output_size.width as usize); } diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/error.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/error.rs similarity index 86% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/error.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/error.rs index 4736049..fac7320 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/error.rs +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/error.rs @@ -54,16 +54,7 @@ impl fmt::Display for Error { } impl StdError for Error { - fn description(&self) -> &str { - match *self { - Error::Format(_) => "invalid JPEG format", - Error::Unsupported(_) => "unsupported JPEG feature", - Error::Io(ref err) => err.description(), - Error::Internal(ref err) => err.description(), - } - } - - fn cause(&self) -> Option<&dyn StdError> { + fn source(&self) -> Option<&(dyn StdError + 'static)> { match *self { Error::Io(ref err) => Some(err), Error::Internal(ref err) => Some(&**err), diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/huffman.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/huffman.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/huffman.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/huffman.rs diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/idct.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/idct.rs new file mode 100644 index 0000000..a5de082 --- /dev/null +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/idct.rs @@ -0,0 +1,381 @@ +// Malicious JPEG files can cause operations in the idct to overflow. +// One example is tests/crashtest/images/imagetestsuite/b0b8914cc5f7a6eff409f16d8cc236c5.jpg +// That's why wrapping operators are needed. +use crate::parser::Dimensions; +use std::num::Wrapping; + +pub(crate) fn choose_idct_size(full_size: Dimensions, requested_size: Dimensions) -> usize { + fn scaled(len: u16, scale: usize) -> u16 { ((len as u32 * scale as u32 - 1) / 8 + 1) as u16 } + + for &scale in &[1, 2, 4] { + if scaled(full_size.width, scale) >= requested_size.width || scaled(full_size.height, scale) >= requested_size.height { + return scale; + } + } + + return 8; +} + +#[test] +fn test_choose_idct_size() { + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 200, height: 200}), 1); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 500, height: 500}), 1); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 684, height: 456}), 1); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 999, height: 456}), 1); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 684, height: 999}), 1); + assert_eq!(choose_idct_size(Dimensions{width: 500, height: 333}, Dimensions{width: 63, height: 42}), 1); + + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 685, height: 999}), 2); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 1000, height: 1000}), 2); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 1400, height: 1400}), 4); + + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 5472, height: 3648}), 8); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 16384, height: 16384}), 8); + assert_eq!(choose_idct_size(Dimensions{width: 1, height: 1}, Dimensions{width: 65535, height: 65535}), 8); + assert_eq!(choose_idct_size(Dimensions{width: 5472, height: 3648}, Dimensions{width: 16384, height: 16384}), 8); +} + +pub(crate) fn dequantize_and_idct_block(scale: usize, coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { + match scale { + 8 => dequantize_and_idct_block_8x8(coefficients, quantization_table, output_linestride, output), + 4 => dequantize_and_idct_block_4x4(coefficients, quantization_table, output_linestride, output), + 2 => dequantize_and_idct_block_2x2(coefficients, quantization_table, output_linestride, output), + 1 => dequantize_and_idct_block_1x1(coefficients, quantization_table, output_linestride, output), + _ => panic!("Unsupported IDCT scale {}/8", scale), + } +} + +// This is based on stb_image's 'stbi__idct_block'. +fn dequantize_and_idct_block_8x8(coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { + debug_assert_eq!(coefficients.len(), 64); + + let mut temp = [Wrapping(0i32); 64]; + + // columns + for i in 0 .. 8 { + // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing + if coefficients[i + 8] == 0 && coefficients[i + 16] == 0 && coefficients[i + 24] == 0 && + coefficients[i + 32] == 0 && coefficients[i + 40] == 0 && coefficients[i + 48] == 0 && + coefficients[i + 56] == 0 { + let dcterm = Wrapping(coefficients[i] as i32 * quantization_table[i] as i32) << 2; + temp[i] = dcterm; + temp[i + 8] = dcterm; + temp[i + 16] = dcterm; + temp[i + 24] = dcterm; + temp[i + 32] = dcterm; + temp[i + 40] = dcterm; + temp[i + 48] = dcterm; + temp[i + 56] = dcterm; + } + else { + let s0 = Wrapping(coefficients[i] as i32 * quantization_table[i] as i32); + let s1 = Wrapping(coefficients[i + 8] as i32 * quantization_table[i + 8] as i32); + let s2 = Wrapping(coefficients[i + 16] as i32 * quantization_table[i + 16] as i32); + let s3 = Wrapping(coefficients[i + 24] as i32 * quantization_table[i + 24] as i32); + let s4 = Wrapping(coefficients[i + 32] as i32 * quantization_table[i + 32] as i32); + let s5 = Wrapping(coefficients[i + 40] as i32 * quantization_table[i + 40] as i32); + let s6 = Wrapping(coefficients[i + 48] as i32 * quantization_table[i + 48] as i32); + let s7 = Wrapping(coefficients[i + 56] as i32 * quantization_table[i + 56] as i32); + + let p2 = s2; + let p3 = s6; + let p1 = (p2 + p3) * stbi_f2f(0.5411961); + let t2 = p1 + p3 * stbi_f2f(-1.847759065); + let t3 = p1 + p2 * stbi_f2f(0.765366865); + let p2 = s0; + let p3 = s4; + let t0 = stbi_fsh(p2 + p3); + let t1 = stbi_fsh(p2 - p3); + let x0 = t0 + t3; + let x3 = t0 - t3; + let x1 = t1 + t2; + let x2 = t1 - t2; + let t0 = s7; + let t1 = s5; + let t2 = s3; + let t3 = s1; + let p3 = t0 + t2; + let p4 = t1 + t3; + let p1 = t0 + t3; + let p2 = t1 + t2; + let p5 = (p3 + p4) * stbi_f2f(1.175875602); + let t0 = t0 * stbi_f2f(0.298631336); + let t1 = t1 * stbi_f2f(2.053119869); + let t2 = t2 * stbi_f2f(3.072711026); + let t3 = t3 * stbi_f2f(1.501321110); + let p1 = p5 + (p1 * stbi_f2f(-0.899976223)); + let p2 = p5 + (p2 * stbi_f2f(-2.562915447)); + let p3 = p3 * stbi_f2f(-1.961570560); + let p4 = p4 * stbi_f2f(-0.390180644); + let t3 = t3 + p1 + p4; + let t2 = t2 + p2 + p3; + let t1 = t1 + p2 + p4; + let t0 = t0 + p1 + p3; + + // constants scaled things up by 1<<12; let's bring them back + // down, but keep 2 extra bits of precision + let x0 = x0 + Wrapping(512); + let x1 = x1 + Wrapping(512); + let x2 = x2 + Wrapping(512); + let x3 = x3 + Wrapping(512); + + temp[i] = (x0 + t3) >> 10; + temp[i + 56] = (x0 - t3) >> 10; + temp[i + 8] = (x1 + t2) >> 10; + temp[i + 48] = (x1 - t2) >> 10; + temp[i + 16] = (x2 + t1) >> 10; + temp[i + 40] = (x2 - t1) >> 10; + temp[i + 24] = (x3 + t0) >> 10; + temp[i + 32] = (x3 - t0) >> 10; + } + } + + for i in 0 .. 8 { + // no fast case since the first 1D IDCT spread components out + let s0 = temp[i * 8]; + let s1 = temp[i * 8 + 1]; + let s2 = temp[i * 8 + 2]; + let s3 = temp[i * 8 + 3]; + let s4 = temp[i * 8 + 4]; + let s5 = temp[i * 8 + 5]; + let s6 = temp[i * 8 + 6]; + let s7 = temp[i * 8 + 7]; + + let p2 = s2; + let p3 = s6; + let p1 = (p2 + p3) * stbi_f2f(0.5411961); + let t2 = p1 + p3 * stbi_f2f(-1.847759065); + let t3 = p1 + p2 * stbi_f2f(0.765366865); + let p2 = s0; + let p3 = s4; + let t0 = stbi_fsh(p2 + p3); + let t1 = stbi_fsh(p2 - p3); + let x0 = t0 + t3; + let x3 = t0 - t3; + let x1 = t1 + t2; + let x2 = t1 - t2; + let t0 = s7; + let t1 = s5; + let t2 = s3; + let t3 = s1; + let p3 = t0 + t2; + let p4 = t1 + t3; + let p1 = t0 + t3; + let p2 = t1 + t2; + let p5 = (p3 + p4) * stbi_f2f(1.175875602); + let t0 = t0 * stbi_f2f(0.298631336); + let t1 = t1 * stbi_f2f(2.053119869); + let t2 = t2 * stbi_f2f(3.072711026); + let t3 = t3 * stbi_f2f(1.501321110); + let p1 = p5 + p1 * stbi_f2f(-0.899976223); + let p2 = p5 + p2 * stbi_f2f(-2.562915447); + let p3 = p3 * stbi_f2f(-1.961570560); + let p4 = p4 * stbi_f2f(-0.390180644); + let t3 = t3 + p1 + p4; + let t2 = t2 + p2 + p3; + let t1 = t1 + p2 + p4; + let t0 = t0 + p1 + p3; + + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + // so we want to round that, which means adding 0.5 * 1<<17, + // aka 65536. Also, we'll end up with -128 to 127 that we want + // to encode as 0..255 by adding 128, so we'll add that before the shift + let x0 = x0 + Wrapping(65536 + (128 << 17)); + let x1 = x1 + Wrapping(65536 + (128 << 17)); + let x2 = x2 + Wrapping(65536 + (128 << 17)); + let x3 = x3 + Wrapping(65536 + (128 << 17)); + + output[i * output_linestride] = stbi_clamp((x0 + t3) >> 17); + output[i * output_linestride + 7] = stbi_clamp((x0 - t3) >> 17); + output[i * output_linestride + 1] = stbi_clamp((x1 + t2) >> 17); + output[i * output_linestride + 6] = stbi_clamp((x1 - t2) >> 17); + output[i * output_linestride + 2] = stbi_clamp((x2 + t1) >> 17); + output[i * output_linestride + 5] = stbi_clamp((x2 - t1) >> 17); + output[i * output_linestride + 3] = stbi_clamp((x3 + t0) >> 17); + output[i * output_linestride + 4] = stbi_clamp((x3 - t0) >> 17); + } +} + +// 4x4 and 2x2 IDCT based on Rakesh Dugad and Narendra Ahuja: "A Fast Scheme for Image Size Change in the Compressed Domain" (2001). +// http://sylvana.net/jpegcrop/jidctred/ +fn dequantize_and_idct_block_4x4(coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { + debug_assert_eq!(coefficients.len(), 64); + let mut temp = [Wrapping(0i32); 4 * 4]; + + const CONST_BITS: usize = 12; + const PASS1_BITS: usize = 2; + const FINAL_BITS: usize = CONST_BITS + PASS1_BITS + 3; + + // columns + for i in 0..4 { + let s0 = Wrapping(coefficients[i + 8 * 0] as i32 * quantization_table[i + 8 * 0] as i32); + let s1 = Wrapping(coefficients[i + 8 * 1] as i32 * quantization_table[i + 8 * 1] as i32); + let s2 = Wrapping(coefficients[i + 8 * 2] as i32 * quantization_table[i + 8 * 2] as i32); + let s3 = Wrapping(coefficients[i + 8 * 3] as i32 * quantization_table[i + 8 * 3] as i32); + + let x0 = (s0 + s2) << PASS1_BITS; + let x2 = (s0 - s2) << PASS1_BITS; + + let p1 = (s1 + s3) * stbi_f2f(0.541196100); + let t0 = (p1 + s3 * stbi_f2f(-1.847759065) + Wrapping(512)) >> (CONST_BITS - PASS1_BITS); + let t2 = (p1 + s1 * stbi_f2f(0.765366865) + Wrapping(512)) >> (CONST_BITS - PASS1_BITS); + + temp[i + 4 * 0] = x0 + t2; + temp[i + 4 * 3] = x0 - t2; + temp[i + 4 * 1] = x2 + t0; + temp[i + 4 * 2] = x2 - t0; + } + + for i in 0 .. 4 { + let s0 = temp[i * 4 + 0]; + let s1 = temp[i * 4 + 1]; + let s2 = temp[i * 4 + 2]; + let s3 = temp[i * 4 + 3]; + + let x0 = (s0 + s2) << CONST_BITS; + let x2 = (s0 - s2) << CONST_BITS; + + let p1 = (s1 + s3) * stbi_f2f(0.541196100); + let t0 = p1 + s3 * stbi_f2f(-1.847759065); + let t2 = p1 + s1 * stbi_f2f(0.765366865); + + // constants scaled things up by 1<<12, plus we had 1<<2 from first + // loop, plus horizontal and vertical each scale by sqrt(8) so together + // we've got an extra 1<<3, so 1<<17 total we need to remove. + // so we want to round that, which means adding 0.5 * 1<<17, + // aka 65536. Also, we'll end up with -128 to 127 that we want + // to encode as 0..255 by adding 128, so we'll add that before the shift + let x0 = x0 + Wrapping(1 << (FINAL_BITS - 1)) + Wrapping(128 << FINAL_BITS); + let x2 = x2 + Wrapping(1 << (FINAL_BITS - 1)) + Wrapping(128 << FINAL_BITS); + + output[i * output_linestride + 0] = stbi_clamp((x0 + t2) >> FINAL_BITS); + output[i * output_linestride + 3] = stbi_clamp((x0 - t2) >> FINAL_BITS); + output[i * output_linestride + 1] = stbi_clamp((x2 + t0) >> FINAL_BITS); + output[i * output_linestride + 2] = stbi_clamp((x2 - t0) >> FINAL_BITS); + } +} + +fn dequantize_and_idct_block_2x2(coefficients: &[i16], quantization_table: &[u16; 64], output_linestride: usize, output: &mut [u8]) { + debug_assert_eq!(coefficients.len(), 64); + + const SCALE_BITS: usize = 3; + + // Column 0 + let s00 = Wrapping(coefficients[8 * 0] as i32 * quantization_table[8 * 0] as i32); + let s10 = Wrapping(coefficients[8 * 1] as i32 * quantization_table[8 * 1] as i32); + + let x0 = s00 + s10; + let x2 = s00 - s10; + + // Column 1 + let s01 = Wrapping(coefficients[8 * 0 + 1] as i32 * quantization_table[8 * 0 + 1] as i32); + let s11 = Wrapping(coefficients[8 * 1 + 1] as i32 * quantization_table[8 * 1 + 1] as i32); + + let x1 = s01 + s11; + let x3 = s01 - s11; + + let x0 = x0 + Wrapping(1 << (SCALE_BITS - 1)) + Wrapping(128 << SCALE_BITS); + let x2 = x2 + Wrapping(1 << (SCALE_BITS - 1)) + Wrapping(128 << SCALE_BITS); + + // Row 0 + output[0] = stbi_clamp((x0 + x1) >> SCALE_BITS); + output[1] = stbi_clamp((x0 - x1) >> SCALE_BITS); + + // Row 1 + output[output_linestride + 0] = stbi_clamp((x2 + x3) >> SCALE_BITS); + output[output_linestride + 1] = stbi_clamp((x2 - x3) >> SCALE_BITS); +} + +fn dequantize_and_idct_block_1x1(coefficients: &[i16], quantization_table: &[u16; 64], _output_linestride: usize, output: &mut [u8]) { + debug_assert_eq!(coefficients.len(), 64); + + let s0 = (Wrapping(coefficients[0] as i32 * quantization_table[0] as i32) + Wrapping(128 * 8)) / Wrapping(8); + output[0] = stbi_clamp(s0); +} + +// take a -128..127 value and stbi__clamp it and convert to 0..255 +fn stbi_clamp(x: Wrapping) -> u8 +{ + x.0.max(0).min(255) as u8 +} + +fn stbi_f2f(x: f32) -> Wrapping { + Wrapping((x * 4096.0 + 0.5) as i32) +} + +fn stbi_fsh(x: Wrapping) -> Wrapping { + x << 12 +} + +#[test] +fn test_dequantize_and_idct_block_8x8() { + let coefficients: [i16; 8 * 8] = [ + -14, -39, 58, -2, 3, 3, 0, 1, + 11, 27, 4, -3, 3, 0, 1, 0, + -6, -13, -9, -1, -2, -1, 0, 0, + -4, 0, -1, -2, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 0, + -3, -2, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0]; + + let quantization_table: [u16; 8 * 8] = [ + 8, 6, 5, 8, 12, 20, 26, 31, + 6, 6, 7, 10, 13, 29, 30, 28, + 7, 7, 8, 12, 20, 29, 35, 28, + 7, 9, 11, 15, 26, 44, 40, 31, + 9, 11, 19, 28, 34, 55, 52, 39, + 12, 18, 28, 32, 41, 52, 57, 46, + 25, 32, 39, 44, 52, 61, 60, 51, + 36, 46, 48, 49, 56, 50, 52, 50]; + let output_linestride: usize = 8; + let mut output = [0u8; 8 * 8]; + dequantize_and_idct_block_8x8( + &coefficients, + &quantization_table, + output_linestride, + &mut output); + let expected_output = [ + 118, 92, 110, 83, 77, 93, 144, 198, + 172, 116, 114, 87, 78, 93, 146, 191, + 194, 107, 91, 76, 71, 93, 160, 198, + 196, 100, 80, 74, 67, 92, 174, 209, + 182, 104, 88, 81, 68, 89, 178, 206, + 105, 64, 59, 59, 63, 94, 183, 201, + 35, 27, 28, 37, 72, 121, 203, 204, + 37, 45, 41, 47, 98, 154, 223, 208]; + assert_eq!(&output[..], &expected_output[..]); +} + +#[test] +fn test_dequantize_and_idct_block_8x8_all_zero() { + let mut output = [0u8; 8 * 8]; + dequantize_and_idct_block_8x8( + &[0; 8*8], + &[666; 8*8], + 8, + &mut output); + assert_eq!(&output[..], &[128; 8*8][..]); +} + +#[test] +fn test_dequantize_and_idct_block_8x8_saturated() { + let mut output = [0u8; 8 * 8]; + dequantize_and_idct_block_8x8( + &[std::i16::MAX; 8*8], + &[std::u16::MAX; 8*8], + 8, + &mut output); + let expected = [ + 0, 0, 0, 255, 255, 0, 0, 255, + 0, 0, 215, 0, 0, 255, 255, 0, + 255, 255, 255, 255, 255, 0, 0, 255, + 0, 0, 255, 0, 255, 0, 255, 255, + 0, 0, 255, 255, 0, 255, 0, 0, + 255, 255, 0, 255, 255, 255, 170, 0, + 0, 255, 0, 0, 0, 0, 0, 255, + 255, 255, 0, 255, 0, 255, 0, 0]; + assert_eq!(&output[..], &expected[..]); +} diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/lib.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/lib.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/lib.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/lib.rs diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/marker.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/marker.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/marker.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/marker.rs diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/parser.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/parser.rs similarity index 93% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/parser.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/parser.rs index 4c28b9e..823778e 100644 --- a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/parser.rs +++ b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/parser.rs @@ -240,18 +240,24 @@ pub fn parse_sof(reader: &mut R, marker: Marker) -> Result { }) } +/// Returns ceil(x/y), requires x>0 +fn ceil_div(x: u32, y: u32) -> u16 { + assert!(x>0 && y>0, "invalid dimensions"); + (1 + ((x - 1) / y)) as u16 +} + fn update_component_sizes(size: Dimensions, components: &mut [Component]) -> Dimensions { - let h_max = components.iter().map(|c| c.horizontal_sampling_factor).max().unwrap(); - let v_max = components.iter().map(|c| c.vertical_sampling_factor).max().unwrap(); + let h_max = components.iter().map(|c| c.horizontal_sampling_factor).max().unwrap() as u32; + let v_max = components.iter().map(|c| c.vertical_sampling_factor).max().unwrap() as u32; let mcu_size = Dimensions { - width: (size.width as f32 / (h_max as f32 * 8.0)).ceil() as u16, - height: (size.height as f32 / (v_max as f32 * 8.0)).ceil() as u16, + width: ceil_div(size.width as u32, h_max * 8), + height: ceil_div(size.height as u32, v_max * 8), }; for component in components { - component.size.width = (size.width as f32 * component.horizontal_sampling_factor as f32 * component.dct_scale as f32 / (h_max as f32 * 8.0)).ceil() as u16; - component.size.height = (size.height as f32 * component.vertical_sampling_factor as f32 * component.dct_scale as f32 / (v_max as f32 * 8.0)).ceil() as u16; + component.size.width = ceil_div(size.width as u32 * component.horizontal_sampling_factor as u32 * component.dct_scale as u32, h_max * 8); + component.size.height = ceil_div(size.height as u32 * component.vertical_sampling_factor as u32 * component.dct_scale as u32, v_max * 8); component.block_size.width = mcu_size.width * component.horizontal_sampling_factor as u16; component.block_size.height = mcu_size.height * component.vertical_sampling_factor as u16; @@ -260,6 +266,25 @@ fn update_component_sizes(size: Dimensions, components: &mut [Component]) -> Dim mcu_size } +#[test] +fn test_update_component_sizes() { + let mut components = [Component { + identifier: 1, + horizontal_sampling_factor: 2, + vertical_sampling_factor: 2, + quantization_table_index: 0, + dct_scale: 8, + size: Dimensions { width: 0, height: 0 }, + block_size: Dimensions { width: 0, height: 0 }, + }]; + let mcu = update_component_sizes( + Dimensions { width: 800, height: 280 }, + &mut components); + assert_eq!(mcu, Dimensions { width: 50, height: 18 }); + assert_eq!(components[0].block_size, Dimensions { width: 100, height: 36 }); + assert_eq!(components[0].size, Dimensions { width: 800, height: 280 }); +} + // Section B.2.3 pub fn parse_sos(reader: &mut R, frame: &FrameInfo) -> Result { let length = read_length(reader, SOS)?; diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/upsampler.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/upsampler.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/upsampler.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/upsampler.rs diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/worker/immediate.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/worker/immediate.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/worker/immediate.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/worker/immediate.rs diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/worker/mod.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/worker/mod.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/worker/mod.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/worker/mod.rs diff --git a/third_party/cargo/vendor/jpeg-decoder-0.1.18/src/worker/threaded.rs b/third_party/cargo/vendor/jpeg-decoder-0.1.19/src/worker/threaded.rs similarity index 100% rename from third_party/cargo/vendor/jpeg-decoder-0.1.18/src/worker/threaded.rs rename to third_party/cargo/vendor/jpeg-decoder-0.1.19/src/worker/threaded.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/.cargo-checksum.json b/third_party/cargo/vendor/libc-0.2.67/.cargo-checksum.json deleted file mode 100644 index f013dd8..0000000 --- a/third_party/cargo/vendor/libc-0.2.67/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CONTRIBUTING.md":"cc340197d05fd8f069dfda6347b97d3da92c8f260c75ac78fb6970f08dba7638","Cargo.toml":"c163f08a308a5770a7a87fabc2a766182d410be6b5d2317878eee531f0dccedb","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"3d4ffed8a5f477b249d4e9684937b9b01b78994ded690d9712c1dbf13a8a1b31","build.rs":"ab351d7171b14f8032948e843841ebe8518ed95eb1abf0b1e689700c7cef4bf5","rustfmt.toml":"8a654d5787585ca8f2c20580737336fc327f411a07b0dbd4870adf6e9bdf624f","src/cloudabi/aarch64.rs":"b8550bf1fd7344972aa4db29441486f39f31482d0327534981dbb75959c29114","src/cloudabi/arm.rs":"c197e2781c2839808bd6fcef219a29705b27b992d3ef920e9cf6ac96e2022bbf","src/cloudabi/mod.rs":"7b36bc7429863346f11a395dbbc200a38b789066ee9aefeac808ecefda9a1a88","src/cloudabi/x86.rs":"33eb97f272d2201f3838ae74d444583c7de8f67856852ca375293b20bbd05636","src/cloudabi/x86_64.rs":"400d85d4fe39e26cf2e6ece9ee31c75fe9e88c4bcf4d836ca9f765c05c9c5be3","src/fixed_width_ints.rs":"34c60f12ec5eeb90f13ec3b954427532111c2446e69617616a97aefc1086a9f1","src/fuchsia/aarch64.rs":"378776a9e40766154a54c94c2a7b4675b5c302a38e6e42da99e67bfbaee60e56","src/fuchsia/align.rs":"ae1cf8f011a99737eabeb14ffff768e60f13b13363d7646744dbb0f443dab3d6","src/fuchsia/mod.rs":"4a7b5f7f8cdee2b3e17f8828ec2c2bd10bd6350c1414162895cc3c37aa453755","src/fuchsia/no_align.rs":"303f3f1b255e0088b5715094353cf00476131d8e94e6aebb3f469557771c8b8a","src/fuchsia/x86_64.rs":"93a3632b5cf67d2a6bcb7dc0a558605252d5fe689e0f38d8aa2ec5852255ac87","src/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/hermit/mod.rs":"aeda183662787a44c4bd26645cea76f31bf5f7c63d4d59118118c360705fb9eb","src/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/lib.rs":"1397a0db2d265c5777d4a405b4a92e875bc308449be8daae341c3eeabe82d72e","src/macros.rs":"f75e6eb90c38c35292ee3664f8e0c65723703cf36cb04ebb88ac509006ac872a","src/sgx.rs":"16a95cdefc81c5ee00d8353a60db363c4cc3e0f75abcd5d0144723f2a306ed1b","src/switch.rs":"9da3dd39b3de45a7928789926e8572d00e1e11a39e6f7289a1349aadce90edba","src/unix/align.rs":"2cdc7c826ef7ae61f5171c5ae8c445a743d86f1a7f2d9d7e4ceeec56d6874f65","src/unix/bsd/apple/b32/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b32/mod.rs":"6a4ce300da0d2b0db04b18548286603ffe4b47d679a41cf60f1902895894aa1f","src/unix/bsd/apple/b64/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b64/mod.rs":"76e172191d70e7ea7ca194aaa2d002e50db5724bf24526c3be5028cfd2085897","src/unix/bsd/apple/mod.rs":"f23791d87f31bb7bad49290c8e32bd43d20c5f53a67ac135fad0cb452940b669","src/unix/bsd/freebsdlike/dragonfly/errno.rs":"ae5e8e6b0f610ec015dfcc2928609037d7ea7b94570c72bcc5bdd588424c6259","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"1f6b04504ae77ce84b461910979ea640176e051bf2616c01d37cf9fc94c6fc17","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"e528191e42977fa4c226d8850c47d3e526e951cca46ea9a4a87af40221f79d63","src/unix/bsd/freebsdlike/freebsd/arm.rs":"10fe01bc6269b47da72d1e9f8bdae2fcc7d4f332540e8ce1756e1f58d506bf8c","src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs":"3d96c3bbd507688099ace8650ea2934cd7d85650d2e3a0981c6f916597edd09d","src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs":"9808d152c1196aa647f1b0f0cf84dac8c930da7d7f897a44975545e3d9d17681","src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs":"ceb4d5bd386f13bbf11499e12b5d4c377bd78ecca06fd65b0d08a6b25fba5ca4","src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/mod.rs":"e915c297192ddc82f439d659c6be20047fdf6b62d435f5aad383e1b3d4540a68","src/unix/bsd/freebsdlike/freebsd/powerpc64.rs":"125457305b14309cbad4c46fd2fbd54e2f96d37adfec6c89ae9ed8cedfa015bc","src/unix/bsd/freebsdlike/freebsd/x86.rs":"4e0813f01a017dc148262d7c40dfadb964eb7eb6138dc2b0b83d0b51dbe4d467","src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs":"fcf38f59ac1e8f90d5a26c6a434b6874972955404cb8cc33c17b1a583e3b3014","src/unix/bsd/freebsdlike/mod.rs":"2e0f5a0f768748a48caf05552956158c066db64ef59b935439f3a9e51ed1b93c","src/unix/bsd/mod.rs":"d8cf315174e6d97d87b44253fc4e4ef2570a495df8eec71f7571359c756ad039","src/unix/bsd/netbsdlike/mod.rs":"100b5fac3769b32be3cc7ea686cfd2a85fb2a55f154781a7ce44d65b163e0959","src/unix/bsd/netbsdlike/netbsd/aarch64.rs":"b38fc046f9a40fea28bd26328b96629f4d5d63d7524936bd6af1865d401a8716","src/unix/bsd/netbsdlike/netbsd/arm.rs":"58cdbb70b0d6f536551f0f3bb3725d2d75c4690db12c26c034e7d6ec4a924452","src/unix/bsd/netbsdlike/netbsd/mod.rs":"0b9039ff836fd05015eea83007adcb0f65c7fc56f37feaa4ffb72ab47e8f9f7b","src/unix/bsd/netbsdlike/netbsd/powerpc.rs":"ee7ff5d89d0ed22f531237b5059aa669df93a3b5c489fa641465ace8d405bf41","src/unix/bsd/netbsdlike/netbsd/sparc64.rs":"9489f4b3e4566f43bb12dfb92238960613dac7f6a45cc13068a8d152b902d7d9","src/unix/bsd/netbsdlike/netbsd/x86.rs":"20692320e36bfe028d1a34d16fe12ca77aa909cb02bda167376f98f1a09aefe7","src/unix/bsd/netbsdlike/netbsd/x86_64.rs":"135509edeaf3fb3f102d89d51ff1a8f82323497336a8dc7e1f0f23b5c2434b73","src/unix/bsd/netbsdlike/openbsd/aarch64.rs":"1dd5449dd1fd3d51e30ffdeeaece91d0aaf05c710e0ac699fecc5461cfa2c28e","src/unix/bsd/netbsdlike/openbsd/mod.rs":"837d8c8de710ee8967a93f7f62425b8be925de9ed48371069cfefdd095c77bdd","src/unix/bsd/netbsdlike/openbsd/sparc64.rs":"d04fd287afbaa2c5df9d48c94e8374a532a3ba491b424ddf018270c7312f4085","src/unix/bsd/netbsdlike/openbsd/x86.rs":"6f7f5c4fde2a2259eb547890cbd86570cea04ef85347d7569e94e679448bec87","src/unix/bsd/netbsdlike/openbsd/x86_64.rs":"e59b7fd65f68f8e857eec39e0c03bac1d3af6ddc26c9ba58494336b83659bb9b","src/unix/haiku/b32.rs":"69ae47fc52c6880e85416b4744500d5655c9ec6131cb737f3b649fceaadce15a","src/unix/haiku/b64.rs":"73e64db09275a8da8d50a13cce2cfa2b136036ddf3a930d2939f337fc995900b","src/unix/haiku/mod.rs":"e1ee9e402284d78ffd31ae2fb3f8310e94ed5bb1b0b65f44d5be6cd06bc5fa6a","src/unix/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/unix/hermit/mod.rs":"878e02b4b3ceafdfce3746efadb621ec1baacfe93e385556c6e505bae5c3eaaf","src/unix/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/unix/linux_like/android/b32/arm.rs":"3625a32c7e58cfe683a53486fbe3d42d4e28f00bea31e19cb46ed2bb0b6a140b","src/unix/linux_like/android/b32/mod.rs":"c997e59bc7a5abe0f37dd87fcc206651dcb2c9837c3f4c2437f9d7944a30717c","src/unix/linux_like/android/b32/x86/align.rs":"812914e4241df82e32b12375ca3374615dc3a4bdd4cf31f0423c5815320c0dab","src/unix/linux_like/android/b32/x86/mod.rs":"edc810399ce9db38c1042c653f05d7f3571f711fa2c16917e8b543df01f065a5","src/unix/linux_like/android/b64/aarch64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/android/b64/aarch64/mod.rs":"d832328045ed4d65e06ecd072cbe32336a5023664ad85e3961cb1bde8e9d69ba","src/unix/linux_like/android/b64/mod.rs":"2577fa47de16e819569b4d02aeb5f30e8367d85b169fdcc1789f0b404ad6b957","src/unix/linux_like/android/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/android/b64/x86_64/mod.rs":"c6eff774c053f7c8e7a895906ad23e7f835e7349260b40f0ee1689e4d1139ec8","src/unix/linux_like/android/mod.rs":"8c7d93ace278798a3020aed47310e2a9834a0b338b4097f5cbf0f424a57d5e42","src/unix/linux_like/emscripten/align.rs":"3f40c9cd6ba8b49b4129b53ae43ae8590dfdf21ecc7d20c306d35faf1b470872","src/unix/linux_like/emscripten/mod.rs":"62037212af196240b6469d5cd41ddc81b18d379e346e78e77d6e467f4a4ca47e","src/unix/linux_like/emscripten/no_align.rs":"0128e4aa721a9902754828b61b5ec7d8a86619983ed1e0544a85d35b1051fad6","src/unix/linux_like/linux/align.rs":"15957efd9b772280eb28447849f3aad38fff0c5d65a02566a7ebfba2e7107437","src/unix/linux_like/linux/gnu/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/gnu/b32/arm/align.rs":"3fed009dc9af3cc81be7087da9d2d7d1f39845e4497e290259c5cdbae25f039d","src/unix/linux_like/linux/gnu/b32/arm/mod.rs":"48bea857c59cd3f45c78fb737e048c37174d58d06d20b21c91928f373510ba19","src/unix/linux_like/linux/gnu/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/gnu/b32/mips/mod.rs":"e2d2e51fea73210d9705b7eaa37de8baa7152b71ae3a10a316c277345c529b5c","src/unix/linux_like/linux/gnu/b32/mod.rs":"c65adabb73b2b145a9311e0c2abd4075bf1b763b7bea5b26fbd938199e462f37","src/unix/linux_like/linux/gnu/b32/powerpc.rs":"ba9f549679f66ba15e007a5ded4fe9d10d2e9283a5ce95e6bdfb110089bf15f6","src/unix/linux_like/linux/gnu/b32/sparc/align.rs":"21adbed27df73e2d1ed934aaf733a643003d7baf2bde9c48ea440895bcca6d41","src/unix/linux_like/linux/gnu/b32/sparc/mod.rs":"690357fa2a9a9bf895c59d44d73842e7ee2e5de4decb803b61ec1c9491f32fc0","src/unix/linux_like/linux/gnu/b32/x86/align.rs":"e4bafdc4a519a7922a81b37a62bbfd1177a2f620890eef8f1fbc47162e9eb413","src/unix/linux_like/linux/gnu/b32/x86/mod.rs":"403dc6de6fb22d1eefdbe5e3e4977fd972c15335c3d9d5a394f17c5c1b35a205","src/unix/linux_like/linux/gnu/b64/aarch64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs":"72779fa53260d2e72d01a8cf387da0948cd93072b8b31937d51d3b6c25a44f03","src/unix/linux_like/linux/gnu/b64/mips64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/mips64/mod.rs":"44261e37fd6b3ff5cb091a5c973faa75b157bac91a9eac9d9cb78bf34f6c2a2f","src/unix/linux_like/linux/gnu/b64/mod.rs":"b90d87f76bff37707a1725551fe45d70d0c106e01b1dbbcd5f60460e0a19b4c3","src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs":"fc4d6613805fdedfff9455d736819a146f5403354a26c902b8c82003b2452629","src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs":"4a5dada65294246696b8114accb38d003e66b1b1c165a49abb41073bab504d82","src/unix/linux_like/linux/gnu/b64/s390x.rs":"f796526968527985a0bbb89eb4f7347a193eb515932504aa32712ca2f07fa4a1","src/unix/linux_like/linux/gnu/b64/sparc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs":"239dd7dfa45c078adc0d188dca8e54a9cef1814f1c331bed4eacb87fd7578615","src/unix/linux_like/linux/gnu/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs":"33d9c3c191591d50df619c1bd8913ba06559cf924023d626fdc71c4ba893c299","src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs":"c1862036556262f076eda2008470b8a351b9c371d70664f54387c46890e8cd18","src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs":"30f88d0fa9e7807ee4cbe89fd274061f810099567d5e68fa829277d7d27ba708","src/unix/linux_like/linux/gnu/mod.rs":"47f5ac20088795aebfb94fd478b45ac268b9ae35c1487a1753412f7a8b34ce43","src/unix/linux_like/linux/gnu/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/mod.rs":"4eb72d01a19dfb52e2aa5ccdd54453829eabd4fdf91f4fed44bf1d7503b50a34","src/unix/linux_like/linux/musl/b32/arm/align.rs":"3e8ac052c1043764776b54c93ba4260e061df998631737a897d9d47d54f7b80c","src/unix/linux_like/linux/musl/b32/arm/mod.rs":"2a57708c5c2976896697ea497be32e0d03573fe44e940df8ddcd4cb06350212c","src/unix/linux_like/linux/musl/b32/hexagon.rs":"e945250ac42713836cae8e4820fc395d374535fce332dbd3ef68109c392290a0","src/unix/linux_like/linux/musl/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/musl/b32/mips/mod.rs":"eb65de7aeefed797129c9521785eaa99cdac0644efd826fc6efbab5afc760bf2","src/unix/linux_like/linux/musl/b32/mod.rs":"011c23053388aaacf9aaa17c92b2a918d0fa054410bb1640e61cc4e6d00b0b75","src/unix/linux_like/linux/musl/b32/powerpc.rs":"e3bb421df570b8b154d89969c5a045573c369c2b043ebd93b1d1d2211684dca5","src/unix/linux_like/linux/musl/b32/x86/align.rs":"08e77fbd7435d7dec2ff56932433bece3f02e47ce810f89004a275a86d39cbe1","src/unix/linux_like/linux/musl/b32/x86/mod.rs":"4698f7c107451e7db247e75ade30095b634cb0bfec9605e273975e75c1907420","src/unix/linux_like/linux/musl/b64/aarch64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/linux/musl/b64/aarch64/mod.rs":"81c4be3f230a60263b57e1d1766420d620e50d8cca04d5a75f48a2a5fe30622e","src/unix/linux_like/linux/musl/b64/mips64.rs":"e8206d97833a50b980aa36a42b02e6197d903a1db4f4314a53b7289308c28bdd","src/unix/linux_like/linux/musl/b64/mod.rs":"317d1cb47ccc87cb7f8ed677bab799fa6eb1b8fd7fbd57d1896005644e02a010","src/unix/linux_like/linux/musl/b64/powerpc64.rs":"9b3faba7fa4f3a660e744ec7bdb71a759ac7d4d78a51b3374d004d5494f8332a","src/unix/linux_like/linux/musl/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/musl/b64/x86_64/mod.rs":"f317c46a2fe4e91e0aaabcaad9bd7535e9d286f0d41caa77bc1d706e37e6a762","src/unix/linux_like/linux/musl/mod.rs":"11b4f90bd362c36b5b20704020d3db28c3b8dffc314f84fc99c4fadef595cc98","src/unix/linux_like/linux/no_align.rs":"b94d6612cb8cb1eea947afc825cf8acaddc7f14835a15d2a6e691765de975fcd","src/unix/linux_like/mod.rs":"cd126c3bcf2d633e0d03b0ee15149b76148c2098e0b3ad53dfc57c63f2ba3afd","src/unix/mod.rs":"a0d4038f1e39689c1bce389314361d7a0fceaa4abbe71ffe894f68b78df847ee","src/unix/newlib/aarch64/mod.rs":"934754e14de392703fd380e0a443fd19a85a405d6c9310d9f855288dd8e76343","src/unix/newlib/align.rs":"28aaf87fafbc6b312622719d472d8cf65f9e5467d15339df5f73e66d8502b28a","src/unix/newlib/arm/mod.rs":"69756a6ba4b75d8cdeae1843bd6d079c42c94e3e61e6e09f169bd20cebec8b0e","src/unix/newlib/mod.rs":"fc2a6cef4ab8f19f16d5ef5d18e206a5514c5ae39091b8d69c7cc1229a3c1f7f","src/unix/newlib/no_align.rs":"7123dcec13604a11b7765c380ff3a4d0da19c39f4b03919de7857723c0cf1502","src/unix/no_align.rs":"c06e95373b9088266e0b14bba0954eef95f93fb2b01d951855e382d22de78e53","src/unix/redox/mod.rs":"b56dcb5135935b750ff25a3967dd15e1285438ecd2239e87145338dacdccb344","src/unix/solarish/compat.rs":"cf4ee4cf0d7d45b253b01d1cf823d7f007e3e71aeb5cd8ffe77ef3d722255e68","src/unix/solarish/mod.rs":"7d6c8a7852561c901ef779b515e14149799209c040ae9e75b2cfaa13ee43e60e","src/unix/uclibc/align.rs":"a8540e1cce5913a45bc8d7422b79e86c0b12740e8a679478e0e4d863a31f8cc1","src/unix/uclibc/arm/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/uclibc/arm/mod.rs":"d67dd46bc6f417169fc6a23832bde7ccdafc5d1bcb08b10debdd82edaf75d529","src/unix/uclibc/arm/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/uclibc/mips/mips32/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/uclibc/mips/mips32/mod.rs":"a045ebc6619f540adf670b88a987abd2d6e42e440a552e8cfe9f8c77f397e873","src/unix/uclibc/mips/mips32/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/uclibc/mips/mips64/align.rs":"a7bdcb18a37a2d91e64d5fad83ea3edc78f5412adb28f77ab077dbb26dd08b2d","src/unix/uclibc/mips/mips64/mod.rs":"e3085ba56cfbc528d7c3c55065880603238c333b6047ef51c58177508a487fcd","src/unix/uclibc/mips/mips64/no_align.rs":"4a18e3875698c85229599225ac3401a2a40da87e77b2ad4ef47c6fcd5a24ed30","src/unix/uclibc/mips/mod.rs":"1054d0bfeb506b3346b9a4148564beced8a22da0d9c9a612101f6237756795fb","src/unix/uclibc/mod.rs":"e7183f8306dc2ef8729ac4c51cf5e8152da4b9df16e4326e5d434d38fbc2e9d6","src/unix/uclibc/no_align.rs":"3f28637046524618adaa1012e26cb7ffe94b9396e6b518cccdc69d59f274d709","src/unix/uclibc/x86_64/align.rs":"c44ee7782b74733bee5659dfd7eb32d5901c17c99cb540b1a08291859f6238c6","src/unix/uclibc/x86_64/l4re.rs":"bb31053d6403091e11f95ac2203982f279f8b984a19adf30796878c45fdd8c25","src/unix/uclibc/x86_64/mod.rs":"df78de7e0234192c0559b9820c0034a24d72a0820d361f9aad05a9eac36e80ff","src/unix/uclibc/x86_64/no_align.rs":"b308f7b110caf7405b57186882cfc4804caae49a8287f8ab612ec8548467f2f4","src/unix/uclibc/x86_64/other.rs":"42c3f71e58cabba373f6a55a623f3c31b85049eb64824c09c2b082b3b2d6a0a8","src/vxworks/aarch64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/arm.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/mod.rs":"d69c23ba963c6cfb818f29da91e6f8f8ef2fdef1766f8f85ffa2b1fe1a05dfbd","src/vxworks/powerpc.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/powerpc64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/x86.rs":"552f007f38317620b23889cb7c49d1d115841252439060122f52f434fbc6e5ba","src/vxworks/x86_64.rs":"018d92be3ad628a129eff9f2f5dfbc0883d8b8e5f2fa917b900a7f98ed6b514a","src/wasi.rs":"3948fd2fe7458dfc5163f522da285e4bf4d7c714a6449e8bc89edca6bca54c9a","src/windows/gnu/align.rs":"b2c13ec1b9f3b39a75c452c80c951dff9d0215e31d77e883b4502afb31794647","src/windows/gnu/mod.rs":"dc8e2f8d32280394d2bc386f804ce1c71f751590cfeed7db9220e231acc766e3","src/windows/mod.rs":"6b716e89836615269884c3af29d40051986c7a62312ecad7f274fd45bf5cd027","src/windows/msvc.rs":"2c2bfce66027d88021e7289139ebf5b0db258a7b6443f18872c84dbd4ef57131","tests/const_fn.rs":"cb75a1f0864f926aebe79118fc34d51a0d1ade2c20a394e7774c7e545f21f1f4"},"package":"eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018"} \ No newline at end of file diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/align.rs b/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/align.rs deleted file mode 100644 index 8e94996..0000000 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f32; 8] - } -} diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/compat.rs b/third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/compat.rs deleted file mode 100644 index a336452..0000000 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/compat.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Common functions that are unfortunately missing on illumos and -// Solaris, but often needed by other crates. - -use unix::solarish::*; - -pub unsafe fn cfmakeraw(termios: *mut ::termios) { - let mut t = *termios as ::termios; - t.c_iflag &= !(IMAXBEL - | IGNBRK - | BRKINT - | PARMRK - | ISTRIP - | INLCR - | IGNCR - | ICRNL - | IXON); - t.c_oflag &= !OPOST; - t.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN); - t.c_cflag &= !(CSIZE | PARENB); - t.c_cflag |= CS8; -} - -pub unsafe fn cfsetspeed( - termios: *mut ::termios, - speed: ::speed_t, -) -> ::c_int { - // Neither of these functions on illumos or Solaris actually ever - // return an error - ::cfsetispeed(termios, speed); - ::cfsetospeed(termios, speed); - 0 -} diff --git a/third_party/cargo/vendor/libc-0.2.71/.cargo-checksum.json b/third_party/cargo/vendor/libc-0.2.71/.cargo-checksum.json new file mode 100644 index 0000000..f4992a7 --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CONTRIBUTING.md":"cc340197d05fd8f069dfda6347b97d3da92c8f260c75ac78fb6970f08dba7638","Cargo.toml":"e5f9349df5a2675230752b65e5798f3daf91bbf41cb65aa47a9060b3fb4f7f62","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"a8d47ff51ca256f56a8932dba07660672dbfe3004257ca8de708aac1415937a1","README.md":"69f85e8acfa71ff6e1f3807985e04d19eefe88bbd90192e4b42515336eb93b4a","build.rs":"ab351d7171b14f8032948e843841ebe8518ed95eb1abf0b1e689700c7cef4bf5","rustfmt.toml":"8a654d5787585ca8f2c20580737336fc327f411a07b0dbd4870adf6e9bdf624f","src/cloudabi/aarch64.rs":"b8550bf1fd7344972aa4db29441486f39f31482d0327534981dbb75959c29114","src/cloudabi/arm.rs":"c197e2781c2839808bd6fcef219a29705b27b992d3ef920e9cf6ac96e2022bbf","src/cloudabi/mod.rs":"d5d4488e8c0b8227f516fe13810f550a2a72af3bdfe769200ad8687c8755bdf6","src/cloudabi/x86.rs":"33eb97f272d2201f3838ae74d444583c7de8f67856852ca375293b20bbd05636","src/cloudabi/x86_64.rs":"400d85d4fe39e26cf2e6ece9ee31c75fe9e88c4bcf4d836ca9f765c05c9c5be3","src/fixed_width_ints.rs":"34c60f12ec5eeb90f13ec3b954427532111c2446e69617616a97aefc1086a9f1","src/fuchsia/aarch64.rs":"378776a9e40766154a54c94c2a7b4675b5c302a38e6e42da99e67bfbaee60e56","src/fuchsia/align.rs":"ae1cf8f011a99737eabeb14ffff768e60f13b13363d7646744dbb0f443dab3d6","src/fuchsia/mod.rs":"3d669cc3355c42f6581f88af354cd99514f93fda843c2c893619b0bb77df85c5","src/fuchsia/no_align.rs":"303f3f1b255e0088b5715094353cf00476131d8e94e6aebb3f469557771c8b8a","src/fuchsia/x86_64.rs":"93a3632b5cf67d2a6bcb7dc0a558605252d5fe689e0f38d8aa2ec5852255ac87","src/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/hermit/mod.rs":"d3bfce41e4463d4be8020a2d063c9bfa8b665f45f1cc6cbf3163f5d01e7cb21f","src/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/lib.rs":"20495d790ad3e5716723bb5206eba94e655041deb65e05031a18d807bee69fbf","src/macros.rs":"f75e6eb90c38c35292ee3664f8e0c65723703cf36cb04ebb88ac509006ac872a","src/psp.rs":"fb16ddcc1264f7d870e604306e605b819744c3a9971d3f846e8803e932b9ceb3","src/sgx.rs":"16a95cdefc81c5ee00d8353a60db363c4cc3e0f75abcd5d0144723f2a306ed1b","src/switch.rs":"9da3dd39b3de45a7928789926e8572d00e1e11a39e6f7289a1349aadce90edba","src/unix/align.rs":"2cdc7c826ef7ae61f5171c5ae8c445a743d86f1a7f2d9d7e4ceeec56d6874f65","src/unix/bsd/apple/b32/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b32/mod.rs":"6a4ce300da0d2b0db04b18548286603ffe4b47d679a41cf60f1902895894aa1f","src/unix/bsd/apple/b64/align.rs":"ec833a747866fe19ca2d9b4d3c9ff0385faba5edf4bd0d15fa68884c40b0e26c","src/unix/bsd/apple/b64/mod.rs":"81254d89be1febc5bb20e787d014a624950d56e2e14973df5bbebfdabc95ae20","src/unix/bsd/apple/mod.rs":"dde90b02e79e46e0cc670de76d95612bc44c154edcb137d07d32dc4afc7ea952","src/unix/bsd/freebsdlike/dragonfly/errno.rs":"ae5e8e6b0f610ec015dfcc2928609037d7ea7b94570c72bcc5bdd588424c6259","src/unix/bsd/freebsdlike/dragonfly/mod.rs":"1f6b04504ae77ce84b461910979ea640176e051bf2616c01d37cf9fc94c6fc17","src/unix/bsd/freebsdlike/freebsd/aarch64.rs":"e528191e42977fa4c226d8850c47d3e526e951cca46ea9a4a87af40221f79d63","src/unix/bsd/freebsdlike/freebsd/arm.rs":"10fe01bc6269b47da72d1e9f8bdae2fcc7d4f332540e8ce1756e1f58d506bf8c","src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs":"3d96c3bbd507688099ace8650ea2934cd7d85650d2e3a0981c6f916597edd09d","src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs":"9808d152c1196aa647f1b0f0cf84dac8c930da7d7f897a44975545e3d9d17681","src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs":"ceb4d5bd386f13bbf11499e12b5d4c377bd78ecca06fd65b0d08a6b25fba5ca4","src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs":"61cbe45f8499bedb168106b686d4f8239472f25c7553b069eec2afe197ff2df6","src/unix/bsd/freebsdlike/freebsd/mod.rs":"00d9430c3490a1c619ae32ca6f6fd193ee8f05892a3c9585bb066cd2de014298","src/unix/bsd/freebsdlike/freebsd/powerpc64.rs":"125457305b14309cbad4c46fd2fbd54e2f96d37adfec6c89ae9ed8cedfa015bc","src/unix/bsd/freebsdlike/freebsd/x86.rs":"4e0813f01a017dc148262d7c40dfadb964eb7eb6138dc2b0b83d0b51dbe4d467","src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs":"fcf38f59ac1e8f90d5a26c6a434b6874972955404cb8cc33c17b1a583e3b3014","src/unix/bsd/freebsdlike/mod.rs":"94031bc1130c7ffeb720de67276d3abf41dbf100caccc89fb5cf2286f4154a9a","src/unix/bsd/mod.rs":"2103affabcd0ec50f459f32d30e97d57f82ae8e9e0b11e382867faa6a4ed5b4d","src/unix/bsd/netbsdlike/mod.rs":"49a20ad0e1fba2822d27d77413fb312cbfcd1972fbda5de091584509be3c63fb","src/unix/bsd/netbsdlike/netbsd/aarch64.rs":"b38fc046f9a40fea28bd26328b96629f4d5d63d7524936bd6af1865d401a8716","src/unix/bsd/netbsdlike/netbsd/arm.rs":"58cdbb70b0d6f536551f0f3bb3725d2d75c4690db12c26c034e7d6ec4a924452","src/unix/bsd/netbsdlike/netbsd/mod.rs":"b2837698c6eb22e6511e7d5854208856eac92add94dff922df5037b80944d072","src/unix/bsd/netbsdlike/netbsd/powerpc.rs":"ee7ff5d89d0ed22f531237b5059aa669df93a3b5c489fa641465ace8d405bf41","src/unix/bsd/netbsdlike/netbsd/sparc64.rs":"9489f4b3e4566f43bb12dfb92238960613dac7f6a45cc13068a8d152b902d7d9","src/unix/bsd/netbsdlike/netbsd/x86.rs":"20692320e36bfe028d1a34d16fe12ca77aa909cb02bda167376f98f1a09aefe7","src/unix/bsd/netbsdlike/netbsd/x86_64.rs":"135509edeaf3fb3f102d89d51ff1a8f82323497336a8dc7e1f0f23b5c2434b73","src/unix/bsd/netbsdlike/openbsd/aarch64.rs":"1dd5449dd1fd3d51e30ffdeeaece91d0aaf05c710e0ac699fecc5461cfa2c28e","src/unix/bsd/netbsdlike/openbsd/mod.rs":"234cda145f27a1b92ea2b1380708a91727668df249d40261e1d07d203bf1c535","src/unix/bsd/netbsdlike/openbsd/sparc64.rs":"d04fd287afbaa2c5df9d48c94e8374a532a3ba491b424ddf018270c7312f4085","src/unix/bsd/netbsdlike/openbsd/x86.rs":"6f7f5c4fde2a2259eb547890cbd86570cea04ef85347d7569e94e679448bec87","src/unix/bsd/netbsdlike/openbsd/x86_64.rs":"e59b7fd65f68f8e857eec39e0c03bac1d3af6ddc26c9ba58494336b83659bb9b","src/unix/haiku/b32.rs":"69ae47fc52c6880e85416b4744500d5655c9ec6131cb737f3b649fceaadce15a","src/unix/haiku/b64.rs":"73e64db09275a8da8d50a13cce2cfa2b136036ddf3a930d2939f337fc995900b","src/unix/haiku/mod.rs":"0b00eb9d3d593182fea45cce424810c81493fd8791a2fa15bcd5f3950d6d7331","src/unix/hermit/aarch64.rs":"86048676e335944c37a63d0083d0f368ae10ceccefeed9debb3bbe08777fc682","src/unix/hermit/mod.rs":"fb7e14d0f46ffaa989b5ab68c85184efe6aa04b5381e46866299b1f3258ddce3","src/unix/hermit/x86_64.rs":"ab832b7524e5fb15c49ff7431165ab1a37dc4667ae0b58e8306f4c539bfa110c","src/unix/linux_like/android/b32/arm.rs":"155994121906903a2e0afad895f0b3b7546f6e54d6305a3336ce2c4dfafbfdfa","src/unix/linux_like/android/b32/mod.rs":"0325adf3364fed7157fff5b24fabe1b36d806c39ee04ec82dd29a606d28f91f6","src/unix/linux_like/android/b32/x86/align.rs":"812914e4241df82e32b12375ca3374615dc3a4bdd4cf31f0423c5815320c0dab","src/unix/linux_like/android/b32/x86/mod.rs":"5b1e9fcd77ca5f939acb7fb5f5da12f305b0377698d8b8989feb236e26360aa0","src/unix/linux_like/android/b64/aarch64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/android/b64/aarch64/mod.rs":"d832328045ed4d65e06ecd072cbe32336a5023664ad85e3961cb1bde8e9d69ba","src/unix/linux_like/android/b64/mod.rs":"6a71abfcbbcdae60c916de41cd4688d5f25bdbca83d1d9df49decd56ad726a06","src/unix/linux_like/android/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/android/b64/x86_64/mod.rs":"e84176d838e663d351450bad218715db1fafbb531e47ea0e262cbb45829dae89","src/unix/linux_like/android/mod.rs":"ed6cf0314f9af332cd237b92f4977c5e60d26b5a4355cee05866fc76a84404f6","src/unix/linux_like/emscripten/align.rs":"86c95cbed7a7161b1f23ee06843e7b0e2340ad92b2cb86fe2a8ef3e0e8c36216","src/unix/linux_like/emscripten/mod.rs":"55fb89f5a965a4ad81ee4d02498c32aaed69e6047ce708c2329a602171862a76","src/unix/linux_like/emscripten/no_align.rs":"0128e4aa721a9902754828b61b5ec7d8a86619983ed1e0544a85d35b1051fad6","src/unix/linux_like/linux/align.rs":"dde648468764a5deef5566b8016290150acf50ee6a0f8c0678cb2078658bc2fa","src/unix/linux_like/linux/gnu/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/linux_like/linux/gnu/b32/arm/align.rs":"3fed009dc9af3cc81be7087da9d2d7d1f39845e4497e290259c5cdbae25f039d","src/unix/linux_like/linux/gnu/b32/arm/mod.rs":"6d9ba242111c7be8173b7a7b8cf8c863ba23d839edc9d026c0fd37a4b64460b4","src/unix/linux_like/linux/gnu/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/gnu/b32/mips/mod.rs":"e2d2e51fea73210d9705b7eaa37de8baa7152b71ae3a10a316c277345c529b5c","src/unix/linux_like/linux/gnu/b32/mod.rs":"e224551fa50be726bc8a559da32a96294b18743fb5a5b67cdbee4bb6a9eeb796","src/unix/linux_like/linux/gnu/b32/powerpc.rs":"39aae80d2c4ffa845592e16c0a6c910017de19e2b15c1e507c4df10e79ce3e38","src/unix/linux_like/linux/gnu/b32/sparc/align.rs":"21adbed27df73e2d1ed934aaf733a643003d7baf2bde9c48ea440895bcca6d41","src/unix/linux_like/linux/gnu/b32/sparc/mod.rs":"3b4dd40b288788740d2b030171b21f9d0b076ce26d88e0ff62f5d87f09e7c787","src/unix/linux_like/linux/gnu/b32/x86/align.rs":"e4bafdc4a519a7922a81b37a62bbfd1177a2f620890eef8f1fbc47162e9eb413","src/unix/linux_like/linux/gnu/b32/x86/mod.rs":"927d1bd8cb2f053549fc5acfeb1315b7f80b35d7a1904cd76e99651ff32b141e","src/unix/linux_like/linux/gnu/b64/aarch64/align.rs":"2179c3b1608fa4bf68840482bfc2b2fa3ee2faf6fcae3770f9e505cddca35c7b","src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs":"ab19209e0b6dba3e32e10db2aa3f9f87446ba60af23c363eef57ecd736bf97f8","src/unix/linux_like/linux/gnu/b64/mips64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/mips64/mod.rs":"0b5d94f3a2361742b6dd9eb3f543ddf675d3f70dab3402ad179faa6ddaae2218","src/unix/linux_like/linux/gnu/b64/mod.rs":"b90d87f76bff37707a1725551fe45d70d0c106e01b1dbbcd5f60460e0a19b4c3","src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs":"2f279eb268c0aca9a6bd9b4c84139799cd039a64ca1cd2ded68b04c63397be1b","src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs":"bb01828300f02c11c27689522454439d0d02f22d738df88a97367dc87eecf868","src/unix/linux_like/linux/gnu/b64/s390x.rs":"9c449b64b11cbf55d453b324cf9475acb3253f85cb9692f9873b777ed8978ff4","src/unix/linux_like/linux/gnu/b64/sparc64/align.rs":"e29c4868bbecfa4a6cd8a2ad06193f3bbc78a468cc1dc9df83f002f1268130d9","src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs":"a2667a09e526878683fafa02474f81fbc212d861ceeabade17b0ff4d6d49ff9d","src/unix/linux_like/linux/gnu/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs":"e6197537739cb8628cad25827081c8bf6b371c02ad4b2132b30b9ae74143b1ef","src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs":"c1862036556262f076eda2008470b8a351b9c371d70664f54387c46890e8cd18","src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs":"30f88d0fa9e7807ee4cbe89fd274061f810099567d5e68fa829277d7d27ba708","src/unix/linux_like/linux/gnu/mod.rs":"11e694e8e7287e6cb4517e7fc04d319c1b672ac35300d5d26019a578afec8f4f","src/unix/linux_like/linux/gnu/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/linux_like/linux/mod.rs":"620cce393343bbfe668ad289e0aa148b27059867b3fd4206d1fabdbf2a71faba","src/unix/linux_like/linux/musl/b32/arm/align.rs":"3e8ac052c1043764776b54c93ba4260e061df998631737a897d9d47d54f7b80c","src/unix/linux_like/linux/musl/b32/arm/mod.rs":"45062a178b382ab17341a69d027b5c83325c4e79fecf45729ba9c47b1bcdc3da","src/unix/linux_like/linux/musl/b32/hexagon.rs":"cecf5989ce577062b4b67f601ea7232da5259b2d02952ade0f5d54ff81eb8ceb","src/unix/linux_like/linux/musl/b32/mips/align.rs":"429fb5e005cb7143602d430098b6ebfb7d360685b194f333dfd587472ae954ee","src/unix/linux_like/linux/musl/b32/mips/mod.rs":"9eb0e4953be5afaa0b9e3ac54c85ed40583cfb8cc0b03264b9bc8f763a8f3254","src/unix/linux_like/linux/musl/b32/mod.rs":"8ede3985e6243882814ce91e8ce543e7edbafc0cee5932816072b6f14207a671","src/unix/linux_like/linux/musl/b32/powerpc.rs":"cf286cbf4d2076aaa82662ace2b5c333480410fa59af5cb4542d59f04da84b31","src/unix/linux_like/linux/musl/b32/x86/align.rs":"08e77fbd7435d7dec2ff56932433bece3f02e47ce810f89004a275a86d39cbe1","src/unix/linux_like/linux/musl/b32/x86/mod.rs":"9c3b6e98e7710d6c877a4e31726d36416115a58f53fc469bb173b7fe660b39e5","src/unix/linux_like/linux/musl/b64/aarch64/align.rs":"0bf138f84e5327d8339bcd4adf071a6832b516445e597552c82bbd881095e3a8","src/unix/linux_like/linux/musl/b64/aarch64/mod.rs":"7b3fb85a869e00aae3f6af9c36f82f9c70bf8c2b9cccbd931b923602846ea42c","src/unix/linux_like/linux/musl/b64/mips64.rs":"9d0158ac7a913222d0a62239ec043aa1aee73522a7a1e0e191d0642dde35c083","src/unix/linux_like/linux/musl/b64/mod.rs":"8b76e92a1505ad785d4aa0b7739e0b93647a1e81910949b49cedb6c88468be9c","src/unix/linux_like/linux/musl/b64/powerpc64.rs":"ed9b879bb9cdc526ad83815875edeb4cad4e8829086dfba2578277c265336229","src/unix/linux_like/linux/musl/b64/x86_64/align.rs":"7169d07a9fd4716f7512719aec9fda5d8bed306dc0720ffc1b21696c9951e3c6","src/unix/linux_like/linux/musl/b64/x86_64/mod.rs":"cfeb109c732ac6bc7d2be44069d3652e917a0509b8b545270b756ff2d52e27e8","src/unix/linux_like/linux/musl/mod.rs":"9df606a473029d68f472ef764cdbe327b2c0705c91c6d0f54321cab40a5ba3a9","src/unix/linux_like/linux/no_align.rs":"c81ccd1942295d423b43a55b4aa19633c2096fb93bb381a6a29acb93e85aab07","src/unix/linux_like/mod.rs":"e71bdc83a031e0008c520fa5c5ec8ae09ebc4eba7ebd3a38a28c97303f6cb974","src/unix/mod.rs":"54c29e6344f244bc2e7d84a31444bee654c96b33e326625aef9ada119e8361ad","src/unix/newlib/aarch64/mod.rs":"6a1410b26773f03f9aea335fc6b9b56abfc53f4edaf97738ab151e3de5a3ed6f","src/unix/newlib/align.rs":"28aaf87fafbc6b312622719d472d8cf65f9e5467d15339df5f73e66d8502b28a","src/unix/newlib/arm/mod.rs":"c0b9b002d76234e28744c0cbd28408227d63fdcd37570e51f49cad83895130d4","src/unix/newlib/mod.rs":"66f7edbab3e40fddf123de2620c67f1942ac6128f87d290187a7f5814e991be4","src/unix/newlib/no_align.rs":"7123dcec13604a11b7765c380ff3a4d0da19c39f4b03919de7857723c0cf1502","src/unix/newlib/xtensa/mod.rs":"a7177ae61ca7adfac50ea60198273048a705b7453cc1c3baeb4ef285dd797906","src/unix/no_align.rs":"c06e95373b9088266e0b14bba0954eef95f93fb2b01d951855e382d22de78e53","src/unix/redox/mod.rs":"89c31827cf348e9a7af387f9e708fc834d04da36cad415d3957d2faa70f2fcbe","src/unix/solarish/compat.rs":"d62a5d3b5bd6adc998cb9bb817a622ef9ec666235bb237bd0f13f8e6a94de576","src/unix/solarish/illumos.rs":"98774e3cc1140e2dafa737488b53c720dd34e5d8681d34faca729dd4e242f1d9","src/unix/solarish/mod.rs":"8a4234e9fcf8f4a64ffcf74ff0bce3e6afa7601cd824e5e9eb6c5c41f709d084","src/unix/solarish/solaris.rs":"6d2dad7087c477efc64e4723b70bc08ed301ff92bf9bcf896c475af96d32662a","src/unix/uclibc/align.rs":"a8540e1cce5913a45bc8d7422b79e86c0b12740e8a679478e0e4d863a31f8cc1","src/unix/uclibc/arm/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/uclibc/arm/mod.rs":"d67dd46bc6f417169fc6a23832bde7ccdafc5d1bcb08b10debdd82edaf75d529","src/unix/uclibc/arm/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/uclibc/mips/mips32/align.rs":"e4a3c27fe20a57b8d612c34cb05bc70646edb5cec7251957315afa53a7b9f936","src/unix/uclibc/mips/mips32/mod.rs":"a045ebc6619f540adf670b88a987abd2d6e42e440a552e8cfe9f8c77f397e873","src/unix/uclibc/mips/mips32/no_align.rs":"9cd223135de75315840ff9c3fd5441ba1cb632b96b5c85a76f8316c86653db25","src/unix/uclibc/mips/mips64/align.rs":"a7bdcb18a37a2d91e64d5fad83ea3edc78f5412adb28f77ab077dbb26dd08b2d","src/unix/uclibc/mips/mips64/mod.rs":"e3085ba56cfbc528d7c3c55065880603238c333b6047ef51c58177508a487fcd","src/unix/uclibc/mips/mips64/no_align.rs":"4a18e3875698c85229599225ac3401a2a40da87e77b2ad4ef47c6fcd5a24ed30","src/unix/uclibc/mips/mod.rs":"1054d0bfeb506b3346b9a4148564beced8a22da0d9c9a612101f6237756795fb","src/unix/uclibc/mod.rs":"f7c016df4efc030a1d86ae051724c842d14edceb907936f055509a60a6e96fe5","src/unix/uclibc/no_align.rs":"3f28637046524618adaa1012e26cb7ffe94b9396e6b518cccdc69d59f274d709","src/unix/uclibc/x86_64/align.rs":"4e34cebb7955e9c98ae2f310be6f8ed16a861fc3817c08543867554aeec9524e","src/unix/uclibc/x86_64/l4re.rs":"bb31053d6403091e11f95ac2203982f279f8b984a19adf30796878c45fdd8c25","src/unix/uclibc/x86_64/mod.rs":"188fbaf06a8e23cac72718b1ef7eb4bd98bdfd946aa708151f3f7e3553b65876","src/unix/uclibc/x86_64/no_align.rs":"2ccc0107a6007c70dc49e656095b64a352ca5d8f9f3e65c1dba634effbc15636","src/unix/uclibc/x86_64/other.rs":"42c3f71e58cabba373f6a55a623f3c31b85049eb64824c09c2b082b3b2d6a0a8","src/vxworks/aarch64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/arm.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/mod.rs":"79077f518d234baf6cb76cb742153d174b3ddd43c6eda9238ebb053e08f9f9c7","src/vxworks/powerpc.rs":"acb7968ce99fe3f4abdf39d98f8133d21a4fba435b8ef7084777cb181d788e88","src/vxworks/powerpc64.rs":"98f0afdc511cd02557e506c21fed6737585490a1dce7a9d4941d08c437762b99","src/vxworks/x86.rs":"552f007f38317620b23889cb7c49d1d115841252439060122f52f434fbc6e5ba","src/vxworks/x86_64.rs":"018d92be3ad628a129eff9f2f5dfbc0883d8b8e5f2fa917b900a7f98ed6b514a","src/wasi.rs":"3948fd2fe7458dfc5163f522da285e4bf4d7c714a6449e8bc89edca6bca54c9a","src/windows/gnu/align.rs":"b2c13ec1b9f3b39a75c452c80c951dff9d0215e31d77e883b4502afb31794647","src/windows/gnu/mod.rs":"c7ab9793baaa3b6854d25fdf44266b7953533009e4fa722ca717b71d3e5d2c9d","src/windows/mod.rs":"35e279d4bcf2f8d76f856f7b11fe7cc030000b0e35f4f1de714b2116cf614187","src/windows/msvc.rs":"2c2bfce66027d88021e7289139ebf5b0db258a7b6443f18872c84dbd4ef57131","tests/const_fn.rs":"cb75a1f0864f926aebe79118fc34d51a0d1ade2c20a394e7774c7e545f21f1f4","triagebot.toml":"a135e10c777cd13459559bdf74fb704c1379af7c9b0f70bc49fa6f5a837daa81"},"package":"9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"} \ No newline at end of file diff --git a/third_party/cargo/vendor/libc-0.2.67/BUILD b/third_party/cargo/vendor/libc-0.2.71/BUILD similarity index 97% rename from third_party/cargo/vendor/libc-0.2.67/BUILD rename to third_party/cargo/vendor/libc-0.2.71/BUILD index 631613b..c13f1e5 100644 --- a/third_party/cargo/vendor/libc-0.2.67/BUILD +++ b/third_party/cargo/vendor/libc-0.2.71/BUILD @@ -37,7 +37,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.67", + version = "0.2.71", crate_features = [ "default", "std", diff --git a/third_party/cargo/vendor/libc-0.2.67/CONTRIBUTING.md b/third_party/cargo/vendor/libc-0.2.71/CONTRIBUTING.md similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/CONTRIBUTING.md rename to third_party/cargo/vendor/libc-0.2.71/CONTRIBUTING.md diff --git a/third_party/cargo/vendor/libc-0.2.67/Cargo.toml b/third_party/cargo/vendor/libc-0.2.71/Cargo.toml similarity index 90% rename from third_party/cargo/vendor/libc-0.2.67/Cargo.toml rename to third_party/cargo/vendor/libc-0.2.71/Cargo.toml index d4fc550..841a824 100644 --- a/third_party/cargo/vendor/libc-0.2.67/Cargo.toml +++ b/third_party/cargo/vendor/libc-0.2.71/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "libc" -version = "0.2.67" +version = "0.2.71" authors = ["The Rust Project Developers"] build = "build.rs" exclude = ["/ci/*", "/azure-pipelines.yml"] @@ -36,9 +36,10 @@ extra_traits = [] rustc-dep-of-std = ["align", "rustc-std-workspace-core"] std = [] use_std = ["std"] -[badges.appveyor] -project_name = "rust-lang-libs/libc" -repository = "rust-lang/libc" +[badges.azure-devops] +pipeline = "rust-lang.libc%20(1)" +project = "rust-lang2/libc" -[badges.travis-ci] +[badges.cirrus-ci] +branch = "master" repository = "rust-lang/libc" diff --git a/third_party/cargo/vendor/libc-0.2.67/LICENSE-APACHE b/third_party/cargo/vendor/libc-0.2.71/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/LICENSE-APACHE rename to third_party/cargo/vendor/libc-0.2.71/LICENSE-APACHE diff --git a/third_party/cargo/vendor/libc-0.2.71/LICENSE-MIT b/third_party/cargo/vendor/libc-0.2.71/LICENSE-MIT new file mode 100644 index 0000000..7806181 --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2014-2020 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/third_party/cargo/vendor/libc-0.2.67/README.md b/third_party/cargo/vendor/libc-0.2.71/README.md similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/README.md rename to third_party/cargo/vendor/libc-0.2.71/README.md index 8a36881..ae2cfd8 100644 --- a/third_party/cargo/vendor/libc-0.2.67/README.md +++ b/third_party/cargo/vendor/libc-0.2.71/README.md @@ -94,7 +94,7 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. -[Azure Status]: https://dev.azure.com/rust-lang2/libc/_apis/build/status/rust-lang.libc?branchName=master +[Azure Status]: https://dev.azure.com/rust-lang2/libc/_apis/build/status/rust-lang.libc%20(1)?branchName=master [Azure]: https://dev.azure.com/rust-lang2/libc/_build/latest?definitionId=1&branchName=master [Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc [Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg diff --git a/third_party/cargo/vendor/libc-0.2.67/build.rs b/third_party/cargo/vendor/libc-0.2.71/build.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/build.rs rename to third_party/cargo/vendor/libc-0.2.71/build.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/rustfmt.toml b/third_party/cargo/vendor/libc-0.2.71/rustfmt.toml similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/rustfmt.toml rename to third_party/cargo/vendor/libc-0.2.71/rustfmt.toml diff --git a/third_party/cargo/vendor/libc-0.2.67/src/cloudabi/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/cloudabi/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/cloudabi/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/cloudabi/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/cloudabi/arm.rs b/third_party/cargo/vendor/libc-0.2.71/src/cloudabi/arm.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/cloudabi/arm.rs rename to third_party/cargo/vendor/libc-0.2.71/src/cloudabi/arm.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/cloudabi/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/cloudabi/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/cloudabi/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/cloudabi/mod.rs index b3065d7..7781712 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/cloudabi/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/cloudabi/mod.rs @@ -120,7 +120,7 @@ impl ::Clone for FILE { } } #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // TODO: fill this out with a struct +pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { @@ -259,6 +259,7 @@ extern "C" { ) -> ::size_t; pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; pub fn memcpy( dest: *mut c_void, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/cloudabi/x86.rs b/third_party/cargo/vendor/libc-0.2.71/src/cloudabi/x86.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/cloudabi/x86.rs rename to third_party/cargo/vendor/libc-0.2.71/src/cloudabi/x86.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/cloudabi/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/cloudabi/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/cloudabi/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/cloudabi/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/fixed_width_ints.rs b/third_party/cargo/vendor/libc-0.2.71/src/fixed_width_ints.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/fixed_width_ints.rs rename to third_party/cargo/vendor/libc-0.2.71/src/fixed_width_ints.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/fuchsia/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/fuchsia/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/fuchsia/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/fuchsia/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/fuchsia/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/fuchsia/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/fuchsia/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/fuchsia/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/fuchsia/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/fuchsia/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/fuchsia/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/fuchsia/mod.rs index f5e8957..4717089 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/fuchsia/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/fuchsia/mod.rs @@ -109,7 +109,7 @@ impl ::Clone for DIR { } #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // TODO: fill this out with a struct +pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { @@ -1416,7 +1416,7 @@ pub const F_SEAL_SHRINK: ::c_int = 0x0002; pub const F_SEAL_GROW: ::c_int = 0x0004; pub const F_SEAL_WRITE: ::c_int = 0x0008; -// TODO(#235): Include file sealing fcntls once we have a way to verify them. +// FIXME(#235): Include file sealing fcntls once we have a way to verify them. pub const SIGTRAP: ::c_int = 5; @@ -1433,10 +1433,8 @@ pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; pub const CLOCK_BOOTTIME: ::clockid_t = 7; pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; -// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep -// 2014.) See also musl/mod.rs -// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -// pub const CLOCK_TAI: ::clockid_t = 11; +pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; +pub const CLOCK_TAI: ::clockid_t = 11; pub const TIMER_ABSTIME: ::c_int = 1; pub const RLIMIT_CPU: ::c_int = 0; @@ -1968,6 +1966,7 @@ pub const POSIX_FADV_WILLNEED: ::c_int = 3; pub const AT_FDCWD: ::c_int = -100; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; pub const AT_REMOVEDIR: ::c_int = 0x200; +pub const AT_EACCESS: ::c_int = 0x200; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; pub const AT_EMPTY_PATH: ::c_int = 0x1000; @@ -2773,11 +2772,6 @@ pub const TIOCINQ: ::c_int = ::FIONREAD; pub const RTLD_GLOBAL: ::c_int = 0x100; pub const RTLD_NOLOAD: ::c_int = 0x4; -// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also notbsd/mod.rs -pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -pub const CLOCK_TAI: ::clockid_t = 11; - pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; @@ -3273,7 +3267,7 @@ impl ::Clone for FILE { } } #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // TODO: fill this out with a struct +pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { @@ -3401,6 +3395,7 @@ extern "C" { ) -> ::size_t; pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; pub fn memcpy( dest: *mut c_void, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/fuchsia/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/fuchsia/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/fuchsia/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/fuchsia/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/fuchsia/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/fuchsia/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/fuchsia/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/fuchsia/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/hermit/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/hermit/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/hermit/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/hermit/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/hermit/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/hermit/mod.rs similarity index 77% rename from third_party/cargo/vendor/libc-0.2.67/src/hermit/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/hermit/mod.rs index 9880b50..bffcefd 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/hermit/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/hermit/mod.rs @@ -1,13 +1,3 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // libc port for HermitCore (https://hermitcore.org) // // Ported by Colin Fink diff --git a/third_party/cargo/vendor/libc-0.2.67/src/hermit/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/hermit/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/hermit/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/hermit/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/lib.rs b/third_party/cargo/vendor/libc-0.2.71/src/lib.rs similarity index 89% rename from third_party/cargo/vendor/libc-0.2.67/src/lib.rs rename to third_party/cargo/vendor/libc-0.2.71/src/lib.rs index 0b1496a..6c4cbf7 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/lib.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/lib.rs @@ -1,12 +1,3 @@ -// Copyright 2012-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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. //! libc - Raw FFI bindings to platforms' system libraries //! //! [Documentation for other platforms][pd]. @@ -14,14 +5,17 @@ //! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation #![crate_name = "libc"] #![crate_type = "rlib"] -#![cfg_attr(libc_deny_warnings, deny(warnings))] +// FIXME: Remove this and redundant_semicolon once renamed lint reaches stable. +#![allow(renamed_and_removed_lints)] #![allow( bad_style, overflowing_literals, improper_ctypes, unknown_lints, - redundant_semicolon + redundant_semicolon, + redundant_semicolons )] +#![cfg_attr(libc_deny_warnings, deny(warnings))] // Attributes needed when building as part of the standard library #![cfg_attr( feature = "rustc-dep-of-std", @@ -45,6 +39,8 @@ cfg_if! { #[allow(unused_imports)] use core::iter; #[allow(unused_imports)] + use core::ops; + #[allow(unused_imports)] use core::option; } } @@ -121,6 +117,12 @@ cfg_if! { mod switch; pub use switch::*; + } else if #[cfg(target_os = "psp")] { + mod fixed_width_ints; + pub use fixed_width_ints::*; + + mod psp; + pub use psp::*; } else if #[cfg(target_os = "vxworks")] { mod fixed_width_ints; pub use fixed_width_ints::*; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/macros.rs b/third_party/cargo/vendor/libc-0.2.71/src/macros.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/macros.rs rename to third_party/cargo/vendor/libc-0.2.71/src/macros.rs diff --git a/third_party/cargo/vendor/libc-0.2.71/src/psp.rs b/third_party/cargo/vendor/libc-0.2.71/src/psp.rs new file mode 100644 index 0000000..4b3ec9b --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/src/psp.rs @@ -0,0 +1,47 @@ +//! PSP C type definitions + +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_float = f32; +pub type c_double = f64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; + +pub type size_t = usize; +pub type ptrdiff_t = isize; +pub type intptr_t = isize; +pub type uintptr_t = usize; +pub type ssize_t = isize; + +pub type c_char = u8; +pub type c_long = i64; +pub type c_ulong = u64; + +pub const INT_MIN: c_int = -2147483648; +pub const INT_MAX: c_int = 2147483647; + +cfg_if! { + if #[cfg(libc_core_cvoid)] { + pub use ::ffi::c_void; + } else { + // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help + // enable more optimization opportunities around it recognizing things + // like malloc/free. + #[repr(u8)] + #[allow(missing_copy_implementations)] + #[allow(missing_debug_implementations)] + pub enum c_void { + // Two dummy variants so the #[repr] attribute can be used. + #[doc(hidden)] + __variant1, + #[doc(hidden)] + __variant2, + } + } +} diff --git a/third_party/cargo/vendor/libc-0.2.67/src/sgx.rs b/third_party/cargo/vendor/libc-0.2.71/src/sgx.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/sgx.rs rename to third_party/cargo/vendor/libc-0.2.71/src/sgx.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/switch.rs b/third_party/cargo/vendor/libc-0.2.71/src/switch.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/switch.rs rename to third_party/cargo/vendor/libc-0.2.71/src/switch.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b32/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b32/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b32/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b32/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b32/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b32/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b32/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b32/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b64/mod.rs similarity index 51% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b64/mod.rs index 7f70083..0651741 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/b64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/b64/mod.rs @@ -3,6 +3,7 @@ pub type c_long = i64; pub type c_ulong = u64; pub type boolean_t = ::c_uint; +pub type mcontext_t = *mut __darwin_mcontext64; s! { pub struct timeval32 { @@ -48,6 +49,107 @@ s! { pub bh_datalen: u32, pub bh_hdrlen: ::c_ushort, } + + pub struct ucontext_t { + pub uc_onstack: ::c_int, + pub uc_sigmask: ::sigset_t, + pub uc_stack: ::stack_t, + pub uc_link: *mut ::ucontext_t, + pub uc_mcsize: usize, + pub uc_mcontext: mcontext_t, + } + + pub struct __darwin_mcontext64 { + pub __es: __darwin_x86_exception_state64, + pub __ss: __darwin_x86_thread_state64, + pub __fs: __darwin_x86_float_state64, + } + + pub struct __darwin_x86_exception_state64 { + pub __trapno: u16, + pub __cpu: u16, + pub __err: u32, + pub __faultvaddr: u64, + } + + pub struct __darwin_x86_thread_state64 { + pub __rax: u64, + pub __rbx: u64, + pub __rcx: u64, + pub __rdx: u64, + pub __rdi: u64, + pub __rsi: u64, + pub __rbp: u64, + pub __rsp: u64, + pub __r8: u64, + pub __r9: u64, + pub __r10: u64, + pub __r11: u64, + pub __r12: u64, + pub __r13: u64, + pub __r14: u64, + pub __r15: u64, + pub __rip: u64, + pub __rflags: u64, + pub __cs: u64, + pub __fs: u64, + pub __gs: u64, + } + + pub struct __darwin_x86_float_state64 { + pub __fpu_reserved: [::c_int; 2], + __fpu_fcw: ::c_short, + __fpu_fsw: ::c_short, + pub __fpu_ftw: u8, + pub __fpu_rsrv1: u8, + pub __fpu_fop: u16, + pub __fpu_ip: u32, + pub __fpu_cs: u16, + pub __fpu_rsrv2: u16, + pub __fpu_dp: u32, + pub __fpu_ds: u16, + pub __fpu_rsrv3: u16, + pub __fpu_mxcsr: u32, + pub __fpu_mxcsrmask: u32, + pub __fpu_stmm0: __darwin_mmst_reg, + pub __fpu_stmm1: __darwin_mmst_reg, + pub __fpu_stmm2: __darwin_mmst_reg, + pub __fpu_stmm3: __darwin_mmst_reg, + pub __fpu_stmm4: __darwin_mmst_reg, + pub __fpu_stmm5: __darwin_mmst_reg, + pub __fpu_stmm6: __darwin_mmst_reg, + pub __fpu_stmm7: __darwin_mmst_reg, + pub __fpu_xmm0: __darwin_xmm_reg, + pub __fpu_xmm1: __darwin_xmm_reg, + pub __fpu_xmm2: __darwin_xmm_reg, + pub __fpu_xmm3: __darwin_xmm_reg, + pub __fpu_xmm4: __darwin_xmm_reg, + pub __fpu_xmm5: __darwin_xmm_reg, + pub __fpu_xmm6: __darwin_xmm_reg, + pub __fpu_xmm7: __darwin_xmm_reg, + pub __fpu_xmm8: __darwin_xmm_reg, + pub __fpu_xmm9: __darwin_xmm_reg, + pub __fpu_xmm10: __darwin_xmm_reg, + pub __fpu_xmm11: __darwin_xmm_reg, + pub __fpu_xmm12: __darwin_xmm_reg, + pub __fpu_xmm13: __darwin_xmm_reg, + pub __fpu_xmm14: __darwin_xmm_reg, + pub __fpu_xmm15: __darwin_xmm_reg, + // this field is actually [u8; 96], but defining it with a bigger type + // allows us to auto-implement traits for it since the length of the + // array is less than 32 + __fpu_rsrv4: [u32; 24], + pub __fpu_reserved1: ::c_int, + } + + pub struct __darwin_mmst_reg { + pub __mmst_reg: [::c_char; 10], + pub __mmst_rsrv: [::c_char; 6], + } + + pub struct __darwin_xmm_reg { + pub __xmm_reg: [::c_char; 16], + } } s_no_extra_traits! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/mod.rs similarity index 95% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/mod.rs index 98208f8..c03c644 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/apple/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/apple/mod.rs @@ -31,6 +31,9 @@ pub type posix_spawn_file_actions_t = *mut ::c_void; pub type key_t = ::c_int; pub type shmatt_t = ::c_ushort; +pub type sae_associd_t = u32; +pub type sae_connid_t = u32; + deprecated_mach! { pub type vm_prot_t = ::c_int; pub type vm_size_t = ::uintptr_t; @@ -493,6 +496,44 @@ s! { pub struct in_addr { pub s_addr: ::in_addr_t, } + + // sys/socket.h + + pub struct sa_endpoints_t { + pub sae_srcif: ::c_uint, // optional source interface + pub sae_srcaddr: *const ::sockaddr, // optional source address + pub sae_srcaddrlen: ::socklen_t, // size of source address + pub sae_dstaddr: *const ::sockaddr, // destination address + pub sae_dstaddrlen: ::socklen_t, // size of destination address + } + + pub struct timex { + pub modes: ::c_uint, + pub offset: ::c_long, + pub freq: ::c_long, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub status: ::c_int, + pub constant: ::c_long, + pub precision: ::c_long, + pub tolerance: ::c_long, + pub ppsfreq: ::c_long, + pub jitter: ::c_long, + pub shift: ::c_int, + pub stabil: ::c_long, + pub jitcnt: ::c_long, + pub calcnt: ::c_long, + pub errcnt: ::c_long, + pub stbcnt: ::c_long, + } + + pub struct ntptimeval { + pub time: ::timespec, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub tai: ::c_long, + pub time_state: ::c_int, + } } s_no_extra_traits! { @@ -1719,8 +1760,6 @@ pub const TIOCGETD: ::c_ulong = 0x4004741a; pub const TIOCSETD: ::c_ulong = 0x8004741b; pub const TIOCIXON: ::c_uint = 0x20007481; pub const TIOCIXOFF: ::c_uint = 0x20007480; -pub const TIOCSBRK: ::c_uint = 0x2000747b; -pub const TIOCCBRK: ::c_uint = 0x2000747a; pub const TIOCSDTR: ::c_uint = 0x20007479; pub const TIOCCDTR: ::c_uint = 0x20007478; pub const TIOCGPGRP: ::c_ulong = 0x40047477; @@ -2208,14 +2247,20 @@ pub const IP_PKTINFO: ::c_int = 26; pub const IP_RECVTOS: ::c_int = 27; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; +pub const IPV6_CHECKSUM: ::c_int = 26; pub const IPV6_RECVTCLASS: ::c_int = 35; pub const IPV6_TCLASS: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; +pub const IPV6_HOPLIMIT: ::c_int = 47; pub const IPV6_RECVPKTINFO: ::c_int = 61; pub const TCP_NOPUSH: ::c_int = 4; pub const TCP_NOOPT: ::c_int = 8; pub const TCP_KEEPALIVE: ::c_int = 0x10; +pub const TCP_KEEPINTVL: ::c_int = 0x101; +pub const TCP_KEEPCNT: ::c_int = 0x102; +/// Enable/Disable TCP Fastopen on this socket +pub const TCP_FASTOPEN: ::c_int = 0x105; pub const SOL_LOCAL: ::c_int = 0; @@ -2304,6 +2349,23 @@ pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; +pub const SAE_ASSOCID_ANY: ::sae_associd_t = 0; +/// ((sae_associd_t)(-1ULL)) +pub const SAE_ASSOCID_ALL: ::sae_associd_t = 0xffffffff; + +pub const SAE_CONNID_ANY: ::sae_connid_t = 0; +/// ((sae_connid_t)(-1ULL)) +pub const SAE_CONNID_ALL: ::sae_connid_t = 0xffffffff; + +// connectx() flag parameters + +/// resume connect() on read/write +pub const CONNECT_RESUME_ON_READ_WRITE: ::c_uint = 0x1; +/// data is idempotent +pub const CONNECT_DATA_IDEMPOTENT: ::c_uint = 0x2; +/// data includes security that replaces the TFO-cookie +pub const CONNECT_DATA_AUTHENTICATED: ::c_uint = 0x4; + pub const LOCK_SH: ::c_int = 1; pub const LOCK_EX: ::c_int = 2; pub const LOCK_NB: ::c_int = 4; @@ -2438,6 +2500,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { __opaque: [0; __PTHREAD_RWLOCK_SIZE__], }; +pub const MINSIGSTKSZ: ::size_t = 32768; pub const SIGSTKSZ: ::size_t = 131072; pub const FD_SETSIZE: usize = 1024; @@ -2976,6 +3039,43 @@ pub const DLT_LOOP: ::c_uint = 108; // sizeof(i32) pub const BPF_ALIGNMENT: ::c_int = 4; +// sys/mount.h +pub const MNT_RDONLY: ::c_int = 0x00000001; +pub const MNT_SYNCHRONOUS: ::c_int = 0x00000002; +pub const MNT_NOEXEC: ::c_int = 0x00000004; +pub const MNT_NOSUID: ::c_int = 0x00000008; +pub const MNT_NODEV: ::c_int = 0x00000010; +pub const MNT_UNION: ::c_int = 0x00000020; +pub const MNT_ASYNC: ::c_int = 0x00000040; +pub const MNT_CPROTECT: ::c_int = 0x00000080; + +// NFS export related mount flags. +pub const MNT_EXPORTED: ::c_int = 0x00000100; + +// MAC labeled / "quarantined" flag +pub const MNT_QUARANTINE: ::c_int = 0x00000400; + +// Flags set by internal operations. +pub const MNT_LOCAL: ::c_int = 0x00001000; +pub const MNT_QUOTA: ::c_int = 0x00002000; +pub const MNT_ROOTFS: ::c_int = 0x00004000; +pub const MNT_DOVOLFS: ::c_int = 0x00008000; + +pub const MNT_DONTBROWSE: ::c_int = 0x00100000; +pub const MNT_IGNORE_OWNERSHIP: ::c_int = 0x00200000; +pub const MNT_AUTOMOUNTED: ::c_int = 0x00400000; +pub const MNT_JOURNALED: ::c_int = 0x00800000; +pub const MNT_NOUSERXATTR: ::c_int = 0x01000000; +pub const MNT_DEFWRITE: ::c_int = 0x02000000; +pub const MNT_MULTILABEL: ::c_int = 0x04000000; +pub const MNT_NOATIME: ::c_int = 0x10000000; +pub const MNT_SNAPSHOT: ::c_int = 0x40000000; + +// External filesystem command modifier flags. +pub const MNT_UPDATE: ::c_int = 0x00010000; +pub const MNT_NOBLOCK: ::c_int = 0x00020000; +pub const MNT_RELOAD: ::c_int = 0x00040000; + // sys/spawn.h: pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; @@ -3031,6 +3131,58 @@ pub const SF_IMMUTABLE: ::c_uint = 0x00020000; pub const SF_APPEND: ::c_uint = 0x00040000; pub const UF_HIDDEN: ::c_uint = 0x00008000; +// +pub const NTP_API: ::c_int = 4; +pub const MAXPHASE: ::c_long = 500000000; +pub const MAXFREQ: ::c_long = 500000; +pub const MINSEC: ::c_int = 256; +pub const MAXSEC: ::c_int = 2048; +pub const NANOSECOND: ::c_long = 1000000000; +pub const SCALE_PPM: ::c_int = 65; +pub const MAXTC: ::c_int = 10; +pub const MOD_OFFSET: ::c_uint = 0x0001; +pub const MOD_FREQUENCY: ::c_uint = 0x0002; +pub const MOD_MAXERROR: ::c_uint = 0x0004; +pub const MOD_ESTERROR: ::c_uint = 0x0008; +pub const MOD_STATUS: ::c_uint = 0x0010; +pub const MOD_TIMECONST: ::c_uint = 0x0020; +pub const MOD_PPSMAX: ::c_uint = 0x0040; +pub const MOD_TAI: ::c_uint = 0x0080; +pub const MOD_MICRO: ::c_uint = 0x1000; +pub const MOD_NANO: ::c_uint = 0x2000; +pub const MOD_CLKB: ::c_uint = 0x4000; +pub const MOD_CLKA: ::c_uint = 0x8000; +pub const STA_PLL: ::c_int = 0x0001; +pub const STA_PPSFREQ: ::c_int = 0x0002; +pub const STA_PPSTIME: ::c_int = 0x0004; +pub const STA_FLL: ::c_int = 0x0008; +pub const STA_INS: ::c_int = 0x0010; +pub const STA_DEL: ::c_int = 0x0020; +pub const STA_UNSYNC: ::c_int = 0x0040; +pub const STA_FREQHOLD: ::c_int = 0x0080; +pub const STA_PPSSIGNAL: ::c_int = 0x0100; +pub const STA_PPSJITTER: ::c_int = 0x0200; +pub const STA_PPSWANDER: ::c_int = 0x0400; +pub const STA_PPSERROR: ::c_int = 0x0800; +pub const STA_CLOCKERR: ::c_int = 0x1000; +pub const STA_NANO: ::c_int = 0x2000; +pub const STA_MODE: ::c_int = 0x4000; +pub const STA_CLK: ::c_int = 0x8000; +pub const STA_RONLY: ::c_int = STA_PPSSIGNAL + | STA_PPSJITTER + | STA_PPSWANDER + | STA_PPSERROR + | STA_CLOCKERR + | STA_NANO + | STA_MODE + | STA_CLK; +pub const TIME_OK: ::c_int = 0; +pub const TIME_INS: ::c_int = 1; +pub const TIME_DEL: ::c_int = 2; +pub const TIME_OOP: ::c_int = 3; +pub const TIME_WAIT: ::c_int = 4; +pub const TIME_ERROR: ::c_int = 5; + cfg_if! { if #[cfg(libc_const_size_of)] { fn __DARWIN_ALIGN32(p: usize) -> usize { @@ -3528,6 +3680,25 @@ extern "C" { newfd: ::c_int, ) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; + + pub fn connectx( + socket: ::c_int, + endpoints: *const sa_endpoints_t, + associd: sae_associd_t, + flags: ::c_uint, + iov: *const ::iovec, + iovcnt: ::c_uint, + len: *mut ::size_t, + connid: *mut sae_connid_t, + ) -> ::c_int; + pub fn disconnectx( + socket: ::c_int, + associd: sae_associd_t, + connid: sae_connid_t, + ) -> ::c_int; + + pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; + pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; } cfg_if! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/dragonfly/errno.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/dragonfly/errno.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/dragonfly/errno.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/dragonfly/errno.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/dragonfly/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/dragonfly/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/dragonfly/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/arm.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/arm.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/arm.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/arm.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/mod.rs index 1b714b7..db36184 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -107,6 +107,15 @@ s! { pub msg_hdr: ::msghdr, pub msg_len: ::ssize_t, } + + pub struct sockcred { + pub sc_uid: ::uid_t, + pub sc_euid: ::uid_t, + pub sc_gid: ::gid_t, + pub sc_egid: ::gid_t, + pub sc_ngroups: ::c_int, + pub sc_groups: [::gid_t; 1], + } } s_no_extra_traits! { @@ -340,6 +349,13 @@ pub const RLIMIT_UMTXP: ::c_int = 14; #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::rlim_t = 15; +pub const NI_NOFQDN: ::c_int = 0x00000001; +pub const NI_NUMERICHOST: ::c_int = 0x00000002; +pub const NI_NAMEREQD: ::c_int = 0x00000004; +pub const NI_NUMERICSERV: ::c_int = 0x00000008; +pub const NI_DGRAM: ::c_int = 0x00000010; +pub const NI_NUMERICSCOPE: ::c_int = 0x00000020; + pub const Q_GETQUOTA: ::c_int = 0x700; pub const Q_SETQUOTA: ::c_int = 0x800; @@ -1136,6 +1152,15 @@ f! { as ::c_uint } + pub fn SOCKCREDSIZE(ngrps: usize) -> usize { + let ngrps = if ngrps > 0 { + ngrps - 1 + } else { + 0 + }; + ::mem::size_of::() + ::mem::size_of::<::gid_t>() * ngrps + } + pub fn uname(buf: *mut ::utsname) -> ::c_int { __xuname(256, buf as *mut ::c_void) } diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/x86.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/x86.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/x86.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/x86.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/mod.rs similarity index 94% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/mod.rs index 1b7804c..44457c3 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/freebsdlike/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/freebsdlike/mod.rs @@ -190,6 +190,34 @@ s! { pub ar_pln: u8, pub ar_op: u16, } + + pub struct timex { + pub modes: ::c_uint, + pub offset: ::c_long, + pub freq: ::c_long, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub status: ::c_int, + pub constant: ::c_long, + pub precision: ::c_long, + pub tolerance: ::c_long, + pub ppsfreq: ::c_long, + pub jitter: ::c_long, + pub shift: ::c_int, + pub stabil: ::c_long, + pub jitcnt: ::c_long, + pub calcnt: ::c_long, + pub errcnt: ::c_long, + pub stbcnt: ::c_long, + } + + pub struct ntptimeval { + pub time: ::timespec, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub tai: ::c_long, + pub time_state: ::c_int, + } } s_no_extra_traits! { @@ -710,6 +738,7 @@ pub const MSG_DONTWAIT: ::c_int = 0x00000080; pub const MSG_EOF: ::c_int = 0x00000100; pub const SCM_TIMESTAMP: ::c_int = 0x02; +pub const SCM_CREDS: ::c_int = 0x03; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; @@ -728,8 +757,10 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 13; pub const IP_RECVIF: ::c_int = 20; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; +pub const IPV6_CHECKSUM: ::c_int = 26; pub const IPV6_RECVPKTINFO: ::c_int = 36; pub const IPV6_PKTINFO: ::c_int = 46; +pub const IPV6_HOPLIMIT: ::c_int = 47; pub const IPV6_RECVTCLASS: ::c_int = 57; pub const IPV6_TCLASS: ::c_int = 61; @@ -1014,8 +1045,6 @@ pub const TIOCSPGRP: ::c_ulong = 0x80047476; pub const TIOCGPGRP: ::c_uint = 0x40047477; pub const TIOCCDTR: ::c_uint = 0x20007478; pub const TIOCSDTR: ::c_uint = 0x20007479; -pub const TIOCCBRK: ::c_uint = 0x2000747a; -pub const TIOCSBRK: ::c_uint = 0x2000747b; pub const TTYDISC: ::c_int = 0x0; pub const SLIPDISC: ::c_int = 0x4; pub const PPPDISC: ::c_int = 0x5; @@ -1101,6 +1130,61 @@ pub const SF_NOUNLINK: ::c_ulong = 0x00100000; pub const TIMER_ABSTIME: ::c_int = 1; +// +pub const NTP_API: ::c_int = 4; +pub const MAXPHASE: ::c_long = 500000000; +pub const MAXFREQ: ::c_long = 500000; +pub const MINSEC: ::c_int = 256; +pub const MAXSEC: ::c_int = 2048; +pub const NANOSECOND: ::c_long = 1000000000; +pub const SCALE_PPM: ::c_int = 65; +pub const MAXTC: ::c_int = 10; +pub const MOD_OFFSET: ::c_uint = 0x0001; +pub const MOD_FREQUENCY: ::c_uint = 0x0002; +pub const MOD_MAXERROR: ::c_uint = 0x0004; +pub const MOD_ESTERROR: ::c_uint = 0x0008; +pub const MOD_STATUS: ::c_uint = 0x0010; +pub const MOD_TIMECONST: ::c_uint = 0x0020; +pub const MOD_PPSMAX: ::c_uint = 0x0040; +pub const MOD_TAI: ::c_uint = 0x0080; +pub const MOD_MICRO: ::c_uint = 0x1000; +pub const MOD_NANO: ::c_uint = 0x2000; +pub const MOD_CLKB: ::c_uint = 0x4000; +pub const MOD_CLKA: ::c_uint = 0x8000; +pub const STA_PLL: ::c_int = 0x0001; +pub const STA_PPSFREQ: ::c_int = 0x0002; +pub const STA_PPSTIME: ::c_int = 0x0004; +pub const STA_FLL: ::c_int = 0x0008; +pub const STA_INS: ::c_int = 0x0010; +pub const STA_DEL: ::c_int = 0x0020; +pub const STA_UNSYNC: ::c_int = 0x0040; +pub const STA_FREQHOLD: ::c_int = 0x0080; +pub const STA_PPSSIGNAL: ::c_int = 0x0100; +pub const STA_PPSJITTER: ::c_int = 0x0200; +pub const STA_PPSWANDER: ::c_int = 0x0400; +pub const STA_PPSERROR: ::c_int = 0x0800; +pub const STA_CLOCKERR: ::c_int = 0x1000; +pub const STA_NANO: ::c_int = 0x2000; +pub const STA_MODE: ::c_int = 0x4000; +pub const STA_CLK: ::c_int = 0x8000; +pub const STA_RONLY: ::c_int = STA_PPSSIGNAL + | STA_PPSJITTER + | STA_PPSWANDER + | STA_PPSERROR + | STA_CLOCKERR + | STA_NANO + | STA_MODE + | STA_CLK; +pub const TIME_OK: ::c_int = 0; +pub const TIME_INS: ::c_int = 1; +pub const TIME_DEL: ::c_int = 2; +pub const TIME_OOP: ::c_int = 3; +pub const TIME_WAIT: ::c_int = 4; +pub const TIME_ERROR: ::c_int = 5; + +pub const REG_ENOSYS: ::c_int = -1; +pub const REG_ILLSEQ: ::c_int = 17; + f! { pub fn WIFCONTINUED(status: ::c_int) -> bool { status == 0x13 @@ -1165,7 +1249,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] pub fn getpwent_r( pwd: *mut ::passwd, buf: *mut ::c_char, @@ -1433,6 +1516,9 @@ extern "C" { times: *const ::timespec, flag: ::c_int, ) -> ::c_int; + + pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; + pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; } #[link(name = "util")] diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/mod.rs similarity index 90% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/mod.rs index cf9f59e..a70c1d9 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/mod.rs @@ -6,6 +6,7 @@ pub type socklen_t = u32; pub type sa_family_t = u8; pub type pthread_t = ::uintptr_t; pub type nfds_t = ::c_uint; +pub type regoff_t = off_t; s! { pub struct sockaddr { @@ -101,6 +102,18 @@ s! { pub if_index: ::c_uint, pub if_name: *mut ::c_char, } + + pub struct regex_t { + __re_magic: ::c_int, + __re_nsub: ::size_t, + __re_endp: *const ::c_char, + __re_g: *mut ::c_void, + } + + pub struct regmatch_t { + pub rm_so: regoff_t, + pub rm_eo: regoff_t, + } } s_no_extra_traits! { @@ -450,6 +463,48 @@ pub const BIOCGHDRCMPLT: ::c_ulong = 0x40044274; pub const BIOCSHDRCMPLT: ::c_ulong = 0x80044275; pub const SIOCGIFADDR: ::c_ulong = 0xc0206921; +pub const REG_BASIC: ::c_int = 0o0000; +pub const REG_EXTENDED: ::c_int = 0o0001; +pub const REG_ICASE: ::c_int = 0o0002; +pub const REG_NOSUB: ::c_int = 0o0004; +pub const REG_NEWLINE: ::c_int = 0o0010; +pub const REG_NOSPEC: ::c_int = 0o0020; +pub const REG_PEND: ::c_int = 0o0040; +pub const REG_DUMP: ::c_int = 0o0200; + +pub const REG_NOMATCH: ::c_int = 1; +pub const REG_BADPAT: ::c_int = 2; +pub const REG_ECOLLATE: ::c_int = 3; +pub const REG_ECTYPE: ::c_int = 4; +pub const REG_EESCAPE: ::c_int = 5; +pub const REG_ESUBREG: ::c_int = 6; +pub const REG_EBRACK: ::c_int = 7; +pub const REG_EPAREN: ::c_int = 8; +pub const REG_EBRACE: ::c_int = 9; +pub const REG_BADBR: ::c_int = 10; +pub const REG_ERANGE: ::c_int = 11; +pub const REG_ESPACE: ::c_int = 12; +pub const REG_BADRPT: ::c_int = 13; +pub const REG_EMPTY: ::c_int = 14; +pub const REG_ASSERT: ::c_int = 15; +pub const REG_INVARG: ::c_int = 16; +pub const REG_ATOI: ::c_int = 255; +pub const REG_ITOA: ::c_int = 0o0400; + +pub const REG_NOTBOL: ::c_int = 0o00001; +pub const REG_NOTEOL: ::c_int = 0o00002; +pub const REG_STARTEND: ::c_int = 0o00004; +pub const REG_TRACE: ::c_int = 0o00400; +pub const REG_LARGE: ::c_int = 0o01000; +pub const REG_BACKR: ::c_int = 0o02000; + +pub const TIOCCBRK: ::c_uint = 0x2000747a; +pub const TIOCSBRK: ::c_uint = 0x2000747b; + +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr { if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() { @@ -686,7 +741,6 @@ extern "C" { ) -> ::ssize_t; pub fn sync(); - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -702,7 +756,6 @@ extern "C" { pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, @@ -729,7 +782,6 @@ extern "C" { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, @@ -738,7 +790,6 @@ extern "C" { result: *mut *mut passwd, ) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -750,7 +801,6 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "sigwait$UNIX2003" )] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, @@ -776,6 +826,43 @@ extern "C" { value: *mut ::c_void, ) -> ::c_int; pub fn acct(filename: *const ::c_char) -> ::c_int; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "wait4$UNIX2003" + )] + #[cfg_attr( + all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)), + link_name = "wait4@FBSD_1.0" + )] + pub fn wait4( + pid: ::pid_t, + status: *mut ::c_int, + options: ::c_int, + rusage: *mut ::rusage, + ) -> ::pid_t; + + pub fn regcomp( + preg: *mut regex_t, + pattern: *const ::c_char, + cflags: ::c_int, + ) -> ::c_int; + + pub fn regexec( + preg: *const regex_t, + input: *const ::c_char, + nmatch: ::size_t, + pmatch: *mut regmatch_t, + eflags: ::c_int, + ) -> ::c_int; + + pub fn regerror( + errcode: ::c_int, + preg: *const regex_t, + errbuf: *mut ::c_char, + errbuf_size: ::size_t, + ) -> ::size_t; + + pub fn regfree(preg: *mut regex_t); } cfg_if! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/mod.rs index 970cb23..976b95c 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/mod.rs @@ -632,6 +632,12 @@ extern "C" { ) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + pub fn accept4( + s: ::c_int, + addr: *mut ::sockaddr, + addrlen: *mut ::socklen_t, + flags: ::c_int, + ) -> ::c_int; pub fn mincore( addr: *mut ::c_void, len: ::size_t, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/arm.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/arm.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/arm.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/arm.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/mod.rs similarity index 96% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/mod.rs index 48c9038..8b3ce3e 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -312,6 +312,35 @@ s! { pub ll_host: [::c_char; UT_HOSTSIZE], pub ll_time: ::time_t } + + pub struct timex { + pub modes: ::c_uint, + pub offset: ::c_long, + pub freq: ::c_long, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub status: ::c_int, + pub constant: ::c_long, + pub precision: ::c_long, + pub tolerance: ::c_long, + pub ppsfreq: ::c_long, + pub jitter: ::c_long, + pub shift: ::c_int, + pub stabil: ::c_long, + pub jitcnt: ::c_long, + pub calcnt: ::c_long, + pub errcnt: ::c_long, + pub stbcnt: ::c_long, + } + + pub struct ntptimeval { + pub time: ::timespec, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub tai: ::c_long, + pub time_state: ::c_int, + } + } s_no_extra_traits! { @@ -1233,6 +1262,58 @@ pub const BIOCSDLT: ::c_ulong = 0x80044278; pub const BIOCGSEESENT: ::c_ulong = 0x40044276; pub const BIOCSSEESENT: ::c_ulong = 0x80044277; +// +pub const NTP_API: ::c_int = 4; +pub const MAXPHASE: ::c_long = 500000000; +pub const MAXFREQ: ::c_long = 500000; +pub const MINSEC: ::c_int = 256; +pub const MAXSEC: ::c_int = 2048; +pub const NANOSECOND: ::c_long = 1000000000; +pub const SCALE_PPM: ::c_int = 65; +pub const MAXTC: ::c_int = 10; +pub const MOD_OFFSET: ::c_uint = 0x0001; +pub const MOD_FREQUENCY: ::c_uint = 0x0002; +pub const MOD_MAXERROR: ::c_uint = 0x0004; +pub const MOD_ESTERROR: ::c_uint = 0x0008; +pub const MOD_STATUS: ::c_uint = 0x0010; +pub const MOD_TIMECONST: ::c_uint = 0x0020; +pub const MOD_PPSMAX: ::c_uint = 0x0040; +pub const MOD_TAI: ::c_uint = 0x0080; +pub const MOD_MICRO: ::c_uint = 0x1000; +pub const MOD_NANO: ::c_uint = 0x2000; +pub const MOD_CLKB: ::c_uint = 0x4000; +pub const MOD_CLKA: ::c_uint = 0x8000; +pub const STA_PLL: ::c_int = 0x0001; +pub const STA_PPSFREQ: ::c_int = 0x0002; +pub const STA_PPSTIME: ::c_int = 0x0004; +pub const STA_FLL: ::c_int = 0x0008; +pub const STA_INS: ::c_int = 0x0010; +pub const STA_DEL: ::c_int = 0x0020; +pub const STA_UNSYNC: ::c_int = 0x0040; +pub const STA_FREQHOLD: ::c_int = 0x0080; +pub const STA_PPSSIGNAL: ::c_int = 0x0100; +pub const STA_PPSJITTER: ::c_int = 0x0200; +pub const STA_PPSWANDER: ::c_int = 0x0400; +pub const STA_PPSERROR: ::c_int = 0x0800; +pub const STA_CLOCKERR: ::c_int = 0x1000; +pub const STA_NANO: ::c_int = 0x2000; +pub const STA_MODE: ::c_int = 0x4000; +pub const STA_CLK: ::c_int = 0x8000; +pub const STA_RONLY: ::c_int = STA_PPSSIGNAL + | STA_PPSJITTER + | STA_PPSWANDER + | STA_PPSERROR + | STA_CLOCKERR + | STA_NANO + | STA_MODE + | STA_CLK; +pub const TIME_OK: ::c_int = 0; +pub const TIME_INS: ::c_int = 1; +pub const TIME_DEL: ::c_int = 2; +pub const TIME_OOP: ::c_int = 3; +pub const TIME_WAIT: ::c_int = 4; +pub const TIME_ERROR: ::c_int = 5; + cfg_if! { if #[cfg(any(target_arch = "sparc", target_arch = "sparc64", target_arch = "x86", target_arch = "x86_64"))] { @@ -1565,6 +1646,8 @@ pub const FIBMAP: ::c_ulong = 0xc008667a; pub const SIGSTKSZ: ::size_t = 40960; +pub const REG_ENOSYS: ::c_int = 17; + pub const PT_DUMPCORE: ::c_int = 12; pub const PT_LWPINFO: ::c_int = 13; pub const PT_SYSCALL: ::c_int = 14; @@ -1649,6 +1732,11 @@ f! { } } +extern "C" { + pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; + pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; +} + #[link(name = "rt")] extern "C" { pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/powerpc.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/powerpc.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/powerpc.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/powerpc.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/sparc64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/sparc64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/sparc64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/sparc64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/x86.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/x86.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/x86.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/x86.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/netbsd/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/netbsd/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/mod.rs index 8e1bfcb..47a5585 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1150,12 +1150,14 @@ pub const KERN_NTHREADS: ::c_int = 26; pub const KERN_OSVERSION: ::c_int = 27; pub const KERN_SOMAXCONN: ::c_int = 28; pub const KERN_SOMINCONN: ::c_int = 29; +#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] pub const KERN_USERMOUNT: ::c_int = 30; pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; pub const KERN_FSYNC: ::c_int = 33; pub const KERN_SYSVMSG: ::c_int = 34; pub const KERN_SYSVSEM: ::c_int = 35; pub const KERN_SYSVSHM: ::c_int = 36; +#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] pub const KERN_ARND: ::c_int = 37; pub const KERN_MSGBUFSIZE: ::c_int = 38; pub const KERN_MALLOCSTATS: ::c_int = 39; @@ -1393,12 +1395,6 @@ extern "C" { tp: *const ::timeval, tz: *const ::timezone, ) -> ::c_int; - pub fn accept4( - s: ::c_int, - addr: *mut ::sockaddr, - addrlen: *mut ::socklen_t, - flags: ::c_int, - ) -> ::c_int; pub fn execvpe( file: *const ::c_char, argv: *const *const ::c_char, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/sparc64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/sparc64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/sparc64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/sparc64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/x86.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/x86.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/x86.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/x86.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/bsd/netbsdlike/openbsd/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/bsd/netbsdlike/openbsd/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/b32.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/b32.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/b32.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/b32.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/b64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/b64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/b64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/b64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/mod.rs similarity index 97% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/mod.rs index 5cbbfe9..e7b104e 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/haiku/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/haiku/mod.rs @@ -662,7 +662,7 @@ pub const LC_NUMERIC: ::c_int = 4; pub const LC_TIME: ::c_int = 5; pub const LC_MESSAGES: ::c_int = 6; -// TODO: Haiku does not have MAP_FILE, but libstd/os.rs requires it +// FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it pub const MAP_FILE: ::c_int = 0x00; pub const MAP_SHARED: ::c_int = 0x01; pub const MAP_PRIVATE: ::c_int = 0x02; @@ -790,7 +790,7 @@ pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000; pub const IFF_CONFIGURING: ::c_int = 0x4000; pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast -pub const AF_UNSEC: ::c_int = 0; +pub const AF_UNSPEC: ::c_int = 0; pub const AF_INET: ::c_int = 1; pub const AF_APPLETALK: ::c_int = 2; pub const AF_ROUTE: ::c_int = 3; @@ -994,7 +994,7 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3; -pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku! +pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku! pub const RUSAGE_CHILDREN: ::c_int = -1; @@ -1206,6 +1206,10 @@ pub const TIOCCBRK: ::c_int = TCGETA + 21; pub const TIOCMBIS: ::c_int = TCGETA + 22; pub const TIOCMBIC: ::c_int = TCGETA + 23; +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; @@ -1270,6 +1274,13 @@ f! { extern "C" { pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; + pub fn utimensat( + fd: ::c_int, + path: *const ::c_char, + times: *const ::timespec, + flag: ::c_int, + ) -> ::c_int; + pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; pub fn strerror_r( errnum: ::c_int, buf: *mut c_char, @@ -1394,7 +1405,6 @@ extern "C" { addrlen: *mut ::socklen_t, ) -> ::ssize_t; pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; - pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int; pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; @@ -1430,7 +1440,6 @@ extern "C" { argv: *const *const ::c_char, environment: *const *const ::c_char, ) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -1438,15 +1447,9 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003" - )] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, @@ -1454,10 +1457,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003" - )] pub fn pthread_sigmask( how: ::c_int, set: *const sigset_t, @@ -1468,8 +1467,6 @@ extern "C" { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, @@ -1477,8 +1474,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -1486,11 +1481,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigwait$UNIX2003" - )] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, @@ -1498,10 +1488,6 @@ extern "C" { child: ::Option, ) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003" - )] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn openpty( amaster: *mut ::c_int, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/mod.rs index 83e064e..ae3fa22 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/mod.rs @@ -1,13 +1,3 @@ -// 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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - // liblibc port for HermitCore (https://hermitcore.org) // HermitCore is a unikernel based on lwIP, newlib, and // pthread-embedded. @@ -949,6 +939,10 @@ const ULONG_SIZE: usize = 64; pub const WNOHANG: ::c_int = 0x00000001; +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn WEXITSTATUS(status: ::c_int) -> ::c_int { (status >> 8) & 0xff diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/hermit/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/hermit/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/arm.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/arm.rs similarity index 68% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/arm.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/arm.rs index 1320b16..aa9beb7 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/arm.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/arm.rs @@ -1,5 +1,151 @@ pub type c_char = u8; pub type wchar_t = u32; +pub type greg_t = i32; +pub type mcontext_t = sigcontext; + +s! { + pub struct sigcontext { + pub trap_no: ::c_ulong, + pub error_code: ::c_ulong, + pub oldmask: ::c_ulong, + pub arm_r0: ::c_ulong, + pub arm_r1: ::c_ulong, + pub arm_r2: ::c_ulong, + pub arm_r3: ::c_ulong, + pub arm_r4: ::c_ulong, + pub arm_r5: ::c_ulong, + pub arm_r6: ::c_ulong, + pub arm_r7: ::c_ulong, + pub arm_r8: ::c_ulong, + pub arm_r9: ::c_ulong, + pub arm_r10: ::c_ulong, + pub arm_fp: ::c_ulong, + pub arm_ip: ::c_ulong, + pub arm_sp: ::c_ulong, + pub arm_lr: ::c_ulong, + pub arm_pc: ::c_ulong, + pub arm_cpsr: ::c_ulong, + pub fault_address: ::c_ulong, + } +} + +cfg_if! { + if #[cfg(libc_union)] { + s_no_extra_traits! { + pub struct __c_anonymous_uc_sigmask_with_padding { + pub uc_sigmask: ::sigset_t, + /* Android has a wrong (smaller) sigset_t on x86. */ + __padding_rt_sigset: u32, + } + + pub union __c_anonymous_uc_sigmask { + uc_sigmask: __c_anonymous_uc_sigmask_with_padding, + uc_sigmask64: ::sigset64_t, + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask, + /* The kernel adds extra padding after uc_sigmask to match + * glibc sigset_t on ARM. */ + __padding: [c_char; 120], + __align: [::c_longlong; 0], + uc_regspace: [::c_ulong; 128], + } + } + + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for __c_anonymous_uc_sigmask_with_padding { + fn eq( + &self, other: &__c_anonymous_uc_sigmask_with_padding + ) -> bool { + self.uc_sigmask == other.uc_sigmask + // Ignore padding + } + } + impl Eq for __c_anonymous_uc_sigmask_with_padding {} + impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("uc_sigmask_with_padding") + .field("uc_sigmask_with_padding", &self.uc_sigmask) + // Ignore padding + .finish() + } + } + impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding { + fn hash(&self, state: &mut H) { + self.uc_sigmask.hash(state) + // Ignore padding + } + } + + impl PartialEq for __c_anonymous_uc_sigmask { + fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool { + unsafe { self.uc_sigmask == other.uc_sigmask } + } + } + impl Eq for __c_anonymous_uc_sigmask {} + impl ::fmt::Debug for __c_anonymous_uc_sigmask { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("uc_sigmask") + .field("uc_sigmask", unsafe { &self.uc_sigmask }) + .finish() + } + } + impl ::hash::Hash for __c_anonymous_uc_sigmask { + fn hash(&self, state: &mut H) { + unsafe { self.uc_sigmask.hash(state) } + } + } + + impl PartialEq for ucontext_t { + fn eq(&self, other: &Self) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask__c_anonymous_union + == other.uc_sigmask__c_anonymous_union + && &self.uc_regspace[..] == &other.uc_regspace[..] + // Ignore padding field + } + } + impl Eq for ucontext_t {} + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field( + "uc_sigmask__c_anonymous_union", + &self.uc_sigmask__c_anonymous_union + ) + .field("uc_regspace", &&self.uc_regspace[..]) + // Ignore padding field + .finish() + } + } + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask__c_anonymous_union.hash(state); + &self.uc_regspace[..].hash(state); + // Ignore padding field + } + } + } + } + } +} pub const O_DIRECT: ::c_int = 0x10000; pub const O_DIRECTORY: ::c_int = 0x4000; @@ -355,3 +501,23 @@ pub const SYS_pwritev2: ::c_long = 393; pub const SYS_pkey_mprotect: ::c_long = 394; pub const SYS_pkey_alloc: ::c_long = 395; pub const SYS_pkey_free: ::c_long = 396; + +// offsets in mcontext_t.gregs from sys/ucontext.h +pub const REG_R0: ::c_int = 0; +pub const REG_R1: ::c_int = 1; +pub const REG_R2: ::c_int = 2; +pub const REG_R3: ::c_int = 3; +pub const REG_R4: ::c_int = 4; +pub const REG_R5: ::c_int = 5; +pub const REG_R6: ::c_int = 6; +pub const REG_R7: ::c_int = 7; +pub const REG_R8: ::c_int = 8; +pub const REG_R9: ::c_int = 9; +pub const REG_R10: ::c_int = 10; +pub const REG_R11: ::c_int = 11; +pub const REG_R12: ::c_int = 12; +pub const REG_R13: ::c_int = 13; +pub const REG_R14: ::c_int = 14; +pub const REG_R15: ::c_int = 15; + +pub const NGREG: ::c_int = 18; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/mod.rs similarity index 93% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/mod.rs index e5c97e9..5c4f032 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/mod.rs @@ -161,6 +161,24 @@ s! { } } +s_no_extra_traits! { + pub struct sigset64_t { + __bits: [::c_ulong; 2] + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl ::fmt::Debug for sigset64_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigset64_t") + .field("__bits", &self.__bits) + .finish() + } + } + } +} + // These constants must be of the same type of sigaction.sa_flags pub const SA_NOCLDSTOP: ::c_int = 0x00000001; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/x86/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/x86/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/x86/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/x86/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/x86/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/x86/mod.rs similarity index 72% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/x86/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/x86/mod.rs index 101bf2d..879ea1a 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b32/x86/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b32/x86/mod.rs @@ -1,5 +1,144 @@ pub type c_char = i8; pub type wchar_t = i32; +pub type greg_t = i32; + +s! { + pub struct _libc_fpreg { + pub significand: [u16; 4], + pub exponent: u16, + } + + pub struct _libc_fpstate { + pub cw: ::c_ulong, + pub sw: ::c_ulong, + pub tag: ::c_ulong, + pub ipoff: ::c_ulong, + pub cssel: ::c_ulong, + pub dataoff: ::c_ulong, + pub datasel: ::c_ulong, + pub _st: [_libc_fpreg; 8], + pub status: ::c_ulong, + } + + pub struct mcontext_t { + pub gregs: [greg_t; 19], + pub fpregs: *mut _libc_fpstate, + pub oldmask: ::c_ulong, + pub cr2: ::c_ulong, + } +} + +cfg_if! { + if #[cfg(libc_union)] { + s_no_extra_traits! { + pub struct __c_anonymous_uc_sigmask_with_padding { + pub uc_sigmask: ::sigset_t, + /* Android has a wrong (smaller) sigset_t on x86. */ + __padding_rt_sigset: u32, + } + + pub union __c_anonymous_uc_sigmask { + uc_sigmask: __c_anonymous_uc_sigmask_with_padding, + uc_sigmask64: ::sigset64_t, + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask, + __padding_rt_sigset: u32, + __fpregs_mem: _libc_fpstate, + } + } + + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for __c_anonymous_uc_sigmask_with_padding { + fn eq( + &self, other: &__c_anonymous_uc_sigmask_with_padding + ) -> bool { + self.uc_sigmask == other.uc_sigmask + // Ignore padding + } + } + impl Eq for __c_anonymous_uc_sigmask_with_padding {} + impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("uc_sigmask_with_padding") + .field("uc_sigmask_with_padding", &self.uc_sigmask) + // Ignore padding + .finish() + } + } + impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding { + fn hash(&self, state: &mut H) { + self.uc_sigmask.hash(state) + // Ignore padding + } + } + + impl PartialEq for __c_anonymous_uc_sigmask { + fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool { + unsafe { self.uc_sigmask == other.uc_sigmask } + } + } + impl Eq for __c_anonymous_uc_sigmask {} + impl ::fmt::Debug for __c_anonymous_uc_sigmask { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("uc_sigmask") + .field("uc_sigmask", unsafe { &self.uc_sigmask }) + .finish() + } + } + impl ::hash::Hash for __c_anonymous_uc_sigmask { + fn hash(&self, state: &mut H) { + unsafe { self.uc_sigmask.hash(state) } + } + } + + impl PartialEq for ucontext_t { + fn eq(&self, other: &Self) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask__c_anonymous_union + == other.uc_sigmask__c_anonymous_union + // Ignore padding field + } + } + impl Eq for ucontext_t {} + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field( + "uc_sigmask__c_anonymous_union", + &self.uc_sigmask__c_anonymous_union + ) + // Ignore padding field + .finish() + } + } + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask__c_anonymous_union.hash(state); + // Ignore padding field + } + } + } + } + } +} pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; @@ -414,6 +553,27 @@ pub const EFL: ::c_int = 14; pub const UESP: ::c_int = 15; pub const SS: ::c_int = 16; +// offsets in mcontext_t.gregs from sys/ucontext.h +pub const REG_GS: ::c_int = 0; +pub const REG_FS: ::c_int = 1; +pub const REG_ES: ::c_int = 2; +pub const REG_DS: ::c_int = 3; +pub const REG_EDI: ::c_int = 4; +pub const REG_ESI: ::c_int = 5; +pub const REG_EBP: ::c_int = 6; +pub const REG_ESP: ::c_int = 7; +pub const REG_EBX: ::c_int = 8; +pub const REG_EDX: ::c_int = 9; +pub const REG_ECX: ::c_int = 10; +pub const REG_EAX: ::c_int = 11; +pub const REG_TRAPNO: ::c_int = 12; +pub const REG_ERR: ::c_int = 13; +pub const REG_EIP: ::c_int = 14; +pub const REG_CS: ::c_int = 15; +pub const REG_EFL: ::c_int = 16; +pub const REG_UESP: ::c_int = 17; +pub const REG_SS: ::c_int = 18; + cfg_if! { if #[cfg(libc_align)] { mod align; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/aarch64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/aarch64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/aarch64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/aarch64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/aarch64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/aarch64/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/aarch64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/aarch64/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/mod.rs similarity index 96% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/mod.rs index 9826bb9..0f9443f 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/mod.rs @@ -126,6 +126,10 @@ s_no_extra_traits! { attr: i32, __reserved: [::c_char; 36], } + + pub struct sigset64_t { + __bits: [::c_ulong; 1] + } } cfg_if! { @@ -228,6 +232,14 @@ cfg_if! { self.__reserved.hash(state); } } + + impl ::fmt::Debug for sigset64_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("sigset64_t") + .field("__bits", &self.__bits) + .finish() + } + } } } diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/x86_64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/x86_64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/x86_64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/x86_64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/x86_64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/x86_64/mod.rs similarity index 65% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/x86_64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/x86_64/mod.rs index f5b8b16..27fd17b 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -1,5 +1,6 @@ pub type c_char = i8; pub type wchar_t = i32; +pub type greg_t = i64; s! { pub struct stat { @@ -41,6 +42,218 @@ s! { pub st_ctime_nsec: ::c_long, __unused: [::c_long; 3], } + + pub struct _libc_xmmreg { + pub element: [u32; 4], + } +} + +cfg_if! { + if #[cfg(libc_union)] { + s_no_extra_traits! { + pub union __c_anonymous_uc_sigmask { + uc_sigmask: ::sigset_t, + uc_sigmask64: ::sigset64_t, + } + } + + cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for __c_anonymous_uc_sigmask { + fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool { + unsafe { self.uc_sigmask == other.uc_sigmask } + } + } + impl Eq for __c_anonymous_uc_sigmask {} + impl ::fmt::Debug for __c_anonymous_uc_sigmask { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("uc_sigmask") + .field("uc_sigmask", unsafe { &self.uc_sigmask }) + .finish() + } + } + impl ::hash::Hash for __c_anonymous_uc_sigmask { + fn hash(&self, state: &mut H) { + unsafe { self.uc_sigmask.hash(state) } + } + } + } + } + } +} + +s_no_extra_traits! { + pub struct _libc_fpxreg { + pub significand: [u16; 4], + pub exponent: u16, + __padding: [u16; 3], + } + + pub struct _libc_fpstate { + pub cwd: u16, + pub swd: u16, + pub ftw: u16, + pub fop: u16, + pub rip: u64, + pub rdp: u64, + pub mxcsr: u32, + pub mxcr_mask: u32, + pub _st: [_libc_fpxreg; 8], + pub _xmm: [_libc_xmmreg; 16], + __private: [u32; 24], + } + + pub struct mcontext_t { + pub gregs: [greg_t; 23], + pub fpregs: *mut _libc_fpstate, + __private: [u64; 8], + } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: mcontext_t, + pub uc_sigmask64: __c_anonymous_uc_sigmask, + __fpregs_mem: _libc_fpstate, + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for _libc_fpxreg { + fn eq(&self, other: &Self) -> bool { + self.significand == other.significand + && self.exponent == other.exponent + // Ignore padding field + } + } + impl Eq for _libc_fpxreg {} + impl ::fmt::Debug for _libc_fpxreg { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("_libc_fpxreg") + .field("significand", &self.significand) + .field("exponent", &self.exponent) + // Ignore padding field + .finish() + } + } + impl ::hash::Hash for _libc_fpxreg { + fn hash(&self, state: &mut H) { + self.significand.hash(state); + self.exponent.hash(state); + // Ignore padding field + } + } + + impl PartialEq for _libc_fpstate { + fn eq(&self, other: &Self) -> bool { + self.cwd == other.cwd + && self.swd == other.swd + && self.ftw == other.ftw + && self.fop == other.fop + && self.rip == other.rip + && self.rdp == other.rdp + && self.mxcsr == other.mxcsr + && self.mxcr_mask == other.mxcr_mask + && self._st == other._st + && self._xmm == other._xmm + // Ignore padding field + } + } + impl Eq for _libc_fpstate {} + impl ::fmt::Debug for _libc_fpstate { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("_libc_fpstate") + .field("cwd", &self.cwd) + .field("swd", &self.swd) + .field("ftw", &self.ftw) + .field("fop", &self.fop) + .field("rip", &self.rip) + .field("rdp", &self.rdp) + .field("mxcsr", &self.mxcsr) + .field("mxcr_mask", &self.mxcr_mask) + .field("_st", &self._st) + .field("_xmm", &self._xmm) + // Ignore padding field + .finish() + } + } + impl ::hash::Hash for _libc_fpstate { + fn hash(&self, state: &mut H) { + self.cwd.hash(state); + self.swd.hash(state); + self.ftw.hash(state); + self.fop.hash(state); + self.rip.hash(state); + self.rdp.hash(state); + self.mxcsr.hash(state); + self.mxcr_mask.hash(state); + self._st.hash(state); + self._xmm.hash(state); + // Ignore padding field + } + } + + impl PartialEq for mcontext_t { + fn eq(&self, other: &Self) -> bool { + self.gregs == other.gregs + && self.fpregs == other.fpregs + // Ignore padding field + } + } + impl Eq for mcontext_t {} + impl ::fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mcontext_t") + .field("gregs", &self.gregs) + .field("fpregs", &self.fpregs) + // Ignore padding field + .finish() + } + } + impl ::hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { + self.gregs.hash(state); + self.fpregs.hash(state); + // Ignore padding field + } + } + + impl PartialEq for ucontext_t { + fn eq(&self, other: &Self) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask64 == other.uc_sigmask64 + // Ignore padding field + } + } + impl Eq for ucontext_t {} + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_flags) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field("uc_sigmask64", &self.uc_sigmask64) + // Ignore padding field + .finish() + } + } + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask64.hash(state); + // Ignore padding field + } + } + } } pub const O_DIRECT: ::c_int = 0x4000; @@ -419,6 +632,31 @@ pub const ES: ::c_int = 24; pub const FS: ::c_int = 25; pub const GS: ::c_int = 26; +// offsets in mcontext_t.gregs from sys/ucontext.h +pub const REG_R8: ::c_int = 0; +pub const REG_R9: ::c_int = 1; +pub const REG_R10: ::c_int = 2; +pub const REG_R11: ::c_int = 3; +pub const REG_R12: ::c_int = 4; +pub const REG_R13: ::c_int = 5; +pub const REG_R14: ::c_int = 6; +pub const REG_R15: ::c_int = 7; +pub const REG_RDI: ::c_int = 8; +pub const REG_RSI: ::c_int = 9; +pub const REG_RBP: ::c_int = 10; +pub const REG_RBX: ::c_int = 11; +pub const REG_RDX: ::c_int = 12; +pub const REG_RAX: ::c_int = 13; +pub const REG_RCX: ::c_int = 14; +pub const REG_RSP: ::c_int = 15; +pub const REG_RIP: ::c_int = 16; +pub const REG_EFL: ::c_int = 17; +pub const REG_CSGSFS: ::c_int = 18; +pub const REG_ERR: ::c_int = 19; +pub const REG_TRAPNO: ::c_int = 20; +pub const REG_OLDMASK: ::c_int = 21; +pub const REG_CR2: ::c_int = 22; + cfg_if! { if #[cfg(libc_align)] { mod align; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/mod.rs similarity index 94% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/mod.rs index 361030b..9cc1c77 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/android/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/android/mod.rs @@ -208,6 +208,16 @@ s! { pub cookie: u32, pub len: u32 } + + pub struct sock_extended_err { + pub ee_errno: u32, + pub ee_origin: u8, + pub ee_type: u8, + pub ee_code: u8, + pub ee_pad: u8, + pub ee_info: u32, + pub ee_data: u32, + } } s_no_extra_traits! { @@ -1097,12 +1107,20 @@ pub const F_SETLKW: ::c_int = 7; pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; pub const F_UNLCK: ::c_int = 2; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const RLIMIT_CPU: ::c_int = 0; pub const RLIMIT_FSIZE: ::c_int = 1; pub const RLIMIT_DATA: ::c_int = 2; pub const RLIMIT_STACK: ::c_int = 3; pub const RLIMIT_CORE: ::c_int = 4; +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_AS: ::c_int = 9; pub const RLIMIT_LOCKS: ::c_int = 10; pub const RLIMIT_SIGPENDING: ::c_int = 11; pub const RLIMIT_MSGQUEUE: ::c_int = 12; @@ -1142,6 +1160,8 @@ pub const TIOCMBIC: ::c_int = 0x5417; pub const TIOCMSET: ::c_int = 0x5418; pub const FIONREAD: ::c_int = 0x541B; pub const TIOCCONS: ::c_int = 0x541D; +pub const TIOCSBRK: ::c_int = 0x5427; +pub const TIOCCBRK: ::c_int = 0x5428; pub const ST_RDONLY: ::c_ulong = 1; pub const ST_NOSUID: ::c_ulong = 2; @@ -1411,6 +1431,72 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001; pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002; pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004; +// linux/netfilter/nfnetlink_log.h +pub const NFQNL_MSG_PACKET: ::c_int = 0; +pub const NFQNL_MSG_VERDICT: ::c_int = 1; +pub const NFQNL_MSG_CONFIG: ::c_int = 2; +pub const NFQNL_MSG_VERDICT_BATCH: ::c_int = 3; + +pub const NFQA_UNSPEC: ::c_int = 0; +pub const NFQA_PACKET_HDR: ::c_int = 1; +pub const NFQA_VERDICT_HDR: ::c_int = 2; +pub const NFQA_MARK: ::c_int = 3; +pub const NFQA_TIMESTAMP: ::c_int = 4; +pub const NFQA_IFINDEX_INDEV: ::c_int = 5; +pub const NFQA_IFINDEX_OUTDEV: ::c_int = 6; +pub const NFQA_IFINDEX_PHYSINDEV: ::c_int = 7; +pub const NFQA_IFINDEX_PHYSOUTDEV: ::c_int = 8; +pub const NFQA_HWADDR: ::c_int = 9; +pub const NFQA_PAYLOAD: ::c_int = 10; +pub const NFQA_CT: ::c_int = 11; +pub const NFQA_CT_INFO: ::c_int = 12; +pub const NFQA_CAP_LEN: ::c_int = 13; +pub const NFQA_SKB_INFO: ::c_int = 14; +pub const NFQA_EXP: ::c_int = 15; +pub const NFQA_UID: ::c_int = 16; +pub const NFQA_GID: ::c_int = 17; +pub const NFQA_SECCTX: ::c_int = 18; +/* + FIXME: These are not yet available in musl sanitized kernel headers and + make the tests fail. Enable them once musl has them. + + See https://github.com/rust-lang/libc/pull/1628 for more details. +pub const NFQA_VLAN: ::c_int = 19; +pub const NFQA_L2HDR: ::c_int = 20; + +pub const NFQA_VLAN_UNSPEC: ::c_int = 0; +pub const NFQA_VLAN_PROTO: ::c_int = 1; +pub const NFQA_VLAN_TCI: ::c_int = 2; +*/ + +pub const NFQNL_CFG_CMD_NONE: ::c_int = 0; +pub const NFQNL_CFG_CMD_BIND: ::c_int = 1; +pub const NFQNL_CFG_CMD_UNBIND: ::c_int = 2; +pub const NFQNL_CFG_CMD_PF_BIND: ::c_int = 3; +pub const NFQNL_CFG_CMD_PF_UNBIND: ::c_int = 4; + +pub const NFQNL_COPY_NONE: ::c_int = 0; +pub const NFQNL_COPY_META: ::c_int = 1; +pub const NFQNL_COPY_PACKET: ::c_int = 2; + +pub const NFQA_CFG_UNSPEC: ::c_int = 0; +pub const NFQA_CFG_CMD: ::c_int = 1; +pub const NFQA_CFG_PARAMS: ::c_int = 2; +pub const NFQA_CFG_QUEUE_MAXLEN: ::c_int = 3; +pub const NFQA_CFG_MASK: ::c_int = 4; +pub const NFQA_CFG_FLAGS: ::c_int = 5; + +pub const NFQA_CFG_F_FAIL_OPEN: ::c_int = 0x0001; +pub const NFQA_CFG_F_CONNTRACK: ::c_int = 0x0002; +pub const NFQA_CFG_F_GSO: ::c_int = 0x0004; +pub const NFQA_CFG_F_UID_GID: ::c_int = 0x0008; +pub const NFQA_CFG_F_SECCTX: ::c_int = 0x0010; +pub const NFQA_CFG_F_MAX: ::c_int = 0x0020; + +pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001; +pub const NFQA_SKB_GSO: ::c_int = 0x0002; +pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004; + pub const GENL_NAMSIZ: ::c_int = 16; pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE; @@ -1503,6 +1589,7 @@ pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; pub const SO_ORIGINAL_DST: ::c_int = 80; pub const IP_ORIGDSTADDR: ::c_int = 20; pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR; +pub const IPV6_FLOWINFO: ::c_int = 11; pub const IPV6_ORIGDSTADDR: ::c_int = 74; pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR; pub const IPV6_FLOWLABEL_MGR: ::c_int = 32; @@ -1600,6 +1687,9 @@ pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225; pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300; pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX; +// linux/netfilter_ipv6/ip6_tables.h +pub const IP6T_SO_ORIGINAL_DST: ::c_int = 80; + // linux/netfilter/nf_tables.h pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; @@ -2009,6 +2099,55 @@ pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +// linux/errqueue.h +pub const SO_EE_ORIGIN_NONE: u8 = 0; +pub const SO_EE_ORIGIN_LOCAL: u8 = 1; +pub const SO_EE_ORIGIN_ICMP: u8 = 2; +pub const SO_EE_ORIGIN_ICMP6: u8 = 3; +pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4; +pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS; + +// errno.h +pub const EPERM: ::c_int = 1; +pub const ENOENT: ::c_int = 2; +pub const ESRCH: ::c_int = 3; +pub const EINTR: ::c_int = 4; +pub const EIO: ::c_int = 5; +pub const ENXIO: ::c_int = 6; +pub const E2BIG: ::c_int = 7; +pub const ENOEXEC: ::c_int = 8; +pub const EBADF: ::c_int = 9; +pub const ECHILD: ::c_int = 10; +pub const EAGAIN: ::c_int = 11; +pub const ENOMEM: ::c_int = 12; +pub const EACCES: ::c_int = 13; +pub const EFAULT: ::c_int = 14; +pub const ENOTBLK: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const EXDEV: ::c_int = 18; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENFILE: ::c_int = 23; +pub const EMFILE: ::c_int = 24; +pub const ENOTTY: ::c_int = 25; +pub const ETXTBSY: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const ESPIPE: ::c_int = 29; +pub const EROFS: ::c_int = 30; +pub const EMLINK: ::c_int = 31; +pub const EPIPE: ::c_int = 32; +pub const EDOM: ::c_int = 33; +pub const ERANGE: ::c_int = 34; +pub const EWOULDBLOCK: ::c_int = EAGAIN; + +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { @@ -2068,6 +2207,10 @@ f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) } + + pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { + ee.offset(1) as *mut ::sockaddr + } } extern "C" { @@ -2277,7 +2420,6 @@ extern "C" { pub fn setfsgid(gid: ::gid_t) -> ::c_int; pub fn setfsuid(uid: ::uid_t) -> ::c_int; pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -2285,14 +2427,8 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003" - )] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, @@ -2300,10 +2436,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003" - )] pub fn pthread_sigmask( how: ::c_int, set: *const sigset_t, @@ -2314,8 +2446,6 @@ extern "C" { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, @@ -2323,8 +2453,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -2332,11 +2460,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigwait$UNIX2003" - )] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, @@ -2355,10 +2478,6 @@ extern "C" { attr: *const pthread_mutexattr_t, pshared: *mut ::c_int, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003" - )] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn faccessat( dirfd: ::c_int, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/align.rs similarity index 97% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/align.rs index 141570f..b9ea3f3 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/align.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/align.rs @@ -38,9 +38,9 @@ macro_rules! expand_align { } #[allow(missing_debug_implementations)] - #[repr(align(8))] + #[repr(align(16))] pub struct max_align_t { - priv_: [f64; 2] + priv_: [f64; 4] } } diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/mod.rs similarity index 92% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/mod.rs index 3fc47bb..7817021 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/mod.rs @@ -35,7 +35,7 @@ pub type c_ulong = u32; pub type nlink_t = u32; #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // TODO: fill this out with a struct +pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { @@ -1174,20 +1174,142 @@ pub const O_TRUNC: ::c_int = 512; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_CLOEXEC: ::c_int = 0x80000; -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; +// Defined as wasi value. +pub const EPERM: ::c_int = 63; +pub const ENOENT: ::c_int = 44; +pub const ESRCH: ::c_int = 71; +pub const EINTR: ::c_int = 27; +pub const EIO: ::c_int = 29; +pub const ENXIO: ::c_int = 60; +pub const E2BIG: ::c_int = 1; +pub const ENOEXEC: ::c_int = 45; +pub const EBADF: ::c_int = 8; +pub const ECHILD: ::c_int = 12; +pub const EAGAIN: ::c_int = 6; +pub const ENOMEM: ::c_int = 48; +pub const EACCES: ::c_int = 2; +pub const EFAULT: ::c_int = 21; +pub const ENOTBLK: ::c_int = 105; +pub const EBUSY: ::c_int = 10; +pub const EEXIST: ::c_int = 20; +pub const EXDEV: ::c_int = 75; +pub const ENODEV: ::c_int = 43; +pub const ENOTDIR: ::c_int = 54; +pub const EISDIR: ::c_int = 31; +pub const EINVAL: ::c_int = 28; +pub const ENFILE: ::c_int = 41; +pub const EMFILE: ::c_int = 33; +pub const ENOTTY: ::c_int = 59; +pub const ETXTBSY: ::c_int = 74; +pub const EFBIG: ::c_int = 22; +pub const ENOSPC: ::c_int = 51; +pub const ESPIPE: ::c_int = 70; +pub const EROFS: ::c_int = 69; +pub const EMLINK: ::c_int = 34; +pub const EPIPE: ::c_int = 64; +pub const EDOM: ::c_int = 18; +pub const ERANGE: ::c_int = 68; +pub const EWOULDBLOCK: ::c_int = EAGAIN; +pub const ENOLINK: ::c_int = 47; +pub const EPROTO: ::c_int = 65; +pub const EDEADLK: ::c_int = 16; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const ENAMETOOLONG: ::c_int = 37; +pub const ENOLCK: ::c_int = 46; +pub const ENOSYS: ::c_int = 52; +pub const ENOTEMPTY: ::c_int = 55; +pub const ELOOP: ::c_int = 32; +pub const ENOMSG: ::c_int = 49; +pub const EIDRM: ::c_int = 24; +pub const EMULTIHOP: ::c_int = 36; +pub const EBADMSG: ::c_int = 9; +pub const EOVERFLOW: ::c_int = 61; +pub const EILSEQ: ::c_int = 25; +pub const ENOTSOCK: ::c_int = 57; +pub const EDESTADDRREQ: ::c_int = 17; +pub const EMSGSIZE: ::c_int = 35; +pub const EPROTOTYPE: ::c_int = 67; +pub const ENOPROTOOPT: ::c_int = 50; +pub const EPROTONOSUPPORT: ::c_int = 66; +pub const EAFNOSUPPORT: ::c_int = 5; +pub const EADDRINUSE: ::c_int = 3; +pub const EADDRNOTAVAIL: ::c_int = 4; +pub const ENETDOWN: ::c_int = 38; +pub const ENETUNREACH: ::c_int = 40; +pub const ENETRESET: ::c_int = 39; +pub const ECONNABORTED: ::c_int = 13; +pub const ECONNRESET: ::c_int = 15; +pub const ENOBUFS: ::c_int = 42; +pub const EISCONN: ::c_int = 30; +pub const ENOTCONN: ::c_int = 53; +pub const ETIMEDOUT: ::c_int = 73; +pub const ECONNREFUSED: ::c_int = 14; +pub const EHOSTUNREACH: ::c_int = 23; +pub const EALREADY: ::c_int = 7; +pub const EINPROGRESS: ::c_int = 26; +pub const ESTALE: ::c_int = 72; +pub const EDQUOT: ::c_int = 19; +pub const ECANCELED: ::c_int = 11; +pub const EOWNERDEAD: ::c_int = 62; +pub const ENOTRECOVERABLE: ::c_int = 56; + +pub const ENOSTR: ::c_int = 100; +pub const EBFONT: ::c_int = 101; +pub const EBADSLT: ::c_int = 102; +pub const EBADRQC: ::c_int = 103; +pub const ENOANO: ::c_int = 104; +pub const ECHRNG: ::c_int = 106; +pub const EL3HLT: ::c_int = 107; +pub const EL3RST: ::c_int = 108; +pub const ELNRNG: ::c_int = 109; +pub const EUNATCH: ::c_int = 110; +pub const ENOCSI: ::c_int = 111; +pub const EL2HLT: ::c_int = 112; +pub const EBADE: ::c_int = 113; +pub const EBADR: ::c_int = 114; +pub const EXFULL: ::c_int = 115; +pub const ENODATA: ::c_int = 116; +pub const ETIME: ::c_int = 117; +pub const ENOSR: ::c_int = 118; +pub const ENONET: ::c_int = 119; +pub const ENOPKG: ::c_int = 120; +pub const EREMOTE: ::c_int = 121; +pub const EADV: ::c_int = 122; +pub const ESRMNT: ::c_int = 123; +pub const ECOMM: ::c_int = 124; +pub const EDOTDOT: ::c_int = 125; +pub const ENOTUNIQ: ::c_int = 126; +pub const EBADFD: ::c_int = 127; +pub const EREMCHG: ::c_int = 128; +pub const ELIBACC: ::c_int = 129; +pub const ELIBBAD: ::c_int = 130; +pub const ELIBSCN: ::c_int = 131; +pub const ELIBMAX: ::c_int = 132; +pub const ELIBEXEC: ::c_int = 133; +pub const ERESTART: ::c_int = 134; +pub const ESTRPIPE: ::c_int = 135; +pub const EUSERS: ::c_int = 136; +pub const ESOCKTNOSUPPORT: ::c_int = 137; +pub const EOPNOTSUPP: ::c_int = 138; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 139; +pub const ESHUTDOWN: ::c_int = 140; +pub const ETOOMANYREFS: ::c_int = 141; +pub const EHOSTDOWN: ::c_int = 142; +pub const EUCLEAN: ::c_int = 143; +pub const ENOTNAM: ::c_int = 144; +pub const ENAVAIL: ::c_int = 145; +pub const EISNAM: ::c_int = 146; +pub const EREMOTEIO: ::c_int = 147; +pub const ENOMEDIUM: ::c_int = 148; +pub const EMEDIUMTYPE: ::c_int = 149; +pub const ENOKEY: ::c_int = 150; +pub const EKEYEXPIRED: ::c_int = 151; +pub const EKEYREVOKED: ::c_int = 152; +pub const EKEYREJECTED: ::c_int = 153; +pub const ERFKILL: ::c_int = 154; +pub const EHWPOISON: ::c_int = 155; +pub const EL2NSYNC: ::c_int = 156; pub const SA_NODEFER: ::c_int = 0x40000000; pub const SA_RESETHAND: ::c_int = 0x80000000; @@ -1286,10 +1408,7 @@ pub const TIOCINQ: ::c_int = ::FIONREAD; pub const RTLD_GLOBAL: ::c_int = 0x100; pub const RTLD_NOLOAD: ::c_int = 0x4; -// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also linux_like/mod.rs pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -pub const CLOCK_TAI: ::clockid_t = 11; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; @@ -1440,92 +1559,6 @@ pub const SOCK_SEQPACKET: ::c_int = 5; pub const SOL_SOCKET: ::c_int = 1; -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EDEADLOCK: ::c_int = EDEADLK; -pub const EMULTIHOP: ::c_int = 72; -pub const EBADMSG: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const ENOTSUP: ::c_int = EOPNOTSUPP; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const ERFKILL: ::c_int = 132; -pub const EHWPOISON: ::c_int = 133; - pub const SO_REUSEADDR: ::c_int = 2; pub const SO_TYPE: ::c_int = 3; pub const SO_ERROR: ::c_int = 4; @@ -1580,6 +1613,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 11; @@ -1644,6 +1680,10 @@ pub const ARPD_LOOKUP: ::c_ushort = 0x02; pub const ARPD_FLUSH: ::c_ushort = 0x03; pub const ATF_MAGIC: ::c_int = 0x80; +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr) -> *mut cmsghdr { @@ -1696,7 +1736,7 @@ f! { pub fn major(dev: ::dev_t) -> ::c_uint { // see - // https://github.com/kripken/emscripten/blob/ + // https://github.com/emscripten-core/emscripten/blob/ // master/system/include/libc/sys/sysmacros.h let mut major = 0; major |= (dev & 0x00000fff) >> 8; @@ -1706,7 +1746,7 @@ f! { pub fn minor(dev: ::dev_t) -> ::c_uint { // see - // https://github.com/kripken/emscripten/blob/ + // https://github.com/emscripten-core/emscripten/blob/ // master/system/include/libc/sys/sysmacros.h let mut minor = 0; minor |= (dev & 0x000000ff) >> 0; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/emscripten/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/emscripten/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/align.rs similarity index 89% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/align.rs index 6000b41..01e0083 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/align.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/align.rs @@ -7,7 +7,8 @@ macro_rules! expand_align { target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64", - target_arch = "aarch64"), + target_arch = "aarch64", + target_arch = "riscv64"), repr(align(4)))] #[cfg_attr(not(any(target_pointer_width = "32", target_arch = "x86_64", @@ -15,7 +16,8 @@ macro_rules! expand_align { target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64", - target_arch = "aarch64")), + target_arch = "aarch64", + target_arch = "riscv64")), repr(align(8)))] pub struct pthread_mutexattr_t { #[doc(hidden)] @@ -37,6 +39,17 @@ macro_rules! expand_align { #[doc(hidden)] size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } + + #[repr(align(8))] + pub struct fanotify_event_metadata { + pub event_len: __u32, + pub vers: __u8, + pub reserved: __u8, + pub metadata_len: __u16, + pub mask: __u64, + pub fd: ::c_int, + pub pid: ::c_int, + } } s_no_extra_traits! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/arm/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/arm/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/arm/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/arm/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/arm/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/arm/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index 0a5fc85..22746ee 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -212,6 +212,7 @@ pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_SYNC : ::c_int = 0x080000; pub const SOL_SOCKET: ::c_int = 1; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mips/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mips/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mips/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mips/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mips/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mips/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mips/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mod.rs similarity index 97% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mod.rs index cc6b636..2eab8dd 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/mod.rs @@ -143,6 +143,10 @@ pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; pub const F_UNLCK: ::c_int = 2; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; + pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; @@ -237,6 +241,9 @@ pub const PTRACE_SETFPREGS: ::c_uint = 15; pub const PTRACE_GETREGS: ::c_uint = 12; pub const PTRACE_SETREGS: ::c_uint = 13; +pub const TIOCSBRK: ::c_int = 0x5427; +pub const TIOCCBRK: ::c_int = 0x5428; + #[link(name = "util")] extern "C" { pub fn sysctl( diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/powerpc.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/powerpc.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/powerpc.rs index 7644428..f3f9493 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/powerpc.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/powerpc.rs @@ -213,6 +213,7 @@ pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_SYNC : ::c_int = 0x080000; pub const SOL_SOCKET: ::c_int = 1; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/sparc/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/sparc/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/sparc/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/sparc/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index f670b34..aaa8008 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -245,6 +245,7 @@ pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const EDEADLK: ::c_int = 78; pub const ENAMETOOLONG: ::c_int = 63; @@ -395,6 +396,9 @@ pub const F_GETOWN: ::c_int = 5; pub const F_SETOWN: ::c_int = 6; pub const F_SETLK: ::c_int = 8; pub const F_SETLKW: ::c_int = 9; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const F_RDLCK: ::c_int = 1; pub const F_WRLCK: ::c_int = 2; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/x86/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/x86/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/x86/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/x86/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/x86/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/x86/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index f5f7cac..b1d306c 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -416,6 +416,7 @@ pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_SYNC : ::c_int = 0x080000; pub const EDEADLOCK: ::c_int = 35; pub const EUCLEAN: ::c_int = 117; @@ -542,6 +543,8 @@ pub const FIONBIO: ::c_ulong = 0x5421; pub const PTRACE_GETFPXREGS: ::c_uint = 18; pub const PTRACE_SETFPXREGS: ::c_uint = 19; +pub const PTRACE_SYSEMU: ::c_uint = 31; +pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; diff --git a/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs new file mode 100644 index 0000000..154c2c5 --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs @@ -0,0 +1,29 @@ +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f32; 8] + } +} + +s! { + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub fault_address: ::c_ulonglong, + pub regs: [::c_ulonglong; 31], + pub sp: ::c_ulonglong, + pub pc: ::c_ulonglong, + pub pstate: ::c_ulonglong, + // nested arrays to get the right size/length while being able to + // auto-derive traits like Debug + __reserved: [[u64; 32]; 16], + } +} diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs similarity index 93% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index 93f0f2b..2c2f568 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -212,11 +212,6 @@ pub const RTLD_DEEPBIND: ::c_int = 0x8; pub const RTLD_GLOBAL: ::c_int = 0x100; pub const RTLD_NOLOAD: ::c_int = 0x4; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -pub const TIOCGRS485: ::c_int = 0x542E; -pub const TIOCSRS485: ::c_int = 0x542F; - pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; pub const RLIMIT_AS: ::__rlimit_resource_t = 9; pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; @@ -429,6 +424,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; @@ -444,7 +442,13 @@ pub const TIOCMGET: ::c_ulong = 0x5415; pub const TIOCMBIS: ::c_ulong = 0x5416; pub const TIOCMBIC: ::c_ulong = 0x5417; pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; pub const TIOCCONS: ::c_ulong = 0x541D; +pub const TIOCSBRK: ::c_ulong = 0x5427; +pub const TIOCCBRK: ::c_ulong = 0x5428; +pub const TIOCGRS485: ::c_int = 0x542E; +pub const TIOCSRS485: ::c_int = 0x542F; pub const TIOCM_ST: ::c_int = 0x008; pub const TIOCM_SR: ::c_int = 0x010; @@ -530,6 +534,7 @@ pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC: ::c_int = 0x080000; pub const EDEADLOCK: ::c_int = 35; @@ -662,6 +667,51 @@ pub const TCSAFLUSH: ::c_int = 2; pub const TIOCLINUX: ::c_ulong = 0x541C; pub const TIOCGSERIAL: ::c_ulong = 0x541E; +// sys/auxv.h +pub const HWCAP_FP: ::c_ulong = 1 << 0; +pub const HWCAP_ASIMD: ::c_ulong = 1 << 1; +pub const HWCAP_EVTSTRM: ::c_ulong = 1 << 2; +pub const HWCAP_AES: ::c_ulong = 1 << 3; +pub const HWCAP_PMULL: ::c_ulong = 1 << 4; +pub const HWCAP_SHA1: ::c_ulong = 1 << 5; +pub const HWCAP_SHA2: ::c_ulong = 1 << 6; +pub const HWCAP_CRC32: ::c_ulong = 1 << 7; +pub const HWCAP_ATOMICS: ::c_ulong = 1 << 8; +pub const HWCAP_FPHP: ::c_ulong = 1 << 9; +pub const HWCAP_ASIMDHP: ::c_ulong = 1 << 10; +pub const HWCAP_CPUID: ::c_ulong = 1 << 11; +pub const HWCAP_ASIMDRDM: ::c_ulong = 1 << 12; +pub const HWCAP_JSCVT: ::c_ulong = 1 << 13; +pub const HWCAP_FCMA: ::c_ulong = 1 << 14; +pub const HWCAP_LRCPC: ::c_ulong = 1 << 15; +pub const HWCAP_DCPOP: ::c_ulong = 1 << 16; +pub const HWCAP_SHA3: ::c_ulong = 1 << 17; +pub const HWCAP_SM3: ::c_ulong = 1 << 18; +pub const HWCAP_SM4: ::c_ulong = 1 << 19; +pub const HWCAP_ASIMDDP: ::c_ulong = 1 << 20; +pub const HWCAP_SHA512: ::c_ulong = 1 << 21; +pub const HWCAP_SVE: ::c_ulong = 1 << 22; +pub const HWCAP_ASIMDFHM: ::c_ulong = 1 << 23; +pub const HWCAP_DIT: ::c_ulong = 1 << 24; +pub const HWCAP_USCAT: ::c_ulong = 1 << 25; +pub const HWCAP_ILRCPC: ::c_ulong = 1 << 26; +pub const HWCAP_FLAGM: ::c_ulong = 1 << 27; +pub const HWCAP_SSBS: ::c_ulong = 1 << 28; +pub const HWCAP_SB: ::c_ulong = 1 << 29; +pub const HWCAP_PACA: ::c_ulong = 1 << 30; +pub const HWCAP_PACG: ::c_ulong = 1 << 31; +// FIXME: enable these again once linux-api-headers are up to date enough on CI. +// See discussion in https://github.com/rust-lang/libc/pull/1638 +//pub const HWCAP2_DCPODP: ::c_ulong = 1 << 0; +//pub const HWCAP2_SVE2: ::c_ulong = 1 << 1; +//pub const HWCAP2_SVEAES: ::c_ulong = 1 << 2; +//pub const HWCAP2_SVEPMULL: ::c_ulong = 1 << 3; +//pub const HWCAP2_SVEBITPERM: ::c_ulong = 1 << 4; +//pub const HWCAP2_SVESHA3: ::c_ulong = 1 << 5; +//pub const HWCAP2_SVESM4: ::c_ulong = 1 << 6; +//pub const HWCAP2_FLAGM2: ::c_ulong = 1 << 7; +//pub const HWCAP2_FRINT: ::c_ulong = 1 << 8; + // Syscall table pub const SYS_io_setup: ::c_long = 0; pub const SYS_io_destroy: ::c_long = 1; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mips64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mips64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mips64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mips64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index a59554b..2e0d78e 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -857,6 +857,9 @@ pub const F_GETOWN: ::c_int = 23; pub const F_SETOWN: ::c_int = 24; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const SFD_NONBLOCK: ::c_int = 0x80; @@ -871,6 +874,8 @@ pub const TCSETAF: ::c_ulong = 0x5404; pub const TCSBRK: ::c_ulong = 0x5405; pub const TCXONC: ::c_ulong = 0x5406; pub const TCFLSH: ::c_ulong = 0x5407; +pub const TIOCSBRK: ::c_ulong = 0x5427; +pub const TIOCCBRK: ::c_ulong = 0x5428; pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; pub const TIOCINQ: ::c_ulong = 0x467f; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index 22507d7..9cf0b21 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -416,6 +416,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; @@ -438,6 +441,8 @@ pub const TIOCMBIS: ::c_ulong = 0x5416; pub const TIOCMBIC: ::c_ulong = 0x5417; pub const TIOCMSET: ::c_ulong = 0x5418; pub const TIOCCONS: ::c_ulong = 0x541D; +pub const TIOCSBRK: ::c_ulong = 0x5427; +pub const TIOCCBRK: ::c_ulong = 0x5428; pub const TIOCGRS485: ::c_int = 0x542E; pub const TIOCSRS485: ::c_int = 0x542F; @@ -541,6 +546,7 @@ pub const O_DIRECT: ::c_int = 0x20000; pub const MAP_LOCKED: ::c_int = 0x00080; pub const MAP_NORESERVE: ::c_int = 0x00040; +pub const MAP_SYNC : ::c_int = 0x080000; pub const EDEADLOCK: ::c_int = 58; pub const EUCLEAN: ::c_int = 117; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs similarity index 90% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index c45c5b2..9fa0f0a 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -4,23 +4,10 @@ pub type c_char = u8; pub type c_long = i64; pub type c_ulong = u64; pub type wchar_t = ::c_int; -pub type time_t = ::c_long; -pub type dev_t = ::c_ulong; -pub type uid_t = ::c_uint; -pub type gid_t = ::c_uint; -pub type ino_t = ::c_ulong; -pub type ino64_t = ::c_ulong; -pub type mode_t = ::c_uint; pub type nlink_t = ::c_uint; -pub type off_t = ::c_long; -pub type off64_t = ::c_long; -pub type pid_t = ::c_int; pub type blksize_t = ::c_int; -pub type blkcnt_t = ::c_long; -pub type fsblkcnt_t = ::c_ulong; pub type fsblkcnt64_t = ::c_ulong; -pub type fsfilcnt_t = ::c_ulong; pub type fsfilcnt64_t = ::c_ulong; pub type suseconds_t = i64; pub type __u64 = ::c_ulonglong; @@ -30,63 +17,58 @@ s! { __size: [::c_ulong; 7], } - pub struct timespec { - pub tv_sec: time_t, - pub tv_nsec: ::c_long, - } - pub struct stat { - pub st_dev: dev_t, - pub st_ino: ino_t, - pub st_mode: mode_t, - pub st_nlink: nlink_t, - pub st_uid: uid_t, - pub st_gid: gid_t, - pub st_rdev: dev_t, - pub __pad1: dev_t, - pub st_size: off_t, - pub st_blksize: blksize_t, + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub __pad1: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, pub __pad2: ::c_int, - pub st_blocks: blkcnt_t, - pub st_atime: time_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, pub st_atime_nsec: ::c_long, - pub st_mtime: time_t, + pub st_mtime: ::time_t, pub st_mtime_nsec: ::c_long, - pub st_ctime: time_t, + pub st_ctime: ::time_t, pub st_ctime_nsec: ::c_long, - pub __unused: [::c_int; 2usize], + __unused: [::c_int; 2usize], } pub struct stat64 { - pub st_dev: dev_t, - pub st_ino: ino64_t, - pub st_mode: mode_t, - pub st_nlink: nlink_t, - pub st_uid: uid_t, - pub st_gid: gid_t, - pub st_rdev: dev_t, - pub __pad1: dev_t, - pub st_size: off64_t, - pub st_blksize: blksize_t, + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub __pad1: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, pub __pad2: ::c_int, - pub st_blocks: blkcnt_t, - pub st_atime: time_t, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, pub st_atime_nsec: ::c_long, - pub st_mtime: time_t, + pub st_mtime: ::time_t, pub st_mtime_nsec: ::c_long, - pub st_ctime: time_t, + pub st_ctime: ::time_t, pub st_ctime_nsec: ::c_long, - pub __unused: [::c_int; 2], + __unused: [::c_int; 2], } pub struct statfs { pub f_type: ::c_long, pub f_bsize: ::c_long, - pub f_blocks: fsblkcnt_t, - pub f_bfree: fsblkcnt_t, - pub f_bavail: fsblkcnt_t, - pub f_files: fsfilcnt_t, - pub f_ffree: fsfilcnt_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, pub f_fsid: ::fsid_t, pub f_namelen: ::c_long, pub f_frsize: ::c_long, @@ -97,11 +79,11 @@ s! { pub struct statfs64 { pub f_type: ::c_long, pub f_bsize: ::c_long, - pub f_blocks: fsblkcnt64_t, - pub f_bfree: fsblkcnt64_t, - pub f_bavail: fsblkcnt64_t, - pub f_files: fsfilcnt64_t, - pub f_ffree: fsfilcnt64_t, + pub f_blocks: ::fsblkcnt64_t, + pub f_bfree: ::fsblkcnt64_t, + pub f_bavail: ::fsblkcnt64_t, + pub f_files: ::fsfilcnt64_t, + pub f_ffree: ::fsfilcnt64_t, pub f_fsid: ::fsid_t, pub f_namelen: ::c_long, pub f_frsize: ::c_long, @@ -112,12 +94,12 @@ s! { pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, - pub f_blocks: fsblkcnt_t, - pub f_bfree: fsblkcnt_t, - pub f_bavail: fsblkcnt_t, - pub f_files: fsfilcnt_t, - pub f_ffree: fsfilcnt_t, - pub f_favail: fsfilcnt_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, pub f_fsid: ::c_ulong, pub f_flag: ::c_ulong, pub f_namemax: ::c_ulong, @@ -127,12 +109,12 @@ s! { pub struct statvfs64 { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, - pub f_blocks: fsblkcnt64_t, - pub f_bfree: fsblkcnt64_t, - pub f_bavail: fsblkcnt64_t, - pub f_files: fsfilcnt64_t, - pub f_ffree: fsfilcnt64_t, - pub f_favail: fsfilcnt64_t, + pub f_blocks: ::fsblkcnt64_t, + pub f_bfree: ::fsblkcnt64_t, + pub f_bavail: ::fsblkcnt64_t, + pub f_files: ::fsfilcnt64_t, + pub f_ffree: ::fsfilcnt64_t, + pub f_favail: ::fsfilcnt64_t, pub f_fsid: ::c_ulong, pub f_flag: ::c_ulong, pub f_namemax: ::c_ulong, @@ -167,35 +149,31 @@ s! { pub sa_restorer: ::Option, } - pub struct sigset_t { - pub __val: [::c_ulong; 16], - } - pub struct ipc_perm { pub __key: ::key_t, - pub uid: uid_t, - pub gid: gid_t, - pub cuid: uid_t, - pub cgid: gid_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, pub mode: ::c_ushort, - pub __pad1: ::c_ushort, + __pad1: ::c_ushort, pub __seq: ::c_ushort, - pub __pad2: ::c_ushort, - pub __unused1: ::c_ulong, - pub __unused2: ::c_ulong, + __pad2: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong, } pub struct shmid_ds { - pub shm_perm: ipc_perm, + pub shm_perm: ::ipc_perm, pub shm_segsz: ::size_t, - pub shm_atime: time_t, - pub shm_dtime: time_t, - pub shm_ctime: time_t, - pub shm_cpid: pid_t, - pub shm_lpid: pid_t, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_cpid: ::pid_t, + pub shm_lpid: ::pid_t, pub shm_nattch: ::shmatt_t, - pub __unused5: ::c_ulong, - pub __unused6: ::c_ulong, + __unused5: ::c_ulong, + __unused6: ::c_ulong, } pub struct flock { @@ -205,15 +183,31 @@ s! { pub l_len: ::off_t, pub l_pid: ::pid_t, } + + pub struct flock64 { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off64_t, + pub l_len: ::off64_t, + pub l_pid: ::pid_t, + } } pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; pub const VEOF: usize = 4; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; pub const TIOCGSOFTCAR: ::c_ulong = 21529; pub const TIOCSSOFTCAR: ::c_ulong = 21530; pub const TIOCGRS485: ::c_int = 21550; pub const TIOCSRS485: ::c_int = 21551; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; pub const O_APPEND: ::c_int = 1024; pub const O_CREAT: ::c_int = 64; pub const O_EXCL: ::c_int = 128; @@ -400,6 +394,9 @@ pub const F_SETLKW: ::c_int = 7; pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; pub const F_UNLCK: ::c_int = 2; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const SFD_NONBLOCK: ::c_int = 2048; pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; @@ -460,6 +457,7 @@ pub const MAP_EXECUTABLE: ::c_int = 4096; pub const MAP_POPULATE: ::c_int = 32768; pub const MAP_NONBLOCK: ::c_int = 65536; pub const MAP_STACK: ::c_int = 131072; +pub const MAP_SYNC : ::c_int = 0x080000; pub const EDEADLOCK: ::c_int = 35; pub const EUCLEAN: ::c_int = 117; pub const ENOTNAM: ::c_int = 118; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/s390x.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/s390x.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/s390x.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/s390x.rs index cf0612a..906a44a 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -540,6 +540,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const SFD_NONBLOCK: ::c_int = 0x0800; @@ -572,6 +575,8 @@ pub const TIOCMBIC: ::c_ulong = 0x5417; pub const TIOCMSET: ::c_ulong = 0x5418; pub const FIONREAD: ::c_ulong = 0x541B; pub const TIOCCONS: ::c_ulong = 0x541D; +pub const TIOCSBRK: ::c_ulong = 0x5427; +pub const TIOCCBRK: ::c_ulong = 0x5428; pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index 651ada3..e7d6239 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -247,6 +247,7 @@ pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const EDEADLK: ::c_int = 78; pub const ENAMETOOLONG: ::c_int = 63; @@ -397,6 +398,9 @@ pub const F_GETOWN: ::c_int = 5; pub const F_SETOWN: ::c_int = 6; pub const F_SETLK: ::c_int = 8; pub const F_SETLKW: ::c_int = 9; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const F_RDLCK: ::c_int = 1; pub const F_WRLCK: ::c_int = 2; @@ -412,13 +416,15 @@ pub const TIOCLINUX: ::c_ulong = 0x541C; pub const TIOCGSERIAL: ::c_ulong = 0x541E; pub const TIOCEXCL: ::c_ulong = 0x2000740d; pub const TIOCNXCL: ::c_ulong = 0x2000740e; -pub const TIOCSCTTY: ::c_ulong = 0x20007484; -pub const TIOCSTI: ::c_ulong = 0x80017472; -pub const TIOCMGET: ::c_ulong = 0x4004746a; -pub const TIOCMBIS: ::c_ulong = 0x8004746c; -pub const TIOCMBIC: ::c_ulong = 0x8004746b; -pub const TIOCMSET: ::c_ulong = 0x8004746d; pub const TIOCCONS: ::c_ulong = 0x20007424; +pub const TIOCMGET: ::c_ulong = 0x4004746a; +pub const TIOCMBIC: ::c_ulong = 0x8004746b; +pub const TIOCMBIS: ::c_ulong = 0x8004746c; +pub const TIOCMSET: ::c_ulong = 0x8004746d; +pub const TIOCSTI: ::c_ulong = 0x80017472; +pub const TIOCCBRK: ::c_ulong = 0x2000747a; +pub const TIOCSBRK: ::c_ulong = 0x2000747b; +pub const TIOCSCTTY: ::c_ulong = 0x20007484; pub const TIOCM_ST: ::c_int = 0x008; pub const TIOCM_SR: ::c_int = 0x010; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 34e4da8..f48d659 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -618,6 +618,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; @@ -698,6 +701,7 @@ pub const MAP_EXECUTABLE: ::c_int = 0x01000; pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const EDEADLOCK: ::c_int = 35; pub const EUCLEAN: ::c_int = 117; @@ -717,6 +721,8 @@ pub const PTRACE_SETFPXREGS: ::c_uint = 19; pub const PTRACE_GETREGS: ::c_uint = 12; pub const PTRACE_SETREGS: ::c_uint = 13; pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1; +pub const PTRACE_SYSEMU: ::c_uint = 31; +pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; @@ -835,6 +841,8 @@ pub const TIOCOUTQ: ::c_ulong = 0x5411; pub const TIOCGWINSZ: ::c_ulong = 0x5413; pub const TIOCSWINSZ: ::c_ulong = 0x5414; pub const FIONREAD: ::c_ulong = 0x541B; +pub const TIOCSBRK: ::c_ulong = 0x5427; +pub const TIOCCBRK: ::c_ulong = 0x5428; // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/mod.rs similarity index 74% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/mod.rs index f16bf8c..da9890e 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/mod.rs @@ -2,6 +2,7 @@ pub type pthread_t = c_ulong; pub type __priority_which_t = ::c_uint; pub type __rlimit_resource_t = ::c_uint; pub type Lmid_t = ::c_long; +pub type regoff_t = ::c_int; s! { pub struct statx { @@ -183,6 +184,107 @@ s! { pub rt_window: ::c_ulong, pub rt_irtt: ::c_ushort, } + + pub struct timex { + pub modes: ::c_uint, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub offset: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub offset: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub freq: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub freq: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub maxerror: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub maxerror: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub esterror: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub esterror: ::c_long, + pub status: ::c_int, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub constant: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub constant: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub precision: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub precision: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub tolerance: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub tolerance: ::c_long, + pub time: ::timeval, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub tick: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub tick: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub ppsfreq: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub ppsfreq: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub jitter: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub jitter: ::c_long, + pub shift: ::c_int, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub stabil: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub stabil: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub jitcnt: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub jitcnt: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub calcnt: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub calcnt: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub errcnt: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub errcnt: ::c_long, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + pub stbcnt: i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + pub stbcnt: ::c_long, + pub tai: ::c_int, + pub __unused1: i32, + pub __unused2: i32, + pub __unused3: i32, + pub __unused4: i32, + pub __unused5: i32, + pub __unused6: i32, + pub __unused7: i32, + pub __unused8: i32, + pub __unused9: i32, + pub __unused10: i32, + pub __unused11: i32, + } + + pub struct ntptimeval { + pub time: ::timeval, + pub maxerror: ::c_long, + pub esterror: ::c_long, + pub tai: ::c_long, + pub __glibc_reserved1: ::c_long, + pub __glibc_reserved2: ::c_long, + pub __glibc_reserved3: ::c_long, + pub __glibc_reserved4: ::c_long, + } + + pub struct regex_t { + __buffer: *mut ::c_void, + __allocated: ::size_t, + __used: ::size_t, + __syntax: ::c_ulong, + __fastmap: *mut ::c_char, + __translate: *mut ::c_char, + __re_nsub: ::size_t, + __bitfield: u8, + } } impl siginfo_t { @@ -309,6 +411,47 @@ cfg_if! { } } +// include/uapi/asm-generic/hugetlb_encode.h +pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26; +pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f; + +pub const HUGETLB_FLAG_ENCODE_64KB: ::c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_512KB: ::c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_1MB: ::c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_2MB: ::c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_8MB: ::c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_16MB: ::c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_32MB: ::c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_256MB: ::c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_512MB: ::c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_1GB: ::c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_2GB: ::c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT; +pub const HUGETLB_FLAG_ENCODE_16GB: ::c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT; + +// include/uapi/linux/mman.h +/* + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page + * size other than the default is desired. See hugetlb_encode.h. + * All known huge page size encodings are provided here. It is the + * responsibility of the application to know which sizes are supported on + * the running system. See mmap(2) man page for details. + */ +pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT; +pub const MAP_HUGE_MASK: ::c_int = HUGETLB_FLAG_ENCODE_MASK; + +pub const MAP_HUGE_64KB: ::c_int = HUGETLB_FLAG_ENCODE_64KB; +pub const MAP_HUGE_512KB: ::c_int = HUGETLB_FLAG_ENCODE_512KB; +pub const MAP_HUGE_1MB: ::c_int = HUGETLB_FLAG_ENCODE_1MB; +pub const MAP_HUGE_2MB: ::c_int = HUGETLB_FLAG_ENCODE_2MB; +pub const MAP_HUGE_8MB: ::c_int = HUGETLB_FLAG_ENCODE_8MB; +pub const MAP_HUGE_16MB: ::c_int = HUGETLB_FLAG_ENCODE_16MB; +pub const MAP_HUGE_32MB: ::c_int = HUGETLB_FLAG_ENCODE_32MB; +pub const MAP_HUGE_256MB: ::c_int = HUGETLB_FLAG_ENCODE_256MB; +pub const MAP_HUGE_512MB: ::c_int = HUGETLB_FLAG_ENCODE_512MB; +pub const MAP_HUGE_1GB: ::c_int = HUGETLB_FLAG_ENCODE_1GB; +pub const MAP_HUGE_2GB: ::c_int = HUGETLB_FLAG_ENCODE_2GB; +pub const MAP_HUGE_16GB: ::c_int = HUGETLB_FLAG_ENCODE_16GB; + pub const RLIMIT_CPU: ::__rlimit_resource_t = 0; pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1; pub const RLIMIT_DATA: ::__rlimit_resource_t = 2; @@ -322,6 +465,10 @@ pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16; +pub const PRIO_PROCESS: ::__priority_which_t = 0; +pub const PRIO_PGRP: ::__priority_which_t = 1; +pub const PRIO_USER: ::__priority_which_t = 2; + pub const MS_RMT_MASK: ::c_ulong = 0x02800051; pub const __UT_LINESIZE: usize = 32; @@ -391,9 +538,6 @@ pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK | LC_MEASUREMENT_MASK | LC_IDENTIFICATION_MASK; -pub const MAP_SHARED_VALIDATE: ::c_int = 0x3; -pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000; - pub const ENOTSUP: ::c_int = EOPNOTSUPP; pub const SOCK_SEQPACKET: ::c_int = 5; @@ -410,6 +554,7 @@ pub const TCP_QUEUE_SEQ: ::c_int = 21; pub const TCP_REPAIR_OPTIONS: ::c_int = 22; pub const TCP_FASTOPEN: ::c_int = 23; pub const TCP_TIMESTAMP: ::c_int = 24; +pub const TCP_FASTOPEN_CONNECT: ::c_int = 30; /* DCCP socket options */ pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; @@ -543,6 +688,8 @@ pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; pub const TMPFS_MAGIC: ::c_long = 0x01021994; pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; +pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb; +pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270; pub const CPU_SETSIZE: ::c_int = 0x400; @@ -574,21 +721,6 @@ pub const EPOLLWAKEUP: ::c_int = 0x20000000; pub const SEEK_DATA: ::c_int = 3; pub const SEEK_HOLE: ::c_int = 4; -pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; -pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; -pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; -pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; -pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; - -pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; -pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; -pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; -pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; -pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; -pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; -pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; -pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; - // linux/rtnetlink.h pub const TCA_PAD: ::c_ushort = 9; pub const TCA_DUMP_INVISIBLE: ::c_ushort = 10; @@ -648,6 +780,37 @@ pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; pub const NFPROTO_INET: ::c_int = 1; pub const NFPROTO_NETDEV: ::c_int = 5; +// linux/keyctl.h +pub const KEYCTL_DH_COMPUTE: u32 = 23; +pub const KEYCTL_PKEY_QUERY: u32 = 24; +pub const KEYCTL_PKEY_ENCRYPT: u32 = 25; +pub const KEYCTL_PKEY_DECRYPT: u32 = 26; +pub const KEYCTL_PKEY_SIGN: u32 = 27; +pub const KEYCTL_PKEY_VERIFY: u32 = 28; +pub const KEYCTL_RESTRICT_KEYRING: u32 = 29; + +pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01; +pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02; +pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04; +pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08; +cfg_if! { + if #[cfg(not(any(target_arch="mips", target_arch="mips64")))] { + pub const KEYCTL_MOVE: u32 = 30; + pub const KEYCTL_CAPABILITIES: u32 = 31; + + pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01; + pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02; + pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04; + pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08; + pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10; + pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20; + pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40; + pub const KEYCTL_CAPS0_MOVE: u32 = 0x80; + pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01; + pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02; + } +} + // linux/netfilter/nf_tables.h pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; @@ -874,12 +1037,99 @@ pub const STATX_ATTR_NODUMP: ::c_int = 0x0040; pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800; pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000; +// sys/auxv.h +pub const AT_NULL: ::c_ulong = 0; +pub const AT_IGNORE: ::c_ulong = 1; +pub const AT_EXECFD: ::c_ulong = 2; +pub const AT_PHDR: ::c_ulong = 3; +pub const AT_PHENT: ::c_ulong = 4; +pub const AT_PHNUM: ::c_ulong = 5; +pub const AT_PAGESZ: ::c_ulong = 6; +pub const AT_BASE: ::c_ulong = 7; +pub const AT_FLAGS: ::c_ulong = 8; +pub const AT_ENTRY: ::c_ulong = 9; +pub const AT_NOTELF: ::c_ulong = 10; +pub const AT_UID: ::c_ulong = 11; +pub const AT_EUID: ::c_ulong = 12; +pub const AT_GID: ::c_ulong = 13; +pub const AT_EGID: ::c_ulong = 14; +pub const AT_PLATFORM: ::c_ulong = 15; +pub const AT_HWCAP: ::c_ulong = 16; +pub const AT_CLKTCK: ::c_ulong = 17; +// AT_* values 18 through 22 are reserved +pub const AT_SECURE: ::c_ulong = 23; +pub const AT_BASE_PLATFORM: ::c_ulong = 24; +pub const AT_RANDOM: ::c_ulong = 25; +pub const AT_HWCAP2: ::c_ulong = 26; + +pub const AT_EXECFN: ::c_ulong = 31; + +//sys/timex.h +pub const ADJ_OFFSET: ::c_uint = 0x0001; +pub const ADJ_FREQUENCY: ::c_uint = 0x0002; +pub const ADJ_MAXERROR: ::c_uint = 0x0004; +pub const ADJ_ESTERROR: ::c_uint = 0x0008; +pub const ADJ_STATUS: ::c_uint = 0x0010; +pub const ADJ_TIMECONST: ::c_uint = 0x0020; +pub const ADJ_TAI: ::c_uint = 0x0080; +pub const ADJ_SETOFFSET: ::c_uint = 0x0100; +pub const ADJ_MICRO: ::c_uint = 0x1000; +pub const ADJ_NANO: ::c_uint = 0x2000; +pub const ADJ_TICK: ::c_uint = 0x4000; +pub const ADJ_OFFSET_SINGLESHOT: ::c_uint = 0x8001; +pub const ADJ_OFFSET_SS_READ: ::c_uint = 0xa001; +pub const MOD_OFFSET: ::c_uint = ADJ_OFFSET; +pub const MOD_FREQUENCY: ::c_uint = ADJ_FREQUENCY; +pub const MOD_MAXERROR: ::c_uint = ADJ_MAXERROR; +pub const MOD_ESTERROR: ::c_uint = ADJ_ESTERROR; +pub const MOD_STATUS: ::c_uint = ADJ_STATUS; +pub const MOD_TIMECONST: ::c_uint = ADJ_TIMECONST; +pub const MOD_CLKB: ::c_uint = ADJ_TICK; +pub const MOD_CLKA: ::c_uint = ADJ_OFFSET_SINGLESHOT; +pub const MOD_TAI: ::c_uint = ADJ_TAI; +pub const MOD_MICRO: ::c_uint = ADJ_MICRO; +pub const MOD_NANO: ::c_uint = ADJ_NANO; +pub const STA_PLL: ::c_int = 0x0001; +pub const STA_PPSFREQ: ::c_int = 0x0002; +pub const STA_PPSTIME: ::c_int = 0x0004; +pub const STA_FLL: ::c_int = 0x0008; +pub const STA_INS: ::c_int = 0x0010; +pub const STA_DEL: ::c_int = 0x0020; +pub const STA_UNSYNC: ::c_int = 0x0040; +pub const STA_FREQHOLD: ::c_int = 0x0080; +pub const STA_PPSSIGNAL: ::c_int = 0x0100; +pub const STA_PPSJITTER: ::c_int = 0x0200; +pub const STA_PPSWANDER: ::c_int = 0x0400; +pub const STA_PPSERROR: ::c_int = 0x0800; +pub const STA_CLOCKERR: ::c_int = 0x1000; +pub const STA_NANO: ::c_int = 0x2000; +pub const STA_MODE: ::c_int = 0x4000; +pub const STA_CLK: ::c_int = 0x8000; +pub const STA_RONLY: ::c_int = STA_PPSSIGNAL + | STA_PPSJITTER + | STA_PPSWANDER + | STA_PPSERROR + | STA_CLOCKERR + | STA_NANO + | STA_MODE + | STA_CLK; +pub const NTP_API: ::c_int = 4; +pub const TIME_OK: ::c_int = 0; +pub const TIME_INS: ::c_int = 1; +pub const TIME_DEL: ::c_int = 2; +pub const TIME_OOP: ::c_int = 3; +pub const TIME_WAIT: ::c_int = 4; +pub const TIME_ERROR: ::c_int = 5; +pub const TIME_BAD: ::c_int = TIME_ERROR; +pub const MAXTC: ::c_long = 6; + cfg_if! { if #[cfg(any( target_arch = "arm", target_arch = "x86", target_arch = "x86_64", - target_arch = "s390x" + target_arch = "s390x", + target_arch = "riscv64" ))] { pub const PTHREAD_STACK_MIN: ::size_t = 16384; } else if #[cfg(any( @@ -893,7 +1143,33 @@ cfg_if! { } pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; +pub const REG_STARTEND: ::c_int = 4; + +pub const REG_EEND: ::c_int = 14; +pub const REG_ESIZE: ::c_int = 15; +pub const REG_ERPAREN: ::c_int = 16; + extern "C" { + pub fn fgetspent_r( + fp: *mut ::FILE, + spbuf: *mut ::spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut ::spwd, + ) -> ::c_int; + pub fn sgetspent_r( + s: *const ::c_char, + spbuf: *mut ::spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut ::spwd, + ) -> ::c_int; + pub fn getspent_r( + spbuf: *mut ::spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut ::spwd, + ) -> ::c_int; pub fn qsort_r( base: *mut ::c_void, num: ::size_t, @@ -972,12 +1248,34 @@ extern "C" { buflen: ::size_t, flags: ::c_uint, ) -> ::ssize_t; + pub fn memmem( haystack: *const ::c_void, haystacklen: ::size_t, needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void; + pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; + + pub fn adjtimex(buf: *mut timex) -> ::c_int; + pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; + #[link_name = "ntp_gettimex"] + pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; + pub fn copy_file_range( + fd_in: ::c_int, + off_in: *mut ::off64_t, + fd_out: ::c_int, + off_out: *mut ::off64_t, + len: ::size_t, + flags: ::c_uint, + ) -> ::ssize_t; + pub fn fanotify_mark( + fd: ::c_int, + flags: ::c_uint, + mask: u64, + dirfd: ::c_int, + path: *const ::c_char, + ) -> ::c_int; } #[link(name = "util")] @@ -1031,17 +1329,12 @@ extern "C" { pub fn sched_getcpu() -> ::c_int; pub fn mallinfo() -> ::mallinfo; pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; - pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")] pub fn getpwent_r( pwd: *mut ::passwd, buf: *mut ::c_char, buflen: ::size_t, result: *mut *mut ::passwd, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getgrent_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")] pub fn getgrent_r( grp: *mut ::group, buf: *mut ::c_char, diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/gnu/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/mod.rs similarity index 89% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/mod.rs index 3e2a9ff..27d5ab2 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/mod.rs @@ -37,7 +37,7 @@ pub type Elf32_Section = u16; pub type Elf64_Section = u16; #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // TODO: fill this out with a struct +pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { @@ -477,6 +477,11 @@ s! { pub len: u32 } + pub struct fanotify_response { + pub fd: ::c_int, + pub response: __u32, + } + pub struct sockaddr_vm { pub svm_family: ::sa_family_t, pub svm_reserved1: ::c_ushort, @@ -484,6 +489,21 @@ s! { pub svm_cid: ::c_uint, pub svm_zero: [u8; 4] } + + pub struct regmatch_t { + pub rm_so: regoff_t, + pub rm_eo: regoff_t, + } + + pub struct sock_extended_err { + pub ee_errno: u32, + pub ee_origin: u8, + pub ee_type: u8, + pub ee_code: u8, + pub ee_pad: u8, + pub ee_info: u32, + pub ee_data: u32, + } } s_no_extra_traits! { @@ -1205,6 +1225,8 @@ pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; pub const RTLD_NODELETE: ::c_int = 0x1000; pub const RTLD_NOW: ::c_int = 0x2; +pub const AT_EACCESS: ::c_int = 0x200; + pub const TCP_MD5SIG: ::c_int = 14; align_const! { @@ -1296,6 +1318,17 @@ pub const IPPROTO_MPLS: ::c_int = 137; pub const IPPROTO_RAW: ::c_int = 255; pub const IPPROTO_MAX: ::c_int = 256; +pub const IP_MSFILTER: ::c_int = 41; +pub const MCAST_JOIN_GROUP: ::c_int = 42; +pub const MCAST_BLOCK_SOURCE: ::c_int = 43; +pub const MCAST_UNBLOCK_SOURCE: ::c_int = 44; +pub const MCAST_LEAVE_GROUP: ::c_int = 45; +pub const MCAST_JOIN_SOURCE_GROUP: ::c_int = 46; +pub const MCAST_LEAVE_SOURCE_GROUP: ::c_int = 47; +pub const MCAST_MSFILTER: ::c_int = 48; +pub const IP_MULTICAST_ALL: ::c_int = 49; +pub const IP_UNICAST_IF: ::c_int = 50; + pub const AF_IB: ::c_int = 27; pub const AF_MPLS: ::c_int = 28; pub const AF_NFC: ::c_int = 39; @@ -1560,6 +1593,7 @@ pub const ENOATTR: ::c_int = ::ENODATA; pub const SO_ORIGINAL_DST: ::c_int = 80; pub const IP_ORIGDSTADDR: ::c_int = 20; pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR; +pub const IPV6_FLOWINFO: ::c_int = 11; pub const IPV6_ORIGDSTADDR: ::c_int = 74; pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR; pub const IPV6_FLOWLABEL_MGR: ::c_int = 32; @@ -1773,6 +1807,72 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001; pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002; pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004; +// linux/netfilter/nfnetlink_log.h +pub const NFQNL_MSG_PACKET: ::c_int = 0; +pub const NFQNL_MSG_VERDICT: ::c_int = 1; +pub const NFQNL_MSG_CONFIG: ::c_int = 2; +pub const NFQNL_MSG_VERDICT_BATCH: ::c_int = 3; + +pub const NFQA_UNSPEC: ::c_int = 0; +pub const NFQA_PACKET_HDR: ::c_int = 1; +pub const NFQA_VERDICT_HDR: ::c_int = 2; +pub const NFQA_MARK: ::c_int = 3; +pub const NFQA_TIMESTAMP: ::c_int = 4; +pub const NFQA_IFINDEX_INDEV: ::c_int = 5; +pub const NFQA_IFINDEX_OUTDEV: ::c_int = 6; +pub const NFQA_IFINDEX_PHYSINDEV: ::c_int = 7; +pub const NFQA_IFINDEX_PHYSOUTDEV: ::c_int = 8; +pub const NFQA_HWADDR: ::c_int = 9; +pub const NFQA_PAYLOAD: ::c_int = 10; +pub const NFQA_CT: ::c_int = 11; +pub const NFQA_CT_INFO: ::c_int = 12; +pub const NFQA_CAP_LEN: ::c_int = 13; +pub const NFQA_SKB_INFO: ::c_int = 14; +pub const NFQA_EXP: ::c_int = 15; +pub const NFQA_UID: ::c_int = 16; +pub const NFQA_GID: ::c_int = 17; +pub const NFQA_SECCTX: ::c_int = 18; +/* + FIXME: These are not yet available in musl sanitized kernel headers and + make the tests fail. Enable them once musl has them. + + See https://github.com/rust-lang/libc/pull/1628 for more details. +pub const NFQA_VLAN: ::c_int = 19; +pub const NFQA_L2HDR: ::c_int = 20; + +pub const NFQA_VLAN_UNSPEC: ::c_int = 0; +pub const NFQA_VLAN_PROTO: ::c_int = 1; +pub const NFQA_VLAN_TCI: ::c_int = 2; +*/ + +pub const NFQNL_CFG_CMD_NONE: ::c_int = 0; +pub const NFQNL_CFG_CMD_BIND: ::c_int = 1; +pub const NFQNL_CFG_CMD_UNBIND: ::c_int = 2; +pub const NFQNL_CFG_CMD_PF_BIND: ::c_int = 3; +pub const NFQNL_CFG_CMD_PF_UNBIND: ::c_int = 4; + +pub const NFQNL_COPY_NONE: ::c_int = 0; +pub const NFQNL_COPY_META: ::c_int = 1; +pub const NFQNL_COPY_PACKET: ::c_int = 2; + +pub const NFQA_CFG_UNSPEC: ::c_int = 0; +pub const NFQA_CFG_CMD: ::c_int = 1; +pub const NFQA_CFG_PARAMS: ::c_int = 2; +pub const NFQA_CFG_QUEUE_MAXLEN: ::c_int = 3; +pub const NFQA_CFG_MASK: ::c_int = 4; +pub const NFQA_CFG_FLAGS: ::c_int = 5; + +pub const NFQA_CFG_F_FAIL_OPEN: ::c_int = 0x0001; +pub const NFQA_CFG_F_CONNTRACK: ::c_int = 0x0002; +pub const NFQA_CFG_F_GSO: ::c_int = 0x0004; +pub const NFQA_CFG_F_UID_GID: ::c_int = 0x0008; +pub const NFQA_CFG_F_SECCTX: ::c_int = 0x0010; +pub const NFQA_CFG_F_MAX: ::c_int = 0x0020; + +pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001; +pub const NFQA_SKB_GSO: ::c_int = 0x0002; +pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004; + pub const GENL_NAMSIZ: ::c_int = 16; pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE; @@ -1900,6 +2000,9 @@ pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225; pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300; pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX; +// linux/netfilter_ipv6/ip6_tables.h +pub const IP6T_SO_ORIGINAL_DST: ::c_int = 80; + pub const SIOCADDRT: ::c_ulong = 0x0000890B; pub const SIOCDELRT: ::c_ulong = 0x0000890C; pub const SIOCGIFNAME: ::c_ulong = 0x00008910; @@ -2235,6 +2338,20 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; pub const ALG_OP_DECRYPT: ::c_int = 0; pub const ALG_OP_ENCRYPT: ::c_int = 1; +// include/uapi/linux/udp.h +pub const UDP_CORK: ::c_int = 1; +pub const UDP_ENCAP: ::c_int = 100; +pub const UDP_NO_CHECK6_TX: ::c_int = 101; +pub const UDP_NO_CHECK6_RX: ::c_int = 102; +pub const UDP_SEGMENT: ::c_int = 103; +pub const UDP_GRO: ::c_int = 104; + +// include/uapi/linux/mman.h +pub const MAP_SHARED_VALIDATE: ::c_int = 0x3; + +// include/uapi/asm-generic/mman-common.h +pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000; + // uapi/linux/vm_sockets.h pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF; pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0; @@ -2264,6 +2381,50 @@ pub const IN_ONLYDIR: u32 = 0x0100_0000; pub const IN_DONT_FOLLOW: u32 = 0x0200_0000; // pub const IN_EXCL_UNLINK: u32 = 0x0400_0000; +// linux/keyctl.h +pub const KEY_SPEC_THREAD_KEYRING: i32 = -1; +pub const KEY_SPEC_PROCESS_KEYRING: i32 = -2; +pub const KEY_SPEC_SESSION_KEYRING: i32 = -3; +pub const KEY_SPEC_USER_KEYRING: i32 = -4; +pub const KEY_SPEC_USER_SESSION_KEYRING: i32 = -5; +pub const KEY_SPEC_GROUP_KEYRING: i32 = -6; +pub const KEY_SPEC_REQKEY_AUTH_KEY: i32 = -7; +pub const KEY_SPEC_REQUESTOR_KEYRING: i32 = -8; + +pub const KEY_REQKEY_DEFL_NO_CHANGE: i32 = -1; +pub const KEY_REQKEY_DEFL_DEFAULT: i32 = 0; +pub const KEY_REQKEY_DEFL_THREAD_KEYRING: i32 = 1; +pub const KEY_REQKEY_DEFL_PROCESS_KEYRING: i32 = 2; +pub const KEY_REQKEY_DEFL_SESSION_KEYRING: i32 = 3; +pub const KEY_REQKEY_DEFL_USER_KEYRING: i32 = 4; +pub const KEY_REQKEY_DEFL_USER_SESSION_KEYRING: i32 = 5; +pub const KEY_REQKEY_DEFL_GROUP_KEYRING: i32 = 6; +pub const KEY_REQKEY_DEFL_REQUESTOR_KEYRING: i32 = 7; + +pub const KEYCTL_GET_KEYRING_ID: u32 = 0; +pub const KEYCTL_JOIN_SESSION_KEYRING: u32 = 1; +pub const KEYCTL_UPDATE: u32 = 2; +pub const KEYCTL_REVOKE: u32 = 3; +pub const KEYCTL_CHOWN: u32 = 4; +pub const KEYCTL_SETPERM: u32 = 5; +pub const KEYCTL_DESCRIBE: u32 = 6; +pub const KEYCTL_CLEAR: u32 = 7; +pub const KEYCTL_LINK: u32 = 8; +pub const KEYCTL_UNLINK: u32 = 9; +pub const KEYCTL_SEARCH: u32 = 10; +pub const KEYCTL_READ: u32 = 11; +pub const KEYCTL_INSTANTIATE: u32 = 12; +pub const KEYCTL_NEGATE: u32 = 13; +pub const KEYCTL_SET_REQKEY_KEYRING: u32 = 14; +pub const KEYCTL_SET_TIMEOUT: u32 = 15; +pub const KEYCTL_ASSUME_AUTHORITY: u32 = 16; +pub const KEYCTL_GET_SECURITY: u32 = 17; +pub const KEYCTL_SESSION_TO_PARENT: u32 = 18; +pub const KEYCTL_REJECT: u32 = 19; +pub const KEYCTL_INSTANTIATE_IOV: u32 = 20; +pub const KEYCTL_INVALIDATE: u32 = 21; +pub const KEYCTL_GET_PERSISTENT: u32 = 22; + // pub const IN_MASK_CREATE: u32 = 0x1000_0000; // pub const IN_MASK_ADD: u32 = 0x2000_0000; pub const IN_ISDIR: u32 = 0x4000_0000; @@ -2285,6 +2446,53 @@ pub const IN_ALL_EVENTS: u32 = IN_ACCESS pub const IN_CLOEXEC: ::c_int = O_CLOEXEC; pub const IN_NONBLOCK: ::c_int = O_NONBLOCK; +// uapi/linux/fanotify.h +pub const FAN_ACCESS: u64 = 0x0000_0001; +pub const FAN_MODIFY: u64 = 0x0000_0002; +pub const FAN_CLOSE_WRITE: u64 = 0x0000_0008; +pub const FAN_CLOSE_NOWRITE: u64 = 0x0000_0010; +pub const FAN_OPEN: u64 = 0x0000_0020; + +pub const FAN_Q_OVERFLOW: u64 = 0x0000_4000; + +pub const FAN_OPEN_PERM: u64 = 0x0001_0000; +pub const FAN_ACCESS_PERM: u64 = 0x0002_0000; + +pub const FAN_ONDIR: u64 = 0x4000_0000; + +pub const FAN_EVENT_ON_CHILD: u64 = 0x0800_0000; + +pub const FAN_CLOSE: u64 = FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE; + +pub const FAN_CLOEXEC: ::c_uint = 0x0000_0001; +pub const FAN_NONBLOCK: ::c_uint = 0x0000_0002; + +pub const FAN_CLASS_NOTIF: ::c_uint = 0x0000_0000; +pub const FAN_CLASS_CONTENT: ::c_uint = 0x0000_0004; +pub const FAN_CLASS_PRE_CONTENT: ::c_uint = 0x0000_0008; + +pub const FAN_UNLIMITED_QUEUE: ::c_uint = 0x0000_0010; +pub const FAN_UNLIMITED_MARKS: ::c_uint = 0x0000_0020; + +pub const FAN_MARK_ADD: ::c_uint = 0x0000_0001; +pub const FAN_MARK_REMOVE: ::c_uint = 0x0000_0002; +pub const FAN_MARK_DONT_FOLLOW: ::c_uint = 0x0000_0004; +pub const FAN_MARK_ONLYDIR: ::c_uint = 0x0000_0008; +pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; +pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010; +// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0 +pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100; +pub const FAN_MARK_IGNORED_MASK: ::c_uint = 0x0000_0020; +pub const FAN_MARK_IGNORED_SURV_MODIFY: ::c_uint = 0x0000_0040; +pub const FAN_MARK_FLUSH: ::c_uint = 0x0000_0080; + +pub const FANOTIFY_METADATA_VERSION: u8 = 3; + +pub const FAN_ALLOW: u32 = 0x01; +pub const FAN_DENY: u32 = 0x02; + +pub const FAN_NOFD: ::c_int = -1; + pub const FUTEX_WAIT: ::c_int = 0; pub const FUTEX_WAKE: ::c_int = 1; pub const FUTEX_FD: ::c_int = 2; @@ -2304,6 +2512,90 @@ pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +// linux/reboot.h +pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; +pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; +pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; +pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; + +pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; +pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; +pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; +pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; +pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; +pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; + +pub const REG_EXTENDED: ::c_int = 1; +pub const REG_ICASE: ::c_int = 2; +pub const REG_NEWLINE: ::c_int = 4; +pub const REG_NOSUB: ::c_int = 8; + +pub const REG_NOTBOL: ::c_int = 1; +pub const REG_NOTEOL: ::c_int = 2; + +pub const REG_ENOSYS: ::c_int = -1; +pub const REG_NOMATCH: ::c_int = 1; +pub const REG_BADPAT: ::c_int = 2; +pub const REG_ECOLLATE: ::c_int = 3; +pub const REG_ECTYPE: ::c_int = 4; +pub const REG_EESCAPE: ::c_int = 5; +pub const REG_ESUBREG: ::c_int = 6; +pub const REG_EBRACK: ::c_int = 7; +pub const REG_EPAREN: ::c_int = 8; +pub const REG_EBRACE: ::c_int = 9; +pub const REG_BADBR: ::c_int = 10; +pub const REG_ERANGE: ::c_int = 11; +pub const REG_ESPACE: ::c_int = 12; +pub const REG_BADRPT: ::c_int = 13; + +// linux/errqueue.h +pub const SO_EE_ORIGIN_NONE: u8 = 0; +pub const SO_EE_ORIGIN_LOCAL: u8 = 1; +pub const SO_EE_ORIGIN_ICMP: u8 = 2; +pub const SO_EE_ORIGIN_ICMP6: u8 = 3; +pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4; +pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS; + +// errno.h +pub const EPERM: ::c_int = 1; +pub const ENOENT: ::c_int = 2; +pub const ESRCH: ::c_int = 3; +pub const EINTR: ::c_int = 4; +pub const EIO: ::c_int = 5; +pub const ENXIO: ::c_int = 6; +pub const E2BIG: ::c_int = 7; +pub const ENOEXEC: ::c_int = 8; +pub const EBADF: ::c_int = 9; +pub const ECHILD: ::c_int = 10; +pub const EAGAIN: ::c_int = 11; +pub const ENOMEM: ::c_int = 12; +pub const EACCES: ::c_int = 13; +pub const EFAULT: ::c_int = 14; +pub const ENOTBLK: ::c_int = 15; +pub const EBUSY: ::c_int = 16; +pub const EEXIST: ::c_int = 17; +pub const EXDEV: ::c_int = 18; +pub const ENODEV: ::c_int = 19; +pub const ENOTDIR: ::c_int = 20; +pub const EISDIR: ::c_int = 21; +pub const EINVAL: ::c_int = 22; +pub const ENFILE: ::c_int = 23; +pub const EMFILE: ::c_int = 24; +pub const ENOTTY: ::c_int = 25; +pub const ETXTBSY: ::c_int = 26; +pub const EFBIG: ::c_int = 27; +pub const ENOSPC: ::c_int = 28; +pub const ESPIPE: ::c_int = 29; +pub const EROFS: ::c_int = 30; +pub const EMLINK: ::c_int = 31; +pub const EPIPE: ::c_int = 32; +pub const EDOM: ::c_int = 33; +pub const ERANGE: ::c_int = 34; +pub const EWOULDBLOCK: ::c_int = EAGAIN; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) @@ -2328,6 +2620,12 @@ f! { } } + pub fn CPU_ALLOC_SIZE(count: ::c_int) -> ::size_t { + let _dummy: cpu_set_t = ::mem::zeroed(); + let size_in_bits = 8 * ::mem::size_of_val(&_dummy.bits[0]); + ((count as ::size_t + size_in_bits - 1) / 8) as ::size_t + } + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.bits.iter_mut() { *slot = 0; @@ -2356,6 +2654,19 @@ f! { 0 != (cpuset.bits[idx] & (1 << offset)) } + pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> ::c_int { + let mut s: u32 = 0; + let size_of_mask = ::mem::size_of_val(&cpuset.bits[0]); + for i in cpuset.bits[..(size / size_of_mask)].iter() { + s += i.count_ones(); + }; + s as ::c_int + } + + pub fn CPU_COUNT(cpuset: &cpu_set_t) -> ::c_int { + CPU_COUNT_S(::mem::size_of::(), cpuset) + } + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { set1.bits == set2.bits } @@ -2404,6 +2715,10 @@ f! { pub fn RT_LOCALADDR(flags: u32) -> bool { (flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE) } + + pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { + ee.offset(1) as *mut ::sockaddr + } } extern "C" { @@ -2450,7 +2765,17 @@ extern "C" { pub fn endspent(); pub fn getspent() -> *mut spwd; - pub fn getspnam(__name: *const ::c_char) -> *mut spwd; + pub fn getspnam(name: *const ::c_char) -> *mut spwd; + // Only `getspnam_r` is implemented for musl, out of all of the reenterant + // functions from `shadow.h`. + // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h + pub fn getspnam_r( + name: *const ::c_char, + spbuf: *mut spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut spwd, + ) -> ::c_int; pub fn shm_open( name: *const c_char, @@ -2947,7 +3272,6 @@ extern "C" { count: ::size_t, ) -> ::ssize_t; pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -2955,15 +3279,9 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003" - )] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, @@ -2972,10 +3290,6 @@ extern "C" { result: *mut *mut ::group, ) -> ::c_int; pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003" - )] pub fn pthread_sigmask( how: ::c_int, set: *const sigset_t, @@ -2987,8 +3301,6 @@ extern "C" { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, @@ -2996,8 +3308,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -3005,11 +3315,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigwait$UNIX2003" - )] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, @@ -3027,10 +3332,6 @@ extern "C" { attr: *const pthread_mutexattr_t, pshared: *mut ::c_int, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003" - )] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn faccessat( dirfd: ::c_int, @@ -3170,6 +3471,30 @@ extern "C" { path: *const ::c_char, mask: u32, ) -> ::c_int; + pub fn fanotify_init(flags: ::c_uint, event_f_flags: ::c_uint) -> ::c_int; + + pub fn regcomp( + preg: *mut ::regex_t, + pattern: *const ::c_char, + cflags: ::c_int, + ) -> ::c_int; + + pub fn regexec( + preg: *const ::regex_t, + input: *const ::c_char, + nmatch: ::size_t, + pmatch: *mut regmatch_t, + eflags: ::c_int, + ) -> ::c_int; + + pub fn regerror( + errcode: ::c_int, + preg: *const ::regex_t, + errbuf: *mut ::c_char, + errbuf_size: ::size_t, + ) -> ::size_t; + + pub fn regfree(preg: *mut ::regex_t); } cfg_if! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/arm/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/arm/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/arm/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/arm/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/arm/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/arm/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/arm/mod.rs index ff23688..51237a2 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -150,6 +150,24 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } } pub const SIGSTKSZ: ::size_t = 8192; @@ -262,6 +280,7 @@ pub const MAP_NORESERVE: ::c_int = 0x04000; pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; @@ -418,6 +437,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 11; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/hexagon.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/hexagon.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/hexagon.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/hexagon.rs index 2340695..8124e4b 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -258,8 +258,6 @@ pub const MAP_ANON: ::c_int = 32; pub const MAP_DENYWRITE: ::c_int = 2048; pub const MAP_EXECUTABLE: ::c_int = 4096; pub const MAP_GROWSDOWN: ::c_int = 256; -pub const MAP_HUGE_MASK: ::c_int = 63; -pub const MAP_HUGE_SHIFT: ::c_int = 26; pub const MAP_HUGETLB: ::c_int = 262144; pub const MAP_LOCKED: ::c_int = 8192; pub const MAP_NONBLOCK: ::c_int = 65536; @@ -727,7 +725,6 @@ pub const TCSETX: ::c_int = 21555; pub const TCSETXF: ::c_int = 21556; pub const TCSETXW: ::c_int = 21557; pub const TCXONC: ::c_int = 21514; -pub const TIOCCBRK: ::c_int = 21544; pub const TIOCCONS: ::c_int = 21533; pub const TIOCEXCL: ::c_int = 21516; pub const TIOCGETD: ::c_int = 21540; @@ -771,7 +768,6 @@ pub const TIOCPKT_IOCTL: ::c_int = 64; pub const TIOCPKT_NOSTOP: ::c_int = 16; pub const TIOCPKT_START: ::c_int = 8; pub const TIOCPKT_STOP: ::c_int = 4; -pub const TIOCSBRK: ::c_int = 21543; pub const TIOCSCTTY: ::c_int = 21518; pub const TIOCSERCONFIG: ::c_int = 21587; pub const TIOCSERGETLSR: ::c_int = 21593; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mips/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mips/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mips/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mips/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mips/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mips/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mips/mod.rs index be11341..7dfac78 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -161,6 +161,24 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } } pub const SIGSTKSZ: ::size_t = 8192; @@ -428,6 +446,9 @@ pub const F_GETOWN: ::c_int = 23; pub const F_SETLK: ::c_int = 34; pub const F_SETLKW: ::c_int = 35; pub const F_SETOWN: ::c_int = 24; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 16; pub const VEOL: usize = 17; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mod.rs index 7cf6da9..f54e5d9 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/mod.rs @@ -3,6 +3,7 @@ pub type c_ulong = u32; pub type nlink_t = u32; pub type blksize_t = ::c_long; pub type __u64 = ::c_ulonglong; +pub type regoff_t = ::c_int; s! { pub struct pthread_attr_t { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/powerpc.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/powerpc.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/powerpc.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/powerpc.rs index 6181b1c..b94bb7b 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -421,6 +421,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 6; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/x86/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/x86/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/x86/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/x86/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/x86/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/x86/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/x86/mod.rs index fcd8ae4..9d00b52 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -154,6 +154,24 @@ s! { pub f_namemax: ::c_ulong, __f_spare: [::c_int; 6], } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } } s_no_extra_traits! { @@ -322,6 +340,7 @@ pub const MAP_NORESERVE: ::c_int = 0x04000; pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; @@ -479,6 +498,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 11; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/aarch64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/aarch64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 876ff3c..d7e06cd 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -170,6 +170,7 @@ pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; @@ -227,6 +228,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/mips64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/mips64.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/mips64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/mips64.rs index 2c41050..7c6f963 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/mips64.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/mips64.rs @@ -83,6 +83,24 @@ s! { pub f_spare: [::c_ulong; 5], } + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } + pub struct ipc_perm { pub __ipc_perm_key: ::key_t, pub uid: ::uid_t, @@ -635,6 +653,9 @@ pub const F_GETOWN: ::c_int = 23; pub const F_SETOWN: ::c_int = 24; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const TCGETS: ::c_ulong = 0x540d; pub const TCSETS: ::c_ulong = 0x540e; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/mod.rs index e6a8fc8..62abee0 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/mod.rs @@ -1,5 +1,6 @@ pub type c_long = i64; pub type c_ulong = u64; +pub type regoff_t = ::c_long; s! { pub struct statfs64 { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/powerpc64.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/powerpc64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/powerpc64.rs index d27d703..18fcd5c 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/powerpc64.rs @@ -170,6 +170,7 @@ pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; @@ -227,6 +228,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/x86_64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/x86_64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/x86_64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/x86_64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index ff9300c..59afe8e 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -48,6 +48,24 @@ s! { __reserved: [::c_long; 3], } + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } + pub struct user_regs_struct { pub r15: ::c_ulong, pub r14: ::c_ulong, @@ -777,6 +795,9 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; @@ -816,6 +837,7 @@ pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC : ::c_int = 0x080000; pub const RLIMIT_NLIMITS: ::c_int = 15; pub const TIOCINQ: ::c_int = ::FIONREAD; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/mod.rs similarity index 84% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/mod.rs index 0bddd64..b251383 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/musl/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/musl/mod.rs @@ -109,6 +109,35 @@ s! { pub l_len: ::off_t, pub l_pid: ::pid_t, } + + pub struct regex_t { + __re_nsub: ::size_t, + __opaque: *mut ::c_void, + __padding: [*mut ::c_void; 4usize], + __nsub2: ::size_t, + __padding2: ::c_char, + } + + pub struct rtentry { + pub rt_pad1: ::c_ulong, + pub rt_dst: ::sockaddr, + pub rt_gateway: ::sockaddr, + pub rt_genmask: ::sockaddr, + pub rt_flags: ::c_ushort, + pub rt_pad2: ::c_short, + pub rt_pad3: ::c_ulong, + pub rt_tos: ::c_uchar, + pub rt_class: ::c_uchar, + #[cfg(target_pointer_width = "64")] + pub rt_pad4: [::c_short; 3usize], + #[cfg(not(target_pointer_width = "64"))] + pub rt_pad4: [::c_short; 1usize], + pub rt_metric: ::c_short, + pub rt_dev: *mut ::c_char, + pub rt_mtu: ::c_ulong, + pub rt_window: ::c_ulong, + pub rt_irtt: ::c_ushort, + } } s_no_extra_traits! { @@ -199,6 +228,30 @@ cfg_if! { } } +// include/sys/mman.h +/* + * Huge page size encoding when MAP_HUGETLB is specified, and a huge page + * size other than the default is desired. See hugetlb_encode.h. + * All known huge page size encodings are provided here. It is the + * responsibility of the application to know which sizes are supported on + * the running system. See mmap(2) man page for details. + */ +pub const MAP_HUGE_SHIFT: ::c_int = 26; +pub const MAP_HUGE_MASK: ::c_int = 0x3f; + +pub const MAP_HUGE_64KB: ::c_int = 16 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_512KB: ::c_int = 19 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_1MB: ::c_int = 20 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_2MB: ::c_int = 21 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_8MB: ::c_int = 23 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_16MB: ::c_int = 24 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_32MB: ::c_int = 25 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_256MB: ::c_int = 28 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_512MB: ::c_int = 29 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_1GB: ::c_int = 30 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_2GB: ::c_int = 31 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT; + pub const MS_RMT_MASK: ::c_ulong = 0x02800051; pub const SFD_CLOEXEC: ::c_int = 0x080000; @@ -271,6 +324,7 @@ pub const TCP_QUEUE_SEQ: ::c_int = 21; pub const TCP_REPAIR_OPTIONS: ::c_int = 22; pub const TCP_FASTOPEN: ::c_int = 23; pub const TCP_TIMESTAMP: ::c_int = 24; +pub const TCP_FASTOPEN_CONNECT: ::c_int = 30; #[deprecated(since = "0.2.55", note = "Use SIGSYS instead")] pub const SIGUNUSED: ::c_int = ::SIGSYS; @@ -327,10 +381,7 @@ pub const TCSAFLUSH: ::c_int = 2; pub const RTLD_GLOBAL: ::c_int = 0x100; pub const RTLD_NOLOAD: ::c_int = 0x4; -// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also linux_like/mod.rs pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -pub const CLOCK_TAI: ::clockid_t = 11; pub const B0: ::speed_t = 0o000000; pub const B50: ::speed_t = 0o000001; @@ -369,6 +420,15 @@ pub const RLIMIT_MSGQUEUE: ::c_int = 12; pub const RLIMIT_NICE: ::c_int = 13; pub const RLIMIT_RTPRIO: ::c_int = 14; +pub const REG_OK: ::c_int = 0; + +pub const TIOCSBRK: ::c_int = 0x5427; +pub const TIOCCBRK: ::c_int = 0x5428; + +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + extern "C" { pub fn sendmmsg( sockfd: ::c_int, @@ -422,6 +482,16 @@ extern "C" { needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void; + // Musl targets need the `mask` argument of `fanotify_mark` be specified + // `::c_ulonglong` instead of `u64` or there will be a type mismatch between + // `long long unsigned int` and the expected `uint64_t`. + pub fn fanotify_mark( + fd: ::c_int, + flags: ::c_uint, + mask: ::c_ulonglong, + dirfd: ::c_int, + path: *const ::c_char, + ) -> ::c_int; } cfg_if! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/no_align.rs similarity index 88% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/no_align.rs index 13c2b71..7393d70 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/linux/no_align.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/linux/no_align.rs @@ -7,6 +7,7 @@ macro_rules! expand_align { target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64", + target_arch = "riscv64", all(target_arch = "aarch64", target_env = "musl")))] __align: [::c_int; 0], @@ -15,6 +16,7 @@ macro_rules! expand_align { target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64", + target_arch = "riscv64", all(target_arch = "aarch64", target_env = "musl"))))] __align: [::c_long; 0], @@ -33,6 +35,17 @@ macro_rules! expand_align { __align: [::c_int; 0], size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } + + pub struct fanotify_event_metadata { + __align: [::c_long; 0], + pub event_len: __u32, + pub vers: __u8, + pub reserved: __u8, + pub metadata_len: __u16, + pub mask: __u64, + pub fd: ::c_int, + pub pid: ::c_int, + } } s_no_extra_traits! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/mod.rs similarity index 96% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/mod.rs index f9c5ea5..df71ecb 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/linux_like/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/linux_like/mod.rs @@ -50,6 +50,8 @@ s! { pub sin6_scope_id: u32, } + // The order of the `ai_addr` field in this struct is crucial + // for converting between the Rust and C types. pub struct addrinfo { pub ai_flags: ::c_int, pub ai_family: ::c_int, @@ -199,16 +201,6 @@ s! { pub msg_hdr: ::msghdr, pub msg_len: ::c_uint, } - - pub struct sock_extended_err { - pub ee_errno: u32, - pub ee_origin: u8, - pub ee_type: u8, - pub ee_code: u8, - pub ee_pad: u8, - pub ee_info: u32, - pub ee_data: u32 - } } s_no_extra_traits! { @@ -482,7 +474,7 @@ pub const F_SEAL_SHRINK: ::c_int = 0x0002; pub const F_SEAL_GROW: ::c_int = 0x0004; pub const F_SEAL_WRITE: ::c_int = 0x0008; -// TODO(#235): Include file sealing fcntls once we have a way to verify them. +// FIXME(#235): Include file sealing fcntls once we have a way to verify them. pub const SIGTRAP: ::c_int = 5; @@ -499,10 +491,7 @@ pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; pub const CLOCK_BOOTTIME: ::clockid_t = 7; pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8; pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9; -// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep -// 2014.) See also musl/mod.rs -// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; -// pub const CLOCK_TAI: ::clockid_t = 11; +pub const CLOCK_TAI: ::clockid_t = 11; pub const TIMER_ABSTIME: ::c_int = 1; pub const RUSAGE_SELF: ::c_int = 0; @@ -612,42 +601,6 @@ pub const MS_ACTIVE: ::c_ulong = 0x40000000; pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; -pub const EPERM: ::c_int = 1; -pub const ENOENT: ::c_int = 2; -pub const ESRCH: ::c_int = 3; -pub const EINTR: ::c_int = 4; -pub const EIO: ::c_int = 5; -pub const ENXIO: ::c_int = 6; -pub const E2BIG: ::c_int = 7; -pub const ENOEXEC: ::c_int = 8; -pub const EBADF: ::c_int = 9; -pub const ECHILD: ::c_int = 10; -pub const EAGAIN: ::c_int = 11; -pub const ENOMEM: ::c_int = 12; -pub const EACCES: ::c_int = 13; -pub const EFAULT: ::c_int = 14; -pub const ENOTBLK: ::c_int = 15; -pub const EBUSY: ::c_int = 16; -pub const EEXIST: ::c_int = 17; -pub const EXDEV: ::c_int = 18; -pub const ENODEV: ::c_int = 19; -pub const ENOTDIR: ::c_int = 20; -pub const EISDIR: ::c_int = 21; -pub const EINVAL: ::c_int = 22; -pub const ENFILE: ::c_int = 23; -pub const EMFILE: ::c_int = 24; -pub const ENOTTY: ::c_int = 25; -pub const ETXTBSY: ::c_int = 26; -pub const EFBIG: ::c_int = 27; -pub const ENOSPC: ::c_int = 28; -pub const ESPIPE: ::c_int = 29; -pub const EROFS: ::c_int = 30; -pub const EMLINK: ::c_int = 31; -pub const EPIPE: ::c_int = 32; -pub const EDOM: ::c_int = 33; -pub const ERANGE: ::c_int = 34; -pub const EWOULDBLOCK: ::c_int = EAGAIN; - pub const SCM_RIGHTS: ::c_int = 0x01; pub const SCM_CREDENTIALS: ::c_int = 0x02; @@ -822,6 +775,7 @@ pub const IP_TOS: ::c_int = 1; pub const IP_TTL: ::c_int = 2; pub const IP_HDRINCL: ::c_int = 3; pub const IP_PKTINFO: ::c_int = 8; +pub const IP_MTU_DISCOVER: ::c_int = 10; pub const IP_RECVTOS: ::c_int = 13; pub const IP_RECVERR: ::c_int = 11; pub const IP_ADD_MEMBERSHIP: ::c_int = 35; @@ -838,7 +792,6 @@ pub const IPV6_2292PKTOPTIONS: ::c_int = 6; pub const IPV6_CHECKSUM: ::c_int = 7; pub const IPV6_2292HOPLIMIT: ::c_int = 8; pub const IPV6_NEXTHOP: ::c_int = 9; -pub const IPV6_FLOWINFO: ::c_int = 11; pub const IPV6_UNICAST_HOPS: ::c_int = 16; pub const IPV6_MULTICAST_IF: ::c_int = 17; pub const IPV6_MULTICAST_HOPS: ::c_int = 18; @@ -854,9 +807,15 @@ pub const IPV6_JOIN_ANYCAST: ::c_int = 27; pub const IPV6_LEAVE_ANYCAST: ::c_int = 28; pub const IPV6_RECVPKTINFO: ::c_int = 49; pub const IPV6_PKTINFO: ::c_int = 50; +pub const IPV6_HOPLIMIT: ::c_int = 52; pub const IPV6_RECVTCLASS: ::c_int = 66; pub const IPV6_TCLASS: ::c_int = 67; +pub const IP_PMTUDISC_DONT: ::c_int = 0; +pub const IP_PMTUDISC_WANT: ::c_int = 1; +pub const IP_PMTUDISC_DO: ::c_int = 2; +pub const IP_PMTUDISC_PROBE: ::c_int = 3; + pub const TCP_NODELAY: ::c_int = 1; pub const TCP_MAXSEG: ::c_int = 2; pub const TCP_CORK: ::c_int = 3; @@ -1199,13 +1158,6 @@ pub const ARPHRD_IEEE802154: u16 = 804; pub const ARPHRD_VOID: u16 = 0xFFFF; pub const ARPHRD_NONE: u16 = 0xFFFE; -pub const SO_EE_ORIGIN_NONE: u8 = 0; -pub const SO_EE_ORIGIN_LOCAL: u8 = 1; -pub const SO_EE_ORIGIN_ICMP: u8 = 2; -pub const SO_EE_ORIGIN_ICMP6: u8 = 3; -pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4; -pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS; - const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) @@ -1311,10 +1263,6 @@ f! { pub fn IPTOS_ECN(x: u8) -> u8 { x & ::IPTOS_ECN_MASK } - - pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr { - ee.offset(1) as *mut ::sockaddr - } } extern "C" { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/mod.rs index ad0217f..55b892f 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/mod.rs @@ -226,8 +226,12 @@ pub const S_ISUID: ::mode_t = 0x800; pub const S_ISGID: ::mode_t = 0x400; pub const S_ISVTX: ::mode_t = 0x200; -pub const IF_NAMESIZE: ::size_t = 16; -pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; +cfg_if! { + if #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] { + pub const IF_NAMESIZE: ::size_t = 16; + pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; + } +} pub const LOG_EMERG: ::c_int = 0; pub const LOG_ALERT: ::c_int = 1; @@ -265,10 +269,6 @@ pub const LOG_NOWAIT: ::c_int = 0x10; pub const LOG_PRIMASK: ::c_int = 7; pub const LOG_FACMASK: ::c_int = 0x3f8; -pub const PRIO_PROCESS: ::c_int = 0; -pub const PRIO_PGRP: ::c_int = 1; -pub const PRIO_USER: ::c_int = 2; - pub const PRIO_MIN: ::c_int = -20; pub const PRIO_MAX: ::c_int = 20; @@ -365,7 +365,7 @@ impl ::Clone for FILE { } } #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // TODO: fill this out with a struct +pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { @@ -521,6 +521,7 @@ extern "C" { pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t; pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t; pub fn strdup(cs: *const c_char) -> *mut c_char; + pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char; pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char; pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char; pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int; @@ -538,6 +539,7 @@ extern "C" { pub fn strerror(n: c_int) -> *mut c_char; pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char; pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t; + pub fn strsignal(sig: c_int) -> *mut c_char; pub fn wcslen(buf: *const wchar_t) -> size_t; pub fn wcstombs( dest: *mut c_char, @@ -546,6 +548,7 @@ extern "C" { ) -> ::size_t; pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; pub fn memcpy( dest: *mut c_void, @@ -610,7 +613,6 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "listen$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_listen")] pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), @@ -853,6 +855,7 @@ extern "C" { pub fn geteuid() -> uid_t; pub fn getgid() -> gid_t; pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int; + #[cfg_attr(target_os = "illumos", link_name = "getloginx")] pub fn getlogin() -> *mut c_char; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), @@ -909,6 +912,7 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "ttyname_r$UNIX2003" )] + #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")] pub fn ttyname_r( fd: ::c_int, buf: *mut c_char, @@ -1215,6 +1219,7 @@ extern "C" { pub fn dlclose(handle: *mut ::c_void) -> ::c_int; pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int; + #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")] pub fn getaddrinfo( node: *const c_char, service: *const c_char, @@ -1446,6 +1451,12 @@ extern "C" { n: *mut size_t, stream: *mut FILE, ) -> ssize_t; + + pub fn lockf( + fd: ::c_int, + cmd: ::c_int, + len: ::off_t, + ) -> ::c_int; } cfg_if! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/aarch64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/aarch64/mod.rs similarity index 75% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/aarch64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/aarch64/mod.rs index 7e1b2bb..3a68bf4 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/aarch64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/aarch64/mod.rs @@ -1,3 +1,4 @@ +pub type clock_t = ::c_long; pub type c_char = u8; pub type wchar_t = u32; @@ -29,5 +30,13 @@ s! { } } +pub const FIONBIO: ::c_ulong = 1; + +pub const POLLIN: ::c_short = 0x1; +pub const POLLPRI: ::c_short = 0x2; pub const POLLOUT: ::c_short = 0x4; +pub const POLLERR: ::c_short = 0x8; pub const POLLHUP: ::c_short = 0x10; +pub const POLLNVAL: ::c_short = 0x20; + +pub const SOL_SOCKET: ::c_int = 65535; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/arm/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/arm/mod.rs similarity index 75% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/arm/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/arm/mod.rs index 39cb425..27274f7 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/arm/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/arm/mod.rs @@ -1,3 +1,4 @@ +pub type clock_t = ::c_long; pub type c_char = u8; pub type wchar_t = u32; @@ -31,5 +32,13 @@ s! { } } -pub const POLLOUT: ::c_short = 0x10; +pub const FIONBIO: ::c_ulong = 1; + +pub const POLLIN: ::c_short = 0x1; +pub const POLLPRI: ::c_short = 0x2; pub const POLLHUP: ::c_short = 0x4; +pub const POLLERR: ::c_short = 0x8; +pub const POLLOUT: ::c_short = 0x10; +pub const POLLNVAL: ::c_short = 0x20; + +pub const SOL_SOCKET: ::c_int = 65535; diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/mod.rs similarity index 94% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/mod.rs index bd9a107..5f53f61 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/mod.rs @@ -1,6 +1,5 @@ pub type blkcnt_t = i32; pub type blksize_t = i32; -pub type clock_t = i32; pub type clockid_t = ::c_ulong; pub type dev_t = u32; pub type fsblkcnt_t = u64; @@ -25,14 +24,23 @@ pub type time_t = i32; pub type useconds_t = u32; s! { + // The order of the `ai_addr` field in this struct is crucial + // for converting between the Rust and C types. pub struct addrinfo { pub ai_flags: ::c_int, pub ai_family: ::c_int, pub ai_socktype: ::c_int, pub ai_protocol: ::c_int, pub ai_addrlen: socklen_t, - pub ai_canonname: *mut ::c_char, + + #[cfg(target_arch = "xtensa")] pub ai_addr: *mut sockaddr, + + pub ai_canonname: *mut ::c_char, + + #[cfg(not(target_arch = "xtensa"))] + pub ai_addr: *mut sockaddr, + pub ai_next: *mut addrinfo, } @@ -364,11 +372,6 @@ pub const O_NONBLOCK: ::c_int = 16384; pub const O_ACCMODE: ::c_int = 3; pub const O_CLOEXEC: ::c_int = 0x80000; -pub const POLLIN: ::c_short = 0x1; -pub const POLLPRI: ::c_short = 0x2; -pub const POLLERR: ::c_short = 0x8; -pub const POLLNVAL: ::c_short = 0x20; - pub const RTLD_LAZY: ::c_int = 0x1; pub const STDIN_FILENO: ::c_int = 0; @@ -379,7 +382,6 @@ pub const SEEK_SET: ::c_int = 0; pub const SEEK_CUR: ::c_int = 1; pub const SEEK_END: ::c_int = 2; -pub const FIONBIO: ::c_ulong = 1; pub const FIOCLEX: ::c_ulong = 0x20006601; pub const FIONCLEX: ::c_ulong = 0x20006602; @@ -406,7 +408,6 @@ pub const S_IROTH: ::mode_t = 4; pub const S_IWOTH: ::mode_t = 2; pub const S_IXOTH: ::mode_t = 1; -pub const SOL_SOCKET: ::c_int = 65535; pub const SOL_TCP: ::c_int = 6; pub const PF_UNSPEC: ::c_int = 0; @@ -417,6 +418,10 @@ pub const AF_UNSPEC: ::c_int = 0; pub const AF_INET: ::c_int = 2; pub const AF_INET6: ::c_int = 23; +pub const CLOCK_REALTIME: ::clockid_t = 1; +pub const CLOCK_MONOTONIC: ::clockid_t = 4; +pub const CLOCK_BOOTTIME: ::clockid_t = 4; + pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; @@ -543,6 +548,13 @@ pub const EAI_MEMORY: ::c_int = -304; pub const EAI_NONAME: ::c_int = -305; pub const EAI_SOCKTYPE: ::c_int = -307; +pub const EXIT_SUCCESS: ::c_int = 0; +pub const EXIT_FAILURE: ::c_int = 1; + +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; @@ -597,6 +609,18 @@ extern "C" { pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int; + pub fn clock_settime( + clock_id: ::clockid_t, + tp: *const ::timespec, + ) -> ::c_int; + pub fn clock_gettime( + clock_id: ::clockid_t, + tp: *mut ::timespec, + ) -> ::c_int; + pub fn clock_getres( + clock_id: ::clockid_t, + res: *mut ::timespec, + ) -> ::c_int; pub fn closesocket(sockfd: ::c_int) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn recvfrom( @@ -623,7 +647,6 @@ extern "C" { envp: *const *const ::c_char, ) -> ::c_int; pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -631,15 +654,9 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003" - )] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, @@ -647,10 +664,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003" - )] pub fn pthread_sigmask( how: ::c_int, set: *const sigset_t, @@ -661,8 +674,6 @@ extern "C" { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, @@ -670,8 +681,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -679,11 +688,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigwait$UNIX2003" - )] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, @@ -691,10 +695,6 @@ extern "C" { child: ::Option, ) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003" - )] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn uname(buf: *mut ::utsname) -> ::c_int; } @@ -706,6 +706,9 @@ cfg_if! { } else if #[cfg(target_arch = "aarch64")] { mod aarch64; pub use self::aarch64::*; + } else if #[cfg(target_arch = "xtensa")] { + mod xtensa; + pub use self::xtensa::*; } else { // Only tested on ARM so far. Other platforms might have different // definitions for types and constants. diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/newlib/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/xtensa/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/xtensa/mod.rs new file mode 100644 index 0000000..bf95d9c --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/newlib/xtensa/mod.rs @@ -0,0 +1,97 @@ +pub type clock_t = ::c_ulong; +pub type c_char = i8; +pub type wchar_t = u32; + +pub type c_long = i32; +pub type c_ulong = u32; + +s! { + pub struct cmsghdr { + pub cmsg_len: ::socklen_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::c_int, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::socklen_t, + pub msg_flags: ::c_int, + } + + pub struct sockaddr_un { + pub sun_family: ::sa_family_t, + pub sun_path: [::c_char; 108], + } + + pub struct sockaddr { + pub sa_len: u8, + pub sa_family: ::sa_family_t, + pub sa_data: [::c_char; 14], + } + + pub struct sockaddr_in6 { + pub sin6_len: u8, + pub sin6_family: ::sa_family_t, + pub sin6_port: ::in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: ::in6_addr, + pub sin6_scope_id: u32, + } + + pub struct sockaddr_in { + pub sin_len: u8, + pub sin_family: ::sa_family_t, + pub sin_port: ::in_port_t, + pub sin_addr: ::in_addr, + pub sin_zero: [::c_char; 8], + } + + pub struct sockaddr_storage { + pub s2_len: u8, + pub ss_family: ::sa_family_t, + pub s2_data1: [::c_char; 2], + pub s2_data2: [u32; 3], + pub s2_data3: [u32; 3], + } +} + +pub const AF_UNIX: ::c_int = 1; + +pub const FIONBIO: ::c_ulong = 2147772030; + +pub const POLLIN: ::c_short = 1 << 0; +pub const POLLRDNORM: ::c_short = 1 << 1; +pub const POLLRDBAND: ::c_short = 1 << 2; +pub const POLLPRI: ::c_short = POLLRDBAND; +pub const POLLOUT: ::c_short = 1 << 3; +pub const POLLWRNORM: ::c_short = POLLOUT; +pub const POLLWRBAND: ::c_short = 1 << 4; +pub const POLLERR: ::c_short = 1 << 5; +pub const POLLHUP: ::c_short = 1 << 6; + +pub const SOL_SOCKET: ::c_int = 0xfff; + +extern "C" { + pub fn sendmsg( + s: ::c_int, + msg: *const ::msghdr, + flags: ::c_int, + ) -> ::ssize_t; + pub fn recvmsg( + s: ::c_int, + msg: *mut ::msghdr, + flags: ::c_int, + ) -> ::ssize_t; + + pub fn writev(s: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) + -> ::c_int; + pub fn readv( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + ) -> ::ssize_t; +} diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/redox/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/redox/mod.rs similarity index 96% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/redox/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/redox/mod.rs index 4ea52e3..55f64ee 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/redox/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/redox/mod.rs @@ -258,7 +258,7 @@ pub const F_GETLK: ::c_int = 5; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; -// TODO: relibc { +// FIXME: relibc { pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; // } @@ -413,7 +413,7 @@ pub const F_GETFD: ::c_int = 1; pub const F_SETFD: ::c_int = 2; pub const F_GETFL: ::c_int = 3; pub const F_SETFL: ::c_int = 4; -// TODO: relibc { +// FIXME: relibc { pub const F_DUPFD_CLOEXEC: ::c_int = ::F_DUPFD; // } pub const FD_CLOEXEC: ::c_int = 0x0100_0000; @@ -435,14 +435,14 @@ pub const O_DIRECTORY: ::c_int = 0x1000_0000; pub const O_PATH: ::c_int = 0x2000_0000; pub const O_SYMLINK: ::c_int = 0x4000_0000; // Negative to allow it to be used as int -// TODO: Fix negative values missing from includes +// FIXME: Fix negative values missing from includes pub const O_NOFOLLOW: ::c_int = -0x8000_0000; // netdb.h pub const EAI_SYSTEM: ::c_int = -11; // netinet/in.h -// TODO: relibc { +// FIXME: relibc { pub const IP_TTL: ::c_int = 2; pub const IPV6_UNICAST_HOPS: ::c_int = 16; pub const IPV6_MULTICAST_IF: ::c_int = 17; @@ -460,7 +460,7 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 36; // netinet/tcp.h pub const TCP_NODELAY: ::c_int = 1; -// TODO: relibc { +// FIXME: relibc { pub const TCP_KEEPIDLE: ::c_int = 1; // } @@ -575,7 +575,7 @@ pub const EXIT_SUCCESS: ::c_int = 0; pub const EXIT_FAILURE: ::c_int = 1; // sys/ioctl.h -// TODO: relibc { +// FIXME: relibc { pub const FIONBIO: ::c_ulong = 0x5421; pub const FIOCLEX: ::c_ulong = 0x5451; // } @@ -587,6 +587,23 @@ pub const TIOCSPGRP: ::c_ulong = 0x5410; pub const TIOCGWINSZ: ::c_ulong = 0x5413; pub const TIOCSWINSZ: ::c_ulong = 0x5414; +// sys/mman.h +pub const PROT_NONE: ::c_int = 0x0000; +pub const PROT_READ: ::c_int = 0x0004; +pub const PROT_WRITE: ::c_int = 0x0002; +pub const PROT_EXEC: ::c_int = 0x0001; + +pub const MAP_SHARED: ::c_int = 0x0001; +pub const MAP_PRIVATE: ::c_int = 0x0002; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; +pub const MAP_FIXED: ::c_int = 0x0010; +pub const MAP_FAILED: *mut ::c_void = !0 as _; + +pub const MS_ASYNC: ::c_int = 0x0001; +pub const MS_INVALIDATE: ::c_int = 0x0002; +pub const MS_SYNC: ::c_int = 0x0004; + // sys/select.h pub const FD_SETSIZE: usize = 1024; @@ -806,6 +823,10 @@ pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18; pub const _PC_SYMLINK_MAX: ::c_int = 19; pub const _PC_2_SYMLINKS: ::c_int = 20; +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + // wait.h f! { pub fn WIFSTOPPED(status: ::c_int) -> bool { @@ -934,6 +955,24 @@ extern "C" { // sys/ioctl.h pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + // sys/mman.h + pub fn msync( + addr: *mut ::c_void, + len: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn mprotect( + addr: *mut ::c_void, + len: ::size_t, + prot: ::c_int, + ) -> ::c_int; + pub fn shm_open( + name: *const c_char, + oflag: ::c_int, + mode: mode_t, + ) -> ::c_int; + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + // sys/resource.h pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int; pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int; diff --git a/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/compat.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/compat.rs new file mode 100644 index 0000000..610dd10 --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/compat.rs @@ -0,0 +1,47 @@ +// Common functions that are unfortunately missing on illumos and +// Solaris, but often needed by other crates. + +use unix::solarish::*; + +pub unsafe fn cfmakeraw(termios: *mut ::termios) { + (*termios).c_iflag &= !(IMAXBEL + | IGNBRK + | BRKINT + | PARMRK + | ISTRIP + | INLCR + | IGNCR + | ICRNL + | IXON); + (*termios).c_oflag &= !OPOST; + (*termios).c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + (*termios).c_cflag &= !(CSIZE | PARENB); + (*termios).c_cflag |= CS8; + + // By default, most software expects a pending read to block until at + // least one byte becomes available. As per termio(7I), this requires + // setting the MIN and TIME parameters appropriately. + // + // As a somewhat unfortunate artefact of history, the MIN and TIME slots + // in the control character array overlap with the EOF and EOL slots used + // for canonical mode processing. Because the EOF character needs to be + // the ASCII EOT value (aka Control-D), it has the byte value 4. When + // switching to raw mode, this is interpreted as a MIN value of 4; i.e., + // reads will block until at least four bytes have been input. + // + // Other platforms with a distinct MIN slot like Linux and FreeBSD appear + // to default to a MIN value of 1, so we'll force that value here: + (*termios).c_cc[VMIN] = 1; + (*termios).c_cc[VTIME] = 0; +} + +pub unsafe fn cfsetspeed( + termios: *mut ::termios, + speed: ::speed_t, +) -> ::c_int { + // Neither of these functions on illumos or Solaris actually ever + // return an error + ::cfsetispeed(termios, speed); + ::cfsetospeed(termios, speed); + 0 +} diff --git a/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/illumos.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/illumos.rs new file mode 100644 index 0000000..42b4af3 --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/illumos.rs @@ -0,0 +1,27 @@ +s! { + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_amp: *mut ::c_void, + pub shm_lkcnt: ::c_ushort, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + pub shm_cnattch: ::c_ulong, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_pad4: [i64; 4], + } +} + +pub const AF_LOCAL: ::c_int = 1; // AF_UNIX +pub const AF_FILE: ::c_int = 1; // AF_UNIX + +extern "C" { + pub fn mincore( + addr: ::caddr_t, + len: ::size_t, + vec: *mut ::c_char, + ) -> ::c_int; +} diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/mod.rs similarity index 95% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/mod.rs index 1361367..b0eecf1 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/solarish/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/mod.rs @@ -1,6 +1,7 @@ pub type c_char = i8; pub type c_long = i64; pub type c_ulong = u64; +pub type caddr_t = *mut ::c_char; pub type clockid_t = ::c_int; pub type blkcnt_t = ::c_long; @@ -36,9 +37,6 @@ pub type id_t = ::c_int; pub type idtype_t = ::c_uint; pub type shmatt_t = ::c_ulong; -pub type door_attr_t = ::c_uint; -pub type door_id_t = ::c_ulonglong; - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} @@ -217,33 +215,6 @@ s! { pub ai_next: *mut addrinfo, } - pub struct shmid_ds { - pub shm_perm: ipc_perm, - pub shm_segsz: ::size_t, - #[cfg(target_os = "illumos")] - pub shm_amp: *mut ::c_void, - #[cfg(target_os = "solaris")] - pub shm_flags: ::uintptr_t, - pub shm_lkcnt: ::c_ushort, - pub shm_lpid: ::pid_t, - pub shm_cpid: ::pid_t, - pub shm_nattch: ::shmatt_t, - pub shm_cnattch: ::c_ulong, - pub shm_atime: ::time_t, - pub shm_dtime: ::time_t, - pub shm_ctime: ::time_t, - #[cfg(target_os = "illumos")] - pub shm_pad4: [i64; 4], - #[cfg(target_os = "solaris")] - pub shm_amp: *mut ::c_void, - #[cfg(target_os = "solaris")] - pub shm_gransize: u64, - #[cfg(target_os = "solaris")] - pub shm_allocated: u64, - #[cfg(target_os = "solaris")] - pub shm_pad4: [i64; 1], - } - pub struct sigset_t { bits: [u32; 4], } @@ -371,7 +342,7 @@ s! { pub mq_maxmsg: ::c_long, pub mq_msgsize: ::c_long, pub mq_curmsgs: ::c_long, - _pad: [::c_int; 4] + _pad: [::c_int; 12] } pub struct port_event { @@ -382,11 +353,6 @@ s! { pub portev_user: *mut ::c_void, } - pub struct door_desc_t__d_data__d_desc { - pub d_descriptor: ::c_int, - pub d_id: ::door_id_t - } - pub struct exit_status { e_termination: ::c_short, e_exit: ::c_short, @@ -401,10 +367,44 @@ s! { pub ut_exit: exit_status, pub ut_time: ::time_t, } + + pub struct timex { + pub modes: u32, + pub offset: i32, + pub freq: i32, + pub maxerror: i32, + pub esterror: i32, + pub status: i32, + pub constant: i32, + pub precision: i32, + pub tolerance: i32, + pub ppsfreq: i32, + pub jitter: i32, + pub shift: i32, + pub stabil: i32, + pub jitcnt: i32, + pub calcnt: i32, + pub errcnt: i32, + pub stbcnt: i32, + } + + pub struct ntptimeval { + pub time: ::timeval, + pub maxerror: i32, + pub esterror: i32, + } + } s_no_extra_traits! { - #[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), repr(packed))] + #[cfg_attr(all( + any(target_arch = "x86", target_arch = "x86_64"), + libc_packedN + ), repr(packed(4)))] + #[cfg_attr(all( + any(target_arch = "x86", target_arch = "x86_64"), + not(libc_packedN) + ), repr(packed))] pub struct epoll_event { pub events: u32, pub u64: u64, @@ -478,28 +478,6 @@ s_no_extra_traits! { pub sigev_notify_attributes: *const ::pthread_attr_t, __sigev_pad2: ::c_int, } - - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] - pub union door_desc_t__d_data { - pub d_desc: door_desc_t__d_data__d_desc, - d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */ - } - - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] - pub struct door_desc_t { - pub d_attributes: door_attr_t, - pub d_data: door_desc_t__d_data, - } - - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] - pub struct door_arg_t { - pub data_ptr: *const ::c_char, - pub data_size: ::size_t, - pub desc_ptr: *const door_desc_t, - pub dec_num: ::c_uint, - pub rbuf: *const ::c_char, - pub rsize: ::size_t, - } } cfg_if! { @@ -991,7 +969,7 @@ pub const O_CREAT: ::c_int = 256; pub const O_EXCL: ::c_int = 1024; pub const O_NOCTTY: ::c_int = 2048; pub const O_TRUNC: ::c_int = 512; -pub const O_NOFOLLOW: ::c_int = 0x200000; +pub const O_NOFOLLOW: ::c_int = 0x20000; pub const O_SEARCH: ::c_int = 0x200000; pub const O_EXEC: ::c_int = 0x400000; pub const O_CLOEXEC: ::c_int = 0x800000; @@ -1075,6 +1053,10 @@ pub const WNOWAIT: ::c_int = 0x80; pub const AT_FDCWD: ::c_int = 0xffd19553; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x1000; +pub const AT_SYMLINK_FOLLOW: ::c_int = 0x2000; +pub const AT_REMOVEDIR: ::c_int = 0x1; +pub const _AT_TRIGGER: ::c_int = 0x2; +pub const AT_EACCESS: ::c_int = 0x4; pub const P_PID: idtype_t = 0; pub const P_PPID: idtype_t = 1; @@ -1330,7 +1312,7 @@ pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM; #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: rlim_t = 7; -pub const RLIM_INFINITY: rlim_t = 0x7fffffff; +pub const RLIM_INFINITY: rlim_t = 0xfffffffffffffffd; pub const RUSAGE_SELF: ::c_int = 0; pub const RUSAGE_CHILDREN: ::c_int = -1; @@ -1344,8 +1326,6 @@ pub const MADV_FREE: ::c_int = 5; pub const AF_UNSPEC: ::c_int = 0; pub const AF_UNIX: ::c_int = 1; -pub const AF_LOCAL: ::c_int = 0; -pub const AF_FILE: ::c_int = 0; pub const AF_INET: ::c_int = 2; pub const AF_IMPLINK: ::c_int = 3; pub const AF_PUP: ::c_int = 4; @@ -1434,6 +1414,9 @@ pub const MSG_DUPCTRL: ::c_int = 0x800; pub const MSG_XPG4_2: ::c_int = 0x8000; pub const MSG_MAXIOVLEN: ::c_int = 16; +pub const IF_NAMESIZE: ::size_t = 32; +pub const IFNAMSIZ: ::size_t = 16; + // https://docs.oracle.com/cd/E23824_01/html/821-1475/if-7p.html pub const IFF_UP: ::c_int = 0x0000000001; // Address is up pub const IFF_BROADCAST: ::c_int = 0x0000000002; // Broadcast address valid @@ -1749,8 +1732,6 @@ pub const PORT_SOURCE_FD: ::c_int = 4; pub const PORT_SOURCE_ALERT: ::c_int = 5; pub const PORT_SOURCE_MQ: ::c_int = 6; pub const PORT_SOURCE_FILE: ::c_int = 7; -pub const PORT_SOURCE_POSTWAIT: ::c_int = 8; -pub const PORT_SOURCE_SIGNAL: ::c_int = 9; pub const NONROOT_USR: ::c_short = 2; pub const _UTX_USERSIZE: usize = 32; @@ -1857,7 +1838,6 @@ pub const EPOLLERR: ::c_int = 0x8; pub const EPOLLHUP: ::c_int = 0x10; pub const EPOLLET: ::c_int = 0x80000000; pub const EPOLLRDHUP: ::c_int = 0x2000; -pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; pub const EPOLLONESHOT: ::c_int = 0x40000000; pub const EPOLL_CLOEXEC: ::c_int = 0x80000; pub const EPOLL_CTL_ADD: ::c_int = 1; @@ -1889,9 +1869,9 @@ pub const B230400: speed_t = 20; pub const B307200: speed_t = 21; pub const B460800: speed_t = 22; pub const B921600: speed_t = 23; -pub const CSTART: ::tcflag_t = 021; -pub const CSTOP: ::tcflag_t = 023; -pub const CSWTCH: ::tcflag_t = 032; +pub const CSTART: ::tcflag_t = 0o21; +pub const CSTOP: ::tcflag_t = 0o23; +pub const CSWTCH: ::tcflag_t = 0o32; pub const CSIZE: ::tcflag_t = 0o000060; pub const CS5: ::tcflag_t = 0; pub const CS6: ::tcflag_t = 0o000020; @@ -1963,6 +1943,62 @@ pub const SOCK_CLOEXEC: ::c_int = 0x080000; pub const SOCK_NONBLOCK: ::c_int = 0x100000; pub const SOCK_NDELAY: ::c_int = 0x200000; +// +pub const SCALE_KG: ::c_int = 1 << 6; +pub const SCALE_KF: ::c_int = 1 << 16; +pub const SCALE_KH: ::c_int = 1 << 2; +pub const MAXTC: ::c_int = 1 << 6; +pub const SCALE_PHASE: ::c_int = 1 << 22; +pub const SCALE_USEC: ::c_int = 1 << 16; +pub const SCALE_UPDATE: ::c_int = SCALE_KG * MAXTC; +pub const FINEUSEC: ::c_int = 1 << 22; +pub const MAXPHASE: ::c_int = 512000; +pub const MAXFREQ: ::c_int = 512 * SCALE_USEC; +pub const MAXTIME: ::c_int = 200 << PPS_AVG; +pub const MINSEC: ::c_int = 16; +pub const MAXSEC: ::c_int = 1200; +pub const PPS_AVG: ::c_int = 2; +pub const PPS_SHIFT: ::c_int = 2; +pub const PPS_SHIFTMAX: ::c_int = 8; +pub const PPS_VALID: ::c_int = 120; +pub const MAXGLITCH: ::c_int = 30; +pub const MOD_OFFSET: u32 = 0x0001; +pub const MOD_FREQUENCY: u32 = 0x0002; +pub const MOD_MAXERROR: u32 = 0x0004; +pub const MOD_ESTERROR: u32 = 0x0008; +pub const MOD_STATUS: u32 = 0x0010; +pub const MOD_TIMECONST: u32 = 0x0020; +pub const MOD_CLKB: u32 = 0x4000; +pub const MOD_CLKA: u32 = 0x8000; +pub const STA_PLL: u32 = 0x0001; +pub const STA_PPSFREQ: i32 = 0x0002; +pub const STA_PPSTIME: i32 = 0x0004; +pub const STA_FLL: i32 = 0x0008; +pub const STA_INS: i32 = 0x0010; +pub const STA_DEL: i32 = 0x0020; +pub const STA_UNSYNC: i32 = 0x0040; +pub const STA_FREQHOLD: i32 = 0x0080; +pub const STA_PPSSIGNAL: i32 = 0x0100; +pub const STA_PPSJITTER: i32 = 0x0200; +pub const STA_PPSWANDER: i32 = 0x0400; +pub const STA_PPSERROR: i32 = 0x0800; +pub const STA_CLOCKERR: i32 = 0x1000; +pub const STA_RONLY: i32 = STA_PPSSIGNAL + | STA_PPSJITTER + | STA_PPSWANDER + | STA_PPSERROR + | STA_CLOCKERR; +pub const TIME_OK: i32 = 0; +pub const TIME_INS: i32 = 1; +pub const TIME_DEL: i32 = 2; +pub const TIME_OOP: i32 = 3; +pub const TIME_WAIT: i32 = 4; +pub const TIME_ERROR: i32 = 5; + +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; @@ -2054,11 +2090,6 @@ extern "C" { pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int; - pub fn mincore( - addr: *const ::c_void, - len: ::size_t, - vec: *mut c_char, - ) -> ::c_int; pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int; pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int; pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int; @@ -2154,6 +2185,7 @@ extern "C" { options: ::c_int, ) -> ::c_int; + #[cfg_attr(target_os = "illumos", link_name = "_glob_ext")] pub fn glob( pattern: *const ::c_char, flags: ::c_int, @@ -2163,6 +2195,7 @@ extern "C" { pglob: *mut ::glob_t, ) -> ::c_int; + #[cfg_attr(target_os = "illumos", link_name = "_globfree_ext")] pub fn globfree(pglob: *mut ::glob_t); pub fn posix_madvise( @@ -2264,6 +2297,12 @@ extern "C" { msg: *mut ::msghdr, flags: ::c_int, ) -> ::ssize_t; + pub fn accept4( + fd: ::c_int, + address: *mut sockaddr, + address_len: *mut socklen_t, + flags: ::c_int + ) -> ::c_int; pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; pub fn mq_close(mqd: ::mqd_t) -> ::c_int; @@ -2325,10 +2364,17 @@ extern "C" { nget: *mut ::c_uint, timeout: *mut ::timespec, ) -> ::c_int; - pub fn fexecve( - fd: ::c_int, - argv: *const *const ::c_char, - envp: *const *const ::c_char, + pub fn port_send( + port: ::c_int, + events: ::c_int, + user: *mut ::c_void, + ) -> ::c_int; + pub fn port_sendn( + port_list: *mut ::c_int, + error_list: *mut ::c_int, + nent: ::c_uint, + events: ::c_int, + user: *mut ::c_void, ) -> ::c_int; #[cfg_attr( any(target_os = "solaris", target_os = "illumos"), @@ -2454,25 +2500,6 @@ extern "C" { pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; pub fn uname(buf: *mut ::utsname) -> ::c_int; pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; - pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int; - pub fn door_return( - data_ptr: *const ::c_char, - data_size: ::size_t, - desc_ptr: *const door_desc_t, - num_desc: ::c_uint, - ); - pub fn door_create( - server_procedure: extern "C" fn( - cookie: *const ::c_void, - argp: *const ::c_char, - arg_size: ::size_t, - dp: *const door_desc_t, - n_desc: ::c_uint, - ), - cookie: *const ::c_void, - attributes: door_attr_t, - ) -> ::c_int; - pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int; pub fn makeutx(ux: *const utmpx) -> *mut utmpx; pub fn modutx(ux: *const utmpx) -> *mut utmpx; @@ -2496,7 +2523,22 @@ extern "C" { pub fn getutmp(ux: *const utmpx, u: *mut utmp); pub fn getutmpx(u: *const utmp, ux: *mut utmpx); pub fn updwtmp(file: *const ::c_char, u: *mut utmp); + + pub fn ntp_adjtime(buf: *mut timex) -> ::c_int; + pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int; } mod compat; pub use self::compat::*; + +cfg_if! { + if #[cfg(target_os = "illumos")] { + mod illumos; + pub use self::illumos::*; + } else if #[cfg(target_os = "solaris")] { + mod solaris; + pub use self::solaris::*; + } else { + // Unknown target_os + } +} diff --git a/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/solaris.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/solaris.rs new file mode 100644 index 0000000..798622e --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/solarish/solaris.rs @@ -0,0 +1,94 @@ +pub type door_attr_t = ::c_uint; +pub type door_id_t = ::c_ulonglong; + +s! { + pub struct shmid_ds { + pub shm_perm: ::ipc_perm, + pub shm_segsz: ::size_t, + pub shm_flags: ::uintptr_t, + pub shm_lkcnt: ::c_ushort, + pub shm_lpid: ::pid_t, + pub shm_cpid: ::pid_t, + pub shm_nattch: ::shmatt_t, + pub shm_cnattch: ::c_ulong, + pub shm_atime: ::time_t, + pub shm_dtime: ::time_t, + pub shm_ctime: ::time_t, + pub shm_amp: *mut ::c_void, + pub shm_gransize: u64, + pub shm_allocated: u64, + pub shm_pad4: [i64; 1], + } + + pub struct door_desc_t__d_data__d_desc { + pub d_descriptor: ::c_int, + pub d_id: ::door_id_t + } +} + +pub const PORT_SOURCE_POSTWAIT: ::c_int = 8; +pub const PORT_SOURCE_SIGNAL: ::c_int = 9; + +pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; + +pub const AF_LOCAL: ::c_int = 0; +pub const AF_FILE: ::c_int = 0; + +extern "C" { + pub fn fexecve( + fd: ::c_int, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + + pub fn mincore( + addr: *const ::c_void, + len: ::size_t, + vec: *mut ::c_char, + ) -> ::c_int; + + pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int; + pub fn door_return( + data_ptr: *const ::c_char, + data_size: ::size_t, + desc_ptr: *const door_desc_t, + num_desc: ::c_uint, + ); + pub fn door_create( + server_procedure: extern "C" fn( + cookie: *const ::c_void, + argp: *const ::c_char, + arg_size: ::size_t, + dp: *const door_desc_t, + n_desc: ::c_uint, + ), + cookie: *const ::c_void, + attributes: door_attr_t, + ) -> ::c_int; + + pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int; +} + +s_no_extra_traits! { + #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] + pub union door_desc_t__d_data { + pub d_desc: door_desc_t__d_data__d_desc, + d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */ + } + + #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] + pub struct door_desc_t { + pub d_attributes: door_attr_t, + pub d_data: door_desc_t__d_data, + } + + #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] + pub struct door_arg_t { + pub data_ptr: *const ::c_char, + pub data_size: ::size_t, + pub desc_ptr: *const door_desc_t, + pub dec_num: ::c_uint, + pub rbuf: *const ::c_char, + pub rsize: ::size_t, + } +} diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/arm/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/arm/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/arm/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/arm/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/arm/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/arm/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/arm/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/arm/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/arm/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/arm/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/arm/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/arm/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips32/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips32/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips32/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips32/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips32/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips32/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips32/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips32/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips32/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips32/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips32/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips32/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips64/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips64/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips64/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips64/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips64/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips64/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mips64/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mips64/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mod.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mips/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mips/mod.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mod.rs similarity index 98% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mod.rs index 3f779aa..a68cb7a 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/mod.rs @@ -23,7 +23,7 @@ pub type nl_item = ::c_int; pub type idtype_t = ::c_uint; #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // TODO: fill this out with a struct +pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} impl ::Clone for fpos64_t { fn clone(&self) -> fpos64_t { @@ -501,7 +501,7 @@ pub const F_GETLEASE: ::c_int = 1025; pub const F_NOTIFY: ::c_int = 1026; pub const F_DUPFD_CLOEXEC: ::c_int = 1030; -// TODO(#235): Include file sealing fcntls once we have a way to verify them. +// FIXME(#235): Include file sealing fcntls once we have a way to verify them. pub const SIGTRAP: ::c_int = 5; @@ -512,8 +512,7 @@ pub const CLOCK_REALTIME: ::clockid_t = 0; pub const CLOCK_MONOTONIC: ::clockid_t = 1; pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; -// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep -// 2014.) See also musl/mod.rs +// FIXME: Add these constants once uclibc gets them. // pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; // pub const CLOCK_TAI: ::clockid_t = 11; pub const TIMER_ABSTIME: ::c_int = 1; @@ -1046,6 +1045,7 @@ pub const POSIX_FADV_WILLNEED: ::c_int = 3; pub const AT_FDCWD: ::c_int = -100; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; pub const AT_REMOVEDIR: ::c_int = 0x200; +pub const AT_EACCESS: ::c_int = 0x200; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; pub const LOG_CRON: ::c_int = 9 << 3; @@ -1503,6 +1503,10 @@ pub const NOSTR: ::nl_item = 0x503; pub const FILENAME_MAX: ::c_uint = 4095; +pub const PRIO_PROCESS: ::c_int = 0; +pub const PRIO_PGRP: ::c_int = 1; +pub const PRIO_USER: ::c_int = 2; + f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; @@ -2185,7 +2189,6 @@ extern "C" { msg: *mut ::msghdr, flags: ::c_int, ) -> ::ssize_t; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")] pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -2193,15 +2196,9 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigaltstack$UNIX2003" - )] - #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")] pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn sem_close(sem: *mut sem_t) -> ::c_int; pub fn getdtablesize() -> ::c_int; - #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")] pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, @@ -2209,10 +2206,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "pthread_sigmask$UNIX2003" - )] pub fn pthread_sigmask( how: ::c_int, set: *const sigset_t, @@ -2223,8 +2216,6 @@ extern "C" { pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int; pub fn sem_unlink(name: *const ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")] pub fn getpwnam_r( name: *const ::c_char, pwd: *mut passwd, @@ -2232,8 +2223,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")] - #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")] pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -2241,11 +2230,6 @@ extern "C" { buflen: ::size_t, result: *mut *mut passwd, ) -> ::c_int; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "sigwait$UNIX2003" - )] - #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")] pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, @@ -2259,10 +2243,6 @@ extern "C" { value: *mut ::c_void, ) -> ::c_int; pub fn getgrgid(gid: ::gid_t) -> *mut ::group; - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "popen$UNIX2003" - )] pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; pub fn uname(buf: *mut ::utsname) -> ::c_int; } diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/no_align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/no_align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/align.rs similarity index 90% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/align.rs index 583a278..e2d829b 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/align.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/align.rs @@ -5,7 +5,7 @@ macro_rules! expand_align { repr(align(4)))] #[cfg_attr(target_pointer_width = "64", repr(align(8)))] - pub struct sem_t { // ToDo + pub struct sem_t { // FIXME #[cfg(target_pointer_width = "32")] __size: [::c_char; 16], #[cfg(target_pointer_width = "64")] @@ -26,12 +26,12 @@ macro_rules! expand_align { target_arch = "s390x", target_arch = "sparc64")), repr(align(8)))] - pub struct pthread_mutexattr_t { // ToDo + pub struct pthread_mutexattr_t { // FIXME size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], } #[repr(align(4))] - pub struct pthread_condattr_t { // ToDo + pub struct pthread_condattr_t { // FIXME size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } } @@ -48,13 +48,13 @@ macro_rules! expand_align { target_arch = "powerpc")))), repr(align(8)))] #[allow(missing_debug_implementations)] - pub struct pthread_mutex_t { // ToDo + pub struct pthread_mutex_t { // FIXME size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], } #[repr(align(8))] #[allow(missing_debug_implementations)] - pub struct pthread_cond_t { // ToDo + pub struct pthread_cond_t { // FIXME size: [u8; ::__SIZEOF_PTHREAD_COND_T], } @@ -69,7 +69,7 @@ macro_rules! expand_align { target_arch = "powerpc"))), repr(align(8)))] #[allow(missing_debug_implementations)] - pub struct pthread_rwlock_t { // ToDo + pub struct pthread_rwlock_t { // FIXME size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], } } diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/l4re.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/l4re.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/l4re.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/l4re.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/mod.rs similarity index 96% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/mod.rs index a8bb079..26eca9e 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/mod.rs @@ -147,13 +147,13 @@ s! { pub sa_mask: ::sigset_t, } - pub struct stack_t { // ToDo + pub struct stack_t { // FIXME pub ss_sp: *mut ::c_void, pub ss_flags: ::c_int, pub ss_size: ::size_t } - pub struct statfs { // ToDo + pub struct statfs { // FIXME pub f_type: fsword_t, pub f_bsize: fsword_t, pub f_blocks: ::fsblkcnt_t, @@ -167,7 +167,7 @@ s! { f_spare: [fsword_t; 5], } - pub struct msghdr { // ToDo + pub struct msghdr { // FIXME pub msg_name: *mut ::c_void, pub msg_namelen: ::socklen_t, pub msg_iov: *mut ::iovec, @@ -177,7 +177,7 @@ s! { pub msg_flags: ::c_int, } - pub struct termios { // ToDo + pub struct termios { // FIXME pub c_iflag: ::tcflag_t, pub c_oflag: ::tcflag_t, pub c_cflag: ::tcflag_t, @@ -186,11 +186,11 @@ s! { pub c_cc: [::cc_t; ::NCCS], } - pub struct sigset_t { // ToDo + pub struct sigset_t { // FIXME __val: [::c_ulong; 16], } - pub struct sysinfo { // ToDo + pub struct sysinfo { // FIXME pub uptime: ::c_long, pub loads: [::c_ulong; 3], pub totalram: ::c_ulong, @@ -207,7 +207,7 @@ s! { pub _f: [::c_char; 0], } - pub struct glob_t { // ToDo + pub struct glob_t { // FIXME pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut c_char, pub gl_offs: ::size_t, @@ -219,19 +219,19 @@ s! { __unused5: *mut ::c_void, } - pub struct rlimit64 { // ToDo + pub struct rlimit64 { // FIXME pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, } - pub struct cpu_set_t { // ToDo + pub struct cpu_set_t { // FIXME #[cfg(target_pointer_width = "32")] bits: [u32; 32], #[cfg(target_pointer_width = "64")] bits: [u64; 16], } - pub struct fsid_t { // ToDo + pub struct fsid_t { // FIXME __val: [::c_int; 2], } } diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/no_align.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/no_align.rs similarity index 87% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/no_align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/no_align.rs index 422d78f..ffa4e52 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/no_align.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/no_align.rs @@ -1,7 +1,7 @@ macro_rules! expand_align { () => { s! { - pub struct sem_t { // ToDo + pub struct sem_t { // FIXME #[cfg(target_pointer_width = "32")] __size: [::c_char; 16], #[cfg(target_pointer_width = "64")] @@ -9,7 +9,7 @@ macro_rules! expand_align { __align: [::c_long; 0], } - pub struct pthread_mutex_t { // ToDo + pub struct pthread_mutex_t { // FIXME #[cfg(any(target_arch = "mips", target_arch = "arm", target_arch = "powerpc"))] @@ -21,7 +21,7 @@ macro_rules! expand_align { size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], } - pub struct pthread_mutexattr_t { // ToDo + pub struct pthread_mutexattr_t { // FIXME #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64", target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64"))] @@ -33,17 +33,17 @@ macro_rules! expand_align { size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], } - pub struct pthread_cond_t { // ToDo + pub struct pthread_cond_t { // FIXME __align: [::c_longlong; 0], size: [u8; ::__SIZEOF_PTHREAD_COND_T], } - pub struct pthread_condattr_t { // ToDo + pub struct pthread_condattr_t { // FIXME __align: [::c_int; 0], size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], } - pub struct pthread_rwlock_t { // ToDo + pub struct pthread_rwlock_t { // FIXME #[cfg(any(target_arch = "mips", target_arch = "arm", target_arch = "powerpc"))] diff --git a/third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/other.rs b/third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/other.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/unix/uclibc/x86_64/other.rs rename to third_party/cargo/vendor/libc-0.2.71/src/unix/uclibc/x86_64/other.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/aarch64.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/aarch64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/aarch64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/aarch64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/arm.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/arm.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/arm.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/arm.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/mod.rs similarity index 97% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/mod.rs index 2df5f0d..2ca38d5 100755 --- a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/mod.rs @@ -100,6 +100,9 @@ pub type _Vx_ticks64_t = ::c_ulonglong; pub type sa_family_t = ::c_uchar; +// mqueue.h +pub type mqd_t = ::c_int; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum _Vx_semaphore {} impl ::Copy for _Vx_semaphore {} @@ -379,6 +382,13 @@ s! { pub dli_sname: *const ::c_char, pub dli_saddr: *mut ::c_void, } + + pub struct mq_attr { + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_flags: ::c_long, + pub mq_curmsgs: ::c_long, + } } s_no_extra_traits! { @@ -999,7 +1009,7 @@ impl ::Clone for FILE { } } #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // TODO: fill this out with a struct +pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { @@ -1173,6 +1183,7 @@ extern "C" { ) -> ::size_t; pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void; + pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t; pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int; pub fn memcpy( dest: *mut c_void, @@ -1971,6 +1982,43 @@ extern "C" { pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int; pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int; pub fn randSecure() -> c_int; + + // mqueue.h + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn mq_close(mqd: ::mqd_t) -> ::c_int; + pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + pub fn mq_receive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + ) -> ::ssize_t; + pub fn mq_timedreceive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::ssize_t; + pub fn mq_send( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + ) -> ::c_int; + pub fn mq_timedsend( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_prio: ::c_uint, + abs_timeout: *const ::timespec, + ) -> ::c_int; + pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; + pub fn mq_setattr( + mqd: ::mqd_t, + newattr: *const ::mq_attr, + oldattr: *mut ::mq_attr, + ) -> ::c_int; } //Dummy functions, these don't really exist in VxWorks. diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/powerpc.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/powerpc.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/powerpc.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/powerpc.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/powerpc64.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/powerpc64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/powerpc64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/powerpc64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/x86.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/x86.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/x86.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/x86.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/vxworks/x86_64.rs b/third_party/cargo/vendor/libc-0.2.71/src/vxworks/x86_64.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/vxworks/x86_64.rs rename to third_party/cargo/vendor/libc-0.2.71/src/vxworks/x86_64.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/wasi.rs b/third_party/cargo/vendor/libc-0.2.71/src/wasi.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/wasi.rs rename to third_party/cargo/vendor/libc-0.2.71/src/wasi.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/windows/gnu/align.rs b/third_party/cargo/vendor/libc-0.2.71/src/windows/gnu/align.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/windows/gnu/align.rs rename to third_party/cargo/vendor/libc-0.2.71/src/windows/gnu/align.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/src/windows/gnu/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/windows/gnu/mod.rs similarity index 65% rename from third_party/cargo/vendor/libc-0.2.67/src/windows/gnu/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/windows/gnu/mod.rs index e74628b..3e90696 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/windows/gnu/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/windows/gnu/mod.rs @@ -13,6 +13,14 @@ extern "C" { s2: *const ::c_char, n: ::size_t, ) -> ::c_int; + + // NOTE: For MSVC target, `wmemchr` is only a inline function in `` + // header file. We cannot find a way to link to that symbol from Rust. + pub fn wmemchr( + cx: *const ::wchar_t, + c: ::wchar_t, + n: ::size_t, + ) -> *mut ::wchar_t; } cfg_if! { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/windows/mod.rs b/third_party/cargo/vendor/libc-0.2.71/src/windows/mod.rs similarity index 99% rename from third_party/cargo/vendor/libc-0.2.67/src/windows/mod.rs rename to third_party/cargo/vendor/libc-0.2.71/src/windows/mod.rs index f440489..54421dd 100644 --- a/third_party/cargo/vendor/libc-0.2.67/src/windows/mod.rs +++ b/third_party/cargo/vendor/libc-0.2.71/src/windows/mod.rs @@ -250,7 +250,7 @@ impl ::Clone for FILE { } } #[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // TODO: fill this out with a struct +pub enum fpos_t {} // FIXME: fill this out with a struct impl ::Copy for fpos_t {} impl ::Clone for fpos_t { fn clone(&self) -> fpos_t { diff --git a/third_party/cargo/vendor/libc-0.2.67/src/windows/msvc.rs b/third_party/cargo/vendor/libc-0.2.71/src/windows/msvc.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/src/windows/msvc.rs rename to third_party/cargo/vendor/libc-0.2.71/src/windows/msvc.rs diff --git a/third_party/cargo/vendor/libc-0.2.67/tests/const_fn.rs b/third_party/cargo/vendor/libc-0.2.71/tests/const_fn.rs similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/tests/const_fn.rs rename to third_party/cargo/vendor/libc-0.2.71/tests/const_fn.rs diff --git a/third_party/cargo/vendor/libc-0.2.71/triagebot.toml b/third_party/cargo/vendor/libc-0.2.71/triagebot.toml new file mode 100644 index 0000000..fa0824a --- /dev/null +++ b/third_party/cargo/vendor/libc-0.2.71/triagebot.toml @@ -0,0 +1 @@ +[assign] diff --git a/third_party/cargo/vendor/libloading-0.5.2/.cargo-checksum.json b/third_party/cargo/vendor/libloading-0.5.2/.cargo-checksum.json deleted file mode 100644 index 6a7f51d..0000000 --- a/third_party/cargo/vendor/libloading-0.5.2/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"9110a58fe827a68e5df22f8d38e4beab38c259724942e868c5ae3debc2f0ebae","LICENSE":"b29f8b01452350c20dd1af16ef83b598fea3053578ccc1c7a0ef40e57be2620f","README.mkd":"b4cd83f110d01dc5aa8fcaf3da34bdbe1478efdba767d73abc14d4d87e4775fa","appveyor.yml":"8382c7f1769f6cf78029a221058c4d73f35a48308b5dfc38d875facabec1c139","build.rs":"d8f7fce1b459d117cd48d85ba3643124bd09657a0df9e0e90a1fd997decff741","src/changelog.rs":"e8a769578ebe2db81055b131ce12fa14c9ad0f21a79035748f244e5b347b2ada","src/lib.rs":"0cc0f6b42c98c14183dea2bc9deaf5aa574fabbe61081fe3339d74430f25fc12","src/os/mod.rs":"51d733e5522dacd6069642ad66aa6d7acf6c82950c934eb040e8dfd112e6d610","src/os/unix/global_static.c":"b1096dedf7d4aed5c28b658fc917f6603339ffd92390c84e25cb543bdc9460ac","src/os/unix/mod.rs":"9a84c15d0b9e5125a6ca086854a0e18884cb6c04cea54f47f1a44243e69335c2","src/os/windows/mod.rs":"c0ee0068a0564d64b7f3d3053d799492693c34571a935fc893a41a62a86fccdd","src/test_helpers.rs":"3a55052e8cd5231e97d9282b43398c2f144c57ced2d2df64bde7f482f5c778e7","src/util.rs":"5d1d3fcf7e5e9dc67df0dbf91332c5e3f5875e90c8f80ada5cfad0bc3c402d7e","tests/functions.rs":"4633f3673db6a5b3623ea8927b13314c25502c9fbb63bb17a5a35650ea489012","tests/markers.rs":"8e9c1b883404d9190e4f23ed39b3d6cbbccb3a07883f733b04aed4357b9c6aca","tests/nagisa32.dll":"5c69b2bd9c8a6ad04165c221075fc9fade1dd66ca697399ace528a5a62328e36","tests/nagisa64.dll":"e20b95e3036f3289421abd100760874d4f455afd33c3b5b64fec56b191f7d477","tests/windows.rs":"7711dfe19062d91356cd127546542b1b6e13aeef76ad3098f32c8a6ae319b66a"},"package":"f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"} \ No newline at end of file diff --git a/third_party/cargo/vendor/libloading-0.5.2/appveyor.yml b/third_party/cargo/vendor/libloading-0.5.2/appveyor.yml deleted file mode 100644 index 1bded0b..0000000 --- a/third_party/cargo/vendor/libloading-0.5.2/appveyor.yml +++ /dev/null @@ -1,19 +0,0 @@ -environment: - matrix: - - TARGET: nightly-x86_64-pc-windows-msvc - - TARGET: nightly-i686-pc-windows-msvc - - TARGET: nightly-x86_64-pc-windows-gnu - - TARGET: nightly-i686-pc-windows-gnu - - TARGET: 1.14.0-x86_64-pc-windows-msvc - - TARGET: 1.14.0-i686-pc-windows-msvc - - TARGET: 1.14.0-x86_64-pc-windows-gnu - - TARGET: 1.14.0-i686-pc-windows-gnu -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-${env:TARGET}.exe" -FileName "rust.exe" - - ps: .\rust.exe /VERYSILENT /NORESTART /DIR="C:\rust" | Out-Null - - ps: $env:PATH="$env:PATH;C:\rust\bin" - - rustc -vV - - cargo -vV -build: off -test_script: - - cargo test diff --git a/third_party/cargo/vendor/libloading-0.5.2/build.rs b/third_party/cargo/vendor/libloading-0.5.2/build.rs deleted file mode 100644 index fc380a7..0000000 --- a/third_party/cargo/vendor/libloading-0.5.2/build.rs +++ /dev/null @@ -1,32 +0,0 @@ -extern crate cc; - -use std::io::Write; -use std::env; - -fn main(){ - let target_os = env::var("CARGO_CFG_TARGET_OS"); - let is_unix = env::var_os("CARGO_CFG_UNIX").is_some(); - match target_os.as_ref().map(|x| &**x) { - Ok("linux") | Ok("android") => println!("cargo:rustc-link-lib=dl"), - Ok("freebsd") | Ok("dragonfly") => println!("cargo:rustc-link-lib=c"), - // netbsd claims dl* will be available to any dynamically linked binary, but I haven’t - // found any libraries that have to be linked to on other platforms. - // What happens if the executable is not linked up dynamically? - Ok("openbsd") | Ok("bitrig") | Ok("netbsd") | Ok("macos") | Ok("ios") => {} - Ok("solaris") => {} - Ok("haiku") => {} - // dependencies come with winapi - Ok("windows") => {} - tos => { - writeln!(::std::io::stderr(), - "Building for an unknown target_os=`{:?}`!\nPlease report an issue ", - tos).expect("could not report the error"); - ::std::process::exit(0xfc); - } - } - if is_unix { - cc::Build::new() - .file("src/os/unix/global_static.c") - .compile("global_static"); - } -} diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/os/unix/global_static.c b/third_party/cargo/vendor/libloading-0.5.2/src/os/unix/global_static.c deleted file mode 100644 index a905780..0000000 --- a/third_party/cargo/vendor/libloading-0.5.2/src/os/unix/global_static.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -pthread_mutex_t __attribute__((weak)) rust_libloading_dlerror_mutex = PTHREAD_MUTEX_INITIALIZER; - -void __attribute__((weak)) -rust_libloading_dlerror_mutex_lock(void) -{ - if (pthread_mutex_lock(&rust_libloading_dlerror_mutex) != 0) { - abort(); - } -} - -void __attribute__((weak)) -rust_libloading_dlerror_mutex_unlock(void) -{ - if (pthread_mutex_unlock(&rust_libloading_dlerror_mutex) != 0) { - abort(); - } -} diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/util.rs b/third_party/cargo/vendor/libloading-0.5.2/src/util.rs deleted file mode 100644 index 650266e..0000000 --- a/third_party/cargo/vendor/libloading-0.5.2/src/util.rs +++ /dev/null @@ -1,61 +0,0 @@ -use std::ffi::{CStr, CString, NulError, FromBytesWithNulError}; -use std::borrow::Cow; -use std::os::raw; - -#[derive(Debug)] -pub struct NullError; - -impl From for NullError { - fn from(_: NulError) -> NullError { - NullError - } -} - -impl From for NullError { - fn from(_: FromBytesWithNulError) -> NullError { - NullError - } -} - -impl From for ::std::io::Error { - fn from(e: NullError) -> ::std::io::Error { - ::std::io::Error::new(::std::io::ErrorKind::Other, format!("{}", e)) - } -} - -impl ::std::error::Error for NullError { - fn description(&self) -> &str { "non-final null byte found" } -} - -impl ::std::fmt::Display for NullError { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - write!(f, "non-final null byte found") - } -} - -/// Checks for last byte and avoids allocating if it is zero. -/// -/// Non-last null bytes still result in an error. -pub fn cstr_cow_from_bytes<'a>(slice: &'a [u8]) -> Result, NullError> { - static ZERO: raw::c_char = 0; - Ok(match slice.last() { - // Slice out of 0 elements - None => unsafe { Cow::Borrowed(CStr::from_ptr(&ZERO)) }, - // Slice with trailing 0 - Some(&0) => Cow::Borrowed(try!(CStr::from_bytes_with_nul(slice))), - // Slice with no trailing 0 - Some(_) => Cow::Owned(try!(CString::new(slice))), - }) -} - -#[inline] -pub fn ensure_compatible_types() { - #[cold] - #[inline(never)] - fn dopanic() { - panic!("value of requested type cannot be dynamically loaded"); - } - if ::std::mem::size_of::() != ::std::mem::size_of::() { - dopanic() - } -} diff --git a/third_party/cargo/vendor/libloading-0.6.2/.cargo-checksum.json b/third_party/cargo/vendor/libloading-0.6.2/.cargo-checksum.json new file mode 100644 index 0000000..2685cdd --- /dev/null +++ b/third_party/cargo/vendor/libloading-0.6.2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"f6ff11a653f961e5ece86a28ad80d498a974cac8200d3a2d9c88abf9438070b4","LICENSE":"b29f8b01452350c20dd1af16ef83b598fea3053578ccc1c7a0ef40e57be2620f","README.mkd":"1be1c69361f15ea2a555dfd9abb05fcef1b692019e4911cbfdaa4e734baa89e3","build.rs":"836e601b6f981ded849d531053a017fc9fa1fffbe7162f124fab0ca161142ab3","src/changelog.rs":"ad8371639d99571911f6e35142905ebd5eb9b520000e7f02989bdbebf5571eef","src/error.rs":"13c880ebc44626cd69f8a6c287ce81dd5ba2947ffa7913da727b8c2ad9910a3a","src/lib.rs":"55d9d61c6403b8634e128f0d0f64f5376b89b7bd75f459592660a471c88e9576","src/os/mod.rs":"51d733e5522dacd6069642ad66aa6d7acf6c82950c934eb040e8dfd112e6d610","src/os/unix/mod.rs":"ac04bbae9d42e74c128c4afd3581cc427b7109a16b968de3899522a4ce2e366f","src/os/windows/mod.rs":"4d0dd74b217a13efa99105c647de4fa807781343e15a3bc2554a1b3df7738d2e","src/test_helpers.rs":"3a55052e8cd5231e97d9282b43398c2f144c57ced2d2df64bde7f482f5c778e7","src/util.rs":"ce5da7b01f15c1d8d99a435079884d86abac861a0f2a1593df44fcb6478ad735","tests/functions.rs":"35132cb8057acb0abe73527872aa7f8d6b3b43773dd5c4d076dddf9d0d2d51a1","tests/markers.rs":"8e9c1b883404d9190e4f23ed39b3d6cbbccb3a07883f733b04aed4357b9c6aca","tests/nagisa32.dll":"5c69b2bd9c8a6ad04165c221075fc9fade1dd66ca697399ace528a5a62328e36","tests/nagisa64.dll":"e20b95e3036f3289421abd100760874d4f455afd33c3b5b64fec56b191f7d477","tests/windows.rs":"7711dfe19062d91356cd127546542b1b6e13aeef76ad3098f32c8a6ae319b66a"},"package":"2cadb8e769f070c45df05c78c7520eb4cd17061d4ab262e43cfc68b4d00ac71c"} \ No newline at end of file diff --git a/third_party/cargo/vendor/libloading-0.5.2/BUILD b/third_party/cargo/vendor/libloading-0.6.2/BUILD similarity index 97% rename from third_party/cargo/vendor/libloading-0.5.2/BUILD rename to third_party/cargo/vendor/libloading-0.6.2/BUILD index 169e954..e269ca6 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/BUILD +++ b/third_party/cargo/vendor/libloading-0.6.2/BUILD @@ -38,7 +38,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.5.2", + version = "0.6.2", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/libloading-0.5.2/Cargo.toml b/third_party/cargo/vendor/libloading-0.6.2/Cargo.toml similarity index 94% rename from third_party/cargo/vendor/libloading-0.5.2/Cargo.toml rename to third_party/cargo/vendor/libloading-0.6.2/Cargo.toml index f9b19a8..630f1e7 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/Cargo.toml +++ b/third_party/cargo/vendor/libloading-0.6.2/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "libloading" -version = "0.5.2" +version = "0.6.2" authors = ["Simonas Kazlauskas "] build = "build.rs" description = "A safer binding to platform’s dynamic library loading utilities" @@ -20,8 +20,6 @@ documentation = "https://docs.rs/libloading/" keywords = ["dlopen", "load", "shared", "dylib"] license = "ISC" repository = "https://github.com/nagisa/rust_libloading/" -[build-dependencies.cc] -version = "1.0" [target."cfg(windows)".dependencies.winapi] version = "0.3" features = ["winerror", "errhandlingapi", "libloaderapi"] diff --git a/third_party/cargo/vendor/libloading-0.5.2/LICENSE b/third_party/cargo/vendor/libloading-0.6.2/LICENSE similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/LICENSE rename to third_party/cargo/vendor/libloading-0.6.2/LICENSE diff --git a/third_party/cargo/vendor/libloading-0.5.2/README.mkd b/third_party/cargo/vendor/libloading-0.6.2/README.mkd similarity index 62% rename from third_party/cargo/vendor/libloading-0.5.2/README.mkd rename to third_party/cargo/vendor/libloading-0.6.2/README.mkd index da78158..006f172 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/README.mkd +++ b/third_party/cargo/vendor/libloading-0.6.2/README.mkd @@ -1,9 +1,4 @@ -# libloading [![Travis CI][tcii]][tci] [![Appveyor CI][acii]][aci] - -[tcii]: https://travis-ci.org/nagisa/rust_libloading.svg?branch=master -[tci]: https://travis-ci.org/nagisa/rust_libloading -[acii]: https://ci.appveyor.com/api/projects/status/cnncnu58qcxb1ikf/branch/master?svg=true -[aci]: https://ci.appveyor.com/project/nagisa/rust-libloading +# libloading A memory-safer wrapper around system dynamic library loading primitives. The most important safety guarantee by this library is prevention of dangling-`Symbol`s that may occur after a `Library` is diff --git a/third_party/cargo/vendor/libloading-0.6.2/build.rs b/third_party/cargo/vendor/libloading-0.6.2/build.rs new file mode 100644 index 0000000..fdc446d --- /dev/null +++ b/third_party/cargo/vendor/libloading-0.6.2/build.rs @@ -0,0 +1,64 @@ +use std::io::Write; +use std::env; + +fn dlerror_is_mtsafe(target_os: &str) { + match target_os { + // Confirmed MT-safe: + "linux" + | "android" + | "openbsd" + | "macos" + | "ios" + | "solaris" + | "illumos" + | "redox" + | "fuchsia" => { + println!("cargo:rustc-cfg=mtsafe_dlerror"); + } + // Confirmed not MT-safe: + "freebsd" + | "dragonfly" + | "netbsd" + | "bitrig" + | "haiku" => {} + // Unknown: + _ => {} + } +} + +fn link_libraries(target_os: &str) { + match target_os { + "linux" | "android" => println!("cargo:rustc-link-lib=dl"), + "freebsd" | "dragonfly" => println!("cargo:rustc-link-lib=c"), + // netbsd claims dl* will be available to any dynamically linked binary, but I haven’t + // found any libraries that have to be linked to on other platforms. + // What happens if the executable is not linked up dynamically? + "openbsd" | "bitrig" | "netbsd" | "macos" | "ios" => {} + "solaris" | "illumos" => {} + "haiku" => {} + "redox" => {} + "fuchsia" => {} + // dependencies come with winapi + "windows" => {} + tos => { + writeln!(::std::io::stderr(), + "Building for an unknown target_os=`{:?}`!\nPlease report an issue ", + tos).expect("could not report the error"); + ::std::process::exit(0xfc); + } + } +} + +fn main() { + match env::var("CARGO_CFG_TARGET_OS") { + Ok(target_os) => { + dlerror_is_mtsafe(&target_os); + link_libraries(&target_os); + } + Err(e) => { + writeln!(::std::io::stderr(), + "Unable to get target_os=`{}`!", e).expect("could not report the error"); + ::std::process::exit(0xfd); + } + } +} diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/changelog.rs b/third_party/cargo/vendor/libloading-0.6.2/src/changelog.rs similarity index 63% rename from third_party/cargo/vendor/libloading-0.5.2/src/changelog.rs rename to third_party/cargo/vendor/libloading-0.6.2/src/changelog.rs index 215ea89..952eb5e 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/src/changelog.rs +++ b/third_party/cargo/vendor/libloading-0.6.2/src/changelog.rs @@ -1,5 +1,50 @@ //! Project changelog +// TODO: for the next breaking release rename `Error::LoadLibraryW` to `Error::LoadLibraryExW`. + +/// Release 0.6.2 (2020-05-06) +/// +/// * Fixed building of this library on Illumos. +pub mod r0_6_2 {} + +/// Release 0.6.1 (2020-04-15) +/// +/// * Introduced a new method [`os::windows::Library::load_with_flags`]; +/// * Added support for the Illumos triple. +/// +/// [`os::windows::Library::load_with_flags`]: ../../os/windows/struct.Library.html#method.load_with_flags +pub mod r0_6_1 {} + +/// Release 0.6.0 (2020-04-05) +/// +/// * Introduced a new method [`os::unix::Library::get_singlethreaded`]; +/// * Added (untested) support for building when targetting Redox and Fuchsia; +/// * The APIs exposed by this library no longer panic and instead return an `Err` when it used +/// to panic. +/// +/// ## Breaking changes +/// +/// * Minimum required (stable) version of Rust to build this library is now 1.40.0; +/// * This crate now implements a custom [`Error`] type and all APIs now return this type rather +/// than returning the `std::io::Error`; +/// * `libloading::Result` has been removed; +/// * Removed the dependency on the C compiler to build this library on UNIX-like platforms. +/// `libloading` used to utilize a snippet written in C to work-around the unlikely possibility +/// of the target having a thread-unsafe implementation of the `dlerror` function. The effect of +/// the work-around was very opportunistic: it would not work if the function was called by +/// forgoing `libloading`. +/// +/// Starting with 0.6.0, [`Library::get`] on platforms where `dlerror` is not MT-safe (such as +/// FreeBSD, DragonflyBSD or NetBSD) will unconditionally return an error when the underlying +/// `dlsym` returns a null pointer. For the use-cases where loading null pointers is necessary +/// consider using [`os::unix::Library::get_singlethreaded`] instead. +/// +/// [`Library::get`]: ../../struct.Library.html#method.get +/// [`os::unix::Library::get_singlethreaded`]: ../../os/unix/struct.Library.html#method.get_singlethreaded +/// [`Error`]: ../../enum.Error.html +pub mod r0_6_0 {} + + /// Release 0.5.2 (2019-07-07) /// /// * Added API to convert OS-specific `Library` and `Symbol` conversion to underlying resources. diff --git a/third_party/cargo/vendor/libloading-0.6.2/src/error.rs b/third_party/cargo/vendor/libloading-0.6.2/src/error.rs new file mode 100644 index 0000000..dcbe2b1 --- /dev/null +++ b/third_party/cargo/vendor/libloading-0.6.2/src/error.rs @@ -0,0 +1,114 @@ +use std::ffi::CString; + +pub struct DlDescription(pub(crate) CString); + +impl std::fmt::Debug for DlDescription { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + std::fmt::Debug::fmt(&self.0, f) + } +} + +pub struct WindowsError(pub(crate) std::io::Error); + +impl std::fmt::Debug for WindowsError { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + std::fmt::Debug::fmt(&self.0, f) + } +} + +#[derive(Debug)] +#[non_exhaustive] +pub enum Error { + /// The `dlopen` call failed. + DlOpen { desc: DlDescription }, + /// The `dlopen` call failed and system did not report an error. + DlOpenUnknown, + /// The `dlsym` call failed. + DlSym { desc: DlDescription }, + /// The `dlsym` call failed and system did not report an error. + DlSymUnknown, + /// The `dlclose` call failed. + DlClose { desc: DlDescription }, + /// The `dlclose` call failed and system did not report an error. + DlCloseUnknown, + /// The `LoadLibraryW` call failed. + LoadLibraryW { source: WindowsError }, + /// The `LoadLibraryW` call failed and system did not report an error. + LoadLibraryWUnknown, + /// The `GetProcAddress` call failed. + GetProcAddress { source: WindowsError }, + /// The `GetProcAddressUnknown` call failed and system did not report an error. + GetProcAddressUnknown, + /// The `FreeLibrary` call failed. + FreeLibrary { source: WindowsError }, + /// The `FreeLibrary` call failed and system did not report an error. + FreeLibraryUnknown, + /// The requested type cannot possibly work. + IncompatibleSize, + /// Could not create a new CString. + CreateCString { source: std::ffi::NulError }, + /// Could not create a new CString from bytes with trailing null. + CreateCStringWithTrailing { source: std::ffi::FromBytesWithNulError }, +} + +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + use Error::*; + match *self { + CreateCString { ref source } => Some(source), + CreateCStringWithTrailing { ref source } => Some(source), + LoadLibraryW { ref source } => Some(&source.0), + GetProcAddress { ref source } => Some(&source.0), + FreeLibrary { ref source } => Some(&source.0), + _ => None, + } + } +} + +impl std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + use Error::*; + match *self { + DlOpen { ref desc } => write!(f, "{}", desc.0.to_string_lossy()), + DlOpenUnknown => write!(f, "dlopen failed, but system did not report the error"), + DlSym { ref desc } => write!(f, "{}", desc.0.to_string_lossy()), + DlSymUnknown => write!(f, "dlsym failed, but system did not report the error"), + DlClose { ref desc } => write!(f, "{}", desc.0.to_string_lossy()), + DlCloseUnknown => write!(f, "dlclose failed, but system did not report the error"), + LoadLibraryW { .. } => write!(f, "LoadLibraryW failed"), + LoadLibraryWUnknown => + write!(f, "LoadLibraryW failed, but system did not report the error"), + GetProcAddress { .. } => write!(f, "GetProcAddress failed"), + GetProcAddressUnknown => + write!(f, "GetProcAddress failed, but system did not report the error"), + FreeLibrary { .. } => write!(f, "FreeLibrary failed"), + FreeLibraryUnknown => + write!(f, "FreeLibrary failed, but system did not report the error"), + CreateCString { .. } => write!(f, "could not create a C string from bytes"), + CreateCStringWithTrailing { .. } => + write!(f, "could not create a C string from bytes with trailing null"), + IncompatibleSize => write!(f, "requested type cannot possibly work"), + } + } +} + +#[cfg(test)] +mod tests { + #[test] + fn error_send() { + fn assert_send() {} + assert_send::(); + } + + #[test] + fn error_sync() { + fn assert_sync() {} + assert_sync::(); + } + + #[test] + fn error_display() { + fn assert_display() {} + assert_display::(); + } +} diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/lib.rs b/third_party/cargo/vendor/libloading-0.6.2/src/lib.rs similarity index 89% rename from third_party/cargo/vendor/libloading-0.5.2/src/lib.rs rename to third_party/cargo/vendor/libloading-0.6.2/src/lib.rs index a3bfe10..fad7d63 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/src/lib.rs +++ b/third_party/cargo/vendor/libloading-0.6.2/src/lib.rs @@ -25,7 +25,7 @@ //! ```no_run //! extern crate libloading as lib; //! -//! fn call_dynamic() -> lib::Result { +//! fn call_dynamic() -> Result> { //! let lib = lib::Library::new("/path/to/liblibrary.so")?; //! unsafe { //! let func: lib::Symbol u32> = lib.get(b"my_func")?; @@ -45,12 +45,12 @@ use std::marker; use self::os::unix as imp; #[cfg(windows)] use self::os::windows as imp; +pub use self::error::Error; pub mod os; pub mod changelog; mod util; - -pub type Result = ::std::io::Result; +mod error; /// A loaded dynamic library. pub struct Library(imp::Library); @@ -114,7 +114,7 @@ impl Library { /// let _ = Library::new("../awesome.module").unwrap(); /// let _ = Library::new("libsomelib.so.1").unwrap(); /// ``` - pub fn new>(filename: P) -> Result { + pub fn new>(filename: P) -> Result { imp::Library::new(filename).map(From::from) } @@ -133,10 +133,16 @@ impl Library { /// /// ## Platform-specific behaviour /// - /// On Linux and Windows, a TLS variable acts just like any regular static variable. OS X uses + /// On Linux and Windows, a TLS variable acts just like any regular global variable. OS X uses /// some sort of lazy initialization scheme, which makes loading TLS variables this way /// impossible. Using a TLS variable loaded this way on OS X is undefined behaviour. /// + /// On POSIX implementations where the `dlerror` function is not confirmed to be MT-safe (such + /// as FreeBSD), this function will unconditionally return an error the underlying `dlsym` call + /// returns a null pointer. There are rare situations where `dlsym` returns a genuine null + /// pointer without it being an error. If loading a null pointer is something you care about, + /// consider using the [`os::unix::Library::get_singlethreaded`] call. + /// /// ## Examples /// /// Given a loaded library: @@ -168,9 +174,21 @@ impl Library { /// **awesome_variable = 42.0; /// }; /// ``` - pub unsafe fn get<'lib, T>(&'lib self, symbol: &[u8]) -> Result> { + pub unsafe fn get<'lib, T>(&'lib self, symbol: &[u8]) -> Result, Error> { self.0.get(symbol).map(|from| Symbol::from_raw(from, self)) } + + /// Unload the library. + /// + /// This method might be a no-op, depending on the flags with which the `Library` was opened, + /// what library was opened or other platform specifics. + /// + /// You only need to call this if you are interested in handling any errors that may arise when + /// library is unloaded. Otherwise the implementation of `Drop` for `Library` will close the + /// library and ignore the errors were they arise. + pub fn close(self) -> Result<(), Error> { + self.0.close() + } } impl fmt::Debug for Library { diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/os/mod.rs b/third_party/cargo/vendor/libloading-0.6.2/src/os/mod.rs similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/src/os/mod.rs rename to third_party/cargo/vendor/libloading-0.6.2/src/os/mod.rs diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/os/unix/mod.rs b/third_party/cargo/vendor/libloading-0.6.2/src/os/unix/mod.rs similarity index 56% rename from third_party/cargo/vendor/libloading-0.5.2/src/os/unix/mod.rs rename to third_party/cargo/vendor/libloading-0.6.2/src/os/unix/mod.rs index d0456dd..29d2003 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/src/os/unix/mod.rs +++ b/third_party/cargo/vendor/libloading-0.6.2/src/os/unix/mod.rs @@ -1,50 +1,45 @@ use util::{ensure_compatible_types, cstr_cow_from_bytes}; use std::ffi::{CStr, OsStr}; -use std::{fmt, io, marker, mem, ptr}; +use std::{fmt, marker, mem, ptr}; use std::os::raw; use std::os::unix::ffi::OsStrExt; -extern "C" { - fn rust_libloading_dlerror_mutex_lock(); - fn rust_libloading_dlerror_mutex_unlock(); -} - -struct DlerrorMutexGuard(()); - -impl DlerrorMutexGuard { - fn new() -> DlerrorMutexGuard { - unsafe { - rust_libloading_dlerror_mutex_lock(); - } - DlerrorMutexGuard(()) - } -} - -impl Drop for DlerrorMutexGuard { - fn drop(&mut self) { - unsafe { - rust_libloading_dlerror_mutex_unlock(); - } - } -} - -// libdl is crazy. +// dl* family of functions did not have enough thought put into it. // -// First of all, whole error handling scheme in libdl is done via setting and querying some global -// state, therefore it is not safe to use libdl in MT-capable environment at all. Only in POSIX -// 2008+TC1 a thread-local state was allowed, which for our purposes is way too late. -fn with_dlerror(closure: F) -> Result> +// Whole error handling scheme is done via setting and querying some global state, therefore it is +// not safe to use dynamic library loading in MT-capable environment at all. Only in POSIX 2008+TC1 +// a thread-local state was allowed for `dlerror`, making the dl* family of functions MT-safe. +// +// In practice (as of 2020-04-01) most of the widely used targets use a thread-local for error +// state and have been doing so for a long time. Regardless the comments in this function shall +// remain as a documentation for the future generations. +fn with_dlerror(wrap: fn(crate::error::DlDescription) -> crate::Error, closure: F) +-> Result> where F: FnOnce() -> Option { - // We will guard all uses of libdl library with our own mutex. This makes libdl - // safe to use in MT programs provided the only way a program uses libdl is via this library. - let _lock = DlerrorMutexGuard::new(); - // While we could could call libdl here to clear the previous error value, only the dlsym - // depends on it being cleared beforehand and only in some cases too. We will instead clear the - // error inside the dlsym binding instead. + // We used to guard all uses of dl* functions with our own mutex. This made them safe to use in + // MT programs provided the only way a program used dl* was via this library. However, it also + // had a number of downsides or cases where it failed to handle the problems. For instance, + // if any other library called `dlerror` internally concurrently with `libloading` things would + // still go awry. + // + // On platforms where `dlerror` is still MT-unsafe, `dlsym` (`Library::get`) can spuriously + // succeed and return a null pointer for a symbol when the actual symbol look-up operation + // fails. Instances where the actual symbol _could_ be `NULL` are platform specific. For + // instance on GNU glibc based-systems (an excerpt from dlsym(3)): + // + // > The value of a symbol returned by dlsym() will never be NULL if the shared object is the + // > result of normal compilation, since a global symbol is never placed at the NULL + // > address. There are nevertheless cases where a lookup using dlsym() may return NULL as the + // > value of a symbol. For example, the symbol value may be the result of a GNU indirect + // > function (IFUNC) resolver function that returns NULL as the resolved value. + + // While we could could call `dlerror` here to clear the previous error value, only the `dlsym` + // call depends on it being cleared beforehand and only in some cases too. We will instead + // clear the error inside the dlsym binding instead. // // In all the other cases, clearing the error here will only be hiding misuse of these bindings - // or the libdl. + // or a bug in implementation of dl* family of functions. closure().ok_or_else(|| unsafe { // This code will only get executed if the `closure` returns `None`. let error = dlerror(); @@ -58,8 +53,8 @@ where F: FnOnce() -> Option { // ownership over the message? // TODO: should do locale-aware conversion here. OTOH Rust doesn’t seem to work well in // any system that uses non-utf8 locale, so I doubt there’s a problem here. - let message = CStr::from_ptr(error).to_string_lossy().into_owned(); - Some(io::Error::new(io::ErrorKind::Other, message)) + let message = CStr::from_ptr(error).into(); + Some(wrap(crate::error::DlDescription(message))) // Since we do a copy of the error string above, maybe we should call dlerror again to // let libdl know it may free its copy of the string now? } @@ -97,7 +92,7 @@ impl Library { /// /// Corresponds to `dlopen(filename, RTLD_NOW)`. #[inline] - pub fn new>(filename: P) -> ::Result { + pub fn new>(filename: P) -> Result { Library::open(Some(filename), RTLD_NOW) } @@ -109,7 +104,7 @@ impl Library { /// Corresponds to `dlopen(NULL, RTLD_NOW)`. #[inline] pub fn this() -> Library { - Library::open(None::<&OsStr>, RTLD_NOW).unwrap() + Library::open(None::<&OsStr>, RTLD_NOW).expect("this should never fail") } /// Find and load a shared library (module). @@ -120,13 +115,13 @@ impl Library { /// If the `filename` is None, null pointer is passed to `dlopen`. /// /// Corresponds to `dlopen(filename, flags)`. - pub fn open

(filename: Option

, flags: raw::c_int) -> ::Result + pub fn open

(filename: Option

, flags: raw::c_int) -> Result where P: AsRef { let filename = match filename { None => None, - Some(ref f) => Some(try!(cstr_cow_from_bytes(f.as_ref().as_bytes()))), + Some(ref f) => Some(cstr_cow_from_bytes(f.as_ref().as_bytes())?), }; - with_dlerror(move || { + with_dlerror(|desc| crate::Error::DlOpen { desc }, move || { let result = unsafe { let r = dlopen(match filename { None => ptr::null(), @@ -143,9 +138,37 @@ impl Library { handle: result }) } - }).map_err(|e| e.unwrap_or_else(|| - panic!("dlopen failed but dlerror did not report anything") - )) + }).map_err(|e| e.unwrap_or(crate::Error::DlOpenUnknown)) + } + + unsafe fn get_impl(&self, symbol: &[u8], on_null: F) -> Result, crate::Error> + where F: FnOnce() -> Result, crate::Error> + { + ensure_compatible_types::()?; + let symbol = cstr_cow_from_bytes(symbol)?; + // `dlsym` may return nullptr in two cases: when a symbol genuinely points to a null + // pointer or the symbol cannot be found. In order to detect this case a double dlerror + // pattern must be used, which is, sadly, a little bit racy. + // + // We try to leave as little space as possible for this to occur, but we can’t exactly + // fully prevent it. + match with_dlerror(|desc| crate::Error::DlSym { desc }, || { + dlerror(); + let symbol = dlsym(self.handle, symbol.as_ptr()); + if symbol.is_null() { + None + } else { + Some(Symbol { + pointer: symbol, + pd: marker::PhantomData + }) + } + }) { + Err(None) => on_null(), + Err(Some(e)) => Err(e), + Ok(x) => Ok(x) + } + } /// Get a pointer to function or static variable by symbol name. @@ -158,43 +181,62 @@ impl Library { /// /// ## Unsafety /// - /// Pointer to a value of arbitrary type is returned. Using a value with wrong type is - /// undefined. + /// This function does not validate the type `T`. It is up to the user of this function to + /// ensure that the loaded symbol is in fact a `T`. Using a value with a wrong type has no + /// definied behaviour. + /// + /// /// /// ## Platform-specific behaviour /// /// OS X uses some sort of lazy initialization scheme, which makes loading TLS variables /// impossible. Using a TLS variable loaded this way on OS X is undefined behaviour. - pub unsafe fn get(&self, symbol: &[u8]) -> ::Result> { - ensure_compatible_types::(); - let symbol = try!(cstr_cow_from_bytes(symbol)); - // `dlsym` may return nullptr in two cases: when a symbol genuinely points to a null - // pointer or the symbol cannot be found. In order to detect this case a double dlerror - // pattern must be used, which is, sadly, a little bit racy. - // - // We try to leave as little space as possible for this to occur, but we can’t exactly - // fully prevent it. - match with_dlerror(|| { - dlerror(); - let symbol = dlsym(self.handle, symbol.as_ptr()); - if symbol.is_null() { - None - } else { - Some(Symbol { - pointer: symbol, - pd: marker::PhantomData - }) - } - }) { - Err(None) => Ok(Symbol { - pointer: ptr::null_mut(), - pd: marker::PhantomData - }), - Err(Some(e)) => Err(e), - Ok(x) => Ok(x) + /// + /// On POSIX implementations where the `dlerror` function is not confirmed to be MT-safe (such + /// as FreeBSD), this function will unconditionally return an error the underlying `dlsym` call + /// returns a null pointer. There are rare situations where `dlsym` returns a genuine null + /// pointer without it being an error. If loading a null pointer is something you care about, + /// consider using the [`Library::get_singlethreaded`] call. + #[inline(always)] + pub unsafe fn get(&self, symbol: &[u8]) -> Result, crate::Error> { + #[cfg(mtsafe_dlerror)] + { return self.get_singlethreaded(symbol); } + #[cfg(not(mtsafe_dlerror))] + { + return self.get_impl(symbol, || Err(crate::Error::DlSymUnknown)); } } + /// Get a pointer to function or static variable by symbol name. + /// + /// The `symbol` may not contain any null bytes, with an exception of last byte. A null + /// terminated `symbol` may avoid a string allocation in some cases. + /// + /// Symbol is interpreted as-is; no mangling is done. This means that symbols like `x::y` are + /// most likely invalid. + /// + /// ## Unsafety + /// + /// This function does not validate the type `T`. It is up to the user of this function to + /// ensure that the loaded symbol is in fact a `T`. Using a value with a wrong type has no + /// definied behaviour. + /// + /// It is up to the user of this library to ensure that no other calls to an MT-unsafe + /// implementation of `dlerror` occur while this function is executing. Failing that the + /// results of this function are not defined. + /// + /// ## Platform-specific behaviour + /// + /// OS X uses some sort of lazy initialization scheme, which makes loading TLS variables + /// impossible. Using a TLS variable loaded this way on OS X is undefined behaviour. + #[inline(always)] + pub unsafe fn get_singlethreaded(&self, symbol: &[u8]) -> Result, crate::Error> { + self.get_impl(symbol, || Ok(Symbol { + pointer: ptr::null_mut(), + pd: marker::PhantomData + })) + } + /// Convert the `Library` to a raw handle. /// /// The handle returned by this function shall be usable with APIs which accept handles @@ -217,15 +259,33 @@ impl Library { handle: handle } } + + /// Unload the library. + /// + /// This method might be a no-op, depending on the flags with which the `Library` was opened, + /// what library was opened or other platform specifics. + /// + /// You only need to call this if you are interested in handling any errors that may arise when + /// library is unloaded. Otherwise the implementation of `Drop` for `Library` will close the + /// library and ignore the errors were they arise. + pub fn close(self) -> Result<(), crate::Error> { + let result = with_dlerror(|desc| crate::Error::DlClose { desc }, || { + if unsafe { dlclose(self.handle) } == 0 { + Some(()) + } else { + None + } + }).map_err(|e| e.unwrap_or(crate::Error::DlCloseUnknown)); + std::mem::forget(self); + result + } } impl Drop for Library { fn drop(&mut self) { - with_dlerror(|| if unsafe { dlclose(self.handle) } == 0 { - Some(()) - } else { - None - }).unwrap(); + unsafe { + dlclose(self.handle); + } } } @@ -289,8 +349,9 @@ impl ::std::ops::Deref for Symbol { impl fmt::Debug for Symbol { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { - let mut info: DlInfo = mem::uninitialized(); - if dladdr(self.pointer, &mut info) != 0 { + let mut info = mem::MaybeUninit::::uninit(); + if dladdr(self.pointer, info.as_mut_ptr()) != 0 { + let info = info.assume_init(); if info.dli_sname.is_null() { f.write_str(&format!("Symbol@{:p} from {:?}", self.pointer, @@ -330,7 +391,10 @@ struct DlInfo { dli_saddr: *mut raw::c_void } -#[test] -fn this() { - Library::this(); +#[cfg(test)] +mod tests { + #[test] + fn this() { + super::Library::this(); + } } diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/os/windows/mod.rs b/third_party/cargo/vendor/libloading-0.6.2/src/os/windows/mod.rs similarity index 70% rename from third_party/cargo/vendor/libloading-0.5.2/src/os/windows/mod.rs rename to third_party/cargo/vendor/libloading-0.6.2/src/os/windows/mod.rs index 8157eab..3620b3e 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/src/os/windows/mod.rs +++ b/third_party/cargo/vendor/libloading-0.6.2/src/os/windows/mod.rs @@ -9,8 +9,7 @@ use util::{ensure_compatible_types, cstr_cow_from_bytes}; use std::ffi::{OsStr, OsString}; use std::{fmt, io, marker, mem, ptr}; use std::os::windows::ffi::{OsStrExt, OsStringExt}; -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - +use std::sync::atomic::{AtomicBool, Ordering}; /// A platform-specific equivalent of the cross-platform `Library`. pub struct Library(HMODULE); @@ -34,25 +33,32 @@ unsafe impl Sync for Library {} impl Library { /// Find and load a shared library (module). /// - /// Corresponds to `LoadLibraryW(filename)`. + /// Corresponds to `LoadLibraryW(filename, reserved: NULL, flags: 0)` which is equivalent to `LoadLibraryW(filename)` #[inline] - pub fn new>(filename: P) -> ::Result { + pub fn new>(filename: P) -> Result { + Library::load_with_flags(filename, 0) + } + + /// Find and load a shared library (module). + /// + /// Locations where library is searched for is platform specific and can’t be adjusted + /// portably. + /// + /// Corresponds to `LoadLibraryW(filename, reserved: NULL, flags)`. + pub fn load_with_flags>(filename: P, flags: DWORD) -> Result { let wide_filename: Vec = filename.as_ref().encode_wide().chain(Some(0)).collect(); let _guard = ErrorModeGuard::new(); - let ret = with_get_last_error(|| { + let ret = with_get_last_error(|source| crate::Error::LoadLibraryW { source }, || { // Make sure no winapi calls as a result of drop happen inside this closure, because // otherwise that might change the return value of the GetLastError. - let handle = unsafe { libloaderapi::LoadLibraryW(wide_filename.as_ptr()) }; + let handle = unsafe { libloaderapi::LoadLibraryExW(wide_filename.as_ptr(), std::ptr::null_mut(), flags) }; if handle.is_null() { None } else { Some(Library(handle)) } - }).map_err(|e| e.unwrap_or_else(|| - panic!("LoadLibraryW failed but GetLastError did not report the error") - )); - + }).map_err(|e| e.unwrap_or(crate::Error::LoadLibraryWUnknown)); drop(wide_filename); // Drop wide_filename here to ensure it doesn’t get moved and dropped // inside the closure by mistake. See comment inside the closure. ret @@ -68,12 +74,13 @@ impl Library { /// /// ## Unsafety /// - /// Pointer to a value of arbitrary type is returned. Using a value with wrong type is - /// undefined. - pub unsafe fn get(&self, symbol: &[u8]) -> ::Result> { - ensure_compatible_types::(); - let symbol = try!(cstr_cow_from_bytes(symbol)); - with_get_last_error(|| { + /// This function does not validate the type `T`. It is up to the user of this function to + /// ensure that the loaded symbol is in fact a `T`. Using a value with a wrong type has no + /// definied behaviour. + pub unsafe fn get(&self, symbol: &[u8]) -> Result, crate::Error> { + ensure_compatible_types::()?; + let symbol = cstr_cow_from_bytes(symbol)?; + with_get_last_error(|source| crate::Error::GetProcAddress { source }, || { let symbol = libloaderapi::GetProcAddress(self.0, symbol.as_ptr()); if symbol.is_null() { None @@ -83,9 +90,7 @@ impl Library { pd: marker::PhantomData }) } - }).map_err(|e| e.unwrap_or_else(|| - panic!("GetProcAddress failed but GetLastError did not report the error") - )) + }).map_err(|e| e.unwrap_or(crate::Error::GetProcAddressUnknown)) } /// Get a pointer to function or static variable by ordinal number. @@ -94,9 +99,9 @@ impl Library { /// /// Pointer to a value of arbitrary type is returned. Using a value with wrong type is /// undefined. - pub unsafe fn get_ordinal(&self, ordinal: WORD) -> ::Result> { - ensure_compatible_types::(); - with_get_last_error(|| { + pub unsafe fn get_ordinal(&self, ordinal: WORD) -> Result, crate::Error> { + ensure_compatible_types::()?; + with_get_last_error(|source| crate::Error::GetProcAddress { source }, || { let ordinal = ordinal as usize as *mut _; let symbol = libloaderapi::GetProcAddress(self.0, ordinal); if symbol.is_null() { @@ -107,9 +112,7 @@ impl Library { pd: marker::PhantomData }) } - }).map_err(|e| e.unwrap_or_else(|| - panic!("GetProcAddress failed but GetLastError did not report the error") - )) + }).map_err(|e| e.unwrap_or(crate::Error::GetProcAddressUnknown)) } /// Convert the `Library` to a raw handle. @@ -128,30 +131,40 @@ impl Library { pub unsafe fn from_raw(handle: HMODULE) -> Library { Library(handle) } -} -impl Drop for Library { - fn drop(&mut self) { - with_get_last_error(|| { + /// Unload the library. + pub fn close(self) -> Result<(), crate::Error> { + with_get_last_error(|source| crate::Error::FreeLibrary { source }, || { if unsafe { libloaderapi::FreeLibrary(self.0) == 0 } { None } else { Some(()) } - }).unwrap() + }).map_err(|e| e.unwrap_or(crate::Error::FreeLibraryUnknown)) + } +} + +impl Drop for Library { + fn drop(&mut self) { + unsafe { libloaderapi::FreeLibrary(self.0); } } } impl fmt::Debug for Library { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { unsafe { - let mut buf: [WCHAR; 1024] = mem::uninitialized(); + // FIXME: use Maybeuninit::uninit_array when stable + let mut buf = + mem::MaybeUninit::<[mem::MaybeUninit::; 1024]>::uninit().assume_init(); let len = libloaderapi::GetModuleFileNameW(self.0, - (&mut buf[..]).as_mut_ptr(), 1024) as usize; + (&mut buf[..]).as_mut_ptr().cast(), 1024) as usize; if len == 0 { f.write_str(&format!("Library@{:p}", self.0)) } else { - let string: OsString = OsString::from_wide(&buf[..len]); + let string: OsString = OsString::from_wide( + // FIXME: use Maybeuninit::slice_get_ref when stable + &*(&buf[..len] as *const [_] as *const [WCHAR]) + ); f.write_str(&format!("Library@{:p} from {:?}", self.0, string)) } } @@ -216,7 +229,7 @@ impl fmt::Debug for Symbol { } -static USE_ERRORMODE: AtomicBool = ATOMIC_BOOL_INIT; +static USE_ERRORMODE: AtomicBool = AtomicBool::new(false); struct ErrorModeGuard(DWORD); impl ErrorModeGuard { @@ -276,38 +289,44 @@ impl Drop for ErrorModeGuard { } } -fn with_get_last_error(closure: F) -> Result> +fn with_get_last_error(wrap: fn(crate::error::WindowsError) -> crate::Error, closure: F) +-> Result> where F: FnOnce() -> Option { closure().ok_or_else(|| { let error = unsafe { errhandlingapi::GetLastError() }; if error == 0 { None } else { - Some(io::Error::from_raw_os_error(error as i32)) + Some(wrap(crate::error::WindowsError(io::Error::from_raw_os_error(error as i32)))) } }) } -#[test] -fn works_getlasterror() { - let lib = Library::new("kernel32.dll").unwrap(); - let gle: Symbol DWORD> = unsafe { - lib.get(b"GetLastError").unwrap() - }; - unsafe { - errhandlingapi::SetLastError(42); - assert_eq!(errhandlingapi::GetLastError(), gle()) - } -} +#[cfg(test)] +mod tests { + use super::*; -#[test] -fn works_getlasterror0() { - let lib = Library::new("kernel32.dll").unwrap(); - let gle: Symbol DWORD> = unsafe { - lib.get(b"GetLastError\0").unwrap() - }; - unsafe { - errhandlingapi::SetLastError(42); - assert_eq!(errhandlingapi::GetLastError(), gle()) + #[test] + fn works_getlasterror() { + let lib = Library::new("kernel32.dll").unwrap(); + let gle: Symbol DWORD> = unsafe { + lib.get(b"GetLastError").unwrap() + }; + unsafe { + errhandlingapi::SetLastError(42); + assert_eq!(errhandlingapi::GetLastError(), gle()) + } + } + + #[test] + fn works_getlasterror0() { + let lib = Library::new("kernel32.dll").unwrap(); + let gle: Symbol DWORD> = unsafe { + lib.get(b"GetLastError\0").unwrap() + }; + unsafe { + errhandlingapi::SetLastError(42); + assert_eq!(errhandlingapi::GetLastError(), gle()) + } } } diff --git a/third_party/cargo/vendor/libloading-0.5.2/src/test_helpers.rs b/third_party/cargo/vendor/libloading-0.6.2/src/test_helpers.rs similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/src/test_helpers.rs rename to third_party/cargo/vendor/libloading-0.6.2/src/test_helpers.rs diff --git a/third_party/cargo/vendor/libloading-0.6.2/src/util.rs b/third_party/cargo/vendor/libloading-0.6.2/src/util.rs new file mode 100644 index 0000000..e5108c2 --- /dev/null +++ b/third_party/cargo/vendor/libloading-0.6.2/src/util.rs @@ -0,0 +1,31 @@ +use std::ffi::{CStr, CString}; +use std::borrow::Cow; +use std::os::raw; + +use crate::Error; + +/// Checks for last byte and avoids allocating if it is zero. +/// +/// Non-last null bytes still result in an error. +pub(crate) fn cstr_cow_from_bytes<'a>(slice: &'a [u8]) -> Result, Error> { + static ZERO: raw::c_char = 0; + Ok(match slice.last() { + // Slice out of 0 elements + None => unsafe { Cow::Borrowed(CStr::from_ptr(&ZERO)) }, + // Slice with trailing 0 + Some(&0) => Cow::Borrowed(CStr::from_bytes_with_nul(slice) + .map_err(|source| Error::CreateCStringWithTrailing { source })?), + // Slice with no trailing 0 + Some(_) => Cow::Owned(CString::new(slice) + .map_err(|source| Error::CreateCString { source })?), + }) +} + +#[inline] +pub(crate) fn ensure_compatible_types() -> Result<(), Error> { + if ::std::mem::size_of::() != ::std::mem::size_of::() { + Err(Error::IncompatibleSize) + } else { + Ok(()) + } +} diff --git a/third_party/cargo/vendor/libloading-0.5.2/tests/functions.rs b/third_party/cargo/vendor/libloading-0.6.2/tests/functions.rs similarity index 89% rename from third_party/cargo/vendor/libloading-0.5.2/tests/functions.rs rename to third_party/cargo/vendor/libloading-0.6.2/tests/functions.rs index c9bc067..dece58c 100644 --- a/third_party/cargo/vendor/libloading-0.5.2/tests/functions.rs +++ b/third_party/cargo/vendor/libloading-0.6.2/tests/functions.rs @@ -4,7 +4,7 @@ use libloading::{Symbol, Library}; const LIBPATH: &'static str = concat!(env!("OUT_DIR"), "/libtest_helpers.dll"); fn make_helpers() { - static ONCE: ::std::sync::Once = ::std::sync::ONCE_INIT; + static ONCE: ::std::sync::Once = ::std::sync::Once::new(); ONCE.call_once(|| { let mut outpath = String::from(if let Some(od) = option_env!("OUT_DIR") { od } else { return }); let rustc = option_env!("RUSTC").unwrap_or_else(|| { "rustc".into() }); @@ -85,25 +85,29 @@ fn interior_null_fails() { } #[test] -#[should_panic] fn test_incompatible_type() { make_helpers(); let lib = Library::new(LIBPATH).unwrap(); unsafe { - let _ = lib.get::<()>(b"test_identity_u32\0"); + assert!(match lib.get::<()>(b"test_identity_u32\0") { + Err(libloading::Error::IncompatibleSize) => true, + _ => false, + }) } } #[test] -#[should_panic] fn test_incompatible_type_named_fn() { make_helpers(); - unsafe fn get<'a, T>(l: &'a Library, _: T) -> libloading::Result> { + unsafe fn get<'a, T>(l: &'a Library, _: T) -> Result, libloading::Error> { l.get::(b"test_identity_u32\0") } let lib = Library::new(LIBPATH).unwrap(); unsafe { - let _ = get(&lib, test_incompatible_type_named_fn); + assert!(match get(&lib, test_incompatible_type_named_fn) { + Err(libloading::Error::IncompatibleSize) => true, + _ => false, + }) } } diff --git a/third_party/cargo/vendor/libloading-0.5.2/tests/markers.rs b/third_party/cargo/vendor/libloading-0.6.2/tests/markers.rs similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/tests/markers.rs rename to third_party/cargo/vendor/libloading-0.6.2/tests/markers.rs diff --git a/third_party/cargo/vendor/libloading-0.5.2/tests/nagisa32.dll b/third_party/cargo/vendor/libloading-0.6.2/tests/nagisa32.dll similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/tests/nagisa32.dll rename to third_party/cargo/vendor/libloading-0.6.2/tests/nagisa32.dll diff --git a/third_party/cargo/vendor/libloading-0.5.2/tests/nagisa64.dll b/third_party/cargo/vendor/libloading-0.6.2/tests/nagisa64.dll similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/tests/nagisa64.dll rename to third_party/cargo/vendor/libloading-0.6.2/tests/nagisa64.dll diff --git a/third_party/cargo/vendor/libloading-0.5.2/tests/windows.rs b/third_party/cargo/vendor/libloading-0.6.2/tests/windows.rs similarity index 100% rename from third_party/cargo/vendor/libloading-0.5.2/tests/windows.rs rename to third_party/cargo/vendor/libloading-0.6.2/tests/windows.rs diff --git a/third_party/cargo/vendor/lock_api-0.3.3/.cargo-checksum.json b/third_party/cargo/vendor/lock_api-0.3.3/.cargo-checksum.json deleted file mode 100644 index 061fae8..0000000 --- a/third_party/cargo/vendor/lock_api-0.3.3/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"c82814c74f08e404a1207533d9f1e292ff743b90ced01a5c7808e52d2721ce82","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","src/lib.rs":"d9ed1f911f058d066ebfd024940da8a5c1ebbab6cfd65a633dfbc613573dd823","src/mutex.rs":"a2f5729761af0ad90596baca6e7ae1e3ae4495e67ebee167e7ad84bb9f4a649c","src/remutex.rs":"7ce5d47f9bdb1a7949ee9f12b0853b7690a8acb1f8eb643333ff05621210f6c8","src/rwlock.rs":"6004fed47262e84befb4817eca069f922a1cdbc207a2bbb5e55493e032bc85dd"},"package":"79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b"} \ No newline at end of file diff --git a/third_party/cargo/vendor/lock_api-0.3.4/.cargo-checksum.json b/third_party/cargo/vendor/lock_api-0.3.4/.cargo-checksum.json new file mode 100644 index 0000000..b192a2f --- /dev/null +++ b/third_party/cargo/vendor/lock_api-0.3.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"6b931fdc231a35953748d244fc3ed1b6cd4d95c95c618058955df508f2e7e738","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","src/lib.rs":"3541bfbc3b6121af8fbeb4683ab28412ca46a9b9bdd83a9348778db76e7ea18f","src/mutex.rs":"d010fba6b466937cbc8c16ed4131c7a16753c61362e4be038c1748c2b9431340","src/remutex.rs":"541735f5675c78117cdec802b53df6ac5b7a834d18e0616cff073b7acc6cf02b","src/rwlock.rs":"992394f38f0bc5211fa1f4d7b7af3a1cc9afcec4d48734ded3b248897c7902d9"},"package":"c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"} \ No newline at end of file diff --git a/third_party/cargo/vendor/lock_api-0.3.3/BUILD b/third_party/cargo/vendor/lock_api-0.3.4/BUILD similarity index 97% rename from third_party/cargo/vendor/lock_api-0.3.3/BUILD rename to third_party/cargo/vendor/lock_api-0.3.4/BUILD index cd34108..12ecbbb 100644 --- a/third_party/cargo/vendor/lock_api-0.3.3/BUILD +++ b/third_party/cargo/vendor/lock_api-0.3.4/BUILD @@ -36,7 +36,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.3.3", + version = "0.3.4", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/lock_api-0.3.3/Cargo.toml b/third_party/cargo/vendor/lock_api-0.3.4/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/lock_api-0.3.3/Cargo.toml rename to third_party/cargo/vendor/lock_api-0.3.4/Cargo.toml index 68171b1..7cbb440 100644 --- a/third_party/cargo/vendor/lock_api-0.3.3/Cargo.toml +++ b/third_party/cargo/vendor/lock_api-0.3.4/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "lock_api" -version = "0.3.3" +version = "0.3.4" authors = ["Amanieu d'Antras "] description = "Wrappers to create fully-featured Mutex and RwLock types. Compatible with no_std." keywords = ["mutex", "rwlock", "lock", "no_std"] diff --git a/third_party/cargo/vendor/lock_api-0.3.3/LICENSE-APACHE b/third_party/cargo/vendor/lock_api-0.3.4/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/lock_api-0.3.3/LICENSE-APACHE rename to third_party/cargo/vendor/lock_api-0.3.4/LICENSE-APACHE diff --git a/third_party/cargo/vendor/lock_api-0.3.3/LICENSE-MIT b/third_party/cargo/vendor/lock_api-0.3.4/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/lock_api-0.3.3/LICENSE-MIT rename to third_party/cargo/vendor/lock_api-0.3.4/LICENSE-MIT diff --git a/third_party/cargo/vendor/lock_api-0.3.3/src/lib.rs b/third_party/cargo/vendor/lock_api-0.3.4/src/lib.rs similarity index 96% rename from third_party/cargo/vendor/lock_api-0.3.3/src/lib.rs rename to third_party/cargo/vendor/lock_api-0.3.4/src/lib.rs index d388d8a..6576546 100644 --- a/third_party/cargo/vendor/lock_api-0.3.3/src/lib.rs +++ b/third_party/cargo/vendor/lock_api-0.3.4/src/lib.rs @@ -47,7 +47,9 @@ //! } //! //! fn try_lock(&self) -> bool { -//! self.0.swap(true, Ordering::Acquire) +//! self.0 +//! .compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed) +//! .is_ok() //! } //! //! fn unlock(&self) { diff --git a/third_party/cargo/vendor/lock_api-0.3.3/src/mutex.rs b/third_party/cargo/vendor/lock_api-0.3.4/src/mutex.rs similarity index 97% rename from third_party/cargo/vendor/lock_api-0.3.3/src/mutex.rs rename to third_party/cargo/vendor/lock_api-0.3.4/src/mutex.rs index 116438e..352ac31 100644 --- a/third_party/cargo/vendor/lock_api-0.3.3/src/mutex.rs +++ b/third_party/cargo/vendor/lock_api-0.3.4/src/mutex.rs @@ -40,7 +40,8 @@ pub unsafe trait RawMutex { /// Acquires this mutex, blocking the current thread until it is able to do so. fn lock(&self); - /// Attempts to acquire this mutex without blocking. + /// Attempts to acquire this mutex without blocking. Returns `true` + /// if the lock was successfully acquired and `false` otherwise. fn try_lock(&self) -> bool; /// Unlocks this mutex. @@ -94,7 +95,7 @@ pub unsafe trait RawMutexTimed: RawMutex { /// it is protecting. The data can only be accessed through the RAII guards /// returned from `lock` and `try_lock`, which guarantees that the data is only /// ever accessed when the mutex is locked. -pub struct Mutex { +pub struct Mutex { raw: R, data: UnsafeCell, } @@ -130,6 +131,19 @@ impl Mutex { } } +impl Mutex { + /// Creates a new mutex based on a pre-existing raw mutex. + /// + /// This allows creating a mutex in a constant context on stable Rust. + #[inline] + pub const fn const_new(raw_mutex: R, val: T) -> Mutex { + Mutex { + raw: raw_mutex, + data: UnsafeCell::new(val), + } + } +} + impl Mutex { /// # Safety /// diff --git a/third_party/cargo/vendor/lock_api-0.3.3/src/remutex.rs b/third_party/cargo/vendor/lock_api-0.3.4/src/remutex.rs similarity index 96% rename from third_party/cargo/vendor/lock_api-0.3.3/src/remutex.rs rename to third_party/cargo/vendor/lock_api-0.3.4/src/remutex.rs index 4fd102a..bdfcc40 100644 --- a/third_party/cargo/vendor/lock_api-0.3.3/src/remutex.rs +++ b/third_party/cargo/vendor/lock_api-0.3.4/src/remutex.rs @@ -47,7 +47,7 @@ pub unsafe trait GetThreadId { fn nonzero_thread_id(&self) -> NonZeroUsize; } -struct RawReentrantMutex { +struct RawReentrantMutex { owner: AtomicUsize, lock_count: Cell, mutex: R, @@ -145,7 +145,7 @@ impl RawReentrantMutex { /// /// See [`Mutex`](struct.Mutex.html) for more details about the underlying mutex /// primitive. -pub struct ReentrantMutex { +pub struct ReentrantMutex { raw: RawReentrantMutex, data: UnsafeCell, } @@ -197,6 +197,26 @@ impl ReentrantMutex { } } +impl ReentrantMutex { + /// Creates a new reentrant mutex based on a pre-existing raw mutex and a + /// helper to get the thread ID. + /// + /// This allows creating a reentrant mutex in a constant context on stable + /// Rust. + #[inline] + pub const fn const_new(raw_mutex: R, get_thread_id: G, val: T) -> ReentrantMutex { + ReentrantMutex { + data: UnsafeCell::new(val), + raw: RawReentrantMutex { + owner: AtomicUsize::new(0), + lock_count: Cell::new(0), + mutex: raw_mutex, + get_thread_id, + }, + } + } +} + impl ReentrantMutex { /// # Safety /// diff --git a/third_party/cargo/vendor/lock_api-0.3.3/src/rwlock.rs b/third_party/cargo/vendor/lock_api-0.3.4/src/rwlock.rs similarity index 99% rename from third_party/cargo/vendor/lock_api-0.3.3/src/rwlock.rs rename to third_party/cargo/vendor/lock_api-0.3.4/src/rwlock.rs index 0707e3c..892ba52 100644 --- a/third_party/cargo/vendor/lock_api-0.3.3/src/rwlock.rs +++ b/third_party/cargo/vendor/lock_api-0.3.4/src/rwlock.rs @@ -231,7 +231,7 @@ pub unsafe trait RawRwLockUpgradeTimed: RawRwLockUpgrade + RawRwLockTimed { /// allow concurrent access through readers. The RAII guards returned from the /// locking methods implement `Deref` (and `DerefMut` for the `write` methods) /// to allow access to the contained of the lock. -pub struct RwLock { +pub struct RwLock { raw: R, data: UnsafeCell, } @@ -297,6 +297,21 @@ impl RwLock { } } +impl RwLock { + /// Creates a new new instance of an `RwLock` based on a pre-existing + /// `RawRwLock`. + /// + /// This allows creating a `RwLock` in a constant context on stable + /// Rust. + #[inline] + pub const fn const_new(raw_rwlock: R, val: T) -> RwLock { + RwLock { + data: UnsafeCell::new(val), + raw: raw_rwlock, + } + } +} + impl RwLock { /// # Safety /// diff --git a/third_party/cargo/vendor/malloc_buf-0.0.6/BUILD b/third_party/cargo/vendor/malloc_buf-0.0.6/BUILD index 08201bf..7e271da 100644 --- a/third_party/cargo/vendor/malloc_buf-0.0.6/BUILD +++ b/third_party/cargo/vendor/malloc_buf-0.0.6/BUILD @@ -31,7 +31,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/memmap-0.7.0/BUILD b/third_party/cargo/vendor/memmap-0.7.0/BUILD index b155874..e10a619 100644 --- a/third_party/cargo/vendor/memmap-0.7.0/BUILD +++ b/third_party/cargo/vendor/memmap-0.7.0/BUILD @@ -32,7 +32,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/mio-0.6.21/.cargo-checksum.json b/third_party/cargo/vendor/mio-0.6.21/.cargo-checksum.json deleted file mode 100644 index 9cfde5c..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"251757dda7b07df5b67d078c03941415d35b56f26995349fd2ee69ff0af16efe","Cargo.toml":"aef5f1abd28b0ef807250dc0b9c490aefc68fab85d633fd0384fa0545747eb89","LICENSE":"07919255c7e04793d8ea760d6c2ce32d19f9ff02bdbdde3ce90b1e1880929a9b","README.md":"eedc84973c97348ea27f93ac7d3232098438d4455c7eaedf6fcc7f105ac9f321","azure-pipelines.yml":"5054467a3d39887027cd680e27cbb9187347ff3f08546e9cafe4d95a1803d635","benches/bench_poll.rs":"dce8529e42e2e2497e91c7610ea2ef4b0dd72b114d329df17ddd90ffec1c04e6","ci/azure-cross-compile.yml":"16d9c0e770caf6a7f06f4bd6874ad244706b878c2822f8e78b7e647b6645fea4","ci/azure-deploy-docs.yml":"b87048ae366067ffe1fd869867927d27cc86b3d26866aa9223228bd1b528073e","ci/azure-install-rust.yml":"6ac24477b6d516823de794fc537c4484b6373d7f32b402e5afc02e5e6b272ae9","ci/azure-test-stable.yml":"86ec2f72251fa66c9954ae137c53d678df76cf66a28d24ab3bb232d01ed89570","src/channel.rs":"b16493a2b74334156e153b1f4143b0e98d43cd4d7bff0275066dfa575dde2402","src/deprecated/event_loop.rs":"ba931d256e6e57d5635c6cfc6e3a4add4551c87f16457d901b334a129f9cf41d","src/deprecated/handler.rs":"13cbc0c193f43a331e125e05d5eddf3712fe86e41a8721186d3672518ef8a9cc","src/deprecated/io.rs":"4948217ffeeba4f508cc89744da5d6af858b4ad7b4be23f927a00df93bdf2984","src/deprecated/mod.rs":"4310471b5a1313dbf53b492769a3031b15353eb269333b7c1a890bc2709def7c","src/deprecated/notify.rs":"8cb108387ebcfb75764e4dd2868d80eb00d793c4b7c867c08cd86ef10b91b023","src/deprecated/unix.rs":"76c832e7db8263395b576930186fe1a3c472589bed41810d445d89f0eed684eb","src/event_imp.rs":"f8cff47dedc52dab9c7cc2d707f2c2d86d7185f942f02ace4c60353cc6094035","src/io.rs":"9207ffc93ea744b09bc6872fa4d378d7c75640f9ac38b1fa67b940c7cb5d0ade","src/lazycell.rs":"871dbd89f6918a354c2ec2d2a8b89e4aa30754e7e3e8dfcf2f5a6071156e39cf","src/lib.rs":"e8ff126d978b128f93b57ddab0aa9230f414b11ce1a255e957151db3c8b69be3","src/net/mod.rs":"340c63a8efe9ee774b7bf8ed8c0f72fc7563e5c4b35f6a8b243f92d366e145a2","src/net/tcp.rs":"8b06dc8d2dd9fb7cd52db582fd7fe608b6a50cdf7ce18cf0abb9992956e95f6d","src/net/udp.rs":"8b5728924a07917d2845bbfb060cadb842b36a74d5372ac7707eb7f169a67d4d","src/poll.rs":"e76bb316deedbd9306f91ca8ab394d02b5676fa767746bd9770c5c9dff490426","src/sys/fuchsia/awakener.rs":"71a4a0083242457b0a96326c69c0f98b23dfdb97be96deb26ee02fa9d1dfb212","src/sys/fuchsia/eventedfd.rs":"bd8f43d2b61cdd6a5d0df9c0dc1cb43e1708140d01a05611055277ed55a33b63","src/sys/fuchsia/handles.rs":"161a69e8a8d7f71326a9c53bcb7685d0a81d184aba8e20da27c64aa27dfd56b2","src/sys/fuchsia/mod.rs":"9d80f1214abc93f48b6b6c12ce5b6cfaddbda592c8f3410564d0237228cae2d0","src/sys/fuchsia/net.rs":"50340191dd9cbe317bd6e6ae0170c03daa9141f15c96782b96484e3d8b8301b1","src/sys/fuchsia/ready.rs":"7e6bb7235c52ab4a2134d36cf982f6a4fd6e18050e737b40ee84c89a10a9faac","src/sys/fuchsia/selector.rs":"f3be7f8d683d43e4a8313246e4cacb9444549bf66ecb2234f0d0f53172043bf5","src/sys/mod.rs":"64bea046e4a9feb1f2e2fb8326452c1be8b9d56cf8794df0af4fbdf565204255","src/sys/unix/awakener.rs":"20a61d8f39b2f2abf4f166a3ed46fa0d79907ddf92758eaddb880c67321db56c","src/sys/unix/dlsym.rs":"559337d1f6c10e6c1172bd3908a9dcfa5a0828b53b04f7ca3a0d926afa85cd63","src/sys/unix/epoll.rs":"ea87ff5490616a8536878394201e8e3a1443746a7a3408a889c45d3cbd767f81","src/sys/unix/eventedfd.rs":"a0bd2096ab5acf42c48110f024bc8ea052ba62c707345c7db46fea7a494388df","src/sys/unix/io.rs":"a518f09020f821e87bcf9c2ecb4bf501d428619ddfd7b35a26629b614919b14c","src/sys/unix/kqueue.rs":"3bf9f9635a8607569e3176998b61d1801e5bb35a94588c827a0a954656eee3ea","src/sys/unix/mod.rs":"bb2bc586283c7a1cc0b739e4fd37ed3022602a562a2255f6c2fb2ac5d74bee17","src/sys/unix/ready.rs":"b77c8dba00cec1c8130c048879f7e8d294e488ca364f8a8e8ec474afe8045724","src/sys/unix/tcp.rs":"19d483762fc8c8a1cb182b2f2ead85534f99394cf605a14d5ed46db7f3354667","src/sys/unix/udp.rs":"bc2e8ad142b17797a7d038e720ff57ac9840eb5b2b26696c854180085ccd1873","src/sys/unix/uds.rs":"5223d4d35048019d175679686cc65a08baf027df0b2127428e2f322bbb533309","src/sys/unix/uio.rs":"3942a49548dd3a37e5fd6044a103d92e2635965ace1ab370be10c82245b41f66","src/sys/windows/awakener.rs":"2d3cdaf8b523675e2f64c5fd81e1197d5255384517b9753b718c5c47acf0cabd","src/sys/windows/buffer_pool.rs":"636f4b7510a507f9985987699ce8ec140b2ed852abb231443ee1486c80759eed","src/sys/windows/from_raw_arc.rs":"659dabdf5037546e3783aacc422992b4248b0ba2ddcce52b149d35bc723550e5","src/sys/windows/mod.rs":"afeec8cd4e3adeaf6ffe68b134ad1b4ba07faa3abae96f6f9a00bbc20ff5f2c5","src/sys/windows/selector.rs":"0137276cff457f84511e007bb9527f5e082ec04e898b8f8e0acd39fe65c00148","src/sys/windows/tcp.rs":"9942db351f91229d01a0b9f52dd6c9680050d3abcee9fbb6b4f2f14896dc2c58","src/sys/windows/udp.rs":"1ef869b660bcf89ea6498552474abf8f540946631e14d5b610ca31014cd9045f","src/timer.rs":"540d521c5b4a79f3b1c01296ef2e14e2e3743192f25180ee6e71e367692ce762","src/token.rs":"4a56f851709470df2eed803c57c68b0a4b12ea86fa1b8d2c999bec7a85d58ec0","src/udp.rs":"442e620f3ea0cf010497d3ad775debd585f28e79a025993d40471c8e6839dc98","test/benchmark.rs":"d655cd4a79b11555df4d46e929134d73f2e49e174a59f66b98904a6b9a2779e3","test/mod.rs":"15306dec0d939312ab36a181f609393d8cb1ebac4d048b8f0275fc056776074f","test/test_battery.rs":"a50e14eb3d2d914bdd1ddc8501a32fae757add51c1c5388350eb4a06b6456509","test/test_broken_pipe.rs":"1e8352a22a8b3fe170aa8bb942dc4a2ddd0fb5e69374733e6bcfa324481da648","test/test_close_on_drop.rs":"5ca1dece36ba37600d474d6e4da2495bb48946d37c17914bb682ffa8a4671702","test/test_custom_evented.rs":"f6dcfbfc5d7d44937e16bc333869f1fbd09f46c3c334135ca79df95b02415e27","test/test_double_register.rs":"f48b1b5aee68f0c3fef8895c8b9f2cf2446e670f3d0e7249ec300067df783617","test/test_echo_server.rs":"34d35e80029c03f276139a10320426ac0b95ff5d1d95d5cbc93474498adac31b","test/test_fuchsia_handles.rs":"1e4fc0920b4067a4ece7487067af4f6e3f18e8e55b0fd636ccc2d333f8ade70f","test/test_local_addr_ready.rs":"0a9cd42cb43b5afcc139b1def8278f2a24834e40f96c4ea69f05c4f3263f7c65","test/test_multicast.rs":"2a0ae0c99e80dddea3088fd639af22204d63f3bb2dad2bcdf1389ac97639d620","test/test_notify.rs":"3e730ae1c4eaf3453c6e46f514eb266ce119dec5543e46a2b5125a3d5eb5cd65","test/test_oneshot.rs":"3f618c167734b1ce4695691955fb01224c6abf0a1cc1e1db9e01248fb9edbd3c","test/test_poll.rs":"ad450ff65e9ab8108d424b3b8cf4c82847fb9927f12e749f0aee1228bd5db7da","test/test_poll_channel.rs":"8414e7d27e32bec5c8ea0341f4f2708eb64853cfb6d28689deb58d90b1619120","test/test_register_deregister.rs":"8fdbf48bbd5f2c84a2685fe4151189a157f148bd13781533e5a84f958a5baaf6","test/test_register_multiple_event_loops.rs":"e0f3115ef938ceed2eae47ea1630c7f440a860b69ab57b70507cf8062fc21eb9","test/test_reregister_without_poll.rs":"30ebba86b936bc283575f8f15237bd1f616ea09516bf34912a27ce6c7b5a5559","test/test_smoke.rs":"f1c4c52509537a76975354dbd9a91e16b14e53f8b30171c57ebf59ff4d935bcc","test/test_subprocess_pipe.rs":"324b68e1cb2d43bec204d41064f6873640cf61970718da3703506f0e5ebad31d","test/test_tcp.rs":"c69f7ffede13e2c9cb2b55490359fd8ec34e79c5797044e4a0051884ede1dc19","test/test_tcp_level.rs":"a76a8b854fe3e3245937c2e80acfb7a6ebb3442701179cd887365d1c27b4bd0d","test/test_tcp_shutdown.rs":"6f095fd7e0af26c61734509cc6e21d080d1f6484dcc3bdd8c954aca4f200f2b3","test/test_tick.rs":"2f3c90e03cac4bcbf70469b631e6ea64053342df3a5715bc30053771a7fdb6de","test/test_udp_level.rs":"c47b99cd614d5115fe59ed3afdbe56e0a4bf16884da7f03bab54ba4a513a3893","test/test_udp_socket.rs":"2c6a8242ea9435b366b70cdd47b318776d61995662e1d6a7077c74b026d8b6ad","test/test_uds_shutdown.rs":"9af7ac437084cb833d97cd9164d29003b45761c36ca0e2bc72bc9affd9590498","test/test_unix_echo_server.rs":"b70a474eceb9f8f320fed218be777b510c3ab8b74dd8959c381e41ed1dbe2929","test/test_unix_pass_fd.rs":"04d8911705047d11c745a2df1ffadff655c032250548e502df85d0b4490305a6","test/test_write_then_drop.rs":"00c91aef8f0b903f480bf0f55857659df6dc9a90f68a477264f62acb179b347f"},"package":"302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f"} \ No newline at end of file diff --git a/third_party/cargo/vendor/mio-0.6.21/azure-pipelines.yml b/third_party/cargo/vendor/mio-0.6.21/azure-pipelines.yml deleted file mode 100644 index 444a67e..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/azure-pipelines.yml +++ /dev/null @@ -1,50 +0,0 @@ -trigger: ["master", "v0.6.x"] -pr: ["master", "v0.6.x"] - -jobs: -# Check formatting -# - template: ci/azure-rustfmt.yml -# parameters: -# name: rustfmt - -# Stable -- template: ci/azure-test-stable.yml - parameters: - name: stable - displayName: Test - cross: true - -# Nightly -- template: ci/azure-test-stable.yml - parameters: - name: nightly - displayName: Nightly - # Pin nightly to avoid being impacted by breakage - rust_version: nightly-2019-11-17 - benches: true - -# This represents the minimum Rust version supported by -# Mio. Updating this should be done in a dedicated PR. -# -# Tests are not run as tests may require newer versions of -# rust. -- template: ci/azure-test-stable.yml - parameters: - name: minrust - displayName: Min Rust - rust_version: 1.18.0 - cmd: check - cross: true - -- template: ci/azure-cross-compile.yml - parameters: - name: cross - -- template: ci/azure-deploy-docs.yml - parameters: - dependsOn: - # - rustfmt - - stable - - nightly - - minrust - - cross diff --git a/third_party/cargo/vendor/mio-0.6.21/benches/bench_poll.rs b/third_party/cargo/vendor/mio-0.6.21/benches/bench_poll.rs deleted file mode 100644 index 6b25b22..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/benches/bench_poll.rs +++ /dev/null @@ -1,53 +0,0 @@ -#![feature(test)] -#![allow(deprecated)] - -extern crate mio; -extern crate test; - -use mio::*; -use test::Bencher; -use std::sync::Arc; -use std::thread; - -#[bench] -fn bench_poll(bench: &mut Bencher) { - const NUM: usize = 10_000; - const THREADS: usize = 4; - - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - - let mut registrations = vec![]; - let mut set_readiness = vec![]; - - for i in 0..NUM { - let (r, s) = Registration::new( - &poll, - Token(i), - Ready::readable(), - PollOpt::edge()); - - registrations.push(r); - set_readiness.push(s); - } - - let set_readiness = Arc::new(set_readiness); - - bench.iter(move || { - for mut i in 0..THREADS { - let set_readiness = set_readiness.clone(); - thread::spawn(move || { - while i < NUM { - set_readiness[i].set_readiness(Ready::readable()).unwrap(); - i += THREADS; - } - }); - } - - let mut n = 0; - - while n < NUM { - n += poll.poll(&mut events, None).unwrap(); - } - }) -} diff --git a/third_party/cargo/vendor/mio-0.6.21/ci/azure-cross-compile.yml b/third_party/cargo/vendor/mio-0.6.21/ci/azure-cross-compile.yml deleted file mode 100644 index c7db94f..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/ci/azure-cross-compile.yml +++ /dev/null @@ -1,56 +0,0 @@ -parameters: - vmImage: ubuntu-16.04 - -jobs: -- job: ${{ parameters.name }} - displayName: Cross - strategy: - matrix: - iOS: - vmImage: macOS-10.13 - target: x86_64-apple-ios - - Android: - vmImage: ubuntu-16.04 - target: arm-linux-androideabi - - Android_64: - vmImage: ubuntu-16.04 - target: aarch64-linux-android - - NetBSD: - vmImage: ubuntu-16.04 - target: x86_64-unknown-netbsd - - Solaris: - vmImage: ubuntu-16.04 - target: x86_64-sun-solaris - - pool: - vmImage: $(vmImage) - - steps: - - template: azure-install-rust.yml - parameters: - rust_version: stable - - - script: rustup target add $(target) - displayName: "Add target" - - - script: cargo check --target $(target) - displayName: Check source - - - script: cargo check --tests --target $(target) - displayName: Check tests - - - script: cargo check --examples --target $(target) - displayName: Check examples - - - script: cargo check --target $(target) --no-default-features - displayName: Check source (no default features) - - - script: cargo check --tests --target $(target) --no-default-features - displayName: Check tests (no default features) - - - script: cargo check --examples --target $(target) --no-default-features - displayName: Check examples (no default features) diff --git a/third_party/cargo/vendor/mio-0.6.21/ci/azure-deploy-docs.yml b/third_party/cargo/vendor/mio-0.6.21/ci/azure-deploy-docs.yml deleted file mode 100644 index 2ff0f2a..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/ci/azure-deploy-docs.yml +++ /dev/null @@ -1,39 +0,0 @@ -parameters: - dependsOn: [] - -jobs: -- job: documentation - displayName: 'Deploy API Documentation' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) - pool: - vmImage: 'Ubuntu 16.04' - dependsOn: - - ${{ parameters.dependsOn }} - steps: - - template: azure-install-rust.yml - parameters: - rust_version: stable - - script: | - cargo doc --no-deps - cp -R target/doc '$(Build.BinariesDirectory)' - displayName: 'Generate Documentation' - - script: | - set -e - - git --version - ls -la - git init - git config user.name 'Deployment Bot (from Azure Pipelines)' - git config user.email 'deploy@tokio-rs.com' - git config --global credential.helper 'store --file ~/.my-credentials' - printf "protocol=https\nhost=github.com\nusername=carllerche\npassword=%s\n\n" "$GITHUB_TOKEN" | git credential-store --file ~/.my-credentials store - git remote add origin https://github.com/tokio-rs/mio - git checkout -b gh-pages - git add . - git commit -m 'Deploy Mio API documentation' - git push -f origin gh-pages - env: - GITHUB_TOKEN: $(githubPersonalToken) - workingDirectory: '$(Build.BinariesDirectory)' - displayName: 'Deploy Documentation' - diff --git a/third_party/cargo/vendor/mio-0.6.21/ci/azure-install-rust.yml b/third_party/cargo/vendor/mio-0.6.21/ci/azure-install-rust.yml deleted file mode 100644 index 43d806e..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/ci/azure-install-rust.yml +++ /dev/null @@ -1,32 +0,0 @@ -steps: - # Linux and macOS. - - script: | - set -e - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none - export PATH=$PATH:$HOME/.cargo/bin - rustup toolchain install $RUSTUP_TOOLCHAIN - rustup default $RUSTUP_TOOLCHAIN - echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (*nix)" - condition: not(eq(variables['Agent.OS'], 'Windows_NT')) - - # Windows. - - script: | - curl -sSf -o rustup-init.exe https://win.rustup.rs - rustup-init.exe -y --default-toolchain none - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - rustup toolchain install %RUSTUP_TOOLCHAIN% - rustup default %RUSTUP_TOOLCHAIN% - echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" - env: - RUSTUP_TOOLCHAIN: ${{parameters.rust_version}} - displayName: "Install rust (windows)" - condition: eq(variables['Agent.OS'], 'Windows_NT') - - # All platforms. - - script: | - rustc -Vv - cargo -V - displayName: Query rust and cargo versions diff --git a/third_party/cargo/vendor/mio-0.6.21/ci/azure-test-stable.yml b/third_party/cargo/vendor/mio-0.6.21/ci/azure-test-stable.yml deleted file mode 100644 index b0b9be1..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/ci/azure-test-stable.yml +++ /dev/null @@ -1,45 +0,0 @@ -parameters: - cmd: test - rust_version: stable - -jobs: -- job: ${{ parameters.name }} - displayName: ${{ parameters.displayName }} - strategy: - matrix: - Linux: - vmImage: ubuntu-16.04 - - ${{ if parameters.cross }}: - MacOS: - vmImage: macOS-10.13 - Windows: - vmImage: vs2017-win2016 - pool: - vmImage: $(vmImage) - - steps: - - template: azure-install-rust.yml - parameters: - rust_version: ${{ parameters.rust_version }} - - - script: | - cargo update - cargo update -p cfg-if --precise 0.1.9 - cargo ${{ parameters.cmd }} - displayName: cargo ${{ parameters.cmd }} - env: - CI: 'True' - - - script: cargo ${{ parameters.cmd }} --no-default-features - displayName: cargo ${{ parameters.cmd }} --no-default-features - env: - CI: 'True' - - - ${{ if eq(parameters.cmd, 'test') }}: - - script: cargo doc --no-deps - displayName: cargo doc --no-deps - - - ${{ if parameters.benches }}: - - script: cargo check --benches - displayName: Check benchmarks diff --git a/third_party/cargo/vendor/mio-0.6.21/test/benchmark.rs b/third_party/cargo/vendor/mio-0.6.21/test/benchmark.rs deleted file mode 100644 index 1e4fac5..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/benchmark.rs +++ /dev/null @@ -1,80 +0,0 @@ -use std::mem; -use mio::net::{AddressFamily, Inet, Inet6, SockAddr, InetAddr, IPv4Addr, SocketType, Dgram, Stream}; -use std::io::net::ip::IpAddr; -use native::NativeTaskBuilder; -use std::task::TaskBuilder; -use mio::os::{from_sockaddr}; -use time::Instant; -use std::vec::*; -use std::io::timer; - -mod nix { - pub use nix::c_int; - pub use nix::fcntl::{Fd, O_NONBLOCK, O_CLOEXEC}; - pub use nix::errno::{EWOULDBLOCK, EINPROGRESS}; - pub use nix::sys::socket::*; - pub use nix::unistd::*; - pub use nix::sys::epoll::*; -} - -fn timed(label: &str, f: ||) { - let start = Instant::now(); - f(); - let elapsed = start.elapsed(); - println!(" {}: {}", label, elapsed.as_secs() as f64 + elapsed.subsec_nanos() as f64 / 1_000_000_000.0); -} - -fn init(saddr: &str) -> (nix::Fd, nix::Fd) { - let optval = 1i; - let addr = SockAddr::parse(saddr.as_slice()).expect("could not parse InetAddr"); - let srvfd = nix::socket(nix::AF_INET, nix::SOCK_STREAM, nix::SOCK_CLOEXEC).unwrap(); - nix::setsockopt(srvfd, nix::SOL_SOCKET, nix::SO_REUSEADDR, &optval).unwrap(); - nix::bind(srvfd, &from_sockaddr(&addr)).unwrap(); - nix::listen(srvfd, 256u).unwrap(); - - let fd = nix::socket(nix::AF_INET, nix::SOCK_STREAM, nix::SOCK_CLOEXEC | nix::SOCK_NONBLOCK).unwrap(); - let res = nix::connect(fd, &from_sockaddr(&addr)); - let start = Instant::now(); - println!("connecting : {}", res); - - let clifd = nix::accept4(srvfd, nix::SOCK_CLOEXEC | nix::SOCK_NONBLOCK).unwrap(); - let elapsed = start.elapsed(); - println!("accepted : {} - {}", clifd, elapsed.as_secs() as f64 + elapsed.subsec_nanos() as f64 / 1_000_000_000.0); - - (clifd, srvfd) -} - -#[test] -fn read_bench() { - let (clifd, srvfd) = init("10.10.1.5:11111"); - let mut buf = Vec::with_capacity(1600); - unsafe { buf.set_len(1600); } - timed("read", || { - let mut i = 0u; - while i < 10000000 { - let res = nix::read(clifd, buf.as_mut_slice()); - assert_eq!(res.unwrap_err().kind, nix::EWOULDBLOCK); - i = i + 1; - } - }); -} - -#[test] -fn epollctl_bench() { - let (clifd, srvfd) = init("10.10.1.5:22222"); - - let epfd = nix::epoll_create().unwrap(); - let info = nix::EpollEvent { events: nix::EPOLLIN | nix::EPOLLONESHOT | nix::EPOLLET, - data: 0u64 }; - - nix::epoll_ctl(epfd, nix::EpollCtlAdd, clifd, &info); - - timed("epoll_ctl", || { - let mut i = 0u; - while i < 10000000 { - nix::epoll_ctl(epfd, nix::EpollCtlMod, clifd, &info); - i = i + 1; - } - }); - -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/mod.rs b/third_party/cargo/vendor/mio-0.6.21/test/mod.rs deleted file mode 100644 index e49034f..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/mod.rs +++ /dev/null @@ -1,214 +0,0 @@ -#![allow(deprecated)] - -extern crate mio; -extern crate bytes; -extern crate net2; - -#[macro_use] -extern crate log; -extern crate env_logger; -extern crate iovec; -extern crate slab; -extern crate tempdir; - -#[cfg(target_os = "fuchsia")] -extern crate fuchsia_zircon as zircon; - -pub use ports::localhost; - -mod test_custom_evented; -mod test_close_on_drop; -mod test_double_register; -mod test_echo_server; -mod test_local_addr_ready; -mod test_multicast; -mod test_oneshot; -mod test_poll; -mod test_register_deregister; -mod test_register_multiple_event_loops; -mod test_reregister_without_poll; -mod test_smoke; -mod test_tcp; -mod test_tcp_level; -mod test_tcp_shutdown; -mod test_udp_level; -mod test_udp_socket; -mod test_write_then_drop; - -#[cfg(feature = "with-deprecated")] -mod test_notify; -#[cfg(feature = "with-deprecated")] -mod test_poll_channel; -#[cfg(feature = "with-deprecated")] -mod test_tick; - -// The following tests are for deprecated features. Only run these tests on -// platforms that were supported from before the features were deprecated -#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] -#[cfg(feature = "with-deprecated")] -mod test_battery; - -#[cfg(any(target_os = "macos", target_os = "linux"))] -#[cfg(feature = "with-deprecated")] -mod test_unix_echo_server; -#[cfg(any(target_os = "macos", target_os = "linux"))] -#[cfg(feature = "with-deprecated")] -mod test_unix_pass_fd; -#[cfg(any(target_os = "macos", target_os = "linux"))] -#[cfg(feature = "with-deprecated")] -mod test_uds_shutdown; -#[cfg(any(target_os = "macos", target_os = "linux"))] -#[cfg(feature = "with-deprecated")] -mod test_subprocess_pipe; -#[cfg(any(target_os = "macos", target_os = "linux"))] -#[cfg(feature = "with-deprecated")] -mod test_broken_pipe; - -#[cfg(any(target_os = "fuchsia"))] -mod test_fuchsia_handles; - -use bytes::{Buf, MutBuf}; -use std::io::{self, Read, Write}; -use std::time::Duration; -use mio::{Events, Poll}; -use mio::event::Event; - -pub trait TryRead { - fn try_read_buf(&mut self, buf: &mut B) -> io::Result> - where Self : Sized - { - // Reads the length of the slice supplied by buf.mut_bytes into the buffer - // This is not guaranteed to consume an entire datagram or segment. - // If your protocol is msg based (instead of continuous stream) you should - // ensure that your buffer is large enough to hold an entire segment (1532 bytes if not jumbo - // frames) - let res = self.try_read(unsafe { buf.mut_bytes() }); - - if let Ok(Some(cnt)) = res { - unsafe { buf.advance(cnt); } - } - - res - } - - fn try_read(&mut self, buf: &mut [u8]) -> io::Result>; -} - -pub trait TryWrite { - fn try_write_buf(&mut self, buf: &mut B) -> io::Result> - where Self : Sized - { - let res = self.try_write(buf.bytes()); - - if let Ok(Some(cnt)) = res { - buf.advance(cnt); - } - - res - } - - fn try_write(&mut self, buf: &[u8]) -> io::Result>; -} - -impl TryRead for T { - fn try_read(&mut self, dst: &mut [u8]) -> io::Result> { - self.read(dst).map_non_block() - } -} - -impl TryWrite for T { - fn try_write(&mut self, src: &[u8]) -> io::Result> { - self.write(src).map_non_block() - } -} - -/* - * - * ===== Helpers ===== - * - */ - -/// A helper trait to provide the map_non_block function on Results. -trait MapNonBlock { - /// Maps a `Result` to a `Result>` by converting - /// operation-would-block errors into `Ok(None)`. - fn map_non_block(self) -> io::Result>; -} - -impl MapNonBlock for io::Result { - fn map_non_block(self) -> io::Result> { - use std::io::ErrorKind::WouldBlock; - - match self { - Ok(value) => Ok(Some(value)), - Err(err) => { - if let WouldBlock = err.kind() { - Ok(None) - } else { - Err(err) - } - } - } - } -} - -mod ports { - use std::net::SocketAddr; - use std::str::FromStr; - use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT}; - use std::sync::atomic::Ordering::SeqCst; - - // Helper for getting a unique port for the task run - // TODO: Reuse ports to not spam the system - static mut NEXT_PORT: AtomicUsize = ATOMIC_USIZE_INIT; - const FIRST_PORT: usize = 18080; - - fn next_port() -> usize { - unsafe { - // If the atomic was never used, set it to the initial port - NEXT_PORT.compare_and_swap(0, FIRST_PORT, SeqCst); - - // Get and increment the port list - NEXT_PORT.fetch_add(1, SeqCst) - } - } - - pub fn localhost() -> SocketAddr { - let s = format!("127.0.0.1:{}", next_port()); - FromStr::from_str(&s).unwrap() - } -} - -pub fn sleep_ms(ms: u64) { - use std::thread; - thread::sleep(Duration::from_millis(ms)); -} - -pub fn expect_events(poll: &Poll, - event_buffer: &mut Events, - poll_try_count: usize, - mut expected: Vec) -{ - const MS: u64 = 1_000; - - for _ in 0..poll_try_count { - poll.poll(event_buffer, Some(Duration::from_millis(MS))).unwrap(); - for event in event_buffer.iter() { - let pos_opt = match expected.iter().position(|exp_event| { - (event.token() == exp_event.token()) && - event.readiness().contains(exp_event.readiness()) - }) { - Some(x) => Some(x), - None => None, - }; - if let Some(pos) = pos_opt { expected.remove(pos); } - } - - if expected.is_empty() { - break; - } - } - - assert!(expected.is_empty(), "The following expected events were not found: {:?}", expected); -} - diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_battery.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_battery.rs deleted file mode 100644 index fa3aff0..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_battery.rs +++ /dev/null @@ -1,269 +0,0 @@ -use {localhost, sleep_ms, TryRead, TryWrite}; -use mio::*; -use mio::deprecated::{EventLoop, EventLoopBuilder, Handler}; -use mio::net::{TcpListener, TcpStream}; -use std::collections::LinkedList; -use slab::Slab; -use std::{io, thread}; -use std::time::Duration; - -// Don't touch the connection slab -const SERVER: Token = Token(10_000_000); -const CLIENT: Token = Token(10_000_001); - -#[cfg(windows)] -const N: usize = 10_000; -#[cfg(unix)] -const N: usize = 1_000_000; - -struct EchoConn { - sock: TcpStream, - token: Option, - count: usize, - buf: Vec -} - -impl EchoConn { - fn new(sock: TcpStream) -> EchoConn { - let mut ec = - EchoConn { - sock: sock, - token: None, - buf: Vec::with_capacity(22), - count: 0 - }; - unsafe { ec.buf.set_len(22) }; - ec - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - event_loop.reregister(&self.sock, self.token.unwrap(), - Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - loop { - match self.sock.try_read(&mut self.buf[..]) { - Ok(None) => { - break; - } - Ok(Some(_)) => { - self.count += 1; - if self.count % 10000 == 0 { - info!("Received {} messages", self.count); - } - if self.count == N { - event_loop.shutdown(); - } - } - Err(_) => { - break; - } - - }; - } - - event_loop.reregister(&self.sock, self.token.unwrap(), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct EchoServer { - sock: TcpListener, - conns: Slab -} - -impl EchoServer { - fn accept(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("server accepting socket"); - - let sock = self.sock.accept().unwrap().0; - let conn = EchoConn::new(sock,); - let tok = self.conns.insert(conn); - - // Register the connection - self.conns[tok].token = Some(Token(tok)); - event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - .expect("could not register socket with event loop"); - - Ok(()) - } - - fn conn_readable(&mut self, event_loop: &mut EventLoop, - tok: Token) -> io::Result<()> { - debug!("server conn readable; tok={:?}", tok); - self.conn(tok).readable(event_loop) - } - - fn conn_writable(&mut self, event_loop: &mut EventLoop, - tok: Token) -> io::Result<()> { - debug!("server conn writable; tok={:?}", tok); - self.conn(tok).writable(event_loop) - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { - &mut self.conns[tok.into()] - } -} - -struct EchoClient { - sock: TcpStream, - backlog: LinkedList, - token: Token, - count: u32 -} - - -// Sends a message and expects to receive the same exact message, one at a time -impl EchoClient { - fn new(sock: TcpStream, tok: Token) -> EchoClient { - - EchoClient { - sock: sock, - backlog: LinkedList::new(), - token: tok, - count: 0 - } - } - - fn readable(&mut self, _event_loop: &mut EventLoop) -> io::Result<()> { - Ok(()) - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket writable"); - - while self.backlog.len() > 0 { - match self.sock.try_write(self.backlog.front().unwrap().as_bytes()) { - Ok(None) => { - break; - } - Ok(Some(_)) => { - self.backlog.pop_front(); - self.count += 1; - if self.count % 10000 == 0 { - info!("Sent {} messages", self.count); - } - } - Err(e) => { debug!("not implemented; client err={:?}", e); break; } - } - } - if self.backlog.len() > 0 { - event_loop.reregister(&self.sock, self.token, Ready::writable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - } - - Ok(()) - } -} - -struct Echo { - server: EchoServer, - client: EchoClient, -} - -impl Echo { - fn new(srv: TcpListener, client: TcpStream) -> Echo { - Echo { - server: EchoServer { - sock: srv, - conns: Slab::with_capacity(128), - }, - client: EchoClient::new(client, CLIENT), - } - } -} - -impl Handler for Echo { - type Timeout = usize; - type Message = String; - - fn ready(&mut self, event_loop: &mut EventLoop, token: Token, - events: Ready) { - - if events.is_readable() { - match token { - SERVER => self.server.accept(event_loop).unwrap(), - CLIENT => self.client.readable(event_loop).unwrap(), - i => self.server.conn_readable(event_loop, i).unwrap() - } - } - if events.is_writable() { - match token { - SERVER => panic!("received writable for token 0"), - CLIENT => self.client.writable(event_loop).unwrap(), - _ => self.server.conn_writable(event_loop, token).unwrap() - } - } - } - - fn notify(&mut self, event_loop: &mut EventLoop, msg: String) { - match self.client.sock.try_write(msg.as_bytes()) { - Ok(Some(n)) => { - self.client.count += 1; - if self.client.count % 10000 == 0 { - info!("Sent {} bytes: count {}", n, self.client.count); - } - }, - - _ => { - self.client.backlog.push_back(msg); - event_loop.reregister( - &self.client.sock, - self.client.token, - Ready::writable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - } - } - } -} - -#[test] -pub fn test_echo_server() { - debug!("Starting TEST_ECHO_SERVER"); - let mut b = EventLoopBuilder::new(); - b.notify_capacity(1_048_576) - .messages_per_tick(64) - .timer_tick(Duration::from_millis(100)) - .timer_wheel_size(1_024) - .timer_capacity(65_536); - - let mut event_loop = b.build().unwrap(); - - let addr = localhost(); - - let srv = TcpListener::bind(&addr).unwrap(); - - info!("listen for connections"); - event_loop.register(&srv, SERVER, Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - let sock = TcpStream::connect(&addr).unwrap(); - - // Connect to the server - event_loop.register(&sock, CLIENT, Ready::writable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - let chan = event_loop.channel(); - - let go = move || { - let mut i = N; - - sleep_ms(1_000); - - let message = "THIS IS A TEST MESSAGE".to_string(); - while i > 0 { - chan.send(message.clone()).unwrap(); - i -= 1; - if i % 10000 == 0 { - info!("Enqueued {} messages", N - i); - } - } - }; - - let t = thread::spawn(go); - - // Start the event loop - event_loop.run(&mut Echo::new(srv, sock)).unwrap(); - t.join().unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_broken_pipe.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_broken_pipe.rs deleted file mode 100644 index 1cd0ca7..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_broken_pipe.rs +++ /dev/null @@ -1,28 +0,0 @@ -use mio::{Token, Ready, PollOpt}; -use mio::deprecated::{unix, EventLoop, Handler}; -use std::time::Duration; - -pub struct BrokenPipeHandler; - -impl Handler for BrokenPipeHandler { - type Timeout = (); - type Message = (); - fn ready(&mut self, _: &mut EventLoop, token: Token, _: Ready) { - if token == Token(1) { - panic!("Received ready() on a closed pipe."); - } - } -} - -#[test] -pub fn broken_pipe() { - let mut event_loop: EventLoop = EventLoop::new().unwrap(); - let (reader, _) = unix::pipe().unwrap(); - - event_loop.register(&reader, Token(1), Ready::all(), PollOpt::edge()) - .unwrap(); - - let mut handler = BrokenPipeHandler; - drop(reader); - event_loop.run_once(&mut handler, Some(Duration::from_millis(1000))).unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_close_on_drop.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_close_on_drop.rs deleted file mode 100644 index 6cd7d13..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_close_on_drop.rs +++ /dev/null @@ -1,119 +0,0 @@ -use {localhost, TryRead}; -use mio::{Events, Poll, PollOpt, Ready, Token}; -use bytes::ByteBuf; -use mio::net::{TcpListener, TcpStream}; - -use self::TestState::{Initial, AfterRead}; - -const SERVER: Token = Token(0); -const CLIENT: Token = Token(1); - -#[derive(Debug, PartialEq)] -enum TestState { - Initial, - AfterRead, -} - -struct TestHandler { - srv: TcpListener, - cli: TcpStream, - state: TestState, - shutdown: bool, -} - -impl TestHandler { - fn new(srv: TcpListener, cli: TcpStream) -> TestHandler { - TestHandler { - srv, - cli, - state: Initial, - shutdown: false, - } - } - - fn handle_read(&mut self, poll: &mut Poll, tok: Token, events: Ready) { - debug!("readable; tok={:?}; hint={:?}", tok, events); - - match tok { - SERVER => { - debug!("server connection ready for accept"); - let _ = self.srv.accept().unwrap(); - } - CLIENT => { - debug!("client readable"); - - match self.state { - Initial => { - let mut buf = [0; 4096]; - debug!("GOT={:?}", self.cli.try_read(&mut buf[..])); - self.state = AfterRead; - }, - AfterRead => {} - } - - let mut buf = ByteBuf::mut_with_capacity(1024); - - match self.cli.try_read_buf(&mut buf) { - Ok(Some(0)) => self.shutdown = true, - Ok(_) => panic!("the client socket should not be readable"), - Err(e) => panic!("Unexpected error {:?}", e) - } - } - _ => panic!("received unknown token {:?}", tok) - } - poll.reregister(&self.cli, CLIENT, Ready::readable(), PollOpt::edge()).unwrap(); - } - - fn handle_write(&mut self, poll: &mut Poll, tok: Token, _: Ready) { - match tok { - SERVER => panic!("received writable for token 0"), - CLIENT => { - debug!("client connected"); - poll.reregister(&self.cli, CLIENT, Ready::readable(), PollOpt::edge()).unwrap(); - } - _ => panic!("received unknown token {:?}", tok) - } - } -} - -#[test] -pub fn test_close_on_drop() { - let _ = ::env_logger::init(); - debug!("Starting TEST_CLOSE_ON_DROP"); - let mut poll = Poll::new().unwrap(); - - // The address to connect to - localhost + a unique port - let addr = localhost(); - - // == Create & setup server socket - let srv = TcpListener::bind(&addr).unwrap(); - - poll.register(&srv, SERVER, Ready::readable(), PollOpt::edge()).unwrap(); - - // == Create & setup client socket - let sock = TcpStream::connect(&addr).unwrap(); - - poll.register(&sock, CLIENT, Ready::writable(), PollOpt::edge()).unwrap(); - - // == Create storage for events - let mut events = Events::with_capacity(1024); - - // == Setup test handler - let mut handler = TestHandler::new(srv, sock); - - // == Run test - while !handler.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.readiness().is_readable() { - handler.handle_read(&mut poll, event.token(), event.readiness()); - } - - if event.readiness().is_writable() { - handler.handle_write(&mut poll, event.token(), event.readiness()); - } - } - } - assert!(handler.state == AfterRead, "actual={:?}", handler.state); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_custom_evented.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_custom_evented.rs deleted file mode 100644 index 08842fc..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_custom_evented.rs +++ /dev/null @@ -1,394 +0,0 @@ -use mio::{Events, Poll, PollOpt, Ready, Registration, SetReadiness, Token}; -use mio::event::Evented; -use std::time::Duration; - -#[test] -fn smoke() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(128); - - let (r, set) = Registration::new2(); - r.register(&poll, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - - let n = poll.poll(&mut events, Some(Duration::from_millis(0))).unwrap(); - assert_eq!(n, 0); - - set.set_readiness(Ready::readable()).unwrap(); - - let n = poll.poll(&mut events, Some(Duration::from_millis(0))).unwrap(); - assert_eq!(n, 1); - - assert_eq!(events.get(0).unwrap().token(), Token(0)); -} - -#[test] -fn set_readiness_before_register() { - use std::sync::{Arc, Barrier}; - use std::thread; - - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(128); - - for _ in 0..5_000 { - let (r, set) = Registration::new2(); - - let b1 = Arc::new(Barrier::new(2)); - let b2 = b1.clone(); - - let th = thread::spawn(move || { - // set readiness before register - set.set_readiness(Ready::readable()).unwrap(); - - // run into barrier so both can pass - b2.wait(); - }); - - // wait for readiness - b1.wait(); - - // now register - poll.register(&r, Token(123), Ready::readable(), PollOpt::edge()).unwrap(); - - loop { - let n = poll.poll(&mut events, None).unwrap(); - - if n == 0 { - continue; - } - - assert_eq!(n, 1); - assert_eq!(events.get(0).unwrap().token(), Token(123)); - break; - } - - th.join().unwrap(); - } -} - -#[cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))] -mod stress { - use mio::{Events, Poll, PollOpt, Ready, Registration, SetReadiness, Token}; - use mio::event::Evented; - use std::time::Duration; - - #[test] - fn single_threaded_poll() { - use std::sync::Arc; - use std::sync::atomic::AtomicUsize; - use std::sync::atomic::Ordering::{Acquire, Release}; - use std::thread; - - const NUM_ATTEMPTS: usize = 30; - const NUM_ITERS: usize = 500; - const NUM_THREADS: usize = 4; - const NUM_REGISTRATIONS: usize = 128; - - for _ in 0..NUM_ATTEMPTS { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(NUM_REGISTRATIONS); - - let registrations: Vec<_> = (0..NUM_REGISTRATIONS).map(|i| { - let (r, s) = Registration::new2(); - r.register(&poll, Token(i), Ready::readable(), PollOpt::edge()).unwrap(); - (r, s) - }).collect(); - - let mut ready: Vec<_> = (0..NUM_REGISTRATIONS).map(|_| Ready::empty()).collect(); - - let remaining = Arc::new(AtomicUsize::new(NUM_THREADS)); - - for _ in 0..NUM_THREADS { - let remaining = remaining.clone(); - - let set_readiness: Vec = - registrations.iter().map(|r| r.1.clone()).collect(); - - thread::spawn(move || { - for _ in 0..NUM_ITERS { - for i in 0..NUM_REGISTRATIONS { - set_readiness[i].set_readiness(Ready::readable()).unwrap(); - set_readiness[i].set_readiness(Ready::empty()).unwrap(); - set_readiness[i].set_readiness(Ready::writable()).unwrap(); - set_readiness[i].set_readiness(Ready::readable() | Ready::writable()).unwrap(); - set_readiness[i].set_readiness(Ready::empty()).unwrap(); - } - } - - for i in 0..NUM_REGISTRATIONS { - set_readiness[i].set_readiness(Ready::readable()).unwrap(); - } - - remaining.fetch_sub(1, Release); - }); - } - - while remaining.load(Acquire) > 0 { - // Set interest - for (i, &(ref r, _)) in registrations.iter().enumerate() { - r.reregister(&poll, Token(i), Ready::writable(), PollOpt::edge()).unwrap(); - } - - poll.poll(&mut events, Some(Duration::from_millis(0))).unwrap(); - - for event in &events { - ready[event.token().0] = event.readiness(); - } - - // Update registration - // Set interest - for (i, &(ref r, _)) in registrations.iter().enumerate() { - r.reregister(&poll, Token(i), Ready::readable(), PollOpt::edge()).unwrap(); - } - } - - // Finall polls, repeat until readiness-queue empty - loop { - // Might not read all events from custom-event-queue at once, implementation dependend - poll.poll(&mut events, Some(Duration::from_millis(0))).unwrap(); - if events.is_empty() { - // no more events in readiness queue pending - break; - } - for event in &events { - ready[event.token().0] = event.readiness(); - } - } - - // Everything should be flagged as readable - for ready in ready { - assert_eq!(ready, Ready::readable()); - } - } - } - - #[test] - fn multi_threaded_poll() { - use std::sync::{Arc, Barrier}; - use std::sync::atomic::{AtomicUsize}; - use std::sync::atomic::Ordering::{Relaxed, SeqCst}; - use std::thread; - - const ENTRIES: usize = 10_000; - const PER_ENTRY: usize = 16; - const THREADS: usize = 4; - const NUM: usize = ENTRIES * PER_ENTRY; - - struct Entry { - #[allow(dead_code)] - registration: Registration, - set_readiness: SetReadiness, - num: AtomicUsize, - } - - impl Entry { - fn fire(&self) { - self.set_readiness.set_readiness(Ready::readable()).unwrap(); - } - } - - let poll = Arc::new(Poll::new().unwrap()); - let mut entries = vec![]; - - // Create entries - for i in 0..ENTRIES { - let (registration, set_readiness) = Registration::new2(); - registration.register(&poll, Token(i), Ready::readable(), PollOpt::edge()).unwrap(); - - entries.push(Entry { - registration, - set_readiness, - num: AtomicUsize::new(0), - }); - } - - let total = Arc::new(AtomicUsize::new(0)); - let entries = Arc::new(entries); - let barrier = Arc::new(Barrier::new(THREADS)); - - let mut threads = vec![]; - - for th in 0..THREADS { - let poll = poll.clone(); - let total = total.clone(); - let entries = entries.clone(); - let barrier = barrier.clone(); - - threads.push(thread::spawn(move || { - let mut events = Events::with_capacity(128); - - barrier.wait(); - - // Prime all the registrations - let mut i = th; - while i < ENTRIES { - entries[i].fire(); - i += THREADS; - } - - let mut n = 0; - - - while total.load(SeqCst) < NUM { - // A poll timeout is necessary here because there may be more - // than one threads blocked in `poll` when the final wakeup - // notification arrives (and only notifies one thread). - n += poll.poll(&mut events, Some(Duration::from_millis(100))).unwrap(); - - let mut num_this_tick = 0; - - for event in &events { - let e = &entries[event.token().0]; - - let mut num = e.num.load(Relaxed); - - loop { - if num < PER_ENTRY { - let actual = e.num.compare_and_swap(num, num + 1, Relaxed); - - if actual == num { - num_this_tick += 1; - e.fire(); - break; - } - - num = actual; - } else { - break; - } - } - } - - total.fetch_add(num_this_tick, SeqCst); - } - - n - })); - } - - let _: Vec<_> = threads.into_iter() - .map(|th| th.join().unwrap()) - .collect(); - - for entry in entries.iter() { - assert_eq!(PER_ENTRY, entry.num.load(Relaxed)); - } - } - - #[test] - fn with_small_events_collection() { - const N: usize = 8; - const ITER: usize = 1_000; - - use std::sync::{Arc, Barrier}; - use std::sync::atomic::AtomicBool; - use std::sync::atomic::Ordering::{Acquire, Release}; - use std::thread; - - let poll = Poll::new().unwrap(); - let mut registrations = vec![]; - - let barrier = Arc::new(Barrier::new(N + 1)); - let done = Arc::new(AtomicBool::new(false)); - - for i in 0..N { - let (registration, set_readiness) = Registration::new2(); - poll.register(®istration, Token(i), Ready::readable(), PollOpt::edge()).unwrap(); - - registrations.push(registration); - - let barrier = barrier.clone(); - let done = done.clone(); - - thread::spawn(move || { - barrier.wait(); - - while !done.load(Acquire) { - set_readiness.set_readiness(Ready::readable()).unwrap(); - } - - // Set one last time - set_readiness.set_readiness(Ready::readable()).unwrap(); - }); - } - - let mut events = Events::with_capacity(4); - - barrier.wait(); - - for _ in 0..ITER { - poll.poll(&mut events, None).unwrap(); - } - - done.store(true, Release); - - let mut final_ready = vec![false; N]; - - - for _ in 0..5 { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - final_ready[event.token().0] = true; - } - - if final_ready.iter().all(|v| *v) { - return; - } - - thread::sleep(Duration::from_millis(10)); - } - - panic!("dead lock?"); - } -} - -#[test] -fn drop_registration_from_non_main_thread() { - use std::thread; - use std::sync::mpsc::channel; - - const THREADS: usize = 8; - const ITERS: usize = 50_000; - - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let mut senders = Vec::with_capacity(THREADS); - let mut token_index = 0; - - // spawn threads, which will send messages to single receiver - for _ in 0..THREADS { - let (tx, rx) = channel::<(Registration, SetReadiness)>(); - senders.push(tx); - - thread::spawn(move || { - for (registration, set_readiness) in rx { - let _ = set_readiness.set_readiness(Ready::readable()); - drop(registration); - drop(set_readiness); - } - }); - } - - let mut index: usize = 0; - for _ in 0..ITERS { - let (registration, set_readiness) = Registration::new2(); - registration.register(&poll, Token(token_index), Ready::readable(), PollOpt::edge()).unwrap(); - let _ = senders[index].send((registration, set_readiness)); - - token_index += 1; - index += 1; - if index == THREADS { - index = 0; - - let (registration, set_readiness) = Registration::new2(); - registration.register(&poll, Token(token_index), Ready::readable(), PollOpt::edge()).unwrap(); - let _ = set_readiness.set_readiness(Ready::readable()); - drop(registration); - drop(set_readiness); - token_index += 1; - - thread::park_timeout(Duration::from_millis(0)); - let _ = poll.poll(&mut events, None).unwrap(); - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_double_register.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_double_register.rs deleted file mode 100644 index c3d011c..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_double_register.rs +++ /dev/null @@ -1,17 +0,0 @@ -//! A smoke test for windows compatibility - -#[test] -#[cfg(any(target_os = "linux", target_os = "windows"))] -pub fn test_double_register() { - use mio::*; - use mio::net::TcpListener; - - let poll = Poll::new().unwrap(); - - // Create the listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - // Register the listener with `Poll` - poll.register(&l, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - assert!(poll.register(&l, Token(1), Ready::readable(), PollOpt::edge()).is_err()); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_echo_server.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_echo_server.rs deleted file mode 100644 index e20ae98..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_echo_server.rs +++ /dev/null @@ -1,303 +0,0 @@ -use {localhost, TryRead, TryWrite}; -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::net::{TcpListener, TcpStream}; -use bytes::{Buf, ByteBuf, MutByteBuf, SliceBuf}; -use slab::Slab; -use std::io; - -const SERVER: Token = Token(10_000_000); -const CLIENT: Token = Token(10_000_001); - -struct EchoConn { - sock: TcpStream, - buf: Option, - mut_buf: Option, - token: Option, - interest: Ready -} - -impl EchoConn { - fn new(sock: TcpStream) -> EchoConn { - EchoConn { - sock, - buf: None, - mut_buf: Some(ByteBuf::mut_with_capacity(2048)), - token: None, - interest: Ready::empty(), - } - } - - fn writable(&mut self, poll: &mut Poll) -> io::Result<()> { - let mut buf = self.buf.take().unwrap(); - - match self.sock.try_write_buf(&mut buf) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - - self.buf = Some(buf); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CONN : we wrote {} bytes!", r); - - self.mut_buf = Some(buf.flip()); - - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e), - } - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - poll.reregister(&self.sock, self.token.unwrap(), self.interest, - PollOpt::edge() | PollOpt::oneshot()) - } - - fn readable(&mut self, poll: &mut Poll) -> io::Result<()> { - let mut buf = self.mut_buf.take().unwrap(); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - debug!("CONN : spurious read wakeup"); - self.mut_buf = Some(buf); - } - Ok(Some(r)) => { - debug!("CONN : we read {} bytes!", r); - - // prepare to provide this to writable - self.buf = Some(buf.flip()); - - self.interest.remove(Ready::readable()); - self.interest.insert(Ready::writable()); - } - Err(e) => { - debug!("not implemented; client err={:?}", e); - self.interest.remove(Ready::readable()); - } - - }; - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - poll.reregister(&self.sock, self.token.unwrap(), self.interest, - PollOpt::edge()) - } -} - -struct EchoServer { - sock: TcpListener, - conns: Slab -} - -impl EchoServer { - fn accept(&mut self, poll: &mut Poll) -> io::Result<()> { - debug!("server accepting socket"); - - let sock = self.sock.accept().unwrap().0; - let conn = EchoConn::new(sock,); - let tok = self.conns.insert(conn); - - // Register the connection - self.conns[tok].token = Some(Token(tok)); - poll.register(&self.conns[tok].sock, Token(tok), Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - .expect("could not register socket with event loop"); - - Ok(()) - } - - fn conn_readable(&mut self, poll: &mut Poll, - tok: Token) -> io::Result<()> { - debug!("server conn readable; tok={:?}", tok); - self.conn(tok).readable(poll) - } - - fn conn_writable(&mut self, poll: &mut Poll, - tok: Token) -> io::Result<()> { - debug!("server conn writable; tok={:?}", tok); - self.conn(tok).writable(poll) - } - - fn conn(&mut self, tok: Token) -> &mut EchoConn { - &mut self.conns[tok.into()] - } -} - -struct EchoClient { - sock: TcpStream, - msgs: Vec<&'static str>, - tx: SliceBuf<'static>, - rx: SliceBuf<'static>, - mut_buf: Option, - token: Token, - interest: Ready, - shutdown: bool, -} - - -// Sends a message and expects to receive the same exact message, one at a time -impl EchoClient { - fn new(sock: TcpStream, token: Token, mut msgs: Vec<&'static str>) -> EchoClient { - let curr = msgs.remove(0); - - EchoClient { - sock, - msgs, - tx: SliceBuf::wrap(curr.as_bytes()), - rx: SliceBuf::wrap(curr.as_bytes()), - mut_buf: Some(ByteBuf::mut_with_capacity(2048)), - token, - interest: Ready::empty(), - shutdown: false, - } - } - - fn readable(&mut self, poll: &mut Poll) -> io::Result<()> { - debug!("client socket readable"); - - let mut buf = self.mut_buf.take().unwrap(); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - debug!("CLIENT : spurious read wakeup"); - self.mut_buf = Some(buf); - } - Ok(Some(r)) => { - debug!("CLIENT : We read {} bytes!", r); - - // prepare for reading - let mut buf = buf.flip(); - - while buf.has_remaining() { - let actual = buf.read_byte().unwrap(); - let expect = self.rx.read_byte().unwrap(); - - assert!(actual == expect, "actual={}; expect={}", actual, expect); - } - - self.mut_buf = Some(buf.flip()); - - self.interest.remove(Ready::readable()); - - if !self.rx.has_remaining() { - self.next_msg(poll).unwrap(); - } - } - Err(e) => { - panic!("not implemented; client err={:?}", e); - } - }; - - if !self.interest.is_empty() { - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - poll.reregister(&self.sock, self.token, self.interest, - PollOpt::edge() | PollOpt::oneshot())?; - } - - Ok(()) - } - - fn writable(&mut self, poll: &mut Poll) -> io::Result<()> { - debug!("client socket writable"); - - match self.sock.try_write_buf(&mut self.tx) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CLIENT : we wrote {} bytes!", r); - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e) - } - - if self.interest.is_readable() || self.interest.is_writable() { - try!(poll.reregister(&self.sock, self.token, self.interest, - PollOpt::edge() | PollOpt::oneshot())); - } - - Ok(()) - } - - fn next_msg(&mut self, poll: &mut Poll) -> io::Result<()> { - if self.msgs.is_empty() { - self.shutdown = true; - return Ok(()); - } - - let curr = self.msgs.remove(0); - - debug!("client prepping next message"); - self.tx = SliceBuf::wrap(curr.as_bytes()); - self.rx = SliceBuf::wrap(curr.as_bytes()); - - self.interest.insert(Ready::writable()); - poll.reregister(&self.sock, self.token, self.interest, - PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct Echo { - server: EchoServer, - client: EchoClient, -} - -impl Echo { - fn new(srv: TcpListener, client: TcpStream, msgs: Vec<&'static str>) -> Echo { - Echo { - server: EchoServer { - sock: srv, - conns: Slab::with_capacity(128) - }, - client: EchoClient::new(client, CLIENT, msgs) - } - } -} - -#[test] -pub fn test_echo_server() { - debug!("Starting TEST_ECHO_SERVER"); - let mut poll = Poll::new().unwrap(); - - let addr = localhost(); - let srv = TcpListener::bind(&addr).unwrap(); - - info!("listen for connections"); - poll.register(&srv, SERVER, Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - let sock = TcpStream::connect(&addr).unwrap(); - - // Connect to the server - poll.register(&sock, CLIENT, Ready::writable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - // == Create storage for events - let mut events = Events::with_capacity(1024); - - let mut handler = Echo::new(srv, sock, vec!["foo", "bar"]); - - // Start the event loop - while !handler.client.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - debug!("ready {:?} {:?}", event.token(), event.readiness()); - if event.readiness().is_readable() { - match event.token() { - SERVER => handler.server.accept(&mut poll).unwrap(), - CLIENT => handler.client.readable(&mut poll).unwrap(), - i => handler.server.conn_readable(&mut poll, i).unwrap() - } - } - - if event.readiness().is_writable() { - match event.token() { - SERVER => panic!("received writable for token 0"), - CLIENT => handler.client.writable(&mut poll).unwrap(), - i => handler.server.conn_writable(&mut poll, i).unwrap() - }; - } - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_fuchsia_handles.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_fuchsia_handles.rs deleted file mode 100644 index 85a1432..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_fuchsia_handles.rs +++ /dev/null @@ -1,30 +0,0 @@ -use mio::*; -use mio::fuchsia::EventedHandle; -use zircon::{self, AsHandleRef}; -use std::time::Duration; - -const MS: u64 = 1_000; - -#[test] -pub fn test_fuchsia_channel() { - let poll = Poll::new().unwrap(); - let mut event_buffer = Events::with_capacity(1); - let event_buffer = &mut event_buffer; - - let (channel0, channel1) = zircon::Channel::create(zircon::ChannelOpts::Normal).unwrap(); - let channel1_evented = unsafe { EventedHandle::new(channel1.raw_handle()) }; - - poll.register(&channel1_evented, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - poll.poll(event_buffer, Some(Duration::from_millis(MS))).unwrap(); - assert_eq!(event_buffer.len(), 0); - - channel0.write(&[1, 2, 3], &mut vec![], 0).unwrap(); - - poll.poll(event_buffer, Some(Duration::from_millis(MS))).unwrap(); - let event = event_buffer.get(0).unwrap(); - assert_eq!(event.token(), Token(1)); - assert!(event.readiness().is_readable()); - - poll.deregister(&channel1_evented).unwrap(); -} \ No newline at end of file diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_local_addr_ready.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_local_addr_ready.rs deleted file mode 100644 index 2e97f52..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_local_addr_ready.rs +++ /dev/null @@ -1,67 +0,0 @@ -use {TryWrite}; -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::net::{TcpListener, TcpStream}; - -const LISTEN: Token = Token(0); -const CLIENT: Token = Token(1); -const SERVER: Token = Token(2); - -struct MyHandler { - listener: TcpListener, - connected: TcpStream, - accepted: Option, - shutdown: bool, -} - -#[test] -fn local_addr_ready() { - let addr = "127.0.0.1:0".parse().unwrap(); - let server = TcpListener::bind(&addr).unwrap(); - let addr = server.local_addr().unwrap(); - - let poll = Poll::new().unwrap(); - poll.register(&server, LISTEN, Ready::readable(), - PollOpt::edge()).unwrap(); - - let sock = TcpStream::connect(&addr).unwrap(); - poll.register(&sock, CLIENT, Ready::readable(), - PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - - let mut handler = MyHandler { - listener: server, - connected: sock, - accepted: None, - shutdown: false, - }; - - while !handler.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - match event.token() { - LISTEN => { - let sock = handler.listener.accept().unwrap().0; - poll.register(&sock, - SERVER, - Ready::writable(), - PollOpt::edge()).unwrap(); - handler.accepted = Some(sock); - } - SERVER => { - handler.accepted.as_ref().unwrap().peer_addr().unwrap(); - handler.accepted.as_ref().unwrap().local_addr().unwrap(); - handler.accepted.as_mut().unwrap().try_write(&[1, 2, 3]).unwrap(); - handler.accepted = None; - } - CLIENT => { - handler.connected.peer_addr().unwrap(); - handler.connected.local_addr().unwrap(); - handler.shutdown = true; - } - _ => panic!("unexpected token"), - } - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_multicast.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_multicast.rs deleted file mode 100644 index b73e0d5..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_multicast.rs +++ /dev/null @@ -1,107 +0,0 @@ -// TODO: This doesn't pass on android 64bit CI... -// Figure out why! -#![cfg(not(target_os = "android"))] - -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::net::UdpSocket; -use bytes::{Buf, MutBuf, RingBuf, SliceBuf}; -use std::str; -use std::net::IpAddr; -use localhost; - -const LISTENER: Token = Token(0); -const SENDER: Token = Token(1); - -pub struct UdpHandler { - tx: UdpSocket, - rx: UdpSocket, - msg: &'static str, - buf: SliceBuf<'static>, - rx_buf: RingBuf, - localhost: IpAddr, - shutdown: bool, -} - -impl UdpHandler { - fn new(tx: UdpSocket, rx: UdpSocket, msg: &'static str) -> UdpHandler { - let sock = UdpSocket::bind(&"127.0.0.1:12345".parse().unwrap()).unwrap(); - UdpHandler { - tx, - rx, - msg, - buf: SliceBuf::wrap(msg.as_bytes()), - rx_buf: RingBuf::new(1024), - localhost: sock.local_addr().unwrap().ip(), - shutdown: false, - } - } - - fn handle_read(&mut self, _: &mut Poll, token: Token, _: Ready) { - if let LISTENER = token { - debug!("We are receiving a datagram now..."); - match unsafe { self.rx.recv_from(self.rx_buf.mut_bytes()) } { - Ok((cnt, addr)) => { - unsafe { MutBuf::advance(&mut self.rx_buf, cnt); } - assert_eq!(addr.ip(), self.localhost); - } - res => panic!("unexpected result: {:?}", res), - } - assert!(str::from_utf8(self.rx_buf.bytes()).unwrap() == self.msg); - self.shutdown = true; - } - } - - fn handle_write(&mut self, _: &mut Poll, token: Token, _: Ready) { - if let SENDER = token { - let addr = self.rx.local_addr().unwrap(); - let cnt = self.tx.send_to(self.buf.bytes(), &addr).unwrap(); - self.buf.advance(cnt); - } - } -} - -#[test] -pub fn test_multicast() { - drop(::env_logger::init()); - debug!("Starting TEST_UDP_CONNECTIONLESS"); - let mut poll = Poll::new().unwrap(); - - let addr = localhost(); - let any = "0.0.0.0:0".parse().unwrap(); - - let tx = UdpSocket::bind(&any).unwrap(); - let rx = UdpSocket::bind(&addr).unwrap(); - - info!("Joining group 227.1.1.100"); - let any = "0.0.0.0".parse().unwrap(); - rx.join_multicast_v4(&"227.1.1.100".parse().unwrap(), &any).unwrap(); - - info!("Joining group 227.1.1.101"); - rx.join_multicast_v4(&"227.1.1.101".parse().unwrap(), &any).unwrap(); - - info!("Registering SENDER"); - poll.register(&tx, SENDER, Ready::writable(), PollOpt::edge()).unwrap(); - - info!("Registering LISTENER"); - poll.register(&rx, LISTENER, Ready::readable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - - let mut handler = UdpHandler::new(tx, rx, "hello world"); - - info!("Starting event loop to test with..."); - - while !handler.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.readiness().is_readable() { - handler.handle_read(&mut poll, event.token(), event.readiness()); - } - - if event.readiness().is_writable() { - handler.handle_write(&mut poll, event.token(), event.readiness()); - } - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_notify.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_notify.rs deleted file mode 100644 index a6a8e51..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_notify.rs +++ /dev/null @@ -1,192 +0,0 @@ -use {localhost, sleep_ms}; -use mio::*; -use mio::deprecated::{EventLoop, EventLoopBuilder, Handler, Sender, NotifyError}; -use mio::net::TcpListener; -use std::thread; - -struct TestHandler { - sender: Sender, - notify: usize -} - -impl TestHandler { - fn new(sender: Sender) -> TestHandler { - TestHandler { - sender, - notify: 0 - } - } -} - -impl Handler for TestHandler { - type Timeout = usize; - type Message = String; - - fn notify(&mut self, event_loop: &mut EventLoop, msg: String) { - match self.notify { - 0 => { - assert!(msg == "First", "actual={}", msg); - self.sender.send("Second".to_string()).unwrap(); - } - 1 => { - assert!(msg == "Second", "actual={}", msg); - event_loop.shutdown(); - } - v => panic!("unexpected value for notify; val={}", v) - } - - self.notify += 1; - } -} - -#[test] -pub fn test_notify() { - debug!("Starting TEST_NOTIFY"); - let mut event_loop = EventLoop::new().unwrap(); - - let addr = localhost(); - - // Setup a server socket so that the event loop blocks - let srv = TcpListener::bind(&addr).unwrap(); - - event_loop.register(&srv, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - - let sender = event_loop.channel(); - - thread::spawn(move || { - sleep_ms(1_000); - sender.send("First".to_string()).unwrap(); - }); - - let sender = event_loop.channel(); - let mut handler = TestHandler::new(sender); - - // Start the event loop - event_loop.run(&mut handler).unwrap(); - - assert!(handler.notify == 2, "actual={}", handler.notify); -} - -#[test] -pub fn test_notify_capacity() { - use std::sync::mpsc::*; - use std::thread; - - struct Capacity(Receiver); - - impl Handler for Capacity { - type Message = i32; - type Timeout = (); - - fn notify(&mut self, event_loop: &mut EventLoop, msg: i32) { - if msg == 1 { - self.0.recv().unwrap(); - } else if msg == 3 { - event_loop.shutdown(); - } - } - } - - let mut builder = EventLoopBuilder::new(); - builder.notify_capacity(1); - - let (tx, rx) = channel::(); - let mut event_loop = builder.build().unwrap(); - let notify = event_loop.channel(); - - let handle = thread::spawn(move || { - let mut handler = Capacity(rx); - event_loop.run(&mut handler).unwrap(); - }); - - assert!(notify.send(1).is_ok()); - - loop { - if notify.send(2).is_err() { - break; - } - } - - tx.send(1).unwrap(); - - loop { - if notify.send(3).is_ok() { - break; - } - } - - handle.join().unwrap(); -} - -#[test] -pub fn test_notify_drop() { - use std::sync::mpsc::{self,Sender}; - use std::thread; - - struct MessageDrop(Sender); - - impl Drop for MessageDrop { - fn drop(&mut self) { - self.0.send(0).unwrap(); - } - } - - struct DummyHandler; - - impl Handler for DummyHandler { - type Timeout = (); - type Message = MessageDrop; - - fn notify(&mut self, event_loop: &mut EventLoop, msg: MessageDrop) { - msg.0.send(1).unwrap(); - drop(msg); - // We stop after the first message - event_loop.shutdown(); - } - } - - let (tx_notif_1, rx_notif_1) = mpsc::channel(); - let (tx_notif_2, rx_notif_2) = mpsc::channel(); - let (tx_notif_3, _unused) = mpsc::channel(); - let (tx_exit_loop, rx_exit_loop) = mpsc::channel(); - let (tx_drop_loop, rx_drop_loop) = mpsc::channel(); - - let mut event_loop = EventLoop::new().unwrap(); - let notify = event_loop.channel(); - - let handle = thread::spawn(move || { - let mut handler = DummyHandler; - event_loop.run(&mut handler).unwrap(); - - // Confirmation we exited the loop - tx_exit_loop.send(()).unwrap(); - - // Order to drop the loop - rx_drop_loop.recv().unwrap(); - drop(event_loop); - }); - notify.send(MessageDrop(tx_notif_1)).unwrap(); - assert_eq!(rx_notif_1.recv().unwrap(), 1); // Response from the loop - assert_eq!(rx_notif_1.recv().unwrap(), 0); // Drop notification - - // We wait for the event loop to exit before sending the second notification - rx_exit_loop.recv().unwrap(); - notify.send(MessageDrop(tx_notif_2)).unwrap(); - - // We ensure the message is indeed stuck in the queue - sleep_ms(100); - assert!(rx_notif_2.try_recv().is_err()); - - // Give the order to drop the event loop - tx_drop_loop.send(()).unwrap(); - assert_eq!(rx_notif_2.recv().unwrap(), 0); // Drop notification - - // Check that sending a new notification will return an error - // We should also get our message back - match notify.send(MessageDrop(tx_notif_3)).unwrap_err() { - NotifyError::Closed(Some(..)) => {} - _ => panic!(), - } - - handle.join().unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_oneshot.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_oneshot.rs deleted file mode 100644 index 4dca219..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_oneshot.rs +++ /dev/null @@ -1,64 +0,0 @@ -use mio::*; -use mio::net::{TcpListener, TcpStream}; -use std::io::*; -use std::time::Duration; - -const MS: u64 = 1_000; - -#[test] -pub fn test_tcp_edge_oneshot() { - let _ = ::env_logger::init(); - - let mut poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - - // Create the listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - // Register the listener with `Poll` - poll.register(&l, Token(0), Ready::readable(), PollOpt::level()).unwrap(); - - // Connect a socket, we are going to write to it - let mut s1 = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - poll.register(&s1, Token(1), Ready::writable(), PollOpt::level()).unwrap(); - - wait_for(&mut poll, &mut events, Token(0)); - - // Get pair - let (mut s2, _) = l.accept().unwrap(); - poll.register(&s2, Token(2), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - wait_for(&mut poll, &mut events, Token(1)); - - let res = s1.write(b"foo").unwrap(); - assert_eq!(3, res); - - let mut buf = [0; 1]; - - for byte in b"foo" { - wait_for(&mut poll, &mut events, Token(2)); - - assert_eq!(1, s2.read(&mut buf).unwrap()); - assert_eq!(*byte, buf[0]); - - poll.reregister(&s2, Token(2), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - if *byte == b'o' { - poll.reregister(&s2, Token(2), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - } - } -} - -fn wait_for(poll: &mut Poll, events: &mut Events, token: Token) { - loop { - poll.poll(events, Some(Duration::from_millis(MS))).unwrap(); - - let cnt = (0..events.len()).map(|i| events.get(i).unwrap()) - .filter(|e| e.token() == token) - .count(); - - assert!(cnt < 2, "token appeared multiple times in poll results; cnt={:}", cnt); - - if cnt == 1 { return }; - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_poll.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_poll.rs deleted file mode 100644 index e259d89..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_poll.rs +++ /dev/null @@ -1,18 +0,0 @@ -use mio::*; -use std::time::Duration; - -#[test] -fn test_poll_closes_fd() { - for _ in 0..2000 { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(4); - let (registration, set_readiness) = Registration::new2(); - - poll.register(®istration, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - poll.poll(&mut events, Some(Duration::from_millis(0))).unwrap(); - - drop(poll); - drop(set_readiness); - drop(registration); - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_poll_channel.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_poll_channel.rs deleted file mode 100644 index f7ce050..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_poll_channel.rs +++ /dev/null @@ -1,285 +0,0 @@ -use {expect_events, sleep_ms}; -use mio::{channel, Events, Poll, PollOpt, Ready, Token}; -use mio::event::Event; -use std::sync::mpsc::TryRecvError; -use std::thread; -use std::time::Duration; - -#[test] -pub fn test_poll_channel_edge() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let (tx, rx) = channel::channel(); - - poll.register(&rx, Token(123), Ready::readable(), PollOpt::edge()).unwrap(); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Push the value - tx.send("hello").unwrap(); - - // Polling will contain the event - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(1, num); - - let event = events.get(0).unwrap(); - assert_eq!(event.token(), Token(123)); - assert_eq!(event.readiness(), Ready::readable()); - - // Poll again and there should be no events - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Read the value - assert_eq!("hello", rx.try_recv().unwrap()); - - // Poll again, nothing - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Push a value - tx.send("goodbye").unwrap(); - - // Have an event - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(1, num); - - let event = events.get(0).unwrap(); - assert_eq!(event.token(), Token(123)); - assert_eq!(event.readiness(), Ready::readable()); - - // Read the value - rx.try_recv().unwrap(); - - // Drop the sender half - drop(tx); - - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(1, num); - - let event = events.get(0).unwrap(); - assert_eq!(event.token(), Token(123)); - assert_eq!(event.readiness(), Ready::readable()); - - match rx.try_recv() { - Err(TryRecvError::Disconnected) => {} - no => panic!("unexpected value {:?}", no), - } - -} - -#[test] -pub fn test_poll_channel_oneshot() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let (tx, rx) = channel::channel(); - - poll.register(&rx, Token(123), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Push the value - tx.send("hello").unwrap(); - - // Polling will contain the event - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(1, num); - - let event = events.get(0).unwrap(); - assert_eq!(event.token(), Token(123)); - assert_eq!(event.readiness(), Ready::readable()); - - // Poll again and there should be no events - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Read the value - assert_eq!("hello", rx.try_recv().unwrap()); - - // Poll again, nothing - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Push a value - tx.send("goodbye").unwrap(); - - // Poll again, nothing - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Reregistering will re-trigger the notification - for _ in 0..3 { - poll.reregister(&rx, Token(123), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Have an event - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(1, num); - - let event = events.get(0).unwrap(); - assert_eq!(event.token(), Token(123)); - assert_eq!(event.readiness(), Ready::readable()); - } - - // Get the value - assert_eq!("goodbye", rx.try_recv().unwrap()); - - poll.reregister(&rx, Token(123), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Have an event - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - poll.reregister(&rx, Token(123), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Have an event - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); -} - -#[test] -pub fn test_poll_channel_level() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let (tx, rx) = channel::channel(); - - poll.register(&rx, Token(123), Ready::readable(), PollOpt::level()).unwrap(); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Push the value - tx.send("hello").unwrap(); - - // Polling will contain the event - for i in 0..5 { - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert!(1 == num, "actually got {} on iteration {}", num, i); - - let event = events.get(0).unwrap(); - assert_eq!(event.token(), Token(123)); - assert_eq!(event.readiness(), Ready::readable()); - } - - // Read the value - assert_eq!("hello", rx.try_recv().unwrap()); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); -} - -#[test] -pub fn test_poll_channel_writable() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let (tx, rx) = channel::channel(); - - poll.register(&rx, Token(123), Ready::writable(), PollOpt::edge()).unwrap(); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); - - // Push the value - tx.send("hello").unwrap(); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); -} - -#[test] -pub fn test_dropping_receive_before_poll() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let (tx, rx) = channel::channel(); - - poll.register(&rx, Token(123), Ready::readable(), PollOpt::edge()).unwrap(); - - // Push the value - tx.send("hello").unwrap(); - - // Drop the receive end - drop(rx); - - // Wait, but nothing should happen - let num = poll.poll(&mut events, Some(Duration::from_millis(300))).unwrap(); - assert_eq!(0, num); -} - -#[test] -pub fn test_mixing_channel_with_socket() { - use mio::net::{TcpListener, TcpStream}; - - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let (tx, rx) = channel::channel(); - - // Create the listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - // Register the listener with `Poll` - poll.register(&l, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - poll.register(&rx, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - // Push a value onto the channel - tx.send("hello").unwrap(); - - // Connect a TCP socket - let s1 = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - - // Register the socket - poll.register(&s1, Token(2), Ready::readable(), PollOpt::edge()).unwrap(); - - // Sleep a bit to ensure it arrives at dest - sleep_ms(250); - - expect_events(&poll, &mut events, 2, vec![ - Event::new(Ready::empty(), Token(0)), - Event::new(Ready::empty(), Token(1)), - ]); -} - -#[test] -pub fn test_sending_from_other_thread_while_polling() { - const ITERATIONS: usize = 20; - const THREADS: usize = 5; - - // Make sure to run multiple times - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - - for _ in 0..ITERATIONS { - let (tx, rx) = channel::channel(); - poll.register(&rx, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - - for _ in 0..THREADS { - let tx = tx.clone(); - - thread::spawn(move || { - sleep_ms(50); - tx.send("ping").unwrap(); - }); - } - - let mut recv = 0; - - while recv < THREADS { - let num = poll.poll(&mut events, None).unwrap(); - - if num != 0 { - assert_eq!(1, num); - assert_eq!(events.get(0).unwrap().token(), Token(0)); - - while let Ok(_) = rx.try_recv() { - recv += 1; - } - } - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_register_deregister.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_register_deregister.rs deleted file mode 100644 index ae84a02..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_register_deregister.rs +++ /dev/null @@ -1,123 +0,0 @@ -use {expect_events, localhost, TryWrite}; -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::event::Event; -use mio::net::{TcpListener, TcpStream}; -use bytes::SliceBuf; -use std::time::Duration; - -const SERVER: Token = Token(0); -const CLIENT: Token = Token(1); - -struct TestHandler { - server: TcpListener, - client: TcpStream, - state: usize, -} - -impl TestHandler { - fn new(srv: TcpListener, cli: TcpStream) -> TestHandler { - TestHandler { - server: srv, - client: cli, - state: 0, - } - } - - fn handle_read(&mut self, poll: &mut Poll, token: Token) { - match token { - SERVER => { - trace!("handle_read; token=SERVER"); - let mut sock = self.server.accept().unwrap().0; - sock.try_write_buf(&mut SliceBuf::wrap(b"foobar")).unwrap(); - } - CLIENT => { - trace!("handle_read; token=CLIENT"); - assert!(self.state == 0, "unexpected state {}", self.state); - self.state = 1; - poll.reregister(&self.client, CLIENT, Ready::writable(), PollOpt::level()).unwrap(); - } - _ => panic!("unexpected token"), - } - } - - fn handle_write(&mut self, poll: &mut Poll, token: Token) { - debug!("handle_write; token={:?}; state={:?}", token, self.state); - - assert!(token == CLIENT, "unexpected token {:?}", token); - assert!(self.state == 1, "unexpected state {}", self.state); - - self.state = 2; - poll.deregister(&self.client).unwrap(); - poll.deregister(&self.server).unwrap(); - } -} - -#[test] -pub fn test_register_deregister() { - let _ = ::env_logger::init(); - - debug!("Starting TEST_REGISTER_DEREGISTER"); - let mut poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - - let addr = localhost(); - - let server = TcpListener::bind(&addr).unwrap(); - - info!("register server socket"); - poll.register(&server, SERVER, Ready::readable(), PollOpt::edge()).unwrap(); - - let client = TcpStream::connect(&addr).unwrap(); - - // Register client socket only as writable - poll.register(&client, CLIENT, Ready::readable(), PollOpt::level()).unwrap(); - - let mut handler = TestHandler::new(server, client); - - loop { - poll.poll(&mut events, None).unwrap(); - - if let Some(event) = events.get(0) { - if event.readiness().is_readable() { - handler.handle_read(&mut poll, event.token()); - } - - if event.readiness().is_writable() { - handler.handle_write(&mut poll, event.token()); - break; - } - } - } - - poll.poll(&mut events, Some(Duration::from_millis(100))).unwrap(); - assert_eq!(events.len(), 0); -} - -#[test] -pub fn test_register_empty_interest() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(1024); - let addr = localhost(); - - let sock = TcpListener::bind(&addr).unwrap(); - - poll.register(&sock, Token(0), Ready::empty(), PollOpt::edge()).unwrap(); - - let client = TcpStream::connect(&addr).unwrap(); - - // The connect is not guaranteed to have started until it is registered - // https://docs.rs/mio/0.6.10/mio/struct.Poll.html#registering-handles - poll.register(&client, Token(1), Ready::empty(), PollOpt::edge()).unwrap(); - - // sock is registered with empty interest, we should not receive any event - poll.poll(&mut events, Some(Duration::from_millis(100))).unwrap(); - assert_eq!(events.len(), 0, "Received unexpected event: {:?}", events.get(0).unwrap()); - - // now sock is reregistered with readable, we should receive the pending event - poll.reregister(&sock, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - expect_events(&poll, &mut events, 2, vec![ - Event::new(Ready::readable(), Token(0)) - ]); - - poll.reregister(&sock, Token(0), Ready::empty(), PollOpt::edge()).unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_register_multiple_event_loops.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_register_multiple_event_loops.rs deleted file mode 100644 index 9204afa..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_register_multiple_event_loops.rs +++ /dev/null @@ -1,63 +0,0 @@ -use localhost; -use mio::*; -use mio::net::{TcpListener, TcpStream, UdpSocket}; -use std::io::ErrorKind; - -#[test] -fn test_tcp_register_multiple_event_loops() { - let addr = localhost(); - let listener = TcpListener::bind(&addr).unwrap(); - - let poll1 = Poll::new().unwrap(); - poll1.register(&listener, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - - let poll2 = Poll::new().unwrap(); - - // Try registering the same socket with the initial one - let res = poll2.register(&listener, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()); - assert!(res.is_err()); - assert_eq!(res.unwrap_err().kind(), ErrorKind::Other); - - // Try cloning the socket and registering it again - let listener2 = listener.try_clone().unwrap(); - let res = poll2.register(&listener2, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()); - assert!(res.is_err()); - assert_eq!(res.unwrap_err().kind(), ErrorKind::Other); - - // Try the stream - let stream = TcpStream::connect(&addr).unwrap(); - - poll1.register(&stream, Token(1), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - - let res = poll2.register(&stream, Token(1), Ready::readable() | Ready::writable(), PollOpt::edge()); - assert!(res.is_err()); - assert_eq!(res.unwrap_err().kind(), ErrorKind::Other); - - // Try cloning the socket and registering it again - let stream2 = stream.try_clone().unwrap(); - let res = poll2.register(&stream2, Token(1), Ready::readable() | Ready::writable(), PollOpt::edge()); - assert!(res.is_err()); - assert_eq!(res.unwrap_err().kind(), ErrorKind::Other); -} - -#[test] -fn test_udp_register_multiple_event_loops() { - let addr = localhost(); - let socket = UdpSocket::bind(&addr).unwrap(); - - let poll1 = Poll::new().unwrap(); - poll1.register(&socket, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - - let poll2 = Poll::new().unwrap(); - - // Try registering the same socket with the initial one - let res = poll2.register(&socket, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()); - assert!(res.is_err()); - assert_eq!(res.unwrap_err().kind(), ErrorKind::Other); - - // Try cloning the socket and registering it again - let socket2 = socket.try_clone().unwrap(); - let res = poll2.register(&socket2, Token(0), Ready::readable() | Ready::writable(), PollOpt::edge()); - assert!(res.is_err()); - assert_eq!(res.unwrap_err().kind(), ErrorKind::Other); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_reregister_without_poll.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_reregister_without_poll.rs deleted file mode 100644 index 45d5aca..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_reregister_without_poll.rs +++ /dev/null @@ -1,28 +0,0 @@ -use {sleep_ms}; -use mio::*; -use mio::net::{TcpListener, TcpStream}; -use std::time::Duration; - -const MS: u64 = 1_000; - -#[test] -pub fn test_reregister_different_without_poll() { - let mut events = Events::with_capacity(1024); - let poll = Poll::new().unwrap(); - - // Create the listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - // Register the listener with `Poll` - poll.register(&l, Token(0), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - let s1 = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - poll.register(&s1, Token(2), Ready::readable(), PollOpt::edge()).unwrap(); - - sleep_ms(MS); - - poll.reregister(&l, Token(0), Ready::writable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - poll.poll(&mut events, Some(Duration::from_millis(MS))).unwrap(); - assert_eq!(events.len(), 0); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_smoke.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_smoke.rs deleted file mode 100644 index 96f7d3c..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_smoke.rs +++ /dev/null @@ -1,23 +0,0 @@ -extern crate mio; - -use mio::{Events, Poll, Token, Ready, PollOpt}; -use mio::net::TcpListener; -use std::time::Duration; - -#[test] -fn run_once_with_nothing() { - let mut events = Events::with_capacity(1024); - let poll = Poll::new().unwrap(); - poll.poll(&mut events, Some(Duration::from_millis(100))).unwrap(); -} - -#[test] -fn add_then_drop() { - let mut events = Events::with_capacity(1024); - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let poll = Poll::new().unwrap(); - poll.register(&l, Token(1), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - drop(l); - poll.poll(&mut events, Some(Duration::from_millis(100))).unwrap(); - -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_subprocess_pipe.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_subprocess_pipe.rs deleted file mode 100644 index 2bcf132..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_subprocess_pipe.rs +++ /dev/null @@ -1,249 +0,0 @@ -use {TryRead, TryWrite}; -use std::mem; -use mio::*; -use std::io; -use mio::deprecated::{EventLoop, Handler}; -use mio::deprecated::unix::{PipeReader, PipeWriter}; -use std::process::{Command, Stdio, Child}; - - -struct SubprocessClient { - stdin: Option, - stdout: Option, - stderr: Option, - stdin_token : Token, - stdout_token : Token, - stderr_token : Token, - output : Vec, - output_stderr : Vec, - input : Vec, - input_offset : usize, - buf : [u8; 65536], -} - - -// Sends a message and expects to receive the same exact message, one at a time -impl SubprocessClient { - fn new(stdin: Option, stdout : Option, stderr : Option, data : &[u8]) -> SubprocessClient { - SubprocessClient { - stdin: stdin, - stdout: stdout, - stderr: stderr, - stdin_token : Token(0), - stdout_token : Token(1), - stderr_token : Token(2), - output : Vec::::new(), - output_stderr : Vec::::new(), - buf : [0; 65536], - input : data.to_vec(), - input_offset : 0, - } - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut eof = false; - match self.stdout { - None => unreachable!(), - Some (ref mut stdout) => match stdout.try_read(&mut self.buf[..]) { - Ok(None) => { - } - Ok(Some(r)) => { - if r == 0 { - eof = true; - } else { - self.output.extend(&self.buf[0..r]); - } - } - Err(e) => { - return Err(e); - } - } - }; - if eof { - drop(self.stdout.take()); - match self.stderr { - None => event_loop.shutdown(), - Some(_) => {}, - } - } - return Ok(()); - } - - fn readable_stderr(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut eof = false; - match self.stderr { - None => unreachable!(), - Some(ref mut stderr) => match stderr.try_read(&mut self.buf[..]) { - Ok(None) => { - } - Ok(Some(r)) => { - if r == 0 { - eof = true; - } else { - self.output_stderr.extend(&self.buf[0..r]); - } - } - Err(e) => { - return Err(e); - } - } - }; - if eof { - drop(self.stderr.take()); - match self.stdout { - None => event_loop.shutdown(), - Some(_) => {}, - } - } - return Ok(()); - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut ok = true; - match self.stdin { - None => unreachable!(), - Some(ref mut stdin) => match stdin.try_write(&(&self.input)[self.input_offset..]) { - Ok(None) => { - }, - Ok(Some(r)) => { - if r == 0 { - ok = false; - } else { - self.input_offset += r; - } - }, - Err(_) => { - ok = false; - }, - } - } - if self.input_offset == self.input.len() || !ok { - drop(self.stdin.take()); - match self.stderr { - None => match self.stdout { - None => event_loop.shutdown(), - Some(_) => {}, - }, - Some(_) => {}, - } - } - return Ok(()); - } - -} - -impl Handler for SubprocessClient { - type Timeout = usize; - type Message = (); - - fn ready(&mut self, event_loop: &mut EventLoop, token: Token, - _: Ready) { - if token == self.stderr_token { - let _x = self.readable_stderr(event_loop); - } else { - let _x = self.readable(event_loop); - } - if token == self.stdin_token { - let _y = self.writable(event_loop); - } - } -} - - - - -const TEST_DATA : [u8; 1024 * 4096] = [42; 1024 * 4096]; -pub fn subprocess_communicate(mut process : Child, input : &[u8]) -> (Vec, Vec) { - let mut event_loop = EventLoop::::new().unwrap(); - let stdin : Option; - let stdin_exists : bool; - match process.stdin { - None => stdin_exists = false, - Some(_) => stdin_exists = true, - } - if stdin_exists { - match PipeWriter::from_stdin(process.stdin.take().unwrap()) { - Err(e) => panic!(e), - Ok(pipe) => stdin = Some(pipe), - } - } else { - stdin = None; - } - let stdout_exists : bool; - let stdout : Option; - match process.stdout { - None => stdout_exists = false, - Some(_) => stdout_exists = true, - } - if stdout_exists { - match PipeReader::from_stdout(process.stdout.take().unwrap()) { - Err(e) => panic!(e), - Ok(pipe) => stdout = Some(pipe), - } - } else { - stdout = None; - } - let stderr_exists : bool; - let stderr : Option; - match process.stderr { - None => stderr_exists = false, - Some(_) => stderr_exists = true, - } - if stderr_exists { - match PipeReader::from_stderr(process.stderr.take().unwrap()) { - Err(e) => panic!(e), - Ok(pipe) => stderr = Some(pipe), - } - } else { - stderr = None - } - - let mut subprocess = SubprocessClient::new(stdin, - stdout, - stderr, - input); - match subprocess.stdout { - Some(ref sub_stdout) => event_loop.register(sub_stdout, subprocess.stdout_token, Ready::readable(), - PollOpt::level()).unwrap(), - None => {}, - } - - match subprocess.stderr { - Some(ref sub_stderr) => event_loop.register(sub_stderr, subprocess.stderr_token, Ready::readable(), - PollOpt::level()).unwrap(), - None => {}, - } - - // Connect to the server - match subprocess.stdin { - Some (ref sub_stdin) => event_loop.register(sub_stdin, subprocess.stdin_token, Ready::writable(), - PollOpt::level()).unwrap(), - None => {}, - } - - // Start the event loop - event_loop.run(&mut subprocess).unwrap(); - let _ = process.wait(); - - let ret_stdout = mem::replace(&mut subprocess.output, Vec::::new()); - let ret_stderr = mem::replace(&mut subprocess.output_stderr, Vec::::new()); - return (ret_stdout, ret_stderr); -} - -#[test] -fn test_subprocess_pipe() { - let process = - Command::new("/bin/cat") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn().unwrap(); - let (ret_stdout, ret_stderr) = subprocess_communicate(process, &TEST_DATA[..]); - assert_eq!(TEST_DATA.len(), ret_stdout.len()); - assert_eq!(0usize, ret_stderr.len()); - let mut i : usize = 0; - for item in TEST_DATA.iter() { - assert_eq!(*item, ret_stdout[i]); - i += 1; - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_tcp.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_tcp.rs deleted file mode 100644 index ae569ac..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_tcp.rs +++ /dev/null @@ -1,660 +0,0 @@ -use std::cmp; -use std::io::prelude::*; -use std::io; -use std::net; -use std::sync::mpsc::channel; -use std::thread; -use std::time::Duration; - -use net2::{self, TcpStreamExt}; - -use {TryRead, TryWrite}; -use mio::{Token, Ready, PollOpt, Poll, Events}; -use iovec::IoVec; -use mio::net::{TcpListener, TcpStream}; - -#[test] -fn accept() { - struct H { hit: bool, listener: TcpListener, shutdown: bool } - - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - net::TcpStream::connect(&addr).unwrap(); - }); - - let poll = Poll::new().unwrap(); - - poll.register(&l, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(128); - - let mut h = H { hit: false, listener: l, shutdown: false }; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - h.hit = true; - assert_eq!(event.token(), Token(1)); - assert!(event.readiness().is_readable()); - assert!(h.listener.accept().is_ok()); - h.shutdown = true; - } - } - assert!(h.hit); - assert!(h.listener.accept().unwrap_err().kind() == io::ErrorKind::WouldBlock); - t.join().unwrap(); -} - -#[test] -fn connect() { - struct H { hit: u32, shutdown: bool } - - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let (tx, rx) = channel(); - let (tx2, rx2) = channel(); - let t = thread::spawn(move || { - let s = l.accept().unwrap(); - rx.recv().unwrap(); - drop(s); - tx2.send(()).unwrap(); - }); - - let poll = Poll::new().unwrap(); - let s = TcpStream::connect(&addr).unwrap(); - - poll.register(&s, Token(1), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(128); - - let mut h = H { hit: 0, shutdown: false }; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - assert_eq!(event.token(), Token(1)); - match h.hit { - 0 => assert!(event.readiness().is_writable()), - 1 => assert!(event.readiness().is_readable()), - _ => panic!(), - } - h.hit += 1; - h.shutdown = true; - } - } - assert_eq!(h.hit, 1); - tx.send(()).unwrap(); - rx2.recv().unwrap(); - h.shutdown = false; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - assert_eq!(event.token(), Token(1)); - match h.hit { - 0 => assert!(event.readiness().is_writable()), - 1 => assert!(event.readiness().is_readable()), - _ => panic!(), - } - h.hit += 1; - h.shutdown = true; - } - } - assert_eq!(h.hit, 2); - t.join().unwrap(); -} - -#[test] -fn read() { - const N: usize = 16 * 1024 * 1024; - struct H { amt: usize, socket: TcpStream, shutdown: bool } - - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - let mut s = l.accept().unwrap().0; - let b = [0; 1024]; - let mut amt = 0; - while amt < N { - amt += s.write(&b).unwrap(); - } - }); - - let poll = Poll::new().unwrap(); - let s = TcpStream::connect(&addr).unwrap(); - - poll.register(&s, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(128); - - let mut h = H { amt: 0, socket: s, shutdown: false }; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - assert_eq!(event.token(), Token(1)); - let mut b = [0; 1024]; - loop { - if let Some(amt) = h.socket.try_read(&mut b).unwrap() { - h.amt += amt; - } else { - break - } - if h.amt >= N { - h.shutdown = true; - break - } - } - } - } - t.join().unwrap(); -} - -#[test] -fn peek() { - const N: usize = 16 * 1024 * 1024; - struct H { amt: usize, socket: TcpStream, shutdown: bool } - - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - let mut s = l.accept().unwrap().0; - let b = [0; 1024]; - let mut amt = 0; - while amt < N { - amt += s.write(&b).unwrap(); - } - }); - - let poll = Poll::new().unwrap(); - let s = TcpStream::connect(&addr).unwrap(); - - poll.register(&s, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(128); - - let mut h = H { amt: 0, socket: s, shutdown: false }; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - assert_eq!(event.token(), Token(1)); - let mut b = [0; 1024]; - match h.socket.peek(&mut b) { - Ok(_) => (), - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { - continue - }, - Err(e) => panic!("unexpected error: {:?}", e), - } - - loop { - if let Some(amt) = h.socket.try_read(&mut b).unwrap() { - h.amt += amt; - } else { - break - } - if h.amt >= N { - h.shutdown = true; - break - } - } - } - } - t.join().unwrap(); -} - -#[test] -fn read_bufs() { - const N: usize = 16 * 1024 * 1024; - - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - let mut s = l.accept().unwrap().0; - let b = [1; 1024]; - let mut amt = 0; - while amt < N { - amt += s.write(&b).unwrap(); - } - }); - - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(128); - - let s = TcpStream::connect(&addr).unwrap(); - - poll.register(&s, Token(1), Ready::readable(), PollOpt::level()).unwrap(); - - let b1 = &mut [0; 10][..]; - let b2 = &mut [0; 383][..]; - let b3 = &mut [0; 28][..]; - let b4 = &mut [0; 8][..]; - let b5 = &mut [0; 128][..]; - let mut b: [&mut IoVec; 5] = [ - b1.into(), - b2.into(), - b3.into(), - b4.into(), - b5.into(), - ]; - - let mut so_far = 0; - loop { - for buf in b.iter_mut() { - for byte in buf.as_mut_bytes() { - *byte = 0; - } - } - - poll.poll(&mut events, None).unwrap(); - - match s.read_bufs(&mut b) { - Ok(0) => { - assert_eq!(so_far, N); - break - } - Ok(mut n) => { - so_far += n; - for buf in b.iter() { - let buf = buf.as_bytes(); - for byte in buf[..cmp::min(n, buf.len())].iter() { - assert_eq!(*byte, 1); - } - n = n.saturating_sub(buf.len()); - if n == 0 { - break - } - } - assert_eq!(n, 0); - } - Err(e) => assert_eq!(e.kind(), io::ErrorKind::WouldBlock), - } - } - - t.join().unwrap(); -} - -#[test] -fn write() { - const N: usize = 16 * 1024 * 1024; - struct H { amt: usize, socket: TcpStream, shutdown: bool } - - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - let mut s = l.accept().unwrap().0; - let mut b = [0; 1024]; - let mut amt = 0; - while amt < N { - amt += s.read(&mut b).unwrap(); - } - }); - - let poll = Poll::new().unwrap(); - let s = TcpStream::connect(&addr).unwrap(); - - poll.register(&s, Token(1), Ready::writable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(128); - - let mut h = H { amt: 0, socket: s, shutdown: false }; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - assert_eq!(event.token(), Token(1)); - let b = [0; 1024]; - loop { - if let Some(amt) = h.socket.try_write(&b).unwrap() { - h.amt += amt; - } else { - break - } - if h.amt >= N { - h.shutdown = true; - break - } - } - } - } - t.join().unwrap(); -} - -#[test] -fn write_bufs() { - const N: usize = 16 * 1024 * 1024; - - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - let mut s = l.accept().unwrap().0; - let mut b = [0; 1024]; - let mut amt = 0; - while amt < N { - for byte in b.iter_mut() { - *byte = 0; - } - let n = s.read(&mut b).unwrap(); - amt += n; - for byte in b[..n].iter() { - assert_eq!(*byte, 1); - } - } - }); - - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(128); - let s = TcpStream::connect(&addr).unwrap(); - poll.register(&s, Token(1), Ready::writable(), PollOpt::level()).unwrap(); - - let b1 = &[1; 10][..]; - let b2 = &[1; 383][..]; - let b3 = &[1; 28][..]; - let b4 = &[1; 8][..]; - let b5 = &[1; 128][..]; - let b: [&IoVec; 5] = [ - b1.into(), - b2.into(), - b3.into(), - b4.into(), - b5.into(), - ]; - - let mut so_far = 0; - while so_far < N { - poll.poll(&mut events, None).unwrap(); - - match s.write_bufs(&b) { - Ok(n) => so_far += n, - Err(e) => assert_eq!(e.kind(), io::ErrorKind::WouldBlock), - } - } - - t.join().unwrap(); -} - -#[test] -fn connect_then_close() { - struct H { listener: TcpListener, shutdown: bool } - - let poll = Poll::new().unwrap(); - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let s = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - - poll.register(&l, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - poll.register(&s, Token(2), Ready::readable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(128); - - let mut h = H { listener: l, shutdown: false }; - while !h.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.token() == Token(1) { - let s = h.listener.accept().unwrap().0; - poll.register(&s, Token(3), Ready::readable() | Ready::writable(), - PollOpt::edge()).unwrap(); - drop(s); - } else if event.token() == Token(2) { - h.shutdown = true; - } - } - } -} - -#[test] -fn listen_then_close() { - let poll = Poll::new().unwrap(); - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - poll.register(&l, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - drop(l); - - let mut events = Events::with_capacity(128); - - poll.poll(&mut events, Some(Duration::from_millis(100))).unwrap(); - - for event in &events { - if event.token() == Token(1) { - panic!("recieved ready() on a closed TcpListener") - } - } -} - -fn assert_send() { -} - -fn assert_sync() { -} - -#[test] -fn test_tcp_sockets_are_send() { - assert_send::(); - assert_send::(); - assert_sync::(); - assert_sync::(); -} - -#[test] -fn bind_twice_bad() { - let l1 = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let addr = l1.local_addr().unwrap(); - assert!(TcpListener::bind(&addr).is_err()); -} - -#[test] -fn multiple_writes_immediate_success() { - const N: usize = 16; - let l = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = l.local_addr().unwrap(); - - let t = thread::spawn(move || { - let mut s = l.accept().unwrap().0; - let mut b = [0; 1024]; - let mut amt = 0; - while amt < 1024*N { - for byte in b.iter_mut() { - *byte = 0; - } - let n = s.read(&mut b).unwrap(); - amt += n; - for byte in b[..n].iter() { - assert_eq!(*byte, 1); - } - } - }); - - let poll = Poll::new().unwrap(); - let mut s = TcpStream::connect(&addr).unwrap(); - poll.register(&s, Token(1), Ready::writable(), PollOpt::level()).unwrap(); - let mut events = Events::with_capacity(16); - - // Wait for our TCP stream to connect - 'outer: loop { - poll.poll(&mut events, None).unwrap(); - for event in events.iter() { - if event.token() == Token(1) && event.readiness().is_writable() { - break 'outer - } - } - } - - for _ in 0..N { - s.write_all(&[1; 1024]).unwrap(); - } - - t.join().unwrap(); -} - -#[test] -fn connection_reset_by_peer() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(16); - let mut buf = [0u8; 16]; - - // Create listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let addr = l.local_addr().unwrap(); - - // Connect client - let client = net2::TcpBuilder::new_v4().unwrap() - .to_tcp_stream().unwrap(); - - client.set_linger(Some(Duration::from_millis(0))).unwrap(); - client.connect(&addr).unwrap(); - - // Convert to Mio stream - let client = TcpStream::from_stream(client).unwrap(); - - // Register server - poll.register(&l, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - - // Register interest in the client - poll.register(&client, Token(1), Ready::readable() | Ready::writable(), PollOpt::edge()).unwrap(); - - // Wait for listener to be ready - let mut server; - 'outer: - loop { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.token() == Token(0) { - match l.accept() { - Ok((sock, _)) => { - server = sock; - break 'outer; - } - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {} - Err(e) => panic!("unexpected error {:?}", e), - } - } - } - } - - // Close the connection - drop(client); - - // Wait a moment - thread::sleep(Duration::from_millis(100)); - - // Register interest in the server socket - poll.register(&server, Token(3), Ready::readable(), PollOpt::edge()).unwrap(); - - - loop { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.token() == Token(3) { - assert!(event.readiness().is_readable()); - - match server.read(&mut buf) { - Ok(0) | - Err(_) => {}, - - Ok(x) => panic!("expected empty buffer but read {} bytes", x), - } - return; - } - } - } - -} - -#[test] -#[cfg_attr(target_os = "fuchsia", ignore)] -fn connect_error() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(16); - - // Pick a "random" port that shouldn't be in use. - let l = match TcpStream::connect(&"127.0.0.1:38381".parse().unwrap()) { - Ok(l) => l, - Err(ref e) if e.kind() == io::ErrorKind::ConnectionRefused => { - // Connection failed synchronously. This is not a bug, but it - // unfortunately doesn't get us the code coverage we want. - return; - }, - Err(e) => panic!("TcpStream::connect unexpected error {:?}", e) - }; - - poll.register(&l, Token(0), Ready::writable(), PollOpt::edge()).unwrap(); - - 'outer: - loop { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.token() == Token(0) { - assert!(event.readiness().is_writable()); - break 'outer - } - } - } - - assert!(l.take_error().unwrap().is_some()); -} - -#[test] -fn write_error() { - let poll = Poll::new().unwrap(); - let mut events = Events::with_capacity(16); - let (tx, rx) = channel(); - - let listener = net::TcpListener::bind("127.0.0.1:0").unwrap(); - let addr = listener.local_addr().unwrap(); - let t = thread::spawn(move || { - let (conn, _addr) = listener.accept().unwrap(); - rx.recv().unwrap(); - drop(conn); - }); - - let mut s = TcpStream::connect(&addr).unwrap(); - poll.register(&s, - Token(0), - Ready::readable() | Ready::writable(), - PollOpt::edge()).unwrap(); - - let mut wait_writable = || { - 'outer: - loop { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.token() == Token(0) && event.readiness().is_writable() { - break 'outer - } - } - } - }; - - wait_writable(); - - tx.send(()).unwrap(); - t.join().unwrap(); - - let buf = [0; 1024]; - loop { - match s.write(&buf) { - Ok(_) => {} - Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { - wait_writable() - } - Err(e) => { - println!("good error: {}", e); - break - } - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_tcp_level.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_tcp_level.rs deleted file mode 100644 index c384caa..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_tcp_level.rs +++ /dev/null @@ -1,142 +0,0 @@ -use {expect_events, sleep_ms, TryRead}; -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::event::Event; -use mio::net::{TcpListener, TcpStream}; -use std::io::Write; -use std::time::Duration; - -const MS: u64 = 1_000; - -#[test] -pub fn test_tcp_listener_level_triggered() { - let poll = Poll::new().unwrap(); - let mut pevents = Events::with_capacity(1024); - - // Create the listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - // Register the listener with `Poll` - poll.register(&l, Token(0), Ready::readable(), PollOpt::level()).unwrap(); - - let s1 = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - poll.register(&s1, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - while filter(&pevents, Token(0)).is_empty() { - poll.poll(&mut pevents, Some(Duration::from_millis(MS))).unwrap(); - } - let events = filter(&pevents, Token(0)); - - assert_eq!(events.len(), 1); - assert_eq!(events[0], Event::new(Ready::readable(), Token(0))); - - poll.poll(&mut pevents, Some(Duration::from_millis(MS))).unwrap(); - let events = filter(&pevents, Token(0)); - assert_eq!(events.len(), 1); - assert_eq!(events[0], Event::new(Ready::readable(), Token(0))); - - // Accept the connection then test that the events stop - let _ = l.accept().unwrap(); - - poll.poll(&mut pevents, Some(Duration::from_millis(MS))).unwrap(); - let events = filter(&pevents, Token(0)); - assert!(events.is_empty(), "actual={:?}", events); - - let s3 = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - poll.register(&s3, Token(2), Ready::readable(), PollOpt::edge()).unwrap(); - - while filter(&pevents, Token(0)).is_empty() { - poll.poll(&mut pevents, Some(Duration::from_millis(MS))).unwrap(); - } - let events = filter(&pevents, Token(0)); - - assert_eq!(events.len(), 1); - assert_eq!(events[0], Event::new(Ready::readable(), Token(0))); - - drop(l); - - poll.poll(&mut pevents, Some(Duration::from_millis(MS))).unwrap(); - let events = filter(&pevents, Token(0)); - assert!(events.is_empty()); -} - -#[test] -pub fn test_tcp_stream_level_triggered() { - drop(::env_logger::init()); - let poll = Poll::new().unwrap(); - let mut pevents = Events::with_capacity(1024); - - // Create the listener - let l = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - // Register the listener with `Poll` - poll.register(&l, Token(0), Ready::readable(), PollOpt::edge()).unwrap(); - - let mut s1 = TcpStream::connect(&l.local_addr().unwrap()).unwrap(); - poll.register(&s1, Token(1), Ready::readable() | Ready::writable(), PollOpt::level()).unwrap(); - - // Sleep a bit to ensure it arrives at dest - sleep_ms(250); - - expect_events(&poll, &mut pevents, 2, vec![ - Event::new(Ready::readable(), Token(0)), - Event::new(Ready::writable(), Token(1)), - ]); - - // Server side of socket - let (mut s1_tx, _) = l.accept().unwrap(); - - // Sleep a bit to ensure it arrives at dest - sleep_ms(250); - - expect_events(&poll, &mut pevents, 2, vec![ - Event::new(Ready::writable(), Token(1)) - ]); - - // Register the socket - poll.register(&s1_tx, Token(123), Ready::readable(), PollOpt::edge()).unwrap(); - - debug!("writing some data ----------"); - - // Write some data - let res = s1_tx.write(b"hello world!"); - assert!(res.unwrap() > 0); - - // Sleep a bit to ensure it arrives at dest - sleep_ms(250); - - debug!("looking at rx end ----------"); - - // Poll rx end - expect_events(&poll, &mut pevents, 2, vec![ - Event::new(Ready::readable(), Token(1)) - ]); - - debug!("reading ----------"); - - // Reading the data should clear it - let mut res = vec![]; - while s1.try_read_buf(&mut res).unwrap().is_some() { - } - - assert_eq!(res, b"hello world!"); - - debug!("checking just read ----------"); - - expect_events(&poll, &mut pevents, 1, vec![ - Event::new(Ready::writable(), Token(1))]); - - // Closing the socket clears all active level events - drop(s1); - - debug!("checking everything is gone ----------"); - - poll.poll(&mut pevents, Some(Duration::from_millis(MS))).unwrap(); - let events = filter(&pevents, Token(1)); - assert!(events.is_empty()); -} - -fn filter(events: &Events, token: Token) -> Vec { - (0..events.len()).map(|i| events.get(i).unwrap()) - .filter(|e| e.token() == token) - .collect() -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_tcp_shutdown.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_tcp_shutdown.rs deleted file mode 100644 index 9363f83..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_tcp_shutdown.rs +++ /dev/null @@ -1,248 +0,0 @@ -use std::collections::HashMap; -use std::net::{self, Shutdown}; -use std::time::{Duration, Instant}; - -use mio::{Token, Ready, PollOpt, Poll, Events}; -use mio::event::{Evented, Event}; -use mio::net::TcpStream; - -struct TestPoll { - poll: Poll, - events: Events, - buf: HashMap, -} - -impl TestPoll { - fn new() -> TestPoll { - TestPoll { - poll: Poll::new().unwrap(), - events: Events::with_capacity(1024), - buf: HashMap::new(), - } - } - - fn register(&self, handle: &E, token: Token, interest: Ready, opts: PollOpt) - where E: Evented - { - self.poll.register(handle, token, interest, opts).unwrap(); - } - - fn wait_for(&mut self, token: Token, ready: Ready) -> Result<(), &'static str> { - let now = Instant::now(); - - loop { - if now.elapsed() > Duration::from_secs(1) { - return Err("not ready"); - } - - if let Some(curr) = self.buf.get(&token) { - if curr.contains(ready) { - break; - } - } - - self.poll.poll(&mut self.events, Some(Duration::from_millis(250))).unwrap(); - - for event in &self.events { - let curr = self.buf.entry(event.token()) - .or_insert(Ready::empty()); - - *curr |= event.readiness(); - } - } - - *self.buf.get_mut(&token).unwrap() -= ready; - Ok(()) - } - - fn check_idle(&mut self) -> Result<(), Event> { - self.poll.poll(&mut self.events, Some(Duration::from_millis(100))).unwrap(); - - if let Some(e) = self.events.iter().next() { - Err(e) - } else { - Ok(()) - } - } -} - -macro_rules! assert_ready { - ($poll:expr, $token:expr, $ready:expr) => {{ - match $poll.wait_for($token, $ready) { - Ok(_) => {} - Err(_) => panic!("not ready; token = {:?}; interest = {:?}", $token, $ready), - } - }} -} - -macro_rules! assert_not_ready { - ($poll:expr, $token:expr, $ready:expr) => {{ - match $poll.wait_for($token, $ready) { - Ok(_) => panic!("is ready; token = {:?}; interest = {:?}", $token, $ready), - Err(_) => {} - } - }} -} - -macro_rules! assert_hup_ready { - ($poll:expr) => { - #[cfg(unix)] - { - use mio::unix::UnixReady; - assert_ready!($poll, Token(0), Ready::from(UnixReady::hup())) - } - } -} - -macro_rules! assert_not_hup_ready { - ($poll:expr) => { - #[cfg(unix)] - { - use mio::unix::UnixReady; - assert_not_ready!($poll, Token(0), Ready::from(UnixReady::hup())) - } - } -} - -macro_rules! assert_idle { - ($poll:expr) => { - match $poll.check_idle() { - Ok(()) => {} - Err(e) => panic!("not idle; event = {:?}", e), - } - } -} - -// TODO: replace w/ assertive -// https://github.com/carllerche/assertive -macro_rules! assert_ok { - ($e:expr) => { - assert_ok!($e,) - }; - ($e:expr,) => {{ - use std::result::Result::*; - match $e { - Ok(v) => v, - Err(e) => panic!("assertion failed: error = {:?}", e), - } - }}; - ($e:expr, $($arg:tt)+) => {{ - use std::result::Result::*; - match $e { - Ok(v) => v, - Err(e) => panic!("assertion failed: error = {:?}: {}", e, format_args!($($arg)+)), - } - }}; -} - -#[test] -fn test_write_shutdown() { - use std::io::prelude::*; - - let mut poll = TestPoll::new(); - let mut buf = [0; 1024]; - - let listener = assert_ok!(net::TcpListener::bind("127.0.0.1:0")); - let addr = assert_ok!(listener.local_addr()); - - let mut client = assert_ok!(TcpStream::connect(&addr)); - poll.register(&client, - Token(0), - Ready::readable() | Ready::writable(), - PollOpt::edge()); - - let (socket, _) = assert_ok!(listener.accept()); - - assert_ready!(poll, Token(0), Ready::writable()); - - // Polling should not have any events - assert_idle!(poll); - - // Now, shutdown the write half of the socket. - assert_ok!(socket.shutdown(Shutdown::Write)); - - assert_ready!(poll, Token(0), Ready::readable()); - - assert_not_hup_ready!(poll); - - let n = assert_ok!(client.read(&mut buf)); - assert_eq!(n, 0); -} - -#[test] -fn test_graceful_shutdown() { - use std::io::prelude::*; - - let mut poll = TestPoll::new(); - let mut buf = [0; 1024]; - - let listener = assert_ok!(net::TcpListener::bind("127.0.0.1:0")); - let addr = assert_ok!(listener.local_addr()); - - let mut client = assert_ok!(TcpStream::connect(&addr)); - poll.register(&client, - Token(0), - Ready::readable() | Ready::writable(), - PollOpt::edge()); - - let (mut socket, _) = assert_ok!(listener.accept()); - - assert_ready!(poll, Token(0), Ready::writable()); - - // Polling should not have any events - assert_idle!(poll); - - // Now, shutdown the write half of the socket. - assert_ok!(client.shutdown(Shutdown::Write)); - - let n = assert_ok!(socket.read(&mut buf)); - assert_eq!(0, n); - drop(socket); - - assert_ready!(poll, Token(0), Ready::readable()); - #[cfg(not(any(target_os = "bitrig", target_os = "dragonfly", - target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "netbsd", target_os = "openbsd")))] - assert_hup_ready!(poll); - - let mut buf = [0; 1024]; - let n = assert_ok!(client.read(&mut buf)); - assert_eq!(n, 0); -} - -#[test] -fn test_abrupt_shutdown() { - use net2::TcpStreamExt; - use std::io::Read; - - let mut poll = TestPoll::new(); - let mut buf = [0; 1024]; - - let listener = assert_ok!(net::TcpListener::bind("127.0.0.1:0")); - let addr = assert_ok!(listener.local_addr()); - - let mut client = assert_ok!(TcpStream::connect(&addr)); - poll.register(&client, - Token(0), - Ready::readable() | Ready::writable(), - PollOpt::edge()); - - let (socket, _) = assert_ok!(listener.accept()); - assert_ok!(socket.set_linger(Some(Duration::from_millis(0)))); - // assert_ok!(socket.set_linger(None)); - - // Wait to be connected - assert_ready!(poll, Token(0), Ready::writable()); - - drop(socket); - - #[cfg(not(any(target_os = "bitrig", target_os = "dragonfly", - target_os = "freebsd", target_os = "ios", target_os = "macos", - target_os = "netbsd", target_os = "openbsd")))] - assert_hup_ready!(poll); - assert_ready!(poll, Token(0), Ready::writable()); - assert_ready!(poll, Token(0), Ready::readable()); - - let res = client.read(&mut buf); - assert!(res.is_err(), "not err = {:?}", res); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_tick.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_tick.rs deleted file mode 100644 index 8c4cec9..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_tick.rs +++ /dev/null @@ -1,64 +0,0 @@ -use mio::*; -use mio::deprecated::{EventLoop, Handler}; -use mio::net::{TcpListener, TcpStream}; -use {sleep_ms}; - -struct TestHandler { - tick: usize, - state: usize, -} - -impl TestHandler { - fn new() -> TestHandler { - TestHandler { - tick: 0, - state: 0, - } - } -} - -impl Handler for TestHandler { - type Timeout = usize; - type Message = String; - - fn tick(&mut self, _event_loop: &mut EventLoop) { - debug!("Handler::tick()"); - self.tick += 1; - - assert_eq!(self.state, 1); - self.state = 0; - } - - fn ready(&mut self, _event_loop: &mut EventLoop, token: Token, events: Ready) { - debug!("READY: {:?} - {:?}", token, events); - if events.is_readable() { - debug!("Handler::ready() readable event"); - assert_eq!(token, Token(0)); - assert_eq!(self.state, 0); - self.state = 1; - } - } -} - -#[test] -pub fn test_tick() { - debug!("Starting TEST_TICK"); - let mut event_loop = EventLoop::new().expect("Couldn't make event loop"); - - let listener = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - event_loop.register(&listener, Token(0), Ready::readable(), PollOpt::level()).unwrap(); - - let client = TcpStream::connect(&listener.local_addr().unwrap()).unwrap(); - event_loop.register(&client, Token(1), Ready::readable(), PollOpt::edge()).unwrap(); - - sleep_ms(250); - - let mut handler = TestHandler::new(); - - for _ in 0..2 { - event_loop.run_once(&mut handler, None).unwrap(); - } - - assert!(handler.tick == 2, "actual={}", handler.tick); - assert!(handler.state == 0, "actual={}", handler.state); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_udp_level.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_udp_level.rs deleted file mode 100644 index 7e19d54..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_udp_level.rs +++ /dev/null @@ -1,52 +0,0 @@ -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::event::Event; -use mio::net::UdpSocket; -use {expect_events, sleep_ms}; - -#[test] -pub fn test_udp_level_triggered() { - let poll = Poll::new().unwrap(); - let poll = &poll; - let mut events = Events::with_capacity(1024); - let events = &mut events; - - // Create the listener - let tx = UdpSocket::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let rx = UdpSocket::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - - poll.register(&tx, Token(0), Ready::readable() | Ready::writable(), PollOpt::level()).unwrap(); - poll.register(&rx, Token(1), Ready::readable() | Ready::writable(), PollOpt::level()).unwrap(); - - - for _ in 0..2 { - expect_events(poll, events, 2, vec![ - Event::new(Ready::writable(), Token(0)), - Event::new(Ready::writable(), Token(1)), - ]); - } - - tx.send_to(b"hello world!", &rx.local_addr().unwrap()).unwrap(); - - sleep_ms(250); - - for _ in 0..2 { - expect_events(poll, events, 2, vec![ - Event::new(Ready::readable() | Ready::writable(), Token(1)) - ]); - } - - let mut buf = [0; 200]; - while rx.recv_from(&mut buf).is_ok() {} - - for _ in 0..2 { - expect_events(poll, events, 4, vec![Event::new(Ready::writable(), Token(1))]); - } - - tx.send_to(b"hello world!", &rx.local_addr().unwrap()).unwrap(); - sleep_ms(250); - - expect_events(poll, events, 10, - vec![Event::new(Ready::readable() | Ready::writable(), Token(1))]); - - drop(rx); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_udp_socket.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_udp_socket.rs deleted file mode 100644 index c331159..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_udp_socket.rs +++ /dev/null @@ -1,252 +0,0 @@ -use mio::{Events, Poll, PollOpt, Ready, Token}; -use mio::net::UdpSocket; -use bytes::{Buf, RingBuf, SliceBuf, MutBuf}; -use std::io::ErrorKind; -use std::str; -use std::time; -use localhost; -use iovec::IoVec; - -const LISTENER: Token = Token(0); -const SENDER: Token = Token(1); - -pub struct UdpHandlerSendRecv { - tx: UdpSocket, - rx: UdpSocket, - msg: &'static str, - buf: SliceBuf<'static>, - rx_buf: RingBuf, - connected: bool, - shutdown: bool, -} - -impl UdpHandlerSendRecv { - fn new(tx: UdpSocket, rx: UdpSocket, connected: bool, msg : &'static str) -> UdpHandlerSendRecv { - UdpHandlerSendRecv { - tx, - rx, - msg, - buf: SliceBuf::wrap(msg.as_bytes()), - rx_buf: RingBuf::new(1024), - connected, - shutdown: false, - } - } -} - -fn assert_send() { -} - -fn assert_sync() { -} - -#[cfg(test)] -fn test_send_recv_udp(tx: UdpSocket, rx: UdpSocket, connected: bool) { - debug!("Starting TEST_UDP_SOCKETS"); - let poll = Poll::new().unwrap(); - - assert_send::(); - assert_sync::(); - - // ensure that the sockets are non-blocking - let mut buf = [0; 128]; - assert_eq!(ErrorKind::WouldBlock, rx.recv_from(&mut buf).unwrap_err().kind()); - - info!("Registering SENDER"); - poll.register(&tx, SENDER, Ready::writable(), PollOpt::edge()).unwrap(); - - info!("Registering LISTENER"); - poll.register(&rx, LISTENER, Ready::readable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - - info!("Starting event loop to test with..."); - let mut handler = UdpHandlerSendRecv::new(tx, rx, connected, "hello world"); - - while !handler.shutdown { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.readiness().is_readable() { - if let LISTENER = event.token() { - debug!("We are receiving a datagram now..."); - let cnt = unsafe { - if !handler.connected { - handler.rx.recv_from(handler.rx_buf.mut_bytes()).unwrap().0 - } else { - handler.rx.recv(handler.rx_buf.mut_bytes()).unwrap() - } - }; - - unsafe { MutBuf::advance(&mut handler.rx_buf, cnt); } - assert!(str::from_utf8(handler.rx_buf.bytes()).unwrap() == handler.msg); - handler.shutdown = true; - } - } - - if event.readiness().is_writable() { - if let SENDER = event.token() { - let cnt = if !handler.connected { - let addr = handler.rx.local_addr().unwrap(); - handler.tx.send_to(handler.buf.bytes(), &addr).unwrap() - } else { - handler.tx.send(handler.buf.bytes()).unwrap() - }; - - handler.buf.advance(cnt); - } - } - } - } -} - -/// Returns the sender and the receiver -fn connected_sockets() -> (UdpSocket, UdpSocket) { - let addr = localhost(); - let any = localhost(); - - let tx = UdpSocket::bind(&any).unwrap(); - let rx = UdpSocket::bind(&addr).unwrap(); - - let tx_addr = tx.local_addr().unwrap(); - let rx_addr = rx.local_addr().unwrap(); - - assert!(tx.connect(rx_addr).is_ok()); - assert!(rx.connect(tx_addr).is_ok()); - - (tx, rx) -} - -#[test] -pub fn test_udp_socket() { - let addr = localhost(); - let any = localhost(); - - let tx = UdpSocket::bind(&any).unwrap(); - let rx = UdpSocket::bind(&addr).unwrap(); - - test_send_recv_udp(tx, rx, false); -} - -#[test] -pub fn test_udp_socket_send_recv() { - let (tx, rx) = connected_sockets(); - - test_send_recv_udp(tx, rx, true); -} - -#[test] -pub fn test_udp_socket_discard() { - let addr = localhost(); - let any = localhost(); - let outside = localhost(); - - let tx = UdpSocket::bind(&any).unwrap(); - let rx = UdpSocket::bind(&addr).unwrap(); - let udp_outside = UdpSocket::bind(&outside).unwrap(); - - let tx_addr = tx.local_addr().unwrap(); - let rx_addr = rx.local_addr().unwrap(); - - assert!(tx.connect(rx_addr).is_ok()); - assert!(udp_outside.connect(rx_addr).is_ok()); - assert!(rx.connect(tx_addr).is_ok()); - - let poll = Poll::new().unwrap(); - - let r = udp_outside.send(b"hello world"); - assert!(r.is_ok() || r.unwrap_err().kind() == ErrorKind::WouldBlock); - - poll.register(&rx, LISTENER, Ready::readable(), PollOpt::edge()).unwrap(); - poll.register(&tx, SENDER, Ready::writable(), PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - - poll.poll(&mut events, Some(time::Duration::from_secs(5))).unwrap(); - - for event in &events { - if event.readiness().is_readable() { - if let LISTENER = event.token() { - assert!(false, "Expected to no receive a packet but got something") - } - } - } -} - -#[cfg(all(unix, not(target_os = "fuchsia")))] -#[test] -pub fn test_udp_socket_send_recv_bufs() { - let (tx, rx) = connected_sockets(); - - let poll = Poll::new().unwrap(); - - poll.register(&tx, SENDER, Ready::writable(), PollOpt::edge()) - .unwrap(); - - poll.register(&rx, LISTENER, Ready::readable(), PollOpt::edge()) - .unwrap(); - - let mut events = Events::with_capacity(1024); - - let data = b"hello, world"; - let write_bufs: Vec<_> = vec![b"hello, " as &[u8], b"world"] - .into_iter() - .flat_map(IoVec::from_bytes) - .collect(); - let (a, b, c) = ( - &mut [0u8; 4] as &mut [u8], - &mut [0u8; 6] as &mut [u8], - &mut [0u8; 8] as &mut [u8], - ); - let mut read_bufs: Vec<_> = vec![a, b, c] - .into_iter() - .flat_map(IoVec::from_bytes_mut) - .collect(); - - let times = 5; - let mut rtimes = 0; - let mut wtimes = 0; - - 'outer: loop { - poll.poll(&mut events, None).unwrap(); - - for event in &events { - if event.readiness().is_readable() { - if let LISTENER = event.token() { - loop { - let cnt = match rx.recv_bufs(read_bufs.as_mut()) { - Ok(cnt) => cnt, - Err(ref e) if e.kind() == ErrorKind::WouldBlock => break, - Err(e) => panic!("read error {}", e), - }; - assert_eq!(cnt, data.len()); - let res: Vec = read_bufs - .iter() - .flat_map(|buf| buf.iter()) - .cloned() - .collect(); - assert_eq!(&res[..cnt], &data[..cnt]); - rtimes += 1; - if rtimes == times { - break 'outer; - } - } - } - } - - if event.readiness().is_writable() { - if let SENDER = event.token() { - while wtimes < times { - let cnt = match tx.send_bufs(write_bufs.as_slice()) { - Ok(cnt) => cnt, - Err(ref e) if e.kind() == ErrorKind::WouldBlock => break, - Err(e) => panic!("write error {}", e), - }; - assert_eq!(cnt, data.len()); - wtimes += 1; - } - } - } - } - } -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_uds_shutdown.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_uds_shutdown.rs deleted file mode 100644 index bf96445..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_uds_shutdown.rs +++ /dev/null @@ -1,300 +0,0 @@ -use {TryRead, TryWrite}; -use mio::*; -use mio::deprecated::{EventLoop, Handler}; -use mio::deprecated::unix::*; -use bytes::{Buf, ByteBuf, MutByteBuf, SliceBuf}; -use slab::Slab; -use std::io; -use std::path::PathBuf; -use tempdir::TempDir; - -const SERVER: Token = Token(10_000_000); -const CLIENT: Token = Token(10_000_001); - -struct EchoConn { - sock: UnixStream, - buf: Option, - mut_buf: Option, - token: Option, - interest: Ready -} - -impl EchoConn { - fn new(sock: UnixStream) -> EchoConn { - EchoConn { - sock: sock, - buf: None, - mut_buf: Some(ByteBuf::mut_with_capacity(2048)), - token: None, - interest: Ready::hup() - } - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut buf = self.buf.take().unwrap(); - - match self.sock.try_write_buf(&mut buf) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - - self.buf = Some(buf); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CONN : we wrote {} bytes!", r); - - self.mut_buf = Some(buf.flip()); - - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - match self.sock.shutdown(Shutdown::Write) { - Err(e) => panic!(e), - _ => {}, - } - } - Err(e) => debug!("not implemented; client err={:?}", e), - } - - event_loop.reregister(&self.sock, self.token.unwrap(), self.interest, - PollOpt::edge() | PollOpt::oneshot()) - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut buf = self.mut_buf.take().unwrap(); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - debug!("CONN : spurious read wakeup"); - self.mut_buf = Some(buf); - } - Ok(Some(r)) => { - debug!("CONN : we read {} bytes!", r); - - // prepare to provide this to writable - self.buf = Some(buf.flip()); - - self.interest.remove(Ready::readable()); - self.interest.insert(Ready::writable()); - } - Err(e) => { - debug!("not implemented; client err={:?}", e); - self.interest.remove(Ready::readable()); - } - - }; - - event_loop.reregister(&self.sock, self.token.unwrap(), self.interest, - PollOpt::edge()) - } -} - -struct EchoServer { - sock: UnixListener, - conns: Slab -} - -impl EchoServer { - fn accept(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("server accepting socket"); - - let sock = self.sock.accept().unwrap(); - let conn = EchoConn::new(sock,); - let tok = self.conns.insert(conn); - - // Register the connection - self.conns[tok].token = Some(Token(tok)); - event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()) - .expect("could not register socket with event loop"); - - Ok(()) - } - - fn conn_readable(&mut self, event_loop: &mut EventLoop, - tok: Token) -> io::Result<()> { - debug!("server conn readable; tok={:?}", tok); - self.conn(tok).readable(event_loop) - } - - fn conn_writable(&mut self, event_loop: &mut EventLoop, - tok: Token) -> io::Result<()> { - debug!("server conn writable; tok={:?}", tok); - self.conn(tok).writable(event_loop) - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { - &mut self.conns[tok.into()] - } -} - -struct EchoClient { - sock: UnixStream, - msgs: Vec<&'static str>, - tx: SliceBuf<'static>, - rx: SliceBuf<'static>, - mut_buf: Option, - token: Token, - interest: Ready -} - - -// Sends a message and expects to receive the same exact message, one at a time -impl EchoClient { - fn new(sock: UnixStream, tok: Token, mut msgs: Vec<&'static str>) -> EchoClient { - let curr = msgs.remove(0); - - EchoClient { - sock: sock, - msgs: msgs, - tx: SliceBuf::wrap(curr.as_bytes()), - rx: SliceBuf::wrap(curr.as_bytes()), - mut_buf: Some(ByteBuf::mut_with_capacity(2048)), - token: tok, - interest: Ready::none() - } - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket readable"); - - let mut buf = self.mut_buf.take().unwrap(); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - debug!("CLIENT : spurious read wakeup"); - self.mut_buf = Some(buf); - } - Ok(Some(r)) => { - if r == 0 { - self.interest.remove(Ready::readable()); - event_loop.shutdown(); - } else { - debug!("CLIENT : We read {} bytes!", r); - - // prepare for reading - let mut buf = buf.flip(); - - while buf.has_remaining() { - let actual = buf.read_byte().unwrap(); - let expect = self.rx.read_byte().unwrap(); - - assert!(actual == expect, "actual={}; expect={}", actual, expect); - } - - self.mut_buf = Some(buf.flip()); - if !self.rx.has_remaining() { - self.next_msg(event_loop).unwrap(); - } - } - } - Err(e) => { - panic!("not implemented; client err={:?}", e); - } - }; - - event_loop.reregister(&self.sock, self.token, self.interest, - PollOpt::edge() | PollOpt::oneshot()) - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket writable"); - - match self.sock.try_write_buf(&mut self.tx) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CLIENT : we wrote {} bytes!", r); - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e) - } - - event_loop.reregister(&self.sock, self.token, self.interest, - PollOpt::edge() | PollOpt::oneshot()) - } - - fn next_msg(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - if self.msgs.is_empty() { - - return Ok(()); - } - - let curr = self.msgs.remove(0); - - debug!("client prepping next message"); - self.tx = SliceBuf::wrap(curr.as_bytes()); - self.rx = SliceBuf::wrap(curr.as_bytes()); - - self.interest.insert(Ready::writable()); - event_loop.reregister(&self.sock, self.token, self.interest, - PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct Echo { - server: EchoServer, - client: EchoClient, -} - -impl Echo { - fn new(srv: UnixListener, client: UnixStream, msgs: Vec<&'static str>) -> Echo { - Echo { - server: EchoServer { - sock: srv, - conns: Slab::with_capacity(128) - }, - client: EchoClient::new(client, CLIENT, msgs) - } - } -} - -impl Handler for Echo { - type Timeout = usize; - type Message = (); - - fn ready(&mut self, event_loop: &mut EventLoop, token: Token, - events: Ready) { - debug!("ready {:?} {:?}", token, events); - if events.is_readable() { - match token { - SERVER => self.server.accept(event_loop).unwrap(), - CLIENT => self.client.readable(event_loop).unwrap(), - i => self.server.conn_readable(event_loop, i).unwrap() - } - } - - if events.is_writable() { - match token { - SERVER => panic!("received writable for token 0"), - CLIENT => self.client.writable(event_loop).unwrap(), - _ => self.server.conn_writable(event_loop, token).unwrap() - }; - } - } -} - -#[test] -pub fn test_echo_server() { - debug!("Starting TEST_ECHO_SERVER"); - let mut event_loop = EventLoop::new().unwrap(); - - let tmp_dir = TempDir::new("mio").unwrap(); - let addr = tmp_dir.path().join(&PathBuf::from("sock")); - - let srv = UnixListener::bind(&addr).unwrap(); - - event_loop.register(&srv, SERVER, Ready::readable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - let sock = UnixStream::connect(&addr).unwrap(); - - // Connect to the server - event_loop.register(&sock, CLIENT, Ready::writable(), - PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Start the event loop - event_loop.run(&mut Echo::new(srv, sock, vec!["foo", "bar"])).unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_unix_echo_server.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_unix_echo_server.rs deleted file mode 100644 index 6531dea..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_unix_echo_server.rs +++ /dev/null @@ -1,292 +0,0 @@ -use {TryRead, TryWrite}; -use mio::*; -use mio::deprecated::{EventLoop, Handler}; -use mio::deprecated::unix::*; -use bytes::{Buf, ByteBuf, MutByteBuf, SliceBuf}; -use slab::Slab; -use std::path::PathBuf; -use std::io; -use tempdir::TempDir; - -const SERVER: Token = Token(10_000_000); -const CLIENT: Token = Token(10_000_001); - -struct EchoConn { - sock: UnixStream, - buf: Option, - mut_buf: Option, - token: Option, - interest: Ready, -} - -impl EchoConn { - fn new(sock: UnixStream) -> EchoConn { - EchoConn { - sock: sock, - buf: None, - mut_buf: Some(ByteBuf::mut_with_capacity(2048)), - token: None, - interest: Ready::hup(), - } - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut buf = self.buf.take().unwrap(); - - match self.sock.try_write_buf(&mut buf) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - - self.buf = Some(buf); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CONN : we wrote {} bytes!", r); - - self.mut_buf = Some(buf.flip()); - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e), - } - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token.unwrap(), self.interest, PollOpt::edge() | PollOpt::oneshot()) - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut buf = self.mut_buf.take().unwrap(); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - debug!("CONN : spurious read wakeup"); - self.mut_buf = Some(buf); - } - Ok(Some(r)) => { - debug!("CONN : we read {} bytes!", r); - - // prepare to provide this to writable - self.buf = Some(buf.flip()); - - self.interest.remove(Ready::readable()); - self.interest.insert(Ready::writable()); - } - Err(e) => { - debug!("not implemented; client err={:?}", e); - self.interest.remove(Ready::readable()); - } - - }; - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token.unwrap(), self.interest, PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct EchoServer { - sock: UnixListener, - conns: Slab -} - -impl EchoServer { - fn accept(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("server accepting socket"); - - let sock = self.sock.accept().unwrap(); - let conn = EchoConn::new(sock); - let tok = self.conns.insert(conn); - - // Register the connection - self.conns[tok].token = Some(Token(tok)); - event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) - .expect("could not register socket with event loop"); - - Ok(()) - } - - fn conn_readable(&mut self, event_loop: &mut EventLoop, tok: Token) -> io::Result<()> { - debug!("server conn readable; tok={:?}", tok); - self.conn(tok).readable(event_loop) - } - - fn conn_writable(&mut self, event_loop: &mut EventLoop, tok: Token) -> io::Result<()> { - debug!("server conn writable; tok={:?}", tok); - self.conn(tok).writable(event_loop) - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { - &mut self.conns[tok.into()] - } -} - -struct EchoClient { - sock: UnixStream, - msgs: Vec<&'static str>, - tx: SliceBuf<'static>, - rx: SliceBuf<'static>, - mut_buf: Option, - token: Token, - interest: Ready, -} - - -// Sends a message and expects to receive the same exact message, one at a time -impl EchoClient { - fn new(sock: UnixStream, tok: Token, mut msgs: Vec<&'static str>) -> EchoClient { - let curr = msgs.remove(0); - - EchoClient { - sock: sock, - msgs: msgs, - tx: SliceBuf::wrap(curr.as_bytes()), - rx: SliceBuf::wrap(curr.as_bytes()), - mut_buf: Some(ByteBuf::mut_with_capacity(2048)), - token: tok, - interest: Ready::none(), - } - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket readable"); - - let mut buf = self.mut_buf.take().unwrap(); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - debug!("CLIENT : spurious read wakeup"); - self.mut_buf = Some(buf); - } - Ok(Some(r)) => { - debug!("CLIENT : We read {} bytes!", r); - - // prepare for reading - let mut buf = buf.flip(); - - debug!("CLIENT : buf = {:?} -- rx = {:?}", buf.bytes(), self.rx.bytes()); - while buf.has_remaining() { - let actual = buf.read_byte().unwrap(); - let expect = self.rx.read_byte().unwrap(); - - assert!(actual == expect, "actual={}; expect={}", actual, expect); - } - - self.mut_buf = Some(buf.flip()); - - self.interest.remove(Ready::readable()); - - if !self.rx.has_remaining() { - self.next_msg(event_loop).unwrap(); - } - } - Err(e) => { - panic!("not implemented; client err={:?}", e); - } - }; - - if !self.interest.is_none() { - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token, self.interest, PollOpt::edge() | PollOpt::oneshot())?; - } - - Ok(()) - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket writable"); - - match self.sock.try_write_buf(&mut self.tx) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CLIENT : we wrote {} bytes!", r); - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e) - } - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token, self.interest, PollOpt::edge() | PollOpt::oneshot()) - } - - fn next_msg(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - if self.msgs.is_empty() { - event_loop.shutdown(); - return Ok(()); - } - - let curr = self.msgs.remove(0); - - debug!("client prepping next message"); - self.tx = SliceBuf::wrap(curr.as_bytes()); - self.rx = SliceBuf::wrap(curr.as_bytes()); - - self.interest.insert(Ready::writable()); - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token, self.interest, PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct Echo { - server: EchoServer, - client: EchoClient, -} - -impl Echo { - fn new(srv: UnixListener, client: UnixStream, msgs: Vec<&'static str>) -> Echo { - Echo { - server: EchoServer { - sock: srv, - conns: Slab::with_capacity(128) - }, - client: EchoClient::new(client, CLIENT, msgs) - } - } -} - -impl Handler for Echo { - type Timeout = usize; - type Message = (); - - fn ready(&mut self, event_loop: &mut EventLoop, token: Token, events: Ready) { - if events.is_readable() { - match token { - SERVER => self.server.accept(event_loop).unwrap(), - CLIENT => self.client.readable(event_loop).unwrap(), - i => self.server.conn_readable(event_loop, i).unwrap() - }; - } - - if events.is_writable() { - match token { - SERVER => panic!("received writable for token 0"), - CLIENT => self.client.writable(event_loop).unwrap(), - _ => self.server.conn_writable(event_loop, token).unwrap() - }; - } - } -} - -#[test] -pub fn test_unix_echo_server() { - debug!("Starting TEST_UNIX_ECHO_SERVER"); - let mut event_loop = EventLoop::new().unwrap(); - - let tmp_dir = TempDir::new("mio").unwrap(); - let addr = tmp_dir.path().join(&PathBuf::from("sock")); - - let srv = UnixListener::bind(&addr).unwrap(); - - info!("listen for connections"); - event_loop.register(&srv, SERVER, Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - let sock = UnixStream::connect(&addr).unwrap(); - - // Connect to the server - event_loop.register(&sock, CLIENT, Ready::writable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Start the event loop - event_loop.run(&mut Echo::new(srv, sock, vec!["foo", "bar"])).unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_unix_pass_fd.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_unix_pass_fd.rs deleted file mode 100644 index a948bb2..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_unix_pass_fd.rs +++ /dev/null @@ -1,306 +0,0 @@ -use {TryRead, TryWrite}; -use mio::*; -use mio::deprecated::{EventLoop, Handler}; -use mio::deprecated::unix::*; -use bytes::{Buf, ByteBuf, SliceBuf}; -use slab::Slab; -use std::path::PathBuf; -use std::io::{self, Read}; -use std::os::unix::io::{AsRawFd, FromRawFd}; -use tempdir::TempDir; - -const SERVER: Token = Token(10_000_000); -const CLIENT: Token = Token(10_000_001); - -struct EchoConn { - sock: UnixStream, - pipe_fd: Option, - token: Option, - interest: Ready, -} - -impl EchoConn { - fn new(sock: UnixStream) -> EchoConn { - EchoConn { - sock: sock, - pipe_fd: None, - token: None, - interest: Ready::hup(), - } - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let fd = self.pipe_fd.take().unwrap(); - - match self.sock.try_write_send_fd(b"x", fd.as_raw_fd()) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - - self.pipe_fd = Some(fd); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CONN : we wrote {} bytes!", r); - - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e), - } - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token.unwrap(), self.interest, PollOpt::edge() | PollOpt::oneshot()) - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - let mut buf = ByteBuf::mut_with_capacity(2048); - - match self.sock.try_read_buf(&mut buf) { - Ok(None) => { - panic!("We just got readable, but were unable to read from the socket?"); - } - Ok(Some(r)) => { - debug!("CONN : we read {} bytes!", r); - self.interest.remove(Ready::readable()); - self.interest.insert(Ready::writable()); - } - Err(e) => { - debug!("not implemented; client err={:?}", e); - self.interest.remove(Ready::readable()); - } - - }; - - // create fd to pass back. Assume that the write will work - // without blocking, for simplicity -- we're only testing that - // the FD makes it through somehow - let (rd, mut wr) = pipe().unwrap(); - let mut buf = buf.flip(); - match wr.try_write_buf(&mut buf) { - Ok(None) => { - panic!("writing to our own pipe blocked :("); - } - Ok(Some(r)) => { - debug!("CONN: we wrote {} bytes to the FD", r); - } - Err(e) => { - panic!("not implemented; client err={:?}", e); - } - } - self.pipe_fd = Some(rd); - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token.unwrap(), self.interest, PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct EchoServer { - sock: UnixListener, - conns: Slab -} - -impl EchoServer { - fn accept(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("server accepting socket"); - - let sock = self.sock.accept().unwrap(); - let conn = EchoConn::new(sock); - let tok = self.conns.insert(conn); - - // Register the connection - self.conns[tok].token = Some(Token(tok)); - event_loop.register(&self.conns[tok].sock, Token(tok), Ready::readable(), PollOpt::edge() | PollOpt::oneshot()) - .expect("could not register socket with event loop"); - - Ok(()) - } - - fn conn_readable(&mut self, event_loop: &mut EventLoop, tok: Token) -> io::Result<()> { - debug!("server conn readable; tok={:?}", tok); - self.conn(tok).readable(event_loop) - } - - fn conn_writable(&mut self, event_loop: &mut EventLoop, tok: Token) -> io::Result<()> { - debug!("server conn writable; tok={:?}", tok); - self.conn(tok).writable(event_loop) - } - - fn conn<'a>(&'a mut self, tok: Token) -> &'a mut EchoConn { - &mut self.conns[tok.into()] - } -} - -struct EchoClient { - sock: UnixStream, - msgs: Vec<&'static str>, - tx: SliceBuf<'static>, - rx: SliceBuf<'static>, - token: Token, - interest: Ready, -} - - -// Sends a message and expects to receive the same exact message, one at a time -impl EchoClient { - fn new(sock: UnixStream, tok: Token, mut msgs: Vec<&'static str>) -> EchoClient { - let curr = msgs.remove(0); - - EchoClient { - sock: sock, - msgs: msgs, - tx: SliceBuf::wrap(curr.as_bytes()), - rx: SliceBuf::wrap(curr.as_bytes()), - token: tok, - interest: Ready::none(), - } - } - - fn readable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket readable"); - - let mut pipe: PipeReader; - let mut buf = [0; 256]; - - match self.sock.read_recv_fd(&mut buf) { - Ok((_, None)) => { - panic!("Did not receive passed file descriptor"); - } - Ok((r, Some(fd))) => { - assert_eq!(r, 1); - assert_eq!(b'x', buf[0]); - debug!("CLIENT : We read {} bytes!", r); - pipe = From::::from(unsafe { Io::from_raw_fd(fd) }); - } - Err(e) => { - panic!("not implemented; client err={:?}", e); - } - }; - - // read the data out of the FD itself - let n = match pipe.read(&mut buf) { - Ok(r) => { - debug!("CLIENT : We read {} bytes from the FD", r); - r - } - Err(e) => { - panic!("not implemented, client err={:?}", e); - } - }; - - for &actual in buf[0..n].iter() { - let expect = self.rx.read_byte().unwrap(); - assert!(actual == expect, "actual={}; expect={}", actual, expect); - } - - self.interest.remove(Ready::readable()); - - if !self.rx.has_remaining() { - self.next_msg(event_loop).unwrap(); - } - - if !self.interest.is_none() { - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token, self.interest, PollOpt::edge() | PollOpt::oneshot())?; - } - - Ok(()) - } - - fn writable(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - debug!("client socket writable"); - - match self.sock.try_write_buf(&mut self.tx) { - Ok(None) => { - debug!("client flushing buf; WOULDBLOCK"); - self.interest.insert(Ready::writable()); - } - Ok(Some(r)) => { - debug!("CLIENT : we wrote {} bytes!", r); - self.interest.insert(Ready::readable()); - self.interest.remove(Ready::writable()); - } - Err(e) => debug!("not implemented; client err={:?}", e) - } - - assert!(self.interest.is_readable() || self.interest.is_writable(), "actual={:?}", self.interest); - event_loop.reregister(&self.sock, self.token, self.interest, PollOpt::edge() | PollOpt::oneshot()) - } - - fn next_msg(&mut self, event_loop: &mut EventLoop) -> io::Result<()> { - if self.msgs.is_empty() { - event_loop.shutdown(); - return Ok(()); - } - - let curr = self.msgs.remove(0); - - debug!("client prepping next message"); - self.tx = SliceBuf::wrap(curr.as_bytes()); - self.rx = SliceBuf::wrap(curr.as_bytes()); - - self.interest.insert(Ready::writable()); - event_loop.reregister(&self.sock, self.token, self.interest, PollOpt::edge() | PollOpt::oneshot()) - } -} - -struct Echo { - server: EchoServer, - client: EchoClient, -} - -impl Echo { - fn new(srv: UnixListener, client: UnixStream, msgs: Vec<&'static str>) -> Echo { - Echo { - server: EchoServer { - sock: srv, - conns: Slab::with_capacity(128) - }, - client: EchoClient::new(client, CLIENT, msgs) - } - } -} - -impl Handler for Echo { - type Timeout = usize; - type Message = (); - - fn ready(&mut self, event_loop: &mut EventLoop, token: Token, events: Ready) { - if events.is_readable() { - match token { - SERVER => self.server.accept(event_loop).unwrap(), - CLIENT => self.client.readable(event_loop).unwrap(), - i => self.server.conn_readable(event_loop, i).unwrap() - }; - } - - if events.is_writable() { - match token { - SERVER => panic!("received writable for token 0"), - CLIENT => self.client.writable(event_loop).unwrap(), - _ => self.server.conn_writable(event_loop, token).unwrap() - }; - } - } -} - -#[test] -pub fn test_unix_pass_fd() { - debug!("Starting TEST_UNIX_PASS_FD"); - let mut event_loop = EventLoop::new().unwrap(); - - let tmp_dir = TempDir::new("mio").unwrap(); - let addr = tmp_dir.path().join(&PathBuf::from("sock")); - - let srv = UnixListener::bind(&addr).unwrap(); - - info!("listen for connections"); - event_loop.register(&srv, SERVER, Ready::readable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - let sock = UnixStream::connect(&addr).unwrap(); - - // Connect to the server - event_loop.register(&sock, CLIENT, Ready::writable(), PollOpt::edge() | PollOpt::oneshot()).unwrap(); - - // Start the event loop - event_loop.run(&mut Echo::new(srv, sock, vec!["foo", "bar"])).unwrap(); -} diff --git a/third_party/cargo/vendor/mio-0.6.21/test/test_write_then_drop.rs b/third_party/cargo/vendor/mio-0.6.21/test/test_write_then_drop.rs deleted file mode 100644 index 971ffff..0000000 --- a/third_party/cargo/vendor/mio-0.6.21/test/test_write_then_drop.rs +++ /dev/null @@ -1,123 +0,0 @@ -use std::io::{Write, Read}; - -use mio::event::Evented; -use mio::net::{TcpListener, TcpStream}; -use mio::{Poll, Events, Ready, PollOpt, Token}; - -#[test] -fn write_then_drop() { - drop(::env_logger::init()); - - let a = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let addr = a.local_addr().unwrap(); - let mut s = TcpStream::connect(&addr).unwrap(); - - let poll = Poll::new().unwrap(); - - a.register(&poll, - Token(1), - Ready::readable(), - PollOpt::edge()).unwrap(); - s.register(&poll, - Token(3), - Ready::empty(), - PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - while events.is_empty() { - poll.poll(&mut events, None).unwrap(); - } - assert_eq!(events.len(), 1); - assert_eq!(events.get(0).unwrap().token(), Token(1)); - - let mut s2 = a.accept().unwrap().0; - - s2.register(&poll, - Token(2), - Ready::writable(), - PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - while events.is_empty() { - poll.poll(&mut events, None).unwrap(); - } - assert_eq!(events.len(), 1); - assert_eq!(events.get(0).unwrap().token(), Token(2)); - - s2.write_all(&[1, 2, 3, 4]).unwrap(); - drop(s2); - - s.reregister(&poll, - Token(3), - Ready::readable(), - PollOpt::edge()).unwrap(); - let mut events = Events::with_capacity(1024); - while events.is_empty() { - poll.poll(&mut events, None).unwrap(); - } - assert_eq!(events.len(), 1); - assert_eq!(events.get(0).unwrap().token(), Token(3)); - - let mut buf = [0; 10]; - assert_eq!(s.read(&mut buf).unwrap(), 4); - assert_eq!(&buf[0..4], &[1, 2, 3, 4]); -} - -#[test] -fn write_then_deregister() { - drop(::env_logger::init()); - - let a = TcpListener::bind(&"127.0.0.1:0".parse().unwrap()).unwrap(); - let addr = a.local_addr().unwrap(); - let mut s = TcpStream::connect(&addr).unwrap(); - - let poll = Poll::new().unwrap(); - - a.register(&poll, - Token(1), - Ready::readable(), - PollOpt::edge()).unwrap(); - s.register(&poll, - Token(3), - Ready::empty(), - PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - while events.is_empty() { - poll.poll(&mut events, None).unwrap(); - } - assert_eq!(events.len(), 1); - assert_eq!(events.get(0).unwrap().token(), Token(1)); - - let mut s2 = a.accept().unwrap().0; - - s2.register(&poll, - Token(2), - Ready::writable(), - PollOpt::edge()).unwrap(); - - let mut events = Events::with_capacity(1024); - while events.is_empty() { - poll.poll(&mut events, None).unwrap(); - } - assert_eq!(events.len(), 1); - assert_eq!(events.get(0).unwrap().token(), Token(2)); - - s2.write_all(&[1, 2, 3, 4]).unwrap(); - s2.deregister(&poll).unwrap(); - - s.reregister(&poll, - Token(3), - Ready::readable(), - PollOpt::edge()).unwrap(); - let mut events = Events::with_capacity(1024); - while events.is_empty() { - poll.poll(&mut events, None).unwrap(); - } - assert_eq!(events.len(), 1); - assert_eq!(events.get(0).unwrap().token(), Token(3)); - - let mut buf = [0; 10]; - assert_eq!(s.read(&mut buf).unwrap(), 4); - assert_eq!(&buf[0..4], &[1, 2, 3, 4]); -} diff --git a/third_party/cargo/vendor/mio-0.6.22/.cargo-checksum.json b/third_party/cargo/vendor/mio-0.6.22/.cargo-checksum.json new file mode 100644 index 0000000..59b9529 --- /dev/null +++ b/third_party/cargo/vendor/mio-0.6.22/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"eea330da1f7d9edc0036ac3c074cbd6505dd632f426212c014dd51aa6eaf308d","Cargo.toml":"ffbac81b21e8e0d0b016b7983b637a39a086ab6f7997584dcdd80ed32d1ec346","LICENSE":"07919255c7e04793d8ea760d6c2ce32d19f9ff02bdbdde3ce90b1e1880929a9b","README.md":"eedc84973c97348ea27f93ac7d3232098438d4455c7eaedf6fcc7f105ac9f321","src/channel.rs":"b16493a2b74334156e153b1f4143b0e98d43cd4d7bff0275066dfa575dde2402","src/deprecated/event_loop.rs":"ba931d256e6e57d5635c6cfc6e3a4add4551c87f16457d901b334a129f9cf41d","src/deprecated/handler.rs":"13cbc0c193f43a331e125e05d5eddf3712fe86e41a8721186d3672518ef8a9cc","src/deprecated/io.rs":"4948217ffeeba4f508cc89744da5d6af858b4ad7b4be23f927a00df93bdf2984","src/deprecated/mod.rs":"4310471b5a1313dbf53b492769a3031b15353eb269333b7c1a890bc2709def7c","src/deprecated/notify.rs":"8cb108387ebcfb75764e4dd2868d80eb00d793c4b7c867c08cd86ef10b91b023","src/deprecated/unix.rs":"76c832e7db8263395b576930186fe1a3c472589bed41810d445d89f0eed684eb","src/event_imp.rs":"f8cff47dedc52dab9c7cc2d707f2c2d86d7185f942f02ace4c60353cc6094035","src/io.rs":"9207ffc93ea744b09bc6872fa4d378d7c75640f9ac38b1fa67b940c7cb5d0ade","src/lazycell.rs":"871dbd89f6918a354c2ec2d2a8b89e4aa30754e7e3e8dfcf2f5a6071156e39cf","src/lib.rs":"f377dc30e6a206d7bbca7d1ce4af336af40d19aa5331abcf4d72c7fbfdc6964b","src/net/mod.rs":"340c63a8efe9ee774b7bf8ed8c0f72fc7563e5c4b35f6a8b243f92d366e145a2","src/net/tcp.rs":"8b06dc8d2dd9fb7cd52db582fd7fe608b6a50cdf7ce18cf0abb9992956e95f6d","src/net/udp.rs":"8b5728924a07917d2845bbfb060cadb842b36a74d5372ac7707eb7f169a67d4d","src/poll.rs":"e76bb316deedbd9306f91ca8ab394d02b5676fa767746bd9770c5c9dff490426","src/sys/fuchsia/awakener.rs":"71a4a0083242457b0a96326c69c0f98b23dfdb97be96deb26ee02fa9d1dfb212","src/sys/fuchsia/eventedfd.rs":"bd8f43d2b61cdd6a5d0df9c0dc1cb43e1708140d01a05611055277ed55a33b63","src/sys/fuchsia/handles.rs":"161a69e8a8d7f71326a9c53bcb7685d0a81d184aba8e20da27c64aa27dfd56b2","src/sys/fuchsia/mod.rs":"9d80f1214abc93f48b6b6c12ce5b6cfaddbda592c8f3410564d0237228cae2d0","src/sys/fuchsia/net.rs":"50340191dd9cbe317bd6e6ae0170c03daa9141f15c96782b96484e3d8b8301b1","src/sys/fuchsia/ready.rs":"7e6bb7235c52ab4a2134d36cf982f6a4fd6e18050e737b40ee84c89a10a9faac","src/sys/fuchsia/selector.rs":"f3be7f8d683d43e4a8313246e4cacb9444549bf66ecb2234f0d0f53172043bf5","src/sys/mod.rs":"64bea046e4a9feb1f2e2fb8326452c1be8b9d56cf8794df0af4fbdf565204255","src/sys/unix/awakener.rs":"20a61d8f39b2f2abf4f166a3ed46fa0d79907ddf92758eaddb880c67321db56c","src/sys/unix/dlsym.rs":"559337d1f6c10e6c1172bd3908a9dcfa5a0828b53b04f7ca3a0d926afa85cd63","src/sys/unix/epoll.rs":"ea87ff5490616a8536878394201e8e3a1443746a7a3408a889c45d3cbd767f81","src/sys/unix/eventedfd.rs":"a0bd2096ab5acf42c48110f024bc8ea052ba62c707345c7db46fea7a494388df","src/sys/unix/io.rs":"a518f09020f821e87bcf9c2ecb4bf501d428619ddfd7b35a26629b614919b14c","src/sys/unix/kqueue.rs":"3bf9f9635a8607569e3176998b61d1801e5bb35a94588c827a0a954656eee3ea","src/sys/unix/mod.rs":"15ddcfab101e7dfb926f82fd2d6eebb30c66f43fc2af00e4bb2f687c7059e0d0","src/sys/unix/ready.rs":"8494e27731d6842a90e01ec783d37001802f472f81358177e047d43b4bc68c43","src/sys/unix/tcp.rs":"19d483762fc8c8a1cb182b2f2ead85534f99394cf605a14d5ed46db7f3354667","src/sys/unix/udp.rs":"bc2e8ad142b17797a7d038e720ff57ac9840eb5b2b26696c854180085ccd1873","src/sys/unix/uds.rs":"5223d4d35048019d175679686cc65a08baf027df0b2127428e2f322bbb533309","src/sys/unix/uio.rs":"3942a49548dd3a37e5fd6044a103d92e2635965ace1ab370be10c82245b41f66","src/sys/windows/awakener.rs":"2d3cdaf8b523675e2f64c5fd81e1197d5255384517b9753b718c5c47acf0cabd","src/sys/windows/buffer_pool.rs":"636f4b7510a507f9985987699ce8ec140b2ed852abb231443ee1486c80759eed","src/sys/windows/from_raw_arc.rs":"659dabdf5037546e3783aacc422992b4248b0ba2ddcce52b149d35bc723550e5","src/sys/windows/mod.rs":"afeec8cd4e3adeaf6ffe68b134ad1b4ba07faa3abae96f6f9a00bbc20ff5f2c5","src/sys/windows/selector.rs":"0137276cff457f84511e007bb9527f5e082ec04e898b8f8e0acd39fe65c00148","src/sys/windows/tcp.rs":"9942db351f91229d01a0b9f52dd6c9680050d3abcee9fbb6b4f2f14896dc2c58","src/sys/windows/udp.rs":"1ef869b660bcf89ea6498552474abf8f540946631e14d5b610ca31014cd9045f","src/timer.rs":"540d521c5b4a79f3b1c01296ef2e14e2e3743192f25180ee6e71e367692ce762","src/token.rs":"4a56f851709470df2eed803c57c68b0a4b12ea86fa1b8d2c999bec7a85d58ec0","src/udp.rs":"442e620f3ea0cf010497d3ad775debd585f28e79a025993d40471c8e6839dc98"},"package":"fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"} \ No newline at end of file diff --git a/third_party/cargo/vendor/mio-0.6.21/BUILD b/third_party/cargo/vendor/mio-0.6.22/BUILD similarity index 84% rename from third_party/cargo/vendor/mio-0.6.21/BUILD rename to third_party/cargo/vendor/mio-0.6.22/BUILD index b6110da..4ec1fe0 100644 --- a/third_party/cargo/vendor/mio-0.6.21/BUILD +++ b/third_party/cargo/vendor/mio-0.6.22/BUILD @@ -23,7 +23,6 @@ load( ) -# Unsupported target "bench_poll" with type "bench" omitted rust_library( name = "mio", @@ -34,15 +33,15 @@ rust_library( deps = [ "//third_party/cargo/vendor/cfg-if-0.1.10:cfg_if", "//third_party/cargo/vendor/iovec-0.1.4:iovec", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/log-0.4.8:log", - "//third_party/cargo/vendor/net2-0.2.33:net2", + "//third_party/cargo/vendor/net2-0.2.34:net2", "//third_party/cargo/vendor/slab-0.4.2:slab", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.6.21", + version = "0.6.22", crate_features = [ "default", "with-deprecated", diff --git a/third_party/cargo/vendor/mio-0.6.21/CHANGELOG.md b/third_party/cargo/vendor/mio-0.6.22/CHANGELOG.md similarity index 98% rename from third_party/cargo/vendor/mio-0.6.21/CHANGELOG.md rename to third_party/cargo/vendor/mio-0.6.22/CHANGELOG.md index 556bd90..bfb1af7 100644 --- a/third_party/cargo/vendor/mio-0.6.21/CHANGELOG.md +++ b/third_party/cargo/vendor/mio-0.6.22/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.6.22 (May 01, 2020) + +### Added +- Add support for illumos target (#1294) + # 0.6.21 (November 27, 2019) ### Fixed diff --git a/third_party/cargo/vendor/mio-0.6.21/Cargo.toml b/third_party/cargo/vendor/mio-0.6.22/Cargo.toml similarity index 86% rename from third_party/cargo/vendor/mio-0.6.21/Cargo.toml rename to third_party/cargo/vendor/mio-0.6.22/Cargo.toml index 7281548..8353e0c 100644 --- a/third_party/cargo/vendor/mio-0.6.21/Cargo.toml +++ b/third_party/cargo/vendor/mio-0.6.22/Cargo.toml @@ -12,17 +12,17 @@ [package] name = "mio" -version = "0.6.21" +version = "0.6.22" authors = ["Carl Lerche "] -exclude = [".gitignore", ".travis.yml", "deploy.sh"] +include = ["Cargo.toml", "LICENSE", "README.md", "CHANGELOG.md", "src/**/*.rs"] description = "Lightweight non-blocking IO" -homepage = "https://github.com/carllerche/mio" -documentation = "https://docs.rs/mio/0.6.21/mio/" +homepage = "https://github.com/tokio-rs/mio" +documentation = "https://docs.rs/mio/0.6.22/mio/" readme = "README.md" keywords = ["io", "async", "non-blocking"] categories = ["asynchronous"] license = "MIT" -repository = "https://github.com/carllerche/mio" +repository = "https://github.com/tokio-rs/mio" [[test]] name = "test" @@ -60,7 +60,7 @@ version = "0.3.2" [target."cfg(target_os = \"fuchsia\")".dependencies.fuchsia-zircon-sys] version = "0.3.2" [target."cfg(unix)".dependencies.libc] -version = "0.2.42" +version = "0.2.54" [target."cfg(windows)".dependencies.kernel32-sys] version = "0.2" diff --git a/third_party/cargo/vendor/mio-0.6.21/LICENSE b/third_party/cargo/vendor/mio-0.6.22/LICENSE similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/LICENSE rename to third_party/cargo/vendor/mio-0.6.22/LICENSE diff --git a/third_party/cargo/vendor/mio-0.6.21/README.md b/third_party/cargo/vendor/mio-0.6.22/README.md similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/README.md rename to third_party/cargo/vendor/mio-0.6.22/README.md diff --git a/third_party/cargo/vendor/mio-0.6.21/src/channel.rs b/third_party/cargo/vendor/mio-0.6.22/src/channel.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/channel.rs rename to third_party/cargo/vendor/mio-0.6.22/src/channel.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/deprecated/event_loop.rs b/third_party/cargo/vendor/mio-0.6.22/src/deprecated/event_loop.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/deprecated/event_loop.rs rename to third_party/cargo/vendor/mio-0.6.22/src/deprecated/event_loop.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/deprecated/handler.rs b/third_party/cargo/vendor/mio-0.6.22/src/deprecated/handler.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/deprecated/handler.rs rename to third_party/cargo/vendor/mio-0.6.22/src/deprecated/handler.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/deprecated/io.rs b/third_party/cargo/vendor/mio-0.6.22/src/deprecated/io.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/deprecated/io.rs rename to third_party/cargo/vendor/mio-0.6.22/src/deprecated/io.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/deprecated/mod.rs b/third_party/cargo/vendor/mio-0.6.22/src/deprecated/mod.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/deprecated/mod.rs rename to third_party/cargo/vendor/mio-0.6.22/src/deprecated/mod.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/deprecated/notify.rs b/third_party/cargo/vendor/mio-0.6.22/src/deprecated/notify.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/deprecated/notify.rs rename to third_party/cargo/vendor/mio-0.6.22/src/deprecated/notify.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/deprecated/unix.rs b/third_party/cargo/vendor/mio-0.6.22/src/deprecated/unix.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/deprecated/unix.rs rename to third_party/cargo/vendor/mio-0.6.22/src/deprecated/unix.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/event_imp.rs b/third_party/cargo/vendor/mio-0.6.22/src/event_imp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/event_imp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/event_imp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/io.rs b/third_party/cargo/vendor/mio-0.6.22/src/io.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/io.rs rename to third_party/cargo/vendor/mio-0.6.22/src/io.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/lazycell.rs b/third_party/cargo/vendor/mio-0.6.22/src/lazycell.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/lazycell.rs rename to third_party/cargo/vendor/mio-0.6.22/src/lazycell.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/lib.rs b/third_party/cargo/vendor/mio-0.6.22/src/lib.rs similarity index 99% rename from third_party/cargo/vendor/mio-0.6.21/src/lib.rs rename to third_party/cargo/vendor/mio-0.6.22/src/lib.rs index 1d2f500..6b57296 100644 --- a/third_party/cargo/vendor/mio-0.6.21/src/lib.rs +++ b/third_party/cargo/vendor/mio-0.6.22/src/lib.rs @@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/mio/0.6.21")] +#![doc(html_root_url = "https://docs.rs/mio/0.6.22")] // Mio targets old versions of the Rust compiler. In order to do this, uses // deprecated APIs. #![allow(bare_trait_objects, deprecated, unknown_lints)] diff --git a/third_party/cargo/vendor/mio-0.6.21/src/net/mod.rs b/third_party/cargo/vendor/mio-0.6.22/src/net/mod.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/net/mod.rs rename to third_party/cargo/vendor/mio-0.6.22/src/net/mod.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/net/tcp.rs b/third_party/cargo/vendor/mio-0.6.22/src/net/tcp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/net/tcp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/net/tcp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/net/udp.rs b/third_party/cargo/vendor/mio-0.6.22/src/net/udp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/net/udp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/net/udp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/poll.rs b/third_party/cargo/vendor/mio-0.6.22/src/poll.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/poll.rs rename to third_party/cargo/vendor/mio-0.6.22/src/poll.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/awakener.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/awakener.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/awakener.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/awakener.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/eventedfd.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/eventedfd.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/eventedfd.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/eventedfd.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/handles.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/handles.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/handles.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/handles.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/mod.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/mod.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/mod.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/mod.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/net.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/net.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/net.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/net.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/ready.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/ready.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/ready.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/ready.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/selector.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/selector.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/fuchsia/selector.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/fuchsia/selector.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/mod.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/mod.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/mod.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/mod.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/awakener.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/awakener.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/awakener.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/awakener.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/dlsym.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/dlsym.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/dlsym.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/dlsym.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/epoll.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/epoll.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/epoll.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/epoll.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/eventedfd.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/eventedfd.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/eventedfd.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/eventedfd.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/io.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/io.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/io.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/io.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/kqueue.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/kqueue.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/kqueue.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/kqueue.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/mod.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/mod.rs similarity index 91% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/mod.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/mod.rs index 5bb8307..c5726c0 100644 --- a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/mod.rs +++ b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/mod.rs @@ -3,10 +3,20 @@ use libc::{self, c_int}; #[macro_use] pub mod dlsym; -#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))] +#[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" +))] mod epoll; -#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))] +#[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" +))] pub use self::epoll::{Events, Selector}; #[cfg(any(target_os = "bitrig", target_os = "dragonfly", diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/ready.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/ready.rs similarity index 93% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/ready.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/ready.rs index 1780cea..ef90147 100644 --- a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/ready.rs +++ b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/ready.rs @@ -109,10 +109,20 @@ const LIO: usize = 0b10_0000; #[cfg(not(any(target_os = "freebsd")))] const LIO: usize = 0b00_0000; -#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))] +#[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" +))] const PRI: usize = 0b100_0000; -#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "solaris")))] +#[cfg(not(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" +)))] const PRI: usize = 0; // Export to support `Ready::all` @@ -129,7 +139,12 @@ fn test_ready_all() { ); // Issue #896. - #[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))] + #[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" + ))] assert!(!Ready::from(UnixReady::priority()).is_writable()); } @@ -258,8 +273,12 @@ impl UnixReady { /// /// [`Poll`]: struct.Poll.html #[inline] - #[cfg(any(target_os = "linux", - target_os = "android", target_os = "solaris"))] + #[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" + ))] pub fn priority() -> UnixReady { UnixReady(ready_from_usize(PRI)) } @@ -385,8 +404,12 @@ impl UnixReady { /// /// [`Poll`]: struct.Poll.html #[inline] - #[cfg(any(target_os = "linux", - target_os = "android", target_os = "solaris"))] + #[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" + ))] pub fn is_priority(&self) -> bool { self.contains(ready_from_usize(PRI)) } @@ -476,8 +499,12 @@ impl fmt::Debug for UnixReady { (UnixReady::hup(), "Hup"), #[allow(deprecated)] (UnixReady::aio(), "Aio"), - #[cfg(any(target_os = "linux", - target_os = "android", target_os = "solaris"))] + #[cfg(any( + target_os = "android", + target_os = "illumos", + target_os = "linux", + target_os = "solaris" + ))] (UnixReady::priority(), "Priority"), ]; diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/tcp.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/tcp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/tcp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/tcp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/udp.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/udp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/udp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/udp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/uds.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/uds.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/uds.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/uds.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/unix/uio.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/unix/uio.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/unix/uio.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/unix/uio.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/awakener.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/awakener.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/awakener.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/awakener.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/buffer_pool.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/buffer_pool.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/buffer_pool.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/buffer_pool.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/from_raw_arc.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/from_raw_arc.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/from_raw_arc.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/from_raw_arc.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/mod.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/mod.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/mod.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/mod.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/selector.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/selector.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/selector.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/selector.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/tcp.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/tcp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/tcp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/tcp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/sys/windows/udp.rs b/third_party/cargo/vendor/mio-0.6.22/src/sys/windows/udp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/sys/windows/udp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/sys/windows/udp.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/timer.rs b/third_party/cargo/vendor/mio-0.6.22/src/timer.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/timer.rs rename to third_party/cargo/vendor/mio-0.6.22/src/timer.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/token.rs b/third_party/cargo/vendor/mio-0.6.22/src/token.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/token.rs rename to third_party/cargo/vendor/mio-0.6.22/src/token.rs diff --git a/third_party/cargo/vendor/mio-0.6.21/src/udp.rs b/third_party/cargo/vendor/mio-0.6.22/src/udp.rs similarity index 100% rename from third_party/cargo/vendor/mio-0.6.21/src/udp.rs rename to third_party/cargo/vendor/mio-0.6.22/src/udp.rs diff --git a/third_party/cargo/vendor/mio-extras-2.0.6/BUILD b/third_party/cargo/vendor/mio-extras-2.0.6/BUILD index 0a3e1a5..8ccbb3b 100644 --- a/third_party/cargo/vendor/mio-extras-2.0.6/BUILD +++ b/third_party/cargo/vendor/mio-extras-2.0.6/BUILD @@ -33,7 +33,7 @@ rust_library( deps = [ "//third_party/cargo/vendor/lazycell-1.2.1:lazycell", "//third_party/cargo/vendor/log-0.4.8:log", - "//third_party/cargo/vendor/mio-0.6.21:mio", + "//third_party/cargo/vendor/mio-0.6.22:mio", "//third_party/cargo/vendor/slab-0.4.2:slab", ], rustc_flags = [ diff --git a/third_party/cargo/vendor/miow-0.2.1/BUILD b/third_party/cargo/vendor/miow-0.2.1/BUILD index d79000d..990ec68 100644 --- a/third_party/cargo/vendor/miow-0.2.1/BUILD +++ b/third_party/cargo/vendor/miow-0.2.1/BUILD @@ -32,7 +32,7 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/kernel32-sys-0.2.2:kernel32_sys", - "//third_party/cargo/vendor/net2-0.2.33:net2", + "//third_party/cargo/vendor/net2-0.2.34:net2", "//third_party/cargo/vendor/winapi-0.2.8:winapi", "//third_party/cargo/vendor/ws2_32-sys-0.2.1:ws2_32_sys", ], diff --git a/third_party/cargo/vendor/ndk-0.1.0/.cargo-checksum.json b/third_party/cargo/vendor/ndk-0.1.0/.cargo-checksum.json new file mode 100644 index 0000000..fd852fc --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"874f91629a80093eea16a9ba6af52e0939bdafd8edc1fe32d2ac2a320fbeaf79","src/asset.rs":"78bde79e285511eceae8a5245f9e8e5625e8a34f6c6eddebeb57965976ea46c0","src/configuration.rs":"a3fb637fb6cff2d9f2272c635517be319ebca02e78845b557c765ca5bd5cfc6f","src/event.rs":"c8aebb742539cfc007f73c37529bcf1f4686b945b4e60438a9bb9a34eea407e2","src/input_queue.rs":"f8d57c10a45231c64cb872c273583ca44a9f66dde2d23e6788fda33d86759967","src/lib.rs":"3d9e5a4eda72b2d8cfcfa0156c42788139da409abb1787c0d42bce7c86c3e9a7","src/looper.rs":"fbd4df0df7319289aa900dd56ce19e1bcb216a7bc2486921933e3323e93af2cf","src/native_activity.rs":"f256723440ac33b06014c4904f5dab09a90d3b22caa1ceacf99b6b113a28e285","src/native_window.rs":"a93759a7750a9f6f2ef1f18871dd0dc620d9c3fa03ddc64509793e74b5bd3702"},"package":"95a356cafe20aee088789830bfea3a61336e84ded9e545e00d3869ce95dcb80c"} \ No newline at end of file diff --git a/third_party/cargo/vendor/ndk-0.1.0/BUILD b/third_party/cargo/vendor/ndk-0.1.0/BUILD new file mode 100644 index 0000000..f876ac4 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "ndk", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/jni-sys-0.3.0:jni_sys", + "//third_party/cargo/vendor/ndk-sys-0.1.0:ndk_sys", + "//third_party/cargo/vendor/num_enum-0.4.3:num_enum", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.0", + crate_features = [ + ], +) + diff --git a/third_party/cargo/vendor/ndk-0.1.0/Cargo.toml b/third_party/cargo/vendor/ndk-0.1.0/Cargo.toml new file mode 100644 index 0000000..77e5ced --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/Cargo.toml @@ -0,0 +1,46 @@ +# 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 = "ndk" +version = "0.1.0" +authors = ["Mark Barbone "] +description = "Safe Rust bindings to the Android NDK" +homepage = "https://github.com/rust-windowing/android-ndk-rs" +documentation = "https://docs.rs/android-ndk" +readme = "../README.md" +keywords = ["android", "ndk"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/rust-windowing/android-ndk-rs" +[package.metadata.docs.rs] +features = ["rustdoc"] +[dependencies.ffi] +version = "0.1" +package = "ndk-sys" + +[dependencies.jni] +version = "0.14.0" +optional = true + +[dependencies.jni-glue] +version = "0.0.10" +optional = true + +[dependencies.jni-sys] +version = "0.3.0" + +[dependencies.num_enum] +version = "0.4.2" + +[features] +rustdoc = ["ffi/rustdoc", "jni", "jni-glue"] diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/asset.rs b/third_party/cargo/vendor/ndk-0.1.0/src/asset.rs new file mode 100644 index 0000000..76011a6 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/asset.rs @@ -0,0 +1,259 @@ +//! Assets +//! +//! See also [the NDK docs](https://developer.android.com/ndk/reference/group/asset) + +use std::ffi::{CStr, CString}; +use std::io; +use std::ptr::NonNull; + +/// A native `AAssetManager *`. +#[derive(Debug)] +pub struct AssetManager { + ptr: NonNull, +} + +// AAssetManager is thread safe. +// See https://developer.android.com/ndk/reference/group/asset#aassetmanager +unsafe impl Send for AssetManager {} +unsafe impl Sync for AssetManager {} + +impl AssetManager { + /// Create an `AssetManager` from a pointer + /// + /// By calling this function, you assert that the pointer is a valid pointer to a native + /// `AAssetManager`. + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// Returns the pointer to the native `AAssetManager`. + pub fn ptr(&self) -> NonNull { + self.ptr + } + + /// Open the asset. Returns `None` if opening the asset fails. + /// + /// This currently always opens the asset in the streaming mode. + pub fn open(&self, filename: &CStr) -> Option { + unsafe { + let ptr = ffi::AAssetManager_open( + self.ptr.as_ptr(), + filename.as_ptr(), + ffi::AASSET_MODE_STREAMING as i32, + ); + Some(Asset::from_ptr(NonNull::new(ptr)?)) + } + } + + /// Open an asset directory. Returns `None` if opening the directory fails. + pub fn open_dir(&self, filename: &CStr) -> Option { + unsafe { + let ptr = ffi::AAssetManager_openDir(self.ptr.as_ptr(), filename.as_ptr()); + Some(AssetDir::from_ptr(NonNull::new(ptr)?)) + } + } +} + +/// A native `AAssetDir *`. +/// +/// ```no_run +/// # use std::ffi::CString; +/// # use android_ndk::asset::AssetManager; +/// # let asset_manager: AssetManager = unimplemented!(); +/// use std::io::Read; +/// +/// let mut my_dir = asset_manager +/// .open_dir(&CString::new("my_dir").unwrap()) +/// .expect("Could not open directory"); +/// +/// // Use it as an iterator +/// let all_files = my_dir.collect::>(); +/// +/// // Reset the iterator +/// my_dir.rewind(); +/// +/// // Use .with_next() to iterate without allocating `CString`s +/// while let Some(asset) = my_dir.with_next(|cstr| asset_manager.open(cstr).unwrap()) { +/// let mut text = String::new(); +/// asset.read_to_string(&mut text); +/// // ... +/// } +/// ``` +#[derive(Debug)] +pub struct AssetDir { + ptr: NonNull, +} + +// It's unclear if AAssetDir is thread safe. +// However, AAsset is not, so there's a good chance that AAssetDir is not either. + +impl Drop for AssetDir { + fn drop(&mut self) { + unsafe { ffi::AAssetDir_close(self.ptr.as_ptr()) } + } +} + +impl AssetDir { + /// Construct an `AssetDir` from the native `AAssetDir *`. This gives ownership of the + /// `AAssetDir *` to the `AssetDir`, which will handle closing the asset. Avoid using + /// the pointer after calling this function. + /// + /// By calling this function, you assert that it points to a valid native `AAssetDir`. + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// The corresponding native `AAssetDir *` + pub fn ptr(&self) -> NonNull { + self.ptr + } + + /// Get the next filename, if any, and process it. Like `.next()`, but performs no additional + /// allocation. + /// + /// The filenames are in the correct format to be passed to `AssetManager::open` + pub fn with_next(&mut self, f: impl for<'a> FnOnce(&'a CStr) -> T) -> Option { + unsafe { + let next_name = ffi::AAssetDir_getNextFileName(self.ptr.as_ptr()); + if next_name.is_null() { + None + } else { + Some(f(CStr::from_ptr(next_name))) + } + } + } + + /// Reset the iteration state + pub fn rewind(&mut self) { + unsafe { + ffi::AAssetDir_rewind(self.ptr.as_ptr()); + } + } +} + +impl Iterator for AssetDir { + type Item = CString; + + fn next(&mut self) -> Option { + self.with_next(|cstr| cstr.to_owned()) + } +} + +/// A native `AAsset *`, open in the streaming mode +/// +/// ```no_run +/// # use std::ffi::CString; +/// # use android_ndk::asset::AssetManager; +/// # let asset_manager: AssetManager = unimplemented!(); +/// use std::io::Read; +/// +/// let asset = asset_manager +/// .open(&CString::new("path/to/asset").unwrap()) +/// .expect("Could not open asset"); +/// +/// let mut data = vec![]; +/// asset.read_to_end(&mut data); +/// // ... use data ... +/// ``` +#[derive(Debug)] +pub struct Asset { + ptr: NonNull, +} + +// AAsset is *not* thread safe. +// See https://developer.android.com/ndk/reference/group/asset#aasset + +impl Drop for Asset { + fn drop(&mut self) { + unsafe { ffi::AAsset_close(self.ptr.as_ptr()) } + } +} + +impl Asset { + /// Construct an `Asset` from the native `AAsset *`. This gives ownership of the `AAsset *` to + /// the `Asset`, which will handle closing the asset. Avoid using the pointer after calling + /// this function. + /// + /// By calling this function, you assert that it points to a valid native `AAsset`, open + /// in the streaming mode. + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// The corresponding native `AAsset *` + pub fn ptr(&self) -> NonNull { + self.ptr + } + + /// Returns the total length of the asset, in bytes + pub fn get_length(&self) -> usize { + unsafe { ffi::AAsset_getLength64(self.ptr.as_ptr()) as usize } + } + + /// Returns the remaining length of the asset, in bytes + pub fn get_remaining_length(&self) -> usize { + unsafe { ffi::AAsset_getRemainingLength64(self.ptr.as_ptr()) as usize } + } + + /// Reads all data into a buffer and returns it + pub fn get_buffer(&mut self) -> io::Result<&[u8]> { + unsafe { + let buf_ptr = ffi::AAsset_getBuffer(self.ptr.as_ptr()); + if buf_ptr.is_null() { + Err(io::Error::new( + io::ErrorKind::Other, + "Android Asset error creating buffer", + )) + } else { + Ok(std::slice::from_raw_parts( + buf_ptr as *const u8, + self.get_remaining_length(), + )) + } + } + } + + //pub fn open_file_descriptor(&self) -> TODO +} + +impl io::Read for Asset { + fn read(&mut self, buf: &mut [u8]) -> io::Result { + unsafe { + let res = ffi::AAsset_read(self.ptr.as_ptr(), buf.as_mut_ptr() as *mut _, buf.len()); + if res >= 0 { + Ok(res as usize) + } else { + Err(io::Error::new( + io::ErrorKind::Other, + "Android Asset read error", + )) + } + } + } +} + +impl io::Seek for Asset { + fn seek(&mut self, seek: io::SeekFrom) -> io::Result { + unsafe { + let res = match seek { + io::SeekFrom::Start(x) => { + ffi::AAsset_seek64(self.ptr.as_ptr(), x as i64, ffi::SEEK_SET as i32) + } + io::SeekFrom::Current(x) => { + ffi::AAsset_seek64(self.ptr.as_ptr(), x, ffi::SEEK_CUR as i32) + } + io::SeekFrom::End(x) => { + ffi::AAsset_seek64(self.ptr.as_ptr(), x, ffi::SEEK_END as i32) + } + }; + if res < 0 { + Err(io::Error::new( + io::ErrorKind::Other, + "Android Asset seek error", + )) + } else { + Ok(res as u64) + } + } + } +} diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/configuration.rs b/third_party/cargo/vendor/ndk-0.1.0/src/configuration.rs new file mode 100644 index 0000000..c4c0c80 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/configuration.rs @@ -0,0 +1,560 @@ +//! Bindings for `AConfiguration`. +//! +//! See also the [NDK docs](https://developer.android.com/ndk/reference/group/configuration) for +//! `AConfiguration`, as well as the [docs for providing +//! resources](https://developer.android.com/guide/topics/resources/providing-resources.html), +//! which explain many of the configuration values. The [`android.content.res.Configuration` +//! javadoc](https://developer.android.com/reference/android/content/res/Configuration.html) may +//! also have useful information. + +use crate::asset::AssetManager; +use num_enum::{IntoPrimitive, TryFromPrimitive}; +use std::convert::TryInto; +use std::fmt; +use std::ptr::NonNull; + +/// A native `AConfiguration *`. +/// +/// This stores information about configuration. See [the NDK +/// docs](https://developer.android.com/ndk/reference/group/configuration) +pub struct Configuration { + ptr: NonNull, +} + +unsafe impl Send for Configuration {} +unsafe impl Sync for Configuration {} + +impl Drop for Configuration { + fn drop(&mut self) { + unsafe { ffi::AConfiguration_delete(self.ptr.as_ptr()) } + } +} + +impl Clone for Configuration { + fn clone(&self) -> Self { + let mut new = Self::new(); + new.copy(self); + new + } +} + +impl PartialEq for Configuration { + fn eq(&self, other: &Self) -> bool { + self.diff(other).0 == 0 + } +} +impl Eq for Configuration {} + +impl fmt::Debug for Configuration { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("Configuration") + .field("mcc", &self.mcc()) + .field("mnc", &self.mnc()) + .field("lang", &self.language()) + .field("country", &self.country()) + .field("orientation", &self.orientation()) + .field("touchscreen", &self.touchscreen()) + .field("density", &self.density()) + .field("keyboard", &self.keyboard()) + .field("navigation", &self.navigation()) + .field("keys_hidden", &self.keys_hidden()) + .field("nav_hidden", &self.nav_hidden()) + .field("sdk_version", &self.sdk_version()) + .field("screen_size", &self.screen_size()) + .field("screen_long", &self.screen_long()) + .field("ui_mode_type", &self.ui_mode_type()) + .field("ui_mode_night", &self.ui_mode_night()) + .finish() + } +} + +impl Configuration { + /// Construct a `Configuration` from a pointer. + /// + /// By calling this function, you assert that it is a valid pointer to a native + /// `AConfiguration`, and give ownership of it to the `Configuration` instance. + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// Create a new `Configuration`, with the same contents as the `AConfiguration` referenced by + /// the pointer. + /// + /// This is useful if you have a pointer, but not ownership of it. + pub unsafe fn clone_from_ptr(ptr: NonNull) -> Self { + let conf = Self::new(); + ffi::AConfiguration_copy(conf.ptr.as_ptr(), ptr.as_ptr()); + conf + } + + /// The pointer to the native `AConfiguration`. Keep in mind that the `Configuration` object + /// still has ownership, and will free it when dropped. + pub fn ptr(&self) -> NonNull { + self.ptr + } + + pub fn from_asset_manager(am: &AssetManager) -> Self { + let config = Self::new(); + unsafe { + ffi::AConfiguration_fromAssetManager(config.ptr().as_mut(), am.ptr().as_mut()); + } + config + } + + /// Create a new `Configuration`, with none of the values set. + pub fn new() -> Self { + unsafe { + Self { + ptr: NonNull::new(ffi::AConfiguration_new()).unwrap(), + } + } + } + + /// `dest.copy(&src)` copies the contents of `src` to `dest` + pub fn copy(&mut self, other: &Self) { + unsafe { ffi::AConfiguration_copy(self.ptr.as_ptr(), other.ptr.as_ptr()) } + } + + /// Information about what fields differ between the two configurations + pub fn diff(&self, other: &Self) -> DiffResult { + unsafe { + DiffResult(ffi::AConfiguration_diff(self.ptr.as_ptr(), other.ptr.as_ptr()) as u32) + } + } + + /// Returns false if anything in `self` conflicts with `requested` + pub fn matches(&self, requested: &Self) -> bool { + unsafe { ffi::AConfiguration_match(self.ptr.as_ptr(), requested.ptr.as_ptr()) != 0 } + } + + /// Returns the country code. It will always be two letters. + pub fn country(&self) -> String { + let mut result = " ".to_owned(); + unsafe { + ffi::AConfiguration_getCountry(self.ptr.as_ptr(), result.as_mut_ptr() as *mut _); + } + result + } + + /// Returns the screen density in dpi. + /// + /// On some devices it can return values outside of the density enum. + pub fn density(&self) -> Option { + let density = unsafe { ffi::AConfiguration_getDensity(self.ptr.as_ptr()) as u32 }; + match density { + ffi::ACONFIGURATION_DENSITY_DEFAULT => Some(160), + ffi::ACONFIGURATION_DENSITY_ANY => None, + ffi::ACONFIGURATION_DENSITY_NONE => None, + density => Some(density), + } + } + + /// Returns the keyboard type. + pub fn keyboard(&self) -> Keyboard { + unsafe { + (ffi::AConfiguration_getKeyboard(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + /// Returns keyboard visibility/availability. + pub fn keys_hidden(&self) -> KeysHidden { + unsafe { + (ffi::AConfiguration_getKeysHidden(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + /// Returns the language, as a `String` of two characters, if a language is set + pub fn language(&self) -> Option { + let mut chars = [0u8; 2]; + unsafe { + ffi::AConfiguration_getLanguage(self.ptr.as_ptr(), chars[..].as_mut_ptr() as *mut _); + } + if chars[0] == 0 { + None + } else { + Some(std::str::from_utf8(&chars[..]).unwrap().to_owned()) + } + } + + /// Returns the layout direction + pub fn layout_direction(&self) -> LayoutDir { + unsafe { + (ffi::AConfiguration_getLayoutDirection(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + /// Returns the mobile country code. + pub fn mcc(&self) -> i32 { + unsafe { ffi::AConfiguration_getMcc(self.ptr.as_ptr()) } + } + + /// Returns the mobile network code, if one is defined + pub fn mnc(&self) -> Option { + unsafe { + match ffi::AConfiguration_getMnc(self.ptr.as_ptr()) { + 0 => None, + x if x == ffi::ACONFIGURATION_MNC_ZERO as i32 => Some(0), + x => Some(x), + } + } + } + + pub fn nav_hidden(&self) -> NavHidden { + unsafe { + (ffi::AConfiguration_getNavHidden(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn navigation(&self) -> Navigation { + unsafe { + (ffi::AConfiguration_getNavigation(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn orientation(&self) -> Orientation { + unsafe { + (ffi::AConfiguration_getOrientation(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn screen_height_dp(&self) -> Option { + unsafe { + let height = ffi::AConfiguration_getScreenHeightDp(self.ptr.as_ptr()); + if height == ffi::ACONFIGURATION_SCREEN_HEIGHT_DP_ANY as i32 { + None + } else { + Some(height) + } + } + } + + pub fn screen_width_dp(&self) -> Option { + unsafe { + let width = ffi::AConfiguration_getScreenWidthDp(self.ptr.as_ptr()); + if width == ffi::ACONFIGURATION_SCREEN_WIDTH_DP_ANY as i32 { + None + } else { + Some(width) + } + } + } + + pub fn screen_long(&self) -> ScreenLong { + unsafe { + (ffi::AConfiguration_getScreenLong(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn screen_round(&self) -> ScreenRound { + unsafe { + (ffi::AConfiguration_getScreenRound(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn screen_size(&self) -> ScreenSize { + unsafe { + (ffi::AConfiguration_getScreenSize(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn sdk_version(&self) -> i32 { + unsafe { ffi::AConfiguration_getSdkVersion(self.ptr.as_ptr()) } + } + + pub fn smallest_screen_width_dp(&self) -> Option { + unsafe { + let width = ffi::AConfiguration_getSmallestScreenWidthDp(self.ptr.as_ptr()); + if width == ffi::ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY as i32 { + None + } else { + Some(width) + } + } + } + + pub fn touchscreen(&self) -> Touchscreen { + unsafe { + (ffi::AConfiguration_getTouchscreen(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn ui_mode_night(&self) -> UiModeNight { + unsafe { + (ffi::AConfiguration_getUiModeNight(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } + + pub fn ui_mode_type(&self) -> UiModeType { + unsafe { + (ffi::AConfiguration_getUiModeType(self.ptr.as_ptr()) as u32) + .try_into() + .unwrap() + } + } +} + +/// A bitfield representing the differences between two `Configuration`s +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct DiffResult(pub u32); + +impl DiffResult { + pub fn mcc(self) -> bool { + self.0 & ffi::ACONFIGURATION_MCC != 0 + } + pub fn mnc(self) -> bool { + self.0 & ffi::ACONFIGURATION_MNC != 0 + } + pub fn locale(self) -> bool { + self.0 & ffi::ACONFIGURATION_LOCALE != 0 + } + pub fn touchscreen(self) -> bool { + self.0 & ffi::ACONFIGURATION_TOUCHSCREEN != 0 + } + pub fn keyboard(self) -> bool { + self.0 & ffi::ACONFIGURATION_KEYBOARD != 0 + } + pub fn keyboard_hidden(self) -> bool { + self.0 & ffi::ACONFIGURATION_KEYBOARD_HIDDEN != 0 + } + pub fn navigation(self) -> bool { + self.0 & ffi::ACONFIGURATION_NAVIGATION != 0 + } + pub fn orientation(self) -> bool { + self.0 & ffi::ACONFIGURATION_ORIENTATION != 0 + } + pub fn density(self) -> bool { + self.0 & ffi::ACONFIGURATION_DENSITY != 0 + } + pub fn screen_size(self) -> bool { + self.0 & ffi::ACONFIGURATION_SCREEN_SIZE != 0 + } + pub fn version(self) -> bool { + self.0 & ffi::ACONFIGURATION_VERSION != 0 + } + pub fn screen_layout(self) -> bool { + self.0 & ffi::ACONFIGURATION_SCREEN_LAYOUT != 0 + } + pub fn ui_mode(self) -> bool { + self.0 & ffi::ACONFIGURATION_UI_MODE != 0 + } + pub fn smallest_screen_size(self) -> bool { + self.0 & ffi::ACONFIGURATION_SMALLEST_SCREEN_SIZE != 0 + } + pub fn layout_dir(self) -> bool { + self.0 & ffi::ACONFIGURATION_LAYOUTDIR != 0 + } + pub fn screen_round(self) -> bool { + self.0 & ffi::ACONFIGURATION_SCREEN_ROUND != 0 + } + pub fn color_mode(self) -> bool { + self.0 & ffi::ACONFIGURATION_COLOR_MODE != 0 + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Orientation { + Any = ffi::ACONFIGURATION_ORIENTATION_ANY, + Port = ffi::ACONFIGURATION_ORIENTATION_PORT, + Land = ffi::ACONFIGURATION_ORIENTATION_LAND, + Square = ffi::ACONFIGURATION_ORIENTATION_SQUARE, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Touchscreen { + Any = ffi::ACONFIGURATION_TOUCHSCREEN_ANY, + NoTouch = ffi::ACONFIGURATION_TOUCHSCREEN_NOTOUCH, + Stylus = ffi::ACONFIGURATION_TOUCHSCREEN_STYLUS, + Finger = ffi::ACONFIGURATION_TOUCHSCREEN_FINGER, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Density { + Default = ffi::ACONFIGURATION_DENSITY_DEFAULT, + Low = ffi::ACONFIGURATION_DENSITY_LOW, + Medium = ffi::ACONFIGURATION_DENSITY_MEDIUM, + TV = ffi::ACONFIGURATION_DENSITY_TV, + High = ffi::ACONFIGURATION_DENSITY_HIGH, + XHigh = ffi::ACONFIGURATION_DENSITY_XHIGH, + XXHigh = ffi::ACONFIGURATION_DENSITY_XXHIGH, + XXXHigh = ffi::ACONFIGURATION_DENSITY_XXXHIGH, + Any = ffi::ACONFIGURATION_DENSITY_ANY, + None = ffi::ACONFIGURATION_DENSITY_NONE, +} + +impl Density { + /// The DPI associated with the density class. + /// See [the Android screen density + /// docs](https://developer.android.com/training/multiscreen/screendensities#TaskProvideAltBmp) + /// + /// There are some `Density` values that have no associated DPI; these values return `None`. + pub fn dpi(self) -> Option { + match self { + Self::Default => Some(160), // Or should it be None? + Self::Low => Some(120), + Self::Medium => Some(160), + Self::High => Some(240), + Self::XHigh => Some(320), + Self::XXHigh => Some(480), + Self::XXXHigh => Some(640), + Self::TV => Some(213), + Self::Any => None, + Self::None => None, + } + } + + /// The Hi-DPI factor associated with the density class. This is the factor by which an + /// image/resource should be scaled to match its size across devices. The baseline is a 160dpi + /// screen (i.e., Hi-DPI factor = DPI / 160). + /// See [the Android screen density + /// docs](https://developer.android.com/training/multiscreen/screendensities#TaskProvideAltBmp) + /// + /// There are some `Density` values that have no associated DPI; these values return `None`. + pub fn approx_hidpi_factor(self) -> Option { + match self { + Self::Default => Some(1.), // Or should it be None? + Self::Low => Some(0.75), + Self::Medium => Some(1.), + Self::High => Some(1.5), + Self::XHigh => Some(2.), + Self::XXHigh => Some(3.), + Self::XXXHigh => Some(4.), + Self::TV => Some(4. / 3.), + Self::Any => None, + Self::None => None, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Keyboard { + Any = ffi::ACONFIGURATION_KEYBOARD_ANY, + NoKeys = ffi::ACONFIGURATION_KEYBOARD_NOKEYS, + Qwerty = ffi::ACONFIGURATION_KEYBOARD_QWERTY, + TwelveKey = ffi::ACONFIGURATION_KEYBOARD_12KEY, +} + +// FIXME is it a bitmask? +// FIXME are they all bitmasks? +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Navigation { + Any = ffi::ACONFIGURATION_NAVIGATION_ANY, + NoNav = ffi::ACONFIGURATION_NAVIGATION_NONAV, + DPad = ffi::ACONFIGURATION_NAVIGATION_DPAD, + Trackball = ffi::ACONFIGURATION_NAVIGATION_TRACKBALL, + Wheel = ffi::ACONFIGURATION_NAVIGATION_WHEEL, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum KeysHidden { + Any = ffi::ACONFIGURATION_KEYSHIDDEN_ANY, + No = ffi::ACONFIGURATION_KEYSHIDDEN_NO, + Yes = ffi::ACONFIGURATION_KEYSHIDDEN_YES, + Soft = ffi::ACONFIGURATION_KEYSHIDDEN_SOFT, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum NavHidden { + Any = ffi::ACONFIGURATION_NAVHIDDEN_ANY, + No = ffi::ACONFIGURATION_NAVHIDDEN_NO, + Yes = ffi::ACONFIGURATION_NAVHIDDEN_YES, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum ScreenSize { + Any = ffi::ACONFIGURATION_SCREENSIZE_ANY, + Small = ffi::ACONFIGURATION_SCREENSIZE_SMALL, + Normal = ffi::ACONFIGURATION_SCREENSIZE_NORMAL, + Large = ffi::ACONFIGURATION_SCREENSIZE_LARGE, + XLarge = ffi::ACONFIGURATION_SCREENSIZE_XLARGE, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum ScreenLong { + Any = ffi::ACONFIGURATION_SCREENLONG_ANY, + No = ffi::ACONFIGURATION_SCREENLONG_NO, + Yes = ffi::ACONFIGURATION_SCREENLONG_YES, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum ScreenRound { + Any = ffi::ACONFIGURATION_SCREENROUND_ANY, + No = ffi::ACONFIGURATION_SCREENROUND_NO, + Yes = ffi::ACONFIGURATION_SCREENROUND_YES, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum WideColorGamut { + Any = ffi::ACONFIGURATION_WIDE_COLOR_GAMUT_ANY, + No = ffi::ACONFIGURATION_WIDE_COLOR_GAMUT_NO, + Yes = ffi::ACONFIGURATION_WIDE_COLOR_GAMUT_YES, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum HDR { + Any = ffi::ACONFIGURATION_HDR_ANY, + No = ffi::ACONFIGURATION_HDR_NO, + Yes = ffi::ACONFIGURATION_HDR_YES, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum LayoutDir { + Any = ffi::ACONFIGURATION_LAYOUTDIR_ANY, + Ltr = ffi::ACONFIGURATION_LAYOUTDIR_LTR, + Rtl = ffi::ACONFIGURATION_LAYOUTDIR_RTL, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum UiModeType { + Any = ffi::ACONFIGURATION_UI_MODE_TYPE_ANY, + Normal = ffi::ACONFIGURATION_UI_MODE_TYPE_NORMAL, + Desk = ffi::ACONFIGURATION_UI_MODE_TYPE_DESK, + Car = ffi::ACONFIGURATION_UI_MODE_TYPE_CAR, + Television = ffi::ACONFIGURATION_UI_MODE_TYPE_TELEVISION, + Applicance = ffi::ACONFIGURATION_UI_MODE_TYPE_APPLIANCE, + Watch = ffi::ACONFIGURATION_UI_MODE_TYPE_WATCH, + VrHeadset = ffi::ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum UiModeNight { + Any = ffi::ACONFIGURATION_UI_MODE_NIGHT_ANY, + No = ffi::ACONFIGURATION_UI_MODE_NIGHT_NO, + Yes = ffi::ACONFIGURATION_UI_MODE_NIGHT_YES, +} diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/event.rs b/third_party/cargo/vendor/ndk-0.1.0/src/event.rs new file mode 100644 index 0000000..d7e1521 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/event.rs @@ -0,0 +1,1461 @@ +//! A wrapper around the NDK's `AInputEvent.` +//! +//! Most of these operations directly wrap functions in the NDK. Documentation for all NDK +//! functions in this module can be found +//! [here](https://developer.android.com/ndk/reference/group/input). See also the javadocs for +//! [`android.view.InputEvent`](https://developer.android.com/reference/android/view/InputEvent.html), +//! [`android.view.MotionEvent`](https://developer.android.com/reference/android/view/MotionEvent.html), +//! and [`android.view.KeyEvent`](https://developer.android.com/reference/android/view/KeyEvent). + +use num_enum::{IntoPrimitive, TryFromPrimitive}; +use std::convert::TryInto; +use std::ptr::NonNull; + +/// A `const AInputEvent *` +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#ainputevent) +#[derive(Debug)] +pub enum InputEvent { + MotionEvent(MotionEvent), + KeyEvent(KeyEvent), +} + +/// An enum representing the source of an `InputEvent`. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-36) +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Source { + Unknown = ffi::AINPUT_SOURCE_UNKNOWN, + Keyboard = ffi::AINPUT_SOURCE_KEYBOARD, + Dpad = ffi::AINPUT_SOURCE_DPAD, + Gamepad = ffi::AINPUT_SOURCE_GAMEPAD, + Touchscreen = ffi::AINPUT_SOURCE_TOUCHSCREEN, + Mouse = ffi::AINPUT_SOURCE_MOUSE, + Stylus = ffi::AINPUT_SOURCE_STYLUS, + BluetoothStylus = ffi::AINPUT_SOURCE_BLUETOOTH_STYLUS, + Trackball = ffi::AINPUT_SOURCE_TRACKBALL, + MouseRelative = ffi::AINPUT_SOURCE_MOUSE_RELATIVE, + Touchpad = ffi::AINPUT_SOURCE_TOUCHPAD, + TouchNavigation = ffi::AINPUT_SOURCE_TOUCH_NAVIGATION, + Joystick = ffi::AINPUT_SOURCE_JOYSTICK, + RotaryEncoder = ffi::AINPUT_SOURCE_ROTARY_ENCODER, + Any = ffi::AINPUT_SOURCE_ANY, +} + +/// An enum representing the class of an `InputEvent` source +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-35) +#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +enum Class { + None = ffi::AINPUT_SOURCE_CLASS_NONE, + Button = ffi::AINPUT_SOURCE_CLASS_BUTTON, + Pointer = ffi::AINPUT_SOURCE_CLASS_POINTER, + Navigation = ffi::AINPUT_SOURCE_CLASS_NAVIGATION, + Position = ffi::AINPUT_SOURCE_CLASS_POSITION, + Joystick = ffi::AINPUT_SOURCE_CLASS_JOYSTICK, +} + +impl InputEvent { + /// Initialize an `InputEvent` from a pointer + /// + /// By calling this function, you assert that the pointer is a valid pointer to a + /// native `AInputEvent`. + #[inline] + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + match ffi::AInputEvent_getType(ptr.as_ptr()) as u32 { + ffi::AINPUT_EVENT_TYPE_KEY => InputEvent::KeyEvent(KeyEvent::from_ptr(ptr)), + ffi::AINPUT_EVENT_TYPE_MOTION => InputEvent::MotionEvent(MotionEvent::from_ptr(ptr)), + x => panic!("Bad event type received: {}", x), + } + } + + /// Returns a pointer to the native `AInputEvent`. + #[inline] + pub fn ptr(&self) -> NonNull { + match self { + InputEvent::MotionEvent(MotionEvent { ptr }) => *ptr, + InputEvent::KeyEvent(KeyEvent { ptr }) => *ptr, + } + } + + /// Get the source of the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getsource) + #[inline] + pub fn source(&self) -> Source { + let source = unsafe { ffi::AInputEvent_getSource(self.ptr().as_ptr()) as u32 }; + source.try_into().unwrap_or(Source::Unknown) + } + + /// Get the device id associated with the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getdeviceid) + #[inline] + pub fn device_id(&self) -> i32 { + unsafe { ffi::AInputEvent_getDeviceId(self.ptr().as_ptr()) } + } +} + +/// A bitfield representing the state of modifier keys during an event. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-25) +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct MetaState(pub u32); + +impl MetaState { + #[inline] + pub fn alt_on(self) -> bool { + self.0 & ffi::AMETA_ALT_ON != 0 + } + #[inline] + pub fn alt_left_on(self) -> bool { + self.0 & ffi::AMETA_ALT_LEFT_ON != 0 + } + #[inline] + pub fn alt_right_on(self) -> bool { + self.0 & ffi::AMETA_ALT_RIGHT_ON != 0 + } + #[inline] + pub fn shift_on(self) -> bool { + self.0 & ffi::AMETA_SHIFT_ON != 0 + } + #[inline] + pub fn shift_left_on(self) -> bool { + self.0 & ffi::AMETA_SHIFT_LEFT_ON != 0 + } + #[inline] + pub fn shift_right_on(self) -> bool { + self.0 & ffi::AMETA_SHIFT_RIGHT_ON != 0 + } + #[inline] + pub fn sym_on(self) -> bool { + self.0 & ffi::AMETA_SYM_ON != 0 + } + #[inline] + pub fn function_on(self) -> bool { + self.0 & ffi::AMETA_FUNCTION_ON != 0 + } + #[inline] + pub fn ctrl_on(self) -> bool { + self.0 & ffi::AMETA_CTRL_ON != 0 + } + #[inline] + pub fn ctrl_left_on(self) -> bool { + self.0 & ffi::AMETA_CTRL_LEFT_ON != 0 + } + #[inline] + pub fn ctrl_right_on(self) -> bool { + self.0 & ffi::AMETA_CTRL_RIGHT_ON != 0 + } + #[inline] + pub fn meta_on(self) -> bool { + self.0 & ffi::AMETA_META_ON != 0 + } + #[inline] + pub fn meta_left_on(self) -> bool { + self.0 & ffi::AMETA_META_LEFT_ON != 0 + } + #[inline] + pub fn meta_right_on(self) -> bool { + self.0 & ffi::AMETA_META_RIGHT_ON != 0 + } + #[inline] + pub fn caps_lock_on(self) -> bool { + self.0 & ffi::AMETA_CAPS_LOCK_ON != 0 + } + #[inline] + pub fn num_lock_on(self) -> bool { + self.0 & ffi::AMETA_NUM_LOCK_ON != 0 + } + #[inline] + pub fn scroll_lock_on(self) -> bool { + self.0 & ffi::AMETA_SCROLL_LOCK_ON != 0 + } +} + +/// A motion event. +/// +/// For general discussion of motion events in Android, see [the relevant +/// javadoc](https://developer.android.com/reference/android/view/MotionEvent). +#[derive(Clone, Debug)] +pub struct MotionEvent { + ptr: NonNull, +} + +// TODO: thread safety? + +/// A motion action. +/// +/// See [the NDK +/// docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-29) +#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum MotionAction { + Down = ffi::AMOTION_EVENT_ACTION_DOWN, + Up = ffi::AMOTION_EVENT_ACTION_UP, + Move = ffi::AMOTION_EVENT_ACTION_MOVE, + Cancel = ffi::AMOTION_EVENT_ACTION_CANCEL, + Outside = ffi::AMOTION_EVENT_ACTION_OUTSIDE, + PointerDown = ffi::AMOTION_EVENT_ACTION_POINTER_DOWN, + PointerUp = ffi::AMOTION_EVENT_ACTION_POINTER_UP, + HoverMove = ffi::AMOTION_EVENT_ACTION_HOVER_MOVE, + Scroll = ffi::AMOTION_EVENT_ACTION_SCROLL, + HoverEnter = ffi::AMOTION_EVENT_ACTION_HOVER_ENTER, + HoverExit = ffi::AMOTION_EVENT_ACTION_HOVER_EXIT, + ButtonPress = ffi::AMOTION_EVENT_ACTION_BUTTON_PRESS, + ButtonRelease = ffi::AMOTION_EVENT_ACTION_BUTTON_RELEASE, +} + +/// An axis of a motion event. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-32) +#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Axis { + X = ffi::AMOTION_EVENT_AXIS_X, + Y = ffi::AMOTION_EVENT_AXIS_Y, + Pressure = ffi::AMOTION_EVENT_AXIS_PRESSURE, + Size = ffi::AMOTION_EVENT_AXIS_SIZE, + TouchMajor = ffi::AMOTION_EVENT_AXIS_TOUCH_MAJOR, + TouchMinor = ffi::AMOTION_EVENT_AXIS_TOUCH_MINOR, + ToolMajor = ffi::AMOTION_EVENT_AXIS_TOOL_MAJOR, + ToolMinor = ffi::AMOTION_EVENT_AXIS_TOOL_MINOR, + Orientation = ffi::AMOTION_EVENT_AXIS_ORIENTATION, + Vscroll = ffi::AMOTION_EVENT_AXIS_VSCROLL, + Hscroll = ffi::AMOTION_EVENT_AXIS_HSCROLL, + Z = ffi::AMOTION_EVENT_AXIS_Z, + Rx = ffi::AMOTION_EVENT_AXIS_RX, + Ry = ffi::AMOTION_EVENT_AXIS_RY, + Rz = ffi::AMOTION_EVENT_AXIS_RZ, + HatX = ffi::AMOTION_EVENT_AXIS_HAT_X, + HatY = ffi::AMOTION_EVENT_AXIS_HAT_Y, + Ltrigger = ffi::AMOTION_EVENT_AXIS_LTRIGGER, + Rtrigger = ffi::AMOTION_EVENT_AXIS_RTRIGGER, + Throttle = ffi::AMOTION_EVENT_AXIS_THROTTLE, + Rudder = ffi::AMOTION_EVENT_AXIS_RUDDER, + Wheel = ffi::AMOTION_EVENT_AXIS_WHEEL, + Gas = ffi::AMOTION_EVENT_AXIS_GAS, + Brake = ffi::AMOTION_EVENT_AXIS_BRAKE, + Distance = ffi::AMOTION_EVENT_AXIS_DISTANCE, + Tilt = ffi::AMOTION_EVENT_AXIS_TILT, + Scroll = ffi::AMOTION_EVENT_AXIS_SCROLL, + RelativeX = ffi::AMOTION_EVENT_AXIS_RELATIVE_X, + RelativeY = ffi::AMOTION_EVENT_AXIS_RELATIVE_Y, + Generic1 = ffi::AMOTION_EVENT_AXIS_GENERIC_1, + Generic2 = ffi::AMOTION_EVENT_AXIS_GENERIC_2, + Generic3 = ffi::AMOTION_EVENT_AXIS_GENERIC_3, + Generic4 = ffi::AMOTION_EVENT_AXIS_GENERIC_4, + Generic5 = ffi::AMOTION_EVENT_AXIS_GENERIC_5, + Generic6 = ffi::AMOTION_EVENT_AXIS_GENERIC_6, + Generic7 = ffi::AMOTION_EVENT_AXIS_GENERIC_7, + Generic8 = ffi::AMOTION_EVENT_AXIS_GENERIC_8, + Generic9 = ffi::AMOTION_EVENT_AXIS_GENERIC_9, + Generic10 = ffi::AMOTION_EVENT_AXIS_GENERIC_10, + Generic11 = ffi::AMOTION_EVENT_AXIS_GENERIC_11, + Generic12 = ffi::AMOTION_EVENT_AXIS_GENERIC_12, + Generic13 = ffi::AMOTION_EVENT_AXIS_GENERIC_13, + Generic14 = ffi::AMOTION_EVENT_AXIS_GENERIC_14, + Generic15 = ffi::AMOTION_EVENT_AXIS_GENERIC_15, + Generic16 = ffi::AMOTION_EVENT_AXIS_GENERIC_16, +} + +/// A bitfield representing the state of buttons during a motion event. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-33) +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct ButtonState(pub u32); + +impl ButtonState { + #[inline] + pub fn primary(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_PRIMARY != 0 + } + #[inline] + pub fn secondary(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_SECONDARY != 0 + } + #[inline] + pub fn teriary(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_TERTIARY != 0 + } + #[inline] + pub fn back(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_BACK != 0 + } + #[inline] + pub fn forward(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_FORWARD != 0 + } + #[inline] + pub fn stylus_primary(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_STYLUS_PRIMARY != 0 + } + #[inline] + pub fn stylus_secondary(self) -> bool { + self.0 & ffi::AMOTION_EVENT_BUTTON_STYLUS_SECONDARY != 0 + } +} + +/// A bitfield representing which edges were touched by a motion event. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-31) +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct EdgeFlags(pub u32); + +impl EdgeFlags { + #[inline] + pub fn top(self) -> bool { + self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_TOP != 0 + } + #[inline] + pub fn bottom(self) -> bool { + self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_BOTTOM != 0 + } + #[inline] + pub fn left(self) -> bool { + self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_LEFT != 0 + } + #[inline] + pub fn right(self) -> bool { + self.0 & ffi::AMOTION_EVENT_EDGE_FLAG_RIGHT != 0 + } +} + +/// Flags associated with a motion event. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-30) +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct MotionEventFlags(pub u32); + +impl MotionEventFlags { + #[inline] + pub fn window_is_obscured(self) -> bool { + self.0 & ffi::AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED != 0 + } +} + +impl MotionEvent { + /// Constructs a MotionEvent from a pointer to a native `AInputEvent` + /// + /// By calling this method, you assert that the pointer is a valid, non-null pointer to a + /// native `AInputEvent`, and that that `AInputEvent` is an `AMotionEvent`. + #[inline] + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// Returns a pointer to the native `AInputEvent` + #[inline] + pub fn ptr(&self) -> NonNull { + self.ptr + } + + /// Get the source of the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getsource) + #[inline] + pub fn source(&self) -> Source { + let source = unsafe { ffi::AInputEvent_getSource(self.ptr.as_ptr()) as u32 }; + source.try_into().unwrap_or(Source::Unknown) + } + + /// Get the device id associated with the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getdeviceid) + #[inline] + pub fn device_id(&self) -> i32 { + unsafe { ffi::AInputEvent_getDeviceId(self.ptr.as_ptr()) } + } + + /// Returns the motion action associated with this event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getaction) + #[inline] + pub fn action(&self) -> MotionAction { + let action = unsafe { + ffi::AMotionEvent_getAction(self.ptr.as_ptr()) as u32 & ffi::AMOTION_EVENT_ACTION_MASK + }; + action.try_into().unwrap() + } + + /// Returns the pointer index of an `Up` or `Down` event. + /// + /// Pointer indices can change per motion event. For an identifier that stays the same, see + /// [`pointer_id`](method.pointer_id.html). + /// + /// This only has a meaning when the action is one of `Up`, `Down`, `PointerUp`, or + /// `PointerDown`. + #[inline] + pub fn pointer_index(&self) -> usize { + let action = unsafe { ffi::AMotionEvent_getAction(self.ptr.as_ptr()) as u32 }; + let index = (action & ffi::AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) + >> ffi::AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; + index as usize + } + + /* + /// Returns the pointer id associated with the given pointer index. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getpointerid) + // TODO: look at output with out-of-range pointer index + // Probably -1 though + pub fn pointer_id_for(&self, pointer_index: usize) -> i32 { + unsafe { ffi::AMotionEvent_getPointerId(self.ptr.as_ptr(), pointer_index) } + } + */ + + /// Returns the number of pointers in this event + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getpointercount) + #[inline] + pub fn pointer_count(&self) -> usize { + unsafe { ffi::AMotionEvent_getPointerCount(self.ptr.as_ptr()) } + } + + /// An iterator over the pointers in this motion event + #[inline] + pub fn pointers(&self) -> PointersIter<'_> { + PointersIter { + event: self.ptr, + next_index: 0, + count: self.pointer_count(), + _marker: std::marker::PhantomData, + } + } + + /// The pointer at a given pointer index. Panics if the pointer index is out of bounds. + /// + /// If you need to loop over all the pointers, prefer the `.pointers()` method. + #[inline] + pub fn pointer_at_index(&self, index: usize) -> Pointer<'_> { + if index >= self.pointer_count() { + panic!("Pointer index {} is out of bounds", index); + } + Pointer { + event: self.ptr, + index, + _marker: std::marker::PhantomData, + } + } + + /// Returns the size of the history contained in this event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_gethistorysize) + #[inline] + pub fn history_size(&self) -> usize { + unsafe { ffi::AMotionEvent_getHistorySize(self.ptr.as_ptr()) } + } + + /// An iterator over the historical events contained in this event. + #[inline] + pub fn history(&self) -> HistoricalMotionEventsIter<'_> { + HistoricalMotionEventsIter { + event: self.ptr, + next_history_index: 0, + history_size: self.history_size(), + _marker: std::marker::PhantomData, + } + } + + /// Returns the state of any modifier keys that were pressed during the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getmetastate) + #[inline] + pub fn meta_state(&self) -> MetaState { + unsafe { MetaState(ffi::AMotionEvent_getMetaState(self.ptr.as_ptr()) as u32) } + } + + /// Returns the button state during this event, as a bitfield. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getbuttonstate) + #[inline] + pub fn button_state(&self) -> ButtonState { + unsafe { ButtonState(ffi::AMotionEvent_getButtonState(self.ptr.as_ptr()) as u32) } + } + + /// Returns the time of the start of this gesture, in the `java.lang.System.nanoTime()` time + /// base + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getdowntime) + #[inline] + pub fn down_time(&self) -> i64 { + unsafe { ffi::AMotionEvent_getDownTime(self.ptr.as_ptr()) } + } + + /// Returns a bitfield indicating which edges were touched by this event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getedgeflags) + #[inline] + pub fn edge_flags(&self) -> EdgeFlags { + unsafe { EdgeFlags(ffi::AMotionEvent_getEdgeFlags(self.ptr.as_ptr()) as u32) } + } + + /// Returns the time of this event, in the `java.lang.System.nanoTime()` time base + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_geteventtime) + #[inline] + pub fn event_time(&self) -> i64 { + unsafe { ffi::AMotionEvent_getEventTime(self.ptr.as_ptr()) } + } + + /// The flags associated with a motion event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getflags) + #[inline] + pub fn flags(&self) -> MotionEventFlags { + unsafe { MotionEventFlags(ffi::AMotionEvent_getFlags(self.ptr.as_ptr()) as u32) } + } + + /// Returns the offset in the x direction between the coordinates and the raw coordinates + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getxoffset) + #[inline] + pub fn x_offset(&self) -> f32 { + unsafe { ffi::AMotionEvent_getXOffset(self.ptr.as_ptr()) } + } + + /// Returns the offset in the y direction between the coordinates and the raw coordinates + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getyoffset) + #[inline] + pub fn y_offset(&self) -> f32 { + unsafe { ffi::AMotionEvent_getYOffset(self.ptr.as_ptr()) } + } + + /// Returns the precision of the x value of the coordinates + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getxprecision) + #[inline] + pub fn x_precision(&self) -> f32 { + unsafe { ffi::AMotionEvent_getXPrecision(self.ptr.as_ptr()) } + } + + /// Returns the precision of the y value of the coordinates + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_getyprecision) + #[inline] + pub fn y_precision(&self) -> f32 { + unsafe { ffi::AMotionEvent_getYPrecision(self.ptr.as_ptr()) } + } +} + +/// A view into the data of a specific pointer in a motion event. +#[derive(Debug)] +pub struct Pointer<'a> { + event: NonNull, + index: usize, + _marker: std::marker::PhantomData<&'a MotionEvent>, +} + +// TODO: thread safety? + +impl<'a> Pointer<'a> { + #[inline] + pub fn pointer_index(&self) -> usize { + self.index + } + + #[inline] + pub fn pointer_id(&self) -> i32 { + unsafe { ffi::AMotionEvent_getPointerId(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn axis_value(&self, axis: Axis) -> f32 { + unsafe { ffi::AMotionEvent_getAxisValue(self.event.as_ptr(), axis as i32, self.index) } + } + + #[inline] + pub fn orientation(&self) -> f32 { + unsafe { ffi::AMotionEvent_getOrientation(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn pressure(&self) -> f32 { + unsafe { ffi::AMotionEvent_getPressure(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn raw_x(&self) -> f32 { + unsafe { ffi::AMotionEvent_getRawX(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn raw_y(&self) -> f32 { + unsafe { ffi::AMotionEvent_getRawY(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn x(&self) -> f32 { + unsafe { ffi::AMotionEvent_getX(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn y(&self) -> f32 { + unsafe { ffi::AMotionEvent_getY(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn size(&self) -> f32 { + unsafe { ffi::AMotionEvent_getSize(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn tool_major(&self) -> f32 { + unsafe { ffi::AMotionEvent_getToolMajor(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn tool_minor(&self) -> f32 { + unsafe { ffi::AMotionEvent_getToolMinor(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn touch_major(&self) -> f32 { + unsafe { ffi::AMotionEvent_getTouchMajor(self.event.as_ptr(), self.index) } + } + + #[inline] + pub fn touch_minor(&self) -> f32 { + unsafe { ffi::AMotionEvent_getTouchMinor(self.event.as_ptr(), self.index) } + } +} + +/// An iterator over the pointers in a `MotionEvent`. +#[derive(Debug)] +pub struct PointersIter<'a> { + event: NonNull, + next_index: usize, + count: usize, + _marker: std::marker::PhantomData<&'a MotionEvent>, +} + +// TODO: thread safety? + +impl<'a> Iterator for PointersIter<'a> { + type Item = Pointer<'a>; + fn next(&mut self) -> Option> { + if self.next_index < self.count { + let ptr = Pointer { + event: self.event, + index: self.next_index, + _marker: std::marker::PhantomData, + }; + self.next_index += 1; + Some(ptr) + } else { + None + } + } + + fn size_hint(&self) -> (usize, Option) { + let size = self.count - self.next_index; + (size, Some(size)) + } +} +impl<'a> ExactSizeIterator for PointersIter<'a> { + fn len(&self) -> usize { + self.count - self.next_index + } +} + +/// Represents a view into a past moment of a motion event +#[derive(Debug)] +pub struct HistoricalMotionEvent<'a> { + event: NonNull, + history_index: usize, + _marker: std::marker::PhantomData<&'a MotionEvent>, +} + +// TODO: thread safety? + +impl<'a> HistoricalMotionEvent<'a> { + /// Returns the "history index" associated with this historical event. Older events have smaller indices. + #[inline] + pub fn history_index(&self) -> usize { + self.history_index + } + + /// Returns the time of the historical event, in the `java.lang.System.nanoTime()` time base + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#amotionevent_gethistoricaleventtime) + #[inline] + pub fn event_time(&self) -> i64 { + unsafe { ffi::AMotionEvent_getHistoricalEventTime(self.event.as_ptr(), self.history_index) } + } + + /// An iterator over the pointers of this historical motion event + #[inline] + pub fn pointers(&self) -> HistoricalPointersIter<'a> { + HistoricalPointersIter { + event: self.event, + history_index: self.history_index, + next_pointer_index: 0, + pointer_count: unsafe { ffi::AMotionEvent_getPointerCount(self.event.as_ptr()) }, + _marker: std::marker::PhantomData, + } + } +} + +/// An iterator over all the historical moments in a `MotionEvent`. +/// +/// It iterates from oldest to newest. +#[derive(Debug)] +pub struct HistoricalMotionEventsIter<'a> { + event: NonNull, + next_history_index: usize, + history_size: usize, + _marker: std::marker::PhantomData<&'a MotionEvent>, +} + +// TODO: thread safety? + +impl<'a> Iterator for HistoricalMotionEventsIter<'a> { + type Item = HistoricalMotionEvent<'a>; + + fn next(&mut self) -> Option> { + if self.next_history_index < self.history_size { + let res = HistoricalMotionEvent { + event: self.event, + history_index: self.next_history_index, + _marker: std::marker::PhantomData, + }; + self.next_history_index += 1; + Some(res) + } else { + None + } + } + + fn size_hint(&self) -> (usize, Option) { + let size = self.history_size - self.next_history_index; + (size, Some(size)) + } +} +impl ExactSizeIterator for HistoricalMotionEventsIter<'_> { + fn len(&self) -> usize { + self.history_size - self.next_history_index + } +} +impl<'a> DoubleEndedIterator for HistoricalMotionEventsIter<'a> { + fn next_back(&mut self) -> Option> { + if self.next_history_index < self.history_size { + self.history_size -= 1; + Some(HistoricalMotionEvent { + event: self.event, + history_index: self.history_size, + _marker: std::marker::PhantomData, + }) + } else { + None + } + } +} + +/// A view into a pointer at a historical moment +#[derive(Debug)] +pub struct HistoricalPointer<'a> { + event: NonNull, + pointer_index: usize, + history_index: usize, + _marker: std::marker::PhantomData<&'a MotionEvent>, +} + +// TODO: thread safety? + +impl<'a> HistoricalPointer<'a> { + #[inline] + pub fn pointer_index(&self) -> usize { + self.pointer_index + } + + #[inline] + pub fn pointer_id(&self) -> i32 { + unsafe { ffi::AMotionEvent_getPointerId(self.event.as_ptr(), self.pointer_index) } + } + + #[inline] + pub fn history_index(&self) -> usize { + self.history_index + } + + #[inline] + pub fn axis_value(&self, axis: Axis) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalAxisValue( + self.event.as_ptr(), + axis as i32, + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn orientation(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalOrientation( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn pressure(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalPressure( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn raw_x(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalRawX( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn raw_y(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalRawY( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn x(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalX( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn y(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalY( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn size(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalSize( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn tool_major(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalToolMajor( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn tool_minor(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalToolMinor( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn touch_major(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalTouchMajor( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } + + #[inline] + pub fn touch_minor(&self) -> f32 { + unsafe { + ffi::AMotionEvent_getHistoricalTouchMinor( + self.event.as_ptr(), + self.pointer_index, + self.history_index, + ) + } + } +} + +/// An iterator over the pointers in a historical motion event +#[derive(Debug)] +pub struct HistoricalPointersIter<'a> { + event: NonNull, + history_index: usize, + next_pointer_index: usize, + pointer_count: usize, + _marker: std::marker::PhantomData<&'a MotionEvent>, +} + +// TODO: thread safety? + +impl<'a> Iterator for HistoricalPointersIter<'a> { + type Item = HistoricalPointer<'a>; + + fn next(&mut self) -> Option> { + if self.next_pointer_index < self.pointer_count { + let ptr = HistoricalPointer { + event: self.event, + history_index: self.history_index, + pointer_index: self.next_pointer_index, + _marker: std::marker::PhantomData, + }; + self.next_pointer_index += 1; + Some(ptr) + } else { + None + } + } + + fn size_hint(&self) -> (usize, Option) { + let size = self.pointer_count - self.next_pointer_index; + (size, Some(size)) + } +} +impl ExactSizeIterator for HistoricalPointersIter<'_> { + fn len(&self) -> usize { + self.pointer_count - self.next_pointer_index + } +} + +/// A key event. +/// +/// For general discussion of key events in Android, see [the relevant +/// javadoc](https://developer.android.com/reference/android/view/KeyEvent). +#[derive(Debug)] +pub struct KeyEvent { + ptr: NonNull, +} + +// TODO: thread safety? + +/// Key actions. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-27) +#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum KeyAction { + Down = ffi::AKEY_EVENT_ACTION_DOWN, + Up = ffi::AKEY_EVENT_ACTION_UP, + Multiple = ffi::AKEY_EVENT_ACTION_MULTIPLE, +} + +/// Key codes. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-39) +#[derive(Copy, Clone, Debug, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum Keycode { + Unknown = ffi::AKEYCODE_UNKNOWN, + SoftLeft = ffi::AKEYCODE_SOFT_LEFT, + SoftRight = ffi::AKEYCODE_SOFT_RIGHT, + Home = ffi::AKEYCODE_HOME, + Back = ffi::AKEYCODE_BACK, + Call = ffi::AKEYCODE_CALL, + Endcall = ffi::AKEYCODE_ENDCALL, + Keycode0 = ffi::AKEYCODE_0, + Keycode1 = ffi::AKEYCODE_1, + Keycode2 = ffi::AKEYCODE_2, + Keycode3 = ffi::AKEYCODE_3, + Keycode4 = ffi::AKEYCODE_4, + Keycode5 = ffi::AKEYCODE_5, + Keycode6 = ffi::AKEYCODE_6, + Keycode7 = ffi::AKEYCODE_7, + Keycode8 = ffi::AKEYCODE_8, + Keycode9 = ffi::AKEYCODE_9, + Star = ffi::AKEYCODE_STAR, + Pound = ffi::AKEYCODE_POUND, + DpadUp = ffi::AKEYCODE_DPAD_UP, + DpadDown = ffi::AKEYCODE_DPAD_DOWN, + DpadLeft = ffi::AKEYCODE_DPAD_LEFT, + DpadRight = ffi::AKEYCODE_DPAD_RIGHT, + DpadCenter = ffi::AKEYCODE_DPAD_CENTER, + VolumeUp = ffi::AKEYCODE_VOLUME_UP, + VolumeDown = ffi::AKEYCODE_VOLUME_DOWN, + Power = ffi::AKEYCODE_POWER, + Camera = ffi::AKEYCODE_CAMERA, + Clear = ffi::AKEYCODE_CLEAR, + A = ffi::AKEYCODE_A, + B = ffi::AKEYCODE_B, + C = ffi::AKEYCODE_C, + D = ffi::AKEYCODE_D, + E = ffi::AKEYCODE_E, + F = ffi::AKEYCODE_F, + G = ffi::AKEYCODE_G, + H = ffi::AKEYCODE_H, + I = ffi::AKEYCODE_I, + J = ffi::AKEYCODE_J, + K = ffi::AKEYCODE_K, + L = ffi::AKEYCODE_L, + M = ffi::AKEYCODE_M, + N = ffi::AKEYCODE_N, + O = ffi::AKEYCODE_O, + P = ffi::AKEYCODE_P, + Q = ffi::AKEYCODE_Q, + R = ffi::AKEYCODE_R, + S = ffi::AKEYCODE_S, + T = ffi::AKEYCODE_T, + U = ffi::AKEYCODE_U, + V = ffi::AKEYCODE_V, + W = ffi::AKEYCODE_W, + X = ffi::AKEYCODE_X, + Y = ffi::AKEYCODE_Y, + Z = ffi::AKEYCODE_Z, + Comma = ffi::AKEYCODE_COMMA, + Period = ffi::AKEYCODE_PERIOD, + AltLeft = ffi::AKEYCODE_ALT_LEFT, + AltRight = ffi::AKEYCODE_ALT_RIGHT, + ShiftLeft = ffi::AKEYCODE_SHIFT_LEFT, + ShiftRight = ffi::AKEYCODE_SHIFT_RIGHT, + Tab = ffi::AKEYCODE_TAB, + Space = ffi::AKEYCODE_SPACE, + Sym = ffi::AKEYCODE_SYM, + Explorer = ffi::AKEYCODE_EXPLORER, + Envelope = ffi::AKEYCODE_ENVELOPE, + Enter = ffi::AKEYCODE_ENTER, + Del = ffi::AKEYCODE_DEL, + Grave = ffi::AKEYCODE_GRAVE, + Minus = ffi::AKEYCODE_MINUS, + Equals = ffi::AKEYCODE_EQUALS, + LeftBracket = ffi::AKEYCODE_LEFT_BRACKET, + RightBracket = ffi::AKEYCODE_RIGHT_BRACKET, + Backslash = ffi::AKEYCODE_BACKSLASH, + Semicolon = ffi::AKEYCODE_SEMICOLON, + Apostrophe = ffi::AKEYCODE_APOSTROPHE, + Slash = ffi::AKEYCODE_SLASH, + At = ffi::AKEYCODE_AT, + Num = ffi::AKEYCODE_NUM, + Headsethook = ffi::AKEYCODE_HEADSETHOOK, + Focus = ffi::AKEYCODE_FOCUS, + Plus = ffi::AKEYCODE_PLUS, + Menu = ffi::AKEYCODE_MENU, + Notification = ffi::AKEYCODE_NOTIFICATION, + Search = ffi::AKEYCODE_SEARCH, + MediaPlayPause = ffi::AKEYCODE_MEDIA_PLAY_PAUSE, + MediaStop = ffi::AKEYCODE_MEDIA_STOP, + MediaNext = ffi::AKEYCODE_MEDIA_NEXT, + MediaPrevious = ffi::AKEYCODE_MEDIA_PREVIOUS, + MediaRewind = ffi::AKEYCODE_MEDIA_REWIND, + MediaFastForward = ffi::AKEYCODE_MEDIA_FAST_FORWARD, + Mute = ffi::AKEYCODE_MUTE, + PageUp = ffi::AKEYCODE_PAGE_UP, + PageDown = ffi::AKEYCODE_PAGE_DOWN, + Pictsymbols = ffi::AKEYCODE_PICTSYMBOLS, + SwitchCharset = ffi::AKEYCODE_SWITCH_CHARSET, + ButtonA = ffi::AKEYCODE_BUTTON_A, + ButtonB = ffi::AKEYCODE_BUTTON_B, + ButtonC = ffi::AKEYCODE_BUTTON_C, + ButtonX = ffi::AKEYCODE_BUTTON_X, + ButtonY = ffi::AKEYCODE_BUTTON_Y, + ButtonZ = ffi::AKEYCODE_BUTTON_Z, + ButtonL1 = ffi::AKEYCODE_BUTTON_L1, + ButtonR1 = ffi::AKEYCODE_BUTTON_R1, + ButtonL2 = ffi::AKEYCODE_BUTTON_L2, + ButtonR2 = ffi::AKEYCODE_BUTTON_R2, + ButtonThumbl = ffi::AKEYCODE_BUTTON_THUMBL, + ButtonThumbr = ffi::AKEYCODE_BUTTON_THUMBR, + ButtonStart = ffi::AKEYCODE_BUTTON_START, + ButtonSelect = ffi::AKEYCODE_BUTTON_SELECT, + ButtonMode = ffi::AKEYCODE_BUTTON_MODE, + Escape = ffi::AKEYCODE_ESCAPE, + ForwardDel = ffi::AKEYCODE_FORWARD_DEL, + CtrlLeft = ffi::AKEYCODE_CTRL_LEFT, + CtrlRight = ffi::AKEYCODE_CTRL_RIGHT, + CapsLock = ffi::AKEYCODE_CAPS_LOCK, + ScrollLock = ffi::AKEYCODE_SCROLL_LOCK, + MetaLeft = ffi::AKEYCODE_META_LEFT, + MetaRight = ffi::AKEYCODE_META_RIGHT, + Function = ffi::AKEYCODE_FUNCTION, + Sysrq = ffi::AKEYCODE_SYSRQ, + Break = ffi::AKEYCODE_BREAK, + MoveHome = ffi::AKEYCODE_MOVE_HOME, + MoveEnd = ffi::AKEYCODE_MOVE_END, + Insert = ffi::AKEYCODE_INSERT, + Forward = ffi::AKEYCODE_FORWARD, + MediaPlay = ffi::AKEYCODE_MEDIA_PLAY, + MediaPause = ffi::AKEYCODE_MEDIA_PAUSE, + MediaClose = ffi::AKEYCODE_MEDIA_CLOSE, + MediaEject = ffi::AKEYCODE_MEDIA_EJECT, + MediaRecord = ffi::AKEYCODE_MEDIA_RECORD, + F1 = ffi::AKEYCODE_F1, + F2 = ffi::AKEYCODE_F2, + F3 = ffi::AKEYCODE_F3, + F4 = ffi::AKEYCODE_F4, + F5 = ffi::AKEYCODE_F5, + F6 = ffi::AKEYCODE_F6, + F7 = ffi::AKEYCODE_F7, + F8 = ffi::AKEYCODE_F8, + F9 = ffi::AKEYCODE_F9, + F10 = ffi::AKEYCODE_F10, + F11 = ffi::AKEYCODE_F11, + F12 = ffi::AKEYCODE_F12, + NumLock = ffi::AKEYCODE_NUM_LOCK, + Numpad0 = ffi::AKEYCODE_NUMPAD_0, + Numpad1 = ffi::AKEYCODE_NUMPAD_1, + Numpad2 = ffi::AKEYCODE_NUMPAD_2, + Numpad3 = ffi::AKEYCODE_NUMPAD_3, + Numpad4 = ffi::AKEYCODE_NUMPAD_4, + Numpad5 = ffi::AKEYCODE_NUMPAD_5, + Numpad6 = ffi::AKEYCODE_NUMPAD_6, + Numpad7 = ffi::AKEYCODE_NUMPAD_7, + Numpad8 = ffi::AKEYCODE_NUMPAD_8, + Numpad9 = ffi::AKEYCODE_NUMPAD_9, + NumpadDivide = ffi::AKEYCODE_NUMPAD_DIVIDE, + NumpadMultiply = ffi::AKEYCODE_NUMPAD_MULTIPLY, + NumpadSubtract = ffi::AKEYCODE_NUMPAD_SUBTRACT, + NumpadAdd = ffi::AKEYCODE_NUMPAD_ADD, + NumpadDot = ffi::AKEYCODE_NUMPAD_DOT, + NumpadComma = ffi::AKEYCODE_NUMPAD_COMMA, + NumpadEnter = ffi::AKEYCODE_NUMPAD_ENTER, + NumpadEquals = ffi::AKEYCODE_NUMPAD_EQUALS, + NumpadLeftParen = ffi::AKEYCODE_NUMPAD_LEFT_PAREN, + NumpadRightParen = ffi::AKEYCODE_NUMPAD_RIGHT_PAREN, + VolumeMute = ffi::AKEYCODE_VOLUME_MUTE, + Info = ffi::AKEYCODE_INFO, + ChannelUp = ffi::AKEYCODE_CHANNEL_UP, + ChannelDown = ffi::AKEYCODE_CHANNEL_DOWN, + ZoomIn = ffi::AKEYCODE_ZOOM_IN, + ZoomOut = ffi::AKEYCODE_ZOOM_OUT, + Tv = ffi::AKEYCODE_TV, + Window = ffi::AKEYCODE_WINDOW, + Guide = ffi::AKEYCODE_GUIDE, + Dvr = ffi::AKEYCODE_DVR, + Bookmark = ffi::AKEYCODE_BOOKMARK, + Captions = ffi::AKEYCODE_CAPTIONS, + Settings = ffi::AKEYCODE_SETTINGS, + TvPower = ffi::AKEYCODE_TV_POWER, + TvInput = ffi::AKEYCODE_TV_INPUT, + StbPower = ffi::AKEYCODE_STB_POWER, + StbInput = ffi::AKEYCODE_STB_INPUT, + AvrPower = ffi::AKEYCODE_AVR_POWER, + AvrInput = ffi::AKEYCODE_AVR_INPUT, + ProgRed = ffi::AKEYCODE_PROG_RED, + ProgGreen = ffi::AKEYCODE_PROG_GREEN, + ProgYellow = ffi::AKEYCODE_PROG_YELLOW, + ProgBlue = ffi::AKEYCODE_PROG_BLUE, + AppSwitch = ffi::AKEYCODE_APP_SWITCH, + Button1 = ffi::AKEYCODE_BUTTON_1, + Button2 = ffi::AKEYCODE_BUTTON_2, + Button3 = ffi::AKEYCODE_BUTTON_3, + Button4 = ffi::AKEYCODE_BUTTON_4, + Button5 = ffi::AKEYCODE_BUTTON_5, + Button6 = ffi::AKEYCODE_BUTTON_6, + Button7 = ffi::AKEYCODE_BUTTON_7, + Button8 = ffi::AKEYCODE_BUTTON_8, + Button9 = ffi::AKEYCODE_BUTTON_9, + Button10 = ffi::AKEYCODE_BUTTON_10, + Button11 = ffi::AKEYCODE_BUTTON_11, + Button12 = ffi::AKEYCODE_BUTTON_12, + Button13 = ffi::AKEYCODE_BUTTON_13, + Button14 = ffi::AKEYCODE_BUTTON_14, + Button15 = ffi::AKEYCODE_BUTTON_15, + Button16 = ffi::AKEYCODE_BUTTON_16, + LanguageSwitch = ffi::AKEYCODE_LANGUAGE_SWITCH, + MannerMode = ffi::AKEYCODE_MANNER_MODE, + Keycode3dMode = ffi::AKEYCODE_3D_MODE, + Contacts = ffi::AKEYCODE_CONTACTS, + Calendar = ffi::AKEYCODE_CALENDAR, + Music = ffi::AKEYCODE_MUSIC, + Calculator = ffi::AKEYCODE_CALCULATOR, + ZenkakuHankaku = ffi::AKEYCODE_ZENKAKU_HANKAKU, + Eisu = ffi::AKEYCODE_EISU, + Muhenkan = ffi::AKEYCODE_MUHENKAN, + Henkan = ffi::AKEYCODE_HENKAN, + KatakanaHiragana = ffi::AKEYCODE_KATAKANA_HIRAGANA, + Yen = ffi::AKEYCODE_YEN, + Ro = ffi::AKEYCODE_RO, + Kana = ffi::AKEYCODE_KANA, + Assist = ffi::AKEYCODE_ASSIST, + BrightnessDown = ffi::AKEYCODE_BRIGHTNESS_DOWN, + BrightnessUp = ffi::AKEYCODE_BRIGHTNESS_UP, + MediaAudioTrack = ffi::AKEYCODE_MEDIA_AUDIO_TRACK, + Sleep = ffi::AKEYCODE_SLEEP, + Wakeup = ffi::AKEYCODE_WAKEUP, + Pairing = ffi::AKEYCODE_PAIRING, + MediaTopMenu = ffi::AKEYCODE_MEDIA_TOP_MENU, + Keycode11 = ffi::AKEYCODE_11, + Keycode12 = ffi::AKEYCODE_12, + LastChannel = ffi::AKEYCODE_LAST_CHANNEL, + TvDataService = ffi::AKEYCODE_TV_DATA_SERVICE, + VoiceAssist = ffi::AKEYCODE_VOICE_ASSIST, + TvRadioService = ffi::AKEYCODE_TV_RADIO_SERVICE, + TvTeletext = ffi::AKEYCODE_TV_TELETEXT, + TvNumberEntry = ffi::AKEYCODE_TV_NUMBER_ENTRY, + TvTerrestrialAnalog = ffi::AKEYCODE_TV_TERRESTRIAL_ANALOG, + TvTerrestrialDigital = ffi::AKEYCODE_TV_TERRESTRIAL_DIGITAL, + TvSatellite = ffi::AKEYCODE_TV_SATELLITE, + TvSatelliteBs = ffi::AKEYCODE_TV_SATELLITE_BS, + TvSatelliteCs = ffi::AKEYCODE_TV_SATELLITE_CS, + TvSatelliteService = ffi::AKEYCODE_TV_SATELLITE_SERVICE, + TvNetwork = ffi::AKEYCODE_TV_NETWORK, + TvAntennaCable = ffi::AKEYCODE_TV_ANTENNA_CABLE, + TvInputHdmi1 = ffi::AKEYCODE_TV_INPUT_HDMI_1, + TvInputHdmi2 = ffi::AKEYCODE_TV_INPUT_HDMI_2, + TvInputHdmi3 = ffi::AKEYCODE_TV_INPUT_HDMI_3, + TvInputHdmi4 = ffi::AKEYCODE_TV_INPUT_HDMI_4, + TvInputComposite1 = ffi::AKEYCODE_TV_INPUT_COMPOSITE_1, + TvInputComposite2 = ffi::AKEYCODE_TV_INPUT_COMPOSITE_2, + TvInputComponent1 = ffi::AKEYCODE_TV_INPUT_COMPONENT_1, + TvInputComponent2 = ffi::AKEYCODE_TV_INPUT_COMPONENT_2, + TvInputVga1 = ffi::AKEYCODE_TV_INPUT_VGA_1, + TvAudioDescription = ffi::AKEYCODE_TV_AUDIO_DESCRIPTION, + TvAudioDescriptionMixUp = ffi::AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP, + TvAudioDescriptionMixDown = ffi::AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN, + TvZoomMode = ffi::AKEYCODE_TV_ZOOM_MODE, + TvContentsMenu = ffi::AKEYCODE_TV_CONTENTS_MENU, + TvMediaContextMenu = ffi::AKEYCODE_TV_MEDIA_CONTEXT_MENU, + TvTimerProgramming = ffi::AKEYCODE_TV_TIMER_PROGRAMMING, + Help = ffi::AKEYCODE_HELP, + NavigatePrevious = ffi::AKEYCODE_NAVIGATE_PREVIOUS, + NavigateNext = ffi::AKEYCODE_NAVIGATE_NEXT, + NavigateIn = ffi::AKEYCODE_NAVIGATE_IN, + NavigateOut = ffi::AKEYCODE_NAVIGATE_OUT, + StemPrimary = ffi::AKEYCODE_STEM_PRIMARY, + Stem1 = ffi::AKEYCODE_STEM_1, + Stem2 = ffi::AKEYCODE_STEM_2, + Stem3 = ffi::AKEYCODE_STEM_3, + DpadUpLeft = ffi::AKEYCODE_DPAD_UP_LEFT, + DpadDownLeft = ffi::AKEYCODE_DPAD_DOWN_LEFT, + DpadUpRight = ffi::AKEYCODE_DPAD_UP_RIGHT, + DpadDownRight = ffi::AKEYCODE_DPAD_DOWN_RIGHT, + MediaSkipForward = ffi::AKEYCODE_MEDIA_SKIP_FORWARD, + MediaSkipBackward = ffi::AKEYCODE_MEDIA_SKIP_BACKWARD, + MediaStepForward = ffi::AKEYCODE_MEDIA_STEP_FORWARD, + MediaStepBackward = ffi::AKEYCODE_MEDIA_STEP_BACKWARD, + SoftSleep = ffi::AKEYCODE_SOFT_SLEEP, + Cut = ffi::AKEYCODE_CUT, + Copy = ffi::AKEYCODE_COPY, + Paste = ffi::AKEYCODE_PASTE, + SystemNavigationUp = ffi::AKEYCODE_SYSTEM_NAVIGATION_UP, + SystemNavigationDown = ffi::AKEYCODE_SYSTEM_NAVIGATION_DOWN, + SystemNavigationLeft = ffi::AKEYCODE_SYSTEM_NAVIGATION_LEFT, + SystemNavigationRight = ffi::AKEYCODE_SYSTEM_NAVIGATION_RIGHT, + AllApps = ffi::AKEYCODE_ALL_APPS, + Refresh = ffi::AKEYCODE_REFRESH, + ThumbsUp = ffi::AKEYCODE_THUMBS_UP, + ThumbsDown = ffi::AKEYCODE_THUMBS_DOWN, + ProfileSwitch = ffi::AKEYCODE_PROFILE_SWITCH, +} + +impl KeyEvent { + /// Constructs a KeyEvent from a pointer to a native `AInputEvent` + /// + /// By calling this method, you assert that the pointer is a valid, non-null pointer to an + /// `AInputEvent`, and that that `AInputEvent` is an `AKeyEvent`. + #[inline] + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// Returns a pointer to the native `AInputEvent` + #[inline] + pub fn ptr(&self) -> NonNull { + self.ptr + } + + /// Returns the key action represented by this event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getaction) + #[inline] + pub fn action(&self) -> KeyAction { + let action = unsafe { ffi::AKeyEvent_getAction(self.ptr.as_ptr()) as u32 }; + action.try_into().unwrap() + } + + /// Get the source of the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getsource) + #[inline] + pub fn source(&self) -> Source { + let source = unsafe { ffi::AInputEvent_getSource(self.ptr.as_ptr()) as u32 }; + source.try_into().unwrap_or(Source::Unknown) + } + + /// Get the device id associated with the event. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#ainputevent_getdeviceid) + #[inline] + pub fn device_id(&self) -> i32 { + unsafe { ffi::AInputEvent_getDeviceId(self.ptr.as_ptr()) } + } + + /// Returns the last time the key was pressed. This is on the scale of + /// `java.lang.System.nanoTime()`, which has nanosecond precision, but no defined start time. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getdowntime) + #[inline] + pub fn down_time(&self) -> i64 { + unsafe { ffi::AKeyEvent_getDownTime(self.ptr.as_ptr()) } + } + + /// Returns the time this event occured. This is on the scale of + /// `java.lang.System.nanoTime()`, which has nanosecond precision, but no defined start time. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_geteventtime) + #[inline] + pub fn event_time(&self) -> i64 { + unsafe { ffi::AKeyEvent_getEventTime(self.ptr.as_ptr()) } + } + + /// Returns the keycode associated with this key event + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getkeycode) + #[inline] + pub fn key_code(&self) -> Keycode { + let keycode = unsafe { ffi::AKeyEvent_getKeyCode(self.ptr.as_ptr()) as u32 }; + keycode.try_into().unwrap_or(Keycode::Unknown) + } + + /// Returns the number of repeats of a key. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getrepeatcount) + #[inline] + pub fn repeat_count(&self) -> i32 { + unsafe { ffi::AKeyEvent_getRepeatCount(self.ptr.as_ptr()) } + } + + /// Returns the hardware keycode of a key. This varies from device to device. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getscancode) + #[inline] + pub fn scan_code(&self) -> i32 { + unsafe { ffi::AKeyEvent_getScanCode(self.ptr.as_ptr()) } + } +} + +/// Flags associated with `KeyEvent`. +/// +/// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#anonymous-enum-28) +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct KeyEventFlags(pub u32); + +impl KeyEventFlags { + #[inline] + pub fn cancelled(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_CANCELED != 0 + } + #[inline] + pub fn cancelled_long_press(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_CANCELED_LONG_PRESS != 0 + } + #[inline] + pub fn editor_action(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_EDITOR_ACTION != 0 + } + #[inline] + pub fn fallback(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_FALLBACK != 0 + } + #[inline] + pub fn from_system(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_FROM_SYSTEM != 0 + } + #[inline] + pub fn keep_touch_mode(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_KEEP_TOUCH_MODE != 0 + } + #[inline] + pub fn long_press(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_LONG_PRESS != 0 + } + #[inline] + pub fn soft_keyboard(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_SOFT_KEYBOARD != 0 + } + #[inline] + pub fn tracking(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_TRACKING != 0 + } + #[inline] + pub fn virtual_hard_key(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY != 0 + } + #[inline] + pub fn woke_here(&self) -> bool { + self.0 & ffi::AKEY_EVENT_FLAG_WOKE_HERE != 0 + } +} + +impl KeyEvent { + /// Flags associated with `KeyEvent`. + /// + /// See [the NDK docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getflags) + #[inline] + pub fn flags(&self) -> KeyEventFlags { + unsafe { KeyEventFlags(ffi::AKeyEvent_getFlags(self.ptr.as_ptr()) as u32) } + } + + /// Returns the state of the modifiers during this key event, represented by a bitmask. + /// + /// See [the NDK + /// docs](https://developer.android.com/ndk/reference/group/input#akeyevent_getmetastate) + #[inline] + pub fn meta_state(&self) -> MetaState { + unsafe { MetaState(ffi::AKeyEvent_getMetaState(self.ptr.as_ptr()) as u32) } + } +} diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/input_queue.rs b/third_party/cargo/vendor/ndk-0.1.0/src/input_queue.rs new file mode 100644 index 0000000..746ed82 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/input_queue.rs @@ -0,0 +1,91 @@ +// TODO: mod docs + +use std::os::raw::c_int; +use std::ptr; +use std::ptr::NonNull; + +use crate::event::InputEvent; +use crate::looper::ForeignLooper; + +// TODO docs +#[derive(Debug)] +pub struct InputQueue { + ptr: NonNull, +} + +// It gets shared between threads in android_native_app_glue +unsafe impl Send for InputQueue {} +unsafe impl Sync for InputQueue {} + +#[derive(Debug)] +pub struct InputQueueError; + +impl InputQueue { + /// Construct an `InputQueue` from the native pointer. + /// + /// By calling this function, you assert that the pointer is a valid pointer to an NDK `AInputQueue`. + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + pub fn ptr(&self) -> NonNull { + self.ptr + } + + pub fn get_event(&self) -> Option { + unsafe { + let mut out_event = ptr::null_mut(); + if ffi::AInputQueue_getEvent(self.ptr.as_ptr(), &mut out_event) < 0 { + None + } else { + debug_assert!(out_event != ptr::null_mut()); + Some(InputEvent::from_ptr(NonNull::new_unchecked(out_event))) + } + } + } + + pub fn has_events(&self) -> Result { + unsafe { + match ffi::AInputQueue_hasEvents(self.ptr.as_ptr()) { + 0 => Ok(false), + 1 => Ok(true), + x if x < 0 => Err(InputQueueError), + x => unreachable!("AInputQueue_hasEvents returned {}", x), + } + } + } + + pub fn pre_dispatch(&self, event: InputEvent) -> Option { + unsafe { + if ffi::AInputQueue_preDispatchEvent(self.ptr.as_ptr(), event.ptr().as_ptr()) == 0 { + Some(event) + } else { + None + } + } + } + + pub fn finish_event(&self, event: InputEvent, handled: bool) { + unsafe { + ffi::AInputQueue_finishEvent(self.ptr.as_ptr(), event.ptr().as_ptr(), handled as c_int); + } + } + + pub fn attach_looper(&self, looper: &ForeignLooper, id: u32) { + unsafe { + ffi::AInputQueue_attachLooper( + self.ptr.as_ptr(), + looper.ptr().as_ptr(), + id as _, + None, + id as _, + ); + } + } + + pub fn detach_looper(&self) { + unsafe { + ffi::AInputQueue_detachLooper(self.ptr.as_ptr()); + } + } +} diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/lib.rs b/third_party/cargo/vendor/ndk-0.1.0/src/lib.rs new file mode 100644 index 0000000..d7f4c69 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/lib.rs @@ -0,0 +1,24 @@ +//! # Android NDK +//! +//! Bindings to the Android NDK. +//! +//! Currently has bindings: +//! * `InputEvent`, `KeyEvent`, and `MotionEvent`, in the `event` module +//! * `Looper`, in the `looper` module +//! * `InputQueue`, in the `input_queue` module +//! * `AssetManager`, `AssetDir`, and `Asset`, in the `asset` module +//! * `NativeActivity`, in the `native_activity` module +//! * `Configuration`, in the `configuration` module +#![cfg_attr( + feature = "native_app_glue", + doc = " * `native_app_glue`'s `AndroidApp`, in the `android_app` module" +)] +#![warn(missing_debug_implementations)] + +pub mod asset; +pub mod configuration; +pub mod event; +pub mod input_queue; +pub mod looper; +pub mod native_activity; +pub mod native_window; diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/looper.rs b/third_party/cargo/vendor/ndk-0.1.0/src/looper.rs new file mode 100644 index 0000000..2dfa3ab --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/looper.rs @@ -0,0 +1,272 @@ +//! Bindings for `ALooper` +//! +//! In Android, `ALooper`s are inherently thread-local. Due to this, there are two different +//! `ALooper` interfaces exposed in this module: +//! +//! * `ThreadLooper`, which has methods for the operations performable with a looper in one's own +//! thread; and +//! * `ForeignLooper`, which has methods for the operations performable with any thread's looper. + +use std::convert::TryInto; +use std::fmt; +use std::os::raw::c_void; +use std::os::unix::io::RawFd; +use std::ptr; +use std::ptr::NonNull; +use std::time::Duration; + +/// A thread-local `ALooper`. This contains a native `ALooper *` and promises that there is a +/// looper associated with the current thread. +#[derive(Debug)] +pub struct ThreadLooper { + _marker: std::marker::PhantomData<*mut ()>, // Not send or sync + foreign: ForeignLooper, +} + +/// The poll result from a `ThreadLooper`. +#[derive(Debug)] +pub enum Poll { + /// This looper was woken using `ForeignLooper::wake` + Wake, + /// For `ThreadLooper::poll_once*`, an event was received and processed using a callback. + Callback, + /// For `ThreadLooper::poll_*_timeout`, the requested timeout was reached before any events. + Timeout, + /// An event was received + Event { + ident: i32, + fd: RawFd, + events: i32, + data: *mut c_void, + }, +} + +#[derive(Debug, Copy, Clone)] +pub struct LooperError; + +impl fmt::Display for LooperError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "Android Looper error") + } +} + +impl std::error::Error for LooperError {} + +impl ThreadLooper { + /// Prepares a looper for the current thread and returns it + pub fn prepare() -> Self { + unsafe { + let ptr = ffi::ALooper_prepare(ffi::ALOOPER_PREPARE_ALLOW_NON_CALLBACKS as _); + let foreign = ForeignLooper::from_ptr(NonNull::new(ptr).expect("looper non null")); + Self { + _marker: std::marker::PhantomData, + foreign, + } + } + } + + /// Returns the looper associated with the current thread, if any. + pub fn for_thread() -> Option { + Some(Self { + _marker: std::marker::PhantomData, + foreign: ForeignLooper::for_thread()?, + }) + } + + fn poll_once_ms(&self, ms: i32) -> Result { + unsafe { + let mut fd: RawFd = -1; + let mut events: i32 = -1; + let mut data: *mut c_void = ptr::null_mut(); + match ffi::ALooper_pollOnce(ms, &mut fd, &mut events, &mut data) { + ffi::ALOOPER_POLL_WAKE => Ok(Poll::Wake), + ffi::ALOOPER_POLL_CALLBACK => Ok(Poll::Callback), + ffi::ALOOPER_POLL_TIMEOUT => Ok(Poll::Timeout), + ffi::ALOOPER_POLL_ERROR => Err(LooperError), + ident if ident >= 0 => Ok(Poll::Event { + ident, + fd, + events, + data, + }), + _ => unreachable!(), + } + } + } + + /// Polls the looper, blocking on processing an event. + #[inline] + pub fn poll_once(&self) -> Result { + self.poll_once_ms(-1) + } + + /// Polls the looper, blocking on processing an event, but with a timeout. Give a timeout of 0 + /// to make this non-blocking. + /// + /// It panics if the timeout is larger than expressible as an `i32` of milliseconds (roughly 25 + /// days). + #[inline] + pub fn poll_once_timeout(&self, timeout: Duration) -> Result { + self.poll_once_ms( + timeout + .as_millis() + .try_into() + .expect("Supplied timeout is too large"), + ) + } + + fn poll_all_ms(&self, ms: i32) -> Result { + unsafe { + let mut fd: RawFd = -1; + let mut events: i32 = -1; + let mut data: *mut c_void = ptr::null_mut(); + match ffi::ALooper_pollAll(ms, &mut fd, &mut events, &mut data) { + ffi::ALOOPER_POLL_WAKE => Ok(Poll::Wake), + ffi::ALOOPER_POLL_TIMEOUT => Ok(Poll::Timeout), + ffi::ALOOPER_POLL_ERROR => Err(LooperError), + ident if ident >= 0 => Ok(Poll::Event { + ident, + fd, + events, + data, + }), + _ => unreachable!(), + } + } + } + + /// Repeatedly polls the looper, blocking on processing an event. + /// + /// This function will never return `Poll::Callback`. + #[inline] + pub fn poll_all(&self) -> Result { + self.poll_all_ms(-1) + } + + /// Repeatedly polls the looper, blocking on processing an event, but with a timeout. Give a + /// timeout of 0 to make this non-blocking. + /// + /// This function will never return `Poll::Callback`. + /// + /// It panics if the timeout is larger than expressible as an `i32` of milliseconds (roughly 25 + /// days). + #[inline] + pub fn poll_all_timeout(&self, timeout: Duration) -> Result { + self.poll_all_ms( + timeout + .as_millis() + .try_into() + .expect("Supplied timeout is too large"), + ) + } + + /// Returns a reference to the `ForeignLooper` that is associated with the current thread. + pub fn as_foreign(&self) -> &ForeignLooper { + &self.foreign + } + + pub fn into_foreign(self) -> ForeignLooper { + self.foreign + } +} + +/// An `ALooper`, not necessarily allociated with the current thread. +#[derive(Debug)] +pub struct ForeignLooper { + ptr: NonNull, +} + +unsafe impl Send for ForeignLooper {} +unsafe impl Sync for ForeignLooper {} + +impl Drop for ForeignLooper { + fn drop(&mut self) { + unsafe { ffi::ALooper_release(self.ptr.as_ptr()) } + } +} + +impl Clone for ForeignLooper { + fn clone(&self) -> Self { + unsafe { + ffi::ALooper_acquire(self.ptr.as_ptr()); + Self { ptr: self.ptr } + } + } +} + +impl ForeignLooper { + /// Returns the looper associated with the current thread, if any. + #[inline] + pub fn for_thread() -> Option { + NonNull::new(unsafe { ffi::ALooper_forThread() }).map(|ptr| unsafe { Self::from_ptr(ptr) }) + } + + /// Construct a `ForeignLooper` object from the given pointer. + /// + /// By calling this function, you guarantee that the pointer is a valid, non-null pointer to an + /// NDK `ALooper`. + #[inline] + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + ffi::ALooper_acquire(ptr.as_ptr()); + Self { ptr } + } + + /// Returns a pointer to the NDK `ALooper` object. + #[inline] + pub fn ptr(&self) -> NonNull { + self.ptr + } + + /// Wakes the looper. An event of `Poll::Wake` will be sent. + pub fn wake(&self) { + unsafe { ffi::ALooper_wake(self.ptr.as_ptr()) } + } + + /// Adds a file descriptor to be polled, without a callback. + /// + /// See also [the NDK + /// docs](https://developer.android.com/ndk/reference/group/looper.html#alooper_addfd). + // TODO why is this unsafe? + pub unsafe fn add_fd( + &self, + fd: RawFd, + ident: i32, + event: i32, + data: *mut c_void, + ) -> Result<(), LooperError> { + match ffi::ALooper_addFd(self.ptr.as_ptr(), fd, ident, event, None, data) { + 1 => Ok(()), + -1 => Err(LooperError), + _ => unreachable!(), + } + } + + /// Adds a file descriptor to be polled, with a callback. + /// + /// The callback takes as an argument the file descriptor, and should return true to continue + /// receiving callbacks, or false to have the callback unregistered. + /// + /// See also [the NDK + /// docs](https://developer.android.com/ndk/reference/group/looper.html#alooper_addfd). + // TODO why is this unsafe? + pub unsafe fn add_fd_with_callback( + &self, + fd: RawFd, + ident: i32, + event: i32, + callback: Box bool>, + ) -> Result<(), LooperError> { + extern "C" fn cb_handler(fd: RawFd, _events: i32, data: *mut c_void) -> i32 { + unsafe { + let cb: &mut Box bool> = &mut *(data as *mut _); + cb(fd) as i32 + } + } + let data: *mut c_void = Box::into_raw(Box::new(callback)) as *mut _; + match ffi::ALooper_addFd(self.ptr.as_ptr(), fd, ident, event, Some(cb_handler), data) { + 1 => Ok(()), + -1 => Err(LooperError), + _ => unreachable!(), + } + } +} diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/native_activity.rs b/third_party/cargo/vendor/ndk-0.1.0/src/native_activity.rs new file mode 100644 index 0000000..bccb9d3 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/native_activity.rs @@ -0,0 +1,185 @@ +//! Bindings for `ANativeActivity` +//! +//! See also [the NDK +//! docs](https://developer.android.com/ndk/reference/struct/a-native-activity.html) + +//use num_enum::{IntoPrimitive, TryFromPrimitive}; +use std::ffi::CStr; +use std::os::raw::c_void; +use std::ptr::NonNull; + +/// An `ANativeActivity *` +/// +/// This is either provided in `ANativeActivity_onCreate`, or accessible in +/// `android_native_app_glue`'s android_app. +#[derive(Debug)] +pub struct NativeActivity { + ptr: NonNull, +} + +// It gets shared between threads in android_native_app_glue +unsafe impl Send for NativeActivity {} +unsafe impl Sync for NativeActivity {} + +impl NativeActivity { + /// Create a `NativeActivity` from a pointer + /// + /// By calling this function, you assert that it is a valid pointer to a native + /// `ANativeActivity`. + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + /// The pointer to the native `ANativeActivity` + pub fn ptr(&self) -> NonNull { + self.ptr + } +} + +/// Methods that relate to fields of the struct itself +/// +/// The relevant NDK docs can be found +/// [here.](https://developer.android.com/ndk/reference/struct/a-native-activity) +impl NativeActivity { + /// The platform's SDK version code + pub fn sdk_version(&self) -> i32 { + unsafe { self.ptr.as_ref().sdkVersion } + } + + /// Path to this application's internal data directory + pub fn internal_data_path(&self) -> &CStr { + unsafe { CStr::from_ptr(self.ptr.as_ref().internalDataPath) } + } + + /// Path to this application's external (removable, mountable) data directory + pub fn external_data_path(&self) -> &CStr { + unsafe { CStr::from_ptr(self.ptr.as_ref().externalDataPath) } + } + + /// This app's asset manager, which can be used to access assets from the `.apk` file. + pub fn asset_manager(&self) -> crate::asset::AssetManager { + unsafe { + crate::asset::AssetManager::from_ptr( + NonNull::new(self.ptr.as_ref().assetManager).unwrap(), + ) + } + } + + /// Instance data associated with the activity + pub fn instance(&self) -> *mut c_void { + unsafe { self.ptr.as_ref().instance } + } + + /// Set the instance data associated with the activity + /// + /// This can invalidate assumptions held by `android_native_app_glue`, as well as cause data + /// races with concurrent access to the instance data. + pub unsafe fn set_instance(&mut self, data: *mut c_void) { + // FIXME Does this create undefined behavior by creating a mutable reference to what could + // also be accessed immutably at the same time? + // + // I think that as long as we warn the users to avoid concurrent access, and we pass along + // the `unsafe` burden, it's OK. + self.ptr.as_mut().instance = data; + } + + /// This process's `JavaVM` object. + /// + /// Usage with [__jni__](https://crates.io/crates/jni) crate: + /// ```no_run + /// # use android_ndk::native_activity::NativeActivity; + /// # let native_activity: NativeActivity = unimplemented!(); + /// let vm_ptr = native_activity.vm(); + /// let vm = unsafe { jni::JavaVM::from_raw(vm_ptr) }.unwrap(); + /// let env = vm.attach_current_thread(); + /// // Do JNI with env ... + /// ``` + /// + /// Usage with [__jni-glue__](https://crates.io/crates/jni-glue) crate: + /// ```no_run + /// # use android_ndk::native_activity::NativeActivity; + /// # let native_activity: NativeActivity = unimplemented!(); + /// let vm_ptr = native_activity.vm(); + /// let vm = unsafe { jni_glue::VM::from_jni_local(&*vm_ptr) }; + /// vm.with_env(|env| { + /// // Do JNI with env ... + /// }); + /// ``` + pub fn vm(&self) -> *mut jni_sys::JavaVM { + unsafe { self.ptr.as_ref().vm as *mut jni_sys::JavaVM } + } + + /// The `android.app.NativeActivity` instance + /// + /// In the JNI, this is named `clazz`; however, as the docs say, "it should really be named + /// 'activity' instead of 'clazz', since it's a reference to the NativeActivity instance. + pub fn activity(&self) -> jni_sys::jobject { + unsafe { self.ptr.as_ref().clazz as jni_sys::jobject } + } + + /// Path to the directory with the application's OBB files. + /// + /// Only available as of Honeycomb (Android 3.0+, API level 11+) + pub unsafe fn obb_path(&self) -> &CStr { + CStr::from_ptr(self.ptr.as_ref().obbPath) + } +} + +/// Methods that relate to `ANativeActivity_*` functions. +/// +/// The relevant NDK docs can be found +/// [here.](https://developer.android.com/ndk/reference/group/native-activity) +impl NativeActivity { + /// Sends a destroy event to the activity and stops it. + pub fn finish(&self) { + unsafe { ffi::ANativeActivity_finish(self.ptr.as_ptr()) } + } + + /// Shows the IME (the on-screen keyboard). + /// + /// If `force` is true, the `SHOW_FORCED` flag is used; otherwise, the `SHOW_IMPLICIT` flag is + /// used. Depending on the value of this flag, the `hide_soft_input` method with behave + /// differently. See [the relevant + /// javadoc](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager#constants_2) + /// for more information. + pub fn show_soft_input(&self, force: bool) { + let flag = if force { + ffi::ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED + } else { + ffi::ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT + }; + unsafe { ffi::ANativeActivity_showSoftInput(self.ptr.as_ptr(), flag) } + } + + /// Hides the IME (the on-screen keyboard). + /// + /// If `not_always` is true, the `HIDE_NOT_ALWAYS` flag is used; otherwise, the + /// `HIDE_IMPLICIT_ONLY` flag is used. Depending on the value of this flag and the way the IME + /// was shown, it may or may not be hidden. See [the relevant + /// javadoc](https://developer.android.com/reference/android/view/inputmethod/InputMethodManager#constants_2) + /// for more information. + pub fn hide_soft_input(&self, not_always: bool) { + let flag = if not_always { + ffi::ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS + } else { + ffi::ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY + }; + unsafe { ffi::ANativeActivity_hideSoftInput(self.ptr.as_ptr(), flag) } + } + + /*/// Set the window format. Performs the Java `.getWindow().setFormat()`. + /// + /// See also [the relevant + /// javadoc](https://developer.android.com/reference/android/view/Window#setFormat(int)) + pub unsafe fn set_window_format(&self, format: WindowFormat) { + unsafe { ffi::ANativeActivity_setWindowFormat(self.ptr.as_ptr(), format.into()) } + }*/ +} + +/*#[derive(Debug, Clone, Copy, PartialEq, Eq, TryFromPrimitive, IntoPrimitive)] +#[repr(u32)] +pub enum WindowFormat { + Rgb565 = ffi::ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGB_565, + Rgba8888 = ffi::ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBA_8888, + Rgbx8888 = ffi::ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBX_8888, +}*/ diff --git a/third_party/cargo/vendor/ndk-0.1.0/src/native_window.rs b/third_party/cargo/vendor/ndk-0.1.0/src/native_window.rs new file mode 100644 index 0000000..6de3de5 --- /dev/null +++ b/third_party/cargo/vendor/ndk-0.1.0/src/native_window.rs @@ -0,0 +1,30 @@ +//! Bindings for `ANativeWindow` +use std::ptr::NonNull; + +#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +pub struct NativeWindow { + ptr: NonNull, +} + +unsafe impl Send for NativeWindow {} +unsafe impl Sync for NativeWindow {} + +impl NativeWindow { + pub unsafe fn from_ptr(ptr: NonNull) -> Self { + Self { ptr } + } + + pub fn ptr(&self) -> NonNull { + self.ptr + } +} + +impl NativeWindow { + pub fn height(&self) -> i32 { + unsafe { ffi::ANativeWindow_getHeight(self.ptr.as_ptr()) } + } + + pub fn width(&self) -> i32 { + unsafe { ffi::ANativeWindow_getWidth(self.ptr.as_ptr()) } + } +} diff --git a/third_party/cargo/vendor/ndk-glue-0.1.0/.cargo-checksum.json b/third_party/cargo/vendor/ndk-glue-0.1.0/.cargo-checksum.json new file mode 100644 index 0000000..bedea56 --- /dev/null +++ b/third_party/cargo/vendor/ndk-glue-0.1.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"fe4c40f0275ccd07a0ce2a802cca3f407531153aedd151f3a2a09b327adb69d6","src/lib.rs":"d9146250862b20115e1c3f5b7d10aec56305ae8309c4d83c81508e8611f19ab4"},"package":"d1730ee2e3de41c3321160a6da815f008c4006d71b095880ea50e17cf52332b8"} \ No newline at end of file diff --git a/third_party/cargo/vendor/ndk-glue-0.1.0/BUILD b/third_party/cargo/vendor/ndk-glue-0.1.0/BUILD new file mode 100644 index 0000000..755b1f8 --- /dev/null +++ b/third_party/cargo/vendor/ndk-glue-0.1.0/BUILD @@ -0,0 +1,48 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "ndk_glue", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/android_log-sys-0.1.2:android_log_sys", + "//third_party/cargo/vendor/lazy_static-1.4.0:lazy_static", + "//third_party/cargo/vendor/libc-0.2.71:libc", + "//third_party/cargo/vendor/log-0.4.8:log", + "//third_party/cargo/vendor/ndk-0.1.0:ndk", + "//third_party/cargo/vendor/ndk-sys-0.1.0:ndk_sys", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.0", + crate_features = [ + ], +) + diff --git a/third_party/cargo/vendor/ndk-glue-0.1.0/Cargo.toml b/third_party/cargo/vendor/ndk-glue-0.1.0/Cargo.toml new file mode 100644 index 0000000..709715a --- /dev/null +++ b/third_party/cargo/vendor/ndk-glue-0.1.0/Cargo.toml @@ -0,0 +1,36 @@ +# 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 = "ndk-glue" +version = "0.1.0" +authors = ["David Craven "] +description = "Startup code for android binaries" +license = "MIT OR Apache-2.0" +[dependencies.android_log-sys] +version = "0.1.2" + +[dependencies.lazy_static] +version = "1.4.0" + +[dependencies.libc] +version = "0.2.66" + +[dependencies.log] +version = "0.4.8" + +[dependencies.ndk] +version = "0.1" + +[dependencies.ndk-sys] +version = "0.1" diff --git a/third_party/cargo/vendor/ndk-glue-0.1.0/src/lib.rs b/third_party/cargo/vendor/ndk-glue-0.1.0/src/lib.rs new file mode 100644 index 0000000..2e4a86a --- /dev/null +++ b/third_party/cargo/vendor/ndk-glue-0.1.0/src/lib.rs @@ -0,0 +1,305 @@ +use lazy_static::lazy_static; +use log::Level; +use ndk::input_queue::InputQueue; +use ndk::looper::{ForeignLooper, ThreadLooper}; +use ndk::native_activity::NativeActivity; +use ndk::native_window::NativeWindow; +use ndk_sys::{AInputQueue, ANativeActivity, ANativeWindow, ARect, ALOOPER_EVENT_INPUT}; +use std::ffi::{CStr, CString}; +use std::fs::File; +use std::io::{BufRead, BufReader}; +use std::os::raw; +use std::os::unix::prelude::*; +use std::ptr::NonNull; +use std::sync::{RwLock, RwLockReadGuard}; +use std::thread; + +#[macro_export] +macro_rules! ndk_glue { + ($main:ident) => { + #[no_mangle] + unsafe extern "C" fn ANativeActivity_onCreate( + activity: *mut std::os::raw::c_void, + saved_state: *mut std::os::raw::c_void, + saved_state_size: usize, + ) { + std::env::set_var("RUST_BACKTRACE", "1"); + $crate::init( + activity as _, + saved_state as _, + saved_state_size as _, + $main, + ); + } + }; +} + +pub fn android_log(level: Level, tag: &CStr, msg: &CStr) { + use android_log_sys::LogPriority; + let prio = match level { + Level::Error => LogPriority::ERROR, + Level::Warn => LogPriority::WARN, + Level::Info => LogPriority::INFO, + Level::Debug => LogPriority::DEBUG, + Level::Trace => LogPriority::VERBOSE, + }; + unsafe { + android_log_sys::__android_log_write( + prio as _, + tag.as_ptr() as *const _, + msg.as_ptr() as *const _, + ); + } +} + +lazy_static! { + static ref NATIVE_WINDOW: RwLock> = Default::default(); + static ref INPUT_QUEUE: RwLock> = Default::default(); + static ref CONTENT_RECT: RwLock = Default::default(); +} + +static mut NATIVE_ACTIVITY: Option = None; +static mut LOOPER: Option = None; + +pub fn native_activity() -> &'static NativeActivity { + unsafe { NATIVE_ACTIVITY.as_ref().unwrap() } +} + +pub fn native_window() -> RwLockReadGuard<'static, Option> { + NATIVE_WINDOW.read().unwrap() +} + +pub fn input_queue() -> RwLockReadGuard<'static, Option> { + INPUT_QUEUE.read().unwrap() +} + +pub fn content_rect() -> Rect { + CONTENT_RECT.read().unwrap().clone() +} + +lazy_static! { + static ref PIPE: [RawFd; 2] = { + let mut pipe: [RawFd; 2] = Default::default(); + unsafe { libc::pipe(pipe.as_mut_ptr()) }; + pipe + }; +} + +pub fn poll_events() -> Option { + unsafe { + let size = std::mem::size_of::(); + let mut event = Event::Start; + if libc::read(PIPE[0], &mut event as *mut _ as *mut _, size) == size as _ { + Some(event) + } else { + None + } + } +} + +unsafe fn wake(_activity: *mut ANativeActivity, event: Event) { + log::trace!("{:?}", event); + let size = std::mem::size_of::(); + let res = libc::write(PIPE[1], &event as *const _ as *const _, size); + assert_eq!(res, size as _); +} + +#[derive(Clone, Debug, Default, Eq, PartialEq)] +pub struct Rect { + pub left: u32, + pub top: u32, + pub right: u32, + pub bottom: u32, +} + +#[derive(Clone, Debug, Eq, PartialEq)] +#[repr(u8)] +pub enum Event { + Start, + Resume, + SaveInstanceState, + Pause, + Stop, + Destroy, + ConfigChanged, + LowMemory, + WindowLostFocus, + WindowHasFocus, + WindowCreated, + WindowResized, + WindowRedrawNeeded, + WindowDestroyed, + InputQueueCreated, + InputQueueDestroyed, + ContentRectChanged, +} + +pub unsafe fn init( + activity: *mut ANativeActivity, + _saved_state: *mut u8, + _saved_state_size: usize, + main: fn(), +) { + let mut activity = NonNull::new(activity).unwrap(); + let mut callbacks = activity.as_mut().callbacks.as_mut().unwrap(); + callbacks.onStart = Some(on_start); + callbacks.onResume = Some(on_resume); + callbacks.onSaveInstanceState = Some(on_save_instance_state); + callbacks.onPause = Some(on_pause); + callbacks.onStop = Some(on_stop); + callbacks.onDestroy = Some(on_destroy); + callbacks.onWindowFocusChanged = Some(on_window_focus_changed); + callbacks.onNativeWindowCreated = Some(on_window_created); + callbacks.onNativeWindowResized = Some(on_window_resized); + callbacks.onNativeWindowRedrawNeeded = Some(on_window_redraw_needed); + callbacks.onNativeWindowDestroyed = Some(on_window_destroyed); + callbacks.onInputQueueCreated = Some(on_input_queue_created); + callbacks.onInputQueueDestroyed = Some(on_input_queue_destroyed); + callbacks.onContentRectChanged = Some(on_content_rect_changed); + callbacks.onConfigurationChanged = Some(on_configuration_changed); + callbacks.onLowMemory = Some(on_low_memory); + + let activity = NativeActivity::from_ptr(activity); + NATIVE_ACTIVITY = Some(activity); + + let mut logpipe: [RawFd; 2] = Default::default(); + libc::pipe(logpipe.as_mut_ptr()); + libc::dup2(logpipe[1], libc::STDOUT_FILENO); + libc::dup2(logpipe[1], libc::STDERR_FILENO); + thread::spawn(move || { + let tag = CStr::from_bytes_with_nul(b"RustStdoutStderr\0").unwrap(); + let file = File::from_raw_fd(logpipe[0]); + let mut reader = BufReader::new(file); + let mut buffer = String::new(); + loop { + buffer.clear(); + if let Ok(len) = reader.read_line(&mut buffer) { + if len == 0 { + break; + } else { + if let Ok(msg) = CString::new(buffer.clone()) { + android_log(Level::Info, tag, &msg); + } + } + } + } + }); + + thread::spawn(move || { + let looper = ThreadLooper::prepare(); + let foreign = looper.into_foreign(); + foreign + .add_fd(PIPE[0], 0, ALOOPER_EVENT_INPUT as _, 0 as _) + .unwrap(); + LOOPER = Some(foreign); + main() + }); +} + +unsafe extern "C" fn on_start(activity: *mut ANativeActivity) { + wake(activity, Event::Start); +} + +unsafe extern "C" fn on_resume(activity: *mut ANativeActivity) { + wake(activity, Event::Resume); +} + +unsafe extern "C" fn on_save_instance_state( + activity: *mut ANativeActivity, + _out_size: *mut usize, +) -> *mut raw::c_void { + // TODO + wake(activity, Event::SaveInstanceState); + std::ptr::null_mut() +} + +unsafe extern "C" fn on_pause(activity: *mut ANativeActivity) { + wake(activity, Event::Pause); +} + +unsafe extern "C" fn on_stop(activity: *mut ANativeActivity) { + wake(activity, Event::Stop); +} + +unsafe extern "C" fn on_destroy(activity: *mut ANativeActivity) { + wake(activity, Event::Destroy); +} + +unsafe extern "C" fn on_configuration_changed(activity: *mut ANativeActivity) { + wake(activity, Event::ConfigChanged); +} + +unsafe extern "C" fn on_low_memory(activity: *mut ANativeActivity) { + wake(activity, Event::LowMemory); +} + +unsafe extern "C" fn on_window_focus_changed( + activity: *mut ANativeActivity, + has_focus: raw::c_int, +) { + let event = if has_focus == 0 { + Event::WindowLostFocus + } else { + Event::WindowHasFocus + }; + wake(activity, event); +} + +unsafe extern "C" fn on_window_created(activity: *mut ANativeActivity, window: *mut ANativeWindow) { + *NATIVE_WINDOW.write().unwrap() = Some(NativeWindow::from_ptr(NonNull::new(window).unwrap())); + wake(activity, Event::WindowCreated); +} + +unsafe extern "C" fn on_window_resized( + activity: *mut ANativeActivity, + _window: *mut ANativeWindow, +) { + wake(activity, Event::WindowResized); +} + +unsafe extern "C" fn on_window_redraw_needed( + activity: *mut ANativeActivity, + _window: *mut ANativeWindow, +) { + wake(activity, Event::WindowRedrawNeeded); +} + +unsafe extern "C" fn on_window_destroyed( + activity: *mut ANativeActivity, + _window: *mut ANativeWindow, +) { + *NATIVE_WINDOW.write().unwrap() = None; + wake(activity, Event::WindowDestroyed); +} + +unsafe extern "C" fn on_input_queue_created( + activity: *mut ANativeActivity, + queue: *mut AInputQueue, +) { + let input_queue = InputQueue::from_ptr(NonNull::new(queue).unwrap()); + let looper = LOOPER.as_ref().unwrap(); + input_queue.attach_looper(looper, 1); + *INPUT_QUEUE.write().unwrap() = Some(input_queue); + wake(activity, Event::InputQueueCreated); +} + +unsafe extern "C" fn on_input_queue_destroyed( + activity: *mut ANativeActivity, + queue: *mut AInputQueue, +) { + let input_queue = InputQueue::from_ptr(NonNull::new(queue).unwrap()); + input_queue.detach_looper(); + *INPUT_QUEUE.write().unwrap() = None; + wake(activity, Event::InputQueueDestroyed); +} + +unsafe extern "C" fn on_content_rect_changed(activity: *mut ANativeActivity, rect: *const ARect) { + let rect = Rect { + left: (*rect).left as _, + top: (*rect).top as _, + right: (*rect).right as _, + bottom: (*rect).bottom as _, + }; + *CONTENT_RECT.write().unwrap() = rect; + wake(activity, Event::ContentRectChanged); +} diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/.cargo-checksum.json b/third_party/cargo/vendor/ndk-sys-0.1.0/.cargo-checksum.json new file mode 100644 index 0000000..d94fad8 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"6aeadc14bbba806ae9161c1d3c3035eb2f18bdc571943c77a8c7603e448720ad","generate_bindings.sh":"043fbf069428fd89caf0ec7d7e819915a2007b751fef32f5c0879f3b2749ce44","src/ffi_aarch64.rs":"e83f9ce21b2352d252600d4277bde9f502d50873ac36758c5da54434a0ccea27","src/ffi_arm.rs":"b41e61d4aa32f58c85c80b42ba71fa3a5778e2d6ba2b5e020598c82b736fbeb1","src/ffi_i686.rs":"5a2e4c73f32c8417885db366b224d31205ae76eb351393c4b474c9e96e254b05","src/ffi_x86_64.rs":"63d5db5cc84804295beff71fc78bd463c3bbb8d08308077c200a605e108c8f69","src/lib.rs":"3355792c4cb50ce6ece5855910aa958170e1b4a7f38eee51975467a56e27df8b","wrapper.h":"b8930809a5f8e248174771a50e437bc7f1c1ce3c82352eb9019052f40d6fe6a0"},"package":"2b2820aca934aba5ed91c79acc72b6a44048ceacc5d36c035ed4e051f12d887d"} \ No newline at end of file diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/BUILD b/third_party/cargo/vendor/ndk-sys-0.1.0/BUILD new file mode 100644 index 0000000..60f0b63 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/BUILD @@ -0,0 +1,42 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "ndk_sys", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.0", + crate_features = [ + ], +) + diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/Cargo.toml b/third_party/cargo/vendor/ndk-sys-0.1.0/Cargo.toml new file mode 100644 index 0000000..2a7bae6 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/Cargo.toml @@ -0,0 +1,30 @@ +# 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 = "ndk-sys" +version = "0.1.0" +authors = ["Mark Barbone "] +description = "FFI bindings for the Android NDK" +homepage = "https://github.com/rust-windowing/android-ndk-rs" +documentation = "https://docs.rs/android-ndk-sys" +readme = "../README.md" +keywords = ["android", "ndk"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/rust-windowing/android-ndk-rs" +[package.metadata.docs.rs] +features = ["rustdoc"] + +[features] +rustdoc = [] +test = [] diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/generate_bindings.sh b/third_party/cargo/vendor/ndk-sys-0.1.0/generate_bindings.sh new file mode 100644 index 0000000..355d6db --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/generate_bindings.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +while read ARCH && read TARGET ; do + bindgen wrapper.h -o src/ffi_$ARCH.rs -- --sysroot="${NDK_HOME}"/sysroot --target=$TARGET +done << EOF +arm +arm-linux-androideabi +aarch64 +aarch64-linux-android +i686 +i686-linux-android +x86_64 +x86_64-linux-android +EOF diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_aarch64.rs b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_aarch64.rs new file mode 100644 index 0000000..ab29183 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_aarch64.rs @@ -0,0 +1,13841 @@ +/* automatically generated by rust-bindgen */ + +pub const __BIONIC__: u32 = 1; +pub const __WORDSIZE: u32 = 64; +pub const __bos_level: u32 = 0; +pub const __ANDROID_API_FUTURE__: u32 = 10000; +pub const __ANDROID_API__: u32 = 10000; +pub const __ANDROID_API_G__: u32 = 9; +pub const __ANDROID_API_I__: u32 = 14; +pub const __ANDROID_API_J__: u32 = 16; +pub const __ANDROID_API_J_MR1__: u32 = 17; +pub const __ANDROID_API_J_MR2__: u32 = 18; +pub const __ANDROID_API_K__: u32 = 19; +pub const __ANDROID_API_L__: u32 = 21; +pub const __ANDROID_API_L_MR1__: u32 = 22; +pub const __ANDROID_API_M__: u32 = 23; +pub const __ANDROID_API_N__: u32 = 24; +pub const __ANDROID_API_N_MR1__: u32 = 25; +pub const __ANDROID_API_O__: u32 = 26; +pub const __ANDROID_API_O_MR1__: u32 = 27; +pub const __ANDROID_API_P__: u32 = 28; +pub const __ANDROID_API_Q__: u32 = 29; +pub const WCHAR_MIN: u8 = 0u8; +pub const INT8_MIN: i32 = -128; +pub const INT8_MAX: u32 = 127; +pub const INT_LEAST8_MIN: i32 = -128; +pub const INT_LEAST8_MAX: u32 = 127; +pub const INT_FAST8_MIN: i32 = -128; +pub const INT_FAST8_MAX: u32 = 127; +pub const UINT8_MAX: u32 = 255; +pub const UINT_LEAST8_MAX: u32 = 255; +pub const UINT_FAST8_MAX: u32 = 255; +pub const INT16_MIN: i32 = -32768; +pub const INT16_MAX: u32 = 32767; +pub const INT_LEAST16_MIN: i32 = -32768; +pub const INT_LEAST16_MAX: u32 = 32767; +pub const UINT16_MAX: u32 = 65535; +pub const UINT_LEAST16_MAX: u32 = 65535; +pub const INT32_MIN: i32 = -2147483648; +pub const INT32_MAX: u32 = 2147483647; +pub const INT_LEAST32_MIN: i32 = -2147483648; +pub const INT_LEAST32_MAX: u32 = 2147483647; +pub const INT_FAST32_MIN: i32 = -2147483648; +pub const INT_FAST32_MAX: u32 = 2147483647; +pub const UINT32_MAX: u32 = 4294967295; +pub const UINT_LEAST32_MAX: u32 = 4294967295; +pub const UINT_FAST32_MAX: u32 = 4294967295; +pub const SIG_ATOMIC_MAX: u32 = 2147483647; +pub const SIG_ATOMIC_MIN: i32 = -2147483648; +pub const WINT_MAX: u32 = 4294967295; +pub const WINT_MIN: u32 = 0; +pub const __BITS_PER_LONG: u32 = 64; +pub const __FD_SETSIZE: u32 = 1024; +pub const __GNUC_VA_LIST: u32 = 1; +pub const JNI_FALSE: u32 = 0; +pub const JNI_TRUE: u32 = 1; +pub const JNI_VERSION_1_1: u32 = 65537; +pub const JNI_VERSION_1_2: u32 = 65538; +pub const JNI_VERSION_1_4: u32 = 65540; +pub const JNI_VERSION_1_6: u32 = 65542; +pub const JNI_OK: u32 = 0; +pub const JNI_ERR: i32 = -1; +pub const JNI_EDETACHED: i32 = -2; +pub const JNI_EVERSION: i32 = -3; +pub const JNI_ENOMEM: i32 = -4; +pub const JNI_EEXIST: i32 = -5; +pub const JNI_EINVAL: i32 = -6; +pub const JNI_COMMIT: u32 = 1; +pub const JNI_ABORT: u32 = 2; +pub const __PRI_64_prefix: &'static [u8; 2usize] = b"l\0"; +pub const __PRI_PTR_prefix: &'static [u8; 2usize] = b"l\0"; +pub const __PRI_FAST_prefix: &'static [u8; 2usize] = b"l\0"; +pub const PRId8: &'static [u8; 2usize] = b"d\0"; +pub const PRId16: &'static [u8; 2usize] = b"d\0"; +pub const PRId32: &'static [u8; 2usize] = b"d\0"; +pub const PRId64: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdLEAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST16: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST64: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdFAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdFAST16: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdFAST32: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdFAST64: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const PRIdPTR: &'static [u8; 3usize] = b"ld\0"; +pub const PRIi8: &'static [u8; 2usize] = b"i\0"; +pub const PRIi16: &'static [u8; 2usize] = b"i\0"; +pub const PRIi32: &'static [u8; 2usize] = b"i\0"; +pub const PRIi64: &'static [u8; 3usize] = b"li\0"; +pub const PRIiLEAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST16: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST64: &'static [u8; 3usize] = b"li\0"; +pub const PRIiFAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiFAST16: &'static [u8; 3usize] = b"li\0"; +pub const PRIiFAST32: &'static [u8; 3usize] = b"li\0"; +pub const PRIiFAST64: &'static [u8; 3usize] = b"li\0"; +pub const PRIiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const PRIiPTR: &'static [u8; 3usize] = b"li\0"; +pub const PRIo8: &'static [u8; 2usize] = b"o\0"; +pub const PRIo16: &'static [u8; 2usize] = b"o\0"; +pub const PRIo32: &'static [u8; 2usize] = b"o\0"; +pub const PRIo64: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoLEAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST16: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST64: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoFAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoFAST16: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoFAST32: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoFAST64: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const PRIoPTR: &'static [u8; 3usize] = b"lo\0"; +pub const PRIu8: &'static [u8; 2usize] = b"u\0"; +pub const PRIu16: &'static [u8; 2usize] = b"u\0"; +pub const PRIu32: &'static [u8; 2usize] = b"u\0"; +pub const PRIu64: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuLEAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST16: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST64: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuFAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuFAST16: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuFAST32: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuFAST64: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const PRIuPTR: &'static [u8; 3usize] = b"lu\0"; +pub const PRIx8: &'static [u8; 2usize] = b"x\0"; +pub const PRIx16: &'static [u8; 2usize] = b"x\0"; +pub const PRIx32: &'static [u8; 2usize] = b"x\0"; +pub const PRIx64: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxLEAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST16: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST64: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxFAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxFAST16: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxFAST32: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxFAST64: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const PRIxPTR: &'static [u8; 3usize] = b"lx\0"; +pub const PRIX8: &'static [u8; 2usize] = b"X\0"; +pub const PRIX16: &'static [u8; 2usize] = b"X\0"; +pub const PRIX32: &'static [u8; 2usize] = b"X\0"; +pub const PRIX64: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXLEAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST16: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST32: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST64: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXFAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXFAST16: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXFAST32: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXFAST64: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXMAX: &'static [u8; 3usize] = b"jX\0"; +pub const PRIXPTR: &'static [u8; 3usize] = b"lX\0"; +pub const SCNd8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNd16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNd32: &'static [u8; 2usize] = b"d\0"; +pub const SCNd64: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdLEAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdLEAST16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const SCNdLEAST64: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdFAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdFAST16: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdFAST32: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdFAST64: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const SCNdPTR: &'static [u8; 3usize] = b"ld\0"; +pub const SCNi8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNi16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNi32: &'static [u8; 2usize] = b"i\0"; +pub const SCNi64: &'static [u8; 3usize] = b"li\0"; +pub const SCNiLEAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiLEAST16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const SCNiLEAST64: &'static [u8; 3usize] = b"li\0"; +pub const SCNiFAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiFAST16: &'static [u8; 3usize] = b"li\0"; +pub const SCNiFAST32: &'static [u8; 3usize] = b"li\0"; +pub const SCNiFAST64: &'static [u8; 3usize] = b"li\0"; +pub const SCNiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const SCNiPTR: &'static [u8; 3usize] = b"li\0"; +pub const SCNo8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNo16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNo32: &'static [u8; 2usize] = b"o\0"; +pub const SCNo64: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoLEAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoLEAST16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const SCNoLEAST64: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoFAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoFAST16: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoFAST32: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoFAST64: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const SCNoPTR: &'static [u8; 3usize] = b"lo\0"; +pub const SCNu8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNu16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNu32: &'static [u8; 2usize] = b"u\0"; +pub const SCNu64: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuLEAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuLEAST16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const SCNuLEAST64: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuFAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuFAST16: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuFAST32: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuFAST64: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const SCNuPTR: &'static [u8; 3usize] = b"lu\0"; +pub const SCNx8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNx16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNx32: &'static [u8; 2usize] = b"x\0"; +pub const SCNx64: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxLEAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxLEAST16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const SCNxLEAST64: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxFAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxFAST16: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxFAST32: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxFAST64: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const SCNxPTR: &'static [u8; 3usize] = b"lx\0"; +pub const true_: u32 = 1; +pub const false_: u32 = 0; +pub const __bool_true_false_are_defined: u32 = 1; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; +pub const _K_SS_MAXSIZE: u32 = 128; +pub const O_DIRECTORY: u32 = 16384; +pub const O_NOFOLLOW: u32 = 32768; +pub const O_DIRECT: u32 = 65536; +pub const O_LARGEFILE: u32 = 131072; +pub const O_ACCMODE: u32 = 3; +pub const O_RDONLY: u32 = 0; +pub const O_WRONLY: u32 = 1; +pub const O_RDWR: u32 = 2; +pub const O_CREAT: u32 = 64; +pub const O_EXCL: u32 = 128; +pub const O_NOCTTY: u32 = 256; +pub const O_TRUNC: u32 = 512; +pub const O_APPEND: u32 = 1024; +pub const O_NONBLOCK: u32 = 2048; +pub const O_DSYNC: u32 = 4096; +pub const FASYNC: u32 = 8192; +pub const O_NOATIME: u32 = 262144; +pub const O_CLOEXEC: u32 = 524288; +pub const __O_SYNC: u32 = 1048576; +pub const O_SYNC: u32 = 1052672; +pub const O_PATH: u32 = 2097152; +pub const __O_TMPFILE: u32 = 4194304; +pub const O_TMPFILE: u32 = 4210688; +pub const O_TMPFILE_MASK: u32 = 4210752; +pub const O_NDELAY: u32 = 2048; +pub const F_DUPFD: u32 = 0; +pub const F_GETFD: u32 = 1; +pub const F_SETFD: u32 = 2; +pub const F_GETFL: u32 = 3; +pub const F_SETFL: u32 = 4; +pub const F_GETLK: u32 = 5; +pub const F_SETLK: u32 = 6; +pub const F_SETLKW: u32 = 7; +pub const F_SETOWN: u32 = 8; +pub const F_GETOWN: u32 = 9; +pub const F_SETSIG: u32 = 10; +pub const F_GETSIG: u32 = 11; +pub const F_SETOWN_EX: u32 = 15; +pub const F_GETOWN_EX: u32 = 16; +pub const F_GETOWNER_UIDS: u32 = 17; +pub const F_OFD_GETLK: u32 = 36; +pub const F_OFD_SETLK: u32 = 37; +pub const F_OFD_SETLKW: u32 = 38; +pub const F_OWNER_TID: u32 = 0; +pub const F_OWNER_PID: u32 = 1; +pub const F_OWNER_PGRP: u32 = 2; +pub const FD_CLOEXEC: u32 = 1; +pub const F_RDLCK: u32 = 0; +pub const F_WRLCK: u32 = 1; +pub const F_UNLCK: u32 = 2; +pub const F_EXLCK: u32 = 4; +pub const F_SHLCK: u32 = 8; +pub const LOCK_SH: u32 = 1; +pub const LOCK_EX: u32 = 2; +pub const LOCK_NB: u32 = 4; +pub const LOCK_UN: u32 = 8; +pub const LOCK_MAND: u32 = 32; +pub const LOCK_READ: u32 = 64; +pub const LOCK_WRITE: u32 = 128; +pub const LOCK_RW: u32 = 192; +pub const F_LINUX_SPECIFIC_BASE: u32 = 1024; +pub const FIOSETOWN: u32 = 35073; +pub const SIOCSPGRP: u32 = 35074; +pub const FIOGETOWN: u32 = 35075; +pub const SIOCGPGRP: u32 = 35076; +pub const SIOCATMARK: u32 = 35077; +pub const SIOCGSTAMP: u32 = 35078; +pub const SIOCGSTAMPNS: u32 = 35079; +pub const SOL_SOCKET: u32 = 1; +pub const SO_DEBUG: u32 = 1; +pub const SO_REUSEADDR: u32 = 2; +pub const SO_TYPE: u32 = 3; +pub const SO_ERROR: u32 = 4; +pub const SO_DONTROUTE: u32 = 5; +pub const SO_BROADCAST: u32 = 6; +pub const SO_SNDBUF: u32 = 7; +pub const SO_RCVBUF: u32 = 8; +pub const SO_SNDBUFFORCE: u32 = 32; +pub const SO_RCVBUFFORCE: u32 = 33; +pub const SO_KEEPALIVE: u32 = 9; +pub const SO_OOBINLINE: u32 = 10; +pub const SO_NO_CHECK: u32 = 11; +pub const SO_PRIORITY: u32 = 12; +pub const SO_LINGER: u32 = 13; +pub const SO_BSDCOMPAT: u32 = 14; +pub const SO_REUSEPORT: u32 = 15; +pub const SO_PASSCRED: u32 = 16; +pub const SO_PEERCRED: u32 = 17; +pub const SO_RCVLOWAT: u32 = 18; +pub const SO_SNDLOWAT: u32 = 19; +pub const SO_RCVTIMEO: u32 = 20; +pub const SO_SNDTIMEO: u32 = 21; +pub const SO_SECURITY_AUTHENTICATION: u32 = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: u32 = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: u32 = 24; +pub const SO_BINDTODEVICE: u32 = 25; +pub const SO_ATTACH_FILTER: u32 = 26; +pub const SO_DETACH_FILTER: u32 = 27; +pub const SO_GET_FILTER: u32 = 26; +pub const SO_PEERNAME: u32 = 28; +pub const SO_TIMESTAMP: u32 = 29; +pub const SCM_TIMESTAMP: u32 = 29; +pub const SO_ACCEPTCONN: u32 = 30; +pub const SO_PEERSEC: u32 = 31; +pub const SO_PASSSEC: u32 = 34; +pub const SO_TIMESTAMPNS: u32 = 35; +pub const SCM_TIMESTAMPNS: u32 = 35; +pub const SO_MARK: u32 = 36; +pub const SO_TIMESTAMPING: u32 = 37; +pub const SCM_TIMESTAMPING: u32 = 37; +pub const SO_PROTOCOL: u32 = 38; +pub const SO_DOMAIN: u32 = 39; +pub const SO_RXQ_OVFL: u32 = 40; +pub const SO_WIFI_STATUS: u32 = 41; +pub const SCM_WIFI_STATUS: u32 = 41; +pub const SO_PEEK_OFF: u32 = 42; +pub const SO_NOFCS: u32 = 43; +pub const SO_LOCK_FILTER: u32 = 44; +pub const SO_SELECT_ERR_QUEUE: u32 = 45; +pub const SO_BUSY_POLL: u32 = 46; +pub const SO_MAX_PACING_RATE: u32 = 47; +pub const SO_BPF_EXTENSIONS: u32 = 48; +pub const SO_INCOMING_CPU: u32 = 49; +pub const SO_ATTACH_BPF: u32 = 50; +pub const SO_DETACH_BPF: u32 = 27; +pub const SO_ATTACH_REUSEPORT_CBPF: u32 = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: u32 = 52; +pub const SO_CNX_ADVICE: u32 = 53; +pub const SCM_TIMESTAMPING_OPT_STATS: u32 = 54; +pub const SO_MEMINFO: u32 = 55; +pub const SO_INCOMING_NAPI_ID: u32 = 56; +pub const SO_COOKIE: u32 = 57; +pub const SCM_TIMESTAMPING_PKTINFO: u32 = 58; +pub const SO_PEERGROUPS: u32 = 59; +pub const SO_ZEROCOPY: u32 = 60; +pub const SO_TXTIME: u32 = 61; +pub const SCM_TXTIME: u32 = 61; +pub const SOCK_IOC_TYPE: u32 = 137; +pub const SIOCADDRT: u32 = 35083; +pub const SIOCDELRT: u32 = 35084; +pub const SIOCRTMSG: u32 = 35085; +pub const SIOCGIFNAME: u32 = 35088; +pub const SIOCSIFLINK: u32 = 35089; +pub const SIOCGIFCONF: u32 = 35090; +pub const SIOCGIFFLAGS: u32 = 35091; +pub const SIOCSIFFLAGS: u32 = 35092; +pub const SIOCGIFADDR: u32 = 35093; +pub const SIOCSIFADDR: u32 = 35094; +pub const SIOCGIFDSTADDR: u32 = 35095; +pub const SIOCSIFDSTADDR: u32 = 35096; +pub const SIOCGIFBRDADDR: u32 = 35097; +pub const SIOCSIFBRDADDR: u32 = 35098; +pub const SIOCGIFNETMASK: u32 = 35099; +pub const SIOCSIFNETMASK: u32 = 35100; +pub const SIOCGIFMETRIC: u32 = 35101; +pub const SIOCSIFMETRIC: u32 = 35102; +pub const SIOCGIFMEM: u32 = 35103; +pub const SIOCSIFMEM: u32 = 35104; +pub const SIOCGIFMTU: u32 = 35105; +pub const SIOCSIFMTU: u32 = 35106; +pub const SIOCSIFNAME: u32 = 35107; +pub const SIOCSIFHWADDR: u32 = 35108; +pub const SIOCGIFENCAP: u32 = 35109; +pub const SIOCSIFENCAP: u32 = 35110; +pub const SIOCGIFHWADDR: u32 = 35111; +pub const SIOCGIFSLAVE: u32 = 35113; +pub const SIOCSIFSLAVE: u32 = 35120; +pub const SIOCADDMULTI: u32 = 35121; +pub const SIOCDELMULTI: u32 = 35122; +pub const SIOCGIFINDEX: u32 = 35123; +pub const SIOGIFINDEX: u32 = 35123; +pub const SIOCSIFPFLAGS: u32 = 35124; +pub const SIOCGIFPFLAGS: u32 = 35125; +pub const SIOCDIFADDR: u32 = 35126; +pub const SIOCSIFHWBROADCAST: u32 = 35127; +pub const SIOCGIFCOUNT: u32 = 35128; +pub const SIOCGIFBR: u32 = 35136; +pub const SIOCSIFBR: u32 = 35137; +pub const SIOCGIFTXQLEN: u32 = 35138; +pub const SIOCSIFTXQLEN: u32 = 35139; +pub const SIOCETHTOOL: u32 = 35142; +pub const SIOCGMIIPHY: u32 = 35143; +pub const SIOCGMIIREG: u32 = 35144; +pub const SIOCSMIIREG: u32 = 35145; +pub const SIOCWANDEV: u32 = 35146; +pub const SIOCOUTQNSD: u32 = 35147; +pub const SIOCGSKNS: u32 = 35148; +pub const SIOCDARP: u32 = 35155; +pub const SIOCGARP: u32 = 35156; +pub const SIOCSARP: u32 = 35157; +pub const SIOCDRARP: u32 = 35168; +pub const SIOCGRARP: u32 = 35169; +pub const SIOCSRARP: u32 = 35170; +pub const SIOCGIFMAP: u32 = 35184; +pub const SIOCSIFMAP: u32 = 35185; +pub const SIOCADDDLCI: u32 = 35200; +pub const SIOCDELDLCI: u32 = 35201; +pub const SIOCGIFVLAN: u32 = 35202; +pub const SIOCSIFVLAN: u32 = 35203; +pub const SIOCBONDENSLAVE: u32 = 35216; +pub const SIOCBONDRELEASE: u32 = 35217; +pub const SIOCBONDSETHWADDR: u32 = 35218; +pub const SIOCBONDSLAVEINFOQUERY: u32 = 35219; +pub const SIOCBONDINFOQUERY: u32 = 35220; +pub const SIOCBONDCHANGEACTIVE: u32 = 35221; +pub const SIOCBRADDBR: u32 = 35232; +pub const SIOCBRDELBR: u32 = 35233; +pub const SIOCBRADDIF: u32 = 35234; +pub const SIOCBRDELIF: u32 = 35235; +pub const SIOCSHWTSTAMP: u32 = 35248; +pub const SIOCGHWTSTAMP: u32 = 35249; +pub const SIOCDEVPRIVATE: u32 = 35312; +pub const SIOCPROTOPRIVATE: u32 = 35296; +pub const UIO_FASTIOV: u32 = 8; +pub const UIO_MAXIOV: u32 = 1024; +pub const SOCK_STREAM: u32 = 1; +pub const SOCK_DGRAM: u32 = 2; +pub const SOCK_RAW: u32 = 3; +pub const SOCK_RDM: u32 = 4; +pub const SOCK_SEQPACKET: u32 = 5; +pub const SOCK_DCCP: u32 = 6; +pub const SOCK_PACKET: u32 = 10; +pub const SOCK_CLOEXEC: u32 = 524288; +pub const SOCK_NONBLOCK: u32 = 2048; +pub const SCM_RIGHTS: u32 = 1; +pub const SCM_CREDENTIALS: u32 = 2; +pub const SCM_SECURITY: u32 = 3; +pub const AF_UNSPEC: u32 = 0; +pub const AF_UNIX: u32 = 1; +pub const AF_LOCAL: u32 = 1; +pub const AF_INET: u32 = 2; +pub const AF_AX25: u32 = 3; +pub const AF_IPX: u32 = 4; +pub const AF_APPLETALK: u32 = 5; +pub const AF_NETROM: u32 = 6; +pub const AF_BRIDGE: u32 = 7; +pub const AF_ATMPVC: u32 = 8; +pub const AF_X25: u32 = 9; +pub const AF_INET6: u32 = 10; +pub const AF_ROSE: u32 = 11; +pub const AF_DECnet: u32 = 12; +pub const AF_NETBEUI: u32 = 13; +pub const AF_SECURITY: u32 = 14; +pub const AF_KEY: u32 = 15; +pub const AF_NETLINK: u32 = 16; +pub const AF_ROUTE: u32 = 16; +pub const AF_PACKET: u32 = 17; +pub const AF_ASH: u32 = 18; +pub const AF_ECONET: u32 = 19; +pub const AF_ATMSVC: u32 = 20; +pub const AF_RDS: u32 = 21; +pub const AF_SNA: u32 = 22; +pub const AF_IRDA: u32 = 23; +pub const AF_PPPOX: u32 = 24; +pub const AF_WANPIPE: u32 = 25; +pub const AF_LLC: u32 = 26; +pub const AF_CAN: u32 = 29; +pub const AF_TIPC: u32 = 30; +pub const AF_BLUETOOTH: u32 = 31; +pub const AF_IUCV: u32 = 32; +pub const AF_RXRPC: u32 = 33; +pub const AF_ISDN: u32 = 34; +pub const AF_PHONET: u32 = 35; +pub const AF_IEEE802154: u32 = 36; +pub const AF_CAIF: u32 = 37; +pub const AF_ALG: u32 = 38; +pub const AF_NFC: u32 = 39; +pub const AF_VSOCK: u32 = 40; +pub const AF_KCM: u32 = 41; +pub const AF_QIPCRTR: u32 = 42; +pub const AF_MAX: u32 = 43; +pub const PF_UNSPEC: u32 = 0; +pub const PF_UNIX: u32 = 1; +pub const PF_LOCAL: u32 = 1; +pub const PF_INET: u32 = 2; +pub const PF_AX25: u32 = 3; +pub const PF_IPX: u32 = 4; +pub const PF_APPLETALK: u32 = 5; +pub const PF_NETROM: u32 = 6; +pub const PF_BRIDGE: u32 = 7; +pub const PF_ATMPVC: u32 = 8; +pub const PF_X25: u32 = 9; +pub const PF_INET6: u32 = 10; +pub const PF_ROSE: u32 = 11; +pub const PF_DECnet: u32 = 12; +pub const PF_NETBEUI: u32 = 13; +pub const PF_SECURITY: u32 = 14; +pub const PF_KEY: u32 = 15; +pub const PF_NETLINK: u32 = 16; +pub const PF_ROUTE: u32 = 16; +pub const PF_PACKET: u32 = 17; +pub const PF_ASH: u32 = 18; +pub const PF_ECONET: u32 = 19; +pub const PF_ATMSVC: u32 = 20; +pub const PF_RDS: u32 = 21; +pub const PF_SNA: u32 = 22; +pub const PF_IRDA: u32 = 23; +pub const PF_PPPOX: u32 = 24; +pub const PF_WANPIPE: u32 = 25; +pub const PF_LLC: u32 = 26; +pub const PF_CAN: u32 = 29; +pub const PF_TIPC: u32 = 30; +pub const PF_BLUETOOTH: u32 = 31; +pub const PF_IUCV: u32 = 32; +pub const PF_RXRPC: u32 = 33; +pub const PF_ISDN: u32 = 34; +pub const PF_PHONET: u32 = 35; +pub const PF_IEEE802154: u32 = 36; +pub const PF_CAIF: u32 = 37; +pub const PF_ALG: u32 = 38; +pub const PF_NFC: u32 = 39; +pub const PF_VSOCK: u32 = 40; +pub const PF_KCM: u32 = 41; +pub const PF_QIPCRTR: u32 = 42; +pub const PF_MAX: u32 = 43; +pub const SOMAXCONN: u32 = 128; +pub const MSG_OOB: u32 = 1; +pub const MSG_PEEK: u32 = 2; +pub const MSG_DONTROUTE: u32 = 4; +pub const MSG_TRYHARD: u32 = 4; +pub const MSG_CTRUNC: u32 = 8; +pub const MSG_PROBE: u32 = 16; +pub const MSG_TRUNC: u32 = 32; +pub const MSG_DONTWAIT: u32 = 64; +pub const MSG_EOR: u32 = 128; +pub const MSG_WAITALL: u32 = 256; +pub const MSG_FIN: u32 = 512; +pub const MSG_SYN: u32 = 1024; +pub const MSG_CONFIRM: u32 = 2048; +pub const MSG_RST: u32 = 4096; +pub const MSG_ERRQUEUE: u32 = 8192; +pub const MSG_NOSIGNAL: u32 = 16384; +pub const MSG_MORE: u32 = 32768; +pub const MSG_WAITFORONE: u32 = 65536; +pub const MSG_BATCH: u32 = 262144; +pub const MSG_FASTOPEN: u32 = 536870912; +pub const MSG_CMSG_CLOEXEC: u32 = 1073741824; +pub const MSG_EOF: u32 = 512; +pub const MSG_CMSG_COMPAT: u32 = 0; +pub const SOL_IP: u32 = 0; +pub const SOL_TCP: u32 = 6; +pub const SOL_UDP: u32 = 17; +pub const SOL_IPV6: u32 = 41; +pub const SOL_ICMPV6: u32 = 58; +pub const SOL_SCTP: u32 = 132; +pub const SOL_RAW: u32 = 255; +pub const SOL_IPX: u32 = 256; +pub const SOL_AX25: u32 = 257; +pub const SOL_ATALK: u32 = 258; +pub const SOL_NETROM: u32 = 259; +pub const SOL_ROSE: u32 = 260; +pub const SOL_DECNET: u32 = 261; +pub const SOL_X25: u32 = 262; +pub const SOL_PACKET: u32 = 263; +pub const SOL_ATM: u32 = 264; +pub const SOL_AAL: u32 = 265; +pub const SOL_IRDA: u32 = 266; +pub const SOL_NETBEUI: u32 = 267; +pub const SOL_LLC: u32 = 268; +pub const SOL_DCCP: u32 = 269; +pub const SOL_NETLINK: u32 = 270; +pub const SOL_TIPC: u32 = 271; +pub const SOL_RXRPC: u32 = 272; +pub const SOL_PPPOL2TP: u32 = 273; +pub const SOL_BLUETOOTH: u32 = 274; +pub const SOL_PNPIPE: u32 = 275; +pub const SOL_RDS: u32 = 276; +pub const SOL_IUCV: u32 = 277; +pub const SOL_CAIF: u32 = 278; +pub const SOL_ALG: u32 = 279; +pub const SOL_NFC: u32 = 280; +pub const SOL_KCM: u32 = 281; +pub const SOL_TLS: u32 = 282; +pub const IPX_TYPE: u32 = 1; +pub const _PATH_HEQUIV: &'static [u8; 24usize] = b"/system/etc/hosts.equiv\0"; +pub const _PATH_HOSTS: &'static [u8; 18usize] = b"/system/etc/hosts\0"; +pub const _PATH_NETWORKS: &'static [u8; 21usize] = b"/system/etc/networks\0"; +pub const _PATH_PROTOCOLS: &'static [u8; 22usize] = b"/system/etc/protocols\0"; +pub const _PATH_SERVICES: &'static [u8; 21usize] = b"/system/etc/services\0"; +pub const NETDB_INTERNAL: i32 = -1; +pub const NETDB_SUCCESS: u32 = 0; +pub const HOST_NOT_FOUND: u32 = 1; +pub const TRY_AGAIN: u32 = 2; +pub const NO_RECOVERY: u32 = 3; +pub const NO_DATA: u32 = 4; +pub const NO_ADDRESS: u32 = 4; +pub const EAI_ADDRFAMILY: u32 = 1; +pub const EAI_AGAIN: u32 = 2; +pub const EAI_BADFLAGS: u32 = 3; +pub const EAI_FAIL: u32 = 4; +pub const EAI_FAMILY: u32 = 5; +pub const EAI_MEMORY: u32 = 6; +pub const EAI_NODATA: u32 = 7; +pub const EAI_NONAME: u32 = 8; +pub const EAI_SERVICE: u32 = 9; +pub const EAI_SOCKTYPE: u32 = 10; +pub const EAI_SYSTEM: u32 = 11; +pub const EAI_BADHINTS: u32 = 12; +pub const EAI_PROTOCOL: u32 = 13; +pub const EAI_OVERFLOW: u32 = 14; +pub const EAI_MAX: u32 = 15; +pub const AI_PASSIVE: u32 = 1; +pub const AI_CANONNAME: u32 = 2; +pub const AI_NUMERICHOST: u32 = 4; +pub const AI_NUMERICSERV: u32 = 8; +pub const AI_ALL: u32 = 256; +pub const AI_V4MAPPED_CFG: u32 = 512; +pub const AI_ADDRCONFIG: u32 = 1024; +pub const AI_V4MAPPED: u32 = 2048; +pub const AI_DEFAULT: u32 = 1536; +pub const NI_MAXHOST: u32 = 1025; +pub const NI_MAXSERV: u32 = 32; +pub const NI_NOFQDN: u32 = 1; +pub const NI_NUMERICHOST: u32 = 2; +pub const NI_NAMEREQD: u32 = 4; +pub const NI_NUMERICSERV: u32 = 8; +pub const NI_DGRAM: u32 = 16; +pub const SCOPE_DELIMITER: u8 = 37u8; +pub const IPPORT_RESERVED: u32 = 1024; +pub const WNOHANG: u32 = 1; +pub const WUNTRACED: u32 = 2; +pub const WSTOPPED: u32 = 2; +pub const WEXITED: u32 = 4; +pub const WCONTINUED: u32 = 8; +pub const WNOWAIT: u32 = 16777216; +pub const __WNOTHREAD: u32 = 536870912; +pub const __WALL: u32 = 1073741824; +pub const __WCLONE: u32 = 2147483648; +pub const P_ALL: u32 = 0; +pub const P_PID: u32 = 1; +pub const P_PGID: u32 = 2; +pub const SEEK_SET: u32 = 0; +pub const SEEK_CUR: u32 = 1; +pub const SEEK_END: u32 = 2; +pub const _IOFBF: u32 = 0; +pub const _IOLBF: u32 = 1; +pub const _IONBF: u32 = 2; +pub const BUFSIZ: u32 = 1024; +pub const EOF: i32 = -1; +pub const FOPEN_MAX: u32 = 20; +pub const FILENAME_MAX: u32 = 4096; +pub const L_tmpnam: u32 = 4096; +pub const TMP_MAX: u32 = 308915776; +pub const P_tmpdir: &'static [u8; 6usize] = b"/tmp/\0"; +pub const L_ctermid: u32 = 1024; +pub const STRUCT_MALLINFO_DECLARED: u32 = 1; +pub const M_DECAY_TIME: i32 = -100; +pub const M_PURGE: i32 = -101; +pub const EXIT_FAILURE: u32 = 1; +pub const EXIT_SUCCESS: u32 = 0; +pub const RAND_MAX: u32 = 2147483647; +pub const __NDK_MAJOR__: u32 = 20; +pub const __NDK_MINOR__: u32 = 0; +pub const __NDK_BETA__: u32 = 0; +pub const __NDK_BUILD__: u32 = 5594570; +pub const __NDK_CANARY__: u32 = 0; +pub const NR_OPEN: u32 = 1024; +pub const NGROUPS_MAX: u32 = 65536; +pub const ARG_MAX: u32 = 131072; +pub const LINK_MAX: u32 = 127; +pub const MAX_CANON: u32 = 255; +pub const MAX_INPUT: u32 = 255; +pub const NAME_MAX: u32 = 255; +pub const PATH_MAX: u32 = 4096; +pub const PIPE_BUF: u32 = 4096; +pub const XATTR_NAME_MAX: u32 = 255; +pub const XATTR_SIZE_MAX: u32 = 65536; +pub const XATTR_LIST_MAX: u32 = 65536; +pub const RTSIG_MAX: u32 = 32; +pub const PASS_MAX: u32 = 128; +pub const NL_ARGMAX: u32 = 9; +pub const NL_LANGMAX: u32 = 14; +pub const NL_MSGMAX: u32 = 32767; +pub const NL_NMAX: u32 = 1; +pub const NL_SETMAX: u32 = 255; +pub const NL_TEXTMAX: u32 = 255; +pub const CHAR_BIT: u32 = 8; +pub const LONG_BIT: u32 = 64; +pub const WORD_BIT: u32 = 32; +pub const SCHAR_MAX: u32 = 127; +pub const SCHAR_MIN: i32 = -128; +pub const UCHAR_MAX: u32 = 255; +pub const CHAR_MIN: u32 = 0; +pub const CHAR_MAX: u32 = 255; +pub const USHRT_MAX: u32 = 65535; +pub const SHRT_MAX: u32 = 32767; +pub const SHRT_MIN: i32 = -32768; +pub const UINT_MAX: u32 = 4294967295; +pub const INT_MAX: u32 = 2147483647; +pub const INT_MIN: i32 = -2147483648; +pub const ULONG_MAX: i32 = -1; +pub const LONG_MAX: u64 = 9223372036854775807; +pub const LONG_MIN: i64 = -9223372036854775808; +pub const ULLONG_MAX: i32 = -1; +pub const LLONG_MAX: u64 = 9223372036854775807; +pub const LLONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MAX: u64 = 9223372036854775807; +pub const ULONG_LONG_MAX: i32 = -1; +pub const UID_MAX: u32 = 4294967295; +pub const GID_MAX: u32 = 4294967295; +pub const SIZE_T_MAX: i32 = -1; +pub const SSIZE_MAX: u64 = 9223372036854775807; +pub const MB_LEN_MAX: u32 = 4; +pub const NZERO: u32 = 20; +pub const IOV_MAX: u32 = 1024; +pub const SEM_VALUE_MAX: u32 = 1073741823; +pub const _POSIX_VERSION: u32 = 200809; +pub const _POSIX2_VERSION: u32 = 200809; +pub const _XOPEN_VERSION: u32 = 700; +pub const __BIONIC_POSIX_FEATURE_MISSING: i32 = -1; +pub const _POSIX_ASYNCHRONOUS_IO: i32 = -1; +pub const _POSIX_CHOWN_RESTRICTED: u32 = 1; +pub const _POSIX_CPUTIME: u32 = 200809; +pub const _POSIX_FSYNC: u32 = 200809; +pub const _POSIX_IPV6: u32 = 200809; +pub const _POSIX_MAPPED_FILES: u32 = 200809; +pub const _POSIX_MEMLOCK_RANGE: u32 = 200809; +pub const _POSIX_MEMORY_PROTECTION: u32 = 200809; +pub const _POSIX_MESSAGE_PASSING: i32 = -1; +pub const _POSIX_MONOTONIC_CLOCK: u32 = 200809; +pub const _POSIX_NO_TRUNC: u32 = 1; +pub const _POSIX_PRIORITIZED_IO: i32 = -1; +pub const _POSIX_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_RAW_SOCKETS: u32 = 200809; +pub const _POSIX_READER_WRITER_LOCKS: u32 = 200809; +pub const _POSIX_REGEXP: u32 = 1; +pub const _POSIX_SAVED_IDS: u32 = 1; +pub const _POSIX_SEMAPHORES: u32 = 200809; +pub const _POSIX_SHARED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_SHELL: u32 = 1; +pub const _POSIX_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_SYNCHRONIZED_IO: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKADDR: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKSIZE: u32 = 200809; +pub const _POSIX_THREAD_CPUTIME: u32 = 200809; +pub const _POSIX_THREAD_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_THREAD_PROCESS_SHARED: u32 = 200809; +pub const _POSIX_THREAD_ROBUST_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_ROBUST_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_SAFE_FUNCTIONS: u32 = 200809; +pub const _POSIX_THREAD_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_THREADS: u32 = 200809; +pub const _POSIX_TIMERS: u32 = 200809; +pub const _POSIX_TRACE: i32 = -1; +pub const _POSIX_TRACE_EVENT_FILTER: i32 = -1; +pub const _POSIX_TRACE_INHERIT: i32 = -1; +pub const _POSIX_TRACE_LOG: i32 = -1; +pub const _POSIX_TYPED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_VDISABLE: u8 = 0u8; +pub const _POSIX2_C_BIND: u32 = 200809; +pub const _POSIX2_C_DEV: i32 = -1; +pub const _POSIX2_CHAR_TERM: u32 = 200809; +pub const _POSIX2_FORT_DEV: i32 = -1; +pub const _POSIX2_FORT_RUN: i32 = -1; +pub const _POSIX2_LOCALEDEF: i32 = -1; +pub const _POSIX2_SW_DEV: i32 = -1; +pub const _POSIX2_UPE: i32 = -1; +pub const _POSIX_V7_ILP32_OFF32: i32 = -1; +pub const _POSIX_V7_ILP32_OFFBIG: i32 = -1; +pub const _POSIX_V7_LP64_OFF64: u32 = 1; +pub const _POSIX_V7_LPBIG_OFFBIG: u32 = 1; +pub const _XOPEN_CRYPT: i32 = -1; +pub const _XOPEN_ENH_I18N: u32 = 1; +pub const _XOPEN_LEGACY: i32 = -1; +pub const _XOPEN_REALTIME: u32 = 1; +pub const _XOPEN_REALTIME_THREADS: u32 = 1; +pub const _XOPEN_SHM: u32 = 1; +pub const _XOPEN_STREAMS: i32 = -1; +pub const _XOPEN_UNIX: u32 = 1; +pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; +pub const _POSIX_AIO_MAX: u32 = 1; +pub const _POSIX_ARG_MAX: u32 = 4096; +pub const _POSIX_CHILD_MAX: u32 = 25; +pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; +pub const _POSIX_DELAYTIMER_MAX: u32 = 32; +pub const _POSIX_HOST_NAME_MAX: u32 = 255; +pub const _POSIX_LINK_MAX: u32 = 8; +pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; +pub const _POSIX_MAX_CANON: u32 = 255; +pub const _POSIX_MAX_INPUT: u32 = 255; +pub const _POSIX_MQ_OPEN_MAX: u32 = 8; +pub const _POSIX_MQ_PRIO_MAX: u32 = 32; +pub const _POSIX_NAME_MAX: u32 = 14; +pub const _POSIX_NGROUPS_MAX: u32 = 8; +pub const _POSIX_OPEN_MAX: u32 = 20; +pub const _POSIX_PATH_MAX: u32 = 256; +pub const _POSIX_PIPE_BUF: u32 = 512; +pub const _POSIX_RE_DUP_MAX: u32 = 255; +pub const _POSIX_RTSIG_MAX: u32 = 8; +pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; +pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; +pub const _POSIX_SIGQUEUE_MAX: u32 = 32; +pub const _POSIX_SSIZE_MAX: u32 = 32767; +pub const _POSIX_STREAM_MAX: u32 = 8; +pub const _POSIX_SS_REPL_MAX: u32 = 4; +pub const _POSIX_SYMLINK_MAX: u32 = 255; +pub const _POSIX_SYMLOOP_MAX: u32 = 8; +pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; +pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; +pub const _POSIX_TIMER_MAX: u32 = 32; +pub const _POSIX_TRACE_EVENT_NAME_MAX: u32 = 30; +pub const _POSIX_TRACE_NAME_MAX: u32 = 8; +pub const _POSIX_TRACE_SYS_MAX: u32 = 8; +pub const _POSIX_TRACE_USER_EVENT_MAX: u32 = 32; +pub const _POSIX_TTY_NAME_MAX: u32 = 9; +pub const _POSIX_TZNAME_MAX: u32 = 6; +pub const _POSIX2_BC_BASE_MAX: u32 = 99; +pub const _POSIX2_BC_DIM_MAX: u32 = 2048; +pub const _POSIX2_BC_SCALE_MAX: u32 = 99; +pub const _POSIX2_BC_STRING_MAX: u32 = 1000; +pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; +pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; +pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; +pub const _POSIX2_LINE_MAX: u32 = 2048; +pub const _POSIX2_RE_DUP_MAX: u32 = 255; +pub const _XOPEN_IOV_MAX: u32 = 16; +pub const _XOPEN_NAME_MAX: u32 = 255; +pub const _XOPEN_PATH_MAX: u32 = 1024; +pub const HOST_NAME_MAX: u32 = 255; +pub const LOGIN_NAME_MAX: u32 = 256; +pub const TTY_NAME_MAX: u32 = 32; +pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const PTHREAD_KEYS_MAX: u32 = 128; +pub const FP_INFINITE: u32 = 1; +pub const FP_NAN: u32 = 2; +pub const FP_NORMAL: u32 = 4; +pub const FP_SUBNORMAL: u32 = 8; +pub const FP_ZERO: u32 = 16; +pub const FP_ILOGB0: i32 = -2147483647; +pub const FP_ILOGBNAN: u32 = 2147483647; +pub const MATH_ERRNO: u32 = 1; +pub const MATH_ERREXCEPT: u32 = 2; +pub const math_errhandling: u32 = 2; +pub const M_E: f64 = 2.718281828459045; +pub const M_LOG2E: f64 = 1.4426950408889634; +pub const M_LOG10E: f64 = 0.4342944819032518; +pub const M_LN2: f64 = 0.6931471805599453; +pub const M_LN10: f64 = 2.302585092994046; +pub const M_PI: f64 = 3.141592653589793; +pub const M_PI_2: f64 = 1.5707963267948966; +pub const M_PI_4: f64 = 0.7853981633974483; +pub const M_1_PI: f64 = 0.3183098861837907; +pub const M_2_PI: f64 = 0.6366197723675814; +pub const M_2_SQRTPI: f64 = 1.1283791670955126; +pub const M_SQRT2: f64 = 1.4142135623730951; +pub const M_SQRT1_2: f64 = 0.7071067811865476; +pub const ASENSOR_FIFO_COUNT_INVALID: i32 = -1; +pub const ASENSOR_DELAY_INVALID: i32 = -2147483648; +pub const ASENSOR_INVALID: i32 = -1; +pub const ASENSOR_STANDARD_GRAVITY: f64 = 9.80665; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MAX: f64 = 60.0; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MIN: f64 = 30.0; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const SYNC_IOC_MAGIC: u8 = 62u8; +extern "C" { + pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_get_device_api_level() -> ::std::os::raw::c_int; +} +pub type wchar_t = ::std::os::raw::c_uint; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[test] +fn bindgen_test_layout_max_align_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __uintptr_t = ::std::os::raw::c_ulong; +pub type int_least8_t = i8; +pub type uint_least8_t = u8; +pub type int_least16_t = i16; +pub type uint_least16_t = u16; +pub type int_least32_t = i32; +pub type uint_least32_t = u32; +pub type int_least64_t = i64; +pub type uint_least64_t = u64; +pub type int_fast8_t = i8; +pub type uint_fast8_t = u8; +pub type int_fast64_t = i64; +pub type uint_fast64_t = u64; +pub type int_fast16_t = i64; +pub type uint_fast16_t = u64; +pub type int_fast32_t = i64; +pub type uint_fast32_t = u64; +pub type uintmax_t = u64; +pub type intmax_t = i64; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_dev_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_attr_t { + pub flags: u32, + pub stack_base: *mut ::std::os::raw::c_void, + pub stack_size: usize, + pub guard_size: usize, + pub sched_policy: i32, + pub sched_priority: i32, + pub __reserved: [::std::os::raw::c_char; 16usize], +} +#[test] +fn bindgen_test_layout_pthread_attr_t() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(pthread_attr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_attr_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(guard_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_priority) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_barrier_t { + pub __private: [i64; 4usize], +} +#[test] +fn bindgen_test_layout_pthread_barrier_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrier_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_barrierattr_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_cond_t { + pub __private: [i32; 12usize], +} +#[test] +fn bindgen_test_layout_pthread_cond_t() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(pthread_cond_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_cond_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_condattr_t = ::std::os::raw::c_long; +pub type pthread_key_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_mutex_t { + pub __private: [i32; 10usize], +} +#[test] +fn bindgen_test_layout_pthread_mutex_t() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_mutexattr_t = ::std::os::raw::c_long; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_rwlock_t { + pub __private: [i32; 14usize], +} +#[test] +fn bindgen_test_layout_pthread_rwlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_rwlockattr_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_spinlock_t { + pub __private: i64, +} +#[test] +fn bindgen_test_layout_pthread_spinlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_spinlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_t = ::std::os::raw::c_long; +pub type __gid_t = __kernel_gid32_t; +pub type gid_t = __gid_t; +pub type __uid_t = __kernel_uid32_t; +pub type uid_t = __uid_t; +pub type __pid_t = __kernel_pid_t; +pub type pid_t = __pid_t; +pub type __id_t = u32; +pub type id_t = __id_t; +pub type blkcnt_t = ::std::os::raw::c_ulong; +pub type blksize_t = ::std::os::raw::c_ulong; +pub type caddr_t = __kernel_caddr_t; +pub type clock_t = __kernel_clock_t; +pub type __clockid_t = __kernel_clockid_t; +pub type clockid_t = __clockid_t; +pub type daddr_t = __kernel_daddr_t; +pub type fsblkcnt_t = ::std::os::raw::c_ulong; +pub type fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __mode_t = __kernel_mode_t; +pub type mode_t = __mode_t; +pub type __key_t = __kernel_key_t; +pub type key_t = __key_t; +pub type __ino_t = __kernel_ino_t; +pub type ino_t = __ino_t; +pub type ino64_t = u64; +pub type __nlink_t = u32; +pub type nlink_t = __nlink_t; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type timer_t = __timer_t; +pub type __suseconds_t = __kernel_suseconds_t; +pub type suseconds_t = __suseconds_t; +pub type __useconds_t = u32; +pub type useconds_t = __useconds_t; +pub type dev_t = u64; +pub type __time_t = __kernel_time_t; +pub type time_t = __time_t; +pub type off_t = i64; +pub type loff_t = off_t; +pub type off64_t = loff_t; +pub type __socklen_t = u32; +pub type socklen_t = __socklen_t; +pub type uint_t = ::std::os::raw::c_uint; +pub type uint = ::std::os::raw::c_uint; +pub type u_char = ::std::os::raw::c_uchar; +pub type u_short = ::std::os::raw::c_ushort; +pub type u_int = ::std::os::raw::c_uint; +pub type u_long = ::std::os::raw::c_ulong; +pub type u_int32_t = u32; +pub type u_int16_t = u16; +pub type u_int8_t = u8; +pub type u_int64_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetDir { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAsset { + _unused: [u8; 0], +} +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; +pub type _bindgen_ty_1 = u32; +extern "C" { + pub fn AAssetManager_openDir( + mgr: *mut AAssetManager, + dirName: *const ::std::os::raw::c_char, + ) -> *mut AAssetDir; +} +extern "C" { + pub fn AAssetManager_open( + mgr: *mut AAssetManager, + filename: *const ::std::os::raw::c_char, + mode: ::std::os::raw::c_int, + ) -> *mut AAsset; +} +extern "C" { + pub fn AAssetDir_getNextFileName(assetDir: *mut AAssetDir) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AAssetDir_rewind(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAssetDir_close(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAsset_read( + asset: *mut AAsset, + buf: *mut ::std::os::raw::c_void, + count: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_seek(asset: *mut AAsset, offset: off_t, whence: ::std::os::raw::c_int) -> off_t; +} +extern "C" { + pub fn AAsset_seek64( + asset: *mut AAsset, + offset: off64_t, + whence: ::std::os::raw::c_int, + ) -> off64_t; +} +extern "C" { + pub fn AAsset_close(asset: *mut AAsset); +} +extern "C" { + pub fn AAsset_getBuffer(asset: *mut AAsset) -> *const ::std::os::raw::c_void; +} +extern "C" { + pub fn AAsset_getLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_getRemainingLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getRemainingLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_openFileDescriptor( + asset: *mut AAsset, + outStart: *mut off_t, + outLength: *mut off_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_openFileDescriptor64( + asset: *mut AAsset, + outStart: *mut off64_t, + outLength: *mut off64_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_isAllocated(asset: *mut AAsset) -> ::std::os::raw::c_int; +} +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type jboolean = u8; +pub type jbyte = i8; +pub type jchar = u16; +pub type jshort = i16; +pub type jint = i32; +pub type jlong = i64; +pub type jfloat = f32; +pub type jdouble = f64; +pub type jsize = jint; +pub type jobject = *mut ::std::os::raw::c_void; +pub type jclass = jobject; +pub type jstring = jobject; +pub type jarray = jobject; +pub type jobjectArray = jarray; +pub type jbooleanArray = jarray; +pub type jbyteArray = jarray; +pub type jcharArray = jarray; +pub type jshortArray = jarray; +pub type jintArray = jarray; +pub type jlongArray = jarray; +pub type jfloatArray = jarray; +pub type jdoubleArray = jarray; +pub type jthrowable = jobject; +pub type jweak = jobject; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jfieldID { + _unused: [u8; 0], +} +pub type jfieldID = *mut _jfieldID; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jmethodID { + _unused: [u8; 0], +} +pub type jmethodID = *mut _jmethodID; +#[repr(C)] +#[derive(Copy, Clone)] +pub union jvalue { + pub z: jboolean, + pub b: jbyte, + pub c: jchar, + pub s: jshort, + pub i: jint, + pub j: jlong, + pub f: jfloat, + pub d: jdouble, + pub l: jobject, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_jvalue() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(jvalue)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(jvalue)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).z as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(z)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(b)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(c)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(s)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(i)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).j as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(j)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(f)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(d)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(l)) + ); +} +pub const jobjectRefType_JNIInvalidRefType: jobjectRefType = 0; +pub const jobjectRefType_JNILocalRefType: jobjectRefType = 1; +pub const jobjectRefType_JNIGlobalRefType: jobjectRefType = 2; +pub const jobjectRefType_JNIWeakGlobalRefType: jobjectRefType = 3; +pub type jobjectRefType = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeMethod { + pub name: *const ::std::os::raw::c_char, + pub signature: *const ::std::os::raw::c_char, + pub fnPtr: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JNINativeMethod() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(JNINativeMethod)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNINativeMethod)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).signature as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fnPtr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(fnPtr) + ) + ); +} +pub type C_JNIEnv = *const JNINativeInterface; +pub type JNIEnv = *const JNINativeInterface; +pub type JavaVM = *const JNIInvokeInterface; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub reserved3: *mut ::std::os::raw::c_void, + pub GetVersion: ::std::option::Option jint>, + pub DefineClass: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *const ::std::os::raw::c_char, + arg3: jobject, + arg4: *const jbyte, + arg5: jsize, + ) -> jclass, + >, + pub FindClass: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jclass, + >, + pub FromReflectedMethod: + ::std::option::Option jmethodID>, + pub FromReflectedField: + ::std::option::Option jfieldID>, + pub ToReflectedMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: jboolean, + ) -> jobject, + >, + pub GetSuperclass: + ::std::option::Option jclass>, + pub IsAssignableFrom: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jclass) -> jboolean, + >, + pub ToReflectedField: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jfieldID, + arg4: jboolean, + ) -> jobject, + >, + pub Throw: + ::std::option::Option jint>, + pub ThrowNew: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + ) -> jint, + >, + pub ExceptionOccurred: + ::std::option::Option jthrowable>, + pub ExceptionDescribe: ::std::option::Option, + pub ExceptionClear: ::std::option::Option, + pub FatalError: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char), + >, + pub PushLocalFrame: + ::std::option::Option jint>, + pub PopLocalFrame: + ::std::option::Option jobject>, + pub NewGlobalRef: + ::std::option::Option jobject>, + pub DeleteGlobalRef: + ::std::option::Option, + pub DeleteLocalRef: + ::std::option::Option, + pub IsSameObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jobject) -> jboolean, + >, + pub NewLocalRef: + ::std::option::Option jobject>, + pub EnsureLocalCapacity: + ::std::option::Option jint>, + pub AllocObject: + ::std::option::Option jobject>, + pub NewObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub NewObjectV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub NewObjectA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub GetObjectClass: + ::std::option::Option jclass>, + pub IsInstanceOf: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass) -> jboolean, + >, + pub GetMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jobject, + >, + pub CallObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub CallObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jboolean, + >, + pub CallBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jboolean, + >, + pub CallBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jbyte, + >, + pub CallByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jbyte, + >, + pub CallByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jchar, + >, + pub CallCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jchar, + >, + pub CallCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jshort, + >, + pub CallShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jshort, + >, + pub CallShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jint, + >, + pub CallIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jint, + >, + pub CallIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jlong, + >, + pub CallLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jlong, + >, + pub CallLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jfloat, + >, + pub CallFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jfloat, + >, + pub CallFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jdouble, + >, + pub CallDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jdouble, + >, + pub CallDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...), + >, + pub CallVoidMethodV: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, arg4: va_list), + >, + pub CallVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ), + >, + pub CallNonvirtualObjectMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jobject, + >, + pub CallNonvirtualObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jobject, + >, + pub CallNonvirtualObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jobject, + >, + pub CallNonvirtualBooleanMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jboolean, + >, + pub CallNonvirtualByteMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jbyte, + >, + pub CallNonvirtualByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jbyte, + >, + pub CallNonvirtualByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jbyte, + >, + pub CallNonvirtualCharMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jchar, + >, + pub CallNonvirtualCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jchar, + >, + pub CallNonvirtualCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jchar, + >, + pub CallNonvirtualShortMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jshort, + >, + pub CallNonvirtualShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jshort, + >, + pub CallNonvirtualShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jshort, + >, + pub CallNonvirtualIntMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jint, + >, + pub CallNonvirtualIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jint, + >, + pub CallNonvirtualIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jint, + >, + pub CallNonvirtualLongMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jlong, + >, + pub CallNonvirtualLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jlong, + >, + pub CallNonvirtualLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jlong, + >, + pub CallNonvirtualFloatMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jfloat, + >, + pub CallNonvirtualDoubleMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jdouble, + >, + pub CallNonvirtualVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass, arg4: jmethodID, ...), + >, + pub CallNonvirtualVoidMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ), + >, + pub CallNonvirtualVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ), + >, + pub GetFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jobject, + >, + pub GetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jboolean, + >, + pub GetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jbyte, + >, + pub GetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jchar, + >, + pub GetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jshort, + >, + pub GetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jint, + >, + pub GetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jlong, + >, + pub GetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jfloat, + >, + pub GetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jdouble, + >, + pub SetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jobject), + >, + pub SetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jboolean), + >, + pub SetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jbyte), + >, + pub SetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jchar), + >, + pub SetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jshort), + >, + pub SetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jint), + >, + pub SetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jlong), + >, + pub SetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jfloat), + >, + pub SetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jdouble), + >, + pub GetStaticMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallStaticObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub CallStaticObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub CallStaticObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallStaticBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jboolean, + >, + pub CallStaticBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jboolean, + >, + pub CallStaticBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallStaticByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jbyte, + >, + pub CallStaticByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jbyte, + >, + pub CallStaticByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallStaticCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jchar, + >, + pub CallStaticCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jchar, + >, + pub CallStaticCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallStaticShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jshort, + >, + pub CallStaticShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jshort, + >, + pub CallStaticShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallStaticIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jint, + >, + pub CallStaticIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jint, + >, + pub CallStaticIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallStaticLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jlong, + >, + pub CallStaticLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jlong, + >, + pub CallStaticLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallStaticFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jfloat, + >, + pub CallStaticFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jfloat, + >, + pub CallStaticFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallStaticDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jdouble, + >, + pub CallStaticDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jdouble, + >, + pub CallStaticDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallStaticVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...), + >, + pub CallStaticVoidMethodV: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: va_list), + >, + pub CallStaticVoidMethodA: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: *const jvalue), + >, + pub GetStaticFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jobject, + >, + pub GetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jboolean, + >, + pub GetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jbyte, + >, + pub GetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jchar, + >, + pub GetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jshort, + >, + pub GetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jint, + >, + pub GetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jlong, + >, + pub GetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jfloat, + >, + pub GetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jdouble, + >, + pub SetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jobject), + >, + pub SetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jboolean), + >, + pub SetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jbyte), + >, + pub SetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jchar), + >, + pub SetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jshort), + >, + pub SetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jint), + >, + pub SetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jlong), + >, + pub SetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jfloat), + >, + pub SetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jdouble), + >, + pub NewString: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const jchar, arg3: jsize) -> jstring, + >, + pub GetStringLength: + ::std::option::Option jsize>, + pub GetStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewStringUTF: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jstring, + >, + pub GetStringUTFLength: + ::std::option::Option jsize>, + pub GetStringUTFChars: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: *mut jboolean, + ) -> *const ::std::os::raw::c_char, + >, + pub ReleaseStringUTFChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const ::std::os::raw::c_char), + >, + pub GetArrayLength: + ::std::option::Option jsize>, + pub NewObjectArray: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jsize, + arg3: jclass, + arg4: jobject, + ) -> jobjectArray, + >, + pub GetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize) -> jobject, + >, + pub SetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize, arg4: jobject), + >, + pub NewBooleanArray: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jsize) -> jbooleanArray, + >, + pub NewByteArray: + ::std::option::Option jbyteArray>, + pub NewCharArray: + ::std::option::Option jcharArray>, + pub NewShortArray: + ::std::option::Option jshortArray>, + pub NewIntArray: + ::std::option::Option jintArray>, + pub NewLongArray: + ::std::option::Option jlongArray>, + pub NewFloatArray: + ::std::option::Option jfloatArray>, + pub NewDoubleArray: + ::std::option::Option jdoubleArray>, + pub GetBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + ) -> *mut jboolean, + >, + pub GetByteArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: *mut jboolean, + ) -> *mut jbyte, + >, + pub GetCharArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: *mut jboolean, + ) -> *mut jchar, + >, + pub GetShortArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: *mut jboolean, + ) -> *mut jshort, + >, + pub GetIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jboolean) -> *mut jint, + >, + pub GetLongArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: *mut jboolean, + ) -> *mut jlong, + >, + pub GetFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: *mut jboolean, + ) -> *mut jfloat, + >, + pub GetDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: *mut jboolean, + ) -> *mut jdouble, + >, + pub ReleaseBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + arg4: jint, + ), + >, + pub ReleaseByteArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jbyteArray, arg3: *mut jbyte, arg4: jint), + >, + pub ReleaseCharArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jcharArray, arg3: *mut jchar, arg4: jint), + >, + pub ReleaseShortArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jshortArray, arg3: *mut jshort, arg4: jint), + >, + pub ReleaseIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jint, arg4: jint), + >, + pub ReleaseLongArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jlongArray, arg3: *mut jlong, arg4: jint), + >, + pub ReleaseFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jfloatArray, arg3: *mut jfloat, arg4: jint), + >, + pub ReleaseDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jdoubleArray, arg3: *mut jdouble, arg4: jint), + >, + pub GetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jboolean, + ), + >, + pub GetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jbyte, + ), + >, + pub GetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jshort, + ), + >, + pub GetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jint, + ), + >, + pub GetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jlong, + ), + >, + pub GetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jfloat, + ), + >, + pub GetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jdouble, + ), + >, + pub SetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *const jboolean, + ), + >, + pub SetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *const jbyte, + ), + >, + pub SetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *const jchar, + ), + >, + pub SetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *const jshort, + ), + >, + pub SetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *const jint, + ), + >, + pub SetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *const jlong, + ), + >, + pub SetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *const jfloat, + ), + >, + pub SetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *const jdouble, + ), + >, + pub RegisterNatives: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const JNINativeMethod, + arg4: jint, + ) -> jint, + >, + pub UnregisterNatives: + ::std::option::Option jint>, + pub MonitorEnter: + ::std::option::Option jint>, + pub MonitorExit: + ::std::option::Option jint>, + pub GetJavaVM: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *mut *mut JavaVM) -> jint, + >, + pub GetStringRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetStringUTFRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut ::std::os::raw::c_char, + ), + >, + pub GetPrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut jboolean, + ) -> *mut ::std::os::raw::c_void, + >, + pub ReleasePrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut ::std::os::raw::c_void, + arg4: jint, + ), + >, + pub GetStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewWeakGlobalRef: + ::std::option::Option jweak>, + pub DeleteWeakGlobalRef: + ::std::option::Option, + pub ExceptionCheck: ::std::option::Option jboolean>, + pub NewDirectByteBuffer: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *mut ::std::os::raw::c_void, + arg3: jlong, + ) -> jobject, + >, + pub GetDirectBufferAddress: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> *mut ::std::os::raw::c_void, + >, + pub GetDirectBufferCapacity: + ::std::option::Option jlong>, + pub GetObjectRefType: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> jobjectRefType, + >, +} +#[test] +fn bindgen_test_layout_JNINativeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 1864usize, + concat!("Size of: ", stringify!(JNINativeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNINativeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved3 as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetVersion as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).DefineClass as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DefineClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FindClass as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FindClass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedMethod as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedField as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedMethod as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetSuperclass as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetSuperclass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).IsAssignableFrom as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsAssignableFrom) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedField as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).Throw as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(Throw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ThrowNew as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ThrowNew) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionOccurred as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionOccurred) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionDescribe as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionDescribe) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionClear as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionClear) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FatalError as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FatalError) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PushLocalFrame as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PushLocalFrame) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PopLocalFrame as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PopLocalFrame) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewGlobalRef as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteGlobalRef as *const _ as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteLocalRef as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteLocalRef) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsSameObject as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsSameObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLocalRef as *const _ as usize }, + 200usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLocalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).EnsureLocalCapacity as *const _ as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(EnsureLocalCapacity) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).AllocObject as *const _ as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(AllocObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObject as *const _ as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectV as *const _ as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectV) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectA as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectClass as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsInstanceOf as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsInstanceOf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetMethodID as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethod as *const _ as usize + }, + 272usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodV as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodA as *const _ as usize + }, + 288usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethod as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodV as *const _ as usize + }, + 304usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodA as *const _ as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethod as *const _ as usize + }, + 320usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodV as *const _ as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodA as *const _ as usize + }, + 336usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethod as *const _ as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodV as *const _ as usize + }, + 352usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodA as *const _ as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethod as *const _ as usize + }, + 368usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodV as *const _ as usize + }, + 376usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodA as *const _ as usize + }, + 384usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethod as *const _ as usize + }, + 392usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodV as *const _ as usize + }, + 400usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodA as *const _ as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethod as *const _ as usize + }, + 416usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodV as *const _ as usize + }, + 424usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodA as *const _ as usize + }, + 432usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethod as *const _ as usize + }, + 440usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodV as *const _ as usize + }, + 448usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodA as *const _ as usize + }, + 456usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethod as *const _ as usize + }, + 464usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodV as *const _ as usize + }, + 472usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodA as *const _ as usize + }, + 480usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethod as *const _ as usize + }, + 488usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodV as *const _ as usize + }, + 496usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodA as *const _ as usize + }, + 504usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethod as *const _ + as usize + }, + 512usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodV as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodA as *const _ + as usize + }, + 528usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethod as *const _ + as usize + }, + 536usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodV as *const _ + as usize + }, + 544usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodA as *const _ + as usize + }, + 552usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethod as *const _ + as usize + }, + 560usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodV as *const _ + as usize + }, + 568usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodA as *const _ + as usize + }, + 576usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethod as *const _ + as usize + }, + 584usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodV as *const _ + as usize + }, + 592usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodA as *const _ + as usize + }, + 600usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethod as *const _ + as usize + }, + 608usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodV as *const _ + as usize + }, + 616usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodA as *const _ + as usize + }, + 624usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethod as *const _ + as usize + }, + 632usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodV as *const _ + as usize + }, + 640usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodA as *const _ + as usize + }, + 648usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethod as *const _ + as usize + }, + 656usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodV as *const _ + as usize + }, + 664usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodA as *const _ + as usize + }, + 672usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethod as *const _ + as usize + }, + 680usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodV as *const _ + as usize + }, + 688usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodA as *const _ + as usize + }, + 696usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethod as *const _ + as usize + }, + 704usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodV as *const _ + as usize + }, + 712usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodA as *const _ + as usize + }, + 720usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethod as *const _ + as usize + }, + 728usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodV as *const _ + as usize + }, + 736usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodA as *const _ + as usize + }, + 744usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodA) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetFieldID as *const _ as usize }, + 752usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectField as *const _ as usize + }, + 760usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanField as *const _ as usize + }, + 768usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetByteField as *const _ as usize }, + 776usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetCharField as *const _ as usize }, + 784usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortField as *const _ as usize + }, + 792usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetIntField as *const _ as usize }, + 800usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetLongField as *const _ as usize }, + 808usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatField as *const _ as usize + }, + 816usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleField as *const _ as usize + }, + 824usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectField as *const _ as usize + }, + 832usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanField as *const _ as usize + }, + 840usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetByteField as *const _ as usize }, + 848usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetCharField as *const _ as usize }, + 856usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortField as *const _ as usize + }, + 864usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetIntField as *const _ as usize }, + 872usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetLongField as *const _ as usize }, + 880usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatField as *const _ as usize + }, + 888usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleField as *const _ as usize + }, + 896usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticMethodID as *const _ as usize + }, + 904usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethod as *const _ + as usize + }, + 912usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodV as *const _ + as usize + }, + 920usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodA as *const _ + as usize + }, + 928usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethod as *const _ + as usize + }, + 936usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodV as *const _ + as usize + }, + 944usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodA as *const _ + as usize + }, + 952usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethod as *const _ as usize + }, + 960usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodV as *const _ + as usize + }, + 968usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodA as *const _ + as usize + }, + 976usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethod as *const _ as usize + }, + 984usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodV as *const _ + as usize + }, + 992usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodA as *const _ + as usize + }, + 1000usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethod as *const _ + as usize + }, + 1008usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodV as *const _ + as usize + }, + 1016usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodA as *const _ + as usize + }, + 1024usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethod as *const _ as usize + }, + 1032usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodV as *const _ as usize + }, + 1040usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodA as *const _ as usize + }, + 1048usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethod as *const _ as usize + }, + 1056usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodV as *const _ + as usize + }, + 1064usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodA as *const _ + as usize + }, + 1072usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethod as *const _ + as usize + }, + 1080usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodV as *const _ + as usize + }, + 1088usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodA as *const _ + as usize + }, + 1096usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethod as *const _ + as usize + }, + 1104usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodV as *const _ + as usize + }, + 1112usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodA as *const _ + as usize + }, + 1120usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethod as *const _ as usize + }, + 1128usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodV as *const _ + as usize + }, + 1136usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodA as *const _ + as usize + }, + 1144usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFieldID as *const _ as usize + }, + 1152usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticObjectField as *const _ as usize + }, + 1160usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticBooleanField as *const _ + as usize + }, + 1168usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticByteField as *const _ as usize + }, + 1176usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticCharField as *const _ as usize + }, + 1184usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticShortField as *const _ as usize + }, + 1192usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticIntField as *const _ as usize + }, + 1200usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticLongField as *const _ as usize + }, + 1208usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFloatField as *const _ as usize + }, + 1216usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticDoubleField as *const _ as usize + }, + 1224usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticObjectField as *const _ as usize + }, + 1232usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticBooleanField as *const _ + as usize + }, + 1240usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticByteField as *const _ as usize + }, + 1248usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticCharField as *const _ as usize + }, + 1256usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticShortField as *const _ as usize + }, + 1264usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticIntField as *const _ as usize + }, + 1272usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticLongField as *const _ as usize + }, + 1280usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticFloatField as *const _ as usize + }, + 1288usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticDoubleField as *const _ as usize + }, + 1296usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewString as *const _ as usize }, + 1304usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewString) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringLength as *const _ as usize + }, + 1312usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringChars as *const _ as usize + }, + 1320usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringChars as *const _ as usize + }, + 1328usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringChars) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewStringUTF as *const _ as usize }, + 1336usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewStringUTF) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFLength as *const _ as usize + }, + 1344usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFChars as *const _ as usize + }, + 1352usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringUTFChars as *const _ + as usize + }, + 1360usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetArrayLength as *const _ as usize + }, + 1368usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetArrayLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewObjectArray as *const _ as usize + }, + 1376usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectArrayElement as *const _ + as usize + }, + 1384usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectArrayElement as *const _ + as usize + }, + 1392usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewBooleanArray as *const _ as usize + }, + 1400usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewBooleanArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewByteArray as *const _ as usize }, + 1408usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewByteArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewCharArray as *const _ as usize }, + 1416usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewCharArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewShortArray as *const _ as usize + }, + 1424usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewShortArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewIntArray as *const _ as usize }, + 1432usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewIntArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLongArray as *const _ as usize }, + 1440usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLongArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewFloatArray as *const _ as usize + }, + 1448usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewFloatArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDoubleArray as *const _ as usize + }, + 1456usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDoubleArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayElements as *const _ + as usize + }, + 1464usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayElements as *const _ as usize + }, + 1472usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayElements as *const _ as usize + }, + 1480usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayElements as *const _ + as usize + }, + 1488usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayElements as *const _ as usize + }, + 1496usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayElements as *const _ as usize + }, + 1504usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayElements as *const _ + as usize + }, + 1512usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayElements as *const _ + as usize + }, + 1520usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseBooleanArrayElements as *const _ + as usize + }, + 1528usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseByteArrayElements as *const _ + as usize + }, + 1536usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseCharArrayElements as *const _ + as usize + }, + 1544usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseShortArrayElements as *const _ + as usize + }, + 1552usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseIntArrayElements as *const _ + as usize + }, + 1560usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseLongArrayElements as *const _ + as usize + }, + 1568usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseFloatArrayElements as *const _ + as usize + }, + 1576usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseDoubleArrayElements as *const _ + as usize + }, + 1584usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayRegion as *const _ + as usize + }, + 1592usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayRegion as *const _ as usize + }, + 1600usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayRegion as *const _ as usize + }, + 1608usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayRegion as *const _ as usize + }, + 1616usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayRegion as *const _ as usize + }, + 1624usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayRegion as *const _ as usize + }, + 1632usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayRegion as *const _ as usize + }, + 1640usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayRegion as *const _ as usize + }, + 1648usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanArrayRegion as *const _ + as usize + }, + 1656usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetByteArrayRegion as *const _ as usize + }, + 1664usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetCharArrayRegion as *const _ as usize + }, + 1672usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortArrayRegion as *const _ as usize + }, + 1680usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetIntArrayRegion as *const _ as usize + }, + 1688usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetLongArrayRegion as *const _ as usize + }, + 1696usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatArrayRegion as *const _ as usize + }, + 1704usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleArrayRegion as *const _ as usize + }, + 1712usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).RegisterNatives as *const _ as usize + }, + 1720usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(RegisterNatives) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).UnregisterNatives as *const _ as usize + }, + 1728usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(UnregisterNatives) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorEnter as *const _ as usize }, + 1736usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorEnter) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorExit as *const _ as usize }, + 1744usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorExit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetJavaVM as *const _ as usize }, + 1752usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringRegion as *const _ as usize + }, + 1760usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFRegion as *const _ as usize + }, + 1768usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetPrimitiveArrayCritical as *const _ + as usize + }, + 1776usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetPrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleasePrimitiveArrayCritical as *const _ + as usize + }, + 1784usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleasePrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringCritical as *const _ as usize + }, + 1792usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringCritical as *const _ + as usize + }, + 1800usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewWeakGlobalRef as *const _ as usize + }, + 1808usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteWeakGlobalRef as *const _ as usize + }, + 1816usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionCheck as *const _ as usize + }, + 1824usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionCheck) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDirectByteBuffer as *const _ as usize + }, + 1832usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDirectByteBuffer) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferAddress as *const _ + as usize + }, + 1840usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferAddress) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferCapacity as *const _ + as usize + }, + 1848usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferCapacity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectRefType as *const _ as usize + }, + 1856usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectRefType) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JNIEnv { + pub functions: *const JNINativeInterface, +} +#[test] +fn bindgen_test_layout__JNIEnv() { + assert_eq!( + ::std::mem::size_of::<_JNIEnv>(), + 8usize, + concat!("Size of: ", stringify!(_JNIEnv)) + ); + assert_eq!( + ::std::mem::align_of::<_JNIEnv>(), + 8usize, + concat!("Alignment of ", stringify!(_JNIEnv)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JNIEnv>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JNIEnv), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNIInvokeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub DestroyJavaVM: ::std::option::Option jint>, + pub AttachCurrentThread: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, + pub DetachCurrentThread: ::std::option::Option jint>, + pub GetEnv: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut ::std::os::raw::c_void, + arg3: jint, + ) -> jint, + >, + pub AttachCurrentThreadAsDaemon: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, +} +#[test] +fn bindgen_test_layout_JNIInvokeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DestroyJavaVM as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DestroyJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThread as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThread) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DetachCurrentThread as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DetachCurrentThread) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetEnv as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(GetEnv) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThreadAsDaemon as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThreadAsDaemon) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JavaVM { + pub functions: *const JNIInvokeInterface, +} +#[test] +fn bindgen_test_layout__JavaVM() { + assert_eq!( + ::std::mem::size_of::<_JavaVM>(), + 8usize, + concat!("Size of: ", stringify!(_JavaVM)) + ); + assert_eq!( + ::std::mem::align_of::<_JavaVM>(), + 8usize, + concat!("Alignment of ", stringify!(_JavaVM)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JavaVM>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JavaVM), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(group) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(JavaVMOption)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JavaVMOption)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(optionString) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(extraInfo) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(nOptions) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(options) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(ignoreUnrecognized) + ) + ); +} +extern "C" { + pub fn JNI_GetDefaultJavaVMInitArgs(arg1: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_CreateJavaVM( + arg1: *mut *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint; +} +extern "C" { + pub fn JNI_GetCreatedJavaVMs(arg1: *mut *mut JavaVM, arg2: jsize, arg3: *mut jsize) -> jint; +} +extern "C" { + pub fn JNI_OnLoad(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_OnUnload(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn AAssetManager_fromJava(env: *mut JNIEnv, assetManager: jobject) -> *mut AAssetManager; +} +pub const ANDROID_BITMAP_RESULT_SUCCESS: _bindgen_ty_2 = 0; +pub const ANDROID_BITMAP_RESULT_BAD_PARAMETER: _bindgen_ty_2 = -1; +pub const ANDROID_BITMAP_RESULT_JNI_EXCEPTION: _bindgen_ty_2 = -2; +pub const ANDROID_BITMAP_RESULT_ALLOCATION_FAILED: _bindgen_ty_2 = -3; +pub type _bindgen_ty_2 = i32; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_NONE: AndroidBitmapFormat = 0; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_8888: AndroidBitmapFormat = 1; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGB_565: AndroidBitmapFormat = 4; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_4444: AndroidBitmapFormat = 7; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_A_8: AndroidBitmapFormat = 8; +pub type AndroidBitmapFormat = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AndroidBitmapInfo { + pub width: u32, + pub height: u32, + pub stride: u32, + pub format: i32, + pub flags: u32, +} +#[test] +fn bindgen_test_layout_AndroidBitmapInfo() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + pub fn AndroidBitmap_getInfo( + env: *mut JNIEnv, + jbitmap: jobject, + info: *mut AndroidBitmapInfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_lockPixels( + env: *mut JNIEnv, + jbitmap: jobject, + addrPtr: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_unlockPixels(env: *mut JNIEnv, jbitmap: jobject) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AChoreographer { + _unused: [u8; 0], +} +pub type AChoreographer_frameCallback = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: ::std::os::raw::c_long, data: *mut ::std::os::raw::c_void), +>; +pub type AChoreographer_frameCallback64 = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: i64, data: *mut ::std::os::raw::c_void), +>; +extern "C" { + pub fn AChoreographer_getInstance() -> *mut AChoreographer; +} +extern "C" { + pub fn AChoreographer_postFrameCallback( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + delayMillis: ::std::os::raw::c_long, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallback64( + chroreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed64( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + delayMillis: u32, + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AConfiguration { + _unused: [u8; 0], +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_3 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_3 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_3 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_3 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_3 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_3 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_3 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_3 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_3 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_3 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_3 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_3 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_3 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_3 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_3 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_3 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_3 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_3 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_3 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_3 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_3 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_3 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_3 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_3 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_3 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_3 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_3 = 65535; +pub type _bindgen_ty_3 = u32; +extern "C" { + pub fn AConfiguration_new() -> *mut AConfiguration; +} +extern "C" { + pub fn AConfiguration_delete(config: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_fromAssetManager(out: *mut AConfiguration, am: *mut AAssetManager); +} +extern "C" { + pub fn AConfiguration_copy(dest: *mut AConfiguration, src: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_getMcc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMcc(config: *mut AConfiguration, mcc: i32); +} +extern "C" { + pub fn AConfiguration_getMnc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMnc(config: *mut AConfiguration, mnc: i32); +} +extern "C" { + pub fn AConfiguration_getLanguage( + config: *mut AConfiguration, + outLanguage: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setLanguage( + config: *mut AConfiguration, + language: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getCountry( + config: *mut AConfiguration, + outCountry: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setCountry( + config: *mut AConfiguration, + country: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getOrientation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setOrientation(config: *mut AConfiguration, orientation: i32); +} +extern "C" { + pub fn AConfiguration_getTouchscreen(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setTouchscreen(config: *mut AConfiguration, touchscreen: i32); +} +extern "C" { + pub fn AConfiguration_getDensity(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setDensity(config: *mut AConfiguration, density: i32); +} +extern "C" { + pub fn AConfiguration_getKeyboard(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeyboard(config: *mut AConfiguration, keyboard: i32); +} +extern "C" { + pub fn AConfiguration_getNavigation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavigation(config: *mut AConfiguration, navigation: i32); +} +extern "C" { + pub fn AConfiguration_getKeysHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeysHidden(config: *mut AConfiguration, keysHidden: i32); +} +extern "C" { + pub fn AConfiguration_getNavHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavHidden(config: *mut AConfiguration, navHidden: i32); +} +extern "C" { + pub fn AConfiguration_getSdkVersion(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSdkVersion(config: *mut AConfiguration, sdkVersion: i32); +} +extern "C" { + pub fn AConfiguration_getScreenSize(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenSize(config: *mut AConfiguration, screenSize: i32); +} +extern "C" { + pub fn AConfiguration_getScreenLong(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenLong(config: *mut AConfiguration, screenLong: i32); +} +extern "C" { + pub fn AConfiguration_getScreenRound(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenRound(config: *mut AConfiguration, screenRound: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeType(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeType(config: *mut AConfiguration, uiModeType: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeNight(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeNight(config: *mut AConfiguration, uiModeNight: i32); +} +extern "C" { + pub fn AConfiguration_getScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getScreenHeightDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenHeightDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getSmallestScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSmallestScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getLayoutDirection(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setLayoutDirection(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_diff(config1: *mut AConfiguration, config2: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_match(base: *mut AConfiguration, requested: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_isBetterThan( + base: *mut AConfiguration, + test: *mut AConfiguration, + requested: *mut AConfiguration, + ) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct imaxdiv_t { + pub quot: intmax_t, + pub rem: intmax_t, +} +#[test] +fn bindgen_test_layout_imaxdiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(imaxdiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(imaxdiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn imaxabs(__i: intmax_t) -> intmax_t; +} +extern "C" { + pub fn imaxdiv(__numerator: intmax_t, __denominator: intmax_t) -> imaxdiv_t; +} +extern "C" { + pub fn strtoimax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn strtoumax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +extern "C" { + pub fn wcstoimax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn wcstoumax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; +pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; +pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; +pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; +pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub type ADataSpace = u32; +pub const ANDROID_DLEXT_RESERVED_ADDRESS: _bindgen_ty_4 = 1; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_HINT: _bindgen_ty_4 = 2; +pub const ANDROID_DLEXT_WRITE_RELRO: _bindgen_ty_4 = 4; +pub const ANDROID_DLEXT_USE_RELRO: _bindgen_ty_4 = 8; +pub const ANDROID_DLEXT_USE_LIBRARY_FD: _bindgen_ty_4 = 16; +pub const ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET: _bindgen_ty_4 = 32; +pub const ANDROID_DLEXT_FORCE_LOAD: _bindgen_ty_4 = 64; +pub const ANDROID_DLEXT_USE_NAMESPACE: _bindgen_ty_4 = 512; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE: _bindgen_ty_4 = 1024; +pub const ANDROID_DLEXT_VALID_FLAG_BITS: _bindgen_ty_4 = 1663; +pub type _bindgen_ty_4 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_namespace_t { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_dlextinfo { + pub flags: u64, + pub reserved_addr: *mut ::std::os::raw::c_void, + pub reserved_size: usize, + pub relro_fd: ::std::os::raw::c_int, + pub library_fd: ::std::os::raw::c_int, + pub library_fd_offset: off64_t, + pub library_namespace: *mut android_namespace_t, +} +#[test] +fn bindgen_test_layout_android_dlextinfo() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(android_dlextinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(android_dlextinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).relro_fd as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(relro_fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).library_fd as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_fd_offset as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_namespace as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_namespace) + ) + ); +} +extern "C" { + pub fn android_dlopen_ext( + __filename: *const ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + __info: *const android_dlextinfo, + ) -> *mut ::std::os::raw::c_void; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ARect { + pub left: i32, + pub top: i32, + pub right: i32, + pub bottom: i32, +} +#[test] +fn bindgen_test_layout_ARect() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ARect)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ARect)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(left) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(top) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(right) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(bottom) + ) + ); +} +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: AHardwareBuffer_Format = 4; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: AHardwareBuffer_Format = + 22; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: AHardwareBuffer_Format = + 43; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_BLOB: AHardwareBuffer_Format = 33; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D16_UNORM: AHardwareBuffer_Format = 48; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM: AHardwareBuffer_Format = 49; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT: AHardwareBuffer_Format = + 50; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT: AHardwareBuffer_Format = 51; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHardwareBuffer_Format = + 52; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub type AHardwareBuffer_Format = u32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_RARELY: + AHardwareBuffer_UsageFlags = 2; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN: + AHardwareBuffer_UsageFlags = 3; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_MASK: + AHardwareBuffer_UsageFlags = 15; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY: + AHardwareBuffer_UsageFlags = 32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN: + AHardwareBuffer_UsageFlags = 48; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK: + AHardwareBuffer_UsageFlags = 240; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE: + AHardwareBuffer_UsageFlags = 256; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY: + AHardwareBuffer_UsageFlags = 2048; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT: + AHardwareBuffer_UsageFlags = 16384; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VIDEO_ENCODE: + AHardwareBuffer_UsageFlags = 65536; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA: + AHardwareBuffer_UsageFlags = 8388608; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER: + AHardwareBuffer_UsageFlags = 16777216; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: + AHardwareBuffer_UsageFlags = 33554432; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: + AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = + 268435456; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = + 536870912; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_2: AHardwareBuffer_UsageFlags = + 1073741824; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_3: AHardwareBuffer_UsageFlags = + 2147483648; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_4: AHardwareBuffer_UsageFlags = + 281474976710656; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_5: AHardwareBuffer_UsageFlags = + 562949953421312; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_6: AHardwareBuffer_UsageFlags = + 1125899906842624; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_7: AHardwareBuffer_UsageFlags = + 2251799813685248; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_8: AHardwareBuffer_UsageFlags = + 4503599627370496; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_9: AHardwareBuffer_UsageFlags = + 9007199254740992; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_10: AHardwareBuffer_UsageFlags = + 18014398509481984; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_11: AHardwareBuffer_UsageFlags = + 36028797018963968; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_12: AHardwareBuffer_UsageFlags = + 72057594037927936; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_13: AHardwareBuffer_UsageFlags = + 144115188075855872; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_14: AHardwareBuffer_UsageFlags = + 288230376151711744; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_15: AHardwareBuffer_UsageFlags = + 576460752303423488; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_16: AHardwareBuffer_UsageFlags = + 1152921504606846976; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_17: AHardwareBuffer_UsageFlags = + 2305843009213693952; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_18: AHardwareBuffer_UsageFlags = + 4611686018427387904; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_19: AHardwareBuffer_UsageFlags = + 9223372036854775808; +pub type AHardwareBuffer_UsageFlags = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Desc { + pub width: u32, + pub height: u32, + pub layers: u32, + pub format: u32, + pub usage: u64, + pub stride: u32, + pub rfu0: u32, + pub rfu1: u64, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Desc() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(layers) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(usage) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Plane { + pub data: *mut ::std::os::raw::c_void, + pub pixelStride: u32, + pub rowStride: u32, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Plane() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pixelStride as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(pixelStride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(rowStride) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Planes { + pub planeCount: u32, + pub planes: [AHardwareBuffer_Plane; 4usize], +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Planes() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).planeCount as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planeCount) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planes) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer { + _unused: [u8; 0], +} +extern "C" { + pub fn AHardwareBuffer_allocate( + desc: *const AHardwareBuffer_Desc, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_acquire(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_release(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_describe( + buffer: *const AHardwareBuffer, + outDesc: *mut AHardwareBuffer_Desc, + ); +} +extern "C" { + pub fn AHardwareBuffer_lock( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_unlock( + buffer: *mut AHardwareBuffer, + fence: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_sendHandleToUnixSocket( + buffer: *const AHardwareBuffer, + socketFd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_recvHandleFromUnixSocket( + socketFd: ::std::os::raw::c_int, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockAndGetInfo( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + outBytesPerPixel: *mut i32, + outBytesPerStride: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_fromHardwareBuffer( + env: *mut JNIEnv, + hardwareBufferObj: jobject, + ) -> *mut AHardwareBuffer; +} +extern "C" { + pub fn AHardwareBuffer_toHardwareBuffer( + env: *mut JNIEnv, + hardwareBuffer: *mut AHardwareBuffer, + ) -> jobject; +} +pub const AKEYCODE_UNKNOWN: _bindgen_ty_5 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_5 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_5 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_5 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_5 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_5 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_5 = 6; +pub const AKEYCODE_0: _bindgen_ty_5 = 7; +pub const AKEYCODE_1: _bindgen_ty_5 = 8; +pub const AKEYCODE_2: _bindgen_ty_5 = 9; +pub const AKEYCODE_3: _bindgen_ty_5 = 10; +pub const AKEYCODE_4: _bindgen_ty_5 = 11; +pub const AKEYCODE_5: _bindgen_ty_5 = 12; +pub const AKEYCODE_6: _bindgen_ty_5 = 13; +pub const AKEYCODE_7: _bindgen_ty_5 = 14; +pub const AKEYCODE_8: _bindgen_ty_5 = 15; +pub const AKEYCODE_9: _bindgen_ty_5 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_5 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_5 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_5 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_5 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_5 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_5 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_5 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_5 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_5 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_5 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_5 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_5 = 28; +pub const AKEYCODE_A: _bindgen_ty_5 = 29; +pub const AKEYCODE_B: _bindgen_ty_5 = 30; +pub const AKEYCODE_C: _bindgen_ty_5 = 31; +pub const AKEYCODE_D: _bindgen_ty_5 = 32; +pub const AKEYCODE_E: _bindgen_ty_5 = 33; +pub const AKEYCODE_F: _bindgen_ty_5 = 34; +pub const AKEYCODE_G: _bindgen_ty_5 = 35; +pub const AKEYCODE_H: _bindgen_ty_5 = 36; +pub const AKEYCODE_I: _bindgen_ty_5 = 37; +pub const AKEYCODE_J: _bindgen_ty_5 = 38; +pub const AKEYCODE_K: _bindgen_ty_5 = 39; +pub const AKEYCODE_L: _bindgen_ty_5 = 40; +pub const AKEYCODE_M: _bindgen_ty_5 = 41; +pub const AKEYCODE_N: _bindgen_ty_5 = 42; +pub const AKEYCODE_O: _bindgen_ty_5 = 43; +pub const AKEYCODE_P: _bindgen_ty_5 = 44; +pub const AKEYCODE_Q: _bindgen_ty_5 = 45; +pub const AKEYCODE_R: _bindgen_ty_5 = 46; +pub const AKEYCODE_S: _bindgen_ty_5 = 47; +pub const AKEYCODE_T: _bindgen_ty_5 = 48; +pub const AKEYCODE_U: _bindgen_ty_5 = 49; +pub const AKEYCODE_V: _bindgen_ty_5 = 50; +pub const AKEYCODE_W: _bindgen_ty_5 = 51; +pub const AKEYCODE_X: _bindgen_ty_5 = 52; +pub const AKEYCODE_Y: _bindgen_ty_5 = 53; +pub const AKEYCODE_Z: _bindgen_ty_5 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_5 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_5 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_5 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_5 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_5 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_5 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_5 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_5 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_5 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_5 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_5 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_5 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_5 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_5 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_5 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_5 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_5 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_5 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_5 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_5 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_5 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_5 = 76; +pub const AKEYCODE_AT: _bindgen_ty_5 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_5 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_5 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_5 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_5 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_5 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_5 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_5 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_5 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_5 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_5 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_5 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_5 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_5 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_5 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_5 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_5 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_5 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_5 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_5 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_5 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_5 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_5 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_5 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_5 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_5 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_5 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_5 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_5 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_5 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_5 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_5 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_5 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_5 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_5 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_5 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_5 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_5 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_5 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_5 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_5 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_5 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_5 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_5 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_5 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_5 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_5 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_5 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_5 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_5 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_5 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_5 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_5 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_5 = 130; +pub const AKEYCODE_F1: _bindgen_ty_5 = 131; +pub const AKEYCODE_F2: _bindgen_ty_5 = 132; +pub const AKEYCODE_F3: _bindgen_ty_5 = 133; +pub const AKEYCODE_F4: _bindgen_ty_5 = 134; +pub const AKEYCODE_F5: _bindgen_ty_5 = 135; +pub const AKEYCODE_F6: _bindgen_ty_5 = 136; +pub const AKEYCODE_F7: _bindgen_ty_5 = 137; +pub const AKEYCODE_F8: _bindgen_ty_5 = 138; +pub const AKEYCODE_F9: _bindgen_ty_5 = 139; +pub const AKEYCODE_F10: _bindgen_ty_5 = 140; +pub const AKEYCODE_F11: _bindgen_ty_5 = 141; +pub const AKEYCODE_F12: _bindgen_ty_5 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_5 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_5 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_5 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_5 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_5 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_5 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_5 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_5 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_5 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_5 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_5 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_5 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_5 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_5 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_5 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_5 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_5 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_5 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_5 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_5 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_5 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_5 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_5 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_5 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_5 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_5 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_5 = 169; +pub const AKEYCODE_TV: _bindgen_ty_5 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_5 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_5 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_5 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_5 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_5 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_5 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_5 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_5 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_5 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_5 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_5 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_5 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_5 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_5 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_5 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_5 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_5 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_5 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_5 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_5 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_5 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_5 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_5 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_5 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_5 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_5 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_5 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_5 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_5 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_5 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_5 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_5 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_5 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_5 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_5 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_5 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_5 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_5 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_5 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_5 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_5 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_5 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_5 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_5 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_5 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_5 = 216; +pub const AKEYCODE_RO: _bindgen_ty_5 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_5 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_5 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_5 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_5 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_5 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_5 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_5 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_5 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_5 = 226; +pub const AKEYCODE_11: _bindgen_ty_5 = 227; +pub const AKEYCODE_12: _bindgen_ty_5 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_5 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_5 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_5 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_5 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_5 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_5 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_5 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_5 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_5 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_5 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_5 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_5 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_5 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_5 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_5 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_5 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_5 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_5 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_5 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_5 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_5 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_5 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_5 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_5 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_5 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_5 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_5 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_5 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_5 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_5 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_5 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_5 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_5 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_5 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_5 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_5 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_5 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_5 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_5 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_5 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_5 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_5 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_5 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_5 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_5 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_5 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_5 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_5 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_5 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_5 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_5 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_5 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_5 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_5 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_5 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_5 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_5 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_5 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_5 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_5 = 288; +pub type _bindgen_ty_5 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ALooper { + _unused: [u8; 0], +} +extern "C" { + pub fn ALooper_forThread() -> *mut ALooper; +} +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_6 = 1; +pub type _bindgen_ty_6 = u32; +extern "C" { + pub fn ALooper_prepare(opts: ::std::os::raw::c_int) -> *mut ALooper; +} +pub const ALOOPER_POLL_WAKE: _bindgen_ty_7 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_7 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_7 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_7 = -4; +pub type _bindgen_ty_7 = i32; +extern "C" { + pub fn ALooper_acquire(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_release(looper: *mut ALooper); +} +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_8 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_8 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_8 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_8 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_8 = 16; +pub type _bindgen_ty_8 = u32; +pub type ALooper_callbackFunc = ::std::option::Option< + unsafe extern "C" fn( + fd: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn ALooper_pollOnce( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_pollAll( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_wake(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_addFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ident: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_removeFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_9 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_9 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_9 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_9 = 2; +pub type _bindgen_ty_9 = i32; +pub const AMETA_NONE: _bindgen_ty_10 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_10 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_10 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_10 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_10 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_10 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_10 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_10 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_10 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_10 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_10 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_10 = 16384; +pub const AMETA_META_ON: _bindgen_ty_10 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_10 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_10 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_10 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_10 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_10 = 4194304; +pub type _bindgen_ty_10 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputEvent { + _unused: [u8; 0], +} +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_11 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_11 = 2; +pub type _bindgen_ty_11 = u32; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_12 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_12 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_12 = 2; +pub type _bindgen_ty_12 = u32; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_13 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_13 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_13 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_13 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_13 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_13 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_13 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_13 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_13 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_13 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_13 = 1024; +pub type _bindgen_ty_13 = u32; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_14 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_14 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_14 = 12; +pub type _bindgen_ty_14 = u32; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_15 = 1; +pub type _bindgen_ty_15 = u32; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_16 = 8; +pub type _bindgen_ty_16 = u32; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_17 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_17 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_17 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_17 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_17 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_17 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_17 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_17 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_17 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_17 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_17 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_17 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_17 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_17 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_17 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_17 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_17 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_17 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_17 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_17 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_17 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_17 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_17 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_17 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_17 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_17 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_17 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_17 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_17 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_17 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_17 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_17 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_17 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_17 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_17 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_17 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_17 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_17 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_17 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_17 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_17 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_17 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_17 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_17 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_17 = 47; +pub type _bindgen_ty_17 = u32; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_18 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_18 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_18 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_18 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_18 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_18 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_18 = 64; +pub type _bindgen_ty_18 = u32; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_19 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_19 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_19 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_19 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_19 = 4; +pub type _bindgen_ty_19 = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_20 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_20 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_20 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_20 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_20 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_20 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_20 = 16; +pub type _bindgen_ty_20 = u32; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_21 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_21 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_21 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_21 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_21 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_21 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_21 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_21 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_21 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_21 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_21 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_21 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_21 = 16777232; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_21 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_21 = 4294967040; +pub type _bindgen_ty_21 = u32; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_22 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_22 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_22 = 2; +pub type _bindgen_ty_22 = u32; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_23 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_23 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_23 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_23 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_23 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_23 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_23 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_23 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_23 = 8; +pub type _bindgen_ty_23 = u32; +extern "C" { + pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getDeviceId(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getFlags(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getKeyCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getScanCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getMetaState(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getRepeatCount(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getDownTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getMetaState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getButtonState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getEdgeFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getDownTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getEventTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getXOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getXPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; +} +extern "C" { + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; +} +extern "C" { + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getHistoricalEventTime( + motion_event: *const AInputEvent, + history_index: usize, + ) -> i64; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalPressure( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalSize( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputQueue { + _unused: [u8; 0], +} +extern "C" { + pub fn AInputQueue_attachLooper( + queue: *mut AInputQueue, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AInputQueue_detachLooper(queue: *mut AInputQueue); +} +extern "C" { + pub fn AInputQueue_hasEvents(queue: *mut AInputQueue) -> i32; +} +extern "C" { + pub fn AInputQueue_getEvent(queue: *mut AInputQueue, outEvent: *mut *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_preDispatchEvent(queue: *mut AInputQueue, event: *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_finishEvent( + queue: *mut AInputQueue, + event: *mut AInputEvent, + handled: ::std::os::raw::c_int, + ); +} +pub const android_LogPriority_ANDROID_LOG_UNKNOWN: android_LogPriority = 0; +pub const android_LogPriority_ANDROID_LOG_DEFAULT: android_LogPriority = 1; +pub const android_LogPriority_ANDROID_LOG_VERBOSE: android_LogPriority = 2; +pub const android_LogPriority_ANDROID_LOG_DEBUG: android_LogPriority = 3; +pub const android_LogPriority_ANDROID_LOG_INFO: android_LogPriority = 4; +pub const android_LogPriority_ANDROID_LOG_WARN: android_LogPriority = 5; +pub const android_LogPriority_ANDROID_LOG_ERROR: android_LogPriority = 6; +pub const android_LogPriority_ANDROID_LOG_FATAL: android_LogPriority = 7; +pub const android_LogPriority_ANDROID_LOG_SILENT: android_LogPriority = 8; +pub type android_LogPriority = u32; +extern "C" { + pub fn __android_log_write( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_print( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_vprint( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ap: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_assert( + cond: *const ::std::os::raw::c_char, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ); +} +pub const log_id_LOG_ID_MIN: log_id = 0; +pub const log_id_LOG_ID_MAIN: log_id = 0; +pub const log_id_LOG_ID_RADIO: log_id = 1; +pub const log_id_LOG_ID_EVENTS: log_id = 2; +pub const log_id_LOG_ID_SYSTEM: log_id = 3; +pub const log_id_LOG_ID_CRASH: log_id = 4; +pub const log_id_LOG_ID_STATS: log_id = 5; +pub const log_id_LOG_ID_SECURITY: log_id = 6; +pub const log_id_LOG_ID_KERNEL: log_id = 7; +pub const log_id_LOG_ID_MAX: log_id = 8; +pub type log_id = u32; +pub use self::log_id as log_id_t; +extern "C" { + pub fn __android_log_buf_write( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_buf_print( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +pub type __kernel_sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[repr(align(8))] +#[derive(Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: __kernel_sa_family_t, + pub __data: [::std::os::raw::c_char; 126usize], +} +#[test] +fn bindgen_test_layout_sockaddr_storage() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(sockaddr_storage)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sockaddr_storage)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ss_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(ss_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(__data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct f_owner_ex { + pub type_: ::std::os::raw::c_int, + pub pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_f_owner_ex() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(f_owner_ex)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(f_owner_ex)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_off_t, + pub l_len: __kernel_off_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(flock)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(flock)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock64 { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_loff_t, + pub l_len: __kernel_loff_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock64() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(flock64)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(flock64)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: __kernel_size_t, +} +#[test] +fn bindgen_test_layout_iovec() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(iovec)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(iovec)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_len) + ) + ); +} +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + _unused: [u8; 0], +} +pub const SHUT_RD: _bindgen_ty_24 = 0; +pub const SHUT_WR: _bindgen_ty_24 = 1; +pub const SHUT_RDWR: _bindgen_ty_24 = 2; +pub type _bindgen_ty_24 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[test] +fn bindgen_test_layout_sockaddr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sockaddr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(sockaddr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_linger() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(linger)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(linger)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_onoff as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_onoff) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_linger as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_linger) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_msghdr() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(msghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(msghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_namelen as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_namelen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iov as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iov) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iovlen as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iovlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_control as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_controllen as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_controllen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_flags as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mmsghdr { + pub msg_hdr: msghdr, + pub msg_len: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_mmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(mmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(mmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_hdr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_hdr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_len as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_cmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(cmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_level as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_level) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_type as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_type) + ) + ); +} +extern "C" { + pub fn __cmsg_nxthdr(__msg: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ucred { + pub pid: pid_t, + pub uid: uid_t, + pub gid: gid_t, +} +#[test] +fn bindgen_test_layout_ucred() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ucred)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ucred)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(pid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(uid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gid as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(gid) + ) + ); +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept4( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *mut ::std::os::raw::c_void, + __value_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen( + __fd: ::std::os::raw::c_int, + __backlog: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *mut mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + __timeout: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __msg: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *const mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __msg: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *const ::std::os::raw::c_void, + __value_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socket( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __dst_addr: *const sockaddr, + __dst_addr_length: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __src_addr: *mut sockaddr, + __src_addr_length: *mut socklen_t, + ) -> isize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct hostent { + pub h_name: *mut ::std::os::raw::c_char, + pub h_aliases: *mut *mut ::std::os::raw::c_char, + pub h_addrtype: ::std::os::raw::c_int, + pub h_length: ::std::os::raw::c_int, + pub h_addr_list: *mut *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_hostent() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(hostent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(hostent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addrtype as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_length as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_length) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addr_list as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addr_list) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct netent { + pub n_name: *mut ::std::os::raw::c_char, + pub n_aliases: *mut *mut ::std::os::raw::c_char, + pub n_addrtype: ::std::os::raw::c_int, + pub n_net: u32, +} +#[test] +fn bindgen_test_layout_netent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(netent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(netent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_addrtype as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_net as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_net) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct servent { + pub s_name: *mut ::std::os::raw::c_char, + pub s_aliases: *mut *mut ::std::os::raw::c_char, + pub s_port: ::std::os::raw::c_int, + pub s_proto: *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_servent() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(servent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(servent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_port as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_port) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_proto as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct protoent { + pub p_name: *mut ::std::os::raw::c_char, + pub p_aliases: *mut *mut ::std::os::raw::c_char, + pub p_proto: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_protoent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(protoent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(protoent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_proto as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct addrinfo { + pub ai_flags: ::std::os::raw::c_int, + pub ai_family: ::std::os::raw::c_int, + pub ai_socktype: ::std::os::raw::c_int, + pub ai_protocol: ::std::os::raw::c_int, + pub ai_addrlen: socklen_t, + pub ai_canonname: *mut ::std::os::raw::c_char, + pub ai_addr: *mut sockaddr, + pub ai_next: *mut addrinfo, +} +#[test] +fn bindgen_test_layout_addrinfo() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(addrinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(addrinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_family as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_socktype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_socktype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_protocol as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_protocol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addrlen as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addrlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_canonname as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_canonname) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addr as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_next as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_next) + ) + ); +} +extern "C" { + pub fn getaddrinfo( + __node: *const ::std::os::raw::c_char, + __service: *const ::std::os::raw::c_char, + __hints: *const addrinfo, + __result: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn freeaddrinfo(__ptr: *mut addrinfo); +} +extern "C" { + pub fn getnameinfo( + __sa: *const sockaddr, + __sa_length: socklen_t, + __host: *mut ::std::os::raw::c_char, + __host_length: usize, + __service: *mut ::std::os::raw::c_char, + __service_length: usize, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gai_strerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn __get_h_errno() -> *mut ::std::os::raw::c_int; +} +extern "C" { + pub fn herror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn hstrerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn gethostbyaddr( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyaddr_r( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname(__name: *const ::std::os::raw::c_char) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname_r( + __name: *const ::std::os::raw::c_char, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname2( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname2_r( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn endhostent(); +} +extern "C" { + pub fn gethostent() -> *mut hostent; +} +extern "C" { + pub fn sethostent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endnetent(); +} +extern "C" { + pub fn getnetbyaddr(__net: u32, __type: ::std::os::raw::c_int) -> *mut netent; +} +extern "C" { + pub fn getnetbyname(__name: *const ::std::os::raw::c_char) -> *mut netent; +} +extern "C" { + pub fn getnetent() -> *mut netent; +} +extern "C" { + pub fn setnetent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endprotoent(); +} +extern "C" { + pub fn getprotobyname(__name: *const ::std::os::raw::c_char) -> *mut protoent; +} +extern "C" { + pub fn getprotobynumber(__proto: ::std::os::raw::c_int) -> *mut protoent; +} +extern "C" { + pub fn getprotoent() -> *mut protoent; +} +extern "C" { + pub fn setprotoent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endservent(); +} +extern "C" { + pub fn getservbyname( + __name: *const ::std::os::raw::c_char, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservbyport( + __port_in_network_order: ::std::os::raw::c_int, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservent() -> *mut servent; +} +extern "C" { + pub fn setservent(__stay_open: ::std::os::raw::c_int); +} +pub type fpos_t = off_t; +pub type fpos64_t = off64_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sFILE { + _unused: [u8; 0], +} +pub type FILE = __sFILE; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn clearerr(__fp: *mut FILE); +} +extern "C" { + pub fn fclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn feof(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __buf: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __count: ::std::os::raw::c_ulong, + __fp: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fwrite( + __buf: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __count: ::std::os::raw::c_ulong, + __fp: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn getc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getdelim( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __delimiter: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn getline( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn perror(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn printf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn remove(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rewind(__fp: *mut FILE); +} +extern "C" { + pub fn scanf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuf(__fp: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __mode: ::std::os::raw::c_int, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __fp: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __args: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpnam(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __prefix: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn rename( + __old_path: *const ::std::os::raw::c_char, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __old_dir_fd: ::std::os::raw::c_int, + __old_path: *const ::std::os::raw::c_char, + __new_dir_fd: ::std::os::raw::c_int, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseek( + __fp: *mut FILE, + __offset: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__fp: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn fgetpos(__fp: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__fp: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko( + __fp: *mut FILE, + __offset: off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__fp: *mut FILE) -> off_t; +} +extern "C" { + pub fn fgetpos64(__fp: *mut FILE, __pos: *mut fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos64(__fp: *mut FILE, __pos: *const fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko64( + __fp: *mut FILE, + __offset: off64_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello64(__fp: *mut FILE) -> off64_t; +} +extern "C" { + pub fn fopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn fopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpfile64() -> *mut FILE; +} +extern "C" { + pub fn snprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_ulong, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_ulong, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ctermid(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __mode: *const ::std::os::raw::c_char) -> *mut FILE; +} +extern "C" { + pub fn fileno(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn flockfile(__fp: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__fp: *mut FILE); +} +extern "C" { + pub fn getc_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fmemopen( + __buf: *mut ::std::os::raw::c_void, + __size: usize, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __ptr: *mut *mut ::std::os::raw::c_char, + __size_ptr: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn asprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetln(__fp: *mut FILE, __length_ptr: *mut usize) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fpurge(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn setlinebuf(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vasprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__fp: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn malloc(__byte_count: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn calloc( + __item_count: ::std::os::raw::c_ulong, + __item_size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn realloc( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn reallocarray( + __ptr: *mut ::std::os::raw::c_void, + __item_count: usize, + __item_size: usize, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn free(__ptr: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn memalign(__alignment: usize, __byte_count: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn malloc_usable_size(__ptr: *const ::std::os::raw::c_void) -> usize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mallinfo { + pub arena: usize, + pub ordblks: usize, + pub smblks: usize, + pub hblks: usize, + pub hblkhd: usize, + pub usmblks: usize, + pub fsmblks: usize, + pub uordblks: usize, + pub fordblks: usize, + pub keepcost: usize, +} +#[test] +fn bindgen_test_layout_mallinfo() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(mallinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(mallinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arena as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(arena) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ordblks as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(ordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smblks as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(smblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblks as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblkhd as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblkhd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usmblks as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(usmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fsmblks as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fsmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uordblks as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(uordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fordblks as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).keepcost as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(keepcost) + ) + ); +} +extern "C" { + pub fn mallinfo() -> mallinfo; +} +extern "C" { + pub fn malloc_info( + __must_be_zero: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mallopt( + __option: ::std::os::raw::c_int, + __value: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut __malloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __realloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __free_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __caller: *const ::std::os::raw::c_void, + ), + >; +} +extern "C" { + pub static mut __memalign_hook: ::std::option::Option< + unsafe extern "C" fn( + __alignment: usize, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_t { + _unused: [u8; 0], +} +pub type locale_t = *mut __locale_t; +extern "C" { + pub fn abort(); +} +extern "C" { + pub fn exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn _Exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn atexit(__fn: ::std::option::Option) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn at_quick_exit( + __fn: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn quick_exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn putenv(__assignment: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setenv( + __name: *const ::std::os::raw::c_char, + __value: *const ::std::os::raw::c_char, + __overwrite: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearenv() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mkostemp64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemp( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps64( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp64(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtol( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn strtoll( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoul( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strtoull( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut ::std::os::raw::c_void, + __alignment: usize, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn strtod( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f64; +} +extern "C" { + pub fn strtold( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> u128; +} +extern "C" { + pub fn strtoul_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn atoi(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn atol(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn atoll(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn realpath( + __path: *const ::std::os::raw::c_char, + __resolved: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bsearch( + __key: *const ::std::os::raw::c_void, + __base: *const ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn qsort( + __base: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ); +} +extern "C" { + pub fn arc4random() -> u32; +} +extern "C" { + pub fn arc4random_uniform(__upper_bound: u32) -> u32; +} +extern "C" { + pub fn arc4random_buf(__buf: *mut ::std::os::raw::c_void, __n: usize); +} +extern "C" { + pub fn rand_r(__seed_ptr: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; +} +extern "C" { + pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); +} +extern "C" { + pub fn lrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn mrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; +} +extern "C" { + pub fn srand48(__seed: ::std::os::raw::c_long); +} +extern "C" { + pub fn initstate( + __seed: ::std::os::raw::c_uint, + __state: *mut ::std::os::raw::c_char, + __n: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn setstate(__state: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getpt() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn posix_openpt(__flags: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ptsname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ptsname_r( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unlockpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsubopt( + __option: *mut *mut ::std::os::raw::c_char, + __tokens: *const *mut ::std::os::raw::c_char, + __value_ptr: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct div_t { + pub quot: ::std::os::raw::c_int, + pub rem: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_div_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(div_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(div_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn div(__numerator: ::std::os::raw::c_int, __denominator: ::std::os::raw::c_int) -> div_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ldiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_ldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn ldiv( + __numerator: ::std::os::raw::c_long, + __denominator: ::std::os::raw::c_long, + ) -> ldiv_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lldiv_t { + pub quot: ::std::os::raw::c_longlong, + pub rem: ::std::os::raw::c_longlong, +} +#[test] +fn bindgen_test_layout_lldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(lldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn lldiv( + __numerator: ::std::os::raw::c_longlong, + __denominator: ::std::os::raw::c_longlong, + ) -> lldiv_t; +} +extern "C" { + pub fn getloadavg(__averages: *mut f64, __n: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getprogname() -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn setprogname(__name: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbstowcs(__dst: *mut wchar_t, __src: *const ::std::os::raw::c_char, __n: usize) + -> usize; +} +extern "C" { + pub fn mbtowc( + __wc_ptr: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wctomb(__dst: *mut ::std::os::raw::c_char, __wc: wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wcstombs(__dst: *mut ::std::os::raw::c_char, __src: *const wchar_t, __n: usize) + -> usize; +} +extern "C" { + pub fn __ctype_get_mb_cur_max() -> usize; +} +extern "C" { + pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtof( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f32; +} +extern "C" { + pub fn atof(__s: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn rand() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn random() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srandom(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn grantpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtoll_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoull_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn strtold_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> u128; +} +extern "C" { + pub fn strtod_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f64; +} +extern "C" { + pub fn strtof_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f32; +} +extern "C" { + pub fn strtol_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + arg1: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_long; +} +pub type net_handle_t = u64; +extern "C" { + pub fn android_setsocknetwork( + network: net_handle_t, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_setprocnetwork(network: net_handle_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_getaddrinfofornetwork( + network: net_handle_t, + node: *const ::std::os::raw::c_char, + service: *const ::std::os::raw::c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +pub const ResNsendFlags_ANDROID_RESOLV_NO_RETRY: ResNsendFlags = 1; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_STORE: ResNsendFlags = 2; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_LOOKUP: ResNsendFlags = 4; +pub type ResNsendFlags = u32; +extern "C" { + pub fn android_res_nquery( + network: net_handle_t, + dname: *const ::std::os::raw::c_char, + ns_class: ::std::os::raw::c_int, + ns_type: ::std::os::raw::c_int, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nsend( + network: net_handle_t, + msg: *const u8, + msglen: usize, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nresult( + fd: ::std::os::raw::c_int, + rcode: *mut ::std::os::raw::c_int, + answer: *mut u8, + anslen: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_cancel(nsend_fd: ::std::os::raw::c_int); +} +pub const OperandCode_ANEURALNETWORKS_FLOAT32: OperandCode = 0; +pub const OperandCode_ANEURALNETWORKS_INT32: OperandCode = 1; +pub const OperandCode_ANEURALNETWORKS_UINT32: OperandCode = 2; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT32: OperandCode = 3; +pub const OperandCode_ANEURALNETWORKS_TENSOR_INT32: OperandCode = 4; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_ASYMM: OperandCode = 5; +pub const OperandCode_ANEURALNETWORKS_BOOL: OperandCode = 6; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_SYMM: OperandCode = 7; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT16: OperandCode = 8; +pub const OperandCode_ANEURALNETWORKS_TENSOR_BOOL8: OperandCode = 9; +pub const OperandCode_ANEURALNETWORKS_FLOAT16: OperandCode = 10; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL: OperandCode = 11; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_ASYMM: OperandCode = 12; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM: OperandCode = 13; +pub type OperandCode = u32; +pub const OperationCode_ANEURALNETWORKS_ADD: OperationCode = 0; +pub const OperationCode_ANEURALNETWORKS_AVERAGE_POOL_2D: OperationCode = 1; +pub const OperationCode_ANEURALNETWORKS_CONCATENATION: OperationCode = 2; +pub const OperationCode_ANEURALNETWORKS_CONV_2D: OperationCode = 3; +pub const OperationCode_ANEURALNETWORKS_DEPTHWISE_CONV_2D: OperationCode = 4; +pub const OperationCode_ANEURALNETWORKS_DEPTH_TO_SPACE: OperationCode = 5; +pub const OperationCode_ANEURALNETWORKS_DEQUANTIZE: OperationCode = 6; +pub const OperationCode_ANEURALNETWORKS_EMBEDDING_LOOKUP: OperationCode = 7; +pub const OperationCode_ANEURALNETWORKS_FLOOR: OperationCode = 8; +pub const OperationCode_ANEURALNETWORKS_FULLY_CONNECTED: OperationCode = 9; +pub const OperationCode_ANEURALNETWORKS_HASHTABLE_LOOKUP: OperationCode = 10; +pub const OperationCode_ANEURALNETWORKS_L2_NORMALIZATION: OperationCode = 11; +pub const OperationCode_ANEURALNETWORKS_L2_POOL_2D: OperationCode = 12; +pub const OperationCode_ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION: OperationCode = 13; +pub const OperationCode_ANEURALNETWORKS_LOGISTIC: OperationCode = 14; +pub const OperationCode_ANEURALNETWORKS_LSH_PROJECTION: OperationCode = 15; +pub const OperationCode_ANEURALNETWORKS_LSTM: OperationCode = 16; +pub const OperationCode_ANEURALNETWORKS_MAX_POOL_2D: OperationCode = 17; +pub const OperationCode_ANEURALNETWORKS_MUL: OperationCode = 18; +pub const OperationCode_ANEURALNETWORKS_RELU: OperationCode = 19; +pub const OperationCode_ANEURALNETWORKS_RELU1: OperationCode = 20; +pub const OperationCode_ANEURALNETWORKS_RELU6: OperationCode = 21; +pub const OperationCode_ANEURALNETWORKS_RESHAPE: OperationCode = 22; +pub const OperationCode_ANEURALNETWORKS_RESIZE_BILINEAR: OperationCode = 23; +pub const OperationCode_ANEURALNETWORKS_RNN: OperationCode = 24; +pub const OperationCode_ANEURALNETWORKS_SOFTMAX: OperationCode = 25; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_DEPTH: OperationCode = 26; +pub const OperationCode_ANEURALNETWORKS_SVDF: OperationCode = 27; +pub const OperationCode_ANEURALNETWORKS_TANH: OperationCode = 28; +pub const OperationCode_ANEURALNETWORKS_BATCH_TO_SPACE_ND: OperationCode = 29; +pub const OperationCode_ANEURALNETWORKS_DIV: OperationCode = 30; +pub const OperationCode_ANEURALNETWORKS_MEAN: OperationCode = 31; +pub const OperationCode_ANEURALNETWORKS_PAD: OperationCode = 32; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_BATCH_ND: OperationCode = 33; +pub const OperationCode_ANEURALNETWORKS_SQUEEZE: OperationCode = 34; +pub const OperationCode_ANEURALNETWORKS_STRIDED_SLICE: OperationCode = 35; +pub const OperationCode_ANEURALNETWORKS_SUB: OperationCode = 36; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE: OperationCode = 37; +pub const OperationCode_ANEURALNETWORKS_ABS: OperationCode = 38; +pub const OperationCode_ANEURALNETWORKS_ARGMAX: OperationCode = 39; +pub const OperationCode_ANEURALNETWORKS_ARGMIN: OperationCode = 40; +pub const OperationCode_ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM: OperationCode = 41; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 42; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 43; +pub const OperationCode_ANEURALNETWORKS_BOX_WITH_NMS_LIMIT: OperationCode = 44; +pub const OperationCode_ANEURALNETWORKS_CAST: OperationCode = 45; +pub const OperationCode_ANEURALNETWORKS_CHANNEL_SHUFFLE: OperationCode = 46; +pub const OperationCode_ANEURALNETWORKS_DETECTION_POSTPROCESSING: OperationCode = 47; +pub const OperationCode_ANEURALNETWORKS_EQUAL: OperationCode = 48; +pub const OperationCode_ANEURALNETWORKS_EXP: OperationCode = 49; +pub const OperationCode_ANEURALNETWORKS_EXPAND_DIMS: OperationCode = 50; +pub const OperationCode_ANEURALNETWORKS_GATHER: OperationCode = 51; +pub const OperationCode_ANEURALNETWORKS_GENERATE_PROPOSALS: OperationCode = 52; +pub const OperationCode_ANEURALNETWORKS_GREATER: OperationCode = 53; +pub const OperationCode_ANEURALNETWORKS_GREATER_EQUAL: OperationCode = 54; +pub const OperationCode_ANEURALNETWORKS_GROUPED_CONV_2D: OperationCode = 55; +pub const OperationCode_ANEURALNETWORKS_HEATMAP_MAX_KEYPOINT: OperationCode = 56; +pub const OperationCode_ANEURALNETWORKS_INSTANCE_NORMALIZATION: OperationCode = 57; +pub const OperationCode_ANEURALNETWORKS_LESS: OperationCode = 58; +pub const OperationCode_ANEURALNETWORKS_LESS_EQUAL: OperationCode = 59; +pub const OperationCode_ANEURALNETWORKS_LOG: OperationCode = 60; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_AND: OperationCode = 61; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_NOT: OperationCode = 62; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_OR: OperationCode = 63; +pub const OperationCode_ANEURALNETWORKS_LOG_SOFTMAX: OperationCode = 64; +pub const OperationCode_ANEURALNETWORKS_MAXIMUM: OperationCode = 65; +pub const OperationCode_ANEURALNETWORKS_MINIMUM: OperationCode = 66; +pub const OperationCode_ANEURALNETWORKS_NEG: OperationCode = 67; +pub const OperationCode_ANEURALNETWORKS_NOT_EQUAL: OperationCode = 68; +pub const OperationCode_ANEURALNETWORKS_PAD_V2: OperationCode = 69; +pub const OperationCode_ANEURALNETWORKS_POW: OperationCode = 70; +pub const OperationCode_ANEURALNETWORKS_PRELU: OperationCode = 71; +pub const OperationCode_ANEURALNETWORKS_QUANTIZE: OperationCode = 72; +pub const OperationCode_ANEURALNETWORKS_QUANTIZED_16BIT_LSTM: OperationCode = 73; +pub const OperationCode_ANEURALNETWORKS_RANDOM_MULTINOMIAL: OperationCode = 74; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ALL: OperationCode = 75; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ANY: OperationCode = 76; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MAX: OperationCode = 77; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MIN: OperationCode = 78; +pub const OperationCode_ANEURALNETWORKS_REDUCE_PROD: OperationCode = 79; +pub const OperationCode_ANEURALNETWORKS_REDUCE_SUM: OperationCode = 80; +pub const OperationCode_ANEURALNETWORKS_ROI_ALIGN: OperationCode = 81; +pub const OperationCode_ANEURALNETWORKS_ROI_POOLING: OperationCode = 82; +pub const OperationCode_ANEURALNETWORKS_RSQRT: OperationCode = 83; +pub const OperationCode_ANEURALNETWORKS_SELECT: OperationCode = 84; +pub const OperationCode_ANEURALNETWORKS_SIN: OperationCode = 85; +pub const OperationCode_ANEURALNETWORKS_SLICE: OperationCode = 86; +pub const OperationCode_ANEURALNETWORKS_SPLIT: OperationCode = 87; +pub const OperationCode_ANEURALNETWORKS_SQRT: OperationCode = 88; +pub const OperationCode_ANEURALNETWORKS_TILE: OperationCode = 89; +pub const OperationCode_ANEURALNETWORKS_TOPK_V2: OperationCode = 90; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE_CONV_2D: OperationCode = 91; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 92; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 93; +pub const OperationCode_ANEURALNETWORKS_RESIZE_NEAREST_NEIGHBOR: OperationCode = 94; +pub type OperationCode = u32; +pub const FuseCode_ANEURALNETWORKS_FUSED_NONE: FuseCode = 0; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU: FuseCode = 1; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU1: FuseCode = 2; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU6: FuseCode = 3; +pub type FuseCode = u32; +pub const PaddingCode_ANEURALNETWORKS_PADDING_SAME: PaddingCode = 1; +pub const PaddingCode_ANEURALNETWORKS_PADDING_VALID: PaddingCode = 2; +pub type PaddingCode = u32; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_LOW_POWER: PreferenceCode = 0; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER: PreferenceCode = 1; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_SUSTAINED_SPEED: PreferenceCode = 2; +pub type PreferenceCode = u32; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_UNKNOWN: DeviceTypeCode = 0; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_OTHER: DeviceTypeCode = 1; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_CPU: DeviceTypeCode = 2; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_GPU: DeviceTypeCode = 3; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_ACCELERATOR: DeviceTypeCode = 4; +pub type DeviceTypeCode = u32; +pub const ResultCode_ANEURALNETWORKS_NO_ERROR: ResultCode = 0; +pub const ResultCode_ANEURALNETWORKS_OUT_OF_MEMORY: ResultCode = 1; +pub const ResultCode_ANEURALNETWORKS_INCOMPLETE: ResultCode = 2; +pub const ResultCode_ANEURALNETWORKS_UNEXPECTED_NULL: ResultCode = 3; +pub const ResultCode_ANEURALNETWORKS_BAD_DATA: ResultCode = 4; +pub const ResultCode_ANEURALNETWORKS_OP_FAILED: ResultCode = 5; +pub const ResultCode_ANEURALNETWORKS_BAD_STATE: ResultCode = 6; +pub const ResultCode_ANEURALNETWORKS_UNMAPPABLE: ResultCode = 7; +pub const ResultCode_ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE: ResultCode = 8; +pub const ResultCode_ANEURALNETWORKS_UNAVAILABLE_DEVICE: ResultCode = 9; +pub type ResultCode = u32; +pub const ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES: _bindgen_ty_25 = 128; +pub type _bindgen_ty_25 = u32; +pub const ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN: _bindgen_ty_26 = 32; +pub type _bindgen_ty_26 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksMemory { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksModel { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksCompilation { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksExecution { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksSymmPerChannelQuantParams { + pub channelDim: u32, + pub scaleCount: u32, + pub scales: *const f32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksSymmPerChannelQuantParams() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).channelDim + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(channelDim) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scaleCount + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scaleCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scales as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scales) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksBurst { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksOperandType { + pub type_: i32, + pub dimensionCount: u32, + pub dimensions: *const u32, + pub scale: f32, + pub zeroPoint: i32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksOperandType() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensionCount as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensionCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensions as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensions) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scale as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(scale) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zeroPoint as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(zeroPoint) + ) + ); +} +pub type ANeuralNetworksOperationType = i32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksEvent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksDevice { + _unused: [u8; 0], +} +extern "C" { + pub fn ANeuralNetworks_getDeviceCount(numDevices: *mut u32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworks_getDevice( + devIndex: u32, + device: *mut *mut ANeuralNetworksDevice, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getName( + device: *const ANeuralNetworksDevice, + name: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getType( + device: *const ANeuralNetworksDevice, + type_: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getVersion( + device: *const ANeuralNetworksDevice, + version: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getFeatureLevel( + device: *const ANeuralNetworksDevice, + featureLevel: *mut i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_getSupportedOperationsForDevices( + model: *const ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + supportedOps: *mut bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_createForDevices( + model: *mut ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_setCaching( + compilation: *mut ANeuralNetworksCompilation, + cacheDir: *const ::std::os::raw::c_char, + token: *const u8, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_compute( + execution: *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandRank( + execution: *mut ANeuralNetworksExecution, + index: i32, + rank: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandDimensions( + execution: *mut ANeuralNetworksExecution, + index: i32, + dimensions: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_create( + compilation: *mut ANeuralNetworksCompilation, + burst: *mut *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_free(burst: *mut ANeuralNetworksBurst); +} +extern "C" { + pub fn ANeuralNetworksExecution_burstCompute( + execution: *mut ANeuralNetworksExecution, + burst: *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromAHardwareBuffer( + ahwb: *const AHardwareBuffer, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setMeasureTiming( + execution: *mut ANeuralNetworksExecution, + measure: bool, + ) -> ::std::os::raw::c_int; +} +pub const DurationCode_ANEURALNETWORKS_DURATION_ON_HARDWARE: DurationCode = 0; +pub const DurationCode_ANEURALNETWORKS_DURATION_IN_DRIVER: DurationCode = 1; +pub type DurationCode = u32; +extern "C" { + pub fn ANeuralNetworksExecution_getDuration( + execution: *const ANeuralNetworksExecution, + durationCode: i32, + duration: *mut u64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromFd( + size: usize, + protect: ::std::os::raw::c_int, + fd: ::std::os::raw::c_int, + offset: usize, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_free(memory: *mut ANeuralNetworksMemory); +} +extern "C" { + pub fn ANeuralNetworksModel_create( + model: *mut *mut ANeuralNetworksModel, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_free(model: *mut ANeuralNetworksModel); +} +extern "C" { + pub fn ANeuralNetworksModel_finish(model: *mut ANeuralNetworksModel) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperand( + model: *mut ANeuralNetworksModel, + type_: *const ANeuralNetworksOperandType, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValue( + model: *mut ANeuralNetworksModel, + index: i32, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandSymmPerChannelQuantParams( + model: *mut ANeuralNetworksModel, + index: i32, + channelQuant: *const ANeuralNetworksSymmPerChannelQuantParams, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValueFromMemory( + model: *mut ANeuralNetworksModel, + index: i32, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperation( + model: *mut ANeuralNetworksModel, + type_: ANeuralNetworksOperationType, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_identifyInputsAndOutputs( + model: *mut ANeuralNetworksModel, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_relaxComputationFloat32toFloat16( + model: *mut ANeuralNetworksModel, + allow: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_create( + model: *mut ANeuralNetworksModel, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_free(compilation: *mut ANeuralNetworksCompilation); +} +extern "C" { + pub fn ANeuralNetworksCompilation_setPreference( + compilation: *mut ANeuralNetworksCompilation, + preference: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_finish( + compilation: *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_create( + compilation: *mut ANeuralNetworksCompilation, + execution: *mut *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_free(execution: *mut ANeuralNetworksExecution); +} +extern "C" { + pub fn ANeuralNetworksExecution_setInput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setInputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *mut ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_startCompute( + execution: *mut ANeuralNetworksExecution, + event: *mut *mut ANeuralNetworksEvent, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_wait(event: *mut ANeuralNetworksEvent) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_free(event: *mut ANeuralNetworksEvent); +} +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBA_8888: ANativeWindow_LegacyFormat = 1; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBX_8888: ANativeWindow_LegacyFormat = 2; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGB_565: ANativeWindow_LegacyFormat = 4; +pub type ANativeWindow_LegacyFormat = u32; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_IDENTITY: ANativeWindowTransform = 0; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL: ANativeWindowTransform = + 1; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL: ANativeWindowTransform = + 2; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_90: ANativeWindowTransform = 4; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_180: ANativeWindowTransform = 3; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_270: ANativeWindowTransform = 7; +pub type ANativeWindowTransform = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow_Buffer { + pub width: i32, + pub height: i32, + pub stride: i32, + pub format: i32, + pub bits: *mut ::std::os::raw::c_void, + pub reserved: [u32; 6usize], +} +#[test] +fn bindgen_test_layout_ANativeWindow_Buffer() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bits as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(bits) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(reserved) + ) + ); +} +extern "C" { + pub fn ANativeWindow_acquire(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_release(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_getWidth(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getHeight(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getFormat(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersGeometry( + window: *mut ANativeWindow, + width: i32, + height: i32, + format: i32, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_lock( + window: *mut ANativeWindow, + outBuffer: *mut ANativeWindow_Buffer, + inOutDirtyBounds: *mut ARect, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_unlockAndPost(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersTransform(window: *mut ANativeWindow, transform: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersDataSpace(window: *mut ANativeWindow, dataSpace: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_getBuffersDataSpace(window: *mut ANativeWindow) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivity { + pub callbacks: *mut ANativeActivityCallbacks, + pub vm: *mut JavaVM, + pub env: *mut JNIEnv, + pub clazz: jobject, + pub internalDataPath: *const ::std::os::raw::c_char, + pub externalDataPath: *const ::std::os::raw::c_char, + pub sdkVersion: i32, + pub instance: *mut ::std::os::raw::c_void, + pub assetManager: *mut AAssetManager, + pub obbPath: *const ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_ANativeActivity() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(ANativeActivity)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANativeActivity)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(callbacks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(vm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(env) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clazz as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(clazz) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).internalDataPath as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(internalDataPath) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).externalDataPath as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(externalDataPath) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(sdkVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(instance) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(assetManager) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(obbPath) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivityCallbacks { + pub onStart: ::std::option::Option, + pub onResume: ::std::option::Option, + pub onSaveInstanceState: ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + outSize: *mut usize, + ) -> *mut ::std::os::raw::c_void, + >, + pub onPause: ::std::option::Option, + pub onStop: ::std::option::Option, + pub onDestroy: ::std::option::Option, + pub onWindowFocusChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, hasFocus: ::std::os::raw::c_int), + >, + pub onNativeWindowCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowResized: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowRedrawNeeded: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onInputQueueCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onInputQueueDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, rect: *const ARect), + >, + pub onConfigurationChanged: + ::std::option::Option, + pub onLowMemory: ::std::option::Option, +} +#[test] +fn bindgen_test_layout_ANativeActivityCallbacks() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onStart as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStart) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onResume as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onResume) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onSaveInstanceState as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onSaveInstanceState) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onPause as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onPause) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStop) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onDestroy as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onDestroy) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ + as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onWindowFocusChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowResized as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowResized) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded + as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowRedrawNeeded) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ + as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueCreated as *const _ + as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueDestroyed as *const _ + as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onContentRectChanged as *const _ + as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onContentRectChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onConfigurationChanged as *const _ + as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onConfigurationChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onLowMemory as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onLowMemory) + ) + ); +} +pub type ANativeActivity_createFunc = ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ), +>; +extern "C" { + pub fn ANativeActivity_onCreate( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ); +} +extern "C" { + pub fn ANativeActivity_finish(activity: *mut ANativeActivity); +} +extern "C" { + pub fn ANativeActivity_setWindowFormat(activity: *mut ANativeActivity, format: i32); +} +extern "C" { + pub fn ANativeActivity_setWindowFlags( + activity: *mut ANativeActivity, + addFlags: u32, + removeFlags: u32, + ); +} +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: _bindgen_ty_27 = 1; +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED: _bindgen_ty_27 = 2; +pub type _bindgen_ty_27 = u32; +extern "C" { + pub fn ANativeActivity_showSoftInput(activity: *mut ANativeActivity, flags: u32); +} +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: _bindgen_ty_28 = 1; +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: _bindgen_ty_28 = 2; +pub type _bindgen_ty_28 = u32; +extern "C" { + pub fn ANativeActivity_hideSoftInput(activity: *mut ANativeActivity, flags: u32); +} +extern "C" { + pub fn ANativeWindow_fromSurface(env: *mut JNIEnv, surface: jobject) -> *mut ANativeWindow; +} +extern "C" { + pub fn ANativeWindow_toSurface(env: *mut JNIEnv, window: *mut ANativeWindow) -> jobject; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AObbInfo { + _unused: [u8; 0], +} +pub const AOBBINFO_OVERLAY: _bindgen_ty_29 = 1; +pub type _bindgen_ty_29 = u32; +extern "C" { + pub fn AObbScanner_getObbInfo(filename: *const ::std::os::raw::c_char) -> *mut AObbInfo; +} +extern "C" { + pub fn AObbInfo_delete(obbInfo: *mut AObbInfo); +} +extern "C" { + pub fn AObbInfo_getPackageName(obbInfo: *mut AObbInfo) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AObbInfo_getVersion(obbInfo: *mut AObbInfo) -> i32; +} +extern "C" { + pub fn AObbInfo_getFlags(obbInfo: *mut AObbInfo) -> i32; +} +pub type __double_t = f64; +pub type double_t = __double_t; +pub type __float_t = f32; +pub type float_t = __float_t; +extern "C" { + pub fn acos(__x: f64) -> f64; +} +extern "C" { + pub fn acosf(__x: f32) -> f32; +} +extern "C" { + pub fn acosl(__x: u128) -> u128; +} +extern "C" { + pub fn asin(__x: f64) -> f64; +} +extern "C" { + pub fn asinf(__x: f32) -> f32; +} +extern "C" { + pub fn asinl(__x: u128) -> u128; +} +extern "C" { + pub fn atan(__x: f64) -> f64; +} +extern "C" { + pub fn atanf(__x: f32) -> f32; +} +extern "C" { + pub fn atanl(__x: u128) -> u128; +} +extern "C" { + pub fn atan2(__y: f64, __x: f64) -> f64; +} +extern "C" { + pub fn atan2f(__y: f32, __x: f32) -> f32; +} +extern "C" { + pub fn atan2l(__y: u128, __x: u128) -> u128; +} +extern "C" { + pub fn cos(__x: f64) -> f64; +} +extern "C" { + pub fn cosf(__x: f32) -> f32; +} +extern "C" { + pub fn cosl(__x: u128) -> u128; +} +extern "C" { + pub fn sin(__x: f64) -> f64; +} +extern "C" { + pub fn sinf(__x: f32) -> f32; +} +extern "C" { + pub fn sinl(__x: u128) -> u128; +} +extern "C" { + pub fn tan(__x: f64) -> f64; +} +extern "C" { + pub fn tanf(__x: f32) -> f32; +} +extern "C" { + pub fn tanl(__x: u128) -> u128; +} +extern "C" { + pub fn acosh(__x: f64) -> f64; +} +extern "C" { + pub fn acoshf(__x: f32) -> f32; +} +extern "C" { + pub fn acoshl(__x: u128) -> u128; +} +extern "C" { + pub fn asinh(__x: f64) -> f64; +} +extern "C" { + pub fn asinhf(__x: f32) -> f32; +} +extern "C" { + pub fn asinhl(__x: u128) -> u128; +} +extern "C" { + pub fn atanh(__x: f64) -> f64; +} +extern "C" { + pub fn atanhf(__x: f32) -> f32; +} +extern "C" { + pub fn atanhl(__x: u128) -> u128; +} +extern "C" { + pub fn cosh(__x: f64) -> f64; +} +extern "C" { + pub fn coshf(__x: f32) -> f32; +} +extern "C" { + pub fn coshl(__x: u128) -> u128; +} +extern "C" { + pub fn sinh(__x: f64) -> f64; +} +extern "C" { + pub fn sinhf(__x: f32) -> f32; +} +extern "C" { + pub fn sinhl(__x: u128) -> u128; +} +extern "C" { + pub fn tanh(__x: f64) -> f64; +} +extern "C" { + pub fn tanhf(__x: f32) -> f32; +} +extern "C" { + pub fn tanhl(__x: u128) -> u128; +} +extern "C" { + pub fn exp(__x: f64) -> f64; +} +extern "C" { + pub fn expf(__x: f32) -> f32; +} +extern "C" { + pub fn expl(__x: u128) -> u128; +} +extern "C" { + pub fn exp2(__x: f64) -> f64; +} +extern "C" { + pub fn exp2f(__x: f32) -> f32; +} +extern "C" { + pub fn exp2l(__x: u128) -> u128; +} +extern "C" { + pub fn expm1(__x: f64) -> f64; +} +extern "C" { + pub fn expm1f(__x: f32) -> f32; +} +extern "C" { + pub fn expm1l(__x: u128) -> u128; +} +extern "C" { + pub fn frexp(__x: f64, __exponent: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn frexpf(__x: f32, __exponent: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn frexpl(__x: u128, __exponent: *mut ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn ilogb(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ilogbf(__x: f32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ilogbl(__x: u128) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ldexp(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn ldexpf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn ldexpl(__x: u128, __exponent: ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn log(__x: f64) -> f64; +} +extern "C" { + pub fn logf(__x: f32) -> f32; +} +extern "C" { + pub fn logl(__x: u128) -> u128; +} +extern "C" { + pub fn log10(__x: f64) -> f64; +} +extern "C" { + pub fn log10f(__x: f32) -> f32; +} +extern "C" { + pub fn log10l(__x: u128) -> u128; +} +extern "C" { + pub fn log1p(__x: f64) -> f64; +} +extern "C" { + pub fn log1pf(__x: f32) -> f32; +} +extern "C" { + pub fn log1pl(__x: u128) -> u128; +} +extern "C" { + pub fn log2(__x: f64) -> f64; +} +extern "C" { + pub fn log2f(__x: f32) -> f32; +} +extern "C" { + pub fn log2l(__x: u128) -> u128; +} +extern "C" { + pub fn logb(__x: f64) -> f64; +} +extern "C" { + pub fn logbf(__x: f32) -> f32; +} +extern "C" { + pub fn logbl(__x: u128) -> u128; +} +extern "C" { + pub fn modf(__x: f64, __integral_part: *mut f64) -> f64; +} +extern "C" { + pub fn modff(__x: f32, __integral_part: *mut f32) -> f32; +} +extern "C" { + pub fn modfl(__x: u128, __integral_part: *mut u128) -> u128; +} +extern "C" { + pub fn scalbn(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn scalbnf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn scalbnl(__x: u128, __exponent: ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn scalbln(__x: f64, __exponent: ::std::os::raw::c_long) -> f64; +} +extern "C" { + pub fn scalblnf(__x: f32, __exponent: ::std::os::raw::c_long) -> f32; +} +extern "C" { + pub fn scalblnl(__x: u128, __exponent: ::std::os::raw::c_long) -> u128; +} +extern "C" { + pub fn cbrt(__x: f64) -> f64; +} +extern "C" { + pub fn cbrtf(__x: f32) -> f32; +} +extern "C" { + pub fn cbrtl(__x: u128) -> u128; +} +extern "C" { + pub fn fabs(__x: f64) -> f64; +} +extern "C" { + pub fn fabsf(__x: f32) -> f32; +} +extern "C" { + pub fn fabsl(__x: u128) -> u128; +} +extern "C" { + pub fn hypot(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn hypotf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn hypotl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn pow(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn powf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn powl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn sqrt(__x: f64) -> f64; +} +extern "C" { + pub fn sqrtf(__x: f32) -> f32; +} +extern "C" { + pub fn sqrtl(__x: u128) -> u128; +} +extern "C" { + pub fn erf(__x: f64) -> f64; +} +extern "C" { + pub fn erff(__x: f32) -> f32; +} +extern "C" { + pub fn erfl(__x: u128) -> u128; +} +extern "C" { + pub fn erfc(__x: f64) -> f64; +} +extern "C" { + pub fn erfcf(__x: f32) -> f32; +} +extern "C" { + pub fn erfcl(__x: u128) -> u128; +} +extern "C" { + pub fn lgamma(__x: f64) -> f64; +} +extern "C" { + pub fn lgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn lgammal(__x: u128) -> u128; +} +extern "C" { + pub fn tgamma(__x: f64) -> f64; +} +extern "C" { + pub fn tgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn tgammal(__x: u128) -> u128; +} +extern "C" { + pub fn ceil(__x: f64) -> f64; +} +extern "C" { + pub fn ceilf(__x: f32) -> f32; +} +extern "C" { + pub fn ceill(__x: u128) -> u128; +} +extern "C" { + pub fn floor(__x: f64) -> f64; +} +extern "C" { + pub fn floorf(__x: f32) -> f32; +} +extern "C" { + pub fn floorl(__x: u128) -> u128; +} +extern "C" { + pub fn nearbyint(__x: f64) -> f64; +} +extern "C" { + pub fn nearbyintf(__x: f32) -> f32; +} +extern "C" { + pub fn nearbyintl(__x: u128) -> u128; +} +extern "C" { + pub fn rint(__x: f64) -> f64; +} +extern "C" { + pub fn rintf(__x: f32) -> f32; +} +extern "C" { + pub fn rintl(__x: u128) -> u128; +} +extern "C" { + pub fn lrint(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lrintf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lrintl(__x: u128) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llrint(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llrintf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llrintl(__x: u128) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn round(__x: f64) -> f64; +} +extern "C" { + pub fn roundf(__x: f32) -> f32; +} +extern "C" { + pub fn roundl(__x: u128) -> u128; +} +extern "C" { + pub fn lround(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lroundf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lroundl(__x: u128) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llround(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llroundf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llroundl(__x: u128) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn trunc(__x: f64) -> f64; +} +extern "C" { + pub fn truncf(__x: f32) -> f32; +} +extern "C" { + pub fn truncl(__x: u128) -> u128; +} +extern "C" { + pub fn fmod(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmodf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmodl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn remainder(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn remainderf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn remainderl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn remquo(__x: f64, __y: f64, __quotient_bits: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn remquof(__x: f32, __y: f32, __quotient_bits: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn remquol(__x: u128, __y: u128, __quotient_bits: *mut ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn copysign(__value: f64, __sign: f64) -> f64; +} +extern "C" { + pub fn copysignf(__value: f32, __sign: f32) -> f32; +} +extern "C" { + pub fn copysignl(__value: u128, __sign: u128) -> u128; +} +extern "C" { + pub fn nan(__kind: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn nanf(__kind: *const ::std::os::raw::c_char) -> f32; +} +extern "C" { + pub fn nanl(__kind: *const ::std::os::raw::c_char) -> u128; +} +extern "C" { + pub fn nextafter(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn nextafterf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn nextafterl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn nexttoward(__x: f64, __y: u128) -> f64; +} +extern "C" { + pub fn nexttowardf(__x: f32, __y: u128) -> f32; +} +extern "C" { + pub fn nexttowardl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fdim(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fdimf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fdiml(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fmax(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmaxf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmaxl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fmin(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fminf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fminl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fma(__x: f64, __y: f64, __z: f64) -> f64; +} +extern "C" { + pub fn fmaf(__x: f32, __y: f32, __z: f32) -> f32; +} +extern "C" { + pub fn fmal(__x: u128, __y: u128, __z: u128) -> u128; +} +extern "C" { + pub fn isinf(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isnan(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut signgam: ::std::os::raw::c_int; +} +extern "C" { + pub fn j0(__x: f64) -> f64; +} +extern "C" { + pub fn j1(__x: f64) -> f64; +} +extern "C" { + pub fn jn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +extern "C" { + pub fn y0(__x: f64) -> f64; +} +extern "C" { + pub fn y1(__x: f64) -> f64; +} +extern "C" { + pub fn yn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +pub const ASENSOR_TYPE_INVALID: _bindgen_ty_30 = -1; +pub const ASENSOR_TYPE_ACCELEROMETER: _bindgen_ty_30 = 1; +pub const ASENSOR_TYPE_MAGNETIC_FIELD: _bindgen_ty_30 = 2; +pub const ASENSOR_TYPE_GYROSCOPE: _bindgen_ty_30 = 4; +pub const ASENSOR_TYPE_LIGHT: _bindgen_ty_30 = 5; +pub const ASENSOR_TYPE_PRESSURE: _bindgen_ty_30 = 6; +pub const ASENSOR_TYPE_PROXIMITY: _bindgen_ty_30 = 8; +pub const ASENSOR_TYPE_GRAVITY: _bindgen_ty_30 = 9; +pub const ASENSOR_TYPE_LINEAR_ACCELERATION: _bindgen_ty_30 = 10; +pub const ASENSOR_TYPE_ROTATION_VECTOR: _bindgen_ty_30 = 11; +pub const ASENSOR_TYPE_RELATIVE_HUMIDITY: _bindgen_ty_30 = 12; +pub const ASENSOR_TYPE_AMBIENT_TEMPERATURE: _bindgen_ty_30 = 13; +pub const ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: _bindgen_ty_30 = 14; +pub const ASENSOR_TYPE_GAME_ROTATION_VECTOR: _bindgen_ty_30 = 15; +pub const ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED: _bindgen_ty_30 = 16; +pub const ASENSOR_TYPE_SIGNIFICANT_MOTION: _bindgen_ty_30 = 17; +pub const ASENSOR_TYPE_STEP_DETECTOR: _bindgen_ty_30 = 18; +pub const ASENSOR_TYPE_STEP_COUNTER: _bindgen_ty_30 = 19; +pub const ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: _bindgen_ty_30 = 20; +pub const ASENSOR_TYPE_HEART_RATE: _bindgen_ty_30 = 21; +pub const ASENSOR_TYPE_POSE_6DOF: _bindgen_ty_30 = 28; +pub const ASENSOR_TYPE_STATIONARY_DETECT: _bindgen_ty_30 = 29; +pub const ASENSOR_TYPE_MOTION_DETECT: _bindgen_ty_30 = 30; +pub const ASENSOR_TYPE_HEART_BEAT: _bindgen_ty_30 = 31; +pub const ASENSOR_TYPE_ADDITIONAL_INFO: _bindgen_ty_30 = 33; +pub const ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT: _bindgen_ty_30 = 34; +pub const ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED: _bindgen_ty_30 = 35; +pub type _bindgen_ty_30 = i32; +pub const ASENSOR_STATUS_NO_CONTACT: _bindgen_ty_31 = -1; +pub const ASENSOR_STATUS_UNRELIABLE: _bindgen_ty_31 = 0; +pub const ASENSOR_STATUS_ACCURACY_LOW: _bindgen_ty_31 = 1; +pub const ASENSOR_STATUS_ACCURACY_MEDIUM: _bindgen_ty_31 = 2; +pub const ASENSOR_STATUS_ACCURACY_HIGH: _bindgen_ty_31 = 3; +pub type _bindgen_ty_31 = i32; +pub const AREPORTING_MODE_INVALID: _bindgen_ty_32 = -1; +pub const AREPORTING_MODE_CONTINUOUS: _bindgen_ty_32 = 0; +pub const AREPORTING_MODE_ON_CHANGE: _bindgen_ty_32 = 1; +pub const AREPORTING_MODE_ONE_SHOT: _bindgen_ty_32 = 2; +pub const AREPORTING_MODE_SPECIAL_TRIGGER: _bindgen_ty_32 = 3; +pub type _bindgen_ty_32 = i32; +pub const ASENSOR_DIRECT_RATE_STOP: _bindgen_ty_33 = 0; +pub const ASENSOR_DIRECT_RATE_NORMAL: _bindgen_ty_33 = 1; +pub const ASENSOR_DIRECT_RATE_FAST: _bindgen_ty_33 = 2; +pub const ASENSOR_DIRECT_RATE_VERY_FAST: _bindgen_ty_33 = 3; +pub type _bindgen_ty_33 = u32; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY: _bindgen_ty_34 = 1; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER: _bindgen_ty_34 = 2; +pub type _bindgen_ty_34 = u32; +pub const ASENSOR_ADDITIONAL_INFO_BEGIN: _bindgen_ty_35 = 0; +pub const ASENSOR_ADDITIONAL_INFO_END: _bindgen_ty_35 = 1; +pub const ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY: _bindgen_ty_35 = 65536; +pub const ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE: _bindgen_ty_35 = 65537; +pub const ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION: _bindgen_ty_35 = 65538; +pub const ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT: _bindgen_ty_35 = 65539; +pub const ASENSOR_ADDITIONAL_INFO_SAMPLING: _bindgen_ty_35 = 65540; +pub type _bindgen_ty_35 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorVector { + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1, + pub status: i8, + pub reserved: [u8; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorVector__bindgen_ty_1 { + pub v: [f32; 3usize], + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1__bindgen_ty_1, + pub __bindgen_anon_2: ASensorVector__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_1 { + pub x: f32, + pub y: f32, + pub z: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_2 { + pub azimuth: f32, + pub pitch: f32, + pub roll: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).azimuth + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(azimuth) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pitch as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(pitch) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).roll as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(roll) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).v as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1), + "::", + stringify!(v) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ASensorVector)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AMetaDataEvent { + pub what: i32, + pub sensor: i32, +} +#[test] +fn bindgen_test_layout_AMetaDataEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).what as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(sensor) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AUncalibratedEvent { + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1, + pub __bindgen_anon_2: AUncalibratedEvent__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_1 { + pub uncalib: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1 { + pub x_uncalib: f32, + pub y_uncalib: f32, + pub z_uncalib: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_uncalib + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_uncalib + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_uncalib + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z_uncalib) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalib as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1), + "::", + stringify!(uncalib) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_2 { + pub bias: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1 { + pub x_bias: f32, + pub y_bias: f32, + pub z_bias: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_bias + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(x_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_bias + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(y_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_bias + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(z_bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).bias as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2), + "::", + stringify!(bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(AUncalibratedEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AUncalibratedEvent)) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHeartRateEvent { + pub bpm: f32, + pub status: i8, +} +#[test] +fn bindgen_test_layout_AHeartRateEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bpm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(bpm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(status) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ADynamicSensorEvent { + pub connected: i32, + pub handle: i32, +} +#[test] +fn bindgen_test_layout_ADynamicSensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).connected as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(connected) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(handle) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AAdditionalInfoEvent { + pub type_: i32, + pub serial: i32, + pub __bindgen_anon_1: AAdditionalInfoEvent__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AAdditionalInfoEvent__bindgen_ty_1 { + pub data_int32: [i32; 14usize], + pub data_float: [f32; 14usize], + _bindgen_union_align: [u32; 14usize], +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_int32 as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_int32) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_float as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_float) + ) + ); +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).serial as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(serial) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorEvent { + pub version: i32, + pub sensor: i32, + pub type_: i32, + pub reserved0: i32, + pub timestamp: i64, + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1, + pub flags: u32, + pub reserved1: [i32; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1 { + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1__bindgen_ty_1, + pub u64: ASensorEvent__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_1 { + pub data: [f32; 16usize], + pub vector: ASensorVector, + pub acceleration: ASensorVector, + pub magnetic: ASensorVector, + pub temperature: f32, + pub distance: f32, + pub light: f32, + pub pressure: f32, + pub relative_humidity: f32, + pub uncalibrated_gyro: AUncalibratedEvent, + pub uncalibrated_magnetic: AUncalibratedEvent, + pub meta_data: AMetaDataEvent, + pub heart_rate: AHeartRateEvent, + pub dynamic_sensor_meta: ADynamicSensorEvent, + pub additional_info: AAdditionalInfoEvent, + _bindgen_union_align: [u32; 16usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).acceleration + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(acceleration) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).magnetic + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).temperature + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(temperature) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).distance + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(distance) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).light as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(light) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pressure + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(pressure) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).relative_humidity + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(relative_humidity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalibrated_gyro + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_gyro) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .uncalibrated_magnetic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).meta_data + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(meta_data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).heart_rate + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(heart_rate) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dynamic_sensor_meta + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(dynamic_sensor_meta) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).additional_info + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(additional_info) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_2 { + pub data: [u64; 8usize], + pub step_counter: u64, + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).step_counter + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(step_counter) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u64 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1), + "::", + stringify!(u64) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(ASensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ASensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(sensor) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(timestamp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 92usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorEventQueue { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensor { + _unused: [u8; 0], +} +pub type ASensorRef = *const ASensor; +pub type ASensorList = *const ASensorRef; +extern "C" { + pub fn ASensorManager_getInstance() -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getInstanceForPackage( + packageName: *const ::std::os::raw::c_char, + ) -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getSensorList( + manager: *mut ASensorManager, + list: *mut ASensorList, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_getDefaultSensor( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_getDefaultSensorEx( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + wakeUp: bool, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_createEventQueue( + manager: *mut ASensorManager, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> *mut ASensorEventQueue; +} +extern "C" { + pub fn ASensorManager_destroyEventQueue( + manager: *mut ASensorManager, + queue: *mut ASensorEventQueue, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createSharedMemoryDirectChannel( + manager: *mut ASensorManager, + fd: ::std::os::raw::c_int, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createHardwareBufferDirectChannel( + manager: *mut ASensorManager, + buffer: *const AHardwareBuffer, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_destroyDirectChannel( + manager: *mut ASensorManager, + channelId: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn ASensorManager_configureDirectReport( + manager: *mut ASensorManager, + sensor: *const ASensor, + channelId: ::std::os::raw::c_int, + rate: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_registerSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + samplingPeriodUs: i32, + maxBatchReportLatencyUs: i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_enableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_disableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_setEventRate( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + usec: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_hasEvents(queue: *mut ASensorEventQueue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_getEvents( + queue: *mut ASensorEventQueue, + events: *mut ASensorEvent, + count: usize, + ) -> isize; +} +extern "C" { + pub fn ASensorEventQueue_requestAdditionalInfoEvents( + queue: *mut ASensorEventQueue, + enable: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getName(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getVendor(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getType(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getResolution(sensor: *const ASensor) -> f32; +} +extern "C" { + pub fn ASensor_getMinDelay(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoMaxEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoReservedEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getStringType(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getReportingMode(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_isWakeUpSensor(sensor: *const ASensor) -> bool; +} +extern "C" { + pub fn ASensor_isDirectChannelTypeSupported( + sensor: *const ASensor, + channelType: ::std::os::raw::c_int, + ) -> bool; +} +extern "C" { + pub fn ASensor_getHighestDirectReportRateLevel(sensor: *const ASensor) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getHandle(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_set_abort_message(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ASharedMemory_create( + name: *const ::std::os::raw::c_char, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_getSize(fd: ::std::os::raw::c_int) -> usize; +} +extern "C" { + pub fn ASharedMemory_setProt( + fd: ::std::os::raw::c_int, + prot: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_dupFromJava( + env: *mut JNIEnv, + sharedMemory: jobject, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AStorageManager { + _unused: [u8; 0], +} +pub const AOBB_STATE_MOUNTED: _bindgen_ty_36 = 1; +pub const AOBB_STATE_UNMOUNTED: _bindgen_ty_36 = 2; +pub const AOBB_STATE_ERROR_INTERNAL: _bindgen_ty_36 = 20; +pub const AOBB_STATE_ERROR_COULD_NOT_MOUNT: _bindgen_ty_36 = 21; +pub const AOBB_STATE_ERROR_COULD_NOT_UNMOUNT: _bindgen_ty_36 = 22; +pub const AOBB_STATE_ERROR_NOT_MOUNTED: _bindgen_ty_36 = 23; +pub const AOBB_STATE_ERROR_ALREADY_MOUNTED: _bindgen_ty_36 = 24; +pub const AOBB_STATE_ERROR_PERMISSION_DENIED: _bindgen_ty_36 = 25; +pub type _bindgen_ty_36 = u32; +extern "C" { + pub fn AStorageManager_new() -> *mut AStorageManager; +} +extern "C" { + pub fn AStorageManager_delete(mgr: *mut AStorageManager); +} +pub type AStorageManager_obbCallbackFunc = ::std::option::Option< + unsafe extern "C" fn( + filename: *const ::std::os::raw::c_char, + state: i32, + data: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + pub fn AStorageManager_mountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + key: *const ::std::os::raw::c_char, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_unmountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + force: ::std::os::raw::c_int, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_isObbMounted( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AStorageManager_getMountedObbPath( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASurfaceTexture { + _unused: [u8; 0], +} +extern "C" { + pub fn ASurfaceTexture_release(st: *mut ASurfaceTexture); +} +extern "C" { + pub fn ASurfaceTexture_acquireANativeWindow(st: *mut ASurfaceTexture) -> *mut ANativeWindow; +} +extern "C" { + pub fn ASurfaceTexture_attachToGLContext( + st: *mut ASurfaceTexture, + texName: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_detachFromGLContext(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_updateTexImage(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_getTransformMatrix(st: *mut ASurfaceTexture, mtx: *mut f32); +} +extern "C" { + pub fn ASurfaceTexture_getTimestamp(st: *mut ASurfaceTexture) -> i64; +} +extern "C" { + pub fn ASurfaceTexture_fromSurfaceTexture( + env: *mut JNIEnv, + surfacetexture: jobject, + ) -> *mut ASurfaceTexture; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_merge_data { + pub name: [::std::os::raw::c_char; 32usize], + pub fd2: __s32, + pub fence: __s32, + pub flags: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_sync_merge_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(sync_merge_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sync_merge_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd2 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fd2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fence as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_fence_info { + pub obj_name: [::std::os::raw::c_char; 32usize], + pub driver_name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub timestamp_ns: __u64, +} +#[test] +fn bindgen_test_layout_sync_fence_info() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(sync_fence_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sync_fence_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obj_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(obj_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).driver_name as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(driver_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp_ns as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(timestamp_ns) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_file_info { + pub name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub num_fences: __u32, + pub pad: __u32, + pub sync_fence_info: __u64, +} +#[test] +fn bindgen_test_layout_sync_file_info() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(sync_file_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sync_file_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_fences as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(num_fences) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sync_fence_info as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(sync_fence_info) + ) + ); +} +extern "C" { + pub fn sync_merge(name: *const ::std::os::raw::c_char, fd1: i32, fd2: i32) -> i32; +} +extern "C" { + pub fn sync_file_info(fd: i32) -> *mut sync_file_info; +} +extern "C" { + pub fn sync_file_info_free(info: *mut sync_file_info); +} +extern "C" { + pub fn ATrace_isEnabled() -> bool; +} +extern "C" { + pub fn ATrace_beginSection(sectionName: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ATrace_endSection(); +} +extern "C" { + pub fn ATrace_beginAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_endAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_setCounter(counterName: *const ::std::os::raw::c_char, counterValue: i64); +} +pub const AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: _bindgen_ty_37 = 1; +pub const AWINDOW_FLAG_DIM_BEHIND: _bindgen_ty_37 = 2; +pub const AWINDOW_FLAG_BLUR_BEHIND: _bindgen_ty_37 = 4; +pub const AWINDOW_FLAG_NOT_FOCUSABLE: _bindgen_ty_37 = 8; +pub const AWINDOW_FLAG_NOT_TOUCHABLE: _bindgen_ty_37 = 16; +pub const AWINDOW_FLAG_NOT_TOUCH_MODAL: _bindgen_ty_37 = 32; +pub const AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING: _bindgen_ty_37 = 64; +pub const AWINDOW_FLAG_KEEP_SCREEN_ON: _bindgen_ty_37 = 128; +pub const AWINDOW_FLAG_LAYOUT_IN_SCREEN: _bindgen_ty_37 = 256; +pub const AWINDOW_FLAG_LAYOUT_NO_LIMITS: _bindgen_ty_37 = 512; +pub const AWINDOW_FLAG_FULLSCREEN: _bindgen_ty_37 = 1024; +pub const AWINDOW_FLAG_FORCE_NOT_FULLSCREEN: _bindgen_ty_37 = 2048; +pub const AWINDOW_FLAG_DITHER: _bindgen_ty_37 = 4096; +pub const AWINDOW_FLAG_SECURE: _bindgen_ty_37 = 8192; +pub const AWINDOW_FLAG_SCALED: _bindgen_ty_37 = 16384; +pub const AWINDOW_FLAG_IGNORE_CHEEK_PRESSES: _bindgen_ty_37 = 32768; +pub const AWINDOW_FLAG_LAYOUT_INSET_DECOR: _bindgen_ty_37 = 65536; +pub const AWINDOW_FLAG_ALT_FOCUSABLE_IM: _bindgen_ty_37 = 131072; +pub const AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH: _bindgen_ty_37 = 262144; +pub const AWINDOW_FLAG_SHOW_WHEN_LOCKED: _bindgen_ty_37 = 524288; +pub const AWINDOW_FLAG_SHOW_WALLPAPER: _bindgen_ty_37 = 1048576; +pub const AWINDOW_FLAG_TURN_SCREEN_ON: _bindgen_ty_37 = 2097152; +pub const AWINDOW_FLAG_DISMISS_KEYGUARD: _bindgen_ty_37 = 4194304; +pub type _bindgen_ty_37 = u32; +pub type __builtin_va_list = __va_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list { + pub __stack: *mut ::std::os::raw::c_void, + pub __gr_top: *mut ::std::os::raw::c_void, + pub __vr_top: *mut ::std::os::raw::c_void, + pub __gr_offs: ::std::os::raw::c_int, + pub __vr_offs: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout___va_list() { + assert_eq!( + ::std::mem::size_of::<__va_list>(), + 32usize, + concat!("Size of: ", stringify!(__va_list)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list>())).__stack as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list), + "::", + stringify!(__stack) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list>())).__gr_top as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list), + "::", + stringify!(__gr_top) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list>())).__vr_top as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list), + "::", + stringify!(__vr_top) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list>())).__gr_offs as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(__va_list), + "::", + stringify!(__gr_offs) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list>())).__vr_offs as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(__va_list), + "::", + stringify!(__vr_offs) + ) + ); +} diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_arm.rs b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_arm.rs new file mode 100644 index 0000000..63acf8c --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_arm.rs @@ -0,0 +1,13590 @@ +/* automatically generated by rust-bindgen */ + +pub const __BIONIC__: u32 = 1; +pub const __WORDSIZE: u32 = 32; +pub const __bos_level: u32 = 0; +pub const __ANDROID_API_FUTURE__: u32 = 10000; +pub const __ANDROID_API__: u32 = 10000; +pub const __ANDROID_API_G__: u32 = 9; +pub const __ANDROID_API_I__: u32 = 14; +pub const __ANDROID_API_J__: u32 = 16; +pub const __ANDROID_API_J_MR1__: u32 = 17; +pub const __ANDROID_API_J_MR2__: u32 = 18; +pub const __ANDROID_API_K__: u32 = 19; +pub const __ANDROID_API_L__: u32 = 21; +pub const __ANDROID_API_L_MR1__: u32 = 22; +pub const __ANDROID_API_M__: u32 = 23; +pub const __ANDROID_API_N__: u32 = 24; +pub const __ANDROID_API_N_MR1__: u32 = 25; +pub const __ANDROID_API_O__: u32 = 26; +pub const __ANDROID_API_O_MR1__: u32 = 27; +pub const __ANDROID_API_P__: u32 = 28; +pub const __ANDROID_API_Q__: u32 = 29; +pub const WCHAR_MIN: u8 = 0u8; +pub const INT8_MIN: i32 = -128; +pub const INT8_MAX: u32 = 127; +pub const INT_LEAST8_MIN: i32 = -128; +pub const INT_LEAST8_MAX: u32 = 127; +pub const INT_FAST8_MIN: i32 = -128; +pub const INT_FAST8_MAX: u32 = 127; +pub const UINT8_MAX: u32 = 255; +pub const UINT_LEAST8_MAX: u32 = 255; +pub const UINT_FAST8_MAX: u32 = 255; +pub const INT16_MIN: i32 = -32768; +pub const INT16_MAX: u32 = 32767; +pub const INT_LEAST16_MIN: i32 = -32768; +pub const INT_LEAST16_MAX: u32 = 32767; +pub const UINT16_MAX: u32 = 65535; +pub const UINT_LEAST16_MAX: u32 = 65535; +pub const INT32_MIN: i32 = -2147483648; +pub const INT32_MAX: u32 = 2147483647; +pub const INT_LEAST32_MIN: i32 = -2147483648; +pub const INT_LEAST32_MAX: u32 = 2147483647; +pub const INT_FAST32_MIN: i32 = -2147483648; +pub const INT_FAST32_MAX: u32 = 2147483647; +pub const UINT32_MAX: u32 = 4294967295; +pub const UINT_LEAST32_MAX: u32 = 4294967295; +pub const UINT_FAST32_MAX: u32 = 4294967295; +pub const SIG_ATOMIC_MAX: u32 = 2147483647; +pub const SIG_ATOMIC_MIN: i32 = -2147483648; +pub const WINT_MAX: u32 = 4294967295; +pub const WINT_MIN: u32 = 0; +pub const INTPTR_MIN: i32 = -2147483648; +pub const INTPTR_MAX: u32 = 2147483647; +pub const UINTPTR_MAX: u32 = 4294967295; +pub const PTRDIFF_MIN: i32 = -2147483648; +pub const PTRDIFF_MAX: u32 = 2147483647; +pub const SIZE_MAX: u32 = 4294967295; +pub const __BITS_PER_LONG: u32 = 32; +pub const __FD_SETSIZE: u32 = 1024; +pub const __GNUC_VA_LIST: u32 = 1; +pub const JNI_FALSE: u32 = 0; +pub const JNI_TRUE: u32 = 1; +pub const JNI_VERSION_1_1: u32 = 65537; +pub const JNI_VERSION_1_2: u32 = 65538; +pub const JNI_VERSION_1_4: u32 = 65540; +pub const JNI_VERSION_1_6: u32 = 65542; +pub const JNI_OK: u32 = 0; +pub const JNI_ERR: i32 = -1; +pub const JNI_EDETACHED: i32 = -2; +pub const JNI_EVERSION: i32 = -3; +pub const JNI_ENOMEM: i32 = -4; +pub const JNI_EEXIST: i32 = -5; +pub const JNI_EINVAL: i32 = -6; +pub const JNI_COMMIT: u32 = 1; +pub const JNI_ABORT: u32 = 2; +pub const __PRI_64_prefix: &'static [u8; 3usize] = b"ll\0"; +pub const PRId8: &'static [u8; 2usize] = b"d\0"; +pub const PRId16: &'static [u8; 2usize] = b"d\0"; +pub const PRId32: &'static [u8; 2usize] = b"d\0"; +pub const PRId64: &'static [u8; 4usize] = b"lld\0"; +pub const PRIdLEAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST16: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST64: &'static [u8; 4usize] = b"lld\0"; +pub const PRIdFAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdFAST64: &'static [u8; 4usize] = b"lld\0"; +pub const PRIdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const PRIi8: &'static [u8; 2usize] = b"i\0"; +pub const PRIi16: &'static [u8; 2usize] = b"i\0"; +pub const PRIi32: &'static [u8; 2usize] = b"i\0"; +pub const PRIi64: &'static [u8; 4usize] = b"lli\0"; +pub const PRIiLEAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST16: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST64: &'static [u8; 4usize] = b"lli\0"; +pub const PRIiFAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiFAST64: &'static [u8; 4usize] = b"lli\0"; +pub const PRIiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const PRIo8: &'static [u8; 2usize] = b"o\0"; +pub const PRIo16: &'static [u8; 2usize] = b"o\0"; +pub const PRIo32: &'static [u8; 2usize] = b"o\0"; +pub const PRIo64: &'static [u8; 4usize] = b"llo\0"; +pub const PRIoLEAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST16: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST64: &'static [u8; 4usize] = b"llo\0"; +pub const PRIoFAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoFAST64: &'static [u8; 4usize] = b"llo\0"; +pub const PRIoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const PRIu8: &'static [u8; 2usize] = b"u\0"; +pub const PRIu16: &'static [u8; 2usize] = b"u\0"; +pub const PRIu32: &'static [u8; 2usize] = b"u\0"; +pub const PRIu64: &'static [u8; 4usize] = b"llu\0"; +pub const PRIuLEAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST16: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST64: &'static [u8; 4usize] = b"llu\0"; +pub const PRIuFAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuFAST64: &'static [u8; 4usize] = b"llu\0"; +pub const PRIuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const PRIx8: &'static [u8; 2usize] = b"x\0"; +pub const PRIx16: &'static [u8; 2usize] = b"x\0"; +pub const PRIx32: &'static [u8; 2usize] = b"x\0"; +pub const PRIx64: &'static [u8; 4usize] = b"llx\0"; +pub const PRIxLEAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST16: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST64: &'static [u8; 4usize] = b"llx\0"; +pub const PRIxFAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxFAST64: &'static [u8; 4usize] = b"llx\0"; +pub const PRIxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const PRIX8: &'static [u8; 2usize] = b"X\0"; +pub const PRIX16: &'static [u8; 2usize] = b"X\0"; +pub const PRIX32: &'static [u8; 2usize] = b"X\0"; +pub const PRIX64: &'static [u8; 4usize] = b"llX\0"; +pub const PRIXLEAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST16: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST32: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST64: &'static [u8; 4usize] = b"llX\0"; +pub const PRIXFAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXFAST64: &'static [u8; 4usize] = b"llX\0"; +pub const PRIXMAX: &'static [u8; 3usize] = b"jX\0"; +pub const SCNd8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNd16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNd32: &'static [u8; 2usize] = b"d\0"; +pub const SCNd64: &'static [u8; 4usize] = b"lld\0"; +pub const SCNdLEAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdLEAST16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const SCNdLEAST64: &'static [u8; 4usize] = b"lld\0"; +pub const SCNdFAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdFAST64: &'static [u8; 4usize] = b"lld\0"; +pub const SCNdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const SCNi8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNi16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNi32: &'static [u8; 2usize] = b"i\0"; +pub const SCNi64: &'static [u8; 4usize] = b"lli\0"; +pub const SCNiLEAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiLEAST16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const SCNiLEAST64: &'static [u8; 4usize] = b"lli\0"; +pub const SCNiFAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiFAST64: &'static [u8; 4usize] = b"lli\0"; +pub const SCNiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const SCNo8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNo16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNo32: &'static [u8; 2usize] = b"o\0"; +pub const SCNo64: &'static [u8; 4usize] = b"llo\0"; +pub const SCNoLEAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoLEAST16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const SCNoLEAST64: &'static [u8; 4usize] = b"llo\0"; +pub const SCNoFAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoFAST64: &'static [u8; 4usize] = b"llo\0"; +pub const SCNoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const SCNu8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNu16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNu32: &'static [u8; 2usize] = b"u\0"; +pub const SCNu64: &'static [u8; 4usize] = b"llu\0"; +pub const SCNuLEAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuLEAST16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const SCNuLEAST64: &'static [u8; 4usize] = b"llu\0"; +pub const SCNuFAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuFAST64: &'static [u8; 4usize] = b"llu\0"; +pub const SCNuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const SCNx8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNx16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNx32: &'static [u8; 2usize] = b"x\0"; +pub const SCNx64: &'static [u8; 4usize] = b"llx\0"; +pub const SCNxLEAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxLEAST16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const SCNxLEAST64: &'static [u8; 4usize] = b"llx\0"; +pub const SCNxFAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxFAST64: &'static [u8; 4usize] = b"llx\0"; +pub const SCNxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const true_: u32 = 1; +pub const false_: u32 = 0; +pub const __bool_true_false_are_defined: u32 = 1; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; +pub const _K_SS_MAXSIZE: u32 = 128; +pub const O_DIRECTORY: u32 = 16384; +pub const O_NOFOLLOW: u32 = 32768; +pub const O_DIRECT: u32 = 65536; +pub const O_LARGEFILE: u32 = 131072; +pub const O_ACCMODE: u32 = 3; +pub const O_RDONLY: u32 = 0; +pub const O_WRONLY: u32 = 1; +pub const O_RDWR: u32 = 2; +pub const O_CREAT: u32 = 64; +pub const O_EXCL: u32 = 128; +pub const O_NOCTTY: u32 = 256; +pub const O_TRUNC: u32 = 512; +pub const O_APPEND: u32 = 1024; +pub const O_NONBLOCK: u32 = 2048; +pub const O_DSYNC: u32 = 4096; +pub const FASYNC: u32 = 8192; +pub const O_NOATIME: u32 = 262144; +pub const O_CLOEXEC: u32 = 524288; +pub const __O_SYNC: u32 = 1048576; +pub const O_SYNC: u32 = 1052672; +pub const O_PATH: u32 = 2097152; +pub const __O_TMPFILE: u32 = 4194304; +pub const O_TMPFILE: u32 = 4210688; +pub const O_TMPFILE_MASK: u32 = 4210752; +pub const O_NDELAY: u32 = 2048; +pub const F_DUPFD: u32 = 0; +pub const F_GETFD: u32 = 1; +pub const F_SETFD: u32 = 2; +pub const F_GETFL: u32 = 3; +pub const F_SETFL: u32 = 4; +pub const F_GETLK: u32 = 5; +pub const F_SETLK: u32 = 6; +pub const F_SETLKW: u32 = 7; +pub const F_SETOWN: u32 = 8; +pub const F_GETOWN: u32 = 9; +pub const F_SETSIG: u32 = 10; +pub const F_GETSIG: u32 = 11; +pub const F_GETLK64: u32 = 12; +pub const F_SETLK64: u32 = 13; +pub const F_SETLKW64: u32 = 14; +pub const F_SETOWN_EX: u32 = 15; +pub const F_GETOWN_EX: u32 = 16; +pub const F_GETOWNER_UIDS: u32 = 17; +pub const F_OFD_GETLK: u32 = 36; +pub const F_OFD_SETLK: u32 = 37; +pub const F_OFD_SETLKW: u32 = 38; +pub const F_OWNER_TID: u32 = 0; +pub const F_OWNER_PID: u32 = 1; +pub const F_OWNER_PGRP: u32 = 2; +pub const FD_CLOEXEC: u32 = 1; +pub const F_RDLCK: u32 = 0; +pub const F_WRLCK: u32 = 1; +pub const F_UNLCK: u32 = 2; +pub const F_EXLCK: u32 = 4; +pub const F_SHLCK: u32 = 8; +pub const LOCK_SH: u32 = 1; +pub const LOCK_EX: u32 = 2; +pub const LOCK_NB: u32 = 4; +pub const LOCK_UN: u32 = 8; +pub const LOCK_MAND: u32 = 32; +pub const LOCK_READ: u32 = 64; +pub const LOCK_WRITE: u32 = 128; +pub const LOCK_RW: u32 = 192; +pub const F_LINUX_SPECIFIC_BASE: u32 = 1024; +pub const FIOSETOWN: u32 = 35073; +pub const SIOCSPGRP: u32 = 35074; +pub const FIOGETOWN: u32 = 35075; +pub const SIOCGPGRP: u32 = 35076; +pub const SIOCATMARK: u32 = 35077; +pub const SIOCGSTAMP: u32 = 35078; +pub const SIOCGSTAMPNS: u32 = 35079; +pub const SOL_SOCKET: u32 = 1; +pub const SO_DEBUG: u32 = 1; +pub const SO_REUSEADDR: u32 = 2; +pub const SO_TYPE: u32 = 3; +pub const SO_ERROR: u32 = 4; +pub const SO_DONTROUTE: u32 = 5; +pub const SO_BROADCAST: u32 = 6; +pub const SO_SNDBUF: u32 = 7; +pub const SO_RCVBUF: u32 = 8; +pub const SO_SNDBUFFORCE: u32 = 32; +pub const SO_RCVBUFFORCE: u32 = 33; +pub const SO_KEEPALIVE: u32 = 9; +pub const SO_OOBINLINE: u32 = 10; +pub const SO_NO_CHECK: u32 = 11; +pub const SO_PRIORITY: u32 = 12; +pub const SO_LINGER: u32 = 13; +pub const SO_BSDCOMPAT: u32 = 14; +pub const SO_REUSEPORT: u32 = 15; +pub const SO_PASSCRED: u32 = 16; +pub const SO_PEERCRED: u32 = 17; +pub const SO_RCVLOWAT: u32 = 18; +pub const SO_SNDLOWAT: u32 = 19; +pub const SO_RCVTIMEO: u32 = 20; +pub const SO_SNDTIMEO: u32 = 21; +pub const SO_SECURITY_AUTHENTICATION: u32 = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: u32 = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: u32 = 24; +pub const SO_BINDTODEVICE: u32 = 25; +pub const SO_ATTACH_FILTER: u32 = 26; +pub const SO_DETACH_FILTER: u32 = 27; +pub const SO_GET_FILTER: u32 = 26; +pub const SO_PEERNAME: u32 = 28; +pub const SO_TIMESTAMP: u32 = 29; +pub const SCM_TIMESTAMP: u32 = 29; +pub const SO_ACCEPTCONN: u32 = 30; +pub const SO_PEERSEC: u32 = 31; +pub const SO_PASSSEC: u32 = 34; +pub const SO_TIMESTAMPNS: u32 = 35; +pub const SCM_TIMESTAMPNS: u32 = 35; +pub const SO_MARK: u32 = 36; +pub const SO_TIMESTAMPING: u32 = 37; +pub const SCM_TIMESTAMPING: u32 = 37; +pub const SO_PROTOCOL: u32 = 38; +pub const SO_DOMAIN: u32 = 39; +pub const SO_RXQ_OVFL: u32 = 40; +pub const SO_WIFI_STATUS: u32 = 41; +pub const SCM_WIFI_STATUS: u32 = 41; +pub const SO_PEEK_OFF: u32 = 42; +pub const SO_NOFCS: u32 = 43; +pub const SO_LOCK_FILTER: u32 = 44; +pub const SO_SELECT_ERR_QUEUE: u32 = 45; +pub const SO_BUSY_POLL: u32 = 46; +pub const SO_MAX_PACING_RATE: u32 = 47; +pub const SO_BPF_EXTENSIONS: u32 = 48; +pub const SO_INCOMING_CPU: u32 = 49; +pub const SO_ATTACH_BPF: u32 = 50; +pub const SO_DETACH_BPF: u32 = 27; +pub const SO_ATTACH_REUSEPORT_CBPF: u32 = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: u32 = 52; +pub const SO_CNX_ADVICE: u32 = 53; +pub const SCM_TIMESTAMPING_OPT_STATS: u32 = 54; +pub const SO_MEMINFO: u32 = 55; +pub const SO_INCOMING_NAPI_ID: u32 = 56; +pub const SO_COOKIE: u32 = 57; +pub const SCM_TIMESTAMPING_PKTINFO: u32 = 58; +pub const SO_PEERGROUPS: u32 = 59; +pub const SO_ZEROCOPY: u32 = 60; +pub const SO_TXTIME: u32 = 61; +pub const SCM_TXTIME: u32 = 61; +pub const SOCK_IOC_TYPE: u32 = 137; +pub const SIOCADDRT: u32 = 35083; +pub const SIOCDELRT: u32 = 35084; +pub const SIOCRTMSG: u32 = 35085; +pub const SIOCGIFNAME: u32 = 35088; +pub const SIOCSIFLINK: u32 = 35089; +pub const SIOCGIFCONF: u32 = 35090; +pub const SIOCGIFFLAGS: u32 = 35091; +pub const SIOCSIFFLAGS: u32 = 35092; +pub const SIOCGIFADDR: u32 = 35093; +pub const SIOCSIFADDR: u32 = 35094; +pub const SIOCGIFDSTADDR: u32 = 35095; +pub const SIOCSIFDSTADDR: u32 = 35096; +pub const SIOCGIFBRDADDR: u32 = 35097; +pub const SIOCSIFBRDADDR: u32 = 35098; +pub const SIOCGIFNETMASK: u32 = 35099; +pub const SIOCSIFNETMASK: u32 = 35100; +pub const SIOCGIFMETRIC: u32 = 35101; +pub const SIOCSIFMETRIC: u32 = 35102; +pub const SIOCGIFMEM: u32 = 35103; +pub const SIOCSIFMEM: u32 = 35104; +pub const SIOCGIFMTU: u32 = 35105; +pub const SIOCSIFMTU: u32 = 35106; +pub const SIOCSIFNAME: u32 = 35107; +pub const SIOCSIFHWADDR: u32 = 35108; +pub const SIOCGIFENCAP: u32 = 35109; +pub const SIOCSIFENCAP: u32 = 35110; +pub const SIOCGIFHWADDR: u32 = 35111; +pub const SIOCGIFSLAVE: u32 = 35113; +pub const SIOCSIFSLAVE: u32 = 35120; +pub const SIOCADDMULTI: u32 = 35121; +pub const SIOCDELMULTI: u32 = 35122; +pub const SIOCGIFINDEX: u32 = 35123; +pub const SIOGIFINDEX: u32 = 35123; +pub const SIOCSIFPFLAGS: u32 = 35124; +pub const SIOCGIFPFLAGS: u32 = 35125; +pub const SIOCDIFADDR: u32 = 35126; +pub const SIOCSIFHWBROADCAST: u32 = 35127; +pub const SIOCGIFCOUNT: u32 = 35128; +pub const SIOCGIFBR: u32 = 35136; +pub const SIOCSIFBR: u32 = 35137; +pub const SIOCGIFTXQLEN: u32 = 35138; +pub const SIOCSIFTXQLEN: u32 = 35139; +pub const SIOCETHTOOL: u32 = 35142; +pub const SIOCGMIIPHY: u32 = 35143; +pub const SIOCGMIIREG: u32 = 35144; +pub const SIOCSMIIREG: u32 = 35145; +pub const SIOCWANDEV: u32 = 35146; +pub const SIOCOUTQNSD: u32 = 35147; +pub const SIOCGSKNS: u32 = 35148; +pub const SIOCDARP: u32 = 35155; +pub const SIOCGARP: u32 = 35156; +pub const SIOCSARP: u32 = 35157; +pub const SIOCDRARP: u32 = 35168; +pub const SIOCGRARP: u32 = 35169; +pub const SIOCSRARP: u32 = 35170; +pub const SIOCGIFMAP: u32 = 35184; +pub const SIOCSIFMAP: u32 = 35185; +pub const SIOCADDDLCI: u32 = 35200; +pub const SIOCDELDLCI: u32 = 35201; +pub const SIOCGIFVLAN: u32 = 35202; +pub const SIOCSIFVLAN: u32 = 35203; +pub const SIOCBONDENSLAVE: u32 = 35216; +pub const SIOCBONDRELEASE: u32 = 35217; +pub const SIOCBONDSETHWADDR: u32 = 35218; +pub const SIOCBONDSLAVEINFOQUERY: u32 = 35219; +pub const SIOCBONDINFOQUERY: u32 = 35220; +pub const SIOCBONDCHANGEACTIVE: u32 = 35221; +pub const SIOCBRADDBR: u32 = 35232; +pub const SIOCBRDELBR: u32 = 35233; +pub const SIOCBRADDIF: u32 = 35234; +pub const SIOCBRDELIF: u32 = 35235; +pub const SIOCSHWTSTAMP: u32 = 35248; +pub const SIOCGHWTSTAMP: u32 = 35249; +pub const SIOCDEVPRIVATE: u32 = 35312; +pub const SIOCPROTOPRIVATE: u32 = 35296; +pub const UIO_FASTIOV: u32 = 8; +pub const UIO_MAXIOV: u32 = 1024; +pub const SOCK_STREAM: u32 = 1; +pub const SOCK_DGRAM: u32 = 2; +pub const SOCK_RAW: u32 = 3; +pub const SOCK_RDM: u32 = 4; +pub const SOCK_SEQPACKET: u32 = 5; +pub const SOCK_DCCP: u32 = 6; +pub const SOCK_PACKET: u32 = 10; +pub const SOCK_CLOEXEC: u32 = 524288; +pub const SOCK_NONBLOCK: u32 = 2048; +pub const SCM_RIGHTS: u32 = 1; +pub const SCM_CREDENTIALS: u32 = 2; +pub const SCM_SECURITY: u32 = 3; +pub const AF_UNSPEC: u32 = 0; +pub const AF_UNIX: u32 = 1; +pub const AF_LOCAL: u32 = 1; +pub const AF_INET: u32 = 2; +pub const AF_AX25: u32 = 3; +pub const AF_IPX: u32 = 4; +pub const AF_APPLETALK: u32 = 5; +pub const AF_NETROM: u32 = 6; +pub const AF_BRIDGE: u32 = 7; +pub const AF_ATMPVC: u32 = 8; +pub const AF_X25: u32 = 9; +pub const AF_INET6: u32 = 10; +pub const AF_ROSE: u32 = 11; +pub const AF_DECnet: u32 = 12; +pub const AF_NETBEUI: u32 = 13; +pub const AF_SECURITY: u32 = 14; +pub const AF_KEY: u32 = 15; +pub const AF_NETLINK: u32 = 16; +pub const AF_ROUTE: u32 = 16; +pub const AF_PACKET: u32 = 17; +pub const AF_ASH: u32 = 18; +pub const AF_ECONET: u32 = 19; +pub const AF_ATMSVC: u32 = 20; +pub const AF_RDS: u32 = 21; +pub const AF_SNA: u32 = 22; +pub const AF_IRDA: u32 = 23; +pub const AF_PPPOX: u32 = 24; +pub const AF_WANPIPE: u32 = 25; +pub const AF_LLC: u32 = 26; +pub const AF_CAN: u32 = 29; +pub const AF_TIPC: u32 = 30; +pub const AF_BLUETOOTH: u32 = 31; +pub const AF_IUCV: u32 = 32; +pub const AF_RXRPC: u32 = 33; +pub const AF_ISDN: u32 = 34; +pub const AF_PHONET: u32 = 35; +pub const AF_IEEE802154: u32 = 36; +pub const AF_CAIF: u32 = 37; +pub const AF_ALG: u32 = 38; +pub const AF_NFC: u32 = 39; +pub const AF_VSOCK: u32 = 40; +pub const AF_KCM: u32 = 41; +pub const AF_QIPCRTR: u32 = 42; +pub const AF_MAX: u32 = 43; +pub const PF_UNSPEC: u32 = 0; +pub const PF_UNIX: u32 = 1; +pub const PF_LOCAL: u32 = 1; +pub const PF_INET: u32 = 2; +pub const PF_AX25: u32 = 3; +pub const PF_IPX: u32 = 4; +pub const PF_APPLETALK: u32 = 5; +pub const PF_NETROM: u32 = 6; +pub const PF_BRIDGE: u32 = 7; +pub const PF_ATMPVC: u32 = 8; +pub const PF_X25: u32 = 9; +pub const PF_INET6: u32 = 10; +pub const PF_ROSE: u32 = 11; +pub const PF_DECnet: u32 = 12; +pub const PF_NETBEUI: u32 = 13; +pub const PF_SECURITY: u32 = 14; +pub const PF_KEY: u32 = 15; +pub const PF_NETLINK: u32 = 16; +pub const PF_ROUTE: u32 = 16; +pub const PF_PACKET: u32 = 17; +pub const PF_ASH: u32 = 18; +pub const PF_ECONET: u32 = 19; +pub const PF_ATMSVC: u32 = 20; +pub const PF_RDS: u32 = 21; +pub const PF_SNA: u32 = 22; +pub const PF_IRDA: u32 = 23; +pub const PF_PPPOX: u32 = 24; +pub const PF_WANPIPE: u32 = 25; +pub const PF_LLC: u32 = 26; +pub const PF_CAN: u32 = 29; +pub const PF_TIPC: u32 = 30; +pub const PF_BLUETOOTH: u32 = 31; +pub const PF_IUCV: u32 = 32; +pub const PF_RXRPC: u32 = 33; +pub const PF_ISDN: u32 = 34; +pub const PF_PHONET: u32 = 35; +pub const PF_IEEE802154: u32 = 36; +pub const PF_CAIF: u32 = 37; +pub const PF_ALG: u32 = 38; +pub const PF_NFC: u32 = 39; +pub const PF_VSOCK: u32 = 40; +pub const PF_KCM: u32 = 41; +pub const PF_QIPCRTR: u32 = 42; +pub const PF_MAX: u32 = 43; +pub const SOMAXCONN: u32 = 128; +pub const MSG_OOB: u32 = 1; +pub const MSG_PEEK: u32 = 2; +pub const MSG_DONTROUTE: u32 = 4; +pub const MSG_TRYHARD: u32 = 4; +pub const MSG_CTRUNC: u32 = 8; +pub const MSG_PROBE: u32 = 16; +pub const MSG_TRUNC: u32 = 32; +pub const MSG_DONTWAIT: u32 = 64; +pub const MSG_EOR: u32 = 128; +pub const MSG_WAITALL: u32 = 256; +pub const MSG_FIN: u32 = 512; +pub const MSG_SYN: u32 = 1024; +pub const MSG_CONFIRM: u32 = 2048; +pub const MSG_RST: u32 = 4096; +pub const MSG_ERRQUEUE: u32 = 8192; +pub const MSG_NOSIGNAL: u32 = 16384; +pub const MSG_MORE: u32 = 32768; +pub const MSG_WAITFORONE: u32 = 65536; +pub const MSG_BATCH: u32 = 262144; +pub const MSG_FASTOPEN: u32 = 536870912; +pub const MSG_CMSG_CLOEXEC: u32 = 1073741824; +pub const MSG_EOF: u32 = 512; +pub const MSG_CMSG_COMPAT: u32 = 0; +pub const SOL_IP: u32 = 0; +pub const SOL_TCP: u32 = 6; +pub const SOL_UDP: u32 = 17; +pub const SOL_IPV6: u32 = 41; +pub const SOL_ICMPV6: u32 = 58; +pub const SOL_SCTP: u32 = 132; +pub const SOL_RAW: u32 = 255; +pub const SOL_IPX: u32 = 256; +pub const SOL_AX25: u32 = 257; +pub const SOL_ATALK: u32 = 258; +pub const SOL_NETROM: u32 = 259; +pub const SOL_ROSE: u32 = 260; +pub const SOL_DECNET: u32 = 261; +pub const SOL_X25: u32 = 262; +pub const SOL_PACKET: u32 = 263; +pub const SOL_ATM: u32 = 264; +pub const SOL_AAL: u32 = 265; +pub const SOL_IRDA: u32 = 266; +pub const SOL_NETBEUI: u32 = 267; +pub const SOL_LLC: u32 = 268; +pub const SOL_DCCP: u32 = 269; +pub const SOL_NETLINK: u32 = 270; +pub const SOL_TIPC: u32 = 271; +pub const SOL_RXRPC: u32 = 272; +pub const SOL_PPPOL2TP: u32 = 273; +pub const SOL_BLUETOOTH: u32 = 274; +pub const SOL_PNPIPE: u32 = 275; +pub const SOL_RDS: u32 = 276; +pub const SOL_IUCV: u32 = 277; +pub const SOL_CAIF: u32 = 278; +pub const SOL_ALG: u32 = 279; +pub const SOL_NFC: u32 = 280; +pub const SOL_KCM: u32 = 281; +pub const SOL_TLS: u32 = 282; +pub const IPX_TYPE: u32 = 1; +pub const _PATH_HEQUIV: &'static [u8; 24usize] = b"/system/etc/hosts.equiv\0"; +pub const _PATH_HOSTS: &'static [u8; 18usize] = b"/system/etc/hosts\0"; +pub const _PATH_NETWORKS: &'static [u8; 21usize] = b"/system/etc/networks\0"; +pub const _PATH_PROTOCOLS: &'static [u8; 22usize] = b"/system/etc/protocols\0"; +pub const _PATH_SERVICES: &'static [u8; 21usize] = b"/system/etc/services\0"; +pub const NETDB_INTERNAL: i32 = -1; +pub const NETDB_SUCCESS: u32 = 0; +pub const HOST_NOT_FOUND: u32 = 1; +pub const TRY_AGAIN: u32 = 2; +pub const NO_RECOVERY: u32 = 3; +pub const NO_DATA: u32 = 4; +pub const NO_ADDRESS: u32 = 4; +pub const EAI_ADDRFAMILY: u32 = 1; +pub const EAI_AGAIN: u32 = 2; +pub const EAI_BADFLAGS: u32 = 3; +pub const EAI_FAIL: u32 = 4; +pub const EAI_FAMILY: u32 = 5; +pub const EAI_MEMORY: u32 = 6; +pub const EAI_NODATA: u32 = 7; +pub const EAI_NONAME: u32 = 8; +pub const EAI_SERVICE: u32 = 9; +pub const EAI_SOCKTYPE: u32 = 10; +pub const EAI_SYSTEM: u32 = 11; +pub const EAI_BADHINTS: u32 = 12; +pub const EAI_PROTOCOL: u32 = 13; +pub const EAI_OVERFLOW: u32 = 14; +pub const EAI_MAX: u32 = 15; +pub const AI_PASSIVE: u32 = 1; +pub const AI_CANONNAME: u32 = 2; +pub const AI_NUMERICHOST: u32 = 4; +pub const AI_NUMERICSERV: u32 = 8; +pub const AI_ALL: u32 = 256; +pub const AI_V4MAPPED_CFG: u32 = 512; +pub const AI_ADDRCONFIG: u32 = 1024; +pub const AI_V4MAPPED: u32 = 2048; +pub const AI_DEFAULT: u32 = 1536; +pub const NI_MAXHOST: u32 = 1025; +pub const NI_MAXSERV: u32 = 32; +pub const NI_NOFQDN: u32 = 1; +pub const NI_NUMERICHOST: u32 = 2; +pub const NI_NAMEREQD: u32 = 4; +pub const NI_NUMERICSERV: u32 = 8; +pub const NI_DGRAM: u32 = 16; +pub const SCOPE_DELIMITER: u8 = 37u8; +pub const IPPORT_RESERVED: u32 = 1024; +pub const WNOHANG: u32 = 1; +pub const WUNTRACED: u32 = 2; +pub const WSTOPPED: u32 = 2; +pub const WEXITED: u32 = 4; +pub const WCONTINUED: u32 = 8; +pub const WNOWAIT: u32 = 16777216; +pub const __WNOTHREAD: u32 = 536870912; +pub const __WALL: u32 = 1073741824; +pub const __WCLONE: u32 = 2147483648; +pub const P_ALL: u32 = 0; +pub const P_PID: u32 = 1; +pub const P_PGID: u32 = 2; +pub const SEEK_SET: u32 = 0; +pub const SEEK_CUR: u32 = 1; +pub const SEEK_END: u32 = 2; +pub const _IOFBF: u32 = 0; +pub const _IOLBF: u32 = 1; +pub const _IONBF: u32 = 2; +pub const BUFSIZ: u32 = 1024; +pub const EOF: i32 = -1; +pub const FOPEN_MAX: u32 = 20; +pub const FILENAME_MAX: u32 = 4096; +pub const L_tmpnam: u32 = 4096; +pub const TMP_MAX: u32 = 308915776; +pub const P_tmpdir: &'static [u8; 6usize] = b"/tmp/\0"; +pub const L_ctermid: u32 = 1024; +pub const STRUCT_MALLINFO_DECLARED: u32 = 1; +pub const M_DECAY_TIME: i32 = -100; +pub const M_PURGE: i32 = -101; +pub const EXIT_FAILURE: u32 = 1; +pub const EXIT_SUCCESS: u32 = 0; +pub const RAND_MAX: u32 = 2147483647; +pub const __NDK_MAJOR__: u32 = 20; +pub const __NDK_MINOR__: u32 = 0; +pub const __NDK_BETA__: u32 = 0; +pub const __NDK_BUILD__: u32 = 5594570; +pub const __NDK_CANARY__: u32 = 0; +pub const NR_OPEN: u32 = 1024; +pub const NGROUPS_MAX: u32 = 65536; +pub const ARG_MAX: u32 = 131072; +pub const LINK_MAX: u32 = 127; +pub const MAX_CANON: u32 = 255; +pub const MAX_INPUT: u32 = 255; +pub const NAME_MAX: u32 = 255; +pub const PATH_MAX: u32 = 4096; +pub const PIPE_BUF: u32 = 4096; +pub const XATTR_NAME_MAX: u32 = 255; +pub const XATTR_SIZE_MAX: u32 = 65536; +pub const XATTR_LIST_MAX: u32 = 65536; +pub const RTSIG_MAX: u32 = 32; +pub const PASS_MAX: u32 = 128; +pub const NL_ARGMAX: u32 = 9; +pub const NL_LANGMAX: u32 = 14; +pub const NL_MSGMAX: u32 = 32767; +pub const NL_NMAX: u32 = 1; +pub const NL_SETMAX: u32 = 255; +pub const NL_TEXTMAX: u32 = 255; +pub const CHAR_BIT: u32 = 8; +pub const LONG_BIT: u32 = 32; +pub const WORD_BIT: u32 = 32; +pub const SCHAR_MAX: u32 = 127; +pub const SCHAR_MIN: i32 = -128; +pub const UCHAR_MAX: u32 = 255; +pub const CHAR_MIN: u32 = 0; +pub const CHAR_MAX: u32 = 255; +pub const USHRT_MAX: u32 = 65535; +pub const SHRT_MAX: u32 = 32767; +pub const SHRT_MIN: i32 = -32768; +pub const UINT_MAX: u32 = 4294967295; +pub const INT_MAX: u32 = 2147483647; +pub const INT_MIN: i32 = -2147483648; +pub const ULONG_MAX: u32 = 4294967295; +pub const LONG_MAX: u32 = 2147483647; +pub const LONG_MIN: i32 = -2147483648; +pub const ULLONG_MAX: i32 = -1; +pub const LLONG_MAX: u64 = 9223372036854775807; +pub const LLONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MAX: u64 = 9223372036854775807; +pub const ULONG_LONG_MAX: i32 = -1; +pub const UID_MAX: u32 = 4294967295; +pub const GID_MAX: u32 = 4294967295; +pub const SIZE_T_MAX: u32 = 4294967295; +pub const SSIZE_MAX: u32 = 2147483647; +pub const MB_LEN_MAX: u32 = 4; +pub const NZERO: u32 = 20; +pub const IOV_MAX: u32 = 1024; +pub const SEM_VALUE_MAX: u32 = 1073741823; +pub const _POSIX_VERSION: u32 = 200809; +pub const _POSIX2_VERSION: u32 = 200809; +pub const _XOPEN_VERSION: u32 = 700; +pub const __BIONIC_POSIX_FEATURE_MISSING: i32 = -1; +pub const _POSIX_ASYNCHRONOUS_IO: i32 = -1; +pub const _POSIX_CHOWN_RESTRICTED: u32 = 1; +pub const _POSIX_CPUTIME: u32 = 200809; +pub const _POSIX_FSYNC: u32 = 200809; +pub const _POSIX_IPV6: u32 = 200809; +pub const _POSIX_MAPPED_FILES: u32 = 200809; +pub const _POSIX_MEMLOCK_RANGE: u32 = 200809; +pub const _POSIX_MEMORY_PROTECTION: u32 = 200809; +pub const _POSIX_MESSAGE_PASSING: i32 = -1; +pub const _POSIX_MONOTONIC_CLOCK: u32 = 200809; +pub const _POSIX_NO_TRUNC: u32 = 1; +pub const _POSIX_PRIORITIZED_IO: i32 = -1; +pub const _POSIX_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_RAW_SOCKETS: u32 = 200809; +pub const _POSIX_READER_WRITER_LOCKS: u32 = 200809; +pub const _POSIX_REGEXP: u32 = 1; +pub const _POSIX_SAVED_IDS: u32 = 1; +pub const _POSIX_SEMAPHORES: u32 = 200809; +pub const _POSIX_SHARED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_SHELL: u32 = 1; +pub const _POSIX_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_SYNCHRONIZED_IO: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKADDR: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKSIZE: u32 = 200809; +pub const _POSIX_THREAD_CPUTIME: u32 = 200809; +pub const _POSIX_THREAD_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_THREAD_PROCESS_SHARED: u32 = 200809; +pub const _POSIX_THREAD_ROBUST_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_ROBUST_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_SAFE_FUNCTIONS: u32 = 200809; +pub const _POSIX_THREAD_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_THREADS: u32 = 200809; +pub const _POSIX_TIMERS: u32 = 200809; +pub const _POSIX_TRACE: i32 = -1; +pub const _POSIX_TRACE_EVENT_FILTER: i32 = -1; +pub const _POSIX_TRACE_INHERIT: i32 = -1; +pub const _POSIX_TRACE_LOG: i32 = -1; +pub const _POSIX_TYPED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_VDISABLE: u8 = 0u8; +pub const _POSIX2_C_BIND: u32 = 200809; +pub const _POSIX2_C_DEV: i32 = -1; +pub const _POSIX2_CHAR_TERM: u32 = 200809; +pub const _POSIX2_FORT_DEV: i32 = -1; +pub const _POSIX2_FORT_RUN: i32 = -1; +pub const _POSIX2_LOCALEDEF: i32 = -1; +pub const _POSIX2_SW_DEV: i32 = -1; +pub const _POSIX2_UPE: i32 = -1; +pub const _POSIX_V7_ILP32_OFF32: u32 = 1; +pub const _POSIX_V7_ILP32_OFFBIG: i32 = -1; +pub const _POSIX_V7_LP64_OFF64: i32 = -1; +pub const _POSIX_V7_LPBIG_OFFBIG: i32 = -1; +pub const _XOPEN_CRYPT: i32 = -1; +pub const _XOPEN_ENH_I18N: u32 = 1; +pub const _XOPEN_LEGACY: i32 = -1; +pub const _XOPEN_REALTIME: u32 = 1; +pub const _XOPEN_REALTIME_THREADS: u32 = 1; +pub const _XOPEN_SHM: u32 = 1; +pub const _XOPEN_STREAMS: i32 = -1; +pub const _XOPEN_UNIX: u32 = 1; +pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; +pub const _POSIX_AIO_MAX: u32 = 1; +pub const _POSIX_ARG_MAX: u32 = 4096; +pub const _POSIX_CHILD_MAX: u32 = 25; +pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; +pub const _POSIX_DELAYTIMER_MAX: u32 = 32; +pub const _POSIX_HOST_NAME_MAX: u32 = 255; +pub const _POSIX_LINK_MAX: u32 = 8; +pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; +pub const _POSIX_MAX_CANON: u32 = 255; +pub const _POSIX_MAX_INPUT: u32 = 255; +pub const _POSIX_MQ_OPEN_MAX: u32 = 8; +pub const _POSIX_MQ_PRIO_MAX: u32 = 32; +pub const _POSIX_NAME_MAX: u32 = 14; +pub const _POSIX_NGROUPS_MAX: u32 = 8; +pub const _POSIX_OPEN_MAX: u32 = 20; +pub const _POSIX_PATH_MAX: u32 = 256; +pub const _POSIX_PIPE_BUF: u32 = 512; +pub const _POSIX_RE_DUP_MAX: u32 = 255; +pub const _POSIX_RTSIG_MAX: u32 = 8; +pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; +pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; +pub const _POSIX_SIGQUEUE_MAX: u32 = 32; +pub const _POSIX_SSIZE_MAX: u32 = 32767; +pub const _POSIX_STREAM_MAX: u32 = 8; +pub const _POSIX_SS_REPL_MAX: u32 = 4; +pub const _POSIX_SYMLINK_MAX: u32 = 255; +pub const _POSIX_SYMLOOP_MAX: u32 = 8; +pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; +pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; +pub const _POSIX_TIMER_MAX: u32 = 32; +pub const _POSIX_TRACE_EVENT_NAME_MAX: u32 = 30; +pub const _POSIX_TRACE_NAME_MAX: u32 = 8; +pub const _POSIX_TRACE_SYS_MAX: u32 = 8; +pub const _POSIX_TRACE_USER_EVENT_MAX: u32 = 32; +pub const _POSIX_TTY_NAME_MAX: u32 = 9; +pub const _POSIX_TZNAME_MAX: u32 = 6; +pub const _POSIX2_BC_BASE_MAX: u32 = 99; +pub const _POSIX2_BC_DIM_MAX: u32 = 2048; +pub const _POSIX2_BC_SCALE_MAX: u32 = 99; +pub const _POSIX2_BC_STRING_MAX: u32 = 1000; +pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; +pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; +pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; +pub const _POSIX2_LINE_MAX: u32 = 2048; +pub const _POSIX2_RE_DUP_MAX: u32 = 255; +pub const _XOPEN_IOV_MAX: u32 = 16; +pub const _XOPEN_NAME_MAX: u32 = 255; +pub const _XOPEN_PATH_MAX: u32 = 1024; +pub const HOST_NAME_MAX: u32 = 255; +pub const LOGIN_NAME_MAX: u32 = 256; +pub const TTY_NAME_MAX: u32 = 32; +pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const PTHREAD_KEYS_MAX: u32 = 128; +pub const FP_INFINITE: u32 = 1; +pub const FP_NAN: u32 = 2; +pub const FP_NORMAL: u32 = 4; +pub const FP_SUBNORMAL: u32 = 8; +pub const FP_ZERO: u32 = 16; +pub const FP_ILOGB0: i32 = -2147483647; +pub const FP_ILOGBNAN: u32 = 2147483647; +pub const MATH_ERRNO: u32 = 1; +pub const MATH_ERREXCEPT: u32 = 2; +pub const math_errhandling: u32 = 2; +pub const M_E: f64 = 2.718281828459045; +pub const M_LOG2E: f64 = 1.4426950408889634; +pub const M_LOG10E: f64 = 0.4342944819032518; +pub const M_LN2: f64 = 0.6931471805599453; +pub const M_LN10: f64 = 2.302585092994046; +pub const M_PI: f64 = 3.141592653589793; +pub const M_PI_2: f64 = 1.5707963267948966; +pub const M_PI_4: f64 = 0.7853981633974483; +pub const M_1_PI: f64 = 0.3183098861837907; +pub const M_2_PI: f64 = 0.6366197723675814; +pub const M_2_SQRTPI: f64 = 1.1283791670955126; +pub const M_SQRT2: f64 = 1.4142135623730951; +pub const M_SQRT1_2: f64 = 0.7071067811865476; +pub const ASENSOR_FIFO_COUNT_INVALID: i32 = -1; +pub const ASENSOR_DELAY_INVALID: i32 = -2147483648; +pub const ASENSOR_INVALID: i32 = -1; +pub const ASENSOR_STANDARD_GRAVITY: f64 = 9.80665; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MAX: f64 = 60.0; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MIN: f64 = 30.0; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const SYNC_IOC_MAGIC: u8 = 62u8; +extern "C" { + pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_get_device_api_level() -> ::std::os::raw::c_int; +} +pub type wchar_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __clang_max_align_nonce2: f64, +} +#[test] +fn bindgen_test_layout_max_align_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_longlong; +pub type __uint64_t = ::std::os::raw::c_ulonglong; +pub type __intptr_t = ::std::os::raw::c_int; +pub type __uintptr_t = ::std::os::raw::c_uint; +pub type int_least8_t = i8; +pub type uint_least8_t = u8; +pub type int_least16_t = i16; +pub type uint_least16_t = u16; +pub type int_least32_t = i32; +pub type uint_least32_t = u32; +pub type int_least64_t = i64; +pub type uint_least64_t = u64; +pub type int_fast8_t = i8; +pub type uint_fast8_t = u8; +pub type int_fast64_t = i64; +pub type uint_fast64_t = u64; +pub type int_fast16_t = i32; +pub type uint_fast16_t = u32; +pub type int_fast32_t = i32; +pub type uint_fast32_t = u32; +pub type uintmax_t = u64; +pub type intmax_t = i64; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 32usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_mode_t = ::std::os::raw::c_ushort; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_ushort; +pub type __kernel_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_uid_t = __kernel_uid_t; +pub type __kernel_old_gid_t = __kernel_gid_t; +pub type __kernel_size_t = ::std::os::raw::c_uint; +pub type __kernel_ssize_t = ::std::os::raw::c_int; +pub type __kernel_ptrdiff_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_attr_t { + pub flags: u32, + pub stack_base: *mut ::std::os::raw::c_void, + pub stack_size: usize, + pub guard_size: usize, + pub sched_policy: i32, + pub sched_priority: i32, +} +#[test] +fn bindgen_test_layout_pthread_attr_t() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(pthread_attr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_attr_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(guard_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_priority) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_barrier_t { + pub __private: [i32; 8usize], +} +#[test] +fn bindgen_test_layout_pthread_barrier_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrier_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_barrierattr_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_cond_t { + pub __private: [i32; 1usize], +} +#[test] +fn bindgen_test_layout_pthread_cond_t() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_cond_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_cond_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_condattr_t = ::std::os::raw::c_long; +pub type pthread_key_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_mutex_t { + pub __private: [i32; 1usize], +} +#[test] +fn bindgen_test_layout_pthread_mutex_t() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_mutexattr_t = ::std::os::raw::c_long; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_rwlock_t { + pub __private: [i32; 10usize], +} +#[test] +fn bindgen_test_layout_pthread_rwlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_rwlockattr_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_spinlock_t { + pub __private: [i32; 2usize], +} +#[test] +fn bindgen_test_layout_pthread_spinlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_spinlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_t = ::std::os::raw::c_long; +pub type __gid_t = __kernel_gid32_t; +pub type gid_t = __gid_t; +pub type __uid_t = __kernel_uid32_t; +pub type uid_t = __uid_t; +pub type __pid_t = __kernel_pid_t; +pub type pid_t = __pid_t; +pub type __id_t = u32; +pub type id_t = __id_t; +pub type blkcnt_t = ::std::os::raw::c_ulong; +pub type blksize_t = ::std::os::raw::c_ulong; +pub type caddr_t = __kernel_caddr_t; +pub type clock_t = __kernel_clock_t; +pub type __clockid_t = __kernel_clockid_t; +pub type clockid_t = __clockid_t; +pub type daddr_t = __kernel_daddr_t; +pub type fsblkcnt_t = ::std::os::raw::c_ulong; +pub type fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __mode_t = __kernel_mode_t; +pub type mode_t = __mode_t; +pub type __key_t = __kernel_key_t; +pub type key_t = __key_t; +pub type __ino_t = __kernel_ino_t; +pub type ino_t = __ino_t; +pub type ino64_t = u64; +pub type __nlink_t = u32; +pub type nlink_t = __nlink_t; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type timer_t = __timer_t; +pub type __suseconds_t = __kernel_suseconds_t; +pub type suseconds_t = __suseconds_t; +pub type __useconds_t = u32; +pub type useconds_t = __useconds_t; +pub type dev_t = u32; +pub type __time_t = __kernel_time_t; +pub type time_t = __time_t; +pub type off_t = __kernel_off_t; +pub type loff_t = __kernel_loff_t; +pub type off64_t = loff_t; +pub type __socklen_t = i32; +pub type socklen_t = __socklen_t; +pub type uint_t = ::std::os::raw::c_uint; +pub type uint = ::std::os::raw::c_uint; +pub type u_char = ::std::os::raw::c_uchar; +pub type u_short = ::std::os::raw::c_ushort; +pub type u_int = ::std::os::raw::c_uint; +pub type u_long = ::std::os::raw::c_ulong; +pub type u_int32_t = u32; +pub type u_int16_t = u16; +pub type u_int8_t = u8; +pub type u_int64_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetDir { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAsset { + _unused: [u8; 0], +} +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; +pub type _bindgen_ty_1 = u32; +extern "C" { + pub fn AAssetManager_openDir( + mgr: *mut AAssetManager, + dirName: *const ::std::os::raw::c_char, + ) -> *mut AAssetDir; +} +extern "C" { + pub fn AAssetManager_open( + mgr: *mut AAssetManager, + filename: *const ::std::os::raw::c_char, + mode: ::std::os::raw::c_int, + ) -> *mut AAsset; +} +extern "C" { + pub fn AAssetDir_getNextFileName(assetDir: *mut AAssetDir) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AAssetDir_rewind(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAssetDir_close(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAsset_read( + asset: *mut AAsset, + buf: *mut ::std::os::raw::c_void, + count: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_seek(asset: *mut AAsset, offset: off_t, whence: ::std::os::raw::c_int) -> off_t; +} +extern "C" { + pub fn AAsset_seek64( + asset: *mut AAsset, + offset: off64_t, + whence: ::std::os::raw::c_int, + ) -> off64_t; +} +extern "C" { + pub fn AAsset_close(asset: *mut AAsset); +} +extern "C" { + pub fn AAsset_getBuffer(asset: *mut AAsset) -> *const ::std::os::raw::c_void; +} +extern "C" { + pub fn AAsset_getLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_getRemainingLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getRemainingLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_openFileDescriptor( + asset: *mut AAsset, + outStart: *mut off_t, + outLength: *mut off_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_openFileDescriptor64( + asset: *mut AAsset, + outStart: *mut off64_t, + outLength: *mut off64_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_isAllocated(asset: *mut AAsset) -> ::std::os::raw::c_int; +} +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type jboolean = u8; +pub type jbyte = i8; +pub type jchar = u16; +pub type jshort = i16; +pub type jint = i32; +pub type jlong = i64; +pub type jfloat = f32; +pub type jdouble = f64; +pub type jsize = jint; +pub type jobject = *mut ::std::os::raw::c_void; +pub type jclass = jobject; +pub type jstring = jobject; +pub type jarray = jobject; +pub type jobjectArray = jarray; +pub type jbooleanArray = jarray; +pub type jbyteArray = jarray; +pub type jcharArray = jarray; +pub type jshortArray = jarray; +pub type jintArray = jarray; +pub type jlongArray = jarray; +pub type jfloatArray = jarray; +pub type jdoubleArray = jarray; +pub type jthrowable = jobject; +pub type jweak = jobject; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jfieldID { + _unused: [u8; 0], +} +pub type jfieldID = *mut _jfieldID; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jmethodID { + _unused: [u8; 0], +} +pub type jmethodID = *mut _jmethodID; +#[repr(C)] +#[derive(Copy, Clone)] +pub union jvalue { + pub z: jboolean, + pub b: jbyte, + pub c: jchar, + pub s: jshort, + pub i: jint, + pub j: jlong, + pub f: jfloat, + pub d: jdouble, + pub l: jobject, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_jvalue() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(jvalue)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(jvalue)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).z as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(z)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(b)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(c)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(s)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(i)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).j as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(j)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(f)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(d)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(l)) + ); +} +pub const jobjectRefType_JNIInvalidRefType: jobjectRefType = 0; +pub const jobjectRefType_JNILocalRefType: jobjectRefType = 1; +pub const jobjectRefType_JNIGlobalRefType: jobjectRefType = 2; +pub const jobjectRefType_JNIWeakGlobalRefType: jobjectRefType = 3; +pub type jobjectRefType = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeMethod { + pub name: *const ::std::os::raw::c_char, + pub signature: *const ::std::os::raw::c_char, + pub fnPtr: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JNINativeMethod() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(JNINativeMethod)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JNINativeMethod)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).signature as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fnPtr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(fnPtr) + ) + ); +} +pub type C_JNIEnv = *const JNINativeInterface; +pub type JNIEnv = *const JNINativeInterface; +pub type JavaVM = *const JNIInvokeInterface; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub reserved3: *mut ::std::os::raw::c_void, + pub GetVersion: ::std::option::Option jint>, + pub DefineClass: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *const ::std::os::raw::c_char, + arg3: jobject, + arg4: *const jbyte, + arg5: jsize, + ) -> jclass, + >, + pub FindClass: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jclass, + >, + pub FromReflectedMethod: + ::std::option::Option jmethodID>, + pub FromReflectedField: + ::std::option::Option jfieldID>, + pub ToReflectedMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: jboolean, + ) -> jobject, + >, + pub GetSuperclass: + ::std::option::Option jclass>, + pub IsAssignableFrom: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jclass) -> jboolean, + >, + pub ToReflectedField: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jfieldID, + arg4: jboolean, + ) -> jobject, + >, + pub Throw: + ::std::option::Option jint>, + pub ThrowNew: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + ) -> jint, + >, + pub ExceptionOccurred: + ::std::option::Option jthrowable>, + pub ExceptionDescribe: ::std::option::Option, + pub ExceptionClear: ::std::option::Option, + pub FatalError: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char), + >, + pub PushLocalFrame: + ::std::option::Option jint>, + pub PopLocalFrame: + ::std::option::Option jobject>, + pub NewGlobalRef: + ::std::option::Option jobject>, + pub DeleteGlobalRef: + ::std::option::Option, + pub DeleteLocalRef: + ::std::option::Option, + pub IsSameObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jobject) -> jboolean, + >, + pub NewLocalRef: + ::std::option::Option jobject>, + pub EnsureLocalCapacity: + ::std::option::Option jint>, + pub AllocObject: + ::std::option::Option jobject>, + pub NewObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub NewObjectV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub NewObjectA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub GetObjectClass: + ::std::option::Option jclass>, + pub IsInstanceOf: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass) -> jboolean, + >, + pub GetMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jobject, + >, + pub CallObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub CallObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jboolean, + >, + pub CallBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jboolean, + >, + pub CallBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jbyte, + >, + pub CallByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jbyte, + >, + pub CallByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jchar, + >, + pub CallCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jchar, + >, + pub CallCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jshort, + >, + pub CallShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jshort, + >, + pub CallShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jint, + >, + pub CallIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jint, + >, + pub CallIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jlong, + >, + pub CallLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jlong, + >, + pub CallLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jfloat, + >, + pub CallFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jfloat, + >, + pub CallFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jdouble, + >, + pub CallDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jdouble, + >, + pub CallDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...), + >, + pub CallVoidMethodV: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, arg4: va_list), + >, + pub CallVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ), + >, + pub CallNonvirtualObjectMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jobject, + >, + pub CallNonvirtualObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jobject, + >, + pub CallNonvirtualObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jobject, + >, + pub CallNonvirtualBooleanMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jboolean, + >, + pub CallNonvirtualByteMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jbyte, + >, + pub CallNonvirtualByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jbyte, + >, + pub CallNonvirtualByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jbyte, + >, + pub CallNonvirtualCharMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jchar, + >, + pub CallNonvirtualCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jchar, + >, + pub CallNonvirtualCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jchar, + >, + pub CallNonvirtualShortMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jshort, + >, + pub CallNonvirtualShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jshort, + >, + pub CallNonvirtualShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jshort, + >, + pub CallNonvirtualIntMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jint, + >, + pub CallNonvirtualIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jint, + >, + pub CallNonvirtualIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jint, + >, + pub CallNonvirtualLongMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jlong, + >, + pub CallNonvirtualLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jlong, + >, + pub CallNonvirtualLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jlong, + >, + pub CallNonvirtualFloatMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jfloat, + >, + pub CallNonvirtualDoubleMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jdouble, + >, + pub CallNonvirtualVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass, arg4: jmethodID, ...), + >, + pub CallNonvirtualVoidMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ), + >, + pub CallNonvirtualVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ), + >, + pub GetFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jobject, + >, + pub GetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jboolean, + >, + pub GetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jbyte, + >, + pub GetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jchar, + >, + pub GetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jshort, + >, + pub GetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jint, + >, + pub GetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jlong, + >, + pub GetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jfloat, + >, + pub GetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jdouble, + >, + pub SetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jobject), + >, + pub SetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jboolean), + >, + pub SetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jbyte), + >, + pub SetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jchar), + >, + pub SetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jshort), + >, + pub SetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jint), + >, + pub SetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jlong), + >, + pub SetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jfloat), + >, + pub SetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jdouble), + >, + pub GetStaticMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallStaticObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub CallStaticObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub CallStaticObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallStaticBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jboolean, + >, + pub CallStaticBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jboolean, + >, + pub CallStaticBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallStaticByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jbyte, + >, + pub CallStaticByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jbyte, + >, + pub CallStaticByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallStaticCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jchar, + >, + pub CallStaticCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jchar, + >, + pub CallStaticCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallStaticShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jshort, + >, + pub CallStaticShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jshort, + >, + pub CallStaticShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallStaticIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jint, + >, + pub CallStaticIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jint, + >, + pub CallStaticIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallStaticLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jlong, + >, + pub CallStaticLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jlong, + >, + pub CallStaticLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallStaticFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jfloat, + >, + pub CallStaticFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jfloat, + >, + pub CallStaticFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallStaticDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jdouble, + >, + pub CallStaticDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jdouble, + >, + pub CallStaticDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallStaticVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...), + >, + pub CallStaticVoidMethodV: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: va_list), + >, + pub CallStaticVoidMethodA: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: *const jvalue), + >, + pub GetStaticFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jobject, + >, + pub GetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jboolean, + >, + pub GetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jbyte, + >, + pub GetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jchar, + >, + pub GetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jshort, + >, + pub GetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jint, + >, + pub GetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jlong, + >, + pub GetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jfloat, + >, + pub GetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jdouble, + >, + pub SetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jobject), + >, + pub SetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jboolean), + >, + pub SetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jbyte), + >, + pub SetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jchar), + >, + pub SetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jshort), + >, + pub SetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jint), + >, + pub SetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jlong), + >, + pub SetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jfloat), + >, + pub SetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jdouble), + >, + pub NewString: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const jchar, arg3: jsize) -> jstring, + >, + pub GetStringLength: + ::std::option::Option jsize>, + pub GetStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewStringUTF: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jstring, + >, + pub GetStringUTFLength: + ::std::option::Option jsize>, + pub GetStringUTFChars: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: *mut jboolean, + ) -> *const ::std::os::raw::c_char, + >, + pub ReleaseStringUTFChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const ::std::os::raw::c_char), + >, + pub GetArrayLength: + ::std::option::Option jsize>, + pub NewObjectArray: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jsize, + arg3: jclass, + arg4: jobject, + ) -> jobjectArray, + >, + pub GetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize) -> jobject, + >, + pub SetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize, arg4: jobject), + >, + pub NewBooleanArray: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jsize) -> jbooleanArray, + >, + pub NewByteArray: + ::std::option::Option jbyteArray>, + pub NewCharArray: + ::std::option::Option jcharArray>, + pub NewShortArray: + ::std::option::Option jshortArray>, + pub NewIntArray: + ::std::option::Option jintArray>, + pub NewLongArray: + ::std::option::Option jlongArray>, + pub NewFloatArray: + ::std::option::Option jfloatArray>, + pub NewDoubleArray: + ::std::option::Option jdoubleArray>, + pub GetBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + ) -> *mut jboolean, + >, + pub GetByteArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: *mut jboolean, + ) -> *mut jbyte, + >, + pub GetCharArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: *mut jboolean, + ) -> *mut jchar, + >, + pub GetShortArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: *mut jboolean, + ) -> *mut jshort, + >, + pub GetIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jboolean) -> *mut jint, + >, + pub GetLongArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: *mut jboolean, + ) -> *mut jlong, + >, + pub GetFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: *mut jboolean, + ) -> *mut jfloat, + >, + pub GetDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: *mut jboolean, + ) -> *mut jdouble, + >, + pub ReleaseBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + arg4: jint, + ), + >, + pub ReleaseByteArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jbyteArray, arg3: *mut jbyte, arg4: jint), + >, + pub ReleaseCharArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jcharArray, arg3: *mut jchar, arg4: jint), + >, + pub ReleaseShortArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jshortArray, arg3: *mut jshort, arg4: jint), + >, + pub ReleaseIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jint, arg4: jint), + >, + pub ReleaseLongArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jlongArray, arg3: *mut jlong, arg4: jint), + >, + pub ReleaseFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jfloatArray, arg3: *mut jfloat, arg4: jint), + >, + pub ReleaseDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jdoubleArray, arg3: *mut jdouble, arg4: jint), + >, + pub GetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jboolean, + ), + >, + pub GetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jbyte, + ), + >, + pub GetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jshort, + ), + >, + pub GetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jint, + ), + >, + pub GetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jlong, + ), + >, + pub GetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jfloat, + ), + >, + pub GetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jdouble, + ), + >, + pub SetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *const jboolean, + ), + >, + pub SetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *const jbyte, + ), + >, + pub SetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *const jchar, + ), + >, + pub SetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *const jshort, + ), + >, + pub SetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *const jint, + ), + >, + pub SetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *const jlong, + ), + >, + pub SetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *const jfloat, + ), + >, + pub SetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *const jdouble, + ), + >, + pub RegisterNatives: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const JNINativeMethod, + arg4: jint, + ) -> jint, + >, + pub UnregisterNatives: + ::std::option::Option jint>, + pub MonitorEnter: + ::std::option::Option jint>, + pub MonitorExit: + ::std::option::Option jint>, + pub GetJavaVM: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *mut *mut JavaVM) -> jint, + >, + pub GetStringRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetStringUTFRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut ::std::os::raw::c_char, + ), + >, + pub GetPrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut jboolean, + ) -> *mut ::std::os::raw::c_void, + >, + pub ReleasePrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut ::std::os::raw::c_void, + arg4: jint, + ), + >, + pub GetStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewWeakGlobalRef: + ::std::option::Option jweak>, + pub DeleteWeakGlobalRef: + ::std::option::Option, + pub ExceptionCheck: ::std::option::Option jboolean>, + pub NewDirectByteBuffer: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *mut ::std::os::raw::c_void, + arg3: jlong, + ) -> jobject, + >, + pub GetDirectBufferAddress: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> *mut ::std::os::raw::c_void, + >, + pub GetDirectBufferCapacity: + ::std::option::Option jlong>, + pub GetObjectRefType: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> jobjectRefType, + >, +} +#[test] +fn bindgen_test_layout_JNINativeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 932usize, + concat!("Size of: ", stringify!(JNINativeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JNINativeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved3 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetVersion as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).DefineClass as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DefineClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FindClass as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FindClass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedMethod as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedField as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedMethod as *const _ as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetSuperclass as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetSuperclass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).IsAssignableFrom as *const _ as usize + }, + 44usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsAssignableFrom) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedField as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).Throw as *const _ as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(Throw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ThrowNew as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ThrowNew) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionOccurred as *const _ as usize + }, + 60usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionOccurred) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionDescribe as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionDescribe) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionClear as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionClear) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FatalError as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FatalError) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PushLocalFrame as *const _ as usize + }, + 76usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PushLocalFrame) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PopLocalFrame as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PopLocalFrame) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewGlobalRef as *const _ as usize }, + 84usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteGlobalRef as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteLocalRef as *const _ as usize + }, + 92usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteLocalRef) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsSameObject as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsSameObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLocalRef as *const _ as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLocalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).EnsureLocalCapacity as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(EnsureLocalCapacity) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).AllocObject as *const _ as usize }, + 108usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(AllocObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObject as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectV as *const _ as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectV) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectA as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectClass as *const _ as usize + }, + 124usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsInstanceOf as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsInstanceOf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetMethodID as *const _ as usize }, + 132usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethod as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodV as *const _ as usize + }, + 140usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodA as *const _ as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethod as *const _ as usize + }, + 148usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodV as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodA as *const _ as usize + }, + 156usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethod as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodV as *const _ as usize + }, + 164usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodA as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethod as *const _ as usize + }, + 172usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodV as *const _ as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodA as *const _ as usize + }, + 180usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethod as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodV as *const _ as usize + }, + 188usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodA as *const _ as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethod as *const _ as usize + }, + 196usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodV as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodA as *const _ as usize + }, + 204usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethod as *const _ as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodV as *const _ as usize + }, + 212usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodA as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethod as *const _ as usize + }, + 220usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodV as *const _ as usize + }, + 224usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodA as *const _ as usize + }, + 228usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethod as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodV as *const _ as usize + }, + 236usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodA as *const _ as usize + }, + 240usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethod as *const _ as usize + }, + 244usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodV as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodA as *const _ as usize + }, + 252usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethod as *const _ + as usize + }, + 256usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodV as *const _ + as usize + }, + 260usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodA as *const _ + as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethod as *const _ + as usize + }, + 268usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodV as *const _ + as usize + }, + 272usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodA as *const _ + as usize + }, + 276usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethod as *const _ + as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodV as *const _ + as usize + }, + 284usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodA as *const _ + as usize + }, + 288usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethod as *const _ + as usize + }, + 292usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodV as *const _ + as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodA as *const _ + as usize + }, + 300usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethod as *const _ + as usize + }, + 304usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodV as *const _ + as usize + }, + 308usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodA as *const _ + as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethod as *const _ + as usize + }, + 316usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodV as *const _ + as usize + }, + 320usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodA as *const _ + as usize + }, + 324usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethod as *const _ + as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodV as *const _ + as usize + }, + 332usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodA as *const _ + as usize + }, + 336usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethod as *const _ + as usize + }, + 340usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodV as *const _ + as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodA as *const _ + as usize + }, + 348usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethod as *const _ + as usize + }, + 352usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodV as *const _ + as usize + }, + 356usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodA as *const _ + as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethod as *const _ + as usize + }, + 364usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodV as *const _ + as usize + }, + 368usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodA as *const _ + as usize + }, + 372usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodA) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetFieldID as *const _ as usize }, + 376usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectField as *const _ as usize + }, + 380usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanField as *const _ as usize + }, + 384usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetByteField as *const _ as usize }, + 388usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetCharField as *const _ as usize }, + 392usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortField as *const _ as usize + }, + 396usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetIntField as *const _ as usize }, + 400usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetLongField as *const _ as usize }, + 404usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatField as *const _ as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleField as *const _ as usize + }, + 412usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectField as *const _ as usize + }, + 416usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanField as *const _ as usize + }, + 420usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetByteField as *const _ as usize }, + 424usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetCharField as *const _ as usize }, + 428usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortField as *const _ as usize + }, + 432usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetIntField as *const _ as usize }, + 436usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetLongField as *const _ as usize }, + 440usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatField as *const _ as usize + }, + 444usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleField as *const _ as usize + }, + 448usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticMethodID as *const _ as usize + }, + 452usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethod as *const _ + as usize + }, + 456usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodV as *const _ + as usize + }, + 460usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodA as *const _ + as usize + }, + 464usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethod as *const _ + as usize + }, + 468usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodV as *const _ + as usize + }, + 472usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodA as *const _ + as usize + }, + 476usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethod as *const _ as usize + }, + 480usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodV as *const _ + as usize + }, + 484usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodA as *const _ + as usize + }, + 488usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethod as *const _ as usize + }, + 492usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodV as *const _ + as usize + }, + 496usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodA as *const _ + as usize + }, + 500usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethod as *const _ + as usize + }, + 504usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodV as *const _ + as usize + }, + 508usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodA as *const _ + as usize + }, + 512usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethod as *const _ as usize + }, + 516usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodV as *const _ as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodA as *const _ as usize + }, + 524usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethod as *const _ as usize + }, + 528usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodV as *const _ + as usize + }, + 532usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodA as *const _ + as usize + }, + 536usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethod as *const _ + as usize + }, + 540usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodV as *const _ + as usize + }, + 544usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodA as *const _ + as usize + }, + 548usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethod as *const _ + as usize + }, + 552usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodV as *const _ + as usize + }, + 556usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodA as *const _ + as usize + }, + 560usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethod as *const _ as usize + }, + 564usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodV as *const _ + as usize + }, + 568usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodA as *const _ + as usize + }, + 572usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFieldID as *const _ as usize + }, + 576usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticObjectField as *const _ as usize + }, + 580usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticBooleanField as *const _ + as usize + }, + 584usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticByteField as *const _ as usize + }, + 588usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticCharField as *const _ as usize + }, + 592usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticShortField as *const _ as usize + }, + 596usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticIntField as *const _ as usize + }, + 600usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticLongField as *const _ as usize + }, + 604usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFloatField as *const _ as usize + }, + 608usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticDoubleField as *const _ as usize + }, + 612usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticObjectField as *const _ as usize + }, + 616usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticBooleanField as *const _ + as usize + }, + 620usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticByteField as *const _ as usize + }, + 624usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticCharField as *const _ as usize + }, + 628usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticShortField as *const _ as usize + }, + 632usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticIntField as *const _ as usize + }, + 636usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticLongField as *const _ as usize + }, + 640usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticFloatField as *const _ as usize + }, + 644usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticDoubleField as *const _ as usize + }, + 648usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewString as *const _ as usize }, + 652usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewString) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringLength as *const _ as usize + }, + 656usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringChars as *const _ as usize + }, + 660usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringChars as *const _ as usize + }, + 664usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringChars) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewStringUTF as *const _ as usize }, + 668usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewStringUTF) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFLength as *const _ as usize + }, + 672usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFChars as *const _ as usize + }, + 676usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringUTFChars as *const _ + as usize + }, + 680usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetArrayLength as *const _ as usize + }, + 684usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetArrayLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewObjectArray as *const _ as usize + }, + 688usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectArrayElement as *const _ + as usize + }, + 692usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectArrayElement as *const _ + as usize + }, + 696usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewBooleanArray as *const _ as usize + }, + 700usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewBooleanArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewByteArray as *const _ as usize }, + 704usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewByteArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewCharArray as *const _ as usize }, + 708usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewCharArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewShortArray as *const _ as usize + }, + 712usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewShortArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewIntArray as *const _ as usize }, + 716usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewIntArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLongArray as *const _ as usize }, + 720usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLongArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewFloatArray as *const _ as usize + }, + 724usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewFloatArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDoubleArray as *const _ as usize + }, + 728usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDoubleArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayElements as *const _ + as usize + }, + 732usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayElements as *const _ as usize + }, + 736usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayElements as *const _ as usize + }, + 740usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayElements as *const _ + as usize + }, + 744usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayElements as *const _ as usize + }, + 748usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayElements as *const _ as usize + }, + 752usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayElements as *const _ + as usize + }, + 756usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayElements as *const _ + as usize + }, + 760usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseBooleanArrayElements as *const _ + as usize + }, + 764usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseByteArrayElements as *const _ + as usize + }, + 768usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseCharArrayElements as *const _ + as usize + }, + 772usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseShortArrayElements as *const _ + as usize + }, + 776usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseIntArrayElements as *const _ + as usize + }, + 780usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseLongArrayElements as *const _ + as usize + }, + 784usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseFloatArrayElements as *const _ + as usize + }, + 788usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseDoubleArrayElements as *const _ + as usize + }, + 792usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayRegion as *const _ + as usize + }, + 796usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayRegion as *const _ as usize + }, + 800usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayRegion as *const _ as usize + }, + 804usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayRegion as *const _ as usize + }, + 808usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayRegion as *const _ as usize + }, + 812usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayRegion as *const _ as usize + }, + 816usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayRegion as *const _ as usize + }, + 820usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayRegion as *const _ as usize + }, + 824usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanArrayRegion as *const _ + as usize + }, + 828usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetByteArrayRegion as *const _ as usize + }, + 832usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetCharArrayRegion as *const _ as usize + }, + 836usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortArrayRegion as *const _ as usize + }, + 840usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetIntArrayRegion as *const _ as usize + }, + 844usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetLongArrayRegion as *const _ as usize + }, + 848usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatArrayRegion as *const _ as usize + }, + 852usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleArrayRegion as *const _ as usize + }, + 856usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).RegisterNatives as *const _ as usize + }, + 860usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(RegisterNatives) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).UnregisterNatives as *const _ as usize + }, + 864usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(UnregisterNatives) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorEnter as *const _ as usize }, + 868usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorEnter) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorExit as *const _ as usize }, + 872usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorExit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetJavaVM as *const _ as usize }, + 876usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringRegion as *const _ as usize + }, + 880usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFRegion as *const _ as usize + }, + 884usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetPrimitiveArrayCritical as *const _ + as usize + }, + 888usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetPrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleasePrimitiveArrayCritical as *const _ + as usize + }, + 892usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleasePrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringCritical as *const _ as usize + }, + 896usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringCritical as *const _ + as usize + }, + 900usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewWeakGlobalRef as *const _ as usize + }, + 904usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteWeakGlobalRef as *const _ as usize + }, + 908usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionCheck as *const _ as usize + }, + 912usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionCheck) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDirectByteBuffer as *const _ as usize + }, + 916usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDirectByteBuffer) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferAddress as *const _ + as usize + }, + 920usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferAddress) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferCapacity as *const _ + as usize + }, + 924usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferCapacity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectRefType as *const _ as usize + }, + 928usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectRefType) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JNIEnv { + pub functions: *const JNINativeInterface, +} +#[test] +fn bindgen_test_layout__JNIEnv() { + assert_eq!( + ::std::mem::size_of::<_JNIEnv>(), + 4usize, + concat!("Size of: ", stringify!(_JNIEnv)) + ); + assert_eq!( + ::std::mem::align_of::<_JNIEnv>(), + 4usize, + concat!("Alignment of ", stringify!(_JNIEnv)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JNIEnv>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JNIEnv), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNIInvokeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub DestroyJavaVM: ::std::option::Option jint>, + pub AttachCurrentThread: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, + pub DetachCurrentThread: ::std::option::Option jint>, + pub GetEnv: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut ::std::os::raw::c_void, + arg3: jint, + ) -> jint, + >, + pub AttachCurrentThreadAsDaemon: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, +} +#[test] +fn bindgen_test_layout_JNIInvokeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DestroyJavaVM as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DestroyJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThread as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThread) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DetachCurrentThread as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DetachCurrentThread) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetEnv as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(GetEnv) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThreadAsDaemon as *const _ + as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThreadAsDaemon) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JavaVM { + pub functions: *const JNIInvokeInterface, +} +#[test] +fn bindgen_test_layout__JavaVM() { + assert_eq!( + ::std::mem::size_of::<_JavaVM>(), + 4usize, + concat!("Size of: ", stringify!(_JavaVM)) + ); + assert_eq!( + ::std::mem::align_of::<_JavaVM>(), + 4usize, + concat!("Alignment of ", stringify!(_JavaVM)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JavaVM>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JavaVM), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(group) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(JavaVMOption)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JavaVMOption)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(optionString) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(extraInfo) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(nOptions) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(options) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(ignoreUnrecognized) + ) + ); +} +extern "C" { + pub fn JNI_GetDefaultJavaVMInitArgs(arg1: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_CreateJavaVM( + arg1: *mut *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint; +} +extern "C" { + pub fn JNI_GetCreatedJavaVMs(arg1: *mut *mut JavaVM, arg2: jsize, arg3: *mut jsize) -> jint; +} +extern "C" { + pub fn JNI_OnLoad(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_OnUnload(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn AAssetManager_fromJava(env: *mut JNIEnv, assetManager: jobject) -> *mut AAssetManager; +} +pub const ANDROID_BITMAP_RESULT_SUCCESS: _bindgen_ty_2 = 0; +pub const ANDROID_BITMAP_RESULT_BAD_PARAMETER: _bindgen_ty_2 = -1; +pub const ANDROID_BITMAP_RESULT_JNI_EXCEPTION: _bindgen_ty_2 = -2; +pub const ANDROID_BITMAP_RESULT_ALLOCATION_FAILED: _bindgen_ty_2 = -3; +pub type _bindgen_ty_2 = i32; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_NONE: AndroidBitmapFormat = 0; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_8888: AndroidBitmapFormat = 1; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGB_565: AndroidBitmapFormat = 4; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_4444: AndroidBitmapFormat = 7; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_A_8: AndroidBitmapFormat = 8; +pub type AndroidBitmapFormat = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AndroidBitmapInfo { + pub width: u32, + pub height: u32, + pub stride: u32, + pub format: i32, + pub flags: u32, +} +#[test] +fn bindgen_test_layout_AndroidBitmapInfo() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + pub fn AndroidBitmap_getInfo( + env: *mut JNIEnv, + jbitmap: jobject, + info: *mut AndroidBitmapInfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_lockPixels( + env: *mut JNIEnv, + jbitmap: jobject, + addrPtr: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_unlockPixels(env: *mut JNIEnv, jbitmap: jobject) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AChoreographer { + _unused: [u8; 0], +} +pub type AChoreographer_frameCallback = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: ::std::os::raw::c_long, data: *mut ::std::os::raw::c_void), +>; +pub type AChoreographer_frameCallback64 = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: i64, data: *mut ::std::os::raw::c_void), +>; +extern "C" { + pub fn AChoreographer_getInstance() -> *mut AChoreographer; +} +extern "C" { + pub fn AChoreographer_postFrameCallback( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + delayMillis: ::std::os::raw::c_long, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallback64( + chroreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed64( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + delayMillis: u32, + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AConfiguration { + _unused: [u8; 0], +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_3 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_3 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_3 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_3 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_3 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_3 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_3 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_3 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_3 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_3 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_3 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_3 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_3 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_3 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_3 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_3 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_3 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_3 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_3 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_3 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_3 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_3 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_3 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_3 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_3 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_3 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_3 = 65535; +pub type _bindgen_ty_3 = u32; +extern "C" { + pub fn AConfiguration_new() -> *mut AConfiguration; +} +extern "C" { + pub fn AConfiguration_delete(config: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_fromAssetManager(out: *mut AConfiguration, am: *mut AAssetManager); +} +extern "C" { + pub fn AConfiguration_copy(dest: *mut AConfiguration, src: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_getMcc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMcc(config: *mut AConfiguration, mcc: i32); +} +extern "C" { + pub fn AConfiguration_getMnc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMnc(config: *mut AConfiguration, mnc: i32); +} +extern "C" { + pub fn AConfiguration_getLanguage( + config: *mut AConfiguration, + outLanguage: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setLanguage( + config: *mut AConfiguration, + language: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getCountry( + config: *mut AConfiguration, + outCountry: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setCountry( + config: *mut AConfiguration, + country: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getOrientation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setOrientation(config: *mut AConfiguration, orientation: i32); +} +extern "C" { + pub fn AConfiguration_getTouchscreen(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setTouchscreen(config: *mut AConfiguration, touchscreen: i32); +} +extern "C" { + pub fn AConfiguration_getDensity(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setDensity(config: *mut AConfiguration, density: i32); +} +extern "C" { + pub fn AConfiguration_getKeyboard(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeyboard(config: *mut AConfiguration, keyboard: i32); +} +extern "C" { + pub fn AConfiguration_getNavigation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavigation(config: *mut AConfiguration, navigation: i32); +} +extern "C" { + pub fn AConfiguration_getKeysHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeysHidden(config: *mut AConfiguration, keysHidden: i32); +} +extern "C" { + pub fn AConfiguration_getNavHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavHidden(config: *mut AConfiguration, navHidden: i32); +} +extern "C" { + pub fn AConfiguration_getSdkVersion(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSdkVersion(config: *mut AConfiguration, sdkVersion: i32); +} +extern "C" { + pub fn AConfiguration_getScreenSize(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenSize(config: *mut AConfiguration, screenSize: i32); +} +extern "C" { + pub fn AConfiguration_getScreenLong(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenLong(config: *mut AConfiguration, screenLong: i32); +} +extern "C" { + pub fn AConfiguration_getScreenRound(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenRound(config: *mut AConfiguration, screenRound: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeType(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeType(config: *mut AConfiguration, uiModeType: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeNight(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeNight(config: *mut AConfiguration, uiModeNight: i32); +} +extern "C" { + pub fn AConfiguration_getScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getScreenHeightDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenHeightDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getSmallestScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSmallestScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getLayoutDirection(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setLayoutDirection(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_diff(config1: *mut AConfiguration, config2: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_match(base: *mut AConfiguration, requested: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_isBetterThan( + base: *mut AConfiguration, + test: *mut AConfiguration, + requested: *mut AConfiguration, + ) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct imaxdiv_t { + pub quot: intmax_t, + pub rem: intmax_t, +} +#[test] +fn bindgen_test_layout_imaxdiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(imaxdiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(imaxdiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn imaxabs(__i: intmax_t) -> intmax_t; +} +extern "C" { + pub fn imaxdiv(__numerator: intmax_t, __denominator: intmax_t) -> imaxdiv_t; +} +extern "C" { + pub fn strtoimax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn strtoumax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +extern "C" { + pub fn wcstoimax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn wcstoumax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; +pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; +pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; +pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; +pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub type ADataSpace = u32; +pub const ANDROID_DLEXT_RESERVED_ADDRESS: _bindgen_ty_4 = 1; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_HINT: _bindgen_ty_4 = 2; +pub const ANDROID_DLEXT_WRITE_RELRO: _bindgen_ty_4 = 4; +pub const ANDROID_DLEXT_USE_RELRO: _bindgen_ty_4 = 8; +pub const ANDROID_DLEXT_USE_LIBRARY_FD: _bindgen_ty_4 = 16; +pub const ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET: _bindgen_ty_4 = 32; +pub const ANDROID_DLEXT_FORCE_LOAD: _bindgen_ty_4 = 64; +pub const ANDROID_DLEXT_USE_NAMESPACE: _bindgen_ty_4 = 512; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE: _bindgen_ty_4 = 1024; +pub const ANDROID_DLEXT_VALID_FLAG_BITS: _bindgen_ty_4 = 1663; +pub type _bindgen_ty_4 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_namespace_t { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_dlextinfo { + pub flags: u64, + pub reserved_addr: *mut ::std::os::raw::c_void, + pub reserved_size: usize, + pub relro_fd: ::std::os::raw::c_int, + pub library_fd: ::std::os::raw::c_int, + pub library_fd_offset: off64_t, + pub library_namespace: *mut android_namespace_t, + pub __bindgen_padding_0: u32, +} +#[test] +fn bindgen_test_layout_android_dlextinfo() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(android_dlextinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(android_dlextinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_size as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).relro_fd as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(relro_fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).library_fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_fd_offset as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_namespace as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_namespace) + ) + ); +} +extern "C" { + pub fn android_dlopen_ext( + __filename: *const ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + __info: *const android_dlextinfo, + ) -> *mut ::std::os::raw::c_void; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ARect { + pub left: i32, + pub top: i32, + pub right: i32, + pub bottom: i32, +} +#[test] +fn bindgen_test_layout_ARect() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ARect)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ARect)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(left) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(top) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(right) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(bottom) + ) + ); +} +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: AHardwareBuffer_Format = 4; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: AHardwareBuffer_Format = + 22; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: AHardwareBuffer_Format = + 43; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_BLOB: AHardwareBuffer_Format = 33; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D16_UNORM: AHardwareBuffer_Format = 48; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM: AHardwareBuffer_Format = 49; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT: AHardwareBuffer_Format = + 50; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT: AHardwareBuffer_Format = 51; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHardwareBuffer_Format = + 52; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub type AHardwareBuffer_Format = u32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_RARELY: + AHardwareBuffer_UsageFlags = 2; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN: + AHardwareBuffer_UsageFlags = 3; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_MASK: + AHardwareBuffer_UsageFlags = 15; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY: + AHardwareBuffer_UsageFlags = 32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN: + AHardwareBuffer_UsageFlags = 48; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK: + AHardwareBuffer_UsageFlags = 240; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE: + AHardwareBuffer_UsageFlags = 256; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY: + AHardwareBuffer_UsageFlags = 2048; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT: + AHardwareBuffer_UsageFlags = 16384; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VIDEO_ENCODE: + AHardwareBuffer_UsageFlags = 65536; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA: + AHardwareBuffer_UsageFlags = 8388608; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER: + AHardwareBuffer_UsageFlags = 16777216; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: + AHardwareBuffer_UsageFlags = 33554432; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: + AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = + 268435456; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = + 536870912; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_2: AHardwareBuffer_UsageFlags = + 1073741824; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_3: AHardwareBuffer_UsageFlags = + 2147483648; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_4: AHardwareBuffer_UsageFlags = + 281474976710656; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_5: AHardwareBuffer_UsageFlags = + 562949953421312; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_6: AHardwareBuffer_UsageFlags = + 1125899906842624; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_7: AHardwareBuffer_UsageFlags = + 2251799813685248; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_8: AHardwareBuffer_UsageFlags = + 4503599627370496; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_9: AHardwareBuffer_UsageFlags = + 9007199254740992; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_10: AHardwareBuffer_UsageFlags = + 18014398509481984; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_11: AHardwareBuffer_UsageFlags = + 36028797018963968; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_12: AHardwareBuffer_UsageFlags = + 72057594037927936; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_13: AHardwareBuffer_UsageFlags = + 144115188075855872; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_14: AHardwareBuffer_UsageFlags = + 288230376151711744; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_15: AHardwareBuffer_UsageFlags = + 576460752303423488; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_16: AHardwareBuffer_UsageFlags = + 1152921504606846976; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_17: AHardwareBuffer_UsageFlags = + 2305843009213693952; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_18: AHardwareBuffer_UsageFlags = + 4611686018427387904; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_19: AHardwareBuffer_UsageFlags = + 9223372036854775808; +pub type AHardwareBuffer_UsageFlags = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Desc { + pub width: u32, + pub height: u32, + pub layers: u32, + pub format: u32, + pub usage: u64, + pub stride: u32, + pub rfu0: u32, + pub rfu1: u64, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Desc() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(layers) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(usage) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Plane { + pub data: *mut ::std::os::raw::c_void, + pub pixelStride: u32, + pub rowStride: u32, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Plane() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pixelStride as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(pixelStride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(rowStride) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Planes { + pub planeCount: u32, + pub planes: [AHardwareBuffer_Plane; 4usize], +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Planes() { + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).planeCount as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planeCount) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planes) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer { + _unused: [u8; 0], +} +extern "C" { + pub fn AHardwareBuffer_allocate( + desc: *const AHardwareBuffer_Desc, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_acquire(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_release(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_describe( + buffer: *const AHardwareBuffer, + outDesc: *mut AHardwareBuffer_Desc, + ); +} +extern "C" { + pub fn AHardwareBuffer_lock( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_unlock( + buffer: *mut AHardwareBuffer, + fence: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_sendHandleToUnixSocket( + buffer: *const AHardwareBuffer, + socketFd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_recvHandleFromUnixSocket( + socketFd: ::std::os::raw::c_int, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockAndGetInfo( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + outBytesPerPixel: *mut i32, + outBytesPerStride: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_fromHardwareBuffer( + env: *mut JNIEnv, + hardwareBufferObj: jobject, + ) -> *mut AHardwareBuffer; +} +extern "C" { + pub fn AHardwareBuffer_toHardwareBuffer( + env: *mut JNIEnv, + hardwareBuffer: *mut AHardwareBuffer, + ) -> jobject; +} +pub const AKEYCODE_UNKNOWN: _bindgen_ty_5 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_5 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_5 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_5 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_5 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_5 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_5 = 6; +pub const AKEYCODE_0: _bindgen_ty_5 = 7; +pub const AKEYCODE_1: _bindgen_ty_5 = 8; +pub const AKEYCODE_2: _bindgen_ty_5 = 9; +pub const AKEYCODE_3: _bindgen_ty_5 = 10; +pub const AKEYCODE_4: _bindgen_ty_5 = 11; +pub const AKEYCODE_5: _bindgen_ty_5 = 12; +pub const AKEYCODE_6: _bindgen_ty_5 = 13; +pub const AKEYCODE_7: _bindgen_ty_5 = 14; +pub const AKEYCODE_8: _bindgen_ty_5 = 15; +pub const AKEYCODE_9: _bindgen_ty_5 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_5 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_5 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_5 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_5 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_5 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_5 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_5 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_5 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_5 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_5 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_5 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_5 = 28; +pub const AKEYCODE_A: _bindgen_ty_5 = 29; +pub const AKEYCODE_B: _bindgen_ty_5 = 30; +pub const AKEYCODE_C: _bindgen_ty_5 = 31; +pub const AKEYCODE_D: _bindgen_ty_5 = 32; +pub const AKEYCODE_E: _bindgen_ty_5 = 33; +pub const AKEYCODE_F: _bindgen_ty_5 = 34; +pub const AKEYCODE_G: _bindgen_ty_5 = 35; +pub const AKEYCODE_H: _bindgen_ty_5 = 36; +pub const AKEYCODE_I: _bindgen_ty_5 = 37; +pub const AKEYCODE_J: _bindgen_ty_5 = 38; +pub const AKEYCODE_K: _bindgen_ty_5 = 39; +pub const AKEYCODE_L: _bindgen_ty_5 = 40; +pub const AKEYCODE_M: _bindgen_ty_5 = 41; +pub const AKEYCODE_N: _bindgen_ty_5 = 42; +pub const AKEYCODE_O: _bindgen_ty_5 = 43; +pub const AKEYCODE_P: _bindgen_ty_5 = 44; +pub const AKEYCODE_Q: _bindgen_ty_5 = 45; +pub const AKEYCODE_R: _bindgen_ty_5 = 46; +pub const AKEYCODE_S: _bindgen_ty_5 = 47; +pub const AKEYCODE_T: _bindgen_ty_5 = 48; +pub const AKEYCODE_U: _bindgen_ty_5 = 49; +pub const AKEYCODE_V: _bindgen_ty_5 = 50; +pub const AKEYCODE_W: _bindgen_ty_5 = 51; +pub const AKEYCODE_X: _bindgen_ty_5 = 52; +pub const AKEYCODE_Y: _bindgen_ty_5 = 53; +pub const AKEYCODE_Z: _bindgen_ty_5 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_5 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_5 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_5 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_5 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_5 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_5 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_5 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_5 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_5 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_5 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_5 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_5 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_5 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_5 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_5 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_5 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_5 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_5 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_5 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_5 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_5 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_5 = 76; +pub const AKEYCODE_AT: _bindgen_ty_5 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_5 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_5 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_5 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_5 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_5 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_5 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_5 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_5 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_5 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_5 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_5 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_5 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_5 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_5 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_5 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_5 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_5 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_5 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_5 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_5 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_5 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_5 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_5 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_5 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_5 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_5 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_5 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_5 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_5 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_5 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_5 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_5 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_5 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_5 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_5 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_5 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_5 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_5 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_5 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_5 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_5 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_5 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_5 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_5 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_5 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_5 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_5 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_5 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_5 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_5 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_5 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_5 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_5 = 130; +pub const AKEYCODE_F1: _bindgen_ty_5 = 131; +pub const AKEYCODE_F2: _bindgen_ty_5 = 132; +pub const AKEYCODE_F3: _bindgen_ty_5 = 133; +pub const AKEYCODE_F4: _bindgen_ty_5 = 134; +pub const AKEYCODE_F5: _bindgen_ty_5 = 135; +pub const AKEYCODE_F6: _bindgen_ty_5 = 136; +pub const AKEYCODE_F7: _bindgen_ty_5 = 137; +pub const AKEYCODE_F8: _bindgen_ty_5 = 138; +pub const AKEYCODE_F9: _bindgen_ty_5 = 139; +pub const AKEYCODE_F10: _bindgen_ty_5 = 140; +pub const AKEYCODE_F11: _bindgen_ty_5 = 141; +pub const AKEYCODE_F12: _bindgen_ty_5 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_5 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_5 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_5 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_5 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_5 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_5 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_5 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_5 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_5 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_5 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_5 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_5 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_5 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_5 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_5 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_5 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_5 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_5 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_5 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_5 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_5 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_5 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_5 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_5 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_5 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_5 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_5 = 169; +pub const AKEYCODE_TV: _bindgen_ty_5 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_5 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_5 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_5 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_5 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_5 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_5 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_5 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_5 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_5 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_5 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_5 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_5 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_5 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_5 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_5 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_5 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_5 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_5 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_5 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_5 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_5 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_5 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_5 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_5 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_5 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_5 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_5 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_5 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_5 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_5 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_5 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_5 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_5 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_5 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_5 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_5 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_5 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_5 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_5 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_5 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_5 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_5 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_5 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_5 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_5 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_5 = 216; +pub const AKEYCODE_RO: _bindgen_ty_5 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_5 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_5 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_5 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_5 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_5 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_5 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_5 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_5 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_5 = 226; +pub const AKEYCODE_11: _bindgen_ty_5 = 227; +pub const AKEYCODE_12: _bindgen_ty_5 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_5 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_5 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_5 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_5 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_5 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_5 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_5 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_5 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_5 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_5 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_5 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_5 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_5 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_5 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_5 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_5 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_5 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_5 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_5 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_5 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_5 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_5 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_5 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_5 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_5 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_5 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_5 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_5 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_5 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_5 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_5 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_5 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_5 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_5 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_5 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_5 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_5 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_5 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_5 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_5 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_5 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_5 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_5 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_5 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_5 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_5 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_5 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_5 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_5 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_5 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_5 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_5 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_5 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_5 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_5 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_5 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_5 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_5 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_5 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_5 = 288; +pub type _bindgen_ty_5 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ALooper { + _unused: [u8; 0], +} +extern "C" { + pub fn ALooper_forThread() -> *mut ALooper; +} +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_6 = 1; +pub type _bindgen_ty_6 = u32; +extern "C" { + pub fn ALooper_prepare(opts: ::std::os::raw::c_int) -> *mut ALooper; +} +pub const ALOOPER_POLL_WAKE: _bindgen_ty_7 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_7 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_7 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_7 = -4; +pub type _bindgen_ty_7 = i32; +extern "C" { + pub fn ALooper_acquire(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_release(looper: *mut ALooper); +} +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_8 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_8 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_8 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_8 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_8 = 16; +pub type _bindgen_ty_8 = u32; +pub type ALooper_callbackFunc = ::std::option::Option< + unsafe extern "C" fn( + fd: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn ALooper_pollOnce( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_pollAll( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_wake(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_addFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ident: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_removeFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_9 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_9 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_9 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_9 = 2; +pub type _bindgen_ty_9 = i32; +pub const AMETA_NONE: _bindgen_ty_10 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_10 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_10 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_10 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_10 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_10 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_10 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_10 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_10 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_10 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_10 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_10 = 16384; +pub const AMETA_META_ON: _bindgen_ty_10 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_10 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_10 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_10 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_10 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_10 = 4194304; +pub type _bindgen_ty_10 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputEvent { + _unused: [u8; 0], +} +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_11 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_11 = 2; +pub type _bindgen_ty_11 = u32; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_12 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_12 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_12 = 2; +pub type _bindgen_ty_12 = u32; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_13 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_13 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_13 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_13 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_13 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_13 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_13 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_13 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_13 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_13 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_13 = 1024; +pub type _bindgen_ty_13 = u32; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_14 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_14 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_14 = 12; +pub type _bindgen_ty_14 = u32; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_15 = 1; +pub type _bindgen_ty_15 = u32; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_16 = 8; +pub type _bindgen_ty_16 = u32; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_17 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_17 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_17 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_17 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_17 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_17 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_17 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_17 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_17 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_17 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_17 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_17 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_17 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_17 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_17 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_17 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_17 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_17 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_17 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_17 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_17 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_17 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_17 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_17 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_17 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_17 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_17 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_17 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_17 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_17 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_17 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_17 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_17 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_17 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_17 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_17 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_17 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_17 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_17 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_17 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_17 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_17 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_17 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_17 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_17 = 47; +pub type _bindgen_ty_17 = u32; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_18 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_18 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_18 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_18 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_18 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_18 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_18 = 64; +pub type _bindgen_ty_18 = u32; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_19 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_19 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_19 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_19 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_19 = 4; +pub type _bindgen_ty_19 = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_20 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_20 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_20 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_20 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_20 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_20 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_20 = 16; +pub type _bindgen_ty_20 = u32; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_21 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_21 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_21 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_21 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_21 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_21 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_21 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_21 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_21 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_21 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_21 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_21 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_21 = 16777232; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_21 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_21 = 4294967040; +pub type _bindgen_ty_21 = u32; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_22 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_22 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_22 = 2; +pub type _bindgen_ty_22 = u32; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_23 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_23 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_23 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_23 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_23 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_23 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_23 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_23 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_23 = 8; +pub type _bindgen_ty_23 = u32; +extern "C" { + pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getDeviceId(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getFlags(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getKeyCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getScanCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getMetaState(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getRepeatCount(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getDownTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getMetaState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getButtonState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getEdgeFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getDownTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getEventTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getXOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getXPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; +} +extern "C" { + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; +} +extern "C" { + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getHistoricalEventTime( + motion_event: *const AInputEvent, + history_index: usize, + ) -> i64; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalPressure( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalSize( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputQueue { + _unused: [u8; 0], +} +extern "C" { + pub fn AInputQueue_attachLooper( + queue: *mut AInputQueue, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AInputQueue_detachLooper(queue: *mut AInputQueue); +} +extern "C" { + pub fn AInputQueue_hasEvents(queue: *mut AInputQueue) -> i32; +} +extern "C" { + pub fn AInputQueue_getEvent(queue: *mut AInputQueue, outEvent: *mut *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_preDispatchEvent(queue: *mut AInputQueue, event: *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_finishEvent( + queue: *mut AInputQueue, + event: *mut AInputEvent, + handled: ::std::os::raw::c_int, + ); +} +pub const android_LogPriority_ANDROID_LOG_UNKNOWN: android_LogPriority = 0; +pub const android_LogPriority_ANDROID_LOG_DEFAULT: android_LogPriority = 1; +pub const android_LogPriority_ANDROID_LOG_VERBOSE: android_LogPriority = 2; +pub const android_LogPriority_ANDROID_LOG_DEBUG: android_LogPriority = 3; +pub const android_LogPriority_ANDROID_LOG_INFO: android_LogPriority = 4; +pub const android_LogPriority_ANDROID_LOG_WARN: android_LogPriority = 5; +pub const android_LogPriority_ANDROID_LOG_ERROR: android_LogPriority = 6; +pub const android_LogPriority_ANDROID_LOG_FATAL: android_LogPriority = 7; +pub const android_LogPriority_ANDROID_LOG_SILENT: android_LogPriority = 8; +pub type android_LogPriority = u32; +extern "C" { + pub fn __android_log_write( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_print( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_vprint( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ap: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_assert( + cond: *const ::std::os::raw::c_char, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ); +} +pub const log_id_LOG_ID_MIN: log_id = 0; +pub const log_id_LOG_ID_MAIN: log_id = 0; +pub const log_id_LOG_ID_RADIO: log_id = 1; +pub const log_id_LOG_ID_EVENTS: log_id = 2; +pub const log_id_LOG_ID_SYSTEM: log_id = 3; +pub const log_id_LOG_ID_CRASH: log_id = 4; +pub const log_id_LOG_ID_STATS: log_id = 5; +pub const log_id_LOG_ID_SECURITY: log_id = 6; +pub const log_id_LOG_ID_KERNEL: log_id = 7; +pub const log_id_LOG_ID_MAX: log_id = 8; +pub type log_id = u32; +pub use self::log_id as log_id_t; +extern "C" { + pub fn __android_log_buf_write( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_buf_print( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +pub type __kernel_sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[repr(align(4))] +#[derive(Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: __kernel_sa_family_t, + pub __data: [::std::os::raw::c_char; 126usize], +} +#[test] +fn bindgen_test_layout_sockaddr_storage() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(sockaddr_storage)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sockaddr_storage)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ss_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(ss_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(__data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct f_owner_ex { + pub type_: ::std::os::raw::c_int, + pub pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_f_owner_ex() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(f_owner_ex)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(f_owner_ex)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_off_t, + pub l_len: __kernel_off_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(flock)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(flock)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock64 { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub __bindgen_padding_0: u32, + pub l_start: __kernel_loff_t, + pub l_len: __kernel_loff_t, + pub l_pid: __kernel_pid_t, + pub __bindgen_padding_1: u32, +} +#[test] +fn bindgen_test_layout_flock64() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(flock64)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(flock64)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: __kernel_size_t, +} +#[test] +fn bindgen_test_layout_iovec() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(iovec)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(iovec)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_len as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_len) + ) + ); +} +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + _unused: [u8; 0], +} +pub const SHUT_RD: _bindgen_ty_24 = 0; +pub const SHUT_WR: _bindgen_ty_24 = 1; +pub const SHUT_RDWR: _bindgen_ty_24 = 2; +pub type _bindgen_ty_24 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[test] +fn bindgen_test_layout_sockaddr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sockaddr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(sockaddr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_linger() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(linger)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(linger)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_onoff as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_onoff) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_linger as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_linger) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_msghdr() { + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(msghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(msghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_namelen as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_namelen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iov as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iov) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iovlen as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iovlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_control as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_controllen as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_controllen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mmsghdr { + pub msg_hdr: msghdr, + pub msg_len: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_mmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(mmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(mmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_hdr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_hdr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_len as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_cmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(cmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_level) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_type as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_type) + ) + ); +} +extern "C" { + pub fn __cmsg_nxthdr(__msg: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ucred { + pub pid: pid_t, + pub uid: uid_t, + pub gid: gid_t, +} +#[test] +fn bindgen_test_layout_ucred() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ucred)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ucred)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(pid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(uid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gid as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(gid) + ) + ); +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept4( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *mut ::std::os::raw::c_void, + __value_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen( + __fd: ::std::os::raw::c_int, + __backlog: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *mut mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + __timeout: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __msg: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *const mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __msg: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *const ::std::os::raw::c_void, + __value_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socket( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __dst_addr: *const sockaddr, + __dst_addr_length: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __src_addr: *mut sockaddr, + __src_addr_length: *mut socklen_t, + ) -> isize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct hostent { + pub h_name: *mut ::std::os::raw::c_char, + pub h_aliases: *mut *mut ::std::os::raw::c_char, + pub h_addrtype: ::std::os::raw::c_int, + pub h_length: ::std::os::raw::c_int, + pub h_addr_list: *mut *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_hostent() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(hostent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(hostent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addrtype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_length as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_length) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addr_list as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addr_list) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct netent { + pub n_name: *mut ::std::os::raw::c_char, + pub n_aliases: *mut *mut ::std::os::raw::c_char, + pub n_addrtype: ::std::os::raw::c_int, + pub n_net: u32, +} +#[test] +fn bindgen_test_layout_netent() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(netent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(netent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_addrtype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_net as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_net) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct servent { + pub s_name: *mut ::std::os::raw::c_char, + pub s_aliases: *mut *mut ::std::os::raw::c_char, + pub s_port: ::std::os::raw::c_int, + pub s_proto: *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_servent() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(servent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(servent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_port as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_port) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_proto as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct protoent { + pub p_name: *mut ::std::os::raw::c_char, + pub p_aliases: *mut *mut ::std::os::raw::c_char, + pub p_proto: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_protoent() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(protoent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(protoent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_proto as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct addrinfo { + pub ai_flags: ::std::os::raw::c_int, + pub ai_family: ::std::os::raw::c_int, + pub ai_socktype: ::std::os::raw::c_int, + pub ai_protocol: ::std::os::raw::c_int, + pub ai_addrlen: socklen_t, + pub ai_canonname: *mut ::std::os::raw::c_char, + pub ai_addr: *mut sockaddr, + pub ai_next: *mut addrinfo, +} +#[test] +fn bindgen_test_layout_addrinfo() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(addrinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(addrinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_family as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_socktype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_socktype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_protocol as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_protocol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addrlen as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addrlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_canonname as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_canonname) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addr as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_next as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_next) + ) + ); +} +extern "C" { + pub fn getaddrinfo( + __node: *const ::std::os::raw::c_char, + __service: *const ::std::os::raw::c_char, + __hints: *const addrinfo, + __result: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn freeaddrinfo(__ptr: *mut addrinfo); +} +extern "C" { + pub fn getnameinfo( + __sa: *const sockaddr, + __sa_length: socklen_t, + __host: *mut ::std::os::raw::c_char, + __host_length: usize, + __service: *mut ::std::os::raw::c_char, + __service_length: usize, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gai_strerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn __get_h_errno() -> *mut ::std::os::raw::c_int; +} +extern "C" { + pub fn herror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn hstrerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn gethostbyaddr( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyaddr_r( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname(__name: *const ::std::os::raw::c_char) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname_r( + __name: *const ::std::os::raw::c_char, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname2( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname2_r( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn endhostent(); +} +extern "C" { + pub fn gethostent() -> *mut hostent; +} +extern "C" { + pub fn sethostent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endnetent(); +} +extern "C" { + pub fn getnetbyaddr(__net: u32, __type: ::std::os::raw::c_int) -> *mut netent; +} +extern "C" { + pub fn getnetbyname(__name: *const ::std::os::raw::c_char) -> *mut netent; +} +extern "C" { + pub fn getnetent() -> *mut netent; +} +extern "C" { + pub fn setnetent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endprotoent(); +} +extern "C" { + pub fn getprotobyname(__name: *const ::std::os::raw::c_char) -> *mut protoent; +} +extern "C" { + pub fn getprotobynumber(__proto: ::std::os::raw::c_int) -> *mut protoent; +} +extern "C" { + pub fn getprotoent() -> *mut protoent; +} +extern "C" { + pub fn setprotoent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endservent(); +} +extern "C" { + pub fn getservbyname( + __name: *const ::std::os::raw::c_char, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservbyport( + __port_in_network_order: ::std::os::raw::c_int, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservent() -> *mut servent; +} +extern "C" { + pub fn setservent(__stay_open: ::std::os::raw::c_int); +} +pub type fpos_t = off_t; +pub type fpos64_t = off64_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sFILE { + _unused: [u8; 0], +} +pub type FILE = __sFILE; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn clearerr(__fp: *mut FILE); +} +extern "C" { + pub fn fclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn feof(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __buf: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_uint, + __count: ::std::os::raw::c_uint, + __fp: *mut FILE, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn fscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fwrite( + __buf: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_uint, + __count: ::std::os::raw::c_uint, + __fp: *mut FILE, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn getc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getdelim( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __delimiter: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn getline( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn perror(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn printf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn remove(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rewind(__fp: *mut FILE); +} +extern "C" { + pub fn scanf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuf(__fp: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __mode: ::std::os::raw::c_int, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __fp: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __args: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpnam(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __prefix: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn rename( + __old_path: *const ::std::os::raw::c_char, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __old_dir_fd: ::std::os::raw::c_int, + __old_path: *const ::std::os::raw::c_char, + __new_dir_fd: ::std::os::raw::c_int, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseek( + __fp: *mut FILE, + __offset: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__fp: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn fgetpos(__fp: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__fp: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko( + __fp: *mut FILE, + __offset: off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__fp: *mut FILE) -> off_t; +} +extern "C" { + pub fn fgetpos64(__fp: *mut FILE, __pos: *mut fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos64(__fp: *mut FILE, __pos: *const fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko64( + __fp: *mut FILE, + __offset: off64_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello64(__fp: *mut FILE) -> off64_t; +} +extern "C" { + pub fn fopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn fopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpfile64() -> *mut FILE; +} +extern "C" { + pub fn snprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_uint, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_uint, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ctermid(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __mode: *const ::std::os::raw::c_char) -> *mut FILE; +} +extern "C" { + pub fn fileno(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn flockfile(__fp: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__fp: *mut FILE); +} +extern "C" { + pub fn getc_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fmemopen( + __buf: *mut ::std::os::raw::c_void, + __size: usize, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __ptr: *mut *mut ::std::os::raw::c_char, + __size_ptr: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn asprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetln(__fp: *mut FILE, __length_ptr: *mut usize) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fpurge(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn setlinebuf(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vasprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__fp: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn malloc(__byte_count: ::std::os::raw::c_uint) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn calloc( + __item_count: ::std::os::raw::c_uint, + __item_size: ::std::os::raw::c_uint, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn realloc( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: ::std::os::raw::c_uint, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn reallocarray( + __ptr: *mut ::std::os::raw::c_void, + __item_count: usize, + __item_size: usize, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn free(__ptr: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn memalign(__alignment: usize, __byte_count: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn malloc_usable_size(__ptr: *const ::std::os::raw::c_void) -> usize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mallinfo { + pub arena: usize, + pub ordblks: usize, + pub smblks: usize, + pub hblks: usize, + pub hblkhd: usize, + pub usmblks: usize, + pub fsmblks: usize, + pub uordblks: usize, + pub fordblks: usize, + pub keepcost: usize, +} +#[test] +fn bindgen_test_layout_mallinfo() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(mallinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(mallinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arena as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(arena) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ordblks as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(ordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smblks as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(smblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblks as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblkhd as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblkhd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usmblks as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(usmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fsmblks as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fsmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uordblks as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(uordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fordblks as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).keepcost as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(keepcost) + ) + ); +} +extern "C" { + pub fn mallinfo() -> mallinfo; +} +extern "C" { + pub fn malloc_info( + __must_be_zero: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mallopt( + __option: ::std::os::raw::c_int, + __value: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut __malloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __realloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __free_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __caller: *const ::std::os::raw::c_void, + ), + >; +} +extern "C" { + pub static mut __memalign_hook: ::std::option::Option< + unsafe extern "C" fn( + __alignment: usize, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_t { + _unused: [u8; 0], +} +pub type locale_t = *mut __locale_t; +extern "C" { + pub fn abort(); +} +extern "C" { + pub fn exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn _Exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn atexit(__fn: ::std::option::Option) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn at_quick_exit( + __fn: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn quick_exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn putenv(__assignment: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setenv( + __name: *const ::std::os::raw::c_char, + __value: *const ::std::os::raw::c_char, + __overwrite: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearenv() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mkostemp64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemp( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps64( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp64(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtol( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn strtoll( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoul( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strtoull( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut ::std::os::raw::c_void, + __alignment: usize, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn strtod( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f64; +} +extern "C" { + pub fn strtoul_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn atoi(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn atol(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn atoll(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn realpath( + __path: *const ::std::os::raw::c_char, + __resolved: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bsearch( + __key: *const ::std::os::raw::c_void, + __base: *const ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn qsort( + __base: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ); +} +extern "C" { + pub fn arc4random() -> u32; +} +extern "C" { + pub fn arc4random_uniform(__upper_bound: u32) -> u32; +} +extern "C" { + pub fn arc4random_buf(__buf: *mut ::std::os::raw::c_void, __n: usize); +} +extern "C" { + pub fn rand_r(__seed_ptr: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; +} +extern "C" { + pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); +} +extern "C" { + pub fn lrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn mrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; +} +extern "C" { + pub fn srand48(__seed: ::std::os::raw::c_long); +} +extern "C" { + pub fn initstate( + __seed: ::std::os::raw::c_uint, + __state: *mut ::std::os::raw::c_char, + __n: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn setstate(__state: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getpt() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn posix_openpt(__flags: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ptsname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ptsname_r( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unlockpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsubopt( + __option: *mut *mut ::std::os::raw::c_char, + __tokens: *const *mut ::std::os::raw::c_char, + __value_ptr: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct div_t { + pub quot: ::std::os::raw::c_int, + pub rem: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_div_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(div_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(div_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn div(__numerator: ::std::os::raw::c_int, __denominator: ::std::os::raw::c_int) -> div_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ldiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_ldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(ldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn ldiv( + __numerator: ::std::os::raw::c_long, + __denominator: ::std::os::raw::c_long, + ) -> ldiv_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lldiv_t { + pub quot: ::std::os::raw::c_longlong, + pub rem: ::std::os::raw::c_longlong, +} +#[test] +fn bindgen_test_layout_lldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(lldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn lldiv( + __numerator: ::std::os::raw::c_longlong, + __denominator: ::std::os::raw::c_longlong, + ) -> lldiv_t; +} +extern "C" { + pub fn getloadavg(__averages: *mut f64, __n: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getprogname() -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn setprogname(__name: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbstowcs(__dst: *mut wchar_t, __src: *const ::std::os::raw::c_char, __n: usize) + -> usize; +} +extern "C" { + pub fn mbtowc( + __wc_ptr: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wctomb(__dst: *mut ::std::os::raw::c_char, __wc: wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wcstombs(__dst: *mut ::std::os::raw::c_char, __src: *const wchar_t, __n: usize) + -> usize; +} +extern "C" { + pub fn __ctype_get_mb_cur_max() -> usize; +} +extern "C" { + pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtof( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f32; +} +extern "C" { + pub fn atof(__s: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn rand() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn random() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srandom(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn grantpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtoll_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoull_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn strtold_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f64; +} +extern "C" { + pub fn strtod_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f64; +} +extern "C" { + pub fn strtof_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f32; +} +extern "C" { + pub fn strtol_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + arg1: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_long; +} +pub type net_handle_t = u64; +extern "C" { + pub fn android_setsocknetwork( + network: net_handle_t, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_setprocnetwork(network: net_handle_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_getaddrinfofornetwork( + network: net_handle_t, + node: *const ::std::os::raw::c_char, + service: *const ::std::os::raw::c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +pub const ResNsendFlags_ANDROID_RESOLV_NO_RETRY: ResNsendFlags = 1; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_STORE: ResNsendFlags = 2; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_LOOKUP: ResNsendFlags = 4; +pub type ResNsendFlags = u32; +extern "C" { + pub fn android_res_nquery( + network: net_handle_t, + dname: *const ::std::os::raw::c_char, + ns_class: ::std::os::raw::c_int, + ns_type: ::std::os::raw::c_int, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nsend( + network: net_handle_t, + msg: *const u8, + msglen: usize, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nresult( + fd: ::std::os::raw::c_int, + rcode: *mut ::std::os::raw::c_int, + answer: *mut u8, + anslen: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_cancel(nsend_fd: ::std::os::raw::c_int); +} +pub const OperandCode_ANEURALNETWORKS_FLOAT32: OperandCode = 0; +pub const OperandCode_ANEURALNETWORKS_INT32: OperandCode = 1; +pub const OperandCode_ANEURALNETWORKS_UINT32: OperandCode = 2; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT32: OperandCode = 3; +pub const OperandCode_ANEURALNETWORKS_TENSOR_INT32: OperandCode = 4; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_ASYMM: OperandCode = 5; +pub const OperandCode_ANEURALNETWORKS_BOOL: OperandCode = 6; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_SYMM: OperandCode = 7; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT16: OperandCode = 8; +pub const OperandCode_ANEURALNETWORKS_TENSOR_BOOL8: OperandCode = 9; +pub const OperandCode_ANEURALNETWORKS_FLOAT16: OperandCode = 10; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL: OperandCode = 11; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_ASYMM: OperandCode = 12; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM: OperandCode = 13; +pub type OperandCode = u32; +pub const OperationCode_ANEURALNETWORKS_ADD: OperationCode = 0; +pub const OperationCode_ANEURALNETWORKS_AVERAGE_POOL_2D: OperationCode = 1; +pub const OperationCode_ANEURALNETWORKS_CONCATENATION: OperationCode = 2; +pub const OperationCode_ANEURALNETWORKS_CONV_2D: OperationCode = 3; +pub const OperationCode_ANEURALNETWORKS_DEPTHWISE_CONV_2D: OperationCode = 4; +pub const OperationCode_ANEURALNETWORKS_DEPTH_TO_SPACE: OperationCode = 5; +pub const OperationCode_ANEURALNETWORKS_DEQUANTIZE: OperationCode = 6; +pub const OperationCode_ANEURALNETWORKS_EMBEDDING_LOOKUP: OperationCode = 7; +pub const OperationCode_ANEURALNETWORKS_FLOOR: OperationCode = 8; +pub const OperationCode_ANEURALNETWORKS_FULLY_CONNECTED: OperationCode = 9; +pub const OperationCode_ANEURALNETWORKS_HASHTABLE_LOOKUP: OperationCode = 10; +pub const OperationCode_ANEURALNETWORKS_L2_NORMALIZATION: OperationCode = 11; +pub const OperationCode_ANEURALNETWORKS_L2_POOL_2D: OperationCode = 12; +pub const OperationCode_ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION: OperationCode = 13; +pub const OperationCode_ANEURALNETWORKS_LOGISTIC: OperationCode = 14; +pub const OperationCode_ANEURALNETWORKS_LSH_PROJECTION: OperationCode = 15; +pub const OperationCode_ANEURALNETWORKS_LSTM: OperationCode = 16; +pub const OperationCode_ANEURALNETWORKS_MAX_POOL_2D: OperationCode = 17; +pub const OperationCode_ANEURALNETWORKS_MUL: OperationCode = 18; +pub const OperationCode_ANEURALNETWORKS_RELU: OperationCode = 19; +pub const OperationCode_ANEURALNETWORKS_RELU1: OperationCode = 20; +pub const OperationCode_ANEURALNETWORKS_RELU6: OperationCode = 21; +pub const OperationCode_ANEURALNETWORKS_RESHAPE: OperationCode = 22; +pub const OperationCode_ANEURALNETWORKS_RESIZE_BILINEAR: OperationCode = 23; +pub const OperationCode_ANEURALNETWORKS_RNN: OperationCode = 24; +pub const OperationCode_ANEURALNETWORKS_SOFTMAX: OperationCode = 25; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_DEPTH: OperationCode = 26; +pub const OperationCode_ANEURALNETWORKS_SVDF: OperationCode = 27; +pub const OperationCode_ANEURALNETWORKS_TANH: OperationCode = 28; +pub const OperationCode_ANEURALNETWORKS_BATCH_TO_SPACE_ND: OperationCode = 29; +pub const OperationCode_ANEURALNETWORKS_DIV: OperationCode = 30; +pub const OperationCode_ANEURALNETWORKS_MEAN: OperationCode = 31; +pub const OperationCode_ANEURALNETWORKS_PAD: OperationCode = 32; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_BATCH_ND: OperationCode = 33; +pub const OperationCode_ANEURALNETWORKS_SQUEEZE: OperationCode = 34; +pub const OperationCode_ANEURALNETWORKS_STRIDED_SLICE: OperationCode = 35; +pub const OperationCode_ANEURALNETWORKS_SUB: OperationCode = 36; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE: OperationCode = 37; +pub const OperationCode_ANEURALNETWORKS_ABS: OperationCode = 38; +pub const OperationCode_ANEURALNETWORKS_ARGMAX: OperationCode = 39; +pub const OperationCode_ANEURALNETWORKS_ARGMIN: OperationCode = 40; +pub const OperationCode_ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM: OperationCode = 41; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 42; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 43; +pub const OperationCode_ANEURALNETWORKS_BOX_WITH_NMS_LIMIT: OperationCode = 44; +pub const OperationCode_ANEURALNETWORKS_CAST: OperationCode = 45; +pub const OperationCode_ANEURALNETWORKS_CHANNEL_SHUFFLE: OperationCode = 46; +pub const OperationCode_ANEURALNETWORKS_DETECTION_POSTPROCESSING: OperationCode = 47; +pub const OperationCode_ANEURALNETWORKS_EQUAL: OperationCode = 48; +pub const OperationCode_ANEURALNETWORKS_EXP: OperationCode = 49; +pub const OperationCode_ANEURALNETWORKS_EXPAND_DIMS: OperationCode = 50; +pub const OperationCode_ANEURALNETWORKS_GATHER: OperationCode = 51; +pub const OperationCode_ANEURALNETWORKS_GENERATE_PROPOSALS: OperationCode = 52; +pub const OperationCode_ANEURALNETWORKS_GREATER: OperationCode = 53; +pub const OperationCode_ANEURALNETWORKS_GREATER_EQUAL: OperationCode = 54; +pub const OperationCode_ANEURALNETWORKS_GROUPED_CONV_2D: OperationCode = 55; +pub const OperationCode_ANEURALNETWORKS_HEATMAP_MAX_KEYPOINT: OperationCode = 56; +pub const OperationCode_ANEURALNETWORKS_INSTANCE_NORMALIZATION: OperationCode = 57; +pub const OperationCode_ANEURALNETWORKS_LESS: OperationCode = 58; +pub const OperationCode_ANEURALNETWORKS_LESS_EQUAL: OperationCode = 59; +pub const OperationCode_ANEURALNETWORKS_LOG: OperationCode = 60; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_AND: OperationCode = 61; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_NOT: OperationCode = 62; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_OR: OperationCode = 63; +pub const OperationCode_ANEURALNETWORKS_LOG_SOFTMAX: OperationCode = 64; +pub const OperationCode_ANEURALNETWORKS_MAXIMUM: OperationCode = 65; +pub const OperationCode_ANEURALNETWORKS_MINIMUM: OperationCode = 66; +pub const OperationCode_ANEURALNETWORKS_NEG: OperationCode = 67; +pub const OperationCode_ANEURALNETWORKS_NOT_EQUAL: OperationCode = 68; +pub const OperationCode_ANEURALNETWORKS_PAD_V2: OperationCode = 69; +pub const OperationCode_ANEURALNETWORKS_POW: OperationCode = 70; +pub const OperationCode_ANEURALNETWORKS_PRELU: OperationCode = 71; +pub const OperationCode_ANEURALNETWORKS_QUANTIZE: OperationCode = 72; +pub const OperationCode_ANEURALNETWORKS_QUANTIZED_16BIT_LSTM: OperationCode = 73; +pub const OperationCode_ANEURALNETWORKS_RANDOM_MULTINOMIAL: OperationCode = 74; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ALL: OperationCode = 75; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ANY: OperationCode = 76; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MAX: OperationCode = 77; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MIN: OperationCode = 78; +pub const OperationCode_ANEURALNETWORKS_REDUCE_PROD: OperationCode = 79; +pub const OperationCode_ANEURALNETWORKS_REDUCE_SUM: OperationCode = 80; +pub const OperationCode_ANEURALNETWORKS_ROI_ALIGN: OperationCode = 81; +pub const OperationCode_ANEURALNETWORKS_ROI_POOLING: OperationCode = 82; +pub const OperationCode_ANEURALNETWORKS_RSQRT: OperationCode = 83; +pub const OperationCode_ANEURALNETWORKS_SELECT: OperationCode = 84; +pub const OperationCode_ANEURALNETWORKS_SIN: OperationCode = 85; +pub const OperationCode_ANEURALNETWORKS_SLICE: OperationCode = 86; +pub const OperationCode_ANEURALNETWORKS_SPLIT: OperationCode = 87; +pub const OperationCode_ANEURALNETWORKS_SQRT: OperationCode = 88; +pub const OperationCode_ANEURALNETWORKS_TILE: OperationCode = 89; +pub const OperationCode_ANEURALNETWORKS_TOPK_V2: OperationCode = 90; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE_CONV_2D: OperationCode = 91; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 92; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 93; +pub const OperationCode_ANEURALNETWORKS_RESIZE_NEAREST_NEIGHBOR: OperationCode = 94; +pub type OperationCode = u32; +pub const FuseCode_ANEURALNETWORKS_FUSED_NONE: FuseCode = 0; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU: FuseCode = 1; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU1: FuseCode = 2; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU6: FuseCode = 3; +pub type FuseCode = u32; +pub const PaddingCode_ANEURALNETWORKS_PADDING_SAME: PaddingCode = 1; +pub const PaddingCode_ANEURALNETWORKS_PADDING_VALID: PaddingCode = 2; +pub type PaddingCode = u32; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_LOW_POWER: PreferenceCode = 0; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER: PreferenceCode = 1; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_SUSTAINED_SPEED: PreferenceCode = 2; +pub type PreferenceCode = u32; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_UNKNOWN: DeviceTypeCode = 0; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_OTHER: DeviceTypeCode = 1; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_CPU: DeviceTypeCode = 2; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_GPU: DeviceTypeCode = 3; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_ACCELERATOR: DeviceTypeCode = 4; +pub type DeviceTypeCode = u32; +pub const ResultCode_ANEURALNETWORKS_NO_ERROR: ResultCode = 0; +pub const ResultCode_ANEURALNETWORKS_OUT_OF_MEMORY: ResultCode = 1; +pub const ResultCode_ANEURALNETWORKS_INCOMPLETE: ResultCode = 2; +pub const ResultCode_ANEURALNETWORKS_UNEXPECTED_NULL: ResultCode = 3; +pub const ResultCode_ANEURALNETWORKS_BAD_DATA: ResultCode = 4; +pub const ResultCode_ANEURALNETWORKS_OP_FAILED: ResultCode = 5; +pub const ResultCode_ANEURALNETWORKS_BAD_STATE: ResultCode = 6; +pub const ResultCode_ANEURALNETWORKS_UNMAPPABLE: ResultCode = 7; +pub const ResultCode_ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE: ResultCode = 8; +pub const ResultCode_ANEURALNETWORKS_UNAVAILABLE_DEVICE: ResultCode = 9; +pub type ResultCode = u32; +pub const ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES: _bindgen_ty_25 = 128; +pub type _bindgen_ty_25 = u32; +pub const ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN: _bindgen_ty_26 = 32; +pub type _bindgen_ty_26 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksMemory { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksModel { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksCompilation { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksExecution { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksSymmPerChannelQuantParams { + pub channelDim: u32, + pub scaleCount: u32, + pub scales: *const f32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksSymmPerChannelQuantParams() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).channelDim + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(channelDim) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scaleCount + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scaleCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scales as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scales) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksBurst { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksOperandType { + pub type_: i32, + pub dimensionCount: u32, + pub dimensions: *const u32, + pub scale: f32, + pub zeroPoint: i32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksOperandType() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensionCount as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensionCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensions as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensions) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scale as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(scale) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zeroPoint as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(zeroPoint) + ) + ); +} +pub type ANeuralNetworksOperationType = i32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksEvent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksDevice { + _unused: [u8; 0], +} +extern "C" { + pub fn ANeuralNetworks_getDeviceCount(numDevices: *mut u32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworks_getDevice( + devIndex: u32, + device: *mut *mut ANeuralNetworksDevice, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getName( + device: *const ANeuralNetworksDevice, + name: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getType( + device: *const ANeuralNetworksDevice, + type_: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getVersion( + device: *const ANeuralNetworksDevice, + version: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getFeatureLevel( + device: *const ANeuralNetworksDevice, + featureLevel: *mut i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_getSupportedOperationsForDevices( + model: *const ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + supportedOps: *mut bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_createForDevices( + model: *mut ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_setCaching( + compilation: *mut ANeuralNetworksCompilation, + cacheDir: *const ::std::os::raw::c_char, + token: *const u8, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_compute( + execution: *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandRank( + execution: *mut ANeuralNetworksExecution, + index: i32, + rank: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandDimensions( + execution: *mut ANeuralNetworksExecution, + index: i32, + dimensions: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_create( + compilation: *mut ANeuralNetworksCompilation, + burst: *mut *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_free(burst: *mut ANeuralNetworksBurst); +} +extern "C" { + pub fn ANeuralNetworksExecution_burstCompute( + execution: *mut ANeuralNetworksExecution, + burst: *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromAHardwareBuffer( + ahwb: *const AHardwareBuffer, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setMeasureTiming( + execution: *mut ANeuralNetworksExecution, + measure: bool, + ) -> ::std::os::raw::c_int; +} +pub const DurationCode_ANEURALNETWORKS_DURATION_ON_HARDWARE: DurationCode = 0; +pub const DurationCode_ANEURALNETWORKS_DURATION_IN_DRIVER: DurationCode = 1; +pub type DurationCode = u32; +extern "C" { + pub fn ANeuralNetworksExecution_getDuration( + execution: *const ANeuralNetworksExecution, + durationCode: i32, + duration: *mut u64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromFd( + size: usize, + protect: ::std::os::raw::c_int, + fd: ::std::os::raw::c_int, + offset: usize, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_free(memory: *mut ANeuralNetworksMemory); +} +extern "C" { + pub fn ANeuralNetworksModel_create( + model: *mut *mut ANeuralNetworksModel, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_free(model: *mut ANeuralNetworksModel); +} +extern "C" { + pub fn ANeuralNetworksModel_finish(model: *mut ANeuralNetworksModel) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperand( + model: *mut ANeuralNetworksModel, + type_: *const ANeuralNetworksOperandType, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValue( + model: *mut ANeuralNetworksModel, + index: i32, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandSymmPerChannelQuantParams( + model: *mut ANeuralNetworksModel, + index: i32, + channelQuant: *const ANeuralNetworksSymmPerChannelQuantParams, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValueFromMemory( + model: *mut ANeuralNetworksModel, + index: i32, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperation( + model: *mut ANeuralNetworksModel, + type_: ANeuralNetworksOperationType, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_identifyInputsAndOutputs( + model: *mut ANeuralNetworksModel, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_relaxComputationFloat32toFloat16( + model: *mut ANeuralNetworksModel, + allow: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_create( + model: *mut ANeuralNetworksModel, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_free(compilation: *mut ANeuralNetworksCompilation); +} +extern "C" { + pub fn ANeuralNetworksCompilation_setPreference( + compilation: *mut ANeuralNetworksCompilation, + preference: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_finish( + compilation: *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_create( + compilation: *mut ANeuralNetworksCompilation, + execution: *mut *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_free(execution: *mut ANeuralNetworksExecution); +} +extern "C" { + pub fn ANeuralNetworksExecution_setInput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setInputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *mut ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_startCompute( + execution: *mut ANeuralNetworksExecution, + event: *mut *mut ANeuralNetworksEvent, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_wait(event: *mut ANeuralNetworksEvent) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_free(event: *mut ANeuralNetworksEvent); +} +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBA_8888: ANativeWindow_LegacyFormat = 1; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBX_8888: ANativeWindow_LegacyFormat = 2; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGB_565: ANativeWindow_LegacyFormat = 4; +pub type ANativeWindow_LegacyFormat = u32; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_IDENTITY: ANativeWindowTransform = 0; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL: ANativeWindowTransform = + 1; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL: ANativeWindowTransform = + 2; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_90: ANativeWindowTransform = 4; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_180: ANativeWindowTransform = 3; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_270: ANativeWindowTransform = 7; +pub type ANativeWindowTransform = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow_Buffer { + pub width: i32, + pub height: i32, + pub stride: i32, + pub format: i32, + pub bits: *mut ::std::os::raw::c_void, + pub reserved: [u32; 6usize], +} +#[test] +fn bindgen_test_layout_ANativeWindow_Buffer() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bits as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(bits) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(reserved) + ) + ); +} +extern "C" { + pub fn ANativeWindow_acquire(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_release(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_getWidth(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getHeight(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getFormat(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersGeometry( + window: *mut ANativeWindow, + width: i32, + height: i32, + format: i32, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_lock( + window: *mut ANativeWindow, + outBuffer: *mut ANativeWindow_Buffer, + inOutDirtyBounds: *mut ARect, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_unlockAndPost(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersTransform(window: *mut ANativeWindow, transform: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersDataSpace(window: *mut ANativeWindow, dataSpace: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_getBuffersDataSpace(window: *mut ANativeWindow) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivity { + pub callbacks: *mut ANativeActivityCallbacks, + pub vm: *mut JavaVM, + pub env: *mut JNIEnv, + pub clazz: jobject, + pub internalDataPath: *const ::std::os::raw::c_char, + pub externalDataPath: *const ::std::os::raw::c_char, + pub sdkVersion: i32, + pub instance: *mut ::std::os::raw::c_void, + pub assetManager: *mut AAssetManager, + pub obbPath: *const ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_ANativeActivity() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(ANativeActivity)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANativeActivity)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(callbacks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(vm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(env) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clazz as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(clazz) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).internalDataPath as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(internalDataPath) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).externalDataPath as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(externalDataPath) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(sdkVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(instance) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(assetManager) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(obbPath) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivityCallbacks { + pub onStart: ::std::option::Option, + pub onResume: ::std::option::Option, + pub onSaveInstanceState: ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + outSize: *mut usize, + ) -> *mut ::std::os::raw::c_void, + >, + pub onPause: ::std::option::Option, + pub onStop: ::std::option::Option, + pub onDestroy: ::std::option::Option, + pub onWindowFocusChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, hasFocus: ::std::os::raw::c_int), + >, + pub onNativeWindowCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowResized: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowRedrawNeeded: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onInputQueueCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onInputQueueDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, rect: *const ARect), + >, + pub onConfigurationChanged: + ::std::option::Option, + pub onLowMemory: ::std::option::Option, +} +#[test] +fn bindgen_test_layout_ANativeActivityCallbacks() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onStart as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStart) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onResume as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onResume) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onSaveInstanceState as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onSaveInstanceState) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onPause as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onPause) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStop) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onDestroy as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onDestroy) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onWindowFocusChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ + as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowResized as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowResized) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded + as *const _ as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowRedrawNeeded) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ + as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueCreated as *const _ + as usize + }, + 44usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueDestroyed as *const _ + as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onContentRectChanged as *const _ + as usize + }, + 52usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onContentRectChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onConfigurationChanged as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onConfigurationChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onLowMemory as *const _ as usize + }, + 60usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onLowMemory) + ) + ); +} +pub type ANativeActivity_createFunc = ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ), +>; +extern "C" { + pub fn ANativeActivity_onCreate( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ); +} +extern "C" { + pub fn ANativeActivity_finish(activity: *mut ANativeActivity); +} +extern "C" { + pub fn ANativeActivity_setWindowFormat(activity: *mut ANativeActivity, format: i32); +} +extern "C" { + pub fn ANativeActivity_setWindowFlags( + activity: *mut ANativeActivity, + addFlags: u32, + removeFlags: u32, + ); +} +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: _bindgen_ty_27 = 1; +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED: _bindgen_ty_27 = 2; +pub type _bindgen_ty_27 = u32; +extern "C" { + pub fn ANativeActivity_showSoftInput(activity: *mut ANativeActivity, flags: u32); +} +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: _bindgen_ty_28 = 1; +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: _bindgen_ty_28 = 2; +pub type _bindgen_ty_28 = u32; +extern "C" { + pub fn ANativeActivity_hideSoftInput(activity: *mut ANativeActivity, flags: u32); +} +extern "C" { + pub fn ANativeWindow_fromSurface(env: *mut JNIEnv, surface: jobject) -> *mut ANativeWindow; +} +extern "C" { + pub fn ANativeWindow_toSurface(env: *mut JNIEnv, window: *mut ANativeWindow) -> jobject; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AObbInfo { + _unused: [u8; 0], +} +pub const AOBBINFO_OVERLAY: _bindgen_ty_29 = 1; +pub type _bindgen_ty_29 = u32; +extern "C" { + pub fn AObbScanner_getObbInfo(filename: *const ::std::os::raw::c_char) -> *mut AObbInfo; +} +extern "C" { + pub fn AObbInfo_delete(obbInfo: *mut AObbInfo); +} +extern "C" { + pub fn AObbInfo_getPackageName(obbInfo: *mut AObbInfo) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AObbInfo_getVersion(obbInfo: *mut AObbInfo) -> i32; +} +extern "C" { + pub fn AObbInfo_getFlags(obbInfo: *mut AObbInfo) -> i32; +} +pub type __double_t = f64; +pub type double_t = __double_t; +pub type __float_t = f32; +pub type float_t = __float_t; +extern "C" { + pub fn acos(__x: f64) -> f64; +} +extern "C" { + pub fn acosf(__x: f32) -> f32; +} +extern "C" { + pub fn asin(__x: f64) -> f64; +} +extern "C" { + pub fn asinf(__x: f32) -> f32; +} +extern "C" { + pub fn atan(__x: f64) -> f64; +} +extern "C" { + pub fn atanf(__x: f32) -> f32; +} +extern "C" { + pub fn atan2(__y: f64, __x: f64) -> f64; +} +extern "C" { + pub fn atan2f(__y: f32, __x: f32) -> f32; +} +extern "C" { + pub fn cos(__x: f64) -> f64; +} +extern "C" { + pub fn cosf(__x: f32) -> f32; +} +extern "C" { + pub fn sin(__x: f64) -> f64; +} +extern "C" { + pub fn sinf(__x: f32) -> f32; +} +extern "C" { + pub fn tan(__x: f64) -> f64; +} +extern "C" { + pub fn tanf(__x: f32) -> f32; +} +extern "C" { + pub fn acosh(__x: f64) -> f64; +} +extern "C" { + pub fn acoshf(__x: f32) -> f32; +} +extern "C" { + pub fn asinh(__x: f64) -> f64; +} +extern "C" { + pub fn asinhf(__x: f32) -> f32; +} +extern "C" { + pub fn atanh(__x: f64) -> f64; +} +extern "C" { + pub fn atanhf(__x: f32) -> f32; +} +extern "C" { + pub fn cosh(__x: f64) -> f64; +} +extern "C" { + pub fn coshf(__x: f32) -> f32; +} +extern "C" { + pub fn sinh(__x: f64) -> f64; +} +extern "C" { + pub fn sinhf(__x: f32) -> f32; +} +extern "C" { + pub fn tanh(__x: f64) -> f64; +} +extern "C" { + pub fn tanhf(__x: f32) -> f32; +} +extern "C" { + pub fn exp(__x: f64) -> f64; +} +extern "C" { + pub fn expf(__x: f32) -> f32; +} +extern "C" { + pub fn exp2(__x: f64) -> f64; +} +extern "C" { + pub fn exp2f(__x: f32) -> f32; +} +extern "C" { + pub fn expm1(__x: f64) -> f64; +} +extern "C" { + pub fn expm1f(__x: f32) -> f32; +} +extern "C" { + pub fn frexp(__x: f64, __exponent: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn frexpf(__x: f32, __exponent: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn ilogb(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ilogbf(__x: f32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ldexp(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn ldexpf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn log(__x: f64) -> f64; +} +extern "C" { + pub fn logf(__x: f32) -> f32; +} +extern "C" { + pub fn log10(__x: f64) -> f64; +} +extern "C" { + pub fn log10f(__x: f32) -> f32; +} +extern "C" { + pub fn log1p(__x: f64) -> f64; +} +extern "C" { + pub fn log1pf(__x: f32) -> f32; +} +extern "C" { + pub fn log2(__x: f64) -> f64; +} +extern "C" { + pub fn log2f(__x: f32) -> f32; +} +extern "C" { + pub fn logb(__x: f64) -> f64; +} +extern "C" { + pub fn logbf(__x: f32) -> f32; +} +extern "C" { + pub fn modf(__x: f64, __integral_part: *mut f64) -> f64; +} +extern "C" { + pub fn modff(__x: f32, __integral_part: *mut f32) -> f32; +} +extern "C" { + pub fn scalbn(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn scalbnf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn scalbln(__x: f64, __exponent: ::std::os::raw::c_long) -> f64; +} +extern "C" { + pub fn scalblnf(__x: f32, __exponent: ::std::os::raw::c_long) -> f32; +} +extern "C" { + pub fn scalblnl(__x: f64, __exponent: ::std::os::raw::c_long) -> f64; +} +extern "C" { + pub fn cbrt(__x: f64) -> f64; +} +extern "C" { + pub fn cbrtf(__x: f32) -> f32; +} +extern "C" { + pub fn fabs(__x: f64) -> f64; +} +extern "C" { + pub fn fabsf(__x: f32) -> f32; +} +extern "C" { + pub fn hypot(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn hypotf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn pow(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn powf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn sqrt(__x: f64) -> f64; +} +extern "C" { + pub fn sqrtf(__x: f32) -> f32; +} +extern "C" { + pub fn erf(__x: f64) -> f64; +} +extern "C" { + pub fn erff(__x: f32) -> f32; +} +extern "C" { + pub fn erfc(__x: f64) -> f64; +} +extern "C" { + pub fn erfcf(__x: f32) -> f32; +} +extern "C" { + pub fn lgamma(__x: f64) -> f64; +} +extern "C" { + pub fn lgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn tgamma(__x: f64) -> f64; +} +extern "C" { + pub fn tgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn ceil(__x: f64) -> f64; +} +extern "C" { + pub fn ceilf(__x: f32) -> f32; +} +extern "C" { + pub fn floor(__x: f64) -> f64; +} +extern "C" { + pub fn floorf(__x: f32) -> f32; +} +extern "C" { + pub fn nearbyint(__x: f64) -> f64; +} +extern "C" { + pub fn nearbyintf(__x: f32) -> f32; +} +extern "C" { + pub fn rint(__x: f64) -> f64; +} +extern "C" { + pub fn rintf(__x: f32) -> f32; +} +extern "C" { + pub fn lrint(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lrintf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llrint(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llrintf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn round(__x: f64) -> f64; +} +extern "C" { + pub fn roundf(__x: f32) -> f32; +} +extern "C" { + pub fn roundl(__x: f64) -> f64; +} +extern "C" { + pub fn lround(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lroundf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llround(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llroundf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn trunc(__x: f64) -> f64; +} +extern "C" { + pub fn truncf(__x: f32) -> f32; +} +extern "C" { + pub fn fmod(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmodf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn remainder(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn remainderf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn remquo(__x: f64, __y: f64, __quotient_bits: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn remquof(__x: f32, __y: f32, __quotient_bits: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn copysign(__value: f64, __sign: f64) -> f64; +} +extern "C" { + pub fn copysignf(__value: f32, __sign: f32) -> f32; +} +extern "C" { + pub fn nan(__kind: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn nanf(__kind: *const ::std::os::raw::c_char) -> f32; +} +extern "C" { + pub fn nextafter(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn nextafterf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn nexttoward(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn nexttowardf(__x: f32, __y: f64) -> f32; +} +extern "C" { + pub fn fdim(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fdimf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmax(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmaxf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmin(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fminf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fma(__x: f64, __y: f64, __z: f64) -> f64; +} +extern "C" { + pub fn fmaf(__x: f32, __y: f32, __z: f32) -> f32; +} +extern "C" { + pub fn isinf(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isnan(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut signgam: ::std::os::raw::c_int; +} +extern "C" { + pub fn j0(__x: f64) -> f64; +} +extern "C" { + pub fn j1(__x: f64) -> f64; +} +extern "C" { + pub fn jn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +extern "C" { + pub fn y0(__x: f64) -> f64; +} +extern "C" { + pub fn y1(__x: f64) -> f64; +} +extern "C" { + pub fn yn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +pub const ASENSOR_TYPE_INVALID: _bindgen_ty_30 = -1; +pub const ASENSOR_TYPE_ACCELEROMETER: _bindgen_ty_30 = 1; +pub const ASENSOR_TYPE_MAGNETIC_FIELD: _bindgen_ty_30 = 2; +pub const ASENSOR_TYPE_GYROSCOPE: _bindgen_ty_30 = 4; +pub const ASENSOR_TYPE_LIGHT: _bindgen_ty_30 = 5; +pub const ASENSOR_TYPE_PRESSURE: _bindgen_ty_30 = 6; +pub const ASENSOR_TYPE_PROXIMITY: _bindgen_ty_30 = 8; +pub const ASENSOR_TYPE_GRAVITY: _bindgen_ty_30 = 9; +pub const ASENSOR_TYPE_LINEAR_ACCELERATION: _bindgen_ty_30 = 10; +pub const ASENSOR_TYPE_ROTATION_VECTOR: _bindgen_ty_30 = 11; +pub const ASENSOR_TYPE_RELATIVE_HUMIDITY: _bindgen_ty_30 = 12; +pub const ASENSOR_TYPE_AMBIENT_TEMPERATURE: _bindgen_ty_30 = 13; +pub const ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: _bindgen_ty_30 = 14; +pub const ASENSOR_TYPE_GAME_ROTATION_VECTOR: _bindgen_ty_30 = 15; +pub const ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED: _bindgen_ty_30 = 16; +pub const ASENSOR_TYPE_SIGNIFICANT_MOTION: _bindgen_ty_30 = 17; +pub const ASENSOR_TYPE_STEP_DETECTOR: _bindgen_ty_30 = 18; +pub const ASENSOR_TYPE_STEP_COUNTER: _bindgen_ty_30 = 19; +pub const ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: _bindgen_ty_30 = 20; +pub const ASENSOR_TYPE_HEART_RATE: _bindgen_ty_30 = 21; +pub const ASENSOR_TYPE_POSE_6DOF: _bindgen_ty_30 = 28; +pub const ASENSOR_TYPE_STATIONARY_DETECT: _bindgen_ty_30 = 29; +pub const ASENSOR_TYPE_MOTION_DETECT: _bindgen_ty_30 = 30; +pub const ASENSOR_TYPE_HEART_BEAT: _bindgen_ty_30 = 31; +pub const ASENSOR_TYPE_ADDITIONAL_INFO: _bindgen_ty_30 = 33; +pub const ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT: _bindgen_ty_30 = 34; +pub const ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED: _bindgen_ty_30 = 35; +pub type _bindgen_ty_30 = i32; +pub const ASENSOR_STATUS_NO_CONTACT: _bindgen_ty_31 = -1; +pub const ASENSOR_STATUS_UNRELIABLE: _bindgen_ty_31 = 0; +pub const ASENSOR_STATUS_ACCURACY_LOW: _bindgen_ty_31 = 1; +pub const ASENSOR_STATUS_ACCURACY_MEDIUM: _bindgen_ty_31 = 2; +pub const ASENSOR_STATUS_ACCURACY_HIGH: _bindgen_ty_31 = 3; +pub type _bindgen_ty_31 = i32; +pub const AREPORTING_MODE_INVALID: _bindgen_ty_32 = -1; +pub const AREPORTING_MODE_CONTINUOUS: _bindgen_ty_32 = 0; +pub const AREPORTING_MODE_ON_CHANGE: _bindgen_ty_32 = 1; +pub const AREPORTING_MODE_ONE_SHOT: _bindgen_ty_32 = 2; +pub const AREPORTING_MODE_SPECIAL_TRIGGER: _bindgen_ty_32 = 3; +pub type _bindgen_ty_32 = i32; +pub const ASENSOR_DIRECT_RATE_STOP: _bindgen_ty_33 = 0; +pub const ASENSOR_DIRECT_RATE_NORMAL: _bindgen_ty_33 = 1; +pub const ASENSOR_DIRECT_RATE_FAST: _bindgen_ty_33 = 2; +pub const ASENSOR_DIRECT_RATE_VERY_FAST: _bindgen_ty_33 = 3; +pub type _bindgen_ty_33 = u32; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY: _bindgen_ty_34 = 1; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER: _bindgen_ty_34 = 2; +pub type _bindgen_ty_34 = u32; +pub const ASENSOR_ADDITIONAL_INFO_BEGIN: _bindgen_ty_35 = 0; +pub const ASENSOR_ADDITIONAL_INFO_END: _bindgen_ty_35 = 1; +pub const ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY: _bindgen_ty_35 = 65536; +pub const ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE: _bindgen_ty_35 = 65537; +pub const ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION: _bindgen_ty_35 = 65538; +pub const ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT: _bindgen_ty_35 = 65539; +pub const ASENSOR_ADDITIONAL_INFO_SAMPLING: _bindgen_ty_35 = 65540; +pub type _bindgen_ty_35 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorVector { + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1, + pub status: i8, + pub reserved: [u8; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorVector__bindgen_ty_1 { + pub v: [f32; 3usize], + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1__bindgen_ty_1, + pub __bindgen_anon_2: ASensorVector__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_1 { + pub x: f32, + pub y: f32, + pub z: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_2 { + pub azimuth: f32, + pub pitch: f32, + pub roll: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).azimuth + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(azimuth) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pitch as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(pitch) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).roll as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(roll) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).v as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1), + "::", + stringify!(v) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ASensorVector)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AMetaDataEvent { + pub what: i32, + pub sensor: i32, +} +#[test] +fn bindgen_test_layout_AMetaDataEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).what as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(sensor) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AUncalibratedEvent { + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1, + pub __bindgen_anon_2: AUncalibratedEvent__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_1 { + pub uncalib: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1 { + pub x_uncalib: f32, + pub y_uncalib: f32, + pub z_uncalib: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_uncalib + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_uncalib + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_uncalib + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z_uncalib) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalib as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1), + "::", + stringify!(uncalib) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_2 { + pub bias: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1 { + pub x_bias: f32, + pub y_bias: f32, + pub z_bias: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_bias + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(x_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_bias + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(y_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_bias + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(z_bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).bias as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2), + "::", + stringify!(bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(AUncalibratedEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AUncalibratedEvent)) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHeartRateEvent { + pub bpm: f32, + pub status: i8, +} +#[test] +fn bindgen_test_layout_AHeartRateEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bpm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(bpm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(status) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ADynamicSensorEvent { + pub connected: i32, + pub handle: i32, +} +#[test] +fn bindgen_test_layout_ADynamicSensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).connected as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(connected) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(handle) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AAdditionalInfoEvent { + pub type_: i32, + pub serial: i32, + pub __bindgen_anon_1: AAdditionalInfoEvent__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AAdditionalInfoEvent__bindgen_ty_1 { + pub data_int32: [i32; 14usize], + pub data_float: [f32; 14usize], + _bindgen_union_align: [u32; 14usize], +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_int32 as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_int32) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_float as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_float) + ) + ); +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).serial as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(serial) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorEvent { + pub version: i32, + pub sensor: i32, + pub type_: i32, + pub reserved0: i32, + pub timestamp: i64, + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1, + pub flags: u32, + pub reserved1: [i32; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1 { + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1__bindgen_ty_1, + pub u64: ASensorEvent__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_1 { + pub data: [f32; 16usize], + pub vector: ASensorVector, + pub acceleration: ASensorVector, + pub magnetic: ASensorVector, + pub temperature: f32, + pub distance: f32, + pub light: f32, + pub pressure: f32, + pub relative_humidity: f32, + pub uncalibrated_gyro: AUncalibratedEvent, + pub uncalibrated_magnetic: AUncalibratedEvent, + pub meta_data: AMetaDataEvent, + pub heart_rate: AHeartRateEvent, + pub dynamic_sensor_meta: ADynamicSensorEvent, + pub additional_info: AAdditionalInfoEvent, + _bindgen_union_align: [u32; 16usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).acceleration + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(acceleration) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).magnetic + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).temperature + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(temperature) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).distance + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(distance) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).light as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(light) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pressure + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(pressure) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).relative_humidity + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(relative_humidity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalibrated_gyro + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_gyro) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .uncalibrated_magnetic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).meta_data + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(meta_data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).heart_rate + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(heart_rate) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dynamic_sensor_meta + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(dynamic_sensor_meta) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).additional_info + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(additional_info) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_2 { + pub data: [u64; 8usize], + pub step_counter: u64, + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).step_counter + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(step_counter) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u64 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1), + "::", + stringify!(u64) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(ASensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ASensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(sensor) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(timestamp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 92usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorEventQueue { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensor { + _unused: [u8; 0], +} +pub type ASensorRef = *const ASensor; +pub type ASensorList = *const ASensorRef; +extern "C" { + pub fn ASensorManager_getInstance() -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getInstanceForPackage( + packageName: *const ::std::os::raw::c_char, + ) -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getSensorList( + manager: *mut ASensorManager, + list: *mut ASensorList, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_getDefaultSensor( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_getDefaultSensorEx( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + wakeUp: bool, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_createEventQueue( + manager: *mut ASensorManager, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> *mut ASensorEventQueue; +} +extern "C" { + pub fn ASensorManager_destroyEventQueue( + manager: *mut ASensorManager, + queue: *mut ASensorEventQueue, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createSharedMemoryDirectChannel( + manager: *mut ASensorManager, + fd: ::std::os::raw::c_int, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createHardwareBufferDirectChannel( + manager: *mut ASensorManager, + buffer: *const AHardwareBuffer, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_destroyDirectChannel( + manager: *mut ASensorManager, + channelId: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn ASensorManager_configureDirectReport( + manager: *mut ASensorManager, + sensor: *const ASensor, + channelId: ::std::os::raw::c_int, + rate: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_registerSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + samplingPeriodUs: i32, + maxBatchReportLatencyUs: i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_enableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_disableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_setEventRate( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + usec: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_hasEvents(queue: *mut ASensorEventQueue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_getEvents( + queue: *mut ASensorEventQueue, + events: *mut ASensorEvent, + count: usize, + ) -> isize; +} +extern "C" { + pub fn ASensorEventQueue_requestAdditionalInfoEvents( + queue: *mut ASensorEventQueue, + enable: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getName(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getVendor(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getType(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getResolution(sensor: *const ASensor) -> f32; +} +extern "C" { + pub fn ASensor_getMinDelay(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoMaxEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoReservedEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getStringType(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getReportingMode(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_isWakeUpSensor(sensor: *const ASensor) -> bool; +} +extern "C" { + pub fn ASensor_isDirectChannelTypeSupported( + sensor: *const ASensor, + channelType: ::std::os::raw::c_int, + ) -> bool; +} +extern "C" { + pub fn ASensor_getHighestDirectReportRateLevel(sensor: *const ASensor) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getHandle(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_set_abort_message(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ASharedMemory_create( + name: *const ::std::os::raw::c_char, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_getSize(fd: ::std::os::raw::c_int) -> usize; +} +extern "C" { + pub fn ASharedMemory_setProt( + fd: ::std::os::raw::c_int, + prot: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_dupFromJava( + env: *mut JNIEnv, + sharedMemory: jobject, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AStorageManager { + _unused: [u8; 0], +} +pub const AOBB_STATE_MOUNTED: _bindgen_ty_36 = 1; +pub const AOBB_STATE_UNMOUNTED: _bindgen_ty_36 = 2; +pub const AOBB_STATE_ERROR_INTERNAL: _bindgen_ty_36 = 20; +pub const AOBB_STATE_ERROR_COULD_NOT_MOUNT: _bindgen_ty_36 = 21; +pub const AOBB_STATE_ERROR_COULD_NOT_UNMOUNT: _bindgen_ty_36 = 22; +pub const AOBB_STATE_ERROR_NOT_MOUNTED: _bindgen_ty_36 = 23; +pub const AOBB_STATE_ERROR_ALREADY_MOUNTED: _bindgen_ty_36 = 24; +pub const AOBB_STATE_ERROR_PERMISSION_DENIED: _bindgen_ty_36 = 25; +pub type _bindgen_ty_36 = u32; +extern "C" { + pub fn AStorageManager_new() -> *mut AStorageManager; +} +extern "C" { + pub fn AStorageManager_delete(mgr: *mut AStorageManager); +} +pub type AStorageManager_obbCallbackFunc = ::std::option::Option< + unsafe extern "C" fn( + filename: *const ::std::os::raw::c_char, + state: i32, + data: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + pub fn AStorageManager_mountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + key: *const ::std::os::raw::c_char, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_unmountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + force: ::std::os::raw::c_int, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_isObbMounted( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AStorageManager_getMountedObbPath( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASurfaceTexture { + _unused: [u8; 0], +} +extern "C" { + pub fn ASurfaceTexture_release(st: *mut ASurfaceTexture); +} +extern "C" { + pub fn ASurfaceTexture_acquireANativeWindow(st: *mut ASurfaceTexture) -> *mut ANativeWindow; +} +extern "C" { + pub fn ASurfaceTexture_attachToGLContext( + st: *mut ASurfaceTexture, + texName: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_detachFromGLContext(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_updateTexImage(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_getTransformMatrix(st: *mut ASurfaceTexture, mtx: *mut f32); +} +extern "C" { + pub fn ASurfaceTexture_getTimestamp(st: *mut ASurfaceTexture) -> i64; +} +extern "C" { + pub fn ASurfaceTexture_fromSurfaceTexture( + env: *mut JNIEnv, + surfacetexture: jobject, + ) -> *mut ASurfaceTexture; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_merge_data { + pub name: [::std::os::raw::c_char; 32usize], + pub fd2: __s32, + pub fence: __s32, + pub flags: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_sync_merge_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(sync_merge_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sync_merge_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd2 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fd2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fence as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_fence_info { + pub obj_name: [::std::os::raw::c_char; 32usize], + pub driver_name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub timestamp_ns: __u64, +} +#[test] +fn bindgen_test_layout_sync_fence_info() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(sync_fence_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sync_fence_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obj_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(obj_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).driver_name as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(driver_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp_ns as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(timestamp_ns) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_file_info { + pub name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub num_fences: __u32, + pub pad: __u32, + pub sync_fence_info: __u64, +} +#[test] +fn bindgen_test_layout_sync_file_info() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(sync_file_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sync_file_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_fences as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(num_fences) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sync_fence_info as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(sync_fence_info) + ) + ); +} +extern "C" { + pub fn sync_merge(name: *const ::std::os::raw::c_char, fd1: i32, fd2: i32) -> i32; +} +extern "C" { + pub fn sync_file_info(fd: i32) -> *mut sync_file_info; +} +extern "C" { + pub fn sync_file_info_free(info: *mut sync_file_info); +} +extern "C" { + pub fn ATrace_isEnabled() -> bool; +} +extern "C" { + pub fn ATrace_beginSection(sectionName: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ATrace_endSection(); +} +extern "C" { + pub fn ATrace_beginAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_endAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_setCounter(counterName: *const ::std::os::raw::c_char, counterValue: i64); +} +pub const AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: _bindgen_ty_37 = 1; +pub const AWINDOW_FLAG_DIM_BEHIND: _bindgen_ty_37 = 2; +pub const AWINDOW_FLAG_BLUR_BEHIND: _bindgen_ty_37 = 4; +pub const AWINDOW_FLAG_NOT_FOCUSABLE: _bindgen_ty_37 = 8; +pub const AWINDOW_FLAG_NOT_TOUCHABLE: _bindgen_ty_37 = 16; +pub const AWINDOW_FLAG_NOT_TOUCH_MODAL: _bindgen_ty_37 = 32; +pub const AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING: _bindgen_ty_37 = 64; +pub const AWINDOW_FLAG_KEEP_SCREEN_ON: _bindgen_ty_37 = 128; +pub const AWINDOW_FLAG_LAYOUT_IN_SCREEN: _bindgen_ty_37 = 256; +pub const AWINDOW_FLAG_LAYOUT_NO_LIMITS: _bindgen_ty_37 = 512; +pub const AWINDOW_FLAG_FULLSCREEN: _bindgen_ty_37 = 1024; +pub const AWINDOW_FLAG_FORCE_NOT_FULLSCREEN: _bindgen_ty_37 = 2048; +pub const AWINDOW_FLAG_DITHER: _bindgen_ty_37 = 4096; +pub const AWINDOW_FLAG_SECURE: _bindgen_ty_37 = 8192; +pub const AWINDOW_FLAG_SCALED: _bindgen_ty_37 = 16384; +pub const AWINDOW_FLAG_IGNORE_CHEEK_PRESSES: _bindgen_ty_37 = 32768; +pub const AWINDOW_FLAG_LAYOUT_INSET_DECOR: _bindgen_ty_37 = 65536; +pub const AWINDOW_FLAG_ALT_FOCUSABLE_IM: _bindgen_ty_37 = 131072; +pub const AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH: _bindgen_ty_37 = 262144; +pub const AWINDOW_FLAG_SHOW_WHEN_LOCKED: _bindgen_ty_37 = 524288; +pub const AWINDOW_FLAG_SHOW_WALLPAPER: _bindgen_ty_37 = 1048576; +pub const AWINDOW_FLAG_TURN_SCREEN_ON: _bindgen_ty_37 = 2097152; +pub const AWINDOW_FLAG_DISMISS_KEYGUARD: _bindgen_ty_37 = 4194304; +pub type _bindgen_ty_37 = u32; +pub type __builtin_va_list = __va_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list { + pub __ap: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout___va_list() { + assert_eq!( + ::std::mem::size_of::<__va_list>(), + 4usize, + concat!("Size of: ", stringify!(__va_list)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list>(), + 4usize, + concat!("Alignment of ", stringify!(__va_list)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list>())).__ap as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list), + "::", + stringify!(__ap) + ) + ); +} diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_i686.rs b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_i686.rs new file mode 100644 index 0000000..b0fcdb0 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_i686.rs @@ -0,0 +1,13560 @@ +/* automatically generated by rust-bindgen */ + +pub const __BIONIC__: u32 = 1; +pub const __WORDSIZE: u32 = 32; +pub const __bos_level: u32 = 0; +pub const __ANDROID_API_FUTURE__: u32 = 10000; +pub const __ANDROID_API__: u32 = 10000; +pub const __ANDROID_API_G__: u32 = 9; +pub const __ANDROID_API_I__: u32 = 14; +pub const __ANDROID_API_J__: u32 = 16; +pub const __ANDROID_API_J_MR1__: u32 = 17; +pub const __ANDROID_API_J_MR2__: u32 = 18; +pub const __ANDROID_API_K__: u32 = 19; +pub const __ANDROID_API_L__: u32 = 21; +pub const __ANDROID_API_L_MR1__: u32 = 22; +pub const __ANDROID_API_M__: u32 = 23; +pub const __ANDROID_API_N__: u32 = 24; +pub const __ANDROID_API_N_MR1__: u32 = 25; +pub const __ANDROID_API_O__: u32 = 26; +pub const __ANDROID_API_O_MR1__: u32 = 27; +pub const __ANDROID_API_P__: u32 = 28; +pub const __ANDROID_API_Q__: u32 = 29; +pub const INT8_MIN: i32 = -128; +pub const INT8_MAX: u32 = 127; +pub const INT_LEAST8_MIN: i32 = -128; +pub const INT_LEAST8_MAX: u32 = 127; +pub const INT_FAST8_MIN: i32 = -128; +pub const INT_FAST8_MAX: u32 = 127; +pub const UINT8_MAX: u32 = 255; +pub const UINT_LEAST8_MAX: u32 = 255; +pub const UINT_FAST8_MAX: u32 = 255; +pub const INT16_MIN: i32 = -32768; +pub const INT16_MAX: u32 = 32767; +pub const INT_LEAST16_MIN: i32 = -32768; +pub const INT_LEAST16_MAX: u32 = 32767; +pub const UINT16_MAX: u32 = 65535; +pub const UINT_LEAST16_MAX: u32 = 65535; +pub const INT32_MIN: i32 = -2147483648; +pub const INT32_MAX: u32 = 2147483647; +pub const INT_LEAST32_MIN: i32 = -2147483648; +pub const INT_LEAST32_MAX: u32 = 2147483647; +pub const INT_FAST32_MIN: i32 = -2147483648; +pub const INT_FAST32_MAX: u32 = 2147483647; +pub const UINT32_MAX: u32 = 4294967295; +pub const UINT_LEAST32_MAX: u32 = 4294967295; +pub const UINT_FAST32_MAX: u32 = 4294967295; +pub const SIG_ATOMIC_MAX: u32 = 2147483647; +pub const SIG_ATOMIC_MIN: i32 = -2147483648; +pub const WINT_MAX: u32 = 4294967295; +pub const WINT_MIN: u32 = 0; +pub const INTPTR_MIN: i32 = -2147483648; +pub const INTPTR_MAX: u32 = 2147483647; +pub const UINTPTR_MAX: u32 = 4294967295; +pub const PTRDIFF_MIN: i32 = -2147483648; +pub const PTRDIFF_MAX: u32 = 2147483647; +pub const SIZE_MAX: u32 = 4294967295; +pub const __BITS_PER_LONG: u32 = 32; +pub const __FD_SETSIZE: u32 = 1024; +pub const __GNUC_VA_LIST: u32 = 1; +pub const JNI_FALSE: u32 = 0; +pub const JNI_TRUE: u32 = 1; +pub const JNI_VERSION_1_1: u32 = 65537; +pub const JNI_VERSION_1_2: u32 = 65538; +pub const JNI_VERSION_1_4: u32 = 65540; +pub const JNI_VERSION_1_6: u32 = 65542; +pub const JNI_OK: u32 = 0; +pub const JNI_ERR: i32 = -1; +pub const JNI_EDETACHED: i32 = -2; +pub const JNI_EVERSION: i32 = -3; +pub const JNI_ENOMEM: i32 = -4; +pub const JNI_EEXIST: i32 = -5; +pub const JNI_EINVAL: i32 = -6; +pub const JNI_COMMIT: u32 = 1; +pub const JNI_ABORT: u32 = 2; +pub const __PRI_64_prefix: &'static [u8; 3usize] = b"ll\0"; +pub const PRId8: &'static [u8; 2usize] = b"d\0"; +pub const PRId16: &'static [u8; 2usize] = b"d\0"; +pub const PRId32: &'static [u8; 2usize] = b"d\0"; +pub const PRId64: &'static [u8; 4usize] = b"lld\0"; +pub const PRIdLEAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST16: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST64: &'static [u8; 4usize] = b"lld\0"; +pub const PRIdFAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdFAST64: &'static [u8; 4usize] = b"lld\0"; +pub const PRIdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const PRIi8: &'static [u8; 2usize] = b"i\0"; +pub const PRIi16: &'static [u8; 2usize] = b"i\0"; +pub const PRIi32: &'static [u8; 2usize] = b"i\0"; +pub const PRIi64: &'static [u8; 4usize] = b"lli\0"; +pub const PRIiLEAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST16: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST64: &'static [u8; 4usize] = b"lli\0"; +pub const PRIiFAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiFAST64: &'static [u8; 4usize] = b"lli\0"; +pub const PRIiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const PRIo8: &'static [u8; 2usize] = b"o\0"; +pub const PRIo16: &'static [u8; 2usize] = b"o\0"; +pub const PRIo32: &'static [u8; 2usize] = b"o\0"; +pub const PRIo64: &'static [u8; 4usize] = b"llo\0"; +pub const PRIoLEAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST16: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST64: &'static [u8; 4usize] = b"llo\0"; +pub const PRIoFAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoFAST64: &'static [u8; 4usize] = b"llo\0"; +pub const PRIoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const PRIu8: &'static [u8; 2usize] = b"u\0"; +pub const PRIu16: &'static [u8; 2usize] = b"u\0"; +pub const PRIu32: &'static [u8; 2usize] = b"u\0"; +pub const PRIu64: &'static [u8; 4usize] = b"llu\0"; +pub const PRIuLEAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST16: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST64: &'static [u8; 4usize] = b"llu\0"; +pub const PRIuFAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuFAST64: &'static [u8; 4usize] = b"llu\0"; +pub const PRIuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const PRIx8: &'static [u8; 2usize] = b"x\0"; +pub const PRIx16: &'static [u8; 2usize] = b"x\0"; +pub const PRIx32: &'static [u8; 2usize] = b"x\0"; +pub const PRIx64: &'static [u8; 4usize] = b"llx\0"; +pub const PRIxLEAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST16: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST64: &'static [u8; 4usize] = b"llx\0"; +pub const PRIxFAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxFAST64: &'static [u8; 4usize] = b"llx\0"; +pub const PRIxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const PRIX8: &'static [u8; 2usize] = b"X\0"; +pub const PRIX16: &'static [u8; 2usize] = b"X\0"; +pub const PRIX32: &'static [u8; 2usize] = b"X\0"; +pub const PRIX64: &'static [u8; 4usize] = b"llX\0"; +pub const PRIXLEAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST16: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST32: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST64: &'static [u8; 4usize] = b"llX\0"; +pub const PRIXFAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXFAST64: &'static [u8; 4usize] = b"llX\0"; +pub const PRIXMAX: &'static [u8; 3usize] = b"jX\0"; +pub const SCNd8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNd16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNd32: &'static [u8; 2usize] = b"d\0"; +pub const SCNd64: &'static [u8; 4usize] = b"lld\0"; +pub const SCNdLEAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdLEAST16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const SCNdLEAST64: &'static [u8; 4usize] = b"lld\0"; +pub const SCNdFAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdFAST64: &'static [u8; 4usize] = b"lld\0"; +pub const SCNdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const SCNi8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNi16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNi32: &'static [u8; 2usize] = b"i\0"; +pub const SCNi64: &'static [u8; 4usize] = b"lli\0"; +pub const SCNiLEAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiLEAST16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const SCNiLEAST64: &'static [u8; 4usize] = b"lli\0"; +pub const SCNiFAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiFAST64: &'static [u8; 4usize] = b"lli\0"; +pub const SCNiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const SCNo8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNo16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNo32: &'static [u8; 2usize] = b"o\0"; +pub const SCNo64: &'static [u8; 4usize] = b"llo\0"; +pub const SCNoLEAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoLEAST16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const SCNoLEAST64: &'static [u8; 4usize] = b"llo\0"; +pub const SCNoFAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoFAST64: &'static [u8; 4usize] = b"llo\0"; +pub const SCNoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const SCNu8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNu16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNu32: &'static [u8; 2usize] = b"u\0"; +pub const SCNu64: &'static [u8; 4usize] = b"llu\0"; +pub const SCNuLEAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuLEAST16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const SCNuLEAST64: &'static [u8; 4usize] = b"llu\0"; +pub const SCNuFAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuFAST64: &'static [u8; 4usize] = b"llu\0"; +pub const SCNuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const SCNx8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNx16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNx32: &'static [u8; 2usize] = b"x\0"; +pub const SCNx64: &'static [u8; 4usize] = b"llx\0"; +pub const SCNxLEAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxLEAST16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const SCNxLEAST64: &'static [u8; 4usize] = b"llx\0"; +pub const SCNxFAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxFAST64: &'static [u8; 4usize] = b"llx\0"; +pub const SCNxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const true_: u32 = 1; +pub const false_: u32 = 0; +pub const __bool_true_false_are_defined: u32 = 1; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; +pub const _K_SS_MAXSIZE: u32 = 128; +pub const O_ACCMODE: u32 = 3; +pub const O_RDONLY: u32 = 0; +pub const O_WRONLY: u32 = 1; +pub const O_RDWR: u32 = 2; +pub const O_CREAT: u32 = 64; +pub const O_EXCL: u32 = 128; +pub const O_NOCTTY: u32 = 256; +pub const O_TRUNC: u32 = 512; +pub const O_APPEND: u32 = 1024; +pub const O_NONBLOCK: u32 = 2048; +pub const O_DSYNC: u32 = 4096; +pub const FASYNC: u32 = 8192; +pub const O_DIRECT: u32 = 16384; +pub const O_LARGEFILE: u32 = 32768; +pub const O_DIRECTORY: u32 = 65536; +pub const O_NOFOLLOW: u32 = 131072; +pub const O_NOATIME: u32 = 262144; +pub const O_CLOEXEC: u32 = 524288; +pub const __O_SYNC: u32 = 1048576; +pub const O_SYNC: u32 = 1052672; +pub const O_PATH: u32 = 2097152; +pub const __O_TMPFILE: u32 = 4194304; +pub const O_TMPFILE: u32 = 4259840; +pub const O_TMPFILE_MASK: u32 = 4259904; +pub const O_NDELAY: u32 = 2048; +pub const F_DUPFD: u32 = 0; +pub const F_GETFD: u32 = 1; +pub const F_SETFD: u32 = 2; +pub const F_GETFL: u32 = 3; +pub const F_SETFL: u32 = 4; +pub const F_GETLK: u32 = 5; +pub const F_SETLK: u32 = 6; +pub const F_SETLKW: u32 = 7; +pub const F_SETOWN: u32 = 8; +pub const F_GETOWN: u32 = 9; +pub const F_SETSIG: u32 = 10; +pub const F_GETSIG: u32 = 11; +pub const F_GETLK64: u32 = 12; +pub const F_SETLK64: u32 = 13; +pub const F_SETLKW64: u32 = 14; +pub const F_SETOWN_EX: u32 = 15; +pub const F_GETOWN_EX: u32 = 16; +pub const F_GETOWNER_UIDS: u32 = 17; +pub const F_OFD_GETLK: u32 = 36; +pub const F_OFD_SETLK: u32 = 37; +pub const F_OFD_SETLKW: u32 = 38; +pub const F_OWNER_TID: u32 = 0; +pub const F_OWNER_PID: u32 = 1; +pub const F_OWNER_PGRP: u32 = 2; +pub const FD_CLOEXEC: u32 = 1; +pub const F_RDLCK: u32 = 0; +pub const F_WRLCK: u32 = 1; +pub const F_UNLCK: u32 = 2; +pub const F_EXLCK: u32 = 4; +pub const F_SHLCK: u32 = 8; +pub const LOCK_SH: u32 = 1; +pub const LOCK_EX: u32 = 2; +pub const LOCK_NB: u32 = 4; +pub const LOCK_UN: u32 = 8; +pub const LOCK_MAND: u32 = 32; +pub const LOCK_READ: u32 = 64; +pub const LOCK_WRITE: u32 = 128; +pub const LOCK_RW: u32 = 192; +pub const F_LINUX_SPECIFIC_BASE: u32 = 1024; +pub const FIOSETOWN: u32 = 35073; +pub const SIOCSPGRP: u32 = 35074; +pub const FIOGETOWN: u32 = 35075; +pub const SIOCGPGRP: u32 = 35076; +pub const SIOCATMARK: u32 = 35077; +pub const SIOCGSTAMP: u32 = 35078; +pub const SIOCGSTAMPNS: u32 = 35079; +pub const SOL_SOCKET: u32 = 1; +pub const SO_DEBUG: u32 = 1; +pub const SO_REUSEADDR: u32 = 2; +pub const SO_TYPE: u32 = 3; +pub const SO_ERROR: u32 = 4; +pub const SO_DONTROUTE: u32 = 5; +pub const SO_BROADCAST: u32 = 6; +pub const SO_SNDBUF: u32 = 7; +pub const SO_RCVBUF: u32 = 8; +pub const SO_SNDBUFFORCE: u32 = 32; +pub const SO_RCVBUFFORCE: u32 = 33; +pub const SO_KEEPALIVE: u32 = 9; +pub const SO_OOBINLINE: u32 = 10; +pub const SO_NO_CHECK: u32 = 11; +pub const SO_PRIORITY: u32 = 12; +pub const SO_LINGER: u32 = 13; +pub const SO_BSDCOMPAT: u32 = 14; +pub const SO_REUSEPORT: u32 = 15; +pub const SO_PASSCRED: u32 = 16; +pub const SO_PEERCRED: u32 = 17; +pub const SO_RCVLOWAT: u32 = 18; +pub const SO_SNDLOWAT: u32 = 19; +pub const SO_RCVTIMEO: u32 = 20; +pub const SO_SNDTIMEO: u32 = 21; +pub const SO_SECURITY_AUTHENTICATION: u32 = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: u32 = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: u32 = 24; +pub const SO_BINDTODEVICE: u32 = 25; +pub const SO_ATTACH_FILTER: u32 = 26; +pub const SO_DETACH_FILTER: u32 = 27; +pub const SO_GET_FILTER: u32 = 26; +pub const SO_PEERNAME: u32 = 28; +pub const SO_TIMESTAMP: u32 = 29; +pub const SCM_TIMESTAMP: u32 = 29; +pub const SO_ACCEPTCONN: u32 = 30; +pub const SO_PEERSEC: u32 = 31; +pub const SO_PASSSEC: u32 = 34; +pub const SO_TIMESTAMPNS: u32 = 35; +pub const SCM_TIMESTAMPNS: u32 = 35; +pub const SO_MARK: u32 = 36; +pub const SO_TIMESTAMPING: u32 = 37; +pub const SCM_TIMESTAMPING: u32 = 37; +pub const SO_PROTOCOL: u32 = 38; +pub const SO_DOMAIN: u32 = 39; +pub const SO_RXQ_OVFL: u32 = 40; +pub const SO_WIFI_STATUS: u32 = 41; +pub const SCM_WIFI_STATUS: u32 = 41; +pub const SO_PEEK_OFF: u32 = 42; +pub const SO_NOFCS: u32 = 43; +pub const SO_LOCK_FILTER: u32 = 44; +pub const SO_SELECT_ERR_QUEUE: u32 = 45; +pub const SO_BUSY_POLL: u32 = 46; +pub const SO_MAX_PACING_RATE: u32 = 47; +pub const SO_BPF_EXTENSIONS: u32 = 48; +pub const SO_INCOMING_CPU: u32 = 49; +pub const SO_ATTACH_BPF: u32 = 50; +pub const SO_DETACH_BPF: u32 = 27; +pub const SO_ATTACH_REUSEPORT_CBPF: u32 = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: u32 = 52; +pub const SO_CNX_ADVICE: u32 = 53; +pub const SCM_TIMESTAMPING_OPT_STATS: u32 = 54; +pub const SO_MEMINFO: u32 = 55; +pub const SO_INCOMING_NAPI_ID: u32 = 56; +pub const SO_COOKIE: u32 = 57; +pub const SCM_TIMESTAMPING_PKTINFO: u32 = 58; +pub const SO_PEERGROUPS: u32 = 59; +pub const SO_ZEROCOPY: u32 = 60; +pub const SO_TXTIME: u32 = 61; +pub const SCM_TXTIME: u32 = 61; +pub const SOCK_IOC_TYPE: u32 = 137; +pub const SIOCADDRT: u32 = 35083; +pub const SIOCDELRT: u32 = 35084; +pub const SIOCRTMSG: u32 = 35085; +pub const SIOCGIFNAME: u32 = 35088; +pub const SIOCSIFLINK: u32 = 35089; +pub const SIOCGIFCONF: u32 = 35090; +pub const SIOCGIFFLAGS: u32 = 35091; +pub const SIOCSIFFLAGS: u32 = 35092; +pub const SIOCGIFADDR: u32 = 35093; +pub const SIOCSIFADDR: u32 = 35094; +pub const SIOCGIFDSTADDR: u32 = 35095; +pub const SIOCSIFDSTADDR: u32 = 35096; +pub const SIOCGIFBRDADDR: u32 = 35097; +pub const SIOCSIFBRDADDR: u32 = 35098; +pub const SIOCGIFNETMASK: u32 = 35099; +pub const SIOCSIFNETMASK: u32 = 35100; +pub const SIOCGIFMETRIC: u32 = 35101; +pub const SIOCSIFMETRIC: u32 = 35102; +pub const SIOCGIFMEM: u32 = 35103; +pub const SIOCSIFMEM: u32 = 35104; +pub const SIOCGIFMTU: u32 = 35105; +pub const SIOCSIFMTU: u32 = 35106; +pub const SIOCSIFNAME: u32 = 35107; +pub const SIOCSIFHWADDR: u32 = 35108; +pub const SIOCGIFENCAP: u32 = 35109; +pub const SIOCSIFENCAP: u32 = 35110; +pub const SIOCGIFHWADDR: u32 = 35111; +pub const SIOCGIFSLAVE: u32 = 35113; +pub const SIOCSIFSLAVE: u32 = 35120; +pub const SIOCADDMULTI: u32 = 35121; +pub const SIOCDELMULTI: u32 = 35122; +pub const SIOCGIFINDEX: u32 = 35123; +pub const SIOGIFINDEX: u32 = 35123; +pub const SIOCSIFPFLAGS: u32 = 35124; +pub const SIOCGIFPFLAGS: u32 = 35125; +pub const SIOCDIFADDR: u32 = 35126; +pub const SIOCSIFHWBROADCAST: u32 = 35127; +pub const SIOCGIFCOUNT: u32 = 35128; +pub const SIOCGIFBR: u32 = 35136; +pub const SIOCSIFBR: u32 = 35137; +pub const SIOCGIFTXQLEN: u32 = 35138; +pub const SIOCSIFTXQLEN: u32 = 35139; +pub const SIOCETHTOOL: u32 = 35142; +pub const SIOCGMIIPHY: u32 = 35143; +pub const SIOCGMIIREG: u32 = 35144; +pub const SIOCSMIIREG: u32 = 35145; +pub const SIOCWANDEV: u32 = 35146; +pub const SIOCOUTQNSD: u32 = 35147; +pub const SIOCGSKNS: u32 = 35148; +pub const SIOCDARP: u32 = 35155; +pub const SIOCGARP: u32 = 35156; +pub const SIOCSARP: u32 = 35157; +pub const SIOCDRARP: u32 = 35168; +pub const SIOCGRARP: u32 = 35169; +pub const SIOCSRARP: u32 = 35170; +pub const SIOCGIFMAP: u32 = 35184; +pub const SIOCSIFMAP: u32 = 35185; +pub const SIOCADDDLCI: u32 = 35200; +pub const SIOCDELDLCI: u32 = 35201; +pub const SIOCGIFVLAN: u32 = 35202; +pub const SIOCSIFVLAN: u32 = 35203; +pub const SIOCBONDENSLAVE: u32 = 35216; +pub const SIOCBONDRELEASE: u32 = 35217; +pub const SIOCBONDSETHWADDR: u32 = 35218; +pub const SIOCBONDSLAVEINFOQUERY: u32 = 35219; +pub const SIOCBONDINFOQUERY: u32 = 35220; +pub const SIOCBONDCHANGEACTIVE: u32 = 35221; +pub const SIOCBRADDBR: u32 = 35232; +pub const SIOCBRDELBR: u32 = 35233; +pub const SIOCBRADDIF: u32 = 35234; +pub const SIOCBRDELIF: u32 = 35235; +pub const SIOCSHWTSTAMP: u32 = 35248; +pub const SIOCGHWTSTAMP: u32 = 35249; +pub const SIOCDEVPRIVATE: u32 = 35312; +pub const SIOCPROTOPRIVATE: u32 = 35296; +pub const UIO_FASTIOV: u32 = 8; +pub const UIO_MAXIOV: u32 = 1024; +pub const SOCK_STREAM: u32 = 1; +pub const SOCK_DGRAM: u32 = 2; +pub const SOCK_RAW: u32 = 3; +pub const SOCK_RDM: u32 = 4; +pub const SOCK_SEQPACKET: u32 = 5; +pub const SOCK_DCCP: u32 = 6; +pub const SOCK_PACKET: u32 = 10; +pub const SOCK_CLOEXEC: u32 = 524288; +pub const SOCK_NONBLOCK: u32 = 2048; +pub const SCM_RIGHTS: u32 = 1; +pub const SCM_CREDENTIALS: u32 = 2; +pub const SCM_SECURITY: u32 = 3; +pub const AF_UNSPEC: u32 = 0; +pub const AF_UNIX: u32 = 1; +pub const AF_LOCAL: u32 = 1; +pub const AF_INET: u32 = 2; +pub const AF_AX25: u32 = 3; +pub const AF_IPX: u32 = 4; +pub const AF_APPLETALK: u32 = 5; +pub const AF_NETROM: u32 = 6; +pub const AF_BRIDGE: u32 = 7; +pub const AF_ATMPVC: u32 = 8; +pub const AF_X25: u32 = 9; +pub const AF_INET6: u32 = 10; +pub const AF_ROSE: u32 = 11; +pub const AF_DECnet: u32 = 12; +pub const AF_NETBEUI: u32 = 13; +pub const AF_SECURITY: u32 = 14; +pub const AF_KEY: u32 = 15; +pub const AF_NETLINK: u32 = 16; +pub const AF_ROUTE: u32 = 16; +pub const AF_PACKET: u32 = 17; +pub const AF_ASH: u32 = 18; +pub const AF_ECONET: u32 = 19; +pub const AF_ATMSVC: u32 = 20; +pub const AF_RDS: u32 = 21; +pub const AF_SNA: u32 = 22; +pub const AF_IRDA: u32 = 23; +pub const AF_PPPOX: u32 = 24; +pub const AF_WANPIPE: u32 = 25; +pub const AF_LLC: u32 = 26; +pub const AF_CAN: u32 = 29; +pub const AF_TIPC: u32 = 30; +pub const AF_BLUETOOTH: u32 = 31; +pub const AF_IUCV: u32 = 32; +pub const AF_RXRPC: u32 = 33; +pub const AF_ISDN: u32 = 34; +pub const AF_PHONET: u32 = 35; +pub const AF_IEEE802154: u32 = 36; +pub const AF_CAIF: u32 = 37; +pub const AF_ALG: u32 = 38; +pub const AF_NFC: u32 = 39; +pub const AF_VSOCK: u32 = 40; +pub const AF_KCM: u32 = 41; +pub const AF_QIPCRTR: u32 = 42; +pub const AF_MAX: u32 = 43; +pub const PF_UNSPEC: u32 = 0; +pub const PF_UNIX: u32 = 1; +pub const PF_LOCAL: u32 = 1; +pub const PF_INET: u32 = 2; +pub const PF_AX25: u32 = 3; +pub const PF_IPX: u32 = 4; +pub const PF_APPLETALK: u32 = 5; +pub const PF_NETROM: u32 = 6; +pub const PF_BRIDGE: u32 = 7; +pub const PF_ATMPVC: u32 = 8; +pub const PF_X25: u32 = 9; +pub const PF_INET6: u32 = 10; +pub const PF_ROSE: u32 = 11; +pub const PF_DECnet: u32 = 12; +pub const PF_NETBEUI: u32 = 13; +pub const PF_SECURITY: u32 = 14; +pub const PF_KEY: u32 = 15; +pub const PF_NETLINK: u32 = 16; +pub const PF_ROUTE: u32 = 16; +pub const PF_PACKET: u32 = 17; +pub const PF_ASH: u32 = 18; +pub const PF_ECONET: u32 = 19; +pub const PF_ATMSVC: u32 = 20; +pub const PF_RDS: u32 = 21; +pub const PF_SNA: u32 = 22; +pub const PF_IRDA: u32 = 23; +pub const PF_PPPOX: u32 = 24; +pub const PF_WANPIPE: u32 = 25; +pub const PF_LLC: u32 = 26; +pub const PF_CAN: u32 = 29; +pub const PF_TIPC: u32 = 30; +pub const PF_BLUETOOTH: u32 = 31; +pub const PF_IUCV: u32 = 32; +pub const PF_RXRPC: u32 = 33; +pub const PF_ISDN: u32 = 34; +pub const PF_PHONET: u32 = 35; +pub const PF_IEEE802154: u32 = 36; +pub const PF_CAIF: u32 = 37; +pub const PF_ALG: u32 = 38; +pub const PF_NFC: u32 = 39; +pub const PF_VSOCK: u32 = 40; +pub const PF_KCM: u32 = 41; +pub const PF_QIPCRTR: u32 = 42; +pub const PF_MAX: u32 = 43; +pub const SOMAXCONN: u32 = 128; +pub const MSG_OOB: u32 = 1; +pub const MSG_PEEK: u32 = 2; +pub const MSG_DONTROUTE: u32 = 4; +pub const MSG_TRYHARD: u32 = 4; +pub const MSG_CTRUNC: u32 = 8; +pub const MSG_PROBE: u32 = 16; +pub const MSG_TRUNC: u32 = 32; +pub const MSG_DONTWAIT: u32 = 64; +pub const MSG_EOR: u32 = 128; +pub const MSG_WAITALL: u32 = 256; +pub const MSG_FIN: u32 = 512; +pub const MSG_SYN: u32 = 1024; +pub const MSG_CONFIRM: u32 = 2048; +pub const MSG_RST: u32 = 4096; +pub const MSG_ERRQUEUE: u32 = 8192; +pub const MSG_NOSIGNAL: u32 = 16384; +pub const MSG_MORE: u32 = 32768; +pub const MSG_WAITFORONE: u32 = 65536; +pub const MSG_BATCH: u32 = 262144; +pub const MSG_FASTOPEN: u32 = 536870912; +pub const MSG_CMSG_CLOEXEC: u32 = 1073741824; +pub const MSG_EOF: u32 = 512; +pub const MSG_CMSG_COMPAT: u32 = 0; +pub const SOL_IP: u32 = 0; +pub const SOL_TCP: u32 = 6; +pub const SOL_UDP: u32 = 17; +pub const SOL_IPV6: u32 = 41; +pub const SOL_ICMPV6: u32 = 58; +pub const SOL_SCTP: u32 = 132; +pub const SOL_RAW: u32 = 255; +pub const SOL_IPX: u32 = 256; +pub const SOL_AX25: u32 = 257; +pub const SOL_ATALK: u32 = 258; +pub const SOL_NETROM: u32 = 259; +pub const SOL_ROSE: u32 = 260; +pub const SOL_DECNET: u32 = 261; +pub const SOL_X25: u32 = 262; +pub const SOL_PACKET: u32 = 263; +pub const SOL_ATM: u32 = 264; +pub const SOL_AAL: u32 = 265; +pub const SOL_IRDA: u32 = 266; +pub const SOL_NETBEUI: u32 = 267; +pub const SOL_LLC: u32 = 268; +pub const SOL_DCCP: u32 = 269; +pub const SOL_NETLINK: u32 = 270; +pub const SOL_TIPC: u32 = 271; +pub const SOL_RXRPC: u32 = 272; +pub const SOL_PPPOL2TP: u32 = 273; +pub const SOL_BLUETOOTH: u32 = 274; +pub const SOL_PNPIPE: u32 = 275; +pub const SOL_RDS: u32 = 276; +pub const SOL_IUCV: u32 = 277; +pub const SOL_CAIF: u32 = 278; +pub const SOL_ALG: u32 = 279; +pub const SOL_NFC: u32 = 280; +pub const SOL_KCM: u32 = 281; +pub const SOL_TLS: u32 = 282; +pub const IPX_TYPE: u32 = 1; +pub const _PATH_HEQUIV: &'static [u8; 24usize] = b"/system/etc/hosts.equiv\0"; +pub const _PATH_HOSTS: &'static [u8; 18usize] = b"/system/etc/hosts\0"; +pub const _PATH_NETWORKS: &'static [u8; 21usize] = b"/system/etc/networks\0"; +pub const _PATH_PROTOCOLS: &'static [u8; 22usize] = b"/system/etc/protocols\0"; +pub const _PATH_SERVICES: &'static [u8; 21usize] = b"/system/etc/services\0"; +pub const NETDB_INTERNAL: i32 = -1; +pub const NETDB_SUCCESS: u32 = 0; +pub const HOST_NOT_FOUND: u32 = 1; +pub const TRY_AGAIN: u32 = 2; +pub const NO_RECOVERY: u32 = 3; +pub const NO_DATA: u32 = 4; +pub const NO_ADDRESS: u32 = 4; +pub const EAI_ADDRFAMILY: u32 = 1; +pub const EAI_AGAIN: u32 = 2; +pub const EAI_BADFLAGS: u32 = 3; +pub const EAI_FAIL: u32 = 4; +pub const EAI_FAMILY: u32 = 5; +pub const EAI_MEMORY: u32 = 6; +pub const EAI_NODATA: u32 = 7; +pub const EAI_NONAME: u32 = 8; +pub const EAI_SERVICE: u32 = 9; +pub const EAI_SOCKTYPE: u32 = 10; +pub const EAI_SYSTEM: u32 = 11; +pub const EAI_BADHINTS: u32 = 12; +pub const EAI_PROTOCOL: u32 = 13; +pub const EAI_OVERFLOW: u32 = 14; +pub const EAI_MAX: u32 = 15; +pub const AI_PASSIVE: u32 = 1; +pub const AI_CANONNAME: u32 = 2; +pub const AI_NUMERICHOST: u32 = 4; +pub const AI_NUMERICSERV: u32 = 8; +pub const AI_ALL: u32 = 256; +pub const AI_V4MAPPED_CFG: u32 = 512; +pub const AI_ADDRCONFIG: u32 = 1024; +pub const AI_V4MAPPED: u32 = 2048; +pub const AI_DEFAULT: u32 = 1536; +pub const NI_MAXHOST: u32 = 1025; +pub const NI_MAXSERV: u32 = 32; +pub const NI_NOFQDN: u32 = 1; +pub const NI_NUMERICHOST: u32 = 2; +pub const NI_NAMEREQD: u32 = 4; +pub const NI_NUMERICSERV: u32 = 8; +pub const NI_DGRAM: u32 = 16; +pub const SCOPE_DELIMITER: u8 = 37u8; +pub const IPPORT_RESERVED: u32 = 1024; +pub const WNOHANG: u32 = 1; +pub const WUNTRACED: u32 = 2; +pub const WSTOPPED: u32 = 2; +pub const WEXITED: u32 = 4; +pub const WCONTINUED: u32 = 8; +pub const WNOWAIT: u32 = 16777216; +pub const __WNOTHREAD: u32 = 536870912; +pub const __WALL: u32 = 1073741824; +pub const __WCLONE: u32 = 2147483648; +pub const P_ALL: u32 = 0; +pub const P_PID: u32 = 1; +pub const P_PGID: u32 = 2; +pub const SEEK_SET: u32 = 0; +pub const SEEK_CUR: u32 = 1; +pub const SEEK_END: u32 = 2; +pub const _IOFBF: u32 = 0; +pub const _IOLBF: u32 = 1; +pub const _IONBF: u32 = 2; +pub const BUFSIZ: u32 = 1024; +pub const EOF: i32 = -1; +pub const FOPEN_MAX: u32 = 20; +pub const FILENAME_MAX: u32 = 4096; +pub const L_tmpnam: u32 = 4096; +pub const TMP_MAX: u32 = 308915776; +pub const P_tmpdir: &'static [u8; 6usize] = b"/tmp/\0"; +pub const L_ctermid: u32 = 1024; +pub const STRUCT_MALLINFO_DECLARED: u32 = 1; +pub const M_DECAY_TIME: i32 = -100; +pub const M_PURGE: i32 = -101; +pub const EXIT_FAILURE: u32 = 1; +pub const EXIT_SUCCESS: u32 = 0; +pub const RAND_MAX: u32 = 2147483647; +pub const __NDK_MAJOR__: u32 = 20; +pub const __NDK_MINOR__: u32 = 0; +pub const __NDK_BETA__: u32 = 0; +pub const __NDK_BUILD__: u32 = 5594570; +pub const __NDK_CANARY__: u32 = 0; +pub const NR_OPEN: u32 = 1024; +pub const NGROUPS_MAX: u32 = 65536; +pub const ARG_MAX: u32 = 131072; +pub const LINK_MAX: u32 = 127; +pub const MAX_CANON: u32 = 255; +pub const MAX_INPUT: u32 = 255; +pub const NAME_MAX: u32 = 255; +pub const PATH_MAX: u32 = 4096; +pub const PIPE_BUF: u32 = 4096; +pub const XATTR_NAME_MAX: u32 = 255; +pub const XATTR_SIZE_MAX: u32 = 65536; +pub const XATTR_LIST_MAX: u32 = 65536; +pub const RTSIG_MAX: u32 = 32; +pub const PASS_MAX: u32 = 128; +pub const NL_ARGMAX: u32 = 9; +pub const NL_LANGMAX: u32 = 14; +pub const NL_MSGMAX: u32 = 32767; +pub const NL_NMAX: u32 = 1; +pub const NL_SETMAX: u32 = 255; +pub const NL_TEXTMAX: u32 = 255; +pub const CHAR_BIT: u32 = 8; +pub const LONG_BIT: u32 = 32; +pub const WORD_BIT: u32 = 32; +pub const SCHAR_MAX: u32 = 127; +pub const SCHAR_MIN: i32 = -128; +pub const UCHAR_MAX: u32 = 255; +pub const CHAR_MAX: u32 = 127; +pub const CHAR_MIN: i32 = -128; +pub const USHRT_MAX: u32 = 65535; +pub const SHRT_MAX: u32 = 32767; +pub const SHRT_MIN: i32 = -32768; +pub const UINT_MAX: u32 = 4294967295; +pub const INT_MAX: u32 = 2147483647; +pub const INT_MIN: i32 = -2147483648; +pub const ULONG_MAX: u32 = 4294967295; +pub const LONG_MAX: u32 = 2147483647; +pub const LONG_MIN: i32 = -2147483648; +pub const ULLONG_MAX: i32 = -1; +pub const LLONG_MAX: u64 = 9223372036854775807; +pub const LLONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MAX: u64 = 9223372036854775807; +pub const ULONG_LONG_MAX: i32 = -1; +pub const UID_MAX: u32 = 4294967295; +pub const GID_MAX: u32 = 4294967295; +pub const SIZE_T_MAX: u32 = 4294967295; +pub const SSIZE_MAX: u32 = 2147483647; +pub const MB_LEN_MAX: u32 = 4; +pub const NZERO: u32 = 20; +pub const IOV_MAX: u32 = 1024; +pub const SEM_VALUE_MAX: u32 = 1073741823; +pub const _POSIX_VERSION: u32 = 200809; +pub const _POSIX2_VERSION: u32 = 200809; +pub const _XOPEN_VERSION: u32 = 700; +pub const __BIONIC_POSIX_FEATURE_MISSING: i32 = -1; +pub const _POSIX_ASYNCHRONOUS_IO: i32 = -1; +pub const _POSIX_CHOWN_RESTRICTED: u32 = 1; +pub const _POSIX_CPUTIME: u32 = 200809; +pub const _POSIX_FSYNC: u32 = 200809; +pub const _POSIX_IPV6: u32 = 200809; +pub const _POSIX_MAPPED_FILES: u32 = 200809; +pub const _POSIX_MEMLOCK_RANGE: u32 = 200809; +pub const _POSIX_MEMORY_PROTECTION: u32 = 200809; +pub const _POSIX_MESSAGE_PASSING: i32 = -1; +pub const _POSIX_MONOTONIC_CLOCK: u32 = 200809; +pub const _POSIX_NO_TRUNC: u32 = 1; +pub const _POSIX_PRIORITIZED_IO: i32 = -1; +pub const _POSIX_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_RAW_SOCKETS: u32 = 200809; +pub const _POSIX_READER_WRITER_LOCKS: u32 = 200809; +pub const _POSIX_REGEXP: u32 = 1; +pub const _POSIX_SAVED_IDS: u32 = 1; +pub const _POSIX_SEMAPHORES: u32 = 200809; +pub const _POSIX_SHARED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_SHELL: u32 = 1; +pub const _POSIX_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_SYNCHRONIZED_IO: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKADDR: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKSIZE: u32 = 200809; +pub const _POSIX_THREAD_CPUTIME: u32 = 200809; +pub const _POSIX_THREAD_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_THREAD_PROCESS_SHARED: u32 = 200809; +pub const _POSIX_THREAD_ROBUST_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_ROBUST_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_SAFE_FUNCTIONS: u32 = 200809; +pub const _POSIX_THREAD_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_THREADS: u32 = 200809; +pub const _POSIX_TIMERS: u32 = 200809; +pub const _POSIX_TRACE: i32 = -1; +pub const _POSIX_TRACE_EVENT_FILTER: i32 = -1; +pub const _POSIX_TRACE_INHERIT: i32 = -1; +pub const _POSIX_TRACE_LOG: i32 = -1; +pub const _POSIX_TYPED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_VDISABLE: u8 = 0u8; +pub const _POSIX2_C_BIND: u32 = 200809; +pub const _POSIX2_C_DEV: i32 = -1; +pub const _POSIX2_CHAR_TERM: u32 = 200809; +pub const _POSIX2_FORT_DEV: i32 = -1; +pub const _POSIX2_FORT_RUN: i32 = -1; +pub const _POSIX2_LOCALEDEF: i32 = -1; +pub const _POSIX2_SW_DEV: i32 = -1; +pub const _POSIX2_UPE: i32 = -1; +pub const _POSIX_V7_ILP32_OFF32: u32 = 1; +pub const _POSIX_V7_ILP32_OFFBIG: i32 = -1; +pub const _POSIX_V7_LP64_OFF64: i32 = -1; +pub const _POSIX_V7_LPBIG_OFFBIG: i32 = -1; +pub const _XOPEN_CRYPT: i32 = -1; +pub const _XOPEN_ENH_I18N: u32 = 1; +pub const _XOPEN_LEGACY: i32 = -1; +pub const _XOPEN_REALTIME: u32 = 1; +pub const _XOPEN_REALTIME_THREADS: u32 = 1; +pub const _XOPEN_SHM: u32 = 1; +pub const _XOPEN_STREAMS: i32 = -1; +pub const _XOPEN_UNIX: u32 = 1; +pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; +pub const _POSIX_AIO_MAX: u32 = 1; +pub const _POSIX_ARG_MAX: u32 = 4096; +pub const _POSIX_CHILD_MAX: u32 = 25; +pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; +pub const _POSIX_DELAYTIMER_MAX: u32 = 32; +pub const _POSIX_HOST_NAME_MAX: u32 = 255; +pub const _POSIX_LINK_MAX: u32 = 8; +pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; +pub const _POSIX_MAX_CANON: u32 = 255; +pub const _POSIX_MAX_INPUT: u32 = 255; +pub const _POSIX_MQ_OPEN_MAX: u32 = 8; +pub const _POSIX_MQ_PRIO_MAX: u32 = 32; +pub const _POSIX_NAME_MAX: u32 = 14; +pub const _POSIX_NGROUPS_MAX: u32 = 8; +pub const _POSIX_OPEN_MAX: u32 = 20; +pub const _POSIX_PATH_MAX: u32 = 256; +pub const _POSIX_PIPE_BUF: u32 = 512; +pub const _POSIX_RE_DUP_MAX: u32 = 255; +pub const _POSIX_RTSIG_MAX: u32 = 8; +pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; +pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; +pub const _POSIX_SIGQUEUE_MAX: u32 = 32; +pub const _POSIX_SSIZE_MAX: u32 = 32767; +pub const _POSIX_STREAM_MAX: u32 = 8; +pub const _POSIX_SS_REPL_MAX: u32 = 4; +pub const _POSIX_SYMLINK_MAX: u32 = 255; +pub const _POSIX_SYMLOOP_MAX: u32 = 8; +pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; +pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; +pub const _POSIX_TIMER_MAX: u32 = 32; +pub const _POSIX_TRACE_EVENT_NAME_MAX: u32 = 30; +pub const _POSIX_TRACE_NAME_MAX: u32 = 8; +pub const _POSIX_TRACE_SYS_MAX: u32 = 8; +pub const _POSIX_TRACE_USER_EVENT_MAX: u32 = 32; +pub const _POSIX_TTY_NAME_MAX: u32 = 9; +pub const _POSIX_TZNAME_MAX: u32 = 6; +pub const _POSIX2_BC_BASE_MAX: u32 = 99; +pub const _POSIX2_BC_DIM_MAX: u32 = 2048; +pub const _POSIX2_BC_SCALE_MAX: u32 = 99; +pub const _POSIX2_BC_STRING_MAX: u32 = 1000; +pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; +pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; +pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; +pub const _POSIX2_LINE_MAX: u32 = 2048; +pub const _POSIX2_RE_DUP_MAX: u32 = 255; +pub const _XOPEN_IOV_MAX: u32 = 16; +pub const _XOPEN_NAME_MAX: u32 = 255; +pub const _XOPEN_PATH_MAX: u32 = 1024; +pub const HOST_NAME_MAX: u32 = 255; +pub const LOGIN_NAME_MAX: u32 = 256; +pub const TTY_NAME_MAX: u32 = 32; +pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const PTHREAD_KEYS_MAX: u32 = 128; +pub const FP_INFINITE: u32 = 1; +pub const FP_NAN: u32 = 2; +pub const FP_NORMAL: u32 = 4; +pub const FP_SUBNORMAL: u32 = 8; +pub const FP_ZERO: u32 = 16; +pub const FP_ILOGB0: i32 = -2147483647; +pub const FP_ILOGBNAN: u32 = 2147483647; +pub const MATH_ERRNO: u32 = 1; +pub const MATH_ERREXCEPT: u32 = 2; +pub const math_errhandling: u32 = 2; +pub const M_E: f64 = 2.718281828459045; +pub const M_LOG2E: f64 = 1.4426950408889634; +pub const M_LOG10E: f64 = 0.4342944819032518; +pub const M_LN2: f64 = 0.6931471805599453; +pub const M_LN10: f64 = 2.302585092994046; +pub const M_PI: f64 = 3.141592653589793; +pub const M_PI_2: f64 = 1.5707963267948966; +pub const M_PI_4: f64 = 0.7853981633974483; +pub const M_1_PI: f64 = 0.3183098861837907; +pub const M_2_PI: f64 = 0.6366197723675814; +pub const M_2_SQRTPI: f64 = 1.1283791670955126; +pub const M_SQRT2: f64 = 1.4142135623730951; +pub const M_SQRT1_2: f64 = 0.7071067811865476; +pub const ASENSOR_FIFO_COUNT_INVALID: i32 = -1; +pub const ASENSOR_DELAY_INVALID: i32 = -2147483648; +pub const ASENSOR_INVALID: i32 = -1; +pub const ASENSOR_STANDARD_GRAVITY: f64 = 9.80665; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MAX: f64 = 60.0; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MIN: f64 = 30.0; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const SYNC_IOC_MAGIC: u8 = 62u8; +extern "C" { + pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_get_device_api_level() -> ::std::os::raw::c_int; +} +pub type wchar_t = ::std::os::raw::c_int; +#[repr(C)] +#[repr(align(8))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __clang_max_align_nonce2: f64, +} +#[test] +fn bindgen_test_layout_max_align_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_longlong; +pub type __uint64_t = ::std::os::raw::c_ulonglong; +pub type __intptr_t = ::std::os::raw::c_int; +pub type __uintptr_t = ::std::os::raw::c_uint; +pub type int_least8_t = i8; +pub type uint_least8_t = u8; +pub type int_least16_t = i16; +pub type uint_least16_t = u16; +pub type int_least32_t = i32; +pub type uint_least32_t = u32; +pub type int_least64_t = i64; +pub type uint_least64_t = u64; +pub type int_fast8_t = i8; +pub type uint_fast8_t = u8; +pub type int_fast64_t = i64; +pub type uint_fast64_t = u64; +pub type int_fast16_t = i32; +pub type uint_fast16_t = u32; +pub type int_fast32_t = i32; +pub type uint_fast32_t = u32; +pub type uintmax_t = u64; +pub type intmax_t = i64; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 32usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_mode_t = ::std::os::raw::c_ushort; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_ushort; +pub type __kernel_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ushort; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_old_uid_t = __kernel_uid_t; +pub type __kernel_old_gid_t = __kernel_gid_t; +pub type __kernel_size_t = ::std::os::raw::c_uint; +pub type __kernel_ssize_t = ::std::os::raw::c_int; +pub type __kernel_ptrdiff_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_attr_t { + pub flags: u32, + pub stack_base: *mut ::std::os::raw::c_void, + pub stack_size: usize, + pub guard_size: usize, + pub sched_policy: i32, + pub sched_priority: i32, +} +#[test] +fn bindgen_test_layout_pthread_attr_t() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(pthread_attr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_attr_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(guard_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_priority) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_barrier_t { + pub __private: [i32; 8usize], +} +#[test] +fn bindgen_test_layout_pthread_barrier_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrier_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_barrierattr_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_cond_t { + pub __private: [i32; 1usize], +} +#[test] +fn bindgen_test_layout_pthread_cond_t() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_cond_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_cond_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_condattr_t = ::std::os::raw::c_long; +pub type pthread_key_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_mutex_t { + pub __private: [i32; 1usize], +} +#[test] +fn bindgen_test_layout_pthread_mutex_t() { + assert_eq!( + ::std::mem::size_of::(), + 4usize, + concat!("Size of: ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_mutexattr_t = ::std::os::raw::c_long; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_rwlock_t { + pub __private: [i32; 10usize], +} +#[test] +fn bindgen_test_layout_pthread_rwlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_rwlockattr_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_spinlock_t { + pub __private: [i32; 2usize], +} +#[test] +fn bindgen_test_layout_pthread_spinlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_spinlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_t = ::std::os::raw::c_long; +pub type __gid_t = __kernel_gid32_t; +pub type gid_t = __gid_t; +pub type __uid_t = __kernel_uid32_t; +pub type uid_t = __uid_t; +pub type __pid_t = __kernel_pid_t; +pub type pid_t = __pid_t; +pub type __id_t = u32; +pub type id_t = __id_t; +pub type blkcnt_t = ::std::os::raw::c_ulong; +pub type blksize_t = ::std::os::raw::c_ulong; +pub type caddr_t = __kernel_caddr_t; +pub type clock_t = __kernel_clock_t; +pub type __clockid_t = __kernel_clockid_t; +pub type clockid_t = __clockid_t; +pub type daddr_t = __kernel_daddr_t; +pub type fsblkcnt_t = ::std::os::raw::c_ulong; +pub type fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __mode_t = __kernel_mode_t; +pub type mode_t = __mode_t; +pub type __key_t = __kernel_key_t; +pub type key_t = __key_t; +pub type __ino_t = __kernel_ino_t; +pub type ino_t = __ino_t; +pub type ino64_t = u64; +pub type __nlink_t = u32; +pub type nlink_t = __nlink_t; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type timer_t = __timer_t; +pub type __suseconds_t = __kernel_suseconds_t; +pub type suseconds_t = __suseconds_t; +pub type __useconds_t = u32; +pub type useconds_t = __useconds_t; +pub type dev_t = u32; +pub type __time_t = __kernel_time_t; +pub type time_t = __time_t; +pub type off_t = __kernel_off_t; +pub type loff_t = __kernel_loff_t; +pub type off64_t = loff_t; +pub type __socklen_t = i32; +pub type socklen_t = __socklen_t; +pub type __va_list = __builtin_va_list; +pub type uint_t = ::std::os::raw::c_uint; +pub type uint = ::std::os::raw::c_uint; +pub type u_char = ::std::os::raw::c_uchar; +pub type u_short = ::std::os::raw::c_ushort; +pub type u_int = ::std::os::raw::c_uint; +pub type u_long = ::std::os::raw::c_ulong; +pub type u_int32_t = u32; +pub type u_int16_t = u16; +pub type u_int8_t = u8; +pub type u_int64_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetDir { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAsset { + _unused: [u8; 0], +} +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; +pub type _bindgen_ty_1 = u32; +extern "C" { + pub fn AAssetManager_openDir( + mgr: *mut AAssetManager, + dirName: *const ::std::os::raw::c_char, + ) -> *mut AAssetDir; +} +extern "C" { + pub fn AAssetManager_open( + mgr: *mut AAssetManager, + filename: *const ::std::os::raw::c_char, + mode: ::std::os::raw::c_int, + ) -> *mut AAsset; +} +extern "C" { + pub fn AAssetDir_getNextFileName(assetDir: *mut AAssetDir) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AAssetDir_rewind(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAssetDir_close(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAsset_read( + asset: *mut AAsset, + buf: *mut ::std::os::raw::c_void, + count: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_seek(asset: *mut AAsset, offset: off_t, whence: ::std::os::raw::c_int) -> off_t; +} +extern "C" { + pub fn AAsset_seek64( + asset: *mut AAsset, + offset: off64_t, + whence: ::std::os::raw::c_int, + ) -> off64_t; +} +extern "C" { + pub fn AAsset_close(asset: *mut AAsset); +} +extern "C" { + pub fn AAsset_getBuffer(asset: *mut AAsset) -> *const ::std::os::raw::c_void; +} +extern "C" { + pub fn AAsset_getLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_getRemainingLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getRemainingLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_openFileDescriptor( + asset: *mut AAsset, + outStart: *mut off_t, + outLength: *mut off_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_openFileDescriptor64( + asset: *mut AAsset, + outStart: *mut off64_t, + outLength: *mut off64_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_isAllocated(asset: *mut AAsset) -> ::std::os::raw::c_int; +} +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type jboolean = u8; +pub type jbyte = i8; +pub type jchar = u16; +pub type jshort = i16; +pub type jint = i32; +pub type jlong = i64; +pub type jfloat = f32; +pub type jdouble = f64; +pub type jsize = jint; +pub type jobject = *mut ::std::os::raw::c_void; +pub type jclass = jobject; +pub type jstring = jobject; +pub type jarray = jobject; +pub type jobjectArray = jarray; +pub type jbooleanArray = jarray; +pub type jbyteArray = jarray; +pub type jcharArray = jarray; +pub type jshortArray = jarray; +pub type jintArray = jarray; +pub type jlongArray = jarray; +pub type jfloatArray = jarray; +pub type jdoubleArray = jarray; +pub type jthrowable = jobject; +pub type jweak = jobject; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jfieldID { + _unused: [u8; 0], +} +pub type jfieldID = *mut _jfieldID; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jmethodID { + _unused: [u8; 0], +} +pub type jmethodID = *mut _jmethodID; +#[repr(C)] +#[derive(Copy, Clone)] +pub union jvalue { + pub z: jboolean, + pub b: jbyte, + pub c: jchar, + pub s: jshort, + pub i: jint, + pub j: jlong, + pub f: jfloat, + pub d: jdouble, + pub l: jobject, + _bindgen_union_align: [u32; 2usize], +} +#[test] +fn bindgen_test_layout_jvalue() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(jvalue)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(jvalue)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).z as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(z)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(b)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(c)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(s)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(i)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).j as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(j)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(f)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(d)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(l)) + ); +} +pub const jobjectRefType_JNIInvalidRefType: jobjectRefType = 0; +pub const jobjectRefType_JNILocalRefType: jobjectRefType = 1; +pub const jobjectRefType_JNIGlobalRefType: jobjectRefType = 2; +pub const jobjectRefType_JNIWeakGlobalRefType: jobjectRefType = 3; +pub type jobjectRefType = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeMethod { + pub name: *const ::std::os::raw::c_char, + pub signature: *const ::std::os::raw::c_char, + pub fnPtr: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JNINativeMethod() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(JNINativeMethod)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JNINativeMethod)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).signature as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fnPtr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(fnPtr) + ) + ); +} +pub type C_JNIEnv = *const JNINativeInterface; +pub type JNIEnv = *const JNINativeInterface; +pub type JavaVM = *const JNIInvokeInterface; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub reserved3: *mut ::std::os::raw::c_void, + pub GetVersion: ::std::option::Option jint>, + pub DefineClass: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *const ::std::os::raw::c_char, + arg3: jobject, + arg4: *const jbyte, + arg5: jsize, + ) -> jclass, + >, + pub FindClass: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jclass, + >, + pub FromReflectedMethod: + ::std::option::Option jmethodID>, + pub FromReflectedField: + ::std::option::Option jfieldID>, + pub ToReflectedMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: jboolean, + ) -> jobject, + >, + pub GetSuperclass: + ::std::option::Option jclass>, + pub IsAssignableFrom: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jclass) -> jboolean, + >, + pub ToReflectedField: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jfieldID, + arg4: jboolean, + ) -> jobject, + >, + pub Throw: + ::std::option::Option jint>, + pub ThrowNew: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + ) -> jint, + >, + pub ExceptionOccurred: + ::std::option::Option jthrowable>, + pub ExceptionDescribe: ::std::option::Option, + pub ExceptionClear: ::std::option::Option, + pub FatalError: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char), + >, + pub PushLocalFrame: + ::std::option::Option jint>, + pub PopLocalFrame: + ::std::option::Option jobject>, + pub NewGlobalRef: + ::std::option::Option jobject>, + pub DeleteGlobalRef: + ::std::option::Option, + pub DeleteLocalRef: + ::std::option::Option, + pub IsSameObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jobject) -> jboolean, + >, + pub NewLocalRef: + ::std::option::Option jobject>, + pub EnsureLocalCapacity: + ::std::option::Option jint>, + pub AllocObject: + ::std::option::Option jobject>, + pub NewObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub NewObjectV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub NewObjectA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub GetObjectClass: + ::std::option::Option jclass>, + pub IsInstanceOf: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass) -> jboolean, + >, + pub GetMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jobject, + >, + pub CallObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub CallObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jboolean, + >, + pub CallBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jboolean, + >, + pub CallBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jbyte, + >, + pub CallByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jbyte, + >, + pub CallByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jchar, + >, + pub CallCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jchar, + >, + pub CallCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jshort, + >, + pub CallShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jshort, + >, + pub CallShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jint, + >, + pub CallIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jint, + >, + pub CallIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jlong, + >, + pub CallLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jlong, + >, + pub CallLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jfloat, + >, + pub CallFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jfloat, + >, + pub CallFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jdouble, + >, + pub CallDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: va_list, + ) -> jdouble, + >, + pub CallDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...), + >, + pub CallVoidMethodV: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, arg4: va_list), + >, + pub CallVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ), + >, + pub CallNonvirtualObjectMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jobject, + >, + pub CallNonvirtualObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jobject, + >, + pub CallNonvirtualObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jobject, + >, + pub CallNonvirtualBooleanMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jboolean, + >, + pub CallNonvirtualByteMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jbyte, + >, + pub CallNonvirtualByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jbyte, + >, + pub CallNonvirtualByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jbyte, + >, + pub CallNonvirtualCharMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jchar, + >, + pub CallNonvirtualCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jchar, + >, + pub CallNonvirtualCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jchar, + >, + pub CallNonvirtualShortMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jshort, + >, + pub CallNonvirtualShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jshort, + >, + pub CallNonvirtualShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jshort, + >, + pub CallNonvirtualIntMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jint, + >, + pub CallNonvirtualIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jint, + >, + pub CallNonvirtualIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jint, + >, + pub CallNonvirtualLongMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jlong, + >, + pub CallNonvirtualLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jlong, + >, + pub CallNonvirtualLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jlong, + >, + pub CallNonvirtualFloatMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jfloat, + >, + pub CallNonvirtualDoubleMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jdouble, + >, + pub CallNonvirtualVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass, arg4: jmethodID, ...), + >, + pub CallNonvirtualVoidMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: va_list, + ), + >, + pub CallNonvirtualVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ), + >, + pub GetFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jobject, + >, + pub GetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jboolean, + >, + pub GetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jbyte, + >, + pub GetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jchar, + >, + pub GetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jshort, + >, + pub GetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jint, + >, + pub GetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jlong, + >, + pub GetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jfloat, + >, + pub GetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jdouble, + >, + pub SetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jobject), + >, + pub SetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jboolean), + >, + pub SetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jbyte), + >, + pub SetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jchar), + >, + pub SetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jshort), + >, + pub SetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jint), + >, + pub SetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jlong), + >, + pub SetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jfloat), + >, + pub SetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jdouble), + >, + pub GetStaticMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallStaticObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub CallStaticObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jobject, + >, + pub CallStaticObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallStaticBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jboolean, + >, + pub CallStaticBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jboolean, + >, + pub CallStaticBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallStaticByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jbyte, + >, + pub CallStaticByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jbyte, + >, + pub CallStaticByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallStaticCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jchar, + >, + pub CallStaticCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jchar, + >, + pub CallStaticCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallStaticShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jshort, + >, + pub CallStaticShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jshort, + >, + pub CallStaticShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallStaticIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jint, + >, + pub CallStaticIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jint, + >, + pub CallStaticIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallStaticLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jlong, + >, + pub CallStaticLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jlong, + >, + pub CallStaticLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallStaticFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jfloat, + >, + pub CallStaticFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jfloat, + >, + pub CallStaticFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallStaticDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jdouble, + >, + pub CallStaticDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: va_list, + ) -> jdouble, + >, + pub CallStaticDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallStaticVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...), + >, + pub CallStaticVoidMethodV: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: va_list), + >, + pub CallStaticVoidMethodA: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: *const jvalue), + >, + pub GetStaticFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jobject, + >, + pub GetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jboolean, + >, + pub GetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jbyte, + >, + pub GetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jchar, + >, + pub GetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jshort, + >, + pub GetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jint, + >, + pub GetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jlong, + >, + pub GetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jfloat, + >, + pub GetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jdouble, + >, + pub SetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jobject), + >, + pub SetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jboolean), + >, + pub SetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jbyte), + >, + pub SetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jchar), + >, + pub SetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jshort), + >, + pub SetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jint), + >, + pub SetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jlong), + >, + pub SetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jfloat), + >, + pub SetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jdouble), + >, + pub NewString: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const jchar, arg3: jsize) -> jstring, + >, + pub GetStringLength: + ::std::option::Option jsize>, + pub GetStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewStringUTF: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jstring, + >, + pub GetStringUTFLength: + ::std::option::Option jsize>, + pub GetStringUTFChars: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: *mut jboolean, + ) -> *const ::std::os::raw::c_char, + >, + pub ReleaseStringUTFChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const ::std::os::raw::c_char), + >, + pub GetArrayLength: + ::std::option::Option jsize>, + pub NewObjectArray: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jsize, + arg3: jclass, + arg4: jobject, + ) -> jobjectArray, + >, + pub GetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize) -> jobject, + >, + pub SetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize, arg4: jobject), + >, + pub NewBooleanArray: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jsize) -> jbooleanArray, + >, + pub NewByteArray: + ::std::option::Option jbyteArray>, + pub NewCharArray: + ::std::option::Option jcharArray>, + pub NewShortArray: + ::std::option::Option jshortArray>, + pub NewIntArray: + ::std::option::Option jintArray>, + pub NewLongArray: + ::std::option::Option jlongArray>, + pub NewFloatArray: + ::std::option::Option jfloatArray>, + pub NewDoubleArray: + ::std::option::Option jdoubleArray>, + pub GetBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + ) -> *mut jboolean, + >, + pub GetByteArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: *mut jboolean, + ) -> *mut jbyte, + >, + pub GetCharArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: *mut jboolean, + ) -> *mut jchar, + >, + pub GetShortArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: *mut jboolean, + ) -> *mut jshort, + >, + pub GetIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jboolean) -> *mut jint, + >, + pub GetLongArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: *mut jboolean, + ) -> *mut jlong, + >, + pub GetFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: *mut jboolean, + ) -> *mut jfloat, + >, + pub GetDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: *mut jboolean, + ) -> *mut jdouble, + >, + pub ReleaseBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + arg4: jint, + ), + >, + pub ReleaseByteArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jbyteArray, arg3: *mut jbyte, arg4: jint), + >, + pub ReleaseCharArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jcharArray, arg3: *mut jchar, arg4: jint), + >, + pub ReleaseShortArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jshortArray, arg3: *mut jshort, arg4: jint), + >, + pub ReleaseIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jint, arg4: jint), + >, + pub ReleaseLongArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jlongArray, arg3: *mut jlong, arg4: jint), + >, + pub ReleaseFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jfloatArray, arg3: *mut jfloat, arg4: jint), + >, + pub ReleaseDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jdoubleArray, arg3: *mut jdouble, arg4: jint), + >, + pub GetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jboolean, + ), + >, + pub GetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jbyte, + ), + >, + pub GetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jshort, + ), + >, + pub GetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jint, + ), + >, + pub GetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jlong, + ), + >, + pub GetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jfloat, + ), + >, + pub GetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jdouble, + ), + >, + pub SetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *const jboolean, + ), + >, + pub SetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *const jbyte, + ), + >, + pub SetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *const jchar, + ), + >, + pub SetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *const jshort, + ), + >, + pub SetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *const jint, + ), + >, + pub SetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *const jlong, + ), + >, + pub SetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *const jfloat, + ), + >, + pub SetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *const jdouble, + ), + >, + pub RegisterNatives: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const JNINativeMethod, + arg4: jint, + ) -> jint, + >, + pub UnregisterNatives: + ::std::option::Option jint>, + pub MonitorEnter: + ::std::option::Option jint>, + pub MonitorExit: + ::std::option::Option jint>, + pub GetJavaVM: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *mut *mut JavaVM) -> jint, + >, + pub GetStringRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetStringUTFRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut ::std::os::raw::c_char, + ), + >, + pub GetPrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut jboolean, + ) -> *mut ::std::os::raw::c_void, + >, + pub ReleasePrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut ::std::os::raw::c_void, + arg4: jint, + ), + >, + pub GetStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewWeakGlobalRef: + ::std::option::Option jweak>, + pub DeleteWeakGlobalRef: + ::std::option::Option, + pub ExceptionCheck: ::std::option::Option jboolean>, + pub NewDirectByteBuffer: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *mut ::std::os::raw::c_void, + arg3: jlong, + ) -> jobject, + >, + pub GetDirectBufferAddress: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> *mut ::std::os::raw::c_void, + >, + pub GetDirectBufferCapacity: + ::std::option::Option jlong>, + pub GetObjectRefType: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> jobjectRefType, + >, +} +#[test] +fn bindgen_test_layout_JNINativeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 932usize, + concat!("Size of: ", stringify!(JNINativeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JNINativeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved3 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetVersion as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).DefineClass as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DefineClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FindClass as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FindClass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedMethod as *const _ as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedField as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedMethod as *const _ as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetSuperclass as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetSuperclass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).IsAssignableFrom as *const _ as usize + }, + 44usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsAssignableFrom) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedField as *const _ as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).Throw as *const _ as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(Throw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ThrowNew as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ThrowNew) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionOccurred as *const _ as usize + }, + 60usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionOccurred) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionDescribe as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionDescribe) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionClear as *const _ as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionClear) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FatalError as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FatalError) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PushLocalFrame as *const _ as usize + }, + 76usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PushLocalFrame) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PopLocalFrame as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PopLocalFrame) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewGlobalRef as *const _ as usize }, + 84usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteGlobalRef as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteLocalRef as *const _ as usize + }, + 92usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteLocalRef) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsSameObject as *const _ as usize }, + 96usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsSameObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLocalRef as *const _ as usize }, + 100usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLocalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).EnsureLocalCapacity as *const _ as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(EnsureLocalCapacity) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).AllocObject as *const _ as usize }, + 108usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(AllocObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObject as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectV as *const _ as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectV) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectA as *const _ as usize }, + 120usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectClass as *const _ as usize + }, + 124usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsInstanceOf as *const _ as usize }, + 128usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsInstanceOf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetMethodID as *const _ as usize }, + 132usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethod as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodV as *const _ as usize + }, + 140usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodA as *const _ as usize + }, + 144usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethod as *const _ as usize + }, + 148usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodV as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodA as *const _ as usize + }, + 156usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethod as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodV as *const _ as usize + }, + 164usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodA as *const _ as usize + }, + 168usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethod as *const _ as usize + }, + 172usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodV as *const _ as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodA as *const _ as usize + }, + 180usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethod as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodV as *const _ as usize + }, + 188usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodA as *const _ as usize + }, + 192usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethod as *const _ as usize + }, + 196usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodV as *const _ as usize + }, + 200usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodA as *const _ as usize + }, + 204usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethod as *const _ as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodV as *const _ as usize + }, + 212usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodA as *const _ as usize + }, + 216usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethod as *const _ as usize + }, + 220usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodV as *const _ as usize + }, + 224usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodA as *const _ as usize + }, + 228usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethod as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodV as *const _ as usize + }, + 236usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodA as *const _ as usize + }, + 240usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethod as *const _ as usize + }, + 244usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodV as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodA as *const _ as usize + }, + 252usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethod as *const _ + as usize + }, + 256usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodV as *const _ + as usize + }, + 260usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodA as *const _ + as usize + }, + 264usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethod as *const _ + as usize + }, + 268usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodV as *const _ + as usize + }, + 272usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodA as *const _ + as usize + }, + 276usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethod as *const _ + as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodV as *const _ + as usize + }, + 284usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodA as *const _ + as usize + }, + 288usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethod as *const _ + as usize + }, + 292usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodV as *const _ + as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodA as *const _ + as usize + }, + 300usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethod as *const _ + as usize + }, + 304usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodV as *const _ + as usize + }, + 308usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodA as *const _ + as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethod as *const _ + as usize + }, + 316usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodV as *const _ + as usize + }, + 320usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodA as *const _ + as usize + }, + 324usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethod as *const _ + as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodV as *const _ + as usize + }, + 332usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodA as *const _ + as usize + }, + 336usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethod as *const _ + as usize + }, + 340usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodV as *const _ + as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodA as *const _ + as usize + }, + 348usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethod as *const _ + as usize + }, + 352usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodV as *const _ + as usize + }, + 356usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodA as *const _ + as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethod as *const _ + as usize + }, + 364usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodV as *const _ + as usize + }, + 368usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodA as *const _ + as usize + }, + 372usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodA) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetFieldID as *const _ as usize }, + 376usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectField as *const _ as usize + }, + 380usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanField as *const _ as usize + }, + 384usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetByteField as *const _ as usize }, + 388usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetCharField as *const _ as usize }, + 392usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortField as *const _ as usize + }, + 396usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetIntField as *const _ as usize }, + 400usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetLongField as *const _ as usize }, + 404usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatField as *const _ as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleField as *const _ as usize + }, + 412usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectField as *const _ as usize + }, + 416usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanField as *const _ as usize + }, + 420usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetByteField as *const _ as usize }, + 424usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetCharField as *const _ as usize }, + 428usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortField as *const _ as usize + }, + 432usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetIntField as *const _ as usize }, + 436usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetLongField as *const _ as usize }, + 440usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatField as *const _ as usize + }, + 444usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleField as *const _ as usize + }, + 448usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticMethodID as *const _ as usize + }, + 452usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethod as *const _ + as usize + }, + 456usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodV as *const _ + as usize + }, + 460usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodA as *const _ + as usize + }, + 464usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethod as *const _ + as usize + }, + 468usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodV as *const _ + as usize + }, + 472usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodA as *const _ + as usize + }, + 476usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethod as *const _ as usize + }, + 480usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodV as *const _ + as usize + }, + 484usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodA as *const _ + as usize + }, + 488usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethod as *const _ as usize + }, + 492usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodV as *const _ + as usize + }, + 496usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodA as *const _ + as usize + }, + 500usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethod as *const _ + as usize + }, + 504usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodV as *const _ + as usize + }, + 508usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodA as *const _ + as usize + }, + 512usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethod as *const _ as usize + }, + 516usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodV as *const _ as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodA as *const _ as usize + }, + 524usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethod as *const _ as usize + }, + 528usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodV as *const _ + as usize + }, + 532usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodA as *const _ + as usize + }, + 536usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethod as *const _ + as usize + }, + 540usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodV as *const _ + as usize + }, + 544usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodA as *const _ + as usize + }, + 548usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethod as *const _ + as usize + }, + 552usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodV as *const _ + as usize + }, + 556usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodA as *const _ + as usize + }, + 560usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethod as *const _ as usize + }, + 564usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodV as *const _ + as usize + }, + 568usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodA as *const _ + as usize + }, + 572usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFieldID as *const _ as usize + }, + 576usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticObjectField as *const _ as usize + }, + 580usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticBooleanField as *const _ + as usize + }, + 584usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticByteField as *const _ as usize + }, + 588usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticCharField as *const _ as usize + }, + 592usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticShortField as *const _ as usize + }, + 596usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticIntField as *const _ as usize + }, + 600usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticLongField as *const _ as usize + }, + 604usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFloatField as *const _ as usize + }, + 608usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticDoubleField as *const _ as usize + }, + 612usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticObjectField as *const _ as usize + }, + 616usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticBooleanField as *const _ + as usize + }, + 620usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticByteField as *const _ as usize + }, + 624usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticCharField as *const _ as usize + }, + 628usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticShortField as *const _ as usize + }, + 632usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticIntField as *const _ as usize + }, + 636usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticLongField as *const _ as usize + }, + 640usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticFloatField as *const _ as usize + }, + 644usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticDoubleField as *const _ as usize + }, + 648usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewString as *const _ as usize }, + 652usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewString) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringLength as *const _ as usize + }, + 656usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringChars as *const _ as usize + }, + 660usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringChars as *const _ as usize + }, + 664usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringChars) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewStringUTF as *const _ as usize }, + 668usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewStringUTF) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFLength as *const _ as usize + }, + 672usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFChars as *const _ as usize + }, + 676usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringUTFChars as *const _ + as usize + }, + 680usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetArrayLength as *const _ as usize + }, + 684usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetArrayLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewObjectArray as *const _ as usize + }, + 688usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectArrayElement as *const _ + as usize + }, + 692usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectArrayElement as *const _ + as usize + }, + 696usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewBooleanArray as *const _ as usize + }, + 700usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewBooleanArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewByteArray as *const _ as usize }, + 704usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewByteArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewCharArray as *const _ as usize }, + 708usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewCharArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewShortArray as *const _ as usize + }, + 712usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewShortArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewIntArray as *const _ as usize }, + 716usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewIntArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLongArray as *const _ as usize }, + 720usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLongArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewFloatArray as *const _ as usize + }, + 724usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewFloatArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDoubleArray as *const _ as usize + }, + 728usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDoubleArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayElements as *const _ + as usize + }, + 732usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayElements as *const _ as usize + }, + 736usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayElements as *const _ as usize + }, + 740usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayElements as *const _ + as usize + }, + 744usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayElements as *const _ as usize + }, + 748usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayElements as *const _ as usize + }, + 752usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayElements as *const _ + as usize + }, + 756usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayElements as *const _ + as usize + }, + 760usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseBooleanArrayElements as *const _ + as usize + }, + 764usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseByteArrayElements as *const _ + as usize + }, + 768usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseCharArrayElements as *const _ + as usize + }, + 772usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseShortArrayElements as *const _ + as usize + }, + 776usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseIntArrayElements as *const _ + as usize + }, + 780usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseLongArrayElements as *const _ + as usize + }, + 784usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseFloatArrayElements as *const _ + as usize + }, + 788usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseDoubleArrayElements as *const _ + as usize + }, + 792usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayRegion as *const _ + as usize + }, + 796usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayRegion as *const _ as usize + }, + 800usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayRegion as *const _ as usize + }, + 804usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayRegion as *const _ as usize + }, + 808usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayRegion as *const _ as usize + }, + 812usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayRegion as *const _ as usize + }, + 816usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayRegion as *const _ as usize + }, + 820usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayRegion as *const _ as usize + }, + 824usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanArrayRegion as *const _ + as usize + }, + 828usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetByteArrayRegion as *const _ as usize + }, + 832usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetCharArrayRegion as *const _ as usize + }, + 836usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortArrayRegion as *const _ as usize + }, + 840usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetIntArrayRegion as *const _ as usize + }, + 844usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetLongArrayRegion as *const _ as usize + }, + 848usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatArrayRegion as *const _ as usize + }, + 852usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleArrayRegion as *const _ as usize + }, + 856usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).RegisterNatives as *const _ as usize + }, + 860usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(RegisterNatives) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).UnregisterNatives as *const _ as usize + }, + 864usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(UnregisterNatives) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorEnter as *const _ as usize }, + 868usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorEnter) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorExit as *const _ as usize }, + 872usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorExit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetJavaVM as *const _ as usize }, + 876usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringRegion as *const _ as usize + }, + 880usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFRegion as *const _ as usize + }, + 884usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetPrimitiveArrayCritical as *const _ + as usize + }, + 888usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetPrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleasePrimitiveArrayCritical as *const _ + as usize + }, + 892usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleasePrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringCritical as *const _ as usize + }, + 896usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringCritical as *const _ + as usize + }, + 900usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewWeakGlobalRef as *const _ as usize + }, + 904usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteWeakGlobalRef as *const _ as usize + }, + 908usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionCheck as *const _ as usize + }, + 912usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionCheck) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDirectByteBuffer as *const _ as usize + }, + 916usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDirectByteBuffer) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferAddress as *const _ + as usize + }, + 920usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferAddress) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferCapacity as *const _ + as usize + }, + 924usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferCapacity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectRefType as *const _ as usize + }, + 928usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectRefType) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JNIEnv { + pub functions: *const JNINativeInterface, +} +#[test] +fn bindgen_test_layout__JNIEnv() { + assert_eq!( + ::std::mem::size_of::<_JNIEnv>(), + 4usize, + concat!("Size of: ", stringify!(_JNIEnv)) + ); + assert_eq!( + ::std::mem::align_of::<_JNIEnv>(), + 4usize, + concat!("Alignment of ", stringify!(_JNIEnv)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JNIEnv>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JNIEnv), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNIInvokeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub DestroyJavaVM: ::std::option::Option jint>, + pub AttachCurrentThread: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, + pub DetachCurrentThread: ::std::option::Option jint>, + pub GetEnv: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut ::std::os::raw::c_void, + arg3: jint, + ) -> jint, + >, + pub AttachCurrentThreadAsDaemon: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, +} +#[test] +fn bindgen_test_layout_JNIInvokeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DestroyJavaVM as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DestroyJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThread as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThread) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DetachCurrentThread as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DetachCurrentThread) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetEnv as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(GetEnv) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThreadAsDaemon as *const _ + as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThreadAsDaemon) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JavaVM { + pub functions: *const JNIInvokeInterface, +} +#[test] +fn bindgen_test_layout__JavaVM() { + assert_eq!( + ::std::mem::size_of::<_JavaVM>(), + 4usize, + concat!("Size of: ", stringify!(_JavaVM)) + ); + assert_eq!( + ::std::mem::align_of::<_JavaVM>(), + 4usize, + concat!("Alignment of ", stringify!(_JavaVM)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JavaVM>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JavaVM), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(group) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(JavaVMOption)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JavaVMOption)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(optionString) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(extraInfo) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(nOptions) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(options) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(ignoreUnrecognized) + ) + ); +} +extern "C" { + pub fn JNI_GetDefaultJavaVMInitArgs(arg1: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_CreateJavaVM( + arg1: *mut *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint; +} +extern "C" { + pub fn JNI_GetCreatedJavaVMs(arg1: *mut *mut JavaVM, arg2: jsize, arg3: *mut jsize) -> jint; +} +extern "C" { + pub fn JNI_OnLoad(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_OnUnload(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn AAssetManager_fromJava(env: *mut JNIEnv, assetManager: jobject) -> *mut AAssetManager; +} +pub const ANDROID_BITMAP_RESULT_SUCCESS: _bindgen_ty_2 = 0; +pub const ANDROID_BITMAP_RESULT_BAD_PARAMETER: _bindgen_ty_2 = -1; +pub const ANDROID_BITMAP_RESULT_JNI_EXCEPTION: _bindgen_ty_2 = -2; +pub const ANDROID_BITMAP_RESULT_ALLOCATION_FAILED: _bindgen_ty_2 = -3; +pub type _bindgen_ty_2 = i32; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_NONE: AndroidBitmapFormat = 0; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_8888: AndroidBitmapFormat = 1; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGB_565: AndroidBitmapFormat = 4; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_4444: AndroidBitmapFormat = 7; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_A_8: AndroidBitmapFormat = 8; +pub type AndroidBitmapFormat = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AndroidBitmapInfo { + pub width: u32, + pub height: u32, + pub stride: u32, + pub format: i32, + pub flags: u32, +} +#[test] +fn bindgen_test_layout_AndroidBitmapInfo() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + pub fn AndroidBitmap_getInfo( + env: *mut JNIEnv, + jbitmap: jobject, + info: *mut AndroidBitmapInfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_lockPixels( + env: *mut JNIEnv, + jbitmap: jobject, + addrPtr: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_unlockPixels(env: *mut JNIEnv, jbitmap: jobject) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AChoreographer { + _unused: [u8; 0], +} +pub type AChoreographer_frameCallback = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: ::std::os::raw::c_long, data: *mut ::std::os::raw::c_void), +>; +pub type AChoreographer_frameCallback64 = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: i64, data: *mut ::std::os::raw::c_void), +>; +extern "C" { + pub fn AChoreographer_getInstance() -> *mut AChoreographer; +} +extern "C" { + pub fn AChoreographer_postFrameCallback( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + delayMillis: ::std::os::raw::c_long, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallback64( + chroreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed64( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + delayMillis: u32, + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AConfiguration { + _unused: [u8; 0], +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_3 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_3 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_3 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_3 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_3 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_3 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_3 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_3 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_3 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_3 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_3 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_3 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_3 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_3 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_3 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_3 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_3 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_3 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_3 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_3 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_3 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_3 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_3 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_3 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_3 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_3 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_3 = 65535; +pub type _bindgen_ty_3 = u32; +extern "C" { + pub fn AConfiguration_new() -> *mut AConfiguration; +} +extern "C" { + pub fn AConfiguration_delete(config: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_fromAssetManager(out: *mut AConfiguration, am: *mut AAssetManager); +} +extern "C" { + pub fn AConfiguration_copy(dest: *mut AConfiguration, src: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_getMcc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMcc(config: *mut AConfiguration, mcc: i32); +} +extern "C" { + pub fn AConfiguration_getMnc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMnc(config: *mut AConfiguration, mnc: i32); +} +extern "C" { + pub fn AConfiguration_getLanguage( + config: *mut AConfiguration, + outLanguage: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setLanguage( + config: *mut AConfiguration, + language: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getCountry( + config: *mut AConfiguration, + outCountry: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setCountry( + config: *mut AConfiguration, + country: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getOrientation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setOrientation(config: *mut AConfiguration, orientation: i32); +} +extern "C" { + pub fn AConfiguration_getTouchscreen(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setTouchscreen(config: *mut AConfiguration, touchscreen: i32); +} +extern "C" { + pub fn AConfiguration_getDensity(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setDensity(config: *mut AConfiguration, density: i32); +} +extern "C" { + pub fn AConfiguration_getKeyboard(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeyboard(config: *mut AConfiguration, keyboard: i32); +} +extern "C" { + pub fn AConfiguration_getNavigation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavigation(config: *mut AConfiguration, navigation: i32); +} +extern "C" { + pub fn AConfiguration_getKeysHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeysHidden(config: *mut AConfiguration, keysHidden: i32); +} +extern "C" { + pub fn AConfiguration_getNavHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavHidden(config: *mut AConfiguration, navHidden: i32); +} +extern "C" { + pub fn AConfiguration_getSdkVersion(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSdkVersion(config: *mut AConfiguration, sdkVersion: i32); +} +extern "C" { + pub fn AConfiguration_getScreenSize(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenSize(config: *mut AConfiguration, screenSize: i32); +} +extern "C" { + pub fn AConfiguration_getScreenLong(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenLong(config: *mut AConfiguration, screenLong: i32); +} +extern "C" { + pub fn AConfiguration_getScreenRound(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenRound(config: *mut AConfiguration, screenRound: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeType(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeType(config: *mut AConfiguration, uiModeType: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeNight(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeNight(config: *mut AConfiguration, uiModeNight: i32); +} +extern "C" { + pub fn AConfiguration_getScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getScreenHeightDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenHeightDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getSmallestScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSmallestScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getLayoutDirection(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setLayoutDirection(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_diff(config1: *mut AConfiguration, config2: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_match(base: *mut AConfiguration, requested: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_isBetterThan( + base: *mut AConfiguration, + test: *mut AConfiguration, + requested: *mut AConfiguration, + ) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct imaxdiv_t { + pub quot: intmax_t, + pub rem: intmax_t, +} +#[test] +fn bindgen_test_layout_imaxdiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(imaxdiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(imaxdiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn imaxabs(__i: intmax_t) -> intmax_t; +} +extern "C" { + pub fn imaxdiv(__numerator: intmax_t, __denominator: intmax_t) -> imaxdiv_t; +} +extern "C" { + pub fn strtoimax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn strtoumax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +extern "C" { + pub fn wcstoimax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn wcstoumax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; +pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; +pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; +pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; +pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub type ADataSpace = u32; +pub const ANDROID_DLEXT_RESERVED_ADDRESS: _bindgen_ty_4 = 1; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_HINT: _bindgen_ty_4 = 2; +pub const ANDROID_DLEXT_WRITE_RELRO: _bindgen_ty_4 = 4; +pub const ANDROID_DLEXT_USE_RELRO: _bindgen_ty_4 = 8; +pub const ANDROID_DLEXT_USE_LIBRARY_FD: _bindgen_ty_4 = 16; +pub const ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET: _bindgen_ty_4 = 32; +pub const ANDROID_DLEXT_FORCE_LOAD: _bindgen_ty_4 = 64; +pub const ANDROID_DLEXT_USE_NAMESPACE: _bindgen_ty_4 = 512; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE: _bindgen_ty_4 = 1024; +pub const ANDROID_DLEXT_VALID_FLAG_BITS: _bindgen_ty_4 = 1663; +pub type _bindgen_ty_4 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_namespace_t { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_dlextinfo { + pub flags: u64, + pub reserved_addr: *mut ::std::os::raw::c_void, + pub reserved_size: usize, + pub relro_fd: ::std::os::raw::c_int, + pub library_fd: ::std::os::raw::c_int, + pub library_fd_offset: off64_t, + pub library_namespace: *mut android_namespace_t, +} +#[test] +fn bindgen_test_layout_android_dlextinfo() { + assert_eq!( + ::std::mem::size_of::(), + 36usize, + concat!("Size of: ", stringify!(android_dlextinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(android_dlextinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_size as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).relro_fd as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(relro_fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).library_fd as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_fd_offset as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_namespace as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_namespace) + ) + ); +} +extern "C" { + pub fn android_dlopen_ext( + __filename: *const ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + __info: *const android_dlextinfo, + ) -> *mut ::std::os::raw::c_void; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ARect { + pub left: i32, + pub top: i32, + pub right: i32, + pub bottom: i32, +} +#[test] +fn bindgen_test_layout_ARect() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ARect)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ARect)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(left) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(top) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(right) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(bottom) + ) + ); +} +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: AHardwareBuffer_Format = 4; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: AHardwareBuffer_Format = + 22; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: AHardwareBuffer_Format = + 43; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_BLOB: AHardwareBuffer_Format = 33; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D16_UNORM: AHardwareBuffer_Format = 48; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM: AHardwareBuffer_Format = 49; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT: AHardwareBuffer_Format = + 50; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT: AHardwareBuffer_Format = 51; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHardwareBuffer_Format = + 52; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub type AHardwareBuffer_Format = u32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_RARELY: + AHardwareBuffer_UsageFlags = 2; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN: + AHardwareBuffer_UsageFlags = 3; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_MASK: + AHardwareBuffer_UsageFlags = 15; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY: + AHardwareBuffer_UsageFlags = 32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN: + AHardwareBuffer_UsageFlags = 48; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK: + AHardwareBuffer_UsageFlags = 240; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE: + AHardwareBuffer_UsageFlags = 256; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY: + AHardwareBuffer_UsageFlags = 2048; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT: + AHardwareBuffer_UsageFlags = 16384; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VIDEO_ENCODE: + AHardwareBuffer_UsageFlags = 65536; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA: + AHardwareBuffer_UsageFlags = 8388608; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER: + AHardwareBuffer_UsageFlags = 16777216; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: + AHardwareBuffer_UsageFlags = 33554432; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: + AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = + 268435456; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = + 536870912; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_2: AHardwareBuffer_UsageFlags = + 1073741824; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_3: AHardwareBuffer_UsageFlags = + 2147483648; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_4: AHardwareBuffer_UsageFlags = + 281474976710656; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_5: AHardwareBuffer_UsageFlags = + 562949953421312; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_6: AHardwareBuffer_UsageFlags = + 1125899906842624; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_7: AHardwareBuffer_UsageFlags = + 2251799813685248; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_8: AHardwareBuffer_UsageFlags = + 4503599627370496; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_9: AHardwareBuffer_UsageFlags = + 9007199254740992; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_10: AHardwareBuffer_UsageFlags = + 18014398509481984; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_11: AHardwareBuffer_UsageFlags = + 36028797018963968; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_12: AHardwareBuffer_UsageFlags = + 72057594037927936; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_13: AHardwareBuffer_UsageFlags = + 144115188075855872; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_14: AHardwareBuffer_UsageFlags = + 288230376151711744; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_15: AHardwareBuffer_UsageFlags = + 576460752303423488; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_16: AHardwareBuffer_UsageFlags = + 1152921504606846976; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_17: AHardwareBuffer_UsageFlags = + 2305843009213693952; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_18: AHardwareBuffer_UsageFlags = + 4611686018427387904; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_19: AHardwareBuffer_UsageFlags = + 9223372036854775808; +pub type AHardwareBuffer_UsageFlags = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Desc { + pub width: u32, + pub height: u32, + pub layers: u32, + pub format: u32, + pub usage: u64, + pub stride: u32, + pub rfu0: u32, + pub rfu1: u64, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Desc() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(layers) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(usage) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Plane { + pub data: *mut ::std::os::raw::c_void, + pub pixelStride: u32, + pub rowStride: u32, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Plane() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pixelStride as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(pixelStride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(rowStride) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Planes { + pub planeCount: u32, + pub planes: [AHardwareBuffer_Plane; 4usize], +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Planes() { + assert_eq!( + ::std::mem::size_of::(), + 52usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).planeCount as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planeCount) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planes) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer { + _unused: [u8; 0], +} +extern "C" { + pub fn AHardwareBuffer_allocate( + desc: *const AHardwareBuffer_Desc, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_acquire(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_release(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_describe( + buffer: *const AHardwareBuffer, + outDesc: *mut AHardwareBuffer_Desc, + ); +} +extern "C" { + pub fn AHardwareBuffer_lock( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_unlock( + buffer: *mut AHardwareBuffer, + fence: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_sendHandleToUnixSocket( + buffer: *const AHardwareBuffer, + socketFd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_recvHandleFromUnixSocket( + socketFd: ::std::os::raw::c_int, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockAndGetInfo( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + outBytesPerPixel: *mut i32, + outBytesPerStride: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_fromHardwareBuffer( + env: *mut JNIEnv, + hardwareBufferObj: jobject, + ) -> *mut AHardwareBuffer; +} +extern "C" { + pub fn AHardwareBuffer_toHardwareBuffer( + env: *mut JNIEnv, + hardwareBuffer: *mut AHardwareBuffer, + ) -> jobject; +} +pub const AKEYCODE_UNKNOWN: _bindgen_ty_5 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_5 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_5 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_5 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_5 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_5 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_5 = 6; +pub const AKEYCODE_0: _bindgen_ty_5 = 7; +pub const AKEYCODE_1: _bindgen_ty_5 = 8; +pub const AKEYCODE_2: _bindgen_ty_5 = 9; +pub const AKEYCODE_3: _bindgen_ty_5 = 10; +pub const AKEYCODE_4: _bindgen_ty_5 = 11; +pub const AKEYCODE_5: _bindgen_ty_5 = 12; +pub const AKEYCODE_6: _bindgen_ty_5 = 13; +pub const AKEYCODE_7: _bindgen_ty_5 = 14; +pub const AKEYCODE_8: _bindgen_ty_5 = 15; +pub const AKEYCODE_9: _bindgen_ty_5 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_5 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_5 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_5 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_5 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_5 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_5 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_5 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_5 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_5 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_5 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_5 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_5 = 28; +pub const AKEYCODE_A: _bindgen_ty_5 = 29; +pub const AKEYCODE_B: _bindgen_ty_5 = 30; +pub const AKEYCODE_C: _bindgen_ty_5 = 31; +pub const AKEYCODE_D: _bindgen_ty_5 = 32; +pub const AKEYCODE_E: _bindgen_ty_5 = 33; +pub const AKEYCODE_F: _bindgen_ty_5 = 34; +pub const AKEYCODE_G: _bindgen_ty_5 = 35; +pub const AKEYCODE_H: _bindgen_ty_5 = 36; +pub const AKEYCODE_I: _bindgen_ty_5 = 37; +pub const AKEYCODE_J: _bindgen_ty_5 = 38; +pub const AKEYCODE_K: _bindgen_ty_5 = 39; +pub const AKEYCODE_L: _bindgen_ty_5 = 40; +pub const AKEYCODE_M: _bindgen_ty_5 = 41; +pub const AKEYCODE_N: _bindgen_ty_5 = 42; +pub const AKEYCODE_O: _bindgen_ty_5 = 43; +pub const AKEYCODE_P: _bindgen_ty_5 = 44; +pub const AKEYCODE_Q: _bindgen_ty_5 = 45; +pub const AKEYCODE_R: _bindgen_ty_5 = 46; +pub const AKEYCODE_S: _bindgen_ty_5 = 47; +pub const AKEYCODE_T: _bindgen_ty_5 = 48; +pub const AKEYCODE_U: _bindgen_ty_5 = 49; +pub const AKEYCODE_V: _bindgen_ty_5 = 50; +pub const AKEYCODE_W: _bindgen_ty_5 = 51; +pub const AKEYCODE_X: _bindgen_ty_5 = 52; +pub const AKEYCODE_Y: _bindgen_ty_5 = 53; +pub const AKEYCODE_Z: _bindgen_ty_5 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_5 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_5 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_5 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_5 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_5 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_5 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_5 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_5 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_5 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_5 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_5 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_5 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_5 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_5 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_5 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_5 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_5 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_5 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_5 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_5 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_5 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_5 = 76; +pub const AKEYCODE_AT: _bindgen_ty_5 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_5 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_5 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_5 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_5 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_5 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_5 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_5 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_5 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_5 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_5 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_5 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_5 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_5 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_5 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_5 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_5 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_5 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_5 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_5 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_5 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_5 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_5 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_5 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_5 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_5 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_5 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_5 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_5 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_5 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_5 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_5 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_5 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_5 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_5 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_5 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_5 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_5 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_5 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_5 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_5 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_5 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_5 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_5 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_5 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_5 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_5 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_5 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_5 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_5 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_5 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_5 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_5 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_5 = 130; +pub const AKEYCODE_F1: _bindgen_ty_5 = 131; +pub const AKEYCODE_F2: _bindgen_ty_5 = 132; +pub const AKEYCODE_F3: _bindgen_ty_5 = 133; +pub const AKEYCODE_F4: _bindgen_ty_5 = 134; +pub const AKEYCODE_F5: _bindgen_ty_5 = 135; +pub const AKEYCODE_F6: _bindgen_ty_5 = 136; +pub const AKEYCODE_F7: _bindgen_ty_5 = 137; +pub const AKEYCODE_F8: _bindgen_ty_5 = 138; +pub const AKEYCODE_F9: _bindgen_ty_5 = 139; +pub const AKEYCODE_F10: _bindgen_ty_5 = 140; +pub const AKEYCODE_F11: _bindgen_ty_5 = 141; +pub const AKEYCODE_F12: _bindgen_ty_5 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_5 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_5 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_5 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_5 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_5 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_5 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_5 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_5 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_5 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_5 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_5 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_5 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_5 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_5 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_5 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_5 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_5 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_5 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_5 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_5 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_5 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_5 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_5 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_5 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_5 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_5 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_5 = 169; +pub const AKEYCODE_TV: _bindgen_ty_5 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_5 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_5 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_5 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_5 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_5 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_5 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_5 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_5 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_5 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_5 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_5 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_5 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_5 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_5 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_5 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_5 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_5 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_5 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_5 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_5 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_5 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_5 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_5 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_5 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_5 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_5 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_5 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_5 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_5 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_5 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_5 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_5 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_5 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_5 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_5 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_5 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_5 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_5 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_5 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_5 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_5 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_5 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_5 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_5 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_5 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_5 = 216; +pub const AKEYCODE_RO: _bindgen_ty_5 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_5 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_5 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_5 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_5 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_5 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_5 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_5 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_5 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_5 = 226; +pub const AKEYCODE_11: _bindgen_ty_5 = 227; +pub const AKEYCODE_12: _bindgen_ty_5 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_5 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_5 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_5 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_5 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_5 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_5 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_5 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_5 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_5 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_5 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_5 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_5 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_5 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_5 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_5 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_5 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_5 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_5 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_5 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_5 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_5 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_5 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_5 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_5 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_5 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_5 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_5 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_5 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_5 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_5 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_5 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_5 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_5 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_5 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_5 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_5 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_5 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_5 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_5 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_5 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_5 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_5 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_5 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_5 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_5 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_5 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_5 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_5 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_5 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_5 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_5 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_5 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_5 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_5 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_5 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_5 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_5 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_5 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_5 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_5 = 288; +pub type _bindgen_ty_5 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ALooper { + _unused: [u8; 0], +} +extern "C" { + pub fn ALooper_forThread() -> *mut ALooper; +} +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_6 = 1; +pub type _bindgen_ty_6 = u32; +extern "C" { + pub fn ALooper_prepare(opts: ::std::os::raw::c_int) -> *mut ALooper; +} +pub const ALOOPER_POLL_WAKE: _bindgen_ty_7 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_7 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_7 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_7 = -4; +pub type _bindgen_ty_7 = i32; +extern "C" { + pub fn ALooper_acquire(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_release(looper: *mut ALooper); +} +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_8 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_8 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_8 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_8 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_8 = 16; +pub type _bindgen_ty_8 = u32; +pub type ALooper_callbackFunc = ::std::option::Option< + unsafe extern "C" fn( + fd: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn ALooper_pollOnce( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_pollAll( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_wake(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_addFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ident: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_removeFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_9 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_9 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_9 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_9 = 2; +pub type _bindgen_ty_9 = i32; +pub const AMETA_NONE: _bindgen_ty_10 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_10 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_10 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_10 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_10 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_10 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_10 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_10 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_10 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_10 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_10 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_10 = 16384; +pub const AMETA_META_ON: _bindgen_ty_10 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_10 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_10 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_10 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_10 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_10 = 4194304; +pub type _bindgen_ty_10 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputEvent { + _unused: [u8; 0], +} +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_11 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_11 = 2; +pub type _bindgen_ty_11 = u32; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_12 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_12 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_12 = 2; +pub type _bindgen_ty_12 = u32; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_13 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_13 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_13 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_13 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_13 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_13 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_13 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_13 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_13 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_13 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_13 = 1024; +pub type _bindgen_ty_13 = u32; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_14 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_14 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_14 = 12; +pub type _bindgen_ty_14 = u32; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_15 = 1; +pub type _bindgen_ty_15 = u32; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_16 = 8; +pub type _bindgen_ty_16 = u32; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_17 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_17 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_17 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_17 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_17 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_17 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_17 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_17 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_17 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_17 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_17 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_17 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_17 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_17 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_17 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_17 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_17 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_17 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_17 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_17 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_17 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_17 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_17 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_17 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_17 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_17 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_17 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_17 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_17 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_17 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_17 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_17 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_17 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_17 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_17 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_17 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_17 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_17 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_17 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_17 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_17 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_17 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_17 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_17 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_17 = 47; +pub type _bindgen_ty_17 = u32; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_18 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_18 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_18 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_18 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_18 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_18 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_18 = 64; +pub type _bindgen_ty_18 = u32; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_19 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_19 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_19 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_19 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_19 = 4; +pub type _bindgen_ty_19 = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_20 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_20 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_20 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_20 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_20 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_20 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_20 = 16; +pub type _bindgen_ty_20 = u32; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_21 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_21 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_21 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_21 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_21 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_21 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_21 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_21 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_21 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_21 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_21 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_21 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_21 = 16777232; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_21 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_21 = 4294967040; +pub type _bindgen_ty_21 = u32; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_22 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_22 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_22 = 2; +pub type _bindgen_ty_22 = u32; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_23 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_23 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_23 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_23 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_23 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_23 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_23 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_23 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_23 = 8; +pub type _bindgen_ty_23 = u32; +extern "C" { + pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getDeviceId(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getFlags(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getKeyCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getScanCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getMetaState(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getRepeatCount(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getDownTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getMetaState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getButtonState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getEdgeFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getDownTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getEventTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getXOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getXPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; +} +extern "C" { + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; +} +extern "C" { + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getHistoricalEventTime( + motion_event: *const AInputEvent, + history_index: usize, + ) -> i64; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalPressure( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalSize( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputQueue { + _unused: [u8; 0], +} +extern "C" { + pub fn AInputQueue_attachLooper( + queue: *mut AInputQueue, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AInputQueue_detachLooper(queue: *mut AInputQueue); +} +extern "C" { + pub fn AInputQueue_hasEvents(queue: *mut AInputQueue) -> i32; +} +extern "C" { + pub fn AInputQueue_getEvent(queue: *mut AInputQueue, outEvent: *mut *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_preDispatchEvent(queue: *mut AInputQueue, event: *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_finishEvent( + queue: *mut AInputQueue, + event: *mut AInputEvent, + handled: ::std::os::raw::c_int, + ); +} +pub const android_LogPriority_ANDROID_LOG_UNKNOWN: android_LogPriority = 0; +pub const android_LogPriority_ANDROID_LOG_DEFAULT: android_LogPriority = 1; +pub const android_LogPriority_ANDROID_LOG_VERBOSE: android_LogPriority = 2; +pub const android_LogPriority_ANDROID_LOG_DEBUG: android_LogPriority = 3; +pub const android_LogPriority_ANDROID_LOG_INFO: android_LogPriority = 4; +pub const android_LogPriority_ANDROID_LOG_WARN: android_LogPriority = 5; +pub const android_LogPriority_ANDROID_LOG_ERROR: android_LogPriority = 6; +pub const android_LogPriority_ANDROID_LOG_FATAL: android_LogPriority = 7; +pub const android_LogPriority_ANDROID_LOG_SILENT: android_LogPriority = 8; +pub type android_LogPriority = u32; +extern "C" { + pub fn __android_log_write( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_print( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_vprint( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ap: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_assert( + cond: *const ::std::os::raw::c_char, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ); +} +pub const log_id_LOG_ID_MIN: log_id = 0; +pub const log_id_LOG_ID_MAIN: log_id = 0; +pub const log_id_LOG_ID_RADIO: log_id = 1; +pub const log_id_LOG_ID_EVENTS: log_id = 2; +pub const log_id_LOG_ID_SYSTEM: log_id = 3; +pub const log_id_LOG_ID_CRASH: log_id = 4; +pub const log_id_LOG_ID_STATS: log_id = 5; +pub const log_id_LOG_ID_SECURITY: log_id = 6; +pub const log_id_LOG_ID_KERNEL: log_id = 7; +pub const log_id_LOG_ID_MAX: log_id = 8; +pub type log_id = u32; +pub use self::log_id as log_id_t; +extern "C" { + pub fn __android_log_buf_write( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_buf_print( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +pub type __kernel_sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[repr(align(4))] +#[derive(Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: __kernel_sa_family_t, + pub __data: [::std::os::raw::c_char; 126usize], +} +#[test] +fn bindgen_test_layout_sockaddr_storage() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(sockaddr_storage)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sockaddr_storage)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ss_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(ss_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(__data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct f_owner_ex { + pub type_: ::std::os::raw::c_int, + pub pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_f_owner_ex() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(f_owner_ex)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(f_owner_ex)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_off_t, + pub l_len: __kernel_off_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(flock)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(flock)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock64 { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_loff_t, + pub l_len: __kernel_loff_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock64() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(flock64)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(flock64)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: __kernel_size_t, +} +#[test] +fn bindgen_test_layout_iovec() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(iovec)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(iovec)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_len as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_len) + ) + ); +} +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + _unused: [u8; 0], +} +pub const SHUT_RD: _bindgen_ty_24 = 0; +pub const SHUT_WR: _bindgen_ty_24 = 1; +pub const SHUT_RDWR: _bindgen_ty_24 = 2; +pub type _bindgen_ty_24 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[test] +fn bindgen_test_layout_sockaddr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sockaddr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(sockaddr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_linger() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(linger)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(linger)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_onoff as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_onoff) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_linger as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_linger) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_msghdr() { + assert_eq!( + ::std::mem::size_of::(), + 28usize, + concat!("Size of: ", stringify!(msghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(msghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_namelen as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_namelen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iov as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iov) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iovlen as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iovlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_control as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_controllen as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_controllen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_flags as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mmsghdr { + pub msg_hdr: msghdr, + pub msg_len: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_mmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(mmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(mmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_hdr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_hdr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_len as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_cmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(cmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(cmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_level as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_level) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_type as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_type) + ) + ); +} +extern "C" { + pub fn __cmsg_nxthdr(__msg: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ucred { + pub pid: pid_t, + pub uid: uid_t, + pub gid: gid_t, +} +#[test] +fn bindgen_test_layout_ucred() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ucred)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ucred)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(pid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(uid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gid as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(gid) + ) + ); +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept4( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *mut ::std::os::raw::c_void, + __value_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen( + __fd: ::std::os::raw::c_int, + __backlog: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *mut mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + __timeout: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __msg: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *const mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __msg: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *const ::std::os::raw::c_void, + __value_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socket( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __dst_addr: *const sockaddr, + __dst_addr_length: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __src_addr: *mut sockaddr, + __src_addr_length: *mut socklen_t, + ) -> isize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct hostent { + pub h_name: *mut ::std::os::raw::c_char, + pub h_aliases: *mut *mut ::std::os::raw::c_char, + pub h_addrtype: ::std::os::raw::c_int, + pub h_length: ::std::os::raw::c_int, + pub h_addr_list: *mut *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_hostent() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(hostent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(hostent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addrtype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_length as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_length) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addr_list as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addr_list) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct netent { + pub n_name: *mut ::std::os::raw::c_char, + pub n_aliases: *mut *mut ::std::os::raw::c_char, + pub n_addrtype: ::std::os::raw::c_int, + pub n_net: u32, +} +#[test] +fn bindgen_test_layout_netent() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(netent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(netent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_addrtype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_net as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_net) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct servent { + pub s_name: *mut ::std::os::raw::c_char, + pub s_aliases: *mut *mut ::std::os::raw::c_char, + pub s_port: ::std::os::raw::c_int, + pub s_proto: *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_servent() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(servent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(servent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_port as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_port) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_proto as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct protoent { + pub p_name: *mut ::std::os::raw::c_char, + pub p_aliases: *mut *mut ::std::os::raw::c_char, + pub p_proto: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_protoent() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(protoent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(protoent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_aliases as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_proto as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct addrinfo { + pub ai_flags: ::std::os::raw::c_int, + pub ai_family: ::std::os::raw::c_int, + pub ai_socktype: ::std::os::raw::c_int, + pub ai_protocol: ::std::os::raw::c_int, + pub ai_addrlen: socklen_t, + pub ai_canonname: *mut ::std::os::raw::c_char, + pub ai_addr: *mut sockaddr, + pub ai_next: *mut addrinfo, +} +#[test] +fn bindgen_test_layout_addrinfo() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(addrinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(addrinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_family as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_socktype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_socktype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_protocol as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_protocol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addrlen as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addrlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_canonname as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_canonname) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addr as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_next as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_next) + ) + ); +} +extern "C" { + pub fn getaddrinfo( + __node: *const ::std::os::raw::c_char, + __service: *const ::std::os::raw::c_char, + __hints: *const addrinfo, + __result: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn freeaddrinfo(__ptr: *mut addrinfo); +} +extern "C" { + pub fn getnameinfo( + __sa: *const sockaddr, + __sa_length: socklen_t, + __host: *mut ::std::os::raw::c_char, + __host_length: usize, + __service: *mut ::std::os::raw::c_char, + __service_length: usize, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gai_strerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn __get_h_errno() -> *mut ::std::os::raw::c_int; +} +extern "C" { + pub fn herror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn hstrerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn gethostbyaddr( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyaddr_r( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname(__name: *const ::std::os::raw::c_char) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname_r( + __name: *const ::std::os::raw::c_char, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname2( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname2_r( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn endhostent(); +} +extern "C" { + pub fn gethostent() -> *mut hostent; +} +extern "C" { + pub fn sethostent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endnetent(); +} +extern "C" { + pub fn getnetbyaddr(__net: u32, __type: ::std::os::raw::c_int) -> *mut netent; +} +extern "C" { + pub fn getnetbyname(__name: *const ::std::os::raw::c_char) -> *mut netent; +} +extern "C" { + pub fn getnetent() -> *mut netent; +} +extern "C" { + pub fn setnetent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endprotoent(); +} +extern "C" { + pub fn getprotobyname(__name: *const ::std::os::raw::c_char) -> *mut protoent; +} +extern "C" { + pub fn getprotobynumber(__proto: ::std::os::raw::c_int) -> *mut protoent; +} +extern "C" { + pub fn getprotoent() -> *mut protoent; +} +extern "C" { + pub fn setprotoent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endservent(); +} +extern "C" { + pub fn getservbyname( + __name: *const ::std::os::raw::c_char, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservbyport( + __port_in_network_order: ::std::os::raw::c_int, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservent() -> *mut servent; +} +extern "C" { + pub fn setservent(__stay_open: ::std::os::raw::c_int); +} +pub type fpos_t = off_t; +pub type fpos64_t = off64_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sFILE { + _unused: [u8; 0], +} +pub type FILE = __sFILE; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn clearerr(__fp: *mut FILE); +} +extern "C" { + pub fn fclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn feof(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __buf: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_uint, + __count: ::std::os::raw::c_uint, + __fp: *mut FILE, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn fscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fwrite( + __buf: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_uint, + __count: ::std::os::raw::c_uint, + __fp: *mut FILE, + ) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn getc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getdelim( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __delimiter: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn getline( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn perror(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn printf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn remove(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rewind(__fp: *mut FILE); +} +extern "C" { + pub fn scanf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuf(__fp: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __mode: ::std::os::raw::c_int, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __fp: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __args: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpnam(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __prefix: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn rename( + __old_path: *const ::std::os::raw::c_char, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __old_dir_fd: ::std::os::raw::c_int, + __old_path: *const ::std::os::raw::c_char, + __new_dir_fd: ::std::os::raw::c_int, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseek( + __fp: *mut FILE, + __offset: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__fp: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn fgetpos(__fp: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__fp: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko( + __fp: *mut FILE, + __offset: off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__fp: *mut FILE) -> off_t; +} +extern "C" { + pub fn fgetpos64(__fp: *mut FILE, __pos: *mut fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos64(__fp: *mut FILE, __pos: *const fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko64( + __fp: *mut FILE, + __offset: off64_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello64(__fp: *mut FILE) -> off64_t; +} +extern "C" { + pub fn fopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn fopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpfile64() -> *mut FILE; +} +extern "C" { + pub fn snprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_uint, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_uint, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: __builtin_va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ctermid(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __mode: *const ::std::os::raw::c_char) -> *mut FILE; +} +extern "C" { + pub fn fileno(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn flockfile(__fp: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__fp: *mut FILE); +} +extern "C" { + pub fn getc_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fmemopen( + __buf: *mut ::std::os::raw::c_void, + __size: usize, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __ptr: *mut *mut ::std::os::raw::c_char, + __size_ptr: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn asprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetln(__fp: *mut FILE, __length_ptr: *mut usize) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fpurge(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn setlinebuf(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vasprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: va_list, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__fp: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn malloc(__byte_count: ::std::os::raw::c_uint) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn calloc( + __item_count: ::std::os::raw::c_uint, + __item_size: ::std::os::raw::c_uint, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn realloc( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: ::std::os::raw::c_uint, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn reallocarray( + __ptr: *mut ::std::os::raw::c_void, + __item_count: usize, + __item_size: usize, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn free(__ptr: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn memalign(__alignment: usize, __byte_count: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn malloc_usable_size(__ptr: *const ::std::os::raw::c_void) -> usize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mallinfo { + pub arena: usize, + pub ordblks: usize, + pub smblks: usize, + pub hblks: usize, + pub hblkhd: usize, + pub usmblks: usize, + pub fsmblks: usize, + pub uordblks: usize, + pub fordblks: usize, + pub keepcost: usize, +} +#[test] +fn bindgen_test_layout_mallinfo() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(mallinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(mallinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arena as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(arena) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ordblks as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(ordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smblks as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(smblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblks as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblkhd as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblkhd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usmblks as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(usmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fsmblks as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fsmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uordblks as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(uordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fordblks as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).keepcost as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(keepcost) + ) + ); +} +extern "C" { + pub fn mallinfo() -> mallinfo; +} +extern "C" { + pub fn malloc_info( + __must_be_zero: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mallopt( + __option: ::std::os::raw::c_int, + __value: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut __malloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __realloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __free_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __caller: *const ::std::os::raw::c_void, + ), + >; +} +extern "C" { + pub static mut __memalign_hook: ::std::option::Option< + unsafe extern "C" fn( + __alignment: usize, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_t { + _unused: [u8; 0], +} +pub type locale_t = *mut __locale_t; +extern "C" { + pub fn abort(); +} +extern "C" { + pub fn exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn _Exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn atexit(__fn: ::std::option::Option) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn at_quick_exit( + __fn: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn quick_exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn putenv(__assignment: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setenv( + __name: *const ::std::os::raw::c_char, + __value: *const ::std::os::raw::c_char, + __overwrite: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearenv() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mkostemp64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemp( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps64( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp64(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtol( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn strtoll( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoul( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strtoull( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut ::std::os::raw::c_void, + __alignment: usize, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn strtod( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f64; +} +extern "C" { + pub fn strtoul_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn atoi(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn atol(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn atoll(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn realpath( + __path: *const ::std::os::raw::c_char, + __resolved: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bsearch( + __key: *const ::std::os::raw::c_void, + __base: *const ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn qsort( + __base: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ); +} +extern "C" { + pub fn arc4random() -> u32; +} +extern "C" { + pub fn arc4random_uniform(__upper_bound: u32) -> u32; +} +extern "C" { + pub fn arc4random_buf(__buf: *mut ::std::os::raw::c_void, __n: usize); +} +extern "C" { + pub fn rand_r(__seed_ptr: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; +} +extern "C" { + pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); +} +extern "C" { + pub fn lrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn mrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; +} +extern "C" { + pub fn srand48(__seed: ::std::os::raw::c_long); +} +extern "C" { + pub fn initstate( + __seed: ::std::os::raw::c_uint, + __state: *mut ::std::os::raw::c_char, + __n: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn setstate(__state: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getpt() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn posix_openpt(__flags: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ptsname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ptsname_r( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unlockpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsubopt( + __option: *mut *mut ::std::os::raw::c_char, + __tokens: *const *mut ::std::os::raw::c_char, + __value_ptr: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct div_t { + pub quot: ::std::os::raw::c_int, + pub rem: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_div_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(div_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(div_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn div(__numerator: ::std::os::raw::c_int, __denominator: ::std::os::raw::c_int) -> div_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ldiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_ldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(ldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn ldiv( + __numerator: ::std::os::raw::c_long, + __denominator: ::std::os::raw::c_long, + ) -> ldiv_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lldiv_t { + pub quot: ::std::os::raw::c_longlong, + pub rem: ::std::os::raw::c_longlong, +} +#[test] +fn bindgen_test_layout_lldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(lldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(lldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn lldiv( + __numerator: ::std::os::raw::c_longlong, + __denominator: ::std::os::raw::c_longlong, + ) -> lldiv_t; +} +extern "C" { + pub fn getloadavg(__averages: *mut f64, __n: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getprogname() -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn setprogname(__name: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbstowcs(__dst: *mut wchar_t, __src: *const ::std::os::raw::c_char, __n: usize) + -> usize; +} +extern "C" { + pub fn mbtowc( + __wc_ptr: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wctomb(__dst: *mut ::std::os::raw::c_char, __wc: wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wcstombs(__dst: *mut ::std::os::raw::c_char, __src: *const wchar_t, __n: usize) + -> usize; +} +extern "C" { + pub fn __ctype_get_mb_cur_max() -> usize; +} +extern "C" { + pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtof( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f32; +} +extern "C" { + pub fn atof(__s: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn rand() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn random() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srandom(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn grantpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtoll_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoull_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn strtold_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f64; +} +extern "C" { + pub fn strtod_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f64; +} +extern "C" { + pub fn strtof_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f32; +} +extern "C" { + pub fn strtol_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + arg1: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_long; +} +pub type net_handle_t = u64; +extern "C" { + pub fn android_setsocknetwork( + network: net_handle_t, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_setprocnetwork(network: net_handle_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_getaddrinfofornetwork( + network: net_handle_t, + node: *const ::std::os::raw::c_char, + service: *const ::std::os::raw::c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +pub const ResNsendFlags_ANDROID_RESOLV_NO_RETRY: ResNsendFlags = 1; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_STORE: ResNsendFlags = 2; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_LOOKUP: ResNsendFlags = 4; +pub type ResNsendFlags = u32; +extern "C" { + pub fn android_res_nquery( + network: net_handle_t, + dname: *const ::std::os::raw::c_char, + ns_class: ::std::os::raw::c_int, + ns_type: ::std::os::raw::c_int, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nsend( + network: net_handle_t, + msg: *const u8, + msglen: usize, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nresult( + fd: ::std::os::raw::c_int, + rcode: *mut ::std::os::raw::c_int, + answer: *mut u8, + anslen: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_cancel(nsend_fd: ::std::os::raw::c_int); +} +pub const OperandCode_ANEURALNETWORKS_FLOAT32: OperandCode = 0; +pub const OperandCode_ANEURALNETWORKS_INT32: OperandCode = 1; +pub const OperandCode_ANEURALNETWORKS_UINT32: OperandCode = 2; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT32: OperandCode = 3; +pub const OperandCode_ANEURALNETWORKS_TENSOR_INT32: OperandCode = 4; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_ASYMM: OperandCode = 5; +pub const OperandCode_ANEURALNETWORKS_BOOL: OperandCode = 6; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_SYMM: OperandCode = 7; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT16: OperandCode = 8; +pub const OperandCode_ANEURALNETWORKS_TENSOR_BOOL8: OperandCode = 9; +pub const OperandCode_ANEURALNETWORKS_FLOAT16: OperandCode = 10; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL: OperandCode = 11; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_ASYMM: OperandCode = 12; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM: OperandCode = 13; +pub type OperandCode = u32; +pub const OperationCode_ANEURALNETWORKS_ADD: OperationCode = 0; +pub const OperationCode_ANEURALNETWORKS_AVERAGE_POOL_2D: OperationCode = 1; +pub const OperationCode_ANEURALNETWORKS_CONCATENATION: OperationCode = 2; +pub const OperationCode_ANEURALNETWORKS_CONV_2D: OperationCode = 3; +pub const OperationCode_ANEURALNETWORKS_DEPTHWISE_CONV_2D: OperationCode = 4; +pub const OperationCode_ANEURALNETWORKS_DEPTH_TO_SPACE: OperationCode = 5; +pub const OperationCode_ANEURALNETWORKS_DEQUANTIZE: OperationCode = 6; +pub const OperationCode_ANEURALNETWORKS_EMBEDDING_LOOKUP: OperationCode = 7; +pub const OperationCode_ANEURALNETWORKS_FLOOR: OperationCode = 8; +pub const OperationCode_ANEURALNETWORKS_FULLY_CONNECTED: OperationCode = 9; +pub const OperationCode_ANEURALNETWORKS_HASHTABLE_LOOKUP: OperationCode = 10; +pub const OperationCode_ANEURALNETWORKS_L2_NORMALIZATION: OperationCode = 11; +pub const OperationCode_ANEURALNETWORKS_L2_POOL_2D: OperationCode = 12; +pub const OperationCode_ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION: OperationCode = 13; +pub const OperationCode_ANEURALNETWORKS_LOGISTIC: OperationCode = 14; +pub const OperationCode_ANEURALNETWORKS_LSH_PROJECTION: OperationCode = 15; +pub const OperationCode_ANEURALNETWORKS_LSTM: OperationCode = 16; +pub const OperationCode_ANEURALNETWORKS_MAX_POOL_2D: OperationCode = 17; +pub const OperationCode_ANEURALNETWORKS_MUL: OperationCode = 18; +pub const OperationCode_ANEURALNETWORKS_RELU: OperationCode = 19; +pub const OperationCode_ANEURALNETWORKS_RELU1: OperationCode = 20; +pub const OperationCode_ANEURALNETWORKS_RELU6: OperationCode = 21; +pub const OperationCode_ANEURALNETWORKS_RESHAPE: OperationCode = 22; +pub const OperationCode_ANEURALNETWORKS_RESIZE_BILINEAR: OperationCode = 23; +pub const OperationCode_ANEURALNETWORKS_RNN: OperationCode = 24; +pub const OperationCode_ANEURALNETWORKS_SOFTMAX: OperationCode = 25; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_DEPTH: OperationCode = 26; +pub const OperationCode_ANEURALNETWORKS_SVDF: OperationCode = 27; +pub const OperationCode_ANEURALNETWORKS_TANH: OperationCode = 28; +pub const OperationCode_ANEURALNETWORKS_BATCH_TO_SPACE_ND: OperationCode = 29; +pub const OperationCode_ANEURALNETWORKS_DIV: OperationCode = 30; +pub const OperationCode_ANEURALNETWORKS_MEAN: OperationCode = 31; +pub const OperationCode_ANEURALNETWORKS_PAD: OperationCode = 32; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_BATCH_ND: OperationCode = 33; +pub const OperationCode_ANEURALNETWORKS_SQUEEZE: OperationCode = 34; +pub const OperationCode_ANEURALNETWORKS_STRIDED_SLICE: OperationCode = 35; +pub const OperationCode_ANEURALNETWORKS_SUB: OperationCode = 36; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE: OperationCode = 37; +pub const OperationCode_ANEURALNETWORKS_ABS: OperationCode = 38; +pub const OperationCode_ANEURALNETWORKS_ARGMAX: OperationCode = 39; +pub const OperationCode_ANEURALNETWORKS_ARGMIN: OperationCode = 40; +pub const OperationCode_ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM: OperationCode = 41; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 42; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 43; +pub const OperationCode_ANEURALNETWORKS_BOX_WITH_NMS_LIMIT: OperationCode = 44; +pub const OperationCode_ANEURALNETWORKS_CAST: OperationCode = 45; +pub const OperationCode_ANEURALNETWORKS_CHANNEL_SHUFFLE: OperationCode = 46; +pub const OperationCode_ANEURALNETWORKS_DETECTION_POSTPROCESSING: OperationCode = 47; +pub const OperationCode_ANEURALNETWORKS_EQUAL: OperationCode = 48; +pub const OperationCode_ANEURALNETWORKS_EXP: OperationCode = 49; +pub const OperationCode_ANEURALNETWORKS_EXPAND_DIMS: OperationCode = 50; +pub const OperationCode_ANEURALNETWORKS_GATHER: OperationCode = 51; +pub const OperationCode_ANEURALNETWORKS_GENERATE_PROPOSALS: OperationCode = 52; +pub const OperationCode_ANEURALNETWORKS_GREATER: OperationCode = 53; +pub const OperationCode_ANEURALNETWORKS_GREATER_EQUAL: OperationCode = 54; +pub const OperationCode_ANEURALNETWORKS_GROUPED_CONV_2D: OperationCode = 55; +pub const OperationCode_ANEURALNETWORKS_HEATMAP_MAX_KEYPOINT: OperationCode = 56; +pub const OperationCode_ANEURALNETWORKS_INSTANCE_NORMALIZATION: OperationCode = 57; +pub const OperationCode_ANEURALNETWORKS_LESS: OperationCode = 58; +pub const OperationCode_ANEURALNETWORKS_LESS_EQUAL: OperationCode = 59; +pub const OperationCode_ANEURALNETWORKS_LOG: OperationCode = 60; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_AND: OperationCode = 61; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_NOT: OperationCode = 62; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_OR: OperationCode = 63; +pub const OperationCode_ANEURALNETWORKS_LOG_SOFTMAX: OperationCode = 64; +pub const OperationCode_ANEURALNETWORKS_MAXIMUM: OperationCode = 65; +pub const OperationCode_ANEURALNETWORKS_MINIMUM: OperationCode = 66; +pub const OperationCode_ANEURALNETWORKS_NEG: OperationCode = 67; +pub const OperationCode_ANEURALNETWORKS_NOT_EQUAL: OperationCode = 68; +pub const OperationCode_ANEURALNETWORKS_PAD_V2: OperationCode = 69; +pub const OperationCode_ANEURALNETWORKS_POW: OperationCode = 70; +pub const OperationCode_ANEURALNETWORKS_PRELU: OperationCode = 71; +pub const OperationCode_ANEURALNETWORKS_QUANTIZE: OperationCode = 72; +pub const OperationCode_ANEURALNETWORKS_QUANTIZED_16BIT_LSTM: OperationCode = 73; +pub const OperationCode_ANEURALNETWORKS_RANDOM_MULTINOMIAL: OperationCode = 74; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ALL: OperationCode = 75; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ANY: OperationCode = 76; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MAX: OperationCode = 77; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MIN: OperationCode = 78; +pub const OperationCode_ANEURALNETWORKS_REDUCE_PROD: OperationCode = 79; +pub const OperationCode_ANEURALNETWORKS_REDUCE_SUM: OperationCode = 80; +pub const OperationCode_ANEURALNETWORKS_ROI_ALIGN: OperationCode = 81; +pub const OperationCode_ANEURALNETWORKS_ROI_POOLING: OperationCode = 82; +pub const OperationCode_ANEURALNETWORKS_RSQRT: OperationCode = 83; +pub const OperationCode_ANEURALNETWORKS_SELECT: OperationCode = 84; +pub const OperationCode_ANEURALNETWORKS_SIN: OperationCode = 85; +pub const OperationCode_ANEURALNETWORKS_SLICE: OperationCode = 86; +pub const OperationCode_ANEURALNETWORKS_SPLIT: OperationCode = 87; +pub const OperationCode_ANEURALNETWORKS_SQRT: OperationCode = 88; +pub const OperationCode_ANEURALNETWORKS_TILE: OperationCode = 89; +pub const OperationCode_ANEURALNETWORKS_TOPK_V2: OperationCode = 90; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE_CONV_2D: OperationCode = 91; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 92; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 93; +pub const OperationCode_ANEURALNETWORKS_RESIZE_NEAREST_NEIGHBOR: OperationCode = 94; +pub type OperationCode = u32; +pub const FuseCode_ANEURALNETWORKS_FUSED_NONE: FuseCode = 0; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU: FuseCode = 1; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU1: FuseCode = 2; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU6: FuseCode = 3; +pub type FuseCode = u32; +pub const PaddingCode_ANEURALNETWORKS_PADDING_SAME: PaddingCode = 1; +pub const PaddingCode_ANEURALNETWORKS_PADDING_VALID: PaddingCode = 2; +pub type PaddingCode = u32; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_LOW_POWER: PreferenceCode = 0; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER: PreferenceCode = 1; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_SUSTAINED_SPEED: PreferenceCode = 2; +pub type PreferenceCode = u32; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_UNKNOWN: DeviceTypeCode = 0; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_OTHER: DeviceTypeCode = 1; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_CPU: DeviceTypeCode = 2; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_GPU: DeviceTypeCode = 3; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_ACCELERATOR: DeviceTypeCode = 4; +pub type DeviceTypeCode = u32; +pub const ResultCode_ANEURALNETWORKS_NO_ERROR: ResultCode = 0; +pub const ResultCode_ANEURALNETWORKS_OUT_OF_MEMORY: ResultCode = 1; +pub const ResultCode_ANEURALNETWORKS_INCOMPLETE: ResultCode = 2; +pub const ResultCode_ANEURALNETWORKS_UNEXPECTED_NULL: ResultCode = 3; +pub const ResultCode_ANEURALNETWORKS_BAD_DATA: ResultCode = 4; +pub const ResultCode_ANEURALNETWORKS_OP_FAILED: ResultCode = 5; +pub const ResultCode_ANEURALNETWORKS_BAD_STATE: ResultCode = 6; +pub const ResultCode_ANEURALNETWORKS_UNMAPPABLE: ResultCode = 7; +pub const ResultCode_ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE: ResultCode = 8; +pub const ResultCode_ANEURALNETWORKS_UNAVAILABLE_DEVICE: ResultCode = 9; +pub type ResultCode = u32; +pub const ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES: _bindgen_ty_25 = 128; +pub type _bindgen_ty_25 = u32; +pub const ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN: _bindgen_ty_26 = 32; +pub type _bindgen_ty_26 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksMemory { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksModel { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksCompilation { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksExecution { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksSymmPerChannelQuantParams { + pub channelDim: u32, + pub scaleCount: u32, + pub scales: *const f32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksSymmPerChannelQuantParams() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).channelDim + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(channelDim) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scaleCount + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scaleCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scales as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scales) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksBurst { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksOperandType { + pub type_: i32, + pub dimensionCount: u32, + pub dimensions: *const u32, + pub scale: f32, + pub zeroPoint: i32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksOperandType() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensionCount as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensionCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensions as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensions) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scale as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(scale) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zeroPoint as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(zeroPoint) + ) + ); +} +pub type ANeuralNetworksOperationType = i32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksEvent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksDevice { + _unused: [u8; 0], +} +extern "C" { + pub fn ANeuralNetworks_getDeviceCount(numDevices: *mut u32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworks_getDevice( + devIndex: u32, + device: *mut *mut ANeuralNetworksDevice, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getName( + device: *const ANeuralNetworksDevice, + name: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getType( + device: *const ANeuralNetworksDevice, + type_: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getVersion( + device: *const ANeuralNetworksDevice, + version: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getFeatureLevel( + device: *const ANeuralNetworksDevice, + featureLevel: *mut i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_getSupportedOperationsForDevices( + model: *const ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + supportedOps: *mut bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_createForDevices( + model: *mut ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_setCaching( + compilation: *mut ANeuralNetworksCompilation, + cacheDir: *const ::std::os::raw::c_char, + token: *const u8, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_compute( + execution: *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandRank( + execution: *mut ANeuralNetworksExecution, + index: i32, + rank: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandDimensions( + execution: *mut ANeuralNetworksExecution, + index: i32, + dimensions: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_create( + compilation: *mut ANeuralNetworksCompilation, + burst: *mut *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_free(burst: *mut ANeuralNetworksBurst); +} +extern "C" { + pub fn ANeuralNetworksExecution_burstCompute( + execution: *mut ANeuralNetworksExecution, + burst: *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromAHardwareBuffer( + ahwb: *const AHardwareBuffer, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setMeasureTiming( + execution: *mut ANeuralNetworksExecution, + measure: bool, + ) -> ::std::os::raw::c_int; +} +pub const DurationCode_ANEURALNETWORKS_DURATION_ON_HARDWARE: DurationCode = 0; +pub const DurationCode_ANEURALNETWORKS_DURATION_IN_DRIVER: DurationCode = 1; +pub type DurationCode = u32; +extern "C" { + pub fn ANeuralNetworksExecution_getDuration( + execution: *const ANeuralNetworksExecution, + durationCode: i32, + duration: *mut u64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromFd( + size: usize, + protect: ::std::os::raw::c_int, + fd: ::std::os::raw::c_int, + offset: usize, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_free(memory: *mut ANeuralNetworksMemory); +} +extern "C" { + pub fn ANeuralNetworksModel_create( + model: *mut *mut ANeuralNetworksModel, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_free(model: *mut ANeuralNetworksModel); +} +extern "C" { + pub fn ANeuralNetworksModel_finish(model: *mut ANeuralNetworksModel) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperand( + model: *mut ANeuralNetworksModel, + type_: *const ANeuralNetworksOperandType, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValue( + model: *mut ANeuralNetworksModel, + index: i32, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandSymmPerChannelQuantParams( + model: *mut ANeuralNetworksModel, + index: i32, + channelQuant: *const ANeuralNetworksSymmPerChannelQuantParams, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValueFromMemory( + model: *mut ANeuralNetworksModel, + index: i32, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperation( + model: *mut ANeuralNetworksModel, + type_: ANeuralNetworksOperationType, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_identifyInputsAndOutputs( + model: *mut ANeuralNetworksModel, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_relaxComputationFloat32toFloat16( + model: *mut ANeuralNetworksModel, + allow: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_create( + model: *mut ANeuralNetworksModel, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_free(compilation: *mut ANeuralNetworksCompilation); +} +extern "C" { + pub fn ANeuralNetworksCompilation_setPreference( + compilation: *mut ANeuralNetworksCompilation, + preference: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_finish( + compilation: *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_create( + compilation: *mut ANeuralNetworksCompilation, + execution: *mut *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_free(execution: *mut ANeuralNetworksExecution); +} +extern "C" { + pub fn ANeuralNetworksExecution_setInput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setInputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *mut ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_startCompute( + execution: *mut ANeuralNetworksExecution, + event: *mut *mut ANeuralNetworksEvent, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_wait(event: *mut ANeuralNetworksEvent) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_free(event: *mut ANeuralNetworksEvent); +} +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBA_8888: ANativeWindow_LegacyFormat = 1; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBX_8888: ANativeWindow_LegacyFormat = 2; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGB_565: ANativeWindow_LegacyFormat = 4; +pub type ANativeWindow_LegacyFormat = u32; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_IDENTITY: ANativeWindowTransform = 0; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL: ANativeWindowTransform = + 1; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL: ANativeWindowTransform = + 2; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_90: ANativeWindowTransform = 4; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_180: ANativeWindowTransform = 3; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_270: ANativeWindowTransform = 7; +pub type ANativeWindowTransform = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow_Buffer { + pub width: i32, + pub height: i32, + pub stride: i32, + pub format: i32, + pub bits: *mut ::std::os::raw::c_void, + pub reserved: [u32; 6usize], +} +#[test] +fn bindgen_test_layout_ANativeWindow_Buffer() { + assert_eq!( + ::std::mem::size_of::(), + 44usize, + concat!("Size of: ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bits as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(bits) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(reserved) + ) + ); +} +extern "C" { + pub fn ANativeWindow_acquire(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_release(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_getWidth(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getHeight(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getFormat(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersGeometry( + window: *mut ANativeWindow, + width: i32, + height: i32, + format: i32, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_lock( + window: *mut ANativeWindow, + outBuffer: *mut ANativeWindow_Buffer, + inOutDirtyBounds: *mut ARect, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_unlockAndPost(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersTransform(window: *mut ANativeWindow, transform: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersDataSpace(window: *mut ANativeWindow, dataSpace: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_getBuffersDataSpace(window: *mut ANativeWindow) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivity { + pub callbacks: *mut ANativeActivityCallbacks, + pub vm: *mut JavaVM, + pub env: *mut JNIEnv, + pub clazz: jobject, + pub internalDataPath: *const ::std::os::raw::c_char, + pub externalDataPath: *const ::std::os::raw::c_char, + pub sdkVersion: i32, + pub instance: *mut ::std::os::raw::c_void, + pub assetManager: *mut AAssetManager, + pub obbPath: *const ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_ANativeActivity() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(ANativeActivity)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANativeActivity)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(callbacks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(vm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(env) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clazz as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(clazz) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).internalDataPath as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(internalDataPath) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).externalDataPath as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(externalDataPath) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(sdkVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(instance) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(assetManager) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(obbPath) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivityCallbacks { + pub onStart: ::std::option::Option, + pub onResume: ::std::option::Option, + pub onSaveInstanceState: ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + outSize: *mut usize, + ) -> *mut ::std::os::raw::c_void, + >, + pub onPause: ::std::option::Option, + pub onStop: ::std::option::Option, + pub onDestroy: ::std::option::Option, + pub onWindowFocusChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, hasFocus: ::std::os::raw::c_int), + >, + pub onNativeWindowCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowResized: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowRedrawNeeded: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onInputQueueCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onInputQueueDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, rect: *const ARect), + >, + pub onConfigurationChanged: + ::std::option::Option, + pub onLowMemory: ::std::option::Option, +} +#[test] +fn bindgen_test_layout_ANativeActivityCallbacks() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onStart as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStart) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onResume as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onResume) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onSaveInstanceState as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onSaveInstanceState) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onPause as *const _ as usize + }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onPause) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStop) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onDestroy as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onDestroy) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ + as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onWindowFocusChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ + as usize + }, + 28usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowResized as *const _ + as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowResized) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded + as *const _ as usize + }, + 36usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowRedrawNeeded) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ + as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueCreated as *const _ + as usize + }, + 44usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueDestroyed as *const _ + as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onContentRectChanged as *const _ + as usize + }, + 52usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onContentRectChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onConfigurationChanged as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onConfigurationChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onLowMemory as *const _ as usize + }, + 60usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onLowMemory) + ) + ); +} +pub type ANativeActivity_createFunc = ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ), +>; +extern "C" { + pub fn ANativeActivity_onCreate( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ); +} +extern "C" { + pub fn ANativeActivity_finish(activity: *mut ANativeActivity); +} +extern "C" { + pub fn ANativeActivity_setWindowFormat(activity: *mut ANativeActivity, format: i32); +} +extern "C" { + pub fn ANativeActivity_setWindowFlags( + activity: *mut ANativeActivity, + addFlags: u32, + removeFlags: u32, + ); +} +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: _bindgen_ty_27 = 1; +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED: _bindgen_ty_27 = 2; +pub type _bindgen_ty_27 = u32; +extern "C" { + pub fn ANativeActivity_showSoftInput(activity: *mut ANativeActivity, flags: u32); +} +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: _bindgen_ty_28 = 1; +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: _bindgen_ty_28 = 2; +pub type _bindgen_ty_28 = u32; +extern "C" { + pub fn ANativeActivity_hideSoftInput(activity: *mut ANativeActivity, flags: u32); +} +extern "C" { + pub fn ANativeWindow_fromSurface(env: *mut JNIEnv, surface: jobject) -> *mut ANativeWindow; +} +extern "C" { + pub fn ANativeWindow_toSurface(env: *mut JNIEnv, window: *mut ANativeWindow) -> jobject; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AObbInfo { + _unused: [u8; 0], +} +pub const AOBBINFO_OVERLAY: _bindgen_ty_29 = 1; +pub type _bindgen_ty_29 = u32; +extern "C" { + pub fn AObbScanner_getObbInfo(filename: *const ::std::os::raw::c_char) -> *mut AObbInfo; +} +extern "C" { + pub fn AObbInfo_delete(obbInfo: *mut AObbInfo); +} +extern "C" { + pub fn AObbInfo_getPackageName(obbInfo: *mut AObbInfo) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AObbInfo_getVersion(obbInfo: *mut AObbInfo) -> i32; +} +extern "C" { + pub fn AObbInfo_getFlags(obbInfo: *mut AObbInfo) -> i32; +} +pub type __double_t = f64; +pub type double_t = __double_t; +pub type __float_t = f32; +pub type float_t = __float_t; +extern "C" { + pub fn acos(__x: f64) -> f64; +} +extern "C" { + pub fn acosf(__x: f32) -> f32; +} +extern "C" { + pub fn asin(__x: f64) -> f64; +} +extern "C" { + pub fn asinf(__x: f32) -> f32; +} +extern "C" { + pub fn atan(__x: f64) -> f64; +} +extern "C" { + pub fn atanf(__x: f32) -> f32; +} +extern "C" { + pub fn atan2(__y: f64, __x: f64) -> f64; +} +extern "C" { + pub fn atan2f(__y: f32, __x: f32) -> f32; +} +extern "C" { + pub fn cos(__x: f64) -> f64; +} +extern "C" { + pub fn cosf(__x: f32) -> f32; +} +extern "C" { + pub fn sin(__x: f64) -> f64; +} +extern "C" { + pub fn sinf(__x: f32) -> f32; +} +extern "C" { + pub fn tan(__x: f64) -> f64; +} +extern "C" { + pub fn tanf(__x: f32) -> f32; +} +extern "C" { + pub fn acosh(__x: f64) -> f64; +} +extern "C" { + pub fn acoshf(__x: f32) -> f32; +} +extern "C" { + pub fn asinh(__x: f64) -> f64; +} +extern "C" { + pub fn asinhf(__x: f32) -> f32; +} +extern "C" { + pub fn atanh(__x: f64) -> f64; +} +extern "C" { + pub fn atanhf(__x: f32) -> f32; +} +extern "C" { + pub fn cosh(__x: f64) -> f64; +} +extern "C" { + pub fn coshf(__x: f32) -> f32; +} +extern "C" { + pub fn sinh(__x: f64) -> f64; +} +extern "C" { + pub fn sinhf(__x: f32) -> f32; +} +extern "C" { + pub fn tanh(__x: f64) -> f64; +} +extern "C" { + pub fn tanhf(__x: f32) -> f32; +} +extern "C" { + pub fn exp(__x: f64) -> f64; +} +extern "C" { + pub fn expf(__x: f32) -> f32; +} +extern "C" { + pub fn exp2(__x: f64) -> f64; +} +extern "C" { + pub fn exp2f(__x: f32) -> f32; +} +extern "C" { + pub fn expm1(__x: f64) -> f64; +} +extern "C" { + pub fn expm1f(__x: f32) -> f32; +} +extern "C" { + pub fn frexp(__x: f64, __exponent: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn frexpf(__x: f32, __exponent: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn ilogb(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ilogbf(__x: f32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ldexp(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn ldexpf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn log(__x: f64) -> f64; +} +extern "C" { + pub fn logf(__x: f32) -> f32; +} +extern "C" { + pub fn log10(__x: f64) -> f64; +} +extern "C" { + pub fn log10f(__x: f32) -> f32; +} +extern "C" { + pub fn log1p(__x: f64) -> f64; +} +extern "C" { + pub fn log1pf(__x: f32) -> f32; +} +extern "C" { + pub fn log2(__x: f64) -> f64; +} +extern "C" { + pub fn log2f(__x: f32) -> f32; +} +extern "C" { + pub fn logb(__x: f64) -> f64; +} +extern "C" { + pub fn logbf(__x: f32) -> f32; +} +extern "C" { + pub fn modf(__x: f64, __integral_part: *mut f64) -> f64; +} +extern "C" { + pub fn modff(__x: f32, __integral_part: *mut f32) -> f32; +} +extern "C" { + pub fn scalbn(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn scalbnf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn scalbln(__x: f64, __exponent: ::std::os::raw::c_long) -> f64; +} +extern "C" { + pub fn scalblnf(__x: f32, __exponent: ::std::os::raw::c_long) -> f32; +} +extern "C" { + pub fn scalblnl(__x: f64, __exponent: ::std::os::raw::c_long) -> f64; +} +extern "C" { + pub fn cbrt(__x: f64) -> f64; +} +extern "C" { + pub fn cbrtf(__x: f32) -> f32; +} +extern "C" { + pub fn fabs(__x: f64) -> f64; +} +extern "C" { + pub fn fabsf(__x: f32) -> f32; +} +extern "C" { + pub fn hypot(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn hypotf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn pow(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn powf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn sqrt(__x: f64) -> f64; +} +extern "C" { + pub fn sqrtf(__x: f32) -> f32; +} +extern "C" { + pub fn erf(__x: f64) -> f64; +} +extern "C" { + pub fn erff(__x: f32) -> f32; +} +extern "C" { + pub fn erfc(__x: f64) -> f64; +} +extern "C" { + pub fn erfcf(__x: f32) -> f32; +} +extern "C" { + pub fn lgamma(__x: f64) -> f64; +} +extern "C" { + pub fn lgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn tgamma(__x: f64) -> f64; +} +extern "C" { + pub fn tgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn ceil(__x: f64) -> f64; +} +extern "C" { + pub fn ceilf(__x: f32) -> f32; +} +extern "C" { + pub fn floor(__x: f64) -> f64; +} +extern "C" { + pub fn floorf(__x: f32) -> f32; +} +extern "C" { + pub fn nearbyint(__x: f64) -> f64; +} +extern "C" { + pub fn nearbyintf(__x: f32) -> f32; +} +extern "C" { + pub fn rint(__x: f64) -> f64; +} +extern "C" { + pub fn rintf(__x: f32) -> f32; +} +extern "C" { + pub fn lrint(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lrintf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llrint(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llrintf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn round(__x: f64) -> f64; +} +extern "C" { + pub fn roundf(__x: f32) -> f32; +} +extern "C" { + pub fn roundl(__x: f64) -> f64; +} +extern "C" { + pub fn lround(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lroundf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llround(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llroundf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn trunc(__x: f64) -> f64; +} +extern "C" { + pub fn truncf(__x: f32) -> f32; +} +extern "C" { + pub fn fmod(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmodf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn remainder(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn remainderf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn remquo(__x: f64, __y: f64, __quotient_bits: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn remquof(__x: f32, __y: f32, __quotient_bits: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn copysign(__value: f64, __sign: f64) -> f64; +} +extern "C" { + pub fn copysignf(__value: f32, __sign: f32) -> f32; +} +extern "C" { + pub fn nan(__kind: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn nanf(__kind: *const ::std::os::raw::c_char) -> f32; +} +extern "C" { + pub fn nextafter(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn nextafterf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn nexttoward(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn nexttowardf(__x: f32, __y: f64) -> f32; +} +extern "C" { + pub fn fdim(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fdimf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmax(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmaxf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmin(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fminf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fma(__x: f64, __y: f64, __z: f64) -> f64; +} +extern "C" { + pub fn fmaf(__x: f32, __y: f32, __z: f32) -> f32; +} +extern "C" { + pub fn isinf(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isnan(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut signgam: ::std::os::raw::c_int; +} +extern "C" { + pub fn j0(__x: f64) -> f64; +} +extern "C" { + pub fn j1(__x: f64) -> f64; +} +extern "C" { + pub fn jn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +extern "C" { + pub fn y0(__x: f64) -> f64; +} +extern "C" { + pub fn y1(__x: f64) -> f64; +} +extern "C" { + pub fn yn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +pub const ASENSOR_TYPE_INVALID: _bindgen_ty_30 = -1; +pub const ASENSOR_TYPE_ACCELEROMETER: _bindgen_ty_30 = 1; +pub const ASENSOR_TYPE_MAGNETIC_FIELD: _bindgen_ty_30 = 2; +pub const ASENSOR_TYPE_GYROSCOPE: _bindgen_ty_30 = 4; +pub const ASENSOR_TYPE_LIGHT: _bindgen_ty_30 = 5; +pub const ASENSOR_TYPE_PRESSURE: _bindgen_ty_30 = 6; +pub const ASENSOR_TYPE_PROXIMITY: _bindgen_ty_30 = 8; +pub const ASENSOR_TYPE_GRAVITY: _bindgen_ty_30 = 9; +pub const ASENSOR_TYPE_LINEAR_ACCELERATION: _bindgen_ty_30 = 10; +pub const ASENSOR_TYPE_ROTATION_VECTOR: _bindgen_ty_30 = 11; +pub const ASENSOR_TYPE_RELATIVE_HUMIDITY: _bindgen_ty_30 = 12; +pub const ASENSOR_TYPE_AMBIENT_TEMPERATURE: _bindgen_ty_30 = 13; +pub const ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: _bindgen_ty_30 = 14; +pub const ASENSOR_TYPE_GAME_ROTATION_VECTOR: _bindgen_ty_30 = 15; +pub const ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED: _bindgen_ty_30 = 16; +pub const ASENSOR_TYPE_SIGNIFICANT_MOTION: _bindgen_ty_30 = 17; +pub const ASENSOR_TYPE_STEP_DETECTOR: _bindgen_ty_30 = 18; +pub const ASENSOR_TYPE_STEP_COUNTER: _bindgen_ty_30 = 19; +pub const ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: _bindgen_ty_30 = 20; +pub const ASENSOR_TYPE_HEART_RATE: _bindgen_ty_30 = 21; +pub const ASENSOR_TYPE_POSE_6DOF: _bindgen_ty_30 = 28; +pub const ASENSOR_TYPE_STATIONARY_DETECT: _bindgen_ty_30 = 29; +pub const ASENSOR_TYPE_MOTION_DETECT: _bindgen_ty_30 = 30; +pub const ASENSOR_TYPE_HEART_BEAT: _bindgen_ty_30 = 31; +pub const ASENSOR_TYPE_ADDITIONAL_INFO: _bindgen_ty_30 = 33; +pub const ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT: _bindgen_ty_30 = 34; +pub const ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED: _bindgen_ty_30 = 35; +pub type _bindgen_ty_30 = i32; +pub const ASENSOR_STATUS_NO_CONTACT: _bindgen_ty_31 = -1; +pub const ASENSOR_STATUS_UNRELIABLE: _bindgen_ty_31 = 0; +pub const ASENSOR_STATUS_ACCURACY_LOW: _bindgen_ty_31 = 1; +pub const ASENSOR_STATUS_ACCURACY_MEDIUM: _bindgen_ty_31 = 2; +pub const ASENSOR_STATUS_ACCURACY_HIGH: _bindgen_ty_31 = 3; +pub type _bindgen_ty_31 = i32; +pub const AREPORTING_MODE_INVALID: _bindgen_ty_32 = -1; +pub const AREPORTING_MODE_CONTINUOUS: _bindgen_ty_32 = 0; +pub const AREPORTING_MODE_ON_CHANGE: _bindgen_ty_32 = 1; +pub const AREPORTING_MODE_ONE_SHOT: _bindgen_ty_32 = 2; +pub const AREPORTING_MODE_SPECIAL_TRIGGER: _bindgen_ty_32 = 3; +pub type _bindgen_ty_32 = i32; +pub const ASENSOR_DIRECT_RATE_STOP: _bindgen_ty_33 = 0; +pub const ASENSOR_DIRECT_RATE_NORMAL: _bindgen_ty_33 = 1; +pub const ASENSOR_DIRECT_RATE_FAST: _bindgen_ty_33 = 2; +pub const ASENSOR_DIRECT_RATE_VERY_FAST: _bindgen_ty_33 = 3; +pub type _bindgen_ty_33 = u32; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY: _bindgen_ty_34 = 1; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER: _bindgen_ty_34 = 2; +pub type _bindgen_ty_34 = u32; +pub const ASENSOR_ADDITIONAL_INFO_BEGIN: _bindgen_ty_35 = 0; +pub const ASENSOR_ADDITIONAL_INFO_END: _bindgen_ty_35 = 1; +pub const ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY: _bindgen_ty_35 = 65536; +pub const ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE: _bindgen_ty_35 = 65537; +pub const ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION: _bindgen_ty_35 = 65538; +pub const ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT: _bindgen_ty_35 = 65539; +pub const ASENSOR_ADDITIONAL_INFO_SAMPLING: _bindgen_ty_35 = 65540; +pub type _bindgen_ty_35 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorVector { + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1, + pub status: i8, + pub reserved: [u8; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorVector__bindgen_ty_1 { + pub v: [f32; 3usize], + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1__bindgen_ty_1, + pub __bindgen_anon_2: ASensorVector__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_1 { + pub x: f32, + pub y: f32, + pub z: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_2 { + pub azimuth: f32, + pub pitch: f32, + pub roll: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).azimuth + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(azimuth) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pitch as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(pitch) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).roll as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(roll) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).v as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1), + "::", + stringify!(v) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ASensorVector)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AMetaDataEvent { + pub what: i32, + pub sensor: i32, +} +#[test] +fn bindgen_test_layout_AMetaDataEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).what as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(sensor) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AUncalibratedEvent { + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1, + pub __bindgen_anon_2: AUncalibratedEvent__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_1 { + pub uncalib: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1 { + pub x_uncalib: f32, + pub y_uncalib: f32, + pub z_uncalib: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_uncalib + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_uncalib + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_uncalib + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z_uncalib) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalib as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1), + "::", + stringify!(uncalib) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_2 { + pub bias: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1 { + pub x_bias: f32, + pub y_bias: f32, + pub z_bias: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_bias + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(x_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_bias + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(y_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_bias + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(z_bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).bias as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2), + "::", + stringify!(bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(AUncalibratedEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AUncalibratedEvent)) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHeartRateEvent { + pub bpm: f32, + pub status: i8, +} +#[test] +fn bindgen_test_layout_AHeartRateEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bpm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(bpm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(status) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ADynamicSensorEvent { + pub connected: i32, + pub handle: i32, +} +#[test] +fn bindgen_test_layout_ADynamicSensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).connected as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(connected) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(handle) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AAdditionalInfoEvent { + pub type_: i32, + pub serial: i32, + pub __bindgen_anon_1: AAdditionalInfoEvent__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AAdditionalInfoEvent__bindgen_ty_1 { + pub data_int32: [i32; 14usize], + pub data_float: [f32; 14usize], + _bindgen_union_align: [u32; 14usize], +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_int32 as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_int32) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_float as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_float) + ) + ); +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).serial as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(serial) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorEvent { + pub version: i32, + pub sensor: i32, + pub type_: i32, + pub reserved0: i32, + pub timestamp: i64, + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1, + pub flags: u32, + pub reserved1: [i32; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1 { + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1__bindgen_ty_1, + pub u64: ASensorEvent__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u32; 16usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_1 { + pub data: [f32; 16usize], + pub vector: ASensorVector, + pub acceleration: ASensorVector, + pub magnetic: ASensorVector, + pub temperature: f32, + pub distance: f32, + pub light: f32, + pub pressure: f32, + pub relative_humidity: f32, + pub uncalibrated_gyro: AUncalibratedEvent, + pub uncalibrated_magnetic: AUncalibratedEvent, + pub meta_data: AMetaDataEvent, + pub heart_rate: AHeartRateEvent, + pub dynamic_sensor_meta: ADynamicSensorEvent, + pub additional_info: AAdditionalInfoEvent, + _bindgen_union_align: [u32; 16usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).acceleration + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(acceleration) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).magnetic + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).temperature + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(temperature) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).distance + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(distance) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).light as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(light) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pressure + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(pressure) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).relative_humidity + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(relative_humidity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalibrated_gyro + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_gyro) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .uncalibrated_magnetic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).meta_data + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(meta_data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).heart_rate + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(heart_rate) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dynamic_sensor_meta + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(dynamic_sensor_meta) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).additional_info + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(additional_info) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_2 { + pub data: [u64; 8usize], + pub step_counter: u64, + _bindgen_union_align: [u32; 16usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).step_counter + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(step_counter) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u64 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1), + "::", + stringify!(u64) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(ASensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(sensor) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(timestamp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 92usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorEventQueue { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensor { + _unused: [u8; 0], +} +pub type ASensorRef = *const ASensor; +pub type ASensorList = *const ASensorRef; +extern "C" { + pub fn ASensorManager_getInstance() -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getInstanceForPackage( + packageName: *const ::std::os::raw::c_char, + ) -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getSensorList( + manager: *mut ASensorManager, + list: *mut ASensorList, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_getDefaultSensor( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_getDefaultSensorEx( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + wakeUp: bool, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_createEventQueue( + manager: *mut ASensorManager, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> *mut ASensorEventQueue; +} +extern "C" { + pub fn ASensorManager_destroyEventQueue( + manager: *mut ASensorManager, + queue: *mut ASensorEventQueue, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createSharedMemoryDirectChannel( + manager: *mut ASensorManager, + fd: ::std::os::raw::c_int, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createHardwareBufferDirectChannel( + manager: *mut ASensorManager, + buffer: *const AHardwareBuffer, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_destroyDirectChannel( + manager: *mut ASensorManager, + channelId: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn ASensorManager_configureDirectReport( + manager: *mut ASensorManager, + sensor: *const ASensor, + channelId: ::std::os::raw::c_int, + rate: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_registerSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + samplingPeriodUs: i32, + maxBatchReportLatencyUs: i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_enableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_disableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_setEventRate( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + usec: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_hasEvents(queue: *mut ASensorEventQueue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_getEvents( + queue: *mut ASensorEventQueue, + events: *mut ASensorEvent, + count: usize, + ) -> isize; +} +extern "C" { + pub fn ASensorEventQueue_requestAdditionalInfoEvents( + queue: *mut ASensorEventQueue, + enable: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getName(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getVendor(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getType(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getResolution(sensor: *const ASensor) -> f32; +} +extern "C" { + pub fn ASensor_getMinDelay(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoMaxEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoReservedEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getStringType(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getReportingMode(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_isWakeUpSensor(sensor: *const ASensor) -> bool; +} +extern "C" { + pub fn ASensor_isDirectChannelTypeSupported( + sensor: *const ASensor, + channelType: ::std::os::raw::c_int, + ) -> bool; +} +extern "C" { + pub fn ASensor_getHighestDirectReportRateLevel(sensor: *const ASensor) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getHandle(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_set_abort_message(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ASharedMemory_create( + name: *const ::std::os::raw::c_char, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_getSize(fd: ::std::os::raw::c_int) -> usize; +} +extern "C" { + pub fn ASharedMemory_setProt( + fd: ::std::os::raw::c_int, + prot: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_dupFromJava( + env: *mut JNIEnv, + sharedMemory: jobject, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AStorageManager { + _unused: [u8; 0], +} +pub const AOBB_STATE_MOUNTED: _bindgen_ty_36 = 1; +pub const AOBB_STATE_UNMOUNTED: _bindgen_ty_36 = 2; +pub const AOBB_STATE_ERROR_INTERNAL: _bindgen_ty_36 = 20; +pub const AOBB_STATE_ERROR_COULD_NOT_MOUNT: _bindgen_ty_36 = 21; +pub const AOBB_STATE_ERROR_COULD_NOT_UNMOUNT: _bindgen_ty_36 = 22; +pub const AOBB_STATE_ERROR_NOT_MOUNTED: _bindgen_ty_36 = 23; +pub const AOBB_STATE_ERROR_ALREADY_MOUNTED: _bindgen_ty_36 = 24; +pub const AOBB_STATE_ERROR_PERMISSION_DENIED: _bindgen_ty_36 = 25; +pub type _bindgen_ty_36 = u32; +extern "C" { + pub fn AStorageManager_new() -> *mut AStorageManager; +} +extern "C" { + pub fn AStorageManager_delete(mgr: *mut AStorageManager); +} +pub type AStorageManager_obbCallbackFunc = ::std::option::Option< + unsafe extern "C" fn( + filename: *const ::std::os::raw::c_char, + state: i32, + data: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + pub fn AStorageManager_mountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + key: *const ::std::os::raw::c_char, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_unmountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + force: ::std::os::raw::c_int, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_isObbMounted( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AStorageManager_getMountedObbPath( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASurfaceTexture { + _unused: [u8; 0], +} +extern "C" { + pub fn ASurfaceTexture_release(st: *mut ASurfaceTexture); +} +extern "C" { + pub fn ASurfaceTexture_acquireANativeWindow(st: *mut ASurfaceTexture) -> *mut ANativeWindow; +} +extern "C" { + pub fn ASurfaceTexture_attachToGLContext( + st: *mut ASurfaceTexture, + texName: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_detachFromGLContext(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_updateTexImage(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_getTransformMatrix(st: *mut ASurfaceTexture, mtx: *mut f32); +} +extern "C" { + pub fn ASurfaceTexture_getTimestamp(st: *mut ASurfaceTexture) -> i64; +} +extern "C" { + pub fn ASurfaceTexture_fromSurfaceTexture( + env: *mut JNIEnv, + surfacetexture: jobject, + ) -> *mut ASurfaceTexture; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_merge_data { + pub name: [::std::os::raw::c_char; 32usize], + pub fd2: __s32, + pub fence: __s32, + pub flags: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_sync_merge_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(sync_merge_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sync_merge_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd2 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fd2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fence as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_fence_info { + pub obj_name: [::std::os::raw::c_char; 32usize], + pub driver_name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub timestamp_ns: __u64, +} +#[test] +fn bindgen_test_layout_sync_fence_info() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(sync_fence_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sync_fence_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obj_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(obj_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).driver_name as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(driver_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp_ns as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(timestamp_ns) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_file_info { + pub name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub num_fences: __u32, + pub pad: __u32, + pub sync_fence_info: __u64, +} +#[test] +fn bindgen_test_layout_sync_file_info() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(sync_file_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sync_file_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_fences as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(num_fences) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sync_fence_info as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(sync_fence_info) + ) + ); +} +extern "C" { + pub fn sync_merge(name: *const ::std::os::raw::c_char, fd1: i32, fd2: i32) -> i32; +} +extern "C" { + pub fn sync_file_info(fd: i32) -> *mut sync_file_info; +} +extern "C" { + pub fn sync_file_info_free(info: *mut sync_file_info); +} +extern "C" { + pub fn ATrace_isEnabled() -> bool; +} +extern "C" { + pub fn ATrace_beginSection(sectionName: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ATrace_endSection(); +} +extern "C" { + pub fn ATrace_beginAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_endAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_setCounter(counterName: *const ::std::os::raw::c_char, counterValue: i64); +} +pub const AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: _bindgen_ty_37 = 1; +pub const AWINDOW_FLAG_DIM_BEHIND: _bindgen_ty_37 = 2; +pub const AWINDOW_FLAG_BLUR_BEHIND: _bindgen_ty_37 = 4; +pub const AWINDOW_FLAG_NOT_FOCUSABLE: _bindgen_ty_37 = 8; +pub const AWINDOW_FLAG_NOT_TOUCHABLE: _bindgen_ty_37 = 16; +pub const AWINDOW_FLAG_NOT_TOUCH_MODAL: _bindgen_ty_37 = 32; +pub const AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING: _bindgen_ty_37 = 64; +pub const AWINDOW_FLAG_KEEP_SCREEN_ON: _bindgen_ty_37 = 128; +pub const AWINDOW_FLAG_LAYOUT_IN_SCREEN: _bindgen_ty_37 = 256; +pub const AWINDOW_FLAG_LAYOUT_NO_LIMITS: _bindgen_ty_37 = 512; +pub const AWINDOW_FLAG_FULLSCREEN: _bindgen_ty_37 = 1024; +pub const AWINDOW_FLAG_FORCE_NOT_FULLSCREEN: _bindgen_ty_37 = 2048; +pub const AWINDOW_FLAG_DITHER: _bindgen_ty_37 = 4096; +pub const AWINDOW_FLAG_SECURE: _bindgen_ty_37 = 8192; +pub const AWINDOW_FLAG_SCALED: _bindgen_ty_37 = 16384; +pub const AWINDOW_FLAG_IGNORE_CHEEK_PRESSES: _bindgen_ty_37 = 32768; +pub const AWINDOW_FLAG_LAYOUT_INSET_DECOR: _bindgen_ty_37 = 65536; +pub const AWINDOW_FLAG_ALT_FOCUSABLE_IM: _bindgen_ty_37 = 131072; +pub const AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH: _bindgen_ty_37 = 262144; +pub const AWINDOW_FLAG_SHOW_WHEN_LOCKED: _bindgen_ty_37 = 524288; +pub const AWINDOW_FLAG_SHOW_WALLPAPER: _bindgen_ty_37 = 1048576; +pub const AWINDOW_FLAG_TURN_SCREEN_ON: _bindgen_ty_37 = 2097152; +pub const AWINDOW_FLAG_DISMISS_KEYGUARD: _bindgen_ty_37 = 4194304; +pub type _bindgen_ty_37 = u32; +pub type __builtin_va_list = *mut ::std::os::raw::c_char; diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_x86_64.rs b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_x86_64.rs new file mode 100644 index 0000000..0af4875 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/src/ffi_x86_64.rs @@ -0,0 +1,13840 @@ +/* automatically generated by rust-bindgen */ + +pub const __BIONIC__: u32 = 1; +pub const __WORDSIZE: u32 = 64; +pub const __bos_level: u32 = 0; +pub const __ANDROID_API_FUTURE__: u32 = 10000; +pub const __ANDROID_API__: u32 = 10000; +pub const __ANDROID_API_G__: u32 = 9; +pub const __ANDROID_API_I__: u32 = 14; +pub const __ANDROID_API_J__: u32 = 16; +pub const __ANDROID_API_J_MR1__: u32 = 17; +pub const __ANDROID_API_J_MR2__: u32 = 18; +pub const __ANDROID_API_K__: u32 = 19; +pub const __ANDROID_API_L__: u32 = 21; +pub const __ANDROID_API_L_MR1__: u32 = 22; +pub const __ANDROID_API_M__: u32 = 23; +pub const __ANDROID_API_N__: u32 = 24; +pub const __ANDROID_API_N_MR1__: u32 = 25; +pub const __ANDROID_API_O__: u32 = 26; +pub const __ANDROID_API_O_MR1__: u32 = 27; +pub const __ANDROID_API_P__: u32 = 28; +pub const __ANDROID_API_Q__: u32 = 29; +pub const INT8_MIN: i32 = -128; +pub const INT8_MAX: u32 = 127; +pub const INT_LEAST8_MIN: i32 = -128; +pub const INT_LEAST8_MAX: u32 = 127; +pub const INT_FAST8_MIN: i32 = -128; +pub const INT_FAST8_MAX: u32 = 127; +pub const UINT8_MAX: u32 = 255; +pub const UINT_LEAST8_MAX: u32 = 255; +pub const UINT_FAST8_MAX: u32 = 255; +pub const INT16_MIN: i32 = -32768; +pub const INT16_MAX: u32 = 32767; +pub const INT_LEAST16_MIN: i32 = -32768; +pub const INT_LEAST16_MAX: u32 = 32767; +pub const UINT16_MAX: u32 = 65535; +pub const UINT_LEAST16_MAX: u32 = 65535; +pub const INT32_MIN: i32 = -2147483648; +pub const INT32_MAX: u32 = 2147483647; +pub const INT_LEAST32_MIN: i32 = -2147483648; +pub const INT_LEAST32_MAX: u32 = 2147483647; +pub const INT_FAST32_MIN: i32 = -2147483648; +pub const INT_FAST32_MAX: u32 = 2147483647; +pub const UINT32_MAX: u32 = 4294967295; +pub const UINT_LEAST32_MAX: u32 = 4294967295; +pub const UINT_FAST32_MAX: u32 = 4294967295; +pub const SIG_ATOMIC_MAX: u32 = 2147483647; +pub const SIG_ATOMIC_MIN: i32 = -2147483648; +pub const WINT_MAX: u32 = 4294967295; +pub const WINT_MIN: u32 = 0; +pub const __BITS_PER_LONG: u32 = 64; +pub const __FD_SETSIZE: u32 = 1024; +pub const __GNUC_VA_LIST: u32 = 1; +pub const JNI_FALSE: u32 = 0; +pub const JNI_TRUE: u32 = 1; +pub const JNI_VERSION_1_1: u32 = 65537; +pub const JNI_VERSION_1_2: u32 = 65538; +pub const JNI_VERSION_1_4: u32 = 65540; +pub const JNI_VERSION_1_6: u32 = 65542; +pub const JNI_OK: u32 = 0; +pub const JNI_ERR: i32 = -1; +pub const JNI_EDETACHED: i32 = -2; +pub const JNI_EVERSION: i32 = -3; +pub const JNI_ENOMEM: i32 = -4; +pub const JNI_EEXIST: i32 = -5; +pub const JNI_EINVAL: i32 = -6; +pub const JNI_COMMIT: u32 = 1; +pub const JNI_ABORT: u32 = 2; +pub const __PRI_64_prefix: &'static [u8; 2usize] = b"l\0"; +pub const __PRI_PTR_prefix: &'static [u8; 2usize] = b"l\0"; +pub const __PRI_FAST_prefix: &'static [u8; 2usize] = b"l\0"; +pub const PRId8: &'static [u8; 2usize] = b"d\0"; +pub const PRId16: &'static [u8; 2usize] = b"d\0"; +pub const PRId32: &'static [u8; 2usize] = b"d\0"; +pub const PRId64: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdLEAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST16: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const PRIdLEAST64: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdFAST8: &'static [u8; 2usize] = b"d\0"; +pub const PRIdFAST16: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdFAST32: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdFAST64: &'static [u8; 3usize] = b"ld\0"; +pub const PRIdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const PRIdPTR: &'static [u8; 3usize] = b"ld\0"; +pub const PRIi8: &'static [u8; 2usize] = b"i\0"; +pub const PRIi16: &'static [u8; 2usize] = b"i\0"; +pub const PRIi32: &'static [u8; 2usize] = b"i\0"; +pub const PRIi64: &'static [u8; 3usize] = b"li\0"; +pub const PRIiLEAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST16: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const PRIiLEAST64: &'static [u8; 3usize] = b"li\0"; +pub const PRIiFAST8: &'static [u8; 2usize] = b"i\0"; +pub const PRIiFAST16: &'static [u8; 3usize] = b"li\0"; +pub const PRIiFAST32: &'static [u8; 3usize] = b"li\0"; +pub const PRIiFAST64: &'static [u8; 3usize] = b"li\0"; +pub const PRIiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const PRIiPTR: &'static [u8; 3usize] = b"li\0"; +pub const PRIo8: &'static [u8; 2usize] = b"o\0"; +pub const PRIo16: &'static [u8; 2usize] = b"o\0"; +pub const PRIo32: &'static [u8; 2usize] = b"o\0"; +pub const PRIo64: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoLEAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST16: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const PRIoLEAST64: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoFAST8: &'static [u8; 2usize] = b"o\0"; +pub const PRIoFAST16: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoFAST32: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoFAST64: &'static [u8; 3usize] = b"lo\0"; +pub const PRIoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const PRIoPTR: &'static [u8; 3usize] = b"lo\0"; +pub const PRIu8: &'static [u8; 2usize] = b"u\0"; +pub const PRIu16: &'static [u8; 2usize] = b"u\0"; +pub const PRIu32: &'static [u8; 2usize] = b"u\0"; +pub const PRIu64: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuLEAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST16: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const PRIuLEAST64: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuFAST8: &'static [u8; 2usize] = b"u\0"; +pub const PRIuFAST16: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuFAST32: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuFAST64: &'static [u8; 3usize] = b"lu\0"; +pub const PRIuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const PRIuPTR: &'static [u8; 3usize] = b"lu\0"; +pub const PRIx8: &'static [u8; 2usize] = b"x\0"; +pub const PRIx16: &'static [u8; 2usize] = b"x\0"; +pub const PRIx32: &'static [u8; 2usize] = b"x\0"; +pub const PRIx64: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxLEAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST16: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const PRIxLEAST64: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxFAST8: &'static [u8; 2usize] = b"x\0"; +pub const PRIxFAST16: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxFAST32: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxFAST64: &'static [u8; 3usize] = b"lx\0"; +pub const PRIxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const PRIxPTR: &'static [u8; 3usize] = b"lx\0"; +pub const PRIX8: &'static [u8; 2usize] = b"X\0"; +pub const PRIX16: &'static [u8; 2usize] = b"X\0"; +pub const PRIX32: &'static [u8; 2usize] = b"X\0"; +pub const PRIX64: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXLEAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST16: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST32: &'static [u8; 2usize] = b"X\0"; +pub const PRIXLEAST64: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXFAST8: &'static [u8; 2usize] = b"X\0"; +pub const PRIXFAST16: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXFAST32: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXFAST64: &'static [u8; 3usize] = b"lX\0"; +pub const PRIXMAX: &'static [u8; 3usize] = b"jX\0"; +pub const PRIXPTR: &'static [u8; 3usize] = b"lX\0"; +pub const SCNd8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNd16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNd32: &'static [u8; 2usize] = b"d\0"; +pub const SCNd64: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdLEAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdLEAST16: &'static [u8; 3usize] = b"hd\0"; +pub const SCNdLEAST32: &'static [u8; 2usize] = b"d\0"; +pub const SCNdLEAST64: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdFAST8: &'static [u8; 4usize] = b"hhd\0"; +pub const SCNdFAST16: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdFAST32: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdFAST64: &'static [u8; 3usize] = b"ld\0"; +pub const SCNdMAX: &'static [u8; 3usize] = b"jd\0"; +pub const SCNdPTR: &'static [u8; 3usize] = b"ld\0"; +pub const SCNi8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNi16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNi32: &'static [u8; 2usize] = b"i\0"; +pub const SCNi64: &'static [u8; 3usize] = b"li\0"; +pub const SCNiLEAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiLEAST16: &'static [u8; 3usize] = b"hi\0"; +pub const SCNiLEAST32: &'static [u8; 2usize] = b"i\0"; +pub const SCNiLEAST64: &'static [u8; 3usize] = b"li\0"; +pub const SCNiFAST8: &'static [u8; 4usize] = b"hhi\0"; +pub const SCNiFAST16: &'static [u8; 3usize] = b"li\0"; +pub const SCNiFAST32: &'static [u8; 3usize] = b"li\0"; +pub const SCNiFAST64: &'static [u8; 3usize] = b"li\0"; +pub const SCNiMAX: &'static [u8; 3usize] = b"ji\0"; +pub const SCNiPTR: &'static [u8; 3usize] = b"li\0"; +pub const SCNo8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNo16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNo32: &'static [u8; 2usize] = b"o\0"; +pub const SCNo64: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoLEAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoLEAST16: &'static [u8; 3usize] = b"ho\0"; +pub const SCNoLEAST32: &'static [u8; 2usize] = b"o\0"; +pub const SCNoLEAST64: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoFAST8: &'static [u8; 4usize] = b"hho\0"; +pub const SCNoFAST16: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoFAST32: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoFAST64: &'static [u8; 3usize] = b"lo\0"; +pub const SCNoMAX: &'static [u8; 3usize] = b"jo\0"; +pub const SCNoPTR: &'static [u8; 3usize] = b"lo\0"; +pub const SCNu8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNu16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNu32: &'static [u8; 2usize] = b"u\0"; +pub const SCNu64: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuLEAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuLEAST16: &'static [u8; 3usize] = b"hu\0"; +pub const SCNuLEAST32: &'static [u8; 2usize] = b"u\0"; +pub const SCNuLEAST64: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuFAST8: &'static [u8; 4usize] = b"hhu\0"; +pub const SCNuFAST16: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuFAST32: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuFAST64: &'static [u8; 3usize] = b"lu\0"; +pub const SCNuMAX: &'static [u8; 3usize] = b"ju\0"; +pub const SCNuPTR: &'static [u8; 3usize] = b"lu\0"; +pub const SCNx8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNx16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNx32: &'static [u8; 2usize] = b"x\0"; +pub const SCNx64: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxLEAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxLEAST16: &'static [u8; 3usize] = b"hx\0"; +pub const SCNxLEAST32: &'static [u8; 2usize] = b"x\0"; +pub const SCNxLEAST64: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxFAST8: &'static [u8; 4usize] = b"hhx\0"; +pub const SCNxFAST16: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxFAST32: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxFAST64: &'static [u8; 3usize] = b"lx\0"; +pub const SCNxMAX: &'static [u8; 3usize] = b"jx\0"; +pub const SCNxPTR: &'static [u8; 3usize] = b"lx\0"; +pub const true_: u32 = 1; +pub const false_: u32 = 0; +pub const __bool_true_false_are_defined: u32 = 1; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT: u32 = 8; +pub const _K_SS_MAXSIZE: u32 = 128; +pub const O_ACCMODE: u32 = 3; +pub const O_RDONLY: u32 = 0; +pub const O_WRONLY: u32 = 1; +pub const O_RDWR: u32 = 2; +pub const O_CREAT: u32 = 64; +pub const O_EXCL: u32 = 128; +pub const O_NOCTTY: u32 = 256; +pub const O_TRUNC: u32 = 512; +pub const O_APPEND: u32 = 1024; +pub const O_NONBLOCK: u32 = 2048; +pub const O_DSYNC: u32 = 4096; +pub const FASYNC: u32 = 8192; +pub const O_DIRECT: u32 = 16384; +pub const O_LARGEFILE: u32 = 32768; +pub const O_DIRECTORY: u32 = 65536; +pub const O_NOFOLLOW: u32 = 131072; +pub const O_NOATIME: u32 = 262144; +pub const O_CLOEXEC: u32 = 524288; +pub const __O_SYNC: u32 = 1048576; +pub const O_SYNC: u32 = 1052672; +pub const O_PATH: u32 = 2097152; +pub const __O_TMPFILE: u32 = 4194304; +pub const O_TMPFILE: u32 = 4259840; +pub const O_TMPFILE_MASK: u32 = 4259904; +pub const O_NDELAY: u32 = 2048; +pub const F_DUPFD: u32 = 0; +pub const F_GETFD: u32 = 1; +pub const F_SETFD: u32 = 2; +pub const F_GETFL: u32 = 3; +pub const F_SETFL: u32 = 4; +pub const F_GETLK: u32 = 5; +pub const F_SETLK: u32 = 6; +pub const F_SETLKW: u32 = 7; +pub const F_SETOWN: u32 = 8; +pub const F_GETOWN: u32 = 9; +pub const F_SETSIG: u32 = 10; +pub const F_GETSIG: u32 = 11; +pub const F_SETOWN_EX: u32 = 15; +pub const F_GETOWN_EX: u32 = 16; +pub const F_GETOWNER_UIDS: u32 = 17; +pub const F_OFD_GETLK: u32 = 36; +pub const F_OFD_SETLK: u32 = 37; +pub const F_OFD_SETLKW: u32 = 38; +pub const F_OWNER_TID: u32 = 0; +pub const F_OWNER_PID: u32 = 1; +pub const F_OWNER_PGRP: u32 = 2; +pub const FD_CLOEXEC: u32 = 1; +pub const F_RDLCK: u32 = 0; +pub const F_WRLCK: u32 = 1; +pub const F_UNLCK: u32 = 2; +pub const F_EXLCK: u32 = 4; +pub const F_SHLCK: u32 = 8; +pub const LOCK_SH: u32 = 1; +pub const LOCK_EX: u32 = 2; +pub const LOCK_NB: u32 = 4; +pub const LOCK_UN: u32 = 8; +pub const LOCK_MAND: u32 = 32; +pub const LOCK_READ: u32 = 64; +pub const LOCK_WRITE: u32 = 128; +pub const LOCK_RW: u32 = 192; +pub const F_LINUX_SPECIFIC_BASE: u32 = 1024; +pub const FIOSETOWN: u32 = 35073; +pub const SIOCSPGRP: u32 = 35074; +pub const FIOGETOWN: u32 = 35075; +pub const SIOCGPGRP: u32 = 35076; +pub const SIOCATMARK: u32 = 35077; +pub const SIOCGSTAMP: u32 = 35078; +pub const SIOCGSTAMPNS: u32 = 35079; +pub const SOL_SOCKET: u32 = 1; +pub const SO_DEBUG: u32 = 1; +pub const SO_REUSEADDR: u32 = 2; +pub const SO_TYPE: u32 = 3; +pub const SO_ERROR: u32 = 4; +pub const SO_DONTROUTE: u32 = 5; +pub const SO_BROADCAST: u32 = 6; +pub const SO_SNDBUF: u32 = 7; +pub const SO_RCVBUF: u32 = 8; +pub const SO_SNDBUFFORCE: u32 = 32; +pub const SO_RCVBUFFORCE: u32 = 33; +pub const SO_KEEPALIVE: u32 = 9; +pub const SO_OOBINLINE: u32 = 10; +pub const SO_NO_CHECK: u32 = 11; +pub const SO_PRIORITY: u32 = 12; +pub const SO_LINGER: u32 = 13; +pub const SO_BSDCOMPAT: u32 = 14; +pub const SO_REUSEPORT: u32 = 15; +pub const SO_PASSCRED: u32 = 16; +pub const SO_PEERCRED: u32 = 17; +pub const SO_RCVLOWAT: u32 = 18; +pub const SO_SNDLOWAT: u32 = 19; +pub const SO_RCVTIMEO: u32 = 20; +pub const SO_SNDTIMEO: u32 = 21; +pub const SO_SECURITY_AUTHENTICATION: u32 = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: u32 = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: u32 = 24; +pub const SO_BINDTODEVICE: u32 = 25; +pub const SO_ATTACH_FILTER: u32 = 26; +pub const SO_DETACH_FILTER: u32 = 27; +pub const SO_GET_FILTER: u32 = 26; +pub const SO_PEERNAME: u32 = 28; +pub const SO_TIMESTAMP: u32 = 29; +pub const SCM_TIMESTAMP: u32 = 29; +pub const SO_ACCEPTCONN: u32 = 30; +pub const SO_PEERSEC: u32 = 31; +pub const SO_PASSSEC: u32 = 34; +pub const SO_TIMESTAMPNS: u32 = 35; +pub const SCM_TIMESTAMPNS: u32 = 35; +pub const SO_MARK: u32 = 36; +pub const SO_TIMESTAMPING: u32 = 37; +pub const SCM_TIMESTAMPING: u32 = 37; +pub const SO_PROTOCOL: u32 = 38; +pub const SO_DOMAIN: u32 = 39; +pub const SO_RXQ_OVFL: u32 = 40; +pub const SO_WIFI_STATUS: u32 = 41; +pub const SCM_WIFI_STATUS: u32 = 41; +pub const SO_PEEK_OFF: u32 = 42; +pub const SO_NOFCS: u32 = 43; +pub const SO_LOCK_FILTER: u32 = 44; +pub const SO_SELECT_ERR_QUEUE: u32 = 45; +pub const SO_BUSY_POLL: u32 = 46; +pub const SO_MAX_PACING_RATE: u32 = 47; +pub const SO_BPF_EXTENSIONS: u32 = 48; +pub const SO_INCOMING_CPU: u32 = 49; +pub const SO_ATTACH_BPF: u32 = 50; +pub const SO_DETACH_BPF: u32 = 27; +pub const SO_ATTACH_REUSEPORT_CBPF: u32 = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: u32 = 52; +pub const SO_CNX_ADVICE: u32 = 53; +pub const SCM_TIMESTAMPING_OPT_STATS: u32 = 54; +pub const SO_MEMINFO: u32 = 55; +pub const SO_INCOMING_NAPI_ID: u32 = 56; +pub const SO_COOKIE: u32 = 57; +pub const SCM_TIMESTAMPING_PKTINFO: u32 = 58; +pub const SO_PEERGROUPS: u32 = 59; +pub const SO_ZEROCOPY: u32 = 60; +pub const SO_TXTIME: u32 = 61; +pub const SCM_TXTIME: u32 = 61; +pub const SOCK_IOC_TYPE: u32 = 137; +pub const SIOCADDRT: u32 = 35083; +pub const SIOCDELRT: u32 = 35084; +pub const SIOCRTMSG: u32 = 35085; +pub const SIOCGIFNAME: u32 = 35088; +pub const SIOCSIFLINK: u32 = 35089; +pub const SIOCGIFCONF: u32 = 35090; +pub const SIOCGIFFLAGS: u32 = 35091; +pub const SIOCSIFFLAGS: u32 = 35092; +pub const SIOCGIFADDR: u32 = 35093; +pub const SIOCSIFADDR: u32 = 35094; +pub const SIOCGIFDSTADDR: u32 = 35095; +pub const SIOCSIFDSTADDR: u32 = 35096; +pub const SIOCGIFBRDADDR: u32 = 35097; +pub const SIOCSIFBRDADDR: u32 = 35098; +pub const SIOCGIFNETMASK: u32 = 35099; +pub const SIOCSIFNETMASK: u32 = 35100; +pub const SIOCGIFMETRIC: u32 = 35101; +pub const SIOCSIFMETRIC: u32 = 35102; +pub const SIOCGIFMEM: u32 = 35103; +pub const SIOCSIFMEM: u32 = 35104; +pub const SIOCGIFMTU: u32 = 35105; +pub const SIOCSIFMTU: u32 = 35106; +pub const SIOCSIFNAME: u32 = 35107; +pub const SIOCSIFHWADDR: u32 = 35108; +pub const SIOCGIFENCAP: u32 = 35109; +pub const SIOCSIFENCAP: u32 = 35110; +pub const SIOCGIFHWADDR: u32 = 35111; +pub const SIOCGIFSLAVE: u32 = 35113; +pub const SIOCSIFSLAVE: u32 = 35120; +pub const SIOCADDMULTI: u32 = 35121; +pub const SIOCDELMULTI: u32 = 35122; +pub const SIOCGIFINDEX: u32 = 35123; +pub const SIOGIFINDEX: u32 = 35123; +pub const SIOCSIFPFLAGS: u32 = 35124; +pub const SIOCGIFPFLAGS: u32 = 35125; +pub const SIOCDIFADDR: u32 = 35126; +pub const SIOCSIFHWBROADCAST: u32 = 35127; +pub const SIOCGIFCOUNT: u32 = 35128; +pub const SIOCGIFBR: u32 = 35136; +pub const SIOCSIFBR: u32 = 35137; +pub const SIOCGIFTXQLEN: u32 = 35138; +pub const SIOCSIFTXQLEN: u32 = 35139; +pub const SIOCETHTOOL: u32 = 35142; +pub const SIOCGMIIPHY: u32 = 35143; +pub const SIOCGMIIREG: u32 = 35144; +pub const SIOCSMIIREG: u32 = 35145; +pub const SIOCWANDEV: u32 = 35146; +pub const SIOCOUTQNSD: u32 = 35147; +pub const SIOCGSKNS: u32 = 35148; +pub const SIOCDARP: u32 = 35155; +pub const SIOCGARP: u32 = 35156; +pub const SIOCSARP: u32 = 35157; +pub const SIOCDRARP: u32 = 35168; +pub const SIOCGRARP: u32 = 35169; +pub const SIOCSRARP: u32 = 35170; +pub const SIOCGIFMAP: u32 = 35184; +pub const SIOCSIFMAP: u32 = 35185; +pub const SIOCADDDLCI: u32 = 35200; +pub const SIOCDELDLCI: u32 = 35201; +pub const SIOCGIFVLAN: u32 = 35202; +pub const SIOCSIFVLAN: u32 = 35203; +pub const SIOCBONDENSLAVE: u32 = 35216; +pub const SIOCBONDRELEASE: u32 = 35217; +pub const SIOCBONDSETHWADDR: u32 = 35218; +pub const SIOCBONDSLAVEINFOQUERY: u32 = 35219; +pub const SIOCBONDINFOQUERY: u32 = 35220; +pub const SIOCBONDCHANGEACTIVE: u32 = 35221; +pub const SIOCBRADDBR: u32 = 35232; +pub const SIOCBRDELBR: u32 = 35233; +pub const SIOCBRADDIF: u32 = 35234; +pub const SIOCBRDELIF: u32 = 35235; +pub const SIOCSHWTSTAMP: u32 = 35248; +pub const SIOCGHWTSTAMP: u32 = 35249; +pub const SIOCDEVPRIVATE: u32 = 35312; +pub const SIOCPROTOPRIVATE: u32 = 35296; +pub const UIO_FASTIOV: u32 = 8; +pub const UIO_MAXIOV: u32 = 1024; +pub const SOCK_STREAM: u32 = 1; +pub const SOCK_DGRAM: u32 = 2; +pub const SOCK_RAW: u32 = 3; +pub const SOCK_RDM: u32 = 4; +pub const SOCK_SEQPACKET: u32 = 5; +pub const SOCK_DCCP: u32 = 6; +pub const SOCK_PACKET: u32 = 10; +pub const SOCK_CLOEXEC: u32 = 524288; +pub const SOCK_NONBLOCK: u32 = 2048; +pub const SCM_RIGHTS: u32 = 1; +pub const SCM_CREDENTIALS: u32 = 2; +pub const SCM_SECURITY: u32 = 3; +pub const AF_UNSPEC: u32 = 0; +pub const AF_UNIX: u32 = 1; +pub const AF_LOCAL: u32 = 1; +pub const AF_INET: u32 = 2; +pub const AF_AX25: u32 = 3; +pub const AF_IPX: u32 = 4; +pub const AF_APPLETALK: u32 = 5; +pub const AF_NETROM: u32 = 6; +pub const AF_BRIDGE: u32 = 7; +pub const AF_ATMPVC: u32 = 8; +pub const AF_X25: u32 = 9; +pub const AF_INET6: u32 = 10; +pub const AF_ROSE: u32 = 11; +pub const AF_DECnet: u32 = 12; +pub const AF_NETBEUI: u32 = 13; +pub const AF_SECURITY: u32 = 14; +pub const AF_KEY: u32 = 15; +pub const AF_NETLINK: u32 = 16; +pub const AF_ROUTE: u32 = 16; +pub const AF_PACKET: u32 = 17; +pub const AF_ASH: u32 = 18; +pub const AF_ECONET: u32 = 19; +pub const AF_ATMSVC: u32 = 20; +pub const AF_RDS: u32 = 21; +pub const AF_SNA: u32 = 22; +pub const AF_IRDA: u32 = 23; +pub const AF_PPPOX: u32 = 24; +pub const AF_WANPIPE: u32 = 25; +pub const AF_LLC: u32 = 26; +pub const AF_CAN: u32 = 29; +pub const AF_TIPC: u32 = 30; +pub const AF_BLUETOOTH: u32 = 31; +pub const AF_IUCV: u32 = 32; +pub const AF_RXRPC: u32 = 33; +pub const AF_ISDN: u32 = 34; +pub const AF_PHONET: u32 = 35; +pub const AF_IEEE802154: u32 = 36; +pub const AF_CAIF: u32 = 37; +pub const AF_ALG: u32 = 38; +pub const AF_NFC: u32 = 39; +pub const AF_VSOCK: u32 = 40; +pub const AF_KCM: u32 = 41; +pub const AF_QIPCRTR: u32 = 42; +pub const AF_MAX: u32 = 43; +pub const PF_UNSPEC: u32 = 0; +pub const PF_UNIX: u32 = 1; +pub const PF_LOCAL: u32 = 1; +pub const PF_INET: u32 = 2; +pub const PF_AX25: u32 = 3; +pub const PF_IPX: u32 = 4; +pub const PF_APPLETALK: u32 = 5; +pub const PF_NETROM: u32 = 6; +pub const PF_BRIDGE: u32 = 7; +pub const PF_ATMPVC: u32 = 8; +pub const PF_X25: u32 = 9; +pub const PF_INET6: u32 = 10; +pub const PF_ROSE: u32 = 11; +pub const PF_DECnet: u32 = 12; +pub const PF_NETBEUI: u32 = 13; +pub const PF_SECURITY: u32 = 14; +pub const PF_KEY: u32 = 15; +pub const PF_NETLINK: u32 = 16; +pub const PF_ROUTE: u32 = 16; +pub const PF_PACKET: u32 = 17; +pub const PF_ASH: u32 = 18; +pub const PF_ECONET: u32 = 19; +pub const PF_ATMSVC: u32 = 20; +pub const PF_RDS: u32 = 21; +pub const PF_SNA: u32 = 22; +pub const PF_IRDA: u32 = 23; +pub const PF_PPPOX: u32 = 24; +pub const PF_WANPIPE: u32 = 25; +pub const PF_LLC: u32 = 26; +pub const PF_CAN: u32 = 29; +pub const PF_TIPC: u32 = 30; +pub const PF_BLUETOOTH: u32 = 31; +pub const PF_IUCV: u32 = 32; +pub const PF_RXRPC: u32 = 33; +pub const PF_ISDN: u32 = 34; +pub const PF_PHONET: u32 = 35; +pub const PF_IEEE802154: u32 = 36; +pub const PF_CAIF: u32 = 37; +pub const PF_ALG: u32 = 38; +pub const PF_NFC: u32 = 39; +pub const PF_VSOCK: u32 = 40; +pub const PF_KCM: u32 = 41; +pub const PF_QIPCRTR: u32 = 42; +pub const PF_MAX: u32 = 43; +pub const SOMAXCONN: u32 = 128; +pub const MSG_OOB: u32 = 1; +pub const MSG_PEEK: u32 = 2; +pub const MSG_DONTROUTE: u32 = 4; +pub const MSG_TRYHARD: u32 = 4; +pub const MSG_CTRUNC: u32 = 8; +pub const MSG_PROBE: u32 = 16; +pub const MSG_TRUNC: u32 = 32; +pub const MSG_DONTWAIT: u32 = 64; +pub const MSG_EOR: u32 = 128; +pub const MSG_WAITALL: u32 = 256; +pub const MSG_FIN: u32 = 512; +pub const MSG_SYN: u32 = 1024; +pub const MSG_CONFIRM: u32 = 2048; +pub const MSG_RST: u32 = 4096; +pub const MSG_ERRQUEUE: u32 = 8192; +pub const MSG_NOSIGNAL: u32 = 16384; +pub const MSG_MORE: u32 = 32768; +pub const MSG_WAITFORONE: u32 = 65536; +pub const MSG_BATCH: u32 = 262144; +pub const MSG_FASTOPEN: u32 = 536870912; +pub const MSG_CMSG_CLOEXEC: u32 = 1073741824; +pub const MSG_EOF: u32 = 512; +pub const MSG_CMSG_COMPAT: u32 = 0; +pub const SOL_IP: u32 = 0; +pub const SOL_TCP: u32 = 6; +pub const SOL_UDP: u32 = 17; +pub const SOL_IPV6: u32 = 41; +pub const SOL_ICMPV6: u32 = 58; +pub const SOL_SCTP: u32 = 132; +pub const SOL_RAW: u32 = 255; +pub const SOL_IPX: u32 = 256; +pub const SOL_AX25: u32 = 257; +pub const SOL_ATALK: u32 = 258; +pub const SOL_NETROM: u32 = 259; +pub const SOL_ROSE: u32 = 260; +pub const SOL_DECNET: u32 = 261; +pub const SOL_X25: u32 = 262; +pub const SOL_PACKET: u32 = 263; +pub const SOL_ATM: u32 = 264; +pub const SOL_AAL: u32 = 265; +pub const SOL_IRDA: u32 = 266; +pub const SOL_NETBEUI: u32 = 267; +pub const SOL_LLC: u32 = 268; +pub const SOL_DCCP: u32 = 269; +pub const SOL_NETLINK: u32 = 270; +pub const SOL_TIPC: u32 = 271; +pub const SOL_RXRPC: u32 = 272; +pub const SOL_PPPOL2TP: u32 = 273; +pub const SOL_BLUETOOTH: u32 = 274; +pub const SOL_PNPIPE: u32 = 275; +pub const SOL_RDS: u32 = 276; +pub const SOL_IUCV: u32 = 277; +pub const SOL_CAIF: u32 = 278; +pub const SOL_ALG: u32 = 279; +pub const SOL_NFC: u32 = 280; +pub const SOL_KCM: u32 = 281; +pub const SOL_TLS: u32 = 282; +pub const IPX_TYPE: u32 = 1; +pub const _PATH_HEQUIV: &'static [u8; 24usize] = b"/system/etc/hosts.equiv\0"; +pub const _PATH_HOSTS: &'static [u8; 18usize] = b"/system/etc/hosts\0"; +pub const _PATH_NETWORKS: &'static [u8; 21usize] = b"/system/etc/networks\0"; +pub const _PATH_PROTOCOLS: &'static [u8; 22usize] = b"/system/etc/protocols\0"; +pub const _PATH_SERVICES: &'static [u8; 21usize] = b"/system/etc/services\0"; +pub const NETDB_INTERNAL: i32 = -1; +pub const NETDB_SUCCESS: u32 = 0; +pub const HOST_NOT_FOUND: u32 = 1; +pub const TRY_AGAIN: u32 = 2; +pub const NO_RECOVERY: u32 = 3; +pub const NO_DATA: u32 = 4; +pub const NO_ADDRESS: u32 = 4; +pub const EAI_ADDRFAMILY: u32 = 1; +pub const EAI_AGAIN: u32 = 2; +pub const EAI_BADFLAGS: u32 = 3; +pub const EAI_FAIL: u32 = 4; +pub const EAI_FAMILY: u32 = 5; +pub const EAI_MEMORY: u32 = 6; +pub const EAI_NODATA: u32 = 7; +pub const EAI_NONAME: u32 = 8; +pub const EAI_SERVICE: u32 = 9; +pub const EAI_SOCKTYPE: u32 = 10; +pub const EAI_SYSTEM: u32 = 11; +pub const EAI_BADHINTS: u32 = 12; +pub const EAI_PROTOCOL: u32 = 13; +pub const EAI_OVERFLOW: u32 = 14; +pub const EAI_MAX: u32 = 15; +pub const AI_PASSIVE: u32 = 1; +pub const AI_CANONNAME: u32 = 2; +pub const AI_NUMERICHOST: u32 = 4; +pub const AI_NUMERICSERV: u32 = 8; +pub const AI_ALL: u32 = 256; +pub const AI_V4MAPPED_CFG: u32 = 512; +pub const AI_ADDRCONFIG: u32 = 1024; +pub const AI_V4MAPPED: u32 = 2048; +pub const AI_DEFAULT: u32 = 1536; +pub const NI_MAXHOST: u32 = 1025; +pub const NI_MAXSERV: u32 = 32; +pub const NI_NOFQDN: u32 = 1; +pub const NI_NUMERICHOST: u32 = 2; +pub const NI_NAMEREQD: u32 = 4; +pub const NI_NUMERICSERV: u32 = 8; +pub const NI_DGRAM: u32 = 16; +pub const SCOPE_DELIMITER: u8 = 37u8; +pub const IPPORT_RESERVED: u32 = 1024; +pub const WNOHANG: u32 = 1; +pub const WUNTRACED: u32 = 2; +pub const WSTOPPED: u32 = 2; +pub const WEXITED: u32 = 4; +pub const WCONTINUED: u32 = 8; +pub const WNOWAIT: u32 = 16777216; +pub const __WNOTHREAD: u32 = 536870912; +pub const __WALL: u32 = 1073741824; +pub const __WCLONE: u32 = 2147483648; +pub const P_ALL: u32 = 0; +pub const P_PID: u32 = 1; +pub const P_PGID: u32 = 2; +pub const SEEK_SET: u32 = 0; +pub const SEEK_CUR: u32 = 1; +pub const SEEK_END: u32 = 2; +pub const _IOFBF: u32 = 0; +pub const _IOLBF: u32 = 1; +pub const _IONBF: u32 = 2; +pub const BUFSIZ: u32 = 1024; +pub const EOF: i32 = -1; +pub const FOPEN_MAX: u32 = 20; +pub const FILENAME_MAX: u32 = 4096; +pub const L_tmpnam: u32 = 4096; +pub const TMP_MAX: u32 = 308915776; +pub const P_tmpdir: &'static [u8; 6usize] = b"/tmp/\0"; +pub const L_ctermid: u32 = 1024; +pub const STRUCT_MALLINFO_DECLARED: u32 = 1; +pub const M_DECAY_TIME: i32 = -100; +pub const M_PURGE: i32 = -101; +pub const EXIT_FAILURE: u32 = 1; +pub const EXIT_SUCCESS: u32 = 0; +pub const RAND_MAX: u32 = 2147483647; +pub const __NDK_MAJOR__: u32 = 20; +pub const __NDK_MINOR__: u32 = 0; +pub const __NDK_BETA__: u32 = 0; +pub const __NDK_BUILD__: u32 = 5594570; +pub const __NDK_CANARY__: u32 = 0; +pub const NR_OPEN: u32 = 1024; +pub const NGROUPS_MAX: u32 = 65536; +pub const ARG_MAX: u32 = 131072; +pub const LINK_MAX: u32 = 127; +pub const MAX_CANON: u32 = 255; +pub const MAX_INPUT: u32 = 255; +pub const NAME_MAX: u32 = 255; +pub const PATH_MAX: u32 = 4096; +pub const PIPE_BUF: u32 = 4096; +pub const XATTR_NAME_MAX: u32 = 255; +pub const XATTR_SIZE_MAX: u32 = 65536; +pub const XATTR_LIST_MAX: u32 = 65536; +pub const RTSIG_MAX: u32 = 32; +pub const PASS_MAX: u32 = 128; +pub const NL_ARGMAX: u32 = 9; +pub const NL_LANGMAX: u32 = 14; +pub const NL_MSGMAX: u32 = 32767; +pub const NL_NMAX: u32 = 1; +pub const NL_SETMAX: u32 = 255; +pub const NL_TEXTMAX: u32 = 255; +pub const CHAR_BIT: u32 = 8; +pub const LONG_BIT: u32 = 64; +pub const WORD_BIT: u32 = 32; +pub const SCHAR_MAX: u32 = 127; +pub const SCHAR_MIN: i32 = -128; +pub const UCHAR_MAX: u32 = 255; +pub const CHAR_MAX: u32 = 127; +pub const CHAR_MIN: i32 = -128; +pub const USHRT_MAX: u32 = 65535; +pub const SHRT_MAX: u32 = 32767; +pub const SHRT_MIN: i32 = -32768; +pub const UINT_MAX: u32 = 4294967295; +pub const INT_MAX: u32 = 2147483647; +pub const INT_MIN: i32 = -2147483648; +pub const ULONG_MAX: i32 = -1; +pub const LONG_MAX: u64 = 9223372036854775807; +pub const LONG_MIN: i64 = -9223372036854775808; +pub const ULLONG_MAX: i32 = -1; +pub const LLONG_MAX: u64 = 9223372036854775807; +pub const LLONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MIN: i64 = -9223372036854775808; +pub const LONG_LONG_MAX: u64 = 9223372036854775807; +pub const ULONG_LONG_MAX: i32 = -1; +pub const UID_MAX: u32 = 4294967295; +pub const GID_MAX: u32 = 4294967295; +pub const SIZE_T_MAX: i32 = -1; +pub const SSIZE_MAX: u64 = 9223372036854775807; +pub const MB_LEN_MAX: u32 = 4; +pub const NZERO: u32 = 20; +pub const IOV_MAX: u32 = 1024; +pub const SEM_VALUE_MAX: u32 = 1073741823; +pub const _POSIX_VERSION: u32 = 200809; +pub const _POSIX2_VERSION: u32 = 200809; +pub const _XOPEN_VERSION: u32 = 700; +pub const __BIONIC_POSIX_FEATURE_MISSING: i32 = -1; +pub const _POSIX_ASYNCHRONOUS_IO: i32 = -1; +pub const _POSIX_CHOWN_RESTRICTED: u32 = 1; +pub const _POSIX_CPUTIME: u32 = 200809; +pub const _POSIX_FSYNC: u32 = 200809; +pub const _POSIX_IPV6: u32 = 200809; +pub const _POSIX_MAPPED_FILES: u32 = 200809; +pub const _POSIX_MEMLOCK_RANGE: u32 = 200809; +pub const _POSIX_MEMORY_PROTECTION: u32 = 200809; +pub const _POSIX_MESSAGE_PASSING: i32 = -1; +pub const _POSIX_MONOTONIC_CLOCK: u32 = 200809; +pub const _POSIX_NO_TRUNC: u32 = 1; +pub const _POSIX_PRIORITIZED_IO: i32 = -1; +pub const _POSIX_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_RAW_SOCKETS: u32 = 200809; +pub const _POSIX_READER_WRITER_LOCKS: u32 = 200809; +pub const _POSIX_REGEXP: u32 = 1; +pub const _POSIX_SAVED_IDS: u32 = 1; +pub const _POSIX_SEMAPHORES: u32 = 200809; +pub const _POSIX_SHARED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_SHELL: u32 = 1; +pub const _POSIX_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_SYNCHRONIZED_IO: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKADDR: u32 = 200809; +pub const _POSIX_THREAD_ATTR_STACKSIZE: u32 = 200809; +pub const _POSIX_THREAD_CPUTIME: u32 = 200809; +pub const _POSIX_THREAD_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_PRIORITY_SCHEDULING: u32 = 200809; +pub const _POSIX_THREAD_PROCESS_SHARED: u32 = 200809; +pub const _POSIX_THREAD_ROBUST_PRIO_INHERIT: i32 = -1; +pub const _POSIX_THREAD_ROBUST_PRIO_PROTECT: i32 = -1; +pub const _POSIX_THREAD_SAFE_FUNCTIONS: u32 = 200809; +pub const _POSIX_THREAD_SPORADIC_SERVER: i32 = -1; +pub const _POSIX_THREADS: u32 = 200809; +pub const _POSIX_TIMERS: u32 = 200809; +pub const _POSIX_TRACE: i32 = -1; +pub const _POSIX_TRACE_EVENT_FILTER: i32 = -1; +pub const _POSIX_TRACE_INHERIT: i32 = -1; +pub const _POSIX_TRACE_LOG: i32 = -1; +pub const _POSIX_TYPED_MEMORY_OBJECTS: i32 = -1; +pub const _POSIX_VDISABLE: u8 = 0u8; +pub const _POSIX2_C_BIND: u32 = 200809; +pub const _POSIX2_C_DEV: i32 = -1; +pub const _POSIX2_CHAR_TERM: u32 = 200809; +pub const _POSIX2_FORT_DEV: i32 = -1; +pub const _POSIX2_FORT_RUN: i32 = -1; +pub const _POSIX2_LOCALEDEF: i32 = -1; +pub const _POSIX2_SW_DEV: i32 = -1; +pub const _POSIX2_UPE: i32 = -1; +pub const _POSIX_V7_ILP32_OFF32: i32 = -1; +pub const _POSIX_V7_ILP32_OFFBIG: i32 = -1; +pub const _POSIX_V7_LP64_OFF64: u32 = 1; +pub const _POSIX_V7_LPBIG_OFFBIG: u32 = 1; +pub const _XOPEN_CRYPT: i32 = -1; +pub const _XOPEN_ENH_I18N: u32 = 1; +pub const _XOPEN_LEGACY: i32 = -1; +pub const _XOPEN_REALTIME: u32 = 1; +pub const _XOPEN_REALTIME_THREADS: u32 = 1; +pub const _XOPEN_SHM: u32 = 1; +pub const _XOPEN_STREAMS: i32 = -1; +pub const _XOPEN_UNIX: u32 = 1; +pub const _POSIX_AIO_LISTIO_MAX: u32 = 2; +pub const _POSIX_AIO_MAX: u32 = 1; +pub const _POSIX_ARG_MAX: u32 = 4096; +pub const _POSIX_CHILD_MAX: u32 = 25; +pub const _POSIX_CLOCKRES_MIN: u32 = 20000000; +pub const _POSIX_DELAYTIMER_MAX: u32 = 32; +pub const _POSIX_HOST_NAME_MAX: u32 = 255; +pub const _POSIX_LINK_MAX: u32 = 8; +pub const _POSIX_LOGIN_NAME_MAX: u32 = 9; +pub const _POSIX_MAX_CANON: u32 = 255; +pub const _POSIX_MAX_INPUT: u32 = 255; +pub const _POSIX_MQ_OPEN_MAX: u32 = 8; +pub const _POSIX_MQ_PRIO_MAX: u32 = 32; +pub const _POSIX_NAME_MAX: u32 = 14; +pub const _POSIX_NGROUPS_MAX: u32 = 8; +pub const _POSIX_OPEN_MAX: u32 = 20; +pub const _POSIX_PATH_MAX: u32 = 256; +pub const _POSIX_PIPE_BUF: u32 = 512; +pub const _POSIX_RE_DUP_MAX: u32 = 255; +pub const _POSIX_RTSIG_MAX: u32 = 8; +pub const _POSIX_SEM_NSEMS_MAX: u32 = 256; +pub const _POSIX_SEM_VALUE_MAX: u32 = 32767; +pub const _POSIX_SIGQUEUE_MAX: u32 = 32; +pub const _POSIX_SSIZE_MAX: u32 = 32767; +pub const _POSIX_STREAM_MAX: u32 = 8; +pub const _POSIX_SS_REPL_MAX: u32 = 4; +pub const _POSIX_SYMLINK_MAX: u32 = 255; +pub const _POSIX_SYMLOOP_MAX: u32 = 8; +pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const _POSIX_THREAD_KEYS_MAX: u32 = 128; +pub const _POSIX_THREAD_THREADS_MAX: u32 = 64; +pub const _POSIX_TIMER_MAX: u32 = 32; +pub const _POSIX_TRACE_EVENT_NAME_MAX: u32 = 30; +pub const _POSIX_TRACE_NAME_MAX: u32 = 8; +pub const _POSIX_TRACE_SYS_MAX: u32 = 8; +pub const _POSIX_TRACE_USER_EVENT_MAX: u32 = 32; +pub const _POSIX_TTY_NAME_MAX: u32 = 9; +pub const _POSIX_TZNAME_MAX: u32 = 6; +pub const _POSIX2_BC_BASE_MAX: u32 = 99; +pub const _POSIX2_BC_DIM_MAX: u32 = 2048; +pub const _POSIX2_BC_SCALE_MAX: u32 = 99; +pub const _POSIX2_BC_STRING_MAX: u32 = 1000; +pub const _POSIX2_CHARCLASS_NAME_MAX: u32 = 14; +pub const _POSIX2_COLL_WEIGHTS_MAX: u32 = 2; +pub const _POSIX2_EXPR_NEST_MAX: u32 = 32; +pub const _POSIX2_LINE_MAX: u32 = 2048; +pub const _POSIX2_RE_DUP_MAX: u32 = 255; +pub const _XOPEN_IOV_MAX: u32 = 16; +pub const _XOPEN_NAME_MAX: u32 = 255; +pub const _XOPEN_PATH_MAX: u32 = 1024; +pub const HOST_NAME_MAX: u32 = 255; +pub const LOGIN_NAME_MAX: u32 = 256; +pub const TTY_NAME_MAX: u32 = 32; +pub const PTHREAD_DESTRUCTOR_ITERATIONS: u32 = 4; +pub const PTHREAD_KEYS_MAX: u32 = 128; +pub const FP_INFINITE: u32 = 1; +pub const FP_NAN: u32 = 2; +pub const FP_NORMAL: u32 = 4; +pub const FP_SUBNORMAL: u32 = 8; +pub const FP_ZERO: u32 = 16; +pub const FP_ILOGB0: i32 = -2147483647; +pub const FP_ILOGBNAN: u32 = 2147483647; +pub const MATH_ERRNO: u32 = 1; +pub const MATH_ERREXCEPT: u32 = 2; +pub const math_errhandling: u32 = 2; +pub const M_E: f64 = 2.718281828459045; +pub const M_LOG2E: f64 = 1.4426950408889634; +pub const M_LOG10E: f64 = 0.4342944819032518; +pub const M_LN2: f64 = 0.6931471805599453; +pub const M_LN10: f64 = 2.302585092994046; +pub const M_PI: f64 = 3.141592653589793; +pub const M_PI_2: f64 = 1.5707963267948966; +pub const M_PI_4: f64 = 0.7853981633974483; +pub const M_1_PI: f64 = 0.3183098861837907; +pub const M_2_PI: f64 = 0.6366197723675814; +pub const M_2_SQRTPI: f64 = 1.1283791670955126; +pub const M_SQRT2: f64 = 1.4142135623730951; +pub const M_SQRT1_2: f64 = 0.7071067811865476; +pub const ASENSOR_FIFO_COUNT_INVALID: i32 = -1; +pub const ASENSOR_DELAY_INVALID: i32 = -2147483648; +pub const ASENSOR_INVALID: i32 = -1; +pub const ASENSOR_STANDARD_GRAVITY: f64 = 9.80665; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MAX: f64 = 60.0; +pub const ASENSOR_MAGNETIC_FIELD_EARTH_MIN: f64 = 30.0; +pub const _IOC_NRBITS: u32 = 8; +pub const _IOC_TYPEBITS: u32 = 8; +pub const _IOC_SIZEBITS: u32 = 14; +pub const _IOC_DIRBITS: u32 = 2; +pub const _IOC_NRMASK: u32 = 255; +pub const _IOC_TYPEMASK: u32 = 255; +pub const _IOC_SIZEMASK: u32 = 16383; +pub const _IOC_DIRMASK: u32 = 3; +pub const _IOC_NRSHIFT: u32 = 0; +pub const _IOC_TYPESHIFT: u32 = 8; +pub const _IOC_SIZESHIFT: u32 = 16; +pub const _IOC_DIRSHIFT: u32 = 30; +pub const _IOC_NONE: u32 = 0; +pub const _IOC_WRITE: u32 = 1; +pub const _IOC_READ: u32 = 2; +pub const IOC_IN: u32 = 1073741824; +pub const IOC_OUT: u32 = 2147483648; +pub const IOC_INOUT: u32 = 3221225472; +pub const IOCSIZE_MASK: u32 = 1073676288; +pub const IOCSIZE_SHIFT: u32 = 16; +pub const SYNC_IOC_MAGIC: u8 = 62u8; +extern "C" { + pub fn android_get_application_target_sdk_version() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_get_device_api_level() -> ::std::os::raw::c_int; +} +pub type wchar_t = ::std::os::raw::c_int; +#[repr(C)] +#[repr(align(16))] +#[derive(Debug, Copy, Clone)] +pub struct max_align_t { + pub __clang_max_align_nonce1: ::std::os::raw::c_longlong, + pub __bindgen_padding_0: u64, + pub __clang_max_align_nonce2: u128, +} +#[test] +fn bindgen_test_layout_max_align_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(max_align_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 16usize, + concat!("Alignment of ", stringify!(max_align_t)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(max_align_t), + "::", + stringify!(__clang_max_align_nonce2) + ) + ); +} +pub type __int8_t = ::std::os::raw::c_schar; +pub type __uint8_t = ::std::os::raw::c_uchar; +pub type __int16_t = ::std::os::raw::c_short; +pub type __uint16_t = ::std::os::raw::c_ushort; +pub type __int32_t = ::std::os::raw::c_int; +pub type __uint32_t = ::std::os::raw::c_uint; +pub type __int64_t = ::std::os::raw::c_long; +pub type __uint64_t = ::std::os::raw::c_ulong; +pub type __intptr_t = ::std::os::raw::c_long; +pub type __uintptr_t = ::std::os::raw::c_ulong; +pub type int_least8_t = i8; +pub type uint_least8_t = u8; +pub type int_least16_t = i16; +pub type uint_least16_t = u16; +pub type int_least32_t = i32; +pub type uint_least32_t = u32; +pub type int_least64_t = i64; +pub type uint_least64_t = u64; +pub type int_fast8_t = i8; +pub type uint_fast8_t = u8; +pub type int_fast64_t = i64; +pub type uint_fast64_t = u64; +pub type int_fast16_t = i64; +pub type uint_fast16_t = u64; +pub type int_fast32_t = i64; +pub type uint_fast32_t = u64; +pub type uintmax_t = u64; +pub type intmax_t = i64; +pub type __s8 = ::std::os::raw::c_schar; +pub type __u8 = ::std::os::raw::c_uchar; +pub type __s16 = ::std::os::raw::c_short; +pub type __u16 = ::std::os::raw::c_ushort; +pub type __s32 = ::std::os::raw::c_int; +pub type __u32 = ::std::os::raw::c_uint; +pub type __s64 = ::std::os::raw::c_longlong; +pub type __u64 = ::std::os::raw::c_ulonglong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[test] +fn bindgen_test_layout___kernel_fd_set() { + assert_eq!( + ::std::mem::size_of::<__kernel_fd_set>(), + 128usize, + concat!("Size of: ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fd_set>(), + 8usize, + concat!("Alignment of ", stringify!(__kernel_fd_set)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fd_set), + "::", + stringify!(fds_bits) + ) + ); +} +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[test] +fn bindgen_test_layout___kernel_fsid_t() { + assert_eq!( + ::std::mem::size_of::<__kernel_fsid_t>(), + 8usize, + concat!("Size of: ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + ::std::mem::align_of::<__kernel_fsid_t>(), + 4usize, + concat!("Alignment of ", stringify!(__kernel_fsid_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__kernel_fsid_t), + "::", + stringify!(val) + ) + ); +} +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +pub type __le16 = __u16; +pub type __be16 = __u16; +pub type __le32 = __u32; +pub type __be32 = __u32; +pub type __le64 = __u64; +pub type __be64 = __u64; +pub type __sum16 = __u16; +pub type __wsum = __u32; +pub type __poll_t = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_attr_t { + pub flags: u32, + pub stack_base: *mut ::std::os::raw::c_void, + pub stack_size: usize, + pub guard_size: usize, + pub sched_policy: i32, + pub sched_priority: i32, + pub __reserved: [::std::os::raw::c_char; 16usize], +} +#[test] +fn bindgen_test_layout_pthread_attr_t() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(pthread_attr_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_attr_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_base as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stack_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(stack_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).guard_size as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(guard_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_policy as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_policy) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sched_priority as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(sched_priority) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__reserved as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(pthread_attr_t), + "::", + stringify!(__reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_barrier_t { + pub __private: [i64; 4usize], +} +#[test] +fn bindgen_test_layout_pthread_barrier_t() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_barrier_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_barrier_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_barrierattr_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_cond_t { + pub __private: [i32; 12usize], +} +#[test] +fn bindgen_test_layout_pthread_cond_t() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(pthread_cond_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_cond_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_cond_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_condattr_t = ::std::os::raw::c_long; +pub type pthread_key_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_mutex_t { + pub __private: [i32; 10usize], +} +#[test] +fn bindgen_test_layout_pthread_mutex_t() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_mutex_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_mutex_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_mutexattr_t = ::std::os::raw::c_long; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_rwlock_t { + pub __private: [i32; 14usize], +} +#[test] +fn bindgen_test_layout_pthread_rwlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(pthread_rwlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_rwlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_rwlockattr_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct pthread_spinlock_t { + pub __private: i64, +} +#[test] +fn bindgen_test_layout_pthread_spinlock_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(pthread_spinlock_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__private as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(pthread_spinlock_t), + "::", + stringify!(__private) + ) + ); +} +pub type pthread_t = ::std::os::raw::c_long; +pub type __gid_t = __kernel_gid32_t; +pub type gid_t = __gid_t; +pub type __uid_t = __kernel_uid32_t; +pub type uid_t = __uid_t; +pub type __pid_t = __kernel_pid_t; +pub type pid_t = __pid_t; +pub type __id_t = u32; +pub type id_t = __id_t; +pub type blkcnt_t = ::std::os::raw::c_ulong; +pub type blksize_t = ::std::os::raw::c_ulong; +pub type caddr_t = __kernel_caddr_t; +pub type clock_t = __kernel_clock_t; +pub type __clockid_t = __kernel_clockid_t; +pub type clockid_t = __clockid_t; +pub type daddr_t = __kernel_daddr_t; +pub type fsblkcnt_t = ::std::os::raw::c_ulong; +pub type fsfilcnt_t = ::std::os::raw::c_ulong; +pub type __mode_t = __kernel_mode_t; +pub type mode_t = __mode_t; +pub type __key_t = __kernel_key_t; +pub type key_t = __key_t; +pub type __ino_t = __kernel_ino_t; +pub type ino_t = __ino_t; +pub type ino64_t = u64; +pub type __nlink_t = u32; +pub type nlink_t = __nlink_t; +pub type __timer_t = *mut ::std::os::raw::c_void; +pub type timer_t = __timer_t; +pub type __suseconds_t = __kernel_suseconds_t; +pub type suseconds_t = __suseconds_t; +pub type __useconds_t = u32; +pub type useconds_t = __useconds_t; +pub type dev_t = u64; +pub type __time_t = __kernel_time_t; +pub type time_t = __time_t; +pub type off_t = i64; +pub type loff_t = off_t; +pub type off64_t = loff_t; +pub type __socklen_t = u32; +pub type socklen_t = __socklen_t; +pub type __va_list = __builtin_va_list; +pub type uint_t = ::std::os::raw::c_uint; +pub type uint = ::std::os::raw::c_uint; +pub type u_char = ::std::os::raw::c_uchar; +pub type u_short = ::std::os::raw::c_ushort; +pub type u_int = ::std::os::raw::c_uint; +pub type u_long = ::std::os::raw::c_ulong; +pub type u_int32_t = u32; +pub type u_int16_t = u16; +pub type u_int8_t = u8; +pub type u_int64_t = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAssetDir { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AAsset { + _unused: [u8; 0], +} +pub const AASSET_MODE_UNKNOWN: _bindgen_ty_1 = 0; +pub const AASSET_MODE_RANDOM: _bindgen_ty_1 = 1; +pub const AASSET_MODE_STREAMING: _bindgen_ty_1 = 2; +pub const AASSET_MODE_BUFFER: _bindgen_ty_1 = 3; +pub type _bindgen_ty_1 = u32; +extern "C" { + pub fn AAssetManager_openDir( + mgr: *mut AAssetManager, + dirName: *const ::std::os::raw::c_char, + ) -> *mut AAssetDir; +} +extern "C" { + pub fn AAssetManager_open( + mgr: *mut AAssetManager, + filename: *const ::std::os::raw::c_char, + mode: ::std::os::raw::c_int, + ) -> *mut AAsset; +} +extern "C" { + pub fn AAssetDir_getNextFileName(assetDir: *mut AAssetDir) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AAssetDir_rewind(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAssetDir_close(assetDir: *mut AAssetDir); +} +extern "C" { + pub fn AAsset_read( + asset: *mut AAsset, + buf: *mut ::std::os::raw::c_void, + count: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_seek(asset: *mut AAsset, offset: off_t, whence: ::std::os::raw::c_int) -> off_t; +} +extern "C" { + pub fn AAsset_seek64( + asset: *mut AAsset, + offset: off64_t, + whence: ::std::os::raw::c_int, + ) -> off64_t; +} +extern "C" { + pub fn AAsset_close(asset: *mut AAsset); +} +extern "C" { + pub fn AAsset_getBuffer(asset: *mut AAsset) -> *const ::std::os::raw::c_void; +} +extern "C" { + pub fn AAsset_getLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_getRemainingLength(asset: *mut AAsset) -> off_t; +} +extern "C" { + pub fn AAsset_getRemainingLength64(asset: *mut AAsset) -> off64_t; +} +extern "C" { + pub fn AAsset_openFileDescriptor( + asset: *mut AAsset, + outStart: *mut off_t, + outLength: *mut off_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_openFileDescriptor64( + asset: *mut AAsset, + outStart: *mut off64_t, + outLength: *mut off64_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AAsset_isAllocated(asset: *mut AAsset) -> ::std::os::raw::c_int; +} +pub type va_list = __builtin_va_list; +pub type __gnuc_va_list = __builtin_va_list; +pub type jboolean = u8; +pub type jbyte = i8; +pub type jchar = u16; +pub type jshort = i16; +pub type jint = i32; +pub type jlong = i64; +pub type jfloat = f32; +pub type jdouble = f64; +pub type jsize = jint; +pub type jobject = *mut ::std::os::raw::c_void; +pub type jclass = jobject; +pub type jstring = jobject; +pub type jarray = jobject; +pub type jobjectArray = jarray; +pub type jbooleanArray = jarray; +pub type jbyteArray = jarray; +pub type jcharArray = jarray; +pub type jshortArray = jarray; +pub type jintArray = jarray; +pub type jlongArray = jarray; +pub type jfloatArray = jarray; +pub type jdoubleArray = jarray; +pub type jthrowable = jobject; +pub type jweak = jobject; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jfieldID { + _unused: [u8; 0], +} +pub type jfieldID = *mut _jfieldID; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _jmethodID { + _unused: [u8; 0], +} +pub type jmethodID = *mut _jmethodID; +#[repr(C)] +#[derive(Copy, Clone)] +pub union jvalue { + pub z: jboolean, + pub b: jbyte, + pub c: jchar, + pub s: jshort, + pub i: jint, + pub j: jlong, + pub f: jfloat, + pub d: jdouble, + pub l: jobject, + _bindgen_union_align: u64, +} +#[test] +fn bindgen_test_layout_jvalue() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(jvalue)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(jvalue)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).z as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(z)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).b as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(b)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).c as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(c)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(s)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).i as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(i)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).j as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(j)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).f as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(f)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).d as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(d)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(jvalue), "::", stringify!(l)) + ); +} +pub const jobjectRefType_JNIInvalidRefType: jobjectRefType = 0; +pub const jobjectRefType_JNILocalRefType: jobjectRefType = 1; +pub const jobjectRefType_JNIGlobalRefType: jobjectRefType = 2; +pub const jobjectRefType_JNIWeakGlobalRefType: jobjectRefType = 3; +pub type jobjectRefType = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeMethod { + pub name: *const ::std::os::raw::c_char, + pub signature: *const ::std::os::raw::c_char, + pub fnPtr: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JNINativeMethod() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(JNINativeMethod)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNINativeMethod)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).signature as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(signature) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fnPtr as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNINativeMethod), + "::", + stringify!(fnPtr) + ) + ); +} +pub type C_JNIEnv = *const JNINativeInterface; +pub type JNIEnv = *const JNINativeInterface; +pub type JavaVM = *const JNIInvokeInterface; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNINativeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub reserved3: *mut ::std::os::raw::c_void, + pub GetVersion: ::std::option::Option jint>, + pub DefineClass: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *const ::std::os::raw::c_char, + arg3: jobject, + arg4: *const jbyte, + arg5: jsize, + ) -> jclass, + >, + pub FindClass: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jclass, + >, + pub FromReflectedMethod: + ::std::option::Option jmethodID>, + pub FromReflectedField: + ::std::option::Option jfieldID>, + pub ToReflectedMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: jboolean, + ) -> jobject, + >, + pub GetSuperclass: + ::std::option::Option jclass>, + pub IsAssignableFrom: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jclass) -> jboolean, + >, + pub ToReflectedField: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jfieldID, + arg4: jboolean, + ) -> jobject, + >, + pub Throw: + ::std::option::Option jint>, + pub ThrowNew: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + ) -> jint, + >, + pub ExceptionOccurred: + ::std::option::Option jthrowable>, + pub ExceptionDescribe: ::std::option::Option, + pub ExceptionClear: ::std::option::Option, + pub FatalError: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char), + >, + pub PushLocalFrame: + ::std::option::Option jint>, + pub PopLocalFrame: + ::std::option::Option jobject>, + pub NewGlobalRef: + ::std::option::Option jobject>, + pub DeleteGlobalRef: + ::std::option::Option, + pub DeleteLocalRef: + ::std::option::Option, + pub IsSameObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jobject) -> jboolean, + >, + pub NewLocalRef: + ::std::option::Option jobject>, + pub EnsureLocalCapacity: + ::std::option::Option jint>, + pub AllocObject: + ::std::option::Option jobject>, + pub NewObject: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub NewObjectV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jobject, + >, + pub NewObjectA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub GetObjectClass: + ::std::option::Option jclass>, + pub IsInstanceOf: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass) -> jboolean, + >, + pub GetMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jobject, + >, + pub CallObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jobject, + >, + pub CallObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jboolean, + >, + pub CallBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jboolean, + >, + pub CallBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jbyte, + >, + pub CallByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jbyte, + >, + pub CallByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jchar, + >, + pub CallCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jchar, + >, + pub CallCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jshort, + >, + pub CallShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jshort, + >, + pub CallShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jint, + >, + pub CallIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jint, + >, + pub CallIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jlong, + >, + pub CallLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jlong, + >, + pub CallLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jfloat, + >, + pub CallFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jfloat, + >, + pub CallFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...) -> jdouble, + >, + pub CallDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jdouble, + >, + pub CallDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jmethodID, ...), + >, + pub CallVoidMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ), + >, + pub CallVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jmethodID, + arg4: *const jvalue, + ), + >, + pub CallNonvirtualObjectMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jobject, + >, + pub CallNonvirtualObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jobject, + >, + pub CallNonvirtualObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jobject, + >, + pub CallNonvirtualBooleanMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jboolean, + >, + pub CallNonvirtualBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jboolean, + >, + pub CallNonvirtualByteMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jbyte, + >, + pub CallNonvirtualByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jbyte, + >, + pub CallNonvirtualByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jbyte, + >, + pub CallNonvirtualCharMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jchar, + >, + pub CallNonvirtualCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jchar, + >, + pub CallNonvirtualCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jchar, + >, + pub CallNonvirtualShortMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jshort, + >, + pub CallNonvirtualShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jshort, + >, + pub CallNonvirtualShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jshort, + >, + pub CallNonvirtualIntMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jint, + >, + pub CallNonvirtualIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jint, + >, + pub CallNonvirtualIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jint, + >, + pub CallNonvirtualLongMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jlong, + >, + pub CallNonvirtualLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jlong, + >, + pub CallNonvirtualLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jlong, + >, + pub CallNonvirtualFloatMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jfloat, + >, + pub CallNonvirtualFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jfloat, + >, + pub CallNonvirtualDoubleMethod: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + ... + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ) -> jdouble, + >, + pub CallNonvirtualDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ) -> jdouble, + >, + pub CallNonvirtualVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jclass, arg4: jmethodID, ...), + >, + pub CallNonvirtualVoidMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *mut __va_list_tag, + ), + >, + pub CallNonvirtualVoidMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jobject, + arg3: jclass, + arg4: jmethodID, + arg5: *const jvalue, + ), + >, + pub GetFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jobject, + >, + pub GetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jboolean, + >, + pub GetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jbyte, + >, + pub GetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jchar, + >, + pub GetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jshort, + >, + pub GetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jint, + >, + pub GetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jlong, + >, + pub GetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jfloat, + >, + pub GetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID) -> jdouble, + >, + pub SetObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jobject), + >, + pub SetBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jboolean), + >, + pub SetByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jbyte), + >, + pub SetCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jchar), + >, + pub SetShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jshort), + >, + pub SetIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jint), + >, + pub SetLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jlong), + >, + pub SetFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jfloat), + >, + pub SetDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject, arg3: jfieldID, arg4: jdouble), + >, + pub GetStaticMethodID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jmethodID, + >, + pub CallStaticObjectMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jobject, + >, + pub CallStaticObjectMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jobject, + >, + pub CallStaticObjectMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jobject, + >, + pub CallStaticBooleanMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jboolean, + >, + pub CallStaticBooleanMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jboolean, + >, + pub CallStaticBooleanMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jboolean, + >, + pub CallStaticByteMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jbyte, + >, + pub CallStaticByteMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jbyte, + >, + pub CallStaticByteMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jbyte, + >, + pub CallStaticCharMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jchar, + >, + pub CallStaticCharMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jchar, + >, + pub CallStaticCharMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jchar, + >, + pub CallStaticShortMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jshort, + >, + pub CallStaticShortMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jshort, + >, + pub CallStaticShortMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jshort, + >, + pub CallStaticIntMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jint, + >, + pub CallStaticIntMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jint, + >, + pub CallStaticIntMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jint, + >, + pub CallStaticLongMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jlong, + >, + pub CallStaticLongMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jlong, + >, + pub CallStaticLongMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jlong, + >, + pub CallStaticFloatMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jfloat, + >, + pub CallStaticFloatMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jfloat, + >, + pub CallStaticFloatMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jfloat, + >, + pub CallStaticDoubleMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...) -> jdouble, + >, + pub CallStaticDoubleMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ) -> jdouble, + >, + pub CallStaticDoubleMethodA: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *const jvalue, + ) -> jdouble, + >, + pub CallStaticVoidMethod: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, ...), + >, + pub CallStaticVoidMethodV: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: jmethodID, + arg4: *mut __va_list_tag, + ), + >, + pub CallStaticVoidMethodA: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jmethodID, arg4: *const jvalue), + >, + pub GetStaticFieldID: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const ::std::os::raw::c_char, + arg4: *const ::std::os::raw::c_char, + ) -> jfieldID, + >, + pub GetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jobject, + >, + pub GetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jboolean, + >, + pub GetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jbyte, + >, + pub GetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jchar, + >, + pub GetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jshort, + >, + pub GetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jint, + >, + pub GetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jlong, + >, + pub GetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jfloat, + >, + pub GetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID) -> jdouble, + >, + pub SetStaticObjectField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jobject), + >, + pub SetStaticBooleanField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jboolean), + >, + pub SetStaticByteField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jbyte), + >, + pub SetStaticCharField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jchar), + >, + pub SetStaticShortField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jshort), + >, + pub SetStaticIntField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jint), + >, + pub SetStaticLongField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jlong), + >, + pub SetStaticFloatField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jfloat), + >, + pub SetStaticDoubleField: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jclass, arg3: jfieldID, arg4: jdouble), + >, + pub NewString: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const jchar, arg3: jsize) -> jstring, + >, + pub GetStringLength: + ::std::option::Option jsize>, + pub GetStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewStringUTF: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *const ::std::os::raw::c_char) -> jstring, + >, + pub GetStringUTFLength: + ::std::option::Option jsize>, + pub GetStringUTFChars: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: *mut jboolean, + ) -> *const ::std::os::raw::c_char, + >, + pub ReleaseStringUTFChars: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const ::std::os::raw::c_char), + >, + pub GetArrayLength: + ::std::option::Option jsize>, + pub NewObjectArray: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jsize, + arg3: jclass, + arg4: jobject, + ) -> jobjectArray, + >, + pub GetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize) -> jobject, + >, + pub SetObjectArrayElement: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobjectArray, arg3: jsize, arg4: jobject), + >, + pub NewBooleanArray: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jsize) -> jbooleanArray, + >, + pub NewByteArray: + ::std::option::Option jbyteArray>, + pub NewCharArray: + ::std::option::Option jcharArray>, + pub NewShortArray: + ::std::option::Option jshortArray>, + pub NewIntArray: + ::std::option::Option jintArray>, + pub NewLongArray: + ::std::option::Option jlongArray>, + pub NewFloatArray: + ::std::option::Option jfloatArray>, + pub NewDoubleArray: + ::std::option::Option jdoubleArray>, + pub GetBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + ) -> *mut jboolean, + >, + pub GetByteArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: *mut jboolean, + ) -> *mut jbyte, + >, + pub GetCharArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: *mut jboolean, + ) -> *mut jchar, + >, + pub GetShortArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: *mut jboolean, + ) -> *mut jshort, + >, + pub GetIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jboolean) -> *mut jint, + >, + pub GetLongArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: *mut jboolean, + ) -> *mut jlong, + >, + pub GetFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: *mut jboolean, + ) -> *mut jfloat, + >, + pub GetDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: *mut jboolean, + ) -> *mut jdouble, + >, + pub ReleaseBooleanArrayElements: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: *mut jboolean, + arg4: jint, + ), + >, + pub ReleaseByteArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jbyteArray, arg3: *mut jbyte, arg4: jint), + >, + pub ReleaseCharArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jcharArray, arg3: *mut jchar, arg4: jint), + >, + pub ReleaseShortArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jshortArray, arg3: *mut jshort, arg4: jint), + >, + pub ReleaseIntArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jintArray, arg3: *mut jint, arg4: jint), + >, + pub ReleaseLongArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jlongArray, arg3: *mut jlong, arg4: jint), + >, + pub ReleaseFloatArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jfloatArray, arg3: *mut jfloat, arg4: jint), + >, + pub ReleaseDoubleArrayElements: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jdoubleArray, arg3: *mut jdouble, arg4: jint), + >, + pub GetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jboolean, + ), + >, + pub GetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jbyte, + ), + >, + pub GetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jshort, + ), + >, + pub GetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jint, + ), + >, + pub GetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jlong, + ), + >, + pub GetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jfloat, + ), + >, + pub GetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *mut jdouble, + ), + >, + pub SetBooleanArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbooleanArray, + arg3: jsize, + arg4: jsize, + arg5: *const jboolean, + ), + >, + pub SetByteArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jbyteArray, + arg3: jsize, + arg4: jsize, + arg5: *const jbyte, + ), + >, + pub SetCharArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jcharArray, + arg3: jsize, + arg4: jsize, + arg5: *const jchar, + ), + >, + pub SetShortArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jshortArray, + arg3: jsize, + arg4: jsize, + arg5: *const jshort, + ), + >, + pub SetIntArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jintArray, + arg3: jsize, + arg4: jsize, + arg5: *const jint, + ), + >, + pub SetLongArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jlongArray, + arg3: jsize, + arg4: jsize, + arg5: *const jlong, + ), + >, + pub SetFloatArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jfloatArray, + arg3: jsize, + arg4: jsize, + arg5: *const jfloat, + ), + >, + pub SetDoubleArrayRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jdoubleArray, + arg3: jsize, + arg4: jsize, + arg5: *const jdouble, + ), + >, + pub RegisterNatives: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jclass, + arg3: *const JNINativeMethod, + arg4: jint, + ) -> jint, + >, + pub UnregisterNatives: + ::std::option::Option jint>, + pub MonitorEnter: + ::std::option::Option jint>, + pub MonitorExit: + ::std::option::Option jint>, + pub GetJavaVM: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: *mut *mut JavaVM) -> jint, + >, + pub GetStringRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut jchar, + ), + >, + pub GetStringUTFRegion: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jstring, + arg3: jsize, + arg4: jsize, + arg5: *mut ::std::os::raw::c_char, + ), + >, + pub GetPrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut jboolean, + ) -> *mut ::std::os::raw::c_void, + >, + pub ReleasePrimitiveArrayCritical: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: jarray, + arg3: *mut ::std::os::raw::c_void, + arg4: jint, + ), + >, + pub GetStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *mut jboolean) -> *const jchar, + >, + pub ReleaseStringCritical: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jstring, arg3: *const jchar), + >, + pub NewWeakGlobalRef: + ::std::option::Option jweak>, + pub DeleteWeakGlobalRef: + ::std::option::Option, + pub ExceptionCheck: ::std::option::Option jboolean>, + pub NewDirectByteBuffer: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JNIEnv, + arg2: *mut ::std::os::raw::c_void, + arg3: jlong, + ) -> jobject, + >, + pub GetDirectBufferAddress: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> *mut ::std::os::raw::c_void, + >, + pub GetDirectBufferCapacity: + ::std::option::Option jlong>, + pub GetObjectRefType: ::std::option::Option< + unsafe extern "C" fn(arg1: *mut JNIEnv, arg2: jobject) -> jobjectRefType, + >, +} +#[test] +fn bindgen_test_layout_JNINativeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 1864usize, + concat!("Size of: ", stringify!(JNINativeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNINativeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved3 as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(reserved3) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetVersion as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).DefineClass as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DefineClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FindClass as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FindClass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedMethod as *const _ as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).FromReflectedField as *const _ as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FromReflectedField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedMethod as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetSuperclass as *const _ as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetSuperclass) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).IsAssignableFrom as *const _ as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsAssignableFrom) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ToReflectedField as *const _ as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ToReflectedField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).Throw as *const _ as usize }, + 104usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(Throw) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ThrowNew as *const _ as usize }, + 112usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ThrowNew) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionOccurred as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionOccurred) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionDescribe as *const _ as usize + }, + 128usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionDescribe) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionClear as *const _ as usize + }, + 136usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionClear) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).FatalError as *const _ as usize }, + 144usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(FatalError) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PushLocalFrame as *const _ as usize + }, + 152usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PushLocalFrame) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).PopLocalFrame as *const _ as usize + }, + 160usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(PopLocalFrame) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewGlobalRef as *const _ as usize }, + 168usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteGlobalRef as *const _ as usize + }, + 176usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteLocalRef as *const _ as usize + }, + 184usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteLocalRef) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsSameObject as *const _ as usize }, + 192usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsSameObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLocalRef as *const _ as usize }, + 200usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLocalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).EnsureLocalCapacity as *const _ as usize + }, + 208usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(EnsureLocalCapacity) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).AllocObject as *const _ as usize }, + 216usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(AllocObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObject as *const _ as usize }, + 224usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObject) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectV as *const _ as usize }, + 232usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectV) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewObjectA as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectClass as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectClass) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).IsInstanceOf as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(IsInstanceOf) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetMethodID as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethod as *const _ as usize + }, + 272usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodV as *const _ as usize + }, + 280usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallObjectMethodA as *const _ as usize + }, + 288usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethod as *const _ as usize + }, + 296usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodV as *const _ as usize + }, + 304usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallBooleanMethodA as *const _ as usize + }, + 312usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethod as *const _ as usize + }, + 320usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodV as *const _ as usize + }, + 328usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallByteMethodA as *const _ as usize + }, + 336usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethod as *const _ as usize + }, + 344usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodV as *const _ as usize + }, + 352usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallCharMethodA as *const _ as usize + }, + 360usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethod as *const _ as usize + }, + 368usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodV as *const _ as usize + }, + 376usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallShortMethodA as *const _ as usize + }, + 384usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethod as *const _ as usize + }, + 392usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodV as *const _ as usize + }, + 400usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallIntMethodA as *const _ as usize + }, + 408usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethod as *const _ as usize + }, + 416usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodV as *const _ as usize + }, + 424usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallLongMethodA as *const _ as usize + }, + 432usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethod as *const _ as usize + }, + 440usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodV as *const _ as usize + }, + 448usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallFloatMethodA as *const _ as usize + }, + 456usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethod as *const _ as usize + }, + 464usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodV as *const _ as usize + }, + 472usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallDoubleMethodA as *const _ as usize + }, + 480usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethod as *const _ as usize + }, + 488usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodV as *const _ as usize + }, + 496usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallVoidMethodA as *const _ as usize + }, + 504usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethod as *const _ + as usize + }, + 512usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodV as *const _ + as usize + }, + 520usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualObjectMethodA as *const _ + as usize + }, + 528usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethod as *const _ + as usize + }, + 536usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodV as *const _ + as usize + }, + 544usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualBooleanMethodA as *const _ + as usize + }, + 552usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethod as *const _ + as usize + }, + 560usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodV as *const _ + as usize + }, + 568usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualByteMethodA as *const _ + as usize + }, + 576usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethod as *const _ + as usize + }, + 584usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodV as *const _ + as usize + }, + 592usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualCharMethodA as *const _ + as usize + }, + 600usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethod as *const _ + as usize + }, + 608usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodV as *const _ + as usize + }, + 616usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualShortMethodA as *const _ + as usize + }, + 624usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethod as *const _ + as usize + }, + 632usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodV as *const _ + as usize + }, + 640usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualIntMethodA as *const _ + as usize + }, + 648usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethod as *const _ + as usize + }, + 656usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodV as *const _ + as usize + }, + 664usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualLongMethodA as *const _ + as usize + }, + 672usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethod as *const _ + as usize + }, + 680usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodV as *const _ + as usize + }, + 688usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualFloatMethodA as *const _ + as usize + }, + 696usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethod as *const _ + as usize + }, + 704usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodV as *const _ + as usize + }, + 712usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualDoubleMethodA as *const _ + as usize + }, + 720usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethod as *const _ + as usize + }, + 728usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodV as *const _ + as usize + }, + 736usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallNonvirtualVoidMethodA as *const _ + as usize + }, + 744usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallNonvirtualVoidMethodA) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetFieldID as *const _ as usize }, + 752usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectField as *const _ as usize + }, + 760usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanField as *const _ as usize + }, + 768usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetByteField as *const _ as usize }, + 776usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetCharField as *const _ as usize }, + 784usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortField as *const _ as usize + }, + 792usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetIntField as *const _ as usize }, + 800usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetLongField as *const _ as usize }, + 808usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatField as *const _ as usize + }, + 816usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleField as *const _ as usize + }, + 824usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectField as *const _ as usize + }, + 832usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanField as *const _ as usize + }, + 840usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetByteField as *const _ as usize }, + 848usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetCharField as *const _ as usize }, + 856usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortField as *const _ as usize + }, + 864usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetIntField as *const _ as usize }, + 872usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).SetLongField as *const _ as usize }, + 880usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatField as *const _ as usize + }, + 888usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleField as *const _ as usize + }, + 896usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticMethodID as *const _ as usize + }, + 904usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticMethodID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethod as *const _ + as usize + }, + 912usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodV as *const _ + as usize + }, + 920usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticObjectMethodA as *const _ + as usize + }, + 928usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticObjectMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethod as *const _ + as usize + }, + 936usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodV as *const _ + as usize + }, + 944usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticBooleanMethodA as *const _ + as usize + }, + 952usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticBooleanMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethod as *const _ as usize + }, + 960usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodV as *const _ + as usize + }, + 968usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticByteMethodA as *const _ + as usize + }, + 976usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticByteMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethod as *const _ as usize + }, + 984usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodV as *const _ + as usize + }, + 992usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticCharMethodA as *const _ + as usize + }, + 1000usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticCharMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethod as *const _ + as usize + }, + 1008usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodV as *const _ + as usize + }, + 1016usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticShortMethodA as *const _ + as usize + }, + 1024usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticShortMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethod as *const _ as usize + }, + 1032usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodV as *const _ as usize + }, + 1040usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticIntMethodA as *const _ as usize + }, + 1048usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticIntMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethod as *const _ as usize + }, + 1056usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodV as *const _ + as usize + }, + 1064usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticLongMethodA as *const _ + as usize + }, + 1072usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticLongMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethod as *const _ + as usize + }, + 1080usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodV as *const _ + as usize + }, + 1088usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticFloatMethodA as *const _ + as usize + }, + 1096usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticFloatMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethod as *const _ + as usize + }, + 1104usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodV as *const _ + as usize + }, + 1112usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticDoubleMethodA as *const _ + as usize + }, + 1120usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticDoubleMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethod as *const _ as usize + }, + 1128usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethod) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodV as *const _ + as usize + }, + 1136usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodV) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).CallStaticVoidMethodA as *const _ + as usize + }, + 1144usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(CallStaticVoidMethodA) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFieldID as *const _ as usize + }, + 1152usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFieldID) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticObjectField as *const _ as usize + }, + 1160usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticBooleanField as *const _ + as usize + }, + 1168usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticByteField as *const _ as usize + }, + 1176usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticCharField as *const _ as usize + }, + 1184usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticShortField as *const _ as usize + }, + 1192usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticIntField as *const _ as usize + }, + 1200usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticLongField as *const _ as usize + }, + 1208usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticFloatField as *const _ as usize + }, + 1216usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStaticDoubleField as *const _ as usize + }, + 1224usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticObjectField as *const _ as usize + }, + 1232usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticObjectField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticBooleanField as *const _ + as usize + }, + 1240usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticBooleanField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticByteField as *const _ as usize + }, + 1248usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticByteField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticCharField as *const _ as usize + }, + 1256usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticCharField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticShortField as *const _ as usize + }, + 1264usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticShortField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticIntField as *const _ as usize + }, + 1272usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticIntField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticLongField as *const _ as usize + }, + 1280usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticLongField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticFloatField as *const _ as usize + }, + 1288usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticFloatField) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetStaticDoubleField as *const _ as usize + }, + 1296usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetStaticDoubleField) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewString as *const _ as usize }, + 1304usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewString) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringLength as *const _ as usize + }, + 1312usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringChars as *const _ as usize + }, + 1320usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringChars as *const _ as usize + }, + 1328usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringChars) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewStringUTF as *const _ as usize }, + 1336usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewStringUTF) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFLength as *const _ as usize + }, + 1344usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFChars as *const _ as usize + }, + 1352usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringUTFChars as *const _ + as usize + }, + 1360usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringUTFChars) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetArrayLength as *const _ as usize + }, + 1368usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetArrayLength) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewObjectArray as *const _ as usize + }, + 1376usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewObjectArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectArrayElement as *const _ + as usize + }, + 1384usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetObjectArrayElement as *const _ + as usize + }, + 1392usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetObjectArrayElement) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewBooleanArray as *const _ as usize + }, + 1400usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewBooleanArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewByteArray as *const _ as usize }, + 1408usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewByteArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewCharArray as *const _ as usize }, + 1416usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewCharArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewShortArray as *const _ as usize + }, + 1424usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewShortArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewIntArray as *const _ as usize }, + 1432usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewIntArray) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).NewLongArray as *const _ as usize }, + 1440usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewLongArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewFloatArray as *const _ as usize + }, + 1448usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewFloatArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDoubleArray as *const _ as usize + }, + 1456usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDoubleArray) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayElements as *const _ + as usize + }, + 1464usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayElements as *const _ as usize + }, + 1472usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayElements as *const _ as usize + }, + 1480usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayElements as *const _ + as usize + }, + 1488usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayElements as *const _ as usize + }, + 1496usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayElements as *const _ as usize + }, + 1504usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayElements as *const _ + as usize + }, + 1512usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayElements as *const _ + as usize + }, + 1520usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseBooleanArrayElements as *const _ + as usize + }, + 1528usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseBooleanArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseByteArrayElements as *const _ + as usize + }, + 1536usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseByteArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseCharArrayElements as *const _ + as usize + }, + 1544usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseCharArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseShortArrayElements as *const _ + as usize + }, + 1552usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseShortArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseIntArrayElements as *const _ + as usize + }, + 1560usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseIntArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseLongArrayElements as *const _ + as usize + }, + 1568usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseLongArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseFloatArrayElements as *const _ + as usize + }, + 1576usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseFloatArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseDoubleArrayElements as *const _ + as usize + }, + 1584usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseDoubleArrayElements) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetBooleanArrayRegion as *const _ + as usize + }, + 1592usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetByteArrayRegion as *const _ as usize + }, + 1600usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetCharArrayRegion as *const _ as usize + }, + 1608usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetShortArrayRegion as *const _ as usize + }, + 1616usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetIntArrayRegion as *const _ as usize + }, + 1624usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetLongArrayRegion as *const _ as usize + }, + 1632usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetFloatArrayRegion as *const _ as usize + }, + 1640usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDoubleArrayRegion as *const _ as usize + }, + 1648usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetBooleanArrayRegion as *const _ + as usize + }, + 1656usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetBooleanArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetByteArrayRegion as *const _ as usize + }, + 1664usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetByteArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetCharArrayRegion as *const _ as usize + }, + 1672usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetCharArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetShortArrayRegion as *const _ as usize + }, + 1680usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetShortArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetIntArrayRegion as *const _ as usize + }, + 1688usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetIntArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetLongArrayRegion as *const _ as usize + }, + 1696usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetLongArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetFloatArrayRegion as *const _ as usize + }, + 1704usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetFloatArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).SetDoubleArrayRegion as *const _ as usize + }, + 1712usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(SetDoubleArrayRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).RegisterNatives as *const _ as usize + }, + 1720usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(RegisterNatives) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).UnregisterNatives as *const _ as usize + }, + 1728usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(UnregisterNatives) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorEnter as *const _ as usize }, + 1736usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorEnter) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).MonitorExit as *const _ as usize }, + 1744usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(MonitorExit) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetJavaVM as *const _ as usize }, + 1752usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringRegion as *const _ as usize + }, + 1760usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringUTFRegion as *const _ as usize + }, + 1768usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringUTFRegion) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetPrimitiveArrayCritical as *const _ + as usize + }, + 1776usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetPrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleasePrimitiveArrayCritical as *const _ + as usize + }, + 1784usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleasePrimitiveArrayCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetStringCritical as *const _ as usize + }, + 1792usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ReleaseStringCritical as *const _ + as usize + }, + 1800usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ReleaseStringCritical) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewWeakGlobalRef as *const _ as usize + }, + 1808usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DeleteWeakGlobalRef as *const _ as usize + }, + 1816usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(DeleteWeakGlobalRef) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ExceptionCheck as *const _ as usize + }, + 1824usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(ExceptionCheck) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).NewDirectByteBuffer as *const _ as usize + }, + 1832usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(NewDirectByteBuffer) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferAddress as *const _ + as usize + }, + 1840usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferAddress) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetDirectBufferCapacity as *const _ + as usize + }, + 1848usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetDirectBufferCapacity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).GetObjectRefType as *const _ as usize + }, + 1856usize, + concat!( + "Offset of field: ", + stringify!(JNINativeInterface), + "::", + stringify!(GetObjectRefType) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JNIEnv { + pub functions: *const JNINativeInterface, +} +#[test] +fn bindgen_test_layout__JNIEnv() { + assert_eq!( + ::std::mem::size_of::<_JNIEnv>(), + 8usize, + concat!("Size of: ", stringify!(_JNIEnv)) + ); + assert_eq!( + ::std::mem::align_of::<_JNIEnv>(), + 8usize, + concat!("Alignment of ", stringify!(_JNIEnv)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JNIEnv>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JNIEnv), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JNIInvokeInterface { + pub reserved0: *mut ::std::os::raw::c_void, + pub reserved1: *mut ::std::os::raw::c_void, + pub reserved2: *mut ::std::os::raw::c_void, + pub DestroyJavaVM: ::std::option::Option jint>, + pub AttachCurrentThread: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, + pub DetachCurrentThread: ::std::option::Option jint>, + pub GetEnv: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut ::std::os::raw::c_void, + arg3: jint, + ) -> jint, + >, + pub AttachCurrentThreadAsDaemon: ::std::option::Option< + unsafe extern "C" fn( + arg1: *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint, + >, +} +#[test] +fn bindgen_test_layout_JNIInvokeInterface() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JNIInvokeInterface)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved1) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved2 as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(reserved2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DestroyJavaVM as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DestroyJavaVM) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThread as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThread) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).DetachCurrentThread as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(DetachCurrentThread) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).GetEnv as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(GetEnv) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).AttachCurrentThreadAsDaemon as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(JNIInvokeInterface), + "::", + stringify!(AttachCurrentThreadAsDaemon) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _JavaVM { + pub functions: *const JNIInvokeInterface, +} +#[test] +fn bindgen_test_layout__JavaVM() { + assert_eq!( + ::std::mem::size_of::<_JavaVM>(), + 8usize, + concat!("Size of: ", stringify!(_JavaVM)) + ); + assert_eq!( + ::std::mem::align_of::<_JavaVM>(), + 8usize, + concat!("Alignment of ", stringify!(_JavaVM)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<_JavaVM>())).functions as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(_JavaVM), + "::", + stringify!(functions) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMAttachArgs { + pub version: jint, + pub name: *const ::std::os::raw::c_char, + pub group: jobject, +} +#[test] +fn bindgen_test_layout_JavaVMAttachArgs() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JavaVMAttachArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).group as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JavaVMAttachArgs), + "::", + stringify!(group) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMOption { + pub optionString: *const ::std::os::raw::c_char, + pub extraInfo: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout_JavaVMOption() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(JavaVMOption)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JavaVMOption)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).optionString as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(optionString) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).extraInfo as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMOption), + "::", + stringify!(extraInfo) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct JavaVMInitArgs { + pub version: jint, + pub nOptions: jint, + pub options: *mut JavaVMOption, + pub ignoreUnrecognized: jboolean, +} +#[test] +fn bindgen_test_layout_JavaVMInitArgs() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(JavaVMInitArgs)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).nOptions as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(nOptions) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).options as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(options) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).ignoreUnrecognized as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(JavaVMInitArgs), + "::", + stringify!(ignoreUnrecognized) + ) + ); +} +extern "C" { + pub fn JNI_GetDefaultJavaVMInitArgs(arg1: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_CreateJavaVM( + arg1: *mut *mut JavaVM, + arg2: *mut *mut JNIEnv, + arg3: *mut ::std::os::raw::c_void, + ) -> jint; +} +extern "C" { + pub fn JNI_GetCreatedJavaVMs(arg1: *mut *mut JavaVM, arg2: jsize, arg3: *mut jsize) -> jint; +} +extern "C" { + pub fn JNI_OnLoad(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void) -> jint; +} +extern "C" { + pub fn JNI_OnUnload(vm: *mut JavaVM, reserved: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn AAssetManager_fromJava(env: *mut JNIEnv, assetManager: jobject) -> *mut AAssetManager; +} +pub const ANDROID_BITMAP_RESULT_SUCCESS: _bindgen_ty_2 = 0; +pub const ANDROID_BITMAP_RESULT_BAD_PARAMETER: _bindgen_ty_2 = -1; +pub const ANDROID_BITMAP_RESULT_JNI_EXCEPTION: _bindgen_ty_2 = -2; +pub const ANDROID_BITMAP_RESULT_ALLOCATION_FAILED: _bindgen_ty_2 = -3; +pub type _bindgen_ty_2 = i32; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_NONE: AndroidBitmapFormat = 0; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_8888: AndroidBitmapFormat = 1; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGB_565: AndroidBitmapFormat = 4; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_RGBA_4444: AndroidBitmapFormat = 7; +pub const AndroidBitmapFormat_ANDROID_BITMAP_FORMAT_A_8: AndroidBitmapFormat = 8; +pub type AndroidBitmapFormat = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AndroidBitmapInfo { + pub width: u32, + pub height: u32, + pub stride: u32, + pub format: i32, + pub flags: u32, +} +#[test] +fn bindgen_test_layout_AndroidBitmapInfo() { + assert_eq!( + ::std::mem::size_of::(), + 20usize, + concat!("Size of: ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AndroidBitmapInfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AndroidBitmapInfo), + "::", + stringify!(flags) + ) + ); +} +extern "C" { + pub fn AndroidBitmap_getInfo( + env: *mut JNIEnv, + jbitmap: jobject, + info: *mut AndroidBitmapInfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_lockPixels( + env: *mut JNIEnv, + jbitmap: jobject, + addrPtr: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AndroidBitmap_unlockPixels(env: *mut JNIEnv, jbitmap: jobject) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AChoreographer { + _unused: [u8; 0], +} +pub type AChoreographer_frameCallback = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: ::std::os::raw::c_long, data: *mut ::std::os::raw::c_void), +>; +pub type AChoreographer_frameCallback64 = ::std::option::Option< + unsafe extern "C" fn(frameTimeNanos: i64, data: *mut ::std::os::raw::c_void), +>; +extern "C" { + pub fn AChoreographer_getInstance() -> *mut AChoreographer; +} +extern "C" { + pub fn AChoreographer_postFrameCallback( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback, + data: *mut ::std::os::raw::c_void, + delayMillis: ::std::os::raw::c_long, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallback64( + chroreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AChoreographer_postFrameCallbackDelayed64( + choreographer: *mut AChoreographer, + callback: AChoreographer_frameCallback64, + data: *mut ::std::os::raw::c_void, + delayMillis: u32, + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AConfiguration { + _unused: [u8; 0], +} +pub const ACONFIGURATION_ORIENTATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_ORIENTATION_PORT: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_ORIENTATION_LAND: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_ORIENTATION_SQUARE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_TOUCHSCREEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_TOUCHSCREEN_NOTOUCH: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_TOUCHSCREEN_STYLUS: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_TOUCHSCREEN_FINGER: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_DENSITY_DEFAULT: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_DENSITY_LOW: _bindgen_ty_3 = 120; +pub const ACONFIGURATION_DENSITY_MEDIUM: _bindgen_ty_3 = 160; +pub const ACONFIGURATION_DENSITY_TV: _bindgen_ty_3 = 213; +pub const ACONFIGURATION_DENSITY_HIGH: _bindgen_ty_3 = 240; +pub const ACONFIGURATION_DENSITY_XHIGH: _bindgen_ty_3 = 320; +pub const ACONFIGURATION_DENSITY_XXHIGH: _bindgen_ty_3 = 480; +pub const ACONFIGURATION_DENSITY_XXXHIGH: _bindgen_ty_3 = 640; +pub const ACONFIGURATION_DENSITY_ANY: _bindgen_ty_3 = 65534; +pub const ACONFIGURATION_DENSITY_NONE: _bindgen_ty_3 = 65535; +pub const ACONFIGURATION_KEYBOARD_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYBOARD_NOKEYS: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYBOARD_QWERTY: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYBOARD_12KEY: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVIGATION_NONAV: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVIGATION_DPAD: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_NAVIGATION_TRACKBALL: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVIGATION_WHEEL: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_KEYSHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_KEYSHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_KEYSHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_KEYSHIDDEN_SOFT: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_NAVHIDDEN_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_NAVHIDDEN_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_NAVHIDDEN_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENSIZE_SMALL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENSIZE_NORMAL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENSIZE_LARGE: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_SCREENSIZE_XLARGE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_SCREENLONG_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENLONG_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENLONG_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREENROUND_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREENROUND_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_SCREENROUND_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_WIDE_COLOR_GAMUT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_HDR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_HDR_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_HDR_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_TYPE_NORMAL: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_TYPE_DESK: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_UI_MODE_TYPE_CAR: _bindgen_ty_3 = 3; +pub const ACONFIGURATION_UI_MODE_TYPE_TELEVISION: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_UI_MODE_TYPE_APPLIANCE: _bindgen_ty_3 = 5; +pub const ACONFIGURATION_UI_MODE_TYPE_WATCH: _bindgen_ty_3 = 6; +pub const ACONFIGURATION_UI_MODE_TYPE_VR_HEADSET: _bindgen_ty_3 = 7; +pub const ACONFIGURATION_UI_MODE_NIGHT_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_UI_MODE_NIGHT_NO: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_UI_MODE_NIGHT_YES: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SCREEN_HEIGHT_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_ANY: _bindgen_ty_3 = 0; +pub const ACONFIGURATION_LAYOUTDIR_LTR: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_LAYOUTDIR_RTL: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_MCC: _bindgen_ty_3 = 1; +pub const ACONFIGURATION_MNC: _bindgen_ty_3 = 2; +pub const ACONFIGURATION_LOCALE: _bindgen_ty_3 = 4; +pub const ACONFIGURATION_TOUCHSCREEN: _bindgen_ty_3 = 8; +pub const ACONFIGURATION_KEYBOARD: _bindgen_ty_3 = 16; +pub const ACONFIGURATION_KEYBOARD_HIDDEN: _bindgen_ty_3 = 32; +pub const ACONFIGURATION_NAVIGATION: _bindgen_ty_3 = 64; +pub const ACONFIGURATION_ORIENTATION: _bindgen_ty_3 = 128; +pub const ACONFIGURATION_DENSITY: _bindgen_ty_3 = 256; +pub const ACONFIGURATION_SCREEN_SIZE: _bindgen_ty_3 = 512; +pub const ACONFIGURATION_VERSION: _bindgen_ty_3 = 1024; +pub const ACONFIGURATION_SCREEN_LAYOUT: _bindgen_ty_3 = 2048; +pub const ACONFIGURATION_UI_MODE: _bindgen_ty_3 = 4096; +pub const ACONFIGURATION_SMALLEST_SCREEN_SIZE: _bindgen_ty_3 = 8192; +pub const ACONFIGURATION_LAYOUTDIR: _bindgen_ty_3 = 16384; +pub const ACONFIGURATION_SCREEN_ROUND: _bindgen_ty_3 = 32768; +pub const ACONFIGURATION_COLOR_MODE: _bindgen_ty_3 = 65536; +pub const ACONFIGURATION_MNC_ZERO: _bindgen_ty_3 = 65535; +pub type _bindgen_ty_3 = u32; +extern "C" { + pub fn AConfiguration_new() -> *mut AConfiguration; +} +extern "C" { + pub fn AConfiguration_delete(config: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_fromAssetManager(out: *mut AConfiguration, am: *mut AAssetManager); +} +extern "C" { + pub fn AConfiguration_copy(dest: *mut AConfiguration, src: *mut AConfiguration); +} +extern "C" { + pub fn AConfiguration_getMcc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMcc(config: *mut AConfiguration, mcc: i32); +} +extern "C" { + pub fn AConfiguration_getMnc(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setMnc(config: *mut AConfiguration, mnc: i32); +} +extern "C" { + pub fn AConfiguration_getLanguage( + config: *mut AConfiguration, + outLanguage: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setLanguage( + config: *mut AConfiguration, + language: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getCountry( + config: *mut AConfiguration, + outCountry: *mut ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_setCountry( + config: *mut AConfiguration, + country: *const ::std::os::raw::c_char, + ); +} +extern "C" { + pub fn AConfiguration_getOrientation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setOrientation(config: *mut AConfiguration, orientation: i32); +} +extern "C" { + pub fn AConfiguration_getTouchscreen(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setTouchscreen(config: *mut AConfiguration, touchscreen: i32); +} +extern "C" { + pub fn AConfiguration_getDensity(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setDensity(config: *mut AConfiguration, density: i32); +} +extern "C" { + pub fn AConfiguration_getKeyboard(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeyboard(config: *mut AConfiguration, keyboard: i32); +} +extern "C" { + pub fn AConfiguration_getNavigation(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavigation(config: *mut AConfiguration, navigation: i32); +} +extern "C" { + pub fn AConfiguration_getKeysHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setKeysHidden(config: *mut AConfiguration, keysHidden: i32); +} +extern "C" { + pub fn AConfiguration_getNavHidden(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setNavHidden(config: *mut AConfiguration, navHidden: i32); +} +extern "C" { + pub fn AConfiguration_getSdkVersion(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSdkVersion(config: *mut AConfiguration, sdkVersion: i32); +} +extern "C" { + pub fn AConfiguration_getScreenSize(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenSize(config: *mut AConfiguration, screenSize: i32); +} +extern "C" { + pub fn AConfiguration_getScreenLong(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenLong(config: *mut AConfiguration, screenLong: i32); +} +extern "C" { + pub fn AConfiguration_getScreenRound(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenRound(config: *mut AConfiguration, screenRound: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeType(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeType(config: *mut AConfiguration, uiModeType: i32); +} +extern "C" { + pub fn AConfiguration_getUiModeNight(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setUiModeNight(config: *mut AConfiguration, uiModeNight: i32); +} +extern "C" { + pub fn AConfiguration_getScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getScreenHeightDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setScreenHeightDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getSmallestScreenWidthDp(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setSmallestScreenWidthDp(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_getLayoutDirection(config: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_setLayoutDirection(config: *mut AConfiguration, value: i32); +} +extern "C" { + pub fn AConfiguration_diff(config1: *mut AConfiguration, config2: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_match(base: *mut AConfiguration, requested: *mut AConfiguration) -> i32; +} +extern "C" { + pub fn AConfiguration_isBetterThan( + base: *mut AConfiguration, + test: *mut AConfiguration, + requested: *mut AConfiguration, + ) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct imaxdiv_t { + pub quot: intmax_t, + pub rem: intmax_t, +} +#[test] +fn bindgen_test_layout_imaxdiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(imaxdiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(imaxdiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(imaxdiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn imaxabs(__i: intmax_t) -> intmax_t; +} +extern "C" { + pub fn imaxdiv(__numerator: intmax_t, __denominator: intmax_t) -> imaxdiv_t; +} +extern "C" { + pub fn strtoimax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn strtoumax( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +extern "C" { + pub fn wcstoimax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> intmax_t; +} +extern "C" { + pub fn wcstoumax( + __s: *const wchar_t, + __end_ptr: *mut *mut wchar_t, + __base: ::std::os::raw::c_int, + ) -> uintmax_t; +} +pub const ADataSpace_ADATASPACE_UNKNOWN: ADataSpace = 0; +pub const ADataSpace_ADATASPACE_SCRGB_LINEAR: ADataSpace = 406913024; +pub const ADataSpace_ADATASPACE_SRGB: ADataSpace = 142671872; +pub const ADataSpace_ADATASPACE_SCRGB: ADataSpace = 411107328; +pub const ADataSpace_ADATASPACE_DISPLAY_P3: ADataSpace = 143261696; +pub const ADataSpace_ADATASPACE_BT2020_PQ: ADataSpace = 163971072; +pub type ADataSpace = u32; +pub const ANDROID_DLEXT_RESERVED_ADDRESS: _bindgen_ty_4 = 1; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_HINT: _bindgen_ty_4 = 2; +pub const ANDROID_DLEXT_WRITE_RELRO: _bindgen_ty_4 = 4; +pub const ANDROID_DLEXT_USE_RELRO: _bindgen_ty_4 = 8; +pub const ANDROID_DLEXT_USE_LIBRARY_FD: _bindgen_ty_4 = 16; +pub const ANDROID_DLEXT_USE_LIBRARY_FD_OFFSET: _bindgen_ty_4 = 32; +pub const ANDROID_DLEXT_FORCE_LOAD: _bindgen_ty_4 = 64; +pub const ANDROID_DLEXT_USE_NAMESPACE: _bindgen_ty_4 = 512; +pub const ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE: _bindgen_ty_4 = 1024; +pub const ANDROID_DLEXT_VALID_FLAG_BITS: _bindgen_ty_4 = 1663; +pub type _bindgen_ty_4 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_namespace_t { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct android_dlextinfo { + pub flags: u64, + pub reserved_addr: *mut ::std::os::raw::c_void, + pub reserved_size: usize, + pub relro_fd: ::std::os::raw::c_int, + pub library_fd: ::std::os::raw::c_int, + pub library_fd_offset: off64_t, + pub library_namespace: *mut android_namespace_t, +} +#[test] +fn bindgen_test_layout_android_dlextinfo() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(android_dlextinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(android_dlextinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_addr as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved_size as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(reserved_size) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).relro_fd as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(relro_fd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).library_fd as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_fd_offset as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_fd_offset) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).library_namespace as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(android_dlextinfo), + "::", + stringify!(library_namespace) + ) + ); +} +extern "C" { + pub fn android_dlopen_ext( + __filename: *const ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + __info: *const android_dlextinfo, + ) -> *mut ::std::os::raw::c_void; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ARect { + pub left: i32, + pub top: i32, + pub right: i32, + pub bottom: i32, +} +#[test] +fn bindgen_test_layout_ARect() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ARect)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ARect)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).left as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(left) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).top as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(top) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).right as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(right) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bottom as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ARect), + "::", + stringify!(bottom) + ) + ); +} +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: AHardwareBuffer_Format = 1; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: AHardwareBuffer_Format = 2; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: AHardwareBuffer_Format = 3; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: AHardwareBuffer_Format = 4; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: AHardwareBuffer_Format = + 22; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: AHardwareBuffer_Format = + 43; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_BLOB: AHardwareBuffer_Format = 33; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D16_UNORM: AHardwareBuffer_Format = 48; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM: AHardwareBuffer_Format = 49; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT: AHardwareBuffer_Format = + 50; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT: AHardwareBuffer_Format = 51; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_D32_FLOAT_S8_UINT: AHardwareBuffer_Format = + 52; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_S8_UINT: AHardwareBuffer_Format = 53; +pub const AHardwareBuffer_Format_AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_420: AHardwareBuffer_Format = 35; +pub type AHardwareBuffer_Format = u32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_RARELY: + AHardwareBuffer_UsageFlags = 2; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN: + AHardwareBuffer_UsageFlags = 3; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_READ_MASK: + AHardwareBuffer_UsageFlags = 15; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_NEVER: + AHardwareBuffer_UsageFlags = 0; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_RARELY: + AHardwareBuffer_UsageFlags = 32; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_OFTEN: + AHardwareBuffer_UsageFlags = 48; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK: + AHardwareBuffer_UsageFlags = 240; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE: + AHardwareBuffer_UsageFlags = 256; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_FRAMEBUFFER: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT: + AHardwareBuffer_UsageFlags = 512; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_COMPOSER_OVERLAY: + AHardwareBuffer_UsageFlags = 2048; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_PROTECTED_CONTENT: + AHardwareBuffer_UsageFlags = 16384; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VIDEO_ENCODE: + AHardwareBuffer_UsageFlags = 65536; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_SENSOR_DIRECT_DATA: + AHardwareBuffer_UsageFlags = 8388608; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER: + AHardwareBuffer_UsageFlags = 16777216; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_CUBE_MAP: + AHardwareBuffer_UsageFlags = 33554432; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_GPU_MIPMAP_COMPLETE: + AHardwareBuffer_UsageFlags = 67108864; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_0: AHardwareBuffer_UsageFlags = + 268435456; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_1: AHardwareBuffer_UsageFlags = + 536870912; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_2: AHardwareBuffer_UsageFlags = + 1073741824; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_3: AHardwareBuffer_UsageFlags = + 2147483648; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_4: AHardwareBuffer_UsageFlags = + 281474976710656; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_5: AHardwareBuffer_UsageFlags = + 562949953421312; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_6: AHardwareBuffer_UsageFlags = + 1125899906842624; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_7: AHardwareBuffer_UsageFlags = + 2251799813685248; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_8: AHardwareBuffer_UsageFlags = + 4503599627370496; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_9: AHardwareBuffer_UsageFlags = + 9007199254740992; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_10: AHardwareBuffer_UsageFlags = + 18014398509481984; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_11: AHardwareBuffer_UsageFlags = + 36028797018963968; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_12: AHardwareBuffer_UsageFlags = + 72057594037927936; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_13: AHardwareBuffer_UsageFlags = + 144115188075855872; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_14: AHardwareBuffer_UsageFlags = + 288230376151711744; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_15: AHardwareBuffer_UsageFlags = + 576460752303423488; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_16: AHardwareBuffer_UsageFlags = + 1152921504606846976; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_17: AHardwareBuffer_UsageFlags = + 2305843009213693952; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_18: AHardwareBuffer_UsageFlags = + 4611686018427387904; +pub const AHardwareBuffer_UsageFlags_AHARDWAREBUFFER_USAGE_VENDOR_19: AHardwareBuffer_UsageFlags = + 9223372036854775808; +pub type AHardwareBuffer_UsageFlags = u64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Desc { + pub width: u32, + pub height: u32, + pub layers: u32, + pub format: u32, + pub usage: u64, + pub stride: u32, + pub rfu0: u32, + pub rfu1: u64, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Desc() { + assert_eq!( + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Desc)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).layers as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(layers) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usage as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(usage) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu0 as *const _ as usize }, + 28usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rfu1 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Desc), + "::", + stringify!(rfu1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Plane { + pub data: *mut ::std::os::raw::c_void, + pub pixelStride: u32, + pub rowStride: u32, +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Plane() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Plane)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).data as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pixelStride as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(pixelStride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rowStride as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Plane), + "::", + stringify!(rowStride) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer_Planes { + pub planeCount: u32, + pub planes: [AHardwareBuffer_Plane; 4usize], +} +#[test] +fn bindgen_test_layout_AHardwareBuffer_Planes() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(AHardwareBuffer_Planes)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).planeCount as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planeCount) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).planes as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AHardwareBuffer_Planes), + "::", + stringify!(planes) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHardwareBuffer { + _unused: [u8; 0], +} +extern "C" { + pub fn AHardwareBuffer_allocate( + desc: *const AHardwareBuffer_Desc, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_acquire(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_release(buffer: *mut AHardwareBuffer); +} +extern "C" { + pub fn AHardwareBuffer_describe( + buffer: *const AHardwareBuffer, + outDesc: *mut AHardwareBuffer_Desc, + ); +} +extern "C" { + pub fn AHardwareBuffer_lock( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockPlanes( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outPlanes: *mut AHardwareBuffer_Planes, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_unlock( + buffer: *mut AHardwareBuffer, + fence: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_sendHandleToUnixSocket( + buffer: *const AHardwareBuffer, + socketFd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_recvHandleFromUnixSocket( + socketFd: ::std::os::raw::c_int, + outBuffer: *mut *mut AHardwareBuffer, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_isSupported(desc: *const AHardwareBuffer_Desc) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_lockAndGetInfo( + buffer: *mut AHardwareBuffer, + usage: u64, + fence: i32, + rect: *const ARect, + outVirtualAddress: *mut *mut ::std::os::raw::c_void, + outBytesPerPixel: *mut i32, + outBytesPerStride: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AHardwareBuffer_fromHardwareBuffer( + env: *mut JNIEnv, + hardwareBufferObj: jobject, + ) -> *mut AHardwareBuffer; +} +extern "C" { + pub fn AHardwareBuffer_toHardwareBuffer( + env: *mut JNIEnv, + hardwareBuffer: *mut AHardwareBuffer, + ) -> jobject; +} +pub const AKEYCODE_UNKNOWN: _bindgen_ty_5 = 0; +pub const AKEYCODE_SOFT_LEFT: _bindgen_ty_5 = 1; +pub const AKEYCODE_SOFT_RIGHT: _bindgen_ty_5 = 2; +pub const AKEYCODE_HOME: _bindgen_ty_5 = 3; +pub const AKEYCODE_BACK: _bindgen_ty_5 = 4; +pub const AKEYCODE_CALL: _bindgen_ty_5 = 5; +pub const AKEYCODE_ENDCALL: _bindgen_ty_5 = 6; +pub const AKEYCODE_0: _bindgen_ty_5 = 7; +pub const AKEYCODE_1: _bindgen_ty_5 = 8; +pub const AKEYCODE_2: _bindgen_ty_5 = 9; +pub const AKEYCODE_3: _bindgen_ty_5 = 10; +pub const AKEYCODE_4: _bindgen_ty_5 = 11; +pub const AKEYCODE_5: _bindgen_ty_5 = 12; +pub const AKEYCODE_6: _bindgen_ty_5 = 13; +pub const AKEYCODE_7: _bindgen_ty_5 = 14; +pub const AKEYCODE_8: _bindgen_ty_5 = 15; +pub const AKEYCODE_9: _bindgen_ty_5 = 16; +pub const AKEYCODE_STAR: _bindgen_ty_5 = 17; +pub const AKEYCODE_POUND: _bindgen_ty_5 = 18; +pub const AKEYCODE_DPAD_UP: _bindgen_ty_5 = 19; +pub const AKEYCODE_DPAD_DOWN: _bindgen_ty_5 = 20; +pub const AKEYCODE_DPAD_LEFT: _bindgen_ty_5 = 21; +pub const AKEYCODE_DPAD_RIGHT: _bindgen_ty_5 = 22; +pub const AKEYCODE_DPAD_CENTER: _bindgen_ty_5 = 23; +pub const AKEYCODE_VOLUME_UP: _bindgen_ty_5 = 24; +pub const AKEYCODE_VOLUME_DOWN: _bindgen_ty_5 = 25; +pub const AKEYCODE_POWER: _bindgen_ty_5 = 26; +pub const AKEYCODE_CAMERA: _bindgen_ty_5 = 27; +pub const AKEYCODE_CLEAR: _bindgen_ty_5 = 28; +pub const AKEYCODE_A: _bindgen_ty_5 = 29; +pub const AKEYCODE_B: _bindgen_ty_5 = 30; +pub const AKEYCODE_C: _bindgen_ty_5 = 31; +pub const AKEYCODE_D: _bindgen_ty_5 = 32; +pub const AKEYCODE_E: _bindgen_ty_5 = 33; +pub const AKEYCODE_F: _bindgen_ty_5 = 34; +pub const AKEYCODE_G: _bindgen_ty_5 = 35; +pub const AKEYCODE_H: _bindgen_ty_5 = 36; +pub const AKEYCODE_I: _bindgen_ty_5 = 37; +pub const AKEYCODE_J: _bindgen_ty_5 = 38; +pub const AKEYCODE_K: _bindgen_ty_5 = 39; +pub const AKEYCODE_L: _bindgen_ty_5 = 40; +pub const AKEYCODE_M: _bindgen_ty_5 = 41; +pub const AKEYCODE_N: _bindgen_ty_5 = 42; +pub const AKEYCODE_O: _bindgen_ty_5 = 43; +pub const AKEYCODE_P: _bindgen_ty_5 = 44; +pub const AKEYCODE_Q: _bindgen_ty_5 = 45; +pub const AKEYCODE_R: _bindgen_ty_5 = 46; +pub const AKEYCODE_S: _bindgen_ty_5 = 47; +pub const AKEYCODE_T: _bindgen_ty_5 = 48; +pub const AKEYCODE_U: _bindgen_ty_5 = 49; +pub const AKEYCODE_V: _bindgen_ty_5 = 50; +pub const AKEYCODE_W: _bindgen_ty_5 = 51; +pub const AKEYCODE_X: _bindgen_ty_5 = 52; +pub const AKEYCODE_Y: _bindgen_ty_5 = 53; +pub const AKEYCODE_Z: _bindgen_ty_5 = 54; +pub const AKEYCODE_COMMA: _bindgen_ty_5 = 55; +pub const AKEYCODE_PERIOD: _bindgen_ty_5 = 56; +pub const AKEYCODE_ALT_LEFT: _bindgen_ty_5 = 57; +pub const AKEYCODE_ALT_RIGHT: _bindgen_ty_5 = 58; +pub const AKEYCODE_SHIFT_LEFT: _bindgen_ty_5 = 59; +pub const AKEYCODE_SHIFT_RIGHT: _bindgen_ty_5 = 60; +pub const AKEYCODE_TAB: _bindgen_ty_5 = 61; +pub const AKEYCODE_SPACE: _bindgen_ty_5 = 62; +pub const AKEYCODE_SYM: _bindgen_ty_5 = 63; +pub const AKEYCODE_EXPLORER: _bindgen_ty_5 = 64; +pub const AKEYCODE_ENVELOPE: _bindgen_ty_5 = 65; +pub const AKEYCODE_ENTER: _bindgen_ty_5 = 66; +pub const AKEYCODE_DEL: _bindgen_ty_5 = 67; +pub const AKEYCODE_GRAVE: _bindgen_ty_5 = 68; +pub const AKEYCODE_MINUS: _bindgen_ty_5 = 69; +pub const AKEYCODE_EQUALS: _bindgen_ty_5 = 70; +pub const AKEYCODE_LEFT_BRACKET: _bindgen_ty_5 = 71; +pub const AKEYCODE_RIGHT_BRACKET: _bindgen_ty_5 = 72; +pub const AKEYCODE_BACKSLASH: _bindgen_ty_5 = 73; +pub const AKEYCODE_SEMICOLON: _bindgen_ty_5 = 74; +pub const AKEYCODE_APOSTROPHE: _bindgen_ty_5 = 75; +pub const AKEYCODE_SLASH: _bindgen_ty_5 = 76; +pub const AKEYCODE_AT: _bindgen_ty_5 = 77; +pub const AKEYCODE_NUM: _bindgen_ty_5 = 78; +pub const AKEYCODE_HEADSETHOOK: _bindgen_ty_5 = 79; +pub const AKEYCODE_FOCUS: _bindgen_ty_5 = 80; +pub const AKEYCODE_PLUS: _bindgen_ty_5 = 81; +pub const AKEYCODE_MENU: _bindgen_ty_5 = 82; +pub const AKEYCODE_NOTIFICATION: _bindgen_ty_5 = 83; +pub const AKEYCODE_SEARCH: _bindgen_ty_5 = 84; +pub const AKEYCODE_MEDIA_PLAY_PAUSE: _bindgen_ty_5 = 85; +pub const AKEYCODE_MEDIA_STOP: _bindgen_ty_5 = 86; +pub const AKEYCODE_MEDIA_NEXT: _bindgen_ty_5 = 87; +pub const AKEYCODE_MEDIA_PREVIOUS: _bindgen_ty_5 = 88; +pub const AKEYCODE_MEDIA_REWIND: _bindgen_ty_5 = 89; +pub const AKEYCODE_MEDIA_FAST_FORWARD: _bindgen_ty_5 = 90; +pub const AKEYCODE_MUTE: _bindgen_ty_5 = 91; +pub const AKEYCODE_PAGE_UP: _bindgen_ty_5 = 92; +pub const AKEYCODE_PAGE_DOWN: _bindgen_ty_5 = 93; +pub const AKEYCODE_PICTSYMBOLS: _bindgen_ty_5 = 94; +pub const AKEYCODE_SWITCH_CHARSET: _bindgen_ty_5 = 95; +pub const AKEYCODE_BUTTON_A: _bindgen_ty_5 = 96; +pub const AKEYCODE_BUTTON_B: _bindgen_ty_5 = 97; +pub const AKEYCODE_BUTTON_C: _bindgen_ty_5 = 98; +pub const AKEYCODE_BUTTON_X: _bindgen_ty_5 = 99; +pub const AKEYCODE_BUTTON_Y: _bindgen_ty_5 = 100; +pub const AKEYCODE_BUTTON_Z: _bindgen_ty_5 = 101; +pub const AKEYCODE_BUTTON_L1: _bindgen_ty_5 = 102; +pub const AKEYCODE_BUTTON_R1: _bindgen_ty_5 = 103; +pub const AKEYCODE_BUTTON_L2: _bindgen_ty_5 = 104; +pub const AKEYCODE_BUTTON_R2: _bindgen_ty_5 = 105; +pub const AKEYCODE_BUTTON_THUMBL: _bindgen_ty_5 = 106; +pub const AKEYCODE_BUTTON_THUMBR: _bindgen_ty_5 = 107; +pub const AKEYCODE_BUTTON_START: _bindgen_ty_5 = 108; +pub const AKEYCODE_BUTTON_SELECT: _bindgen_ty_5 = 109; +pub const AKEYCODE_BUTTON_MODE: _bindgen_ty_5 = 110; +pub const AKEYCODE_ESCAPE: _bindgen_ty_5 = 111; +pub const AKEYCODE_FORWARD_DEL: _bindgen_ty_5 = 112; +pub const AKEYCODE_CTRL_LEFT: _bindgen_ty_5 = 113; +pub const AKEYCODE_CTRL_RIGHT: _bindgen_ty_5 = 114; +pub const AKEYCODE_CAPS_LOCK: _bindgen_ty_5 = 115; +pub const AKEYCODE_SCROLL_LOCK: _bindgen_ty_5 = 116; +pub const AKEYCODE_META_LEFT: _bindgen_ty_5 = 117; +pub const AKEYCODE_META_RIGHT: _bindgen_ty_5 = 118; +pub const AKEYCODE_FUNCTION: _bindgen_ty_5 = 119; +pub const AKEYCODE_SYSRQ: _bindgen_ty_5 = 120; +pub const AKEYCODE_BREAK: _bindgen_ty_5 = 121; +pub const AKEYCODE_MOVE_HOME: _bindgen_ty_5 = 122; +pub const AKEYCODE_MOVE_END: _bindgen_ty_5 = 123; +pub const AKEYCODE_INSERT: _bindgen_ty_5 = 124; +pub const AKEYCODE_FORWARD: _bindgen_ty_5 = 125; +pub const AKEYCODE_MEDIA_PLAY: _bindgen_ty_5 = 126; +pub const AKEYCODE_MEDIA_PAUSE: _bindgen_ty_5 = 127; +pub const AKEYCODE_MEDIA_CLOSE: _bindgen_ty_5 = 128; +pub const AKEYCODE_MEDIA_EJECT: _bindgen_ty_5 = 129; +pub const AKEYCODE_MEDIA_RECORD: _bindgen_ty_5 = 130; +pub const AKEYCODE_F1: _bindgen_ty_5 = 131; +pub const AKEYCODE_F2: _bindgen_ty_5 = 132; +pub const AKEYCODE_F3: _bindgen_ty_5 = 133; +pub const AKEYCODE_F4: _bindgen_ty_5 = 134; +pub const AKEYCODE_F5: _bindgen_ty_5 = 135; +pub const AKEYCODE_F6: _bindgen_ty_5 = 136; +pub const AKEYCODE_F7: _bindgen_ty_5 = 137; +pub const AKEYCODE_F8: _bindgen_ty_5 = 138; +pub const AKEYCODE_F9: _bindgen_ty_5 = 139; +pub const AKEYCODE_F10: _bindgen_ty_5 = 140; +pub const AKEYCODE_F11: _bindgen_ty_5 = 141; +pub const AKEYCODE_F12: _bindgen_ty_5 = 142; +pub const AKEYCODE_NUM_LOCK: _bindgen_ty_5 = 143; +pub const AKEYCODE_NUMPAD_0: _bindgen_ty_5 = 144; +pub const AKEYCODE_NUMPAD_1: _bindgen_ty_5 = 145; +pub const AKEYCODE_NUMPAD_2: _bindgen_ty_5 = 146; +pub const AKEYCODE_NUMPAD_3: _bindgen_ty_5 = 147; +pub const AKEYCODE_NUMPAD_4: _bindgen_ty_5 = 148; +pub const AKEYCODE_NUMPAD_5: _bindgen_ty_5 = 149; +pub const AKEYCODE_NUMPAD_6: _bindgen_ty_5 = 150; +pub const AKEYCODE_NUMPAD_7: _bindgen_ty_5 = 151; +pub const AKEYCODE_NUMPAD_8: _bindgen_ty_5 = 152; +pub const AKEYCODE_NUMPAD_9: _bindgen_ty_5 = 153; +pub const AKEYCODE_NUMPAD_DIVIDE: _bindgen_ty_5 = 154; +pub const AKEYCODE_NUMPAD_MULTIPLY: _bindgen_ty_5 = 155; +pub const AKEYCODE_NUMPAD_SUBTRACT: _bindgen_ty_5 = 156; +pub const AKEYCODE_NUMPAD_ADD: _bindgen_ty_5 = 157; +pub const AKEYCODE_NUMPAD_DOT: _bindgen_ty_5 = 158; +pub const AKEYCODE_NUMPAD_COMMA: _bindgen_ty_5 = 159; +pub const AKEYCODE_NUMPAD_ENTER: _bindgen_ty_5 = 160; +pub const AKEYCODE_NUMPAD_EQUALS: _bindgen_ty_5 = 161; +pub const AKEYCODE_NUMPAD_LEFT_PAREN: _bindgen_ty_5 = 162; +pub const AKEYCODE_NUMPAD_RIGHT_PAREN: _bindgen_ty_5 = 163; +pub const AKEYCODE_VOLUME_MUTE: _bindgen_ty_5 = 164; +pub const AKEYCODE_INFO: _bindgen_ty_5 = 165; +pub const AKEYCODE_CHANNEL_UP: _bindgen_ty_5 = 166; +pub const AKEYCODE_CHANNEL_DOWN: _bindgen_ty_5 = 167; +pub const AKEYCODE_ZOOM_IN: _bindgen_ty_5 = 168; +pub const AKEYCODE_ZOOM_OUT: _bindgen_ty_5 = 169; +pub const AKEYCODE_TV: _bindgen_ty_5 = 170; +pub const AKEYCODE_WINDOW: _bindgen_ty_5 = 171; +pub const AKEYCODE_GUIDE: _bindgen_ty_5 = 172; +pub const AKEYCODE_DVR: _bindgen_ty_5 = 173; +pub const AKEYCODE_BOOKMARK: _bindgen_ty_5 = 174; +pub const AKEYCODE_CAPTIONS: _bindgen_ty_5 = 175; +pub const AKEYCODE_SETTINGS: _bindgen_ty_5 = 176; +pub const AKEYCODE_TV_POWER: _bindgen_ty_5 = 177; +pub const AKEYCODE_TV_INPUT: _bindgen_ty_5 = 178; +pub const AKEYCODE_STB_POWER: _bindgen_ty_5 = 179; +pub const AKEYCODE_STB_INPUT: _bindgen_ty_5 = 180; +pub const AKEYCODE_AVR_POWER: _bindgen_ty_5 = 181; +pub const AKEYCODE_AVR_INPUT: _bindgen_ty_5 = 182; +pub const AKEYCODE_PROG_RED: _bindgen_ty_5 = 183; +pub const AKEYCODE_PROG_GREEN: _bindgen_ty_5 = 184; +pub const AKEYCODE_PROG_YELLOW: _bindgen_ty_5 = 185; +pub const AKEYCODE_PROG_BLUE: _bindgen_ty_5 = 186; +pub const AKEYCODE_APP_SWITCH: _bindgen_ty_5 = 187; +pub const AKEYCODE_BUTTON_1: _bindgen_ty_5 = 188; +pub const AKEYCODE_BUTTON_2: _bindgen_ty_5 = 189; +pub const AKEYCODE_BUTTON_3: _bindgen_ty_5 = 190; +pub const AKEYCODE_BUTTON_4: _bindgen_ty_5 = 191; +pub const AKEYCODE_BUTTON_5: _bindgen_ty_5 = 192; +pub const AKEYCODE_BUTTON_6: _bindgen_ty_5 = 193; +pub const AKEYCODE_BUTTON_7: _bindgen_ty_5 = 194; +pub const AKEYCODE_BUTTON_8: _bindgen_ty_5 = 195; +pub const AKEYCODE_BUTTON_9: _bindgen_ty_5 = 196; +pub const AKEYCODE_BUTTON_10: _bindgen_ty_5 = 197; +pub const AKEYCODE_BUTTON_11: _bindgen_ty_5 = 198; +pub const AKEYCODE_BUTTON_12: _bindgen_ty_5 = 199; +pub const AKEYCODE_BUTTON_13: _bindgen_ty_5 = 200; +pub const AKEYCODE_BUTTON_14: _bindgen_ty_5 = 201; +pub const AKEYCODE_BUTTON_15: _bindgen_ty_5 = 202; +pub const AKEYCODE_BUTTON_16: _bindgen_ty_5 = 203; +pub const AKEYCODE_LANGUAGE_SWITCH: _bindgen_ty_5 = 204; +pub const AKEYCODE_MANNER_MODE: _bindgen_ty_5 = 205; +pub const AKEYCODE_3D_MODE: _bindgen_ty_5 = 206; +pub const AKEYCODE_CONTACTS: _bindgen_ty_5 = 207; +pub const AKEYCODE_CALENDAR: _bindgen_ty_5 = 208; +pub const AKEYCODE_MUSIC: _bindgen_ty_5 = 209; +pub const AKEYCODE_CALCULATOR: _bindgen_ty_5 = 210; +pub const AKEYCODE_ZENKAKU_HANKAKU: _bindgen_ty_5 = 211; +pub const AKEYCODE_EISU: _bindgen_ty_5 = 212; +pub const AKEYCODE_MUHENKAN: _bindgen_ty_5 = 213; +pub const AKEYCODE_HENKAN: _bindgen_ty_5 = 214; +pub const AKEYCODE_KATAKANA_HIRAGANA: _bindgen_ty_5 = 215; +pub const AKEYCODE_YEN: _bindgen_ty_5 = 216; +pub const AKEYCODE_RO: _bindgen_ty_5 = 217; +pub const AKEYCODE_KANA: _bindgen_ty_5 = 218; +pub const AKEYCODE_ASSIST: _bindgen_ty_5 = 219; +pub const AKEYCODE_BRIGHTNESS_DOWN: _bindgen_ty_5 = 220; +pub const AKEYCODE_BRIGHTNESS_UP: _bindgen_ty_5 = 221; +pub const AKEYCODE_MEDIA_AUDIO_TRACK: _bindgen_ty_5 = 222; +pub const AKEYCODE_SLEEP: _bindgen_ty_5 = 223; +pub const AKEYCODE_WAKEUP: _bindgen_ty_5 = 224; +pub const AKEYCODE_PAIRING: _bindgen_ty_5 = 225; +pub const AKEYCODE_MEDIA_TOP_MENU: _bindgen_ty_5 = 226; +pub const AKEYCODE_11: _bindgen_ty_5 = 227; +pub const AKEYCODE_12: _bindgen_ty_5 = 228; +pub const AKEYCODE_LAST_CHANNEL: _bindgen_ty_5 = 229; +pub const AKEYCODE_TV_DATA_SERVICE: _bindgen_ty_5 = 230; +pub const AKEYCODE_VOICE_ASSIST: _bindgen_ty_5 = 231; +pub const AKEYCODE_TV_RADIO_SERVICE: _bindgen_ty_5 = 232; +pub const AKEYCODE_TV_TELETEXT: _bindgen_ty_5 = 233; +pub const AKEYCODE_TV_NUMBER_ENTRY: _bindgen_ty_5 = 234; +pub const AKEYCODE_TV_TERRESTRIAL_ANALOG: _bindgen_ty_5 = 235; +pub const AKEYCODE_TV_TERRESTRIAL_DIGITAL: _bindgen_ty_5 = 236; +pub const AKEYCODE_TV_SATELLITE: _bindgen_ty_5 = 237; +pub const AKEYCODE_TV_SATELLITE_BS: _bindgen_ty_5 = 238; +pub const AKEYCODE_TV_SATELLITE_CS: _bindgen_ty_5 = 239; +pub const AKEYCODE_TV_SATELLITE_SERVICE: _bindgen_ty_5 = 240; +pub const AKEYCODE_TV_NETWORK: _bindgen_ty_5 = 241; +pub const AKEYCODE_TV_ANTENNA_CABLE: _bindgen_ty_5 = 242; +pub const AKEYCODE_TV_INPUT_HDMI_1: _bindgen_ty_5 = 243; +pub const AKEYCODE_TV_INPUT_HDMI_2: _bindgen_ty_5 = 244; +pub const AKEYCODE_TV_INPUT_HDMI_3: _bindgen_ty_5 = 245; +pub const AKEYCODE_TV_INPUT_HDMI_4: _bindgen_ty_5 = 246; +pub const AKEYCODE_TV_INPUT_COMPOSITE_1: _bindgen_ty_5 = 247; +pub const AKEYCODE_TV_INPUT_COMPOSITE_2: _bindgen_ty_5 = 248; +pub const AKEYCODE_TV_INPUT_COMPONENT_1: _bindgen_ty_5 = 249; +pub const AKEYCODE_TV_INPUT_COMPONENT_2: _bindgen_ty_5 = 250; +pub const AKEYCODE_TV_INPUT_VGA_1: _bindgen_ty_5 = 251; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION: _bindgen_ty_5 = 252; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP: _bindgen_ty_5 = 253; +pub const AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN: _bindgen_ty_5 = 254; +pub const AKEYCODE_TV_ZOOM_MODE: _bindgen_ty_5 = 255; +pub const AKEYCODE_TV_CONTENTS_MENU: _bindgen_ty_5 = 256; +pub const AKEYCODE_TV_MEDIA_CONTEXT_MENU: _bindgen_ty_5 = 257; +pub const AKEYCODE_TV_TIMER_PROGRAMMING: _bindgen_ty_5 = 258; +pub const AKEYCODE_HELP: _bindgen_ty_5 = 259; +pub const AKEYCODE_NAVIGATE_PREVIOUS: _bindgen_ty_5 = 260; +pub const AKEYCODE_NAVIGATE_NEXT: _bindgen_ty_5 = 261; +pub const AKEYCODE_NAVIGATE_IN: _bindgen_ty_5 = 262; +pub const AKEYCODE_NAVIGATE_OUT: _bindgen_ty_5 = 263; +pub const AKEYCODE_STEM_PRIMARY: _bindgen_ty_5 = 264; +pub const AKEYCODE_STEM_1: _bindgen_ty_5 = 265; +pub const AKEYCODE_STEM_2: _bindgen_ty_5 = 266; +pub const AKEYCODE_STEM_3: _bindgen_ty_5 = 267; +pub const AKEYCODE_DPAD_UP_LEFT: _bindgen_ty_5 = 268; +pub const AKEYCODE_DPAD_DOWN_LEFT: _bindgen_ty_5 = 269; +pub const AKEYCODE_DPAD_UP_RIGHT: _bindgen_ty_5 = 270; +pub const AKEYCODE_DPAD_DOWN_RIGHT: _bindgen_ty_5 = 271; +pub const AKEYCODE_MEDIA_SKIP_FORWARD: _bindgen_ty_5 = 272; +pub const AKEYCODE_MEDIA_SKIP_BACKWARD: _bindgen_ty_5 = 273; +pub const AKEYCODE_MEDIA_STEP_FORWARD: _bindgen_ty_5 = 274; +pub const AKEYCODE_MEDIA_STEP_BACKWARD: _bindgen_ty_5 = 275; +pub const AKEYCODE_SOFT_SLEEP: _bindgen_ty_5 = 276; +pub const AKEYCODE_CUT: _bindgen_ty_5 = 277; +pub const AKEYCODE_COPY: _bindgen_ty_5 = 278; +pub const AKEYCODE_PASTE: _bindgen_ty_5 = 279; +pub const AKEYCODE_SYSTEM_NAVIGATION_UP: _bindgen_ty_5 = 280; +pub const AKEYCODE_SYSTEM_NAVIGATION_DOWN: _bindgen_ty_5 = 281; +pub const AKEYCODE_SYSTEM_NAVIGATION_LEFT: _bindgen_ty_5 = 282; +pub const AKEYCODE_SYSTEM_NAVIGATION_RIGHT: _bindgen_ty_5 = 283; +pub const AKEYCODE_ALL_APPS: _bindgen_ty_5 = 284; +pub const AKEYCODE_REFRESH: _bindgen_ty_5 = 285; +pub const AKEYCODE_THUMBS_UP: _bindgen_ty_5 = 286; +pub const AKEYCODE_THUMBS_DOWN: _bindgen_ty_5 = 287; +pub const AKEYCODE_PROFILE_SWITCH: _bindgen_ty_5 = 288; +pub type _bindgen_ty_5 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ALooper { + _unused: [u8; 0], +} +extern "C" { + pub fn ALooper_forThread() -> *mut ALooper; +} +pub const ALOOPER_PREPARE_ALLOW_NON_CALLBACKS: _bindgen_ty_6 = 1; +pub type _bindgen_ty_6 = u32; +extern "C" { + pub fn ALooper_prepare(opts: ::std::os::raw::c_int) -> *mut ALooper; +} +pub const ALOOPER_POLL_WAKE: _bindgen_ty_7 = -1; +pub const ALOOPER_POLL_CALLBACK: _bindgen_ty_7 = -2; +pub const ALOOPER_POLL_TIMEOUT: _bindgen_ty_7 = -3; +pub const ALOOPER_POLL_ERROR: _bindgen_ty_7 = -4; +pub type _bindgen_ty_7 = i32; +extern "C" { + pub fn ALooper_acquire(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_release(looper: *mut ALooper); +} +pub const ALOOPER_EVENT_INPUT: _bindgen_ty_8 = 1; +pub const ALOOPER_EVENT_OUTPUT: _bindgen_ty_8 = 2; +pub const ALOOPER_EVENT_ERROR: _bindgen_ty_8 = 4; +pub const ALOOPER_EVENT_HANGUP: _bindgen_ty_8 = 8; +pub const ALOOPER_EVENT_INVALID: _bindgen_ty_8 = 16; +pub type _bindgen_ty_8 = u32; +pub type ALooper_callbackFunc = ::std::option::Option< + unsafe extern "C" fn( + fd: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; +extern "C" { + pub fn ALooper_pollOnce( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_pollAll( + timeoutMillis: ::std::os::raw::c_int, + outFd: *mut ::std::os::raw::c_int, + outEvents: *mut ::std::os::raw::c_int, + outData: *mut *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_wake(looper: *mut ALooper); +} +extern "C" { + pub fn ALooper_addFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ident: ::std::os::raw::c_int, + events: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ALooper_removeFd( + looper: *mut ALooper, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +pub const AKEY_STATE_UNKNOWN: _bindgen_ty_9 = -1; +pub const AKEY_STATE_UP: _bindgen_ty_9 = 0; +pub const AKEY_STATE_DOWN: _bindgen_ty_9 = 1; +pub const AKEY_STATE_VIRTUAL: _bindgen_ty_9 = 2; +pub type _bindgen_ty_9 = i32; +pub const AMETA_NONE: _bindgen_ty_10 = 0; +pub const AMETA_ALT_ON: _bindgen_ty_10 = 2; +pub const AMETA_ALT_LEFT_ON: _bindgen_ty_10 = 16; +pub const AMETA_ALT_RIGHT_ON: _bindgen_ty_10 = 32; +pub const AMETA_SHIFT_ON: _bindgen_ty_10 = 1; +pub const AMETA_SHIFT_LEFT_ON: _bindgen_ty_10 = 64; +pub const AMETA_SHIFT_RIGHT_ON: _bindgen_ty_10 = 128; +pub const AMETA_SYM_ON: _bindgen_ty_10 = 4; +pub const AMETA_FUNCTION_ON: _bindgen_ty_10 = 8; +pub const AMETA_CTRL_ON: _bindgen_ty_10 = 4096; +pub const AMETA_CTRL_LEFT_ON: _bindgen_ty_10 = 8192; +pub const AMETA_CTRL_RIGHT_ON: _bindgen_ty_10 = 16384; +pub const AMETA_META_ON: _bindgen_ty_10 = 65536; +pub const AMETA_META_LEFT_ON: _bindgen_ty_10 = 131072; +pub const AMETA_META_RIGHT_ON: _bindgen_ty_10 = 262144; +pub const AMETA_CAPS_LOCK_ON: _bindgen_ty_10 = 1048576; +pub const AMETA_NUM_LOCK_ON: _bindgen_ty_10 = 2097152; +pub const AMETA_SCROLL_LOCK_ON: _bindgen_ty_10 = 4194304; +pub type _bindgen_ty_10 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputEvent { + _unused: [u8; 0], +} +pub const AINPUT_EVENT_TYPE_KEY: _bindgen_ty_11 = 1; +pub const AINPUT_EVENT_TYPE_MOTION: _bindgen_ty_11 = 2; +pub type _bindgen_ty_11 = u32; +pub const AKEY_EVENT_ACTION_DOWN: _bindgen_ty_12 = 0; +pub const AKEY_EVENT_ACTION_UP: _bindgen_ty_12 = 1; +pub const AKEY_EVENT_ACTION_MULTIPLE: _bindgen_ty_12 = 2; +pub type _bindgen_ty_12 = u32; +pub const AKEY_EVENT_FLAG_WOKE_HERE: _bindgen_ty_13 = 1; +pub const AKEY_EVENT_FLAG_SOFT_KEYBOARD: _bindgen_ty_13 = 2; +pub const AKEY_EVENT_FLAG_KEEP_TOUCH_MODE: _bindgen_ty_13 = 4; +pub const AKEY_EVENT_FLAG_FROM_SYSTEM: _bindgen_ty_13 = 8; +pub const AKEY_EVENT_FLAG_EDITOR_ACTION: _bindgen_ty_13 = 16; +pub const AKEY_EVENT_FLAG_CANCELED: _bindgen_ty_13 = 32; +pub const AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY: _bindgen_ty_13 = 64; +pub const AKEY_EVENT_FLAG_LONG_PRESS: _bindgen_ty_13 = 128; +pub const AKEY_EVENT_FLAG_CANCELED_LONG_PRESS: _bindgen_ty_13 = 256; +pub const AKEY_EVENT_FLAG_TRACKING: _bindgen_ty_13 = 512; +pub const AKEY_EVENT_FLAG_FALLBACK: _bindgen_ty_13 = 1024; +pub type _bindgen_ty_13 = u32; +pub const AMOTION_EVENT_ACTION_MASK: _bindgen_ty_14 = 255; +pub const AMOTION_EVENT_ACTION_POINTER_INDEX_MASK: _bindgen_ty_14 = 65280; +pub const AMOTION_EVENT_ACTION_DOWN: _bindgen_ty_14 = 0; +pub const AMOTION_EVENT_ACTION_UP: _bindgen_ty_14 = 1; +pub const AMOTION_EVENT_ACTION_MOVE: _bindgen_ty_14 = 2; +pub const AMOTION_EVENT_ACTION_CANCEL: _bindgen_ty_14 = 3; +pub const AMOTION_EVENT_ACTION_OUTSIDE: _bindgen_ty_14 = 4; +pub const AMOTION_EVENT_ACTION_POINTER_DOWN: _bindgen_ty_14 = 5; +pub const AMOTION_EVENT_ACTION_POINTER_UP: _bindgen_ty_14 = 6; +pub const AMOTION_EVENT_ACTION_HOVER_MOVE: _bindgen_ty_14 = 7; +pub const AMOTION_EVENT_ACTION_SCROLL: _bindgen_ty_14 = 8; +pub const AMOTION_EVENT_ACTION_HOVER_ENTER: _bindgen_ty_14 = 9; +pub const AMOTION_EVENT_ACTION_HOVER_EXIT: _bindgen_ty_14 = 10; +pub const AMOTION_EVENT_ACTION_BUTTON_PRESS: _bindgen_ty_14 = 11; +pub const AMOTION_EVENT_ACTION_BUTTON_RELEASE: _bindgen_ty_14 = 12; +pub type _bindgen_ty_14 = u32; +pub const AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED: _bindgen_ty_15 = 1; +pub type _bindgen_ty_15 = u32; +pub const AMOTION_EVENT_EDGE_FLAG_NONE: _bindgen_ty_16 = 0; +pub const AMOTION_EVENT_EDGE_FLAG_TOP: _bindgen_ty_16 = 1; +pub const AMOTION_EVENT_EDGE_FLAG_BOTTOM: _bindgen_ty_16 = 2; +pub const AMOTION_EVENT_EDGE_FLAG_LEFT: _bindgen_ty_16 = 4; +pub const AMOTION_EVENT_EDGE_FLAG_RIGHT: _bindgen_ty_16 = 8; +pub type _bindgen_ty_16 = u32; +pub const AMOTION_EVENT_AXIS_X: _bindgen_ty_17 = 0; +pub const AMOTION_EVENT_AXIS_Y: _bindgen_ty_17 = 1; +pub const AMOTION_EVENT_AXIS_PRESSURE: _bindgen_ty_17 = 2; +pub const AMOTION_EVENT_AXIS_SIZE: _bindgen_ty_17 = 3; +pub const AMOTION_EVENT_AXIS_TOUCH_MAJOR: _bindgen_ty_17 = 4; +pub const AMOTION_EVENT_AXIS_TOUCH_MINOR: _bindgen_ty_17 = 5; +pub const AMOTION_EVENT_AXIS_TOOL_MAJOR: _bindgen_ty_17 = 6; +pub const AMOTION_EVENT_AXIS_TOOL_MINOR: _bindgen_ty_17 = 7; +pub const AMOTION_EVENT_AXIS_ORIENTATION: _bindgen_ty_17 = 8; +pub const AMOTION_EVENT_AXIS_VSCROLL: _bindgen_ty_17 = 9; +pub const AMOTION_EVENT_AXIS_HSCROLL: _bindgen_ty_17 = 10; +pub const AMOTION_EVENT_AXIS_Z: _bindgen_ty_17 = 11; +pub const AMOTION_EVENT_AXIS_RX: _bindgen_ty_17 = 12; +pub const AMOTION_EVENT_AXIS_RY: _bindgen_ty_17 = 13; +pub const AMOTION_EVENT_AXIS_RZ: _bindgen_ty_17 = 14; +pub const AMOTION_EVENT_AXIS_HAT_X: _bindgen_ty_17 = 15; +pub const AMOTION_EVENT_AXIS_HAT_Y: _bindgen_ty_17 = 16; +pub const AMOTION_EVENT_AXIS_LTRIGGER: _bindgen_ty_17 = 17; +pub const AMOTION_EVENT_AXIS_RTRIGGER: _bindgen_ty_17 = 18; +pub const AMOTION_EVENT_AXIS_THROTTLE: _bindgen_ty_17 = 19; +pub const AMOTION_EVENT_AXIS_RUDDER: _bindgen_ty_17 = 20; +pub const AMOTION_EVENT_AXIS_WHEEL: _bindgen_ty_17 = 21; +pub const AMOTION_EVENT_AXIS_GAS: _bindgen_ty_17 = 22; +pub const AMOTION_EVENT_AXIS_BRAKE: _bindgen_ty_17 = 23; +pub const AMOTION_EVENT_AXIS_DISTANCE: _bindgen_ty_17 = 24; +pub const AMOTION_EVENT_AXIS_TILT: _bindgen_ty_17 = 25; +pub const AMOTION_EVENT_AXIS_SCROLL: _bindgen_ty_17 = 26; +pub const AMOTION_EVENT_AXIS_RELATIVE_X: _bindgen_ty_17 = 27; +pub const AMOTION_EVENT_AXIS_RELATIVE_Y: _bindgen_ty_17 = 28; +pub const AMOTION_EVENT_AXIS_GENERIC_1: _bindgen_ty_17 = 32; +pub const AMOTION_EVENT_AXIS_GENERIC_2: _bindgen_ty_17 = 33; +pub const AMOTION_EVENT_AXIS_GENERIC_3: _bindgen_ty_17 = 34; +pub const AMOTION_EVENT_AXIS_GENERIC_4: _bindgen_ty_17 = 35; +pub const AMOTION_EVENT_AXIS_GENERIC_5: _bindgen_ty_17 = 36; +pub const AMOTION_EVENT_AXIS_GENERIC_6: _bindgen_ty_17 = 37; +pub const AMOTION_EVENT_AXIS_GENERIC_7: _bindgen_ty_17 = 38; +pub const AMOTION_EVENT_AXIS_GENERIC_8: _bindgen_ty_17 = 39; +pub const AMOTION_EVENT_AXIS_GENERIC_9: _bindgen_ty_17 = 40; +pub const AMOTION_EVENT_AXIS_GENERIC_10: _bindgen_ty_17 = 41; +pub const AMOTION_EVENT_AXIS_GENERIC_11: _bindgen_ty_17 = 42; +pub const AMOTION_EVENT_AXIS_GENERIC_12: _bindgen_ty_17 = 43; +pub const AMOTION_EVENT_AXIS_GENERIC_13: _bindgen_ty_17 = 44; +pub const AMOTION_EVENT_AXIS_GENERIC_14: _bindgen_ty_17 = 45; +pub const AMOTION_EVENT_AXIS_GENERIC_15: _bindgen_ty_17 = 46; +pub const AMOTION_EVENT_AXIS_GENERIC_16: _bindgen_ty_17 = 47; +pub type _bindgen_ty_17 = u32; +pub const AMOTION_EVENT_BUTTON_PRIMARY: _bindgen_ty_18 = 1; +pub const AMOTION_EVENT_BUTTON_SECONDARY: _bindgen_ty_18 = 2; +pub const AMOTION_EVENT_BUTTON_TERTIARY: _bindgen_ty_18 = 4; +pub const AMOTION_EVENT_BUTTON_BACK: _bindgen_ty_18 = 8; +pub const AMOTION_EVENT_BUTTON_FORWARD: _bindgen_ty_18 = 16; +pub const AMOTION_EVENT_BUTTON_STYLUS_PRIMARY: _bindgen_ty_18 = 32; +pub const AMOTION_EVENT_BUTTON_STYLUS_SECONDARY: _bindgen_ty_18 = 64; +pub type _bindgen_ty_18 = u32; +pub const AMOTION_EVENT_TOOL_TYPE_UNKNOWN: _bindgen_ty_19 = 0; +pub const AMOTION_EVENT_TOOL_TYPE_FINGER: _bindgen_ty_19 = 1; +pub const AMOTION_EVENT_TOOL_TYPE_STYLUS: _bindgen_ty_19 = 2; +pub const AMOTION_EVENT_TOOL_TYPE_MOUSE: _bindgen_ty_19 = 3; +pub const AMOTION_EVENT_TOOL_TYPE_ERASER: _bindgen_ty_19 = 4; +pub type _bindgen_ty_19 = u32; +pub const AINPUT_SOURCE_CLASS_MASK: _bindgen_ty_20 = 255; +pub const AINPUT_SOURCE_CLASS_NONE: _bindgen_ty_20 = 0; +pub const AINPUT_SOURCE_CLASS_BUTTON: _bindgen_ty_20 = 1; +pub const AINPUT_SOURCE_CLASS_POINTER: _bindgen_ty_20 = 2; +pub const AINPUT_SOURCE_CLASS_NAVIGATION: _bindgen_ty_20 = 4; +pub const AINPUT_SOURCE_CLASS_POSITION: _bindgen_ty_20 = 8; +pub const AINPUT_SOURCE_CLASS_JOYSTICK: _bindgen_ty_20 = 16; +pub type _bindgen_ty_20 = u32; +pub const AINPUT_SOURCE_UNKNOWN: _bindgen_ty_21 = 0; +pub const AINPUT_SOURCE_KEYBOARD: _bindgen_ty_21 = 257; +pub const AINPUT_SOURCE_DPAD: _bindgen_ty_21 = 513; +pub const AINPUT_SOURCE_GAMEPAD: _bindgen_ty_21 = 1025; +pub const AINPUT_SOURCE_TOUCHSCREEN: _bindgen_ty_21 = 4098; +pub const AINPUT_SOURCE_MOUSE: _bindgen_ty_21 = 8194; +pub const AINPUT_SOURCE_STYLUS: _bindgen_ty_21 = 16386; +pub const AINPUT_SOURCE_BLUETOOTH_STYLUS: _bindgen_ty_21 = 49154; +pub const AINPUT_SOURCE_TRACKBALL: _bindgen_ty_21 = 65540; +pub const AINPUT_SOURCE_MOUSE_RELATIVE: _bindgen_ty_21 = 131076; +pub const AINPUT_SOURCE_TOUCHPAD: _bindgen_ty_21 = 1048584; +pub const AINPUT_SOURCE_TOUCH_NAVIGATION: _bindgen_ty_21 = 2097152; +pub const AINPUT_SOURCE_JOYSTICK: _bindgen_ty_21 = 16777232; +pub const AINPUT_SOURCE_ROTARY_ENCODER: _bindgen_ty_21 = 4194304; +pub const AINPUT_SOURCE_ANY: _bindgen_ty_21 = 4294967040; +pub type _bindgen_ty_21 = u32; +pub const AINPUT_KEYBOARD_TYPE_NONE: _bindgen_ty_22 = 0; +pub const AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC: _bindgen_ty_22 = 1; +pub const AINPUT_KEYBOARD_TYPE_ALPHABETIC: _bindgen_ty_22 = 2; +pub type _bindgen_ty_22 = u32; +pub const AINPUT_MOTION_RANGE_X: _bindgen_ty_23 = 0; +pub const AINPUT_MOTION_RANGE_Y: _bindgen_ty_23 = 1; +pub const AINPUT_MOTION_RANGE_PRESSURE: _bindgen_ty_23 = 2; +pub const AINPUT_MOTION_RANGE_SIZE: _bindgen_ty_23 = 3; +pub const AINPUT_MOTION_RANGE_TOUCH_MAJOR: _bindgen_ty_23 = 4; +pub const AINPUT_MOTION_RANGE_TOUCH_MINOR: _bindgen_ty_23 = 5; +pub const AINPUT_MOTION_RANGE_TOOL_MAJOR: _bindgen_ty_23 = 6; +pub const AINPUT_MOTION_RANGE_TOOL_MINOR: _bindgen_ty_23 = 7; +pub const AINPUT_MOTION_RANGE_ORIENTATION: _bindgen_ty_23 = 8; +pub type _bindgen_ty_23 = u32; +extern "C" { + pub fn AInputEvent_getType(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getDeviceId(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AInputEvent_getSource(event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getAction(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getFlags(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getKeyCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getScanCode(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getMetaState(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getRepeatCount(key_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AKeyEvent_getDownTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AKeyEvent_getEventTime(key_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getAction(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getMetaState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getButtonState(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getEdgeFlags(motion_event: *const AInputEvent) -> i32; +} +extern "C" { + pub fn AMotionEvent_getDownTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getEventTime(motion_event: *const AInputEvent) -> i64; +} +extern "C" { + pub fn AMotionEvent_getXOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYOffset(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getXPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getYPrecision(motion_event: *const AInputEvent) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPointerCount(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getPointerId(motion_event: *const AInputEvent, pointer_index: usize) + -> i32; +} +extern "C" { + pub fn AMotionEvent_getToolType(motion_event: *const AInputEvent, pointer_index: usize) -> i32; +} +extern "C" { + pub fn AMotionEvent_getRawX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getRawY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getX(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getY(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getPressure(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getSize(motion_event: *const AInputEvent, pointer_index: usize) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMajor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getToolMinor(motion_event: *const AInputEvent, pointer_index: usize) + -> f32; +} +extern "C" { + pub fn AMotionEvent_getOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistorySize(motion_event: *const AInputEvent) -> usize; +} +extern "C" { + pub fn AMotionEvent_getHistoricalEventTime( + motion_event: *const AInputEvent, + history_index: usize, + ) -> i64; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalRawY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalX( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalY( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalPressure( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalSize( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalTouchMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMajor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalToolMinor( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalOrientation( + motion_event: *const AInputEvent, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +extern "C" { + pub fn AMotionEvent_getHistoricalAxisValue( + motion_event: *const AInputEvent, + axis: i32, + pointer_index: usize, + history_index: usize, + ) -> f32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AInputQueue { + _unused: [u8; 0], +} +extern "C" { + pub fn AInputQueue_attachLooper( + queue: *mut AInputQueue, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AInputQueue_detachLooper(queue: *mut AInputQueue); +} +extern "C" { + pub fn AInputQueue_hasEvents(queue: *mut AInputQueue) -> i32; +} +extern "C" { + pub fn AInputQueue_getEvent(queue: *mut AInputQueue, outEvent: *mut *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_preDispatchEvent(queue: *mut AInputQueue, event: *mut AInputEvent) -> i32; +} +extern "C" { + pub fn AInputQueue_finishEvent( + queue: *mut AInputQueue, + event: *mut AInputEvent, + handled: ::std::os::raw::c_int, + ); +} +pub const android_LogPriority_ANDROID_LOG_UNKNOWN: android_LogPriority = 0; +pub const android_LogPriority_ANDROID_LOG_DEFAULT: android_LogPriority = 1; +pub const android_LogPriority_ANDROID_LOG_VERBOSE: android_LogPriority = 2; +pub const android_LogPriority_ANDROID_LOG_DEBUG: android_LogPriority = 3; +pub const android_LogPriority_ANDROID_LOG_INFO: android_LogPriority = 4; +pub const android_LogPriority_ANDROID_LOG_WARN: android_LogPriority = 5; +pub const android_LogPriority_ANDROID_LOG_ERROR: android_LogPriority = 6; +pub const android_LogPriority_ANDROID_LOG_FATAL: android_LogPriority = 7; +pub const android_LogPriority_ANDROID_LOG_SILENT: android_LogPriority = 8; +pub type android_LogPriority = u32; +extern "C" { + pub fn __android_log_write( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_print( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_vprint( + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ap: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_assert( + cond: *const ::std::os::raw::c_char, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ); +} +pub const log_id_LOG_ID_MIN: log_id = 0; +pub const log_id_LOG_ID_MAIN: log_id = 0; +pub const log_id_LOG_ID_RADIO: log_id = 1; +pub const log_id_LOG_ID_EVENTS: log_id = 2; +pub const log_id_LOG_ID_SYSTEM: log_id = 3; +pub const log_id_LOG_ID_CRASH: log_id = 4; +pub const log_id_LOG_ID_STATS: log_id = 5; +pub const log_id_LOG_ID_SECURITY: log_id = 6; +pub const log_id_LOG_ID_KERNEL: log_id = 7; +pub const log_id_LOG_ID_MAX: log_id = 8; +pub type log_id = u32; +pub use self::log_id as log_id_t; +extern "C" { + pub fn __android_log_buf_write( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + text: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn __android_log_buf_print( + bufID: ::std::os::raw::c_int, + prio: ::std::os::raw::c_int, + tag: *const ::std::os::raw::c_char, + fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +pub type __kernel_sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[repr(align(8))] +#[derive(Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: __kernel_sa_family_t, + pub __data: [::std::os::raw::c_char; 126usize], +} +#[test] +fn bindgen_test_layout_sockaddr_storage() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(sockaddr_storage)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sockaddr_storage)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ss_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(ss_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).__data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr_storage), + "::", + stringify!(__data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct f_owner_ex { + pub type_: ::std::os::raw::c_int, + pub pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_f_owner_ex() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(f_owner_ex)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(f_owner_ex)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(f_owner_ex), + "::", + stringify!(pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_off_t, + pub l_len: __kernel_off_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(flock)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(flock)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(flock), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct flock64 { + pub l_type: ::std::os::raw::c_short, + pub l_whence: ::std::os::raw::c_short, + pub l_start: __kernel_loff_t, + pub l_len: __kernel_loff_t, + pub l_pid: __kernel_pid_t, +} +#[test] +fn bindgen_test_layout_flock64() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(flock64)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(flock64)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_type as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_type) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_whence as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_whence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_start as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_start) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_len as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_pid as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(flock64), + "::", + stringify!(l_pid) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: __kernel_size_t, +} +#[test] +fn bindgen_test_layout_iovec() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(iovec)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(iovec)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_base as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_base) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).iov_len as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(iovec), + "::", + stringify!(iov_len) + ) + ); +} +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + _unused: [u8; 0], +} +pub const SHUT_RD: _bindgen_ty_24 = 0; +pub const SHUT_WR: _bindgen_ty_24 = 1; +pub const SHUT_RDWR: _bindgen_ty_24 = 2; +pub type _bindgen_ty_24 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[test] +fn bindgen_test_layout_sockaddr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(sockaddr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 2usize, + concat!("Alignment of ", stringify!(sockaddr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_family as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sa_data as *const _ as usize }, + 2usize, + concat!( + "Offset of field: ", + stringify!(sockaddr), + "::", + stringify!(sa_data) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_linger() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(linger)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(linger)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_onoff as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_onoff) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).l_linger as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(linger), + "::", + stringify!(l_linger) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_msghdr() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(msghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(msghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_namelen as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_namelen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iov as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iov) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_iovlen as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_iovlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_control as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_control) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_controllen as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_controllen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_flags as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(msghdr), + "::", + stringify!(msg_flags) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mmsghdr { + pub msg_hdr: msghdr, + pub msg_len: ::std::os::raw::c_uint, +} +#[test] +fn bindgen_test_layout_mmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(mmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(mmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_hdr as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_hdr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).msg_len as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(mmsghdr), + "::", + stringify!(msg_len) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_cmsghdr() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(cmsghdr)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cmsghdr)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_len as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_len) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_level as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_level) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).cmsg_type as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(cmsghdr), + "::", + stringify!(cmsg_type) + ) + ); +} +extern "C" { + pub fn __cmsg_nxthdr(__msg: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ucred { + pub pid: pid_t, + pub uid: uid_t, + pub gid: gid_t, +} +#[test] +fn bindgen_test_layout_ucred() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ucred)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ucred)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pid as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(pid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uid as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(uid) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).gid as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ucred), + "::", + stringify!(gid) + ) + ); +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept4( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *mut ::std::os::raw::c_void, + __value_length: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen( + __fd: ::std::os::raw::c_int, + __backlog: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *mut mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + __timeout: *const timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __msg: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendmmsg( + __fd: ::std::os::raw::c_int, + __msgs: *const mmsghdr, + __msg_count: ::std::os::raw::c_uint, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __msg: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __option: ::std::os::raw::c_int, + __value: *const ::std::os::raw::c_void, + __value_length: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socket( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __af: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __dst_addr: *const sockaddr, + __dst_addr_length: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __src_addr: *mut sockaddr, + __src_addr_length: *mut socklen_t, + ) -> isize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct hostent { + pub h_name: *mut ::std::os::raw::c_char, + pub h_aliases: *mut *mut ::std::os::raw::c_char, + pub h_addrtype: ::std::os::raw::c_int, + pub h_length: ::std::os::raw::c_int, + pub h_addr_list: *mut *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_hostent() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(hostent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(hostent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addrtype as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_length as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_length) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).h_addr_list as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(hostent), + "::", + stringify!(h_addr_list) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct netent { + pub n_name: *mut ::std::os::raw::c_char, + pub n_aliases: *mut *mut ::std::os::raw::c_char, + pub n_addrtype: ::std::os::raw::c_int, + pub n_net: u32, +} +#[test] +fn bindgen_test_layout_netent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(netent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(netent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_addrtype as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_addrtype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).n_net as *const _ as usize }, + 20usize, + concat!( + "Offset of field: ", + stringify!(netent), + "::", + stringify!(n_net) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct servent { + pub s_name: *mut ::std::os::raw::c_char, + pub s_aliases: *mut *mut ::std::os::raw::c_char, + pub s_port: ::std::os::raw::c_int, + pub s_proto: *mut ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_servent() { + assert_eq!( + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(servent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(servent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_port as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_port) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).s_proto as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(servent), + "::", + stringify!(s_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct protoent { + pub p_name: *mut ::std::os::raw::c_char, + pub p_aliases: *mut *mut ::std::os::raw::c_char, + pub p_proto: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_protoent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(protoent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(protoent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_aliases as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_aliases) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).p_proto as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(protoent), + "::", + stringify!(p_proto) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct addrinfo { + pub ai_flags: ::std::os::raw::c_int, + pub ai_family: ::std::os::raw::c_int, + pub ai_socktype: ::std::os::raw::c_int, + pub ai_protocol: ::std::os::raw::c_int, + pub ai_addrlen: socklen_t, + pub ai_canonname: *mut ::std::os::raw::c_char, + pub ai_addr: *mut sockaddr, + pub ai_next: *mut addrinfo, +} +#[test] +fn bindgen_test_layout_addrinfo() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(addrinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(addrinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_flags as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_family as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_family) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_socktype as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_socktype) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_protocol as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_protocol) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addrlen as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addrlen) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_canonname as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_canonname) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_addr as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_addr) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ai_next as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(addrinfo), + "::", + stringify!(ai_next) + ) + ); +} +extern "C" { + pub fn getaddrinfo( + __node: *const ::std::os::raw::c_char, + __service: *const ::std::os::raw::c_char, + __hints: *const addrinfo, + __result: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn freeaddrinfo(__ptr: *mut addrinfo); +} +extern "C" { + pub fn getnameinfo( + __sa: *const sockaddr, + __sa_length: socklen_t, + __host: *mut ::std::os::raw::c_char, + __host_length: usize, + __service: *mut ::std::os::raw::c_char, + __service_length: usize, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gai_strerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn __get_h_errno() -> *mut ::std::os::raw::c_int; +} +extern "C" { + pub fn herror(__s: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn hstrerror(__error: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn gethostbyaddr( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyaddr_r( + __addr: *const ::std::os::raw::c_void, + __length: socklen_t, + __type: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname(__name: *const ::std::os::raw::c_char) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname_r( + __name: *const ::std::os::raw::c_char, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn gethostbyname2( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + ) -> *mut hostent; +} +extern "C" { + pub fn gethostbyname2_r( + __name: *const ::std::os::raw::c_char, + __af: ::std::os::raw::c_int, + __ret: *mut hostent, + __buf: *mut ::std::os::raw::c_char, + __buf_size: usize, + __result: *mut *mut hostent, + __h_errno_ptr: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn endhostent(); +} +extern "C" { + pub fn gethostent() -> *mut hostent; +} +extern "C" { + pub fn sethostent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endnetent(); +} +extern "C" { + pub fn getnetbyaddr(__net: u32, __type: ::std::os::raw::c_int) -> *mut netent; +} +extern "C" { + pub fn getnetbyname(__name: *const ::std::os::raw::c_char) -> *mut netent; +} +extern "C" { + pub fn getnetent() -> *mut netent; +} +extern "C" { + pub fn setnetent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endprotoent(); +} +extern "C" { + pub fn getprotobyname(__name: *const ::std::os::raw::c_char) -> *mut protoent; +} +extern "C" { + pub fn getprotobynumber(__proto: ::std::os::raw::c_int) -> *mut protoent; +} +extern "C" { + pub fn getprotoent() -> *mut protoent; +} +extern "C" { + pub fn setprotoent(__stay_open: ::std::os::raw::c_int); +} +extern "C" { + pub fn endservent(); +} +extern "C" { + pub fn getservbyname( + __name: *const ::std::os::raw::c_char, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservbyport( + __port_in_network_order: ::std::os::raw::c_int, + __proto: *const ::std::os::raw::c_char, + ) -> *mut servent; +} +extern "C" { + pub fn getservent() -> *mut servent; +} +extern "C" { + pub fn setservent(__stay_open: ::std::os::raw::c_int); +} +pub type fpos_t = off_t; +pub type fpos64_t = off64_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sFILE { + _unused: [u8; 0], +} +pub type FILE = __sFILE; +extern "C" { + pub static mut stdin: *mut FILE; +} +extern "C" { + pub static mut stdout: *mut FILE; +} +extern "C" { + pub static mut stderr: *mut FILE; +} +extern "C" { + pub fn clearerr(__fp: *mut FILE); +} +extern "C" { + pub fn fclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn feof(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fflush(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgets( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fputs(__s: *const ::std::os::raw::c_char, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fread( + __buf: *mut ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __count: ::std::os::raw::c_ulong, + __fp: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn fscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fwrite( + __buf: *const ::std::os::raw::c_void, + __size: ::std::os::raw::c_ulong, + __count: ::std::os::raw::c_ulong, + __fp: *mut FILE, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn getc(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getdelim( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __delimiter: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn getline( + __line_ptr: *mut *mut ::std::os::raw::c_char, + __line_length_ptr: *mut usize, + __fp: *mut FILE, + ) -> isize; +} +extern "C" { + pub fn perror(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn printf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn puts(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn remove(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn rewind(__fp: *mut FILE); +} +extern "C" { + pub fn scanf(__fmt: *const ::std::os::raw::c_char, ...) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuf(__fp: *mut FILE, __buf: *mut ::std::os::raw::c_char); +} +extern "C" { + pub fn setvbuf( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __mode: ::std::os::raw::c_int, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ungetc(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfprintf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vprintf( + __fp: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn dprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vdprintf( + __fd: ::std::os::raw::c_int, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsprintf( + __s: *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn tmpnam(__s: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn tempnam( + __dir: *const ::std::os::raw::c_char, + __prefix: *const ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn rename( + __old_path: *const ::std::os::raw::c_char, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn renameat( + __old_dir_fd: ::std::os::raw::c_int, + __old_path: *const ::std::os::raw::c_char, + __new_dir_fd: ::std::os::raw::c_int, + __new_path: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseek( + __fp: *mut FILE, + __offset: ::std::os::raw::c_long, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftell(__fp: *mut FILE) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn fgetpos(__fp: *mut FILE, __pos: *mut fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos(__fp: *mut FILE, __pos: *const fpos_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko( + __fp: *mut FILE, + __offset: off_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello(__fp: *mut FILE) -> off_t; +} +extern "C" { + pub fn fgetpos64(__fp: *mut FILE, __pos: *mut fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fsetpos64(__fp: *mut FILE, __pos: *const fpos64_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fseeko64( + __fp: *mut FILE, + __offset: off64_t, + __whence: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ftello64(__fp: *mut FILE) -> off64_t; +} +extern "C" { + pub fn fopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn fopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn freopen64( + __path: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + __fp: *mut FILE, + ) -> *mut FILE; +} +extern "C" { + pub fn tmpfile() -> *mut FILE; +} +extern "C" { + pub fn tmpfile64() -> *mut FILE; +} +extern "C" { + pub fn snprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_ulong, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vfscanf( + __fp: *mut FILE, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vscanf( + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsnprintf( + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_ulong, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vsscanf( + __s: *const ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ctermid(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fdopen(__fd: ::std::os::raw::c_int, __mode: *const ::std::os::raw::c_char) -> *mut FILE; +} +extern "C" { + pub fn fileno(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pclose(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn popen( + __command: *const ::std::os::raw::c_char, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn flockfile(__fp: *mut FILE); +} +extern "C" { + pub fn ftrylockfile(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn funlockfile(__fp: *mut FILE); +} +extern "C" { + pub fn getc_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getchar_unlocked() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putc_unlocked(__ch: ::std::os::raw::c_int, __fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn putchar_unlocked(__ch: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fmemopen( + __buf: *mut ::std::os::raw::c_void, + __size: usize, + __mode: *const ::std::os::raw::c_char, + ) -> *mut FILE; +} +extern "C" { + pub fn open_memstream( + __ptr: *mut *mut ::std::os::raw::c_char, + __size_ptr: *mut usize, + ) -> *mut FILE; +} +extern "C" { + pub fn asprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + ... + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fgetln(__fp: *mut FILE, __length_ptr: *mut usize) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn fpurge(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setbuffer( + __fp: *mut FILE, + __buf: *mut ::std::os::raw::c_char, + __size: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn setlinebuf(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn vasprintf( + __s_ptr: *mut *mut ::std::os::raw::c_char, + __fmt: *const ::std::os::raw::c_char, + __args: *mut __va_list_tag, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearerr_unlocked(__fp: *mut FILE); +} +extern "C" { + pub fn feof_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ferror_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn fileno_unlocked(__fp: *mut FILE) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn malloc(__byte_count: ::std::os::raw::c_ulong) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn calloc( + __item_count: ::std::os::raw::c_ulong, + __item_size: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn realloc( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: ::std::os::raw::c_ulong, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn reallocarray( + __ptr: *mut ::std::os::raw::c_void, + __item_count: usize, + __item_size: usize, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn free(__ptr: *mut ::std::os::raw::c_void); +} +extern "C" { + pub fn memalign(__alignment: usize, __byte_count: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn malloc_usable_size(__ptr: *const ::std::os::raw::c_void) -> usize; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct mallinfo { + pub arena: usize, + pub ordblks: usize, + pub smblks: usize, + pub hblks: usize, + pub hblkhd: usize, + pub usmblks: usize, + pub fsmblks: usize, + pub uordblks: usize, + pub fordblks: usize, + pub keepcost: usize, +} +#[test] +fn bindgen_test_layout_mallinfo() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(mallinfo)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(mallinfo)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).arena as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(arena) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).ordblks as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(ordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).smblks as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(smblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblks as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).hblkhd as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(hblkhd) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).usmblks as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(usmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fsmblks as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fsmblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).uordblks as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(uordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fordblks as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(fordblks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).keepcost as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(mallinfo), + "::", + stringify!(keepcost) + ) + ); +} +extern "C" { + pub fn mallinfo() -> mallinfo; +} +extern "C" { + pub fn malloc_info( + __must_be_zero: ::std::os::raw::c_int, + __fp: *mut FILE, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mallopt( + __option: ::std::os::raw::c_int, + __value: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut __malloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __realloc_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +extern "C" { + pub static mut __free_hook: ::std::option::Option< + unsafe extern "C" fn( + __ptr: *mut ::std::os::raw::c_void, + __caller: *const ::std::os::raw::c_void, + ), + >; +} +extern "C" { + pub static mut __memalign_hook: ::std::option::Option< + unsafe extern "C" fn( + __alignment: usize, + __byte_count: usize, + __caller: *const ::std::os::raw::c_void, + ) -> *mut ::std::os::raw::c_void, + >; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_t { + _unused: [u8; 0], +} +pub type locale_t = *mut __locale_t; +extern "C" { + pub fn abort(); +} +extern "C" { + pub fn exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn _Exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn atexit(__fn: ::std::option::Option) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn at_quick_exit( + __fn: ::std::option::Option, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn quick_exit(__status: ::std::os::raw::c_int); +} +extern "C" { + pub fn getenv(__name: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn putenv(__assignment: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setenv( + __name: *const ::std::os::raw::c_char, + __value: *const ::std::os::raw::c_char, + __overwrite: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unsetenv(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clearenv() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkdtemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mktemp(__template: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn mkostemp64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemp( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps64( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkostemps( + __template: *mut ::std::os::raw::c_char, + __suffix_length: ::std::os::raw::c_int, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp64(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemp(__template: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps64( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mkstemps( + __template: *mut ::std::os::raw::c_char, + __flags: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtol( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn strtoll( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoul( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn strtoull( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn posix_memalign( + __memptr: *mut *mut ::std::os::raw::c_void, + __alignment: usize, + __size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn aligned_alloc(__alignment: usize, __size: usize) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn strtod( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f64; +} +extern "C" { + pub fn strtold( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> u128; +} +extern "C" { + pub fn strtoul_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulong; +} +extern "C" { + pub fn atoi(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn atol(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn atoll(__s: *const ::std::os::raw::c_char) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn realpath( + __path: *const ::std::os::raw::c_char, + __resolved: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn system(__command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bsearch( + __key: *const ::std::os::raw::c_void, + __base: *const ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ) -> *mut ::std::os::raw::c_void; +} +extern "C" { + pub fn qsort( + __base: *mut ::std::os::raw::c_void, + __nmemb: usize, + __size: usize, + __comparator: ::std::option::Option< + unsafe extern "C" fn( + __lhs: *const ::std::os::raw::c_void, + __rhs: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, + >, + ); +} +extern "C" { + pub fn arc4random() -> u32; +} +extern "C" { + pub fn arc4random_uniform(__upper_bound: u32) -> u32; +} +extern "C" { + pub fn arc4random_buf(__buf: *mut ::std::os::raw::c_void, __n: usize); +} +extern "C" { + pub fn rand_r(__seed_ptr: *mut ::std::os::raw::c_uint) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn drand48() -> f64; +} +extern "C" { + pub fn erand48(__xsubi: *mut ::std::os::raw::c_ushort) -> f64; +} +extern "C" { + pub fn jrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lcong48(__param: *mut ::std::os::raw::c_ushort); +} +extern "C" { + pub fn lrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn mrand48() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn nrand48(__xsubi: *mut ::std::os::raw::c_ushort) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn seed48(__seed16v: *mut ::std::os::raw::c_ushort) -> *mut ::std::os::raw::c_ushort; +} +extern "C" { + pub fn srand48(__seed: ::std::os::raw::c_long); +} +extern "C" { + pub fn initstate( + __seed: ::std::os::raw::c_uint, + __state: *mut ::std::os::raw::c_char, + __n: usize, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn setstate(__state: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn getpt() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn posix_openpt(__flags: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ptsname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ptsname_r( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn unlockpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsubopt( + __option: *mut *mut ::std::os::raw::c_char, + __tokens: *const *mut ::std::os::raw::c_char, + __value_ptr: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct div_t { + pub quot: ::std::os::raw::c_int, + pub rem: ::std::os::raw::c_int, +} +#[test] +fn bindgen_test_layout_div_t() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(div_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(div_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(div_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn div(__numerator: ::std::os::raw::c_int, __denominator: ::std::os::raw::c_int) -> div_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ldiv_t { + pub quot: ::std::os::raw::c_long, + pub rem: ::std::os::raw::c_long, +} +#[test] +fn bindgen_test_layout_ldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn ldiv( + __numerator: ::std::os::raw::c_long, + __denominator: ::std::os::raw::c_long, + ) -> ldiv_t; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct lldiv_t { + pub quot: ::std::os::raw::c_longlong, + pub rem: ::std::os::raw::c_longlong, +} +#[test] +fn bindgen_test_layout_lldiv_t() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(lldiv_t)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lldiv_t)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).quot as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(quot) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).rem as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lldiv_t), + "::", + stringify!(rem) + ) + ); +} +extern "C" { + pub fn lldiv( + __numerator: ::std::os::raw::c_longlong, + __denominator: ::std::os::raw::c_longlong, + ) -> lldiv_t; +} +extern "C" { + pub fn getloadavg(__averages: *mut f64, __n: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getprogname() -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn setprogname(__name: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn mblen(__s: *const ::std::os::raw::c_char, __n: usize) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn mbstowcs(__dst: *mut wchar_t, __src: *const ::std::os::raw::c_char, __n: usize) + -> usize; +} +extern "C" { + pub fn mbtowc( + __wc_ptr: *mut wchar_t, + __s: *const ::std::os::raw::c_char, + __n: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wctomb(__dst: *mut ::std::os::raw::c_char, __wc: wchar_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wcstombs(__dst: *mut ::std::os::raw::c_char, __src: *const wchar_t, __n: usize) + -> usize; +} +extern "C" { + pub fn __ctype_get_mb_cur_max() -> usize; +} +extern "C" { + pub fn abs(__x: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn labs(__x: ::std::os::raw::c_long) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llabs(__x: ::std::os::raw::c_longlong) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtof( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + ) -> f32; +} +extern "C" { + pub fn atof(__s: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn rand() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn srand(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn random() -> ::std::os::raw::c_long; +} +extern "C" { + pub fn srandom(__seed: ::std::os::raw::c_uint); +} +extern "C" { + pub fn grantpt(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn strtoll_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn strtoull_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __base: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_ulonglong; +} +extern "C" { + pub fn strtold_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> u128; +} +extern "C" { + pub fn strtod_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f64; +} +extern "C" { + pub fn strtof_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + __l: locale_t, + ) -> f32; +} +extern "C" { + pub fn strtol_l( + __s: *const ::std::os::raw::c_char, + __end_ptr: *mut *mut ::std::os::raw::c_char, + arg1: ::std::os::raw::c_int, + __l: locale_t, + ) -> ::std::os::raw::c_long; +} +pub type net_handle_t = u64; +extern "C" { + pub fn android_setsocknetwork( + network: net_handle_t, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_setprocnetwork(network: net_handle_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_getaddrinfofornetwork( + network: net_handle_t, + node: *const ::std::os::raw::c_char, + service: *const ::std::os::raw::c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo, + ) -> ::std::os::raw::c_int; +} +pub const ResNsendFlags_ANDROID_RESOLV_NO_RETRY: ResNsendFlags = 1; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_STORE: ResNsendFlags = 2; +pub const ResNsendFlags_ANDROID_RESOLV_NO_CACHE_LOOKUP: ResNsendFlags = 4; +pub type ResNsendFlags = u32; +extern "C" { + pub fn android_res_nquery( + network: net_handle_t, + dname: *const ::std::os::raw::c_char, + ns_class: ::std::os::raw::c_int, + ns_type: ::std::os::raw::c_int, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nsend( + network: net_handle_t, + msg: *const u8, + msglen: usize, + flags: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_nresult( + fd: ::std::os::raw::c_int, + rcode: *mut ::std::os::raw::c_int, + answer: *mut u8, + anslen: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_res_cancel(nsend_fd: ::std::os::raw::c_int); +} +pub const OperandCode_ANEURALNETWORKS_FLOAT32: OperandCode = 0; +pub const OperandCode_ANEURALNETWORKS_INT32: OperandCode = 1; +pub const OperandCode_ANEURALNETWORKS_UINT32: OperandCode = 2; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT32: OperandCode = 3; +pub const OperandCode_ANEURALNETWORKS_TENSOR_INT32: OperandCode = 4; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_ASYMM: OperandCode = 5; +pub const OperandCode_ANEURALNETWORKS_BOOL: OperandCode = 6; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_SYMM: OperandCode = 7; +pub const OperandCode_ANEURALNETWORKS_TENSOR_FLOAT16: OperandCode = 8; +pub const OperandCode_ANEURALNETWORKS_TENSOR_BOOL8: OperandCode = 9; +pub const OperandCode_ANEURALNETWORKS_FLOAT16: OperandCode = 10; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL: OperandCode = 11; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT16_ASYMM: OperandCode = 12; +pub const OperandCode_ANEURALNETWORKS_TENSOR_QUANT8_SYMM: OperandCode = 13; +pub type OperandCode = u32; +pub const OperationCode_ANEURALNETWORKS_ADD: OperationCode = 0; +pub const OperationCode_ANEURALNETWORKS_AVERAGE_POOL_2D: OperationCode = 1; +pub const OperationCode_ANEURALNETWORKS_CONCATENATION: OperationCode = 2; +pub const OperationCode_ANEURALNETWORKS_CONV_2D: OperationCode = 3; +pub const OperationCode_ANEURALNETWORKS_DEPTHWISE_CONV_2D: OperationCode = 4; +pub const OperationCode_ANEURALNETWORKS_DEPTH_TO_SPACE: OperationCode = 5; +pub const OperationCode_ANEURALNETWORKS_DEQUANTIZE: OperationCode = 6; +pub const OperationCode_ANEURALNETWORKS_EMBEDDING_LOOKUP: OperationCode = 7; +pub const OperationCode_ANEURALNETWORKS_FLOOR: OperationCode = 8; +pub const OperationCode_ANEURALNETWORKS_FULLY_CONNECTED: OperationCode = 9; +pub const OperationCode_ANEURALNETWORKS_HASHTABLE_LOOKUP: OperationCode = 10; +pub const OperationCode_ANEURALNETWORKS_L2_NORMALIZATION: OperationCode = 11; +pub const OperationCode_ANEURALNETWORKS_L2_POOL_2D: OperationCode = 12; +pub const OperationCode_ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION: OperationCode = 13; +pub const OperationCode_ANEURALNETWORKS_LOGISTIC: OperationCode = 14; +pub const OperationCode_ANEURALNETWORKS_LSH_PROJECTION: OperationCode = 15; +pub const OperationCode_ANEURALNETWORKS_LSTM: OperationCode = 16; +pub const OperationCode_ANEURALNETWORKS_MAX_POOL_2D: OperationCode = 17; +pub const OperationCode_ANEURALNETWORKS_MUL: OperationCode = 18; +pub const OperationCode_ANEURALNETWORKS_RELU: OperationCode = 19; +pub const OperationCode_ANEURALNETWORKS_RELU1: OperationCode = 20; +pub const OperationCode_ANEURALNETWORKS_RELU6: OperationCode = 21; +pub const OperationCode_ANEURALNETWORKS_RESHAPE: OperationCode = 22; +pub const OperationCode_ANEURALNETWORKS_RESIZE_BILINEAR: OperationCode = 23; +pub const OperationCode_ANEURALNETWORKS_RNN: OperationCode = 24; +pub const OperationCode_ANEURALNETWORKS_SOFTMAX: OperationCode = 25; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_DEPTH: OperationCode = 26; +pub const OperationCode_ANEURALNETWORKS_SVDF: OperationCode = 27; +pub const OperationCode_ANEURALNETWORKS_TANH: OperationCode = 28; +pub const OperationCode_ANEURALNETWORKS_BATCH_TO_SPACE_ND: OperationCode = 29; +pub const OperationCode_ANEURALNETWORKS_DIV: OperationCode = 30; +pub const OperationCode_ANEURALNETWORKS_MEAN: OperationCode = 31; +pub const OperationCode_ANEURALNETWORKS_PAD: OperationCode = 32; +pub const OperationCode_ANEURALNETWORKS_SPACE_TO_BATCH_ND: OperationCode = 33; +pub const OperationCode_ANEURALNETWORKS_SQUEEZE: OperationCode = 34; +pub const OperationCode_ANEURALNETWORKS_STRIDED_SLICE: OperationCode = 35; +pub const OperationCode_ANEURALNETWORKS_SUB: OperationCode = 36; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE: OperationCode = 37; +pub const OperationCode_ANEURALNETWORKS_ABS: OperationCode = 38; +pub const OperationCode_ANEURALNETWORKS_ARGMAX: OperationCode = 39; +pub const OperationCode_ANEURALNETWORKS_ARGMIN: OperationCode = 40; +pub const OperationCode_ANEURALNETWORKS_AXIS_ALIGNED_BBOX_TRANSFORM: OperationCode = 41; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 42; +pub const OperationCode_ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 43; +pub const OperationCode_ANEURALNETWORKS_BOX_WITH_NMS_LIMIT: OperationCode = 44; +pub const OperationCode_ANEURALNETWORKS_CAST: OperationCode = 45; +pub const OperationCode_ANEURALNETWORKS_CHANNEL_SHUFFLE: OperationCode = 46; +pub const OperationCode_ANEURALNETWORKS_DETECTION_POSTPROCESSING: OperationCode = 47; +pub const OperationCode_ANEURALNETWORKS_EQUAL: OperationCode = 48; +pub const OperationCode_ANEURALNETWORKS_EXP: OperationCode = 49; +pub const OperationCode_ANEURALNETWORKS_EXPAND_DIMS: OperationCode = 50; +pub const OperationCode_ANEURALNETWORKS_GATHER: OperationCode = 51; +pub const OperationCode_ANEURALNETWORKS_GENERATE_PROPOSALS: OperationCode = 52; +pub const OperationCode_ANEURALNETWORKS_GREATER: OperationCode = 53; +pub const OperationCode_ANEURALNETWORKS_GREATER_EQUAL: OperationCode = 54; +pub const OperationCode_ANEURALNETWORKS_GROUPED_CONV_2D: OperationCode = 55; +pub const OperationCode_ANEURALNETWORKS_HEATMAP_MAX_KEYPOINT: OperationCode = 56; +pub const OperationCode_ANEURALNETWORKS_INSTANCE_NORMALIZATION: OperationCode = 57; +pub const OperationCode_ANEURALNETWORKS_LESS: OperationCode = 58; +pub const OperationCode_ANEURALNETWORKS_LESS_EQUAL: OperationCode = 59; +pub const OperationCode_ANEURALNETWORKS_LOG: OperationCode = 60; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_AND: OperationCode = 61; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_NOT: OperationCode = 62; +pub const OperationCode_ANEURALNETWORKS_LOGICAL_OR: OperationCode = 63; +pub const OperationCode_ANEURALNETWORKS_LOG_SOFTMAX: OperationCode = 64; +pub const OperationCode_ANEURALNETWORKS_MAXIMUM: OperationCode = 65; +pub const OperationCode_ANEURALNETWORKS_MINIMUM: OperationCode = 66; +pub const OperationCode_ANEURALNETWORKS_NEG: OperationCode = 67; +pub const OperationCode_ANEURALNETWORKS_NOT_EQUAL: OperationCode = 68; +pub const OperationCode_ANEURALNETWORKS_PAD_V2: OperationCode = 69; +pub const OperationCode_ANEURALNETWORKS_POW: OperationCode = 70; +pub const OperationCode_ANEURALNETWORKS_PRELU: OperationCode = 71; +pub const OperationCode_ANEURALNETWORKS_QUANTIZE: OperationCode = 72; +pub const OperationCode_ANEURALNETWORKS_QUANTIZED_16BIT_LSTM: OperationCode = 73; +pub const OperationCode_ANEURALNETWORKS_RANDOM_MULTINOMIAL: OperationCode = 74; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ALL: OperationCode = 75; +pub const OperationCode_ANEURALNETWORKS_REDUCE_ANY: OperationCode = 76; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MAX: OperationCode = 77; +pub const OperationCode_ANEURALNETWORKS_REDUCE_MIN: OperationCode = 78; +pub const OperationCode_ANEURALNETWORKS_REDUCE_PROD: OperationCode = 79; +pub const OperationCode_ANEURALNETWORKS_REDUCE_SUM: OperationCode = 80; +pub const OperationCode_ANEURALNETWORKS_ROI_ALIGN: OperationCode = 81; +pub const OperationCode_ANEURALNETWORKS_ROI_POOLING: OperationCode = 82; +pub const OperationCode_ANEURALNETWORKS_RSQRT: OperationCode = 83; +pub const OperationCode_ANEURALNETWORKS_SELECT: OperationCode = 84; +pub const OperationCode_ANEURALNETWORKS_SIN: OperationCode = 85; +pub const OperationCode_ANEURALNETWORKS_SLICE: OperationCode = 86; +pub const OperationCode_ANEURALNETWORKS_SPLIT: OperationCode = 87; +pub const OperationCode_ANEURALNETWORKS_SQRT: OperationCode = 88; +pub const OperationCode_ANEURALNETWORKS_TILE: OperationCode = 89; +pub const OperationCode_ANEURALNETWORKS_TOPK_V2: OperationCode = 90; +pub const OperationCode_ANEURALNETWORKS_TRANSPOSE_CONV_2D: OperationCode = 91; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM: OperationCode = 92; +pub const OperationCode_ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_RNN: OperationCode = 93; +pub const OperationCode_ANEURALNETWORKS_RESIZE_NEAREST_NEIGHBOR: OperationCode = 94; +pub type OperationCode = u32; +pub const FuseCode_ANEURALNETWORKS_FUSED_NONE: FuseCode = 0; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU: FuseCode = 1; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU1: FuseCode = 2; +pub const FuseCode_ANEURALNETWORKS_FUSED_RELU6: FuseCode = 3; +pub type FuseCode = u32; +pub const PaddingCode_ANEURALNETWORKS_PADDING_SAME: PaddingCode = 1; +pub const PaddingCode_ANEURALNETWORKS_PADDING_VALID: PaddingCode = 2; +pub type PaddingCode = u32; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_LOW_POWER: PreferenceCode = 0; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER: PreferenceCode = 1; +pub const PreferenceCode_ANEURALNETWORKS_PREFER_SUSTAINED_SPEED: PreferenceCode = 2; +pub type PreferenceCode = u32; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_UNKNOWN: DeviceTypeCode = 0; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_OTHER: DeviceTypeCode = 1; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_CPU: DeviceTypeCode = 2; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_GPU: DeviceTypeCode = 3; +pub const DeviceTypeCode_ANEURALNETWORKS_DEVICE_ACCELERATOR: DeviceTypeCode = 4; +pub type DeviceTypeCode = u32; +pub const ResultCode_ANEURALNETWORKS_NO_ERROR: ResultCode = 0; +pub const ResultCode_ANEURALNETWORKS_OUT_OF_MEMORY: ResultCode = 1; +pub const ResultCode_ANEURALNETWORKS_INCOMPLETE: ResultCode = 2; +pub const ResultCode_ANEURALNETWORKS_UNEXPECTED_NULL: ResultCode = 3; +pub const ResultCode_ANEURALNETWORKS_BAD_DATA: ResultCode = 4; +pub const ResultCode_ANEURALNETWORKS_OP_FAILED: ResultCode = 5; +pub const ResultCode_ANEURALNETWORKS_BAD_STATE: ResultCode = 6; +pub const ResultCode_ANEURALNETWORKS_UNMAPPABLE: ResultCode = 7; +pub const ResultCode_ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE: ResultCode = 8; +pub const ResultCode_ANEURALNETWORKS_UNAVAILABLE_DEVICE: ResultCode = 9; +pub type ResultCode = u32; +pub const ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES: _bindgen_ty_25 = 128; +pub type _bindgen_ty_25 = u32; +pub const ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN: _bindgen_ty_26 = 32; +pub type _bindgen_ty_26 = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksMemory { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksModel { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksCompilation { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksExecution { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksSymmPerChannelQuantParams { + pub channelDim: u32, + pub scaleCount: u32, + pub scales: *const f32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksSymmPerChannelQuantParams() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).channelDim + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(channelDim) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scaleCount + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scaleCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scales as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksSymmPerChannelQuantParams), + "::", + stringify!(scales) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksBurst { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksOperandType { + pub type_: i32, + pub dimensionCount: u32, + pub dimensions: *const u32, + pub scale: f32, + pub zeroPoint: i32, +} +#[test] +fn bindgen_test_layout_ANeuralNetworksOperandType() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANeuralNetworksOperandType)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).type_ as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensionCount as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensionCount) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dimensions as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(dimensions) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).scale as *const _ as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(scale) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).zeroPoint as *const _ as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(ANeuralNetworksOperandType), + "::", + stringify!(zeroPoint) + ) + ); +} +pub type ANeuralNetworksOperationType = i32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksEvent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANeuralNetworksDevice { + _unused: [u8; 0], +} +extern "C" { + pub fn ANeuralNetworks_getDeviceCount(numDevices: *mut u32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworks_getDevice( + devIndex: u32, + device: *mut *mut ANeuralNetworksDevice, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getName( + device: *const ANeuralNetworksDevice, + name: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getType( + device: *const ANeuralNetworksDevice, + type_: *mut i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getVersion( + device: *const ANeuralNetworksDevice, + version: *mut *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksDevice_getFeatureLevel( + device: *const ANeuralNetworksDevice, + featureLevel: *mut i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_getSupportedOperationsForDevices( + model: *const ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + supportedOps: *mut bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_createForDevices( + model: *mut ANeuralNetworksModel, + devices: *const *const ANeuralNetworksDevice, + numDevices: u32, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_setCaching( + compilation: *mut ANeuralNetworksCompilation, + cacheDir: *const ::std::os::raw::c_char, + token: *const u8, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_compute( + execution: *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandRank( + execution: *mut ANeuralNetworksExecution, + index: i32, + rank: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_getOutputOperandDimensions( + execution: *mut ANeuralNetworksExecution, + index: i32, + dimensions: *mut u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_create( + compilation: *mut ANeuralNetworksCompilation, + burst: *mut *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksBurst_free(burst: *mut ANeuralNetworksBurst); +} +extern "C" { + pub fn ANeuralNetworksExecution_burstCompute( + execution: *mut ANeuralNetworksExecution, + burst: *mut ANeuralNetworksBurst, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromAHardwareBuffer( + ahwb: *const AHardwareBuffer, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setMeasureTiming( + execution: *mut ANeuralNetworksExecution, + measure: bool, + ) -> ::std::os::raw::c_int; +} +pub const DurationCode_ANEURALNETWORKS_DURATION_ON_HARDWARE: DurationCode = 0; +pub const DurationCode_ANEURALNETWORKS_DURATION_IN_DRIVER: DurationCode = 1; +pub type DurationCode = u32; +extern "C" { + pub fn ANeuralNetworksExecution_getDuration( + execution: *const ANeuralNetworksExecution, + durationCode: i32, + duration: *mut u64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_createFromFd( + size: usize, + protect: ::std::os::raw::c_int, + fd: ::std::os::raw::c_int, + offset: usize, + memory: *mut *mut ANeuralNetworksMemory, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksMemory_free(memory: *mut ANeuralNetworksMemory); +} +extern "C" { + pub fn ANeuralNetworksModel_create( + model: *mut *mut ANeuralNetworksModel, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_free(model: *mut ANeuralNetworksModel); +} +extern "C" { + pub fn ANeuralNetworksModel_finish(model: *mut ANeuralNetworksModel) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperand( + model: *mut ANeuralNetworksModel, + type_: *const ANeuralNetworksOperandType, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValue( + model: *mut ANeuralNetworksModel, + index: i32, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandSymmPerChannelQuantParams( + model: *mut ANeuralNetworksModel, + index: i32, + channelQuant: *const ANeuralNetworksSymmPerChannelQuantParams, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_setOperandValueFromMemory( + model: *mut ANeuralNetworksModel, + index: i32, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_addOperation( + model: *mut ANeuralNetworksModel, + type_: ANeuralNetworksOperationType, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_identifyInputsAndOutputs( + model: *mut ANeuralNetworksModel, + inputCount: u32, + inputs: *const u32, + outputCount: u32, + outputs: *const u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksModel_relaxComputationFloat32toFloat16( + model: *mut ANeuralNetworksModel, + allow: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_create( + model: *mut ANeuralNetworksModel, + compilation: *mut *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_free(compilation: *mut ANeuralNetworksCompilation); +} +extern "C" { + pub fn ANeuralNetworksCompilation_setPreference( + compilation: *mut ANeuralNetworksCompilation, + preference: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksCompilation_finish( + compilation: *mut ANeuralNetworksCompilation, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_create( + compilation: *mut ANeuralNetworksCompilation, + execution: *mut *mut ANeuralNetworksExecution, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_free(execution: *mut ANeuralNetworksExecution); +} +extern "C" { + pub fn ANeuralNetworksExecution_setInput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *const ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setInputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutput( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + buffer: *mut ::std::os::raw::c_void, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_setOutputFromMemory( + execution: *mut ANeuralNetworksExecution, + index: i32, + type_: *const ANeuralNetworksOperandType, + memory: *const ANeuralNetworksMemory, + offset: usize, + length: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksExecution_startCompute( + execution: *mut ANeuralNetworksExecution, + event: *mut *mut ANeuralNetworksEvent, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_wait(event: *mut ANeuralNetworksEvent) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ANeuralNetworksEvent_free(event: *mut ANeuralNetworksEvent); +} +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBA_8888: ANativeWindow_LegacyFormat = 1; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGBX_8888: ANativeWindow_LegacyFormat = 2; +pub const ANativeWindow_LegacyFormat_WINDOW_FORMAT_RGB_565: ANativeWindow_LegacyFormat = 4; +pub type ANativeWindow_LegacyFormat = u32; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_IDENTITY: ANativeWindowTransform = 0; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_HORIZONTAL: ANativeWindowTransform = + 1; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_MIRROR_VERTICAL: ANativeWindowTransform = + 2; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_90: ANativeWindowTransform = 4; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_180: ANativeWindowTransform = 3; +pub const ANativeWindowTransform_ANATIVEWINDOW_TRANSFORM_ROTATE_270: ANativeWindowTransform = 7; +pub type ANativeWindowTransform = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeWindow_Buffer { + pub width: i32, + pub height: i32, + pub stride: i32, + pub format: i32, + pub bits: *mut ::std::os::raw::c_void, + pub reserved: [u32; 6usize], +} +#[test] +fn bindgen_test_layout_ANativeWindow_Buffer() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANativeWindow_Buffer)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(width) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).height as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(height) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).stride as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(stride) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).format as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(format) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bits as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(bits) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeWindow_Buffer), + "::", + stringify!(reserved) + ) + ); +} +extern "C" { + pub fn ANativeWindow_acquire(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_release(window: *mut ANativeWindow); +} +extern "C" { + pub fn ANativeWindow_getWidth(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getHeight(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_getFormat(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersGeometry( + window: *mut ANativeWindow, + width: i32, + height: i32, + format: i32, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_lock( + window: *mut ANativeWindow, + outBuffer: *mut ANativeWindow_Buffer, + inOutDirtyBounds: *mut ARect, + ) -> i32; +} +extern "C" { + pub fn ANativeWindow_unlockAndPost(window: *mut ANativeWindow) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersTransform(window: *mut ANativeWindow, transform: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_setBuffersDataSpace(window: *mut ANativeWindow, dataSpace: i32) -> i32; +} +extern "C" { + pub fn ANativeWindow_getBuffersDataSpace(window: *mut ANativeWindow) -> i32; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivity { + pub callbacks: *mut ANativeActivityCallbacks, + pub vm: *mut JavaVM, + pub env: *mut JNIEnv, + pub clazz: jobject, + pub internalDataPath: *const ::std::os::raw::c_char, + pub externalDataPath: *const ::std::os::raw::c_char, + pub sdkVersion: i32, + pub instance: *mut ::std::os::raw::c_void, + pub assetManager: *mut AAssetManager, + pub obbPath: *const ::std::os::raw::c_char, +} +#[test] +fn bindgen_test_layout_ANativeActivity() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(ANativeActivity)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANativeActivity)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).callbacks as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(callbacks) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vm as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(vm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).env as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(env) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).clazz as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(clazz) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).internalDataPath as *const _ as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(internalDataPath) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).externalDataPath as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(externalDataPath) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sdkVersion as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(sdkVersion) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).instance as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(instance) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).assetManager as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(assetManager) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obbPath as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivity), + "::", + stringify!(obbPath) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ANativeActivityCallbacks { + pub onStart: ::std::option::Option, + pub onResume: ::std::option::Option, + pub onSaveInstanceState: ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + outSize: *mut usize, + ) -> *mut ::std::os::raw::c_void, + >, + pub onPause: ::std::option::Option, + pub onStop: ::std::option::Option, + pub onDestroy: ::std::option::Option, + pub onWindowFocusChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, hasFocus: ::std::os::raw::c_int), + >, + pub onNativeWindowCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowResized: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowRedrawNeeded: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onNativeWindowDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, window: *mut ANativeWindow), + >, + pub onInputQueueCreated: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onInputQueueDestroyed: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, queue: *mut AInputQueue), + >, + pub onContentRectChanged: ::std::option::Option< + unsafe extern "C" fn(activity: *mut ANativeActivity, rect: *const ARect), + >, + pub onConfigurationChanged: + ::std::option::Option, + pub onLowMemory: ::std::option::Option, +} +#[test] +fn bindgen_test_layout_ANativeActivityCallbacks() { + assert_eq!( + ::std::mem::size_of::(), + 128usize, + concat!("Size of: ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ANativeActivityCallbacks)) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onStart as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStart) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onResume as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onResume) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onSaveInstanceState as *const _ + as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onSaveInstanceState) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onPause as *const _ as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onPause) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).onStop as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onStop) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onDestroy as *const _ as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onDestroy) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onWindowFocusChanged as *const _ + as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onWindowFocusChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowCreated as *const _ + as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowResized as *const _ + as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowResized) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowRedrawNeeded + as *const _ as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowRedrawNeeded) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onNativeWindowDestroyed as *const _ + as usize + }, + 80usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onNativeWindowDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueCreated as *const _ + as usize + }, + 88usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueCreated) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onInputQueueDestroyed as *const _ + as usize + }, + 96usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onInputQueueDestroyed) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onContentRectChanged as *const _ + as usize + }, + 104usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onContentRectChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onConfigurationChanged as *const _ + as usize + }, + 112usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onConfigurationChanged) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).onLowMemory as *const _ as usize + }, + 120usize, + concat!( + "Offset of field: ", + stringify!(ANativeActivityCallbacks), + "::", + stringify!(onLowMemory) + ) + ); +} +pub type ANativeActivity_createFunc = ::std::option::Option< + unsafe extern "C" fn( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ), +>; +extern "C" { + pub fn ANativeActivity_onCreate( + activity: *mut ANativeActivity, + savedState: *mut ::std::os::raw::c_void, + savedStateSize: usize, + ); +} +extern "C" { + pub fn ANativeActivity_finish(activity: *mut ANativeActivity); +} +extern "C" { + pub fn ANativeActivity_setWindowFormat(activity: *mut ANativeActivity, format: i32); +} +extern "C" { + pub fn ANativeActivity_setWindowFlags( + activity: *mut ANativeActivity, + addFlags: u32, + removeFlags: u32, + ); +} +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT: _bindgen_ty_27 = 1; +pub const ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED: _bindgen_ty_27 = 2; +pub type _bindgen_ty_27 = u32; +extern "C" { + pub fn ANativeActivity_showSoftInput(activity: *mut ANativeActivity, flags: u32); +} +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY: _bindgen_ty_28 = 1; +pub const ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS: _bindgen_ty_28 = 2; +pub type _bindgen_ty_28 = u32; +extern "C" { + pub fn ANativeActivity_hideSoftInput(activity: *mut ANativeActivity, flags: u32); +} +extern "C" { + pub fn ANativeWindow_fromSurface(env: *mut JNIEnv, surface: jobject) -> *mut ANativeWindow; +} +extern "C" { + pub fn ANativeWindow_toSurface(env: *mut JNIEnv, window: *mut ANativeWindow) -> jobject; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AObbInfo { + _unused: [u8; 0], +} +pub const AOBBINFO_OVERLAY: _bindgen_ty_29 = 1; +pub type _bindgen_ty_29 = u32; +extern "C" { + pub fn AObbScanner_getObbInfo(filename: *const ::std::os::raw::c_char) -> *mut AObbInfo; +} +extern "C" { + pub fn AObbInfo_delete(obbInfo: *mut AObbInfo); +} +extern "C" { + pub fn AObbInfo_getPackageName(obbInfo: *mut AObbInfo) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn AObbInfo_getVersion(obbInfo: *mut AObbInfo) -> i32; +} +extern "C" { + pub fn AObbInfo_getFlags(obbInfo: *mut AObbInfo) -> i32; +} +pub type __double_t = f64; +pub type double_t = __double_t; +pub type __float_t = f32; +pub type float_t = __float_t; +extern "C" { + pub fn acos(__x: f64) -> f64; +} +extern "C" { + pub fn acosf(__x: f32) -> f32; +} +extern "C" { + pub fn acosl(__x: u128) -> u128; +} +extern "C" { + pub fn asin(__x: f64) -> f64; +} +extern "C" { + pub fn asinf(__x: f32) -> f32; +} +extern "C" { + pub fn asinl(__x: u128) -> u128; +} +extern "C" { + pub fn atan(__x: f64) -> f64; +} +extern "C" { + pub fn atanf(__x: f32) -> f32; +} +extern "C" { + pub fn atanl(__x: u128) -> u128; +} +extern "C" { + pub fn atan2(__y: f64, __x: f64) -> f64; +} +extern "C" { + pub fn atan2f(__y: f32, __x: f32) -> f32; +} +extern "C" { + pub fn atan2l(__y: u128, __x: u128) -> u128; +} +extern "C" { + pub fn cos(__x: f64) -> f64; +} +extern "C" { + pub fn cosf(__x: f32) -> f32; +} +extern "C" { + pub fn cosl(__x: u128) -> u128; +} +extern "C" { + pub fn sin(__x: f64) -> f64; +} +extern "C" { + pub fn sinf(__x: f32) -> f32; +} +extern "C" { + pub fn sinl(__x: u128) -> u128; +} +extern "C" { + pub fn tan(__x: f64) -> f64; +} +extern "C" { + pub fn tanf(__x: f32) -> f32; +} +extern "C" { + pub fn tanl(__x: u128) -> u128; +} +extern "C" { + pub fn acosh(__x: f64) -> f64; +} +extern "C" { + pub fn acoshf(__x: f32) -> f32; +} +extern "C" { + pub fn acoshl(__x: u128) -> u128; +} +extern "C" { + pub fn asinh(__x: f64) -> f64; +} +extern "C" { + pub fn asinhf(__x: f32) -> f32; +} +extern "C" { + pub fn asinhl(__x: u128) -> u128; +} +extern "C" { + pub fn atanh(__x: f64) -> f64; +} +extern "C" { + pub fn atanhf(__x: f32) -> f32; +} +extern "C" { + pub fn atanhl(__x: u128) -> u128; +} +extern "C" { + pub fn cosh(__x: f64) -> f64; +} +extern "C" { + pub fn coshf(__x: f32) -> f32; +} +extern "C" { + pub fn coshl(__x: u128) -> u128; +} +extern "C" { + pub fn sinh(__x: f64) -> f64; +} +extern "C" { + pub fn sinhf(__x: f32) -> f32; +} +extern "C" { + pub fn sinhl(__x: u128) -> u128; +} +extern "C" { + pub fn tanh(__x: f64) -> f64; +} +extern "C" { + pub fn tanhf(__x: f32) -> f32; +} +extern "C" { + pub fn tanhl(__x: u128) -> u128; +} +extern "C" { + pub fn exp(__x: f64) -> f64; +} +extern "C" { + pub fn expf(__x: f32) -> f32; +} +extern "C" { + pub fn expl(__x: u128) -> u128; +} +extern "C" { + pub fn exp2(__x: f64) -> f64; +} +extern "C" { + pub fn exp2f(__x: f32) -> f32; +} +extern "C" { + pub fn exp2l(__x: u128) -> u128; +} +extern "C" { + pub fn expm1(__x: f64) -> f64; +} +extern "C" { + pub fn expm1f(__x: f32) -> f32; +} +extern "C" { + pub fn expm1l(__x: u128) -> u128; +} +extern "C" { + pub fn frexp(__x: f64, __exponent: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn frexpf(__x: f32, __exponent: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn frexpl(__x: u128, __exponent: *mut ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn ilogb(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ilogbf(__x: f32) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ilogbl(__x: u128) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ldexp(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn ldexpf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn ldexpl(__x: u128, __exponent: ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn log(__x: f64) -> f64; +} +extern "C" { + pub fn logf(__x: f32) -> f32; +} +extern "C" { + pub fn logl(__x: u128) -> u128; +} +extern "C" { + pub fn log10(__x: f64) -> f64; +} +extern "C" { + pub fn log10f(__x: f32) -> f32; +} +extern "C" { + pub fn log10l(__x: u128) -> u128; +} +extern "C" { + pub fn log1p(__x: f64) -> f64; +} +extern "C" { + pub fn log1pf(__x: f32) -> f32; +} +extern "C" { + pub fn log1pl(__x: u128) -> u128; +} +extern "C" { + pub fn log2(__x: f64) -> f64; +} +extern "C" { + pub fn log2f(__x: f32) -> f32; +} +extern "C" { + pub fn log2l(__x: u128) -> u128; +} +extern "C" { + pub fn logb(__x: f64) -> f64; +} +extern "C" { + pub fn logbf(__x: f32) -> f32; +} +extern "C" { + pub fn logbl(__x: u128) -> u128; +} +extern "C" { + pub fn modf(__x: f64, __integral_part: *mut f64) -> f64; +} +extern "C" { + pub fn modff(__x: f32, __integral_part: *mut f32) -> f32; +} +extern "C" { + pub fn modfl(__x: u128, __integral_part: *mut u128) -> u128; +} +extern "C" { + pub fn scalbn(__x: f64, __exponent: ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn scalbnf(__x: f32, __exponent: ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn scalbnl(__x: u128, __exponent: ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn scalbln(__x: f64, __exponent: ::std::os::raw::c_long) -> f64; +} +extern "C" { + pub fn scalblnf(__x: f32, __exponent: ::std::os::raw::c_long) -> f32; +} +extern "C" { + pub fn scalblnl(__x: u128, __exponent: ::std::os::raw::c_long) -> u128; +} +extern "C" { + pub fn cbrt(__x: f64) -> f64; +} +extern "C" { + pub fn cbrtf(__x: f32) -> f32; +} +extern "C" { + pub fn cbrtl(__x: u128) -> u128; +} +extern "C" { + pub fn fabs(__x: f64) -> f64; +} +extern "C" { + pub fn fabsf(__x: f32) -> f32; +} +extern "C" { + pub fn fabsl(__x: u128) -> u128; +} +extern "C" { + pub fn hypot(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn hypotf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn hypotl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn pow(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn powf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn powl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn sqrt(__x: f64) -> f64; +} +extern "C" { + pub fn sqrtf(__x: f32) -> f32; +} +extern "C" { + pub fn sqrtl(__x: u128) -> u128; +} +extern "C" { + pub fn erf(__x: f64) -> f64; +} +extern "C" { + pub fn erff(__x: f32) -> f32; +} +extern "C" { + pub fn erfl(__x: u128) -> u128; +} +extern "C" { + pub fn erfc(__x: f64) -> f64; +} +extern "C" { + pub fn erfcf(__x: f32) -> f32; +} +extern "C" { + pub fn erfcl(__x: u128) -> u128; +} +extern "C" { + pub fn lgamma(__x: f64) -> f64; +} +extern "C" { + pub fn lgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn lgammal(__x: u128) -> u128; +} +extern "C" { + pub fn tgamma(__x: f64) -> f64; +} +extern "C" { + pub fn tgammaf(__x: f32) -> f32; +} +extern "C" { + pub fn tgammal(__x: u128) -> u128; +} +extern "C" { + pub fn ceil(__x: f64) -> f64; +} +extern "C" { + pub fn ceilf(__x: f32) -> f32; +} +extern "C" { + pub fn ceill(__x: u128) -> u128; +} +extern "C" { + pub fn floor(__x: f64) -> f64; +} +extern "C" { + pub fn floorf(__x: f32) -> f32; +} +extern "C" { + pub fn floorl(__x: u128) -> u128; +} +extern "C" { + pub fn nearbyint(__x: f64) -> f64; +} +extern "C" { + pub fn nearbyintf(__x: f32) -> f32; +} +extern "C" { + pub fn nearbyintl(__x: u128) -> u128; +} +extern "C" { + pub fn rint(__x: f64) -> f64; +} +extern "C" { + pub fn rintf(__x: f32) -> f32; +} +extern "C" { + pub fn rintl(__x: u128) -> u128; +} +extern "C" { + pub fn lrint(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lrintf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lrintl(__x: u128) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llrint(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llrintf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llrintl(__x: u128) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn round(__x: f64) -> f64; +} +extern "C" { + pub fn roundf(__x: f32) -> f32; +} +extern "C" { + pub fn roundl(__x: u128) -> u128; +} +extern "C" { + pub fn lround(__x: f64) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lroundf(__x: f32) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn lroundl(__x: u128) -> ::std::os::raw::c_long; +} +extern "C" { + pub fn llround(__x: f64) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llroundf(__x: f32) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn llroundl(__x: u128) -> ::std::os::raw::c_longlong; +} +extern "C" { + pub fn trunc(__x: f64) -> f64; +} +extern "C" { + pub fn truncf(__x: f32) -> f32; +} +extern "C" { + pub fn truncl(__x: u128) -> u128; +} +extern "C" { + pub fn fmod(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmodf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmodl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn remainder(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn remainderf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn remainderl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn remquo(__x: f64, __y: f64, __quotient_bits: *mut ::std::os::raw::c_int) -> f64; +} +extern "C" { + pub fn remquof(__x: f32, __y: f32, __quotient_bits: *mut ::std::os::raw::c_int) -> f32; +} +extern "C" { + pub fn remquol(__x: u128, __y: u128, __quotient_bits: *mut ::std::os::raw::c_int) -> u128; +} +extern "C" { + pub fn copysign(__value: f64, __sign: f64) -> f64; +} +extern "C" { + pub fn copysignf(__value: f32, __sign: f32) -> f32; +} +extern "C" { + pub fn copysignl(__value: u128, __sign: u128) -> u128; +} +extern "C" { + pub fn nan(__kind: *const ::std::os::raw::c_char) -> f64; +} +extern "C" { + pub fn nanf(__kind: *const ::std::os::raw::c_char) -> f32; +} +extern "C" { + pub fn nanl(__kind: *const ::std::os::raw::c_char) -> u128; +} +extern "C" { + pub fn nextafter(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn nextafterf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn nextafterl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn nexttoward(__x: f64, __y: u128) -> f64; +} +extern "C" { + pub fn nexttowardf(__x: f32, __y: u128) -> f32; +} +extern "C" { + pub fn nexttowardl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fdim(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fdimf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fdiml(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fmax(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fmaxf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fmaxl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fmin(__x: f64, __y: f64) -> f64; +} +extern "C" { + pub fn fminf(__x: f32, __y: f32) -> f32; +} +extern "C" { + pub fn fminl(__x: u128, __y: u128) -> u128; +} +extern "C" { + pub fn fma(__x: f64, __y: f64, __z: f64) -> f64; +} +extern "C" { + pub fn fmaf(__x: f32, __y: f32, __z: f32) -> f32; +} +extern "C" { + pub fn fmal(__x: u128, __y: u128, __z: u128) -> u128; +} +extern "C" { + pub fn isinf(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isnan(__x: f64) -> ::std::os::raw::c_int; +} +extern "C" { + pub static mut signgam: ::std::os::raw::c_int; +} +extern "C" { + pub fn j0(__x: f64) -> f64; +} +extern "C" { + pub fn j1(__x: f64) -> f64; +} +extern "C" { + pub fn jn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +extern "C" { + pub fn y0(__x: f64) -> f64; +} +extern "C" { + pub fn y1(__x: f64) -> f64; +} +extern "C" { + pub fn yn(__n: ::std::os::raw::c_int, __x: f64) -> f64; +} +pub const ASENSOR_TYPE_INVALID: _bindgen_ty_30 = -1; +pub const ASENSOR_TYPE_ACCELEROMETER: _bindgen_ty_30 = 1; +pub const ASENSOR_TYPE_MAGNETIC_FIELD: _bindgen_ty_30 = 2; +pub const ASENSOR_TYPE_GYROSCOPE: _bindgen_ty_30 = 4; +pub const ASENSOR_TYPE_LIGHT: _bindgen_ty_30 = 5; +pub const ASENSOR_TYPE_PRESSURE: _bindgen_ty_30 = 6; +pub const ASENSOR_TYPE_PROXIMITY: _bindgen_ty_30 = 8; +pub const ASENSOR_TYPE_GRAVITY: _bindgen_ty_30 = 9; +pub const ASENSOR_TYPE_LINEAR_ACCELERATION: _bindgen_ty_30 = 10; +pub const ASENSOR_TYPE_ROTATION_VECTOR: _bindgen_ty_30 = 11; +pub const ASENSOR_TYPE_RELATIVE_HUMIDITY: _bindgen_ty_30 = 12; +pub const ASENSOR_TYPE_AMBIENT_TEMPERATURE: _bindgen_ty_30 = 13; +pub const ASENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: _bindgen_ty_30 = 14; +pub const ASENSOR_TYPE_GAME_ROTATION_VECTOR: _bindgen_ty_30 = 15; +pub const ASENSOR_TYPE_GYROSCOPE_UNCALIBRATED: _bindgen_ty_30 = 16; +pub const ASENSOR_TYPE_SIGNIFICANT_MOTION: _bindgen_ty_30 = 17; +pub const ASENSOR_TYPE_STEP_DETECTOR: _bindgen_ty_30 = 18; +pub const ASENSOR_TYPE_STEP_COUNTER: _bindgen_ty_30 = 19; +pub const ASENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: _bindgen_ty_30 = 20; +pub const ASENSOR_TYPE_HEART_RATE: _bindgen_ty_30 = 21; +pub const ASENSOR_TYPE_POSE_6DOF: _bindgen_ty_30 = 28; +pub const ASENSOR_TYPE_STATIONARY_DETECT: _bindgen_ty_30 = 29; +pub const ASENSOR_TYPE_MOTION_DETECT: _bindgen_ty_30 = 30; +pub const ASENSOR_TYPE_HEART_BEAT: _bindgen_ty_30 = 31; +pub const ASENSOR_TYPE_ADDITIONAL_INFO: _bindgen_ty_30 = 33; +pub const ASENSOR_TYPE_LOW_LATENCY_OFFBODY_DETECT: _bindgen_ty_30 = 34; +pub const ASENSOR_TYPE_ACCELEROMETER_UNCALIBRATED: _bindgen_ty_30 = 35; +pub type _bindgen_ty_30 = i32; +pub const ASENSOR_STATUS_NO_CONTACT: _bindgen_ty_31 = -1; +pub const ASENSOR_STATUS_UNRELIABLE: _bindgen_ty_31 = 0; +pub const ASENSOR_STATUS_ACCURACY_LOW: _bindgen_ty_31 = 1; +pub const ASENSOR_STATUS_ACCURACY_MEDIUM: _bindgen_ty_31 = 2; +pub const ASENSOR_STATUS_ACCURACY_HIGH: _bindgen_ty_31 = 3; +pub type _bindgen_ty_31 = i32; +pub const AREPORTING_MODE_INVALID: _bindgen_ty_32 = -1; +pub const AREPORTING_MODE_CONTINUOUS: _bindgen_ty_32 = 0; +pub const AREPORTING_MODE_ON_CHANGE: _bindgen_ty_32 = 1; +pub const AREPORTING_MODE_ONE_SHOT: _bindgen_ty_32 = 2; +pub const AREPORTING_MODE_SPECIAL_TRIGGER: _bindgen_ty_32 = 3; +pub type _bindgen_ty_32 = i32; +pub const ASENSOR_DIRECT_RATE_STOP: _bindgen_ty_33 = 0; +pub const ASENSOR_DIRECT_RATE_NORMAL: _bindgen_ty_33 = 1; +pub const ASENSOR_DIRECT_RATE_FAST: _bindgen_ty_33 = 2; +pub const ASENSOR_DIRECT_RATE_VERY_FAST: _bindgen_ty_33 = 3; +pub type _bindgen_ty_33 = u32; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_SHARED_MEMORY: _bindgen_ty_34 = 1; +pub const ASENSOR_DIRECT_CHANNEL_TYPE_HARDWARE_BUFFER: _bindgen_ty_34 = 2; +pub type _bindgen_ty_34 = u32; +pub const ASENSOR_ADDITIONAL_INFO_BEGIN: _bindgen_ty_35 = 0; +pub const ASENSOR_ADDITIONAL_INFO_END: _bindgen_ty_35 = 1; +pub const ASENSOR_ADDITIONAL_INFO_UNTRACKED_DELAY: _bindgen_ty_35 = 65536; +pub const ASENSOR_ADDITIONAL_INFO_INTERNAL_TEMPERATURE: _bindgen_ty_35 = 65537; +pub const ASENSOR_ADDITIONAL_INFO_VEC3_CALIBRATION: _bindgen_ty_35 = 65538; +pub const ASENSOR_ADDITIONAL_INFO_SENSOR_PLACEMENT: _bindgen_ty_35 = 65539; +pub const ASENSOR_ADDITIONAL_INFO_SAMPLING: _bindgen_ty_35 = 65540; +pub type _bindgen_ty_35 = u32; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorVector { + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1, + pub status: i8, + pub reserved: [u8; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorVector__bindgen_ty_1 { + pub v: [f32; 3usize], + pub __bindgen_anon_1: ASensorVector__bindgen_ty_1__bindgen_ty_1, + pub __bindgen_anon_2: ASensorVector__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_1 { + pub x: f32, + pub y: f32, + pub z: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorVector__bindgen_ty_1__bindgen_ty_2 { + pub azimuth: f32, + pub pitch: f32, + pub roll: f32, +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).azimuth + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(azimuth) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pitch as *const _ + as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(pitch) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).roll as *const _ + as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(roll) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).v as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector__bindgen_ty_1), + "::", + stringify!(v) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorVector() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(ASensorVector)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ASensorVector)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved as *const _ as usize }, + 13usize, + concat!( + "Offset of field: ", + stringify!(ASensorVector), + "::", + stringify!(reserved) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AMetaDataEvent { + pub what: i32, + pub sensor: i32, +} +#[test] +fn bindgen_test_layout_AMetaDataEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AMetaDataEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).what as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AMetaDataEvent), + "::", + stringify!(sensor) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AUncalibratedEvent { + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1, + pub __bindgen_anon_2: AUncalibratedEvent__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_1 { + pub uncalib: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1 { + pub x_uncalib: f32, + pub y_uncalib: f32, + pub z_uncalib: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_uncalib + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(x_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_uncalib + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(y_uncalib) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_uncalib + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(z_uncalib) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalib as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_1), + "::", + stringify!(uncalib) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AUncalibratedEvent__bindgen_ty_2 { + pub bias: [f32; 3usize], + pub __bindgen_anon_1: AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1, + _bindgen_union_align: [u32; 3usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1 { + pub x_bias: f32, + pub y_bias: f32, + pub z_bias: f32, +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!( + "Size of: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).x_bias + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(x_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).y_bias + as *const _ as usize + }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(y_bias) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).z_bias + as *const _ as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2__bindgen_ty_1), + "::", + stringify!(z_bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 12usize, + concat!("Size of: ", stringify!(AUncalibratedEvent__bindgen_ty_2)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AUncalibratedEvent__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).bias as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AUncalibratedEvent__bindgen_ty_2), + "::", + stringify!(bias) + ) + ); +} +#[test] +fn bindgen_test_layout_AUncalibratedEvent() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(AUncalibratedEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AUncalibratedEvent)) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AHeartRateEvent { + pub bpm: f32, + pub status: i8, +} +#[test] +fn bindgen_test_layout_AHeartRateEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AHeartRateEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).bpm as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(bpm) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AHeartRateEvent), + "::", + stringify!(status) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ADynamicSensorEvent { + pub connected: i32, + pub handle: i32, +} +#[test] +fn bindgen_test_layout_ADynamicSensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!("Size of: ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(ADynamicSensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).connected as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(connected) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ADynamicSensorEvent), + "::", + stringify!(handle) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct AAdditionalInfoEvent { + pub type_: i32, + pub serial: i32, + pub __bindgen_anon_1: AAdditionalInfoEvent__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union AAdditionalInfoEvent__bindgen_ty_1 { + pub data_int32: [i32; 14usize], + pub data_float: [f32; 14usize], + _bindgen_union_align: [u32; 14usize], +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_int32 as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_int32) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data_float as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent__bindgen_ty_1), + "::", + stringify!(data_float) + ) + ); +} +#[test] +fn bindgen_test_layout_AAdditionalInfoEvent() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(AAdditionalInfoEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).serial as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(AAdditionalInfoEvent), + "::", + stringify!(serial) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ASensorEvent { + pub version: i32, + pub sensor: i32, + pub type_: i32, + pub reserved0: i32, + pub timestamp: i64, + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1, + pub flags: u32, + pub reserved1: [i32; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1 { + pub __bindgen_anon_1: ASensorEvent__bindgen_ty_1__bindgen_ty_1, + pub u64: ASensorEvent__bindgen_ty_1__bindgen_ty_2, + _bindgen_union_align: [u64; 8usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_1 { + pub data: [f32; 16usize], + pub vector: ASensorVector, + pub acceleration: ASensorVector, + pub magnetic: ASensorVector, + pub temperature: f32, + pub distance: f32, + pub light: f32, + pub pressure: f32, + pub relative_humidity: f32, + pub uncalibrated_gyro: AUncalibratedEvent, + pub uncalibrated_magnetic: AUncalibratedEvent, + pub meta_data: AMetaDataEvent, + pub heart_rate: AHeartRateEvent, + pub dynamic_sensor_meta: ADynamicSensorEvent, + pub additional_info: AAdditionalInfoEvent, + _bindgen_union_align: [u32; 16usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vector as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(vector) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).acceleration + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(acceleration) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).magnetic + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).temperature + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(temperature) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).distance + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(distance) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).light as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(light) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).pressure + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(pressure) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).relative_humidity + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(relative_humidity) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).uncalibrated_gyro + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_gyro) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())) + .uncalibrated_magnetic as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(uncalibrated_magnetic) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).meta_data + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(meta_data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).heart_rate + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(heart_rate) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).dynamic_sensor_meta + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(dynamic_sensor_meta) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).additional_info + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(additional_info) + ) + ); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ASensorEvent__bindgen_ty_1__bindgen_ty_2 { + pub data: [u64; 8usize], + pub step_counter: u64, + _bindgen_union_align: [u64; 8usize], +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!( + "Size of: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).data as *const _ + as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(data) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).step_counter + as *const _ as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(step_counter) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ASensorEvent__bindgen_ty_1)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).u64 as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent__bindgen_ty_1), + "::", + stringify!(u64) + ) + ); +} +#[test] +fn bindgen_test_layout_ASensorEvent() { + assert_eq!( + ::std::mem::size_of::(), + 104usize, + concat!("Size of: ", stringify!(ASensorEvent)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(ASensorEvent)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).version as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(version) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sensor as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(sensor) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(type_) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved0 as *const _ as usize }, + 12usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved0) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(timestamp) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 88usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).reserved1 as *const _ as usize }, + 92usize, + concat!( + "Offset of field: ", + stringify!(ASensorEvent), + "::", + stringify!(reserved1) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorManager { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensorEventQueue { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASensor { + _unused: [u8; 0], +} +pub type ASensorRef = *const ASensor; +pub type ASensorList = *const ASensorRef; +extern "C" { + pub fn ASensorManager_getInstance() -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getInstanceForPackage( + packageName: *const ::std::os::raw::c_char, + ) -> *mut ASensorManager; +} +extern "C" { + pub fn ASensorManager_getSensorList( + manager: *mut ASensorManager, + list: *mut ASensorList, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_getDefaultSensor( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_getDefaultSensorEx( + manager: *mut ASensorManager, + type_: ::std::os::raw::c_int, + wakeUp: bool, + ) -> *const ASensor; +} +extern "C" { + pub fn ASensorManager_createEventQueue( + manager: *mut ASensorManager, + looper: *mut ALooper, + ident: ::std::os::raw::c_int, + callback: ALooper_callbackFunc, + data: *mut ::std::os::raw::c_void, + ) -> *mut ASensorEventQueue; +} +extern "C" { + pub fn ASensorManager_destroyEventQueue( + manager: *mut ASensorManager, + queue: *mut ASensorEventQueue, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createSharedMemoryDirectChannel( + manager: *mut ASensorManager, + fd: ::std::os::raw::c_int, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_createHardwareBufferDirectChannel( + manager: *mut ASensorManager, + buffer: *const AHardwareBuffer, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorManager_destroyDirectChannel( + manager: *mut ASensorManager, + channelId: ::std::os::raw::c_int, + ); +} +extern "C" { + pub fn ASensorManager_configureDirectReport( + manager: *mut ASensorManager, + sensor: *const ASensor, + channelId: ::std::os::raw::c_int, + rate: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_registerSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + samplingPeriodUs: i32, + maxBatchReportLatencyUs: i64, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_enableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_disableSensor( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_setEventRate( + queue: *mut ASensorEventQueue, + sensor: *const ASensor, + usec: i32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_hasEvents(queue: *mut ASensorEventQueue) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensorEventQueue_getEvents( + queue: *mut ASensorEventQueue, + events: *mut ASensorEvent, + count: usize, + ) -> isize; +} +extern "C" { + pub fn ASensorEventQueue_requestAdditionalInfoEvents( + queue: *mut ASensorEventQueue, + enable: bool, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getName(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getVendor(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getType(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getResolution(sensor: *const ASensor) -> f32; +} +extern "C" { + pub fn ASensor_getMinDelay(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoMaxEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getFifoReservedEventCount(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getStringType(sensor: *const ASensor) -> *const ::std::os::raw::c_char; +} +extern "C" { + pub fn ASensor_getReportingMode(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_isWakeUpSensor(sensor: *const ASensor) -> bool; +} +extern "C" { + pub fn ASensor_isDirectChannelTypeSupported( + sensor: *const ASensor, + channelType: ::std::os::raw::c_int, + ) -> bool; +} +extern "C" { + pub fn ASensor_getHighestDirectReportRateLevel(sensor: *const ASensor) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASensor_getHandle(sensor: *const ASensor) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn android_set_abort_message(__msg: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ASharedMemory_create( + name: *const ::std::os::raw::c_char, + size: usize, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_getSize(fd: ::std::os::raw::c_int) -> usize; +} +extern "C" { + pub fn ASharedMemory_setProt( + fd: ::std::os::raw::c_int, + prot: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASharedMemory_dupFromJava( + env: *mut JNIEnv, + sharedMemory: jobject, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct AStorageManager { + _unused: [u8; 0], +} +pub const AOBB_STATE_MOUNTED: _bindgen_ty_36 = 1; +pub const AOBB_STATE_UNMOUNTED: _bindgen_ty_36 = 2; +pub const AOBB_STATE_ERROR_INTERNAL: _bindgen_ty_36 = 20; +pub const AOBB_STATE_ERROR_COULD_NOT_MOUNT: _bindgen_ty_36 = 21; +pub const AOBB_STATE_ERROR_COULD_NOT_UNMOUNT: _bindgen_ty_36 = 22; +pub const AOBB_STATE_ERROR_NOT_MOUNTED: _bindgen_ty_36 = 23; +pub const AOBB_STATE_ERROR_ALREADY_MOUNTED: _bindgen_ty_36 = 24; +pub const AOBB_STATE_ERROR_PERMISSION_DENIED: _bindgen_ty_36 = 25; +pub type _bindgen_ty_36 = u32; +extern "C" { + pub fn AStorageManager_new() -> *mut AStorageManager; +} +extern "C" { + pub fn AStorageManager_delete(mgr: *mut AStorageManager); +} +pub type AStorageManager_obbCallbackFunc = ::std::option::Option< + unsafe extern "C" fn( + filename: *const ::std::os::raw::c_char, + state: i32, + data: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + pub fn AStorageManager_mountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + key: *const ::std::os::raw::c_char, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_unmountObb( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + force: ::std::os::raw::c_int, + cb: AStorageManager_obbCallbackFunc, + data: *mut ::std::os::raw::c_void, + ); +} +extern "C" { + pub fn AStorageManager_isObbMounted( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn AStorageManager_getMountedObbPath( + mgr: *mut AStorageManager, + filename: *const ::std::os::raw::c_char, + ) -> *const ::std::os::raw::c_char; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ASurfaceTexture { + _unused: [u8; 0], +} +extern "C" { + pub fn ASurfaceTexture_release(st: *mut ASurfaceTexture); +} +extern "C" { + pub fn ASurfaceTexture_acquireANativeWindow(st: *mut ASurfaceTexture) -> *mut ANativeWindow; +} +extern "C" { + pub fn ASurfaceTexture_attachToGLContext( + st: *mut ASurfaceTexture, + texName: u32, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_detachFromGLContext(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_updateTexImage(st: *mut ASurfaceTexture) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn ASurfaceTexture_getTransformMatrix(st: *mut ASurfaceTexture, mtx: *mut f32); +} +extern "C" { + pub fn ASurfaceTexture_getTimestamp(st: *mut ASurfaceTexture) -> i64; +} +extern "C" { + pub fn ASurfaceTexture_fromSurfaceTexture( + env: *mut JNIEnv, + surfacetexture: jobject, + ) -> *mut ASurfaceTexture; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_merge_data { + pub name: [::std::os::raw::c_char; 32usize], + pub fd2: __s32, + pub fence: __s32, + pub flags: __u32, + pub pad: __u32, +} +#[test] +fn bindgen_test_layout_sync_merge_data() { + assert_eq!( + ::std::mem::size_of::(), + 48usize, + concat!("Size of: ", stringify!(sync_merge_data)) + ); + assert_eq!( + ::std::mem::align_of::(), + 4usize, + concat!("Alignment of ", stringify!(sync_merge_data)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fd2 as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fd2) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).fence as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(fence) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_merge_data), + "::", + stringify!(pad) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_fence_info { + pub obj_name: [::std::os::raw::c_char; 32usize], + pub driver_name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub timestamp_ns: __u64, +} +#[test] +fn bindgen_test_layout_sync_fence_info() { + assert_eq!( + ::std::mem::size_of::(), + 80usize, + concat!("Size of: ", stringify!(sync_fence_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sync_fence_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).obj_name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(obj_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).driver_name as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(driver_name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 64usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 68usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).timestamp_ns as *const _ as usize }, + 72usize, + concat!( + "Offset of field: ", + stringify!(sync_fence_info), + "::", + stringify!(timestamp_ns) + ) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sync_file_info { + pub name: [::std::os::raw::c_char; 32usize], + pub status: __s32, + pub flags: __u32, + pub num_fences: __u32, + pub pad: __u32, + pub sync_fence_info: __u64, +} +#[test] +fn bindgen_test_layout_sync_file_info() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(sync_file_info)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(sync_file_info)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(status) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, + 36usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(flags) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).num_fences as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(num_fences) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).pad as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(pad) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).sync_fence_info as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(sync_file_info), + "::", + stringify!(sync_fence_info) + ) + ); +} +extern "C" { + pub fn sync_merge(name: *const ::std::os::raw::c_char, fd1: i32, fd2: i32) -> i32; +} +extern "C" { + pub fn sync_file_info(fd: i32) -> *mut sync_file_info; +} +extern "C" { + pub fn sync_file_info_free(info: *mut sync_file_info); +} +extern "C" { + pub fn ATrace_isEnabled() -> bool; +} +extern "C" { + pub fn ATrace_beginSection(sectionName: *const ::std::os::raw::c_char); +} +extern "C" { + pub fn ATrace_endSection(); +} +extern "C" { + pub fn ATrace_beginAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_endAsyncSection(sectionName: *const ::std::os::raw::c_char, cookie: i32); +} +extern "C" { + pub fn ATrace_setCounter(counterName: *const ::std::os::raw::c_char, counterValue: i64); +} +pub const AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON: _bindgen_ty_37 = 1; +pub const AWINDOW_FLAG_DIM_BEHIND: _bindgen_ty_37 = 2; +pub const AWINDOW_FLAG_BLUR_BEHIND: _bindgen_ty_37 = 4; +pub const AWINDOW_FLAG_NOT_FOCUSABLE: _bindgen_ty_37 = 8; +pub const AWINDOW_FLAG_NOT_TOUCHABLE: _bindgen_ty_37 = 16; +pub const AWINDOW_FLAG_NOT_TOUCH_MODAL: _bindgen_ty_37 = 32; +pub const AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING: _bindgen_ty_37 = 64; +pub const AWINDOW_FLAG_KEEP_SCREEN_ON: _bindgen_ty_37 = 128; +pub const AWINDOW_FLAG_LAYOUT_IN_SCREEN: _bindgen_ty_37 = 256; +pub const AWINDOW_FLAG_LAYOUT_NO_LIMITS: _bindgen_ty_37 = 512; +pub const AWINDOW_FLAG_FULLSCREEN: _bindgen_ty_37 = 1024; +pub const AWINDOW_FLAG_FORCE_NOT_FULLSCREEN: _bindgen_ty_37 = 2048; +pub const AWINDOW_FLAG_DITHER: _bindgen_ty_37 = 4096; +pub const AWINDOW_FLAG_SECURE: _bindgen_ty_37 = 8192; +pub const AWINDOW_FLAG_SCALED: _bindgen_ty_37 = 16384; +pub const AWINDOW_FLAG_IGNORE_CHEEK_PRESSES: _bindgen_ty_37 = 32768; +pub const AWINDOW_FLAG_LAYOUT_INSET_DECOR: _bindgen_ty_37 = 65536; +pub const AWINDOW_FLAG_ALT_FOCUSABLE_IM: _bindgen_ty_37 = 131072; +pub const AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH: _bindgen_ty_37 = 262144; +pub const AWINDOW_FLAG_SHOW_WHEN_LOCKED: _bindgen_ty_37 = 524288; +pub const AWINDOW_FLAG_SHOW_WALLPAPER: _bindgen_ty_37 = 1048576; +pub const AWINDOW_FLAG_TURN_SCREEN_ON: _bindgen_ty_37 = 2097152; +pub const AWINDOW_FLAG_DISMISS_KEYGUARD: _bindgen_ty_37 = 4194304; +pub type _bindgen_ty_37 = u32; +pub type __builtin_va_list = [__va_list_tag; 1usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __va_list_tag { + pub gp_offset: ::std::os::raw::c_uint, + pub fp_offset: ::std::os::raw::c_uint, + pub overflow_arg_area: *mut ::std::os::raw::c_void, + pub reg_save_area: *mut ::std::os::raw::c_void, +} +#[test] +fn bindgen_test_layout___va_list_tag() { + assert_eq!( + ::std::mem::size_of::<__va_list_tag>(), + 24usize, + concat!("Size of: ", stringify!(__va_list_tag)) + ); + assert_eq!( + ::std::mem::align_of::<__va_list_tag>(), + 8usize, + concat!("Alignment of ", stringify!(__va_list_tag)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list_tag>())).gp_offset as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(gp_offset) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list_tag>())).fp_offset as *const _ as usize }, + 4usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(fp_offset) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list_tag>())).overflow_arg_area as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(overflow_arg_area) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::<__va_list_tag>())).reg_save_area as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(__va_list_tag), + "::", + stringify!(reg_save_area) + ) + ); +} diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/src/lib.rs b/third_party/cargo/vendor/ndk-sys-0.1.0/src/lib.rs new file mode 100644 index 0000000..e32e62f --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/src/lib.rs @@ -0,0 +1,39 @@ +//! Raw FFI bindings to the Android NDK. +//! +//! The bindings are pre-generated and the right one for the platform is selected at compile time. +//! +//! If you are including `android_native_app_glue.c`, the [`android_native_app_glue` +//! module](android_native_app_glue/index.html) contains the interface for that. + +// Bindgen lints +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(improper_ctypes)] +// Test setup lints +#![cfg_attr(test, allow(dead_code))] + +#[cfg(not(any(target_os = "android", feature = "test", feature = "rustdoc")))] +compile_error!("android-ndk-sys only supports compiling for Android"); + +#[cfg(any( + all( + any(target_os = "android", feature = "test"), + any(target_arch = "arm", target_arch = "armv7") + ), + feature = "rustdoc" +))] +include!("ffi_arm.rs"); + +#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "aarch64"))] +include!("ffi_aarch64.rs"); + +#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "x86"))] +include!("ffi_i686.rs"); + +#[cfg(all(any(target_os = "android", feature = "test"), target_arch = "x86_64"))] +include!("ffi_x86_64.rs"); + +#[cfg(target_os = "android")] +#[link(name = "android")] +extern "C" {} diff --git a/third_party/cargo/vendor/ndk-sys-0.1.0/wrapper.h b/third_party/cargo/vendor/ndk-sys-0.1.0/wrapper.h new file mode 100644 index 0000000..9cbfc33 --- /dev/null +++ b/third_party/cargo/vendor/ndk-sys-0.1.0/wrapper.h @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/third_party/cargo/vendor/net2-0.2.33/.cargo-checksum.json b/third_party/cargo/vendor/net2-0.2.33/.cargo-checksum.json deleted file mode 100644 index 247941b..0000000 --- a/third_party/cargo/vendor/net2-0.2.33/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"c18ec02a8566f054a27e18df2ac53856a74864fad952a41abda096c91caae106","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"c13834771aa1973a02dfbf99c282850ea1d6974269ebe9081cd2853a5ac59c93","appveyor.yml":"6e3173d907ccfa65e289c99042cb29d4a23b9d1f4ec5bf7afa6c0d65365bab54","src/ext.rs":"b9300ae246e9ac451889f146ece8bb6ed4a95482edf806373de5af759cd09360","src/lib.rs":"8d8a171090b75e86e7505921460fba072db0077942edd11c4a3c8a70e9164eef","src/socket.rs":"a033d04061d95c4fea3eb78ce25f147d3b669034681e4119d00bc78b817a8096","src/sys/redox/impls.rs":"90059116f0514bd44dbf282a3e8d7b192c99e1a78a34ebacb00f2d325ca0f8b0","src/sys/redox/mod.rs":"137013d409fd174fed0ceb3eceb2c17d15f34a3af70c7d237c06dd3a144affc1","src/sys/unix/impls.rs":"05f123226e8fe7559317d50864021650b2455d25d01a9aff1c65c01ae26cf4ef","src/sys/unix/mod.rs":"bb28a7275eac021132b01206d134802902d616c0be3e82100b45a3ff1eba4c02","src/sys/windows/impls.rs":"bee70b7cd45055c4eaa1967f7aad7ec46639de458c71ed6f3e97a2f7b2c49281","src/sys/windows/mod.rs":"0706f1587af0f693f75e8597e4196075a3f673c89727dd865447da306974bf35","src/tcp.rs":"0bebf5cca75714151de30c8f2d7697ca519c57da065e93ba81796bce04673f8d","src/udp.rs":"8af5a55a4ae5e4120ffe18dcc4dc24072e18da34bf3591a02b18653e5d3e8ac8","src/unix.rs":"fe9cdbd75ef2e1fafc128d1abb5f32500eaf0b674aa618d837e06ab1d0dc6687","src/utils.rs":"d31de5333a6fa2f5c99b64cc937be596888d9863264632e6bc6b36b30197fa5b","tests/all.rs":"12cb4616c842f655ece1b477664d41821f95b3051053da641b1d85026ee18274"},"package":"42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"} \ No newline at end of file diff --git a/third_party/cargo/vendor/net2-0.2.33/appveyor.yml b/third_party/cargo/vendor/net2-0.2.33/appveyor.yml deleted file mode 100644 index 9b61baf..0000000 --- a/third_party/cargo/vendor/net2-0.2.33/appveyor.yml +++ /dev/null @@ -1,17 +0,0 @@ -environment: - matrix: - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc - - TARGET: i686-pc-windows-gnu -install: - - ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:TARGET}.exe" - - rust-nightly-%TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust" - - SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin - - SET PATH=%PATH%;C:\MinGW\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - cargo test --verbose --features nightly --target %TARGET% diff --git a/third_party/cargo/vendor/net2-0.2.33/tests/all.rs b/third_party/cargo/vendor/net2-0.2.33/tests/all.rs deleted file mode 100644 index 9413c0e..0000000 --- a/third_party/cargo/vendor/net2-0.2.33/tests/all.rs +++ /dev/null @@ -1,45 +0,0 @@ -extern crate net2; - -use std::net::{TcpStream, IpAddr, Ipv4Addr, Ipv6Addr}; -use std::io::prelude::*; -use std::thread; - -use net2::TcpBuilder; - -macro_rules! t { - ($e:expr) => (match $e { - Ok(e) => e, - Err(e) => panic!("{} failed with: {}", stringify!($e), e), - }) -} - -#[test] -fn smoke_build_listener() { - let b = t!(TcpBuilder::new_v4()); - t!(b.bind("127.0.0.1:0")); - - let addr = t!(b.local_addr()); - assert_eq!(addr.ip(), IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1))); - - let listener = t!(b.listen(200)); - - let t = thread::spawn(move || { - let mut s = t!(listener.accept()).0; - let mut b = [0; 4]; - t!(s.read(&mut b)); - assert_eq!(b, [1, 2, 3, 0]); - }); - - let mut stream = t!(TcpStream::connect(&addr)); - t!(stream.write(&[1,2,3])); - t.join().unwrap(); -} - -#[test] -fn smoke_build_listener_v6() { - let b = t!(TcpBuilder::new_v6()); - t!(b.bind("::1:0")); - - let addr = t!(b.local_addr()); - assert_eq!(addr.ip(), IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1))); -} diff --git a/third_party/cargo/vendor/net2-0.2.34/.cargo-checksum.json b/third_party/cargo/vendor/net2-0.2.34/.cargo-checksum.json new file mode 100644 index 0000000..a125d0e --- /dev/null +++ b/third_party/cargo/vendor/net2-0.2.34/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"3a7012e5d1e7748f62d595edcfc93df6014899d74c183929c0e9977793473a2d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"a99cb0401bd49e68c945f6a249175dd5c4a5117b2c8cc5d5fb7dea369002574e","src/ext.rs":"03836f768aaf8c7bc9a351f3c10ce47d1f27f162133e99941850f84bb0e9dbc5","src/lib.rs":"a5e429c904fa13291dee5ed5df6c20adcebbaa56fc0312d475fd2056e9974153","src/socket.rs":"fda3d134345dd9b6178399c9173f42775b7620b9eaa802bf2d56dd9b798c5ca8","src/sys/redox/impls.rs":"90059116f0514bd44dbf282a3e8d7b192c99e1a78a34ebacb00f2d325ca0f8b0","src/sys/redox/mod.rs":"137013d409fd174fed0ceb3eceb2c17d15f34a3af70c7d237c06dd3a144affc1","src/sys/unix/impls.rs":"05f123226e8fe7559317d50864021650b2455d25d01a9aff1c65c01ae26cf4ef","src/sys/unix/mod.rs":"a7120712dfe2a08951532307667275f35e196d5f294570bfdc55fe1af4d2b4f1","src/sys/wasi/impls.rs":"da4e95a27a765b64fbbebce55b860020ac891456085ed706d5f8f391e0d1cddf","src/sys/wasi/mod.rs":"e88b02f4d5e0ae558f093d49cc0bb1b3cdf86ede625d00ed9231f0ab414e483f","src/sys/windows/impls.rs":"bee70b7cd45055c4eaa1967f7aad7ec46639de458c71ed6f3e97a2f7b2c49281","src/sys/windows/mod.rs":"0706f1587af0f693f75e8597e4196075a3f673c89727dd865447da306974bf35","src/tcp.rs":"0bebf5cca75714151de30c8f2d7697ca519c57da065e93ba81796bce04673f8d","src/udp.rs":"8af5a55a4ae5e4120ffe18dcc4dc24072e18da34bf3591a02b18653e5d3e8ac8","src/unix.rs":"1156707694cb1f002a2eb2144bf205a73412e1661fd196a8a2a7bc8ea5aaad2d","src/utils.rs":"d31de5333a6fa2f5c99b64cc937be596888d9863264632e6bc6b36b30197fa5b"},"package":"2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"} \ No newline at end of file diff --git a/third_party/cargo/vendor/net2-0.2.33/BUILD b/third_party/cargo/vendor/net2-0.2.34/BUILD similarity index 86% rename from third_party/cargo/vendor/net2-0.2.33/BUILD rename to third_party/cargo/vendor/net2-0.2.34/BUILD index 9fbb044..1406280 100644 --- a/third_party/cargo/vendor/net2-0.2.33/BUILD +++ b/third_party/cargo/vendor/net2-0.2.34/BUILD @@ -23,7 +23,6 @@ load( ) -# Unsupported target "all" with type "test" omitted rust_library( name = "net2", @@ -33,12 +32,12 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/cfg-if-0.1.10:cfg_if", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.33", + version = "0.2.34", crate_features = [ "default", "duration", diff --git a/third_party/cargo/vendor/net2-0.2.33/Cargo.toml b/third_party/cargo/vendor/net2-0.2.34/Cargo.toml similarity index 69% rename from third_party/cargo/vendor/net2-0.2.33/Cargo.toml rename to third_party/cargo/vendor/net2-0.2.34/Cargo.toml index 40a6d8e..4d1ac45 100644 --- a/third_party/cargo/vendor/net2-0.2.33/Cargo.toml +++ b/third_party/cargo/vendor/net2-0.2.34/Cargo.toml @@ -3,7 +3,7 @@ # 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 +# 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 @@ -12,14 +12,15 @@ [package] name = "net2" -version = "0.2.33" +version = "0.2.34" authors = ["Alex Crichton "] +include = ["Cargo.toml", "LICENSE-APACHE", "LICENSE-MIT", "README.md", "src/**/*.rs"] description = "Extensions to the standard library's networking types as proposed in RFC 1158.\n" -homepage = "https://github.com/rust-lang-nursery/net2-rs" -documentation = "https://doc.rust-lang.org/net2-rs/" +homepage = "https://github.com/deprecrated/net2-rs" +documentation = "https://docs.rs/net2/~0.2" readme = "README.md" license = "MIT/Apache-2.0" -repository = "https://github.com/rust-lang-nursery/net2-rs" +repository = "https://github.com/deprecrated/net2-rs" [dependencies.cfg-if] version = "0.1" @@ -27,8 +28,8 @@ version = "0.1" default = ["duration"] duration = [] nightly = [] -[target."cfg(any(target_os=\"redox\", unix))".dependencies.libc] -version = "0.2.42" +[target."cfg(any(target_os=\"redox\", unix, target_os=\"wasi\"))".dependencies.libc] +version = "0.2.54" [target."cfg(windows)".dependencies.winapi] version = "0.3" features = ["handleapi", "winsock2", "ws2def", "ws2ipdef", "ws2tcpip"] diff --git a/third_party/cargo/vendor/net2-0.2.33/LICENSE-APACHE b/third_party/cargo/vendor/net2-0.2.34/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/LICENSE-APACHE rename to third_party/cargo/vendor/net2-0.2.34/LICENSE-APACHE diff --git a/third_party/cargo/vendor/libc-0.2.67/LICENSE-MIT b/third_party/cargo/vendor/net2-0.2.34/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/libc-0.2.67/LICENSE-MIT rename to third_party/cargo/vendor/net2-0.2.34/LICENSE-MIT diff --git a/third_party/cargo/vendor/net2-0.2.33/README.md b/third_party/cargo/vendor/net2-0.2.34/README.md similarity index 62% rename from third_party/cargo/vendor/net2-0.2.33/README.md rename to third_party/cargo/vendor/net2-0.2.34/README.md index 6d8fc15..9818422 100644 --- a/third_party/cargo/vendor/net2-0.2.33/README.md +++ b/third_party/cargo/vendor/net2-0.2.34/README.md @@ -1,21 +1,17 @@ # net2 -[![Build Status](https://travis-ci.org/rust-lang-nursery/net2-rs.svg?branch=master)](https://travis-ci.org/rust-lang-nursery/net2-rs) -[![Build status](https://ci.appveyor.com/api/projects/status/ns78f02jt2uvd2lp?svg=true)](https://ci.appveyor.com/project/alexcrichton/net2-rs) - -[Documentation](https://docs.rs/net2/0.2.32/net2/) - -Extensions to the standard library's networking types, proposed in [RFC -1158][rfc]. - +Extensions to the standard library's networking types, proposed in [RFC 1158][rfc]. [rfc]: https://github.com/alexcrichton/rfcs/blob/net2.1/text/0000-io-net-2.1.md -```toml -# Cargo.toml -[dependencies] -net2 = "0.2" -``` +[![Build Status](https://github.com/deprecrated/net2-rs/workflows/CI/badge.svg)](https://github.com/deprecrated/net2-rs/actions?query=workflow%3ACI+branch%3Amaster) +[![Documentation](https://docs.rs/net2/badge.svg?version=0.2)](https://docs.rs/net2/~0.2) + +# net2 is Deprecated + +Prospective and existing consumers are encouraged to consider +[socket2](https://crates.io/crates/socket2) instead. + # License diff --git a/third_party/cargo/vendor/net2-0.2.33/src/ext.rs b/third_party/cargo/vendor/net2-0.2.34/src/ext.rs similarity index 95% rename from third_party/cargo/vendor/net2-0.2.33/src/ext.rs rename to third_party/cargo/vendor/net2-0.2.34/src/ext.rs index 38185d6..a0c5456 100644 --- a/third_party/cargo/vendor/net2-0.2.33/src/ext.rs +++ b/third_party/cargo/vendor/net2-0.2.34/src/ext.rs @@ -28,6 +28,7 @@ cfg_if! { target_os = "netbsd", target_os = "openbsd", target_os = "solaris", + target_os = "illumos", target_env = "uclibc"))] { use libc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; use libc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; @@ -38,13 +39,15 @@ cfg_if! { use std::time::Duration; -#[cfg(any(unix, target_os = "redox"))] use libc::*; +#[cfg(any(unix, target_os = "redox", target_os = "wasi"))] use libc::*; #[cfg(any(unix, target_os = "redox"))] use std::os::unix::prelude::*; +#[cfg(target_os = "wasi")] use std::os::wasi::prelude::*; #[cfg(target_os = "redox")] pub type Socket = usize; #[cfg(unix)] pub type Socket = c_int; +#[cfg(target_os = "wasi")] pub type Socket = std::os::wasi::io::RawFd; #[cfg(windows)] pub type Socket = SOCKET; #[cfg(windows)] use std::os::windows::prelude::*; -#[cfg(windows)] use sys::c::*; +#[cfg(any(windows, target_os = "wasi"))] use sys::c::*; #[cfg(windows)] const SIO_KEEPALIVE_VALS: DWORD = 0x98000004; #[cfg(windows)] @@ -55,10 +58,16 @@ struct tcp_keepalive { keepaliveinterval: c_ulong, } -#[cfg(target_os = "redox")] fn v(opt: c_int) -> c_int { opt } -#[cfg(unix)] fn v(opt: c_int) -> c_int { opt } +#[cfg(any(unix, target_os = "redox", target_os = "wasi"))] fn v(opt: c_int) -> c_int { opt } #[cfg(windows)] fn v(opt: IPPROTO) -> c_int { opt as c_int } +#[cfg(target_os = "wasi")] +pub fn set_opt(_sock: Socket, _opt: c_int, _val: c_int, + _payload: T) -> io::Result<()> { + Ok(()) +} + +#[cfg(not(target_os = "wasi"))] pub fn set_opt(sock: Socket, opt: c_int, val: c_int, payload: T) -> io::Result<()> { unsafe { @@ -67,10 +76,15 @@ pub fn set_opt(sock: Socket, opt: c_int, val: c_int, let sock = sock as c_int; try!(::cvt(setsockopt(sock, opt, val, payload as *const _, mem::size_of::() as socklen_t))); - Ok(()) } + Ok(()) } +#[cfg(target_os = "wasi")] +pub fn get_opt(_sock: Socket, _opt: c_int, _val: c_int) -> io::Result { + unimplemented!() +} +#[cfg(not(target_os = "wasi"))] pub fn get_opt(sock: Socket, opt: c_int, val: c_int) -> io::Result { unsafe { let mut slot: T = mem::zeroed(); @@ -641,11 +655,7 @@ pub trait AsSock { fn as_sock(&self) -> Socket; } -#[cfg(target_os = "redox")] -impl AsSock for T { - fn as_sock(&self) -> Socket { self.as_raw_fd() } -} -#[cfg(unix)] +#[cfg(any(unix, target_os = "redox", target_os = "wasi"))] impl AsSock for T { fn as_sock(&self) -> Socket { self.as_raw_fd() } } @@ -750,6 +760,16 @@ impl TcpStreamExt for TcpStream { Ok(Some((secs as u32) * 1000)) } + #[cfg(target_os = "wasi")] + fn set_keepalive_ms(&self, _keepalive: Option) -> io::Result<()> { + unimplemented!() + } + + #[cfg(target_os = "wasi")] + fn keepalive_ms(&self) -> io::Result> { + unimplemented!() + } + #[cfg(windows)] fn set_keepalive_ms(&self, keepalive: Option) -> io::Result<()> { let ms = keepalive.unwrap_or(INFINITE); @@ -872,7 +892,7 @@ impl TcpStreamExt for TcpStream { } } -#[cfg(any(target_os = "redox", unix))] +#[cfg(any(target_os = "redox", unix, target_os = "wasi"))] fn ms2timeout(dur: Option) -> timeval { // TODO: be more rigorous match dur { @@ -884,7 +904,7 @@ fn ms2timeout(dur: Option) -> timeval { } } -#[cfg(any(target_os = "redox", unix))] +#[cfg(any(target_os = "redox", unix, target_os = "wasi"))] fn timeout2ms(dur: timeval) -> Option { if dur.tv_sec == 0 && dur.tv_usec == 0 { None @@ -929,7 +949,7 @@ fn dur2linger(dur: Option) -> linger { } } -#[cfg(any(target_os = "redox", unix))] +#[cfg(any(target_os = "redox", unix, target_os = "wasi"))] fn dur2linger(dur: Option) -> linger { match dur { Some(d) => { @@ -1193,6 +1213,22 @@ impl UdpSocketExt for UdpSocket { } } + #[cfg(target_os = "wasi")] + fn send(&self, buf: &[u8]) -> io::Result { + let _so_datalen: *mut sys::c::size_t = &mut 0; + unsafe { + let _errno = libc::__wasi_sock_send( + self.as_sock() as libc::__wasi_fd_t, + buf.as_ptr() as *const _, + buf.len(), + 0, + _so_datalen, + ); + // TODO: handle errno + Ok((*_so_datalen) as usize) + } + } + #[cfg(windows)] fn send(&self, buf: &[u8]) -> io::Result { let len = ::std::cmp::min(buf.len(), c_int::max_value() as usize); @@ -1219,6 +1255,24 @@ impl UdpSocketExt for UdpSocket { } } + #[cfg(target_os = "wasi")] + fn recv(&self, buf: &mut [u8]) -> io::Result { + let _ro_datalen: *mut sys::c::size_t = &mut 0; + let _ro_flags: *mut sys::c::__wasi_roflags_t = &mut 0; + unsafe { + let _errno = __wasi_sock_recv( + self.as_sock(), + buf.as_mut_ptr() as *mut _, + buf.len(), + 0, + _ro_datalen, + _ro_flags, + ); + // TODO: handle errno + Ok((*_ro_datalen) as usize) + } + } + #[cfg(windows)] fn recv(&self, buf: &mut [u8]) -> io::Result { let len = ::std::cmp::min(buf.len(), c_int::max_value() as usize); @@ -1270,6 +1324,11 @@ fn set_nonblocking(sock: Socket, nonblocking: bool) -> io::Result<()> { }).map(|_| ()) } +#[cfg(target_os = "wasi")] +fn set_nonblocking(_sock: Socket, _nonblocking: bool) -> io::Result<()> { + Ok(()) +} + #[cfg(windows)] fn set_nonblocking(sock: Socket, nonblocking: bool) -> io::Result<()> { let mut nonblocking = nonblocking as c_ulong; @@ -1289,7 +1348,7 @@ fn ip2in_addr(ip: &Ipv4Addr) -> in_addr { } } -#[cfg(unix)] +#[cfg(any(unix, target_os = "wasi"))] fn ip2in_addr(ip: &Ipv4Addr) -> in_addr { let oct = ip.octets(); in_addr { @@ -1421,7 +1480,7 @@ impl TcpBuilder { /// Set value for the `SO_REUSEADDR` option on this socket. /// - /// This indicates that futher calls to `bind` may allow reuse of local + /// This indicates that further calls to `bind` may allow reuse of local /// addresses. For IPv4 sockets this means that a socket may bind even when /// there's a socket already listening on this port. pub fn reuse_address(&self, reuse: bool) -> io::Result<&Self> { diff --git a/third_party/cargo/vendor/net2-0.2.33/src/lib.rs b/third_party/cargo/vendor/net2-0.2.34/src/lib.rs similarity index 90% rename from third_party/cargo/vendor/net2-0.2.33/src/lib.rs rename to third_party/cargo/vendor/net2-0.2.34/src/lib.rs index d5a3378..fcbb7b4 100644 --- a/third_party/cargo/vendor/net2-0.2.33/src/lib.rs +++ b/third_party/cargo/vendor/net2-0.2.34/src/lib.rs @@ -41,8 +41,12 @@ html_root_url = "https://doc.rust-lang.org/net2-rs")] #![deny(missing_docs, warnings)] +// Silence warnings about deprecated try!() usage +#![allow(deprecated)] -#[cfg(any(target_os="redox", unix))] extern crate libc; +#![cfg_attr(target_os = "wasi", feature(wasi_ext))] + +#[cfg(any(target_os = "redox", target_os = "wasi", unix))] extern crate libc; #[cfg(windows)] extern crate winapi; @@ -63,7 +67,8 @@ mod utils; #[cfg(target_os="redox")] #[path = "sys/redox/mod.rs"] mod sys; #[cfg(unix)] #[path = "sys/unix/mod.rs"] mod sys; #[cfg(windows)] #[path = "sys/windows/mod.rs"] mod sys; -#[cfg(all(unix, not(any(target_os = "solaris"))))] pub mod unix; +#[cfg(target_os = "wasi")] #[path = "sys/wasi/mod.rs"] mod sys; +#[cfg(all(unix, not(any(target_os = "solaris", target_os = "illumos"))))] pub mod unix; pub use tcp::TcpBuilder; pub use udp::UdpBuilder; diff --git a/third_party/cargo/vendor/net2-0.2.33/src/socket.rs b/third_party/cargo/vendor/net2-0.2.34/src/socket.rs similarity index 98% rename from third_party/cargo/vendor/net2-0.2.33/src/socket.rs rename to third_party/cargo/vendor/net2-0.2.34/src/socket.rs index 385ed2d..2b4a48c 100644 --- a/third_party/cargo/vendor/net2-0.2.33/src/socket.rs +++ b/third_party/cargo/vendor/net2-0.2.34/src/socket.rs @@ -12,9 +12,7 @@ use std::fmt; use std::io; use std::mem; use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; -#[cfg(target_os = "redox")] -use libc::c_int; -#[cfg(unix)] +#[cfg(any(unix, target_os = "redox", target_os = "wasi"))] use libc::c_int; #[cfg(windows)] use winapi::ctypes::c_int; diff --git a/third_party/cargo/vendor/net2-0.2.33/src/sys/redox/impls.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/redox/impls.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/sys/redox/impls.rs rename to third_party/cargo/vendor/net2-0.2.34/src/sys/redox/impls.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/sys/redox/mod.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/redox/mod.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/sys/redox/mod.rs rename to third_party/cargo/vendor/net2-0.2.34/src/sys/redox/mod.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/sys/unix/impls.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/unix/impls.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/sys/unix/impls.rs rename to third_party/cargo/vendor/net2-0.2.34/src/sys/unix/impls.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/sys/unix/mod.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/unix/mod.rs similarity index 89% rename from third_party/cargo/vendor/net2-0.2.33/src/sys/unix/mod.rs rename to third_party/cargo/vendor/net2-0.2.34/src/sys/unix/mod.rs index e13f97c..3351356 100644 --- a/third_party/cargo/vendor/net2-0.2.33/src/sys/unix/mod.rs +++ b/third_party/cargo/vendor/net2-0.2.34/src/sys/unix/mod.rs @@ -14,7 +14,7 @@ use std::mem; use std::net::{TcpListener, TcpStream, UdpSocket}; use std::os::unix::io::FromRawFd; use libc::{self, c_int}; -#[cfg(not(any(target_os = "solaris", target_os = "emscripten")))] +#[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))] use libc::{ioctl, FIOCLEX}; mod impls; @@ -36,7 +36,7 @@ pub struct Socket { } impl Socket { - #[cfg(not(any(target_os = "solaris", target_os = "emscripten")))] + #[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))] pub fn new(family: c_int, ty: c_int) -> io::Result { unsafe { // Linux >2.6.26 overloads the type argument to accept SOCK_CLOEXEC, @@ -56,9 +56,9 @@ impl Socket { } } - // ioctl(FIOCLEX) is not supported by Solaris/Illumos or emscripten, + // ioctl(FIOCLEX) is not supported by Solaris/illumos or emscripten, // use fcntl(FD_CLOEXEC) instead - #[cfg(any(target_os = "solaris", target_os = "emscripten"))] + #[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten"))] pub fn new(family: c_int, ty: c_int) -> io::Result { unsafe { let fd = try!(::cvt(libc::socket(family, ty, 0))); diff --git a/third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/impls.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/impls.rs new file mode 100644 index 0000000..eef8094 --- /dev/null +++ b/third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/impls.rs @@ -0,0 +1,33 @@ +use std::os::wasi::io::{FromRawFd, AsRawFd}; + +use {TcpBuilder, UdpBuilder, FromInner, AsInner}; +use socket::Socket; +use sys::{self, c::__wasi_fd_t}; + +impl FromRawFd for TcpBuilder { + unsafe fn from_raw_fd(fd: __wasi_fd_t) -> TcpBuilder { + let sock = sys::Socket::from_inner(fd); + TcpBuilder::from_inner(Socket::from_inner(sock)) + } +} + +impl AsRawFd for TcpBuilder { + fn as_raw_fd(&self) -> __wasi_fd_t { + // TODO: this unwrap() is very bad + self.as_inner().borrow().as_ref().unwrap().as_inner().raw() as __wasi_fd_t + } +} + +impl FromRawFd for UdpBuilder { + unsafe fn from_raw_fd(fd: __wasi_fd_t) -> UdpBuilder { + let sock = sys::Socket::from_inner(fd); + UdpBuilder::from_inner(Socket::from_inner(sock)) + } +} + +impl AsRawFd for UdpBuilder { + fn as_raw_fd(&self) -> __wasi_fd_t { + // TODO: this unwrap() is very bad + self.as_inner().borrow().as_ref().unwrap().as_inner().raw() as __wasi_fd_t + } +} diff --git a/third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/mod.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/mod.rs new file mode 100644 index 0000000..bbc507e --- /dev/null +++ b/third_party/cargo/vendor/net2-0.2.34/src/sys/wasi/mod.rs @@ -0,0 +1,185 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(non_camel_case_types)] +use libc::{self, c_int, __wasi_fd_t}; +use std::io; +use std::mem; +use std::net::{TcpListener, TcpStream, UdpSocket}; +use std::os::wasi::io::FromRawFd; + +mod impls; + +pub mod c { + pub use libc::*; + + pub type sa_family_t = u16; + pub type socklen_t = u32; + pub type in_port_t = u16; + + pub const SOCK_DGRAM: c_int = 0x00; + pub const SOL_SOCKET: c_int = 0x00; + pub const SO_RCVBUF: c_int = 0x00; + pub const SO_SNDBUF: c_int = 0x00; + pub const TCP_NODELAY: c_int = 0x00; + pub const IPPROTO_TCP: c_int = 0x00; + pub const SO_RCVTIMEO: c_int = 0x00; + pub const SO_SNDTIMEO: c_int = 0x00; + pub const IPPROTO_IP: c_int = 0x00; + pub const IP_TTL: c_int = 0x00; + pub const IPPROTO_IPV6: c_int = 0x00; + pub const IPV6_V6ONLY: c_int = 0x00; + pub const SO_ERROR: c_int = 0x00; + pub const SO_LINGER: c_int = 0x00; + pub const SO_BROADCAST: c_int = 0x00; + pub const IP_MULTICAST_LOOP: c_int = 0x00; + pub const IP_MULTICAST_TTL: c_int = 0x00; + pub const IPV6_MULTICAST_HOPS: c_int = 0x00; + pub const IPV6_MULTICAST_LOOP: c_int = 0x00; + pub const IP_MULTICAST_IF: c_int = 0x00; + pub const IPV6_MULTICAST_IF: c_int = 0x00; + pub const IPV6_UNICAST_HOPS: c_int = 0x00; + pub const IP_ADD_MEMBERSHIP: c_int = 0x00; + pub const IPV6_ADD_MEMBERSHIP: c_int = 0x00; + pub const IP_DROP_MEMBERSHIP: c_int = 0x00; + pub const IPV6_DROP_MEMBERSHIP: c_int = 0x00; + pub const SO_REUSEADDR: c_int = 0x00; + pub const SOCK_STREAM: c_int = 0x00; + pub const AF_INET: c_int = 0x00; + pub const AF_INET6: c_int = 0x01; + + #[repr(C)] + pub struct sockaddr_storage { + pub ss_family: sa_family_t, + } + #[repr(C)] + pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [c_char; 14], + } + + #[repr(C)] + pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: in6_addr, + pub sin6_scope_id: u32, + } + + #[repr(C)] + pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [u8; 8], + } + + #[repr(align(4))] + #[derive(Copy, Clone)] + pub struct in6_addr { + pub s6_addr: [u8; 16], + } + + #[derive(Copy, Clone)] + pub struct ipv6_mreq { + pub ipv6mr_multiaddr: in6_addr, + pub ipv6mr_interface: c_uint, + } + + pub type in_addr_t = u32; + #[derive(Copy, Clone)] + pub struct in_addr { + pub s_addr: in_addr_t, + } + + #[derive(Copy, Clone)] + pub struct linger { + pub l_onoff: c_int, + pub l_linger: c_int, + } + + #[derive(Copy, Clone)] + pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + } + + pub unsafe fn getsockname(_socket: __wasi_fd_t, _address: *mut sockaddr, + _address_len: *mut socklen_t) -> c_int { + unimplemented!() + } + pub unsafe fn connect(_socket: __wasi_fd_t, _address: *const sockaddr, + _len: socklen_t) -> c_int { + unimplemented!() + } + pub unsafe fn listen(_socket: __wasi_fd_t, _backlog: c_int) -> c_int { + unimplemented!() + } + pub unsafe fn bind(_socket: __wasi_fd_t, _address: *const sockaddr, + _address_len: socklen_t) -> c_int { + unimplemented!() + } + + pub fn sockaddr_in_u32(sa: &sockaddr_in) -> u32 { + ::ntoh((*sa).sin_addr.s_addr) + } + + pub fn in_addr_to_u32(addr: &in_addr) -> u32 { + ::ntoh(addr.s_addr) + } +} + +pub struct Socket { + fd: __wasi_fd_t, +} + +impl Socket { + pub fn new(_family: c_int, _ty: c_int) -> io::Result { + unimplemented!() + } + + pub fn raw(&self) -> libc::__wasi_fd_t { + self.fd + } + + fn into_fd(self) -> libc::__wasi_fd_t { + let fd = self.fd; + mem::forget(self); + fd + } + + pub fn into_tcp_listener(self) -> TcpListener { + unsafe { TcpListener::from_raw_fd(self.into_fd()) } + } + + pub fn into_tcp_stream(self) -> TcpStream { + unsafe { TcpStream::from_raw_fd(self.into_fd()) } + } + + pub fn into_udp_socket(self) -> UdpSocket { + unsafe { UdpSocket::from_raw_fd(self.into_fd()) } + } +} + +impl ::FromInner for Socket { + type Inner = libc::__wasi_fd_t; + fn from_inner(fd: libc::__wasi_fd_t) -> Socket { + Socket { fd: fd } + } +} + +impl Drop for Socket { + fn drop(&mut self) { + // unsafe { + // let _ = libc::close(self.fd); + // } + } +} \ No newline at end of file diff --git a/third_party/cargo/vendor/net2-0.2.33/src/sys/windows/impls.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/windows/impls.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/sys/windows/impls.rs rename to third_party/cargo/vendor/net2-0.2.34/src/sys/windows/impls.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/sys/windows/mod.rs b/third_party/cargo/vendor/net2-0.2.34/src/sys/windows/mod.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/sys/windows/mod.rs rename to third_party/cargo/vendor/net2-0.2.34/src/sys/windows/mod.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/tcp.rs b/third_party/cargo/vendor/net2-0.2.34/src/tcp.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/tcp.rs rename to third_party/cargo/vendor/net2-0.2.34/src/tcp.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/udp.rs b/third_party/cargo/vendor/net2-0.2.34/src/udp.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/udp.rs rename to third_party/cargo/vendor/net2-0.2.34/src/udp.rs diff --git a/third_party/cargo/vendor/net2-0.2.33/src/unix.rs b/third_party/cargo/vendor/net2-0.2.34/src/unix.rs similarity index 92% rename from third_party/cargo/vendor/net2-0.2.33/src/unix.rs rename to third_party/cargo/vendor/net2-0.2.34/src/unix.rs index 21dcb2a..a1e1c6f 100644 --- a/third_party/cargo/vendor/net2-0.2.33/src/unix.rs +++ b/third_party/cargo/vendor/net2-0.2.34/src/unix.rs @@ -10,7 +10,7 @@ use ext::{self, AsSock}; pub trait UnixTcpBuilderExt { /// Set value for the `SO_REUSEPORT` option on this socket. /// - /// This indicates that futher calls to `bind` may allow reuse of local + /// This indicates that further calls to `bind` may allow reuse of local /// addresses. For IPv4 sockets this means that a socket may bind even when /// there's a socket already listening on this port. fn reuse_port(&self, reuse: bool) -> io::Result<&Self>; @@ -35,7 +35,7 @@ impl UnixTcpBuilderExt for TcpBuilder { pub trait UnixUdpBuilderExt { /// Set value for the `SO_REUSEPORT` option on this socket. /// - /// This indicates that futher calls to `bind` may allow reuse of local + /// This indicates that further calls to `bind` may allow reuse of local /// addresses. For IPv4 sockets this means that a socket may bind even when /// there's a socket already listening on this port. fn reuse_port(&self, reuse: bool) -> io::Result<&Self>; diff --git a/third_party/cargo/vendor/net2-0.2.33/src/utils.rs b/third_party/cargo/vendor/net2-0.2.34/src/utils.rs similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/src/utils.rs rename to third_party/cargo/vendor/net2-0.2.34/src/utils.rs diff --git a/third_party/cargo/vendor/nix-0.14.1/BUILD b/third_party/cargo/vendor/nix-0.14.1/BUILD index 839a1a6..b8e5fdf 100644 --- a/third_party/cargo/vendor/nix-0.14.1/BUILD +++ b/third_party/cargo/vendor/nix-0.14.1/BUILD @@ -34,7 +34,7 @@ rust_library( deps = [ "//third_party/cargo/vendor/bitflags-1.2.1:bitflags", "//third_party/cargo/vendor/cfg-if-0.1.10:cfg_if", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/void-1.0.2:void", ], rustc_flags = [ diff --git a/third_party/cargo/vendor/num-rational-0.2.3/.cargo-checksum.json b/third_party/cargo/vendor/num-rational-0.2.3/.cargo-checksum.json deleted file mode 100644 index 8406b7f..0000000 --- a/third_party/cargo/vendor/num-rational-0.2.3/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"312e04a1cb878b492475ae6a2ebc260c43c5b8f804e58a129800c42ae847e6de","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"44e4759870c5e7b1b68d3ded60f655cac360e7614ad09d646cc2db35c47a502f","RELEASES.md":"4a9adcea77bb5e196a0c72d382b1c13da2aa036372002d285e4b75ca67827f2b","build.rs":"aba9dbc29eff865d95ce39cfe7cb20fde6137c7b7fae441d1b52ebb5087e402f","src/lib.rs":"0a96e23cdfafa420b620d032f93c53114d9cb1fb927f7442f13bea306ad6c56d"},"package":"da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3"} \ No newline at end of file diff --git a/third_party/cargo/vendor/num-rational-0.2.4/.cargo-checksum.json b/third_party/cargo/vendor/num-rational-0.2.4/.cargo-checksum.json new file mode 100644 index 0000000..f3d8f80 --- /dev/null +++ b/third_party/cargo/vendor/num-rational-0.2.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"15b5b2c51cedb62324d85209347b1f104bc32fa3bb8c16a4a642f2b27e93d077","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"44e4759870c5e7b1b68d3ded60f655cac360e7614ad09d646cc2db35c47a502f","RELEASES.md":"41de3744864404bfbb946e93e425a0615ae87b674ad93d27b191223b75909753","build.rs":"aba9dbc29eff865d95ce39cfe7cb20fde6137c7b7fae441d1b52ebb5087e402f","src/lib.rs":"3d47aadd8b47165ebee680250bfa097cced6b813e4ca06cb1a0e14d28501a531"},"package":"5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef"} \ No newline at end of file diff --git a/third_party/cargo/vendor/num-rational-0.2.3/BUILD b/third_party/cargo/vendor/num-rational-0.2.4/BUILD similarity index 97% rename from third_party/cargo/vendor/num-rational-0.2.3/BUILD rename to third_party/cargo/vendor/num-rational-0.2.4/BUILD index af54465..1864efd 100644 --- a/third_party/cargo/vendor/num-rational-0.2.3/BUILD +++ b/third_party/cargo/vendor/num-rational-0.2.4/BUILD @@ -38,7 +38,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.2.3", + version = "0.2.4", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/num-rational-0.2.3/Cargo.toml b/third_party/cargo/vendor/num-rational-0.2.4/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/num-rational-0.2.3/Cargo.toml rename to third_party/cargo/vendor/num-rational-0.2.4/Cargo.toml index 68df79c..dd94ea3 100644 --- a/third_party/cargo/vendor/num-rational-0.2.3/Cargo.toml +++ b/third_party/cargo/vendor/num-rational-0.2.4/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "num-rational" -version = "0.2.3" +version = "0.2.4" authors = ["The Rust Project Developers"] build = "build.rs" exclude = ["/ci/*", "/.travis.yml", "/bors.toml"] diff --git a/third_party/cargo/vendor/num-rational-0.2.3/LICENSE-APACHE b/third_party/cargo/vendor/num-rational-0.2.4/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/num-rational-0.2.3/LICENSE-APACHE rename to third_party/cargo/vendor/num-rational-0.2.4/LICENSE-APACHE diff --git a/third_party/cargo/vendor/net2-0.2.33/LICENSE-MIT b/third_party/cargo/vendor/num-rational-0.2.4/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/net2-0.2.33/LICENSE-MIT rename to third_party/cargo/vendor/num-rational-0.2.4/LICENSE-MIT diff --git a/third_party/cargo/vendor/num-rational-0.2.3/README.md b/third_party/cargo/vendor/num-rational-0.2.4/README.md similarity index 100% rename from third_party/cargo/vendor/num-rational-0.2.3/README.md rename to third_party/cargo/vendor/num-rational-0.2.4/README.md diff --git a/third_party/cargo/vendor/num-rational-0.2.3/RELEASES.md b/third_party/cargo/vendor/num-rational-0.2.4/RELEASES.md similarity index 92% rename from third_party/cargo/vendor/num-rational-0.2.3/RELEASES.md rename to third_party/cargo/vendor/num-rational-0.2.4/RELEASES.md index 0551af0..6094226 100644 --- a/third_party/cargo/vendor/num-rational-0.2.3/RELEASES.md +++ b/third_party/cargo/vendor/num-rational-0.2.4/RELEASES.md @@ -1,3 +1,11 @@ +# Release 0.2.4 (2020-03-17) + +- [Fixed `CheckedDiv` when both dividend and divisor are 0][74]. +- [Fixed `CheckedDiv` with `min_value()` numerators][76]. + +[74]: https://github.com/rust-num/num-rational/pull/74 +[76]: https://github.com/rust-num/num-rational/pull/76 + # Release 0.2.3 (2020-01-09) - [`Ratio` now performs earlier reductions to avoid overflow with `+-*/%` operators][42]. diff --git a/third_party/cargo/vendor/num-rational-0.2.3/build.rs b/third_party/cargo/vendor/num-rational-0.2.4/build.rs similarity index 100% rename from third_party/cargo/vendor/num-rational-0.2.3/build.rs rename to third_party/cargo/vendor/num-rational-0.2.4/build.rs diff --git a/third_party/cargo/vendor/num-rational-0.2.3/src/lib.rs b/third_party/cargo/vendor/num-rational-0.2.4/src/lib.rs similarity index 92% rename from third_party/cargo/vendor/num-rational-0.2.3/src/lib.rs rename to third_party/cargo/vendor/num-rational-0.2.4/src/lib.rs index 87380d2..4f21f57 100644 --- a/third_party/cargo/vendor/num-rational-0.2.3/src/lib.rs +++ b/third_party/cargo/vendor/num-rational-0.2.4/src/lib.rs @@ -108,9 +108,6 @@ impl Ratio { /// Creates a new `Ratio`. Fails if `denom` is zero. #[inline] pub fn new(numer: T, denom: T) -> Ratio { - if denom.is_zero() { - panic!("denominator == 0"); - } let mut ret = Ratio::new_raw(numer, denom); ret.reduce(); ret @@ -136,6 +133,17 @@ impl Ratio { /// Puts self into lowest terms, with denom > 0. fn reduce(&mut self) { + if self.denom.is_zero() { + panic!("denominator == 0"); + } + if self.numer.is_zero() { + self.denom.set_one(); + return; + } + if self.numer == self.denom { + self.set_one(); + return; + } let g: T = self.numer.gcd(&self.denom); // FIXME(#5992): assignment operator overloads @@ -872,17 +880,44 @@ where { #[inline] fn checked_div(&self, rhs: &Ratio) -> Option> { - let gcd_ac = self.numer.gcd(&rhs.numer); - let gcd_bd = self.denom.gcd(&rhs.denom); - let denom = otry!((self.denom.clone() / gcd_bd.clone()) - .checked_mul(&(rhs.numer.clone() / gcd_ac.clone()))); - if denom.is_zero() { + if rhs.is_zero() { return None; } - Some(Ratio::new( - otry!((self.numer.clone() / gcd_ac).checked_mul(&(rhs.denom.clone() / gcd_bd))), - denom, - )) + let (numer, denom) = if self.denom == rhs.denom { + (self.numer.clone(), rhs.numer.clone()) + } else if self.numer == rhs.numer { + (rhs.denom.clone(), self.denom.clone()) + } else { + let gcd_ac = self.numer.gcd(&rhs.numer); + let gcd_bd = self.denom.gcd(&rhs.denom); + let denom = otry!((self.denom.clone() / gcd_bd.clone()) + .checked_mul(&(rhs.numer.clone() / gcd_ac.clone()))); + ( + otry!((self.numer.clone() / gcd_ac).checked_mul(&(rhs.denom.clone() / gcd_bd))), + denom, + ) + }; + // Manual `reduce()`, avoiding sharp edges + if denom.is_zero() { + None + } else if numer.is_zero() { + Some(Self::zero()) + } else if numer == denom { + Some(Self::one()) + } else { + let g = numer.gcd(&denom); + let numer = numer / g.clone(); + let denom = denom / g; + let raw = if denom < T::zero() { + // We need to keep denom positive, but 2's-complement MIN may + // overflow negation -- instead we can check multiplying -1. + let n1 = T::zero() - T::one(); + Ratio::new_raw(otry!(numer.checked_mul(&n1)), otry!(denom.checked_mul(&n1))) + } else { + Ratio::new_raw(numer, denom) + }; + Some(raw) + } } } @@ -1086,17 +1121,17 @@ impl FromStr for Ratio { fn from_str(s: &str) -> Result, ParseRatioError> { let mut split = s.splitn(2, '/'); - let n = try!(split.next().ok_or(ParseRatioError { - kind: RatioErrorKind::ParseError - })); - let num = try!(FromStr::from_str(n).map_err(|_| ParseRatioError { - kind: RatioErrorKind::ParseError - })); + let n = split.next().ok_or(ParseRatioError { + kind: RatioErrorKind::ParseError, + })?; + let num = FromStr::from_str(n).map_err(|_| ParseRatioError { + kind: RatioErrorKind::ParseError, + })?; let d = split.next().unwrap_or("1"); - let den = try!(FromStr::from_str(d).map_err(|_| ParseRatioError { - kind: RatioErrorKind::ParseError - })); + let den = FromStr::from_str(d).map_err(|_| ParseRatioError { + kind: RatioErrorKind::ParseError, + })?; if Zero::is_zero(&den) { Err(ParseRatioError { @@ -1403,6 +1438,7 @@ mod test { use core::f64; use core::i32; + use core::isize; use core::str::FromStr; use integer::Integer; use traits::{FromPrimitive, One, Pow, Signed, Zero}; @@ -1439,6 +1475,22 @@ mod test { numer: -2, denom: 3, }; + pub const _MIN: Rational = Ratio { + numer: isize::MIN, + denom: 1, + }; + pub const _MIN_P1: Rational = Ratio { + numer: isize::MIN + 1, + denom: 1, + }; + pub const _MAX: Rational = Ratio { + numer: isize::MAX, + denom: 1, + }; + pub const _MAX_M1: Rational = Ratio { + numer: isize::MAX - 1, + denom: 1, + }; #[cfg(feature = "bigint")] pub fn to_big(n: Rational) -> BigRational { @@ -1469,9 +1521,9 @@ mod test { #[test] fn test_new_reduce() { - let one22 = Ratio::new(2, 2); - - assert_eq!(one22, One::one()); + assert_eq!(Ratio::new(2, 2), One::one()); + assert_eq!(Ratio::new(0, i32::MIN), Zero::zero()); + assert_eq!(Ratio::new(i32::MIN, i32::MIN), One::one()); } #[test] #[should_panic] @@ -1628,7 +1680,7 @@ mod test { mod arith { use super::super::{Ratio, Rational}; - use super::{to_big, _0, _1, _1_2, _2, _3_2, _5_2, _NEG1_2}; + use super::{to_big, _0, _1, _1_2, _2, _3_2, _5_2, _MAX, _MAX_M1, _MIN, _MIN_P1, _NEG1_2}; use core::fmt::Debug; use integer::Integer; use traits::{Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedSub, NumAssign}; @@ -2061,6 +2113,77 @@ mod test { assert_eq!(small.checked_div(&big), None); assert_eq!(_1.checked_div(&_0), None); } + + #[test] + fn test_checked_zeros() { + assert_eq!(_0.checked_add(&_0), Some(_0)); + assert_eq!(_0.checked_sub(&_0), Some(_0)); + assert_eq!(_0.checked_mul(&_0), Some(_0)); + assert_eq!(_0.checked_div(&_0), None); + } + + #[test] + fn test_checked_min() { + assert_eq!(_MIN.checked_add(&_MIN), None); + assert_eq!(_MIN.checked_sub(&_MIN), Some(_0)); + assert_eq!(_MIN.checked_mul(&_MIN), None); + assert_eq!(_MIN.checked_div(&_MIN), Some(_1)); + assert_eq!(_0.checked_add(&_MIN), Some(_MIN)); + assert_eq!(_0.checked_sub(&_MIN), None); + assert_eq!(_0.checked_mul(&_MIN), Some(_0)); + assert_eq!(_0.checked_div(&_MIN), Some(_0)); + assert_eq!(_1.checked_add(&_MIN), Some(_MIN_P1)); + assert_eq!(_1.checked_sub(&_MIN), None); + assert_eq!(_1.checked_mul(&_MIN), Some(_MIN)); + assert_eq!(_1.checked_div(&_MIN), None); + assert_eq!(_MIN.checked_add(&_0), Some(_MIN)); + assert_eq!(_MIN.checked_sub(&_0), Some(_MIN)); + assert_eq!(_MIN.checked_mul(&_0), Some(_0)); + assert_eq!(_MIN.checked_div(&_0), None); + assert_eq!(_MIN.checked_add(&_1), Some(_MIN_P1)); + assert_eq!(_MIN.checked_sub(&_1), None); + assert_eq!(_MIN.checked_mul(&_1), Some(_MIN)); + assert_eq!(_MIN.checked_div(&_1), Some(_MIN)); + } + + #[test] + fn test_checked_max() { + assert_eq!(_MAX.checked_add(&_MAX), None); + assert_eq!(_MAX.checked_sub(&_MAX), Some(_0)); + assert_eq!(_MAX.checked_mul(&_MAX), None); + assert_eq!(_MAX.checked_div(&_MAX), Some(_1)); + assert_eq!(_0.checked_add(&_MAX), Some(_MAX)); + assert_eq!(_0.checked_sub(&_MAX), Some(_MIN_P1)); + assert_eq!(_0.checked_mul(&_MAX), Some(_0)); + assert_eq!(_0.checked_div(&_MAX), Some(_0)); + assert_eq!(_1.checked_add(&_MAX), None); + assert_eq!(_1.checked_sub(&_MAX), Some(-_MAX_M1)); + assert_eq!(_1.checked_mul(&_MAX), Some(_MAX)); + assert_eq!(_1.checked_div(&_MAX), Some(_MAX.recip())); + assert_eq!(_MAX.checked_add(&_0), Some(_MAX)); + assert_eq!(_MAX.checked_sub(&_0), Some(_MAX)); + assert_eq!(_MAX.checked_mul(&_0), Some(_0)); + assert_eq!(_MAX.checked_div(&_0), None); + assert_eq!(_MAX.checked_add(&_1), None); + assert_eq!(_MAX.checked_sub(&_1), Some(_MAX_M1)); + assert_eq!(_MAX.checked_mul(&_1), Some(_MAX)); + assert_eq!(_MAX.checked_div(&_1), Some(_MAX)); + } + + #[test] + fn test_checked_min_max() { + assert_eq!(_MIN.checked_add(&_MAX), Some(-_1)); + assert_eq!(_MIN.checked_sub(&_MAX), None); + assert_eq!(_MIN.checked_mul(&_MAX), None); + assert_eq!( + _MIN.checked_div(&_MAX), + Some(Ratio::new(_MIN.numer, _MAX.numer)) + ); + assert_eq!(_MAX.checked_add(&_MIN), Some(-_1)); + assert_eq!(_MAX.checked_sub(&_MIN), None); + assert_eq!(_MAX.checked_mul(&_MIN), None); + assert_eq!(_MAX.checked_div(&_MIN), None); + } } #[test] diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/.cargo-checksum.json b/third_party/cargo/vendor/num_cpus-1.12.0/.cargo-checksum.json deleted file mode 100644 index ad68cc1..0000000 --- a/third_party/cargo/vendor/num_cpus-1.12.0/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"a2123abd3878019668c6afc950368eec5ef43340e6b3ac46b8ab0d8c453d484c","CONTRIBUTING.md":"2390961aab1bba026135338da1216b6cc828dfaeed9357d9c155c55a252d3efb","Cargo.lock":"f5c0b7fa74b62758d16a9c0473ceebd45e57b7a7d61391d147b70abb53c21e36","Cargo.toml":"fa31772b1643d482a785c1b78b581a377d408ffe9715c8b2d45d80f6c7d09f62","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0593d22d122d4bfec6407115e3907546312976f75473417aaa4c57ecd2095ae6","README.md":"12451d6905fe9cdac206410de8071b562e5ea936b6e55a19ac97982831a0fcdb","examples/values.rs":"46c833324b7339d359054c4f8e8284259e860df206c552c63b5893ade59c16a6","src/lib.rs":"f0f45c2b20071c0cd947da3664330d696c0d33ed50352e182ea2ff4792a663b9"},"package":"46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"} \ No newline at end of file diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/.cargo-checksum.json b/third_party/cargo/vendor/num_cpus-1.13.0/.cargo-checksum.json new file mode 100644 index 0000000..52bdee1 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"648196d9fad2d62618f5778dab9127cf6bb801e3a432d72179f118350d36ff23","CONTRIBUTING.md":"2390961aab1bba026135338da1216b6cc828dfaeed9357d9c155c55a252d3efb","Cargo.lock":"a7cbc6156b3b0ed9e8afdaae9668067e86aaeafc237f99c87e7fda76d8032c24","Cargo.toml":"08fed4ec7fac699f408ef1abdd39b1a6294b2c015cfe859eedbbb4c286bb7912","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0593d22d122d4bfec6407115e3907546312976f75473417aaa4c57ecd2095ae6","README.md":"12451d6905fe9cdac206410de8071b562e5ea936b6e55a19ac97982831a0fcdb","ci/cgroups/Dockerfile":"b018cda01776cabe033af06a22c5ad337c90c07fdb8093e94857f2fc5a0b2bdb","examples/values.rs":"46c833324b7339d359054c4f8e8284259e860df206c552c63b5893ade59c16a6","fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us":"d2ace393dc9388863d75d8de140df516d7ffe4aa7ed2f9a545aa71c9930d6638","fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us":"7ccd86cde0b22ffc2318f2509726d2a13053f6973e96dc5ca6965a56497e485e","fixtures/cgroups/cgroups/good/cpu.cfs_period_us":"d2ace393dc9388863d75d8de140df516d7ffe4aa7ed2f9a545aa71c9930d6638","fixtures/cgroups/cgroups/good/cpu.cfs_quota_us":"cdc3397c35d915e5fe61f8d2bdedcae00a225d55cc6b090580cde1b71c63463b","fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us":"74d01a0c051c963d9a9b8ab9dbeab1723f0ad8534ea9fa6a942f358d7fa011b4","fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us":"1e6ffd8a95fab538ddd645a767e8cc505722d5c8aaf008969f2ed8ab753ff61e","fixtures/cgroups/proc/cgroups/cgroup":"6812299a4409bfd831ed751fdbbfdd9c5749f69acd7b14c5b0a704271a1f74c6","fixtures/cgroups/proc/cgroups/mountinfo":"3187b0b1c0fa192790abced7d435190e8979059186055688e4c3c2ca013398c6","src/lib.rs":"e1ce45ba3b2655fabb49ea0af50080808fd305c884d79cb4b9527198dab828ac","src/linux.rs":"c10382e85a4b196d6fd9a481d9b3d5978b8bb18eaeb7670716ced7d71b919f5e"},"package":"05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"} \ No newline at end of file diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/BUILD b/third_party/cargo/vendor/num_cpus-1.13.0/BUILD similarity index 91% rename from third_party/cargo/vendor/num_cpus-1.12.0/BUILD rename to third_party/cargo/vendor/num_cpus-1.13.0/BUILD index 3e50bdc..7620e83 100644 --- a/third_party/cargo/vendor/num_cpus-1.12.0/BUILD +++ b/third_party/cargo/vendor/num_cpus-1.13.0/BUILD @@ -31,12 +31,12 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", ], - version = "1.12.0", + version = "1.13.0", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/CHANGELOG.md b/third_party/cargo/vendor/num_cpus-1.13.0/CHANGELOG.md similarity index 95% rename from third_party/cargo/vendor/num_cpus-1.12.0/CHANGELOG.md rename to third_party/cargo/vendor/num_cpus-1.13.0/CHANGELOG.md index 5c433df..0caafb2 100644 --- a/third_party/cargo/vendor/num_cpus-1.12.0/CHANGELOG.md +++ b/third_party/cargo/vendor/num_cpus-1.13.0/CHANGELOG.md @@ -1,3 +1,9 @@ +## v1.13.0 + +### Features + +- add Linux cgroups support when calling `get()`. + ## v1.12.0 #### Fixes diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/CONTRIBUTING.md b/third_party/cargo/vendor/num_cpus-1.13.0/CONTRIBUTING.md similarity index 100% rename from third_party/cargo/vendor/num_cpus-1.12.0/CONTRIBUTING.md rename to third_party/cargo/vendor/num_cpus-1.13.0/CONTRIBUTING.md diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/Cargo.lock b/third_party/cargo/vendor/num_cpus-1.13.0/Cargo.lock similarity index 71% rename from third_party/cargo/vendor/num_cpus-1.12.0/Cargo.lock rename to third_party/cargo/vendor/num_cpus-1.13.0/Cargo.lock index 83f53bc..62c701c 100644 --- a/third_party/cargo/vendor/num_cpus-1.12.0/Cargo.lock +++ b/third_party/cargo/vendor/num_cpus-1.13.0/Cargo.lock @@ -1,10 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "doc-comment" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "hermit-abi" version = "0.1.3" @@ -20,14 +15,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "num_cpus" -version = "1.12.0" +version = "1.13.0" dependencies = [ - "doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] -"checksum doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "923dea538cea0aa3025e8685b20d6ee21ef99c4f77e954a30febbaac5ec73a97" "checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120" "checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/Cargo.toml b/third_party/cargo/vendor/num_cpus-1.13.0/Cargo.toml similarity index 94% rename from third_party/cargo/vendor/num_cpus-1.12.0/Cargo.toml rename to third_party/cargo/vendor/num_cpus-1.13.0/Cargo.toml index 949e0fe..0bab66d 100644 --- a/third_party/cargo/vendor/num_cpus-1.12.0/Cargo.toml +++ b/third_party/cargo/vendor/num_cpus-1.13.0/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "num_cpus" -version = "1.12.0" +version = "1.13.0" authors = ["Sean McArthur "] description = "Get the number of CPUs on a machine." documentation = "https://docs.rs/num_cpus" @@ -23,7 +23,5 @@ license = "MIT/Apache-2.0" repository = "https://github.com/seanmonstar/num_cpus" [dependencies.libc] version = "0.2.26" -[dev-dependencies.doc-comment] -version = "0.3" [target."cfg(all(any(target_arch = \"x86_64\", target_arch = \"aarch64\"), target_os = \"hermit\"))".dependencies.hermit-abi] version = "0.1.3" diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/LICENSE-APACHE b/third_party/cargo/vendor/num_cpus-1.13.0/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/num_cpus-1.12.0/LICENSE-APACHE rename to third_party/cargo/vendor/num_cpus-1.13.0/LICENSE-APACHE diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/LICENSE-MIT b/third_party/cargo/vendor/num_cpus-1.13.0/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/num_cpus-1.12.0/LICENSE-MIT rename to third_party/cargo/vendor/num_cpus-1.13.0/LICENSE-MIT diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/README.md b/third_party/cargo/vendor/num_cpus-1.13.0/README.md similarity index 100% rename from third_party/cargo/vendor/num_cpus-1.12.0/README.md rename to third_party/cargo/vendor/num_cpus-1.13.0/README.md diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/ci/cgroups/Dockerfile b/third_party/cargo/vendor/num_cpus-1.13.0/ci/cgroups/Dockerfile new file mode 100644 index 0000000..d5f288a --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/ci/cgroups/Dockerfile @@ -0,0 +1,9 @@ +FROM rust:1.40 + +WORKDIR /usr/num_cpus + +COPY . . + +RUN cargo build + +CMD [ "cargo", "test", "--lib" ] diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/examples/values.rs b/third_party/cargo/vendor/num_cpus-1.13.0/examples/values.rs similarity index 100% rename from third_party/cargo/vendor/num_cpus-1.12.0/examples/values.rs rename to third_party/cargo/vendor/num_cpus-1.13.0/examples/values.rs diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us new file mode 100644 index 0000000..022f514 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_period_us @@ -0,0 +1,2 @@ +100000 + diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us new file mode 100644 index 0000000..cb2bf3e --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/ceil/cpu.cfs_quota_us @@ -0,0 +1,2 @@ +150000 + diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_period_us b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_period_us new file mode 100644 index 0000000..022f514 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_period_us @@ -0,0 +1,2 @@ +100000 + diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_quota_us b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_quota_us new file mode 100644 index 0000000..16e37df --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/good/cpu.cfs_quota_us @@ -0,0 +1,2 @@ +600000 + diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us new file mode 100644 index 0000000..77ac542 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_period_us @@ -0,0 +1,2 @@ +0 + diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us new file mode 100644 index 0000000..26f3b3d --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/cgroups/zero-period/cpu.cfs_quota_us @@ -0,0 +1 @@ +600000 diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/cgroup b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/cgroup new file mode 100644 index 0000000..a47f047 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/cgroup @@ -0,0 +1,3 @@ +12:perf_event:/ +11:cpu,cpuacct:/ +3:devices:/user.slice diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/mountinfo b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/mountinfo new file mode 100644 index 0000000..37f4e25 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/fixtures/cgroups/proc/cgroups/mountinfo @@ -0,0 +1,8 @@ +1 0 8:1 / / rw,noatime shared:1 - ext4 /dev/sda1 rw,errors=remount-ro,data=reordered +2 1 0:1 / /dev rw,relatime shared:2 - devtmpfs udev rw,size=10240k,nr_inodes=16487629,mode=755 +3 1 0:2 / /proc rw,nosuid,nodev,noexec,relatime shared:3 - proc proc rw +4 1 0:3 / /sys rw,nosuid,nodev,noexec,relatime shared:4 - sysfs sysfs rw +5 4 0:4 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:5 - tmpfs tmpfs ro,mode=755 +6 5 0:5 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:6 - cgroup cgroup rw,cpuset +7 5 0:6 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:7 - cgroup cgroup rw,cpu,cpuacct +8 5 0:7 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,memory diff --git a/third_party/cargo/vendor/num_cpus-1.12.0/src/lib.rs b/third_party/cargo/vendor/num_cpus-1.13.0/src/lib.rs similarity index 85% rename from third_party/cargo/vendor/num_cpus-1.12.0/src/lib.rs rename to third_party/cargo/vendor/num_cpus-1.13.0/src/lib.rs index 807af39..6c8280f 100644 --- a/third_party/cargo/vendor/num_cpus-1.12.0/src/lib.rs +++ b/third_party/cargo/vendor/num_cpus-1.13.0/src/lib.rs @@ -28,7 +28,7 @@ //! [`rayon::ThreadPool`]: https://docs.rs/rayon/1.*/rayon/struct.ThreadPool.html #![cfg_attr(test, deny(warnings))] #![deny(missing_docs)] -#![doc(html_root_url = "https://docs.rs/num_cpus/1.12.0")] +#![doc(html_root_url = "https://docs.rs/num_cpus/1.13.0")] #![allow(non_snake_case)] #[cfg(not(windows))] @@ -37,12 +37,10 @@ extern crate libc; #[cfg(target_os = "hermit")] extern crate hermit_abi; -#[cfg(test)] -#[macro_use] -extern crate doc_comment; - -#[cfg(test)] -doctest!("../README.md"); +#[cfg(target_os = "linux")] +mod linux; +#[cfg(target_os = "linux")] +use linux::{get_num_cpus, get_num_physical_cpus}; /// Returns the number of available CPUs of the current system. /// @@ -62,11 +60,14 @@ doctest!("../README.md"); /// /// # Note /// -/// This will check [sched affinity] on Linux, showing a lower number of CPUs if the current -/// thread does not have access to all the computer's CPUs. +/// This will check [sched affinity] on Linux, showing a lower number of CPUs if the current +/// thread does not have access to all the computer's CPUs. +/// +/// This will also check [cgroups], frequently used in containers to constrain CPU usage. /// /// [smt]: https://en.wikipedia.org/wiki/Simultaneous_multithreading /// [sched affinity]: http://www.gnu.org/software/libc/manual/html_node/CPU-Affinity.html +/// [cgroups]: https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt #[inline] pub fn get() -> usize { get_num_cpus() @@ -196,56 +197,6 @@ fn get_num_physical_cpus_windows() -> Option { } } -#[cfg(target_os = "linux")] -fn get_num_physical_cpus() -> usize { - use std::collections::HashMap; - use std::fs::File; - use std::io::BufRead; - use std::io::BufReader; - - let file = match File::open("/proc/cpuinfo") { - Ok(val) => val, - Err(_) => return get_num_cpus(), - }; - let reader = BufReader::new(file); - let mut map = HashMap::new(); - let mut physid: u32 = 0; - let mut cores: usize = 0; - let mut chgcount = 0; - for line in reader.lines().filter_map(|result| result.ok()) { - let mut it = line.split(':'); - let (key, value) = match (it.next(), it.next()) { - (Some(key), Some(value)) => (key.trim(), value.trim()), - _ => continue, - }; - if key == "physical id" { - match value.parse() { - Ok(val) => physid = val, - Err(_) => break, - }; - chgcount += 1; - } - if key == "cpu cores" { - match value.parse() { - Ok(val) => cores = val, - Err(_) => break, - }; - chgcount += 1; - } - if chgcount == 2 { - map.insert(physid, cores); - chgcount = 0; - } - } - let count = map.into_iter().fold(0, |acc, (_, cores)| acc + cores); - - if count == 0 { - get_num_cpus() - } else { - count - } -} - #[cfg(windows)] fn get_num_cpus() -> usize { #[repr(C)] @@ -373,27 +324,6 @@ fn get_num_physical_cpus() -> usize { cpus as usize } -#[cfg(target_os = "linux")] -fn get_num_cpus() -> usize { - let mut set: libc::cpu_set_t = unsafe { std::mem::zeroed() }; - if unsafe { libc::sched_getaffinity(0, std::mem::size_of::(), &mut set) } == 0 { - let mut count: u32 = 0; - for i in 0..libc::CPU_SETSIZE as usize { - if unsafe { libc::CPU_ISSET(i, &set) } { - count += 1 - } - } - count as usize - } else { - let cpus = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) }; - if cpus < 1 { - 1 - } else { - cpus as usize - } - } -} - #[cfg(any( target_os = "nacl", target_os = "macos", diff --git a/third_party/cargo/vendor/num_cpus-1.13.0/src/linux.rs b/third_party/cargo/vendor/num_cpus-1.13.0/src/linux.rs new file mode 100644 index 0000000..671a943 --- /dev/null +++ b/third_party/cargo/vendor/num_cpus-1.13.0/src/linux.rs @@ -0,0 +1,414 @@ +use std::collections::HashMap; +use std::fs::File; +use std::io::{BufRead, BufReader, Read}; +use std::mem; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::Once; + +use libc; + +macro_rules! debug { + ($($args:expr),*) => ({ + if false { + //if true { + println!($($args),*); + } + }); +} + +macro_rules! some { + ($e:expr) => ({ + match $e { + Some(v) => v, + None => { + debug!("NONE: {:?}", stringify!($e)); + return None; + } + } + }) +} + +pub fn get_num_cpus() -> usize { + match cgroups_num_cpus() { + Some(n) => n, + None => logical_cpus(), + } +} + +fn logical_cpus() -> usize { + let mut set: libc::cpu_set_t = unsafe { mem::zeroed() }; + if unsafe { libc::sched_getaffinity(0, mem::size_of::(), &mut set) } == 0 { + let mut count: u32 = 0; + for i in 0..libc::CPU_SETSIZE as usize { + if unsafe { libc::CPU_ISSET(i, &set) } { + count += 1 + } + } + count as usize + } else { + let cpus = unsafe { libc::sysconf(libc::_SC_NPROCESSORS_ONLN) }; + if cpus < 1 { + 1 + } else { + cpus as usize + } + } +} + +pub fn get_num_physical_cpus() -> usize { + let file = match File::open("/proc/cpuinfo") { + Ok(val) => val, + Err(_) => return get_num_cpus(), + }; + let reader = BufReader::new(file); + let mut map = HashMap::new(); + let mut physid: u32 = 0; + let mut cores: usize = 0; + let mut chgcount = 0; + for line in reader.lines().filter_map(|result| result.ok()) { + let mut it = line.split(':'); + let (key, value) = match (it.next(), it.next()) { + (Some(key), Some(value)) => (key.trim(), value.trim()), + _ => continue, + }; + if key == "physical id" { + match value.parse() { + Ok(val) => physid = val, + Err(_) => break, + }; + chgcount += 1; + } + if key == "cpu cores" { + match value.parse() { + Ok(val) => cores = val, + Err(_) => break, + }; + chgcount += 1; + } + if chgcount == 2 { + map.insert(physid, cores); + chgcount = 0; + } + } + let count = map.into_iter().fold(0, |acc, (_, cores)| acc + cores); + + if count == 0 { + get_num_cpus() + } else { + count + } +} + +/// Cached CPUs calculated from cgroups. +/// +/// If 0, check logical cpus. +// Allow deprecation warnings, we want to work on older rustc +#[allow(warnings)] +static CGROUPS_CPUS: AtomicUsize = ::std::sync::atomic::ATOMIC_USIZE_INIT; + +fn cgroups_num_cpus() -> Option { + #[allow(warnings)] + static ONCE: Once = ::std::sync::ONCE_INIT; + + ONCE.call_once(init_cgroups); + + let cpus = CGROUPS_CPUS.load(Ordering::Acquire); + + if cpus > 0 { + Some(cpus) + } else { + None + } +} + +fn init_cgroups() { + // Should only be called once + debug_assert!(CGROUPS_CPUS.load(Ordering::SeqCst) == 0); + + match load_cgroups("/proc/self/cgroup", "/proc/self/mountinfo") { + Some(quota) => { + if quota == 0 { + return; + } + + let logical = logical_cpus(); + let count = ::std::cmp::min(quota, logical); + + CGROUPS_CPUS.store(count, Ordering::SeqCst); + } + None => return, + } +} + +fn load_cgroups(cgroup_proc: P1, mountinfo_proc: P2) -> Option +where + P1: AsRef, + P2: AsRef, +{ + let subsys = some!(Subsys::load_cpu(cgroup_proc)); + let mntinfo = some!(MountInfo::load_cpu(mountinfo_proc)); + let cgroup = some!(Cgroup::translate(mntinfo, subsys)); + cgroup.cpu_quota() +} + +struct Cgroup { + base: PathBuf, +} + +struct MountInfo { + root: String, + mount_point: String, +} + +struct Subsys { + base: String, +} + +impl Cgroup { + fn new(dir: PathBuf) -> Cgroup { + Cgroup { + base: dir, + } + } + + fn translate(mntinfo: MountInfo, subsys: Subsys) -> Option { + // Translate the subsystem directory via the host paths. + debug!( + "subsys = {:?}; root = {:?}; mount_point = {:?}", + subsys.base, + mntinfo.root, + mntinfo.mount_point + ); + + let rel_from_root = some!(Path::new(&subsys.base).strip_prefix(&mntinfo.root).ok()); + + debug!("rel_from_root: {:?}", rel_from_root); + + // join(mp.MountPoint, relPath) + let mut path = PathBuf::from(mntinfo.mount_point); + path.push(rel_from_root); + Some(Cgroup::new(path)) + } + + fn cpu_quota(&self) -> Option { + let quota_us = some!(self.quota_us()); + let period_us = some!(self.period_us()); + + // protect against dividing by zero + if period_us == 0 { + return None; + } + + // Ceil the division, since we want to be able to saturate + // the available CPUs, and flooring would leave a CPU un-utilized. + + Some((quota_us as f64 / period_us as f64).ceil() as usize) + } + + fn quota_us(&self) -> Option { + self.param("cpu.cfs_quota_us") + } + + fn period_us(&self) -> Option { + self.param("cpu.cfs_period_us") + } + + fn param(&self, param: &str) -> Option { + let mut file = some!(File::open(self.base.join(param)).ok()); + + let mut buf = String::new(); + some!(file.read_to_string(&mut buf).ok()); + + buf.trim().parse().ok() + } +} + +impl MountInfo { + fn load_cpu>(proc_path: P) -> Option { + let file = some!(File::open(proc_path).ok()); + let file = BufReader::new(file); + + file.lines() + .filter_map(|result| result.ok()) + .filter_map(MountInfo::parse_line) + .next() + } + + fn parse_line(line: String) -> Option { + let mut fields = line.split(' '); + + let mnt_root = some!(fields.nth(3)); + let mnt_point = some!(fields.nth(0)); + + if fields.nth(3) != Some("cgroup") { + return None; + } + + let super_opts = some!(fields.nth(1)); + + // We only care about the 'cpu' option + if !super_opts.split(',').any(|opt| opt == "cpu") { + return None; + } + + Some(MountInfo { + root: mnt_root.to_owned(), + mount_point: mnt_point.to_owned(), + }) + } +} + +impl Subsys { + fn load_cpu>(proc_path: P) -> Option { + let file = some!(File::open(proc_path).ok()); + let file = BufReader::new(file); + + file.lines() + .filter_map(|result| result.ok()) + .filter_map(Subsys::parse_line) + .next() + } + + fn parse_line(line: String) -> Option { + // Example format: + // 11:cpu,cpuacct:/ + let mut fields = line.split(':'); + + let sub_systems = some!(fields.nth(1)); + + if !sub_systems.split(',').any(|sub| sub == "cpu") { + return None; + } + + fields.next().map(|path| Subsys { base: path.to_owned() }) + } +} + +#[cfg(test)] +mod tests { + use std::path::{Path, PathBuf}; + use super::{Cgroup, MountInfo, Subsys}; + + + static FIXTURES_PROC: &'static str = "fixtures/cgroups/proc/cgroups"; + + static FIXTURES_CGROUPS: &'static str = "fixtures/cgroups/cgroups"; + + macro_rules! join { + ($base:expr, $($path:expr),+) => ({ + Path::new($base) + $(.join($path))+ + }) + } + + #[test] + fn test_load_mountinfo() { + let path = join!(FIXTURES_PROC, "mountinfo"); + + let mnt_info = MountInfo::load_cpu(path).unwrap(); + + assert_eq!(mnt_info.root, "/"); + assert_eq!(mnt_info.mount_point, "/sys/fs/cgroup/cpu,cpuacct"); + } + + #[test] + fn test_load_subsys() { + let path = join!(FIXTURES_PROC, "cgroup"); + + let subsys = Subsys::load_cpu(path).unwrap(); + + assert_eq!(subsys.base, "/"); + } + + #[test] + fn test_cgroup_mount() { + let cases = &[ + ( + "/", + "/sys/fs/cgroup/cpu", + "/", + Some("/sys/fs/cgroup/cpu"), + ), + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/docker/01abcd", + Some("/sys/fs/cgroup/cpu"), + ), + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/docker/01abcd/", + Some("/sys/fs/cgroup/cpu"), + ), + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/docker/01abcd/large", + Some("/sys/fs/cgroup/cpu/large"), + ), + + // fails + + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/", + None, + ), + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/docker", + None, + ), + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/elsewhere", + None, + ), + ( + "/docker/01abcd", + "/sys/fs/cgroup/cpu", + "/docker/01abcd-other-dir", + None, + ), + ]; + + for &(root, mount_point, subsys, expected) in cases.iter() { + let mnt_info = MountInfo { + root: root.into(), + mount_point: mount_point.into(), + }; + let subsys = Subsys { + base: subsys.into(), + }; + + let actual = Cgroup::translate(mnt_info, subsys).map(|c| c.base); + let expected = expected.map(|s| PathBuf::from(s)); + assert_eq!(actual, expected); + } + } + + #[test] + fn test_cgroup_cpu_quota() { + let cgroup = Cgroup::new(join!(FIXTURES_CGROUPS, "good")); + assert_eq!(cgroup.cpu_quota(), Some(6)); + } + + #[test] + fn test_cgroup_cpu_quota_divide_by_zero() { + let cgroup = Cgroup::new(join!(FIXTURES_CGROUPS, "zero-period")); + assert!(cgroup.quota_us().is_some()); + assert_eq!(cgroup.period_us(), Some(0)); + assert_eq!(cgroup.cpu_quota(), None); + } + + #[test] + fn test_cgroup_cpu_quota_ceil() { + let cgroup = Cgroup::new(join!(FIXTURES_CGROUPS, "ceil")); + assert_eq!(cgroup.cpu_quota(), Some(2)); + } +} diff --git a/third_party/cargo/vendor/num_enum-0.4.3/.cargo-checksum.json b/third_party/cargo/vendor/num_enum-0.4.3/.cargo-checksum.json new file mode 100644 index 0000000..07f6b1d --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"9283f1938e47fd92815eff171ba5e840fe1075ff74bf696f7e959871feed21cd","LICENSE":"0be96d891d00e0ae0df75d7f3289b12871c000a1f5ac744f3b570768d4bb277c","README.md":"c4e3d50d2a7331b7732a7c89f01b4fd7a08c02b7dfa1aa664eed5726597d2c9a","src/lib.rs":"341fbe980dd687d048a8c7e3c68492b254253fb653958bb978a9a0d90aa355f5","tests/lib.rs":"83895d886f80f9e55dcecec93d0b0a142aae095030236d45cd4072f751950583","tests/renamed_num_enum.rs":"f6720717475c81f8c07a03936824dce6fba279866133614093f869bd615e2e8e"},"package":"ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4"} \ No newline at end of file diff --git a/third_party/cargo/vendor/num_enum-0.4.3/BUILD b/third_party/cargo/vendor/num_enum-0.4.3/BUILD new file mode 100644 index 0000000..7edcc30 --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/BUILD @@ -0,0 +1,48 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "BSD-3-Clause" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "lib" with type "test" omitted + +rust_library( + name = "num_enum", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/derivative-2.1.1:derivative", + "//third_party/cargo/vendor/num_enum_derive-0.4.3:num_enum_derive", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.4.3", + crate_features = [ + "default", + "std", + ], +) + +# Unsupported target "renamed_num_enum" with type "test" omitted diff --git a/third_party/cargo/vendor/num_enum-0.4.3/Cargo.toml b/third_party/cargo/vendor/num_enum-0.4.3/Cargo.toml new file mode 100644 index 0000000..f26b173 --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/Cargo.toml @@ -0,0 +1,44 @@ +# 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 = "num_enum" +version = "0.4.3" +authors = ["Daniel Wagner-Hall ", "Daniel Henry-Mantilla "] +description = "Procedural macros to make inter-operation between primitives and enums easier." +readme = "README.md" +keywords = ["enum", "conversion", "safe", "ffi", "derive"] +categories = ["rust-patterns"] +license = "BSD-3-Clause" +repository = "https://github.com/illicitonion/num_enum" +[package.metadata.docs.rs] +features = ["external_doc"] +[dependencies.derivative] +version = "2" +features = ["use_core"] + +[dependencies.num_enum_derive] +version = "0.4.3" +default-features = false + +[features] +complex-expressions = ["num_enum_derive/complex-expressions"] +default = ["std"] +external_doc = [] +std = ["num_enum_derive/std"] +[badges.maintenance] +status = "passively-maintained" + +[badges.travis-ci] +branch = "master" +repository = "illicitonion/num_enum" diff --git a/third_party/cargo/vendor/num_enum-0.4.3/LICENSE b/third_party/cargo/vendor/num_enum-0.4.3/LICENSE new file mode 100644 index 0000000..b742e29 --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2018, Daniel Wagner-Hall +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of num_enum nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/cargo/vendor/num_enum-0.4.3/README.md b/third_party/cargo/vendor/num_enum-0.4.3/README.md new file mode 100644 index 0000000..413f36c --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/README.md @@ -0,0 +1,104 @@ +num_enum +======== + +Procedural macros to make inter-operation between primitives and enums easier. +This crate is no_std compatible. + +[![crates.io](https://img.shields.io/crates/v/num_enum.svg)](https://crates.io/crates/num_enum) +[![Documentation](https://docs.rs/num_enum/badge.svg)](https://docs.rs/num_enum) +[![Build Status](https://travis-ci.org/illicitonion/num_enum.svg?branch=master)](https://travis-ci.org/illicitonion/num_enum) + +Turning an enum into a primitive +-------------------------------- + +```rust +use num_enum::IntoPrimitive; + +#[derive(IntoPrimitive)] +#[repr(u8)] +enum Number { + Zero, + One, +} + +fn main() { + let zero: u8 = Number::Zero.into(); + assert_eq!(zero, 0u8); +} +``` + +`num_enum`'s `IntoPrimitive` is more type-safe than using `as`, because `as` will silently truncate - `num_enum` only derives `From` for exactly the discriminant type of the enum. + +Attempting to turn a primitive into an enum with try_from +---------------------------------------------- + +```rust +use num_enum::TryFromPrimitive; +use std::convert::TryFrom; + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +enum Number { + Zero, + One, +} + +fn main() { + let zero = Number::try_from(0u8); + assert_eq!(zero, Ok(Number::Zero)); + + let three = Number::try_from(3u8); + assert_eq!( + three.unwrap_err().to_string(), + "No discriminant in enum `Number` matches the value `3`", + ); +} +``` + +Unsafely turning a primitive into an enum with from_unchecked +------------------------------------------------------------- + +If you're really certain a conversion will succeed, and want to avoid a small amount of overhead, you can use unsafe +code to do this conversion. Unless you have data showing that the match statement generated in the `try_from` above is a +bottleneck for you, you should avoid doing this, as the unsafe code has potential to cause serious memory issues in +your program. + +```rust +use num_enum::UnsafeFromPrimitive; + +#[derive(Debug, Eq, PartialEq, UnsafeFromPrimitive)] +#[repr(u8)] +enum Number { + Zero, + One, +} + +fn main() { + assert_eq!( + Number::Zero, + unsafe { Number::from_unchecked(0_u8) }, + ); + assert_eq!( + Number::One, + unsafe { Number::from_unchecked(1_u8) }, + ); +} + +unsafe fn undefined_behavior() { + let _ = Number::from_unchecked(2); // 2 is not a valid discriminant! +} +``` + +Optional features +----------------- + +Some enum values may be composed of complex expressions, for example: + +```rust +enum Number { + Zero = (0, 1).0, + One = (0, 1).1, +} +``` + +To cut down on compile time, these are not supported by default, but if you enable the `complex-expressions` feature of your dependency on `num_enum`, these should start working. diff --git a/third_party/cargo/vendor/num_enum-0.4.3/src/lib.rs b/third_party/cargo/vendor/num_enum-0.4.3/src/lib.rs new file mode 100644 index 0000000..f96381e --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/src/lib.rs @@ -0,0 +1,45 @@ +#![cfg_attr(feature = "external_doc", feature(external_doc))] +#![cfg_attr(feature = "external_doc", doc(include = "../README.md"))] +#![cfg_attr( + not(feature = "external_doc"), + doc = "See https://docs.rs/num_enum for more info about this crate." +)] +#![cfg_attr(not(feature = "std"), no_std)] + +pub use ::num_enum_derive::{IntoPrimitive, TryFromPrimitive, UnsafeFromPrimitive}; + +use ::core::fmt; + +pub trait TryFromPrimitive: Sized { + type Primitive: Copy + Eq + fmt::Debug; + + const NAME: &'static str; + + fn try_from_primitive(number: Self::Primitive) -> Result>; +} + +#[derive(::derivative::Derivative)] +#[derivative( // use derivative to remove incorrect bound on `Enum` parameter. See https://github.com/rust-lang/rust/issues/26925 + Debug(bound = ""), + Clone(bound = ""), + Copy(bound = ""), + PartialEq(bound = ""), + Eq(bound = "") +)] +pub struct TryFromPrimitiveError { + pub number: Enum::Primitive, +} + +impl fmt::Display for TryFromPrimitiveError { + fn fmt(self: &'_ Self, stream: &'_ mut fmt::Formatter<'_>) -> fmt::Result { + write!( + stream, + "No discriminant in enum `{name}` matches the value `{input:?}`", + name = Enum::NAME, + input = self.number, + ) + } +} + +#[cfg(feature = "std")] +impl ::std::error::Error for TryFromPrimitiveError {} diff --git a/third_party/cargo/vendor/num_enum-0.4.3/tests/lib.rs b/third_party/cargo/vendor/num_enum-0.4.3/tests/lib.rs new file mode 100644 index 0000000..34d91b2 --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/tests/lib.rs @@ -0,0 +1,299 @@ +mod into_primitive { + use num_enum::IntoPrimitive; + + #[derive(IntoPrimitive)] + #[repr(u8)] + enum SimpleNumber { + Zero, + One, + Two, + } + + #[test] + fn simple() { + let zero: u8 = SimpleNumber::Zero.into(); + assert_eq!(zero, 0u8); + + let one: u8 = SimpleNumber::One.into(); + assert_eq!(one, 1u8); + + let two: u8 = SimpleNumber::Two.into(); + assert_eq!(two, 2u8); + } +} + +use num_enum::TryFromPrimitive; +use std::convert::TryInto; + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +enum SimpleNumber { + Zero, + One, + Two, +} + +#[test] +fn simple() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(SimpleNumber::Zero)); + + let three: Result = 3u8.try_into(); + assert_eq!( + three.unwrap_err().to_string(), + "No discriminant in enum `SimpleNumber` matches the value `3`" + ); +} + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +enum EvenNumber { + Zero = 0, + Two = 2, + Four = 4, +} + +#[test] +fn even() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(EvenNumber::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!( + one.unwrap_err().to_string(), + "No discriminant in enum `EvenNumber` matches the value `1`" + ); + + let two: Result = 2u8.try_into(); + assert_eq!(two, Ok(EvenNumber::Two)); + + let three: Result = 3u8.try_into(); + assert_eq!( + three.unwrap_err().to_string(), + "No discriminant in enum `EvenNumber` matches the value `3`" + ); + + let four: Result = 4u8.try_into(); + assert_eq!(four, Ok(EvenNumber::Four)); +} + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +enum SkippedNumber { + Zero, + One, + Three = 3, + Four, +} + +#[test] +fn skipped_value() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(SkippedNumber::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!(one, Ok(SkippedNumber::One)); + + let two: Result = 2u8.try_into(); + assert_eq!( + two.unwrap_err().to_string(), + "No discriminant in enum `SkippedNumber` matches the value `2`" + ); + + let three: Result = 3u8.try_into(); + assert_eq!(three, Ok(SkippedNumber::Three)); + + let four: Result = 4u8.try_into(); + assert_eq!(four, Ok(SkippedNumber::Four)); +} + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +enum WrongOrderNumber { + Four = 4, + Three = 3, + Zero = 0, + One, // Zero + 1 +} + +#[test] +fn wrong_order() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(WrongOrderNumber::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!(one, Ok(WrongOrderNumber::One)); + + let two: Result = 2u8.try_into(); + assert_eq!( + two.unwrap_err().to_string(), + "No discriminant in enum `WrongOrderNumber` matches the value `2`" + ); + + let three: Result = 3u8.try_into(); + assert_eq!(three, Ok(WrongOrderNumber::Three)); + + let four: Result = 4u8.try_into(); + assert_eq!(four, Ok(WrongOrderNumber::Four)); +} + +#[cfg(feature = "complex-expression")] +mod complex { + const ONE: u8 = 1; + + #[derive(Debug, Eq, PartialEq, TryFromPrimitive)] + #[repr(u8)] + enum DifferentValuesNumber { + Zero, + One = ONE, + Two, + Four = 4u8, + Five, + Six = ONE + ONE + 2u8 + 2, + Seven = (7, 2).0, + } + + #[test] + fn different_values() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(DifferentValuesNumber::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!(one, Ok(DifferentValuesNumber::One)); + + let two: Result = 2u8.try_into(); + assert_eq!(two, Ok(DifferentValuesNumber::Two)); + + let three: Result = 3u8.try_into(); + assert_eq!( + three.unwrap_err().to_string(), + "No discriminant in enum `DifferentValuesNumber` matches the value `3`", + ); + + let four: Result = 4u8.try_into(); + assert_eq!(four, Ok(DifferentValuesNumber::Four)); + + let five: Result = 5u8.try_into(); + assert_eq!(five, Ok(DifferentValuesNumber::Five)); + + let six: Result = 6u8.try_into(); + assert_eq!(six, Ok(DifferentValuesNumber::Six)); + + let seven: Result = 7u8.try_into(); + assert_eq!(seven, Ok(DifferentValuesNumber::Seven)); + } +} + +#[rustfmt::skip] +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +enum MissingTrailingCommaNumber { + Zero, + One +} + +#[test] +fn missing_trailing_comma() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(MissingTrailingCommaNumber::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!(one, Ok(MissingTrailingCommaNumber::One)); + + let two: Result = 2u8.try_into(); + assert_eq!( + two.unwrap_err().to_string(), + "No discriminant in enum `MissingTrailingCommaNumber` matches the value `2`" + ); +} + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[allow(unused)] +#[repr(u8)] +enum ExtraAttributes { + Zero, + #[allow(unused)] + One, +} + +#[test] +fn ignores_extra_attributes() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(ExtraAttributes::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!(one, Ok(ExtraAttributes::One)); + + let two: Result = 2u8.try_into(); + assert_eq!( + two.unwrap_err().to_string(), + "No discriminant in enum `ExtraAttributes` matches the value `2`" + ); +} + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +pub(crate) enum VisibleNumber { + Zero, + One, +} + +#[test] +fn visibility_is_fine() { + let zero: Result = 0u8.try_into(); + assert_eq!(zero, Ok(VisibleNumber::Zero)); + + let one: Result = 1u8.try_into(); + assert_eq!(one, Ok(VisibleNumber::One)); + + let two: Result = 2u8.try_into(); + assert_eq!( + two.unwrap_err().to_string(), + "No discriminant in enum `VisibleNumber` matches the value `2`" + ); +} + +#[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +#[repr(u8)] +pub enum HasErrorVariant { + Ok, + Error, +} + +#[test] +fn error_variant_is_allowed() { + let ok: Result = 0u8.try_into(); + assert_eq!(ok, Ok(HasErrorVariant::Ok)); + + let err: Result = 1u8.try_into(); + assert_eq!(err, Ok(HasErrorVariant::Error)); + + let unknown: Result = 2u8.try_into(); + assert_eq!( + unknown.unwrap_err().to_string(), + "No discriminant in enum `HasErrorVariant` matches the value `2`" + ); +} + +use num_enum::UnsafeFromPrimitive; + +#[derive(Debug, Eq, PartialEq, UnsafeFromPrimitive)] +#[repr(u8)] +enum HasUnsafeFromPrimitiveNumber { + Zero, + One, +} + +#[test] +fn has_unsafe_from_primitive_number() { + unsafe { + assert_eq!( + HasUnsafeFromPrimitiveNumber::Zero, + HasUnsafeFromPrimitiveNumber::from_unchecked(0_u8) + ); + assert_eq!( + HasUnsafeFromPrimitiveNumber::One, + HasUnsafeFromPrimitiveNumber::from_unchecked(1_u8) + ); + } +} diff --git a/third_party/cargo/vendor/num_enum-0.4.3/tests/renamed_num_enum.rs b/third_party/cargo/vendor/num_enum-0.4.3/tests/renamed_num_enum.rs new file mode 100644 index 0000000..0d43a64 --- /dev/null +++ b/third_party/cargo/vendor/num_enum-0.4.3/tests/renamed_num_enum.rs @@ -0,0 +1,13 @@ +#[test] +fn main() { + assert!(::std::process::Command::new("cargo") + .arg("run") + .arg("--manifest-path") + .arg(concat!( + env!("CARGO_MANIFEST_DIR"), + "/../renamed_num_enum/Cargo.toml", + )) + .status() + .unwrap() + .success()) +} diff --git a/third_party/cargo/vendor/num_enum_derive-0.4.3/.cargo-checksum.json b/third_party/cargo/vendor/num_enum_derive-0.4.3/.cargo-checksum.json new file mode 100644 index 0000000..8a4747f --- /dev/null +++ b/third_party/cargo/vendor/num_enum_derive-0.4.3/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"74529dcc4480058612240c71503dff3828dd4f1b2bad53d7b61a213d44aa5cb4","LICENSE":"0be96d891d00e0ae0df75d7f3289b12871c000a1f5ac744f3b570768d4bb277c","src/lib.rs":"e3395d3a80d4ab305fb40dfe2392c6f083ae6697e0e90b519f89fb6547d2b1fd"},"package":"ffa5a33ddddfee04c0283a7653987d634e880347e96b5b2ed64de07efb59db9d"} \ No newline at end of file diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/BUILD b/third_party/cargo/vendor/num_enum_derive-0.4.3/BUILD similarity index 63% rename from third_party/cargo/vendor/arrayvec-0.5.1/BUILD rename to third_party/cargo/vendor/num_enum_derive-0.4.3/BUILD index 5f25c07..988b829 100644 --- a/third_party/cargo/vendor/arrayvec-0.5.1/BUILD +++ b/third_party/cargo/vendor/num_enum_derive-0.4.3/BUILD @@ -12,7 +12,7 @@ package(default_visibility = [ ]) licenses([ - "notice", # "MIT,Apache-2.0" + "notice", # "BSD-3-Clause" ]) load( @@ -23,24 +23,25 @@ load( ) -# Unsupported target "arraystring" with type "bench" omitted rust_library( - name = "arrayvec", + name = "num_enum_derive", crate_root = "src/lib.rs", - crate_type = "lib", + crate_type = "proc-macro", edition = "2018", srcs = glob(["**/*.rs"]), deps = [ + "//third_party/cargo/vendor/proc-macro-crate-0.1.4:proc_macro_crate", + "//third_party/cargo/vendor/proc-macro2-1.0.17:proc_macro2", + "//third_party/cargo/vendor/quote-1.0.6:quote", + "//third_party/cargo/vendor/syn-1.0.27:syn", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.5.1", + version = "0.4.3", crate_features = [ + "std", ], ) -# Unsupported target "extend" with type "bench" omitted -# Unsupported target "serde" with type "test" omitted -# Unsupported target "tests" with type "test" omitted diff --git a/third_party/cargo/vendor/num_enum_derive-0.4.3/Cargo.toml b/third_party/cargo/vendor/num_enum_derive-0.4.3/Cargo.toml new file mode 100644 index 0000000..addc06a --- /dev/null +++ b/third_party/cargo/vendor/num_enum_derive-0.4.3/Cargo.toml @@ -0,0 +1,44 @@ +# 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 = "num_enum_derive" +version = "0.4.3" +authors = ["Daniel Wagner-Hall ", "Daniel Henry-Mantilla "] +description = "Internal implementation details for ::num_enum (Procedural macros to make inter-operation between primitives and enums easier)" +keywords = [] +categories = [] +license = "BSD-3-Clause" +repository = "https://github.com/illicitonion/num_enum" +[package.metadata.docs.rs] +features = ["external_doc"] + +[lib] +proc-macro = true +[dependencies.proc-macro-crate] +version = "0.1.4" + +[dependencies.proc-macro2] +version = "1" + +[dependencies.quote] +version = "1" + +[dependencies.syn] +version = "1" + +[features] +complex-expressions = ["syn/full"] +default = ["std"] +external_doc = [] +std = [] diff --git a/third_party/cargo/vendor/num_enum_derive-0.4.3/LICENSE b/third_party/cargo/vendor/num_enum_derive-0.4.3/LICENSE new file mode 100644 index 0000000..b742e29 --- /dev/null +++ b/third_party/cargo/vendor/num_enum_derive-0.4.3/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2018, Daniel Wagner-Hall +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of num_enum nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/third_party/cargo/vendor/num_enum_derive-0.4.3/src/lib.rs b/third_party/cargo/vendor/num_enum_derive-0.4.3/src/lib.rs new file mode 100644 index 0000000..200bb3f --- /dev/null +++ b/third_party/cargo/vendor/num_enum_derive-0.4.3/src/lib.rs @@ -0,0 +1,313 @@ +extern crate proc_macro; +use ::proc_macro::TokenStream; +use ::proc_macro2::Span; +use ::quote::quote; +use ::std::iter::FromIterator; +use ::syn::{ + parse::{Parse, ParseStream}, + parse_macro_input, parse_quote, Data, DeriveInput, Error, Expr, Ident, LitInt, LitStr, Meta, + Result, +}; + +macro_rules! die { + ($span:expr=> + $msg:expr + ) => ( + return Err(Error::new($span, $msg)); + ); + + ( + $msg:expr + ) => ( + die!(Span::call_site() => $msg) + ); +} + +fn literal(i: u64) -> Expr { + let literal = LitInt::new(&i.to_string(), Span::call_site()); + parse_quote! { + #literal + } +} + +struct EnumInfo { + name: Ident, + repr: Ident, + value_expressions_to_enum_keys: Vec<(Expr, Ident)>, +} + +impl Parse for EnumInfo { + fn parse(input: ParseStream) -> Result { + Ok({ + let input: DeriveInput = input.parse()?; + let name = input.ident; + let data = if let Data::Enum(data) = input.data { + data + } else { + let span = match input.data { + Data::Union(data) => data.union_token.span, + Data::Struct(data) => data.struct_token.span, + _ => unreachable!(), + }; + die!(span => "Expected enum"); + }; + + let repr: Ident = { + let mut attrs = input.attrs.into_iter(); + loop { + if let Some(attr) = attrs.next() { + if let Ok(Meta::List(meta_list)) = attr.parse_meta() { + if let Some(ident) = meta_list.path.get_ident() { + if ident == "repr" { + let mut nested = meta_list.nested.iter(); + if nested.len() != 1 { + die!(ident.span()=> + "Expected exactly one `repr` argument" + ); + } + let repr = nested.next().unwrap(); + let repr: Ident = parse_quote! { + #repr + }; + if repr == "C" { + die!(repr.span()=> + "repr(C) doesn't have a well defined size" + ); + } else { + break repr; + } + } + } + } + } else { + die!("Missing `#[repr({Integer})]` attribute"); + } + } + }; + + let mut next_discriminant = literal(0); + let value_expressions_to_enum_keys = + Vec::from_iter(data.variants.into_iter().map(|variant| { + let disc = if let Some(d) = variant.discriminant { + d.1 + } else { + next_discriminant.clone() + }; + let ref variant_ident = variant.ident; + next_discriminant = parse_quote! { + #repr::wrapping_add(#variant_ident, 1) + }; + (disc, variant.ident) + })); + + EnumInfo { + name, + repr, + value_expressions_to_enum_keys, + } + }) + } +} + +/// Implements `Into` for a `#[repr(Primitive)] enum`. +/// +/// (It actually implements `From for Primitive`) +/// +/// ## Allows turning an enum into a primitive. +/// +/// ```rust +/// use num_enum::IntoPrimitive; +/// +/// #[derive(IntoPrimitive)] +/// #[repr(u8)] +/// enum Number { +/// Zero, +/// One, +/// } +/// +/// fn main() { +/// let zero: u8 = Number::Zero.into(); +/// assert_eq!(zero, 0u8); +/// } +/// ``` +#[proc_macro_derive(IntoPrimitive)] +pub fn derive_into_primitive(input: TokenStream) -> TokenStream { + let EnumInfo { name, repr, .. } = parse_macro_input!(input as EnumInfo); + + TokenStream::from(quote! { + impl From<#name> for #repr { + #[inline] + fn from (enum_value: #name) -> Self + { + enum_value as Self + } + } + }) +} + +/// Implements `TryFrom` for a `#[repr(Primitive)] enum`. +/// +/// Attempting to turn a primitive into an enum with try_from. +/// ---------------------------------------------- +/// +/// ```rust +/// use num_enum::TryFromPrimitive; +/// use std::convert::TryFrom; +/// +/// #[derive(Debug, Eq, PartialEq, TryFromPrimitive)] +/// #[repr(u8)] +/// enum Number { +/// Zero, +/// One, +/// } +/// +/// fn main() { +/// let zero = Number::try_from(0u8); +/// assert_eq!(zero, Ok(Number::Zero)); +/// +/// let three = Number::try_from(3u8); +/// assert_eq!( +/// three.unwrap_err().to_string(), +/// "No discriminant in enum `Number` matches the value `3`", +/// ); +/// } +/// ``` +#[proc_macro_derive(TryFromPrimitive)] +pub fn derive_try_from_primitive(input: TokenStream) -> TokenStream { + let EnumInfo { + name, + repr, + value_expressions_to_enum_keys, + } = parse_macro_input!(input); + + let (match_const_exprs, enum_keys): (Vec, Vec) = + value_expressions_to_enum_keys.into_iter().unzip(); + + let krate = Ident::new( + &::proc_macro_crate::crate_name("num_enum") + .map(::std::borrow::Cow::from) + .unwrap_or_else(|err| { + eprintln!("Warning: {}\n => defaulting to `num_enum`", err,); + "num_enum".into() + }), + Span::call_site(), + ); + + TokenStream::from(quote! { + impl ::#krate::TryFromPrimitive for #name { + type Primitive = #repr; + + const NAME: &'static str = stringify!(#name); + + fn try_from_primitive ( + number: Self::Primitive, + ) -> ::core::result::Result< + Self, + ::#krate::TryFromPrimitiveError, + > + { + // Use intermediate const(s) so that enums defined like + // `Two = ONE + 1u8` work properly. + #![allow(non_upper_case_globals)] + #( + const #enum_keys: #repr = + #match_const_exprs + ; + )* + match number { + #( + | #enum_keys => ::core::result::Result::Ok( + #name::#enum_keys + ), + )* + | _ => ::core::result::Result::Err( + ::#krate::TryFromPrimitiveError { number } + ), + } + } + } + + impl ::core::convert::TryFrom<#repr> for #name { + type Error = ::#krate::TryFromPrimitiveError; + + #[inline] + fn try_from ( + number: #repr, + ) -> ::core::result::Result< + Self, + ::#krate::TryFromPrimitiveError, + > + { + ::#krate::TryFromPrimitive::try_from_primitive(number) + } + } + }) +} + +/// Generates a `unsafe fn from_unchecked (number: Primitive) -> Self` +/// associated function. +/// +/// Allows unsafely turning a primitive into an enum with from_unchecked. +/// ------------------------------------------------------------- +/// +/// If you're really certain a conversion will succeed, and want to avoid a small amount of overhead, you can use unsafe +/// code to do this conversion. Unless you have data showing that the match statement generated in the `try_from` above is a +/// bottleneck for you, you should avoid doing this, as the unsafe code has potential to cause serious memory issues in +/// your program. +/// +/// ```rust +/// use num_enum::UnsafeFromPrimitive; +/// +/// #[derive(Debug, Eq, PartialEq, UnsafeFromPrimitive)] +/// #[repr(u8)] +/// enum Number { +/// Zero, +/// One, +/// } +/// +/// fn main() { +/// assert_eq!( +/// Number::Zero, +/// unsafe { Number::from_unchecked(0_u8) }, +/// ); +/// assert_eq!( +/// Number::One, +/// unsafe { Number::from_unchecked(1_u8) }, +/// ); +/// } +/// +/// unsafe fn undefined_behavior() { +/// let _ = Number::from_unchecked(2); // 2 is not a valid discriminant! +/// } +/// ``` +#[proc_macro_derive(UnsafeFromPrimitive)] +pub fn derive_unsafe_from_primitive(stream: TokenStream) -> TokenStream { + let EnumInfo { name, repr, .. } = parse_macro_input!(stream as EnumInfo); + + let doc_string = LitStr::new( + &format!( + r#" +Transmutes `number: {repr}` into a [`{name}`]. + +# Safety + + - `number` must represent a valid discriminant of [`{name}`] +"#, + repr = repr, + name = name, + ), + Span::call_site(), + ); + + TokenStream::from(quote! { + impl #name { + #[doc = #doc_string] + #[inline] + pub + unsafe + fn from_unchecked(number: #repr) -> Self { + ::core::mem::transmute(number) + } + } + }) +} diff --git a/third_party/cargo/vendor/objc-0.2.7/.cargo-checksum.json b/third_party/cargo/vendor/objc-0.2.7/.cargo-checksum.json index d276f10..3b36dfa 100644 --- a/third_party/cargo/vendor/objc-0.2.7/.cargo-checksum.json +++ b/third_party/cargo/vendor/objc-0.2.7/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"b75b0c2c69a1b22b3e8a554f94353c423aef7e3891a66eefdee0b3a0813debf7","Cargo.toml":"d051e9534ddcac152d11d2c2b6e040136b22397fb5579867fd3de67c0c3b44f3","LICENSE.txt":"e353f37b12aefbb9f9b29490e837cfee05d9bda70804b3562839a3285c1df1e5","README.md":"2798cf78a640ea9fb83bdf27e2c82d98d9f8f7459196ab9db10372fb843c7a65","examples/example.rs":"df5fd939ffa46505b368e4e31aa0a0b144202fbceac72e5343bedb706313ef5e","src/declare.rs":"a4409a3b849413af55398b9b6a86ca482bdea94dd16ce818b39d420228426b54","src/encode.rs":"6e792c73f7cfced248f20cebe93dc038a39d25bdd9cbe1a115464b7baa02885b","src/exception.rs":"a641f9fdb9267e1d44f680b685d650faa2931d5d22949b621c8e2783ed534a4f","src/lib.rs":"1b03c53c792b0abe909d2958d7b692b2264ae0f25a109c15dacf57da2352f6f7","src/macros.rs":"b0d82088510fa6a14b1dfa240e91f85b0d13536bbf1a28d33a5dc932409b7279","src/message/apple/arm.rs":"3df72141b9fa48e7eab13b33acfa76c0eae730c2eedad0cc92ed7f89c51ca0da","src/message/apple/arm64.rs":"3efa598e34232c1e1c2171de864beac7f79e10f85807b23d10537335e0e84bd3","src/message/apple/mod.rs":"8aa9b9419084f92acc4468dae647b6bc3bd4570de0dbffe82dd8b6a18883345e","src/message/apple/x86.rs":"a268b01e54d0c7cbd9ae765815524fbd5f7c92c339f110f1f3d76877e5238597","src/message/apple/x86_64.rs":"bb64ad8de038b65cda61eaa55a46ce56795aeb36b574dc4dbbfd0d328aa23889","src/message/gnustep.rs":"15bbf9abc5aa0edc25b8b1d9622ebcacc33fd1103fe20a6a93ba9d82ca1b262d","src/message/mod.rs":"aa9da24db7d02ed7d827d78d53936c132fc9302e7fdc09380bdf7021ddd16ae6","src/message/verify.rs":"0047219354c49568a14f7aa7a5bb91edca16e5636a30c66c15a1533668759845","src/rc/autorelease.rs":"f56e26a5f866b5dbbe5c336289bbe21d5a5872928d504c5dfdfda3eeaedd5a3e","src/rc/mod.rs":"ce4b5206fa8273ad3931376d18c1b9aca6cef8172eb2ff8daf962fee710db9d7","src/rc/strong.rs":"f472889e5827cd67f6df62f50e55fdc2101bcdfeb59c7d39dacc5f30a0ed06bb","src/rc/weak.rs":"0b4f77abcd9f1eec1993b6cc6f3db564d90aafe3dbf15233a6f268ded48ef6cb","src/runtime.rs":"69b33722d727faef47e3fb14e68bb18b96a970930a1f9b244e2bb4e161d67874","src/test_utils.rs":"db73875ff5ae4761187d3691998829a689e3dfd26b9812bdebc1bcae0388f78b"},"package":"915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"} \ No newline at end of file +{"files":{"CHANGELOG.md":"b75b0c2c69a1b22b3e8a554f94353c423aef7e3891a66eefdee0b3a0813debf7","Cargo.lock":"a133d68c72c3735526ec3dcae9cfcd8928d19de7532940488f4527d1946fb954","Cargo.toml":"d051e9534ddcac152d11d2c2b6e040136b22397fb5579867fd3de67c0c3b44f3","LICENSE.txt":"e353f37b12aefbb9f9b29490e837cfee05d9bda70804b3562839a3285c1df1e5","README.md":"2798cf78a640ea9fb83bdf27e2c82d98d9f8f7459196ab9db10372fb843c7a65","examples/example.rs":"df5fd939ffa46505b368e4e31aa0a0b144202fbceac72e5343bedb706313ef5e","src/declare.rs":"a4409a3b849413af55398b9b6a86ca482bdea94dd16ce818b39d420228426b54","src/encode.rs":"6e792c73f7cfced248f20cebe93dc038a39d25bdd9cbe1a115464b7baa02885b","src/exception.rs":"a641f9fdb9267e1d44f680b685d650faa2931d5d22949b621c8e2783ed534a4f","src/lib.rs":"1b03c53c792b0abe909d2958d7b692b2264ae0f25a109c15dacf57da2352f6f7","src/macros.rs":"b0d82088510fa6a14b1dfa240e91f85b0d13536bbf1a28d33a5dc932409b7279","src/message/apple/arm.rs":"3df72141b9fa48e7eab13b33acfa76c0eae730c2eedad0cc92ed7f89c51ca0da","src/message/apple/arm64.rs":"3efa598e34232c1e1c2171de864beac7f79e10f85807b23d10537335e0e84bd3","src/message/apple/mod.rs":"8aa9b9419084f92acc4468dae647b6bc3bd4570de0dbffe82dd8b6a18883345e","src/message/apple/x86.rs":"a268b01e54d0c7cbd9ae765815524fbd5f7c92c339f110f1f3d76877e5238597","src/message/apple/x86_64.rs":"bb64ad8de038b65cda61eaa55a46ce56795aeb36b574dc4dbbfd0d328aa23889","src/message/gnustep.rs":"15bbf9abc5aa0edc25b8b1d9622ebcacc33fd1103fe20a6a93ba9d82ca1b262d","src/message/mod.rs":"aa9da24db7d02ed7d827d78d53936c132fc9302e7fdc09380bdf7021ddd16ae6","src/message/verify.rs":"0047219354c49568a14f7aa7a5bb91edca16e5636a30c66c15a1533668759845","src/rc/autorelease.rs":"f56e26a5f866b5dbbe5c336289bbe21d5a5872928d504c5dfdfda3eeaedd5a3e","src/rc/mod.rs":"ce4b5206fa8273ad3931376d18c1b9aca6cef8172eb2ff8daf962fee710db9d7","src/rc/strong.rs":"f472889e5827cd67f6df62f50e55fdc2101bcdfeb59c7d39dacc5f30a0ed06bb","src/rc/weak.rs":"0b4f77abcd9f1eec1993b6cc6f3db564d90aafe3dbf15233a6f268ded48ef6cb","src/runtime.rs":"69b33722d727faef47e3fb14e68bb18b96a970930a1f9b244e2bb4e161d67874","src/test_utils.rs":"db73875ff5ae4761187d3691998829a689e3dfd26b9812bdebc1bcae0388f78b"},"package":"915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"} \ No newline at end of file diff --git a/third_party/cargo/vendor/objc-0.2.7/Cargo.lock b/third_party/cargo/vendor/objc-0.2.7/Cargo.lock new file mode 100644 index 0000000..122fb19 --- /dev/null +++ b/third_party/cargo/vendor/objc-0.2.7/Cargo.lock @@ -0,0 +1,41 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "gcc" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.57" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.7" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc_exception 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc_exception" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" +"checksum libc 0.2.57 (registry+https://github.com/rust-lang/crates.io-index)" = "a844cabbd5a77e60403a58af576f0a1baa83c3dd2670be63e615bd24fc58b82d" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum objc_exception 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "098cd29a2fa3c230d3463ae069cecccc3fdfd64c0d2496ab5b96f82dab6a00dc" diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/.cargo-checksum.json b/third_party/cargo/vendor/parking_lot-0.10.0/.cargo-checksum.json deleted file mode 100644 index 83624a0..0000000 --- a/third_party/cargo/vendor/parking_lot-0.10.0/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"67c50cb22d980c9320ccce5568ccaa89a58e8366ff6c1aafb90a0450034bb731","Cargo.toml":"1476f231995686093ade27b1da08c4fc6ed0c4cfbf3534589389e93e2bbe684e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"72b6b1ba1c29f8de15fb4ac65c482f32278e5402666a37d42054a8fd557387d0","appveyor.yml":"e2416e65e27442dd8e17c773deee1e45ee96157221bc81b03d9a6d25bfa570e2","src/condvar.rs":"56ca5fc69955f28a997133255547bb5d64074af6108f8036ea0273bab3e0fddd","src/deadlock.rs":"081dbf009539b113f67ad0a1abd7af889dad684a47aa1a7dc00ae91f08975ef6","src/elision.rs":"00f7af80021fd602879fb7205befb6ff941cd8dc932a5c0a534b430fefe421ea","src/lib.rs":"533f098d633a4a94367f2bb4e615a97ef2ab977c1ba55b01cd91dc5f91f2a294","src/mutex.rs":"ac145b5913cdc5690a146d7c3456f1cffa6cb454e994ac39de52c1ce97b78e55","src/once.rs":"a1c38a5d87077e3d112d57e065ee126a24ab19f04fba9cb1f2cb43bc82caf33c","src/raw_mutex.rs":"f3507478c34b49bd725dfaed6bf4847fc3aec28700960a7823af9e15b06b5e24","src/raw_rwlock.rs":"f8ce7c4f92299cf64cb6e7b69cd46d9ddefd1211535729b6455e82f7c4eb3eae","src/remutex.rs":"416d02e2195e04654ca2b0a8ebce2a10842da56f6910d9ed3b90948718de39d0","src/rwlock.rs":"54a3cb74644c88b425d2cd692117a35fe4ed8211ba73c975d6129297603ebf0e","src/util.rs":"37a2c8b5c9254df83e8f3a5cd831558c1045061a76c2571bdc4d78eb86e467f2"},"package":"92e98c49ab0b7ce5b222f2cc9193fc4efe11c6d0bd4f648e374684a6857b1cfc"} \ No newline at end of file diff --git a/third_party/cargo/vendor/parking_lot-0.10.2/.cargo-checksum.json b/third_party/cargo/vendor/parking_lot-0.10.2/.cargo-checksum.json new file mode 100644 index 0000000..784094c --- /dev/null +++ b/third_party/cargo/vendor/parking_lot-0.10.2/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"18a3b6c2a59fb59450362712afae444070b23c2697cf20aa9ee3911dd9f6d981","Cargo.toml":"c0d17dd8decba5afb1495577e0ded39c0228eeb2eb14be4f4d4d5d9c96ebc0c3","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"0f1b45638eb0d2b3f142baec830319a5790f3f2004eac5bc5f3e95bc632bdaed","appveyor.yml":"e2416e65e27442dd8e17c773deee1e45ee96157221bc81b03d9a6d25bfa570e2","bors.toml":"1c81ede536a37edd30fe4e622ff0531b25372403ac9475a5d6c50f14156565a2","src/condvar.rs":"510f96e94b56f0cb0d200a8e94b0487d0799e13b9e126b9b416f22d8dc11b643","src/deadlock.rs":"7d3ebb5b4f63658435df277bb983e352e4bc651a92c4fd48ae68bf103e452d0d","src/elision.rs":"9aceb0b27fd3cdaf4ef76bda63435a96ec2fdef24be098b9e4edbc39db000765","src/fair_mutex.rs":"d0a032e8207919da04b85f1422dfb14aa2af7aad78843c708d2fe3e0478e401a","src/lib.rs":"3d89619878f3c8b6190261321a4e430e0514c97b65e8c911c0764ea57c0605f2","src/mutex.rs":"afc25db5c45da63c743029ee3cb22e262ea7a32b533245b441c0a5835f9f525f","src/once.rs":"a1c38a5d87077e3d112d57e065ee126a24ab19f04fba9cb1f2cb43bc82caf33c","src/raw_fair_mutex.rs":"a7415aa6cbc040a2f886d06dd6c0c0b3be9963936a31f60f1494e718c9d18acb","src/raw_mutex.rs":"f3507478c34b49bd725dfaed6bf4847fc3aec28700960a7823af9e15b06b5e24","src/raw_rwlock.rs":"f8ce7c4f92299cf64cb6e7b69cd46d9ddefd1211535729b6455e82f7c4eb3eae","src/remutex.rs":"7a0de55161cd57497bb52d3aecca69a89eff2e71cdb2d762df53579e0607b489","src/rwlock.rs":"1a782ab4fafc0c542d1c42151b98475829c96da168d2d0e8947181b7f2d7cb07","src/util.rs":"37a2c8b5c9254df83e8f3a5cd831558c1045061a76c2571bdc4d78eb86e467f2","tests/issue_203.rs":"5fbdf6ec63f391d86457df949678c203a1e81e8aa32d4e10037fa76e768702c0"},"package":"d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"} \ No newline at end of file diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/BUILD b/third_party/cargo/vendor/parking_lot-0.10.2/BUILD similarity index 78% rename from third_party/cargo/vendor/parking_lot-0.10.0/BUILD rename to third_party/cargo/vendor/parking_lot-0.10.2/BUILD index 77b42cd..378caf7 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/BUILD +++ b/third_party/cargo/vendor/parking_lot-0.10.2/BUILD @@ -23,6 +23,7 @@ load( ) +# Unsupported target "issue_203" with type "test" omitted rust_library( name = "parking_lot", @@ -31,13 +32,13 @@ rust_library( edition = "2018", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/lock_api-0.3.3:lock_api", - "//third_party/cargo/vendor/parking_lot_core-0.7.0:parking_lot_core", + "//third_party/cargo/vendor/lock_api-0.3.4:lock_api", + "//third_party/cargo/vendor/parking_lot_core-0.7.2:parking_lot_core", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.10.0", + version = "0.10.2", crate_features = [ "default", ], diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/CHANGELOG.md b/third_party/cargo/vendor/parking_lot-0.10.2/CHANGELOG.md similarity index 87% rename from third_party/cargo/vendor/parking_lot-0.10.0/CHANGELOG.md rename to third_party/cargo/vendor/parking_lot-0.10.2/CHANGELOG.md index a681861..c187e4d 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/CHANGELOG.md +++ b/third_party/cargo/vendor/parking_lot-0.10.2/CHANGELOG.md @@ -1,7 +1,23 @@ +## parking_lot 0.10.2 (2020-04-10) + +- Update minimum version of `lock_api`. + +## parking_lot 0.10.1, parking_lot_core 0.7.1, lock_api 0.3.4 (2020-04-10) + +- Add methods to construct `Mutex`, `RwLock`, etc in a `const` context. (#217) +- Add `FairMutex` which always uses fair unlocking. (#204) +- Fixed panic with deadlock detection on macOS. (#203) +- Fixed incorrect synchronization in `create_hashtable`. (#210) +- Use `llvm_asm!` instead of the deprecated `asm!`. (#223) + +## lock_api 0.3.3 (2020-01-04) + +- Deprecate unsound `MappedRwLockWriteGuard::downgrade` (#198) + ## parking_lot 0.10.0, parking_lot_core 0.7.0, lock_api 0.3.2 (2019-11-25) - Upgrade smallvec dependency to 1.0 in parking_lot_core. -- Replace all usage of `mem::unitialized` with `mem::MaybeUninit`. +- Replace all usage of `mem::uninitialized` with `mem::MaybeUninit`. - The minimum required Rust version is bumped to 1.36. Because of the above two changes. - Make methods on `WaitTimeoutResult` and `OnceState` take `self` by value instead of reference. diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/Cargo.toml b/third_party/cargo/vendor/parking_lot-0.10.2/Cargo.toml similarity index 92% rename from third_party/cargo/vendor/parking_lot-0.10.0/Cargo.toml rename to third_party/cargo/vendor/parking_lot-0.10.2/Cargo.toml index ea2833f..57940ff 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/Cargo.toml +++ b/third_party/cargo/vendor/parking_lot-0.10.2/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "parking_lot" -version = "0.10.0" +version = "0.10.2" authors = ["Amanieu d'Antras "] description = "More compact and efficient implementations of the standard synchronization primitives." readme = "README.md" @@ -22,16 +22,13 @@ categories = ["concurrency"] license = "Apache-2.0/MIT" repository = "https://github.com/Amanieu/parking_lot" [dependencies.lock_api] -version = "0.3.1" +version = "0.3.4" [dependencies.parking_lot_core] -version = "0.7.0" +version = "0.7.1" [dev-dependencies.bincode] version = "1.1.3" -[dev-dependencies.lazy_static] -version = "1.0" - [dev-dependencies.rand] version = "0.7" diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/LICENSE-APACHE b/third_party/cargo/vendor/parking_lot-0.10.2/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/LICENSE-APACHE rename to third_party/cargo/vendor/parking_lot-0.10.2/LICENSE-APACHE diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/LICENSE-MIT b/third_party/cargo/vendor/parking_lot-0.10.2/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/LICENSE-MIT rename to third_party/cargo/vendor/parking_lot-0.10.2/LICENSE-MIT diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/README.md b/third_party/cargo/vendor/parking_lot-0.10.2/README.md similarity index 96% rename from third_party/cargo/vendor/parking_lot-0.10.0/README.md rename to third_party/cargo/vendor/parking_lot-0.10.2/README.md index 7705e67..3ec4cb0 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/README.md +++ b/third_party/cargo/vendor/parking_lot-0.10.2/README.md @@ -87,8 +87,9 @@ lock. There are a few restrictions when using this library on stable Rust: -- You will have to use `lazy_static!` or equivalent to statically initialize `Mutex` - and `RwLock` types. They use generics and can't be `const fn`s on stable yet. +- You will have to use the `const_*` functions (e.g. `const_mutex(val)`) to + statically initialize the locking primitives. Using e.g. `Mutex::new(val)` + does not work on stable Rust yet. - `RwLock` will not be able to take advantage of hardware lock elision for readers, which improves performance when there are multiple readers. @@ -104,12 +105,6 @@ Add this to your `Cargo.toml`: parking_lot = "0.10" ``` -and this to your crate root: - -```rust -extern crate parking_lot; -``` - To enable nightly-only features, add this to your `Cargo.toml` instead: ```toml diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/appveyor.yml b/third_party/cargo/vendor/parking_lot-0.10.2/appveyor.yml similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/appveyor.yml rename to third_party/cargo/vendor/parking_lot-0.10.2/appveyor.yml diff --git a/third_party/cargo/vendor/parking_lot-0.10.2/bors.toml b/third_party/cargo/vendor/parking_lot-0.10.2/bors.toml new file mode 100644 index 0000000..ca08e81 --- /dev/null +++ b/third_party/cargo/vendor/parking_lot-0.10.2/bors.toml @@ -0,0 +1,3 @@ +status = [ + "continuous-integration/travis-ci/push", +] diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/condvar.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/condvar.rs similarity index 99% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/condvar.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/condvar.rs index 149ec86..0afda3a 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/condvar.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/condvar.rs @@ -81,7 +81,7 @@ impl WaitTimeoutResult { /// if !*started { /// cvar.wait(&mut started); /// } -/// // Note that we used and if instead of a while loop above. This is only +/// // Note that we used an if instead of a while loop above. This is only /// // possible because parking_lot's Condvar will never spuriously wake up. /// // This means that wait() will only return after notify_one or notify_all is /// // called. diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/deadlock.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/deadlock.rs similarity index 98% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/deadlock.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/deadlock.rs index 810edf1..0fab722 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/deadlock.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/deadlock.rs @@ -46,9 +46,7 @@ mod tests { use std::time::Duration; // We need to serialize these tests since deadlock detection uses global state - lazy_static::lazy_static! { - static ref DEADLOCK_DETECTION_LOCK: Mutex<()> = Mutex::new(()); - } + static DEADLOCK_DETECTION_LOCK: Mutex<()> = crate::const_mutex(()); fn check_deadlock() -> bool { use parking_lot_core::deadlock::check_deadlock; diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/elision.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/elision.rs similarity index 75% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/elision.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/elision.rs index 74ff5ff..68cfa63 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/elision.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/elision.rs @@ -57,11 +57,11 @@ impl AtomicElisionExt for AtomicUsize { fn elision_compare_exchange_acquire(&self, current: usize, new: usize) -> Result { unsafe { let prev: usize; - asm!("xacquire; lock; cmpxchgl $2, $1" - : "={eax}" (prev), "+*m" (self) - : "r" (new), "{eax}" (current) - : "memory" - : "volatile"); + llvm_asm!("xacquire; lock; cmpxchgl $2, $1" + : "={eax}" (prev), "+*m" (self) + : "r" (new), "{eax}" (current) + : "memory" + : "volatile"); if prev == current { Ok(prev) } else { @@ -74,11 +74,11 @@ impl AtomicElisionExt for AtomicUsize { fn elision_compare_exchange_acquire(&self, current: usize, new: usize) -> Result { unsafe { let prev: usize; - asm!("xacquire; lock; cmpxchgq $2, $1" - : "={rax}" (prev), "+*m" (self) - : "r" (new), "{rax}" (current) - : "memory" - : "volatile"); + llvm_asm!("xacquire; lock; cmpxchgq $2, $1" + : "={rax}" (prev), "+*m" (self) + : "r" (new), "{rax}" (current) + : "memory" + : "volatile"); if prev == current { Ok(prev) } else { @@ -92,11 +92,11 @@ impl AtomicElisionExt for AtomicUsize { fn elision_fetch_sub_release(&self, val: usize) -> usize { unsafe { let prev: usize; - asm!("xrelease; lock; xaddl $2, $1" - : "=r" (prev), "+*m" (self) - : "0" (val.wrapping_neg()) - : "memory" - : "volatile"); + llvm_asm!("xrelease; lock; xaddl $2, $1" + : "=r" (prev), "+*m" (self) + : "0" (val.wrapping_neg()) + : "memory" + : "volatile"); prev } } @@ -105,11 +105,11 @@ impl AtomicElisionExt for AtomicUsize { fn elision_fetch_sub_release(&self, val: usize) -> usize { unsafe { let prev: usize; - asm!("xrelease; lock; xaddq $2, $1" - : "=r" (prev), "+*m" (self) - : "0" (val.wrapping_neg()) - : "memory" - : "volatile"); + llvm_asm!("xrelease; lock; xaddq $2, $1" + : "=r" (prev), "+*m" (self) + : "0" (val.wrapping_neg()) + : "memory" + : "volatile"); prev } } diff --git a/third_party/cargo/vendor/parking_lot-0.10.2/src/fair_mutex.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/fair_mutex.rs new file mode 100644 index 0000000..449c53b --- /dev/null +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/fair_mutex.rs @@ -0,0 +1,278 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use crate::raw_fair_mutex::RawFairMutex; +use lock_api; + +/// A mutual exclusive primitive that is always fair, useful for protecting shared data +/// +/// This mutex will block threads waiting for the lock to become available. The +/// mutex can also be statically initialized or created via a `new` +/// constructor. Each mutex has a type parameter which represents the data that +/// it is protecting. The data can only be accessed through the RAII guards +/// returned from `lock` and `try_lock`, which guarantees that the data is only +/// ever accessed when the mutex is locked. +/// +/// The regular mutex provided by `parking_lot` uses eventual locking fairness +/// (after some time it will default to the fair algorithm), but eventual +/// fairness does not provide the same garantees a always fair method would. +/// Fair mutexes are generally slower, but sometimes needed. This wrapper was +/// created to avoid using a unfair protocol when it's forbidden by mistake. +/// +/// In a fair mutex the lock is provided to whichever thread asked first, +/// they form a queue and always follow the first-in first-out order. This +/// means some thread in the queue won't be able to steal the lock and use it fast +/// to increase throughput, at the cost of latency. Since the response time will grow +/// for some threads that are waiting for the lock and losing to faster but later ones, +/// but it may make sending more responses possible. +/// +/// A fair mutex may not be interesting if threads have different priorities (this is known as +/// priority inversion). +/// +/// # Differences from the standard library `Mutex` +/// +/// - No poisoning, the lock is released normally on panic. +/// - Only requires 1 byte of space, whereas the standard library boxes the +/// `FairMutex` due to platform limitations. +/// - Can be statically constructed (requires the `const_fn` nightly feature). +/// - Does not require any drop glue when dropped. +/// - Inline fast path for the uncontended case. +/// - Efficient handling of micro-contention using adaptive spinning. +/// - Allows raw locking & unlocking without a guard. +/// +/// # Examples +/// +/// ``` +/// use parking_lot::FairMutex; +/// use std::sync::{Arc, mpsc::channel}; +/// use std::thread; +/// +/// const N: usize = 10; +/// +/// // Spawn a few threads to increment a shared variable (non-atomically), and +/// // let the main thread know once all increments are done. +/// // +/// // Here we're using an Arc to share memory among threads, and the data inside +/// // the Arc is protected with a mutex. +/// let data = Arc::new(FairMutex::new(0)); +/// +/// let (tx, rx) = channel(); +/// for _ in 0..10 { +/// let (data, tx) = (Arc::clone(&data), tx.clone()); +/// thread::spawn(move || { +/// // The shared state can only be accessed once the lock is held. +/// // Our non-atomic increment is safe because we're the only thread +/// // which can access the shared state when the lock is held. +/// let mut data = data.lock(); +/// *data += 1; +/// if *data == N { +/// tx.send(()).unwrap(); +/// } +/// // the lock is unlocked here when `data` goes out of scope. +/// }); +/// } +/// +/// rx.recv().unwrap(); +/// ``` +pub type FairMutex = lock_api::Mutex; + +/// Creates a new fair mutex in an unlocked state ready for use. +/// +/// This allows creating a fair mutex in a constant context on stable Rust. +pub const fn const_fair_mutex(val: T) -> FairMutex { + FairMutex::const_new(::INIT, val) +} + +/// An RAII implementation of a "scoped lock" of a mutex. When this structure is +/// dropped (falls out of scope), the lock will be unlocked. +/// +/// The data protected by the mutex can be accessed through this guard via its +/// `Deref` and `DerefMut` implementations. +pub type FairMutexGuard<'a, T> = lock_api::MutexGuard<'a, RawFairMutex, T>; + +/// An RAII mutex guard returned by `FairMutexGuard::map`, which can point to a +/// subfield of the protected data. +/// +/// The main difference between `MappedFairMutexGuard` and `FairMutexGuard` is that the +/// former doesn't support temporarily unlocking and re-locking, since that +/// could introduce soundness issues if the locked object is modified by another +/// thread. +pub type MappedFairMutexGuard<'a, T> = lock_api::MappedMutexGuard<'a, RawFairMutex, T>; + +#[cfg(test)] +mod tests { + use crate::FairMutex; + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::sync::mpsc::channel; + use std::sync::Arc; + use std::thread; + + #[cfg(feature = "serde")] + use bincode::{deserialize, serialize}; + + #[derive(Eq, PartialEq, Debug)] + struct NonCopy(i32); + + #[test] + fn smoke() { + let m = FairMutex::new(()); + drop(m.lock()); + drop(m.lock()); + } + + #[test] + fn lots_and_lots() { + const J: u32 = 1000; + const K: u32 = 3; + + let m = Arc::new(FairMutex::new(0)); + + fn inc(m: &FairMutex) { + for _ in 0..J { + *m.lock() += 1; + } + } + + let (tx, rx) = channel(); + for _ in 0..K { + let tx2 = tx.clone(); + let m2 = m.clone(); + thread::spawn(move || { + inc(&m2); + tx2.send(()).unwrap(); + }); + let tx2 = tx.clone(); + let m2 = m.clone(); + thread::spawn(move || { + inc(&m2); + tx2.send(()).unwrap(); + }); + } + + drop(tx); + for _ in 0..2 * K { + rx.recv().unwrap(); + } + assert_eq!(*m.lock(), J * K * 2); + } + + #[test] + fn try_lock() { + let m = FairMutex::new(()); + *m.try_lock().unwrap() = (); + } + + #[test] + fn test_into_inner() { + let m = FairMutex::new(NonCopy(10)); + assert_eq!(m.into_inner(), NonCopy(10)); + } + + #[test] + fn test_into_inner_drop() { + struct Foo(Arc); + impl Drop for Foo { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } + } + let num_drops = Arc::new(AtomicUsize::new(0)); + let m = FairMutex::new(Foo(num_drops.clone())); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + { + let _inner = m.into_inner(); + assert_eq!(num_drops.load(Ordering::SeqCst), 0); + } + assert_eq!(num_drops.load(Ordering::SeqCst), 1); + } + + #[test] + fn test_get_mut() { + let mut m = FairMutex::new(NonCopy(10)); + *m.get_mut() = NonCopy(20); + assert_eq!(m.into_inner(), NonCopy(20)); + } + + #[test] + fn test_mutex_arc_nested() { + // Tests nested mutexes and access + // to underlying data. + let arc = Arc::new(FairMutex::new(1)); + let arc2 = Arc::new(FairMutex::new(arc)); + let (tx, rx) = channel(); + let _t = thread::spawn(move || { + let lock = arc2.lock(); + let lock2 = lock.lock(); + assert_eq!(*lock2, 1); + tx.send(()).unwrap(); + }); + rx.recv().unwrap(); + } + + #[test] + fn test_mutex_arc_access_in_unwind() { + let arc = Arc::new(FairMutex::new(1)); + let arc2 = arc.clone(); + let _ = thread::spawn(move || { + struct Unwinder { + i: Arc>, + } + impl Drop for Unwinder { + fn drop(&mut self) { + *self.i.lock() += 1; + } + } + let _u = Unwinder { i: arc2 }; + panic!(); + }) + .join(); + let lock = arc.lock(); + assert_eq!(*lock, 2); + } + + #[test] + fn test_mutex_unsized() { + let mutex: &FairMutex<[i32]> = &FairMutex::new([1, 2, 3]); + { + let b = &mut *mutex.lock(); + b[0] = 4; + b[2] = 5; + } + let comp: &[i32] = &[4, 2, 5]; + assert_eq!(&*mutex.lock(), comp); + } + + #[test] + fn test_mutexguard_sync() { + fn sync(_: T) {} + + let mutex = FairMutex::new(()); + sync(mutex.lock()); + } + + #[test] + fn test_mutex_debug() { + let mutex = FairMutex::new(vec![0u8, 10]); + + assert_eq!(format!("{:?}", mutex), "Mutex { data: [0, 10] }"); + let _lock = mutex.lock(); + assert_eq!(format!("{:?}", mutex), "Mutex { data: }"); + } + + #[cfg(feature = "serde")] + #[test] + fn test_serde() { + let contents: Vec = vec![0, 1, 2]; + let mutex = FairMutex::new(contents.clone()); + + let serialized = serialize(&mutex).unwrap(); + let deserialized: FairMutex> = deserialize(&serialized).unwrap(); + + assert_eq!(*(mutex.lock()), *(deserialized.lock())); + assert_eq!(contents, *(deserialized.lock())); + } +} diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/lib.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/lib.rs similarity index 69% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/lib.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/lib.rs index db0d6b3..73246c2 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/lib.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/lib.rs @@ -11,12 +11,14 @@ #![warn(missing_docs)] #![warn(rust_2018_idioms)] -#![cfg_attr(feature = "nightly", feature(asm))] +#![cfg_attr(feature = "nightly", feature(llvm_asm))] mod condvar; mod elision; +mod fair_mutex; mod mutex; mod once; +mod raw_fair_mutex; mod raw_mutex; mod raw_rwlock; mod remutex; @@ -29,15 +31,18 @@ pub mod deadlock; mod deadlock; pub use self::condvar::{Condvar, WaitTimeoutResult}; -pub use self::mutex::{MappedMutexGuard, Mutex, MutexGuard}; +pub use self::fair_mutex::{const_fair_mutex, FairMutex, FairMutexGuard, MappedFairMutexGuard}; +pub use self::mutex::{const_mutex, MappedMutexGuard, Mutex, MutexGuard}; pub use self::once::{Once, OnceState}; +pub use self::raw_fair_mutex::RawFairMutex; pub use self::raw_mutex::RawMutex; pub use self::raw_rwlock::RawRwLock; pub use self::remutex::{ - MappedReentrantMutexGuard, RawThreadId, ReentrantMutex, ReentrantMutexGuard, + const_reentrant_mutex, MappedReentrantMutexGuard, RawThreadId, ReentrantMutex, + ReentrantMutexGuard, }; pub use self::rwlock::{ - MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, + const_rwlock, MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, RwLockUpgradableReadGuard, RwLockWriteGuard, }; pub use ::lock_api; diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/mutex.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/mutex.rs similarity index 97% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/mutex.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/mutex.rs index 82f1fe5..36e5ea7 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/mutex.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/mutex.rs @@ -53,10 +53,9 @@ use lock_api; /// # Examples /// /// ``` -/// use std::sync::Arc; /// use parking_lot::Mutex; +/// use std::sync::{Arc, mpsc::channel}; /// use std::thread; -/// use std::sync::mpsc::channel; /// /// const N: usize = 10; /// @@ -87,6 +86,13 @@ use lock_api; /// ``` pub type Mutex = lock_api::Mutex; +/// Creates a new mutex in an unlocked state ready for use. +/// +/// This allows creating a mutex in a constant context on stable Rust. +pub const fn const_mutex(val: T) -> Mutex { + Mutex::const_new(::INIT, val) +} + /// An RAII implementation of a "scoped lock" of a mutex. When this structure is /// dropped (falls out of scope), the lock will be unlocked. /// diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/once.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/once.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/once.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/once.rs diff --git a/third_party/cargo/vendor/parking_lot-0.10.2/src/raw_fair_mutex.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/raw_fair_mutex.rs new file mode 100644 index 0000000..3eb7ddb --- /dev/null +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/raw_fair_mutex.rs @@ -0,0 +1,60 @@ +// Copyright 2016 Amanieu d'Antras +// +// Licensed under the Apache License, Version 2.0, or the MIT license , at your option. This file may not be +// copied, modified, or distributed except according to those terms. + +use crate::raw_mutex::RawMutex; +use lock_api::RawMutexFair; + +/// Raw fair mutex type backed by the parking lot. +pub struct RawFairMutex(RawMutex); + +unsafe impl lock_api::RawMutex for RawFairMutex { + const INIT: Self = RawFairMutex(::INIT); + + type GuardMarker = ::GuardMarker; + + #[inline] + fn lock(&self) { + self.0.lock() + } + + #[inline] + fn try_lock(&self) -> bool { + self.0.try_lock() + } + + #[inline] + fn unlock(&self) { + self.unlock_fair() + } +} + +unsafe impl lock_api::RawMutexFair for RawFairMutex { + #[inline] + fn unlock_fair(&self) { + self.0.unlock_fair() + } + + #[inline] + fn bump(&self) { + self.0.bump() + } +} + +unsafe impl lock_api::RawMutexTimed for RawFairMutex { + type Duration = ::Duration; + type Instant = ::Instant; + + #[inline] + fn try_lock_until(&self, timeout: Self::Instant) -> bool { + self.0.try_lock_until(timeout) + } + + #[inline] + fn try_lock_for(&self, timeout: Self::Duration) -> bool { + self.0.try_lock_for(timeout) + } +} diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/raw_mutex.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/raw_mutex.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/raw_mutex.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/raw_mutex.rs diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/raw_rwlock.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/raw_rwlock.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/raw_rwlock.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/raw_rwlock.rs diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/remutex.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/remutex.rs similarity index 90% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/remutex.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/remutex.rs index 6fdf107..1037923 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/remutex.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/remutex.rs @@ -36,10 +36,21 @@ unsafe impl GetThreadId for RawThreadId { /// - `ReentrantMutexGuard` does not give mutable references to the locked data. /// Use a `RefCell` if you need this. /// -/// See [`Mutex`](struct.Mutex.html) for more details about the underlying mutex +/// See [`Mutex`](type.Mutex.html) for more details about the underlying mutex /// primitive. pub type ReentrantMutex = lock_api::ReentrantMutex; +/// Creates a new reentrant mutex in an unlocked state ready for use. +/// +/// This allows creating a reentrant mutex in a constant context on stable Rust. +pub const fn const_reentrant_mutex(val: T) -> ReentrantMutex { + ReentrantMutex::const_new( + ::INIT, + ::INIT, + val, + ) +} + /// An RAII implementation of a "scoped lock" of a reentrant mutex. When this structure /// is dropped (falls out of scope), the lock will be unlocked. /// diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/rwlock.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/rwlock.rs similarity index 96% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/rwlock.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/rwlock.rs index 776cec0..0381316 100644 --- a/third_party/cargo/vendor/parking_lot-0.10.0/src/rwlock.rs +++ b/third_party/cargo/vendor/parking_lot-0.10.2/src/rwlock.rs @@ -88,6 +88,13 @@ use lock_api; /// ``` pub type RwLock = lock_api::RwLock; +/// Creates a new instance of an `RwLock` which is unlocked. +/// +/// This allows creating a `RwLock` in a constant context on stable Rust. +pub const fn const_rwlock(val: T) -> RwLock { + RwLock::const_new(::INIT, val) +} + /// RAII structure used to release the shared read access of a lock when /// dropped. pub type RwLockReadGuard<'a, T> = lock_api::RwLockReadGuard<'a, RawRwLock, T>; @@ -579,4 +586,28 @@ mod tests { assert_eq!(*(mutex.read()), *(deserialized.read())); assert_eq!(contents, *(deserialized.read())); } + + #[test] + fn test_issue_203() { + struct Bar(RwLock<()>); + + impl Drop for Bar { + fn drop(&mut self) { + let _n = self.0.write(); + } + } + + thread_local! { + static B: Bar = Bar(RwLock::new(())); + } + + thread::spawn(|| { + B.with(|_| ()); + + let a = RwLock::new(()); + let _a = a.read(); + }) + .join() + .unwrap(); + } } diff --git a/third_party/cargo/vendor/parking_lot-0.10.0/src/util.rs b/third_party/cargo/vendor/parking_lot-0.10.2/src/util.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot-0.10.0/src/util.rs rename to third_party/cargo/vendor/parking_lot-0.10.2/src/util.rs diff --git a/third_party/cargo/vendor/parking_lot-0.10.2/tests/issue_203.rs b/third_party/cargo/vendor/parking_lot-0.10.2/tests/issue_203.rs new file mode 100644 index 0000000..a77a95f --- /dev/null +++ b/third_party/cargo/vendor/parking_lot-0.10.2/tests/issue_203.rs @@ -0,0 +1,26 @@ +use parking_lot::RwLock; +use std::thread; + +struct Bar(RwLock<()>); + +impl Drop for Bar { + fn drop(&mut self) { + let _n = self.0.write(); + } +} + +thread_local! { + static B: Bar = Bar(RwLock::new(())); +} + +#[test] +fn main() { + thread::spawn(|| { + B.with(|_| ()); + + let a = RwLock::new(()); + let _a = a.read(); + }) + .join() + .unwrap(); +} diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/.cargo-checksum.json b/third_party/cargo/vendor/parking_lot_core-0.7.2/.cargo-checksum.json similarity index 82% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/.cargo-checksum.json rename to third_party/cargo/vendor/parking_lot_core-0.7.2/.cargo-checksum.json index cb5595b..2b1d6d8 100644 --- a/third_party/cargo/vendor/parking_lot_core-0.7.0/.cargo-checksum.json +++ b/third_party/cargo/vendor/parking_lot_core-0.7.2/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"3f1e8aa786fef106f002b12b25cb128fa1212ce04b2a2a98452ec1e83a662c4b","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","src/lib.rs":"058dddad16d91c8d0160fa2a78bb5f7c2f801f2fd9770fc387c5843395bf0379","src/parking_lot.rs":"13c1c9162933b0b3ed8b5237e03dfa66010e169070faead7a463ef9859bcb740","src/spinwait.rs":"d568d8a81f9144ec4c4a139dc934d7d04ee1656a4a221eb548742fe7aba09ab1","src/thread_parker/cloudabi.rs":"0668b50898c20e7267ac6cc977e7ad376a18958e2d07faeca8199794d873d2eb","src/thread_parker/generic.rs":"2f501c6e46fcff434ba9e13ae8859e66de3327f601ed92989b310124e4129ff4","src/thread_parker/linux.rs":"853fd22f51215d1f553ad6461ad3c92c4ec9c294e607e69ed5f53b2e8c7a11d7","src/thread_parker/mod.rs":"5bc2100d2f575608b5b76e626ca92ce3ba4830176ecc773c5594cda6ca0905e9","src/thread_parker/redox.rs":"081c76af1e24be12da45d8093e261c48d558342ac2ac64dc3f7dd95eaaa1bf11","src/thread_parker/sgx.rs":"3fd71a7066db58189f302d2344e4e425320f82c298ca482ca4318bae44ae37fd","src/thread_parker/unix.rs":"77e1f049207b7e89b22ef05e5134c7538b31fff99aa9660784136f96fec1845a","src/thread_parker/wasm.rs":"b4c9f9e9c1fd636b235a0e8e0227c954b1e7432d8394b58af77b348cdfa2141e","src/thread_parker/wasm_atomic.rs":"a1ab05981a833e72d8d353350ab2b95e6f833cd7224591e595ccdb3692968c23","src/thread_parker/windows/keyed_event.rs":"34fc4693e7afd69a5c426ae7face83b8363f114a44dece44197cd03861cfdded","src/thread_parker/windows/mod.rs":"7702ff9b72ac647ec998a9b205ace961a28839fcd94631fb750ca459e4804260","src/thread_parker/windows/waitaddress.rs":"06d994633006e237dc940f377432ea00cf1609e56096d69d46f7bb3b80eeb857","src/util.rs":"285e6133150645525f2ca1ece41f6d35bad4e7c5e08b42b20c99d2a97e04a974","src/word_lock.rs":"2c030aedb340ae8ca564365206452c298fe29986d005d6a40e808c9760f91c95"},"package":"7582838484df45743c8434fbff785e8edf260c28748353d44bc0da32e0ceabf1"} \ No newline at end of file +{"files":{"Cargo.toml":"8230dddab7c73aa75c9fcb9647c57af37c015e57223ac1706cf7e73e810559dc","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","src/lib.rs":"058dddad16d91c8d0160fa2a78bb5f7c2f801f2fd9770fc387c5843395bf0379","src/parking_lot.rs":"15c2c91f05ca117bb47fbaeb65e19cb039aab0064301c5113c2a48c86b76f5da","src/spinwait.rs":"d568d8a81f9144ec4c4a139dc934d7d04ee1656a4a221eb548742fe7aba09ab1","src/thread_parker/cloudabi.rs":"0668b50898c20e7267ac6cc977e7ad376a18958e2d07faeca8199794d873d2eb","src/thread_parker/generic.rs":"2f501c6e46fcff434ba9e13ae8859e66de3327f601ed92989b310124e4129ff4","src/thread_parker/linux.rs":"853fd22f51215d1f553ad6461ad3c92c4ec9c294e607e69ed5f53b2e8c7a11d7","src/thread_parker/mod.rs":"5bc2100d2f575608b5b76e626ca92ce3ba4830176ecc773c5594cda6ca0905e9","src/thread_parker/redox.rs":"081c76af1e24be12da45d8093e261c48d558342ac2ac64dc3f7dd95eaaa1bf11","src/thread_parker/sgx.rs":"3fd71a7066db58189f302d2344e4e425320f82c298ca482ca4318bae44ae37fd","src/thread_parker/unix.rs":"77e1f049207b7e89b22ef05e5134c7538b31fff99aa9660784136f96fec1845a","src/thread_parker/wasm.rs":"b4c9f9e9c1fd636b235a0e8e0227c954b1e7432d8394b58af77b348cdfa2141e","src/thread_parker/wasm_atomic.rs":"a1ab05981a833e72d8d353350ab2b95e6f833cd7224591e595ccdb3692968c23","src/thread_parker/windows/keyed_event.rs":"34fc4693e7afd69a5c426ae7face83b8363f114a44dece44197cd03861cfdded","src/thread_parker/windows/mod.rs":"7702ff9b72ac647ec998a9b205ace961a28839fcd94631fb750ca459e4804260","src/thread_parker/windows/waitaddress.rs":"06d994633006e237dc940f377432ea00cf1609e56096d69d46f7bb3b80eeb857","src/util.rs":"285e6133150645525f2ca1ece41f6d35bad4e7c5e08b42b20c99d2a97e04a974","src/word_lock.rs":"2c030aedb340ae8ca564365206452c298fe29986d005d6a40e808c9760f91c95"},"package":"d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"} \ No newline at end of file diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/BUILD b/third_party/cargo/vendor/parking_lot_core-0.7.2/BUILD similarity index 85% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/BUILD rename to third_party/cargo/vendor/parking_lot_core-0.7.2/BUILD index 2a120d1..80402cf 100644 --- a/third_party/cargo/vendor/parking_lot_core-0.7.0/BUILD +++ b/third_party/cargo/vendor/parking_lot_core-0.7.2/BUILD @@ -32,13 +32,13 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/cfg-if-0.1.10:cfg_if", - "//third_party/cargo/vendor/libc-0.2.67:libc", - "//third_party/cargo/vendor/smallvec-1.2.0:smallvec", + "//third_party/cargo/vendor/libc-0.2.71:libc", + "//third_party/cargo/vendor/smallvec-1.4.0:smallvec", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.7.0", + version = "0.7.2", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/Cargo.toml b/third_party/cargo/vendor/parking_lot_core-0.7.2/Cargo.toml similarity index 97% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/Cargo.toml rename to third_party/cargo/vendor/parking_lot_core-0.7.2/Cargo.toml index 4da7eb7..d24a5ca 100644 --- a/third_party/cargo/vendor/parking_lot_core-0.7.0/Cargo.toml +++ b/third_party/cargo/vendor/parking_lot_core-0.7.2/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "parking_lot_core" -version = "0.7.0" +version = "0.7.2" authors = ["Amanieu d'Antras "] description = "An advanced API for creating custom synchronization primitives." keywords = ["mutex", "condvar", "rwlock", "once", "thread"] @@ -28,7 +28,7 @@ optional = true version = "0.1.5" [dependencies.petgraph] -version = "0.4.5" +version = "0.5" optional = true [dependencies.smallvec] diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/LICENSE-APACHE b/third_party/cargo/vendor/parking_lot_core-0.7.2/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/LICENSE-APACHE rename to third_party/cargo/vendor/parking_lot_core-0.7.2/LICENSE-APACHE diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/LICENSE-MIT b/third_party/cargo/vendor/parking_lot_core-0.7.2/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/LICENSE-MIT rename to third_party/cargo/vendor/parking_lot_core-0.7.2/LICENSE-MIT diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/lib.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/lib.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/lib.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/lib.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/parking_lot.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/parking_lot.rs similarity index 96% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/parking_lot.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/parking_lot.rs index e91b665..440b7c7 100644 --- a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/parking_lot.rs +++ b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/parking_lot.rs @@ -4,7 +4,7 @@ // http://apache.org/licenses/LICENSE-2.0> or the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. - +use cfg_if::cfg_if; use crate::thread_parker::{ThreadParker, ThreadParkerT, UnparkHandleT}; use crate::util::UncheckedOptionExt; use crate::word_lock::WordLock; @@ -16,6 +16,46 @@ use core::{ use smallvec::SmallVec; use std::time::{Duration, Instant}; +cfg_if! { + if #[cfg(all( + target_arch = "wasm32", + target_os = "unknown", + target_vendor = "unknown" + ))] { + use core::ops::Add; + + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] + struct DummyInstant(Duration); + + impl DummyInstant { + pub fn now() -> DummyInstant { + DummyInstant::zero() + } + + const fn zero() -> DummyInstant { + DummyInstant(Duration::from_secs(0)) + } + } + + impl Add for DummyInstant { + type Output = DummyInstant; + + fn add(self, _rhs: Duration) -> DummyInstant { + DummyInstant::zero() + } + } + + // Use dummy implementation for `Instant` on `wasm32`. The reason for this is + // that `Instant::now()` will always panic because time is currently not implemented + // on wasm32-unknown-unknown. + // See https://github.com/rust-lang/rust/blob/master/src/libstd/sys/wasm/time.rs + type InstantType = DummyInstant; + } else { + // Otherwise use `std::time::Instant` + type InstantType = Instant; + } +} + static NUM_THREADS: AtomicUsize = AtomicUsize::new(0); /// Holds the pointer to the currently active `HashTable`. @@ -47,7 +87,7 @@ impl HashTable { let new_size = (num_threads * LOAD_FACTOR).next_power_of_two(); let hash_bits = 0usize.leading_zeros() - new_size.leading_zeros() - 1; - let now = Instant::now(); + let now = InstantType::now(); let mut entries = Vec::with_capacity(new_size); for i in 0..new_size { // We must ensure the seed is not zero @@ -77,7 +117,7 @@ struct Bucket { impl Bucket { #[inline] - pub fn new(timeout: Instant, seed: u32) -> Self { + pub fn new(timeout: InstantType, seed: u32) -> Self { Self { mutex: WordLock::new(), queue_head: Cell::new(ptr::null()), @@ -89,7 +129,7 @@ impl Bucket { struct FairTimeout { // Next time at which point be_fair should be set - timeout: Instant, + timeout: InstantType, // the PRNG state for calculating the next timeout seed: u32, @@ -97,14 +137,14 @@ struct FairTimeout { impl FairTimeout { #[inline] - fn new(timeout: Instant, seed: u32) -> FairTimeout { + fn new(timeout: InstantType, seed: u32) -> FairTimeout { FairTimeout { timeout, seed } } // Determine whether we should force a fair unlock, and update the timeout #[inline] fn should_timeout(&mut self) -> bool { - let now = Instant::now(); + let now = InstantType::now(); if now > self.timeout { // Time between 0 and 1ms. let nanos = self.gen_u32() % 1_000_000; @@ -216,8 +256,8 @@ fn create_hashtable() -> &'static HashTable { let table = match HASHTABLE.compare_exchange( ptr::null_mut(), new_table, - Ordering::Release, - Ordering::Relaxed, + Ordering::AcqRel, + Ordering::Acquire, ) { Ok(_) => new_table, Err(old_table) => { @@ -1198,10 +1238,14 @@ mod deadlock_impl { pub unsafe fn release_resource(key: usize) { with_thread_data(|thread_data| { let resources = &mut (*thread_data.deadlock_data.resources.get()); - match resources.iter().rposition(|x| *x == key) { - Some(p) => resources.swap_remove(p), - None => panic!("key {} not found in thread resources", key), - }; + + // There is only one situation where we can fail to find the + // resource: we are currently running TLS destructors and our + // ThreadData has already been freed. There isn't much we can do + // about it at this point, so just ignore it. + if let Some(p) = resources.iter().rposition(|x| *x == key) { + resources.swap_remove(p); + } }); } diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/spinwait.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/spinwait.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/spinwait.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/spinwait.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/cloudabi.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/cloudabi.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/cloudabi.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/cloudabi.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/generic.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/generic.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/generic.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/generic.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/linux.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/linux.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/linux.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/linux.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/mod.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/mod.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/mod.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/mod.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/redox.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/redox.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/redox.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/redox.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/sgx.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/sgx.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/sgx.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/sgx.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/unix.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/unix.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/unix.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/unix.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/wasm.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/wasm.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/wasm.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/wasm.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/wasm_atomic.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/wasm_atomic.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/wasm_atomic.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/wasm_atomic.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/windows/keyed_event.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/windows/keyed_event.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/windows/keyed_event.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/windows/keyed_event.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/windows/mod.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/windows/mod.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/windows/mod.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/windows/mod.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/windows/waitaddress.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/windows/waitaddress.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/thread_parker/windows/waitaddress.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/thread_parker/windows/waitaddress.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/util.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/util.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/util.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/util.rs diff --git a/third_party/cargo/vendor/parking_lot_core-0.7.0/src/word_lock.rs b/third_party/cargo/vendor/parking_lot_core-0.7.2/src/word_lock.rs similarity index 100% rename from third_party/cargo/vendor/parking_lot_core-0.7.0/src/word_lock.rs rename to third_party/cargo/vendor/parking_lot_core-0.7.2/src/word_lock.rs diff --git a/third_party/cargo/vendor/png-0.16.1/.cargo-checksum.json b/third_party/cargo/vendor/png-0.16.1/.cargo-checksum.json deleted file mode 100644 index 5b18f74..0000000 --- a/third_party/cargo/vendor/png-0.16.1/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGES.md":"e71971f67bc8a0d8d6d43e7b0ccacbf3716218d4c08851ab9f3083f261b524af","Cargo.lock":"fcab1503189c44ac930761a3bf905fc9e83953d019f20ba966b478ff54c30638","Cargo.toml":"a1fd64989049be9664e881efde2fde8cfbe7317a195586cb456d961a39ef8af1","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"eaf40297c75da471f7cda1f3458e8d91b4b2ec866e609527a13acfa93b638652","README.md":"86b59909aec85ba466fb3821bf0a4beee741486f1199401d12b6f9039951ccd7","benches/README.md":"0c60c3d497abdf6c032863aa47da41bc6bb4f5ff696d45dec0e6eb33459b14b0","benches/decoder.rs":"81a13f5c731f674cc21a6aa472bcf4cc6c3581a41b1e002fa3996fc9a6e0dfe5","examples/pngcheck.rs":"afc0b028c08302d6c041e90201d217482237d09a4495adc360a97c385b311cdb","examples/show.rs":"ccd00c9d1cb7b6b1c2e181994dec6ebdee32c7d5ac9c5bc5592de4496256d696","src/chunk.rs":"f8aa01e68683b5cd41ac2580ac11f2d6a6190c52007e3f115dc5b7c3b0354e63","src/common.rs":"a0bc64f16cfdf511925a2869d9fda70ed07272a8278c1d2db142821babd4c931","src/decoder/mod.rs":"5cdb1cdbc7b52846053437b9730f150284929db1dc174280f3485cb25f9528c9","src/decoder/stream.rs":"18260e2e193c252ea7c1a3669457f699ac6b2f5b4be45afcc554c4988744dc93","src/encoder.rs":"aa8786db0244d6089549974aecd2ec4c9f6e44fdaff4cc646433c7eac4132e20","src/filter.rs":"d21d6f3d87044a6dd71d17e3fcdf23bf41fe23486123dc683c5b63b4e9b33c68","src/lib.rs":"533ca87e8771468637d4cdc0a2def4737b1e74e98ff69a8c11296d905e8ad34e","src/traits.rs":"0a5ae6012e567acdf46aff9d09e89c713d3fa7c399e32a3580b07b86b5f87ef5","src/utils.rs":"ff368caa4ecf41401b51f9d1f693f014079ae2fa369b668505bbc1b1b065d4f6"},"package":"46060468187c21c00ffa2a920690b29997d7fd543f5a4d400461e4a7d4fccde8"} \ No newline at end of file diff --git a/third_party/cargo/vendor/png-0.16.1/benches/decoder.rs b/third_party/cargo/vendor/png-0.16.1/benches/decoder.rs deleted file mode 100644 index 7d9cce9..0000000 --- a/third_party/cargo/vendor/png-0.16.1/benches/decoder.rs +++ /dev/null @@ -1,25 +0,0 @@ -#![cfg(feature = "benchmarks")] -#![feature(test)] - -extern crate png; -extern crate test; - -use std::fs::File; -use std::io::Read; - -use png::Decoder; - -#[bench] -fn bench_big(b: &mut test::Bencher) { - let mut data = Vec::new(); - File::open("tests/pngsuite/PngSuite.png").unwrap().read_to_end(&mut data).unwrap(); - let decoder = Decoder::new(&*data); - let (info, _) = decoder.read_info().unwrap(); - let mut image = vec![0; info.buffer_size()]; - b.iter(|| { - let decoder = Decoder::new(&*data); - let (_, mut decoder) = decoder.read_info().unwrap(); - test::black_box(decoder.next_frame(&mut image)).unwrap(); - }); - b.bytes = info.buffer_size() as u64 -} diff --git a/third_party/cargo/vendor/png-0.16.1/src/filter.rs b/third_party/cargo/vendor/png-0.16.1/src/filter.rs deleted file mode 100644 index 4f81d8e..0000000 --- a/third_party/cargo/vendor/png-0.16.1/src/filter.rs +++ /dev/null @@ -1,158 +0,0 @@ -use std; - -/// The byte level filter applied to scanlines to prepare them for compression. -/// -/// Compression in general benefits from repetitive data. The filter is a content-aware method of -/// compressing the range of occurring byte values to help the compression algorithm. Note that -/// this does not operate on pixels but on raw bytes of a scanline. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -#[repr(u8)] -pub enum FilterType { - NoFilter = 0, - Sub = 1, - Up = 2, - Avg = 3, - Paeth = 4 -} - - impl FilterType { - /// u8 -> Self. Temporary solution until Rust provides a canonical one. - pub fn from_u8(n: u8) -> Option { - match n { - 0 => Some(FilterType::NoFilter), - 1 => Some(FilterType::Sub), - 2 => Some(FilterType::Up), - 3 => Some(FilterType::Avg), - 4 => Some(FilterType::Paeth), - _ => None - } - } -} - -fn filter_paeth(a: u8, b: u8, c: u8) -> u8 { - let ia = i16::from(a); - let ib = i16::from(b); - let ic = i16::from(c); - - let p = ia + ib - ic; - - let pa = (p - ia).abs(); - let pb = (p - ib).abs(); - let pc = (p - ic).abs(); - - if pa <= pb && pa <= pc { - a - } else if pb <= pc { - b - } else { - c - } -} - -pub fn unfilter(filter: FilterType, bpp: usize, previous: &[u8], current: &mut [u8]) -> std::result::Result<(), &'static str> { - use self::FilterType::*; - assert!(bpp > 0); - let len = current.len(); - - match filter { - NoFilter => Ok(()), - Sub => { - for i in bpp..len { - current[i] = current[i].wrapping_add( - current[i - bpp] - ); - } - Ok(()) - } - Up => { - if previous.len() < len { - Err("Filtering failed: not enough data in previous row") - } else { - for i in 0..len { - current[i] = current[i].wrapping_add( - previous[i] - ); - } - Ok(()) - } - } - Avg => { - if previous.len() < len { - Err("Filtering failed: not enough data in previous row") - } else if bpp > len { - Err("Filtering failed: bytes per pixel is greater than length of row") - } else { - for i in 0..bpp { - current[i] = current[i].wrapping_add( - previous[i] / 2 - ); - } - - for i in bpp..len { - current[i] = current[i].wrapping_add( - ((i16::from(current[i - bpp]) + i16::from(previous[i])) / 2) as u8 - ); - } - Ok(()) - } - } - Paeth => { - if previous.len() < len { - Err("Filtering failed: not enough data in previous row") - } else if bpp > len { - Err("Filtering failed: bytes per pixel is greater than length of row") - } else { - for i in 0..bpp { - current[i] = current[i].wrapping_add( - filter_paeth(0, previous[i], 0) - ); - } - - for i in bpp..len { - current[i] = current[i].wrapping_add( - filter_paeth(current[i - bpp], previous[i], previous[i - bpp]) - ); - } - Ok(()) - } - } - } -} - -pub fn filter(method: FilterType, bpp: usize, previous: &[u8], current: &mut [u8]) { - use self::FilterType::*; - assert!(bpp > 0); - let len = current.len(); - - match method { - NoFilter => (), - Sub => { - for i in (bpp..len).rev() { - current[i] = current[i].wrapping_sub(current[i - bpp]); - } - } - Up => { - for i in 0..len { - current[i] = current[i].wrapping_sub(previous[i]); - } - } - Avg => { - for i in (bpp..len).rev() { - current[i] = current[i].wrapping_sub(current[i - bpp].wrapping_add(previous[i]) / 2); - } - - for i in 0..bpp { - current[i] = current[i].wrapping_sub(previous[i] / 2); - } - } - Paeth => { - for i in (bpp..len).rev() { - current[i] = current[i].wrapping_sub(filter_paeth(current[i - bpp], previous[i], previous[i - bpp])); - } - - for i in 0..bpp { - current[i] = current[i].wrapping_sub(filter_paeth(0, previous[i], 0)); - } - } - } -} diff --git a/third_party/cargo/vendor/png-0.16.1/src/traits.rs b/third_party/cargo/vendor/png-0.16.1/src/traits.rs deleted file mode 100644 index fac36f3..0000000 --- a/third_party/cargo/vendor/png-0.16.1/src/traits.rs +++ /dev/null @@ -1,72 +0,0 @@ -use std::io; - -// Will be replaced by stdlib solution -fn read_all(this: &mut R, buf: &mut [u8]) -> io::Result<()> { - let mut total = 0; - while total < buf.len() { - match this.read(&mut buf[total..]) { - Ok(0) => return Err(io::Error::new(io::ErrorKind::Other, - "failed to read the whole buffer")), - Ok(n) => total += n, - Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {} - Err(e) => return Err(e), - } - } - Ok(()) -} - -/// Read extension to read big endian data -pub trait ReadBytesExt: io::Read { - /// Read `T` from a bytes stream. Most significant byte first. - fn read_be(&mut self) -> io::Result; - -} - -/// Write extension to write big endian data -pub trait WriteBytesExt: io::Write { - /// Writes `T` to a bytes stream. Most significant byte first. - fn write_be(&mut self, _: T) -> io::Result<()>; - -} - -impl ReadBytesExt for W { - #[inline] - fn read_be(&mut self) -> io::Result { - let mut byte = [0]; - read_all(self, &mut byte)?; - Ok(byte[0]) - } -} -impl ReadBytesExt for W { - #[inline] - fn read_be(&mut self) -> io::Result { - let mut bytes = [0, 0]; - read_all(self, &mut bytes)?; - Ok((u16::from(bytes[0])) << 8 | u16::from(bytes[1])) - } -} - -impl ReadBytesExt for W { - #[inline] - fn read_be(&mut self) -> io::Result { - let mut bytes = [0, 0, 0, 0]; - read_all(self, &mut bytes)?; - Ok( (u32::from(bytes[0])) << 24 - | (u32::from(bytes[1])) << 16 - | (u32::from(bytes[2])) << 8 - | u32::from(bytes[3]) - ) - } -} - -impl WriteBytesExt for W { - #[inline] - fn write_be(&mut self, n: u32) -> io::Result<()> { - self.write_all(&[ - (n >> 24) as u8, - (n >> 16) as u8, - (n >> 8) as u8, - n as u8 - ]) - } -} diff --git a/third_party/cargo/vendor/png-0.16.3/.cargo-checksum.json b/third_party/cargo/vendor/png-0.16.3/.cargo-checksum.json new file mode 100644 index 0000000..105b121 --- /dev/null +++ b/third_party/cargo/vendor/png-0.16.3/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGES.md":"2c58e65fd811db9f826a64ad0cdaa38612363a9d062bb5dfb6edf048db0b25ed","Cargo.lock":"e124141b762c8c9c2c17d57310eea539a3760ab1574c8d0b63eab4d204b63aee","Cargo.toml":"247c8bbf7f9cc4ee0406214c8ec2a28af901d83a3cfa2b7b6603df5882ceb7cd","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"eaf40297c75da471f7cda1f3458e8d91b4b2ec866e609527a13acfa93b638652","README.md":"86b59909aec85ba466fb3821bf0a4beee741486f1199401d12b6f9039951ccd7","benches/README.md":"0c60c3d497abdf6c032863aa47da41bc6bb4f5ff696d45dec0e6eb33459b14b0","benches/decoder.rs":"bcf50f1b8fb93419829839b5349a85b056370a9f9d42c1e574666afa30943872","examples/pngcheck.rs":"49658ca599514e64d8f4933e43385b68c0cc00ea906c532154594c737ee8f575","examples/show.rs":"f760608dc7adb811c72b757f47465eb62e15172157361cced6acb1448b73653e","src/chunk.rs":"1fbd30e73e776f54d315ceceaaa8d957b2a42a6c4482ac51c72376cc1b328f51","src/common.rs":"cf86723da3aa6acbd87737788cd6425c750b4b308821492596553a34002c56de","src/decoder/mod.rs":"2502e23fa7a1d9352bfbc54515aad688a6051d5f4c653e039ded9ee8511660e6","src/decoder/stream.rs":"05ad02fe98676078b21c0937a77dc234c38beb5982beca45537ad0f593fd2361","src/encoder.rs":"d558090dda914b7e9e1f4a708270332657d5bd76c8420ce9b07d5f6ff5c74130","src/filter.rs":"c230483f14b0f7688afe681913f0db2d009053d9d7d60d6c50de32414d689295","src/lib.rs":"1ed32901cfd4c2bc0a0882cf93487c4898f601d42d272af653fa2d4bfc25e355","src/traits.rs":"79d357244e493f5174ca11873b0d5c443fd4a5e6e1f7c6df400a1767c5ad05b2","src/utils.rs":"e31d3fb904a1d39b9e72c0d4ac4b677065ea68a7c80271649c7fdafb628b1a78"},"package":"2c68a431ed29933a4eb5709aca9800989758c97759345860fa5db3cfced0b65d"} \ No newline at end of file diff --git a/third_party/cargo/vendor/png-0.16.1/BUILD b/third_party/cargo/vendor/png-0.16.3/BUILD similarity index 93% rename from third_party/cargo/vendor/png-0.16.1/BUILD rename to third_party/cargo/vendor/png-0.16.3/BUILD index 698face..dd4c262 100644 --- a/third_party/cargo/vendor/png-0.16.1/BUILD +++ b/third_party/cargo/vendor/png-0.16.3/BUILD @@ -34,13 +34,13 @@ rust_library( deps = [ "//third_party/cargo/vendor/bitflags-1.2.1:bitflags", "//third_party/cargo/vendor/crc32fast-1.2.0:crc32fast", - "//third_party/cargo/vendor/deflate-0.8.3:deflate", + "//third_party/cargo/vendor/deflate-0.8.4:deflate", "//third_party/cargo/vendor/inflate-0.4.5:inflate", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.16.1", + version = "0.16.3", crate_features = [ "default", "deflate", diff --git a/third_party/cargo/vendor/png-0.16.1/CHANGES.md b/third_party/cargo/vendor/png-0.16.3/CHANGES.md similarity index 84% rename from third_party/cargo/vendor/png-0.16.1/CHANGES.md rename to third_party/cargo/vendor/png-0.16.3/CHANGES.md index 04579f6..5e783c4 100644 --- a/third_party/cargo/vendor/png-0.16.1/CHANGES.md +++ b/third_party/cargo/vendor/png-0.16.3/CHANGES.md @@ -1,3 +1,12 @@ +## 0.16.3 + +* Fix encoding with filtering methods Up, Avg, Paeth +* Optimize decoding throughput by up to +30% + +## 0.16.2 + +* Added method constructing an owned stream encoder. + ## 0.16.1 * Addressed files bloating the packed crate diff --git a/third_party/cargo/vendor/png-0.16.3/Cargo.lock b/third_party/cargo/vendor/png-0.16.3/Cargo.lock new file mode 100644 index 0000000..96fe2a7 --- /dev/null +++ b/third_party/cargo/vendor/png-0.16.3/Cargo.lock @@ -0,0 +1,1431 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "adler32" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "andrew" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rusttype 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "approx" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "arrayvec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "blake2b_simd" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bstr" +version = "0.2.12" +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)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bumpalo" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cast" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.50" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cgl" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "clap" +version = "2.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cocoa" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-foundation" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-graphics" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "criterion" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion-plot 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "criterion-plot" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-queue" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "csv" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bstr 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "csv-core" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "deflate" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dirs-sys" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dlib" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "downcast-rs" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "either" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "getopts" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "getrandom" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gl_generator" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gl_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.6.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glium" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "glutin" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_gles2_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_glx_sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_wgl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_gles2_sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "hermit-abi" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "inflate" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itertools" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "itoa" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "js-sys" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +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 = "libc" +version = "0.2.68" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libloading" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "line_drawing" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lock_api" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "memmap" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memoffset" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num_cpus" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "oorandom" +version = "11.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "ordered-float" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "plotters" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "png" +version = "0.16.3" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", + "glium 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.6" +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 = "proc-macro2" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.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 = "quote" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "raw-window-handle" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rayon-core" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_users" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-automata" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rust-argon2" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rusttype" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rusttype 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rusttype" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stb_truetype 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-util 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_derive" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "shared_library" +version = "0.1.9" +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)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "andrew 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-protocols 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stb_truetype" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "term" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tinytemplate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.7" +source = "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 = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "walkdir" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wasm-bindgen" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.60" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wayland-client" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "downcast-rs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-commons" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-protocols" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-scanner" +version = "0.21.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)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-sys" +version = "0.21.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "web-sys" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.8" +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-util" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (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" + +[[package]] +name = "winit" +version = "0.19.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.5 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "x11-dl" +version = "2.18.5" +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)", + "libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xdg" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "xml-rs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +"checksum andrew 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b7f09f89872c2b6b29e319377b1fbe91c6f5947df19a25596e121cf19a7b35e" +"checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +"checksum approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" +"checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +"checksum backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" +"checksum backtrace-sys 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" +"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum bstr 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" +"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" +"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cocoa 0.18.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1706996401131526e36b3b49f0c4d912639ce110996f3ca144d78946727bce54" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum criterion 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc755679c12bda8e5523a71e4d654b6bf2e14bd838dfc48cde6559a05caf7d1" +"checksum criterion-plot 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a01e15e0ea58e8234f96146b1f91fa9d0e4dd7a38da93ff7a75d42c0b9d3a545" +"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" +"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum deflate 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "050ef6de42a33903b30a7497b76b40d3d58691d4d3eec355348c122444a388f0" +"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +"checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" +"checksum downcast-rs 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "52ba6eb47c2131e784a38b726eb54c1e1484904f013e576a25354d0124161af6" +"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" +"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +"checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd" +"checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" +"checksum gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "cae10d7c99d0e77b4766e850a60898a17c1abaf01075531f1066f03dc7dc5fc5" +"checksum glium 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "213290166315d0ff3cf48dd76a31f3ad57c934182d3e87aeec890f2747226a21" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum glutin 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e5cc17ac6cb35704f434faaa5bb5e4254a66f50853976c7e6f00aee09ff1bf2" +"checksum glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "772edef3b28b8ad41e4ea202748e65eefe8e5ffd1f4535f1219793dbb20b3d4c" +"checksum glutin_gles2_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07e853d96bebcb8e53e445225c3009758c6f5960d44f2543245f6f07b567dae0" +"checksum glutin_glx_sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "08c243de74d6cf5ea100c788826d2fb9319de315485dd4b310811a663b3809c3" +"checksum glutin_wgl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a93dba7ee3a0feeac0f437141ff25e71ce2066bcf1a706acab1559ffff94eb6a" +"checksum hermit-abi 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e" +"checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" +"checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +"checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" +"checksum khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.68 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0c0405123bba743ee3f91f49b1c7cfb684eef0da0a50110f758ccf24cdff0" +"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +"checksum line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" +"checksum lock_api 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "79b2de95ecb4691949fea4716ca53cdbcfccb2c612e19644a8bad05edcf9f47b" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +"checksum memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +"checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" +"checksum objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +"checksum oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebcec7c9c2a95cacc7cd0ecb89d8a8454eca13906f6deb55258ffff0adeb9405" +"checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" +"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +"checksum plotters 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "4e3bb8da247d27ae212529352020f3e5ee16e83c0c258061d27b08ab92675eeb" +"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum raw-window-handle 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" +"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" +"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" +"checksum regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" +"checksum rust-argon2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum rusttype 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5" +"checksum rusttype 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "14a911032fb5791ccbeec9f28fdcb9bf0983b81f227bafdfd227c658d0731c8a" +"checksum ryu 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535622e6be132bccd223f4bb2b8ac8d53cda3c7a6394944d3b2b33fb974f9d76" +"checksum same-file 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" +"checksum serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" +"checksum serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)" = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" +"checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" +"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +"checksum smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa" +"checksum stb_truetype 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51" +"checksum syn 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" +"checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum tinytemplate 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a" +"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" +"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" +"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" +"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" +"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" +"checksum wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713" +"checksum wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec" +"checksum wayland-protocols 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4afde2ea2a428eee6d7d2c8584fdbe8b82eee8b6c353e129a434cd6e07f42145" +"checksum wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3828c568714507315ee425a9529edc4a4aa9901409e373e9e0027e7622b79e" +"checksum wayland-sys 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "520ab0fd578017a0ee2206623ba9ef4afe5e8f23ca7b42f6acfba2f4e66b1628" +"checksum web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fa515c5163a99cc82bab70fd3bfdd36d827be85de63737b40fcef2ce084a436e" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winit 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1e96eb4bb472fa43e718e8fa4aef82f86cd9deac9483a1e1529230babdb394a8" +"checksum x11-dl 2.18.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2bf981e3a5b3301209754218f962052d4d9ee97e478f4d26d4a6eced34c1fef8" +"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" +"checksum xml-rs 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9afd061c1c7c8ef0a3d337fbf76fc8c098bd0dfefd4adaafef25a559352f2031" diff --git a/third_party/cargo/vendor/png-0.16.1/Cargo.toml b/third_party/cargo/vendor/png-0.16.3/Cargo.toml similarity index 91% rename from third_party/cargo/vendor/png-0.16.1/Cargo.toml rename to third_party/cargo/vendor/png-0.16.3/Cargo.toml index 133d195..c3b20bb 100644 --- a/third_party/cargo/vendor/png-0.16.1/Cargo.toml +++ b/third_party/cargo/vendor/png-0.16.3/Cargo.toml @@ -13,13 +13,18 @@ [package] edition = "2018" name = "png" -version = "0.16.1" +version = "0.16.3" authors = ["nwin "] include = ["/LICENSE-MIT", "/LICENSE-APACHE", "/README.md", "/CHANGES.md", "/src/", "/examples/", "/benches/"] description = "PNG decoding and encoding library in pure Rust" categories = ["multimedia::images"] license = "MIT OR Apache-2.0" repository = "https://github.com/image-rs/image-png.git" + +[[bench]] +name = "decoder" +path = "benches/decoder.rs" +harness = false [dependencies.bitflags] version = "1.0" @@ -32,6 +37,9 @@ optional = true [dependencies.inflate] version = "0.4.2" +[dev-dependencies.criterion] +version = "0.3.1" + [dev-dependencies.getopts] version = "0.2.14" diff --git a/third_party/cargo/vendor/png-0.16.1/LICENSE-APACHE b/third_party/cargo/vendor/png-0.16.3/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/png-0.16.1/LICENSE-APACHE rename to third_party/cargo/vendor/png-0.16.3/LICENSE-APACHE diff --git a/third_party/cargo/vendor/png-0.16.1/LICENSE-MIT b/third_party/cargo/vendor/png-0.16.3/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/png-0.16.1/LICENSE-MIT rename to third_party/cargo/vendor/png-0.16.3/LICENSE-MIT diff --git a/third_party/cargo/vendor/png-0.16.1/README.md b/third_party/cargo/vendor/png-0.16.3/README.md similarity index 100% rename from third_party/cargo/vendor/png-0.16.1/README.md rename to third_party/cargo/vendor/png-0.16.3/README.md diff --git a/third_party/cargo/vendor/png-0.16.1/benches/README.md b/third_party/cargo/vendor/png-0.16.3/benches/README.md similarity index 100% rename from third_party/cargo/vendor/png-0.16.1/benches/README.md rename to third_party/cargo/vendor/png-0.16.3/benches/README.md diff --git a/third_party/cargo/vendor/png-0.16.3/benches/decoder.rs b/third_party/cargo/vendor/png-0.16.3/benches/decoder.rs new file mode 100644 index 0000000..4403af2 --- /dev/null +++ b/third_party/cargo/vendor/png-0.16.3/benches/decoder.rs @@ -0,0 +1,39 @@ +use std::fs; + +use criterion::{criterion_group, criterion_main, Criterion, Throughput}; +use png::Decoder; + +fn load_all(c: &mut Criterion) { + for file in fs::read_dir("tests/benches/").unwrap() { + if let Ok(entry) = file { + match entry.path().extension() { + Some(st) if st == "png" => {} + _ => continue, + } + + let data = fs::read(entry.path()).unwrap(); + bench_file(c, data, entry.file_name().into_string().unwrap()); + } + } +} + +criterion_group!(benches, load_all); +criterion_main!(benches); + +fn bench_file(c: &mut Criterion, data: Vec, name: String) { + let mut group = c.benchmark_group("decode"); + group.sample_size(20); + + let decoder = Decoder::new(&*data); + let (info, _) = decoder.read_info().unwrap(); + let mut image = vec![0; info.buffer_size()]; + + group.throughput(Throughput::Bytes(info.buffer_size() as u64)); + group.bench_with_input(name, &data, |b, data| { + b.iter(|| { + let decoder = Decoder::new(data.as_slice()); + let (_, mut decoder) = decoder.read_info().unwrap(); + decoder.next_frame(&mut image).unwrap(); + }) + }); +} diff --git a/third_party/cargo/vendor/png-0.16.1/examples/pngcheck.rs b/third_party/cargo/vendor/png-0.16.3/examples/pngcheck.rs similarity index 83% rename from third_party/cargo/vendor/png-0.16.1/examples/pngcheck.rs rename to third_party/cargo/vendor/png-0.16.3/examples/pngcheck.rs index 6cd0b5b..735411b 100644 --- a/third_party/cargo/vendor/png-0.16.1/examples/pngcheck.rs +++ b/third_party/cargo/vendor/png-0.16.3/examples/pngcheck.rs @@ -4,11 +4,11 @@ extern crate getopts; extern crate glob; extern crate png; +use std::env; +use std::fs::File; use std::io; use std::io::prelude::*; use std::path::Path; -use std::fs::File; -use std::env; use getopts::{Matches, Options, ParsingStyle}; use term::{color, Attr}; @@ -24,10 +24,13 @@ fn parse_args() -> Matches { if args.len() > 1 { match opts.parse(&args[1..]) { Ok(matches) => return matches, - Err(err) => println!("{}", err) + Err(err) => println!("{}", err), } } - println!("{}", opts.usage(&format!("Usage: pngcheck [-cpt] [file ...]"))); + println!( + "{}", + opts.usage(&format!("Usage: pngcheck [-cpt] [file ...]")) + ); std::process::exit(0); } @@ -35,7 +38,7 @@ fn parse_args() -> Matches { struct Config { quiet: bool, verbose: bool, - color: bool + color: bool, } fn display_interlaced(i: bool) -> &'static str { @@ -56,7 +59,7 @@ fn display_image_type(bits: u8, color: png::ColorType) -> String { RGB => "RGB", Indexed => "palette", GrayscaleAlpha => "grayscale+alpha", - RGBA => "RGB+alpha" + RGBA => "RGB+alpha", } ) } @@ -68,7 +71,7 @@ fn final_channels(c: png::ColorType, trns: bool) -> u8 { RGB => 3, Indexed => 3 + if trns { 1 } else { 0 }, GrayscaleAlpha => 2, - RGBA => 4 + RGBA => 4, } } fn check_image>(c: Config, fname: P) -> io::Result<()> { @@ -76,9 +79,9 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { use png::Decoded::*; let mut t = term::stdout().ok_or(io::Error::new( io::ErrorKind::Other, - "could not open terminal" + "could not open terminal", ))?; - let mut data = vec![0; 10*1024]; + let mut data = vec![0; 10 * 1024]; let data_p = data.as_mut_ptr(); let mut reader = io::BufReader::new(File::open(&fname)?); let fname = fname.as_ref().to_string_lossy(); @@ -108,7 +111,7 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { let display_error = |err| -> Result<_, io::Error> { let mut t = term::stdout().ok_or(io::Error::new( io::ErrorKind::Other, - "could not open terminal" + "could not open terminal", ))?; if c.verbose { if c.color { @@ -124,18 +127,20 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { } println!(" in {}", fname); } else { - if !c.quiet { if c.color { - t.fg(color::RED)?; - t.attr(Attr::Bold)?; - write!(t, "ERROR")?; - t.reset()?; - write!(t, ": ")?; - t.fg(color::YELLOW)?; - writeln!(t, "{}", fname)?; - t.reset()?; - } else { - println!("ERROR: {}", fname) - }} + if !c.quiet { + if c.color { + t.fg(color::RED)?; + t.attr(Attr::Bold)?; + write!(t, "ERROR")?; + t.reset()?; + write!(t, ": ")?; + t.fg(color::YELLOW)?; + writeln!(t, "{}", fname)?; + t.reset()?; + } else { + println!("ERROR: {}", fname) + } + } print!("{}: ", fname); if c.color { t.fg(color::RED)?; @@ -144,11 +149,10 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { } else { println!("{}", err); } - } Ok(()) }; - + if c.verbose { print!("File: "); if c.color { @@ -159,15 +163,12 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { print!("{}", fname); } print!(" ({}) bytes", data.len()) - } loop { if buf.len() == 0 { // circumvent borrow checker assert!(!data.is_empty()); - let n = reader.read(unsafe { - ::std::slice::from_raw_parts_mut(data_p, data.len()) - })?; + let n = reader.read(unsafe { ::std::slice::from_raw_parts_mut(data_p, data.len()) })?; // EOF if n == 0 { @@ -202,7 +203,7 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { display_image_type(bits, color), (if trns { "+trns" } else { "" }), display_interlaced(interlaced), - 100.0*(1.0-c_ratio!()) + 100.0 * (1.0 - c_ratio!()) ) } else if !c.quiet { println!(""); @@ -218,11 +219,11 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { "in {} ({} chunks, {:.1}% compression)", fname, n_chunks, - 100.0*(1.0-c_ratio!()) + 100.0 * (1.0 - c_ratio!()) ) } - break - }, + break; + } Ok((n, res)) => { buf = &buf[n..]; pos += n; @@ -258,11 +259,11 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { chunk::IDAT => { have_idat = true; compressed_size += len - }, + } chunk::tRNS => { trns = true; - }, - _ => () + } + _ => (), } } ImageData => { @@ -282,16 +283,12 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { display_interlaced(interlaced), ); } - _ => () + _ => (), } } AnimationControl(actl) => { println!(""); - print!( - " {} frames, {} plays", - actl.num_frames, - actl.num_plays, - ); + print!(" {} frames, {} plays", actl.num_frames, actl.num_plays,); } FrameControl(fctl) => { println!(""); @@ -310,18 +307,22 @@ fn check_image>(c: Config, fname: P) -> io::Result<()> { print!( " {}/{} s delay, dispose: {}, blend: {}", fctl.delay_num, - if fctl.delay_den == 0 { 100 } else {fctl.delay_den}, + if fctl.delay_den == 0 { + 100 + } else { + fctl.delay_den + }, fctl.dispose_op, fctl.blend_op, ); } - _ => () + _ => (), } //println!("{} {:?}", n, res) - }, + } Err(err) => { let _ = display_error(err); - break + break; } } } @@ -334,20 +335,20 @@ fn main() { let config = Config { quiet: m.opt_present("q"), verbose: m.opt_present("v"), - color: m.opt_present("c") + color: m.opt_present("c"), }; for file in m.free { let result = if file.contains("*") { - glob::glob(&file).map_err(|err| { - io::Error::new(io::ErrorKind::Other, err) - }).and_then(|mut glob| glob.try_for_each(|entry| { - entry.map_err(|err| { - io::Error::new(io::ErrorKind::Other, err) - }).and_then(|file| { - check_image(config, file) + glob::glob(&file) + .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) + .and_then(|mut glob| { + glob.try_for_each(|entry| { + entry + .map_err(|err| io::Error::new(io::ErrorKind::Other, err)) + .and_then(|file| check_image(config, file)) + }) }) - })) } else { check_image(config, &file) }; diff --git a/third_party/cargo/vendor/png-0.16.1/examples/show.rs b/third_party/cargo/vendor/png-0.16.3/examples/show.rs similarity index 54% rename from third_party/cargo/vendor/png-0.16.1/examples/show.rs rename to third_party/cargo/vendor/png-0.16.3/examples/show.rs index 9185b8f..131610e 100644 --- a/third_party/cargo/vendor/png-0.16.1/examples/show.rs +++ b/third_party/cargo/vendor/png-0.16.3/examples/show.rs @@ -2,17 +2,17 @@ extern crate glium; extern crate glob; extern crate png; -use std::env; -use std::io; -use std::fs::File; use std::borrow::Cow; -use std::path; +use std::env; use std::error::Error; +use std::fs::File; +use std::io; +use std::path; -use glium::{Surface, Rect, BlitTarget}; -use glium::texture::{RawImage2d, ClientFormat}; -use glium::glutin::{self, Event, VirtualKeyCode, dpi}; use glium::backend::glutin::Display; +use glium::glutin::{self, dpi, Event, VirtualKeyCode}; +use glium::texture::{ClientFormat, RawImage2d}; +use glium::{BlitTarget, Rect, Surface}; /// Load the image using `png` fn load_image(path: &path::PathBuf) -> io::Result> { @@ -27,33 +27,34 @@ fn load_image(path: &path::PathBuf) -> io::Result> { RGBA => (img_data, ClientFormat::U8U8U8U8), Grayscale => ( { - let mut vec = Vec::with_capacity(img_data.len()*3); + let mut vec = Vec::with_capacity(img_data.len() * 3); for g in img_data { vec.extend([g, g, g].iter().cloned()) } vec }, - ClientFormat::U8U8U8 + ClientFormat::U8U8U8, ), GrayscaleAlpha => ( { - let mut vec = Vec::with_capacity(img_data.len()*3); + let mut vec = Vec::with_capacity(img_data.len() * 3); for ga in img_data.chunks(2) { - let g = ga[0]; let a = ga[1]; + let g = ga[0]; + let a = ga[1]; vec.extend([g, g, g, a].iter().cloned()) } vec }, - ClientFormat::U8U8U8U8 + ClientFormat::U8U8U8U8, ), - _ => unreachable!("uncovered color type") + _ => unreachable!("uncovered color type"), }; Ok(RawImage2d { data: Cow::Owned(data), width: info.width, height: info.height, - format: format + format: format, }) } @@ -65,14 +66,10 @@ fn main_loop(files: Vec) -> io::Result<()> { let mut events_loop = glutin::EventsLoop::new(); let window = glutin::WindowBuilder::new(); - let context = glutin::ContextBuilder::new() - .with_vsync(true); + let context = glutin::ContextBuilder::new().with_vsync(true); let display = Display::new(window, context, &events_loop) - .map_err(|err| io::Error::new( - io::ErrorKind::Other, - err.description() - ))?; + .map_err(|err| io::Error::new(io::ErrorKind::Other, err))?; // building the display, ie. the main object resize_window(&display, &image); let mut opengl_texture = glium::Texture2d::new(&display, image).unwrap(); @@ -81,69 +78,93 @@ fn main_loop(files: Vec) -> io::Result<()> { let mut res = Ok(()); 'main: loop { let frame = display.draw(); - fill_v_flipped(&opengl_texture.as_surface(), &frame, glium::uniforms::MagnifySamplerFilter::Linear); + fill_v_flipped( + &opengl_texture.as_surface(), + &frame, + glium::uniforms::MagnifySamplerFilter::Linear, + ); frame.finish().unwrap(); // polling and handling the events received by the window events_loop.poll_events(|event| { - if stop {return;} + if stop { + return; + } match event { - Event::WindowEvent {event: WindowEvent::CloseRequested, ..} => { + Event::WindowEvent { + event: WindowEvent::CloseRequested, + .. + } => { stop = true; return; } Event::WindowEvent { - event: WindowEvent::KeyboardInput { - input: KeyboardInput { - state: glutin::ElementState::Pressed, - virtual_keycode: code, + event: + WindowEvent::KeyboardInput { + input: + KeyboardInput { + state: glutin::ElementState::Pressed, + virtual_keycode: code, + .. + }, .. }, - .. - }, .. } => match code { Some(VirtualKeyCode::Escape) => { stop = true; return; } - Some(VirtualKeyCode::Right) => { - match files.next() { - Some(path) => { - let image = match load_image(path) { - Ok(image) => image, - Err(err) => { - stop = true; - res = Err(err); - return; - } - }; - resize_window(&display, &image); - opengl_texture = glium::Texture2d::new(&display, image).unwrap(); - }, - None => { - stop = true; - return; - } + Some(VirtualKeyCode::Right) => match files.next() { + Some(path) => { + let image = match load_image(path) { + Ok(image) => image, + Err(err) => { + stop = true; + res = Err(err); + return; + } + }; + resize_window(&display, &image); + opengl_texture = glium::Texture2d::new(&display, image).unwrap(); + } + None => { + stop = true; + return; } }, - _ => () + _ => (), }, - _ => () + _ => (), } }); - if stop {break 'main;} + if stop { + break 'main; + } } res } fn fill_v_flipped(src: &S1, target: &S2, filter: glium::uniforms::MagnifySamplerFilter) -where S1: Surface, S2: Surface { +where + S1: Surface, + S2: Surface, +{ let src_dim = src.get_dimensions(); - let src_rect = Rect { left: 0, bottom: 0, width: src_dim.0 as u32, height: src_dim.1 as u32 }; + let src_rect = Rect { + left: 0, + bottom: 0, + width: src_dim.0 as u32, + height: src_dim.1 as u32, + }; let target_dim = target.get_dimensions(); - let target_rect = BlitTarget { left: 0, bottom: target_dim.1, width: target_dim.0 as i32, height: -(target_dim.1 as i32) }; + let target_rect = BlitTarget { + left: 0, + bottom: target_dim.1, + width: target_dim.0 as i32, + height: -(target_dim.1 as i32), + }; src.blit_color(&src_rect, target, &target_rect, filter); } @@ -157,7 +178,10 @@ fn resize_window(display: &Display, image: &RawImage2d<'static, u8>) { width *= 10; height *= 10; } - display.gl_window().window().set_inner_size(dpi::LogicalSize::new(f64::from(width), f64::from(height))); + display + .gl_window() + .window() + .set_inner_size(dpi::LogicalSize::new(f64::from(width), f64::from(height))); } fn main() { @@ -169,12 +193,13 @@ fn main() { for file in args.iter().skip(1) { match if file.contains("*") { (|| -> io::Result<_> { - for entry in glob::glob(&file).map_err(|err| { - io::Error::new(io::ErrorKind::Other, err.msg) - })? { - files.push(entry.map_err(|_| { - io::Error::new(io::ErrorKind::Other, "glob error") - })?) + for entry in glob::glob(&file) + .map_err(|err| io::Error::new(io::ErrorKind::Other, err.msg))? + { + files.push( + entry + .map_err(|_| io::Error::new(io::ErrorKind::Other, "glob error"))?, + ) } Ok(()) })() @@ -185,15 +210,14 @@ fn main() { Ok(_) => (), Err(err) => { println!("{}: {}", file, err); - break + break; } } - } // "tests/pngsuite/pngsuite.png" match main_loop(files) { Ok(_) => (), - Err(err) => println!("Error: {}", err) + Err(err) => println!("Error: {}", err), } } } diff --git a/third_party/cargo/vendor/png-0.16.1/src/chunk.rs b/third_party/cargo/vendor/png-0.16.3/src/chunk.rs similarity index 99% rename from third_party/cargo/vendor/png-0.16.1/src/chunk.rs rename to third_party/cargo/vendor/png-0.16.3/src/chunk.rs index 9e24e6e..b83d8d3 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/chunk.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/chunk.rs @@ -56,4 +56,4 @@ pub fn reserved_set(type_: ChunkType) -> bool { /// Returns true if the chunk is safe to copy if unknown. pub fn safe_to_copy(type_: ChunkType) -> bool { type_[3] & 32 != 0 -} \ No newline at end of file +} diff --git a/third_party/cargo/vendor/png-0.16.1/src/common.rs b/third_party/cargo/vendor/png-0.16.3/src/common.rs similarity index 95% rename from third_party/cargo/vendor/png-0.16.1/src/common.rs rename to third_party/cargo/vendor/png-0.16.3/src/common.rs index 014efb7..ab44d86 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/common.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/common.rs @@ -11,7 +11,7 @@ pub enum ColorType { RGB = 2, Indexed = 3, GrayscaleAlpha = 4, - RGBA = 6 + RGBA = 6, } impl ColorType { @@ -22,10 +22,10 @@ impl ColorType { Grayscale | Indexed => 1, RGB => 3, GrayscaleAlpha => 2, - RGBA => 4 + RGBA => 4, } } - + /// u8 -> Self. Temporary solution until Rust provides a canonical one. pub fn from_u8(n: u8) -> Option { match n { @@ -34,7 +34,7 @@ impl ColorType { 3 => Some(ColorType::Indexed), 4 => Some(ColorType::GrayscaleAlpha), 6 => Some(ColorType::RGBA), - _ => None + _ => None, } } } @@ -43,10 +43,10 @@ impl ColorType { #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u8)] pub enum BitDepth { - One = 1, - Two = 2, - Four = 4, - Eight = 8, + One = 1, + Two = 2, + Four = 4, + Eight = 8, Sixteen = 16, } @@ -59,7 +59,7 @@ impl BitDepth { 4 => Some(BitDepth::Four), 8 => Some(BitDepth::Eight), 16 => Some(BitDepth::Sixteen), - _ => None + _ => None, } } } @@ -89,7 +89,7 @@ impl Unit { match n { 0 => Some(Unit::Unspecified), 1 => Some(Unit::Meter), - _ => None + _ => None, } } } @@ -99,11 +99,11 @@ impl Unit { #[repr(u8)] pub enum DisposeOp { /// Leave the buffer unchanged. - None = 0, + None = 0, /// Clear buffer with the background color. Background = 1, /// Reset the buffer to the state before the current frame. - Previous = 2, + Previous = 2, } impl DisposeOp { @@ -113,7 +113,7 @@ impl DisposeOp { 0 => Some(DisposeOp::None), 1 => Some(DisposeOp::Background), 2 => Some(DisposeOp::Previous), - _ => None + _ => None, } } } @@ -136,7 +136,7 @@ pub enum BlendOp { /// Pixels overwrite the value at their position. Source = 0, /// The new pixels are blended into the current state based on alpha. - Over = 1, + Over = 1, } impl BlendOp { @@ -145,7 +145,7 @@ impl BlendOp { match n { 0 => Some(BlendOp::Source), 1 => Some(BlendOp::Over), - _ => None + _ => None, } } } @@ -207,7 +207,6 @@ impl FrameControl { pub fn inc_seq_num(&mut self, i: u32) { self.sequence_number += i; } - } /// Animation control information @@ -266,8 +265,8 @@ impl Default for Info { pixel_dims: None, frame_control: None, animation_control: None, - // Default to `deflate::Compresion::Fast` and `filter::FilterType::Sub` - // to maintain backward compatible output. + // Default to `deflate::Compresion::Fast` and `filter::FilterType::Sub` + // to maintain backward compatible output. compression: Compression::Fast, filter: filter::FilterType::Sub, } @@ -279,57 +278,62 @@ impl Info { pub fn size(&self) -> (u32, u32) { (self.width, self.height) } - + /// Returns true if the image is an APNG image. pub fn is_animated(&self) -> bool { self.frame_control.is_some() && self.animation_control.is_some() } - + /// Returns the frame control information of the image pub fn animation_control(&self) -> Option<&AnimationControl> { self.animation_control.as_ref() } - + /// Returns the frame control information of the current frame pub fn frame_control(&self) -> Option<&FrameControl> { self.frame_control.as_ref() } - + /// Returns the bits per pixel pub fn bits_per_pixel(&self) -> usize { self.color_type.samples() * self.bit_depth as usize } - + /// Returns the bytes per pixel pub fn bytes_per_pixel(&self) -> usize { self.color_type.samples() * ((self.bit_depth as usize + 7) >> 3) } - + /// Returns the number of bytes needed for one deinterlaced image pub fn raw_bytes(&self) -> usize { self.height as usize * self.raw_row_length() } - - /// Returns the number of bytes needed for one deinterlaced row + + /// Returns the number of bytes needed for one deinterlaced row pub fn raw_row_length(&self) -> usize { let bits = self.width as usize * self.color_type.samples() * self.bit_depth as usize; let extra = bits % 8; - bits/8 - + match extra { 0 => 0, _ => 1 } - + 1 // filter method + bits / 8 + + match extra { + 0 => 0, + _ => 1, + } + + 1 // filter method } - + /// Returns the number of bytes needed for one deinterlaced row of width `width` pub fn raw_row_length_from_width(&self, width: u32) -> usize { let bits = width as usize * self.color_type.samples() * self.bit_depth as usize; let extra = bits % 8; - bits/8 - + match extra { 0 => 0, _ => 1 } - + 1 // filter method + bits / 8 + + match extra { + 0 => 0, + _ => 1, + } + + 1 // filter method } } - bitflags! { /// # Output transformations /// @@ -401,4 +405,3 @@ mod deflate_convert { } } } - diff --git a/third_party/cargo/vendor/png-0.16.1/src/decoder/mod.rs b/third_party/cargo/vendor/png-0.16.3/src/decoder/mod.rs similarity index 65% rename from third_party/cargo/vendor/png-0.16.1/src/decoder/mod.rs rename to third_party/cargo/vendor/png-0.16.3/src/decoder/mod.rs index 7665983..1a23163 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/decoder/mod.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/decoder/mod.rs @@ -1,15 +1,15 @@ mod stream; -pub use self::stream::{StreamingDecoder, Decoded, DecodingError}; -use self::stream::{CHUNCK_BUFFER_SIZE, get_info}; +use self::stream::{get_info, CHUNCK_BUFFER_SIZE}; +pub use self::stream::{Decoded, DecodingError, StreamingDecoder}; -use std::mem; use std::borrow; -use std::io::{Read, Write, BufReader, BufRead}; +use std::io::{BufRead, BufReader, Read, Write}; +use std::mem; -use crate::common::{ColorType, BitDepth, Info, Transformations}; -use crate::filter::{unfilter, FilterType}; use crate::chunk::IDAT; +use crate::common::{BitDepth, ColorType, Info, Transformations}; +use crate::filter::{unfilter, FilterType}; use crate::utils; /* @@ -50,7 +50,7 @@ pub struct Limits { impl Default for Limits { fn default() -> Limits { Limits { - bytes: 1024*1024*64, + bytes: 1024 * 1024 * 64, } } } @@ -65,15 +65,27 @@ pub struct Decoder { limits: Limits, } +struct InterlacedRow<'data> { + data: &'data [u8], + interlace: InterlaceInfo, +} + +enum InterlaceInfo { + None, + Adam7 { pass: u8, line: u32, width: u32 }, +} + impl Decoder { pub fn new(r: R) -> Decoder { Decoder::new_with_limits(r, Limits::default()) } - + pub fn new_with_limits(r: R, limits: Limits) -> Decoder { Decoder { r, - transform: crate::Transformations::EXPAND | crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16, + transform: crate::Transformations::EXPAND + | crate::Transformations::SCALE_16 + | crate::Transformations::STRIP_16, limits, } } @@ -128,7 +140,7 @@ impl Decoder { struct ReadDecoder { reader: BufReader, decoder: StreamingDecoder, - at_eof: bool + at_eof: bool, } impl ReadDecoder { @@ -139,9 +151,7 @@ impl ReadDecoder { let (consumed, result) = { let buf = self.reader.fill_buf()?; if buf.is_empty() { - return Err(DecodingError::Format( - "unexpected EOF".into() - )) + return Err(DecodingError::Format("unexpected EOF".into())); } self.decoder.update(buf, image_data)? }; @@ -149,7 +159,7 @@ impl ReadDecoder { match result { Decoded::Nothing => (), Decoded::ImageEnd => self.at_eof = true, - result => return Ok(Some(result)) + result => return Ok(Some(result)), } } Ok(None) @@ -172,6 +182,8 @@ pub struct Reader { prev: Vec, /// Current raw line current: Vec, + /// Start index of the current scan line. + scan_start: usize, /// Output transformations transform: Transformations, /// Processed line @@ -192,13 +204,14 @@ impl Reader { decoder: ReadDecoder { reader: BufReader::with_capacity(CHUNCK_BUFFER_SIZE, r), decoder: d, - at_eof: false + at_eof: false, }, bpp: 0, rowlen: 0, adam7: None, prev: Vec::new(), current: Vec::new(), + scan_start: 0, transform: t, processed: Vec::new(), limits, @@ -214,18 +227,14 @@ impl Reader { loop { match self.decoder.decode_next(&mut Vec::new())? { Some(ChunkBegin(_, IDAT)) => break, - None => return Err(DecodingError::Format( - "IDAT chunk missing".into() - )), + None => return Err(DecodingError::Format("IDAT chunk missing".into())), _ => (), } } { let info = match self.decoder.info() { Some(info) => info, - None => return Err(DecodingError::Format( - "IHDR chunk missing".into() - )) + None => return Err(DecodingError::Format("IHDR chunk missing".into())), }; self.bpp = info.bytes_per_pixel(); self.rowlen = info.raw_row_length(); @@ -250,15 +259,15 @@ impl Reader { let width = get_info!(self).width; if buf.len() < self.output_buffer_size() { return Err(DecodingError::Other( - "supplied buffer is too small to hold the image".into() - )) + "supplied buffer is too small to hold the image".into(), + )); } if get_info!(self).interlaced { - while let Some((row, adam7)) = self.next_interlaced_row()? { - let (pass, line, _) = adam7.unwrap(); - let samples = color_type.samples() as u8; - utils::expand_pass(buf, width, row, pass, line, samples * (bit_depth as u8)); - } + while let Some((row, adam7)) = self.next_interlaced_row()? { + let (pass, line, _) = adam7.unwrap(); + let samples = color_type.samples() as u8; + utils::expand_pass(buf, width, row, pass, line, samples * (bit_depth as u8)); + } } else { let mut len = 0; while let Some(row) = self.next_row()? { @@ -274,70 +283,94 @@ impl Reader { } /// Returns the next processed row of the image - pub fn next_interlaced_row(&mut self) -> Result)>, DecodingError> { - use crate::common::ColorType::*; - let transform = self.transform; - if transform == crate::Transformations::IDENTITY { - self.next_raw_interlaced_row() - } else { - // swap buffer to circumvent borrow issues - let mut buffer = mem::replace(&mut self.processed, Vec::new()); - let (got_next, adam7) = if let Some((row, adam7)) = self.next_raw_interlaced_row()? { - (&mut buffer[..]).write_all(row)?; - (true, adam7) - } else { - (false, None) - }; - // swap back - let _ = mem::replace(&mut self.processed, buffer); - if got_next { - let (color_type, bit_depth, trns) = { - let info = get_info!(self); - (info.color_type, info.bit_depth as u8, info.trns.is_some()) + pub fn next_interlaced_row( + &mut self, + ) -> Result)>, DecodingError> { + match self.next_interlaced_row_impl() { + Err(err) => Err(err), + Ok(None) => Ok(None), + Ok(Some(row)) => { + let interlace = match row.interlace { + InterlaceInfo::None => None, + InterlaceInfo::Adam7 { pass, line, width } => Some((pass, line, width)), }; - let output_buffer = if let Some((_, _, width)) = adam7 { - let width = self.line_size(width); - &mut self.processed[..width] - } else { - &mut *self.processed - }; - let mut len = output_buffer.len(); - if transform.contains(crate::Transformations::EXPAND) { - match color_type { - Indexed => { - expand_paletted(output_buffer, get_info!(self))? - } - Grayscale | GrayscaleAlpha if bit_depth < 8 => expand_gray_u8( - output_buffer, get_info!(self) - ), - Grayscale | RGB if trns => { - let channels = color_type.samples(); - let trns = get_info!(self).trns.as_ref().unwrap(); - if bit_depth == 8 { - utils::expand_trns_line(output_buffer, &*trns, channels); - } else { - utils::expand_trns_line16(output_buffer, &*trns, channels); - } - }, - _ => () - } - } - if bit_depth == 16 && transform.intersects(crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16) { - len /= 2; - for i in 0..len { - output_buffer[i] = output_buffer[2 * i]; - } - } - Ok(Some(( - &output_buffer[..len], - adam7 - ))) - } else { - Ok(None) + + Ok(Some((row.data, interlace))) } } } + /// Fetch the next interlaced row and filter it according to our own transformations. + fn next_interlaced_row_impl(&mut self) -> Result>, DecodingError> { + use crate::common::ColorType::*; + let transform = self.transform; + + if transform == crate::Transformations::IDENTITY { + return self.next_raw_interlaced_row(); + } + + // swap buffer to circumvent borrow issues + let mut buffer = mem::replace(&mut self.processed, Vec::new()); + let (got_next, adam7) = if let Some(row) = self.next_raw_interlaced_row()? { + (&mut buffer[..]).write_all(row.data)?; + (true, row.interlace) + } else { + (false, InterlaceInfo::None) + }; + // swap back + let _ = mem::replace(&mut self.processed, buffer); + + if !got_next { + return Ok(None); + } + + let (color_type, bit_depth, trns) = { + let info = get_info!(self); + (info.color_type, info.bit_depth as u8, info.trns.is_some()) + }; + let output_buffer = if let InterlaceInfo::Adam7 { width, .. } = adam7 { + let width = self.line_size(width); + &mut self.processed[..width] + } else { + &mut *self.processed + }; + + let mut len = output_buffer.len(); + if transform.contains(crate::Transformations::EXPAND) { + match color_type { + Indexed => expand_paletted(output_buffer, get_info!(self))?, + Grayscale | GrayscaleAlpha if bit_depth < 8 => { + expand_gray_u8(output_buffer, get_info!(self)) + } + Grayscale | RGB if trns => { + let channels = color_type.samples(); + let trns = get_info!(self).trns.as_ref().unwrap(); + if bit_depth == 8 { + utils::expand_trns_line(output_buffer, &*trns, channels); + } else { + utils::expand_trns_line16(output_buffer, &*trns, channels); + } + } + _ => (), + } + } + + if bit_depth == 16 + && transform + .intersects(crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16) + { + len /= 2; + for i in 0..len { + output_buffer[i] = output_buffer[2 * i]; + } + } + + Ok(Some(InterlacedRow { + data: &output_buffer[..len], + interlace: adam7, + })) + } + /// Returns the color type and the number of bits per sample /// of the data returned by `Reader::next_row` and Reader::frames`. pub fn output_color_type(&mut self) -> (ColorType, BitDepth) { @@ -349,10 +382,13 @@ impl Reader { } else { let bits = match info.bit_depth as u8 { 16 if t.intersects( - crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16 - ) => 8, + crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16, + ) => + { + 8 + } n if n < 8 && t.contains(crate::Transformations::EXPAND) => 8, - n => n + n => n, }; let color_type = if t.contains(crate::Transformations::EXPAND) { let has_trns = info.trns.is_some(); @@ -361,7 +397,7 @@ impl Reader { RGB if has_trns => RGBA, Indexed if has_trns => RGBA, Indexed => RGB, - ct => ct + ct => ct, } } else { info.color_type @@ -381,9 +417,11 @@ impl Reader { /// Returns the number of bytes required to hold a deinterlaced row. pub fn output_line_size(&self, width: u32) -> usize { let size = self.line_size(width); - if get_info!(self).bit_depth as u8 == 16 && self.transform.intersects( - crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16 - ) { + if get_info!(self).bit_depth as u8 == 16 + && self + .transform + .intersects(crate::Transformations::SCALE_16 | crate::Transformations::STRIP_16) + { size / 2 } else { size @@ -406,13 +444,15 @@ impl Reader { GrayscaleAlpha if t.contains(crate::Transformations::EXPAND) => 2 * 8, // divide by 2 as it will get mutiplied by two later _ if info.bit_depth as u8 == 16 => info.bits_per_pixel() / 2, - _ => info.bits_per_pixel() - } - * width as usize - * if info.bit_depth as u8 == 16 { 2 } else { 1 }; + _ => info.bits_per_pixel(), + } * width as usize + * if info.bit_depth as u8 == 16 { 2 } else { 1 }; let len = bits / 8; let extra = bits % 8; - len + match extra { 0 => 0, _ => 1 } + len + match extra { + 0 => 0, + _ => 1, + } } fn allocate_out_buf(&mut self) -> Result<(), DecodingError> { @@ -425,8 +465,9 @@ impl Reader { Ok(()) } - /// Returns the next raw row of the image - fn next_raw_interlaced_row(&mut self) -> Result)>, DecodingError> { + /// Returns the next raw scanline of the image interlace pass. + /// The scanline is filtered against the previous scanline according to the specification. + fn next_raw_interlaced_row(&mut self) -> Result>, DecodingError> { let _ = get_info!(self); let bpp = self.bpp; let (rowlen, passdata) = if let Some(ref mut adam7) = self.adam7 { @@ -435,52 +476,61 @@ impl Reader { let rowlen = get_info!(self).raw_row_length_from_width(len); if last_pass != pass { self.prev.clear(); - for _ in 0..rowlen { - self.prev.push(0); - } + self.prev.resize(rowlen, 0u8); } (rowlen, Some((pass, line, len))) } else { - return Ok(None) + return Ok(None); } } else { (self.rowlen, None) }; loop { - if self.current.len() >= rowlen { - if let Some(filter) = FilterType::from_u8(self.current[0]) { - if let Err(message) = unfilter(filter, bpp, &self.prev[1..rowlen], &mut self.current[1..rowlen]) { + if self.current.len() - self.scan_start >= rowlen { + let row = &mut self.current[self.scan_start..]; + let filter = match FilterType::from_u8(row[0]) { + None => { return Err(DecodingError::Format( - borrow::Cow::Borrowed(message) + format!("invalid filter method ({})", row[0]).into(), )) } - self.prev[..rowlen].copy_from_slice(&self.current[..rowlen]); - self.current.drain(0..rowlen); - return Ok( - Some(( - &self.prev[1..rowlen], - passdata - )) - ) - } else { - return Err(DecodingError::Format( - format!("invalid filter method ({})", self.current[0]).into() - )) + Some(filter) => filter, + }; + + if let Err(message) = + unfilter(filter, bpp, &self.prev[1..rowlen], &mut row[1..rowlen]) + { + return Err(DecodingError::Format(borrow::Cow::Borrowed(message))); } + + self.prev[..rowlen].copy_from_slice(&row[..rowlen]); + self.scan_start += rowlen; + + return Ok(Some(InterlacedRow { + data: &self.prev[1..rowlen], + interlace: match passdata { + None => InterlaceInfo::None, + Some((pass, line, width)) => InterlaceInfo::Adam7 { pass, line, width }, + }, + })); } else { + // Clear the current buffer before appending more data. + if self.scan_start > 0 { + self.current.drain(..self.scan_start).for_each(drop); + self.scan_start = 0; + } + let val = self.decoder.decode_next(&mut self.current)?; match val { Some(Decoded::ImageData) => {} None => { if !self.current.is_empty() { - return Err(DecodingError::Format( - "file truncated".into() - )) + return Err(DecodingError::Format("file truncated".into())); } else { - return Ok(None) + return Ok(None); } } - _ => () + _ => (), } } } @@ -490,14 +540,18 @@ impl Reader { fn expand_paletted(buffer: &mut [u8], info: &Info) -> Result<(), DecodingError> { if let Some(palette) = info.palette.as_ref() { if let BitDepth::Sixteen = info.bit_depth { - Err(DecodingError::Format("Bit depth '16' is not valid for paletted images".into())) + Err(DecodingError::Format( + "Bit depth '16' is not valid for paletted images".into(), + )) } else { let black = [0, 0, 0]; if let Some(ref trns) = info.trns { utils::unpack_bits(buffer, 4, info.bit_depth as u8, |i, chunk| { let (rgb, a) = ( - palette.get(3*i as usize..3*i as usize+3).unwrap_or(&black), - *trns.get(i as usize).unwrap_or(&0xFF) + palette + .get(3 * i as usize..3 * i as usize + 3) + .unwrap_or(&black), + *trns.get(i as usize).unwrap_or(&0xFF), ); chunk[0] = rgb[0]; chunk[1] = rgb[1]; @@ -506,7 +560,9 @@ fn expand_paletted(buffer: &mut [u8], info: &Info) -> Result<(), DecodingError> }); } else { utils::unpack_bits(buffer, 3, info.bit_depth as u8, |i, chunk| { - let rgb = palette.get(3*i as usize..3*i as usize+3).unwrap_or(&black); + let rgb = palette + .get(3 * i as usize..3 * i as usize + 3) + .unwrap_or(&black); chunk[0] = rgb[0]; chunk[1] = rgb[1]; chunk[2] = rgb[2]; @@ -522,7 +578,7 @@ fn expand_paletted(buffer: &mut [u8], info: &Info) -> Result<(), DecodingError> fn expand_gray_u8(buffer: &mut [u8], info: &Info) { let rescale = true; let scaling_factor = if rescale { - (255)/((1u16 << info.bit_depth as u8) - 1) as u8 + (255) / ((1u16 << info.bit_depth as u8) - 1) as u8 } else { 1 }; diff --git a/third_party/cargo/vendor/png-0.16.1/src/decoder/stream.rs b/third_party/cargo/vendor/png-0.16.3/src/decoder/stream.rs similarity index 73% rename from third_party/cargo/vendor/png-0.16.1/src/decoder/stream.rs rename to third_party/cargo/vendor/png-0.16.3/src/decoder/stream.rs index f137c37..76c0a45 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/decoder/stream.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/decoder/stream.rs @@ -2,22 +2,25 @@ extern crate crc32fast; extern crate inflate; use std::borrow::Cow; +use std::cmp::min; +use std::convert::From; use std::default::Default; use std::error; use std::fmt; use std::io; -use std::cmp::min; -use std::convert::From; use crc32fast::Hasher as Crc32; use self::inflate::InflateStream; +use crate::chunk::{self, ChunkType, IDAT, IEND, IHDR}; +use crate::common::{ + AnimationControl, BitDepth, BlendOp, ColorType, DisposeOp, FrameControl, Info, PixelDimensions, + Unit, +}; use crate::traits::ReadBytesExt; -use crate::common::{BitDepth, BlendOp, ColorType, DisposeOp, Info, Unit, PixelDimensions, AnimationControl, FrameControl}; -use crate::chunk::{self, ChunkType, IHDR, IDAT, IEND}; /// TODO check if these size are reasonable -pub const CHUNCK_BUFFER_SIZE: usize = 32*1024; +pub const CHUNCK_BUFFER_SIZE: usize = 32 * 1024; /// Determines if checksum checks should be disabled globally. /// @@ -38,7 +41,7 @@ enum U32Value { // CHUNKS Length, Type(u32), - Crc(ChunkType) + Crc(ChunkType), } #[derive(Debug)] @@ -82,7 +85,7 @@ pub enum DecodingError { crc_val: u32, /// Calculated CRC32 sum crc_sum: u32, - chunk: ChunkType + chunk: ChunkType, }, Other(Cow<'static, str>), CorruptFlateStream, @@ -107,7 +110,7 @@ impl fmt::Display for DecodingError { InvalidSignature => write!(fmt, "invalid signature"), CrcMismatch { .. } => write!(fmt, "CRC error"), CorruptFlateStream => write!(fmt, "compressed data stream corrupted"), - LimitsExceeded => write!(fmt, "limits are exceeded") + LimitsExceeded => write!(fmt, "limits are exceeded"), } } } @@ -128,10 +131,7 @@ impl From for io::Error { fn from(err: DecodingError) -> io::Error { match err { DecodingError::IoError(err) => err, - err => io::Error::new( - io::ErrorKind::Other, - err.to_string() - ) + err => io::Error::new(io::ErrorKind::Other, err.to_string()), } } } @@ -168,7 +168,7 @@ impl StreamingDecoder { inflater: zlib_stream(), info: None, current_seq_no: None, - have_idat: false + have_idat: false, } } @@ -189,26 +189,30 @@ impl StreamingDecoder { /// Allows to stream partial data to the encoder. Returns a tuple containing the bytes that have /// been consumed from the input buffer and the current decoding result. If the decoded chunk /// was an image data chunk, it also appends the read data to `image_data`. - pub fn update(&mut self, mut buf: &[u8], image_data: &mut Vec) - -> Result<(usize, Decoded), DecodingError> { + pub fn update( + &mut self, + mut buf: &[u8], + image_data: &mut Vec, + ) -> Result<(usize, Decoded), DecodingError> { let len = buf.len(); while !buf.is_empty() && self.state.is_some() { match self.next_state(buf, image_data) { - Ok((bytes, Decoded::Nothing)) => { - buf = &buf[bytes..] - } + Ok((bytes, Decoded::Nothing)) => buf = &buf[bytes..], Ok((bytes, result)) => { buf = &buf[bytes..]; - return Ok((len-buf.len(), result)); + return Ok((len - buf.len(), result)); } - Err(err) => return Err(err) + Err(err) => return Err(err), } } - Ok((len-buf.len(), Decoded::Nothing)) + Ok((len - buf.len(), Decoded::Nothing)) } - fn next_state<'a>(&'a mut self, buf: &[u8], image_data: &mut Vec) - -> Result<(usize, Decoded), DecodingError> { + fn next_state<'a>( + &'a mut self, + buf: &[u8], + image_data: &mut Vec, + ) -> Result<(usize, Decoded), DecodingError> { use self::State::*; macro_rules! goto ( @@ -239,9 +243,11 @@ impl StreamingDecoder { match state { Signature(i, mut signature) if i < 7 => { signature[i as usize] = current_byte; - goto!(Signature(i+1, signature)) + goto!(Signature(i + 1, signature)) } - Signature(_, signature) if signature == [137, 80, 78, 71, 13, 10, 26] && current_byte == 10 => { + Signature(_, signature) + if signature == [137, 80, 78, 71, 13, 10, 26] && current_byte == 10 => + { goto!(U32(U32Value::Length)) } Signature(..) => Err(DecodingError::InvalidSignature), @@ -255,7 +261,7 @@ impl StreamingDecoder { (val >> 24) as u8, (val >> 16) as u8, (val >> 8) as u8, - val as u8 + val as u8, ]; self.current_chunk.crc.reset(); self.current_chunk.crc.update(&type_str); @@ -264,7 +270,7 @@ impl StreamingDecoder { ReadChunk(type_str, true), emit Decoded::ChunkBegin(length, type_str) ) - }, + } Crc(type_str) => { let sum = self.current_chunk.crc.clone().finalize(); if CHECKSUM_DISABLED || val == sum { @@ -281,21 +287,15 @@ impl StreamingDecoder { recover: 1, crc_val: val, crc_sum: sum, - chunk: type_str + chunk: type_str, }) } - }, + } } - }, - U32Byte2(type_, val) => { - goto!(U32Byte3(type_, val | u32::from(current_byte) << 8)) - }, - U32Byte1(type_, val) => { - goto!(U32Byte2(type_, val | u32::from(current_byte) << 16)) - }, - U32(type_) => { - goto!(U32Byte1(type_, u32::from(current_byte) << 24)) - }, + } + U32Byte2(type_, val) => goto!(U32Byte3(type_, val | u32::from(current_byte) << 8)), + U32Byte1(type_, val) => goto!(U32Byte2(type_, val | u32::from(current_byte) << 16)), + U32(type_) => goto!(U32Byte1(type_, u32::from(current_byte) << 24)), PartialChunk(type_str) => { match type_str { IDAT => { @@ -305,31 +305,37 @@ impl StreamingDecoder { DecodeData(type_str, 0), emit Decoded::PartialChunk(type_str) ) - }, + } chunk::fdAT => { if let Some(seq_no) = self.current_seq_no { let mut buf = &self.current_chunk.raw_bytes[..]; let next_seq_no = buf.read_be()?; if next_seq_no != seq_no + 1 { - return Err(DecodingError::Format(format!( - "Sequence is not in order, expected #{} got #{}.", - seq_no + 1, - next_seq_no - ).into())) + return Err(DecodingError::Format( + format!( + "Sequence is not in order, expected #{} got #{}.", + seq_no + 1, + next_seq_no + ) + .into(), + )); } self.current_seq_no = Some(next_seq_no); } else { - return Err(DecodingError::Format("fcTL chunk missing before fdAT chunk.".into())) + return Err(DecodingError::Format( + "fcTL chunk missing before fdAT chunk.".into(), + )); } goto!( 0, DecodeData(type_str, 4), emit Decoded::PartialChunk(type_str) ) - }, + } // Handle other chunks _ => { - if self.current_chunk.remaining == 0 { // complete chunk + if self.current_chunk.remaining == 0 { + // complete chunk Ok((0, self.parse_chunk(type_str)?)) } else { goto!( @@ -339,14 +345,17 @@ impl StreamingDecoder { } } } - - }, + } ReadChunk(type_str, clear) => { if clear { self.current_chunk.raw_bytes.clear(); } if self.current_chunk.remaining > 0 { - let ChunkState { crc, remaining, raw_bytes } = &mut self.current_chunk; + let ChunkState { + crc, + remaining, + raw_bytes, + } = &mut self.current_chunk; let buf_avail = raw_bytes.capacity() - raw_bytes.len(); let bytes_avail = min(buf.len(), buf_avail); let n = min(*remaining, bytes_avail as u32); @@ -358,12 +367,10 @@ impl StreamingDecoder { raw_bytes.extend_from_slice(buf); *remaining -= n; if *remaining == 0 { - goto!(n as usize, PartialChunk(type_str - )) + goto!(n as usize, PartialChunk(type_str)) } else { goto!(n as usize, ReadChunk(type_str, false)) } - } } else { goto!(0, U32(U32Value::Crc(type_str))) @@ -392,72 +399,67 @@ impl StreamingDecoder { } } - fn parse_chunk(&mut self, type_str: [u8; 4]) - -> Result { + fn parse_chunk(&mut self, type_str: [u8; 4]) -> Result { self.state = Some(State::U32(U32Value::Crc(type_str))); if self.info.is_none() && type_str != IHDR { - return Err(DecodingError::Format(format!( - "{} chunk appeared before IHDR chunk", String::from_utf8_lossy(&type_str) - ).into())) + return Err(DecodingError::Format( + format!( + "{} chunk appeared before IHDR chunk", + String::from_utf8_lossy(&type_str) + ) + .into(), + )); } match match type_str { - IHDR => { - self.parse_ihdr() - } - chunk::PLTE => { - self.parse_plte() - } - chunk::tRNS => { - self.parse_trns() - } - chunk::pHYs => { - self.parse_phys() - } - chunk::acTL => { - self.parse_actl() - } - chunk::fcTL => { - self.parse_fctl() - } - _ => Ok(Decoded::PartialChunk(type_str)) + IHDR => self.parse_ihdr(), + chunk::PLTE => self.parse_plte(), + chunk::tRNS => self.parse_trns(), + chunk::pHYs => self.parse_phys(), + chunk::acTL => self.parse_actl(), + chunk::fcTL => self.parse_fctl(), + _ => Ok(Decoded::PartialChunk(type_str)), } { - Err(err) =>{ + Err(err) => { // Borrow of self ends here, because Decoding error does not borrow self. self.state = None; Err(err) - }, - ok => ok + } + ok => ok, } } fn get_info_or_err(&self) -> Result<&Info, DecodingError> { - self.info.as_ref().ok_or_else(|| DecodingError::Format( - "IHDR chunk missing".into() - )) + self.info + .as_ref() + .ok_or_else(|| DecodingError::Format("IHDR chunk missing".into())) } - fn parse_fctl(&mut self) - -> Result { + fn parse_fctl(&mut self) -> Result { let mut buf = &self.current_chunk.raw_bytes[..]; let next_seq_no = buf.read_be()?; // Asuming that fcTL is required before *every* fdAT-sequence self.current_seq_no = Some(if let Some(seq_no) = self.current_seq_no { if next_seq_no != seq_no + 1 { - return Err(DecodingError::Format(format!( - "Sequence is not in order, expected #{} got #{}.", - seq_no + 1, - next_seq_no - ).into())) + return Err(DecodingError::Format( + format!( + "Sequence is not in order, expected #{} got #{}.", + seq_no + 1, + next_seq_no + ) + .into(), + )); } next_seq_no } else { if next_seq_no != 0 { - return Err(DecodingError::Format(format!( - "Sequence is not in order, expected #{} got #{}.", - 0, - next_seq_no - ).into())) + return Err(DecodingError::Format( + format!( + "Sequence is not in order, expected #{} got #{}.", + 0, next_seq_no + ) + .into(), + )); } 0 }); @@ -472,44 +474,41 @@ impl StreamingDecoder { delay_den: buf.read_be()?, dispose_op: match DisposeOp::from_u8(buf.read_be()?) { Some(dispose_op) => dispose_op, - None => return Err(DecodingError::Format("invalid dispose operation".into())) + None => return Err(DecodingError::Format("invalid dispose operation".into())), }, - blend_op : match BlendOp::from_u8(buf.read_be()?) { + blend_op: match BlendOp::from_u8(buf.read_be()?) { Some(blend_op) => blend_op, - None => return Err(DecodingError::Format("invalid blend operation".into())) + None => return Err(DecodingError::Format("invalid blend operation".into())), }, }; self.info.as_mut().unwrap().frame_control = Some(fc); Ok(Decoded::FrameControl(fc)) } - fn parse_actl(&mut self) - -> Result { + fn parse_actl(&mut self) -> Result { if self.have_idat { Err(DecodingError::Format( - "acTL chunk appeared after first IDAT chunk".into() + "acTL chunk appeared after first IDAT chunk".into(), )) } else { let mut buf = &self.current_chunk.raw_bytes[..]; let actl = AnimationControl { num_frames: buf.read_be()?, - num_plays: buf.read_be()? + num_plays: buf.read_be()?, }; self.info.as_mut().unwrap().animation_control = Some(actl); Ok(Decoded::AnimationControl(actl)) } } - fn parse_plte(&mut self) - -> Result { + fn parse_plte(&mut self) -> Result { if let Some(info) = self.info.as_mut() { info.palette = Some(self.current_chunk.raw_bytes.clone()) } Ok(Decoded::Nothing) } - fn parse_trns(&mut self) - -> Result { + fn parse_trns(&mut self) -> Result { use crate::common::ColorType::*; let (color_type, bit_depth) = { let info = self.get_info_or_err()?; @@ -519,30 +518,28 @@ impl StreamingDecoder { let len = vec.len(); let info = match self.info { Some(ref mut info) => info, - None => return Err(DecodingError::Format( - "tRNS chunk occured before IHDR chunk".into() - )) + None => { + return Err(DecodingError::Format( + "tRNS chunk occured before IHDR chunk".into(), + )) + } }; info.trns = Some(vec); let vec = info.trns.as_mut().unwrap(); match color_type { Grayscale => { if len < 2 { - return Err(DecodingError::Format( - "not enough palette entries".into() - )) + return Err(DecodingError::Format("not enough palette entries".into())); } if bit_depth < 16 { vec[0] = vec[1]; vec.truncate(1); } Ok(Decoded::Nothing) - }, + } RGB => { if len < 6 { - return Err(DecodingError::Format( - "not enough palette entries".into() - )) + return Err(DecodingError::Format("not enough palette entries".into())); } if bit_depth < 16 { vec[0] = vec[1]; @@ -551,25 +548,23 @@ impl StreamingDecoder { vec.truncate(3); } Ok(Decoded::Nothing) - }, + } Indexed => { - let _ = info.palette.as_ref().ok_or_else(|| DecodingError::Format( - "tRNS chunk occured before PLTE chunk".into() - )); + let _ = info.palette.as_ref().ok_or_else(|| { + DecodingError::Format("tRNS chunk occured before PLTE chunk".into()) + }); Ok(Decoded::Nothing) - }, + } c => Err(DecodingError::Format( - format!("tRNS chunk found for color type ({})", c as u8).into() - )) + format!("tRNS chunk found for color type ({})", c as u8).into(), + )), } - } - fn parse_phys(&mut self) - -> Result { + fn parse_phys(&mut self) -> Result { if self.have_idat { Err(DecodingError::Format( - "pHYs chunk appeared after first IDAT chunk".into() + "pHYs chunk appeared after first IDAT chunk".into(), )) } else { let mut buf = &self.current_chunk.raw_bytes[..]; @@ -578,22 +573,19 @@ impl StreamingDecoder { let unit = buf.read_be()?; let unit = match Unit::from_u8(unit) { Some(unit) => unit, - None => return Err(DecodingError::Format( - format!("invalid unit ({})", unit).into() - )) - }; - let pixel_dims = PixelDimensions { - xppu, - yppu, - unit, + None => { + return Err(DecodingError::Format( + format!("invalid unit ({})", unit).into(), + )) + } }; + let pixel_dims = PixelDimensions { xppu, yppu, unit }; self.info.as_mut().unwrap().pixel_dims = Some(pixel_dims); Ok(Decoded::PixelDimensions(pixel_dims)) } } - fn parse_ihdr(&mut self) - -> Result { + fn parse_ihdr(&mut self) -> Result { // TODO: check if color/bit depths combination is valid let mut buf = &self.current_chunk.raw_bytes[..]; let width = buf.read_be()?; @@ -601,37 +593,47 @@ impl StreamingDecoder { let bit_depth = buf.read_be()?; let bit_depth = match BitDepth::from_u8(bit_depth) { Some(bits) => bits, - None => return Err(DecodingError::Format( - format!("invalid bit depth ({})", bit_depth).into() - )) + None => { + return Err(DecodingError::Format( + format!("invalid bit depth ({})", bit_depth).into(), + )) + } }; let color_type = buf.read_be()?; let color_type = match ColorType::from_u8(color_type) { Some(color_type) => color_type, - None => return Err(DecodingError::Format( - format!("invalid color type ({})", color_type).into() - )) + None => { + return Err(DecodingError::Format( + format!("invalid color type ({})", color_type).into(), + )) + } }; - match buf.read_be()? { // compression method + match buf.read_be()? { + // compression method 0u8 => (), - n => return Err(DecodingError::Format( - format!("unknown compression method ({})", n).into() - )) + n => { + return Err(DecodingError::Format( + format!("unknown compression method ({})", n).into(), + )) + } } - match buf.read_be()? { // filter method + match buf.read_be()? { + // filter method 0u8 => (), - n => return Err(DecodingError::Format( - format!("unknown filter method ({})", n).into() - )) + n => { + return Err(DecodingError::Format( + format!("unknown filter method ({})", n).into(), + )) + } } let interlaced = match buf.read_be()? { 0u8 => false, - 1 => { - true - }, - n => return Err(DecodingError::Format( - format!("unknown interlace method ({})", n).into() - )) + 1 => true, + n => { + return Err(DecodingError::Format( + format!("unknown interlace method ({})", n).into(), + )) + } }; let mut info = Info::default(); @@ -642,11 +644,7 @@ impl StreamingDecoder { info.interlaced = interlaced; self.info = Some(info); Ok(Decoded::Header( - width, - height, - bit_depth, - color_type, - interlaced + width, height, bit_depth, color_type, interlaced, )) } } @@ -654,7 +652,7 @@ impl StreamingDecoder { impl Default for ChunkState { fn default() -> Self { ChunkState { - crc:Crc32::new(), + crc: Crc32::new(), remaining: 0, raw_bytes: Vec::with_capacity(CHUNCK_BUFFER_SIZE), } diff --git a/third_party/cargo/vendor/png-0.16.1/src/encoder.rs b/third_party/cargo/vendor/png-0.16.3/src/encoder.rs similarity index 76% rename from third_party/cargo/vendor/png-0.16.1/src/encoder.rs rename to third_party/cargo/vendor/png-0.16.3/src/encoder.rs index c6bd597..913cc71 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/encoder.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/encoder.rs @@ -11,8 +11,8 @@ use std::result; use crc32fast::Hasher as Crc32; use crate::chunk; -use crate::common::{Info, ColorType, BitDepth, Compression}; -use crate::filter::{FilterType, filter}; +use crate::common::{BitDepth, ColorType, Compression, Info}; +use crate::filter::{filter, FilterType}; use crate::traits::WriteBytesExt; pub type Result = result::Result; @@ -112,6 +112,8 @@ pub struct Writer { info: Info, } +const DEFAULT_BUFFER_LENGTH: usize = 4 * 1024; + impl Writer { fn new(w: W, info: Info) -> Writer { Writer { w, info } @@ -153,7 +155,8 @@ impl Writer { const MAX_CHUNK_LEN: u32 = (1u32 << 31) - 1; let bpp = self.info.bytes_per_pixel(); let in_len = self.info.raw_row_length() - 1; - let mut prev = vec![0; in_len]; + let prev = vec![0; in_len]; + let mut prev = prev.as_slice(); let mut current = vec![0; in_len]; let data_size = in_len * self.info.height as usize; if data_size != data.len() { @@ -167,7 +170,7 @@ impl Writer { zlib.write_all(&[filter_method as u8])?; filter(filter_method, bpp, &prev, &mut current); zlib.write_all(¤t)?; - mem::swap(&mut prev, &mut current); + prev = line; } let zlib_encoded = zlib.finish()?; for chunk in zlib_encoded.chunks(MAX_CHUNK_LEN as usize) { @@ -178,19 +181,41 @@ impl Writer { /// Create an stream writer. /// - /// This allows you create images that do not fit - /// in memory. The default chunk size is 4K, use - /// `stream_writer_with_size` to set another chuck + /// This allows you create images that do not fit in memory. The default + /// chunk size is 4K, use `stream_writer_with_size` to set another chuck /// size. + /// + /// This borrows the writer. This preserves it which allows manually + /// appending additional chunks after the image data has been written pub fn stream_writer(&mut self) -> StreamWriter { - self.stream_writer_with_size(4 * 1024) + self.stream_writer_with_size(DEFAULT_BUFFER_LENGTH) } /// Create a stream writer with custom buffer size. /// - /// See `stream_writer` + /// See [`stream_writer`]. + /// + /// [`stream_writer`]: #fn.stream_writer pub fn stream_writer_with_size(&mut self, size: usize) -> StreamWriter { - StreamWriter::new(self, size) + StreamWriter::new(ChunkOutput::Borrowed(self), size) + } + + /// Turn this into a stream writer for image data. + /// + /// This allows you create images that do not fit in memory. The default + /// chunk size is 4K, use `stream_writer_with_size` to set another chuck + /// size. + pub fn into_stream_writer(self) -> StreamWriter<'static, W> { + self.into_stream_writer_with_size(DEFAULT_BUFFER_LENGTH) + } + + /// Turn this into a stream writer with custom buffer size. + /// + /// See [`into_stream_writer`]. + /// + /// [`into_stream_writer`]: #fn.into_stream_writer + pub fn into_stream_writer_with_size(self, size: usize) -> StreamWriter<'static, W> { + StreamWriter::new(ChunkOutput::Owned(self), size) } } @@ -201,13 +226,18 @@ impl Drop for Writer { } struct ChunkWriter<'a, W: Write> { - writer: &'a mut Writer, + writer: ChunkOutput<'a, W>, buffer: Vec, index: usize, } +enum ChunkOutput<'a, W: Write> { + Borrowed(&'a mut Writer), + Owned(Writer), +} + impl<'a, W: Write> ChunkWriter<'a, W> { - fn new(writer: &'a mut Writer, buf_len: usize) -> ChunkWriter<'a, W> { + fn new(writer: ChunkOutput<'a, W>, buf_len: usize) -> ChunkWriter<'a, W> { ChunkWriter { writer, buffer: vec![0; buf_len], @@ -216,13 +246,24 @@ impl<'a, W: Write> ChunkWriter<'a, W> { } } +impl<'a, W: Write> AsMut> for ChunkOutput<'a, W> { + fn as_mut(&mut self) -> &mut Writer { + match self { + ChunkOutput::Borrowed(writer) => writer, + ChunkOutput::Owned(writer) => writer, + } + } +} + impl<'a, W: Write> Write for ChunkWriter<'a, W> { fn write(&mut self, mut buf: &[u8]) -> io::Result { let written = buf.read(&mut self.buffer[self.index..])?; self.index += written; - + if self.index + 1 >= self.buffer.len() { - self.writer.write_chunk(chunk::IDAT, &self.buffer)?; + self.writer + .as_mut() + .write_chunk(chunk::IDAT, &self.buffer)?; self.index = 0; } @@ -231,7 +272,9 @@ impl<'a, W: Write> Write for ChunkWriter<'a, W> { fn flush(&mut self) -> io::Result<()> { if self.index > 0 { - self.writer.write_chunk(chunk::IDAT, &self.buffer[..=self.index])?; + self.writer + .as_mut() + .write_chunk(chunk::IDAT, &self.buffer[..=self.index])?; } self.index = 0; Ok(()) @@ -244,11 +287,10 @@ impl<'a, W: Write> Drop for ChunkWriter<'a, W> { } } - /// Streaming png writer /// /// This may silently fail in the destructor, so it is a good idea to call -/// [`finish`](#method.finish) or [`flush`](https://doc.rust-lang.org/stable/std/io/trait.Write.html#tymethod.flush) before dropping. +/// [`finish`](#method.finish) or [`flush`](https://doc.rust-lang.org/stable/std/io/trait.Write.html#tymethod.flush) before dropping. pub struct StreamWriter<'a, W: Write> { writer: deflate::write::ZlibEncoder>, prev_buf: Vec, @@ -259,14 +301,14 @@ pub struct StreamWriter<'a, W: Write> { } impl<'a, W: Write> StreamWriter<'a, W> { - fn new(writer: &'a mut Writer, buf_len: usize) -> StreamWriter<'a, W> { - let bpp = writer.info.bytes_per_pixel(); - let in_len = writer.info.raw_row_length() - 1; - let filter = writer.info.filter; + fn new(mut writer: ChunkOutput<'a, W>, buf_len: usize) -> StreamWriter<'a, W> { + let bpp = writer.as_mut().info.bytes_per_pixel(); + let in_len = writer.as_mut().info.raw_row_length() - 1; + let filter = writer.as_mut().info.filter; let prev_buf = vec![0; in_len]; let curr_buf = vec![0; in_len]; - let compression = writer.info.compression.clone(); + let compression = writer.as_mut().info.compression.clone(); let chunk_writer = ChunkWriter::new(writer, buf_len); let zlib = deflate::write::ZlibEncoder::new(chunk_writer, compression); @@ -291,7 +333,7 @@ impl<'a, W: Write> Write for StreamWriter<'a, W> { fn write(&mut self, mut buf: &[u8]) -> io::Result { let written = buf.read(&mut self.curr_buf[self.index..])?; self.index += written; - + if self.index >= self.curr_buf.len() { self.writer.write_all(&[self.filter as u8])?; filter(self.filter, self.bpp, &self.prev_buf, &mut self.curr_buf); @@ -326,15 +368,18 @@ mod tests { extern crate glob; use rand::{thread_rng, Rng}; - use std::{io, cmp}; - use std::io::Write; use std::fs::File; + use std::io::Write; + use std::{cmp, io}; #[test] fn roundtrip() { // More loops = more random testing, but also more test wait time for _ in 0..10 { - for path in glob::glob("tests/pngsuite/*.png").unwrap().map(|r| r.unwrap()) { + for path in glob::glob("tests/pngsuite/*.png") + .unwrap() + .map(|r| r.unwrap()) + { if path.file_name().unwrap().to_str().unwrap().starts_with("x") { // x* files are expected to fail to decode continue; @@ -353,10 +398,12 @@ mod tests { { let mut wrapper = RandomChunkWriter { rng: thread_rng(), - w: &mut out + w: &mut out, }; - let mut encoder = Encoder::new(&mut wrapper, info.width, info.height).write_header().unwrap(); + let mut encoder = Encoder::new(&mut wrapper, info.width, info.height) + .write_header() + .unwrap(); encoder.write_image_data(&buf).unwrap(); } // Decode encoded decoded image @@ -374,7 +421,10 @@ mod tests { fn roundtrip_stream() { // More loops = more random testing, but also more test wait time for _ in 0..10 { - for path in glob::glob("tests/pngsuite/*.png").unwrap().map(|r| r.unwrap()) { + for path in glob::glob("tests/pngsuite/*.png") + .unwrap() + .map(|r| r.unwrap()) + { if path.file_name().unwrap().to_str().unwrap().starts_with("x") { // x* files are expected to fail to decode continue; @@ -393,17 +443,19 @@ mod tests { { let mut wrapper = RandomChunkWriter { rng: thread_rng(), - w: &mut out + w: &mut out, }; - let mut encoder = Encoder::new(&mut wrapper, info.width, info.height).write_header().unwrap(); + let mut encoder = Encoder::new(&mut wrapper, info.width, info.height) + .write_header() + .unwrap(); let mut stream_writer = encoder.stream_writer(); let mut outer_wrapper = RandomChunkWriter { rng: thread_rng(), - w: &mut stream_writer + w: &mut stream_writer, }; - + outer_wrapper.write_all(&buf).unwrap(); } // Decode encoded decoded image @@ -458,10 +510,42 @@ mod tests { Ok(()) } + #[test] + fn all_filters_roundtrip() -> io::Result<()> { + let pixel: Vec<_> = (0..48).collect(); + + let roundtrip = |filter: FilterType| -> io::Result<()> { + let mut buffer = vec![]; + let mut encoder = Encoder::new(&mut buffer, 4, 4); + encoder.set_depth(BitDepth::Eight); + encoder.set_color(ColorType::RGB); + encoder.set_filter(filter); + encoder.write_header()?.write_image_data(&pixel)?; + + let decoder = crate::Decoder::new(io::Cursor::new(buffer)); + let (info, mut reader) = decoder.read_info()?; + assert_eq!(info.width, 4); + assert_eq!(info.height, 4); + let mut dest = vec![0; pixel.len()]; + reader.next_frame(&mut dest)?; + assert_eq!(dest, pixel, "Deviation with filter type {:?}", filter); + + Ok(()) + }; + + roundtrip(FilterType::NoFilter)?; + roundtrip(FilterType::Sub)?; + roundtrip(FilterType::Up)?; + roundtrip(FilterType::Avg)?; + roundtrip(FilterType::Paeth)?; + + Ok(()) + } + /// A Writer that only writes a few bytes at a time struct RandomChunkWriter<'a, R: Rng, W: Write + 'a> { rng: R, - w: &'a mut W + w: &'a mut W, } impl<'a, R: Rng, W: Write + 'a> Write for RandomChunkWriter<'a, R, W> { @@ -476,5 +560,4 @@ mod tests { self.w.flush() } } - } diff --git a/third_party/cargo/vendor/png-0.16.3/src/filter.rs b/third_party/cargo/vendor/png-0.16.3/src/filter.rs new file mode 100644 index 0000000..51fb013 --- /dev/null +++ b/third_party/cargo/vendor/png-0.16.3/src/filter.rs @@ -0,0 +1,265 @@ +use std; + +/// The byte level filter applied to scanlines to prepare them for compression. +/// +/// Compression in general benefits from repetitive data. The filter is a content-aware method of +/// compressing the range of occurring byte values to help the compression algorithm. Note that +/// this does not operate on pixels but on raw bytes of a scanline. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum FilterType { + NoFilter = 0, + Sub = 1, + Up = 2, + Avg = 3, + Paeth = 4, +} + +impl FilterType { + /// u8 -> Self. Temporary solution until Rust provides a canonical one. + pub fn from_u8(n: u8) -> Option { + match n { + 0 => Some(FilterType::NoFilter), + 1 => Some(FilterType::Sub), + 2 => Some(FilterType::Up), + 3 => Some(FilterType::Avg), + 4 => Some(FilterType::Paeth), + _ => None, + } + } +} + +fn filter_paeth(a: u8, b: u8, c: u8) -> u8 { + let ia = i16::from(a); + let ib = i16::from(b); + let ic = i16::from(c); + + let p = ia + ib - ic; + + let pa = (p - ia).abs(); + let pb = (p - ib).abs(); + let pc = (p - ic).abs(); + + if pa <= pb && pa <= pc { + a + } else if pb <= pc { + b + } else { + c + } +} + +pub fn unfilter( + filter: FilterType, + bpp: usize, + previous: &[u8], + current: &mut [u8], +) -> std::result::Result<(), &'static str> { + use self::FilterType::*; + assert!(bpp > 0); + let len = current.len(); + + fn require_length(slice: &[u8], length: usize) -> Result<&[u8], &'static str> { + match slice.get(..length) { + None => Err("Filtering failed: not enough data in previous row"), + Some(slice) => Ok(slice), + } + } + + match filter { + NoFilter => Ok(()), + Sub => { + let current = &mut current[..len]; + for i in bpp..len { + current[i] = current[i].wrapping_add(current[i - bpp]); + } + Ok(()) + } + Up => { + let current = &mut current[..len]; + let previous = require_length(previous, len)?; + for i in 0..len { + current[i] = current[i].wrapping_add(previous[i]); + } + Ok(()) + } + Avg => { + let current = &mut current[..len]; + let previous = require_length(previous, len)?; + if bpp > len { + return Err("Filtering failed: bytes per pixel is greater than length of row"); + } + + for i in 0..bpp { + current[i] = current[i].wrapping_add(previous[i] / 2); + } + + macro_rules! avg_tail { + ($name:ident, $bpp:expr) => { + fn $name(current: &mut [u8], previous: &[u8]) { + let len = current.len(); + let current = &mut current[..len]; + let previous = &previous[..len]; + + let mut current = current.chunks_exact_mut($bpp); + let mut previous = previous.chunks_exact($bpp); + + let mut lprevious = current.next().unwrap(); + let _ = previous.next(); + + while let Some(pprevious) = previous.next() { + let pcurrent = current.next().unwrap(); + + for i in 0..$bpp { + let lprev = lprevious[i]; + let pprev = pprevious[i]; + pcurrent[i] = pcurrent[i].wrapping_add( + ((u16::from(lprev) + u16::from(pprev)) / 2) as u8, + ); + } + + lprevious = pcurrent; + } + } + }; + } + + avg_tail!(avg_tail_8, 8); + avg_tail!(avg_tail_6, 6); + avg_tail!(avg_tail_4, 4); + avg_tail!(avg_tail_3, 3); + avg_tail!(avg_tail_2, 2); + avg_tail!(avg_tail_1, 1); + + match bpp { + 8 => avg_tail_8(current, previous), + 6 => avg_tail_6(current, previous), + 4 => avg_tail_4(current, previous), + 3 => avg_tail_3(current, previous), + 2 => avg_tail_2(current, previous), + 1 => avg_tail_1(current, previous), + _ => unreachable!("Invalid bytes per pixel"), + } + + Ok(()) + } + Paeth => { + let current = &mut current[..len]; + let previous = require_length(previous, len)?; + if bpp > len { + return Err("Filtering failed: bytes per pixel is greater than length of row"); + } + + for i in 0..bpp { + current[i] = current[i].wrapping_add(filter_paeth(0, previous[i], 0)); + } + + let mut current = current.chunks_exact_mut(bpp); + let mut previous = previous.chunks_exact(bpp); + + let mut lprevious = current.next().unwrap(); + let mut lpprevious = previous.next().unwrap(); + + while let Some(pprevious) = previous.next() { + let pcurrent = current.next().unwrap(); + + for i in 0..bpp { + pcurrent[i] = pcurrent[i].wrapping_add(filter_paeth( + lprevious[i], + pprevious[i], + lpprevious[i], + )); + } + + lprevious = pcurrent; + lpprevious = pprevious; + } + + Ok(()) + } + } +} + +pub fn filter(method: FilterType, bpp: usize, previous: &[u8], current: &mut [u8]) { + use self::FilterType::*; + assert!(bpp > 0); + let len = current.len(); + + match method { + NoFilter => (), + Sub => { + for i in (bpp..len).rev() { + current[i] = current[i].wrapping_sub(current[i - bpp]); + } + } + Up => { + for i in 0..len { + current[i] = current[i].wrapping_sub(previous[i]); + } + } + Avg => { + for i in (bpp..len).rev() { + current[i] = + current[i].wrapping_sub(current[i - bpp].wrapping_add(previous[i]) / 2); + } + + for i in 0..bpp { + current[i] = current[i].wrapping_sub(previous[i] / 2); + } + } + Paeth => { + for i in (bpp..len).rev() { + current[i] = current[i].wrapping_sub(filter_paeth( + current[i - bpp], + previous[i], + previous[i - bpp], + )); + } + + for i in 0..bpp { + current[i] = current[i].wrapping_sub(filter_paeth(0, previous[i], 0)); + } + } + } +} + +#[cfg(test)] +mod test { + use super::{filter, unfilter, FilterType}; + use core::iter; + + #[test] + fn roundtrip() { + // A multiple of 8, 6, 4, 3, 2, 1 + const LEN: u8 = 240; + let previous: Vec<_> = iter::repeat(1).take(LEN.into()).collect(); + let mut current: Vec<_> = (0..LEN).collect(); + let expected = current.clone(); + + let mut roundtrip = |kind, bpp: usize| { + filter(kind, bpp, &previous, &mut current); + unfilter(kind, bpp, &previous, &mut current).expect("Unfilter worked"); + assert_eq!( + current, expected, + "Filtering {:?} with {:?} does not roundtrip", + bpp, kind + ); + }; + + let filters = [ + FilterType::NoFilter, + FilterType::Sub, + FilterType::Up, + FilterType::Avg, + FilterType::Paeth, + ]; + + let bpps = [1, 2, 3, 4, 6, 8]; + + for &filter in filters.iter() { + for &bpp in bpps.iter() { + roundtrip(filter, bpp); + } + } + } +} diff --git a/third_party/cargo/vendor/png-0.16.1/src/lib.rs b/third_party/cargo/vendor/png-0.16.3/src/lib.rs similarity index 90% rename from third_party/cargo/vendor/png-0.16.1/src/lib.rs rename to third_party/cargo/vendor/png-0.16.3/src/lib.rs index 15e9ec3..7df7d13 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/lib.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/lib.rs @@ -43,19 +43,22 @@ //! //#![cfg_attr(test, feature(test))] -#[macro_use] extern crate bitflags; +#[macro_use] +extern crate bitflags; pub mod chunk; +mod common; mod decoder; #[cfg(feature = "png-encoding")] mod encoder; mod filter; mod traits; -mod common; mod utils; pub use crate::common::*; -pub use crate::decoder::{Decoder, Reader, OutputInfo, StreamingDecoder, Decoded, DecodingError, Limits}; +pub use crate::decoder::{ + Decoded, Decoder, DecodingError, Limits, OutputInfo, Reader, StreamingDecoder, +}; #[cfg(feature = "png-encoding")] -pub use crate::encoder::{Encoder, Writer, StreamWriter, EncodingError}; +pub use crate::encoder::{Encoder, EncodingError, StreamWriter, Writer}; pub use crate::filter::FilterType; diff --git a/third_party/cargo/vendor/png-0.16.3/src/traits.rs b/third_party/cargo/vendor/png-0.16.3/src/traits.rs new file mode 100644 index 0000000..ffc10e7 --- /dev/null +++ b/third_party/cargo/vendor/png-0.16.3/src/traits.rs @@ -0,0 +1,43 @@ +use std::io; + +macro_rules! read_bytes_ext { + ($output_type:ty) => { + impl ReadBytesExt<$output_type> for W { + #[inline] + fn read_be(&mut self) -> io::Result<$output_type> { + let mut bytes = [0u8; std::mem::size_of::<$output_type>()]; + self.read_exact(&mut bytes)?; + Ok(<$output_type>::from_be_bytes(bytes)) + } + } + }; +} + +macro_rules! write_bytes_ext { + ($input_type:ty) => { + impl WriteBytesExt<$input_type> for W { + #[inline] + fn write_be(&mut self, n: $input_type) -> io::Result<()> { + self.write_all(&n.to_be_bytes()) + } + } + }; +} + +/// Read extension to read big endian data +pub trait ReadBytesExt: io::Read { + /// Read `T` from a bytes stream. Most significant byte first. + fn read_be(&mut self) -> io::Result; +} + +/// Write extension to write big endian data +pub trait WriteBytesExt: io::Write { + /// Writes `T` to a bytes stream. Most significant byte first. + fn write_be(&mut self, _: T) -> io::Result<()>; +} + +read_bytes_ext!(u8); +read_bytes_ext!(u16); +read_bytes_ext!(u32); + +write_bytes_ext!(u32); diff --git a/third_party/cargo/vendor/png-0.16.1/src/utils.rs b/third_party/cargo/vendor/png-0.16.3/src/utils.rs similarity index 62% rename from third_party/cargo/vendor/png-0.16.1/src/utils.rs rename to third_party/cargo/vendor/png-0.16.3/src/utils.rs index 1e91629..17eb2e9 100644 --- a/third_party/cargo/vendor/png-0.16.1/src/utils.rs +++ b/third_party/cargo/vendor/png-0.16.3/src/utils.rs @@ -4,31 +4,32 @@ use std::ops::Range; #[inline(always)] pub fn unpack_bits(buf: &mut [u8], channels: usize, bit_depth: u8, func: F) -where F: Fn(u8, &mut[u8]) { +where + F: Fn(u8, &mut [u8]), +{ // Return early if empty. This enables to subtract `channels` later without overflow. if buf.len() < channels { return; } - let bits = buf.len()/channels*bit_depth as usize; + let bits = buf.len() / channels * bit_depth as usize; let extra_bits = bits % 8; - let entries = bits / 8 + match extra_bits { - 0 => 0, - _ => 1 - }; + let entries = bits / 8 + + match extra_bits { + 0 => 0, + _ => 1, + }; let skip = match extra_bits { 0 => 0, - n => (8-n) / bit_depth as usize + n => (8 - n) / bit_depth as usize, }; let mask = ((1u16 << bit_depth) - 1) as u8; - let i = - (0..entries) + let i = (0..entries) .rev() // reverse iterator .flat_map(|idx| // this has to be reversed too (0..8).step_by(bit_depth.into()) - .zip(repeat(idx)) - ) + .zip(repeat(idx))) .skip(skip); let j = (0..=buf.len() - channels).rev().step_by(channels); for ((shift, i), j) in i.zip(j) { @@ -37,54 +38,55 @@ where F: Fn(u8, &mut[u8]) { } } -pub fn expand_trns_line(buf: &mut[u8], trns: &[u8], channels: usize) { +pub fn expand_trns_line(buf: &mut [u8], trns: &[u8], channels: usize) { // Return early if empty. This enables to subtract `channels` later without overflow. - if buf.len() < (channels+1) { + if buf.len() < (channels + 1) { return; } - let i = (0..=buf.len() / (channels+1) * channels - channels).rev().step_by(channels); - let j = (0..=buf.len() - (channels+1)).rev().step_by(channels+1); + let i = (0..=buf.len() / (channels + 1) * channels - channels) + .rev() + .step_by(channels); + let j = (0..=buf.len() - (channels + 1)).rev().step_by(channels + 1); for (i, j) in i.zip(j) { let i_pixel = i; let j_chunk = j; - if &buf[i_pixel..i_pixel+channels] == trns { - buf[j_chunk+channels] = 0 + if &buf[i_pixel..i_pixel + channels] == trns { + buf[j_chunk + channels] = 0 } else { - buf[j_chunk+channels] = 0xFF + buf[j_chunk + channels] = 0xFF } for k in (0..channels).rev() { - buf[j_chunk+k] = buf[i_pixel+k]; + buf[j_chunk + k] = buf[i_pixel + k]; } } } -pub fn expand_trns_line16(buf: &mut[u8], trns: &[u8], channels: usize) { +pub fn expand_trns_line16(buf: &mut [u8], trns: &[u8], channels: usize) { let c2 = 2 * channels; // Return early if empty. This enables to subtract `channels` later without overflow. - if buf.len() < (c2+2) { + if buf.len() < (c2 + 2) { return; } - let i = (0..=buf.len() / (c2+2) * c2 - c2).rev().step_by(c2); - let j = (0..=buf.len() - (c2+2)).rev().step_by(c2+2); + let i = (0..=buf.len() / (c2 + 2) * c2 - c2).rev().step_by(c2); + let j = (0..=buf.len() - (c2 + 2)).rev().step_by(c2 + 2); for (i, j) in i.zip(j) { let i_pixel = i; let j_chunk = j; - if &buf[i_pixel..i_pixel+c2] == trns { - buf[j_chunk+c2] = 0; - buf[j_chunk+c2 + 1] = 0 + if &buf[i_pixel..i_pixel + c2] == trns { + buf[j_chunk + c2] = 0; + buf[j_chunk + c2 + 1] = 0 } else { - buf[j_chunk+c2] = 0xFF; - buf[j_chunk+c2 + 1] = 0xFF + buf[j_chunk + c2] = 0xFF; + buf[j_chunk + c2 + 1] = 0xFF } for k in (0..c2).rev() { - buf[j_chunk+k] = buf[i_pixel+k]; + buf[j_chunk + k] = buf[i_pixel + k]; } } } - /// This iterator iterates over the different passes of an image Adam7 encoded /// PNG image /// The pattern is: @@ -126,20 +128,20 @@ impl Adam7Iterator { let w = f64::from(self.width); let h = f64::from(self.height); let (line_width, lines) = match self.current_pass { - 1 => (w/8.0, h/8.0), - 2 => ((w-4.0)/8.0, h/8.0), - 3 => (w/4.0, (h-4.0)/8.0), - 4 => ((w-2.0)/4.0, h/4.0), - 5 => (w/2.0, (h-2.0)/4.0), - 6 => ((w-1.0)/2.0, h/2.0), - 7 => (w, (h-1.0)/2.0), - _ => unreachable!() + 1 => (w / 8.0, h / 8.0), + 2 => ((w - 4.0) / 8.0, h / 8.0), + 3 => (w / 4.0, (h - 4.0) / 8.0), + 4 => ((w - 2.0) / 4.0, h / 4.0), + 5 => (w / 2.0, (h - 2.0) / 4.0), + 6 => ((w - 1.0) / 2.0, h / 2.0), + 7 => (w, (h - 1.0) / 2.0), + _ => unreachable!(), }; self.line_width = line_width.ceil() as u32; self.lines = lines.ceil() as u32; self.line = 0; } - + /// The current pass#. pub fn current_pass(&self) -> u8 { self.current_pass @@ -164,26 +166,33 @@ impl Iterator for Adam7Iterator { } } -fn subbyte_pixels<'a>(scanline: &'a [u8], bits_pp: usize) -> impl Iterator + 'a { - (0..scanline.len() * 8).step_by(bits_pp).map(move |bit_idx| { - let byte_idx = bit_idx / 8; +fn subbyte_pixels<'a>(scanline: &'a [u8], bits_pp: usize) -> impl Iterator + 'a { + (0..scanline.len() * 8) + .step_by(bits_pp) + .map(move |bit_idx| { + let byte_idx = bit_idx / 8; - // sub-byte samples start in the high-order bits - let rem = 8 - bit_idx % 8 - bits_pp; + // sub-byte samples start in the high-order bits + let rem = 8 - bit_idx % 8 - bits_pp; - match bits_pp { - // evenly divides bytes - 1 => (scanline[byte_idx] >> rem) & 1, - 2 => (scanline[byte_idx] >> rem) & 3, - 4 => (scanline[byte_idx] >> rem) & 15, - _ => unreachable!(), - } - }) + match bits_pp { + // evenly divides bytes + 1 => (scanline[byte_idx] >> rem) & 1, + 2 => (scanline[byte_idx] >> rem) & 3, + 4 => (scanline[byte_idx] >> rem) & 15, + _ => unreachable!(), + } + }) } /// Given pass, image width, and line number, produce an iterator of bit positions of pixels to copy /// from the input scanline to the image buffer. -fn expand_adam7_bits(pass: u8, width: usize, line_no: usize, bits_pp: usize) -> StepBy> { +fn expand_adam7_bits( + pass: u8, + width: usize, + line_no: usize, + bits_pp: usize, +) -> StepBy> { let (line_mul, line_off, samp_mul, samp_off) = match pass { 1 => (8, 0, 8, 0), 2 => (8, 0, 8, 4), @@ -192,7 +201,7 @@ fn expand_adam7_bits(pass: u8, width: usize, line_no: usize, bits_pp: usize) -> 5 => (4, 2, 2, 0), 6 => (2, 0, 2, 1), 7 => (2, 1, 1, 0), - _ => panic!("Adam7 pass out of range: {}", pass) + _ => panic!("Adam7 pass out of range: {}", pass), }; // the equivalent line number in progressive scan @@ -203,20 +212,26 @@ fn expand_adam7_bits(pass: u8, width: usize, line_no: usize, bits_pp: usize) -> let start = line_start + (samp_off * bits_pp); let stop = line_start + (width * bits_pp); - (start .. stop).step_by(bits_pp * samp_mul) + (start..stop).step_by(bits_pp * samp_mul) } /// Expands an Adam 7 pass pub fn expand_pass( - img: &mut [u8], width: u32, scanline: &[u8], - pass: u8, line_no: u32, bits_pp: u8) { - + img: &mut [u8], + width: u32, + scanline: &[u8], + pass: u8, + line_no: u32, + bits_pp: u8, +) { let width = width as usize; let line_no = line_no as usize; let bits_pp = bits_pp as usize; - // pass is out of range but don't blow up - if pass == 0 || pass > 7 { return; } + // pass is out of range but don't blow up + if pass == 0 || pass > 7 { + return; + } let bit_indices = expand_adam7_bits(pass, width, line_no, bits_pp); @@ -226,14 +241,14 @@ pub fn expand_pass( img[pos / 8] |= px << rem as u8; } } else { - let bytes_pp = bits_pp / 8; + let bytes_pp = bits_pp / 8; - for (bitpos, px) in bit_indices.zip(scanline.chunks(bytes_pp)) { - for (offset, val) in px.iter().enumerate() { - img[bitpos / 8 + offset] = *val; - } - } - } + for (bitpos, px) in bit_indices.zip(scanline.chunks(bytes_pp)) { + for (offset, val) in px.iter().enumerate() { + img[bitpos / 8 + offset] = *val; + } + } + } } #[test] @@ -246,14 +261,24 @@ fn test_adam7() { */ let it = Adam7Iterator::new(4, 4); let passes: Vec<_> = it.collect(); - assert_eq!(&*passes, &[(1, 0, 1), (4, 0, 1), (5, 0, 2), (6, 0, 2), (6, 1, 2), (7, 0, 4), (7, 1, 4)]); + assert_eq!( + &*passes, + &[ + (1, 0, 1), + (4, 0, 1), + (5, 0, 2), + (6, 0, 2), + (6, 1, 2), + (7, 0, 4), + (7, 1, 4) + ] + ); } #[test] fn test_subbyte_pixels() { let scanline = &[0b10101010, 0b10101010]; - let pixels = subbyte_pixels(scanline, 1).collect::>(); assert_eq!(pixels.len(), 16); assert_eq!(pixels, [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]); @@ -264,7 +289,11 @@ fn test_expand_adam7_bits() { let width = 32; let bits_pp = 1; - let expected = |offset: usize, step: usize, count: usize| (0 .. count).map(move |i| step * i + offset).collect::>(); + let expected = |offset: usize, step: usize, count: usize| { + (0..count) + .map(move |i| step * i + offset) + .collect::>() + }; for line_no in 0..8 { let start = 8 * line_no * width; @@ -289,7 +318,7 @@ fn test_expand_adam7_bits() { ); } - for line_no in 0 .. 16 { + for line_no in 0..16 { let start = 4 * line_no * width + 2; assert_eq!( @@ -305,13 +334,14 @@ fn test_expand_adam7_bits() { ) } - for line_no in 0 .. 32 { + for line_no in 0..32 { let start = 2 * line_no * width + 1; assert_eq!( expand_adam7_bits(6, width, line_no, bits_pp).collect::>(), expected(start, 2, 16), - "line_no: {}", line_no + "line_no: {}", + line_no ); let start = (2 * line_no + 1) * width; @@ -348,29 +378,92 @@ fn test_expand_pass_subbyte() { assert_eq!(img, [0b10101010u8, 0, 0b10101010, 0, 0b10101010, 0, 0, 0]); expand_pass(&mut img, width, &[0b11110000], 5, 1, bits_pp); - assert_eq!(img, [0b10101010u8, 0, 0b10101010, 0, 0b10101010, 0, 0b10101010, 0]); + assert_eq!( + img, + [0b10101010u8, 0, 0b10101010, 0, 0b10101010, 0, 0b10101010, 0] + ); expand_pass(&mut img, width, &[0b11110000], 6, 0, bits_pp); - assert_eq!(img, [0b11111111u8, 0, 0b10101010, 0, 0b10101010, 0, 0b10101010, 0]); + assert_eq!( + img, + [0b11111111u8, 0, 0b10101010, 0, 0b10101010, 0, 0b10101010, 0] + ); expand_pass(&mut img, width, &[0b11110000], 6, 1, bits_pp); - assert_eq!(img, [0b11111111u8, 0, 0b11111111, 0, 0b10101010, 0, 0b10101010, 0]); + assert_eq!( + img, + [0b11111111u8, 0, 0b11111111, 0, 0b10101010, 0, 0b10101010, 0] + ); expand_pass(&mut img, width, &[0b11110000], 6, 2, bits_pp); - assert_eq!(img, [0b11111111u8, 0, 0b11111111, 0, 0b11111111, 0, 0b10101010, 0]); + assert_eq!( + img, + [0b11111111u8, 0, 0b11111111, 0, 0b11111111, 0, 0b10101010, 0] + ); expand_pass(&mut img, width, &[0b11110000], 6, 3, bits_pp); - assert_eq!([0b11111111u8, 0, 0b11111111, 0, 0b11111111, 0, 0b11111111, 0], img); + assert_eq!( + [0b11111111u8, 0, 0b11111111, 0, 0b11111111, 0, 0b11111111, 0], + img + ); expand_pass(&mut img, width, &[0b11111111], 7, 0, bits_pp); - assert_eq!([0b11111111u8, 0b11111111, 0b11111111, 0, 0b11111111, 0, 0b11111111, 0], img); + assert_eq!( + [ + 0b11111111u8, + 0b11111111, + 0b11111111, + 0, + 0b11111111, + 0, + 0b11111111, + 0 + ], + img + ); expand_pass(&mut img, width, &[0b11111111], 7, 1, bits_pp); - assert_eq!([0b11111111u8, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0, 0b11111111, 0], img); + assert_eq!( + [ + 0b11111111u8, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0, + 0b11111111, + 0 + ], + img + ); expand_pass(&mut img, width, &[0b11111111], 7, 2, bits_pp); - assert_eq!([0b11111111u8, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0], img); + assert_eq!( + [ + 0b11111111u8, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0 + ], + img + ); expand_pass(&mut img, width, &[0b11111111], 7, 3, bits_pp); - assert_eq!([0b11111111u8, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b11111111], img); + assert_eq!( + [ + 0b11111111u8, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111, + 0b11111111 + ], + img + ); } diff --git a/third_party/cargo/vendor/proc-macro-crate-0.1.4/.cargo-checksum.json b/third_party/cargo/vendor/proc-macro-crate-0.1.4/.cargo-checksum.json new file mode 100644 index 0000000..b21bbfa --- /dev/null +++ b/third_party/cargo/vendor/proc-macro-crate-0.1.4/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"b060647476b485cf061c0c0c14d0415c7372bff73ee6e55b52232ec16e54f138","README.md":"122ef01cacbc3d6cbbbac6e744a4e1c2946dc045e22739b116265c2bf3a02f26","src/lib.rs":"920e77469949fa67b44120ce9a1c9272d463061c46c689bedd07bcf6d20f4fa9"},"package":"e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e"} \ No newline at end of file diff --git a/third_party/cargo/vendor/proc-macro-crate-0.1.4/BUILD b/third_party/cargo/vendor/proc-macro-crate-0.1.4/BUILD new file mode 100644 index 0000000..3b6439a --- /dev/null +++ b/third_party/cargo/vendor/proc-macro-crate-0.1.4/BUILD @@ -0,0 +1,43 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "notice", # "Apache-2.0,MIT" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + + +rust_library( + name = "proc_macro_crate", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/toml-0.5.6:toml", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "0.1.4", + crate_features = [ + ], +) + diff --git a/third_party/cargo/vendor/proc-macro-crate-0.1.4/Cargo.toml b/third_party/cargo/vendor/proc-macro-crate-0.1.4/Cargo.toml new file mode 100644 index 0000000..17ff48c --- /dev/null +++ b/third_party/cargo/vendor/proc-macro-crate-0.1.4/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] +edition = "2018" +name = "proc-macro-crate" +version = "0.1.4" +authors = ["Bastian Köcher "] +description = "Replacement for crate (macro_rules keyword) in proc-macros\n" +documentation = "https://docs.rs/proc-macro-crate" +readme = "./README.md" +keywords = ["macro-rules", "crate", "macro", "proc-macro"] +categories = ["development-tools::procedural-macro-helpers"] +license = "Apache-2.0/MIT" +repository = "https://github.com/bkchr/proc-macro-crate" +[dependencies.toml] +version = "0.5.0" +[dev-dependencies.proc-macro2] +version = "0.4.27" + +[dev-dependencies.quote] +version = "0.6" + +[dev-dependencies.syn] +version = "0.15.26" diff --git a/third_party/cargo/vendor/proc-macro-crate-0.1.4/README.md b/third_party/cargo/vendor/proc-macro-crate-0.1.4/README.md new file mode 100644 index 0000000..6980c56 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro-crate-0.1.4/README.md @@ -0,0 +1,53 @@ +# proc-macro-crate + + +[![](https://docs.rs/proc-macro-crate/badge.svg)](https://docs.rs/proc-macro-crate/) [![](https://img.shields.io/crates/v/proc-macro-crate.svg)](https://crates.io/crates/proc-macro-crate) [![](https://img.shields.io/crates/d/proc-macro-crate.png)](https://crates.io/crates/proc-macro-crate) [![Build Status](https://travis-ci.org/bkchr/proc-macro-crate.png?branch=master)](https://travis-ci.org/bkchr/proc-macro-crate) + +Providing support for `$crate` in procedural macros. + +* [Introduction](#introduction) +* [Example](#example) +* [License](#license) + +### Introduction + +In `macro_rules!` `$crate` is used to get the path of the crate where a macro is declared in. In +procedural macros there is currently no easy way to get this path. A common hack is to import the +desired crate with a know name and use this. However, with rust edition 2018 and dropping +`extern crate` declarations from `lib.rs`, people start to rename crates in `Cargo.toml` directly. +However, this breaks importing the crate, as the proc-macro developer does not know the renamed +name of the crate that should be imported. + +This crate provides a way to get the name of a crate, even if it renamed in `Cargo.toml`. For this +purpose a single function `crate_name` is provided. This function needs to be called in the context +of a proc-macro with the name of the desired crate. `CARGO_MANIFEST_DIR` will be used to find the +current active `Cargo.toml` and this `Cargo.toml` is searched for the desired crate. The returned +name of `crate_name` is either the given original rename (crate not renamed) or the renamed name. + +### Example + +```rust +use quote::quote; +use syn::Ident; +use proc_macro2::Span; +use proc_macro_crate::crate_name; + +fn import_my_crate() { + let name = crate_name("my-crate").expect("my-crate is present in `Cargo.toml`"); + let ident = Ident::new(&name, Span::call_site()); + quote!( extern crate #ident as my_crate_known_name ); +} + +``` + +### License + +Licensed under either of + + * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) + + * [MIT license](http://opensource.org/licenses/MIT) + +at your option. + +License: Apache-2.0/MIT diff --git a/third_party/cargo/vendor/proc-macro-crate-0.1.4/src/lib.rs b/third_party/cargo/vendor/proc-macro-crate-0.1.4/src/lib.rs new file mode 100644 index 0000000..a2dc39f --- /dev/null +++ b/third_party/cargo/vendor/proc-macro-crate-0.1.4/src/lib.rs @@ -0,0 +1,274 @@ +/*! + +[![](https://docs.rs/proc-macro-crate/badge.svg)](https://docs.rs/proc-macro-crate/) [![](https://img.shields.io/crates/v/proc-macro-crate.svg)](https://crates.io/crates/proc-macro-crate) [![](https://img.shields.io/crates/d/proc-macro-crate.png)](https://crates.io/crates/proc-macro-crate) [![Build Status](https://travis-ci.org/bkchr/proc-macro-crate.png?branch=master)](https://travis-ci.org/bkchr/proc-macro-crate) + +Providing support for `$crate` in procedural macros. + +* [Introduction](#introduction) +* [Example](#example) +* [License](#license) + +## Introduction + +In `macro_rules!` `$crate` is used to get the path of the crate where a macro is declared in. In +procedural macros there is currently no easy way to get this path. A common hack is to import the +desired crate with a know name and use this. However, with rust edition 2018 and dropping +`extern crate` declarations from `lib.rs`, people start to rename crates in `Cargo.toml` directly. +However, this breaks importing the crate, as the proc-macro developer does not know the renamed +name of the crate that should be imported. + +This crate provides a way to get the name of a crate, even if it renamed in `Cargo.toml`. For this +purpose a single function `crate_name` is provided. This function needs to be called in the context +of a proc-macro with the name of the desired crate. `CARGO_MANIFEST_DIR` will be used to find the +current active `Cargo.toml` and this `Cargo.toml` is searched for the desired crate. The returned +name of `crate_name` is either the given original rename (crate not renamed) or the renamed name. + +## Example + +``` +use quote::quote; +use syn::Ident; +use proc_macro2::Span; +use proc_macro_crate::crate_name; + +fn import_my_crate() { + let name = crate_name("my-crate").expect("my-crate is present in `Cargo.toml`"); + let ident = Ident::new(&name, Span::call_site()); + quote!( extern crate #ident as my_crate_known_name ); +} + +# fn main() {} +``` + +## License + +Licensed under either of + + * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) + + * [MIT license](http://opensource.org/licenses/MIT) + +at your option. +*/ + +use std::{ + collections::HashMap, + env, + fmt::Display, + fs::File, + io::Read, + path::{Path, PathBuf}, +}; + +use toml::{self, value::Table}; + +type CargoToml = HashMap; + +/// Find the crate name for the given `orig_name` in the current `Cargo.toml`. +/// +/// `orig_name` should be the original name of the searched crate. +/// +/// The current `Cargo.toml` is determined by taking `CARGO_MANIFEST_DIR/Cargo.toml`. +/// +/// # Returns +/// +/// - `Ok(orig_name)` if the crate was found, but not renamed in the `Cargo.toml`. +/// - `Ok(RENAMED)` if the crate was found, but is renamed in the `Cargo.toml`. `RENAMED` will be +/// the renamed name. +/// - `Err` if an error occurred. +/// +/// The returned crate name is sanitized in such a way that it is a valid rust identifier. Thus, +/// it is ready to be used in `extern crate` as identifier. +pub fn crate_name(orig_name: &str) -> Result { + let manifest_dir = env::var("CARGO_MANIFEST_DIR") + .map_err(|_| "Could not find `CARGO_MANIFEST_DIR` env variable.")?; + + let cargo_toml_path = PathBuf::from(manifest_dir).join("Cargo.toml"); + + if !cargo_toml_path.exists() { + return Err(format!("`{}` does not exist.", cargo_toml_path.display())); + } + + let cargo_toml = open_cargo_toml(&cargo_toml_path)?; + + extract_crate_name(orig_name, cargo_toml, &cargo_toml_path).map(sanitize_crate_name) +} + +/// Make sure that the given crate name is a valid rust identifier. +fn sanitize_crate_name(name: String) -> String { + name.replace("-", "_") +} + +/// Open the given `Cargo.toml` and parse it into a hashmap. +fn open_cargo_toml(path: &Path) -> Result { + let mut content = String::new(); + File::open(path) + .map_err(|e| format!("Could not open `{}`: {:?}", path.display(), e))? + .read_to_string(&mut content) + .map_err(|e| format!("Could not read `{}` to string: {:?}", path.display(), e))?; + toml::from_str(&content).map_err(|e| format!("{:?}", e)) +} + +/// Create the not found error. +fn create_not_found_err(orig_name: &str, path: &Display) -> Result { + Err(format!( + "Could not find `{}` in `dependencies` or `dev-dependencies` in `{}`!", + orig_name, path + )) +} + +/// Extract the crate name for the given `orig_name` from the given `Cargo.toml` by checking the +/// `dependencies` and `dev-dependencies`. +/// +/// Returns `Ok(orig_name)` if the crate is not renamed in the `Cargo.toml` or otherwise +/// the renamed identifier. +fn extract_crate_name( + orig_name: &str, + mut cargo_toml: CargoToml, + cargo_toml_path: &Path, +) -> Result { + if let Some(name) = ["dependencies", "dev-dependencies"] + .iter() + .find_map(|k| search_crate_at_key(k, orig_name, &mut cargo_toml)) + { + return Ok(name); + } + + // Start searching `target.xy.dependencies` + if let Some(name) = cargo_toml + .remove("target") + .and_then(|t| t.try_into::().ok()) + .and_then(|t| { + t.values() + .filter_map(|v| v.as_table()) + .filter_map(|t| t.get("dependencies").and_then(|t| t.as_table())) + .find_map(|t| extract_crate_name_from_deps(orig_name, t.clone())) + }) + { + return Ok(name); + } + + create_not_found_err(orig_name, &cargo_toml_path.display()) +} + +/// Search the `orig_name` crate at the given `key` in `cargo_toml`. +fn search_crate_at_key(key: &str, orig_name: &str, cargo_toml: &mut CargoToml) -> Option { + cargo_toml + .remove(key) + .and_then(|v| v.try_into::
().ok()) + .and_then(|t| extract_crate_name_from_deps(orig_name, t)) +} + +/// Extract the crate name from the given dependencies. +/// +/// Returns `Some(orig_name)` if the crate is not renamed in the `Cargo.toml` or otherwise +/// the renamed identifier. +fn extract_crate_name_from_deps(orig_name: &str, deps: Table) -> Option { + for (key, value) in deps.into_iter() { + let renamed = value + .try_into::
() + .ok() + .and_then(|t| t.get("package").cloned()) + .map(|t| t.as_str() == Some(orig_name)) + .unwrap_or(false); + + if key == orig_name || renamed { + return Some(key.clone()); + } + } + + None +} + +#[cfg(test)] +mod tests { + use super::*; + + macro_rules! create_test { + ( + $name:ident, + $cargo_toml:expr, + $result:expr, + ) => { + #[test] + fn $name() { + let cargo_toml = toml::from_str($cargo_toml).expect("Parses `Cargo.toml`"); + let path = PathBuf::from("test-path"); + + assert_eq!($result, extract_crate_name("my_crate", cargo_toml, &path)); + } + }; + } + + create_test! { + deps_with_crate, + r#" + [dependencies] + my_crate = "0.1" + "#, + Ok("my_crate".into()), + } + + create_test! { + dev_deps_with_crate, + r#" + [dev-dependencies] + my_crate = "0.1" + "#, + Ok("my_crate".into()), + } + + create_test! { + deps_with_crate_renamed, + r#" + [dependencies] + cool = { package = "my_crate", version = "0.1" } + "#, + Ok("cool".into()), + } + + create_test! { + deps_with_crate_renamed_second, + r#" + [dependencies.cool] + package = "my_crate" + version = "0.1" + "#, + Ok("cool".into()), + } + + create_test! { + deps_empty, + r#" + [dependencies] + "#, + create_not_found_err("my_crate", &"test-path"), + } + + create_test! { + crate_not_found, + r#" + [dependencies] + serde = "1.0" + "#, + create_not_found_err("my_crate", &"test-path"), + } + + create_test! { + target_dependency, + r#" + [target.'cfg(target_os="android")'.dependencies] + my_crate = "0.1" + "#, + Ok("my_crate".into()), + } + + create_test! { + target_dependency2, + r#" + [target.x86_64-pc-windows-gnu.dependencies] + my_crate = "0.1" + "#, + Ok("my_crate".into()), + } +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/.cargo-checksum.json b/third_party/cargo/vendor/proc-macro2-1.0.17/.cargo-checksum.json new file mode 100644 index 0000000..128a3ac --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"57717fafaff95cd648a97f5ddd4c884bd533b6556c4798dc2aada83501f3a7e2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"e1f9d4fc22cff2c049f166a403b41458632a94357890d31cf0e3ad83807fb430","build.rs":"19a6f788bf33f0f9e521c7ff32c04ebbbb9fe8c11a058e5bfdd747999e828772","src/detection.rs":"9d25d896889e65330858f2d6f6223c1b98cd1dad189813ad4161ff189fbda2b8","src/fallback.rs":"11b105ffcc1d6cd077cb26718ba873cf658344da6b38b560fe5b420cb092273c","src/lib.rs":"36a3c082878d5753d682d20e7a350b87247899475f1b391e9c8a10de5a51e5dd","src/parse.rs":"2d97645a195afd0d70488e07250ac3269e2a39b9637615d3b099420dfd96316f","src/strnom.rs":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","src/wrapper.rs":"55f9aa6244082450bd56ad2761b5bb966122aa5a087124882456188e9e874b5a","tests/comments.rs":"ea6cbe6f4c8852e6a0612893c7d4f2c144a2e6a134a6c3db641a320cbfc3c800","tests/features.rs":"a86deb8644992a4eb64d9fd493eff16f9cf9c5cb6ade3a634ce0c990cf87d559","tests/marker.rs":"c2652e3ae1dfcb94d2e6313b29712c5dcbd0fe62026913e67bb7cebd7560aade","tests/test.rs":"fa754f11557f5246ec2b7c474b759de854a1e2a991dba67e66c26fd6ae8f4839"},"package":"1502d12e458c49a4c9cbff560d0fe0060c252bc29799ed94ca2ed4bb665a0101"} \ No newline at end of file diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/BUILD b/third_party/cargo/vendor/proc-macro2-1.0.17/BUILD new file mode 100644 index 0000000..41713a2 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/BUILD @@ -0,0 +1,50 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "comments" with type "test" omitted +# Unsupported target "features" with type "test" omitted +# Unsupported target "marker" with type "test" omitted + +rust_library( + name = "proc_macro2", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/unicode-xid-0.2.0:unicode_xid", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.17", + crate_features = [ + "default", + "proc-macro", + ], +) + +# Unsupported target "test" with type "test" omitted diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/Cargo.toml b/third_party/cargo/vendor/proc-macro2-1.0.17/Cargo.toml new file mode 100644 index 0000000..78e8bd5 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/Cargo.toml @@ -0,0 +1,42 @@ +# 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 = "proc-macro2" +version = "1.0.17" +authors = ["Alex Crichton ", "David Tolnay "] +description = "A substitute implementation of the compiler's `proc_macro` API to decouple\ntoken-based libraries from the procedural macro use case.\n" +documentation = "https://docs.rs/proc-macro2" +readme = "README.md" +keywords = ["macros"] +categories = ["development-tools::procedural-macro-helpers"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/alexcrichton/proc-macro2" +[package.metadata.docs.rs] +rustc-args = ["--cfg", "procmacro2_semver_exempt"] +rustdoc-args = ["--cfg", "procmacro2_semver_exempt"] +targets = ["x86_64-unknown-linux-gnu"] + +[package.metadata.playground] +features = ["span-locations"] +[dependencies.unicode-xid] +version = "0.2" +[dev-dependencies.quote] +version = "1.0" +default_features = false + +[features] +default = ["proc-macro"] +nightly = [] +proc-macro = [] +span-locations = [] diff --git a/third_party/cargo/vendor/regex-1.3.5/LICENSE-APACHE b/third_party/cargo/vendor/proc-macro2-1.0.17/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/LICENSE-APACHE rename to third_party/cargo/vendor/proc-macro2-1.0.17/LICENSE-APACHE diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/LICENSE-MIT b/third_party/cargo/vendor/proc-macro2-1.0.17/LICENSE-MIT similarity index 95% rename from third_party/cargo/vendor/regex-syntax-0.6.17/LICENSE-MIT rename to third_party/cargo/vendor/proc-macro2-1.0.17/LICENSE-MIT index 39d4bdb..39e0ed6 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/LICENSE-MIT +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2014 The Rust Project Developers +Copyright (c) 2014 Alex Crichton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/README.md b/third_party/cargo/vendor/proc-macro2-1.0.17/README.md new file mode 100644 index 0000000..3d05e87 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/README.md @@ -0,0 +1,93 @@ +# proc-macro2 + +[![Build Status](https://img.shields.io/github/workflow/status/alexcrichton/proc-macro2/build%20and%20test)](https://github.com/alexcrichton/proc-macro2/actions) +[![Latest Version](https://img.shields.io/crates/v/proc-macro2.svg)](https://crates.io/crates/proc-macro2) +[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/proc-macro2) + +A wrapper around the procedural macro API of the compiler's `proc_macro` crate. +This library serves two purposes: + +- **Bring proc-macro-like functionality to other contexts like build.rs and + main.rs.** Types from `proc_macro` are entirely specific to procedural macros + and cannot ever exist in code outside of a procedural macro. Meanwhile + `proc_macro2` types may exist anywhere including non-macro code. By developing + foundational libraries like [syn] and [quote] against `proc_macro2` rather + than `proc_macro`, the procedural macro ecosystem becomes easily applicable to + many other use cases and we avoid reimplementing non-macro equivalents of + those libraries. + +- **Make procedural macros unit testable.** As a consequence of being specific + to procedural macros, nothing that uses `proc_macro` can be executed from a + unit test. In order for helper libraries or components of a macro to be + testable in isolation, they must be implemented using `proc_macro2`. + +[syn]: https://github.com/dtolnay/syn +[quote]: https://github.com/dtolnay/quote + +## Usage + +```toml +[dependencies] +proc-macro2 = "1.0" +``` + +The skeleton of a typical procedural macro typically looks like this: + +```rust +extern crate proc_macro; + +#[proc_macro_derive(MyDerive)] +pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { + let input = proc_macro2::TokenStream::from(input); + + let output: proc_macro2::TokenStream = { + /* transform input */ + }; + + proc_macro::TokenStream::from(output) +} +``` + +If parsing with [Syn], you'll use [`parse_macro_input!`] instead to propagate +parse errors correctly back to the compiler when parsing fails. + +[`parse_macro_input!`]: https://docs.rs/syn/1.0/syn/macro.parse_macro_input.html + +## Unstable features + +The default feature set of proc-macro2 tracks the most recent stable compiler +API. Functionality in `proc_macro` that is not yet stable is not exposed by +proc-macro2 by default. + +To opt into the additional APIs available in the most recent nightly compiler, +the `procmacro2_semver_exempt` config flag must be passed to rustc. We will +polyfill those nightly-only APIs back to Rust 1.31.0. As these are unstable APIs +that track the nightly compiler, minor versions of proc-macro2 may make breaking +changes to them at any time. + +``` +RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo build +``` + +Note that this must not only be done for your crate, but for any crate that +depends on your crate. This infectious nature is intentional, as it serves as a +reminder that you are outside of the normal semver guarantees. + +Semver exempt methods are marked as such in the proc-macro2 documentation. + +
+ +#### License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate 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/third_party/cargo/vendor/proc-macro2-1.0.17/build.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/build.rs new file mode 100644 index 0000000..89e2ab3 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/build.rs @@ -0,0 +1,137 @@ +// rustc-cfg emitted by the build script: +// +// "use_proc_macro" +// Link to extern crate proc_macro. Available on any compiler and any target +// except wasm32. Requires "proc-macro" Cargo cfg to be enabled (default is +// enabled). On wasm32 we never link to proc_macro even if "proc-macro" cfg +// is enabled. +// +// "wrap_proc_macro" +// Wrap types from libproc_macro rather than polyfilling the whole API. +// Enabled on rustc 1.29+ as long as procmacro2_semver_exempt is not set, +// because we can't emulate the unstable API without emulating everything +// else. Also enabled unconditionally on nightly, in which case the +// procmacro2_semver_exempt surface area is implemented by using the +// nightly-only proc_macro API. +// +// "hygiene" +// Enable Span::mixed_site() and non-dummy behavior of Span::resolved_at +// and Span::located_at. Enabled on Rust 1.45+. +// +// "proc_macro_span" +// Enable non-dummy behavior of Span::start and Span::end methods which +// requires an unstable compiler feature. Enabled when building with +// nightly, unless `-Z allow-feature` in RUSTFLAGS disallows unstable +// features. +// +// "super_unstable" +// Implement the semver exempt API in terms of the nightly-only proc_macro +// API. Enabled when using procmacro2_semver_exempt on a nightly compiler. +// +// "span_locations" +// Provide methods Span::start and Span::end which give the line/column +// location of a token. Enabled by procmacro2_semver_exempt or the +// "span-locations" Cargo cfg. This is behind a cfg because tracking +// location inside spans is a performance hit. + +use std::env; +use std::process::{self, Command}; +use std::str; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + + let version = match rustc_version() { + Some(version) => version, + None => return, + }; + + if version.minor < 31 { + eprintln!("Minimum supported rustc version is 1.31"); + process::exit(1); + } + + let semver_exempt = cfg!(procmacro2_semver_exempt); + if semver_exempt { + // https://github.com/alexcrichton/proc-macro2/issues/147 + println!("cargo:rustc-cfg=procmacro2_semver_exempt"); + } + + if semver_exempt || cfg!(feature = "span-locations") { + println!("cargo:rustc-cfg=span_locations"); + } + + if version.minor >= 45 { + println!("cargo:rustc-cfg=hygiene"); + } + + let target = env::var("TARGET").unwrap(); + if !enable_use_proc_macro(&target) { + return; + } + + println!("cargo:rustc-cfg=use_proc_macro"); + + if version.nightly || !semver_exempt { + println!("cargo:rustc-cfg=wrap_proc_macro"); + } + + if version.nightly && feature_allowed("proc_macro_span") { + println!("cargo:rustc-cfg=proc_macro_span"); + } + + if semver_exempt && version.nightly { + println!("cargo:rustc-cfg=super_unstable"); + } +} + +fn enable_use_proc_macro(target: &str) -> bool { + // wasm targets don't have the `proc_macro` crate, disable this feature. + if target.contains("wasm32") { + return false; + } + + // Otherwise, only enable it if our feature is actually enabled. + cfg!(feature = "proc-macro") +} + +struct RustcVersion { + minor: u32, + nightly: bool, +} + +fn rustc_version() -> Option { + let rustc = env::var_os("RUSTC")?; + let output = Command::new(rustc).arg("--version").output().ok()?; + let version = str::from_utf8(&output.stdout).ok()?; + let nightly = version.contains("nightly") || version.contains("dev"); + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + let minor = pieces.next()?.parse().ok()?; + Some(RustcVersion { minor, nightly }) +} + +fn feature_allowed(feature: &str) -> bool { + // Recognized formats: + // + // -Z allow-features=feature1,feature2 + // + // -Zallow-features=feature1,feature2 + + if let Some(rustflags) = env::var_os("RUSTFLAGS") { + for mut flag in rustflags.to_string_lossy().split(' ') { + if flag.starts_with("-Z") { + flag = &flag["-Z".len()..]; + } + if flag.starts_with("allow-features=") { + flag = &flag["allow-features=".len()..]; + return flag.split(',').any(|allowed| allowed == feature); + } + } + } + + // No allow-features= flag, allowed by default. + true +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/src/detection.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/src/detection.rs new file mode 100644 index 0000000..c597bc9 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/src/detection.rs @@ -0,0 +1,67 @@ +use std::panic::{self, PanicInfo}; +use std::sync::atomic::*; +use std::sync::Once; + +static WORKS: AtomicUsize = AtomicUsize::new(0); +static INIT: Once = Once::new(); + +pub(crate) fn inside_proc_macro() -> bool { + match WORKS.load(Ordering::SeqCst) { + 1 => return false, + 2 => return true, + _ => {} + } + + INIT.call_once(initialize); + inside_proc_macro() +} + +pub(crate) fn force_fallback() { + WORKS.store(1, Ordering::SeqCst); +} + +pub(crate) fn unforce_fallback() { + initialize(); +} + +// Swap in a null panic hook to avoid printing "thread panicked" to stderr, +// then use catch_unwind to determine whether the compiler's proc_macro is +// working. When proc-macro2 is used from outside of a procedural macro all +// of the proc_macro crate's APIs currently panic. +// +// The Once is to prevent the possibility of this ordering: +// +// thread 1 calls take_hook, gets the user's original hook +// thread 1 calls set_hook with the null hook +// thread 2 calls take_hook, thinks null hook is the original hook +// thread 2 calls set_hook with the null hook +// thread 1 calls set_hook with the actual original hook +// thread 2 calls set_hook with what it thinks is the original hook +// +// in which the user's hook has been lost. +// +// There is still a race condition where a panic in a different thread can +// happen during the interval that the user's original panic hook is +// unregistered such that their hook is incorrectly not called. This is +// sufficiently unlikely and less bad than printing panic messages to stderr +// on correct use of this crate. Maybe there is a libstd feature request +// here. For now, if a user needs to guarantee that this failure mode does +// not occur, they need to call e.g. `proc_macro2::Span::call_site()` from +// the main thread before launching any other threads. +fn initialize() { + type PanicHook = dyn Fn(&PanicInfo) + Sync + Send + 'static; + + let null_hook: Box = Box::new(|_panic_info| { /* ignore */ }); + let sanity_check = &*null_hook as *const PanicHook; + let original_hook = panic::take_hook(); + panic::set_hook(null_hook); + + let works = panic::catch_unwind(proc_macro::Span::call_site).is_ok(); + WORKS.store(works as usize + 1, Ordering::SeqCst); + + let hopefully_null_hook = panic::take_hook(); + panic::set_hook(original_hook); + if sanity_check != &*hopefully_null_hook { + panic!("observed race condition in proc_macro2::inside_proc_macro"); + } +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/src/fallback.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/src/fallback.rs new file mode 100644 index 0000000..b1cc376 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/src/fallback.rs @@ -0,0 +1,856 @@ +use crate::parse::{token_stream, Cursor}; +use crate::{Delimiter, Spacing, TokenTree}; +#[cfg(span_locations)] +use std::cell::RefCell; +#[cfg(span_locations)] +use std::cmp; +use std::fmt; +use std::iter; +use std::mem; +use std::ops::RangeBounds; +#[cfg(procmacro2_semver_exempt)] +use std::path::Path; +use std::path::PathBuf; +use std::str::FromStr; +use std::vec; +use unicode_xid::UnicodeXID; + +/// Force use of proc-macro2's fallback implementation of the API for now, even +/// if the compiler's implementation is available. +pub fn force() { + #[cfg(wrap_proc_macro)] + crate::detection::force_fallback(); +} + +/// Resume using the compiler's implementation of the proc macro API if it is +/// available. +pub fn unforce() { + #[cfg(wrap_proc_macro)] + crate::detection::unforce_fallback(); +} + +#[derive(Clone)] +pub(crate) struct TokenStream { + pub(crate) inner: Vec, +} + +#[derive(Debug)] +pub(crate) struct LexError; + +impl TokenStream { + pub fn new() -> TokenStream { + TokenStream { inner: Vec::new() } + } + + pub fn is_empty(&self) -> bool { + self.inner.len() == 0 + } + + fn take_inner(&mut self) -> Vec { + mem::replace(&mut self.inner, Vec::new()) + } +} + +// Nonrecursive to prevent stack overflow. +impl Drop for TokenStream { + fn drop(&mut self) { + while let Some(token) = self.inner.pop() { + let group = match token { + TokenTree::Group(group) => group.inner, + _ => continue, + }; + #[cfg(wrap_proc_macro)] + let group = match group { + crate::imp::Group::Fallback(group) => group, + _ => continue, + }; + let mut group = group; + self.inner.extend(group.stream.take_inner()); + } + } +} + +#[cfg(span_locations)] +fn get_cursor(src: &str) -> Cursor { + // Create a dummy file & add it to the source map + SOURCE_MAP.with(|cm| { + let mut cm = cm.borrow_mut(); + let name = format!("", cm.files.len()); + let span = cm.add_file(&name, src); + Cursor { + rest: src, + off: span.lo, + } + }) +} + +#[cfg(not(span_locations))] +fn get_cursor(src: &str) -> Cursor { + Cursor { rest: src } +} + +impl FromStr for TokenStream { + type Err = LexError; + + fn from_str(src: &str) -> Result { + // Create a dummy file & add it to the source map + let cursor = get_cursor(src); + + let (rest, tokens) = token_stream(cursor)?; + if rest.is_empty() { + Ok(tokens) + } else { + Err(LexError) + } + } +} + +impl fmt::Display for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut joint = false; + for (i, tt) in self.inner.iter().enumerate() { + if i != 0 && !joint { + write!(f, " ")?; + } + joint = false; + match tt { + TokenTree::Group(tt) => { + let (start, end) = match tt.delimiter() { + Delimiter::Parenthesis => ("(", ")"), + Delimiter::Brace => ("{", "}"), + Delimiter::Bracket => ("[", "]"), + Delimiter::None => ("", ""), + }; + if tt.stream().into_iter().next().is_none() { + write!(f, "{} {}", start, end)? + } else { + write!(f, "{} {} {}", start, tt.stream(), end)? + } + } + TokenTree::Ident(tt) => write!(f, "{}", tt)?, + TokenTree::Punct(tt) => { + write!(f, "{}", tt.as_char())?; + match tt.spacing() { + Spacing::Alone => {} + Spacing::Joint => joint = true, + } + } + TokenTree::Literal(tt) => write!(f, "{}", tt)?, + } + } + + Ok(()) + } +} + +impl fmt::Debug for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("TokenStream ")?; + f.debug_list().entries(self.clone()).finish() + } +} + +#[cfg(use_proc_macro)] +impl From for TokenStream { + fn from(inner: proc_macro::TokenStream) -> TokenStream { + inner + .to_string() + .parse() + .expect("compiler token stream parse failed") + } +} + +#[cfg(use_proc_macro)] +impl From for proc_macro::TokenStream { + fn from(inner: TokenStream) -> proc_macro::TokenStream { + inner + .to_string() + .parse() + .expect("failed to parse to compiler tokens") + } +} + +impl From for TokenStream { + fn from(tree: TokenTree) -> TokenStream { + TokenStream { inner: vec![tree] } + } +} + +impl iter::FromIterator for TokenStream { + fn from_iter>(streams: I) -> Self { + let mut v = Vec::new(); + + for token in streams.into_iter() { + v.push(token); + } + + TokenStream { inner: v } + } +} + +impl iter::FromIterator for TokenStream { + fn from_iter>(streams: I) -> Self { + let mut v = Vec::new(); + + for mut stream in streams.into_iter() { + v.extend(stream.take_inner()); + } + + TokenStream { inner: v } + } +} + +impl Extend for TokenStream { + fn extend>(&mut self, streams: I) { + self.inner.extend(streams); + } +} + +impl Extend for TokenStream { + fn extend>(&mut self, streams: I) { + self.inner + .extend(streams.into_iter().flat_map(|stream| stream)); + } +} + +pub(crate) type TokenTreeIter = vec::IntoIter; + +impl IntoIterator for TokenStream { + type Item = TokenTree; + type IntoIter = TokenTreeIter; + + fn into_iter(mut self) -> TokenTreeIter { + self.take_inner().into_iter() + } +} + +#[derive(Clone, PartialEq, Eq)] +pub(crate) struct SourceFile { + path: PathBuf, +} + +impl SourceFile { + /// Get the path to this source file as a string. + pub fn path(&self) -> PathBuf { + self.path.clone() + } + + pub fn is_real(&self) -> bool { + // XXX(nika): Support real files in the future? + false + } +} + +impl fmt::Debug for SourceFile { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("SourceFile") + .field("path", &self.path()) + .field("is_real", &self.is_real()) + .finish() + } +} + +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub(crate) struct LineColumn { + pub line: usize, + pub column: usize, +} + +#[cfg(span_locations)] +thread_local! { + static SOURCE_MAP: RefCell = RefCell::new(SourceMap { + // NOTE: We start with a single dummy file which all call_site() and + // def_site() spans reference. + files: vec![FileInfo { + #[cfg(procmacro2_semver_exempt)] + name: "".to_owned(), + span: Span { lo: 0, hi: 0 }, + lines: vec![0], + }], + }); +} + +#[cfg(span_locations)] +struct FileInfo { + #[cfg(procmacro2_semver_exempt)] + name: String, + span: Span, + lines: Vec, +} + +#[cfg(span_locations)] +impl FileInfo { + fn offset_line_column(&self, offset: usize) -> LineColumn { + assert!(self.span_within(Span { + lo: offset as u32, + hi: offset as u32 + })); + let offset = offset - self.span.lo as usize; + match self.lines.binary_search(&offset) { + Ok(found) => LineColumn { + line: found + 1, + column: 0, + }, + Err(idx) => LineColumn { + line: idx, + column: offset - self.lines[idx - 1], + }, + } + } + + fn span_within(&self, span: Span) -> bool { + span.lo >= self.span.lo && span.hi <= self.span.hi + } +} + +/// Computes the offsets of each line in the given source string +/// and the total number of characters +#[cfg(span_locations)] +fn lines_offsets(s: &str) -> (usize, Vec) { + let mut lines = vec![0]; + let mut total = 0; + + for ch in s.chars() { + total += 1; + if ch == '\n' { + lines.push(total); + } + } + + (total, lines) +} + +#[cfg(span_locations)] +struct SourceMap { + files: Vec, +} + +#[cfg(span_locations)] +impl SourceMap { + fn next_start_pos(&self) -> u32 { + // Add 1 so there's always space between files. + // + // We'll always have at least 1 file, as we initialize our files list + // with a dummy file. + self.files.last().unwrap().span.hi + 1 + } + + fn add_file(&mut self, name: &str, src: &str) -> Span { + let (len, lines) = lines_offsets(src); + let lo = self.next_start_pos(); + // XXX(nika): Shouild we bother doing a checked cast or checked add here? + let span = Span { + lo, + hi: lo + (len as u32), + }; + + self.files.push(FileInfo { + #[cfg(procmacro2_semver_exempt)] + name: name.to_owned(), + span, + lines, + }); + + #[cfg(not(procmacro2_semver_exempt))] + let _ = name; + + span + } + + fn fileinfo(&self, span: Span) -> &FileInfo { + for file in &self.files { + if file.span_within(span) { + return file; + } + } + panic!("Invalid span with no related FileInfo!"); + } +} + +#[derive(Clone, Copy, PartialEq, Eq)] +pub(crate) struct Span { + #[cfg(span_locations)] + pub(crate) lo: u32, + #[cfg(span_locations)] + pub(crate) hi: u32, +} + +impl Span { + #[cfg(not(span_locations))] + pub fn call_site() -> Span { + Span {} + } + + #[cfg(span_locations)] + pub fn call_site() -> Span { + Span { lo: 0, hi: 0 } + } + + #[cfg(procmacro2_semver_exempt)] + #[cfg(hygiene)] + pub fn mixed_site() -> Span { + Span::call_site() + } + + #[cfg(procmacro2_semver_exempt)] + pub fn def_site() -> Span { + Span::call_site() + } + + #[cfg(procmacro2_semver_exempt)] + pub fn resolved_at(&self, _other: Span) -> Span { + // Stable spans consist only of line/column information, so + // `resolved_at` and `located_at` only select which span the + // caller wants line/column information from. + *self + } + + #[cfg(procmacro2_semver_exempt)] + pub fn located_at(&self, other: Span) -> Span { + other + } + + #[cfg(procmacro2_semver_exempt)] + pub fn source_file(&self) -> SourceFile { + SOURCE_MAP.with(|cm| { + let cm = cm.borrow(); + let fi = cm.fileinfo(*self); + SourceFile { + path: Path::new(&fi.name).to_owned(), + } + }) + } + + #[cfg(span_locations)] + pub fn start(&self) -> LineColumn { + SOURCE_MAP.with(|cm| { + let cm = cm.borrow(); + let fi = cm.fileinfo(*self); + fi.offset_line_column(self.lo as usize) + }) + } + + #[cfg(span_locations)] + pub fn end(&self) -> LineColumn { + SOURCE_MAP.with(|cm| { + let cm = cm.borrow(); + let fi = cm.fileinfo(*self); + fi.offset_line_column(self.hi as usize) + }) + } + + #[cfg(not(span_locations))] + pub fn join(&self, _other: Span) -> Option { + Some(Span {}) + } + + #[cfg(span_locations)] + pub fn join(&self, other: Span) -> Option { + SOURCE_MAP.with(|cm| { + let cm = cm.borrow(); + // If `other` is not within the same FileInfo as us, return None. + if !cm.fileinfo(*self).span_within(other) { + return None; + } + Some(Span { + lo: cmp::min(self.lo, other.lo), + hi: cmp::max(self.hi, other.hi), + }) + }) + } + + #[cfg(not(span_locations))] + fn first_byte(self) -> Self { + self + } + + #[cfg(span_locations)] + fn first_byte(self) -> Self { + Span { + lo: self.lo, + hi: cmp::min(self.lo.saturating_add(1), self.hi), + } + } + + #[cfg(not(span_locations))] + fn last_byte(self) -> Self { + self + } + + #[cfg(span_locations)] + fn last_byte(self) -> Self { + Span { + lo: cmp::max(self.hi.saturating_sub(1), self.lo), + hi: self.hi, + } + } +} + +impl fmt::Debug for Span { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + #[cfg(procmacro2_semver_exempt)] + return write!(f, "bytes({}..{})", self.lo, self.hi); + + #[cfg(not(procmacro2_semver_exempt))] + write!(f, "Span") + } +} + +pub(crate) fn debug_span_field_if_nontrivial(debug: &mut fmt::DebugStruct, span: Span) { + if cfg!(procmacro2_semver_exempt) { + debug.field("span", &span); + } +} + +#[derive(Clone)] +pub(crate) struct Group { + delimiter: Delimiter, + stream: TokenStream, + span: Span, +} + +impl Group { + pub fn new(delimiter: Delimiter, stream: TokenStream) -> Group { + Group { + delimiter, + stream, + span: Span::call_site(), + } + } + + pub fn delimiter(&self) -> Delimiter { + self.delimiter + } + + pub fn stream(&self) -> TokenStream { + self.stream.clone() + } + + pub fn span(&self) -> Span { + self.span + } + + pub fn span_open(&self) -> Span { + self.span.first_byte() + } + + pub fn span_close(&self) -> Span { + self.span.last_byte() + } + + pub fn set_span(&mut self, span: Span) { + self.span = span; + } +} + +impl fmt::Display for Group { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let (left, right) = match self.delimiter { + Delimiter::Parenthesis => ("(", ")"), + Delimiter::Brace => ("{", "}"), + Delimiter::Bracket => ("[", "]"), + Delimiter::None => ("", ""), + }; + + f.write_str(left)?; + self.stream.fmt(f)?; + f.write_str(right)?; + + Ok(()) + } +} + +impl fmt::Debug for Group { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + let mut debug = fmt.debug_struct("Group"); + debug.field("delimiter", &self.delimiter); + debug.field("stream", &self.stream); + #[cfg(procmacro2_semver_exempt)] + debug.field("span", &self.span); + debug.finish() + } +} + +#[derive(Clone)] +pub(crate) struct Ident { + sym: String, + span: Span, + raw: bool, +} + +impl Ident { + fn _new(string: &str, raw: bool, span: Span) -> Ident { + validate_ident(string); + + Ident { + sym: string.to_owned(), + span, + raw, + } + } + + pub fn new(string: &str, span: Span) -> Ident { + Ident::_new(string, false, span) + } + + pub fn new_raw(string: &str, span: Span) -> Ident { + Ident::_new(string, true, span) + } + + pub fn span(&self) -> Span { + self.span + } + + pub fn set_span(&mut self, span: Span) { + self.span = span; + } +} + +pub(crate) fn is_ident_start(c: char) -> bool { + ('a' <= c && c <= 'z') + || ('A' <= c && c <= 'Z') + || c == '_' + || (c > '\x7f' && UnicodeXID::is_xid_start(c)) +} + +pub(crate) fn is_ident_continue(c: char) -> bool { + ('a' <= c && c <= 'z') + || ('A' <= c && c <= 'Z') + || c == '_' + || ('0' <= c && c <= '9') + || (c > '\x7f' && UnicodeXID::is_xid_continue(c)) +} + +fn validate_ident(string: &str) { + let validate = string; + if validate.is_empty() { + panic!("Ident is not allowed to be empty; use Option"); + } + + if validate.bytes().all(|digit| digit >= b'0' && digit <= b'9') { + panic!("Ident cannot be a number; use Literal instead"); + } + + fn ident_ok(string: &str) -> bool { + let mut chars = string.chars(); + let first = chars.next().unwrap(); + if !is_ident_start(first) { + return false; + } + for ch in chars { + if !is_ident_continue(ch) { + return false; + } + } + true + } + + if !ident_ok(validate) { + panic!("{:?} is not a valid Ident", string); + } +} + +impl PartialEq for Ident { + fn eq(&self, other: &Ident) -> bool { + self.sym == other.sym && self.raw == other.raw + } +} + +impl PartialEq for Ident +where + T: ?Sized + AsRef, +{ + fn eq(&self, other: &T) -> bool { + let other = other.as_ref(); + if self.raw { + other.starts_with("r#") && self.sym == other[2..] + } else { + self.sym == other + } + } +} + +impl fmt::Display for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.raw { + "r#".fmt(f)?; + } + self.sym.fmt(f) + } +} + +impl fmt::Debug for Ident { + // Ident(proc_macro), Ident(r#union) + #[cfg(not(procmacro2_semver_exempt))] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut debug = f.debug_tuple("Ident"); + debug.field(&format_args!("{}", self)); + debug.finish() + } + + // Ident { + // sym: proc_macro, + // span: bytes(128..138) + // } + #[cfg(procmacro2_semver_exempt)] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let mut debug = f.debug_struct("Ident"); + debug.field("sym", &format_args!("{}", self)); + debug.field("span", &self.span); + debug.finish() + } +} + +#[derive(Clone)] +pub(crate) struct Literal { + text: String, + span: Span, +} + +macro_rules! suffixed_numbers { + ($($name:ident => $kind:ident,)*) => ($( + pub fn $name(n: $kind) -> Literal { + Literal::_new(format!(concat!("{}", stringify!($kind)), n)) + } + )*) +} + +macro_rules! unsuffixed_numbers { + ($($name:ident => $kind:ident,)*) => ($( + pub fn $name(n: $kind) -> Literal { + Literal::_new(n.to_string()) + } + )*) +} + +impl Literal { + pub(crate) fn _new(text: String) -> Literal { + Literal { + text, + span: Span::call_site(), + } + } + + suffixed_numbers! { + u8_suffixed => u8, + u16_suffixed => u16, + u32_suffixed => u32, + u64_suffixed => u64, + u128_suffixed => u128, + usize_suffixed => usize, + i8_suffixed => i8, + i16_suffixed => i16, + i32_suffixed => i32, + i64_suffixed => i64, + i128_suffixed => i128, + isize_suffixed => isize, + + f32_suffixed => f32, + f64_suffixed => f64, + } + + unsuffixed_numbers! { + u8_unsuffixed => u8, + u16_unsuffixed => u16, + u32_unsuffixed => u32, + u64_unsuffixed => u64, + u128_unsuffixed => u128, + usize_unsuffixed => usize, + i8_unsuffixed => i8, + i16_unsuffixed => i16, + i32_unsuffixed => i32, + i64_unsuffixed => i64, + i128_unsuffixed => i128, + isize_unsuffixed => isize, + } + + pub fn f32_unsuffixed(f: f32) -> Literal { + let mut s = f.to_string(); + if !s.contains(".") { + s.push_str(".0"); + } + Literal::_new(s) + } + + pub fn f64_unsuffixed(f: f64) -> Literal { + let mut s = f.to_string(); + if !s.contains(".") { + s.push_str(".0"); + } + Literal::_new(s) + } + + pub fn string(t: &str) -> Literal { + let mut text = String::with_capacity(t.len() + 2); + text.push('"'); + for c in t.chars() { + if c == '\'' { + // escape_debug turns this into "\'" which is unnecessary. + text.push(c); + } else { + text.extend(c.escape_debug()); + } + } + text.push('"'); + Literal::_new(text) + } + + pub fn character(t: char) -> Literal { + let mut text = String::new(); + text.push('\''); + if t == '"' { + // escape_debug turns this into '\"' which is unnecessary. + text.push(t); + } else { + text.extend(t.escape_debug()); + } + text.push('\''); + Literal::_new(text) + } + + pub fn byte_string(bytes: &[u8]) -> Literal { + let mut escaped = "b\"".to_string(); + for b in bytes { + match *b { + b'\0' => escaped.push_str(r"\0"), + b'\t' => escaped.push_str(r"\t"), + b'\n' => escaped.push_str(r"\n"), + b'\r' => escaped.push_str(r"\r"), + b'"' => escaped.push_str("\\\""), + b'\\' => escaped.push_str("\\\\"), + b'\x20'..=b'\x7E' => escaped.push(*b as char), + _ => escaped.push_str(&format!("\\x{:02X}", b)), + } + } + escaped.push('"'); + Literal::_new(escaped) + } + + pub fn span(&self) -> Span { + self.span + } + + pub fn set_span(&mut self, span: Span) { + self.span = span; + } + + pub fn subspan>(&self, _range: R) -> Option { + None + } +} + +impl fmt::Display for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.text.fmt(f) + } +} + +impl fmt::Debug for Literal { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + let mut debug = fmt.debug_struct("Literal"); + debug.field("lit", &format_args!("{}", self.text)); + #[cfg(procmacro2_semver_exempt)] + debug.field("span", &self.span); + debug.finish() + } +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/src/lib.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/src/lib.rs new file mode 100644 index 0000000..25c0903 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/src/lib.rs @@ -0,0 +1,1226 @@ +//! A wrapper around the procedural macro API of the compiler's [`proc_macro`] +//! crate. This library serves two purposes: +//! +//! [`proc_macro`]: https://doc.rust-lang.org/proc_macro/ +//! +//! - **Bring proc-macro-like functionality to other contexts like build.rs and +//! main.rs.** Types from `proc_macro` are entirely specific to procedural +//! macros and cannot ever exist in code outside of a procedural macro. +//! Meanwhile `proc_macro2` types may exist anywhere including non-macro code. +//! By developing foundational libraries like [syn] and [quote] against +//! `proc_macro2` rather than `proc_macro`, the procedural macro ecosystem +//! becomes easily applicable to many other use cases and we avoid +//! reimplementing non-macro equivalents of those libraries. +//! +//! - **Make procedural macros unit testable.** As a consequence of being +//! specific to procedural macros, nothing that uses `proc_macro` can be +//! executed from a unit test. In order for helper libraries or components of +//! a macro to be testable in isolation, they must be implemented using +//! `proc_macro2`. +//! +//! [syn]: https://github.com/dtolnay/syn +//! [quote]: https://github.com/dtolnay/quote +//! +//! # Usage +//! +//! The skeleton of a typical procedural macro typically looks like this: +//! +//! ``` +//! extern crate proc_macro; +//! +//! # const IGNORE: &str = stringify! { +//! #[proc_macro_derive(MyDerive)] +//! # }; +//! # #[cfg(wrap_proc_macro)] +//! pub fn my_derive(input: proc_macro::TokenStream) -> proc_macro::TokenStream { +//! let input = proc_macro2::TokenStream::from(input); +//! +//! let output: proc_macro2::TokenStream = { +//! /* transform input */ +//! # input +//! }; +//! +//! proc_macro::TokenStream::from(output) +//! } +//! ``` +//! +//! If parsing with [Syn], you'll use [`parse_macro_input!`] instead to +//! propagate parse errors correctly back to the compiler when parsing fails. +//! +//! [`parse_macro_input!`]: https://docs.rs/syn/1.0/syn/macro.parse_macro_input.html +//! +//! # Unstable features +//! +//! The default feature set of proc-macro2 tracks the most recent stable +//! compiler API. Functionality in `proc_macro` that is not yet stable is not +//! exposed by proc-macro2 by default. +//! +//! To opt into the additional APIs available in the most recent nightly +//! compiler, the `procmacro2_semver_exempt` config flag must be passed to +//! rustc. We will polyfill those nightly-only APIs back to Rust 1.31.0. As +//! these are unstable APIs that track the nightly compiler, minor versions of +//! proc-macro2 may make breaking changes to them at any time. +//! +//! ```sh +//! RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo build +//! ``` +//! +//! Note that this must not only be done for your crate, but for any crate that +//! depends on your crate. This infectious nature is intentional, as it serves +//! as a reminder that you are outside of the normal semver guarantees. +//! +//! Semver exempt methods are marked as such in the proc-macro2 documentation. +//! +//! # Thread-Safety +//! +//! Most types in this crate are `!Sync` because the underlying compiler +//! types make use of thread-local memory, meaning they cannot be accessed from +//! a different thread. + +// Proc-macro2 types in rustdoc of other crates get linked to here. +#![doc(html_root_url = "https://docs.rs/proc-macro2/1.0.17")] +#![cfg_attr(any(proc_macro_span, super_unstable), feature(proc_macro_span))] +#![cfg_attr(super_unstable, feature(proc_macro_raw_ident, proc_macro_def_site))] + +#[cfg(use_proc_macro)] +extern crate proc_macro; + +use std::cmp::Ordering; +use std::fmt; +use std::hash::{Hash, Hasher}; +use std::iter::FromIterator; +use std::marker; +use std::ops::RangeBounds; +#[cfg(procmacro2_semver_exempt)] +use std::path::PathBuf; +use std::rc::Rc; +use std::str::FromStr; + +mod parse; + +#[cfg(wrap_proc_macro)] +mod detection; + +// Public for proc_macro2::fallback::force() and unforce(), but those are quite +// a niche use case so we omit it from rustdoc. +#[doc(hidden)] +pub mod fallback; + +#[cfg(not(wrap_proc_macro))] +use crate::fallback as imp; +#[path = "wrapper.rs"] +#[cfg(wrap_proc_macro)] +mod imp; + +/// An abstract stream of tokens, or more concretely a sequence of token trees. +/// +/// This type provides interfaces for iterating over token trees and for +/// collecting token trees into one stream. +/// +/// Token stream is both the input and output of `#[proc_macro]`, +/// `#[proc_macro_attribute]` and `#[proc_macro_derive]` definitions. +#[derive(Clone)] +pub struct TokenStream { + inner: imp::TokenStream, + _marker: marker::PhantomData>, +} + +/// Error returned from `TokenStream::from_str`. +pub struct LexError { + inner: imp::LexError, + _marker: marker::PhantomData>, +} + +impl TokenStream { + fn _new(inner: imp::TokenStream) -> TokenStream { + TokenStream { + inner, + _marker: marker::PhantomData, + } + } + + fn _new_stable(inner: fallback::TokenStream) -> TokenStream { + TokenStream { + inner: inner.into(), + _marker: marker::PhantomData, + } + } + + /// Returns an empty `TokenStream` containing no token trees. + pub fn new() -> TokenStream { + TokenStream::_new(imp::TokenStream::new()) + } + + /// Checks if this `TokenStream` is empty. + pub fn is_empty(&self) -> bool { + self.inner.is_empty() + } +} + +/// `TokenStream::default()` returns an empty stream, +/// i.e. this is equivalent with `TokenStream::new()`. +impl Default for TokenStream { + fn default() -> Self { + TokenStream::new() + } +} + +/// Attempts to break the string into tokens and parse those tokens into a token +/// stream. +/// +/// May fail for a number of reasons, for example, if the string contains +/// unbalanced delimiters or characters not existing in the language. +/// +/// NOTE: Some errors may cause panics instead of returning `LexError`. We +/// reserve the right to change these errors into `LexError`s later. +impl FromStr for TokenStream { + type Err = LexError; + + fn from_str(src: &str) -> Result { + let e = src.parse().map_err(|e| LexError { + inner: e, + _marker: marker::PhantomData, + })?; + Ok(TokenStream::_new(e)) + } +} + +#[cfg(use_proc_macro)] +impl From for TokenStream { + fn from(inner: proc_macro::TokenStream) -> TokenStream { + TokenStream::_new(inner.into()) + } +} + +#[cfg(use_proc_macro)] +impl From for proc_macro::TokenStream { + fn from(inner: TokenStream) -> proc_macro::TokenStream { + inner.inner.into() + } +} + +impl From for TokenStream { + fn from(token: TokenTree) -> Self { + TokenStream::_new(imp::TokenStream::from(token)) + } +} + +impl Extend for TokenStream { + fn extend>(&mut self, streams: I) { + self.inner.extend(streams) + } +} + +impl Extend for TokenStream { + fn extend>(&mut self, streams: I) { + self.inner + .extend(streams.into_iter().map(|stream| stream.inner)) + } +} + +/// Collects a number of token trees into a single stream. +impl FromIterator for TokenStream { + fn from_iter>(streams: I) -> Self { + TokenStream::_new(streams.into_iter().collect()) + } +} +impl FromIterator for TokenStream { + fn from_iter>(streams: I) -> Self { + TokenStream::_new(streams.into_iter().map(|i| i.inner).collect()) + } +} + +/// Prints the token stream as a string that is supposed to be losslessly +/// convertible back into the same token stream (modulo spans), except for +/// possibly `TokenTree::Group`s with `Delimiter::None` delimiters and negative +/// numeric literals. +impl fmt::Display for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +/// Prints token in a form convenient for debugging. +impl fmt::Debug for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +impl fmt::Debug for LexError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +/// The source file of a given `Span`. +/// +/// This type is semver exempt and not exposed by default. +#[cfg(procmacro2_semver_exempt)] +#[derive(Clone, PartialEq, Eq)] +pub struct SourceFile { + inner: imp::SourceFile, + _marker: marker::PhantomData>, +} + +#[cfg(procmacro2_semver_exempt)] +impl SourceFile { + fn _new(inner: imp::SourceFile) -> Self { + SourceFile { + inner, + _marker: marker::PhantomData, + } + } + + /// Get the path to this source file. + /// + /// ### Note + /// + /// If the code span associated with this `SourceFile` was generated by an + /// external macro, this may not be an actual path on the filesystem. Use + /// [`is_real`] to check. + /// + /// Also note that even if `is_real` returns `true`, if + /// `--remap-path-prefix` was passed on the command line, the path as given + /// may not actually be valid. + /// + /// [`is_real`]: #method.is_real + pub fn path(&self) -> PathBuf { + self.inner.path() + } + + /// Returns `true` if this source file is a real source file, and not + /// generated by an external macro's expansion. + pub fn is_real(&self) -> bool { + self.inner.is_real() + } +} + +#[cfg(procmacro2_semver_exempt)] +impl fmt::Debug for SourceFile { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +/// A line-column pair representing the start or end of a `Span`. +/// +/// This type is semver exempt and not exposed by default. +#[cfg(span_locations)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +pub struct LineColumn { + /// The 1-indexed line in the source file on which the span starts or ends + /// (inclusive). + pub line: usize, + /// The 0-indexed column (in UTF-8 characters) in the source file on which + /// the span starts or ends (inclusive). + pub column: usize, +} + +#[cfg(span_locations)] +impl Ord for LineColumn { + fn cmp(&self, other: &Self) -> Ordering { + self.line.cmp(&other.line).then(self.column.cmp(&other.column)) + } +} + +#[cfg(span_locations)] +impl PartialOrd for LineColumn { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +/// A region of source code, along with macro expansion information. +#[derive(Copy, Clone)] +pub struct Span { + inner: imp::Span, + _marker: marker::PhantomData>, +} + +impl Span { + fn _new(inner: imp::Span) -> Span { + Span { + inner, + _marker: marker::PhantomData, + } + } + + fn _new_stable(inner: fallback::Span) -> Span { + Span { + inner: inner.into(), + _marker: marker::PhantomData, + } + } + + /// The span of the invocation of the current procedural macro. + /// + /// Identifiers created with this span will be resolved as if they were + /// written directly at the macro call location (call-site hygiene) and + /// other code at the macro call site will be able to refer to them as well. + pub fn call_site() -> Span { + Span::_new(imp::Span::call_site()) + } + + /// The span located at the invocation of the procedural macro, but with + /// local variables, labels, and `$crate` resolved at the definition site + /// of the macro. This is the same hygiene behavior as `macro_rules`. + /// + /// This function requires Rust 1.45 or later. + #[cfg(procmacro2_semver_exempt)] + #[cfg(hygiene)] + pub fn mixed_site() -> Span { + Span::_new(imp::Span::mixed_site()) + } + + /// A span that resolves at the macro definition site. + /// + /// This method is semver exempt and not exposed by default. + #[cfg(procmacro2_semver_exempt)] + pub fn def_site() -> Span { + Span::_new(imp::Span::def_site()) + } + + /// Creates a new span with the same line/column information as `self` but + /// that resolves symbols as though it were at `other`. + #[cfg(procmacro2_semver_exempt)] + pub fn resolved_at(&self, other: Span) -> Span { + Span::_new(self.inner.resolved_at(other.inner)) + } + + /// Creates a new span with the same name resolution behavior as `self` but + /// with the line/column information of `other`. + #[cfg(procmacro2_semver_exempt)] + pub fn located_at(&self, other: Span) -> Span { + Span::_new(self.inner.located_at(other.inner)) + } + + /// Convert `proc_macro2::Span` to `proc_macro::Span`. + /// + /// This method is available when building with a nightly compiler, or when + /// building with rustc 1.29+ *without* semver exempt features. + /// + /// # Panics + /// + /// Panics if called from outside of a procedural macro. Unlike + /// `proc_macro2::Span`, the `proc_macro::Span` type can only exist within + /// the context of a procedural macro invocation. + #[cfg(wrap_proc_macro)] + pub fn unwrap(self) -> proc_macro::Span { + self.inner.unwrap() + } + + // Soft deprecated. Please use Span::unwrap. + #[cfg(wrap_proc_macro)] + #[doc(hidden)] + pub fn unstable(self) -> proc_macro::Span { + self.unwrap() + } + + /// The original source file into which this span points. + /// + /// This method is semver exempt and not exposed by default. + #[cfg(procmacro2_semver_exempt)] + pub fn source_file(&self) -> SourceFile { + SourceFile::_new(self.inner.source_file()) + } + + /// Get the starting line/column in the source file for this span. + /// + /// This method requires the `"span-locations"` feature to be enabled. + #[cfg(span_locations)] + pub fn start(&self) -> LineColumn { + let imp::LineColumn { line, column } = self.inner.start(); + LineColumn { line, column } + } + + /// Get the ending line/column in the source file for this span. + /// + /// This method requires the `"span-locations"` feature to be enabled. + #[cfg(span_locations)] + pub fn end(&self) -> LineColumn { + let imp::LineColumn { line, column } = self.inner.end(); + LineColumn { line, column } + } + + /// Create a new span encompassing `self` and `other`. + /// + /// Returns `None` if `self` and `other` are from different files. + /// + /// Warning: the underlying [`proc_macro::Span::join`] method is + /// nightly-only. When called from within a procedural macro not using a + /// nightly compiler, this method will always return `None`. + /// + /// [`proc_macro::Span::join`]: https://doc.rust-lang.org/proc_macro/struct.Span.html#method.join + pub fn join(&self, other: Span) -> Option { + self.inner.join(other.inner).map(Span::_new) + } + + /// Compares two spans to see if they're equal. + /// + /// This method is semver exempt and not exposed by default. + #[cfg(procmacro2_semver_exempt)] + pub fn eq(&self, other: &Span) -> bool { + self.inner.eq(&other.inner) + } +} + +/// Prints a span in a form convenient for debugging. +impl fmt::Debug for Span { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +/// A single token or a delimited sequence of token trees (e.g. `[1, (), ..]`). +#[derive(Clone)] +pub enum TokenTree { + /// A token stream surrounded by bracket delimiters. + Group(Group), + /// An identifier. + Ident(Ident), + /// A single punctuation character (`+`, `,`, `$`, etc.). + Punct(Punct), + /// A literal character (`'a'`), string (`"hello"`), number (`2.3`), etc. + Literal(Literal), +} + +impl TokenTree { + /// Returns the span of this tree, delegating to the `span` method of + /// the contained token or a delimited stream. + pub fn span(&self) -> Span { + match self { + TokenTree::Group(t) => t.span(), + TokenTree::Ident(t) => t.span(), + TokenTree::Punct(t) => t.span(), + TokenTree::Literal(t) => t.span(), + } + } + + /// Configures the span for *only this token*. + /// + /// Note that if this token is a `Group` then this method will not configure + /// the span of each of the internal tokens, this will simply delegate to + /// the `set_span` method of each variant. + pub fn set_span(&mut self, span: Span) { + match self { + TokenTree::Group(t) => t.set_span(span), + TokenTree::Ident(t) => t.set_span(span), + TokenTree::Punct(t) => t.set_span(span), + TokenTree::Literal(t) => t.set_span(span), + } + } +} + +impl From for TokenTree { + fn from(g: Group) -> TokenTree { + TokenTree::Group(g) + } +} + +impl From for TokenTree { + fn from(g: Ident) -> TokenTree { + TokenTree::Ident(g) + } +} + +impl From for TokenTree { + fn from(g: Punct) -> TokenTree { + TokenTree::Punct(g) + } +} + +impl From for TokenTree { + fn from(g: Literal) -> TokenTree { + TokenTree::Literal(g) + } +} + +/// Prints the token tree as a string that is supposed to be losslessly +/// convertible back into the same token tree (modulo spans), except for +/// possibly `TokenTree::Group`s with `Delimiter::None` delimiters and negative +/// numeric literals. +impl fmt::Display for TokenTree { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + TokenTree::Group(t) => t.fmt(f), + TokenTree::Ident(t) => t.fmt(f), + TokenTree::Punct(t) => t.fmt(f), + TokenTree::Literal(t) => t.fmt(f), + } + } +} + +/// Prints token tree in a form convenient for debugging. +impl fmt::Debug for TokenTree { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // Each of these has the name in the struct type in the derived debug, + // so don't bother with an extra layer of indirection + match self { + TokenTree::Group(t) => t.fmt(f), + TokenTree::Ident(t) => { + let mut debug = f.debug_struct("Ident"); + debug.field("sym", &format_args!("{}", t)); + imp::debug_span_field_if_nontrivial(&mut debug, t.span().inner); + debug.finish() + } + TokenTree::Punct(t) => t.fmt(f), + TokenTree::Literal(t) => t.fmt(f), + } + } +} + +/// A delimited token stream. +/// +/// A `Group` internally contains a `TokenStream` which is surrounded by +/// `Delimiter`s. +#[derive(Clone)] +pub struct Group { + inner: imp::Group, +} + +/// Describes how a sequence of token trees is delimited. +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub enum Delimiter { + /// `( ... )` + Parenthesis, + /// `{ ... }` + Brace, + /// `[ ... ]` + Bracket, + /// `Ø ... Ø` + /// + /// An implicit delimiter, that may, for example, appear around tokens + /// coming from a "macro variable" `$var`. It is important to preserve + /// operator priorities in cases like `$var * 3` where `$var` is `1 + 2`. + /// Implicit delimiters may not survive roundtrip of a token stream through + /// a string. + None, +} + +impl Group { + fn _new(inner: imp::Group) -> Self { + Group { inner } + } + + fn _new_stable(inner: fallback::Group) -> Self { + Group { + inner: inner.into(), + } + } + + /// Creates a new `Group` with the given delimiter and token stream. + /// + /// This constructor will set the span for this group to + /// `Span::call_site()`. To change the span you can use the `set_span` + /// method below. + pub fn new(delimiter: Delimiter, stream: TokenStream) -> Group { + Group { + inner: imp::Group::new(delimiter, stream.inner), + } + } + + /// Returns the delimiter of this `Group` + pub fn delimiter(&self) -> Delimiter { + self.inner.delimiter() + } + + /// Returns the `TokenStream` of tokens that are delimited in this `Group`. + /// + /// Note that the returned token stream does not include the delimiter + /// returned above. + pub fn stream(&self) -> TokenStream { + TokenStream::_new(self.inner.stream()) + } + + /// Returns the span for the delimiters of this token stream, spanning the + /// entire `Group`. + /// + /// ```text + /// pub fn span(&self) -> Span { + /// ^^^^^^^ + /// ``` + pub fn span(&self) -> Span { + Span::_new(self.inner.span()) + } + + /// Returns the span pointing to the opening delimiter of this group. + /// + /// ```text + /// pub fn span_open(&self) -> Span { + /// ^ + /// ``` + pub fn span_open(&self) -> Span { + Span::_new(self.inner.span_open()) + } + + /// Returns the span pointing to the closing delimiter of this group. + /// + /// ```text + /// pub fn span_close(&self) -> Span { + /// ^ + /// ``` + pub fn span_close(&self) -> Span { + Span::_new(self.inner.span_close()) + } + + /// Configures the span for this `Group`'s delimiters, but not its internal + /// tokens. + /// + /// This method will **not** set the span of all the internal tokens spanned + /// by this group, but rather it will only set the span of the delimiter + /// tokens at the level of the `Group`. + pub fn set_span(&mut self, span: Span) { + self.inner.set_span(span.inner) + } +} + +/// Prints the group as a string that should be losslessly convertible back +/// into the same group (modulo spans), except for possibly `TokenTree::Group`s +/// with `Delimiter::None` delimiters. +impl fmt::Display for Group { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.inner, formatter) + } +} + +impl fmt::Debug for Group { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self.inner, formatter) + } +} + +/// An `Punct` is an single punctuation character like `+`, `-` or `#`. +/// +/// Multicharacter operators like `+=` are represented as two instances of +/// `Punct` with different forms of `Spacing` returned. +#[derive(Clone)] +pub struct Punct { + op: char, + spacing: Spacing, + span: Span, +} + +/// Whether an `Punct` is followed immediately by another `Punct` or followed by +/// another token or whitespace. +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub enum Spacing { + /// E.g. `+` is `Alone` in `+ =`, `+ident` or `+()`. + Alone, + /// E.g. `+` is `Joint` in `+=` or `'` is `Joint` in `'#`. + /// + /// Additionally, single quote `'` can join with identifiers to form + /// lifetimes `'ident`. + Joint, +} + +impl Punct { + /// Creates a new `Punct` from the given character and spacing. + /// + /// The `ch` argument must be a valid punctuation character permitted by the + /// language, otherwise the function will panic. + /// + /// The returned `Punct` will have the default span of `Span::call_site()` + /// which can be further configured with the `set_span` method below. + pub fn new(op: char, spacing: Spacing) -> Punct { + Punct { + op, + spacing, + span: Span::call_site(), + } + } + + /// Returns the value of this punctuation character as `char`. + pub fn as_char(&self) -> char { + self.op + } + + /// Returns the spacing of this punctuation character, indicating whether + /// it's immediately followed by another `Punct` in the token stream, so + /// they can potentially be combined into a multicharacter operator + /// (`Joint`), or it's followed by some other token or whitespace (`Alone`) + /// so the operator has certainly ended. + pub fn spacing(&self) -> Spacing { + self.spacing + } + + /// Returns the span for this punctuation character. + pub fn span(&self) -> Span { + self.span + } + + /// Configure the span for this punctuation character. + pub fn set_span(&mut self, span: Span) { + self.span = span; + } +} + +/// Prints the punctuation character as a string that should be losslessly +/// convertible back into the same character. +impl fmt::Display for Punct { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.op.fmt(f) + } +} + +impl fmt::Debug for Punct { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + let mut debug = fmt.debug_struct("Punct"); + debug.field("op", &self.op); + debug.field("spacing", &self.spacing); + imp::debug_span_field_if_nontrivial(&mut debug, self.span.inner); + debug.finish() + } +} + +/// A word of Rust code, which may be a keyword or legal variable name. +/// +/// An identifier consists of at least one Unicode code point, the first of +/// which has the XID_Start property and the rest of which have the XID_Continue +/// property. +/// +/// - The empty string is not an identifier. Use `Option`. +/// - A lifetime is not an identifier. Use `syn::Lifetime` instead. +/// +/// An identifier constructed with `Ident::new` is permitted to be a Rust +/// keyword, though parsing one through its [`Parse`] implementation rejects +/// Rust keywords. Use `input.call(Ident::parse_any)` when parsing to match the +/// behaviour of `Ident::new`. +/// +/// [`Parse`]: https://docs.rs/syn/1.0/syn/parse/trait.Parse.html +/// +/// # Examples +/// +/// A new ident can be created from a string using the `Ident::new` function. +/// A span must be provided explicitly which governs the name resolution +/// behavior of the resulting identifier. +/// +/// ``` +/// use proc_macro2::{Ident, Span}; +/// +/// fn main() { +/// let call_ident = Ident::new("calligraphy", Span::call_site()); +/// +/// println!("{}", call_ident); +/// } +/// ``` +/// +/// An ident can be interpolated into a token stream using the `quote!` macro. +/// +/// ``` +/// use proc_macro2::{Ident, Span}; +/// use quote::quote; +/// +/// fn main() { +/// let ident = Ident::new("demo", Span::call_site()); +/// +/// // Create a variable binding whose name is this ident. +/// let expanded = quote! { let #ident = 10; }; +/// +/// // Create a variable binding with a slightly different name. +/// let temp_ident = Ident::new(&format!("new_{}", ident), Span::call_site()); +/// let expanded = quote! { let #temp_ident = 10; }; +/// } +/// ``` +/// +/// A string representation of the ident is available through the `to_string()` +/// method. +/// +/// ``` +/// # use proc_macro2::{Ident, Span}; +/// # +/// # let ident = Ident::new("another_identifier", Span::call_site()); +/// # +/// // Examine the ident as a string. +/// let ident_string = ident.to_string(); +/// if ident_string.len() > 60 { +/// println!("Very long identifier: {}", ident_string) +/// } +/// ``` +#[derive(Clone)] +pub struct Ident { + inner: imp::Ident, + _marker: marker::PhantomData>, +} + +impl Ident { + fn _new(inner: imp::Ident) -> Ident { + Ident { + inner, + _marker: marker::PhantomData, + } + } + + /// Creates a new `Ident` with the given `string` as well as the specified + /// `span`. + /// + /// The `string` argument must be a valid identifier permitted by the + /// language, otherwise the function will panic. + /// + /// Note that `span`, currently in rustc, configures the hygiene information + /// for this identifier. + /// + /// As of this time `Span::call_site()` explicitly opts-in to "call-site" + /// hygiene meaning that identifiers created with this span will be resolved + /// as if they were written directly at the location of the macro call, and + /// other code at the macro call site will be able to refer to them as well. + /// + /// Later spans like `Span::def_site()` will allow to opt-in to + /// "definition-site" hygiene meaning that identifiers created with this + /// span will be resolved at the location of the macro definition and other + /// code at the macro call site will not be able to refer to them. + /// + /// Due to the current importance of hygiene this constructor, unlike other + /// tokens, requires a `Span` to be specified at construction. + /// + /// # Panics + /// + /// Panics if the input string is neither a keyword nor a legal variable + /// name. If you are not sure whether the string contains an identifier and + /// need to handle an error case, use + /// syn::parse_str::<Ident> + /// rather than `Ident::new`. + pub fn new(string: &str, span: Span) -> Ident { + Ident::_new(imp::Ident::new(string, span.inner)) + } + + /// Same as `Ident::new`, but creates a raw identifier (`r#ident`). + /// + /// This method is semver exempt and not exposed by default. + #[cfg(procmacro2_semver_exempt)] + pub fn new_raw(string: &str, span: Span) -> Ident { + Ident::_new_raw(string, span) + } + + fn _new_raw(string: &str, span: Span) -> Ident { + Ident::_new(imp::Ident::new_raw(string, span.inner)) + } + + /// Returns the span of this `Ident`. + pub fn span(&self) -> Span { + Span::_new(self.inner.span()) + } + + /// Configures the span of this `Ident`, possibly changing its hygiene + /// context. + pub fn set_span(&mut self, span: Span) { + self.inner.set_span(span.inner); + } +} + +impl PartialEq for Ident { + fn eq(&self, other: &Ident) -> bool { + self.inner == other.inner + } +} + +impl PartialEq for Ident +where + T: ?Sized + AsRef, +{ + fn eq(&self, other: &T) -> bool { + self.inner == other + } +} + +impl Eq for Ident {} + +impl PartialOrd for Ident { + fn partial_cmp(&self, other: &Ident) -> Option { + Some(self.cmp(other)) + } +} + +impl Ord for Ident { + fn cmp(&self, other: &Ident) -> Ordering { + self.to_string().cmp(&other.to_string()) + } +} + +impl Hash for Ident { + fn hash(&self, hasher: &mut H) { + self.to_string().hash(hasher) + } +} + +/// Prints the identifier as a string that should be losslessly convertible back +/// into the same identifier. +impl fmt::Display for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +impl fmt::Debug for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +/// A literal string (`"hello"`), byte string (`b"hello"`), character (`'a'`), +/// byte character (`b'a'`), an integer or floating point number with or without +/// a suffix (`1`, `1u8`, `2.3`, `2.3f32`). +/// +/// Boolean literals like `true` and `false` do not belong here, they are +/// `Ident`s. +#[derive(Clone)] +pub struct Literal { + inner: imp::Literal, + _marker: marker::PhantomData>, +} + +macro_rules! suffixed_int_literals { + ($($name:ident => $kind:ident,)*) => ($( + /// Creates a new suffixed integer literal with the specified value. + /// + /// This function will create an integer like `1u32` where the integer + /// value specified is the first part of the token and the integral is + /// also suffixed at the end. Literals created from negative numbers may + /// not survive rountrips through `TokenStream` or strings and may be + /// broken into two tokens (`-` and positive literal). + /// + /// Literals created through this method have the `Span::call_site()` + /// span by default, which can be configured with the `set_span` method + /// below. + pub fn $name(n: $kind) -> Literal { + Literal::_new(imp::Literal::$name(n)) + } + )*) +} + +macro_rules! unsuffixed_int_literals { + ($($name:ident => $kind:ident,)*) => ($( + /// Creates a new unsuffixed integer literal with the specified value. + /// + /// This function will create an integer like `1` where the integer + /// value specified is the first part of the token. No suffix is + /// specified on this token, meaning that invocations like + /// `Literal::i8_unsuffixed(1)` are equivalent to + /// `Literal::u32_unsuffixed(1)`. Literals created from negative numbers + /// may not survive rountrips through `TokenStream` or strings and may + /// be broken into two tokens (`-` and positive literal). + /// + /// Literals created through this method have the `Span::call_site()` + /// span by default, which can be configured with the `set_span` method + /// below. + pub fn $name(n: $kind) -> Literal { + Literal::_new(imp::Literal::$name(n)) + } + )*) +} + +impl Literal { + fn _new(inner: imp::Literal) -> Literal { + Literal { + inner, + _marker: marker::PhantomData, + } + } + + fn _new_stable(inner: fallback::Literal) -> Literal { + Literal { + inner: inner.into(), + _marker: marker::PhantomData, + } + } + + suffixed_int_literals! { + u8_suffixed => u8, + u16_suffixed => u16, + u32_suffixed => u32, + u64_suffixed => u64, + u128_suffixed => u128, + usize_suffixed => usize, + i8_suffixed => i8, + i16_suffixed => i16, + i32_suffixed => i32, + i64_suffixed => i64, + i128_suffixed => i128, + isize_suffixed => isize, + } + + unsuffixed_int_literals! { + u8_unsuffixed => u8, + u16_unsuffixed => u16, + u32_unsuffixed => u32, + u64_unsuffixed => u64, + u128_unsuffixed => u128, + usize_unsuffixed => usize, + i8_unsuffixed => i8, + i16_unsuffixed => i16, + i32_unsuffixed => i32, + i64_unsuffixed => i64, + i128_unsuffixed => i128, + isize_unsuffixed => isize, + } + + /// Creates a new unsuffixed floating-point literal. + /// + /// This constructor is similar to those like `Literal::i8_unsuffixed` where + /// the float's value is emitted directly into the token but no suffix is + /// used, so it may be inferred to be a `f64` later in the compiler. + /// Literals created from negative numbers may not survive rountrips through + /// `TokenStream` or strings and may be broken into two tokens (`-` and + /// positive literal). + /// + /// # Panics + /// + /// This function requires that the specified float is finite, for example + /// if it is infinity or NaN this function will panic. + pub fn f64_unsuffixed(f: f64) -> Literal { + assert!(f.is_finite()); + Literal::_new(imp::Literal::f64_unsuffixed(f)) + } + + /// Creates a new suffixed floating-point literal. + /// + /// This constructor will create a literal like `1.0f64` where the value + /// specified is the preceding part of the token and `f64` is the suffix of + /// the token. This token will always be inferred to be an `f64` in the + /// compiler. Literals created from negative numbers may not survive + /// rountrips through `TokenStream` or strings and may be broken into two + /// tokens (`-` and positive literal). + /// + /// # Panics + /// + /// This function requires that the specified float is finite, for example + /// if it is infinity or NaN this function will panic. + pub fn f64_suffixed(f: f64) -> Literal { + assert!(f.is_finite()); + Literal::_new(imp::Literal::f64_suffixed(f)) + } + + /// Creates a new unsuffixed floating-point literal. + /// + /// This constructor is similar to those like `Literal::i8_unsuffixed` where + /// the float's value is emitted directly into the token but no suffix is + /// used, so it may be inferred to be a `f64` later in the compiler. + /// Literals created from negative numbers may not survive rountrips through + /// `TokenStream` or strings and may be broken into two tokens (`-` and + /// positive literal). + /// + /// # Panics + /// + /// This function requires that the specified float is finite, for example + /// if it is infinity or NaN this function will panic. + pub fn f32_unsuffixed(f: f32) -> Literal { + assert!(f.is_finite()); + Literal::_new(imp::Literal::f32_unsuffixed(f)) + } + + /// Creates a new suffixed floating-point literal. + /// + /// This constructor will create a literal like `1.0f32` where the value + /// specified is the preceding part of the token and `f32` is the suffix of + /// the token. This token will always be inferred to be an `f32` in the + /// compiler. Literals created from negative numbers may not survive + /// rountrips through `TokenStream` or strings and may be broken into two + /// tokens (`-` and positive literal). + /// + /// # Panics + /// + /// This function requires that the specified float is finite, for example + /// if it is infinity or NaN this function will panic. + pub fn f32_suffixed(f: f32) -> Literal { + assert!(f.is_finite()); + Literal::_new(imp::Literal::f32_suffixed(f)) + } + + /// String literal. + pub fn string(string: &str) -> Literal { + Literal::_new(imp::Literal::string(string)) + } + + /// Character literal. + pub fn character(ch: char) -> Literal { + Literal::_new(imp::Literal::character(ch)) + } + + /// Byte string literal. + pub fn byte_string(s: &[u8]) -> Literal { + Literal::_new(imp::Literal::byte_string(s)) + } + + /// Returns the span encompassing this literal. + pub fn span(&self) -> Span { + Span::_new(self.inner.span()) + } + + /// Configures the span associated for this literal. + pub fn set_span(&mut self, span: Span) { + self.inner.set_span(span.inner); + } + + /// Returns a `Span` that is a subset of `self.span()` containing only + /// the source bytes in range `range`. Returns `None` if the would-be + /// trimmed span is outside the bounds of `self`. + /// + /// Warning: the underlying [`proc_macro::Literal::subspan`] method is + /// nightly-only. When called from within a procedural macro not using a + /// nightly compiler, this method will always return `None`. + /// + /// [`proc_macro::Literal::subspan`]: https://doc.rust-lang.org/proc_macro/struct.Literal.html#method.subspan + pub fn subspan>(&self, range: R) -> Option { + self.inner.subspan(range).map(Span::_new) + } +} + +impl fmt::Debug for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +impl fmt::Display for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } +} + +/// Public implementation details for the `TokenStream` type, such as iterators. +pub mod token_stream { + use crate::{imp, TokenTree}; + use std::fmt; + use std::marker; + use std::rc::Rc; + + pub use crate::TokenStream; + + /// An iterator over `TokenStream`'s `TokenTree`s. + /// + /// The iteration is "shallow", e.g. the iterator doesn't recurse into + /// delimited groups, and returns whole groups as token trees. + #[derive(Clone)] + pub struct IntoIter { + inner: imp::TokenTreeIter, + _marker: marker::PhantomData>, + } + + impl Iterator for IntoIter { + type Item = TokenTree; + + fn next(&mut self) -> Option { + self.inner.next() + } + } + + impl fmt::Debug for IntoIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + self.inner.fmt(f) + } + } + + impl IntoIterator for TokenStream { + type Item = TokenTree; + type IntoIter = IntoIter; + + fn into_iter(self) -> IntoIter { + IntoIter { + inner: self.inner.into_iter(), + _marker: marker::PhantomData, + } + } + } +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/src/parse.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/src/parse.rs new file mode 100644 index 0000000..954aff6 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/src/parse.rs @@ -0,0 +1,791 @@ +use crate::fallback::{ + is_ident_continue, is_ident_start, Group, LexError, Literal, Span, TokenStream, +}; +use crate::{Delimiter, Punct, Spacing, TokenTree}; +use std::str::{Bytes, CharIndices, Chars}; +use unicode_xid::UnicodeXID; + +#[derive(Copy, Clone, Eq, PartialEq)] +pub(crate) struct Cursor<'a> { + pub rest: &'a str, + #[cfg(span_locations)] + pub off: u32, +} + +impl<'a> Cursor<'a> { + fn advance(&self, bytes: usize) -> Cursor<'a> { + let (_front, rest) = self.rest.split_at(bytes); + Cursor { + rest, + #[cfg(span_locations)] + off: self.off + _front.chars().count() as u32, + } + } + + fn starts_with(&self, s: &str) -> bool { + self.rest.starts_with(s) + } + + pub(crate) fn is_empty(&self) -> bool { + self.rest.is_empty() + } + + fn len(&self) -> usize { + self.rest.len() + } + + fn as_bytes(&self) -> &'a [u8] { + self.rest.as_bytes() + } + + fn bytes(&self) -> Bytes<'a> { + self.rest.bytes() + } + + fn chars(&self) -> Chars<'a> { + self.rest.chars() + } + + fn char_indices(&self) -> CharIndices<'a> { + self.rest.char_indices() + } + + fn parse(&self, tag: &str) -> Result, LexError> { + if self.starts_with(tag) { + Ok(self.advance(tag.len())) + } else { + Err(LexError) + } + } +} + +type PResult<'a, O> = Result<(Cursor<'a>, O), LexError>; + +fn skip_whitespace(input: Cursor) -> Cursor { + let mut s = input; + + while !s.is_empty() { + let byte = s.as_bytes()[0]; + if byte == b'/' { + if s.starts_with("//") + && (!s.starts_with("///") || s.starts_with("////")) + && !s.starts_with("//!") + { + let (cursor, _) = take_until_newline_or_eof(s); + s = cursor; + continue; + } else if s.starts_with("/**/") { + s = s.advance(4); + continue; + } else if s.starts_with("/*") + && (!s.starts_with("/**") || s.starts_with("/***")) + && !s.starts_with("/*!") + { + match block_comment(s) { + Ok((rest, _)) => { + s = rest; + continue; + } + Err(LexError) => return s, + } + } + } + match byte { + b' ' | 0x09..=0x0d => { + s = s.advance(1); + continue; + } + b if b <= 0x7f => {} + _ => { + let ch = s.chars().next().unwrap(); + if is_whitespace(ch) { + s = s.advance(ch.len_utf8()); + continue; + } + } + } + return s; + } + s +} + +fn block_comment(input: Cursor) -> PResult<&str> { + if !input.starts_with("/*") { + return Err(LexError); + } + + let mut depth = 0; + let bytes = input.as_bytes(); + let mut i = 0; + let upper = bytes.len() - 1; + + while i < upper { + if bytes[i] == b'/' && bytes[i + 1] == b'*' { + depth += 1; + i += 1; // eat '*' + } else if bytes[i] == b'*' && bytes[i + 1] == b'/' { + depth -= 1; + if depth == 0 { + return Ok((input.advance(i + 2), &input.rest[..i + 2])); + } + i += 1; // eat '/' + } + i += 1; + } + + Err(LexError) +} + +fn is_whitespace(ch: char) -> bool { + // Rust treats left-to-right mark and right-to-left mark as whitespace + ch.is_whitespace() || ch == '\u{200e}' || ch == '\u{200f}' +} + +fn word_break(input: Cursor) -> Result { + match input.chars().next() { + Some(ch) if UnicodeXID::is_xid_continue(ch) => Err(LexError), + Some(_) | None => Ok(input), + } +} + +pub(crate) fn token_stream(mut input: Cursor) -> PResult { + let mut trees = Vec::new(); + let mut stack = Vec::new(); + + loop { + input = skip_whitespace(input); + + if let Ok((rest, tt)) = doc_comment(input) { + trees.extend(tt); + input = rest; + continue; + } + + #[cfg(span_locations)] + let lo = input.off; + + let first = match input.bytes().next() { + Some(first) => first, + None => break, + }; + + if let Some(open_delimiter) = match first { + b'(' => Some(Delimiter::Parenthesis), + b'[' => Some(Delimiter::Bracket), + b'{' => Some(Delimiter::Brace), + _ => None, + } { + input = input.advance(1); + let frame = (open_delimiter, trees); + #[cfg(span_locations)] + let frame = (lo, frame); + stack.push(frame); + trees = Vec::new(); + } else if let Some(close_delimiter) = match first { + b')' => Some(Delimiter::Parenthesis), + b']' => Some(Delimiter::Bracket), + b'}' => Some(Delimiter::Brace), + _ => None, + } { + input = input.advance(1); + let frame = stack.pop().ok_or(LexError)?; + #[cfg(span_locations)] + let (lo, frame) = frame; + let (open_delimiter, outer) = frame; + if open_delimiter != close_delimiter { + return Err(LexError); + } + let mut g = Group::new(open_delimiter, TokenStream { inner: trees }); + g.set_span(Span { + #[cfg(span_locations)] + lo, + #[cfg(span_locations)] + hi: input.off, + }); + trees = outer; + trees.push(TokenTree::Group(crate::Group::_new_stable(g))); + } else { + let (rest, mut tt) = leaf_token(input)?; + tt.set_span(crate::Span::_new_stable(Span { + #[cfg(span_locations)] + lo, + #[cfg(span_locations)] + hi: rest.off, + })); + trees.push(tt); + input = rest; + } + } + + if stack.is_empty() { + Ok((input, TokenStream { inner: trees })) + } else { + Err(LexError) + } +} + +fn leaf_token(input: Cursor) -> PResult { + if let Ok((input, l)) = literal(input) { + // must be parsed before ident + Ok((input, TokenTree::Literal(crate::Literal::_new_stable(l)))) + } else if let Ok((input, p)) = op(input) { + Ok((input, TokenTree::Punct(p))) + } else if let Ok((input, i)) = ident(input) { + Ok((input, TokenTree::Ident(i))) + } else { + Err(LexError) + } +} + +fn ident(input: Cursor) -> PResult { + let raw = input.starts_with("r#"); + let rest = input.advance((raw as usize) << 1); + + let (rest, sym) = ident_not_raw(rest)?; + + if !raw { + let ident = crate::Ident::new(sym, crate::Span::call_site()); + return Ok((rest, ident)); + } + + if sym == "_" { + return Err(LexError); + } + + let ident = crate::Ident::_new_raw(sym, crate::Span::call_site()); + Ok((rest, ident)) +} + +fn ident_not_raw(input: Cursor) -> PResult<&str> { + let mut chars = input.char_indices(); + + match chars.next() { + Some((_, ch)) if is_ident_start(ch) => {} + _ => return Err(LexError), + } + + let mut end = input.len(); + for (i, ch) in chars { + if !is_ident_continue(ch) { + end = i; + break; + } + } + + Ok((input.advance(end), &input.rest[..end])) +} + +fn literal(input: Cursor) -> PResult { + match literal_nocapture(input) { + Ok(a) => { + let end = input.len() - a.len(); + Ok((a, Literal::_new(input.rest[..end].to_string()))) + } + Err(LexError) => Err(LexError), + } +} + +fn literal_nocapture(input: Cursor) -> Result { + if let Ok(ok) = string(input) { + Ok(ok) + } else if let Ok(ok) = byte_string(input) { + Ok(ok) + } else if let Ok(ok) = byte(input) { + Ok(ok) + } else if let Ok(ok) = character(input) { + Ok(ok) + } else if let Ok(ok) = float(input) { + Ok(ok) + } else if let Ok(ok) = int(input) { + Ok(ok) + } else { + Err(LexError) + } +} + +fn literal_suffix(input: Cursor) -> Cursor { + match ident_not_raw(input) { + Ok((input, _)) => input, + Err(LexError) => input, + } +} + +fn string(input: Cursor) -> Result { + if let Ok(input) = input.parse("\"") { + cooked_string(input) + } else if let Ok(input) = input.parse("r") { + raw_string(input) + } else { + Err(LexError) + } +} + +fn cooked_string(input: Cursor) -> Result { + let mut chars = input.char_indices().peekable(); + + while let Some((i, ch)) = chars.next() { + match ch { + '"' => { + let input = input.advance(i + 1); + return Ok(literal_suffix(input)); + } + '\r' => { + if let Some((_, '\n')) = chars.next() { + // ... + } else { + break; + } + } + '\\' => match chars.next() { + Some((_, 'x')) => { + if !backslash_x_char(&mut chars) { + break; + } + } + Some((_, 'n')) | Some((_, 'r')) | Some((_, 't')) | Some((_, '\\')) + | Some((_, '\'')) | Some((_, '"')) | Some((_, '0')) => {} + Some((_, 'u')) => { + if !backslash_u(&mut chars) { + break; + } + } + Some((_, '\n')) | Some((_, '\r')) => { + while let Some(&(_, ch)) = chars.peek() { + if ch.is_whitespace() { + chars.next(); + } else { + break; + } + } + } + _ => break, + }, + _ch => {} + } + } + Err(LexError) +} + +fn byte_string(input: Cursor) -> Result { + if let Ok(input) = input.parse("b\"") { + cooked_byte_string(input) + } else if let Ok(input) = input.parse("br") { + raw_string(input) + } else { + Err(LexError) + } +} + +fn cooked_byte_string(mut input: Cursor) -> Result { + let mut bytes = input.bytes().enumerate(); + 'outer: while let Some((offset, b)) = bytes.next() { + match b { + b'"' => { + let input = input.advance(offset + 1); + return Ok(literal_suffix(input)); + } + b'\r' => { + if let Some((_, b'\n')) = bytes.next() { + // ... + } else { + break; + } + } + b'\\' => match bytes.next() { + Some((_, b'x')) => { + if !backslash_x_byte(&mut bytes) { + break; + } + } + Some((_, b'n')) | Some((_, b'r')) | Some((_, b't')) | Some((_, b'\\')) + | Some((_, b'0')) | Some((_, b'\'')) | Some((_, b'"')) => {} + Some((newline, b'\n')) | Some((newline, b'\r')) => { + let rest = input.advance(newline + 1); + for (offset, ch) in rest.char_indices() { + if !ch.is_whitespace() { + input = rest.advance(offset); + bytes = input.bytes().enumerate(); + continue 'outer; + } + } + break; + } + _ => break, + }, + b if b < 0x80 => {} + _ => break, + } + } + Err(LexError) +} + +fn raw_string(input: Cursor) -> Result { + let mut chars = input.char_indices(); + let mut n = 0; + while let Some((i, ch)) = chars.next() { + match ch { + '"' => { + n = i; + break; + } + '#' => {} + _ => return Err(LexError), + } + } + for (i, ch) in chars { + match ch { + '"' if input.rest[i + 1..].starts_with(&input.rest[..n]) => { + let rest = input.advance(i + 1 + n); + return Ok(literal_suffix(rest)); + } + '\r' => {} + _ => {} + } + } + Err(LexError) +} + +fn byte(input: Cursor) -> Result { + let input = input.parse("b'")?; + let mut bytes = input.bytes().enumerate(); + let ok = match bytes.next().map(|(_, b)| b) { + Some(b'\\') => match bytes.next().map(|(_, b)| b) { + Some(b'x') => backslash_x_byte(&mut bytes), + Some(b'n') | Some(b'r') | Some(b't') | Some(b'\\') | Some(b'0') | Some(b'\'') + | Some(b'"') => true, + _ => false, + }, + b => b.is_some(), + }; + if !ok { + return Err(LexError); + } + let (offset, _) = bytes.next().ok_or(LexError)?; + if !input.chars().as_str().is_char_boundary(offset) { + return Err(LexError); + } + let input = input.advance(offset).parse("'")?; + Ok(literal_suffix(input)) +} + +fn character(input: Cursor) -> Result { + let input = input.parse("'")?; + let mut chars = input.char_indices(); + let ok = match chars.next().map(|(_, ch)| ch) { + Some('\\') => match chars.next().map(|(_, ch)| ch) { + Some('x') => backslash_x_char(&mut chars), + Some('u') => backslash_u(&mut chars), + Some('n') | Some('r') | Some('t') | Some('\\') | Some('0') | Some('\'') | Some('"') => { + true + } + _ => false, + }, + ch => ch.is_some(), + }; + if !ok { + return Err(LexError); + } + let (idx, _) = chars.next().ok_or(LexError)?; + let input = input.advance(idx).parse("'")?; + Ok(literal_suffix(input)) +} + +macro_rules! next_ch { + ($chars:ident @ $pat:pat $(| $rest:pat)*) => { + match $chars.next() { + Some((_, ch)) => match ch { + $pat $(| $rest)* => ch, + _ => return false, + }, + None => return false, + } + }; +} + +fn backslash_x_char(chars: &mut I) -> bool +where + I: Iterator, +{ + next_ch!(chars @ '0'..='7'); + next_ch!(chars @ '0'..='9' | 'a'..='f' | 'A'..='F'); + true +} + +fn backslash_x_byte(chars: &mut I) -> bool +where + I: Iterator, +{ + next_ch!(chars @ b'0'..=b'9' | b'a'..=b'f' | b'A'..=b'F'); + next_ch!(chars @ b'0'..=b'9' | b'a'..=b'f' | b'A'..=b'F'); + true +} + +fn backslash_u(chars: &mut I) -> bool +where + I: Iterator, +{ + next_ch!(chars @ '{'); + next_ch!(chars @ '0'..='9' | 'a'..='f' | 'A'..='F'); + loop { + let c = next_ch!(chars @ '0'..='9' | 'a'..='f' | 'A'..='F' | '_' | '}'); + if c == '}' { + return true; + } + } +} + +fn float(input: Cursor) -> Result { + let mut rest = float_digits(input)?; + if let Some(ch) = rest.chars().next() { + if is_ident_start(ch) { + rest = ident_not_raw(rest)?.0; + } + } + word_break(rest) +} + +fn float_digits(input: Cursor) -> Result { + let mut chars = input.chars().peekable(); + match chars.next() { + Some(ch) if ch >= '0' && ch <= '9' => {} + _ => return Err(LexError), + } + + let mut len = 1; + let mut has_dot = false; + let mut has_exp = false; + while let Some(&ch) = chars.peek() { + match ch { + '0'..='9' | '_' => { + chars.next(); + len += 1; + } + '.' => { + if has_dot { + break; + } + chars.next(); + if chars + .peek() + .map(|&ch| ch == '.' || is_ident_start(ch)) + .unwrap_or(false) + { + return Err(LexError); + } + len += 1; + has_dot = true; + } + 'e' | 'E' => { + chars.next(); + len += 1; + has_exp = true; + break; + } + _ => break, + } + } + + let rest = input.advance(len); + if !(has_dot || has_exp || rest.starts_with("f32") || rest.starts_with("f64")) { + return Err(LexError); + } + + if has_exp { + let mut has_exp_value = false; + while let Some(&ch) = chars.peek() { + match ch { + '+' | '-' => { + if has_exp_value { + break; + } + chars.next(); + len += 1; + } + '0'..='9' => { + chars.next(); + len += 1; + has_exp_value = true; + } + '_' => { + chars.next(); + len += 1; + } + _ => break, + } + } + if !has_exp_value { + return Err(LexError); + } + } + + Ok(input.advance(len)) +} + +fn int(input: Cursor) -> Result { + let mut rest = digits(input)?; + if let Some(ch) = rest.chars().next() { + if is_ident_start(ch) { + rest = ident_not_raw(rest)?.0; + } + } + word_break(rest) +} + +fn digits(mut input: Cursor) -> Result { + let base = if input.starts_with("0x") { + input = input.advance(2); + 16 + } else if input.starts_with("0o") { + input = input.advance(2); + 8 + } else if input.starts_with("0b") { + input = input.advance(2); + 2 + } else { + 10 + }; + + let mut len = 0; + let mut empty = true; + for b in input.bytes() { + let digit = match b { + b'0'..=b'9' => (b - b'0') as u64, + b'a'..=b'f' => 10 + (b - b'a') as u64, + b'A'..=b'F' => 10 + (b - b'A') as u64, + b'_' => { + if empty && base == 10 { + return Err(LexError); + } + len += 1; + continue; + } + _ => break, + }; + if digit >= base { + return Err(LexError); + } + len += 1; + empty = false; + } + if empty { + Err(LexError) + } else { + Ok(input.advance(len)) + } +} + +fn op(input: Cursor) -> PResult { + match op_char(input) { + Ok((rest, '\'')) => { + ident(rest)?; + Ok((rest, Punct::new('\'', Spacing::Joint))) + } + Ok((rest, ch)) => { + let kind = match op_char(rest) { + Ok(_) => Spacing::Joint, + Err(LexError) => Spacing::Alone, + }; + Ok((rest, Punct::new(ch, kind))) + } + Err(LexError) => Err(LexError), + } +} + +fn op_char(input: Cursor) -> PResult { + if input.starts_with("//") || input.starts_with("/*") { + // Do not accept `/` of a comment as an op. + return Err(LexError); + } + + let mut chars = input.chars(); + let first = match chars.next() { + Some(ch) => ch, + None => { + return Err(LexError); + } + }; + let recognized = "~!@#$%^&*-=+|;:,<.>/?'"; + if recognized.contains(first) { + Ok((input.advance(first.len_utf8()), first)) + } else { + Err(LexError) + } +} + +fn doc_comment(input: Cursor) -> PResult> { + #[cfg(span_locations)] + let lo = input.off; + let (rest, (comment, inner)) = doc_comment_contents(input)?; + let span = crate::Span::_new_stable(Span { + #[cfg(span_locations)] + lo, + #[cfg(span_locations)] + hi: rest.off, + }); + + let mut scan_for_bare_cr = comment; + while let Some(cr) = scan_for_bare_cr.find('\r') { + let rest = &scan_for_bare_cr[cr + 1..]; + if !rest.starts_with('\n') { + return Err(LexError); + } + scan_for_bare_cr = rest; + } + + let mut trees = Vec::new(); + trees.push(TokenTree::Punct(Punct::new('#', Spacing::Alone))); + if inner { + trees.push(Punct::new('!', Spacing::Alone).into()); + } + let mut stream = vec![ + TokenTree::Ident(crate::Ident::new("doc", span)), + TokenTree::Punct(Punct::new('=', Spacing::Alone)), + TokenTree::Literal(crate::Literal::string(comment)), + ]; + for tt in stream.iter_mut() { + tt.set_span(span); + } + let group = Group::new(Delimiter::Bracket, stream.into_iter().collect()); + trees.push(crate::Group::_new_stable(group).into()); + for tt in trees.iter_mut() { + tt.set_span(span); + } + Ok((rest, trees)) +} + +fn doc_comment_contents(input: Cursor) -> PResult<(&str, bool)> { + if input.starts_with("//!") { + let input = input.advance(3); + let (input, s) = take_until_newline_or_eof(input); + Ok((input, (s, true))) + } else if input.starts_with("/*!") { + let (input, s) = block_comment(input)?; + Ok((input, (&s[3..s.len() - 2], true))) + } else if input.starts_with("///") { + let input = input.advance(3); + if input.starts_with("/") { + return Err(LexError); + } + let (input, s) = take_until_newline_or_eof(input); + Ok((input, (s, false))) + } else if input.starts_with("/**") && !input.rest[3..].starts_with("*") { + let (input, s) = block_comment(input)?; + Ok((input, (&s[3..s.len() - 2], false))) + } else { + Err(LexError) + } +} + +fn take_until_newline_or_eof(input: Cursor) -> (Cursor, &str) { + let mut chars = input.char_indices(); + + while let Some((i, ch)) = chars.next() { + if ch == '\n' { + return (input.advance(i), &input.rest[..i]); + } else if ch == '\r' && input.rest[i + 1..].starts_with('\n') { + return (input.advance(i + 1), &input.rest[..i]); + } + } + + (input.advance(input.len()), input.rest) +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/src/strnom.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/src/strnom.rs new file mode 100644 index 0000000..e69de29 diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/src/wrapper.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/src/wrapper.rs new file mode 100644 index 0000000..b6dff27 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/src/wrapper.rs @@ -0,0 +1,898 @@ +use crate::detection::inside_proc_macro; +use crate::{fallback, Delimiter, Punct, Spacing, TokenTree}; +use std::fmt; +use std::iter; +use std::ops::RangeBounds; +use std::panic; +#[cfg(super_unstable)] +use std::path::PathBuf; +use std::str::FromStr; + +#[derive(Clone)] +pub(crate) enum TokenStream { + Compiler(DeferredTokenStream), + Fallback(fallback::TokenStream), +} + +// Work around https://github.com/rust-lang/rust/issues/65080. +// In `impl Extend for TokenStream` which is used heavily by quote, +// we hold on to the appended tokens and do proc_macro::TokenStream::extend as +// late as possible to batch together consecutive uses of the Extend impl. +#[derive(Clone)] +pub(crate) struct DeferredTokenStream { + stream: proc_macro::TokenStream, + extra: Vec, +} + +pub(crate) enum LexError { + Compiler(proc_macro::LexError), + Fallback(fallback::LexError), +} + +fn mismatch() -> ! { + panic!("stable/nightly mismatch") +} + +impl DeferredTokenStream { + fn new(stream: proc_macro::TokenStream) -> Self { + DeferredTokenStream { + stream, + extra: Vec::new(), + } + } + + fn is_empty(&self) -> bool { + self.stream.is_empty() && self.extra.is_empty() + } + + fn evaluate_now(&mut self) { + self.stream.extend(self.extra.drain(..)); + } + + fn into_token_stream(mut self) -> proc_macro::TokenStream { + self.evaluate_now(); + self.stream + } +} + +impl TokenStream { + pub fn new() -> TokenStream { + if inside_proc_macro() { + TokenStream::Compiler(DeferredTokenStream::new(proc_macro::TokenStream::new())) + } else { + TokenStream::Fallback(fallback::TokenStream::new()) + } + } + + pub fn is_empty(&self) -> bool { + match self { + TokenStream::Compiler(tts) => tts.is_empty(), + TokenStream::Fallback(tts) => tts.is_empty(), + } + } + + fn unwrap_nightly(self) -> proc_macro::TokenStream { + match self { + TokenStream::Compiler(s) => s.into_token_stream(), + TokenStream::Fallback(_) => mismatch(), + } + } + + fn unwrap_stable(self) -> fallback::TokenStream { + match self { + TokenStream::Compiler(_) => mismatch(), + TokenStream::Fallback(s) => s, + } + } +} + +impl FromStr for TokenStream { + type Err = LexError; + + fn from_str(src: &str) -> Result { + if inside_proc_macro() { + Ok(TokenStream::Compiler(DeferredTokenStream::new( + proc_macro_parse(src)?, + ))) + } else { + Ok(TokenStream::Fallback(src.parse()?)) + } + } +} + +// Work around https://github.com/rust-lang/rust/issues/58736. +fn proc_macro_parse(src: &str) -> Result { + panic::catch_unwind(|| src.parse().map_err(LexError::Compiler)) + .unwrap_or(Err(LexError::Fallback(fallback::LexError))) +} + +impl fmt::Display for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + TokenStream::Compiler(tts) => tts.clone().into_token_stream().fmt(f), + TokenStream::Fallback(tts) => tts.fmt(f), + } + } +} + +impl From for TokenStream { + fn from(inner: proc_macro::TokenStream) -> TokenStream { + TokenStream::Compiler(DeferredTokenStream::new(inner)) + } +} + +impl From for proc_macro::TokenStream { + fn from(inner: TokenStream) -> proc_macro::TokenStream { + match inner { + TokenStream::Compiler(inner) => inner.into_token_stream(), + TokenStream::Fallback(inner) => inner.to_string().parse().unwrap(), + } + } +} + +impl From for TokenStream { + fn from(inner: fallback::TokenStream) -> TokenStream { + TokenStream::Fallback(inner) + } +} + +// Assumes inside_proc_macro(). +fn into_compiler_token(token: TokenTree) -> proc_macro::TokenTree { + match token { + TokenTree::Group(tt) => tt.inner.unwrap_nightly().into(), + TokenTree::Punct(tt) => { + let spacing = match tt.spacing() { + Spacing::Joint => proc_macro::Spacing::Joint, + Spacing::Alone => proc_macro::Spacing::Alone, + }; + let mut op = proc_macro::Punct::new(tt.as_char(), spacing); + op.set_span(tt.span().inner.unwrap_nightly()); + op.into() + } + TokenTree::Ident(tt) => tt.inner.unwrap_nightly().into(), + TokenTree::Literal(tt) => tt.inner.unwrap_nightly().into(), + } +} + +impl From for TokenStream { + fn from(token: TokenTree) -> TokenStream { + if inside_proc_macro() { + TokenStream::Compiler(DeferredTokenStream::new(into_compiler_token(token).into())) + } else { + TokenStream::Fallback(token.into()) + } + } +} + +impl iter::FromIterator for TokenStream { + fn from_iter>(trees: I) -> Self { + if inside_proc_macro() { + TokenStream::Compiler(DeferredTokenStream::new( + trees.into_iter().map(into_compiler_token).collect(), + )) + } else { + TokenStream::Fallback(trees.into_iter().collect()) + } + } +} + +impl iter::FromIterator for TokenStream { + fn from_iter>(streams: I) -> Self { + let mut streams = streams.into_iter(); + match streams.next() { + Some(TokenStream::Compiler(mut first)) => { + first.evaluate_now(); + first.stream.extend(streams.map(|s| match s { + TokenStream::Compiler(s) => s.into_token_stream(), + TokenStream::Fallback(_) => mismatch(), + })); + TokenStream::Compiler(first) + } + Some(TokenStream::Fallback(mut first)) => { + first.extend(streams.map(|s| match s { + TokenStream::Fallback(s) => s, + TokenStream::Compiler(_) => mismatch(), + })); + TokenStream::Fallback(first) + } + None => TokenStream::new(), + } + } +} + +impl Extend for TokenStream { + fn extend>(&mut self, streams: I) { + match self { + TokenStream::Compiler(tts) => { + // Here is the reason for DeferredTokenStream. + tts.extra + .extend(streams.into_iter().map(into_compiler_token)); + } + TokenStream::Fallback(tts) => tts.extend(streams), + } + } +} + +impl Extend for TokenStream { + fn extend>(&mut self, streams: I) { + match self { + TokenStream::Compiler(tts) => { + tts.evaluate_now(); + tts.stream + .extend(streams.into_iter().map(|stream| stream.unwrap_nightly())); + } + TokenStream::Fallback(tts) => { + tts.extend(streams.into_iter().map(|stream| stream.unwrap_stable())); + } + } + } +} + +impl fmt::Debug for TokenStream { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + TokenStream::Compiler(tts) => tts.clone().into_token_stream().fmt(f), + TokenStream::Fallback(tts) => tts.fmt(f), + } + } +} + +impl From for LexError { + fn from(e: proc_macro::LexError) -> LexError { + LexError::Compiler(e) + } +} + +impl From for LexError { + fn from(e: fallback::LexError) -> LexError { + LexError::Fallback(e) + } +} + +impl fmt::Debug for LexError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + LexError::Compiler(e) => e.fmt(f), + LexError::Fallback(e) => e.fmt(f), + } + } +} + +#[derive(Clone)] +pub(crate) enum TokenTreeIter { + Compiler(proc_macro::token_stream::IntoIter), + Fallback(fallback::TokenTreeIter), +} + +impl IntoIterator for TokenStream { + type Item = TokenTree; + type IntoIter = TokenTreeIter; + + fn into_iter(self) -> TokenTreeIter { + match self { + TokenStream::Compiler(tts) => { + TokenTreeIter::Compiler(tts.into_token_stream().into_iter()) + } + TokenStream::Fallback(tts) => TokenTreeIter::Fallback(tts.into_iter()), + } + } +} + +impl Iterator for TokenTreeIter { + type Item = TokenTree; + + fn next(&mut self) -> Option { + let token = match self { + TokenTreeIter::Compiler(iter) => iter.next()?, + TokenTreeIter::Fallback(iter) => return iter.next(), + }; + Some(match token { + proc_macro::TokenTree::Group(tt) => crate::Group::_new(Group::Compiler(tt)).into(), + proc_macro::TokenTree::Punct(tt) => { + let spacing = match tt.spacing() { + proc_macro::Spacing::Joint => Spacing::Joint, + proc_macro::Spacing::Alone => Spacing::Alone, + }; + let mut o = Punct::new(tt.as_char(), spacing); + o.set_span(crate::Span::_new(Span::Compiler(tt.span()))); + o.into() + } + proc_macro::TokenTree::Ident(s) => crate::Ident::_new(Ident::Compiler(s)).into(), + proc_macro::TokenTree::Literal(l) => crate::Literal::_new(Literal::Compiler(l)).into(), + }) + } + + fn size_hint(&self) -> (usize, Option) { + match self { + TokenTreeIter::Compiler(tts) => tts.size_hint(), + TokenTreeIter::Fallback(tts) => tts.size_hint(), + } + } +} + +impl fmt::Debug for TokenTreeIter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_struct("TokenTreeIter").finish() + } +} + +#[derive(Clone, PartialEq, Eq)] +#[cfg(super_unstable)] +pub(crate) enum SourceFile { + Compiler(proc_macro::SourceFile), + Fallback(fallback::SourceFile), +} + +#[cfg(super_unstable)] +impl SourceFile { + fn nightly(sf: proc_macro::SourceFile) -> Self { + SourceFile::Compiler(sf) + } + + /// Get the path to this source file as a string. + pub fn path(&self) -> PathBuf { + match self { + SourceFile::Compiler(a) => a.path(), + SourceFile::Fallback(a) => a.path(), + } + } + + pub fn is_real(&self) -> bool { + match self { + SourceFile::Compiler(a) => a.is_real(), + SourceFile::Fallback(a) => a.is_real(), + } + } +} + +#[cfg(super_unstable)] +impl fmt::Debug for SourceFile { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + SourceFile::Compiler(a) => a.fmt(f), + SourceFile::Fallback(a) => a.fmt(f), + } + } +} + +#[cfg(any(super_unstable, feature = "span-locations"))] +pub(crate) struct LineColumn { + pub line: usize, + pub column: usize, +} + +#[derive(Copy, Clone)] +pub(crate) enum Span { + Compiler(proc_macro::Span), + Fallback(fallback::Span), +} + +impl Span { + pub fn call_site() -> Span { + if inside_proc_macro() { + Span::Compiler(proc_macro::Span::call_site()) + } else { + Span::Fallback(fallback::Span::call_site()) + } + } + + #[cfg(procmacro2_semver_exempt)] + #[cfg(hygiene)] + pub fn mixed_site() -> Span { + if inside_proc_macro() { + Span::Compiler(proc_macro::Span::mixed_site()) + } else { + Span::Fallback(fallback::Span::mixed_site()) + } + } + + #[cfg(super_unstable)] + pub fn def_site() -> Span { + if inside_proc_macro() { + Span::Compiler(proc_macro::Span::def_site()) + } else { + Span::Fallback(fallback::Span::def_site()) + } + } + + #[cfg(procmacro2_semver_exempt)] + pub fn resolved_at(&self, other: Span) -> Span { + match (self, other) { + #[cfg(hygiene)] + (Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.resolved_at(b)), + + // Name resolution affects semantics, but location is only cosmetic + #[cfg(not(hygiene))] + (Span::Compiler(_), Span::Compiler(_)) => other, + + (Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.resolved_at(b)), + _ => mismatch(), + } + } + + #[cfg(procmacro2_semver_exempt)] + pub fn located_at(&self, other: Span) -> Span { + match (self, other) { + #[cfg(hygiene)] + (Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.located_at(b)), + + // Name resolution affects semantics, but location is only cosmetic + #[cfg(not(hygiene))] + (Span::Compiler(_), Span::Compiler(_)) => *self, + + (Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.located_at(b)), + _ => mismatch(), + } + } + + pub fn unwrap(self) -> proc_macro::Span { + match self { + Span::Compiler(s) => s, + Span::Fallback(_) => panic!("proc_macro::Span is only available in procedural macros"), + } + } + + #[cfg(super_unstable)] + pub fn source_file(&self) -> SourceFile { + match self { + Span::Compiler(s) => SourceFile::nightly(s.source_file()), + Span::Fallback(s) => SourceFile::Fallback(s.source_file()), + } + } + + #[cfg(any(super_unstable, feature = "span-locations"))] + pub fn start(&self) -> LineColumn { + match self { + #[cfg(proc_macro_span)] + Span::Compiler(s) => { + let proc_macro::LineColumn { line, column } = s.start(); + LineColumn { line, column } + } + #[cfg(not(proc_macro_span))] + Span::Compiler(_) => LineColumn { line: 0, column: 0 }, + Span::Fallback(s) => { + let fallback::LineColumn { line, column } = s.start(); + LineColumn { line, column } + } + } + } + + #[cfg(any(super_unstable, feature = "span-locations"))] + pub fn end(&self) -> LineColumn { + match self { + #[cfg(proc_macro_span)] + Span::Compiler(s) => { + let proc_macro::LineColumn { line, column } = s.end(); + LineColumn { line, column } + } + #[cfg(not(proc_macro_span))] + Span::Compiler(_) => LineColumn { line: 0, column: 0 }, + Span::Fallback(s) => { + let fallback::LineColumn { line, column } = s.end(); + LineColumn { line, column } + } + } + } + + pub fn join(&self, other: Span) -> Option { + let ret = match (self, other) { + #[cfg(proc_macro_span)] + (Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.join(b)?), + (Span::Fallback(a), Span::Fallback(b)) => Span::Fallback(a.join(b)?), + _ => return None, + }; + Some(ret) + } + + #[cfg(super_unstable)] + pub fn eq(&self, other: &Span) -> bool { + match (self, other) { + (Span::Compiler(a), Span::Compiler(b)) => a.eq(b), + (Span::Fallback(a), Span::Fallback(b)) => a.eq(b), + _ => false, + } + } + + fn unwrap_nightly(self) -> proc_macro::Span { + match self { + Span::Compiler(s) => s, + Span::Fallback(_) => mismatch(), + } + } +} + +impl From for crate::Span { + fn from(proc_span: proc_macro::Span) -> crate::Span { + crate::Span::_new(Span::Compiler(proc_span)) + } +} + +impl From for Span { + fn from(inner: fallback::Span) -> Span { + Span::Fallback(inner) + } +} + +impl fmt::Debug for Span { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Span::Compiler(s) => s.fmt(f), + Span::Fallback(s) => s.fmt(f), + } + } +} + +pub(crate) fn debug_span_field_if_nontrivial(debug: &mut fmt::DebugStruct, span: Span) { + match span { + Span::Compiler(s) => { + debug.field("span", &s); + } + Span::Fallback(s) => fallback::debug_span_field_if_nontrivial(debug, s), + } +} + +#[derive(Clone)] +pub(crate) enum Group { + Compiler(proc_macro::Group), + Fallback(fallback::Group), +} + +impl Group { + pub fn new(delimiter: Delimiter, stream: TokenStream) -> Group { + match stream { + TokenStream::Compiler(tts) => { + let delimiter = match delimiter { + Delimiter::Parenthesis => proc_macro::Delimiter::Parenthesis, + Delimiter::Bracket => proc_macro::Delimiter::Bracket, + Delimiter::Brace => proc_macro::Delimiter::Brace, + Delimiter::None => proc_macro::Delimiter::None, + }; + Group::Compiler(proc_macro::Group::new(delimiter, tts.into_token_stream())) + } + TokenStream::Fallback(stream) => { + Group::Fallback(fallback::Group::new(delimiter, stream)) + } + } + } + + pub fn delimiter(&self) -> Delimiter { + match self { + Group::Compiler(g) => match g.delimiter() { + proc_macro::Delimiter::Parenthesis => Delimiter::Parenthesis, + proc_macro::Delimiter::Bracket => Delimiter::Bracket, + proc_macro::Delimiter::Brace => Delimiter::Brace, + proc_macro::Delimiter::None => Delimiter::None, + }, + Group::Fallback(g) => g.delimiter(), + } + } + + pub fn stream(&self) -> TokenStream { + match self { + Group::Compiler(g) => TokenStream::Compiler(DeferredTokenStream::new(g.stream())), + Group::Fallback(g) => TokenStream::Fallback(g.stream()), + } + } + + pub fn span(&self) -> Span { + match self { + Group::Compiler(g) => Span::Compiler(g.span()), + Group::Fallback(g) => Span::Fallback(g.span()), + } + } + + pub fn span_open(&self) -> Span { + match self { + #[cfg(proc_macro_span)] + Group::Compiler(g) => Span::Compiler(g.span_open()), + #[cfg(not(proc_macro_span))] + Group::Compiler(g) => Span::Compiler(g.span()), + Group::Fallback(g) => Span::Fallback(g.span_open()), + } + } + + pub fn span_close(&self) -> Span { + match self { + #[cfg(proc_macro_span)] + Group::Compiler(g) => Span::Compiler(g.span_close()), + #[cfg(not(proc_macro_span))] + Group::Compiler(g) => Span::Compiler(g.span()), + Group::Fallback(g) => Span::Fallback(g.span_close()), + } + } + + pub fn set_span(&mut self, span: Span) { + match (self, span) { + (Group::Compiler(g), Span::Compiler(s)) => g.set_span(s), + (Group::Fallback(g), Span::Fallback(s)) => g.set_span(s), + _ => mismatch(), + } + } + + fn unwrap_nightly(self) -> proc_macro::Group { + match self { + Group::Compiler(g) => g, + Group::Fallback(_) => mismatch(), + } + } +} + +impl From for Group { + fn from(g: fallback::Group) -> Self { + Group::Fallback(g) + } +} + +impl fmt::Display for Group { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Group::Compiler(group) => group.fmt(formatter), + Group::Fallback(group) => group.fmt(formatter), + } + } +} + +impl fmt::Debug for Group { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self { + Group::Compiler(group) => group.fmt(formatter), + Group::Fallback(group) => group.fmt(formatter), + } + } +} + +#[derive(Clone)] +pub(crate) enum Ident { + Compiler(proc_macro::Ident), + Fallback(fallback::Ident), +} + +impl Ident { + pub fn new(string: &str, span: Span) -> Ident { + match span { + Span::Compiler(s) => Ident::Compiler(proc_macro::Ident::new(string, s)), + Span::Fallback(s) => Ident::Fallback(fallback::Ident::new(string, s)), + } + } + + pub fn new_raw(string: &str, span: Span) -> Ident { + match span { + Span::Compiler(s) => { + let p: proc_macro::TokenStream = string.parse().unwrap(); + let ident = match p.into_iter().next() { + Some(proc_macro::TokenTree::Ident(mut i)) => { + i.set_span(s); + i + } + _ => panic!(), + }; + Ident::Compiler(ident) + } + Span::Fallback(s) => Ident::Fallback(fallback::Ident::new_raw(string, s)), + } + } + + pub fn span(&self) -> Span { + match self { + Ident::Compiler(t) => Span::Compiler(t.span()), + Ident::Fallback(t) => Span::Fallback(t.span()), + } + } + + pub fn set_span(&mut self, span: Span) { + match (self, span) { + (Ident::Compiler(t), Span::Compiler(s)) => t.set_span(s), + (Ident::Fallback(t), Span::Fallback(s)) => t.set_span(s), + _ => mismatch(), + } + } + + fn unwrap_nightly(self) -> proc_macro::Ident { + match self { + Ident::Compiler(s) => s, + Ident::Fallback(_) => mismatch(), + } + } +} + +impl PartialEq for Ident { + fn eq(&self, other: &Ident) -> bool { + match (self, other) { + (Ident::Compiler(t), Ident::Compiler(o)) => t.to_string() == o.to_string(), + (Ident::Fallback(t), Ident::Fallback(o)) => t == o, + _ => mismatch(), + } + } +} + +impl PartialEq for Ident +where + T: ?Sized + AsRef, +{ + fn eq(&self, other: &T) -> bool { + let other = other.as_ref(); + match self { + Ident::Compiler(t) => t.to_string() == other, + Ident::Fallback(t) => t == other, + } + } +} + +impl fmt::Display for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Ident::Compiler(t) => t.fmt(f), + Ident::Fallback(t) => t.fmt(f), + } + } +} + +impl fmt::Debug for Ident { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Ident::Compiler(t) => t.fmt(f), + Ident::Fallback(t) => t.fmt(f), + } + } +} + +#[derive(Clone)] +pub(crate) enum Literal { + Compiler(proc_macro::Literal), + Fallback(fallback::Literal), +} + +macro_rules! suffixed_numbers { + ($($name:ident => $kind:ident,)*) => ($( + pub fn $name(n: $kind) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::$name(n)) + } else { + Literal::Fallback(fallback::Literal::$name(n)) + } + } + )*) +} + +macro_rules! unsuffixed_integers { + ($($name:ident => $kind:ident,)*) => ($( + pub fn $name(n: $kind) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::$name(n)) + } else { + Literal::Fallback(fallback::Literal::$name(n)) + } + } + )*) +} + +impl Literal { + suffixed_numbers! { + u8_suffixed => u8, + u16_suffixed => u16, + u32_suffixed => u32, + u64_suffixed => u64, + u128_suffixed => u128, + usize_suffixed => usize, + i8_suffixed => i8, + i16_suffixed => i16, + i32_suffixed => i32, + i64_suffixed => i64, + i128_suffixed => i128, + isize_suffixed => isize, + + f32_suffixed => f32, + f64_suffixed => f64, + } + + unsuffixed_integers! { + u8_unsuffixed => u8, + u16_unsuffixed => u16, + u32_unsuffixed => u32, + u64_unsuffixed => u64, + u128_unsuffixed => u128, + usize_unsuffixed => usize, + i8_unsuffixed => i8, + i16_unsuffixed => i16, + i32_unsuffixed => i32, + i64_unsuffixed => i64, + i128_unsuffixed => i128, + isize_unsuffixed => isize, + } + + pub fn f32_unsuffixed(f: f32) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::f32_unsuffixed(f)) + } else { + Literal::Fallback(fallback::Literal::f32_unsuffixed(f)) + } + } + + pub fn f64_unsuffixed(f: f64) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::f64_unsuffixed(f)) + } else { + Literal::Fallback(fallback::Literal::f64_unsuffixed(f)) + } + } + + pub fn string(t: &str) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::string(t)) + } else { + Literal::Fallback(fallback::Literal::string(t)) + } + } + + pub fn character(t: char) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::character(t)) + } else { + Literal::Fallback(fallback::Literal::character(t)) + } + } + + pub fn byte_string(bytes: &[u8]) -> Literal { + if inside_proc_macro() { + Literal::Compiler(proc_macro::Literal::byte_string(bytes)) + } else { + Literal::Fallback(fallback::Literal::byte_string(bytes)) + } + } + + pub fn span(&self) -> Span { + match self { + Literal::Compiler(lit) => Span::Compiler(lit.span()), + Literal::Fallback(lit) => Span::Fallback(lit.span()), + } + } + + pub fn set_span(&mut self, span: Span) { + match (self, span) { + (Literal::Compiler(lit), Span::Compiler(s)) => lit.set_span(s), + (Literal::Fallback(lit), Span::Fallback(s)) => lit.set_span(s), + _ => mismatch(), + } + } + + pub fn subspan>(&self, range: R) -> Option { + match self { + #[cfg(proc_macro_span)] + Literal::Compiler(lit) => lit.subspan(range).map(Span::Compiler), + #[cfg(not(proc_macro_span))] + Literal::Compiler(_lit) => None, + Literal::Fallback(lit) => lit.subspan(range).map(Span::Fallback), + } + } + + fn unwrap_nightly(self) -> proc_macro::Literal { + match self { + Literal::Compiler(s) => s, + Literal::Fallback(_) => mismatch(), + } + } +} + +impl From for Literal { + fn from(s: fallback::Literal) -> Literal { + Literal::Fallback(s) + } +} + +impl fmt::Display for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Literal::Compiler(t) => t.fmt(f), + Literal::Fallback(t) => t.fmt(f), + } + } +} + +impl fmt::Debug for Literal { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Literal::Compiler(t) => t.fmt(f), + Literal::Fallback(t) => t.fmt(f), + } + } +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/tests/comments.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/comments.rs new file mode 100644 index 0000000..708cccb --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/comments.rs @@ -0,0 +1,103 @@ +use proc_macro2::{Delimiter, Literal, Spacing, TokenStream, TokenTree}; + +// #[doc = "..."] -> "..." +fn lit_of_outer_doc_comment(tokens: TokenStream) -> Literal { + lit_of_doc_comment(tokens, false) +} + +// #![doc = "..."] -> "..." +fn lit_of_inner_doc_comment(tokens: TokenStream) -> Literal { + lit_of_doc_comment(tokens, true) +} + +fn lit_of_doc_comment(tokens: TokenStream, inner: bool) -> Literal { + let mut iter = tokens.clone().into_iter(); + match iter.next().unwrap() { + TokenTree::Punct(punct) => { + assert_eq!(punct.as_char(), '#'); + assert_eq!(punct.spacing(), Spacing::Alone); + } + _ => panic!("wrong token {:?}", tokens), + } + if inner { + match iter.next().unwrap() { + TokenTree::Punct(punct) => { + assert_eq!(punct.as_char(), '!'); + assert_eq!(punct.spacing(), Spacing::Alone); + } + _ => panic!("wrong token {:?}", tokens), + } + } + iter = match iter.next().unwrap() { + TokenTree::Group(group) => { + assert_eq!(group.delimiter(), Delimiter::Bracket); + assert!(iter.next().is_none(), "unexpected token {:?}", tokens); + group.stream().into_iter() + } + _ => panic!("wrong token {:?}", tokens), + }; + match iter.next().unwrap() { + TokenTree::Ident(ident) => assert_eq!(ident.to_string(), "doc"), + _ => panic!("wrong token {:?}", tokens), + } + match iter.next().unwrap() { + TokenTree::Punct(punct) => { + assert_eq!(punct.as_char(), '='); + assert_eq!(punct.spacing(), Spacing::Alone); + } + _ => panic!("wrong token {:?}", tokens), + } + match iter.next().unwrap() { + TokenTree::Literal(literal) => { + assert!(iter.next().is_none(), "unexpected token {:?}", tokens); + literal + } + _ => panic!("wrong token {:?}", tokens), + } +} + +#[test] +fn closed_immediately() { + let stream = "/**/".parse::().unwrap(); + let tokens = stream.into_iter().collect::>(); + assert!(tokens.is_empty(), "not empty -- {:?}", tokens); +} + +#[test] +fn incomplete() { + assert!("/*/".parse::().is_err()); +} + +#[test] +fn lit() { + let stream = "/// doc".parse::().unwrap(); + let lit = lit_of_outer_doc_comment(stream); + assert_eq!(lit.to_string(), "\" doc\""); + + let stream = "//! doc".parse::().unwrap(); + let lit = lit_of_inner_doc_comment(stream); + assert_eq!(lit.to_string(), "\" doc\""); + + let stream = "/** doc */".parse::().unwrap(); + let lit = lit_of_outer_doc_comment(stream); + assert_eq!(lit.to_string(), "\" doc \""); + + let stream = "/*! doc */".parse::().unwrap(); + let lit = lit_of_inner_doc_comment(stream); + assert_eq!(lit.to_string(), "\" doc \""); +} + +#[test] +fn carriage_return() { + let stream = "///\r\n".parse::().unwrap(); + let lit = lit_of_outer_doc_comment(stream); + assert_eq!(lit.to_string(), "\"\""); + + let stream = "/**\r\n*/".parse::().unwrap(); + let lit = lit_of_outer_doc_comment(stream); + assert_eq!(lit.to_string(), "\"\\r\\n\""); + + "///\r".parse::().unwrap_err(); + "///\r \n".parse::().unwrap_err(); + "/**\r \n*/".parse::().unwrap_err(); +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/tests/features.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/features.rs new file mode 100644 index 0000000..073f6e6 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/features.rs @@ -0,0 +1,8 @@ +#[test] +#[ignore] +fn make_sure_no_proc_macro() { + assert!( + !cfg!(feature = "proc-macro"), + "still compiled with proc_macro?" + ); +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/tests/marker.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/marker.rs new file mode 100644 index 0000000..7af2539 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/marker.rs @@ -0,0 +1,59 @@ +use proc_macro2::*; + +macro_rules! assert_impl { + ($ty:ident is $($marker:ident) and +) => { + #[test] + #[allow(non_snake_case)] + fn $ty() { + fn assert_implemented() {} + assert_implemented::<$ty>(); + } + }; + + ($ty:ident is not $($marker:ident) or +) => { + #[test] + #[allow(non_snake_case)] + fn $ty() { + $( + { + // Implemented for types that implement $marker. + trait IsNotImplemented { + fn assert_not_implemented() {} + } + impl IsNotImplemented for T {} + + // Implemented for the type being tested. + trait IsImplemented { + fn assert_not_implemented() {} + } + impl IsImplemented for $ty {} + + // If $ty does not implement $marker, there is no ambiguity + // in the following trait method call. + <$ty>::assert_not_implemented(); + } + )+ + } + }; +} + +assert_impl!(Delimiter is Send and Sync); +assert_impl!(Spacing is Send and Sync); + +assert_impl!(Group is not Send or Sync); +assert_impl!(Ident is not Send or Sync); +assert_impl!(LexError is not Send or Sync); +assert_impl!(Literal is not Send or Sync); +assert_impl!(Punct is not Send or Sync); +assert_impl!(Span is not Send or Sync); +assert_impl!(TokenStream is not Send or Sync); +assert_impl!(TokenTree is not Send or Sync); + +#[cfg(procmacro2_semver_exempt)] +mod semver_exempt { + use super::*; + + assert_impl!(LineColumn is Send and Sync); + + assert_impl!(SourceFile is not Send or Sync); +} diff --git a/third_party/cargo/vendor/proc-macro2-1.0.17/tests/test.rs b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/test.rs new file mode 100644 index 0000000..a0133f6 --- /dev/null +++ b/third_party/cargo/vendor/proc-macro2-1.0.17/tests/test.rs @@ -0,0 +1,476 @@ +use proc_macro2::{Ident, Literal, Spacing, Span, TokenStream, TokenTree}; +use std::str::{self, FromStr}; + +#[test] +fn idents() { + assert_eq!( + Ident::new("String", Span::call_site()).to_string(), + "String" + ); + assert_eq!(Ident::new("fn", Span::call_site()).to_string(), "fn"); + assert_eq!(Ident::new("_", Span::call_site()).to_string(), "_"); +} + +#[test] +#[cfg(procmacro2_semver_exempt)] +fn raw_idents() { + assert_eq!( + Ident::new_raw("String", Span::call_site()).to_string(), + "r#String" + ); + assert_eq!(Ident::new_raw("fn", Span::call_site()).to_string(), "r#fn"); + assert_eq!(Ident::new_raw("_", Span::call_site()).to_string(), "r#_"); +} + +#[test] +#[should_panic(expected = "Ident is not allowed to be empty; use Option")] +fn ident_empty() { + Ident::new("", Span::call_site()); +} + +#[test] +#[should_panic(expected = "Ident cannot be a number; use Literal instead")] +fn ident_number() { + Ident::new("255", Span::call_site()); +} + +#[test] +#[should_panic(expected = "\"a#\" is not a valid Ident")] +fn ident_invalid() { + Ident::new("a#", Span::call_site()); +} + +#[test] +#[should_panic(expected = "not a valid Ident")] +fn raw_ident_empty() { + Ident::new("r#", Span::call_site()); +} + +#[test] +#[should_panic(expected = "not a valid Ident")] +fn raw_ident_number() { + Ident::new("r#255", Span::call_site()); +} + +#[test] +#[should_panic(expected = "\"r#a#\" is not a valid Ident")] +fn raw_ident_invalid() { + Ident::new("r#a#", Span::call_site()); +} + +#[test] +#[should_panic(expected = "not a valid Ident")] +fn lifetime_empty() { + Ident::new("'", Span::call_site()); +} + +#[test] +#[should_panic(expected = "not a valid Ident")] +fn lifetime_number() { + Ident::new("'255", Span::call_site()); +} + +#[test] +#[should_panic(expected = r#""\'a#" is not a valid Ident"#)] +fn lifetime_invalid() { + Ident::new("'a#", Span::call_site()); +} + +#[test] +fn literal_string() { + assert_eq!(Literal::string("foo").to_string(), "\"foo\""); + assert_eq!(Literal::string("\"").to_string(), "\"\\\"\""); + assert_eq!(Literal::string("didn't").to_string(), "\"didn't\""); +} + +#[test] +fn literal_character() { + assert_eq!(Literal::character('x').to_string(), "'x'"); + assert_eq!(Literal::character('\'').to_string(), "'\\''"); + assert_eq!(Literal::character('"').to_string(), "'\"'"); +} + +#[test] +fn literal_float() { + assert_eq!(Literal::f32_unsuffixed(10.0).to_string(), "10.0"); +} + +#[test] +fn literal_suffix() { + fn token_count(p: &str) -> usize { + p.parse::().unwrap().into_iter().count() + } + + assert_eq!(token_count("999u256"), 1); + assert_eq!(token_count("999r#u256"), 3); + assert_eq!(token_count("1."), 1); + assert_eq!(token_count("1.f32"), 3); + assert_eq!(token_count("1.0_0"), 1); + assert_eq!(token_count("1._0"), 3); + assert_eq!(token_count("1._m"), 3); + assert_eq!(token_count("\"\"s"), 1); + assert_eq!(token_count("r\"\"r"), 1); + assert_eq!(token_count("b\"\"b"), 1); + assert_eq!(token_count("br\"\"br"), 1); + assert_eq!(token_count("r#\"\"#r"), 1); + assert_eq!(token_count("'c'c"), 1); + assert_eq!(token_count("b'b'b"), 1); +} + +#[test] +fn roundtrip() { + fn roundtrip(p: &str) { + println!("parse: {}", p); + let s = p.parse::().unwrap().to_string(); + println!("first: {}", s); + let s2 = s.to_string().parse::().unwrap().to_string(); + assert_eq!(s, s2); + } + roundtrip("a"); + roundtrip("<<"); + roundtrip("<<="); + roundtrip( + " + 1 + 1.0 + 1f32 + 2f64 + 1usize + 4isize + 4e10 + 1_000 + 1_0i32 + 8u8 + 9 + 0 + 0xffffffffffffffffffffffffffffffff + 1x + 1u80 + 1f320 + ", + ); + roundtrip("'a"); + roundtrip("'_"); + roundtrip("'static"); + roundtrip("'\\u{10__FFFF}'"); + roundtrip("\"\\u{10_F0FF__}foo\\u{1_0_0_0__}\""); +} + +#[test] +fn fail() { + fn fail(p: &str) { + if let Ok(s) = p.parse::() { + panic!("should have failed to parse: {}\n{:#?}", p, s); + } + } + fail("' static"); + fail("r#1"); + fail("r#_"); +} + +#[cfg(span_locations)] +#[test] +fn span_test() { + check_spans( + "\ +/// This is a document comment +testing 123 +{ + testing 234 +}", + &[ + (1, 0, 1, 30), // # + (1, 0, 1, 30), // [ ... ] + (1, 0, 1, 30), // doc + (1, 0, 1, 30), // = + (1, 0, 1, 30), // "This is..." + (2, 0, 2, 7), // testing + (2, 8, 2, 11), // 123 + (3, 0, 5, 1), // { ... } + (4, 2, 4, 9), // testing + (4, 10, 4, 13), // 234 + ], + ); +} + +#[cfg(procmacro2_semver_exempt)] +#[cfg(not(nightly))] +#[test] +fn default_span() { + let start = Span::call_site().start(); + assert_eq!(start.line, 1); + assert_eq!(start.column, 0); + let end = Span::call_site().end(); + assert_eq!(end.line, 1); + assert_eq!(end.column, 0); + let source_file = Span::call_site().source_file(); + assert_eq!(source_file.path().to_string_lossy(), ""); + assert!(!source_file.is_real()); +} + +#[cfg(procmacro2_semver_exempt)] +#[test] +fn span_join() { + let source1 = "aaa\nbbb" + .parse::() + .unwrap() + .into_iter() + .collect::>(); + let source2 = "ccc\nddd" + .parse::() + .unwrap() + .into_iter() + .collect::>(); + + assert!(source1[0].span().source_file() != source2[0].span().source_file()); + assert_eq!( + source1[0].span().source_file(), + source1[1].span().source_file() + ); + + let joined1 = source1[0].span().join(source1[1].span()); + let joined2 = source1[0].span().join(source2[0].span()); + assert!(joined1.is_some()); + assert!(joined2.is_none()); + + let start = joined1.unwrap().start(); + let end = joined1.unwrap().end(); + assert_eq!(start.line, 1); + assert_eq!(start.column, 0); + assert_eq!(end.line, 2); + assert_eq!(end.column, 3); + + assert_eq!( + joined1.unwrap().source_file(), + source1[0].span().source_file() + ); +} + +#[test] +fn no_panic() { + let s = str::from_utf8(b"b\'\xc2\x86 \x00\x00\x00^\"").unwrap(); + assert!(s.parse::().is_err()); +} + +#[test] +fn op_before_comment() { + let mut tts = TokenStream::from_str("~// comment").unwrap().into_iter(); + match tts.next().unwrap() { + TokenTree::Punct(tt) => { + assert_eq!(tt.as_char(), '~'); + assert_eq!(tt.spacing(), Spacing::Alone); + } + wrong => panic!("wrong token {:?}", wrong), + } +} + +#[test] +fn raw_identifier() { + let mut tts = TokenStream::from_str("r#dyn").unwrap().into_iter(); + match tts.next().unwrap() { + TokenTree::Ident(raw) => assert_eq!("r#dyn", raw.to_string()), + wrong => panic!("wrong token {:?}", wrong), + } + assert!(tts.next().is_none()); +} + +#[test] +fn test_debug_ident() { + let ident = Ident::new("proc_macro", Span::call_site()); + + #[cfg(not(procmacro2_semver_exempt))] + let expected = "Ident(proc_macro)"; + + #[cfg(procmacro2_semver_exempt)] + let expected = "Ident { sym: proc_macro, span: bytes(0..0) }"; + + assert_eq!(expected, format!("{:?}", ident)); +} + +#[test] +fn test_debug_tokenstream() { + let tts = TokenStream::from_str("[a + 1]").unwrap(); + + #[cfg(not(procmacro2_semver_exempt))] + let expected = "\ +TokenStream [ + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: a, + }, + Punct { + op: '+', + spacing: Alone, + }, + Literal { + lit: 1, + }, + ], + }, +]\ + "; + + #[cfg(not(procmacro2_semver_exempt))] + let expected_before_trailing_commas = "\ +TokenStream [ + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: a + }, + Punct { + op: '+', + spacing: Alone + }, + Literal { + lit: 1 + } + ] + } +]\ + "; + + #[cfg(procmacro2_semver_exempt)] + let expected = "\ +TokenStream [ + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: a, + span: bytes(2..3), + }, + Punct { + op: '+', + spacing: Alone, + span: bytes(4..5), + }, + Literal { + lit: 1, + span: bytes(6..7), + }, + ], + span: bytes(1..8), + }, +]\ + "; + + #[cfg(procmacro2_semver_exempt)] + let expected_before_trailing_commas = "\ +TokenStream [ + Group { + delimiter: Bracket, + stream: TokenStream [ + Ident { + sym: a, + span: bytes(2..3) + }, + Punct { + op: '+', + spacing: Alone, + span: bytes(4..5) + }, + Literal { + lit: 1, + span: bytes(6..7) + } + ], + span: bytes(1..8) + } +]\ + "; + + let actual = format!("{:#?}", tts); + if actual.ends_with(",\n]") { + assert_eq!(expected, actual); + } else { + assert_eq!(expected_before_trailing_commas, actual); + } +} + +#[test] +fn default_tokenstream_is_empty() { + let default_token_stream: TokenStream = Default::default(); + + assert!(default_token_stream.is_empty()); +} + +#[test] +fn tuple_indexing() { + // This behavior may change depending on https://github.com/rust-lang/rust/pull/71322 + let mut tokens = "tuple.0.0".parse::().unwrap().into_iter(); + assert_eq!("tuple", tokens.next().unwrap().to_string()); + assert_eq!(".", tokens.next().unwrap().to_string()); + assert_eq!("0.0", tokens.next().unwrap().to_string()); + assert!(tokens.next().is_none()); +} + +#[cfg(span_locations)] +#[test] +fn non_ascii_tokens() { + check_spans("// abc", &[]); + check_spans("// ábc", &[]); + check_spans("// abc x", &[]); + check_spans("// ábc x", &[]); + check_spans("/* abc */ x", &[(1, 10, 1, 11)]); + check_spans("/* ábc */ x", &[(1, 10, 1, 11)]); + check_spans("/* ab\nc */ x", &[(2, 5, 2, 6)]); + check_spans("/* áb\nc */ x", &[(2, 5, 2, 6)]); + check_spans("/*** abc */ x", &[(1, 12, 1, 13)]); + check_spans("/*** ábc */ x", &[(1, 12, 1, 13)]); + check_spans(r#""abc""#, &[(1, 0, 1, 5)]); + check_spans(r#""ábc""#, &[(1, 0, 1, 5)]); + check_spans(r###"r#"abc"#"###, &[(1, 0, 1, 8)]); + check_spans(r###"r#"ábc"#"###, &[(1, 0, 1, 8)]); + check_spans("r#\"a\nc\"#", &[(1, 0, 2, 3)]); + check_spans("r#\"á\nc\"#", &[(1, 0, 2, 3)]); + check_spans("'a'", &[(1, 0, 1, 3)]); + check_spans("'á'", &[(1, 0, 1, 3)]); + check_spans("//! abc", &[(1, 0, 1, 7), (1, 0, 1, 7), (1, 0, 1, 7)]); + check_spans("//! ábc", &[(1, 0, 1, 7), (1, 0, 1, 7), (1, 0, 1, 7)]); + check_spans("//! abc\n", &[(1, 0, 1, 7), (1, 0, 1, 7), (1, 0, 1, 7)]); + check_spans("//! ábc\n", &[(1, 0, 1, 7), (1, 0, 1, 7), (1, 0, 1, 7)]); + check_spans("/*! abc */", &[(1, 0, 1, 10), (1, 0, 1, 10), (1, 0, 1, 10)]); + check_spans("/*! ábc */", &[(1, 0, 1, 10), (1, 0, 1, 10), (1, 0, 1, 10)]); + check_spans("/*! a\nc */", &[(1, 0, 2, 4), (1, 0, 2, 4), (1, 0, 2, 4)]); + check_spans("/*! á\nc */", &[(1, 0, 2, 4), (1, 0, 2, 4), (1, 0, 2, 4)]); + check_spans("abc", &[(1, 0, 1, 3)]); + check_spans("ábc", &[(1, 0, 1, 3)]); + check_spans("ábć", &[(1, 0, 1, 3)]); + check_spans("abc// foo", &[(1, 0, 1, 3)]); + check_spans("ábc// foo", &[(1, 0, 1, 3)]); + check_spans("ábć// foo", &[(1, 0, 1, 3)]); + check_spans("b\"a\\\n c\"", &[(1, 0, 2, 3)]); + check_spans("b\"a\\\n\u{00a0}c\"", &[(1, 0, 2, 3)]); +} + +#[cfg(span_locations)] +fn check_spans(p: &str, mut lines: &[(usize, usize, usize, usize)]) { + let ts = p.parse::().unwrap(); + check_spans_internal(ts, &mut lines); + assert!(lines.is_empty(), "leftover ranges: {:?}", lines); +} + +#[cfg(span_locations)] +fn check_spans_internal(ts: TokenStream, lines: &mut &[(usize, usize, usize, usize)]) { + for i in ts { + if let Some((&(sline, scol, eline, ecol), rest)) = lines.split_first() { + *lines = rest; + + let start = i.span().start(); + assert_eq!(start.line, sline, "sline did not match for {}", i); + assert_eq!(start.column, scol, "scol did not match for {}", i); + + let end = i.span().end(); + assert_eq!(end.line, eline, "eline did not match for {}", i); + assert_eq!(end.column, ecol, "ecol did not match for {}", i); + + if let TokenTree::Group(g) = i { + check_spans_internal(g.stream().clone(), lines); + } + } + } +} diff --git a/third_party/cargo/vendor/quick-error-1.2.3/.cargo-checksum.json b/third_party/cargo/vendor/quick-error-1.2.3/.cargo-checksum.json index 0605353..5f19af6 100644 --- a/third_party/cargo/vendor/quick-error-1.2.3/.cargo-checksum.json +++ b/third_party/cargo/vendor/quick-error-1.2.3/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"1f24b567c7f10b4ec44f5baf033d27da39f659c09df0e8a057437d10ecdd551a","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"058f01fe181608d027fcde7e528fc03ea3cf90f30903c407644b0a9bbc54f500","README.rst":"8bd690e0089d4c38eb71f1327f5144741009f4b2f49f0b16f2547f528171e2e6","bulk.yaml":"17c2548388e0cd3a63473021a2f1e4ddedee082d79d9167cb31ad06a1890d3fc","examples/context.rs":"b9be9a4ca021a1f0ba659932bfc0cf891728bfaea49d48a8be183644c492515b","src/lib.rs":"a02c8a3c40fa1dcee8285b9c238d40cb3078cf4dded1c972fa6361a485d1667f","vagga.yaml":"b01ad1fd3aa25de2439c0f7a437c6517808ba3a7eeeb0363eb209f08e326cc8e"},"package":"a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"} \ No newline at end of file +{"files":{"Cargo.lock":"b88df71c076815e9922973e1f54af221486c3a83d5be2c1af9ca650a8f8f526f","Cargo.toml":"1f24b567c7f10b4ec44f5baf033d27da39f659c09df0e8a057437d10ecdd551a","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"058f01fe181608d027fcde7e528fc03ea3cf90f30903c407644b0a9bbc54f500","README.rst":"8bd690e0089d4c38eb71f1327f5144741009f4b2f49f0b16f2547f528171e2e6","bulk.yaml":"17c2548388e0cd3a63473021a2f1e4ddedee082d79d9167cb31ad06a1890d3fc","examples/context.rs":"b9be9a4ca021a1f0ba659932bfc0cf891728bfaea49d48a8be183644c492515b","src/lib.rs":"a02c8a3c40fa1dcee8285b9c238d40cb3078cf4dded1c972fa6361a485d1667f","vagga.yaml":"b01ad1fd3aa25de2439c0f7a437c6517808ba3a7eeeb0363eb209f08e326cc8e"},"package":"a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"} \ No newline at end of file diff --git a/third_party/cargo/vendor/quick-error-1.2.3/Cargo.lock b/third_party/cargo/vendor/quick-error-1.2.3/Cargo.lock new file mode 100644 index 0000000..da1963e --- /dev/null +++ b/third_party/cargo/vendor/quick-error-1.2.3/Cargo.lock @@ -0,0 +1,6 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "quick-error" +version = "1.2.3" + diff --git a/third_party/cargo/vendor/quote-1.0.6/.cargo-checksum.json b/third_party/cargo/vendor/quote-1.0.6/.cargo-checksum.json new file mode 100644 index 0000000..3e2fae9 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"f10316a17d3d0c915346ebe7349292fd4f0fc66df4bcd9d9d662e578d76142cc","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"c9a75f18b9ab2927829a208fc6aa2cf4e63b8420887ba29cdb265d6619ae82d5","README.md":"9209682116de84bb9cc7be6ccf44478b46b909c7857f9e186d90bcff522af864","src/ext.rs":"a9fed3a1a4c9d3f2de717ba808af99291b995db2cbf8067f4b6927c39cc62bc6","src/format.rs":"a9c3e3a333c6dacf6e330d02b4c726862e273df1c2c6be6da199049cd1e521db","src/ident_fragment.rs":"e66a63f6e9020f2639a71f120d627bc6cfd60081a6caf8a1d735b59ee2413d29","src/lib.rs":"b50d2e72a5aedd728918017d34b337aa1e306a8d5f58b18a1d66fceec7186de9","src/runtime.rs":"f0452bed2b045ab38cefa2ded50dbd210c5bc0c4e059786999fe9f732437d250","src/spanned.rs":"adc0ed742ad17327c375879472d435cea168c208c303f53eb93cb2c0f10f3650","src/to_tokens.rs":"e589c1643479a9003d4dd1d9fa63714042b106f1b16d8ea3903cfe2f73a020f5","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test.rs":"3cfcb80ad5c754ad6ca0a6efab6c4fdeeebbe4cae95cee0296a79fb1a8bc4f4a","tests/ui/does-not-have-iter-interpolated-dup.rs":"ad13eea21d4cdd2ab6c082f633392e1ff20fb0d1af5f2177041e0bf7f30da695","tests/ui/does-not-have-iter-interpolated.rs":"83a5b3f240651adcbe4b6e51076d76d653ad439b37442cf4054f1fd3c073f3b7","tests/ui/does-not-have-iter-separated.rs":"fe413c48331d5e3a7ae5fef6a5892a90c72f610d54595879eb49d0a94154ba3f","tests/ui/does-not-have-iter.rs":"09dc9499d861b63cebb0848b855b78e2dc9497bfde37ba6339f3625ae009a62f","tests/ui/not-quotable.rs":"5759d0884943417609f28faadc70254a3e2fd3d9bd6ff7297a3fb70a77fafd8a","tests/ui/not-repeatable.rs":"b08405e02d46712d47e48ec8d0d68c93d8ebf3bb299714a373c2c954de79f6bd","tests/ui/wrong-type-span.rs":"5f310cb7fde3ef51bad01e7f286d244e3b6e67396cd2ea7eab77275c9d902699"},"package":"54a21852a652ad6f610c9510194f398ff6f8692e334fd1145fed931f7fbe44ea"} \ No newline at end of file diff --git a/third_party/cargo/vendor/quote-1.0.6/BUILD b/third_party/cargo/vendor/quote-1.0.6/BUILD new file mode 100644 index 0000000..7f7e2d4 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/BUILD @@ -0,0 +1,47 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "compiletest" with type "test" omitted + +rust_library( + name = "quote", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/proc-macro2-1.0.17:proc_macro2", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.6", + crate_features = [ + "default", + "proc-macro", + ], +) + +# Unsupported target "test" with type "test" omitted diff --git a/third_party/cargo/vendor/quote-1.0.6/Cargo.toml b/third_party/cargo/vendor/quote-1.0.6/Cargo.toml new file mode 100644 index 0000000..6a004f9 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/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 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 = "quote" +version = "1.0.6" +authors = ["David Tolnay "] +include = ["Cargo.toml", "src/**/*.rs", "tests/**/*.rs", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] +description = "Quasi-quoting macro quote!(...)" +documentation = "https://docs.rs/quote/" +readme = "README.md" +keywords = ["syn"] +categories = ["development-tools::procedural-macro-helpers"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/dtolnay/quote" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] +[dependencies.proc-macro2] +version = "1.0" +default-features = false +[dev-dependencies.rustversion] +version = "1.0" + +[dev-dependencies.trybuild] +version = "1.0.19" +features = ["diff"] + +[features] +default = ["proc-macro"] +proc-macro = ["proc-macro2/proc-macro"] diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/LICENSE-APACHE b/third_party/cargo/vendor/quote-1.0.6/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/LICENSE-APACHE rename to third_party/cargo/vendor/quote-1.0.6/LICENSE-APACHE diff --git a/third_party/cargo/vendor/arrayvec-0.5.1/LICENSE-MIT b/third_party/cargo/vendor/quote-1.0.6/LICENSE-MIT similarity index 95% rename from third_party/cargo/vendor/arrayvec-0.5.1/LICENSE-MIT rename to third_party/cargo/vendor/quote-1.0.6/LICENSE-MIT index 2c8f27d..40b8817 100644 --- a/third_party/cargo/vendor/arrayvec-0.5.1/LICENSE-MIT +++ b/third_party/cargo/vendor/quote-1.0.6/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) Ulrik Sverdrup "bluss" 2015-2017 +Copyright (c) 2016 The Rust Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/third_party/cargo/vendor/quote-1.0.6/README.md b/third_party/cargo/vendor/quote-1.0.6/README.md new file mode 100644 index 0000000..57b2a62 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/README.md @@ -0,0 +1,261 @@ +Rust Quasi-Quoting +================== + +[github](https://github.com/dtolnay/quote) +[crates.io](https://crates.io/crates/quote) +[docs.rs](https://docs.rs/quote) +[build status](https://github.com/dtolnay/quote/actions?query=branch%3Amaster) + +This crate provides the [`quote!`] macro for turning Rust syntax tree data +structures into tokens of source code. + +[`quote!`]: https://docs.rs/quote/1.0/quote/macro.quote.html + +Procedural macros in Rust receive a stream of tokens as input, execute arbitrary +Rust code to determine how to manipulate those tokens, and produce a stream of +tokens to hand back to the compiler to compile into the caller's crate. +Quasi-quoting is a solution to one piece of that — producing tokens to +return to the compiler. + +The idea of quasi-quoting is that we write *code* that we treat as *data*. +Within the `quote!` macro, we can write what looks like code to our text editor +or IDE. We get all the benefits of the editor's brace matching, syntax +highlighting, indentation, and maybe autocompletion. But rather than compiling +that as code into the current crate, we can treat it as data, pass it around, +mutate it, and eventually hand it back to the compiler as tokens to compile into +the macro caller's crate. + +This crate is motivated by the procedural macro use case, but is a +general-purpose Rust quasi-quoting library and is not specific to procedural +macros. + +```toml +[dependencies] +quote = "1.0" +``` + +*Version requirement: Quote supports rustc 1.31 and up.*
+[*Release notes*](https://github.com/dtolnay/quote/releases) + +
+ +## Syntax + +The quote crate provides a [`quote!`] macro within which you can write Rust code +that gets packaged into a [`TokenStream`] and can be treated as data. You should +think of `TokenStream` as representing a fragment of Rust source code. + +[`TokenStream`]: https://docs.rs/proc-macro2/1.0/proc_macro2/struct.TokenStream.html + +Within the `quote!` macro, interpolation is done with `#var`. Any type +implementing the [`quote::ToTokens`] trait can be interpolated. This includes +most Rust primitive types as well as most of the syntax tree types from [`syn`]. + +[`quote::ToTokens`]: https://docs.rs/quote/1.0/quote/trait.ToTokens.html +[`syn`]: https://github.com/dtolnay/syn + +```rust +let tokens = quote! { + struct SerializeWith #generics #where_clause { + value: &'a #field_ty, + phantom: core::marker::PhantomData<#item_ty>, + } + + impl #generics serde::Serialize for SerializeWith #generics #where_clause { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + #path(self.value, serializer) + } + } + + SerializeWith { + value: #value, + phantom: core::marker::PhantomData::<#item_ty>, + } +}; +``` + +
+ +## Repetition + +Repetition is done using `#(...)*` or `#(...),*` similar to `macro_rules!`. This +iterates through the elements of any variable interpolated within the repetition +and inserts a copy of the repetition body for each one. The variables in an +interpolation may be anything that implements `IntoIterator`, including `Vec` or +a pre-existing iterator. + +- `#(#var)*` — no separators +- `#(#var),*` — the character before the asterisk is used as a separator +- `#( struct #var; )*` — the repetition can contain other things +- `#( #k => println!("{}", #v), )*` — even multiple interpolations + +Note that there is a difference between `#(#var ,)*` and `#(#var),*`—the latter +does not produce a trailing comma. This matches the behavior of delimiters in +`macro_rules!`. + +
+ +## Returning tokens to the compiler + +The `quote!` macro evaluates to an expression of type +`proc_macro2::TokenStream`. Meanwhile Rust procedural macros are expected to +return the type `proc_macro::TokenStream`. + +The difference between the two types is that `proc_macro` types are entirely +specific to procedural macros and cannot ever exist in code outside of a +procedural macro, while `proc_macro2` types may exist anywhere including tests +and non-macro code like main.rs and build.rs. This is why even the procedural +macro ecosystem is largely built around `proc_macro2`, because that ensures the +libraries are unit testable and accessible in non-macro contexts. + +There is a [`From`]-conversion in both directions so returning the output of +`quote!` from a procedural macro usually looks like `tokens.into()` or +`proc_macro::TokenStream::from(tokens)`. + +[`From`]: https://doc.rust-lang.org/std/convert/trait.From.html + +
+ +## Examples + +### Combining quoted fragments + +Usually you don't end up constructing an entire final `TokenStream` in one +piece. Different parts may come from different helper functions. The tokens +produced by `quote!` themselves implement `ToTokens` and so can be interpolated +into later `quote!` invocations to build up a final result. + +```rust +let type_definition = quote! {...}; +let methods = quote! {...}; + +let tokens = quote! { + #type_definition + #methods +}; +``` + +### Constructing identifiers + +Suppose we have an identifier `ident` which came from somewhere in a macro +input and we need to modify it in some way for the macro output. Let's consider +prepending the identifier with an underscore. + +Simply interpolating the identifier next to an underscore will not have the +behavior of concatenating them. The underscore and the identifier will continue +to be two separate tokens as if you had written `_ x`. + +```rust +// incorrect +quote! { + let mut _#ident = 0; +} +``` + +The solution is to build a new identifier token with the correct value. As this +is such a common case, the `format_ident!` macro provides a convenient utility +for doing so correctly. + +```rust +let varname = format_ident!("_{}", ident); +quote! { + let mut #varname = 0; +} +``` + +Alternatively, the APIs provided by Syn and proc-macro2 can be used to directly +build the identifier. This is roughly equivalent to the above, but will not +handle `ident` being a raw identifier. + +```rust +let concatenated = format!("_{}", ident); +let varname = syn::Ident::new(&concatenated, ident.span()); +quote! { + let mut #varname = 0; +} +``` + +### Making method calls + +Let's say our macro requires some type specified in the macro input to have a +constructor called `new`. We have the type in a variable called `field_type` of +type `syn::Type` and want to invoke the constructor. + +```rust +// incorrect +quote! { + let value = #field_type::new(); +} +``` + +This works only sometimes. If `field_type` is `String`, the expanded code +contains `String::new()` which is fine. But if `field_type` is something like +`Vec` then the expanded code is `Vec::new()` which is invalid syntax. +Ordinarily in handwritten Rust we would write `Vec::::new()` but for macros +often the following is more convenient. + +```rust +quote! { + let value = <#field_type>::new(); +} +``` + +This expands to `>::new()` which behaves correctly. + +A similar pattern is appropriate for trait methods. + +```rust +quote! { + let value = <#field_type as core::default::Default>::default(); +} +``` + +
+ +## Hygiene + +Any interpolated tokens preserve the `Span` information provided by their +`ToTokens` implementation. Tokens that originate within a `quote!` invocation +are spanned with [`Span::call_site()`]. + +[`Span::call_site()`]: https://docs.rs/proc-macro2/1.0/proc_macro2/struct.Span.html#method.call_site + +A different span can be provided explicitly through the [`quote_spanned!`] +macro. + +[`quote_spanned!`]: https://docs.rs/quote/1.0/quote/macro.quote_spanned.html + +
+ +## Non-macro code generators + +When using `quote` in a build.rs or main.rs and writing the output out to a +file, consider having the code generator pass the tokens through [rustfmt] +before writing (either by shelling out to the `rustfmt` binary or by pulling in +the `rustfmt` library as a dependency). This way if an error occurs in the +generated code it is convenient for a human to read and debug. + +Be aware that no kind of hygiene or span information is retained when tokens are +written to a file; the conversion from tokens to source code is lossy. + +[rustfmt]: https://github.com/rust-lang/rustfmt + +
+ +#### License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate 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/third_party/cargo/vendor/quote-1.0.6/src/ext.rs b/third_party/cargo/vendor/quote-1.0.6/src/ext.rs new file mode 100644 index 0000000..9e9b4a5 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/ext.rs @@ -0,0 +1,112 @@ +use super::ToTokens; + +use std::iter; + +use proc_macro2::{TokenStream, TokenTree}; + +/// TokenStream extension trait with methods for appending tokens. +/// +/// This trait is sealed and cannot be implemented outside of the `quote` crate. +pub trait TokenStreamExt: private::Sealed { + /// For use by `ToTokens` implementations. + /// + /// Appends the token specified to this list of tokens. + fn append(&mut self, token: U) + where + U: Into; + + /// For use by `ToTokens` implementations. + /// + /// ``` + /// # use quote::{quote, TokenStreamExt, ToTokens}; + /// # use proc_macro2::TokenStream; + /// # + /// struct X; + /// + /// impl ToTokens for X { + /// fn to_tokens(&self, tokens: &mut TokenStream) { + /// tokens.append_all(&[true, false]); + /// } + /// } + /// + /// let tokens = quote!(#X); + /// assert_eq!(tokens.to_string(), "true false"); + /// ``` + fn append_all(&mut self, iter: I) + where + I: IntoIterator, + I::Item: ToTokens; + + /// For use by `ToTokens` implementations. + /// + /// Appends all of the items in the iterator `I`, separated by the tokens + /// `U`. + fn append_separated(&mut self, iter: I, op: U) + where + I: IntoIterator, + I::Item: ToTokens, + U: ToTokens; + + /// For use by `ToTokens` implementations. + /// + /// Appends all tokens in the iterator `I`, appending `U` after each + /// element, including after the last element of the iterator. + fn append_terminated(&mut self, iter: I, term: U) + where + I: IntoIterator, + I::Item: ToTokens, + U: ToTokens; +} + +impl TokenStreamExt for TokenStream { + fn append(&mut self, token: U) + where + U: Into, + { + self.extend(iter::once(token.into())); + } + + fn append_all(&mut self, iter: I) + where + I: IntoIterator, + I::Item: ToTokens, + { + for token in iter { + token.to_tokens(self); + } + } + + fn append_separated(&mut self, iter: I, op: U) + where + I: IntoIterator, + I::Item: ToTokens, + U: ToTokens, + { + for (i, token) in iter.into_iter().enumerate() { + if i > 0 { + op.to_tokens(self); + } + token.to_tokens(self); + } + } + + fn append_terminated(&mut self, iter: I, term: U) + where + I: IntoIterator, + I::Item: ToTokens, + U: ToTokens, + { + for token in iter { + token.to_tokens(self); + term.to_tokens(self); + } + } +} + +mod private { + use proc_macro2::TokenStream; + + pub trait Sealed {} + + impl Sealed for TokenStream {} +} diff --git a/third_party/cargo/vendor/quote-1.0.6/src/format.rs b/third_party/cargo/vendor/quote-1.0.6/src/format.rs new file mode 100644 index 0000000..745cb5d --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/format.rs @@ -0,0 +1,164 @@ +/// Formatting macro for constructing `Ident`s. +/// +///
+/// +/// # Syntax +/// +/// Syntax is copied from the [`format!`] macro, supporting both positional and +/// named arguments. +/// +/// Only a limited set of formatting traits are supported. The current mapping +/// of format types to traits is: +/// +/// * `{}` ⇒ [`IdentFragment`] +/// * `{:o}` ⇒ [`Octal`](`std::fmt::Octal`) +/// * `{:x}` ⇒ [`LowerHex`](`std::fmt::LowerHex`) +/// * `{:X}` ⇒ [`UpperHex`](`std::fmt::UpperHex`) +/// * `{:b}` ⇒ [`Binary`](`std::fmt::Binary`) +/// +/// See [`std::fmt`] for more information. +/// +///
+/// +/// # IdentFragment +/// +/// Unlike `format!`, this macro uses the [`IdentFragment`] formatting trait by +/// default. This trait is like `Display`, with a few differences: +/// +/// * `IdentFragment` is only implemented for a limited set of types, such as +/// unsigned integers and strings. +/// * [`Ident`] arguments will have their `r#` prefixes stripped, if present. +/// +/// [`Ident`]: `proc_macro2::Ident` +/// +///
+/// +/// # Hygiene +/// +/// The [`Span`] of the first `Ident` argument is used as the span of the final +/// identifier, falling back to [`Span::call_site`] when no identifiers are +/// provided. +/// +/// ``` +/// # use quote::format_ident; +/// # let ident = format_ident!("Ident"); +/// // If `ident` is an Ident, the span of `my_ident` will be inherited from it. +/// let my_ident = format_ident!("My{}{}", ident, "IsCool"); +/// assert_eq!(my_ident, "MyIdentIsCool"); +/// ``` +/// +/// Alternatively, the span can be overridden by passing the `span` named +/// argument. +/// +/// ``` +/// # use quote::format_ident; +/// # const IGNORE_TOKENS: &'static str = stringify! { +/// let my_span = /* ... */; +/// # }; +/// # let my_span = proc_macro2::Span::call_site(); +/// format_ident!("MyIdent", span = my_span); +/// ``` +/// +/// [`Span`]: `proc_macro2::Span` +/// [`Span::call_site`]: `proc_macro2::Span::call_site` +/// +///


+/// +/// # Panics +/// +/// This method will panic if the resulting formatted string is not a valid +/// identifier. +/// +///
+/// +/// # Examples +/// +/// Composing raw and non-raw identifiers: +/// ``` +/// # use quote::format_ident; +/// let my_ident = format_ident!("My{}", "Ident"); +/// assert_eq!(my_ident, "MyIdent"); +/// +/// let raw = format_ident!("r#Raw"); +/// assert_eq!(raw, "r#Raw"); +/// +/// let my_ident_raw = format_ident!("{}Is{}", my_ident, raw); +/// assert_eq!(my_ident_raw, "MyIdentIsRaw"); +/// ``` +/// +/// Integer formatting options: +/// ``` +/// # use quote::format_ident; +/// let num: u32 = 10; +/// +/// let decimal = format_ident!("Id_{}", num); +/// assert_eq!(decimal, "Id_10"); +/// +/// let octal = format_ident!("Id_{:o}", num); +/// assert_eq!(octal, "Id_12"); +/// +/// let binary = format_ident!("Id_{:b}", num); +/// assert_eq!(binary, "Id_1010"); +/// +/// let lower_hex = format_ident!("Id_{:x}", num); +/// assert_eq!(lower_hex, "Id_a"); +/// +/// let upper_hex = format_ident!("Id_{:X}", num); +/// assert_eq!(upper_hex, "Id_A"); +/// ``` +#[macro_export] +macro_rules! format_ident { + ($fmt:expr) => { + $crate::format_ident_impl!([ + ::std::option::Option::None, + $fmt + ]) + }; + + ($fmt:expr, $($rest:tt)*) => { + $crate::format_ident_impl!([ + ::std::option::Option::None, + $fmt + ] $($rest)*) + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! format_ident_impl { + // Final state + ([$span:expr, $($fmt:tt)*]) => { + $crate::__private::mk_ident(&format!($($fmt)*), $span) + }; + + // Span argument + ([$old:expr, $($fmt:tt)*] span = $span:expr) => { + $crate::format_ident_impl!([$old, $($fmt)*] span = $span,) + }; + ([$old:expr, $($fmt:tt)*] span = $span:expr, $($rest:tt)*) => { + $crate::format_ident_impl!([ + ::std::option::Option::Some::<$crate::__private::Span>($span), + $($fmt)* + ] $($rest)*) + }; + + // Named argument + ([$span:expr, $($fmt:tt)*] $name:ident = $arg:expr) => { + $crate::format_ident_impl!([$span, $($fmt)*] $name = $arg,) + }; + ([$span:expr, $($fmt:tt)*] $name:ident = $arg:expr, $($rest:tt)*) => { + match $crate::__private::IdentFragmentAdapter(&$arg) { + arg => $crate::format_ident_impl!([$span.or(arg.span()), $($fmt)*, $name = arg] $($rest)*), + } + }; + + // Positional argument + ([$span:expr, $($fmt:tt)*] $arg:expr) => { + $crate::format_ident_impl!([$span, $($fmt)*] $arg,) + }; + ([$span:expr, $($fmt:tt)*] $arg:expr, $($rest:tt)*) => { + match $crate::__private::IdentFragmentAdapter(&$arg) { + arg => $crate::format_ident_impl!([$span.or(arg.span()), $($fmt)*, arg] $($rest)*), + } + }; +} diff --git a/third_party/cargo/vendor/quote-1.0.6/src/ident_fragment.rs b/third_party/cargo/vendor/quote-1.0.6/src/ident_fragment.rs new file mode 100644 index 0000000..e7472fe --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/ident_fragment.rs @@ -0,0 +1,86 @@ +use proc_macro2::{Ident, Span}; +use std::borrow::Cow; +use std::fmt; + +/// Specialized formatting trait used by `format_ident!`. +/// +/// [`Ident`] arguments formatted using this trait will have their `r#` prefix +/// stripped, if present. +/// +/// See [`format_ident!`] for more information. +pub trait IdentFragment { + /// Format this value as an identifier fragment. + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result; + + /// Span associated with this `IdentFragment`. + /// + /// If non-`None`, may be inherited by formatted identifiers. + fn span(&self) -> Option { + None + } +} + +impl IdentFragment for &T { + fn span(&self) -> Option { + ::span(*self) + } + + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + IdentFragment::fmt(*self, f) + } +} + +impl IdentFragment for &mut T { + fn span(&self) -> Option { + ::span(*self) + } + + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + IdentFragment::fmt(*self, f) + } +} + +impl IdentFragment for Ident { + fn span(&self) -> Option { + Some(self.span()) + } + + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let id = self.to_string(); + if id.starts_with("r#") { + fmt::Display::fmt(&id[2..], f) + } else { + fmt::Display::fmt(&id[..], f) + } + } +} + +impl IdentFragment for Cow<'_, T> +where + T: IdentFragment + ToOwned + ?Sized, +{ + fn span(&self) -> Option { + T::span(self) + } + + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + T::fmt(self, f) + } +} + +// Limited set of types which this is implemented for, as we want to avoid types +// which will often include non-identifier characters in their `Display` impl. +macro_rules! ident_fragment_display { + ($($T:ty),*) => { + $( + impl IdentFragment for $T { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self, f) + } + } + )* + } +} + +ident_fragment_display!(bool, str, String, char); +ident_fragment_display!(u8, u16, u32, u64, u128, usize); diff --git a/third_party/cargo/vendor/quote-1.0.6/src/lib.rs b/third_party/cargo/vendor/quote-1.0.6/src/lib.rs new file mode 100644 index 0000000..dd7ef3c --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/lib.rs @@ -0,0 +1,962 @@ +//! [![github]](https://github.com/dtolnay/quote) [![crates-io]](https://crates.io/crates/quote) [![docs-rs]](https://docs.rs/quote) +//! +//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github +//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust +//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K +//! +//!
+//! +//! This crate provides the [`quote!`] macro for turning Rust syntax tree data +//! structures into tokens of source code. +//! +//! [`quote!`]: macro.quote.html +//! +//! Procedural macros in Rust receive a stream of tokens as input, execute +//! arbitrary Rust code to determine how to manipulate those tokens, and produce +//! a stream of tokens to hand back to the compiler to compile into the caller's +//! crate. Quasi-quoting is a solution to one piece of that — producing +//! tokens to return to the compiler. +//! +//! The idea of quasi-quoting is that we write *code* that we treat as *data*. +//! Within the `quote!` macro, we can write what looks like code to our text +//! editor or IDE. We get all the benefits of the editor's brace matching, +//! syntax highlighting, indentation, and maybe autocompletion. But rather than +//! compiling that as code into the current crate, we can treat it as data, pass +//! it around, mutate it, and eventually hand it back to the compiler as tokens +//! to compile into the macro caller's crate. +//! +//! This crate is motivated by the procedural macro use case, but is a +//! general-purpose Rust quasi-quoting library and is not specific to procedural +//! macros. +//! +//! ```toml +//! [dependencies] +//! quote = "1.0" +//! ``` +//! +//!
+//! +//! # Example +//! +//! The following quasi-quoted block of code is something you might find in [a] +//! procedural macro having to do with data structure serialization. The `#var` +//! syntax performs interpolation of runtime variables into the quoted tokens. +//! Check out the documentation of the [`quote!`] macro for more detail about +//! the syntax. See also the [`quote_spanned!`] macro which is important for +//! implementing hygienic procedural macros. +//! +//! [a]: https://serde.rs/ +//! [`quote_spanned!`]: macro.quote_spanned.html +//! +//! ``` +//! # use quote::quote; +//! # +//! # let generics = ""; +//! # let where_clause = ""; +//! # let field_ty = ""; +//! # let item_ty = ""; +//! # let path = ""; +//! # let value = ""; +//! # +//! let tokens = quote! { +//! struct SerializeWith #generics #where_clause { +//! value: &'a #field_ty, +//! phantom: core::marker::PhantomData<#item_ty>, +//! } +//! +//! impl #generics serde::Serialize for SerializeWith #generics #where_clause { +//! fn serialize(&self, serializer: S) -> Result +//! where +//! S: serde::Serializer, +//! { +//! #path(self.value, serializer) +//! } +//! } +//! +//! SerializeWith { +//! value: #value, +//! phantom: core::marker::PhantomData::<#item_ty>, +//! } +//! }; +//! ``` + +#![forbid(unsafe_code)] + +// Quote types in rustdoc of other crates get linked to here. +#![doc(html_root_url = "https://docs.rs/quote/1.0.6")] + +#[cfg(all( + not(all(target_arch = "wasm32", target_os = "unknown")), + feature = "proc-macro" +))] +extern crate proc_macro; + +mod ext; +mod format; +mod ident_fragment; +mod to_tokens; + +// Not public API. +#[doc(hidden)] +#[path = "runtime.rs"] +pub mod __private; + +pub use crate::ext::TokenStreamExt; +pub use crate::ident_fragment::IdentFragment; +pub use crate::to_tokens::ToTokens; + +// Not public API. +#[doc(hidden)] +pub mod spanned; + +/// The whole point. +/// +/// Performs variable interpolation against the input and produces it as +/// [`proc_macro2::TokenStream`]. +/// +/// Note: for returning tokens to the compiler in a procedural macro, use +/// `.into()` on the result to convert to [`proc_macro::TokenStream`]. +/// +/// [`TokenStream`]: https://docs.rs/proc-macro2/1.0/proc_macro2/struct.TokenStream.html +/// +///
+/// +/// # Interpolation +/// +/// Variable interpolation is done with `#var` (similar to `$var` in +/// `macro_rules!` macros). This grabs the `var` variable that is currently in +/// scope and inserts it in that location in the output tokens. Any type +/// implementing the [`ToTokens`] trait can be interpolated. This includes most +/// Rust primitive types as well as most of the syntax tree types from the [Syn] +/// crate. +/// +/// [`ToTokens`]: trait.ToTokens.html +/// [Syn]: https://github.com/dtolnay/syn +/// +/// Repetition is done using `#(...)*` or `#(...),*` again similar to +/// `macro_rules!`. This iterates through the elements of any variable +/// interpolated within the repetition and inserts a copy of the repetition body +/// for each one. The variables in an interpolation may be a `Vec`, slice, +/// `BTreeSet`, or any `Iterator`. +/// +/// - `#(#var)*` — no separators +/// - `#(#var),*` — the character before the asterisk is used as a separator +/// - `#( struct #var; )*` — the repetition can contain other tokens +/// - `#( #k => println!("{}", #v), )*` — even multiple interpolations +/// +///
+/// +/// # Hygiene +/// +/// Any interpolated tokens preserve the `Span` information provided by their +/// `ToTokens` implementation. Tokens that originate within the `quote!` +/// invocation are spanned with [`Span::call_site()`]. +/// +/// [`Span::call_site()`]: https://docs.rs/proc-macro2/1.0/proc_macro2/struct.Span.html#method.call_site +/// +/// A different span can be provided through the [`quote_spanned!`] macro. +/// +/// [`quote_spanned!`]: macro.quote_spanned.html +/// +///
+/// +/// # Return type +/// +/// The macro evaluates to an expression of type `proc_macro2::TokenStream`. +/// Meanwhile Rust procedural macros are expected to return the type +/// `proc_macro::TokenStream`. +/// +/// The difference between the two types is that `proc_macro` types are entirely +/// specific to procedural macros and cannot ever exist in code outside of a +/// procedural macro, while `proc_macro2` types may exist anywhere including +/// tests and non-macro code like main.rs and build.rs. This is why even the +/// procedural macro ecosystem is largely built around `proc_macro2`, because +/// that ensures the libraries are unit testable and accessible in non-macro +/// contexts. +/// +/// There is a [`From`]-conversion in both directions so returning the output of +/// `quote!` from a procedural macro usually looks like `tokens.into()` or +/// `proc_macro::TokenStream::from(tokens)`. +/// +/// [`From`]: https://doc.rust-lang.org/std/convert/trait.From.html +/// +///
+/// +/// # Examples +/// +/// ### Procedural macro +/// +/// The structure of a basic procedural macro is as follows. Refer to the [Syn] +/// crate for further useful guidance on using `quote!` as part of a procedural +/// macro. +/// +/// [Syn]: https://github.com/dtolnay/syn +/// +/// ``` +/// # #[cfg(any())] +/// extern crate proc_macro; +/// # extern crate proc_macro2; +/// +/// # #[cfg(any())] +/// use proc_macro::TokenStream; +/// # use proc_macro2::TokenStream; +/// use quote::quote; +/// +/// # const IGNORE_TOKENS: &'static str = stringify! { +/// #[proc_macro_derive(HeapSize)] +/// # }; +/// pub fn derive_heap_size(input: TokenStream) -> TokenStream { +/// // Parse the input and figure out what implementation to generate... +/// # const IGNORE_TOKENS: &'static str = stringify! { +/// let name = /* ... */; +/// let expr = /* ... */; +/// # }; +/// # +/// # let name = 0; +/// # let expr = 0; +/// +/// let expanded = quote! { +/// // The generated impl. +/// impl heapsize::HeapSize for #name { +/// fn heap_size_of_children(&self) -> usize { +/// #expr +/// } +/// } +/// }; +/// +/// // Hand the output tokens back to the compiler. +/// TokenStream::from(expanded) +/// } +/// ``` +/// +///


+/// +/// ### Combining quoted fragments +/// +/// Usually you don't end up constructing an entire final `TokenStream` in one +/// piece. Different parts may come from different helper functions. The tokens +/// produced by `quote!` themselves implement `ToTokens` and so can be +/// interpolated into later `quote!` invocations to build up a final result. +/// +/// ``` +/// # use quote::quote; +/// # +/// let type_definition = quote! {...}; +/// let methods = quote! {...}; +/// +/// let tokens = quote! { +/// #type_definition +/// #methods +/// }; +/// ``` +/// +///


+/// +/// ### Constructing identifiers +/// +/// Suppose we have an identifier `ident` which came from somewhere in a macro +/// input and we need to modify it in some way for the macro output. Let's +/// consider prepending the identifier with an underscore. +/// +/// Simply interpolating the identifier next to an underscore will not have the +/// behavior of concatenating them. The underscore and the identifier will +/// continue to be two separate tokens as if you had written `_ x`. +/// +/// ``` +/// # use proc_macro2::{self as syn, Span}; +/// # use quote::quote; +/// # +/// # let ident = syn::Ident::new("i", Span::call_site()); +/// # +/// // incorrect +/// quote! { +/// let mut _#ident = 0; +/// } +/// # ; +/// ``` +/// +/// The solution is to build a new identifier token with the correct value. As +/// this is such a common case, the [`format_ident!`] macro provides a +/// convenient utility for doing so correctly. +/// +/// ``` +/// # use proc_macro2::{Ident, Span}; +/// # use quote::{format_ident, quote}; +/// # +/// # let ident = Ident::new("i", Span::call_site()); +/// # +/// let varname = format_ident!("_{}", ident); +/// quote! { +/// let mut #varname = 0; +/// } +/// # ; +/// ``` +/// +/// Alternatively, the APIs provided by Syn and proc-macro2 can be used to +/// directly build the identifier. This is roughly equivalent to the above, but +/// will not handle `ident` being a raw identifier. +/// +/// ``` +/// # use proc_macro2::{self as syn, Span}; +/// # use quote::quote; +/// # +/// # let ident = syn::Ident::new("i", Span::call_site()); +/// # +/// let concatenated = format!("_{}", ident); +/// let varname = syn::Ident::new(&concatenated, ident.span()); +/// quote! { +/// let mut #varname = 0; +/// } +/// # ; +/// ``` +/// +///


+/// +/// ### Making method calls +/// +/// Let's say our macro requires some type specified in the macro input to have +/// a constructor called `new`. We have the type in a variable called +/// `field_type` of type `syn::Type` and want to invoke the constructor. +/// +/// ``` +/// # use quote::quote; +/// # +/// # let field_type = quote!(...); +/// # +/// // incorrect +/// quote! { +/// let value = #field_type::new(); +/// } +/// # ; +/// ``` +/// +/// This works only sometimes. If `field_type` is `String`, the expanded code +/// contains `String::new()` which is fine. But if `field_type` is something +/// like `Vec` then the expanded code is `Vec::new()` which is invalid +/// syntax. Ordinarily in handwritten Rust we would write `Vec::::new()` +/// but for macros often the following is more convenient. +/// +/// ``` +/// # use quote::quote; +/// # +/// # let field_type = quote!(...); +/// # +/// quote! { +/// let value = <#field_type>::new(); +/// } +/// # ; +/// ``` +/// +/// This expands to `>::new()` which behaves correctly. +/// +/// A similar pattern is appropriate for trait methods. +/// +/// ``` +/// # use quote::quote; +/// # +/// # let field_type = quote!(...); +/// # +/// quote! { +/// let value = <#field_type as core::default::Default>::default(); +/// } +/// # ; +/// ``` +/// +///


+/// +/// ### Interpolating text inside of doc comments +/// +/// Neither doc comments nor string literals get interpolation behavior in +/// quote: +/// +/// ```compile_fail +/// quote! { +/// /// try to interpolate: #ident +/// /// +/// /// ... +/// } +/// ``` +/// +/// ```compile_fail +/// quote! { +/// #[doc = "try to interpolate: #ident"] +/// } +/// ``` +/// +/// Macro calls in a doc attribute are not valid syntax: +/// +/// ```compile_fail +/// quote! { +/// #[doc = concat!("try to interpolate: ", stringify!(#ident))] +/// } +/// ``` +/// +/// Instead the best way to build doc comments that involve variables is by +/// formatting the doc string literal outside of quote. +/// +/// ```rust +/// # use proc_macro2::{Ident, Span}; +/// # use quote::quote; +/// # +/// # const IGNORE: &str = stringify! { +/// let msg = format!(...); +/// # }; +/// # +/// # let ident = Ident::new("var", Span::call_site()); +/// # let msg = format!("try to interpolate: {}", ident); +/// quote! { +/// #[doc = #msg] +/// /// +/// /// ... +/// } +/// # ; +/// ``` +/// +///


+/// +/// ### Indexing into a tuple struct +/// +/// When interpolating indices of a tuple or tuple struct, we need them not to +/// appears suffixed as integer literals by interpolating them as [`syn::Index`] +/// instead. +/// +/// [`syn::Index`]: https://docs.rs/syn/1.0/syn/struct.Index.html +/// +/// ```compile_fail +/// let i = 0usize..self.fields.len(); +/// +/// // expands to 0 + self.0usize.heap_size() + self.1usize.heap_size() + ... +/// // which is not valid syntax +/// quote! { +/// 0 #( + self.#i.heap_size() )* +/// } +/// ``` +/// +/// ``` +/// # use proc_macro2::{Ident, TokenStream}; +/// # use quote::quote; +/// # +/// # mod syn { +/// # use proc_macro2::{Literal, TokenStream}; +/// # use quote::{ToTokens, TokenStreamExt}; +/// # +/// # pub struct Index(usize); +/// # +/// # impl From for Index { +/// # fn from(i: usize) -> Self { +/// # Index(i) +/// # } +/// # } +/// # +/// # impl ToTokens for Index { +/// # fn to_tokens(&self, tokens: &mut TokenStream) { +/// # tokens.append(Literal::usize_unsuffixed(self.0)); +/// # } +/// # } +/// # } +/// # +/// # struct Struct { +/// # fields: Vec, +/// # } +/// # +/// # impl Struct { +/// # fn example(&self) -> TokenStream { +/// let i = (0..self.fields.len()).map(syn::Index::from); +/// +/// // expands to 0 + self.0.heap_size() + self.1.heap_size() + ... +/// quote! { +/// 0 #( + self.#i.heap_size() )* +/// } +/// # } +/// # } +/// ``` +#[macro_export] +macro_rules! quote { + ($($tt:tt)*) => { + $crate::quote_spanned!($crate::__private::Span::call_site()=> $($tt)*) + }; +} + +/// Same as `quote!`, but applies a given span to all tokens originating within +/// the macro invocation. +/// +///
+/// +/// # Syntax +/// +/// A span expression of type [`Span`], followed by `=>`, followed by the tokens +/// to quote. The span expression should be brief — use a variable for +/// anything more than a few characters. There should be no space before the +/// `=>` token. +/// +/// [`Span`]: https://docs.rs/proc-macro2/1.0/proc_macro2/struct.Span.html +/// +/// ``` +/// # use proc_macro2::Span; +/// # use quote::quote_spanned; +/// # +/// # const IGNORE_TOKENS: &'static str = stringify! { +/// let span = /* ... */; +/// # }; +/// # let span = Span::call_site(); +/// # let init = 0; +/// +/// // On one line, use parentheses. +/// let tokens = quote_spanned!(span=> Box::into_raw(Box::new(#init))); +/// +/// // On multiple lines, place the span at the top and use braces. +/// let tokens = quote_spanned! {span=> +/// Box::into_raw(Box::new(#init)) +/// }; +/// ``` +/// +/// The lack of space before the `=>` should look jarring to Rust programmers +/// and this is intentional. The formatting is designed to be visibly +/// off-balance and draw the eye a particular way, due to the span expression +/// being evaluated in the context of the procedural macro and the remaining +/// tokens being evaluated in the generated code. +/// +///
+/// +/// # Hygiene +/// +/// Any interpolated tokens preserve the `Span` information provided by their +/// `ToTokens` implementation. Tokens that originate within the `quote_spanned!` +/// invocation are spanned with the given span argument. +/// +///
+/// +/// # Example +/// +/// The following procedural macro code uses `quote_spanned!` to assert that a +/// particular Rust type implements the [`Sync`] trait so that references can be +/// safely shared between threads. +/// +/// [`Sync`]: https://doc.rust-lang.org/std/marker/trait.Sync.html +/// +/// ``` +/// # use quote::{quote_spanned, TokenStreamExt, ToTokens}; +/// # use proc_macro2::{Span, TokenStream}; +/// # +/// # struct Type; +/// # +/// # impl Type { +/// # fn span(&self) -> Span { +/// # Span::call_site() +/// # } +/// # } +/// # +/// # impl ToTokens for Type { +/// # fn to_tokens(&self, _tokens: &mut TokenStream) {} +/// # } +/// # +/// # let ty = Type; +/// # let call_site = Span::call_site(); +/// # +/// let ty_span = ty.span(); +/// let assert_sync = quote_spanned! {ty_span=> +/// struct _AssertSync where #ty: Sync; +/// }; +/// ``` +/// +/// If the assertion fails, the user will see an error like the following. The +/// input span of their type is hightlighted in the error. +/// +/// ```text +/// error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied +/// --> src/main.rs:10:21 +/// | +/// 10 | static ref PTR: *const () = &(); +/// | ^^^^^^^^^ `*const ()` cannot be shared between threads safely +/// ``` +/// +/// In this example it is important for the where-clause to be spanned with the +/// line/column information of the user's input type so that error messages are +/// placed appropriately by the compiler. +#[macro_export] +macro_rules! quote_spanned { + ($span:expr=> $($tt:tt)*) => {{ + let mut _s = $crate::__private::TokenStream::new(); + let _span: $crate::__private::Span = $span; + $crate::quote_each_token!(_s _span $($tt)*); + _s + }}; +} + +// Extract the names of all #metavariables and pass them to the $call macro. +// +// in: pounded_var_names!(then!(...) a #b c #( #d )* #e) +// out: then!(... b); +// then!(... d); +// then!(... e); +#[macro_export] +#[doc(hidden)] +macro_rules! pounded_var_names { + ($call:ident! $extra:tt $($tts:tt)*) => { + $crate::pounded_var_names_with_context!($call! $extra + (@ $($tts)*) + ($($tts)* @) + ) + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! pounded_var_names_with_context { + ($call:ident! $extra:tt ($($b1:tt)*) ($($curr:tt)*)) => { + $( + $crate::pounded_var_with_context!($call! $extra $b1 $curr); + )* + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! pounded_var_with_context { + ($call:ident! $extra:tt $b1:tt ( $($inner:tt)* )) => { + $crate::pounded_var_names!($call! $extra $($inner)*); + }; + + ($call:ident! $extra:tt $b1:tt [ $($inner:tt)* ]) => { + $crate::pounded_var_names!($call! $extra $($inner)*); + }; + + ($call:ident! $extra:tt $b1:tt { $($inner:tt)* }) => { + $crate::pounded_var_names!($call! $extra $($inner)*); + }; + + ($call:ident!($($extra:tt)*) # $var:ident) => { + $crate::$call!($($extra)* $var); + }; + + ($call:ident! $extra:tt $b1:tt $curr:tt) => {}; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_bind_into_iter { + ($has_iter:ident $var:ident) => { + // `mut` may be unused if $var occurs multiple times in the list. + #[allow(unused_mut)] + let (mut $var, i) = $var.quote_into_iter(); + let $has_iter = $has_iter | i; + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_bind_next_or_break { + ($var:ident) => { + let $var = match $var.next() { + Some(_x) => $crate::__private::RepInterp(_x), + None => break, + }; + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_each_token { + ($tokens:ident $span:ident $($tts:tt)*) => { + $crate::quote_tokens_with_context!($tokens $span + (@ @ @ @ @ @ $($tts)*) + (@ @ @ @ @ $($tts)* @) + (@ @ @ @ $($tts)* @ @) + (@ @ @ $(($tts))* @ @ @) + (@ @ $($tts)* @ @ @ @) + (@ $($tts)* @ @ @ @ @) + ($($tts)* @ @ @ @ @ @) + ); + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_tokens_with_context { + ($tokens:ident $span:ident + ($($b3:tt)*) ($($b2:tt)*) ($($b1:tt)*) + ($($curr:tt)*) + ($($a1:tt)*) ($($a2:tt)*) ($($a3:tt)*) + ) => { + $( + $crate::quote_token_with_context!($tokens $span $b3 $b2 $b1 $curr $a1 $a2 $a3); + )* + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_token_with_context { + ($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt @ $a1:tt $a2:tt $a3:tt) => {}; + + ($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt (#) ( $($inner:tt)* ) * $a3:tt) => {{ + use $crate::__private::ext::*; + let has_iter = $crate::__private::ThereIsNoIteratorInRepetition; + $crate::pounded_var_names!(quote_bind_into_iter!(has_iter) () $($inner)*); + let _: $crate::__private::HasIterator = has_iter; + // This is `while true` instead of `loop` because if there are no + // iterators used inside of this repetition then the body would not + // contain any `break`, so the compiler would emit unreachable code + // warnings on anything below the loop. We use has_iter to detect and + // fail to compile when there are no iterators, so here we just work + // around the unneeded extra warning. + while true { + $crate::pounded_var_names!(quote_bind_next_or_break!() () $($inner)*); + $crate::quote_each_token!($tokens $span $($inner)*); + } + }}; + ($tokens:ident $span:ident $b3:tt $b2:tt # (( $($inner:tt)* )) * $a2:tt $a3:tt) => {}; + ($tokens:ident $span:ident $b3:tt # ( $($inner:tt)* ) (*) $a1:tt $a2:tt $a3:tt) => {}; + + ($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt (#) ( $($inner:tt)* ) $sep:tt *) => {{ + use $crate::__private::ext::*; + let mut _i = 0usize; + let has_iter = $crate::__private::ThereIsNoIteratorInRepetition; + $crate::pounded_var_names!(quote_bind_into_iter!(has_iter) () $($inner)*); + let _: $crate::__private::HasIterator = has_iter; + while true { + $crate::pounded_var_names!(quote_bind_next_or_break!() () $($inner)*); + if _i > 0 { + $crate::quote_token!($tokens $span $sep); + } + _i += 1; + $crate::quote_each_token!($tokens $span $($inner)*); + } + }}; + ($tokens:ident $span:ident $b3:tt $b2:tt # (( $($inner:tt)* )) $sep:tt * $a3:tt) => {}; + ($tokens:ident $span:ident $b3:tt # ( $($inner:tt)* ) ($sep:tt) * $a2:tt $a3:tt) => {}; + ($tokens:ident $span:ident # ( $($inner:tt)* ) * (*) $a1:tt $a2:tt $a3:tt) => { + // https://github.com/dtolnay/quote/issues/130 + $crate::quote_token!($tokens $span *); + }; + ($tokens:ident $span:ident # ( $($inner:tt)* ) $sep:tt (*) $a1:tt $a2:tt $a3:tt) => {}; + + ($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt (#) $var:ident $a2:tt $a3:tt) => { + $crate::ToTokens::to_tokens(&$var, &mut $tokens); + }; + ($tokens:ident $span:ident $b3:tt $b2:tt # ($var:ident) $a1:tt $a2:tt $a3:tt) => {}; + ($tokens:ident $span:ident $b3:tt $b2:tt $b1:tt ($curr:tt) $a1:tt $a2:tt $a3:tt) => { + $crate::quote_token!($tokens $span $curr); + }; +} + +#[macro_export] +#[doc(hidden)] +macro_rules! quote_token { + ($tokens:ident $span:ident ( $($inner:tt)* )) => { + $tokens.extend({ + let mut g = $crate::__private::Group::new( + $crate::__private::Delimiter::Parenthesis, + $crate::quote_spanned!($span=> $($inner)*), + ); + g.set_span($span); + Some($crate::__private::TokenTree::from(g)) + }); + }; + + ($tokens:ident $span:ident [ $($inner:tt)* ]) => { + $tokens.extend({ + let mut g = $crate::__private::Group::new( + $crate::__private::Delimiter::Bracket, + $crate::quote_spanned!($span=> $($inner)*), + ); + g.set_span($span); + Some($crate::__private::TokenTree::from(g)) + }); + }; + + ($tokens:ident $span:ident { $($inner:tt)* }) => { + $tokens.extend({ + let mut g = $crate::__private::Group::new( + $crate::__private::Delimiter::Brace, + $crate::quote_spanned!($span=> $($inner)*), + ); + g.set_span($span); + Some($crate::__private::TokenTree::from(g)) + }); + }; + + ($tokens:ident $span:ident +) => { + $crate::__private::push_add(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident +=) => { + $crate::__private::push_add_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident &) => { + $crate::__private::push_and(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident &&) => { + $crate::__private::push_and_and(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident &=) => { + $crate::__private::push_and_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident @) => { + $crate::__private::push_at(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident !) => { + $crate::__private::push_bang(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ^) => { + $crate::__private::push_caret(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ^=) => { + $crate::__private::push_caret_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident :) => { + $crate::__private::push_colon(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ::) => { + $crate::__private::push_colon2(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ,) => { + $crate::__private::push_comma(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident /) => { + $crate::__private::push_div(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident /=) => { + $crate::__private::push_div_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident .) => { + $crate::__private::push_dot(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ..) => { + $crate::__private::push_dot2(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ...) => { + $crate::__private::push_dot3(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ..=) => { + $crate::__private::push_dot_dot_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident =) => { + $crate::__private::push_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ==) => { + $crate::__private::push_eq_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident >=) => { + $crate::__private::push_ge(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident >) => { + $crate::__private::push_gt(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident <=) => { + $crate::__private::push_le(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident <) => { + $crate::__private::push_lt(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident *=) => { + $crate::__private::push_mul_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident !=) => { + $crate::__private::push_ne(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident |) => { + $crate::__private::push_or(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident |=) => { + $crate::__private::push_or_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ||) => { + $crate::__private::push_or_or(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident #) => { + $crate::__private::push_pound(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ?) => { + $crate::__private::push_question(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ->) => { + $crate::__private::push_rarrow(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident <-) => { + $crate::__private::push_larrow(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident %) => { + $crate::__private::push_rem(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident %=) => { + $crate::__private::push_rem_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident =>) => { + $crate::__private::push_fat_arrow(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident ;) => { + $crate::__private::push_semi(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident <<) => { + $crate::__private::push_shl(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident <<=) => { + $crate::__private::push_shl_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident >>) => { + $crate::__private::push_shr(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident >>=) => { + $crate::__private::push_shr_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident *) => { + $crate::__private::push_star(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident -) => { + $crate::__private::push_sub(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident -=) => { + $crate::__private::push_sub_eq(&mut $tokens, $span); + }; + + ($tokens:ident $span:ident $ident:ident) => { + $crate::__private::push_ident(&mut $tokens, $span, stringify!($ident)); + }; + + ($tokens:ident $span:ident $other:tt) => { + $crate::__private::parse(&mut $tokens, $span, stringify!($other)); + }; +} diff --git a/third_party/cargo/vendor/quote-1.0.6/src/runtime.rs b/third_party/cargo/vendor/quote-1.0.6/src/runtime.rs new file mode 100644 index 0000000..bbdeb61 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/runtime.rs @@ -0,0 +1,362 @@ +use crate::{IdentFragment, ToTokens, TokenStreamExt}; +use std::fmt; +use std::ops::BitOr; + +pub use proc_macro2::*; + +pub struct HasIterator; // True +pub struct ThereIsNoIteratorInRepetition; // False + +impl BitOr for ThereIsNoIteratorInRepetition { + type Output = ThereIsNoIteratorInRepetition; + fn bitor(self, _rhs: ThereIsNoIteratorInRepetition) -> ThereIsNoIteratorInRepetition { + ThereIsNoIteratorInRepetition + } +} + +impl BitOr for HasIterator { + type Output = HasIterator; + fn bitor(self, _rhs: ThereIsNoIteratorInRepetition) -> HasIterator { + HasIterator + } +} + +impl BitOr for ThereIsNoIteratorInRepetition { + type Output = HasIterator; + fn bitor(self, _rhs: HasIterator) -> HasIterator { + HasIterator + } +} + +impl BitOr for HasIterator { + type Output = HasIterator; + fn bitor(self, _rhs: HasIterator) -> HasIterator { + HasIterator + } +} + +/// Extension traits used by the implementation of `quote!`. These are defined +/// in separate traits, rather than as a single trait due to ambiguity issues. +/// +/// These traits expose a `quote_into_iter` method which should allow calling +/// whichever impl happens to be applicable. Calling that method repeatedly on +/// the returned value should be idempotent. +pub mod ext { + use super::RepInterp; + use super::{HasIterator as HasIter, ThereIsNoIteratorInRepetition as DoesNotHaveIter}; + use crate::ToTokens; + use std::collections::btree_set::{self, BTreeSet}; + use std::slice; + + /// Extension trait providing the `quote_into_iter` method on iterators. + pub trait RepIteratorExt: Iterator + Sized { + fn quote_into_iter(self) -> (Self, HasIter) { + (self, HasIter) + } + } + + impl RepIteratorExt for T {} + + /// Extension trait providing the `quote_into_iter` method for + /// non-iterable types. These types interpolate the same value in each + /// iteration of the repetition. + pub trait RepToTokensExt { + /// Pretend to be an iterator for the purposes of `quote_into_iter`. + /// This allows repeated calls to `quote_into_iter` to continue + /// correctly returning DoesNotHaveIter. + fn next(&self) -> Option<&Self> { + Some(self) + } + + fn quote_into_iter(&self) -> (&Self, DoesNotHaveIter) { + (self, DoesNotHaveIter) + } + } + + impl RepToTokensExt for T {} + + /// Extension trait providing the `quote_into_iter` method for types that + /// can be referenced as an iterator. + pub trait RepAsIteratorExt<'q> { + type Iter: Iterator; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter); + } + + impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a T { + type Iter = T::Iter; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + ::quote_into_iter(*self) + } + } + + impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a mut T { + type Iter = T::Iter; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + ::quote_into_iter(*self) + } + } + + impl<'q, T: 'q> RepAsIteratorExt<'q> for [T] { + type Iter = slice::Iter<'q, T>; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + (self.iter(), HasIter) + } + } + + impl<'q, T: 'q> RepAsIteratorExt<'q> for Vec { + type Iter = slice::Iter<'q, T>; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + (self.iter(), HasIter) + } + } + + impl<'q, T: 'q> RepAsIteratorExt<'q> for BTreeSet { + type Iter = btree_set::Iter<'q, T>; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + (self.iter(), HasIter) + } + } + + macro_rules! array_rep_slice { + ($($l:tt)*) => { + $( + impl<'q, T: 'q> RepAsIteratorExt<'q> for [T; $l] { + type Iter = slice::Iter<'q, T>; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + (self.iter(), HasIter) + } + } + )* + } + } + + array_rep_slice!( + 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 + 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 + ); + + impl<'q, T: RepAsIteratorExt<'q>> RepAsIteratorExt<'q> for RepInterp { + type Iter = T::Iter; + + fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { + self.0.quote_into_iter() + } + } +} + +// Helper type used within interpolations to allow for repeated binding names. +// Implements the relevant traits, and exports a dummy `next()` method. +#[derive(Copy, Clone)] +pub struct RepInterp(pub T); + +impl RepInterp { + // This method is intended to look like `Iterator::next`, and is called when + // a name is bound multiple times, as the previous binding will shadow the + // original `Iterator` object. This allows us to avoid advancing the + // iterator multiple times per iteration. + pub fn next(self) -> Option { + Some(self.0) + } +} + +impl Iterator for RepInterp { + type Item = T::Item; + + fn next(&mut self) -> Option { + self.0.next() + } +} + +impl ToTokens for RepInterp { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.0.to_tokens(tokens); + } +} + +pub fn parse(tokens: &mut TokenStream, span: Span, s: &str) { + let s: TokenStream = s.parse().expect("invalid token stream"); + tokens.extend(s.into_iter().map(|mut t| { + t.set_span(span); + t + })); +} + +pub fn push_ident(tokens: &mut TokenStream, span: Span, s: &str) { + // Optimization over `mk_ident`, as `s` is guaranteed to be a valid ident. + // + // FIXME: When `Ident::new_raw` becomes stable, this method should be + // updated to call it when available. + if s.starts_with("r#") { + parse(tokens, span, s); + } else { + tokens.append(Ident::new(s, span)); + } +} + +macro_rules! push_punct { + ($name:ident $char1:tt) => { + pub fn $name(tokens: &mut TokenStream, span: Span) { + let mut punct = Punct::new($char1, Spacing::Alone); + punct.set_span(span); + tokens.append(punct); + } + }; + ($name:ident $char1:tt $char2:tt) => { + pub fn $name(tokens: &mut TokenStream, span: Span) { + let mut punct = Punct::new($char1, Spacing::Joint); + punct.set_span(span); + tokens.append(punct); + let mut punct = Punct::new($char2, Spacing::Alone); + punct.set_span(span); + tokens.append(punct); + } + }; + ($name:ident $char1:tt $char2:tt $char3:tt) => { + pub fn $name(tokens: &mut TokenStream, span: Span) { + let mut punct = Punct::new($char1, Spacing::Joint); + punct.set_span(span); + tokens.append(punct); + let mut punct = Punct::new($char2, Spacing::Joint); + punct.set_span(span); + tokens.append(punct); + let mut punct = Punct::new($char3, Spacing::Alone); + punct.set_span(span); + tokens.append(punct); + } + }; +} + +push_punct!(push_add '+'); +push_punct!(push_add_eq '+' '='); +push_punct!(push_and '&'); +push_punct!(push_and_and '&' '&'); +push_punct!(push_and_eq '&' '='); +push_punct!(push_at '@'); +push_punct!(push_bang '!'); +push_punct!(push_caret '^'); +push_punct!(push_caret_eq '^' '='); +push_punct!(push_colon ':'); +push_punct!(push_colon2 ':' ':'); +push_punct!(push_comma ','); +push_punct!(push_div '/'); +push_punct!(push_div_eq '/' '='); +push_punct!(push_dot '.'); +push_punct!(push_dot2 '.' '.'); +push_punct!(push_dot3 '.' '.' '.'); +push_punct!(push_dot_dot_eq '.' '.' '='); +push_punct!(push_eq '='); +push_punct!(push_eq_eq '=' '='); +push_punct!(push_ge '>' '='); +push_punct!(push_gt '>'); +push_punct!(push_le '<' '='); +push_punct!(push_lt '<'); +push_punct!(push_mul_eq '*' '='); +push_punct!(push_ne '!' '='); +push_punct!(push_or '|'); +push_punct!(push_or_eq '|' '='); +push_punct!(push_or_or '|' '|'); +push_punct!(push_pound '#'); +push_punct!(push_question '?'); +push_punct!(push_rarrow '-' '>'); +push_punct!(push_larrow '<' '-'); +push_punct!(push_rem '%'); +push_punct!(push_rem_eq '%' '='); +push_punct!(push_fat_arrow '=' '>'); +push_punct!(push_semi ';'); +push_punct!(push_shl '<' '<'); +push_punct!(push_shl_eq '<' '<' '='); +push_punct!(push_shr '>' '>'); +push_punct!(push_shr_eq '>' '>' '='); +push_punct!(push_star '*'); +push_punct!(push_sub '-'); +push_punct!(push_sub_eq '-' '='); + +// Helper method for constructing identifiers from the `format_ident!` macro, +// handling `r#` prefixes. +// +// Directly parsing the input string may produce a valid identifier, +// although the input string was invalid, due to ignored characters such as +// whitespace and comments. Instead, we always create a non-raw identifier +// to validate that the string is OK, and only parse again if needed. +pub fn mk_ident(id: &str, span: Option) -> Ident { + let span = span.unwrap_or_else(Span::call_site); + + let is_raw = id.starts_with("r#"); + let unraw = Ident::new(if is_raw { &id[2..] } else { id }, span); + if !is_raw { + return unraw; + } + + // At this point, the identifier is raw, and the unraw-ed version of it was + // successfully converted into an identifier. Try to produce a valid raw + // identifier by running the `TokenStream` parser, and unwrapping the first + // token as an `Ident`. + // + // FIXME: When `Ident::new_raw` becomes stable, this method should be + // updated to call it when available. + match id.parse::() { + Ok(ts) => { + let mut iter = ts.into_iter(); + match (iter.next(), iter.next()) { + (Some(TokenTree::Ident(mut id)), None) => { + id.set_span(span); + id + } + _ => unreachable!("valid raw ident fails to parse"), + } + } + Err(_) => unreachable!("valid raw ident fails to parse"), + } +} + +// Adapts from `IdentFragment` to `fmt::Display` for use by the `format_ident!` +// macro, and exposes span information from these fragments. +// +// This struct also has forwarding implementations of the formatting traits +// `Octal`, `LowerHex`, `UpperHex`, and `Binary` to allow for their use within +// `format_ident!`. +#[derive(Copy, Clone)] +pub struct IdentFragmentAdapter(pub T); + +impl IdentFragmentAdapter { + pub fn span(&self) -> Option { + self.0.span() + } +} + +impl fmt::Display for IdentFragmentAdapter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + IdentFragment::fmt(&self.0, f) + } +} + +impl fmt::Octal for IdentFragmentAdapter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Octal::fmt(&self.0, f) + } +} + +impl fmt::LowerHex for IdentFragmentAdapter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::LowerHex::fmt(&self.0, f) + } +} + +impl fmt::UpperHex for IdentFragmentAdapter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::UpperHex::fmt(&self.0, f) + } +} + +impl fmt::Binary for IdentFragmentAdapter { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Binary::fmt(&self.0, f) + } +} diff --git a/third_party/cargo/vendor/quote-1.0.6/src/spanned.rs b/third_party/cargo/vendor/quote-1.0.6/src/spanned.rs new file mode 100644 index 0000000..55168bd --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/spanned.rs @@ -0,0 +1,42 @@ +use crate::ToTokens; +use proc_macro2::{Span, TokenStream}; + +pub trait Spanned { + fn __span(&self) -> Span; +} + +impl Spanned for Span { + fn __span(&self) -> Span { + *self + } +} + +impl Spanned for T { + fn __span(&self) -> Span { + join_spans(self.into_token_stream()) + } +} + +fn join_spans(tokens: TokenStream) -> Span { + let mut iter = tokens.into_iter().filter_map(|tt| { + // FIXME: This shouldn't be required, since optimally spans should + // never be invalid. This filter_map can probably be removed when + // https://github.com/rust-lang/rust/issues/43081 is resolved. + let span = tt.span(); + let debug = format!("{:?}", span); + if debug.ends_with("bytes(0..0)") { + None + } else { + Some(span) + } + }); + + let first = match iter.next() { + Some(span) => span, + None => return Span::call_site(), + }; + + iter.fold(None, |_prev, next| Some(next)) + .and_then(|last| first.join(last)) + .unwrap_or(first) +} diff --git a/third_party/cargo/vendor/quote-1.0.6/src/to_tokens.rs b/third_party/cargo/vendor/quote-1.0.6/src/to_tokens.rs new file mode 100644 index 0000000..7f98083 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/src/to_tokens.rs @@ -0,0 +1,209 @@ +use super::TokenStreamExt; + +use std::borrow::Cow; +use std::iter; +use std::rc::Rc; + +use proc_macro2::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree}; + +/// Types that can be interpolated inside a `quote!` invocation. +/// +/// [`quote!`]: macro.quote.html +pub trait ToTokens { + /// Write `self` to the given `TokenStream`. + /// + /// The token append methods provided by the [`TokenStreamExt`] extension + /// trait may be useful for implementing `ToTokens`. + /// + /// [`TokenStreamExt`]: trait.TokenStreamExt.html + /// + /// # Example + /// + /// Example implementation for a struct representing Rust paths like + /// `std::cmp::PartialEq`: + /// + /// ``` + /// use proc_macro2::{TokenTree, Spacing, Span, Punct, TokenStream}; + /// use quote::{TokenStreamExt, ToTokens}; + /// + /// pub struct Path { + /// pub global: bool, + /// pub segments: Vec, + /// } + /// + /// impl ToTokens for Path { + /// fn to_tokens(&self, tokens: &mut TokenStream) { + /// for (i, segment) in self.segments.iter().enumerate() { + /// if i > 0 || self.global { + /// // Double colon `::` + /// tokens.append(Punct::new(':', Spacing::Joint)); + /// tokens.append(Punct::new(':', Spacing::Alone)); + /// } + /// segment.to_tokens(tokens); + /// } + /// } + /// } + /// # + /// # pub struct PathSegment; + /// # + /// # impl ToTokens for PathSegment { + /// # fn to_tokens(&self, tokens: &mut TokenStream) { + /// # unimplemented!() + /// # } + /// # } + /// ``` + fn to_tokens(&self, tokens: &mut TokenStream); + + /// Convert `self` directly into a `TokenStream` object. + /// + /// This method is implicitly implemented using `to_tokens`, and acts as a + /// convenience method for consumers of the `ToTokens` trait. + fn to_token_stream(&self) -> TokenStream { + let mut tokens = TokenStream::new(); + self.to_tokens(&mut tokens); + tokens + } + + /// Convert `self` directly into a `TokenStream` object. + /// + /// This method is implicitly implemented using `to_tokens`, and acts as a + /// convenience method for consumers of the `ToTokens` trait. + fn into_token_stream(self) -> TokenStream + where + Self: Sized, + { + self.to_token_stream() + } +} + +impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T { + fn to_tokens(&self, tokens: &mut TokenStream) { + (**self).to_tokens(tokens); + } +} + +impl<'a, T: ?Sized + ToTokens> ToTokens for &'a mut T { + fn to_tokens(&self, tokens: &mut TokenStream) { + (**self).to_tokens(tokens); + } +} + +impl<'a, T: ?Sized + ToOwned + ToTokens> ToTokens for Cow<'a, T> { + fn to_tokens(&self, tokens: &mut TokenStream) { + (**self).to_tokens(tokens); + } +} + +impl ToTokens for Box { + fn to_tokens(&self, tokens: &mut TokenStream) { + (**self).to_tokens(tokens); + } +} + +impl ToTokens for Rc { + fn to_tokens(&self, tokens: &mut TokenStream) { + (**self).to_tokens(tokens); + } +} + +impl ToTokens for Option { + fn to_tokens(&self, tokens: &mut TokenStream) { + if let Some(ref t) = *self { + t.to_tokens(tokens); + } + } +} + +impl ToTokens for str { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(Literal::string(self)); + } +} + +impl ToTokens for String { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.as_str().to_tokens(tokens); + } +} + +macro_rules! primitive { + ($($t:ident => $name:ident)*) => ($( + impl ToTokens for $t { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(Literal::$name(*self)); + } + } + )*) +} + +primitive! { + i8 => i8_suffixed + i16 => i16_suffixed + i32 => i32_suffixed + i64 => i64_suffixed + i128 => i128_suffixed + isize => isize_suffixed + + u8 => u8_suffixed + u16 => u16_suffixed + u32 => u32_suffixed + u64 => u64_suffixed + u128 => u128_suffixed + usize => usize_suffixed + + f32 => f32_suffixed + f64 => f64_suffixed +} + +impl ToTokens for char { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(Literal::character(*self)); + } +} + +impl ToTokens for bool { + fn to_tokens(&self, tokens: &mut TokenStream) { + let word = if *self { "true" } else { "false" }; + tokens.append(Ident::new(word, Span::call_site())); + } +} + +impl ToTokens for Group { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(self.clone()); + } +} + +impl ToTokens for Ident { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(self.clone()); + } +} + +impl ToTokens for Punct { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(self.clone()); + } +} + +impl ToTokens for Literal { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(self.clone()); + } +} + +impl ToTokens for TokenTree { + fn to_tokens(&self, dst: &mut TokenStream) { + dst.append(self.clone()); + } +} + +impl ToTokens for TokenStream { + fn to_tokens(&self, dst: &mut TokenStream) { + dst.extend(iter::once(self.clone())); + } + + fn into_token_stream(self) -> TokenStream { + self + } +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/compiletest.rs b/third_party/cargo/vendor/quote-1.0.6/tests/compiletest.rs new file mode 100644 index 0000000..f9aea23 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/compiletest.rs @@ -0,0 +1,6 @@ +#[rustversion::attr(not(nightly), ignore)] +#[test] +fn ui() { + let t = trybuild::TestCases::new(); + t.compile_fail("tests/ui/*.rs"); +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/test.rs b/third_party/cargo/vendor/quote-1.0.6/tests/test.rs new file mode 100644 index 0000000..df857fd --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/test.rs @@ -0,0 +1,437 @@ +#![cfg_attr(feature = "cargo-clippy", allow(blacklisted_name))] + +use std::borrow::Cow; +use std::collections::BTreeSet; + +use proc_macro2::{Ident, Span, TokenStream}; +use quote::{format_ident, quote, TokenStreamExt}; + +struct X; + +impl quote::ToTokens for X { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append(Ident::new("X", Span::call_site())); + } +} + +#[test] +fn test_quote_impl() { + let tokens = quote! { + impl<'a, T: ToTokens> ToTokens for &'a T { + fn to_tokens(&self, tokens: &mut TokenStream) { + (**self).to_tokens(tokens) + } + } + }; + + let expected = concat!( + "impl < 'a , T : ToTokens > ToTokens for & 'a T { ", + "fn to_tokens ( & self , tokens : & mut TokenStream ) { ", + "( * * self ) . to_tokens ( tokens ) ", + "} ", + "}" + ); + + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_substitution() { + let x = X; + let tokens = quote!(#x <#x> (#x) [#x] {#x}); + + let expected = "X < X > ( X ) [ X ] { X }"; + + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_iter() { + let primes = &[X, X, X, X]; + + assert_eq!("X X X X", quote!(#(#primes)*).to_string()); + + assert_eq!("X , X , X , X ,", quote!(#(#primes,)*).to_string()); + + assert_eq!("X , X , X , X", quote!(#(#primes),*).to_string()); +} + +#[test] +fn test_advanced() { + let generics = quote!( <'a, T> ); + + let where_clause = quote!( where T: Serialize ); + + let field_ty = quote!(String); + + let item_ty = quote!(Cow<'a, str>); + + let path = quote!(SomeTrait::serialize_with); + + let value = quote!(self.x); + + let tokens = quote! { + struct SerializeWith #generics #where_clause { + value: &'a #field_ty, + phantom: ::std::marker::PhantomData<#item_ty>, + } + + impl #generics ::serde::Serialize for SerializeWith #generics #where_clause { + fn serialize(&self, s: &mut S) -> Result<(), S::Error> + where S: ::serde::Serializer + { + #path(self.value, s) + } + } + + SerializeWith { + value: #value, + phantom: ::std::marker::PhantomData::<#item_ty>, + } + }; + + let expected = concat!( + "struct SerializeWith < 'a , T > where T : Serialize { ", + "value : & 'a String , ", + "phantom : :: std :: marker :: PhantomData < Cow < 'a , str > > , ", + "} ", + "impl < 'a , T > :: serde :: Serialize for SerializeWith < 'a , T > where T : Serialize { ", + "fn serialize < S > ( & self , s : & mut S ) -> Result < ( ) , S :: Error > ", + "where S : :: serde :: Serializer ", + "{ ", + "SomeTrait :: serialize_with ( self . value , s ) ", + "} ", + "} ", + "SerializeWith { ", + "value : self . x , ", + "phantom : :: std :: marker :: PhantomData :: < Cow < 'a , str > > , ", + "}" + ); + + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_integer() { + let ii8 = -1i8; + let ii16 = -1i16; + let ii32 = -1i32; + let ii64 = -1i64; + let ii128 = -1i128; + let iisize = -1isize; + let uu8 = 1u8; + let uu16 = 1u16; + let uu32 = 1u32; + let uu64 = 1u64; + let uu128 = 1u128; + let uusize = 1usize; + + let tokens = quote! { + #ii8 #ii16 #ii32 #ii64 #ii128 #iisize + #uu8 #uu16 #uu32 #uu64 #uu128 #uusize + }; + let expected = "-1i8 -1i16 -1i32 -1i64 -1i128 -1isize 1u8 1u16 1u32 1u64 1u128 1usize"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_floating() { + let e32 = 2.345f32; + + let e64 = 2.345f64; + + let tokens = quote! { + #e32 + #e64 + }; + let expected = concat!("2.345f32 2.345f64"); + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_char() { + let zero = '\0'; + let pound = '#'; + let quote = '"'; + let apost = '\''; + let newline = '\n'; + let heart = '\u{2764}'; + + let tokens = quote! { + #zero #pound #quote #apost #newline #heart + }; + let expected = "'\\u{0}' '#' '\"' '\\'' '\\n' '\u{2764}'"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_str() { + let s = "\0 a 'b \" c"; + let tokens = quote!(#s); + let expected = "\"\\u{0} a 'b \\\" c\""; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_string() { + let s = "\0 a 'b \" c".to_string(); + let tokens = quote!(#s); + let expected = "\"\\u{0} a 'b \\\" c\""; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_ident() { + let foo = Ident::new("Foo", Span::call_site()); + let bar = Ident::new(&format!("Bar{}", 7), Span::call_site()); + let tokens = quote!(struct #foo; enum #bar {}); + let expected = "struct Foo ; enum Bar7 { }"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_duplicate() { + let ch = 'x'; + + let tokens = quote!(#ch #ch); + + let expected = "'x' 'x'"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_fancy_repetition() { + let foo = vec!["a", "b"]; + let bar = vec![true, false]; + + let tokens = quote! { + #(#foo: #bar),* + }; + + let expected = r#""a" : true , "b" : false"#; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_nested_fancy_repetition() { + let nested = vec![vec!['a', 'b', 'c'], vec!['x', 'y', 'z']]; + + let tokens = quote! { + #( + #(#nested)* + ),* + }; + + let expected = "'a' 'b' 'c' , 'x' 'y' 'z'"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_duplicate_name_repetition() { + let foo = &["a", "b"]; + + let tokens = quote! { + #(#foo: #foo),* + #(#foo: #foo),* + }; + + let expected = r#""a" : "a" , "b" : "b" "a" : "a" , "b" : "b""#; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_duplicate_name_repetition_no_copy() { + let foo = vec!["a".to_owned(), "b".to_owned()]; + + let tokens = quote! { + #(#foo: #foo),* + }; + + let expected = r#""a" : "a" , "b" : "b""#; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_btreeset_repetition() { + let mut set = BTreeSet::new(); + set.insert("a".to_owned()); + set.insert("b".to_owned()); + + let tokens = quote! { + #(#set: #set),* + }; + + let expected = r#""a" : "a" , "b" : "b""#; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_variable_name_conflict() { + // The implementation of `#(...),*` uses the variable `_i` but it should be + // fine, if a little confusing when debugging. + let _i = vec!['a', 'b']; + let tokens = quote! { #(#_i),* }; + let expected = "'a' , 'b'"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_nonrep_in_repetition() { + let rep = vec!["a", "b"]; + let nonrep = "c"; + + let tokens = quote! { + #(#rep #rep : #nonrep #nonrep),* + }; + + let expected = r#""a" "a" : "c" "c" , "b" "b" : "c" "c""#; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_empty_quote() { + let tokens = quote!(); + assert_eq!("", tokens.to_string()); +} + +#[test] +fn test_box_str() { + let b = "str".to_owned().into_boxed_str(); + let tokens = quote! { #b }; + assert_eq!("\"str\"", tokens.to_string()); +} + +#[test] +fn test_cow() { + let owned: Cow = Cow::Owned(Ident::new("owned", Span::call_site())); + + let ident = Ident::new("borrowed", Span::call_site()); + let borrowed = Cow::Borrowed(&ident); + + let tokens = quote! { #owned #borrowed }; + assert_eq!("owned borrowed", tokens.to_string()); +} + +#[test] +fn test_closure() { + fn field_i(i: usize) -> Ident { + format_ident!("__field{}", i) + } + + let fields = (0usize..3) + .map(field_i as fn(_) -> _) + .map(|var| quote! { #var }); + + let tokens = quote! { #(#fields)* }; + assert_eq!("__field0 __field1 __field2", tokens.to_string()); +} + +#[test] +fn test_append_tokens() { + let mut a = quote!(a); + let b = quote!(b); + a.append_all(b); + assert_eq!("a b", a.to_string()); +} + +#[test] +fn test_format_ident() { + let id0 = format_ident!("Aa"); + let id1 = format_ident!("Hello{x}", x = id0); + let id2 = format_ident!("Hello{x}", x = 5usize); + let id3 = format_ident!("Hello{}_{x}", id0, x = 10usize); + let id4 = format_ident!("Aa", span = Span::call_site()); + let id5 = format_ident!("Hello{}", Cow::Borrowed("World")); + + assert_eq!(id0, "Aa"); + assert_eq!(id1, "HelloAa"); + assert_eq!(id2, "Hello5"); + assert_eq!(id3, "HelloAa_10"); + assert_eq!(id4, "Aa"); + assert_eq!(id5, "HelloWorld"); +} + +#[test] +fn test_format_ident_strip_raw() { + let id = format_ident!("r#struct"); + let my_id = format_ident!("MyId{}", id); + let raw_my_id = format_ident!("r#MyId{}", id); + + assert_eq!(id, "r#struct"); + assert_eq!(my_id, "MyIdstruct"); + assert_eq!(raw_my_id, "r#MyIdstruct"); +} + +#[test] +fn test_outer_line_comment() { + let tokens = quote! { + /// doc + }; + let expected = "# [ doc = r\" doc\" ]"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_inner_line_comment() { + let tokens = quote! { + //! doc + }; + let expected = "# ! [ doc = r\" doc\" ]"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_outer_block_comment() { + let tokens = quote! { + /** doc */ + }; + let expected = "# [ doc = r\" doc \" ]"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_inner_block_comment() { + let tokens = quote! { + /*! doc */ + }; + let expected = "# ! [ doc = r\" doc \" ]"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_outer_attr() { + let tokens = quote! { + #[inline] + }; + let expected = "# [ inline ]"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_inner_attr() { + let tokens = quote! { + #![no_std] + }; + let expected = "# ! [ no_std ]"; + assert_eq!(expected, tokens.to_string()); +} + +// https://github.com/dtolnay/quote/issues/130 +#[test] +fn test_star_after_repetition() { + let c = vec!['0', '1']; + let tokens = quote! { + #( + f(#c); + )* + *out = None; + }; + let expected = "f ( '0' ) ; f ( '1' ) ; * out = None ;"; + assert_eq!(expected, tokens.to_string()); +} + +#[test] +fn test_quote_raw_id() { + let id = quote!(r#raw_id); + assert_eq!(id.to_string(), "r#raw_id"); +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated-dup.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated-dup.rs new file mode 100644 index 0000000..0a39f41 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated-dup.rs @@ -0,0 +1,9 @@ +use quote::quote; + +fn main() { + let nonrep = ""; + + // Without some protection against repetitions with no iterator somewhere + // inside, this would loop infinitely. + quote!(#(#nonrep #nonrep)*); +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated.rs new file mode 100644 index 0000000..2c740cc --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-interpolated.rs @@ -0,0 +1,9 @@ +use quote::quote; + +fn main() { + let nonrep = ""; + + // Without some protection against repetitions with no iterator somewhere + // inside, this would loop infinitely. + quote!(#(#nonrep)*); +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-separated.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-separated.rs new file mode 100644 index 0000000..c027243 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter-separated.rs @@ -0,0 +1,5 @@ +use quote::quote; + +fn main() { + quote!(#(a b),*); +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter.rs new file mode 100644 index 0000000..8908353 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/does-not-have-iter.rs @@ -0,0 +1,5 @@ +use quote::quote; + +fn main() { + quote!(#(a b)*); +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/not-quotable.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/not-quotable.rs new file mode 100644 index 0000000..f991c18 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/not-quotable.rs @@ -0,0 +1,7 @@ +use quote::quote; +use std::net::Ipv4Addr; + +fn main() { + let ip = Ipv4Addr::LOCALHOST; + let _ = quote! { #ip }; +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/not-repeatable.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/not-repeatable.rs new file mode 100644 index 0000000..ff18060 --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/not-repeatable.rs @@ -0,0 +1,7 @@ +use quote::quote; +use std::net::Ipv4Addr; + +fn main() { + let ip = Ipv4Addr::LOCALHOST; + let _ = quote! { #(#ip)* }; +} diff --git a/third_party/cargo/vendor/quote-1.0.6/tests/ui/wrong-type-span.rs b/third_party/cargo/vendor/quote-1.0.6/tests/ui/wrong-type-span.rs new file mode 100644 index 0000000..1ce391c --- /dev/null +++ b/third_party/cargo/vendor/quote-1.0.6/tests/ui/wrong-type-span.rs @@ -0,0 +1,7 @@ +use quote::quote_spanned; + +fn main() { + let span = ""; + let x = 0; + quote_spanned!(span=> #x); +} diff --git a/third_party/cargo/vendor/rand-0.6.5/BUILD b/third_party/cargo/vendor/rand-0.6.5/BUILD index 4ebc98f..439822d 100644 --- a/third_party/cargo/vendor/rand-0.6.5/BUILD +++ b/third_party/cargo/vendor/rand-0.6.5/BUILD @@ -37,7 +37,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/rand_chacha-0.1.1:rand_chacha", "//third_party/cargo/vendor/rand_core-0.4.2:rand_core", "//third_party/cargo/vendor/rand_hc-0.1.0:rand_hc", diff --git a/third_party/cargo/vendor/rand_os-0.1.3/BUILD b/third_party/cargo/vendor/rand_os-0.1.3/BUILD index f46eb2a..4e76ae8 100644 --- a/third_party/cargo/vendor/rand_os-0.1.3/BUILD +++ b/third_party/cargo/vendor/rand_os-0.1.3/BUILD @@ -32,7 +32,7 @@ rust_library( edition = "2015", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", "//third_party/cargo/vendor/rand_core-0.4.2:rand_core", ], rustc_flags = [ diff --git a/third_party/cargo/vendor/raw-window-handle-0.3.3/BUILD b/third_party/cargo/vendor/raw-window-handle-0.3.3/BUILD index 26ae4a5..021db17 100644 --- a/third_party/cargo/vendor/raw-window-handle-0.3.3/BUILD +++ b/third_party/cargo/vendor/raw-window-handle-0.3.3/BUILD @@ -31,7 +31,7 @@ rust_library( edition = "2018", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/rayon-core-1.7.0/BUILD b/third_party/cargo/vendor/rayon-core-1.7.0/BUILD index 86f8709..1c95529 100644 --- a/third_party/cargo/vendor/rayon-core-1.7.0/BUILD +++ b/third_party/cargo/vendor/rayon-core-1.7.0/BUILD @@ -35,10 +35,10 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/crossbeam-deque-0.7.3:crossbeam_deque", - "//third_party/cargo/vendor/crossbeam-queue-0.2.1:crossbeam_queue", + "//third_party/cargo/vendor/crossbeam-queue-0.2.2:crossbeam_queue", "//third_party/cargo/vendor/crossbeam-utils-0.7.2:crossbeam_utils", "//third_party/cargo/vendor/lazy_static-1.4.0:lazy_static", - "//third_party/cargo/vendor/num_cpus-1.12.0:num_cpus", + "//third_party/cargo/vendor/num_cpus-1.13.0:num_cpus", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/regex-1.3.5/.cargo-checksum.json b/third_party/cargo/vendor/regex-1.3.9/.cargo-checksum.json similarity index 83% rename from third_party/cargo/vendor/regex-1.3.5/.cargo-checksum.json rename to third_party/cargo/vendor/regex-1.3.9/.cargo-checksum.json index d94a4ec..cc003df 100644 --- a/third_party/cargo/vendor/regex-1.3.5/.cargo-checksum.json +++ b/third_party/cargo/vendor/regex-1.3.9/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"8849b94653138598c5d6862146b5baa2e1290191df2e94d545e22418298a9802","Cargo.lock":"af0a01507094ca8807cdb22fece3a12c583aa6b732b232cf6c5fec69c3324c86","Cargo.toml":"5a7bac9e9bb6b93317c45335b4ed43d5a29d6d1622747b083c01b62acc3f1621","HACKING.md":"17818f7a17723608f6bdbe6388ad0a913d4f96f76a16649aaf4e274b1fa0ea97","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","PERFORMANCE.md":"c776b18758b6dc8f2f9d37e9a95261f75c5f744925e8ddf216b83953bf7467b7","README.md":"ea639f8259ae4ff721ea3792d3d0529975e7d5ca80d67d0a27bd82ef464f5d0a","UNICODE.md":"27be97e94d0819ae18ae71029559c3de21c8ffd343d4a791959d0fc22b06dfe6","examples/regexdna-input.txt":"156a49710bb3e1ed4bc2bbb0af0f383b747b3d0281453cfff39c296124c598f8","examples/regexdna-output.txt":"35e85b19b70a893d752fd43e54e1e9da08bac43559191cea85b33387c24c4cc1","examples/shootout-regex-dna-bytes.rs":"e4f0d94e6d9cd4c7f6e340ed51b163f3331ce616dba4539d09f40919548d81d3","examples/shootout-regex-dna-cheat.rs":"bd5f4832c9a2e6f175d79064b2c4ee28dcae4b971f9618586664f99963bd0f8e","examples/shootout-regex-dna-replace.rs":"056e9ee51327a1cf9bd1da007e8c0af9c80a3e7fc2b3a3f63d0cf1b6b244ac74","examples/shootout-regex-dna-single-cheat.rs":"0beeb210972597db3a5c41901c78d78635681a833eba059064b28902e41d6f86","examples/shootout-regex-dna-single.rs":"a5d1ad8ebcfe9dd58bddc0d1ad838112cbce780f8f93c46892a70a1e25fd7c7f","examples/shootout-regex-dna.rs":"7724deec3d94cc5b55077380f7b9664edb5a49eaaa4cc7ba8356579c2ade7129","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/backtrack.rs":"bb24a32bc0d2f2f1c94439d8d0879ad8d15c910d4b9ab86c2833d93945cb088c","src/cache.rs":"df7b83b4f7278705ad1ecdf1284b962cc3b145797f1676c9a59e32c5944c848c","src/compile.rs":"a582b97efaf0fedca0b116c3124e067f2b28ff9b0e6240c905359cd7d5d8f5e9","src/dfa.rs":"69cd7ec8e766f4c7f056a4525aa28d102068f68d03da1d0e6aa98d40fe5c7d44","src/error.rs":"4d03ca3205e373125a0c9a4270fc1c5aa7b5a661b11db3508b563945a0827301","src/exec.rs":"a27ed0cb907dab6540fdf8cc785c799d7ea17f15f1236b80341934586874cd58","src/expand.rs":"f34190d84ea59b7aee07ad2e3c9b09a3fdeef29b5e99443223397402cc68a6b4","src/find_byte.rs":"b387247b77e3269f057c3399aefe5a815032c3af918c876f80eb4b282e4eb95e","src/freqs.rs":"255555f3d95b08a5bb3bc2f38d5a06cc100a39c0f0127fe4f50c33afa1cadc65","src/input.rs":"0bb20717cb630803f78b921260c96984a38a57685f07d9aee16b12deaa1d233b","src/lib.rs":"58290928047bdd668b335cee0fe2bd1ae6213192cedc7f4cd1d07bda850c92e7","src/literal/imp.rs":"f242b29261423342e8cd941bdeb26b95eed73357fc313f8a019032374b77e056","src/literal/mod.rs":"46739643baa0cd5d1b8fc4521df3d727815c61e583af2ffca8b7b63bad3fa50e","src/pattern.rs":"e6124b403c18344675aa341faf9ae2f592193ef89f1c4a5e1cee135b8b34dd21","src/pikevm.rs":"1de81a5e785167d63a0a53e339c85b31ed323ac88d8ef117d57b03082b83175f","src/prog.rs":"f47ac3accf7bd3456bd20902c6315f4063bbb6d9570c9b2f8309a0a1566d6323","src/re_builder.rs":"3ee35fa798c824be941c03e40e5dbeef47c96c2d19aeac2e2f7ca59727ff213b","src/re_bytes.rs":"68cac90eda08b9eda8068b3fe9cd3dbbc87673b415850fd5b8c76bc4b2d2dfe6","src/re_set.rs":"b8abdd3bab254ad53a74d114feec8f7a728ef03c3b213b02efd863649e1fb92a","src/re_trait.rs":"ad63982bf34cde29038be8c9113e0681f49df455eac3de36e2d3a8a974d59048","src/re_unicode.rs":"106c86f116e1c8db77efebf4d727822e16448fa45911c8e0c071485522246ab3","src/sparse.rs":"55db5a233eb266a1d4ffc611529d90e99369282854e9153ed39d7b650573295f","src/testdata/LICENSE":"58cf078acc03da3e280a938c2bd9943f554fc9b6ced89ad93ba35ca436872899","src/testdata/README":"45f869e37f798905c773bfbe0ef19a5fb7e585cbf0b7c21b5b5a784e8cec3c14","src/testdata/basic.dat":"b5b33aa89d48a61cd67cb1fbfd8f70e62c83e30b86256f9f915a5190dd38ff06","src/testdata/nullsubexpr.dat":"496ac0278eec3b6d9170faace14554569032dd3d909618364d9326156de39ecf","src/testdata/repetition.dat":"1f7959063015b284b18a4a2c1c8b416d438a2d6c4b1a362da43406b865f50e69","src/utf8.rs":"708615a4859110cc9766b342a9c1da6c5c4a8a04ad239046b2725385db977efe","test":"bd7ca64a788d1f622ae10c5ac77160b10fc5f0d6adb7f3ba1828637f0ca68c81","tests/api.rs":"f814376a0fdc79a95d915137ba0d80e85a6b25d253870d4b9ca4e1d9ae90f317","tests/api_str.rs":"2ae38c04e7e8fac008b609a820d0b1561ba75f39b0edc0987d6d3d06132da77f","tests/bytes.rs":"edc50f526c5fee43df89d639ef18b237e4eb91e9d533bfc43f3cbab7417d38ba","tests/consistent.rs":"8dadc60727306de8a539325d1d2af84172e5da2cbf50a71bb0c53eafe8039912","tests/crates_regex.rs":"91a59d470e0700b4bcb3ff735d06799f3107b8ef4875a2e9904607b164be0326","tests/crazy.rs":"5f1e925ed35ffa0b3c7e3bde691a7ae7ca75133a8956f5cab4ece01de1ba28b5","tests/flags.rs":"05caace2c81a99d2168037f3a38035d4dffe9f85ef3ebd7ef18b1bc6612f1ea8","tests/fowler.rs":"d78cf914de40b1e125cc92b65ccb444d462586bd07b5e05de4e4a1b5de16aa76","tests/macros.rs":"6db70c16fc90df13e6b30d2b606f8b6dd4dc976697967f6ee001b15aab6d0b19","tests/macros_bytes.rs":"73e2979f60acb009066c3a9a6c5809a0069a60c67fff7db675ea4e59299a7292","tests/macros_str.rs":"4c79ff4f2f5c379503794dd7e4116b3e7d4ac7679e47b81959fa054110a76c1a","tests/misc.rs":"395f52793fa022e4cdda78675b6a6fba1a3106b4b99c834c39f7801574054bd1","tests/multiline.rs":"1b1a3326ed976437c1357f01d81833ece7ea244f38826246eab55cacd5d0862a","tests/noparse.rs":"8850d31cb95e413e3a67edecce8590cd158f49779abcc2e5722381113346179c","tests/regression.rs":"3c161730ab9f57030e1954377245e7c7ff4661c6458ffd2a07a0ec1ceed5ab33","tests/replace.rs":"fb3dd97c2877b71973065a74916cdef40d65a19a92c1ecfc117edfcd9eab3ced","tests/searcher.rs":"ce35e47b0a276a7e8c9060c6a0b225ffba163aebc61fbc15555a6897fa0e552c","tests/set.rs":"cc1c5431d81b43eb7d89bf786d32657c32d7c73098c1df7dc998416c81b84591","tests/shortest_match.rs":"a2c94390c0d61bc24796b4c1288c924e90c8c9c6156fdebb858175177a194a42","tests/suffix_reverse.rs":"b95f89397404871227d9efe6df23b9ded147f183db81597e608f693955c668b5","tests/test_backtrack.rs":"1e286679d643887f7b78ef5a74f5392ff27fa462b99891ce31938db1eacb3842","tests/test_backtrack_bytes.rs":"f66f2ed407795e92ae66eaa3b4b946acfe00d9ea422944c86353dd28812df5bb","tests/test_backtrack_utf8bytes.rs":"9d8c236fbdfa5092230f19ca4d2a7d647f68811d9ffa0813899d924e11d8fc0b","tests/test_crates_regex.rs":"b385d7ca10ed308b8d57074adb9525e18d3faadb5aa883e831dfa4f6669ba58d","tests/test_default.rs":"ea1049e7bc9e40fb0da31a584aeb7f0e2b5dfd61ad10fb58184de2bd44b542cd","tests/test_default_bytes.rs":"fb3310fc315f7282358dcd98d156c31d66ca2432199afe012cf8921f459167a2","tests/test_nfa.rs":"97266c5edb15e5cde1496049a3ad0be4de33352dc32492f086d5351411ebe1ab","tests/test_nfa_bytes.rs":"9aa510e9583f847467c26ce902bd7e1c66cdd610cd50da4a1c1379afa35d4a53","tests/test_nfa_utf8bytes.rs":"2c22e16fa75edb5dbd278f2b8619404404a95b0792b31c440c9751c4aa2f7086","tests/unicode.rs":"7127b140a00cdcc46b57a59139d13bda57675a55a6604bcd10e134c32e84fa52","tests/word_boundary.rs":"7081317ddcec1e82dd4a2090a571c6abf2ff4bbfa8cd10395e1eb3f386157fae","tests/word_boundary_ascii.rs":"cd0be5b5b485de0ba7994b42e2864585556c3d2d8bf5eab05b58931d9aaf4b87","tests/word_boundary_unicode.rs":"75dbcc35d3abc0f9795c2ea99e216dc227b0a5b58e9ca5eef767815ff0513921"},"package":"8900ebc1363efa7ea1c399ccc32daed870b4002651e0bed86e72d501ebbe0048"} \ No newline at end of file +{"files":{"CHANGELOG.md":"dd3250b8611a5dcad2d5ef7d783ab5b91aaf4436edeab99e44e9fce1a892f254","Cargo.lock":"8f6159cd8fb6968fb1fbeae34cbf2c53f4809bc417d06f3e10e88d50aa012229","Cargo.toml":"78157b8d191ee0bc31e74fa7037e52b04fd24a16242aba5e7307d79947bb141a","HACKING.md":"17818f7a17723608f6bdbe6388ad0a913d4f96f76a16649aaf4e274b1fa0ea97","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","PERFORMANCE.md":"c776b18758b6dc8f2f9d37e9a95261f75c5f744925e8ddf216b83953bf7467b7","README.md":"ea639f8259ae4ff721ea3792d3d0529975e7d5ca80d67d0a27bd82ef464f5d0a","UNICODE.md":"27be97e94d0819ae18ae71029559c3de21c8ffd343d4a791959d0fc22b06dfe6","examples/regexdna-input.txt":"156a49710bb3e1ed4bc2bbb0af0f383b747b3d0281453cfff39c296124c598f8","examples/regexdna-output.txt":"35e85b19b70a893d752fd43e54e1e9da08bac43559191cea85b33387c24c4cc1","examples/shootout-regex-dna-bytes.rs":"e4f0d94e6d9cd4c7f6e340ed51b163f3331ce616dba4539d09f40919548d81d3","examples/shootout-regex-dna-cheat.rs":"bd5f4832c9a2e6f175d79064b2c4ee28dcae4b971f9618586664f99963bd0f8e","examples/shootout-regex-dna-replace.rs":"056e9ee51327a1cf9bd1da007e8c0af9c80a3e7fc2b3a3f63d0cf1b6b244ac74","examples/shootout-regex-dna-single-cheat.rs":"0beeb210972597db3a5c41901c78d78635681a833eba059064b28902e41d6f86","examples/shootout-regex-dna-single.rs":"a5d1ad8ebcfe9dd58bddc0d1ad838112cbce780f8f93c46892a70a1e25fd7c7f","examples/shootout-regex-dna.rs":"7724deec3d94cc5b55077380f7b9664edb5a49eaaa4cc7ba8356579c2ade7129","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/backtrack.rs":"bb24a32bc0d2f2f1c94439d8d0879ad8d15c910d4b9ab86c2833d93945cb088c","src/cache.rs":"df7b83b4f7278705ad1ecdf1284b962cc3b145797f1676c9a59e32c5944c848c","src/compile.rs":"aae711d091b3f35b30bae17674ec5dd65d716cd3634756122f0b7b252fb304b3","src/dfa.rs":"69cd7ec8e766f4c7f056a4525aa28d102068f68d03da1d0e6aa98d40fe5c7d44","src/error.rs":"4d03ca3205e373125a0c9a4270fc1c5aa7b5a661b11db3508b563945a0827301","src/exec.rs":"a27ed0cb907dab6540fdf8cc785c799d7ea17f15f1236b80341934586874cd58","src/expand.rs":"f34190d84ea59b7aee07ad2e3c9b09a3fdeef29b5e99443223397402cc68a6b4","src/find_byte.rs":"b387247b77e3269f057c3399aefe5a815032c3af918c876f80eb4b282e4eb95e","src/freqs.rs":"255555f3d95b08a5bb3bc2f38d5a06cc100a39c0f0127fe4f50c33afa1cadc65","src/input.rs":"0bb20717cb630803f78b921260c96984a38a57685f07d9aee16b12deaa1d233b","src/lib.rs":"a358badc302ced5f67dcf739aea7fa8a012c93b1d75e9ca574c9301b9efe81e1","src/literal/imp.rs":"f242b29261423342e8cd941bdeb26b95eed73357fc313f8a019032374b77e056","src/literal/mod.rs":"46739643baa0cd5d1b8fc4521df3d727815c61e583af2ffca8b7b63bad3fa50e","src/pattern.rs":"e6124b403c18344675aa341faf9ae2f592193ef89f1c4a5e1cee135b8b34dd21","src/pikevm.rs":"1de81a5e785167d63a0a53e339c85b31ed323ac88d8ef117d57b03082b83175f","src/prog.rs":"f47ac3accf7bd3456bd20902c6315f4063bbb6d9570c9b2f8309a0a1566d6323","src/re_builder.rs":"3ee35fa798c824be941c03e40e5dbeef47c96c2d19aeac2e2f7ca59727ff213b","src/re_bytes.rs":"68cac90eda08b9eda8068b3fe9cd3dbbc87673b415850fd5b8c76bc4b2d2dfe6","src/re_set.rs":"b8abdd3bab254ad53a74d114feec8f7a728ef03c3b213b02efd863649e1fb92a","src/re_trait.rs":"ad63982bf34cde29038be8c9113e0681f49df455eac3de36e2d3a8a974d59048","src/re_unicode.rs":"106c86f116e1c8db77efebf4d727822e16448fa45911c8e0c071485522246ab3","src/sparse.rs":"43a0ad1c058228121523a2392bb20126b36760228845db157c8819f835e9bfde","src/testdata/LICENSE":"58cf078acc03da3e280a938c2bd9943f554fc9b6ced89ad93ba35ca436872899","src/testdata/README":"45f869e37f798905c773bfbe0ef19a5fb7e585cbf0b7c21b5b5a784e8cec3c14","src/testdata/basic.dat":"b5b33aa89d48a61cd67cb1fbfd8f70e62c83e30b86256f9f915a5190dd38ff06","src/testdata/nullsubexpr.dat":"496ac0278eec3b6d9170faace14554569032dd3d909618364d9326156de39ecf","src/testdata/repetition.dat":"1f7959063015b284b18a4a2c1c8b416d438a2d6c4b1a362da43406b865f50e69","src/utf8.rs":"708615a4859110cc9766b342a9c1da6c5c4a8a04ad239046b2725385db977efe","test":"bd7ca64a788d1f622ae10c5ac77160b10fc5f0d6adb7f3ba1828637f0ca68c81","tests/api.rs":"f814376a0fdc79a95d915137ba0d80e85a6b25d253870d4b9ca4e1d9ae90f317","tests/api_str.rs":"2ae38c04e7e8fac008b609a820d0b1561ba75f39b0edc0987d6d3d06132da77f","tests/bytes.rs":"edc50f526c5fee43df89d639ef18b237e4eb91e9d533bfc43f3cbab7417d38ba","tests/consistent.rs":"8dadc60727306de8a539325d1d2af84172e5da2cbf50a71bb0c53eafe8039912","tests/crates_regex.rs":"91a59d470e0700b4bcb3ff735d06799f3107b8ef4875a2e9904607b164be0326","tests/crazy.rs":"d18ebe88bfe0f61df2761710a5f2362187f071bc952b4c0c898e5a8bfb58cce6","tests/flags.rs":"05caace2c81a99d2168037f3a38035d4dffe9f85ef3ebd7ef18b1bc6612f1ea8","tests/fowler.rs":"d78cf914de40b1e125cc92b65ccb444d462586bd07b5e05de4e4a1b5de16aa76","tests/macros.rs":"6db70c16fc90df13e6b30d2b606f8b6dd4dc976697967f6ee001b15aab6d0b19","tests/macros_bytes.rs":"73e2979f60acb009066c3a9a6c5809a0069a60c67fff7db675ea4e59299a7292","tests/macros_str.rs":"4c79ff4f2f5c379503794dd7e4116b3e7d4ac7679e47b81959fa054110a76c1a","tests/misc.rs":"395f52793fa022e4cdda78675b6a6fba1a3106b4b99c834c39f7801574054bd1","tests/multiline.rs":"1b1a3326ed976437c1357f01d81833ece7ea244f38826246eab55cacd5d0862a","tests/noparse.rs":"12b6be0eff3d80779d33c6459396c74c0f6ebf4ddc9f1d33c3e747ea9e3bf268","tests/regression.rs":"4d4aecf57ce5accf73fe8818267e8d45c9a15896d40093a5b5e1a09007a121a1","tests/replace.rs":"fb3dd97c2877b71973065a74916cdef40d65a19a92c1ecfc117edfcd9eab3ced","tests/searcher.rs":"ce35e47b0a276a7e8c9060c6a0b225ffba163aebc61fbc15555a6897fa0e552c","tests/set.rs":"5365bea7be659f4708bdedc43e9d347f6817cc786688eea934f002c5f55525b0","tests/shortest_match.rs":"a2c94390c0d61bc24796b4c1288c924e90c8c9c6156fdebb858175177a194a42","tests/suffix_reverse.rs":"b95f89397404871227d9efe6df23b9ded147f183db81597e608f693955c668b5","tests/test_backtrack.rs":"1e286679d643887f7b78ef5a74f5392ff27fa462b99891ce31938db1eacb3842","tests/test_backtrack_bytes.rs":"f66f2ed407795e92ae66eaa3b4b946acfe00d9ea422944c86353dd28812df5bb","tests/test_backtrack_utf8bytes.rs":"9d8c236fbdfa5092230f19ca4d2a7d647f68811d9ffa0813899d924e11d8fc0b","tests/test_crates_regex.rs":"b385d7ca10ed308b8d57074adb9525e18d3faadb5aa883e831dfa4f6669ba58d","tests/test_default.rs":"ea1049e7bc9e40fb0da31a584aeb7f0e2b5dfd61ad10fb58184de2bd44b542cd","tests/test_default_bytes.rs":"fb3310fc315f7282358dcd98d156c31d66ca2432199afe012cf8921f459167a2","tests/test_nfa.rs":"97266c5edb15e5cde1496049a3ad0be4de33352dc32492f086d5351411ebe1ab","tests/test_nfa_bytes.rs":"9aa510e9583f847467c26ce902bd7e1c66cdd610cd50da4a1c1379afa35d4a53","tests/test_nfa_utf8bytes.rs":"2c22e16fa75edb5dbd278f2b8619404404a95b0792b31c440c9751c4aa2f7086","tests/unicode.rs":"7127b140a00cdcc46b57a59139d13bda57675a55a6604bcd10e134c32e84fa52","tests/word_boundary.rs":"7081317ddcec1e82dd4a2090a571c6abf2ff4bbfa8cd10395e1eb3f386157fae","tests/word_boundary_ascii.rs":"cd0be5b5b485de0ba7994b42e2864585556c3d2d8bf5eab05b58931d9aaf4b87","tests/word_boundary_unicode.rs":"75dbcc35d3abc0f9795c2ea99e216dc227b0a5b58e9ca5eef767815ff0513921"},"package":"9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6"} \ No newline at end of file diff --git a/third_party/cargo/vendor/regex-1.3.5/BUILD b/third_party/cargo/vendor/regex-1.3.9/BUILD similarity index 96% rename from third_party/cargo/vendor/regex-1.3.5/BUILD rename to third_party/cargo/vendor/regex-1.3.9/BUILD index a2bb53f..1c01ea9 100644 --- a/third_party/cargo/vendor/regex-1.3.5/BUILD +++ b/third_party/cargo/vendor/regex-1.3.9/BUILD @@ -42,13 +42,13 @@ rust_library( deps = [ "//third_party/cargo/vendor/aho-corasick-0.7.10:aho_corasick", "//third_party/cargo/vendor/memchr-2.3.3:memchr", - "//third_party/cargo/vendor/regex-syntax-0.6.17:regex_syntax", + "//third_party/cargo/vendor/regex-syntax-0.6.18:regex_syntax", "//third_party/cargo/vendor/thread_local-1.0.1:thread_local", ], rustc_flags = [ "--cap-lints=allow", ], - version = "1.3.5", + version = "1.3.9", crate_features = [ "aho-corasick", "default", diff --git a/third_party/cargo/vendor/regex-1.3.5/CHANGELOG.md b/third_party/cargo/vendor/regex-1.3.9/CHANGELOG.md similarity index 94% rename from third_party/cargo/vendor/regex-1.3.5/CHANGELOG.md rename to third_party/cargo/vendor/regex-1.3.9/CHANGELOG.md index 0fc0584..c7e528d 100644 --- a/third_party/cargo/vendor/regex-1.3.5/CHANGELOG.md +++ b/third_party/cargo/vendor/regex-1.3.9/CHANGELOG.md @@ -1,3 +1,56 @@ +1.3.9 (2020-05-28) +================== +This release fixes a MSRV (Minimum Support Rust Version) regression in the +1.3.8 release. Namely, while 1.3.8 compiles on Rust 1.28, it actually does not +compile on other Rust versions, such as Rust 1.39. + +Bug fixes: + +* [BUG #685](https://github.com/rust-lang/regex/issue/685): + Remove use of `doc_comment` crate, which cannot be used before Rust 1.43. + + +1.3.8 (2020-05-28) +================== +This release contains a couple of important bug fixes driven +by better support for empty-subexpressions in regexes. For +example, regexes like `b|` are now allowed. Major thanks to +[@sliquister](https://github.com/sliquister) for implementing support for this +in [#677](https://github.com/rust-lang/regex/pull/677). + +Bug fixes: + +* [BUG #523](https://github.com/rust-lang/regex/pull/523): + Add note to documentation that spaces can be escaped in `x` mode. +* [BUG #524](https://github.com/rust-lang/regex/issue/524): + Add support for empty sub-expressions, including empty alternations. +* [BUG #659](https://github.com/rust-lang/regex/issue/659): + Fix match bug caused by an empty sub-expression miscompilation. + + +1.3.7 (2020-04-17) +================== +This release contains a small bug fix that fixes how `regex` forwards crate +features to `regex-syntax`. In particular, this will reduce recompilations in +some cases. + +Bug fixes: + +* [BUG #665](https://github.com/rust-lang/regex/pull/665): + Fix feature forwarding to `regex-syntax`. + + +1.3.6 (2020-03-24) +================== +This release contains a sizable (~30%) performance improvement when compiling +some kinds of large regular expressions. + +Performance improvements: + +* [PERF #657](https://github.com/rust-lang/regex/pull/657): + Improvement performance of compiling large regular expressions. + + 1.3.5 (2020-03-12) ================== This release updates this crate to Unicode 13. diff --git a/third_party/cargo/vendor/regex-1.3.5/Cargo.lock b/third_party/cargo/vendor/regex-1.3.9/Cargo.lock similarity index 90% rename from third_party/cargo/vendor/regex-1.3.5/Cargo.lock rename to third_party/cargo/vendor/regex-1.3.9/Cargo.lock index 12cc2d6..3b9bde6 100644 --- a/third_party/cargo/vendor/regex-1.3.5/Cargo.lock +++ b/third_party/cargo/vendor/regex-1.3.9/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "aho-corasick" -version = "0.7.7" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f56c476256dc249def911d6f7580b5fc7e875895b5d7ee88f5d602208035744" +checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" dependencies = [ "memchr", ] @@ -30,12 +30,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "doc-comment" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923dea538cea0aa3025e8685b20d6ee21ef99c4f77e954a30febbaac5ec73a97" - [[package]] name = "fuchsia-cprng" version = "0.1.1" @@ -50,15 +44,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.66" +version = "0.2.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" [[package]] name = "memchr" -version = "2.3.0" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "quickcheck" @@ -187,10 +181,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.3.5" +version = "1.3.9" dependencies = [ "aho-corasick", - "doc-comment", "lazy_static", "memchr", "quickcheck", @@ -201,9 +194,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" [[package]] name = "thread_local" diff --git a/third_party/cargo/vendor/regex-1.3.5/Cargo.toml b/third_party/cargo/vendor/regex-1.3.9/Cargo.toml similarity index 93% rename from third_party/cargo/vendor/regex-1.3.5/Cargo.toml rename to third_party/cargo/vendor/regex-1.3.9/Cargo.toml index 2deca6d..02caabb 100644 --- a/third_party/cargo/vendor/regex-1.3.5/Cargo.toml +++ b/third_party/cargo/vendor/regex-1.3.9/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "regex" -version = "1.3.5" +version = "1.3.9" authors = ["The Rust Project Developers"] exclude = ["/scripts/*", "/.github/*"] autotests = false @@ -80,15 +80,12 @@ version = "2.2.1" optional = true [dependencies.regex-syntax] -version = "0.6.17" +version = "0.6.18" default-features = false [dependencies.thread_local] version = "1" optional = true -[dev-dependencies.doc-comment] -version = "0.3" - [dev-dependencies.lazy_static] version = "1" @@ -100,7 +97,7 @@ default-features = false version = "0.6.5" [features] -default = ["std", "perf", "unicode"] +default = ["std", "perf", "unicode", "regex-syntax/default"] pattern = [] perf = ["perf-cache", "perf-dfa", "perf-inline", "perf-literal"] perf-cache = ["thread_local"] @@ -108,7 +105,7 @@ perf-dfa = [] perf-inline = [] perf-literal = ["aho-corasick", "memchr"] std = [] -unicode = ["unicode-age", "unicode-bool", "unicode-case", "unicode-gencat", "unicode-perl", "unicode-script", "unicode-segment"] +unicode = ["unicode-age", "unicode-bool", "unicode-case", "unicode-gencat", "unicode-perl", "unicode-script", "unicode-segment", "regex-syntax/unicode"] unicode-age = ["regex-syntax/unicode-age"] unicode-bool = ["regex-syntax/unicode-bool"] unicode-case = ["regex-syntax/unicode-case"] diff --git a/third_party/cargo/vendor/regex-1.3.5/HACKING.md b/third_party/cargo/vendor/regex-1.3.9/HACKING.md similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/HACKING.md rename to third_party/cargo/vendor/regex-1.3.9/HACKING.md diff --git a/third_party/cargo/vendor/smallvec-1.2.0/LICENSE-APACHE b/third_party/cargo/vendor/regex-1.3.9/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/smallvec-1.2.0/LICENSE-APACHE rename to third_party/cargo/vendor/regex-1.3.9/LICENSE-APACHE diff --git a/third_party/cargo/vendor/num-rational-0.2.3/LICENSE-MIT b/third_party/cargo/vendor/regex-1.3.9/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/num-rational-0.2.3/LICENSE-MIT rename to third_party/cargo/vendor/regex-1.3.9/LICENSE-MIT diff --git a/third_party/cargo/vendor/regex-1.3.5/PERFORMANCE.md b/third_party/cargo/vendor/regex-1.3.9/PERFORMANCE.md similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/PERFORMANCE.md rename to third_party/cargo/vendor/regex-1.3.9/PERFORMANCE.md diff --git a/third_party/cargo/vendor/regex-1.3.5/README.md b/third_party/cargo/vendor/regex-1.3.9/README.md similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/README.md rename to third_party/cargo/vendor/regex-1.3.9/README.md diff --git a/third_party/cargo/vendor/regex-1.3.5/UNICODE.md b/third_party/cargo/vendor/regex-1.3.9/UNICODE.md similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/UNICODE.md rename to third_party/cargo/vendor/regex-1.3.9/UNICODE.md diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/regexdna-input.txt b/third_party/cargo/vendor/regex-1.3.9/examples/regexdna-input.txt similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/regexdna-input.txt rename to third_party/cargo/vendor/regex-1.3.9/examples/regexdna-input.txt diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/regexdna-output.txt b/third_party/cargo/vendor/regex-1.3.9/examples/regexdna-output.txt similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/regexdna-output.txt rename to third_party/cargo/vendor/regex-1.3.9/examples/regexdna-output.txt diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-bytes.rs b/third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-cheat.rs b/third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-cheat.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-cheat.rs rename to third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-cheat.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-replace.rs b/third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-replace.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-replace.rs rename to third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-replace.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-single-cheat.rs b/third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-single-cheat.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-single-cheat.rs rename to third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-single-cheat.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-single.rs b/third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-single.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna-single.rs rename to third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna-single.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna.rs b/third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/examples/shootout-regex-dna.rs rename to third_party/cargo/vendor/regex-1.3.9/examples/shootout-regex-dna.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/rustfmt.toml b/third_party/cargo/vendor/regex-1.3.9/rustfmt.toml similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/rustfmt.toml rename to third_party/cargo/vendor/regex-1.3.9/rustfmt.toml diff --git a/third_party/cargo/vendor/regex-1.3.5/src/backtrack.rs b/third_party/cargo/vendor/regex-1.3.9/src/backtrack.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/backtrack.rs rename to third_party/cargo/vendor/regex-1.3.9/src/backtrack.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/cache.rs b/third_party/cargo/vendor/regex-1.3.9/src/cache.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/cache.rs rename to third_party/cargo/vendor/regex-1.3.9/src/cache.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/compile.rs b/third_party/cargo/vendor/regex-1.3.9/src/compile.rs similarity index 83% rename from third_party/cargo/vendor/regex-1.3.5/src/compile.rs rename to third_party/cargo/vendor/regex-1.3.9/src/compile.rs index ac706f8..ad54040 100644 --- a/third_party/cargo/vendor/regex-1.3.5/src/compile.rs +++ b/third_party/cargo/vendor/regex-1.3.9/src/compile.rs @@ -15,6 +15,7 @@ use prog::{ use Error; type Result = result::Result; +type ResultOrEmpty = result::Result, Error>; #[derive(Debug)] struct Patch { @@ -132,7 +133,7 @@ impl Compiler { self.compiled.start = dotstar_patch.entry; } self.compiled.captures = vec![None]; - let patch = self.c_capture(0, expr)?; + let patch = self.c_capture(0, expr)?.unwrap_or(self.next_inst()); if self.compiled.needs_dotstar() { self.fill(dotstar_patch.hole, patch.entry); } else { @@ -167,14 +168,16 @@ impl Compiler { for (i, expr) in exprs[0..exprs.len() - 1].iter().enumerate() { self.fill_to_next(prev_hole); let split = self.push_split_hole(); - let Patch { hole, entry } = self.c_capture(0, expr)?; + let Patch { hole, entry } = + self.c_capture(0, expr)?.unwrap_or(self.next_inst()); self.fill_to_next(hole); self.compiled.matches.push(self.insts.len()); self.push_compiled(Inst::Match(i)); prev_hole = self.fill_split(split, Some(entry), None); } let i = exprs.len() - 1; - let Patch { hole, entry } = self.c_capture(0, &exprs[i])?; + let Patch { hole, entry } = + self.c_capture(0, &exprs[i])?.unwrap_or(self.next_inst()); self.fill(prev_hole, entry); self.fill_to_next(hole); self.compiled.matches.push(self.insts.len()); @@ -242,13 +245,16 @@ impl Compiler { /// method you will see that it does exactly this, though it handles /// a list of expressions rather than just the two that we use for /// an example. - fn c(&mut self, expr: &Hir) -> Result { + /// + /// Ok(None) is returned when an expression is compiled to no + /// instruction, and so no patch.entry value makes sense. + fn c(&mut self, expr: &Hir) -> ResultOrEmpty { use prog; use syntax::hir::HirKind::*; self.check_size()?; match *expr.kind() { - Empty => Ok(Patch { hole: Hole::None, entry: self.insts.len() }), + Empty => Ok(None), Literal(hir::Literal::Unicode(c)) => self.c_char(c), Literal(hir::Literal::Byte(b)) => { assert!(self.compiled.uses_bytes()); @@ -357,7 +363,7 @@ impl Compiler { } } - fn c_capture(&mut self, first_slot: usize, expr: &Hir) -> Result { + fn c_capture(&mut self, first_slot: usize, expr: &Hir) -> ResultOrEmpty { if self.num_exprs > 1 || self.compiled.is_dfa { // Don't ever compile Save instructions for regex sets because // they are never used. They are also never used in DFA programs @@ -366,11 +372,11 @@ impl Compiler { } else { let entry = self.insts.len(); let hole = self.push_hole(InstHole::Save { slot: first_slot }); - let patch = self.c(expr)?; + let patch = self.c(expr)?.unwrap_or(self.next_inst()); self.fill(hole, patch.entry); self.fill_to_next(patch.hole); let hole = self.push_hole(InstHole::Save { slot: first_slot + 1 }); - Ok(Patch { hole: hole, entry: entry }) + Ok(Some(Patch { hole: hole, entry: entry })) } } @@ -381,23 +387,38 @@ impl Compiler { greedy: false, hir: Box::new(Hir::any(true)), }))? + .unwrap() } else { self.c(&Hir::repetition(hir::Repetition { kind: hir::RepetitionKind::ZeroOrMore, greedy: false, hir: Box::new(Hir::any(false)), }))? + .unwrap() }) } - fn c_char(&mut self, c: char) -> Result { - self.c_class(&[hir::ClassUnicodeRange::new(c, c)]) + fn c_char(&mut self, c: char) -> ResultOrEmpty { + if self.compiled.uses_bytes() { + if c.is_ascii() { + let b = c as u8; + let hole = + self.push_hole(InstHole::Bytes { start: b, end: b }); + self.byte_classes.set_range(b, b); + Ok(Some(Patch { hole, entry: self.insts.len() - 1 })) + } else { + self.c_class(&[hir::ClassUnicodeRange::new(c, c)]) + } + } else { + let hole = self.push_hole(InstHole::Char { c: c }); + Ok(Some(Patch { hole, entry: self.insts.len() - 1 })) + } } - fn c_class(&mut self, ranges: &[hir::ClassUnicodeRange]) -> Result { + fn c_class(&mut self, ranges: &[hir::ClassUnicodeRange]) -> ResultOrEmpty { assert!(!ranges.is_empty()); if self.compiled.uses_bytes() { - CompileClass { c: self, ranges: ranges }.compile() + Ok(Some(CompileClass { c: self, ranges: ranges }.compile()?)) } else { let ranges: Vec<(char, char)> = ranges.iter().map(|r| (r.start(), r.end())).collect(); @@ -406,15 +427,18 @@ impl Compiler { } else { self.push_hole(InstHole::Ranges { ranges: ranges }) }; - Ok(Patch { hole: hole, entry: self.insts.len() - 1 }) + Ok(Some(Patch { hole: hole, entry: self.insts.len() - 1 })) } } - fn c_byte(&mut self, b: u8) -> Result { + fn c_byte(&mut self, b: u8) -> ResultOrEmpty { self.c_class_bytes(&[hir::ClassBytesRange::new(b, b)]) } - fn c_class_bytes(&mut self, ranges: &[hir::ClassBytesRange]) -> Result { + fn c_class_bytes( + &mut self, + ranges: &[hir::ClassBytesRange], + ) -> ResultOrEmpty { debug_assert!(!ranges.is_empty()); let first_split_entry = self.insts.len(); @@ -438,35 +462,39 @@ impl Compiler { self.push_hole(InstHole::Bytes { start: r.start(), end: r.end() }), ); self.fill(prev_hole, next); - Ok(Patch { hole: Hole::Many(holes), entry: first_split_entry }) + Ok(Some(Patch { hole: Hole::Many(holes), entry: first_split_entry })) } - fn c_empty_look(&mut self, look: EmptyLook) -> Result { + fn c_empty_look(&mut self, look: EmptyLook) -> ResultOrEmpty { let hole = self.push_hole(InstHole::EmptyLook { look: look }); - Ok(Patch { hole: hole, entry: self.insts.len() - 1 }) + Ok(Some(Patch { hole: hole, entry: self.insts.len() - 1 })) } - fn c_concat<'a, I>(&mut self, exprs: I) -> Result + fn c_concat<'a, I>(&mut self, exprs: I) -> ResultOrEmpty where I: IntoIterator, { let mut exprs = exprs.into_iter(); - let first = match exprs.next() { - Some(expr) => expr, - None => { - return Ok(Patch { hole: Hole::None, entry: self.insts.len() }) + let Patch { mut hole, entry } = loop { + match exprs.next() { + None => return Ok(None), + Some(e) => { + if let Some(p) = self.c(e)? { + break p; + } + } } }; - let Patch { mut hole, entry } = self.c(first)?; for e in exprs { - let p = self.c(e)?; - self.fill(hole, p.entry); - hole = p.hole; + if let Some(p) = self.c(e)? { + self.fill(hole, p.entry); + hole = p.hole; + } } - Ok(Patch { hole: hole, entry: entry }) + Ok(Some(Patch { hole: hole, entry: entry })) } - fn c_alternate(&mut self, exprs: &[Hir]) -> Result { + fn c_alternate(&mut self, exprs: &[Hir]) -> ResultOrEmpty { debug_assert!( exprs.len() >= 2, "alternates must have at least 2 exprs" @@ -479,43 +507,43 @@ impl Compiler { // patched to point to the same location. let mut holes = vec![]; - let mut prev_hole = Hole::None; + // true indicates that the hole is a split where we want to fill + // the second branch. + let mut prev_hole = (Hole::None, false); for e in &exprs[0..exprs.len() - 1] { - self.fill_to_next(prev_hole); - let split = self.push_split_hole(); - let prev_entry = self.insts.len(); - let Patch { hole, entry } = self.c(e)?; - if prev_entry == self.insts.len() { - // TODO(burntsushi): It is kind of silly that we don't support - // empty-subexpressions in alternates, but it is supremely - // awkward to support them in the existing compiler - // infrastructure. This entire compiler needs to be thrown out - // anyway, so don't feel too bad. - return Err(Error::Syntax( - "alternations cannot currently contain \ - empty sub-expressions" - .to_string(), - )); + if prev_hole.1 { + let next = self.insts.len(); + self.fill_split(prev_hole.0, None, Some(next)); + } else { + self.fill_to_next(prev_hole.0); } + let split = self.push_split_hole(); + if let Some(Patch { hole, entry }) = self.c(e)? { + holes.push(hole); + prev_hole = (self.fill_split(split, Some(entry), None), false); + } else { + let (split1, split2) = split.dup_one(); + holes.push(split1); + prev_hole = (split2, true); + } + } + if let Some(Patch { hole, entry }) = self.c(&exprs[exprs.len() - 1])? { holes.push(hole); - prev_hole = self.fill_split(split, Some(entry), None); + if prev_hole.1 { + self.fill_split(prev_hole.0, None, Some(entry)); + } else { + self.fill(prev_hole.0, entry); + } + } else { + // We ignore prev_hole.1. When it's true, it means we have two + // empty branches both pushing prev_hole.0 into holes, so both + // branches will go to the same place anyway. + holes.push(prev_hole.0); } - let prev_entry = self.insts.len(); - let Patch { hole, entry } = self.c(&exprs[exprs.len() - 1])?; - if prev_entry == self.insts.len() { - // TODO(burntsushi): See TODO above. - return Err(Error::Syntax( - "alternations cannot currently contain \ - empty sub-expressions" - .to_string(), - )); - } - holes.push(hole); - self.fill(prev_hole, entry); - Ok(Patch { hole: Hole::Many(holes), entry: first_split_entry }) + Ok(Some(Patch { hole: Hole::Many(holes), entry: first_split_entry })) } - fn c_repeat(&mut self, rep: &hir::Repetition) -> Result { + fn c_repeat(&mut self, rep: &hir::Repetition) -> ResultOrEmpty { use syntax::hir::RepetitionKind::*; match rep.kind { ZeroOrOne => self.c_repeat_zero_or_one(&rep.hir, rep.greedy), @@ -533,24 +561,37 @@ impl Compiler { } } - fn c_repeat_zero_or_one(&mut self, expr: &Hir, greedy: bool) -> Result { + fn c_repeat_zero_or_one( + &mut self, + expr: &Hir, + greedy: bool, + ) -> ResultOrEmpty { let split_entry = self.insts.len(); let split = self.push_split_hole(); - let Patch { hole: hole_rep, entry: entry_rep } = self.c(expr)?; - + let Patch { hole: hole_rep, entry: entry_rep } = match self.c(expr)? { + Some(p) => p, + None => return self.pop_split_hole(), + }; let split_hole = if greedy { self.fill_split(split, Some(entry_rep), None) } else { self.fill_split(split, None, Some(entry_rep)) }; let holes = vec![hole_rep, split_hole]; - Ok(Patch { hole: Hole::Many(holes), entry: split_entry }) + Ok(Some(Patch { hole: Hole::Many(holes), entry: split_entry })) } - fn c_repeat_zero_or_more(&mut self, expr: &Hir, greedy: bool) -> Result { + fn c_repeat_zero_or_more( + &mut self, + expr: &Hir, + greedy: bool, + ) -> ResultOrEmpty { let split_entry = self.insts.len(); let split = self.push_split_hole(); - let Patch { hole: hole_rep, entry: entry_rep } = self.c(expr)?; + let Patch { hole: hole_rep, entry: entry_rep } = match self.c(expr)? { + Some(p) => p, + None => return self.pop_split_hole(), + }; self.fill(hole_rep, split_entry); let split_hole = if greedy { @@ -558,11 +599,18 @@ impl Compiler { } else { self.fill_split(split, None, Some(entry_rep)) }; - Ok(Patch { hole: split_hole, entry: split_entry }) + Ok(Some(Patch { hole: split_hole, entry: split_entry })) } - fn c_repeat_one_or_more(&mut self, expr: &Hir, greedy: bool) -> Result { - let Patch { hole: hole_rep, entry: entry_rep } = self.c(expr)?; + fn c_repeat_one_or_more( + &mut self, + expr: &Hir, + greedy: bool, + ) -> ResultOrEmpty { + let Patch { hole: hole_rep, entry: entry_rep } = match self.c(expr)? { + Some(p) => p, + None => return Ok(None), + }; self.fill_to_next(hole_rep); let split = self.push_split_hole(); @@ -571,7 +619,7 @@ impl Compiler { } else { self.fill_split(split, None, Some(entry_rep)) }; - Ok(Patch { hole: split_hole, entry: entry_rep }) + Ok(Some(Patch { hole: split_hole, entry: entry_rep })) } fn c_repeat_range_min_or_more( @@ -579,12 +627,20 @@ impl Compiler { expr: &Hir, greedy: bool, min: u32, - ) -> Result { + ) -> ResultOrEmpty { let min = u32_to_usize(min); - let patch_concat = self.c_concat(iter::repeat(expr).take(min))?; - let patch_rep = self.c_repeat_zero_or_more(expr, greedy)?; - self.fill(patch_concat.hole, patch_rep.entry); - Ok(Patch { hole: patch_rep.hole, entry: patch_concat.entry }) + // Using next_inst() is ok, because we can't return it (concat would + // have to return Some(_) while c_repeat_range_min_or_more returns + // None). + let patch_concat = self + .c_concat(iter::repeat(expr).take(min))? + .unwrap_or(self.next_inst()); + if let Some(patch_rep) = self.c_repeat_zero_or_more(expr, greedy)? { + self.fill(patch_concat.hole, patch_rep.entry); + Ok(Some(Patch { hole: patch_rep.hole, entry: patch_concat.entry })) + } else { + Ok(None) + } } fn c_repeat_range( @@ -593,13 +649,17 @@ impl Compiler { greedy: bool, min: u32, max: u32, - ) -> Result { + ) -> ResultOrEmpty { let (min, max) = (u32_to_usize(min), u32_to_usize(max)); + debug_assert!(min <= max); let patch_concat = self.c_concat(iter::repeat(expr).take(min))?; - let initial_entry = patch_concat.entry; if min == max { return Ok(patch_concat); } + // Same reasoning as in c_repeat_range_min_or_more (we know that min < + // max at this point). + let patch_concat = patch_concat.unwrap_or(self.next_inst()); + let initial_entry = patch_concat.entry; // It is much simpler to compile, e.g., `a{2,5}` as: // // aaa?a?a? @@ -624,7 +684,10 @@ impl Compiler { for _ in min..max { self.fill_to_next(prev_hole); let split = self.push_split_hole(); - let Patch { hole, entry } = self.c(expr)?; + let Patch { hole, entry } = match self.c(expr)? { + Some(p) => p, + None => return self.pop_split_hole(), + }; prev_hole = hole; if greedy { holes.push(self.fill_split(split, Some(entry), None)); @@ -633,7 +696,14 @@ impl Compiler { } } holes.push(prev_hole); - Ok(Patch { hole: Hole::Many(holes), entry: initial_entry }) + Ok(Some(Patch { hole: Hole::Many(holes), entry: initial_entry })) + } + + /// Can be used as a default value for the c_* functions when the call to + /// c_function is followed by inserting at least one instruction that is + /// always executed after the ones written by the c* function. + fn next_inst(&self) -> Patch { + Patch { hole: Hole::None, entry: self.insts.len() } } fn fill(&mut self, hole: Hole, goto: InstPtr) { @@ -713,6 +783,11 @@ impl Compiler { Hole::One(hole) } + fn pop_split_hole(&mut self) -> ResultOrEmpty { + self.insts.pop(); + Ok(None) + } + fn check_size(&self) -> result::Result<(), Error> { use std::mem::size_of; @@ -731,6 +806,17 @@ enum Hole { Many(Vec), } +impl Hole { + fn dup_one(self) -> (Self, Self) { + match self { + Hole::One(pc) => (Hole::One(pc), Hole::One(pc)), + Hole::None | Hole::Many(_) => { + unreachable!("must be called on single hole") + } + } + } +} + #[derive(Clone, Debug)] enum MaybeInst { Compiled(Inst), @@ -742,13 +828,22 @@ enum MaybeInst { impl MaybeInst { fn fill(&mut self, goto: InstPtr) { - let filled = match *self { - MaybeInst::Uncompiled(ref inst) => inst.fill(goto), + let maybeinst = match *self { + MaybeInst::Split => MaybeInst::Split1(goto), + MaybeInst::Uncompiled(ref inst) => { + MaybeInst::Compiled(inst.fill(goto)) + } MaybeInst::Split1(goto1) => { - Inst::Split(InstSplit { goto1: goto1, goto2: goto }) + MaybeInst::Compiled(Inst::Split(InstSplit { + goto1: goto1, + goto2: goto, + })) } MaybeInst::Split2(goto2) => { - Inst::Split(InstSplit { goto1: goto, goto2: goto2 }) + MaybeInst::Compiled(Inst::Split(InstSplit { + goto1: goto, + goto2: goto2, + })) } _ => unreachable!( "not all instructions were compiled! \ @@ -756,7 +851,7 @@ impl MaybeInst { self ), }; - *self = MaybeInst::Compiled(filled); + *self = maybeinst; } fn fill_split(&mut self, goto1: InstPtr, goto2: InstPtr) { diff --git a/third_party/cargo/vendor/regex-1.3.5/src/dfa.rs b/third_party/cargo/vendor/regex-1.3.9/src/dfa.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/dfa.rs rename to third_party/cargo/vendor/regex-1.3.9/src/dfa.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/error.rs b/third_party/cargo/vendor/regex-1.3.9/src/error.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/error.rs rename to third_party/cargo/vendor/regex-1.3.9/src/error.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/exec.rs b/third_party/cargo/vendor/regex-1.3.9/src/exec.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/exec.rs rename to third_party/cargo/vendor/regex-1.3.9/src/exec.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/expand.rs b/third_party/cargo/vendor/regex-1.3.9/src/expand.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/expand.rs rename to third_party/cargo/vendor/regex-1.3.9/src/expand.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/find_byte.rs b/third_party/cargo/vendor/regex-1.3.9/src/find_byte.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/find_byte.rs rename to third_party/cargo/vendor/regex-1.3.9/src/find_byte.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/freqs.rs b/third_party/cargo/vendor/regex-1.3.9/src/freqs.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/freqs.rs rename to third_party/cargo/vendor/regex-1.3.9/src/freqs.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/input.rs b/third_party/cargo/vendor/regex-1.3.9/src/input.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/input.rs rename to third_party/cargo/vendor/regex-1.3.9/src/input.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/lib.rs b/third_party/cargo/vendor/regex-1.3.9/src/lib.rs similarity index 99% rename from third_party/cargo/vendor/regex-1.3.5/src/lib.rs rename to third_party/cargo/vendor/regex-1.3.9/src/lib.rs index 2a74bf8..e0a0975 100644 --- a/third_party/cargo/vendor/regex-1.3.5/src/lib.rs +++ b/third_party/cargo/vendor/regex-1.3.9/src/lib.rs @@ -152,8 +152,9 @@ assert_eq!(after, "03/14/2012, 01/01/2013 and 07/05/2014"); ``` If you wish to match against whitespace in this mode, you can still use `\s`, -`\n`, `\t`, etc. For escaping a single space character, you can use its hex -character code `\x20` or temporarily disable the `x` flag, e.g., `(?-x: )`. +`\n`, `\t`, etc. For escaping a single space character, you can escape it +directly with `\ `, use its hex character code `\x20` or temporarily disable +the `x` flag, e.g., `(?-x: )`. # Example: match multiple regular expressions simultaneously @@ -621,8 +622,8 @@ compile_error!("`std` feature is currently required to build this crate"); #[cfg(feature = "perf-literal")] extern crate aho_corasick; -#[cfg(test)] -extern crate doc_comment; +// #[cfg(doctest)] +// extern crate doc_comment; #[cfg(feature = "perf-literal")] extern crate memchr; #[cfg(test)] @@ -632,8 +633,8 @@ extern crate regex_syntax as syntax; #[cfg(feature = "perf-cache")] extern crate thread_local; -#[cfg(test)] -doc_comment::doctest!("../README.md"); +// #[cfg(doctest)] +// doc_comment::doctest!("../README.md"); #[cfg(feature = "std")] pub use error::Error; diff --git a/third_party/cargo/vendor/regex-1.3.5/src/literal/imp.rs b/third_party/cargo/vendor/regex-1.3.9/src/literal/imp.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/literal/imp.rs rename to third_party/cargo/vendor/regex-1.3.9/src/literal/imp.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/literal/mod.rs b/third_party/cargo/vendor/regex-1.3.9/src/literal/mod.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/literal/mod.rs rename to third_party/cargo/vendor/regex-1.3.9/src/literal/mod.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/pattern.rs b/third_party/cargo/vendor/regex-1.3.9/src/pattern.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/pattern.rs rename to third_party/cargo/vendor/regex-1.3.9/src/pattern.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/pikevm.rs b/third_party/cargo/vendor/regex-1.3.9/src/pikevm.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/pikevm.rs rename to third_party/cargo/vendor/regex-1.3.9/src/pikevm.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/prog.rs b/third_party/cargo/vendor/regex-1.3.9/src/prog.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/prog.rs rename to third_party/cargo/vendor/regex-1.3.9/src/prog.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/re_builder.rs b/third_party/cargo/vendor/regex-1.3.9/src/re_builder.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/re_builder.rs rename to third_party/cargo/vendor/regex-1.3.9/src/re_builder.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/re_bytes.rs b/third_party/cargo/vendor/regex-1.3.9/src/re_bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/re_bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/src/re_bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/re_set.rs b/third_party/cargo/vendor/regex-1.3.9/src/re_set.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/re_set.rs rename to third_party/cargo/vendor/regex-1.3.9/src/re_set.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/re_trait.rs b/third_party/cargo/vendor/regex-1.3.9/src/re_trait.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/re_trait.rs rename to third_party/cargo/vendor/regex-1.3.9/src/re_trait.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/re_unicode.rs b/third_party/cargo/vendor/regex-1.3.9/src/re_unicode.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/re_unicode.rs rename to third_party/cargo/vendor/regex-1.3.9/src/re_unicode.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/src/sparse.rs b/third_party/cargo/vendor/regex-1.3.9/src/sparse.rs similarity index 91% rename from third_party/cargo/vendor/regex-1.3.5/src/sparse.rs rename to third_party/cargo/vendor/regex-1.3.9/src/sparse.rs index 9d48eee..bc1b2b5 100644 --- a/third_party/cargo/vendor/regex-1.3.5/src/sparse.rs +++ b/third_party/cargo/vendor/regex-1.3.9/src/sparse.rs @@ -1,3 +1,4 @@ +use std::fmt; use std::ops::Deref; use std::slice; @@ -11,7 +12,7 @@ use std::slice; /// Note though that we don't actually use uninitialized memory. We generally /// reuse allocations, so the initial allocation cost is bareable. However, /// its other properties listed above are extremely useful. -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct SparseSet { /// Dense contains the instruction pointers in the order in which they /// were inserted. @@ -60,6 +61,12 @@ impl SparseSet { } } +impl fmt::Debug for SparseSet { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "SparseSet({:?})", self.dense) + } +} + impl Deref for SparseSet { type Target = [usize]; diff --git a/third_party/cargo/vendor/regex-1.3.5/src/testdata/LICENSE b/third_party/cargo/vendor/regex-1.3.9/src/testdata/LICENSE similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/testdata/LICENSE rename to third_party/cargo/vendor/regex-1.3.9/src/testdata/LICENSE diff --git a/third_party/cargo/vendor/regex-1.3.5/src/testdata/README b/third_party/cargo/vendor/regex-1.3.9/src/testdata/README similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/testdata/README rename to third_party/cargo/vendor/regex-1.3.9/src/testdata/README diff --git a/third_party/cargo/vendor/regex-1.3.5/src/testdata/basic.dat b/third_party/cargo/vendor/regex-1.3.9/src/testdata/basic.dat similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/testdata/basic.dat rename to third_party/cargo/vendor/regex-1.3.9/src/testdata/basic.dat diff --git a/third_party/cargo/vendor/regex-1.3.5/src/testdata/nullsubexpr.dat b/third_party/cargo/vendor/regex-1.3.9/src/testdata/nullsubexpr.dat similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/testdata/nullsubexpr.dat rename to third_party/cargo/vendor/regex-1.3.9/src/testdata/nullsubexpr.dat diff --git a/third_party/cargo/vendor/regex-1.3.5/src/testdata/repetition.dat b/third_party/cargo/vendor/regex-1.3.9/src/testdata/repetition.dat similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/testdata/repetition.dat rename to third_party/cargo/vendor/regex-1.3.9/src/testdata/repetition.dat diff --git a/third_party/cargo/vendor/regex-1.3.5/src/utf8.rs b/third_party/cargo/vendor/regex-1.3.9/src/utf8.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/src/utf8.rs rename to third_party/cargo/vendor/regex-1.3.9/src/utf8.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/test b/third_party/cargo/vendor/regex-1.3.9/test similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/test rename to third_party/cargo/vendor/regex-1.3.9/test diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/api.rs b/third_party/cargo/vendor/regex-1.3.9/tests/api.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/api.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/api.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/api_str.rs b/third_party/cargo/vendor/regex-1.3.9/tests/api_str.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/api_str.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/api_str.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/consistent.rs b/third_party/cargo/vendor/regex-1.3.9/tests/consistent.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/consistent.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/consistent.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/crates_regex.rs b/third_party/cargo/vendor/regex-1.3.9/tests/crates_regex.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/crates_regex.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/crates_regex.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/crazy.rs b/third_party/cargo/vendor/regex-1.3.9/tests/crazy.rs similarity index 92% rename from third_party/cargo/vendor/regex-1.3.5/tests/crazy.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/crazy.rs index 8c72273..56f6cad 100644 --- a/third_party/cargo/vendor/regex-1.3.5/tests/crazy.rs +++ b/third_party/cargo/vendor/regex-1.3.9/tests/crazy.rs @@ -118,6 +118,18 @@ matiter!(match_empty8, r"()+|z", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); matiter!(match_empty9, r"z|()+", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); matiter!(match_empty10, r"()+|b", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); matiter!(match_empty11, r"b|()+", "abc", (0, 0), (1, 2), (3, 3)); +matiter!(match_empty12, r"|b", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty13, r"b|", "abc", (0, 0), (1, 2), (3, 3)); +matiter!(match_empty14, r"|z", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty15, r"z|", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty16, r"|", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty17, r"||", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty18, r"||z", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty19, r"(?:)|b", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty20, r"b|(?:)", "abc", (0, 0), (1, 2), (3, 3)); +matiter!(match_empty21, r"(?:|)", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty22, r"(?:|)|z", "abc", (0, 0), (1, 1), (2, 2), (3, 3)); +matiter!(match_empty23, r"a(?:)|b", "abc", (0, 1), (1, 2)); // Test that the DFA can handle pathological cases. // (This should result in the DFA's cache being flushed too frequently, which diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/flags.rs b/third_party/cargo/vendor/regex-1.3.9/tests/flags.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/flags.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/flags.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/fowler.rs b/third_party/cargo/vendor/regex-1.3.9/tests/fowler.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/fowler.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/fowler.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/macros.rs b/third_party/cargo/vendor/regex-1.3.9/tests/macros.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/macros.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/macros.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/macros_bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/macros_bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/macros_bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/macros_bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/macros_str.rs b/third_party/cargo/vendor/regex-1.3.9/tests/macros_str.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/macros_str.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/macros_str.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/misc.rs b/third_party/cargo/vendor/regex-1.3.9/tests/misc.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/misc.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/misc.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/multiline.rs b/third_party/cargo/vendor/regex-1.3.9/tests/multiline.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/multiline.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/multiline.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/noparse.rs b/third_party/cargo/vendor/regex-1.3.9/tests/noparse.rs similarity index 86% rename from third_party/cargo/vendor/regex-1.3.5/tests/noparse.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/noparse.rs index 62eb5be..8ded1dc 100644 --- a/third_party/cargo/vendor/regex-1.3.5/tests/noparse.rs +++ b/third_party/cargo/vendor/regex-1.3.9/tests/noparse.rs @@ -26,6 +26,8 @@ noparse!(fail_bad_capture_name, "(?P)"); noparse!(fail_bad_flag, "(?a)a"); noparse!(fail_too_big, "a{10000000}"); noparse!(fail_counted_no_close, "a{1001"); +noparse!(fail_counted_decreasing, "a{2,1}"); +noparse!(fail_counted_nonnegative, "a{-1,1}"); noparse!(fail_unfinished_cap, "(?"); noparse!(fail_unfinished_escape, "\\"); noparse!(fail_octal_digit, r"\8"); @@ -41,10 +43,3 @@ noparse!(fail_range_end_no_class, "[a-[:lower:]]"); noparse!(fail_range_end_no_begin, r"[a-\A]"); noparse!(fail_range_end_no_end, r"[a-\z]"); noparse!(fail_range_end_no_boundary, r"[a-\b]"); -noparse!(fail_empty_alt1, r"|z"); -noparse!(fail_empty_alt2, r"z|"); -noparse!(fail_empty_alt3, r"|"); -noparse!(fail_empty_alt4, r"||"); -noparse!(fail_empty_alt5, r"()|z"); -noparse!(fail_empty_alt6, r"z|()"); -noparse!(fail_empty_alt7, r"(|)"); diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/regression.rs b/third_party/cargo/vendor/regex-1.3.9/tests/regression.rs similarity index 96% rename from third_party/cargo/vendor/regex-1.3.5/tests/regression.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/regression.rs index 686fe35..44b9083 100644 --- a/third_party/cargo/vendor/regex-1.3.5/tests/regression.rs +++ b/third_party/cargo/vendor/regex-1.3.9/tests/regression.rs @@ -210,3 +210,10 @@ matiter!( (4, 7), (12, 15) ); + +// See: https://github.com/rust-lang/regex/issues/659 +// +// Note that 'Ј' is not 'j', but cyrillic Je +// https://en.wikipedia.org/wiki/Je_(Cyrillic) +ismatch!(empty_group_match, r"()Ј01", "zЈ01", true); +matiter!(empty_group_find, r"()Ј01", "zЈ01", (1, 5)); diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/replace.rs b/third_party/cargo/vendor/regex-1.3.9/tests/replace.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/replace.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/replace.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/searcher.rs b/third_party/cargo/vendor/regex-1.3.9/tests/searcher.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/searcher.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/searcher.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/set.rs b/third_party/cargo/vendor/regex-1.3.9/tests/set.rs similarity index 75% rename from third_party/cargo/vendor/regex-1.3.5/tests/set.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/set.rs index 3e9755c..648feec 100644 --- a/third_party/cargo/vendor/regex-1.3.5/tests/set.rs +++ b/third_party/cargo/vendor/regex-1.3.9/tests/set.rs @@ -17,6 +17,17 @@ matset!(set16, &["a"], "a", 0); matset!(set17, &[".*a"], "a", 0); matset!(set18, &["a", "β"], "β", 1); +// regexes that match the empty string +matset!(setempty1, &["", "a"], "abc", 0, 1); +matset!(setempty2, &["", "b"], "abc", 0, 1); +matset!(setempty3, &["", "z"], "abc", 0); +matset!(setempty4, &["a", ""], "abc", 0, 1); +matset!(setempty5, &["b", ""], "abc", 0, 1); +matset!(setempty6, &["z", ""], "abc", 1); +matset!(setempty7, &["b", "(?:)"], "abc", 0, 1); +matset!(setempty8, &["(?:)", "b"], "abc", 0, 1); +matset!(setempty9, &["c(?:)", "b"], "abc", 0, 1); + nomatset!(nset1, &["a", "a"], "b"); nomatset!(nset2, &["^foo", "bar$"], "bar foo"); nomatset!( diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/shortest_match.rs b/third_party/cargo/vendor/regex-1.3.9/tests/shortest_match.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/shortest_match.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/shortest_match.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/suffix_reverse.rs b/third_party/cargo/vendor/regex-1.3.9/tests/suffix_reverse.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/suffix_reverse.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/suffix_reverse.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_backtrack.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_backtrack.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_backtrack.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_backtrack.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_backtrack_bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_backtrack_bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_backtrack_bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_backtrack_bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_backtrack_utf8bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_backtrack_utf8bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_backtrack_utf8bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_backtrack_utf8bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_crates_regex.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_crates_regex.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_crates_regex.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_crates_regex.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_default.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_default.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_default.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_default.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_default_bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_default_bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_default_bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_default_bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_nfa.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_nfa.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_nfa.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_nfa.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_nfa_bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_nfa_bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_nfa_bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_nfa_bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/test_nfa_utf8bytes.rs b/third_party/cargo/vendor/regex-1.3.9/tests/test_nfa_utf8bytes.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/test_nfa_utf8bytes.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/test_nfa_utf8bytes.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/unicode.rs b/third_party/cargo/vendor/regex-1.3.9/tests/unicode.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/unicode.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/unicode.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/word_boundary.rs b/third_party/cargo/vendor/regex-1.3.9/tests/word_boundary.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/word_boundary.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/word_boundary.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/word_boundary_ascii.rs b/third_party/cargo/vendor/regex-1.3.9/tests/word_boundary_ascii.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/word_boundary_ascii.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/word_boundary_ascii.rs diff --git a/third_party/cargo/vendor/regex-1.3.5/tests/word_boundary_unicode.rs b/third_party/cargo/vendor/regex-1.3.9/tests/word_boundary_unicode.rs similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/tests/word_boundary_unicode.rs rename to third_party/cargo/vendor/regex-1.3.9/tests/word_boundary_unicode.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/.cargo-checksum.json b/third_party/cargo/vendor/regex-syntax-0.6.17/.cargo-checksum.json deleted file mode 100644 index 9874b53..0000000 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"d28e9dad83250ea78fccc43f8a02f28c587d168c3c2877dfc43bcf1f6c7954f9","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7e9a134c72b09540e6f81f02133c5ae7d35067ea6fec44a94a1ebd20af47b151","benches/bench.rs":"f04160a876ee69bc9938bf51227513d6dbf3608643bc8ae422200f7ffc5ca85f","src/ast/mod.rs":"ff7e81186be4f7dea848363622bcd13cd8bf5b0826ea0fd7784a46547d9cf7c0","src/ast/parse.rs":"e1c4bea2fdc4b8eed84b8c3778a37b1d507f92e5a1cabc23b97796416e55ac0f","src/ast/print.rs":"b075392a6d5b48713e09aa510199bb7380aca2cf09fa4bc0efb5c49782630dda","src/ast/visitor.rs":"fb1489ed5ce019091dde244acd8b027e391be442aef3a9033c785c81a4c251fb","src/either.rs":"1758e3edd056884eccadd995708d1e374ba9aa65846bd0e13b1aae852607c560","src/error.rs":"dd937a59d5caed6ca430b884ca4d26116a57ba4c74e4f11797b255d1ac6ace51","src/hir/interval.rs":"fcd0babe3bddbe411e04adff7f4d8855db1d6aaa7d8e2180bba819abad576736","src/hir/literal/mod.rs":"b0a01a3d7e524277ada88d5b58efcced498a53addfac69355fcc368c4c4dfb0f","src/hir/mod.rs":"72f0cd8fab39f9902e5b2e7c9a07d3aab1c07ec522756d0644c0e8b8fc89df23","src/hir/print.rs":"1bd12a70e5876d85eb2188d83c4b71c9533dc6fff0c1ab5c2b0e4701de7e7a90","src/hir/translate.rs":"3d457251560c943f54066ffa5a628d617f2252869266e1c45fdb2103aff430b0","src/hir/visitor.rs":"203dbe93e4a8cde395c6ff5a0eb98c9c3737bc5ea11fe7163f5e7bf1babc1f69","src/lib.rs":"db6fd6a65ea30a5b3b1b45c68c17f521302d3408bfe4cec77115913dd25ae072","src/parser.rs":"10cc145d79c275c7e19b8cc9078754f23fc1da9a2c3a2e56041a8616d5f85dea","src/unicode.rs":"cc3a1d4ce779d52031942acd8a2f67c21837d0b9917819cec0f12ce7c1df888d","src/unicode_tables/LICENSE-UNICODE":"74db5baf44a41b1000312c673544b3374e4198af5605c7f9080a402cec42cfa3","src/unicode_tables/age.rs":"b2926c9810651c42e55b17f9b22b425c42b6032829e2354ca5faa7077a8322ac","src/unicode_tables/case_folding_simple.rs":"6e2c76049932287d62101ba940e709ac8f55289f3331dda84348facfd2d60f2a","src/unicode_tables/general_category.rs":"c78044c5e71141bdeed95b9119446a3f6ae2178cf55b50653caa774e8625552c","src/unicode_tables/grapheme_cluster_break.rs":"8e68196174d3467f7a8529e14e5b391f9bac45af57475ed55617094663b2fc8f","src/unicode_tables/mod.rs":"26c837099cd934c8062e24bc9a0aaecf15fe1de03f9c6da3f3e1e5ac3ca24bee","src/unicode_tables/perl_decimal.rs":"d2bc6593c9b54f5b230196b402bed41e3fd004238b0e95aab199c4e7dea17a06","src/unicode_tables/perl_space.rs":"196f38a2fdce6893cf2d7269882a6d116258121970820486051ea7a07bc0a04a","src/unicode_tables/perl_word.rs":"c7b0be09aa468b022d5faba7c2bdf59318102e526917f8633766ba56a95e9d52","src/unicode_tables/property_bool.rs":"96f9fcb7c0e9d220c90b943953485266def0799161f6005eba56efcacfb263db","src/unicode_tables/property_names.rs":"2b31adc0de5046fd24a1b270cb1f7f1e4b618e903c9a04ea31d5984eafe4e722","src/unicode_tables/property_values.rs":"65fb58b3874f3eb3975e98e4ac35b53df83547183d2e3ac68ac2a39e01003e14","src/unicode_tables/script.rs":"777fc38cf35fa321a18228248013f80dab83404ce92f265b4cf4dd7403f84cab","src/unicode_tables/script_extension.rs":"f4cc121f66ffa0c7507e56033311914dce8bd4f71ad637e0bea419cfbcb47f57","src/unicode_tables/sentence_break.rs":"f62d3b191c621ae8cb8426f2376514ef483e2134d9965d17907afd902069028f","src/unicode_tables/word_break.rs":"f2cd65baf9b9570fe68d83bf6e8b84750ca436193d10bf67860e21bbf41f5198","src/utf8.rs":"f3e9564a0346be55356dfadac20e737c299900193c7fef5d7b4a4fc8ac2537a7","test":"9d0bc68616c249f317e783e5083102d2645a6ade3de735e8d8a414e97eaa76d0"},"package":"7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"} \ No newline at end of file diff --git a/third_party/cargo/vendor/regex-syntax-0.6.18/.cargo-checksum.json b/third_party/cargo/vendor/regex-syntax-0.6.18/.cargo-checksum.json new file mode 100644 index 0000000..e561fe1 --- /dev/null +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"a1ef0846eda9ca7e6205d17e8145c9885096a6dc8a3f22db3ef0a3d20342aedb","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"7e9a134c72b09540e6f81f02133c5ae7d35067ea6fec44a94a1ebd20af47b151","benches/bench.rs":"f04160a876ee69bc9938bf51227513d6dbf3608643bc8ae422200f7ffc5ca85f","src/ast/mod.rs":"ff7e81186be4f7dea848363622bcd13cd8bf5b0826ea0fd7784a46547d9cf7c0","src/ast/parse.rs":"e1c4bea2fdc4b8eed84b8c3778a37b1d507f92e5a1cabc23b97796416e55ac0f","src/ast/print.rs":"b075392a6d5b48713e09aa510199bb7380aca2cf09fa4bc0efb5c49782630dda","src/ast/visitor.rs":"fb1489ed5ce019091dde244acd8b027e391be442aef3a9033c785c81a4c251fb","src/either.rs":"1758e3edd056884eccadd995708d1e374ba9aa65846bd0e13b1aae852607c560","src/error.rs":"dd937a59d5caed6ca430b884ca4d26116a57ba4c74e4f11797b255d1ac6ace51","src/hir/interval.rs":"fcd0babe3bddbe411e04adff7f4d8855db1d6aaa7d8e2180bba819abad576736","src/hir/literal/mod.rs":"b0a01a3d7e524277ada88d5b58efcced498a53addfac69355fcc368c4c4dfb0f","src/hir/mod.rs":"384d44974c90b3520f0ce1426749e6b3abaf29d7031504fd57e22a3c2e7ab3d0","src/hir/print.rs":"1bd12a70e5876d85eb2188d83c4b71c9533dc6fff0c1ab5c2b0e4701de7e7a90","src/hir/translate.rs":"d654aebaa5688e18aafee28caf7c528faf639d0524565598ed5e2f1eca4a0144","src/hir/visitor.rs":"203dbe93e4a8cde395c6ff5a0eb98c9c3737bc5ea11fe7163f5e7bf1babc1f69","src/lib.rs":"224b1ee575d5f485fcb6c70334f1306391639c6adef54d9d2ae7cf8605754429","src/parser.rs":"10cc145d79c275c7e19b8cc9078754f23fc1da9a2c3a2e56041a8616d5f85dea","src/unicode.rs":"cc3a1d4ce779d52031942acd8a2f67c21837d0b9917819cec0f12ce7c1df888d","src/unicode_tables/LICENSE-UNICODE":"74db5baf44a41b1000312c673544b3374e4198af5605c7f9080a402cec42cfa3","src/unicode_tables/age.rs":"b0932a020d3386478dd2f4839c59e30c525e8591735052b9e791e1ce3a2e2b72","src/unicode_tables/case_folding_simple.rs":"6d1f3d095132639228faf4806d05308c70ce2baa68cce69dca01ea159c4eaa15","src/unicode_tables/general_category.rs":"d21877600d387b8a0c5fbb0942458d0330c69aad6565e28134b8a1a371d2f4f4","src/unicode_tables/grapheme_cluster_break.rs":"f03a8be4a00265b568ca2a41d99f66a5d0f5fb423cb4113494153423a1123cda","src/unicode_tables/mod.rs":"26c837099cd934c8062e24bc9a0aaecf15fe1de03f9c6da3f3e1e5ac3ca24bee","src/unicode_tables/perl_decimal.rs":"e39a5934b504eb3282ccb26bbf50ecd764e720120eb7cf6c43662a2321665ab5","src/unicode_tables/perl_space.rs":"014e5d92b66730557e408c2d5c9b2f46d3d288aa85400ab9193c218c7b98ad21","src/unicode_tables/perl_word.rs":"ddf126f39171776ef83151d7a0dbc41da8dd09186723211fb966c4b304247a5e","src/unicode_tables/property_bool.rs":"21f72bd9f3955e3443549ef6609418817ae6df3c81fb5be90a0ceee9d7d3002d","src/unicode_tables/property_names.rs":"504ea44604cd15a7e827a89066bb81a847dd5c57cef360d9f4a914cf22afcf36","src/unicode_tables/property_values.rs":"4d793ad1b664c1913db146897c8eb4fa29d181b821f096de90dc889b738edb88","src/unicode_tables/script.rs":"5a7d2a958b93056081b8b2eb87c3a5609579ad791ad5b0c42959362ce6ea5b31","src/unicode_tables/script_extension.rs":"1d5f1985f7dcae833e78c3858231666b535bf60e032cfacc09d014c22bda6690","src/unicode_tables/sentence_break.rs":"cd5f0eb7ab6b0ec1c1fb4d78496dfecd691d0d0b76495538b9f376645a753deb","src/unicode_tables/word_break.rs":"eabeacfde7558cfe7b1556b0221f09c65f049de0b08c7cd464c1669040610a6b","src/utf8.rs":"f3e9564a0346be55356dfadac20e737c299900193c7fef5d7b4a4fc8ac2537a7","test":"9d0bc68616c249f317e783e5083102d2645a6ade3de735e8d8a414e97eaa76d0"},"package":"26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"} \ No newline at end of file diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/BUILD b/third_party/cargo/vendor/regex-syntax-0.6.18/BUILD similarity index 94% rename from third_party/cargo/vendor/regex-syntax-0.6.17/BUILD rename to third_party/cargo/vendor/regex-syntax-0.6.18/BUILD index 5929f24..fe07fcf 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/BUILD +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/BUILD @@ -36,8 +36,10 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "0.6.17", + version = "0.6.18", crate_features = [ + "default", + "unicode", "unicode-age", "unicode-bool", "unicode-case", diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/Cargo.toml b/third_party/cargo/vendor/regex-syntax-0.6.18/Cargo.toml similarity index 98% rename from third_party/cargo/vendor/regex-syntax-0.6.17/Cargo.toml rename to third_party/cargo/vendor/regex-syntax-0.6.18/Cargo.toml index 46fafd0..a0e2849 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/Cargo.toml +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/Cargo.toml @@ -12,7 +12,7 @@ [package] name = "regex-syntax" -version = "0.6.17" +version = "0.6.18" authors = ["The Rust Project Developers"] description = "A regular expression parser." homepage = "https://github.com/rust-lang/regex" diff --git a/third_party/cargo/vendor/regex-syntax-0.6.18/LICENSE-APACHE b/third_party/cargo/vendor/regex-syntax-0.6.18/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/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/third_party/cargo/vendor/regex-1.3.5/LICENSE-MIT b/third_party/cargo/vendor/regex-syntax-0.6.18/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/regex-1.3.5/LICENSE-MIT rename to third_party/cargo/vendor/regex-syntax-0.6.18/LICENSE-MIT diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/README.md b/third_party/cargo/vendor/regex-syntax-0.6.18/README.md similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/README.md rename to third_party/cargo/vendor/regex-syntax-0.6.18/README.md diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/benches/bench.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/benches/bench.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/benches/bench.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/benches/bench.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/mod.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/mod.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/mod.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/mod.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/parse.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/parse.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/parse.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/parse.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/print.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/print.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/print.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/print.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/visitor.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/visitor.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/ast/visitor.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/ast/visitor.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/either.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/either.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/either.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/either.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/error.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/error.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/error.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/error.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/interval.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/interval.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/interval.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/interval.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/literal/mod.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/literal/mod.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/literal/mod.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/literal/mod.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/mod.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/mod.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/mod.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/mod.rs index a2f166c..53d90b8 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/mod.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/mod.rs @@ -241,8 +241,8 @@ impl Hir { info.set_any_anchored_start(false); info.set_any_anchored_end(false); info.set_match_empty(true); - info.set_literal(true); - info.set_alternation_literal(true); + info.set_literal(false); + info.set_alternation_literal(false); Hir { kind: HirKind::Empty, info: info } } @@ -671,8 +671,8 @@ impl Hir { /// true when this HIR expression is either itself a `Literal` or a /// concatenation of only `Literal`s. /// - /// For example, `f` and `foo` are literals, but `f+`, `(foo)`, `foo()` - /// are not (even though that contain sub-expressions that are literals). + /// For example, `f` and `foo` are literals, but `f+`, `(foo)`, `foo()`, + /// `` are not (even though that contain sub-expressions that are literals). pub fn is_literal(&self) -> bool { self.info.is_literal() } @@ -682,8 +682,8 @@ impl Hir { /// true when this HIR expression is either itself a `Literal` or a /// concatenation of only `Literal`s or an alternation of only `Literal`s. /// - /// For example, `f`, `foo`, `a|b|c`, and `foo|bar|baz` are alternaiton - /// literals, but `f+`, `(foo)`, `foo()` + /// For example, `f`, `foo`, `a|b|c`, and `foo|bar|baz` are alternation + /// literals, but `f+`, `(foo)`, `foo()`, `` /// are not (even though that contain sub-expressions that are literals). pub fn is_alternation_literal(&self) -> bool { self.info.is_alternation_literal() @@ -1496,7 +1496,7 @@ macro_rules! define_bool { self.bools &= !(1 << $bit); } } - } + }; } impl HirInfo { diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/print.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/print.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/print.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/print.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/translate.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/translate.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/translate.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/translate.rs index 2469890..72f3f9a 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/translate.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/translate.rs @@ -3105,13 +3105,13 @@ mod tests { #[test] fn analysis_is_literal() { // Positive examples. - assert!(t(r"").is_literal()); assert!(t(r"a").is_literal()); assert!(t(r"ab").is_literal()); assert!(t(r"abc").is_literal()); assert!(t(r"(?m)abc").is_literal()); // Negative examples. + assert!(!t(r"").is_literal()); assert!(!t(r"^").is_literal()); assert!(!t(r"a|b").is_literal()); assert!(!t(r"(a)").is_literal()); @@ -3124,7 +3124,6 @@ mod tests { #[test] fn analysis_is_alternation_literal() { // Positive examples. - assert!(t(r"").is_alternation_literal()); assert!(t(r"a").is_alternation_literal()); assert!(t(r"ab").is_alternation_literal()); assert!(t(r"abc").is_alternation_literal()); @@ -3135,6 +3134,7 @@ mod tests { assert!(t(r"foo|bar|baz").is_alternation_literal()); // Negative examples. + assert!(!t(r"").is_alternation_literal()); assert!(!t(r"^").is_alternation_literal()); assert!(!t(r"(a)").is_alternation_literal()); assert!(!t(r"a+").is_alternation_literal()); diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/visitor.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/visitor.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/hir/visitor.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/hir/visitor.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/lib.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/lib.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/lib.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/lib.rs index e9f59d8..7892668 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/lib.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/lib.rs @@ -175,7 +175,7 @@ pub mod utf8; /// The string returned may be safely used as a literal in a regular /// expression. pub fn escape(text: &str) -> String { - let mut quoted = String::with_capacity(text.len()); + let mut quoted = String::new(); escape_into(text, &mut quoted); quoted } @@ -185,6 +185,7 @@ pub fn escape(text: &str) -> String { /// This will append escape characters into the given buffer. The characters /// that are appended are safe to use as a literal in a regular expression. pub fn escape_into(text: &str, buf: &mut String) { + buf.reserve(text.len()); for c in text.chars() { if is_meta_character(c) { buf.push('\\'); diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/parser.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/parser.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/parser.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/parser.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/LICENSE-UNICODE b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/LICENSE-UNICODE similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/LICENSE-UNICODE rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/LICENSE-UNICODE diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/age.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/age.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/age.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/age.rs index 1452a52..7772919 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/age.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/age.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate age ucd-13.0.0 --chars +// ucd-generate age ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("V10_0", V10_0), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/case_folding_simple.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/case_folding_simple.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/case_folding_simple.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/case_folding_simple.rs index 6b4cad3..cfb83f3 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/case_folding_simple.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/case_folding_simple.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate case-folding-simple ucd-13.0.0 --chars --all-pairs +// ucd-generate case-folding-simple ucd-13.0.0 --chars --all-pairs // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const CASE_FOLDING_SIMPLE: &'static [(char, &'static [char])] = &[ ('A', &['a']), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/general_category.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/general_category.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/general_category.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/general_category.rs index f2f9cef..33b7b7e 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/general_category.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/general_category.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate general-category ucd-13.0.0 --chars --exclude surrogate +// ucd-generate general-category ucd-13.0.0 --chars --exclude surrogate // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("Cased_Letter", CASED_LETTER), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/grapheme_cluster_break.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/grapheme_cluster_break.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/grapheme_cluster_break.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/grapheme_cluster_break.rs index 1d0b285..7df9d2b 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/grapheme_cluster_break.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/grapheme_cluster_break.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate grapheme-cluster-break ucd-13.0.0 --chars +// ucd-generate grapheme-cluster-break ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("CR", CR), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/mod.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/mod.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/mod.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/mod.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_decimal.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_decimal.rs similarity index 90% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_decimal.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_decimal.rs index 541f324..2a09259 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_decimal.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_decimal.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate general-category ucd-13.0.0 --chars --include decimalnumber +// ucd-generate general-category ucd-13.0.0 --chars --include decimalnumber // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[("Decimal_Number", DECIMAL_NUMBER)]; diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_space.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_space.rs similarity index 76% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_space.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_space.rs index 8f048f8..c112dd1 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_space.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_space.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate property-bool ucd-13.0.0 --chars --include whitespace +// ucd-generate property-bool ucd-13.0.0 --chars --include whitespace // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[("White_Space", WHITE_SPACE)]; diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_word.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_word.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_word.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_word.rs index 68e9451..df9eac7 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/perl_word.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/perl_word.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate perl-word ucd-13.0.0 --chars +// ucd-generate perl-word ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const PERL_WORD: &'static [(char, char)] = &[ ('0', '9'), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_bool.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_bool.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_bool.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_bool.rs index a0ef0cf..21cbaf9 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_bool.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_bool.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate property-bool ucd-13.0.0 --chars +// ucd-generate property-bool ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("ASCII_Hex_Digit", ASCII_HEX_DIGIT), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_names.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_names.rs similarity index 98% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_names.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_names.rs index 19ca856..6393df2 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_names.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_names.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate property-names ucd-13.0.0 +// ucd-generate property-names ucd-13.0.0 // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const PROPERTY_NAMES: &'static [(&'static str, &'static str)] = &[ ("age", "Age"), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_values.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_values.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_values.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_values.rs index bff7d34..c46653a 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/property_values.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/property_values.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate property-values ucd-13.0.0 --include gc,script,scx,age,gcb,wb,sb +// ucd-generate property-values ucd-13.0.0 --include gc,script,scx,age,gcb,wb,sb // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const PROPERTY_VALUES: &'static [( &'static str, diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/script.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/script.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/script.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/script.rs index a48203e..cd86cba 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/script.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/script.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate script ucd-13.0.0 --chars +// ucd-generate script ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("Adlam", ADLAM), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/script_extension.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/script_extension.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/script_extension.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/script_extension.rs index 1b6b4ff..7fca2af 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/script_extension.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/script_extension.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate script-extension ucd-13.0.0 --chars +// ucd-generate script-extension ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("Adlam", ADLAM), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/sentence_break.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/sentence_break.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/sentence_break.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/sentence_break.rs index e4840f4..67d830f 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/sentence_break.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/sentence_break.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate sentence-break ucd-13.0.0 --chars +// ucd-generate sentence-break ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("ATerm", ATERM), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/word_break.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/word_break.rs similarity index 99% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/word_break.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/word_break.rs index 5c01342..bd23e00 100644 --- a/third_party/cargo/vendor/regex-syntax-0.6.17/src/unicode_tables/word_break.rs +++ b/third_party/cargo/vendor/regex-syntax-0.6.18/src/unicode_tables/word_break.rs @@ -1,8 +1,10 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate word-break ucd-13.0.0 --chars +// ucd-generate word-break ucd-13.0.0 --chars // -// ucd-generate 0.2.7 is available on crates.io. +// Unicode version: 13.0.0. +// +// ucd-generate 0.2.8 is available on crates.io. pub const BY_NAME: &'static [(&'static str, &'static [(char, char)])] = &[ ("ALetter", ALETTER), diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/src/utf8.rs b/third_party/cargo/vendor/regex-syntax-0.6.18/src/utf8.rs similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/src/utf8.rs rename to third_party/cargo/vendor/regex-syntax-0.6.18/src/utf8.rs diff --git a/third_party/cargo/vendor/regex-syntax-0.6.17/test b/third_party/cargo/vendor/regex-syntax-0.6.18/test similarity index 100% rename from third_party/cargo/vendor/regex-syntax-0.6.17/test rename to third_party/cargo/vendor/regex-syntax-0.6.18/test diff --git a/third_party/cargo/vendor/rusttype-0.7.9/.cargo-checksum.json b/third_party/cargo/vendor/rusttype-0.7.9/.cargo-checksum.json index bb77d68..8206956 100644 --- a/third_party/cargo/vendor/rusttype-0.7.9/.cargo-checksum.json +++ b/third_party/cargo/vendor/rusttype-0.7.9/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"516d3e945313c5631195a8fc1eb96d409cb6ae34ba214e199fd8f508b16646d0","Cargo.toml":"bd27bf65e40c2f25ca0eb39c07d860b010194f3981b64e79434dd24ee3425ccd","LICENSE-APACHE":"000b4962e6b27176a0ff89cce4be555b16472cafb5671eb2804a8fdac6854793","LICENSE-MIT":"fd198949ebcc78b2d12fc57ebfb2da4ae8f781b7c3b7047aaccc2f804b6f12ef","README.md":"fee072add28c557715864718d5dbb705f8bb71663873584bf8604228b4b56f22","benches/cache.rs":"5f4acfd3afdb6e9c795787f59369943c1839aba34975089fc959889371a4404c","benches/draw.rs":"7f22cac7f3b22cfbd5a8929cf53789c566c9d6c777ba7a2f6e221aa9f9e9fff7","examples/gpu_cache.rs":"a58809df1a589e6b64806e4a90ff771c116e6c4155a23325dcc1359ffe033a67","examples/image.rs":"95a5e14fa8936450fa3ca2c67e8e529680c10b6b877463dc64cb24c89e67135b","examples/simple.rs":"6edff01831cf9ce8fb8379309ae2882211ba160ea4e029a4ab806c22ed5db6b9","rustfmt.toml":"ed17bf27c3712b8f22ec7a2a9d8e5d9d2a5654299754fb93e9ac76ef6d153114","src/lib.rs":"b42b69f9579b5456236ca827f4c5051fb7e2c935a1ef84029db2cf97413eed78","tests/issues.rs":"5ec278cd8073c4095ad3757254d441f12a403ab745be8a446373209d0a6252a1","tests/lipsum.txt":"0e26c67bc34ba4c083a384468c0c3698800147f05afd13007cd44c5e4d799477","tests/reference_big_biohazard.png":"1f9a4fc9c6357d5462157c49f023d7be3805332be8b8dc85752b0ac0fa485e6a","tests/reference_iota.png":"83824e69dd00c9547a64a2f86a200fe58610bf02c2191044fa22942c56837d57","tests/reference_w.png":"6938997b5d4e798d90ea9ab7dc352c3807a17f974f6cf577963c827a5fc59a28","tests/render_reference.rs":"5ebe9c04e46a7b438d94446dae33e2e8abcac943a0018558d4f9c20b81436699"},"package":"310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5"} \ No newline at end of file +{"files":{"CHANGELOG.md":"516d3e945313c5631195a8fc1eb96d409cb6ae34ba214e199fd8f508b16646d0","Cargo.lock":"b9ae39f0c92d01b4636f85807ce3ed2a498ac7fb0a02ba09bbaaf7ef852ddd4a","Cargo.toml":"bd27bf65e40c2f25ca0eb39c07d860b010194f3981b64e79434dd24ee3425ccd","LICENSE-APACHE":"000b4962e6b27176a0ff89cce4be555b16472cafb5671eb2804a8fdac6854793","LICENSE-MIT":"fd198949ebcc78b2d12fc57ebfb2da4ae8f781b7c3b7047aaccc2f804b6f12ef","README.md":"fee072add28c557715864718d5dbb705f8bb71663873584bf8604228b4b56f22","benches/cache.rs":"5f4acfd3afdb6e9c795787f59369943c1839aba34975089fc959889371a4404c","benches/draw.rs":"7f22cac7f3b22cfbd5a8929cf53789c566c9d6c777ba7a2f6e221aa9f9e9fff7","examples/gpu_cache.rs":"a58809df1a589e6b64806e4a90ff771c116e6c4155a23325dcc1359ffe033a67","examples/image.rs":"95a5e14fa8936450fa3ca2c67e8e529680c10b6b877463dc64cb24c89e67135b","examples/simple.rs":"6edff01831cf9ce8fb8379309ae2882211ba160ea4e029a4ab806c22ed5db6b9","rustfmt.toml":"ed17bf27c3712b8f22ec7a2a9d8e5d9d2a5654299754fb93e9ac76ef6d153114","src/lib.rs":"b42b69f9579b5456236ca827f4c5051fb7e2c935a1ef84029db2cf97413eed78","tests/issues.rs":"5ec278cd8073c4095ad3757254d441f12a403ab745be8a446373209d0a6252a1","tests/lipsum.txt":"0e26c67bc34ba4c083a384468c0c3698800147f05afd13007cd44c5e4d799477","tests/reference_big_biohazard.png":"1f9a4fc9c6357d5462157c49f023d7be3805332be8b8dc85752b0ac0fa485e6a","tests/reference_iota.png":"83824e69dd00c9547a64a2f86a200fe58610bf02c2191044fa22942c56837d57","tests/reference_w.png":"6938997b5d4e798d90ea9ab7dc352c3807a17f974f6cf577963c827a5fc59a28","tests/render_reference.rs":"5ebe9c04e46a7b438d94446dae33e2e8abcac943a0018558d4f9c20b81436699"},"package":"310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5"} \ No newline at end of file diff --git a/third_party/cargo/vendor/rusttype-0.7.9/BUILD b/third_party/cargo/vendor/rusttype-0.7.9/BUILD index 4db5478..f883d81 100644 --- a/third_party/cargo/vendor/rusttype-0.7.9/BUILD +++ b/third_party/cargo/vendor/rusttype-0.7.9/BUILD @@ -37,7 +37,7 @@ rust_library( edition = "2018", srcs = glob(["**/*.rs"]), deps = [ - "//third_party/cargo/vendor/rusttype-0.8.2:rusttype", + "//third_party/cargo/vendor/rusttype-0.8.3:rusttype", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/png-0.16.1/Cargo.lock b/third_party/cargo/vendor/rusttype-0.7.9/Cargo.lock similarity index 63% rename from third_party/cargo/vendor/png-0.16.1/Cargo.lock rename to third_party/cargo/vendor/rusttype-0.7.9/Cargo.lock index 83c9915..9cdd24d 100644 --- a/third_party/cargo/vendor/png-0.16.1/Cargo.lock +++ b/third_party/cargo/vendor/rusttype-0.7.9/Cargo.lock @@ -2,7 +2,7 @@ # It is not intended for manual editing. [[package]] name = "adler32" -version = "1.0.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -10,9 +10,9 @@ name = "andrew" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rusttype 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rusttype 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", "xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -28,73 +28,56 @@ name = "approx" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "arrayref" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "arrayvec" -version = "0.4.12" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "autocfg" -version = "0.1.7" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.40" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.32" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bitflags" -version = "1.2.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "blake2b_simd" -version = "0.5.8" +name = "blake2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -102,27 +85,24 @@ name = "block" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "c2-chacha" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cc" -version = "1.0.46" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.10" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -131,7 +111,7 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -139,35 +119,30 @@ name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cocoa" -version = "0.18.5" +version = "0.18.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "constant_time_eq" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "core-foundation" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -180,18 +155,32 @@ name = "core-graphics" version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "crc32fast" -version = "1.2.0" +name = "crossbeam-deque" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -199,37 +188,44 @@ name = "crossbeam-utils" version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "deflate" -version = "0.8.2" +name = "crypto-mac" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "deflate" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "dirs" -version = "2.0.2" +name = "derivative" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "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.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "dirs-sys" -version = "0.3.4" +name = "digest" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -242,29 +238,9 @@ dependencies = [ [[package]] name = "downcast-rs" -version = "1.1.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "failure" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "fnv" version = "1.0.6" @@ -284,26 +260,11 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "getopts" -version = "0.2.21" +name = "generic-array" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "getrandom" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -336,63 +297,65 @@ dependencies = [ [[package]] name = "glium" -version = "0.24.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "takeable-option 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "glutin" -version = "0.20.1" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cocoa 0.18.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "derivative 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_egl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin_emscripten_sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_gles2_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_glx_sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_wgl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winit 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glutin_egl_sys" -version = "0.1.4" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "glutin_emscripten_sys" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "glutin_gles2_sys" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -412,12 +375,25 @@ dependencies = [ "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "image" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "png 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "inflate" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -432,7 +408,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.65" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -440,7 +416,7 @@ name = "libloading" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -449,9 +425,14 @@ name = "line_drawing" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "linked-hash-map" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lock_api" version = "0.3.1" @@ -465,15 +446,20 @@ name = "log" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lzw" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "malloc_buf" version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -486,49 +472,99 @@ name = "memmap" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "memoffset" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nix" version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nodrop" -version = "0.1.14" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "num-traits" -version = "0.2.9" +name = "num-integer" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-iter" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-rational" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num_cpus" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "objc" -version = "0.2.7" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ordered-float" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -554,9 +590,9 @@ name = "parking_lot_core" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", @@ -570,28 +606,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.3.16" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "png" -version = "0.16.1" -dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "deflate 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", - "glium 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.6" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)", + "inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "proc-macro2" @@ -601,14 +628,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "proc-macro2" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "quote" version = "0.6.13" @@ -617,124 +636,24 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "quote" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_chacha" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_os" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "raw-window-handle" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "redox_syscall" version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "redox_users" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rust-argon2" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-hash" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc_version" version = "0.2.3" @@ -745,20 +664,41 @@ dependencies = [ [[package]] name = "rusttype" -version = "0.7.9" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rusttype 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "stb_truetype 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rusttype" -version = "0.8.1" +version = "0.7.9" +dependencies = [ + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "glium 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)", + "image 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rusttype 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rusttype" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "stb_truetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -794,7 +734,7 @@ version = "0.1.9" 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)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -808,7 +748,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "andrew 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -818,6 +758,14 @@ dependencies = [ "wayland-protocols 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "stb_truetype" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stb_truetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "stb_truetype" version = "0.3.0" @@ -826,51 +774,44 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" -version = "1.0.5" +version = "0.15.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "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 = "synstructure" -version = "0.12.1" +name = "takeable-option" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "term" -version = "0.6.1" +name = "typenum" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "unicode-width" -version = "0.1.6" +name = "unicode-normalization" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 0.6.10 (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 = "unicode-xid" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "void" version = "1.0.2" @@ -886,19 +827,14 @@ dependencies = [ "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "wasi" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "wayland-client" version = "0.21.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "downcast-rs 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -919,7 +855,7 @@ name = "wayland-protocols" version = "0.21.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-scanner 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -974,22 +910,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winit" -version = "0.19.5" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cocoa 0.18.5 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "raw-window-handle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1002,9 +937,9 @@ version = "2.18.4" 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)", - "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1018,98 +953,89 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" "checksum andrew 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b7f09f89872c2b6b29e319377b1fbe91c6f5947df19a25596e121cf19a7b35e" "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" "checksum approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" -"checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" -"checksum arrayvec 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" -"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" -"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" -"checksum backtrace 0.3.40 (registry+https://github.com/rust-lang/crates.io-index)" = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea" -"checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" -"checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -"checksum blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)" = "5850aeee1552f495dd0250014cf64b82b7c8879a89d83b33bbdace2cc4f63182" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" +"checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2" +"checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" +"checksum blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" -"checksum cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c" -"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum cc 1.0.42 (registry+https://github.com/rust-lang/crates.io-index)" = "a61c7bce55cd2fae6ec8cb935ebd76256c2959a1f95790f6118a441c2cd5b406" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum cocoa 0.18.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1706996401131526e36b3b49f0c4d912639ce110996f3ca144d78946727bce54" -"checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" +"checksum cocoa 0.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cf79daa4e11e5def06e55306aa3601b87de6b5149671529318da048f67cdd77b" "checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" "checksum core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" -"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" -"checksum deflate 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f5f3e14a3476e8360a1bb56f2311549cfe458418c4e1e6a333b104123df078d2" -"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" -"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +"checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" +"checksum derivative 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "942ca430eef7a3806595a6737bc388bf51adb888d3fc0dd1b50f1c170167ee3a" +"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" -"checksum downcast-rs 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5fe414cc2fd4447b7da94b27ddfb6831a8a06f35f6d077ab5613ec703866c49a" -"checksum failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f8273f13c977665c5db7eb2b99ae520952fe5ac831ae4cd09d80c4c7042b5ed9" -"checksum failure_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bc225b78e0391e4b8683440bf2e63c2deeeb2ce5189eab46e2b68c6d3725d08" +"checksum downcast-rs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b92dfd5c2f75260cbf750572f95d387e7ca0ba5e3fbe9e1a33f23025be020f" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" -"checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" -"checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" +"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd" "checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" "checksum gleam 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "cae10d7c99d0e77b4766e850a60898a17c1abaf01075531f1066f03dc7dc5fc5" -"checksum glium 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)" = "213290166315d0ff3cf48dd76a31f3ad57c934182d3e87aeec890f2747226a21" -"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum glutin 0.20.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e5cc17ac6cb35704f434faaa5bb5e4254a66f50853976c7e6f00aee09ff1bf2" -"checksum glutin_egl_sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "772edef3b28b8ad41e4ea202748e65eefe8e5ffd1f4535f1219793dbb20b3d4c" +"checksum glium 0.25.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6d7d887755ee729c5204e151db1c81b0b5beb809ef5e01d0eb14847e80a71256" +"checksum glutin 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "938ce7a2b1bbfe1535166133bea3f9c1b46350d2794b49561303575e9e1b9949" +"checksum glutin_egl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "23f48987ab6cb2b61ad903b59e54a2fd0c380a7baff68cffd6826b69a73dd326" +"checksum glutin_emscripten_sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "245b3fdb08df6ffed7585365851f8404af9c7e2dd4b59f15262e968b6a95a0c7" "checksum glutin_gles2_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "89996c30857ae1b4de4b5189abf1ea822a20a9fe9e1c93e5e7b862ff0bdd5cdf" "checksum glutin_glx_sys 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1290a5ca5e46fcfa7f66f949cc9d9194b2cb6f2ed61892c8c2b82343631dba57" "checksum glutin_wgl_sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f801bbc91efc22dd1c4818a47814fc72bf74d024510451b119381579bfa39021" +"checksum image 0.21.3 (registry+https://github.com/rust-lang/crates.io-index)" = "35371e467cd7b0b3d1d6013d619203658467df12d61b0ca43cd67b743b1965eb" "checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" "checksum khronos_api 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" +"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum line_drawing 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" +"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" "checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" "checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" -"checksum nodrop 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" -"checksum num-traits 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "443c53b3c3531dfcbfa499d8893944db78474ad7a1d87fa2d94d1a2231693ac6" -"checksum objc 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" +"checksum num-rational 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2885278d5fe2adc2f75ced642d52d879bffaceb5a2e0b1d4309ffdfb239b454" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" +"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" +"checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" "checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea" -"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum png 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "63daf481fdd0defa2d1d2be15c674fbfa1b0fd71882c303a91f9a79b3252c359" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" -"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" -"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" -"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -"checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" -"checksum raw-window-handle 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9db80d08d3ed847ce4fb3def46de0af4bfb6155bd09bd6eaf28b5ac72541c1f1" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_users 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecedbca3bf205f8d8f5c2b44d83cd0690e39ee84b951ed649e9f1841132b66d" -"checksum rust-argon2 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4ca4eaef519b494d1f2848fc602d18816fed808a981aedf4f1f00ceb7c9d32cf" "checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum rusttype 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5" -"checksum rusttype 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6fa38506b5cbf2fb67f915e2725cb5012f1b9a785b0ab55c4733acda5f6554ef" +"checksum rusttype 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "654103d61a05074b268a107cf6581ce120f0fc0115f2610ed9dfea363bb81139" +"checksum rusttype 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07c67d4df90dcc0296c39e293fa9cfbbd29def131a5a3ffb9bc671f8dc906942" "checksum same-file 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "585e8ddcedc187886a30fa705c47985c3fa88d06624095856b36ca0b82ff4421" "checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" @@ -1117,16 +1043,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa" +"checksum stb_truetype 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9d1bec4382294c5a680fcebd29f8451e8d8c04479a026f6909004e2ab1cb425d" "checksum stb_truetype 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "824210d6fb52cbc3ad2545270ead6860c7311aa5450642b078da4515937b6f7a" -"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" -"checksum synstructure 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3f085a5855930c0441ca1288cf044ea4aecf4f43a91668abdb870b4ba546a203" -"checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" -"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" +"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +"checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +"checksum takeable-option 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d77adff586b9bd922afef7791341ed94b09845e11225929217efe949e6366d43" +"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e" -"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" "checksum wayland-client 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713" "checksum wayland-commons 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec" "checksum wayland-protocols 0.21.13 (registry+https://github.com/rust-lang/crates.io-index)" = "4afde2ea2a428eee6d7d2c8584fdbe8b82eee8b6c353e129a434cd6e07f42145" @@ -1136,7 +1062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum winit 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1e96eb4bb472fa43e718e8fa4aef82f86cd9deac9483a1e1529230babdb394a8" +"checksum winit 0.19.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7d0da905e61ae52d55c5ca6f8bea1e09daf5e325b6c77b0947c65a5179b49f5f" "checksum x11-dl 2.18.4 (registry+https://github.com/rust-lang/crates.io-index)" = "be65e1342a3baae65439cd03306778831a3d133b0d20243a7fb83fd5cf403c58" "checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" "checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5" diff --git a/third_party/cargo/vendor/rusttype-0.8.2/.cargo-checksum.json b/third_party/cargo/vendor/rusttype-0.8.2/.cargo-checksum.json deleted file mode 100644 index 992ae60..0000000 --- a/third_party/cargo/vendor/rusttype-0.8.2/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"CHANGELOG.md":"9010bf26df753d67a8a3dd8602f88b7bb8934defa46f634e925689280e0ca2f2","Cargo.toml":"bbbaea100e9ec78824b3bc13a4717718fb186830febeef2e0db842bad79b7e09","LICENSE-APACHE":"000b4962e6b27176a0ff89cce4be555b16472cafb5671eb2804a8fdac6854793","LICENSE-MIT":"fd198949ebcc78b2d12fc57ebfb2da4ae8f781b7c3b7047aaccc2f804b6f12ef","README.md":"57f3d1e10f26e69dce7120be911226246aead1d40db3bdd15b63b71d69f315b8","rustfmt.toml":"ed17bf27c3712b8f22ec7a2a9d8e5d9d2a5654299754fb93e9ac76ef6d153114","src/geometry.rs":"a817203d90212574233ea6af5cd02b629e9bb52f4b71073040cc1236810fb907","src/gpu_cache.rs":"e278a000fd01478cb92e696bf67a0a3ef0ec1a50b5a813717028cdc5676c6ef0","src/lib.rs":"89266e185088c7922b0d86399ad67ad53b89ad564ccc86db2395c338e074e9d0","src/nostd_float.rs":"11f38ff37d6f67369d2cfc3ce960476aad8c7904c47d430fbf4655482e6cde7d","src/rasterizer.rs":"f91b8ab4285da4b96ee8058181db36d0002da3cd58d946e954abd373024a84a3"},"package":"14a911032fb5791ccbeec9f28fdcb9bf0983b81f227bafdfd227c658d0731c8a"} \ No newline at end of file diff --git a/third_party/cargo/vendor/rusttype-0.8.3/.cargo-checksum.json b/third_party/cargo/vendor/rusttype-0.8.3/.cargo-checksum.json new file mode 100644 index 0000000..10b71a6 --- /dev/null +++ b/third_party/cargo/vendor/rusttype-0.8.3/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"CHANGELOG.md":"cae27b3831dd3c1544d2eccefa04327d8822d171a9cc8be18a98460efccba9db","Cargo.toml":"7be15a842fe54015debd48cf8ebb2c859e8a0cf3ca79fcada36d0f6023842da0","LICENSE-APACHE":"000b4962e6b27176a0ff89cce4be555b16472cafb5671eb2804a8fdac6854793","LICENSE-MIT":"fd198949ebcc78b2d12fc57ebfb2da4ae8f781b7c3b7047aaccc2f804b6f12ef","README.md":"57f3d1e10f26e69dce7120be911226246aead1d40db3bdd15b63b71d69f315b8","rustfmt.toml":"ed17bf27c3712b8f22ec7a2a9d8e5d9d2a5654299754fb93e9ac76ef6d153114","src/geometry.rs":"397e9e5be0c66150b0f6709a825bb45bccdcd4895a249d2b98f9ef7965591814","src/gpu_cache.rs":"ff22997f70442959d785e0516a5d0e29826a724747dfa40a5355ad9967701214","src/lib.rs":"7b91c9a9e474dcfca21dbb5849703616bed8810b09bcd4dc689f98f9e271fe78","src/nostd_float.rs":"11f38ff37d6f67369d2cfc3ce960476aad8c7904c47d430fbf4655482e6cde7d","src/rasterizer.rs":"44d7e06ba6d8816fcf00a61a4a9ac4886f6c16ab86e59a12c0a69bd8a64e8203"},"package":"9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0"} \ No newline at end of file diff --git a/third_party/cargo/vendor/rusttype-0.8.2/BUILD b/third_party/cargo/vendor/rusttype-0.8.3/BUILD similarity index 92% rename from third_party/cargo/vendor/rusttype-0.8.2/BUILD rename to third_party/cargo/vendor/rusttype-0.8.3/BUILD index dd83401..e203b2f 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/BUILD +++ b/third_party/cargo/vendor/rusttype-0.8.3/BUILD @@ -32,14 +32,13 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/approx-0.3.2:approx", - "//third_party/cargo/vendor/arrayvec-0.5.1:arrayvec", "//third_party/cargo/vendor/ordered-float-1.0.2:ordered_float", "//third_party/cargo/vendor/stb_truetype-0.3.1:stb_truetype", ], rustc_flags = [ "--cap-lints=allow", ], - version = "0.8.2", + version = "0.8.3", crate_features = [ "default", "has-atomics", diff --git a/third_party/cargo/vendor/rusttype-0.8.2/CHANGELOG.md b/third_party/cargo/vendor/rusttype-0.8.3/CHANGELOG.md similarity index 98% rename from third_party/cargo/vendor/rusttype-0.8.2/CHANGELOG.md rename to third_party/cargo/vendor/rusttype-0.8.3/CHANGELOG.md index 442c0ac..aa9b487 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/CHANGELOG.md +++ b/third_party/cargo/vendor/rusttype-0.8.3/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.3 +* Remove arrayvec dependency. +* Add `Default` implementations for geometry structs. + ## 0.8.2 * Update crossbeam-utils -> `0.7`. * Update libm -> `0.2.1`. diff --git a/third_party/cargo/vendor/rusttype-0.8.2/Cargo.toml b/third_party/cargo/vendor/rusttype-0.8.3/Cargo.toml similarity index 96% rename from third_party/cargo/vendor/rusttype-0.8.2/Cargo.toml rename to third_party/cargo/vendor/rusttype-0.8.3/Cargo.toml index 7d51b86..a37fa26 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/Cargo.toml +++ b/third_party/cargo/vendor/rusttype-0.8.3/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "rusttype" -version = "0.8.2" +version = "0.8.3" authors = ["Dylan Ede ", "Jeremy Soller ", "Alex Butler "] exclude = ["/dev/**"] description = "A pure Rust alternative to libraries like FreeType.\n\nRustType provides an API for loading, querying and rasterising TrueType fonts.\n\nIt also provides an implementation of a dynamic GPU glyph cache for hardware font rendering.\n" @@ -29,10 +29,6 @@ features = ["gpu_cache"] version = "0.3" default-features = false -[dependencies.arrayvec] -version = "0.5" -default-features = false - [dependencies.libm] version = "0.2.1" optional = true diff --git a/third_party/cargo/vendor/rusttype-0.8.2/LICENSE-APACHE b/third_party/cargo/vendor/rusttype-0.8.3/LICENSE-APACHE similarity index 100% rename from third_party/cargo/vendor/rusttype-0.8.2/LICENSE-APACHE rename to third_party/cargo/vendor/rusttype-0.8.3/LICENSE-APACHE diff --git a/third_party/cargo/vendor/rusttype-0.8.2/LICENSE-MIT b/third_party/cargo/vendor/rusttype-0.8.3/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/rusttype-0.8.2/LICENSE-MIT rename to third_party/cargo/vendor/rusttype-0.8.3/LICENSE-MIT diff --git a/third_party/cargo/vendor/rusttype-0.8.2/README.md b/third_party/cargo/vendor/rusttype-0.8.3/README.md similarity index 100% rename from third_party/cargo/vendor/rusttype-0.8.2/README.md rename to third_party/cargo/vendor/rusttype-0.8.3/README.md diff --git a/third_party/cargo/vendor/rusttype-0.8.2/rustfmt.toml b/third_party/cargo/vendor/rusttype-0.8.3/rustfmt.toml similarity index 100% rename from third_party/cargo/vendor/rusttype-0.8.2/rustfmt.toml rename to third_party/cargo/vendor/rusttype-0.8.3/rustfmt.toml diff --git a/third_party/cargo/vendor/rusttype-0.8.2/src/geometry.rs b/third_party/cargo/vendor/rusttype-0.8.3/src/geometry.rs similarity index 96% rename from third_party/cargo/vendor/rusttype-0.8.2/src/geometry.rs rename to third_party/cargo/vendor/rusttype-0.8.3/src/geometry.rs index 422198a..4745b91 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/src/geometry.rs +++ b/third_party/cargo/vendor/rusttype-0.8.3/src/geometry.rs @@ -17,7 +17,7 @@ use crate::nostd_float::FloatExt; /// # let t = 0.5; let p0 = point(0.0, 0.0); let p1 = point(0.0, 0.0); /// let interpolated_point = p0 + (p1 - p0) * t; /// ``` -#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, Default, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct Point { pub x: N, pub y: N, @@ -28,11 +28,12 @@ pub struct Point { /// Legal operations on vectors are addition and subtraction by vectors, /// addition by points (to give points), and multiplication and division by /// scalars. -#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, Debug, Default, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct Vector { pub x: N, pub y: N, } + /// A convenience function for generating `Point`s. #[inline] pub fn point(x: N, y: N) -> Point { @@ -143,23 +144,24 @@ impl> ops::Add> for Vector { } /// A straight line between two points, `p[0]` and `p[1]` -#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] +#[derive(Copy, Clone, Debug, Default, PartialEq, PartialOrd)] pub struct Line { pub p: [Point; 2], } /// A quadratic Bezier curve, starting at `p[0]`, ending at `p[2]`, with control /// point `p[1]`. -#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] +#[derive(Copy, Clone, Debug, Default, PartialEq, PartialOrd)] pub struct Curve { pub p: [Point; 3], } /// A rectangle, with top-left corner at `min`, and bottom-right corner at /// `max`. -#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] +#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Hash, PartialOrd, Ord)] pub struct Rect { pub min: Point, pub max: Point, } + impl + Copy> Rect { pub fn width(&self) -> N { self.max.x - self.min.x diff --git a/third_party/cargo/vendor/rusttype-0.8.2/src/gpu_cache.rs b/third_party/cargo/vendor/rusttype-0.8.3/src/gpu_cache.rs similarity index 98% rename from third_party/cargo/vendor/rusttype-0.8.2/src/gpu_cache.rs rename to third_party/cargo/vendor/rusttype-0.8.3/src/gpu_cache.rs index 45c0661..ff6b94a 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/src/gpu_cache.rs +++ b/third_party/cargo/vendor/rusttype-0.8.3/src/gpu_cache.rs @@ -489,16 +489,13 @@ pub enum CacheReadErr { } impl fmt::Display for CacheReadErr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", error::Error::description(self)) - } -} -impl error::Error for CacheReadErr { - fn description(&self) -> &str { match *self { CacheReadErr::GlyphNotCached => "Glyph not cached", } + .fmt(f) } } +impl error::Error for CacheReadErr {} /// Returned from `Cache::cache_queued`. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] @@ -512,18 +509,16 @@ pub enum CacheWriteErr { } impl fmt::Display for CacheWriteErr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", error::Error::description(self)) - } -} -impl error::Error for CacheWriteErr { - fn description(&self) -> &str { match *self { CacheWriteErr::GlyphTooLarge => "Glyph too large", CacheWriteErr::NoRoomForWholeQueue => "No room for whole queue", } + .fmt(f) } } +impl error::Error for CacheWriteErr {} + /// Successful method of caching of the queue. #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum CachedBy { @@ -818,7 +813,8 @@ impl<'font> Cache<'font> { } if queue_success { - #[cfg(not(target_arch = "wasm32"))] { + #[cfg(not(target_arch = "wasm32"))] + { let glyph_count = draw_and_upload.len(); if self.multithread && glyph_count > 1 { @@ -884,7 +880,8 @@ impl<'font> Cache<'font> { } } } - #[cfg(target_arch = "wasm32")] { + #[cfg(target_arch = "wasm32")] + { for (tex_coords, glyph) in draw_and_upload { let pixels = draw_glyph(tex_coords, glyph, self.pad_glyphs); uploader(tex_coords, pixels.as_slice()); @@ -1128,9 +1125,9 @@ mod test { .multithread(true) .build(); - let font = Font::from_bytes( - include_bytes!("../dev/fonts/wqy-microhei/WenQuanYiMicroHei.ttf") as &[u8], - ) + let font = Font::from_bytes(include_bytes!( + "../dev/fonts/wqy-microhei/WenQuanYiMicroHei.ttf" + ) as &[u8]) .unwrap(); cache.queue_glyph( 0, @@ -1211,9 +1208,9 @@ mod test { .dimensions(64, 64) .align_4x4(align_4x4) .build(); - let font = Font::from_bytes( - include_bytes!("../dev/fonts/wqy-microhei/WenQuanYiMicroHei.ttf") as &[u8], - ) + let font = Font::from_bytes(include_bytes!( + "../dev/fonts/wqy-microhei/WenQuanYiMicroHei.ttf" + ) as &[u8]) .unwrap(); let glyph = font .glyph('l') diff --git a/third_party/cargo/vendor/rusttype-0.8.2/src/lib.rs b/third_party/cargo/vendor/rusttype-0.8.3/src/lib.rs similarity index 100% rename from third_party/cargo/vendor/rusttype-0.8.2/src/lib.rs rename to third_party/cargo/vendor/rusttype-0.8.3/src/lib.rs index 186d243..81c67f6 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/src/lib.rs +++ b/third_party/cargo/vendor/rusttype-0.8.3/src/lib.rs @@ -116,10 +116,10 @@ use alloc::rc::Rc as Arc; #[cfg(feature = "has-atomics")] use alloc::sync::Arc; -#[cfg(not(feature = "std"))] -use alloc::{boxed::Box, vec::Vec}; #[cfg(all(feature = "libm-math", not(feature = "std")))] use crate::nostd_float::FloatExt; +#[cfg(not(feature = "std"))] +use alloc::{boxed::Box, vec::Vec}; /// A collection of fonts read straight from a font file's data. The data in the /// collection is not validated. This structure may or may not own the font diff --git a/third_party/cargo/vendor/rusttype-0.8.2/src/nostd_float.rs b/third_party/cargo/vendor/rusttype-0.8.3/src/nostd_float.rs similarity index 100% rename from third_party/cargo/vendor/rusttype-0.8.2/src/nostd_float.rs rename to third_party/cargo/vendor/rusttype-0.8.3/src/nostd_float.rs diff --git a/third_party/cargo/vendor/rusttype-0.8.2/src/rasterizer.rs b/third_party/cargo/vendor/rusttype-0.8.3/src/rasterizer.rs similarity index 93% rename from third_party/cargo/vendor/rusttype-0.8.2/src/rasterizer.rs rename to third_party/cargo/vendor/rusttype-0.8.3/src/rasterizer.rs index 275709b..57f007c 100644 --- a/third_party/cargo/vendor/rusttype-0.8.2/src/rasterizer.rs +++ b/third_party/cargo/vendor/rusttype-0.8.3/src/rasterizer.rs @@ -2,9 +2,10 @@ use crate::geometry::*; use approx::relative_eq; use ordered_float::OrderedFloat; -use alloc::vec::Vec; #[cfg(all(feature = "libm-math", not(feature = "std")))] use crate::nostd_float::FloatExt; +use alloc::vec::Vec; +use core::iter; trait SliceUp: Sized { type PerSlice: Iterator; @@ -86,7 +87,7 @@ impl SliceUp for Line { } } -type CurveIter = arrayvec::IntoIter<[Curve; 2]>; +type CurveIter = iter::Chain, core::option::IntoIter>; struct CurveSliceIter { curve: Curve, @@ -102,7 +103,6 @@ impl Iterator for CurveSliceIter { fn next(&mut self) -> Option { use crate::geometry::solve_quadratic_real as solve; use crate::geometry::RealQuadraticSolution as RQS; - use arrayvec::ArrayVec; if self.i >= self.planes.count { return None; } @@ -113,7 +113,10 @@ impl Iterator for CurveSliceIter { let upper_d = self.planes.start + self.planes.step * upper; let l_sol = solve(self.a, self.b, self.c_shift - lower_d); let u_sol = solve(self.a, self.b, self.c_shift - upper_d); - let mut result = ArrayVec::<[Curve; 2]>::new(); + + let mut curve1 = None; + let mut curve2 = None; + match (l_sol.in_order(), u_sol.in_order()) { (RQS::Two(a, b), RQS::Two(c, d)) => { // Two pieces @@ -128,11 +131,14 @@ impl Iterator for CurveSliceIter { c.min(1.0).max(0.0), d.min(1.0).max(0.0), ); - if !relative_eq!(a, b) { - result.push(self.curve.cut_from_to(a, b)); - } - if !relative_eq!(c, d) { - result.push(self.curve.cut_from_to(c, d)); + match (relative_eq!(a, b), relative_eq!(c, d)) { + (false, false) => { + curve1 = Some(self.curve.cut_from_to(a, b)); + curve2 = Some(self.curve.cut_from_to(c, d)); + } + (false, true) => curve1 = Some(self.curve.cut_from_to(a, b)), + (true, false) => curve1 = Some(self.curve.cut_from_to(c, d)), + _ => {} } } (RQS::Two(a, b), RQS::None) @@ -145,12 +151,12 @@ impl Iterator for CurveSliceIter { let a = a.min(1.0).max(0.0); let b = b.min(1.0).max(0.0); if !relative_eq!(a, b) { - result.push(self.curve.cut_from_to(a, b)); + curve1 = Some(self.curve.cut_from_to(a, b)); } } (RQS::All, RQS::None) | (RQS::None, RQS::All) => { // coincident with one plane - result.push(self.curve); + curve1 = Some(self.curve); } (RQS::None, RQS::None) => { if self.a == 0.0 @@ -159,12 +165,16 @@ impl Iterator for CurveSliceIter { && self.c_shift <= upper_d { // parallel to planes, inbetween - result.push(self.curve); + curve1 = Some(self.curve); } } _ => unreachable!(), // impossible } - Some(result.into_iter()) + + match curve1 { + Some(curve) => Some(iter::once(curve).chain(curve2)), + None => None + } } } diff --git a/third_party/cargo/vendor/same-file-1.0.6/.cargo-checksum.json b/third_party/cargo/vendor/same-file-1.0.6/.cargo-checksum.json index 0d13a57..bcc92c5 100644 --- a/third_party/cargo/vendor/same-file-1.0.6/.cargo-checksum.json +++ b/third_party/cargo/vendor/same-file-1.0.6/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.toml":"991f8df8fa5a259801900a56908cf21a66c5cf7b238bc81ba9bdf348e233252e","LICENSE-MIT":"cb3c929a05e6cbc9de9ab06a4c57eeb60ca8c724bef6c138c87d3a577e27aa14","README.md":"70c109d9c89b4479016142f2a4ad6963b6fe5793bcdd997add3d3af3d2baf36b","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","examples/is_same_file.rs":"7b3eeb27a15051667d97615fc7a2339cbff5630df3bca6ac19ab81d5be22f329","examples/is_stderr.rs":"e1c5d1a0f36d7aa0020bb5b87c2f45c7176033f03c52cf395be55dd8debfc413","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/lib.rs":"b22c2f0b5cad2248f16f4f42add52b2dc0c627631f71ee67a8c38fe305048f85","src/unix.rs":"69abed9fade151247696c6d4a442ef299554f3722e23a2d08053598a52a27d62","src/unknown.rs":"bfde4e9ac88f500c0ccb69165383682ddd24bf7d7ddaf5859426e1fd4b2f9359","src/win.rs":"94f912cc3734f60608d0ee2b0c664afb65fc96e5b0b223a53565fb8998c03fa3"},"package":"93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"} \ No newline at end of file +{"files":{"COPYING":"01c266bced4a434da0051174d6bee16a4c82cf634e2679b6155d40d75012390f","Cargo.lock":"fa40407b035c7abffe97d267d2ff95d22d83e5b916aca876bec49a56a9067c73","Cargo.toml":"991f8df8fa5a259801900a56908cf21a66c5cf7b238bc81ba9bdf348e233252e","LICENSE-MIT":"cb3c929a05e6cbc9de9ab06a4c57eeb60ca8c724bef6c138c87d3a577e27aa14","README.md":"70c109d9c89b4479016142f2a4ad6963b6fe5793bcdd997add3d3af3d2baf36b","UNLICENSE":"7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c","examples/is_same_file.rs":"7b3eeb27a15051667d97615fc7a2339cbff5630df3bca6ac19ab81d5be22f329","examples/is_stderr.rs":"e1c5d1a0f36d7aa0020bb5b87c2f45c7176033f03c52cf395be55dd8debfc413","rustfmt.toml":"1ca600239a27401c4a43f363cf3f38183a212affc1f31bff3ae93234bbaec228","src/lib.rs":"b22c2f0b5cad2248f16f4f42add52b2dc0c627631f71ee67a8c38fe305048f85","src/unix.rs":"69abed9fade151247696c6d4a442ef299554f3722e23a2d08053598a52a27d62","src/unknown.rs":"bfde4e9ac88f500c0ccb69165383682ddd24bf7d7ddaf5859426e1fd4b2f9359","src/win.rs":"94f912cc3734f60608d0ee2b0c664afb65fc96e5b0b223a53565fb8998c03fa3"},"package":"93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"} \ No newline at end of file diff --git a/third_party/cargo/vendor/same-file-1.0.6/Cargo.lock b/third_party/cargo/vendor/same-file-1.0.6/Cargo.lock new file mode 100644 index 0000000..de49c9d --- /dev/null +++ b/third_party/cargo/vendor/same-file-1.0.6/Cargo.lock @@ -0,0 +1,48 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "doc-comment" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "same-file" +version = "1.0.6" +dependencies = [ + "doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum doc-comment 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "923dea538cea0aa3025e8685b20d6ee21ef99c4f77e954a30febbaac5ec73a97" +"checksum winapi 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "890b38836c01d72fdb636d15c9cfc52ec7fd783b330abc93cd1686f4308dfccc" +"checksum winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec6667f60c23eca65c561e63a13d81b44234c2e38a6b6c959025ee907ec614cc" +"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" +"checksum winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98f12c52b2630cd05d2c3ffd8e008f7f48252c042b4871c72aed9dc733b96668" diff --git a/third_party/cargo/vendor/serde-1.0.110/.cargo-checksum.json b/third_party/cargo/vendor/serde-1.0.110/.cargo-checksum.json new file mode 100644 index 0000000..2ebdce8 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"2c0f2031156304d809c7af3da047c2ebf6cbc604c986660284da32ba07cd2d33","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"08cb53171b9af626517be043b2c566340a964723804a0644f9545b8eee64d46c","build.rs":"00972536ef079d36b6a547057ae423352b30da93554c5f22d33196e3e1753dbc","crates-io.md":"131dee2d4beaf83485aed22942b98815ef65af9bcfb65f02b5b90c59b8bc7b8b","src/de/from_primitive.rs":"058fa17313ed3a9c29ec04c6ec67f21a756f6f28cdeb4b0dfcd7012b3e702d0b","src/de/ignored_any.rs":"6a0527edd497a56a103ae65f5e73da675b3f99094d6dcad3c335c8d932daaf40","src/de/impls.rs":"3534fafb62bfbd1f043ebbcd5abb1a1f9cf26e0f5443e7125f72928a4a7dc61e","src/de/mod.rs":"0dd0c8bdefa86f621fdeba8f7b5575463c111bf034b0297e80d3aa8fedf40955","src/de/utf8.rs":"f17524ee0af98ec3abcfd7d0b812fbd1033263bd8e2ce2f57c1e1999ce153558","src/de/value.rs":"a878f6bdd57d25b0b93bfc6288ed1e46c50870dc8703748b6fbb8c0965a6b586","src/export.rs":"2ebdf0eccaa64c5e98c6dfd13b4980474f627fc3fae90cfc2c741acf860afd5d","src/integer128.rs":"b213ec6c1ecf8c8228d9591e0b2c31b78d972cd4c6a0b231468090f15784f6f6","src/lib.rs":"12a35086703a5d70e57107d793b89ae5769256198dc6efda224b5a84cbb37f48","src/macros.rs":"f18fc25c5fb857238bf119cdee5c7987a8584dea69c51f27ca718b7dfd871d0f","src/private/de.rs":"777285672916b096f21827daa6a8a4f488934723a380881bdf893dff96648d32","src/private/macros.rs":"ebb6affd4c89e3b5f9a42e03f8b7d966bc588875e9b44e962d0b7aba7f80a10f","src/private/mod.rs":"f8f2cd5edbfc26c268b34cdb89db1b34e6348f81384f03d18532e7568575006d","src/private/ser.rs":"67c085463d348806225f323eabd32b5bfd540ec8d78a1b515436af9b8a9636ec","src/ser/fmt.rs":"7827ed07fd8897e6324f75625ba0c926a4c4e7ec2914cd067391ce54d942ac7b","src/ser/impls.rs":"ce9996998c6485c88bbc77516611e9f5a9a92cbb12d34bb4f8ae022530be85e0","src/ser/impossible.rs":"3dd0e165b88fc67e698e675f16569b91fab9e054caa4c3e1997f929ba364fe90","src/ser/mod.rs":"768135161bf67aa5f17908603b84710734e9fdcfdf78bdb32e724899521b2c8e","src/std_error.rs":"3aac687856c035517fae44ed2906dd4a1e3184bae4bf613adcdeb73f74126c57"},"package":"99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c"} \ No newline at end of file diff --git a/third_party/cargo/vendor/serde-1.0.110/BUILD b/third_party/cargo/vendor/serde-1.0.110/BUILD new file mode 100644 index 0000000..c736281 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/BUILD @@ -0,0 +1,45 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted + +rust_library( + name = "serde", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2015", + srcs = glob(["**/*.rs"]), + deps = [ + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.110", + crate_features = [ + "default", + "std", + ], +) + diff --git a/third_party/cargo/vendor/serde-1.0.110/Cargo.toml b/third_party/cargo/vendor/serde-1.0.110/Cargo.toml new file mode 100644 index 0000000..a235efb --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/Cargo.toml @@ -0,0 +1,44 @@ +# 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 = "serde" +version = "1.0.110" +authors = ["Erick Tryzelaar ", "David Tolnay "] +build = "build.rs" +include = ["Cargo.toml", "build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] +description = "A generic serialization/deserialization framework" +homepage = "https://serde.rs" +documentation = "https://docs.serde.rs/serde/" +readme = "crates-io.md" +keywords = ["serde", "serialization", "no_std"] +categories = ["encoding"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/serde-rs/serde" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[package.metadata.playground] +features = ["derive", "rc"] +[dependencies.serde_derive] +version = "=1.0.110" +optional = true +[dev-dependencies.serde_derive] +version = "1.0" + +[features] +alloc = [] +default = ["std"] +derive = ["serde_derive"] +rc = [] +std = [] +unstable = [] diff --git a/third_party/cargo/vendor/serde-1.0.110/LICENSE-APACHE b/third_party/cargo/vendor/serde-1.0.110/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/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/third_party/cargo/vendor/serde-1.0.110/LICENSE-MIT b/third_party/cargo/vendor/serde-1.0.110/LICENSE-MIT new file mode 100644 index 0000000..31aa793 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/LICENSE-MIT @@ -0,0 +1,23 @@ +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/third_party/cargo/vendor/serde-1.0.110/README.md b/third_party/cargo/vendor/serde-1.0.110/README.md new file mode 100644 index 0000000..1deda42 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/README.md @@ -0,0 +1,101 @@ +# Serde   [![Build Status]][actions] [![Latest Version]][crates.io] [![serde: rustc 1.13+]][Rust 1.13] [![serde_derive: rustc 1.31+]][Rust 1.31] + +[Build Status]: https://img.shields.io/github/workflow/status/serde-rs/serde/CI/master +[actions]: https://github.com/serde-rs/serde/actions?query=branch%3Amaster +[Latest Version]: https://img.shields.io/crates/v/serde.svg +[crates.io]: https://crates.io/crates/serde +[serde: rustc 1.13+]: https://img.shields.io/badge/serde-rustc_1.13+-lightgray.svg +[serde_derive: rustc 1.31+]: https://img.shields.io/badge/serde_derive-rustc_1.31+-lightgray.svg +[Rust 1.13]: https://blog.rust-lang.org/2016/11/10/Rust-1.13.html +[Rust 1.31]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html + +**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.** + +--- + +You may be looking for: + +- [An overview of Serde](https://serde.rs/) +- [Data formats supported by Serde](https://serde.rs/#data-formats) +- [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) +- [Examples](https://serde.rs/examples.html) +- [API documentation](https://docs.serde.rs/serde/) +- [Release notes](https://github.com/serde-rs/serde/releases) + +## Serde in action + +
+ +Click to show Cargo.toml. +Run this code in the playground. + + +```toml +[dependencies] + +# The core APIs, including the Serialize and Deserialize traits. Always +# required when using Serde. The "derive" feature is only required when +# using #[derive(Serialize, Deserialize)] to make Serde work with structs +# and enums defined in your crate. +serde = { version = "1.0", features = ["derive"] } + +# Each data format lives in its own crate; the sample code below uses JSON +# but you may be using a different one. +serde_json = "1.0" +``` + +
+

+ +```rust +use serde::{Serialize, Deserialize}; + +#[derive(Serialize, Deserialize, Debug)] +struct Point { + x: i32, + y: i32, +} + +fn main() { + let point = Point { x: 1, y: 2 }; + + // Convert the Point to a JSON string. + let serialized = serde_json::to_string(&point).unwrap(); + + // Prints serialized = {"x":1,"y":2} + println!("serialized = {}", serialized); + + // Convert the JSON string back to a Point. + let deserialized: Point = serde_json::from_str(&serialized).unwrap(); + + // Prints deserialized = Point { x: 1, y: 2 } + println!("deserialized = {:?}", deserialized); +} +``` + +## Getting help + +Serde developers live in the #serde channel on [`irc.mozilla.org`][irc]. The +\#rust channel is also a good resource with generally faster response time but +less specific knowledge about Serde. If IRC is not your thing or you don't get a +good response, we are happy to respond to [GitHub issues][issues] as well. + +[irc]: https://wiki.mozilla.org/IRC +[issues]: https://github.com/serde-rs/serde/issues/new/choose + +
+ +#### License + + +Licensed under either of Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in Serde 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/third_party/cargo/vendor/serde-1.0.110/build.rs b/third_party/cargo/vendor/serde-1.0.110/build.rs new file mode 100644 index 0000000..1453adf --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/build.rs @@ -0,0 +1,127 @@ +use std::env; +use std::process::Command; +use std::str::{self, FromStr}; + +// The rustc-cfg strings below are *not* public API. Please let us know by +// opening a GitHub issue if your build environment requires some way to enable +// these cfgs other than by executing our build script. +fn main() { + let minor = match rustc_minor_version() { + Some(minor) => minor, + None => return, + }; + + let target = env::var("TARGET").unwrap(); + let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten"; + + // std::collections::Bound was stabilized in Rust 1.17 + // but it was moved to core::ops later in Rust 1.26: + // https://doc.rust-lang.org/core/ops/enum.Bound.html + if minor >= 26 { + println!("cargo:rustc-cfg=ops_bound"); + } else if minor >= 17 && cfg!(feature = "std") { + println!("cargo:rustc-cfg=collections_bound"); + } + + // core::cmp::Reverse stabilized in Rust 1.19: + // https://doc.rust-lang.org/stable/core/cmp/struct.Reverse.html + if minor >= 19 { + println!("cargo:rustc-cfg=core_reverse"); + } + + // CString::into_boxed_c_str and PathBuf::into_boxed_path stabilized in Rust 1.20: + // https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str + // https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.into_boxed_path + if minor >= 20 { + println!("cargo:rustc-cfg=de_boxed_c_str"); + println!("cargo:rustc-cfg=de_boxed_path"); + } + + // From> for Rc / Arc stabilized in Rust 1.21: + // https://doc.rust-lang.org/std/rc/struct.Rc.html#impl-From> + // https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-From> + if minor >= 21 { + println!("cargo:rustc-cfg=de_rc_dst"); + } + + // Duration available in core since Rust 1.25: + // https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#library-stabilizations + if minor >= 25 { + println!("cargo:rustc-cfg=core_duration"); + } + + // 128-bit integers stabilized in Rust 1.26: + // https://blog.rust-lang.org/2018/05/10/Rust-1.26.html + // + // Disabled on Emscripten targets as Emscripten doesn't + // currently support integers larger than 64 bits. + if minor >= 26 && !emscripten { + println!("cargo:rustc-cfg=integer128"); + } + + // Inclusive ranges methods stabilized in Rust 1.27: + // https://github.com/rust-lang/rust/pull/50758 + if minor >= 27 { + println!("cargo:rustc-cfg=range_inclusive"); + } + + // Non-zero integers stabilized in Rust 1.28: + // https://github.com/rust-lang/rust/pull/50808 + if minor >= 28 { + println!("cargo:rustc-cfg=num_nonzero"); + } + + // TryFrom, Atomic types, and non-zero signed integers stabilized in Rust 1.34: + // https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto + // https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations + if minor >= 34 { + println!("cargo:rustc-cfg=core_try_from"); + println!("cargo:rustc-cfg=num_nonzero_signed"); + + // Whitelist of archs that support std::sync::atomic module. Ideally we + // would use #[cfg(target_has_atomic = "...")] but it is not stable yet. + // Instead this is based on rustc's src/librustc_target/spec/*.rs. + let has_atomic64 = target.starts_with("x86_64") + || target.starts_with("i686") + || target.starts_with("aarch64") + || target.starts_with("powerpc64") + || target.starts_with("sparc64") + || target.starts_with("mips64el"); + let has_atomic32 = has_atomic64 || emscripten; + if has_atomic64 { + println!("cargo:rustc-cfg=std_atomic64"); + } + if has_atomic32 { + println!("cargo:rustc-cfg=std_atomic"); + } + } +} + +fn rustc_minor_version() -> Option { + let rustc = match env::var_os("RUSTC") { + Some(rustc) => rustc, + None => return None, + }; + + let output = match Command::new(rustc).arg("--version").output() { + Ok(output) => output, + Err(_) => return None, + }; + + let version = match str::from_utf8(&output.stdout) { + Ok(version) => version, + Err(_) => return None, + }; + + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + + let next = match pieces.next() { + Some(next) => next, + None => return None, + }; + + u32::from_str(next).ok() +} diff --git a/third_party/cargo/vendor/serde-1.0.110/crates-io.md b/third_party/cargo/vendor/serde-1.0.110/crates-io.md new file mode 100644 index 0000000..3c6caa1 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/crates-io.md @@ -0,0 +1,52 @@ + + +**Serde is a framework for *ser*ializing and *de*serializing Rust data structures efficiently and generically.** + +--- + +You may be looking for: + +- [An overview of Serde](https://serde.rs/) +- [Data formats supported by Serde](https://serde.rs/#data-formats) +- [Setting up `#[derive(Serialize, Deserialize)]`](https://serde.rs/derive.html) +- [Examples](https://serde.rs/examples.html) +- [API documentation](https://docs.serde.rs/serde/) +- [Release notes](https://github.com/serde-rs/serde/releases) + +## Serde in action + +```rust +use serde::{Serialize, Deserialize}; + +#[derive(Serialize, Deserialize, Debug)] +struct Point { + x: i32, + y: i32, +} + +fn main() { + let point = Point { x: 1, y: 2 }; + + // Convert the Point to a JSON string. + let serialized = serde_json::to_string(&point).unwrap(); + + // Prints serialized = {"x":1,"y":2} + println!("serialized = {}", serialized); + + // Convert the JSON string back to a Point. + let deserialized: Point = serde_json::from_str(&serialized).unwrap(); + + // Prints deserialized = Point { x: 1, y: 2 } + println!("deserialized = {:?}", deserialized); +} +``` + +## Getting help + +Serde developers live in the #serde channel on [`irc.mozilla.org`][irc]. The +\#rust channel is also a good resource with generally faster response time but +less specific knowledge about Serde. If IRC is not your thing or you don't get a +good response, we are happy to respond to [GitHub issues][issues] as well. + +[irc]: https://wiki.mozilla.org/IRC +[issues]: https://github.com/serde-rs/serde/issues/new/choose diff --git a/third_party/cargo/vendor/serde-1.0.110/src/de/from_primitive.rs b/third_party/cargo/vendor/serde-1.0.110/src/de/from_primitive.rs new file mode 100644 index 0000000..544f3f1 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/de/from_primitive.rs @@ -0,0 +1,260 @@ +use lib::*; + +macro_rules! int_to_int { + ($dst:ident, $n:ident) => { + if $dst::min_value() as i64 <= $n as i64 && $n as i64 <= $dst::max_value() as i64 { + Some($n as $dst) + } else { + None + } + }; +} + +macro_rules! int_to_uint { + ($dst:ident, $n:ident) => { + if 0 <= $n && $n as u64 <= $dst::max_value() as u64 { + Some($n as $dst) + } else { + None + } + }; +} + +macro_rules! uint_to { + ($dst:ident, $n:ident) => { + if $n as u64 <= $dst::max_value() as u64 { + Some($n as $dst) + } else { + None + } + }; +} + +pub trait FromPrimitive: Sized { + fn from_i8(n: i8) -> Option; + fn from_i16(n: i16) -> Option; + fn from_i32(n: i32) -> Option; + fn from_i64(n: i64) -> Option; + fn from_u8(n: u8) -> Option; + fn from_u16(n: u16) -> Option; + fn from_u32(n: u32) -> Option; + fn from_u64(n: u64) -> Option; +} + +macro_rules! impl_from_primitive_for_int { + ($t:ident) => { + impl FromPrimitive for $t { + #[inline] + fn from_i8(n: i8) -> Option { + int_to_int!($t, n) + } + #[inline] + fn from_i16(n: i16) -> Option { + int_to_int!($t, n) + } + #[inline] + fn from_i32(n: i32) -> Option { + int_to_int!($t, n) + } + #[inline] + fn from_i64(n: i64) -> Option { + int_to_int!($t, n) + } + #[inline] + fn from_u8(n: u8) -> Option { + uint_to!($t, n) + } + #[inline] + fn from_u16(n: u16) -> Option { + uint_to!($t, n) + } + #[inline] + fn from_u32(n: u32) -> Option { + uint_to!($t, n) + } + #[inline] + fn from_u64(n: u64) -> Option { + uint_to!($t, n) + } + } + }; +} + +macro_rules! impl_from_primitive_for_uint { + ($t:ident) => { + impl FromPrimitive for $t { + #[inline] + fn from_i8(n: i8) -> Option { + int_to_uint!($t, n) + } + #[inline] + fn from_i16(n: i16) -> Option { + int_to_uint!($t, n) + } + #[inline] + fn from_i32(n: i32) -> Option { + int_to_uint!($t, n) + } + #[inline] + fn from_i64(n: i64) -> Option { + int_to_uint!($t, n) + } + #[inline] + fn from_u8(n: u8) -> Option { + uint_to!($t, n) + } + #[inline] + fn from_u16(n: u16) -> Option { + uint_to!($t, n) + } + #[inline] + fn from_u32(n: u32) -> Option { + uint_to!($t, n) + } + #[inline] + fn from_u64(n: u64) -> Option { + uint_to!($t, n) + } + } + }; +} + +macro_rules! impl_from_primitive_for_float { + ($t:ident) => { + impl FromPrimitive for $t { + #[inline] + fn from_i8(n: i8) -> Option { + Some(n as Self) + } + #[inline] + fn from_i16(n: i16) -> Option { + Some(n as Self) + } + #[inline] + fn from_i32(n: i32) -> Option { + Some(n as Self) + } + #[inline] + fn from_i64(n: i64) -> Option { + Some(n as Self) + } + #[inline] + fn from_u8(n: u8) -> Option { + Some(n as Self) + } + #[inline] + fn from_u16(n: u16) -> Option { + Some(n as Self) + } + #[inline] + fn from_u32(n: u32) -> Option { + Some(n as Self) + } + #[inline] + fn from_u64(n: u64) -> Option { + Some(n as Self) + } + } + }; +} + +impl_from_primitive_for_int!(isize); +impl_from_primitive_for_int!(i8); +impl_from_primitive_for_int!(i16); +impl_from_primitive_for_int!(i32); +impl_from_primitive_for_int!(i64); +impl_from_primitive_for_uint!(usize); +impl_from_primitive_for_uint!(u8); +impl_from_primitive_for_uint!(u16); +impl_from_primitive_for_uint!(u32); +impl_from_primitive_for_uint!(u64); +impl_from_primitive_for_float!(f32); +impl_from_primitive_for_float!(f64); + +serde_if_integer128! { + impl FromPrimitive for i128 { + #[inline] + fn from_i8(n: i8) -> Option { + Some(n as i128) + } + #[inline] + fn from_i16(n: i16) -> Option { + Some(n as i128) + } + #[inline] + fn from_i32(n: i32) -> Option { + Some(n as i128) + } + #[inline] + fn from_i64(n: i64) -> Option { + Some(n as i128) + } + #[inline] + fn from_u8(n: u8) -> Option { + Some(n as i128) + } + #[inline] + fn from_u16(n: u16) -> Option { + Some(n as i128) + } + #[inline] + fn from_u32(n: u32) -> Option { + Some(n as i128) + } + #[inline] + fn from_u64(n: u64) -> Option { + Some(n as i128) + } + } + + impl FromPrimitive for u128 { + #[inline] + fn from_i8(n: i8) -> Option { + if n >= 0 { + Some(n as u128) + } else { + None + } + } + #[inline] + fn from_i16(n: i16) -> Option { + if n >= 0 { + Some(n as u128) + } else { + None + } + } + #[inline] + fn from_i32(n: i32) -> Option { + if n >= 0 { + Some(n as u128) + } else { + None + } + } + #[inline] + fn from_i64(n: i64) -> Option { + if n >= 0 { + Some(n as u128) + } else { + None + } + } + #[inline] + fn from_u8(n: u8) -> Option { + Some(n as u128) + } + #[inline] + fn from_u16(n: u16) -> Option { + Some(n as u128) + } + #[inline] + fn from_u32(n: u32) -> Option { + Some(n as u128) + } + #[inline] + fn from_u64(n: u64) -> Option { + Some(n as u128) + } + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/de/ignored_any.rs b/third_party/cargo/vendor/serde-1.0.110/src/de/ignored_any.rs new file mode 100644 index 0000000..68a644e --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/de/ignored_any.rs @@ -0,0 +1,227 @@ +use lib::*; + +use de::{ + Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, VariantAccess, Visitor, +}; + +/// An efficient way of discarding data from a deserializer. +/// +/// Think of this like `serde_json::Value` in that it can be deserialized from +/// any type, except that it does not store any information about the data that +/// gets deserialized. +/// +/// ```edition2018 +/// use std::fmt; +/// use std::marker::PhantomData; +/// +/// use serde::de::{ +/// self, Deserialize, DeserializeSeed, Deserializer, IgnoredAny, SeqAccess, Visitor, +/// }; +/// +/// /// A seed that can be used to deserialize only the `n`th element of a sequence +/// /// while efficiently discarding elements of any type before or after index `n`. +/// /// +/// /// For example to deserialize only the element at index 3: +/// /// +/// /// ``` +/// /// NthElement::new(3).deserialize(deserializer) +/// /// ``` +/// pub struct NthElement { +/// n: usize, +/// marker: PhantomData, +/// } +/// +/// impl NthElement { +/// pub fn new(n: usize) -> Self { +/// NthElement { +/// n: n, +/// marker: PhantomData, +/// } +/// } +/// } +/// +/// impl<'de, T> Visitor<'de> for NthElement +/// where +/// T: Deserialize<'de>, +/// { +/// type Value = T; +/// +/// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// write!( +/// formatter, +/// "a sequence in which we care about element {}", +/// self.n +/// ) +/// } +/// +/// fn visit_seq(self, mut seq: A) -> Result +/// where +/// A: SeqAccess<'de>, +/// { +/// // Skip over the first `n` elements. +/// for i in 0..self.n { +/// // It is an error if the sequence ends before we get to element `n`. +/// if seq.next_element::()?.is_none() { +/// return Err(de::Error::invalid_length(i, &self)); +/// } +/// } +/// +/// // Deserialize the one we care about. +/// let nth = match seq.next_element()? { +/// Some(nth) => nth, +/// None => { +/// return Err(de::Error::invalid_length(self.n, &self)); +/// } +/// }; +/// +/// // Skip over any remaining elements in the sequence after `n`. +/// while let Some(IgnoredAny) = seq.next_element()? { +/// // ignore +/// } +/// +/// Ok(nth) +/// } +/// } +/// +/// impl<'de, T> DeserializeSeed<'de> for NthElement +/// where +/// T: Deserialize<'de>, +/// { +/// type Value = T; +/// +/// fn deserialize(self, deserializer: D) -> Result +/// where +/// D: Deserializer<'de>, +/// { +/// deserializer.deserialize_seq(self) +/// } +/// } +/// +/// # fn example<'de, D>(deserializer: D) -> Result<(), D::Error> +/// # where +/// # D: Deserializer<'de>, +/// # { +/// // Deserialize only the sequence element at index 3 from this deserializer. +/// // The element at index 3 is required to be a string. Elements before and +/// // after index 3 are allowed to be of any type. +/// let s: String = NthElement::new(3).deserialize(deserializer)?; +/// # Ok(()) +/// # } +/// ``` +#[derive(Copy, Clone, Debug, Default)] +pub struct IgnoredAny; + +impl<'de> Visitor<'de> for IgnoredAny { + type Value = IgnoredAny; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("anything at all") + } + + #[inline] + fn visit_bool(self, x: bool) -> Result { + let _ = x; + Ok(IgnoredAny) + } + + #[inline] + fn visit_i64(self, x: i64) -> Result { + let _ = x; + Ok(IgnoredAny) + } + + #[inline] + fn visit_u64(self, x: u64) -> Result { + let _ = x; + Ok(IgnoredAny) + } + + #[inline] + fn visit_f64(self, x: f64) -> Result { + let _ = x; + Ok(IgnoredAny) + } + + #[inline] + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + let _ = s; + Ok(IgnoredAny) + } + + #[inline] + fn visit_none(self) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_some(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + IgnoredAny::deserialize(deserializer) + } + + #[inline] + fn visit_newtype_struct(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + IgnoredAny::deserialize(deserializer) + } + + #[inline] + fn visit_unit(self) -> Result { + Ok(IgnoredAny) + } + + #[inline] + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + while let Some(IgnoredAny) = try!(seq.next_element()) { + // Gobble + } + Ok(IgnoredAny) + } + + #[inline] + fn visit_map(self, mut map: A) -> Result + where + A: MapAccess<'de>, + { + while let Some((IgnoredAny, IgnoredAny)) = try!(map.next_entry()) { + // Gobble + } + Ok(IgnoredAny) + } + + #[inline] + fn visit_bytes(self, bytes: &[u8]) -> Result + where + E: Error, + { + let _ = bytes; + Ok(IgnoredAny) + } + + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + data.variant::()?.1.newtype_variant() + } +} + +impl<'de> Deserialize<'de> for IgnoredAny { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_ignored_any(IgnoredAny) + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/de/impls.rs b/third_party/cargo/vendor/serde-1.0.110/src/de/impls.rs new file mode 100644 index 0000000..e460a40 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/de/impls.rs @@ -0,0 +1,2612 @@ +use lib::*; + +use de::{ + Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, VariantAccess, Visitor, +}; + +#[cfg(any(core_duration, feature = "std", feature = "alloc"))] +use de::MapAccess; + +use de::from_primitive::FromPrimitive; +use private::de::InPlaceSeed; + +#[cfg(any(feature = "std", feature = "alloc"))] +use private::de::size_hint; + +//////////////////////////////////////////////////////////////////////////////// + +struct UnitVisitor; + +impl<'de> Visitor<'de> for UnitVisitor { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("unit") + } + + fn visit_unit(self) -> Result + where + E: Error, + { + Ok(()) + } +} + +impl<'de> Deserialize<'de> for () { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_unit(UnitVisitor) + } +} + +#[cfg(feature = "unstable")] +impl<'de> Deserialize<'de> for ! { + fn deserialize(_deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Err(Error::custom("cannot deserialize `!`")) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +struct BoolVisitor; + +impl<'de> Visitor<'de> for BoolVisitor { + type Value = bool; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a boolean") + } + + fn visit_bool(self, v: bool) -> Result + where + E: Error, + { + Ok(v) + } +} + +impl<'de> Deserialize<'de> for bool { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_bool(BoolVisitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! visit_integer_method { + ($src_ty:ident, $method:ident, $from_method:ident, $group:ident, $group_ty:ident) => { + #[inline] + fn $method(self, v: $src_ty) -> Result + where + E: Error, + { + match FromPrimitive::$from_method(v) { + Some(v) => Ok(v), + None => Err(Error::invalid_value( + Unexpected::$group(v as $group_ty), + &self, + )), + } + } + }; +} + +macro_rules! visit_float_method { + ($src_ty:ident, $method:ident) => { + #[inline] + fn $method(self, v: $src_ty) -> Result + where + E: Error, + { + Ok(v as Self::Value) + } + }; +} + +macro_rules! impl_deserialize_num { + ($ty:ident, $method:ident, $($visit:ident),*) => { + impl<'de> Deserialize<'de> for $ty { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PrimitiveVisitor; + + impl<'de> Visitor<'de> for PrimitiveVisitor { + type Value = $ty; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(stringify!($ty)) + } + + $( + impl_deserialize_num!($visit $ty); + )* + } + + deserializer.$method(PrimitiveVisitor) + } + } + }; + + (integer $ty:ident) => { + visit_integer_method!(i8, visit_i8, from_i8, Signed, i64); + visit_integer_method!(i16, visit_i16, from_i16, Signed, i64); + visit_integer_method!(i32, visit_i32, from_i32, Signed, i64); + visit_integer_method!(i64, visit_i64, from_i64, Signed, i64); + + visit_integer_method!(u8, visit_u8, from_u8, Unsigned, u64); + visit_integer_method!(u16, visit_u16, from_u16, Unsigned, u64); + visit_integer_method!(u32, visit_u32, from_u32, Unsigned, u64); + visit_integer_method!(u64, visit_u64, from_u64, Unsigned, u64); + }; + + (float $ty:ident) => { + visit_float_method!(f32, visit_f32); + visit_float_method!(f64, visit_f64); + }; +} + +impl_deserialize_num!(i8, deserialize_i8, integer); +impl_deserialize_num!(i16, deserialize_i16, integer); +impl_deserialize_num!(i32, deserialize_i32, integer); +impl_deserialize_num!(i64, deserialize_i64, integer); +impl_deserialize_num!(isize, deserialize_i64, integer); + +impl_deserialize_num!(u8, deserialize_u8, integer); +impl_deserialize_num!(u16, deserialize_u16, integer); +impl_deserialize_num!(u32, deserialize_u32, integer); +impl_deserialize_num!(u64, deserialize_u64, integer); +impl_deserialize_num!(usize, deserialize_u64, integer); + +impl_deserialize_num!(f32, deserialize_f32, integer, float); +impl_deserialize_num!(f64, deserialize_f64, integer, float); + +serde_if_integer128! { + impl<'de> Deserialize<'de> for i128 { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PrimitiveVisitor; + + impl<'de> Visitor<'de> for PrimitiveVisitor { + type Value = i128; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("i128") + } + + impl_deserialize_num!(integer i128); + + #[inline] + fn visit_i128(self, v: i128) -> Result + where + E: Error, + { + Ok(v) + } + + #[inline] + fn visit_u128(self, v: u128) -> Result + where + E: Error, + { + if v <= i128::max_value() as u128 { + Ok(v as i128) + } else { + Err(Error::invalid_value(Unexpected::Other("u128"), &self)) + } + } + } + + deserializer.deserialize_i128(PrimitiveVisitor) + } + } + + impl<'de> Deserialize<'de> for u128 { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct PrimitiveVisitor; + + impl<'de> Visitor<'de> for PrimitiveVisitor { + type Value = u128; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("u128") + } + + impl_deserialize_num!(integer u128); + + #[inline] + fn visit_i128(self, v: i128) -> Result + where + E: Error, + { + if v >= 0 { + Ok(v as u128) + } else { + Err(Error::invalid_value(Unexpected::Other("i128"), &self)) + } + } + + #[inline] + fn visit_u128(self, v: u128) -> Result + where + E: Error, + { + Ok(v) + } + } + + deserializer.deserialize_u128(PrimitiveVisitor) + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +struct CharVisitor; + +impl<'de> Visitor<'de> for CharVisitor { + type Value = char; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a character") + } + + #[inline] + fn visit_char(self, v: char) -> Result + where + E: Error, + { + Ok(v) + } + + #[inline] + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + let mut iter = v.chars(); + match (iter.next(), iter.next()) { + (Some(c), None) => Ok(c), + _ => Err(Error::invalid_value(Unexpected::Str(v), &self)), + } + } +} + +impl<'de> Deserialize<'de> for char { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_char(CharVisitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +struct StringVisitor; +#[cfg(any(feature = "std", feature = "alloc"))] +struct StringInPlaceVisitor<'a>(&'a mut String); + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de> Visitor<'de> for StringVisitor { + type Value = String; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a string") + } + + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + Ok(v.to_owned()) + } + + fn visit_string(self, v: String) -> Result + where + E: Error, + { + Ok(v) + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + match str::from_utf8(v) { + Ok(s) => Ok(s.to_owned()), + Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), + } + } + + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + match String::from_utf8(v) { + Ok(s) => Ok(s), + Err(e) => Err(Error::invalid_value( + Unexpected::Bytes(&e.into_bytes()), + &self, + )), + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de> Visitor<'de> for StringInPlaceVisitor<'a> { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a string") + } + + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + self.0.clear(); + self.0.push_str(v); + Ok(()) + } + + fn visit_string(self, v: String) -> Result + where + E: Error, + { + *self.0 = v; + Ok(()) + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + match str::from_utf8(v) { + Ok(s) => { + self.0.clear(); + self.0.push_str(s); + Ok(()) + } + Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), + } + } + + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + match String::from_utf8(v) { + Ok(s) => { + *self.0 = s; + Ok(()) + } + Err(e) => Err(Error::invalid_value( + Unexpected::Bytes(&e.into_bytes()), + &self, + )), + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de> Deserialize<'de> for String { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_string(StringVisitor) + } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + deserializer.deserialize_string(StringInPlaceVisitor(place)) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +struct StrVisitor; + +impl<'a> Visitor<'a> for StrVisitor { + type Value = &'a str; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a borrowed string") + } + + fn visit_borrowed_str(self, v: &'a str) -> Result + where + E: Error, + { + Ok(v) // so easy + } + + fn visit_borrowed_bytes(self, v: &'a [u8]) -> Result + where + E: Error, + { + str::from_utf8(v).map_err(|_| Error::invalid_value(Unexpected::Bytes(v), &self)) + } +} + +impl<'de: 'a, 'a> Deserialize<'de> for &'a str { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_str(StrVisitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +struct BytesVisitor; + +impl<'a> Visitor<'a> for BytesVisitor { + type Value = &'a [u8]; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a borrowed byte array") + } + + fn visit_borrowed_bytes(self, v: &'a [u8]) -> Result + where + E: Error, + { + Ok(v) + } + + fn visit_borrowed_str(self, v: &'a str) -> Result + where + E: Error, + { + Ok(v.as_bytes()) + } +} + +impl<'de: 'a, 'a> Deserialize<'de> for &'a [u8] { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_bytes(BytesVisitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +struct CStringVisitor; + +#[cfg(feature = "std")] +impl<'de> Visitor<'de> for CStringVisitor { + type Value = CString; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("byte array") + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let len = size_hint::cautious(seq.size_hint()); + let mut values = Vec::with_capacity(len); + + while let Some(value) = try!(seq.next_element()) { + values.push(value); + } + + CString::new(values).map_err(Error::custom) + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + CString::new(v).map_err(Error::custom) + } + + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + CString::new(v).map_err(Error::custom) + } + + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + CString::new(v).map_err(Error::custom) + } + + fn visit_string(self, v: String) -> Result + where + E: Error, + { + CString::new(v).map_err(Error::custom) + } +} + +#[cfg(feature = "std")] +impl<'de> Deserialize<'de> for CString { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_byte_buf(CStringVisitor) + } +} + +macro_rules! forwarded_impl { + ( + $(#[doc = $doc:tt])* + ( $($id: ident),* ), $ty: ty, $func: expr + ) => { + $(#[doc = $doc])* + impl<'de $(, $id : Deserialize<'de>,)*> Deserialize<'de> for $ty { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Deserialize::deserialize(deserializer).map($func) + } + } + } +} + +#[cfg(all(feature = "std", de_boxed_c_str))] +forwarded_impl!((), Box, CString::into_boxed_c_str); + +#[cfg(core_reverse)] +forwarded_impl!((T), Reverse, Reverse); + +//////////////////////////////////////////////////////////////////////////////// + +struct OptionVisitor { + marker: PhantomData, +} + +impl<'de, T> Visitor<'de> for OptionVisitor +where + T: Deserialize<'de>, +{ + type Value = Option; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("option") + } + + #[inline] + fn visit_unit(self) -> Result + where + E: Error, + { + Ok(None) + } + + #[inline] + fn visit_none(self) -> Result + where + E: Error, + { + Ok(None) + } + + #[inline] + fn visit_some(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + T::deserialize(deserializer).map(Some) + } + + #[doc(hidden)] + fn __private_visit_untagged_option(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Ok(T::deserialize(deserializer).ok()) + } +} + +impl<'de, T> Deserialize<'de> for Option +where + T: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_option(OptionVisitor { + marker: PhantomData, + }) + } + + // The Some variant's repr is opaque, so we can't play cute tricks with its + // tag to have deserialize_in_place build the content in place unconditionally. + // + // FIXME: investigate whether branching on the old value being Some to + // deserialize_in_place the value is profitable (probably data-dependent?) +} + +//////////////////////////////////////////////////////////////////////////////// + +struct PhantomDataVisitor { + marker: PhantomData, +} + +impl<'de, T: ?Sized> Visitor<'de> for PhantomDataVisitor { + type Value = PhantomData; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("unit") + } + + #[inline] + fn visit_unit(self) -> Result + where + E: Error, + { + Ok(PhantomData) + } +} + +impl<'de, T: ?Sized> Deserialize<'de> for PhantomData { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let visitor = PhantomDataVisitor { + marker: PhantomData, + }; + deserializer.deserialize_unit_struct("PhantomData", visitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +macro_rules! seq_impl { + ( + $ty:ident < T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)* >, + $access:ident, + $clear:expr, + $with_capacity:expr, + $reserve:expr, + $insert:expr + ) => { + impl<'de, T $(, $typaram)*> Deserialize<'de> for $ty + where + T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, + $($typaram: $bound1 $(+ $bound2)*,)* + { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct SeqVisitor { + marker: PhantomData<$ty>, + } + + impl<'de, T $(, $typaram)*> Visitor<'de> for SeqVisitor + where + T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, + $($typaram: $bound1 $(+ $bound2)*,)* + { + type Value = $ty; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a sequence") + } + + #[inline] + fn visit_seq(self, mut $access: A) -> Result + where + A: SeqAccess<'de>, + { + let mut values = $with_capacity; + + while let Some(value) = try!($access.next_element()) { + $insert(&mut values, value); + } + + Ok(values) + } + } + + let visitor = SeqVisitor { marker: PhantomData }; + deserializer.deserialize_seq(visitor) + } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + struct SeqInPlaceVisitor<'a, T: 'a $(, $typaram: 'a)*>(&'a mut $ty); + + impl<'a, 'de, T $(, $typaram)*> Visitor<'de> for SeqInPlaceVisitor<'a, T $(, $typaram)*> + where + T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, + $($typaram: $bound1 $(+ $bound2)*,)* + { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a sequence") + } + + #[inline] + fn visit_seq(mut self, mut $access: A) -> Result + where + A: SeqAccess<'de>, + { + $clear(&mut self.0); + $reserve(&mut self.0, size_hint::cautious($access.size_hint())); + + // FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList) + while let Some(value) = try!($access.next_element()) { + $insert(&mut self.0, value); + } + + Ok(()) + } + } + + deserializer.deserialize_seq(SeqInPlaceVisitor(place)) + } + } + } +} + +// Dummy impl of reserve +#[cfg(any(feature = "std", feature = "alloc"))] +fn nop_reserve(_seq: T, _n: usize) {} + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!( + BinaryHeap, + seq, + BinaryHeap::clear, + BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())), + BinaryHeap::reserve, + BinaryHeap::push +); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!( + BTreeSet, + seq, + BTreeSet::clear, + BTreeSet::new(), + nop_reserve, + BTreeSet::insert +); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!( + LinkedList, + seq, + LinkedList::clear, + LinkedList::new(), + nop_reserve, + LinkedList::push_back +); + +#[cfg(feature = "std")] +seq_impl!( + HashSet, + seq, + HashSet::clear, + HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()), + HashSet::reserve, + HashSet::insert); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!( + VecDeque, + seq, + VecDeque::clear, + VecDeque::with_capacity(size_hint::cautious(seq.size_hint())), + VecDeque::reserve, + VecDeque::push_back +); + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, T> Deserialize<'de> for Vec +where + T: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct VecVisitor { + marker: PhantomData, + } + + impl<'de, T> Visitor<'de> for VecVisitor + where + T: Deserialize<'de>, + { + type Value = Vec; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a sequence") + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let mut values = Vec::with_capacity(size_hint::cautious(seq.size_hint())); + + while let Some(value) = try!(seq.next_element()) { + values.push(value); + } + + Ok(values) + } + } + + let visitor = VecVisitor { + marker: PhantomData, + }; + deserializer.deserialize_seq(visitor) + } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + struct VecInPlaceVisitor<'a, T: 'a>(&'a mut Vec); + + impl<'a, 'de, T> Visitor<'de> for VecInPlaceVisitor<'a, T> + where + T: Deserialize<'de>, + { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a sequence") + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let hint = size_hint::cautious(seq.size_hint()); + if let Some(additional) = hint.checked_sub(self.0.len()) { + self.0.reserve(additional); + } + + for i in 0..self.0.len() { + let next = { + let next_place = InPlaceSeed(&mut self.0[i]); + try!(seq.next_element_seed(next_place)) + }; + if next.is_none() { + self.0.truncate(i); + return Ok(()); + } + } + + while let Some(value) = try!(seq.next_element()) { + self.0.push(value); + } + + Ok(()) + } + } + + deserializer.deserialize_seq(VecInPlaceVisitor(place)) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +struct ArrayVisitor { + marker: PhantomData, +} +struct ArrayInPlaceVisitor<'a, A: 'a>(&'a mut A); + +impl ArrayVisitor { + fn new() -> Self { + ArrayVisitor { + marker: PhantomData, + } + } +} + +impl<'de, T> Visitor<'de> for ArrayVisitor<[T; 0]> { + type Value = [T; 0]; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("an empty array") + } + + #[inline] + fn visit_seq(self, _: A) -> Result + where + A: SeqAccess<'de>, + { + Ok([]) + } +} + +// Does not require T: Deserialize<'de>. +impl<'de, T> Deserialize<'de> for [T; 0] { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_tuple(0, ArrayVisitor::<[T; 0]>::new()) + } +} + +macro_rules! array_impls { + ($($len:expr => ($($n:tt)+))+) => { + $( + impl<'de, T> Visitor<'de> for ArrayVisitor<[T; $len]> + where + T: Deserialize<'de>, + { + type Value = [T; $len]; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("an array of length ", $len)) + } + + #[inline] + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + Ok([$( + match try!(seq.next_element()) { + Some(val) => val, + None => return Err(Error::invalid_length($n, &self)), + } + ),+]) + } + } + + impl<'a, 'de, T> Visitor<'de> for ArrayInPlaceVisitor<'a, [T; $len]> + where + T: Deserialize<'de>, + { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("an array of length ", $len)) + } + + #[inline] + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let mut fail_idx = None; + for (idx, dest) in self.0[..].iter_mut().enumerate() { + if try!(seq.next_element_seed(InPlaceSeed(dest))).is_none() { + fail_idx = Some(idx); + break; + } + } + if let Some(idx) = fail_idx { + return Err(Error::invalid_length(idx, &self)); + } + Ok(()) + } + } + + impl<'de, T> Deserialize<'de> for [T; $len] + where + T: Deserialize<'de>, + { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_tuple($len, ArrayVisitor::<[T; $len]>::new()) + } + + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + deserializer.deserialize_tuple($len, ArrayInPlaceVisitor(place)) + } + } + )+ + } +} + +array_impls! { + 1 => (0) + 2 => (0 1) + 3 => (0 1 2) + 4 => (0 1 2 3) + 5 => (0 1 2 3 4) + 6 => (0 1 2 3 4 5) + 7 => (0 1 2 3 4 5 6) + 8 => (0 1 2 3 4 5 6 7) + 9 => (0 1 2 3 4 5 6 7 8) + 10 => (0 1 2 3 4 5 6 7 8 9) + 11 => (0 1 2 3 4 5 6 7 8 9 10) + 12 => (0 1 2 3 4 5 6 7 8 9 10 11) + 13 => (0 1 2 3 4 5 6 7 8 9 10 11 12) + 14 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13) + 15 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) + 16 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) + 17 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16) + 18 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17) + 19 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18) + 20 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) + 21 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) + 22 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) + 23 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22) + 24 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23) + 25 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24) + 26 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) + 27 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26) + 28 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27) + 29 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28) + 30 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29) + 31 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) + 32 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) +} + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! tuple_impls { + ($($len:tt => ($($n:tt $name:ident)+))+) => { + $( + impl<'de, $($name: Deserialize<'de>),+> Deserialize<'de> for ($($name,)+) { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct TupleVisitor<$($name,)+> { + marker: PhantomData<($($name,)+)>, + } + + impl<'de, $($name: Deserialize<'de>),+> Visitor<'de> for TupleVisitor<$($name,)+> { + type Value = ($($name,)+); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("a tuple of size ", $len)) + } + + #[inline] + #[allow(non_snake_case)] + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + $( + let $name = match try!(seq.next_element()) { + Some(value) => value, + None => return Err(Error::invalid_length($n, &self)), + }; + )+ + + Ok(($($name,)+)) + } + } + + deserializer.deserialize_tuple($len, TupleVisitor { marker: PhantomData }) + } + + #[inline] + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + struct TupleInPlaceVisitor<'a, $($name: 'a,)+>(&'a mut ($($name,)+)); + + impl<'a, 'de, $($name: Deserialize<'de>),+> Visitor<'de> for TupleInPlaceVisitor<'a, $($name,)+> { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("a tuple of size ", $len)) + } + + #[inline] + #[allow(non_snake_case)] + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + $( + if try!(seq.next_element_seed(InPlaceSeed(&mut (self.0).$n))).is_none() { + return Err(Error::invalid_length($n, &self)); + } + )+ + + Ok(()) + } + } + + deserializer.deserialize_tuple($len, TupleInPlaceVisitor(place)) + } + } + )+ + } +} + +tuple_impls! { + 1 => (0 T0) + 2 => (0 T0 1 T1) + 3 => (0 T0 1 T1 2 T2) + 4 => (0 T0 1 T1 2 T2 3 T3) + 5 => (0 T0 1 T1 2 T2 3 T3 4 T4) + 6 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5) + 7 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6) + 8 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7) + 9 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8) + 10 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9) + 11 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10) + 12 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11) + 13 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12) + 14 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13) + 15 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14) + 16 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14 15 T15) +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +macro_rules! map_impl { + ( + $ty:ident < K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)* >, + $access:ident, + $with_capacity:expr + ) => { + impl<'de, K, V $(, $typaram)*> Deserialize<'de> for $ty + where + K: Deserialize<'de> $(+ $kbound1 $(+ $kbound2)*)*, + V: Deserialize<'de>, + $($typaram: $bound1 $(+ $bound2)*),* + { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct MapVisitor { + marker: PhantomData<$ty>, + } + + impl<'de, K, V $(, $typaram)*> Visitor<'de> for MapVisitor + where + K: Deserialize<'de> $(+ $kbound1 $(+ $kbound2)*)*, + V: Deserialize<'de>, + $($typaram: $bound1 $(+ $bound2)*),* + { + type Value = $ty; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a map") + } + + #[inline] + fn visit_map(self, mut $access: A) -> Result + where + A: MapAccess<'de>, + { + let mut values = $with_capacity; + + while let Some((key, value)) = try!($access.next_entry()) { + values.insert(key, value); + } + + Ok(values) + } + } + + let visitor = MapVisitor { marker: PhantomData }; + deserializer.deserialize_map(visitor) + } + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +map_impl!( + BTreeMap, + map, + BTreeMap::new()); + +#[cfg(feature = "std")] +map_impl!( + HashMap, + map, + HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default())); + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +macro_rules! parse_ip_impl { + ($expecting:tt $ty:ty; $size:tt) => { + impl<'de> Deserialize<'de> for $ty { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + if deserializer.is_human_readable() { + struct IpAddrVisitor; + + impl<'de> Visitor<'de> for IpAddrVisitor { + type Value = $ty; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str($expecting) + } + + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + s.parse().map_err(Error::custom) + } + } + + deserializer.deserialize_str(IpAddrVisitor) + } else { + <[u8; $size]>::deserialize(deserializer).map(<$ty>::from) + } + } + } + }; +} + +#[cfg(feature = "std")] +macro_rules! variant_identifier { + ( + $name_kind: ident ( $($variant: ident; $bytes: expr; $index: expr),* ) + $expecting_message: expr, + $variants_name: ident + ) => { + enum $name_kind { + $( $variant ),* + } + + static $variants_name: &'static [&'static str] = &[ $( stringify!($variant) ),*]; + + impl<'de> Deserialize<'de> for $name_kind { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct KindVisitor; + + impl<'de> Visitor<'de> for KindVisitor { + type Value = $name_kind; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str($expecting_message) + } + + fn visit_u32(self, value: u32) -> Result + where + E: Error, + { + match value { + $( + $index => Ok($name_kind :: $variant), + )* + _ => Err(Error::invalid_value(Unexpected::Unsigned(value as u64), &self),), + } + } + + fn visit_str(self, value: &str) -> Result + where + E: Error, + { + match value { + $( + stringify!($variant) => Ok($name_kind :: $variant), + )* + _ => Err(Error::unknown_variant(value, $variants_name)), + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + E: Error, + { + match value { + $( + $bytes => Ok($name_kind :: $variant), + )* + _ => { + match str::from_utf8(value) { + Ok(value) => Err(Error::unknown_variant(value, $variants_name)), + Err(_) => Err(Error::invalid_value(Unexpected::Bytes(value), &self)), + } + } + } + } + } + + deserializer.deserialize_identifier(KindVisitor) + } + } + } +} + +#[cfg(feature = "std")] +macro_rules! deserialize_enum { + ( + $name: ident $name_kind: ident ( $($variant: ident; $bytes: expr; $index: expr),* ) + $expecting_message: expr, + $deserializer: expr + ) => { + variant_identifier!{ + $name_kind ( $($variant; $bytes; $index),* ) + $expecting_message, + VARIANTS + } + + struct EnumVisitor; + impl<'de> Visitor<'de> for EnumVisitor { + type Value = $name; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(concat!("a ", stringify!($name))) + } + + + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + match try!(data.variant()) { + $( + ($name_kind :: $variant, v) => v.newtype_variant().map($name :: $variant), + )* + } + } + } + $deserializer.deserialize_enum(stringify!($name), VARIANTS, EnumVisitor) + } +} + +#[cfg(feature = "std")] +impl<'de> Deserialize<'de> for net::IpAddr { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + if deserializer.is_human_readable() { + struct IpAddrVisitor; + + impl<'de> Visitor<'de> for IpAddrVisitor { + type Value = net::IpAddr; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("IP address") + } + + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + s.parse().map_err(Error::custom) + } + } + + deserializer.deserialize_str(IpAddrVisitor) + } else { + use lib::net::IpAddr; + deserialize_enum! { + IpAddr IpAddrKind (V4; b"V4"; 0, V6; b"V6"; 1) + "`V4` or `V6`", + deserializer + } + } + } +} + +#[cfg(feature = "std")] +parse_ip_impl!("IPv4 address" net::Ipv4Addr; 4); + +#[cfg(feature = "std")] +parse_ip_impl!("IPv6 address" net::Ipv6Addr; 16); + +#[cfg(feature = "std")] +macro_rules! parse_socket_impl { + ($expecting:tt $ty:ty, $new:expr) => { + impl<'de> Deserialize<'de> for $ty { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + if deserializer.is_human_readable() { + struct SocketAddrVisitor; + + impl<'de> Visitor<'de> for SocketAddrVisitor { + type Value = $ty; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str($expecting) + } + + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + s.parse().map_err(Error::custom) + } + } + + deserializer.deserialize_str(SocketAddrVisitor) + } else { + <(_, u16)>::deserialize(deserializer).map(|(ip, port)| $new(ip, port)) + } + } + } + }; +} + +#[cfg(feature = "std")] +impl<'de> Deserialize<'de> for net::SocketAddr { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + if deserializer.is_human_readable() { + struct SocketAddrVisitor; + + impl<'de> Visitor<'de> for SocketAddrVisitor { + type Value = net::SocketAddr; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("socket address") + } + + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + s.parse().map_err(Error::custom) + } + } + + deserializer.deserialize_str(SocketAddrVisitor) + } else { + use lib::net::SocketAddr; + deserialize_enum! { + SocketAddr SocketAddrKind (V4; b"V4"; 0, V6; b"V6"; 1) + "`V4` or `V6`", + deserializer + } + } + } +} + +#[cfg(feature = "std")] +parse_socket_impl!("IPv4 socket address" net::SocketAddrV4, net::SocketAddrV4::new); + +#[cfg(feature = "std")] +parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |ip, port| net::SocketAddrV6::new( + ip, port, 0, 0 +)); + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +struct PathVisitor; + +#[cfg(feature = "std")] +impl<'a> Visitor<'a> for PathVisitor { + type Value = &'a Path; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a borrowed path") + } + + fn visit_borrowed_str(self, v: &'a str) -> Result + where + E: Error, + { + Ok(v.as_ref()) + } + + fn visit_borrowed_bytes(self, v: &'a [u8]) -> Result + where + E: Error, + { + str::from_utf8(v) + .map(AsRef::as_ref) + .map_err(|_| Error::invalid_value(Unexpected::Bytes(v), &self)) + } +} + +#[cfg(feature = "std")] +impl<'de: 'a, 'a> Deserialize<'de> for &'a Path { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_str(PathVisitor) + } +} + +#[cfg(feature = "std")] +struct PathBufVisitor; + +#[cfg(feature = "std")] +impl<'de> Visitor<'de> for PathBufVisitor { + type Value = PathBuf; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("path string") + } + + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + Ok(From::from(v)) + } + + fn visit_string(self, v: String) -> Result + where + E: Error, + { + Ok(From::from(v)) + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + str::from_utf8(v) + .map(From::from) + .map_err(|_| Error::invalid_value(Unexpected::Bytes(v), &self)) + } + + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + String::from_utf8(v) + .map(From::from) + .map_err(|e| Error::invalid_value(Unexpected::Bytes(&e.into_bytes()), &self)) + } +} + +#[cfg(feature = "std")] +impl<'de> Deserialize<'de> for PathBuf { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_string(PathBufVisitor) + } +} + +#[cfg(all(feature = "std", de_boxed_path))] +forwarded_impl!((), Box, PathBuf::into_boxed_path); + +//////////////////////////////////////////////////////////////////////////////// + +// If this were outside of the serde crate, it would just use: +// +// #[derive(Deserialize)] +// #[serde(variant_identifier)] +#[cfg(all(feature = "std", any(unix, windows)))] +variant_identifier! { + OsStringKind (Unix; b"Unix"; 0, Windows; b"Windows"; 1) + "`Unix` or `Windows`", + OSSTR_VARIANTS +} + +#[cfg(all(feature = "std", any(unix, windows)))] +struct OsStringVisitor; + +#[cfg(all(feature = "std", any(unix, windows)))] +impl<'de> Visitor<'de> for OsStringVisitor { + type Value = OsString; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("os string") + } + + #[cfg(unix)] + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + use std::os::unix::ffi::OsStringExt; + + match try!(data.variant()) { + (OsStringKind::Unix, v) => v.newtype_variant().map(OsString::from_vec), + (OsStringKind::Windows, _) => Err(Error::custom( + "cannot deserialize Windows OS string on Unix", + )), + } + } + + #[cfg(windows)] + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + use std::os::windows::ffi::OsStringExt; + + match try!(data.variant()) { + (OsStringKind::Windows, v) => v + .newtype_variant::>() + .map(|vec| OsString::from_wide(&vec)), + (OsStringKind::Unix, _) => Err(Error::custom( + "cannot deserialize Unix OS string on Windows", + )), + } + } +} + +#[cfg(all(feature = "std", any(unix, windows)))] +impl<'de> Deserialize<'de> for OsString { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_enum("OsString", OSSTR_VARIANTS, OsStringVisitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +forwarded_impl!((T), Box, Box::new); + +#[cfg(any(feature = "std", feature = "alloc"))] +forwarded_impl!((T), Box<[T]>, Vec::into_boxed_slice); + +#[cfg(any(feature = "std", feature = "alloc"))] +forwarded_impl!((), Box, String::into_boxed_str); + +#[cfg(all( + not(de_rc_dst), + feature = "rc", + any(feature = "std", feature = "alloc") +))] +forwarded_impl! { + /// This impl requires the [`"rc"`] Cargo feature of Serde. + /// + /// Deserializing a data structure containing `Arc` will not attempt to + /// deduplicate `Arc` references to the same data. Every deserialized `Arc` + /// will end up with a strong count of 1. + /// + /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc + (T), Arc, Arc::new +} + +#[cfg(all( + not(de_rc_dst), + feature = "rc", + any(feature = "std", feature = "alloc") +))] +forwarded_impl! { + /// This impl requires the [`"rc"`] Cargo feature of Serde. + /// + /// Deserializing a data structure containing `Rc` will not attempt to + /// deduplicate `Rc` references to the same data. Every deserialized `Rc` + /// will end up with a strong count of 1. + /// + /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc + (T), Rc, Rc::new +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, 'a, T: ?Sized> Deserialize<'de> for Cow<'a, T> +where + T: ToOwned, + T::Owned: Deserialize<'de>, +{ + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + T::Owned::deserialize(deserializer).map(Cow::Owned) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// This impl requires the [`"rc"`] Cargo feature of Serde. The resulting +/// `Weak` has a reference count of 0 and cannot be upgraded. +/// +/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc +#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] +impl<'de, T: ?Sized> Deserialize<'de> for RcWeak +where + T: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + try!(Option::::deserialize(deserializer)); + Ok(RcWeak::new()) + } +} + +/// This impl requires the [`"rc"`] Cargo feature of Serde. The resulting +/// `Weak` has a reference count of 0 and cannot be upgraded. +/// +/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc +#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] +impl<'de, T: ?Sized> Deserialize<'de> for ArcWeak +where + T: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + try!(Option::::deserialize(deserializer)); + Ok(ArcWeak::new()) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(all(de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))] +macro_rules! box_forwarded_impl { + ( + $(#[doc = $doc:tt])* + $t:ident + ) => { + $(#[doc = $doc])* + impl<'de, T: ?Sized> Deserialize<'de> for $t + where + Box: Deserialize<'de>, + { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Box::deserialize(deserializer).map(Into::into) + } + } + }; +} + +#[cfg(all(de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))] +box_forwarded_impl! { + /// This impl requires the [`"rc"`] Cargo feature of Serde. + /// + /// Deserializing a data structure containing `Rc` will not attempt to + /// deduplicate `Rc` references to the same data. Every deserialized `Rc` + /// will end up with a strong count of 1. + /// + /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc + Rc +} + +#[cfg(all(de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))] +box_forwarded_impl! { + /// This impl requires the [`"rc"`] Cargo feature of Serde. + /// + /// Deserializing a data structure containing `Arc` will not attempt to + /// deduplicate `Arc` references to the same data. Every deserialized `Arc` + /// will end up with a strong count of 1. + /// + /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc + Arc +} + +//////////////////////////////////////////////////////////////////////////////// + +impl<'de, T> Deserialize<'de> for Cell +where + T: Deserialize<'de> + Copy, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + T::deserialize(deserializer).map(Cell::new) + } +} + +forwarded_impl!((T), RefCell, RefCell::new); + +#[cfg(feature = "std")] +forwarded_impl!((T), Mutex, Mutex::new); + +#[cfg(feature = "std")] +forwarded_impl!((T), RwLock, RwLock::new); + +//////////////////////////////////////////////////////////////////////////////// + +// This is a cleaned-up version of the impl generated by: +// +// #[derive(Deserialize)] +// #[serde(deny_unknown_fields)] +// struct Duration { +// secs: u64, +// nanos: u32, +// } +#[cfg(any(core_duration, feature = "std"))] +impl<'de> Deserialize<'de> for Duration { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // If this were outside of the serde crate, it would just use: + // + // #[derive(Deserialize)] + // #[serde(field_identifier, rename_all = "lowercase")] + enum Field { + Secs, + Nanos, + }; + + impl<'de> Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FieldVisitor; + + impl<'de> Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("`secs` or `nanos`") + } + + fn visit_str(self, value: &str) -> Result + where + E: Error, + { + match value { + "secs" => Ok(Field::Secs), + "nanos" => Ok(Field::Nanos), + _ => Err(Error::unknown_field(value, FIELDS)), + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + E: Error, + { + match value { + b"secs" => Ok(Field::Secs), + b"nanos" => Ok(Field::Nanos), + _ => { + let value = ::export::from_utf8_lossy(value); + Err(Error::unknown_field(&value, FIELDS)) + } + } + } + } + + deserializer.deserialize_identifier(FieldVisitor) + } + } + + struct DurationVisitor; + + impl<'de> Visitor<'de> for DurationVisitor { + type Value = Duration; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("struct Duration") + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let secs: u64 = match try!(seq.next_element()) { + Some(value) => value, + None => { + return Err(Error::invalid_length(0, &self)); + } + }; + let nanos: u32 = match try!(seq.next_element()) { + Some(value) => value, + None => { + return Err(Error::invalid_length(1, &self)); + } + }; + Ok(Duration::new(secs, nanos)) + } + + fn visit_map(self, mut map: A) -> Result + where + A: MapAccess<'de>, + { + let mut secs: Option = None; + let mut nanos: Option = None; + while let Some(key) = try!(map.next_key()) { + match key { + Field::Secs => { + if secs.is_some() { + return Err(::duplicate_field("secs")); + } + secs = Some(try!(map.next_value())); + } + Field::Nanos => { + if nanos.is_some() { + return Err(::duplicate_field("nanos")); + } + nanos = Some(try!(map.next_value())); + } + } + } + let secs = match secs { + Some(secs) => secs, + None => return Err(::missing_field("secs")), + }; + let nanos = match nanos { + Some(nanos) => nanos, + None => return Err(::missing_field("nanos")), + }; + Ok(Duration::new(secs, nanos)) + } + } + + const FIELDS: &'static [&'static str] = &["secs", "nanos"]; + deserializer.deserialize_struct("Duration", FIELDS, DurationVisitor) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl<'de> Deserialize<'de> for SystemTime { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // Reuse duration + enum Field { + Secs, + Nanos, + }; + + impl<'de> Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FieldVisitor; + + impl<'de> Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("`secs_since_epoch` or `nanos_since_epoch`") + } + + fn visit_str(self, value: &str) -> Result + where + E: Error, + { + match value { + "secs_since_epoch" => Ok(Field::Secs), + "nanos_since_epoch" => Ok(Field::Nanos), + _ => Err(Error::unknown_field(value, FIELDS)), + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + E: Error, + { + match value { + b"secs_since_epoch" => Ok(Field::Secs), + b"nanos_since_epoch" => Ok(Field::Nanos), + _ => { + let value = String::from_utf8_lossy(value); + Err(Error::unknown_field(&value, FIELDS)) + } + } + } + } + + deserializer.deserialize_identifier(FieldVisitor) + } + } + + struct DurationVisitor; + + impl<'de> Visitor<'de> for DurationVisitor { + type Value = Duration; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("struct SystemTime") + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let secs: u64 = match try!(seq.next_element()) { + Some(value) => value, + None => { + return Err(Error::invalid_length(0, &self)); + } + }; + let nanos: u32 = match try!(seq.next_element()) { + Some(value) => value, + None => { + return Err(Error::invalid_length(1, &self)); + } + }; + Ok(Duration::new(secs, nanos)) + } + + fn visit_map(self, mut map: A) -> Result + where + A: MapAccess<'de>, + { + let mut secs: Option = None; + let mut nanos: Option = None; + while let Some(key) = try!(map.next_key()) { + match key { + Field::Secs => { + if secs.is_some() { + return Err(::duplicate_field( + "secs_since_epoch", + )); + } + secs = Some(try!(map.next_value())); + } + Field::Nanos => { + if nanos.is_some() { + return Err(::duplicate_field( + "nanos_since_epoch", + )); + } + nanos = Some(try!(map.next_value())); + } + } + } + let secs = match secs { + Some(secs) => secs, + None => return Err(::missing_field("secs_since_epoch")), + }; + let nanos = match nanos { + Some(nanos) => nanos, + None => return Err(::missing_field("nanos_since_epoch")), + }; + Ok(Duration::new(secs, nanos)) + } + } + + const FIELDS: &'static [&'static str] = &["secs_since_epoch", "nanos_since_epoch"]; + let duration = try!(deserializer.deserialize_struct("SystemTime", FIELDS, DurationVisitor)); + Ok(UNIX_EPOCH + duration) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +// Similar to: +// +// #[derive(Deserialize)] +// #[serde(deny_unknown_fields)] +// struct Range { +// start: u64, +// end: u32, +// } +impl<'de, Idx> Deserialize<'de> for Range +where + Idx: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let (start, end) = deserializer.deserialize_struct( + "Range", + range::FIELDS, + range::RangeVisitor { + expecting: "struct Range", + phantom: PhantomData, + }, + )?; + Ok(start..end) + } +} + +#[cfg(range_inclusive)] +impl<'de, Idx> Deserialize<'de> for RangeInclusive +where + Idx: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let (start, end) = deserializer.deserialize_struct( + "RangeInclusive", + range::FIELDS, + range::RangeVisitor { + expecting: "struct RangeInclusive", + phantom: PhantomData, + }, + )?; + Ok(RangeInclusive::new(start, end)) + } +} + +mod range { + use lib::*; + + use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; + + pub const FIELDS: &'static [&'static str] = &["start", "end"]; + + // If this were outside of the serde crate, it would just use: + // + // #[derive(Deserialize)] + // #[serde(field_identifier, rename_all = "lowercase")] + enum Field { + Start, + End, + } + + impl<'de> Deserialize<'de> for Field { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FieldVisitor; + + impl<'de> Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("`start` or `end`") + } + + fn visit_str(self, value: &str) -> Result + where + E: Error, + { + match value { + "start" => Ok(Field::Start), + "end" => Ok(Field::End), + _ => Err(Error::unknown_field(value, FIELDS)), + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + E: Error, + { + match value { + b"start" => Ok(Field::Start), + b"end" => Ok(Field::End), + _ => { + let value = ::export::from_utf8_lossy(value); + Err(Error::unknown_field(&value, FIELDS)) + } + } + } + } + + deserializer.deserialize_identifier(FieldVisitor) + } + } + + pub struct RangeVisitor { + pub expecting: &'static str, + pub phantom: PhantomData, + } + + impl<'de, Idx> Visitor<'de> for RangeVisitor + where + Idx: Deserialize<'de>, + { + type Value = (Idx, Idx); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(self.expecting) + } + + fn visit_seq(self, mut seq: A) -> Result + where + A: SeqAccess<'de>, + { + let start: Idx = match try!(seq.next_element()) { + Some(value) => value, + None => { + return Err(Error::invalid_length(0, &self)); + } + }; + let end: Idx = match try!(seq.next_element()) { + Some(value) => value, + None => { + return Err(Error::invalid_length(1, &self)); + } + }; + Ok((start, end)) + } + + fn visit_map(self, mut map: A) -> Result + where + A: MapAccess<'de>, + { + let mut start: Option = None; + let mut end: Option = None; + while let Some(key) = try!(map.next_key()) { + match key { + Field::Start => { + if start.is_some() { + return Err(::duplicate_field("start")); + } + start = Some(try!(map.next_value())); + } + Field::End => { + if end.is_some() { + return Err(::duplicate_field("end")); + } + end = Some(try!(map.next_value())); + } + } + } + let start = match start { + Some(start) => start, + None => return Err(::missing_field("start")), + }; + let end = match end { + Some(end) => end, + None => return Err(::missing_field("end")), + }; + Ok((start, end)) + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(ops_bound, collections_bound))] +impl<'de, T> Deserialize<'de> for Bound +where + T: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + enum Field { + Unbounded, + Included, + Excluded, + } + + impl<'de> Deserialize<'de> for Field { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FieldVisitor; + + impl<'de> Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("`Unbounded`, `Included` or `Excluded`") + } + + fn visit_u32(self, value: u32) -> Result + where + E: Error, + { + match value { + 0 => Ok(Field::Unbounded), + 1 => Ok(Field::Included), + 2 => Ok(Field::Excluded), + _ => Err(Error::invalid_value( + Unexpected::Unsigned(value as u64), + &self, + )), + } + } + + fn visit_str(self, value: &str) -> Result + where + E: Error, + { + match value { + "Unbounded" => Ok(Field::Unbounded), + "Included" => Ok(Field::Included), + "Excluded" => Ok(Field::Excluded), + _ => Err(Error::unknown_variant(value, VARIANTS)), + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + E: Error, + { + match value { + b"Unbounded" => Ok(Field::Unbounded), + b"Included" => Ok(Field::Included), + b"Excluded" => Ok(Field::Excluded), + _ => match str::from_utf8(value) { + Ok(value) => Err(Error::unknown_variant(value, VARIANTS)), + Err(_) => { + Err(Error::invalid_value(Unexpected::Bytes(value), &self)) + } + }, + } + } + } + + deserializer.deserialize_identifier(FieldVisitor) + } + } + + struct BoundVisitor(PhantomData>); + + impl<'de, T> Visitor<'de> for BoundVisitor + where + T: Deserialize<'de>, + { + type Value = Bound; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("enum Bound") + } + + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + match try!(data.variant()) { + (Field::Unbounded, v) => v.unit_variant().map(|()| Bound::Unbounded), + (Field::Included, v) => v.newtype_variant().map(Bound::Included), + (Field::Excluded, v) => v.newtype_variant().map(Bound::Excluded), + } + } + } + + const VARIANTS: &'static [&'static str] = &["Unbounded", "Included", "Excluded"]; + + deserializer.deserialize_enum("Bound", VARIANTS, BoundVisitor(PhantomData)) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! nonzero_integers { + ( $( $T: ident, )+ ) => { + $( + #[cfg(num_nonzero)] + impl<'de> Deserialize<'de> for num::$T { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let value = try!(Deserialize::deserialize(deserializer)); + match ::new(value) { + Some(nonzero) => Ok(nonzero), + None => Err(Error::custom("expected a non-zero value")), + } + } + } + )+ + }; +} + +nonzero_integers! { + NonZeroU8, + NonZeroU16, + NonZeroU32, + NonZeroU64, + NonZeroUsize, +} + +#[cfg(num_nonzero_signed)] +nonzero_integers! { + NonZeroI8, + NonZeroI16, + NonZeroI32, + NonZeroI64, + NonZeroIsize, +} + +// Currently 128-bit integers do not work on Emscripten targets so we need an +// additional `#[cfg]` +serde_if_integer128! { + nonzero_integers! { + NonZeroU128, + } + + #[cfg(num_nonzero_signed)] + nonzero_integers! { + NonZeroI128, + } +} + +//////////////////////////////////////////////////////////////////////////////// + +impl<'de, T, E> Deserialize<'de> for Result +where + T: Deserialize<'de>, + E: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // If this were outside of the serde crate, it would just use: + // + // #[derive(Deserialize)] + // #[serde(variant_identifier)] + enum Field { + Ok, + Err, + } + + impl<'de> Deserialize<'de> for Field { + #[inline] + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + struct FieldVisitor; + + impl<'de> Visitor<'de> for FieldVisitor { + type Value = Field; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("`Ok` or `Err`") + } + + fn visit_u32(self, value: u32) -> Result + where + E: Error, + { + match value { + 0 => Ok(Field::Ok), + 1 => Ok(Field::Err), + _ => Err(Error::invalid_value( + Unexpected::Unsigned(value as u64), + &self, + )), + } + } + + fn visit_str(self, value: &str) -> Result + where + E: Error, + { + match value { + "Ok" => Ok(Field::Ok), + "Err" => Ok(Field::Err), + _ => Err(Error::unknown_variant(value, VARIANTS)), + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + E: Error, + { + match value { + b"Ok" => Ok(Field::Ok), + b"Err" => Ok(Field::Err), + _ => match str::from_utf8(value) { + Ok(value) => Err(Error::unknown_variant(value, VARIANTS)), + Err(_) => { + Err(Error::invalid_value(Unexpected::Bytes(value), &self)) + } + }, + } + } + } + + deserializer.deserialize_identifier(FieldVisitor) + } + } + + struct ResultVisitor(PhantomData>); + + impl<'de, T, E> Visitor<'de> for ResultVisitor + where + T: Deserialize<'de>, + E: Deserialize<'de>, + { + type Value = Result; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("enum Result") + } + + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + match try!(data.variant()) { + (Field::Ok, v) => v.newtype_variant().map(Ok), + (Field::Err, v) => v.newtype_variant().map(Err), + } + } + } + + const VARIANTS: &'static [&'static str] = &["Ok", "Err"]; + + deserializer.deserialize_enum("Result", VARIANTS, ResultVisitor(PhantomData)) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl<'de, T> Deserialize<'de> for Wrapping +where + T: Deserialize<'de>, +{ + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Deserialize::deserialize(deserializer).map(Wrapping) + } +} + +#[cfg(all(feature = "std", std_atomic))] +macro_rules! atomic_impl { + ($($ty:ident)*) => { + $( + impl<'de> Deserialize<'de> for $ty { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Deserialize::deserialize(deserializer).map(Self::new) + } + } + )* + }; +} + +#[cfg(all(feature = "std", std_atomic))] +atomic_impl! { + AtomicBool + AtomicI8 AtomicI16 AtomicI32 AtomicIsize + AtomicU8 AtomicU16 AtomicU32 AtomicUsize +} + +#[cfg(all(feature = "std", std_atomic64))] +atomic_impl! { + AtomicI64 AtomicU64 +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/de/mod.rs b/third_party/cargo/vendor/serde-1.0.110/src/de/mod.rs new file mode 100644 index 0000000..f1b8b31 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/de/mod.rs @@ -0,0 +1,2276 @@ +//! Generic data structure deserialization framework. +//! +//! The two most important traits in this module are [`Deserialize`] and +//! [`Deserializer`]. +//! +//! - **A type that implements `Deserialize` is a data structure** that can be +//! deserialized from any data format supported by Serde, and conversely +//! - **A type that implements `Deserializer` is a data format** that can +//! deserialize any data structure supported by Serde. +//! +//! # The Deserialize trait +//! +//! Serde provides [`Deserialize`] implementations for many Rust primitive and +//! standard library types. The complete list is below. All of these can be +//! deserialized using Serde out of the box. +//! +//! Additionally, Serde provides a procedural macro called [`serde_derive`] to +//! automatically generate [`Deserialize`] implementations for structs and enums +//! in your program. See the [derive section of the manual] for how to use this. +//! +//! In rare cases it may be necessary to implement [`Deserialize`] manually for +//! some type in your program. See the [Implementing `Deserialize`] section of +//! the manual for more about this. +//! +//! Third-party crates may provide [`Deserialize`] implementations for types +//! that they expose. For example the [`linked-hash-map`] crate provides a +//! [`LinkedHashMap`] type that is deserializable by Serde because the +//! crate provides an implementation of [`Deserialize`] for it. +//! +//! # The Deserializer trait +//! +//! [`Deserializer`] implementations are provided by third-party crates, for +//! example [`serde_json`], [`serde_yaml`] and [`bincode`]. +//! +//! A partial list of well-maintained formats is given on the [Serde +//! website][data formats]. +//! +//! # Implementations of Deserialize provided by Serde +//! +//! This is a slightly different set of types than what is supported for +//! serialization. Some types can be serialized by Serde but not deserialized. +//! One example is `OsStr`. +//! +//! - **Primitive types**: +//! - bool +//! - i8, i16, i32, i64, i128, isize +//! - u8, u16, u32, u64, u128, usize +//! - f32, f64 +//! - char +//! - **Compound types**: +//! - \[T; 0\] through \[T; 32\] +//! - tuples up to size 16 +//! - **Common standard library types**: +//! - String +//! - Option\ +//! - Result\ +//! - PhantomData\ +//! - **Wrapper types**: +//! - Box\ +//! - Box\<\[T\]\> +//! - Box\ +//! - Cow\<'a, T\> +//! - Cell\ +//! - RefCell\ +//! - Mutex\ +//! - RwLock\ +//! - Rc\ *(if* features = ["rc"] *is enabled)* +//! - Arc\ *(if* features = ["rc"] *is enabled)* +//! - **Collection types**: +//! - BTreeMap\ +//! - BTreeSet\ +//! - BinaryHeap\ +//! - HashMap\ +//! - HashSet\ +//! - LinkedList\ +//! - VecDeque\ +//! - Vec\ +//! - **Zero-copy types**: +//! - &str +//! - &\[u8\] +//! - **FFI types**: +//! - CString +//! - Box\ +//! - OsString +//! - **Miscellaneous standard library types**: +//! - Duration +//! - SystemTime +//! - Path +//! - PathBuf +//! - Range\ +//! - RangeInclusive\ +//! - Bound\ +//! - num::NonZero* +//! - `!` *(unstable)* +//! - **Net types**: +//! - IpAddr +//! - Ipv4Addr +//! - Ipv6Addr +//! - SocketAddr +//! - SocketAddrV4 +//! - SocketAddrV6 +//! +//! [Implementing `Deserialize`]: https://serde.rs/impl-deserialize.html +//! [`Deserialize`]: ../trait.Deserialize.html +//! [`Deserializer`]: ../trait.Deserializer.html +//! [`LinkedHashMap`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html +//! [`bincode`]: https://github.com/TyOverby/bincode +//! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map +//! [`serde_derive`]: https://crates.io/crates/serde_derive +//! [`serde_json`]: https://github.com/serde-rs/json +//! [`serde_yaml`]: https://github.com/dtolnay/serde-yaml +//! [derive section of the manual]: https://serde.rs/derive.html +//! [data formats]: https://serde.rs/#data-formats + +use lib::*; + +//////////////////////////////////////////////////////////////////////////////// + +pub mod value; + +mod from_primitive; +mod ignored_any; +mod impls; +mod utf8; + +pub use self::ignored_any::IgnoredAny; + +#[cfg(feature = "std")] +#[doc(no_inline)] +pub use std::error::Error as StdError; +#[cfg(not(feature = "std"))] +#[doc(no_inline)] +pub use std_error::Error as StdError; + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! declare_error_trait { + (Error: Sized $(+ $($supertrait:ident)::+)*) => { + /// The `Error` trait allows `Deserialize` implementations to create descriptive + /// error messages belonging to the `Deserializer` against which they are + /// currently running. + /// + /// Every `Deserializer` declares an `Error` type that encompasses both + /// general-purpose deserialization errors as well as errors specific to the + /// particular deserialization format. For example the `Error` type of + /// `serde_json` can represent errors like an invalid JSON escape sequence or an + /// unterminated string literal, in addition to the error cases that are part of + /// this trait. + /// + /// Most deserializers should only need to provide the `Error::custom` method + /// and inherit the default behavior for the other methods. + /// + /// # Example implementation + /// + /// The [example data format] presented on the website shows an error + /// type appropriate for a basic JSON data format. + /// + /// [example data format]: https://serde.rs/data-format.html + pub trait Error: Sized $(+ $($supertrait)::+)* { + /// Raised when there is general error when deserializing a type. + /// + /// The message should not be capitalized and should not end with a period. + /// + /// ```edition2018 + /// # use std::str::FromStr; + /// # + /// # struct IpAddr; + /// # + /// # impl FromStr for IpAddr { + /// # type Err = String; + /// # + /// # fn from_str(_: &str) -> Result { + /// # unimplemented!() + /// # } + /// # } + /// # + /// use serde::de::{self, Deserialize, Deserializer}; + /// + /// impl<'de> Deserialize<'de> for IpAddr { + /// fn deserialize(deserializer: D) -> Result + /// where + /// D: Deserializer<'de>, + /// { + /// let s = String::deserialize(deserializer)?; + /// s.parse().map_err(de::Error::custom) + /// } + /// } + /// ``` + fn custom(msg: T) -> Self + where + T: Display; + + /// Raised when a `Deserialize` receives a type different from what it was + /// expecting. + /// + /// The `unexp` argument provides information about what type was received. + /// This is the type that was present in the input file or other source data + /// of the Deserializer. + /// + /// The `exp` argument provides information about what type was being + /// expected. This is the type that is written in the program. + /// + /// For example if we try to deserialize a String out of a JSON file + /// containing an integer, the unexpected type is the integer and the + /// expected type is the string. + #[cold] + fn invalid_type(unexp: Unexpected, exp: &Expected) -> Self { + Error::custom(format_args!("invalid type: {}, expected {}", unexp, exp)) + } + + /// Raised when a `Deserialize` receives a value of the right type but that + /// is wrong for some other reason. + /// + /// The `unexp` argument provides information about what value was received. + /// This is the value that was present in the input file or other source + /// data of the Deserializer. + /// + /// The `exp` argument provides information about what value was being + /// expected. This is the type that is written in the program. + /// + /// For example if we try to deserialize a String out of some binary data + /// that is not valid UTF-8, the unexpected value is the bytes and the + /// expected value is a string. + #[cold] + fn invalid_value(unexp: Unexpected, exp: &Expected) -> Self { + Error::custom(format_args!("invalid value: {}, expected {}", unexp, exp)) + } + + /// Raised when deserializing a sequence or map and the input data contains + /// too many or too few elements. + /// + /// The `len` argument is the number of elements encountered. The sequence + /// or map may have expected more arguments or fewer arguments. + /// + /// The `exp` argument provides information about what data was being + /// expected. For example `exp` might say that a tuple of size 6 was + /// expected. + #[cold] + fn invalid_length(len: usize, exp: &Expected) -> Self { + Error::custom(format_args!("invalid length {}, expected {}", len, exp)) + } + + /// Raised when a `Deserialize` enum type received a variant with an + /// unrecognized name. + #[cold] + fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self { + if expected.is_empty() { + Error::custom(format_args!( + "unknown variant `{}`, there are no variants", + variant + )) + } else { + Error::custom(format_args!( + "unknown variant `{}`, expected {}", + variant, + OneOf { names: expected } + )) + } + } + + /// Raised when a `Deserialize` struct type received a field with an + /// unrecognized name. + #[cold] + fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self { + if expected.is_empty() { + Error::custom(format_args!( + "unknown field `{}`, there are no fields", + field + )) + } else { + Error::custom(format_args!( + "unknown field `{}`, expected {}", + field, + OneOf { names: expected } + )) + } + } + + /// Raised when a `Deserialize` struct type expected to receive a required + /// field with a particular name but that field was not present in the + /// input. + #[cold] + fn missing_field(field: &'static str) -> Self { + Error::custom(format_args!("missing field `{}`", field)) + } + + /// Raised when a `Deserialize` struct type received more than one of the + /// same field. + #[cold] + fn duplicate_field(field: &'static str) -> Self { + Error::custom(format_args!("duplicate field `{}`", field)) + } + } + } +} + +#[cfg(feature = "std")] +declare_error_trait!(Error: Sized + StdError); + +#[cfg(not(feature = "std"))] +declare_error_trait!(Error: Sized + Debug + Display); + +/// `Unexpected` represents an unexpected invocation of any one of the `Visitor` +/// trait methods. +/// +/// This is used as an argument to the `invalid_type`, `invalid_value`, and +/// `invalid_length` methods of the `Error` trait to build error messages. +/// +/// ```edition2018 +/// # use std::fmt; +/// # +/// # use serde::de::{self, Unexpected, Visitor}; +/// # +/// # struct Example; +/// # +/// # impl<'de> Visitor<'de> for Example { +/// # type Value = (); +/// # +/// # fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// # write!(formatter, "definitely not a boolean") +/// # } +/// # +/// fn visit_bool(self, v: bool) -> Result +/// where +/// E: de::Error, +/// { +/// Err(de::Error::invalid_type(Unexpected::Bool(v), &self)) +/// } +/// # } +/// ``` +#[derive(Copy, Clone, PartialEq, Debug)] +pub enum Unexpected<'a> { + /// The input contained a boolean value that was not expected. + Bool(bool), + + /// The input contained an unsigned integer `u8`, `u16`, `u32` or `u64` that + /// was not expected. + Unsigned(u64), + + /// The input contained a signed integer `i8`, `i16`, `i32` or `i64` that + /// was not expected. + Signed(i64), + + /// The input contained a floating point `f32` or `f64` that was not + /// expected. + Float(f64), + + /// The input contained a `char` that was not expected. + Char(char), + + /// The input contained a `&str` or `String` that was not expected. + Str(&'a str), + + /// The input contained a `&[u8]` or `Vec` that was not expected. + Bytes(&'a [u8]), + + /// The input contained a unit `()` that was not expected. + Unit, + + /// The input contained an `Option` that was not expected. + Option, + + /// The input contained a newtype struct that was not expected. + NewtypeStruct, + + /// The input contained a sequence that was not expected. + Seq, + + /// The input contained a map that was not expected. + Map, + + /// The input contained an enum that was not expected. + Enum, + + /// The input contained a unit variant that was not expected. + UnitVariant, + + /// The input contained a newtype variant that was not expected. + NewtypeVariant, + + /// The input contained a tuple variant that was not expected. + TupleVariant, + + /// The input contained a struct variant that was not expected. + StructVariant, + + /// A message stating what uncategorized thing the input contained that was + /// not expected. + /// + /// The message should be a noun or noun phrase, not capitalized and without + /// a period. An example message is "unoriginal superhero". + Other(&'a str), +} + +impl<'a> fmt::Display for Unexpected<'a> { + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + use self::Unexpected::*; + match *self { + Bool(b) => write!(formatter, "boolean `{}`", b), + Unsigned(i) => write!(formatter, "integer `{}`", i), + Signed(i) => write!(formatter, "integer `{}`", i), + Float(f) => write!(formatter, "floating point `{}`", f), + Char(c) => write!(formatter, "character `{}`", c), + Str(s) => write!(formatter, "string {:?}", s), + Bytes(_) => write!(formatter, "byte array"), + Unit => write!(formatter, "unit value"), + Option => write!(formatter, "Option value"), + NewtypeStruct => write!(formatter, "newtype struct"), + Seq => write!(formatter, "sequence"), + Map => write!(formatter, "map"), + Enum => write!(formatter, "enum"), + UnitVariant => write!(formatter, "unit variant"), + NewtypeVariant => write!(formatter, "newtype variant"), + TupleVariant => write!(formatter, "tuple variant"), + StructVariant => write!(formatter, "struct variant"), + Other(other) => formatter.write_str(other), + } + } +} + +/// `Expected` represents an explanation of what data a `Visitor` was expecting +/// to receive. +/// +/// This is used as an argument to the `invalid_type`, `invalid_value`, and +/// `invalid_length` methods of the `Error` trait to build error messages. The +/// message should be a noun or noun phrase that completes the sentence "This +/// Visitor expects to receive ...", for example the message could be "an +/// integer between 0 and 64". The message should not be capitalized and should +/// not end with a period. +/// +/// Within the context of a `Visitor` implementation, the `Visitor` itself +/// (`&self`) is an implementation of this trait. +/// +/// ```edition2018 +/// # use std::fmt; +/// # +/// # use serde::de::{self, Unexpected, Visitor}; +/// # +/// # struct Example; +/// # +/// # impl<'de> Visitor<'de> for Example { +/// # type Value = (); +/// # +/// # fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// # write!(formatter, "definitely not a boolean") +/// # } +/// # +/// fn visit_bool(self, v: bool) -> Result +/// where +/// E: de::Error, +/// { +/// Err(de::Error::invalid_type(Unexpected::Bool(v), &self)) +/// } +/// # } +/// ``` +/// +/// Outside of a `Visitor`, `&"..."` can be used. +/// +/// ```edition2018 +/// # use serde::de::{self, Unexpected}; +/// # +/// # fn example() -> Result<(), E> +/// # where +/// # E: de::Error, +/// # { +/// # let v = true; +/// return Err(de::Error::invalid_type(Unexpected::Bool(v), &"a negative integer")); +/// # } +/// ``` +pub trait Expected { + /// Format an explanation of what data was being expected. Same signature as + /// the `Display` and `Debug` traits. + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result; +} + +impl<'de, T> Expected for T +where + T: Visitor<'de>, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + self.expecting(formatter) + } +} + +impl<'a> Expected for &'a str { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(self) + } +} + +impl<'a> Display for Expected + 'a { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + Expected::fmt(self, formatter) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A **data structure** that can be deserialized from any data format supported +/// by Serde. +/// +/// Serde provides `Deserialize` implementations for many Rust primitive and +/// standard library types. The complete list is [here][de]. All of these can +/// be deserialized using Serde out of the box. +/// +/// Additionally, Serde provides a procedural macro called `serde_derive` to +/// automatically generate `Deserialize` implementations for structs and enums +/// in your program. See the [derive section of the manual][derive] for how to +/// use this. +/// +/// In rare cases it may be necessary to implement `Deserialize` manually for +/// some type in your program. See the [Implementing +/// `Deserialize`][impl-deserialize] section of the manual for more about this. +/// +/// Third-party crates may provide `Deserialize` implementations for types that +/// they expose. For example the `linked-hash-map` crate provides a +/// `LinkedHashMap` type that is deserializable by Serde because the crate +/// provides an implementation of `Deserialize` for it. +/// +/// [de]: https://docs.serde.rs/serde/de/index.html +/// [derive]: https://serde.rs/derive.html +/// [impl-deserialize]: https://serde.rs/impl-deserialize.html +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed by `Self` when deserialized. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +pub trait Deserialize<'de>: Sized { + /// Deserialize this value from the given Serde deserializer. + /// + /// See the [Implementing `Deserialize`][impl-deserialize] section of the + /// manual for more information about how to implement this method. + /// + /// [impl-deserialize]: https://serde.rs/impl-deserialize.html + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>; + + /// Deserializes a value into `self` from the given Deserializer. + /// + /// The purpose of this method is to allow the deserializer to reuse + /// resources and avoid copies. As such, if this method returns an error, + /// `self` will be in an indeterminate state where some parts of the struct + /// have been overwritten. Although whatever state that is will be + /// memory-safe. + /// + /// This is generally useful when repeatedly deserializing values that + /// are processed one at a time, where the value of `self` doesn't matter + /// when the next deserialization occurs. + /// + /// If you manually implement this, your recursive deserializations should + /// use `deserialize_in_place`. + /// + /// This method is stable and an official public API, but hidden from the + /// documentation because it is almost never what newbies are looking for. + /// Showing it in rustdoc would cause it to be featured more prominently + /// than it deserves. + #[doc(hidden)] + fn deserialize_in_place(deserializer: D, place: &mut Self) -> Result<(), D::Error> + where + D: Deserializer<'de>, + { + // Default implementation just delegates to `deserialize` impl. + *place = Deserialize::deserialize(deserializer)?; + Ok(()) + } +} + +/// A data structure that can be deserialized without borrowing any data from +/// the deserializer. +/// +/// This is primarily useful for trait bounds on functions. For example a +/// `from_str` function may be able to deserialize a data structure that borrows +/// from the input string, but a `from_reader` function may only deserialize +/// owned data. +/// +/// ```edition2018 +/// # use serde::de::{Deserialize, DeserializeOwned}; +/// # use std::io::{Read, Result}; +/// # +/// # trait Ignore { +/// fn from_str<'a, T>(s: &'a str) -> Result +/// where +/// T: Deserialize<'a>; +/// +/// fn from_reader(rdr: R) -> Result +/// where +/// R: Read, +/// T: DeserializeOwned; +/// # } +/// ``` +/// +/// # Lifetime +/// +/// The relationship between `Deserialize` and `DeserializeOwned` in trait +/// bounds is explained in more detail on the page [Understanding deserializer +/// lifetimes]. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +pub trait DeserializeOwned: for<'de> Deserialize<'de> {} +impl DeserializeOwned for T where T: for<'de> Deserialize<'de> {} + +/// `DeserializeSeed` is the stateful form of the `Deserialize` trait. If you +/// ever find yourself looking for a way to pass data into a `Deserialize` impl, +/// this trait is the way to do it. +/// +/// As one example of stateful deserialization consider deserializing a JSON +/// array into an existing buffer. Using the `Deserialize` trait we could +/// deserialize a JSON array into a `Vec` but it would be a freshly allocated +/// `Vec`; there is no way for `Deserialize` to reuse a previously allocated +/// buffer. Using `DeserializeSeed` instead makes this possible as in the +/// example code below. +/// +/// The canonical API for stateless deserialization looks like this: +/// +/// ```edition2018 +/// # use serde::Deserialize; +/// # +/// # enum Error {} +/// # +/// fn func<'de, T: Deserialize<'de>>() -> Result +/// # { +/// # unimplemented!() +/// # } +/// ``` +/// +/// Adjusting an API like this to support stateful deserialization is a matter +/// of accepting a seed as input: +/// +/// ```edition2018 +/// # use serde::de::DeserializeSeed; +/// # +/// # enum Error {} +/// # +/// fn func_seed<'de, T: DeserializeSeed<'de>>(seed: T) -> Result +/// # { +/// # let _ = seed; +/// # unimplemented!() +/// # } +/// ``` +/// +/// In practice the majority of deserialization is stateless. An API expecting a +/// seed can be appeased by passing `std::marker::PhantomData` as a seed in the +/// case of stateless deserialization. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed by `Self::Value` when deserialized. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example +/// +/// Suppose we have JSON that looks like `[[1, 2], [3, 4, 5], [6]]` and we need +/// to deserialize it into a flat representation like `vec![1, 2, 3, 4, 5, 6]`. +/// Allocating a brand new `Vec` for each subarray would be slow. Instead we +/// would like to allocate a single `Vec` and then deserialize each subarray +/// into it. This requires stateful deserialization using the `DeserializeSeed` +/// trait. +/// +/// ```edition2018 +/// use std::fmt; +/// use std::marker::PhantomData; +/// +/// use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor}; +/// +/// // A DeserializeSeed implementation that uses stateful deserialization to +/// // append array elements onto the end of an existing vector. The preexisting +/// // state ("seed") in this case is the Vec. The `deserialize` method of +/// // `ExtendVec` will be traversing the inner arrays of the JSON input and +/// // appending each integer into the existing Vec. +/// struct ExtendVec<'a, T: 'a>(&'a mut Vec); +/// +/// impl<'de, 'a, T> DeserializeSeed<'de> for ExtendVec<'a, T> +/// where +/// T: Deserialize<'de>, +/// { +/// // The return type of the `deserialize` method. This implementation +/// // appends onto an existing vector but does not create any new data +/// // structure, so the return type is (). +/// type Value = (); +/// +/// fn deserialize(self, deserializer: D) -> Result +/// where +/// D: Deserializer<'de>, +/// { +/// // Visitor implementation that will walk an inner array of the JSON +/// // input. +/// struct ExtendVecVisitor<'a, T: 'a>(&'a mut Vec); +/// +/// impl<'de, 'a, T> Visitor<'de> for ExtendVecVisitor<'a, T> +/// where +/// T: Deserialize<'de>, +/// { +/// type Value = (); +/// +/// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// write!(formatter, "an array of integers") +/// } +/// +/// fn visit_seq(self, mut seq: A) -> Result<(), A::Error> +/// where +/// A: SeqAccess<'de>, +/// { +/// // Visit each element in the inner array and push it onto +/// // the existing vector. +/// while let Some(elem) = seq.next_element()? { +/// self.0.push(elem); +/// } +/// Ok(()) +/// } +/// } +/// +/// deserializer.deserialize_seq(ExtendVecVisitor(self.0)) +/// } +/// } +/// +/// // Visitor implementation that will walk the outer array of the JSON input. +/// struct FlattenedVecVisitor(PhantomData); +/// +/// impl<'de, T> Visitor<'de> for FlattenedVecVisitor +/// where +/// T: Deserialize<'de>, +/// { +/// // This Visitor constructs a single Vec to hold the flattened +/// // contents of the inner arrays. +/// type Value = Vec; +/// +/// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// write!(formatter, "an array of arrays") +/// } +/// +/// fn visit_seq(self, mut seq: A) -> Result, A::Error> +/// where +/// A: SeqAccess<'de>, +/// { +/// // Create a single Vec to hold the flattened contents. +/// let mut vec = Vec::new(); +/// +/// // Each iteration through this loop is one inner array. +/// while let Some(()) = seq.next_element_seed(ExtendVec(&mut vec))? { +/// // Nothing to do; inner array has been appended into `vec`. +/// } +/// +/// // Return the finished vec. +/// Ok(vec) +/// } +/// } +/// +/// # fn example<'de, D>(deserializer: D) -> Result<(), D::Error> +/// # where +/// # D: Deserializer<'de>, +/// # { +/// let visitor = FlattenedVecVisitor(PhantomData); +/// let flattened: Vec = deserializer.deserialize_seq(visitor)?; +/// # Ok(()) +/// # } +/// ``` +pub trait DeserializeSeed<'de>: Sized { + /// The type produced by using this seed. + type Value; + + /// Equivalent to the more common `Deserialize::deserialize` method, except + /// with some initial piece of data (the seed) passed in. + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>; +} + +impl<'de, T> DeserializeSeed<'de> for PhantomData +where + T: Deserialize<'de>, +{ + type Value = T; + + #[inline] + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + T::deserialize(deserializer) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A **data format** that can deserialize any data structure supported by +/// Serde. +/// +/// The role of this trait is to define the deserialization half of the [Serde +/// data model], which is a way to categorize every Rust data type into one of +/// 29 possible types. Each method of the `Deserializer` trait corresponds to one +/// of the types of the data model. +/// +/// Implementations of `Deserialize` map themselves into this data model by +/// passing to the `Deserializer` a `Visitor` implementation that can receive +/// these various types. +/// +/// The types that make up the Serde data model are: +/// +/// - **14 primitive types** +/// - bool +/// - i8, i16, i32, i64, i128 +/// - u8, u16, u32, u64, u128 +/// - f32, f64 +/// - char +/// - **string** +/// - UTF-8 bytes with a length and no null terminator. +/// - When serializing, all strings are handled equally. When deserializing, +/// there are three flavors of strings: transient, owned, and borrowed. +/// - **byte array** - \[u8\] +/// - Similar to strings, during deserialization byte arrays can be +/// transient, owned, or borrowed. +/// - **option** +/// - Either none or some value. +/// - **unit** +/// - The type of `()` in Rust. It represents an anonymous value containing +/// no data. +/// - **unit_struct** +/// - For example `struct Unit` or `PhantomData`. It represents a named +/// value containing no data. +/// - **unit_variant** +/// - For example the `E::A` and `E::B` in `enum E { A, B }`. +/// - **newtype_struct** +/// - For example `struct Millimeters(u8)`. +/// - **newtype_variant** +/// - For example the `E::N` in `enum E { N(u8) }`. +/// - **seq** +/// - A variably sized heterogeneous sequence of values, for example `Vec` +/// or `HashSet`. When serializing, the length may or may not be known +/// before iterating through all the data. When deserializing, the length +/// is determined by looking at the serialized data. +/// - **tuple** +/// - A statically sized heterogeneous sequence of values for which the +/// length will be known at deserialization time without looking at the +/// serialized data, for example `(u8,)` or `(String, u64, Vec)` or +/// `[u64; 10]`. +/// - **tuple_struct** +/// - A named tuple, for example `struct Rgb(u8, u8, u8)`. +/// - **tuple_variant** +/// - For example the `E::T` in `enum E { T(u8, u8) }`. +/// - **map** +/// - A heterogeneous key-value pairing, for example `BTreeMap`. +/// - **struct** +/// - A heterogeneous key-value pairing in which the keys are strings and +/// will be known at deserialization time without looking at the serialized +/// data, for example `struct S { r: u8, g: u8, b: u8 }`. +/// - **struct_variant** +/// - For example the `E::S` in `enum E { S { r: u8, g: u8, b: u8 } }`. +/// +/// The `Deserializer` trait supports two entry point styles which enables +/// different kinds of deserialization. +/// +/// 1. The `deserialize` method. Self-describing data formats like JSON are able +/// to look at the serialized data and tell what it represents. For example +/// the JSON deserializer may see an opening curly brace (`{`) and know that +/// it is seeing a map. If the data format supports +/// `Deserializer::deserialize_any`, it will drive the Visitor using whatever +/// type it sees in the input. JSON uses this approach when deserializing +/// `serde_json::Value` which is an enum that can represent any JSON +/// document. Without knowing what is in a JSON document, we can deserialize +/// it to `serde_json::Value` by going through +/// `Deserializer::deserialize_any`. +/// +/// 2. The various `deserialize_*` methods. Non-self-describing formats like +/// Bincode need to be told what is in the input in order to deserialize it. +/// The `deserialize_*` methods are hints to the deserializer for how to +/// interpret the next piece of input. Non-self-describing formats are not +/// able to deserialize something like `serde_json::Value` which relies on +/// `Deserializer::deserialize_any`. +/// +/// When implementing `Deserialize`, you should avoid relying on +/// `Deserializer::deserialize_any` unless you need to be told by the +/// Deserializer what type is in the input. Know that relying on +/// `Deserializer::deserialize_any` means your data type will be able to +/// deserialize from self-describing formats only, ruling out Bincode and many +/// others. +/// +/// [Serde data model]: https://serde.rs/data-model.html +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed from the input when deserializing. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example implementation +/// +/// The [example data format] presented on the website contains example code for +/// a basic JSON `Deserializer`. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait Deserializer<'de>: Sized { + /// The error type that can be returned if some error occurs during + /// deserialization. + type Error: Error; + + /// Require the `Deserializer` to figure out how to drive the visitor based + /// on what data type is in the input. + /// + /// When implementing `Deserialize`, you should avoid relying on + /// `Deserializer::deserialize_any` unless you need to be told by the + /// Deserializer what type is in the input. Know that relying on + /// `Deserializer::deserialize_any` means your data type will be able to + /// deserialize from self-describing formats only, ruling out Bincode and + /// many others. + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a `bool` value. + fn deserialize_bool(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting an `i8` value. + fn deserialize_i8(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting an `i16` value. + fn deserialize_i16(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting an `i32` value. + fn deserialize_i32(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting an `i64` value. + fn deserialize_i64(self, visitor: V) -> Result + where + V: Visitor<'de>; + + serde_if_integer128! { + /// Hint that the `Deserialize` type is expecting an `i128` value. + /// + /// This method is available only on Rust compiler versions >=1.26. The + /// default behavior unconditionally returns an error. + fn deserialize_i128(self, visitor: V) -> Result + where + V: Visitor<'de> + { + let _ = visitor; + Err(Error::custom("i128 is not supported")) + } + } + + /// Hint that the `Deserialize` type is expecting a `u8` value. + fn deserialize_u8(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a `u16` value. + fn deserialize_u16(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a `u32` value. + fn deserialize_u32(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a `u64` value. + fn deserialize_u64(self, visitor: V) -> Result + where + V: Visitor<'de>; + + serde_if_integer128! { + /// Hint that the `Deserialize` type is expecting an `u128` value. + /// + /// This method is available only on Rust compiler versions >=1.26. The + /// default behavior unconditionally returns an error. + fn deserialize_u128(self, visitor: V) -> Result + where + V: Visitor<'de> + { + let _ = visitor; + Err(Error::custom("u128 is not supported")) + } + } + + /// Hint that the `Deserialize` type is expecting a `f32` value. + fn deserialize_f32(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a `f64` value. + fn deserialize_f64(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a `char` value. + fn deserialize_char(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a string value and does + /// not benefit from taking ownership of buffered data owned by the + /// `Deserializer`. + /// + /// If the `Visitor` would benefit from taking ownership of `String` data, + /// indiciate this to the `Deserializer` by using `deserialize_string` + /// instead. + fn deserialize_str(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a string value and would + /// benefit from taking ownership of buffered data owned by the + /// `Deserializer`. + /// + /// If the `Visitor` would not benefit from taking ownership of `String` + /// data, indicate that to the `Deserializer` by using `deserialize_str` + /// instead. + fn deserialize_string(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a byte array and does not + /// benefit from taking ownership of buffered data owned by the + /// `Deserializer`. + /// + /// If the `Visitor` would benefit from taking ownership of `Vec` data, + /// indicate this to the `Deserializer` by using `deserialize_byte_buf` + /// instead. + fn deserialize_bytes(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a byte array and would + /// benefit from taking ownership of buffered data owned by the + /// `Deserializer`. + /// + /// If the `Visitor` would not benefit from taking ownership of `Vec` + /// data, indicate that to the `Deserializer` by using `deserialize_bytes` + /// instead. + fn deserialize_byte_buf(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting an optional value. + /// + /// This allows deserializers that encode an optional value as a nullable + /// value to convert the null value into `None` and a regular value into + /// `Some(value)`. + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a unit value. + fn deserialize_unit(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a unit struct with a + /// particular name. + fn deserialize_unit_struct( + self, + name: &'static str, + visitor: V, + ) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a newtype struct with a + /// particular name. + fn deserialize_newtype_struct( + self, + name: &'static str, + visitor: V, + ) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a sequence of values. + fn deserialize_seq(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a sequence of values and + /// knows how many values there are without looking at the serialized data. + fn deserialize_tuple(self, len: usize, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a tuple struct with a + /// particular name and number of fields. + fn deserialize_tuple_struct( + self, + name: &'static str, + len: usize, + visitor: V, + ) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a map of key-value pairs. + fn deserialize_map(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting a struct with a particular + /// name and fields. + fn deserialize_struct( + self, + name: &'static str, + fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting an enum value with a + /// particular name and possible variants. + fn deserialize_enum( + self, + name: &'static str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type is expecting the name of a struct + /// field or the discriminant of an enum variant. + fn deserialize_identifier(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Hint that the `Deserialize` type needs to deserialize a value whose type + /// doesn't matter because it is ignored. + /// + /// Deserializers for non-self-describing formats may not support this mode. + fn deserialize_ignored_any(self, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Determine whether `Deserialize` implementations should expect to + /// deserialize their human-readable form. + /// + /// Some types have a human-readable form that may be somewhat expensive to + /// construct, as well as a binary form that is compact and efficient. + /// Generally text-based formats like JSON and YAML will prefer to use the + /// human-readable one and binary formats like Bincode will prefer the + /// compact one. + /// + /// ```edition2018 + /// # use std::ops::Add; + /// # use std::str::FromStr; + /// # + /// # struct Timestamp; + /// # + /// # impl Timestamp { + /// # const EPOCH: Timestamp = Timestamp; + /// # } + /// # + /// # impl FromStr for Timestamp { + /// # type Err = String; + /// # fn from_str(_: &str) -> Result { + /// # unimplemented!() + /// # } + /// # } + /// # + /// # struct Duration; + /// # + /// # impl Duration { + /// # fn seconds(_: u64) -> Self { unimplemented!() } + /// # } + /// # + /// # impl Add for Timestamp { + /// # type Output = Timestamp; + /// # fn add(self, _: Duration) -> Self::Output { + /// # unimplemented!() + /// # } + /// # } + /// # + /// use serde::de::{self, Deserialize, Deserializer}; + /// + /// impl<'de> Deserialize<'de> for Timestamp { + /// fn deserialize(deserializer: D) -> Result + /// where + /// D: Deserializer<'de>, + /// { + /// if deserializer.is_human_readable() { + /// // Deserialize from a human-readable string like "2015-05-15T17:01:00Z". + /// let s = String::deserialize(deserializer)?; + /// Timestamp::from_str(&s).map_err(de::Error::custom) + /// } else { + /// // Deserialize from a compact binary representation, seconds since + /// // the Unix epoch. + /// let n = u64::deserialize(deserializer)?; + /// Ok(Timestamp::EPOCH + Duration::seconds(n)) + /// } + /// } + /// } + /// ``` + /// + /// The default implementation of this method returns `true`. Data formats + /// may override this to `false` to request a compact form for types that + /// support one. Note that modifying this method to change a format from + /// human-readable to compact or vice versa should be regarded as a breaking + /// change, as a value serialized in human-readable mode is not required to + /// deserialize from the same data in compact mode. + #[inline] + fn is_human_readable(&self) -> bool { + true + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// This trait represents a visitor that walks through a deserializer. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the requirement for lifetime of data +/// that may be borrowed by `Self::Value`. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example +/// +/// ```edition2018 +/// # use std::fmt; +/// # +/// # use serde::de::{self, Unexpected, Visitor}; +/// # +/// /// A visitor that deserializes a long string - a string containing at least +/// /// some minimum number of bytes. +/// struct LongString { +/// min: usize, +/// } +/// +/// impl<'de> Visitor<'de> for LongString { +/// type Value = String; +/// +/// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { +/// write!(formatter, "a string containing at least {} bytes", self.min) +/// } +/// +/// fn visit_str(self, s: &str) -> Result +/// where +/// E: de::Error, +/// { +/// if s.len() >= self.min { +/// Ok(s.to_owned()) +/// } else { +/// Err(de::Error::invalid_value(Unexpected::Str(s), &self)) +/// } +/// } +/// } +/// ``` +pub trait Visitor<'de>: Sized { + /// The value produced by this visitor. + type Value; + + /// Format a message stating what data this Visitor expects to receive. + /// + /// This is used in error messages. The message should complete the sentence + /// "This Visitor expects to receive ...", for example the message could be + /// "an integer between 0 and 64". The message should not be capitalized and + /// should not end with a period. + /// + /// ```edition2018 + /// # use std::fmt; + /// # + /// # struct S { + /// # max: usize, + /// # } + /// # + /// # impl<'de> serde::de::Visitor<'de> for S { + /// # type Value = (); + /// # + /// fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// write!(formatter, "an integer between 0 and {}", self.max) + /// } + /// # } + /// ``` + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result; + + /// The input contains a boolean. + /// + /// The default implementation fails with a type error. + fn visit_bool(self, v: bool) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Bool(v), &self)) + } + + /// The input contains an `i8`. + /// + /// The default implementation forwards to [`visit_i64`]. + /// + /// [`visit_i64`]: #method.visit_i64 + fn visit_i8(self, v: i8) -> Result + where + E: Error, + { + self.visit_i64(v as i64) + } + + /// The input contains an `i16`. + /// + /// The default implementation forwards to [`visit_i64`]. + /// + /// [`visit_i64`]: #method.visit_i64 + fn visit_i16(self, v: i16) -> Result + where + E: Error, + { + self.visit_i64(v as i64) + } + + /// The input contains an `i32`. + /// + /// The default implementation forwards to [`visit_i64`]. + /// + /// [`visit_i64`]: #method.visit_i64 + fn visit_i32(self, v: i32) -> Result + where + E: Error, + { + self.visit_i64(v as i64) + } + + /// The input contains an `i64`. + /// + /// The default implementation fails with a type error. + fn visit_i64(self, v: i64) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Signed(v), &self)) + } + + serde_if_integer128! { + /// The input contains a `i128`. + /// + /// This method is available only on Rust compiler versions >=1.26. The + /// default implementation fails with a type error. + fn visit_i128(self, v: i128) -> Result + where + E: Error, + { + let _ = v; + Err(Error::invalid_type(Unexpected::Other("i128"), &self)) + } + } + + /// The input contains a `u8`. + /// + /// The default implementation forwards to [`visit_u64`]. + /// + /// [`visit_u64`]: #method.visit_u64 + fn visit_u8(self, v: u8) -> Result + where + E: Error, + { + self.visit_u64(v as u64) + } + + /// The input contains a `u16`. + /// + /// The default implementation forwards to [`visit_u64`]. + /// + /// [`visit_u64`]: #method.visit_u64 + fn visit_u16(self, v: u16) -> Result + where + E: Error, + { + self.visit_u64(v as u64) + } + + /// The input contains a `u32`. + /// + /// The default implementation forwards to [`visit_u64`]. + /// + /// [`visit_u64`]: #method.visit_u64 + fn visit_u32(self, v: u32) -> Result + where + E: Error, + { + self.visit_u64(v as u64) + } + + /// The input contains a `u64`. + /// + /// The default implementation fails with a type error. + fn visit_u64(self, v: u64) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Unsigned(v), &self)) + } + + serde_if_integer128! { + /// The input contains a `u128`. + /// + /// This method is available only on Rust compiler versions >=1.26. The + /// default implementation fails with a type error. + fn visit_u128(self, v: u128) -> Result + where + E: Error, + { + let _ = v; + Err(Error::invalid_type(Unexpected::Other("u128"), &self)) + } + } + + /// The input contains an `f32`. + /// + /// The default implementation forwards to [`visit_f64`]. + /// + /// [`visit_f64`]: #method.visit_f64 + fn visit_f32(self, v: f32) -> Result + where + E: Error, + { + self.visit_f64(v as f64) + } + + /// The input contains an `f64`. + /// + /// The default implementation fails with a type error. + fn visit_f64(self, v: f64) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Float(v), &self)) + } + + /// The input contains a `char`. + /// + /// The default implementation forwards to [`visit_str`] as a one-character + /// string. + /// + /// [`visit_str`]: #method.visit_str + #[inline] + fn visit_char(self, v: char) -> Result + where + E: Error, + { + self.visit_str(utf8::encode(v).as_str()) + } + + /// The input contains a string. The lifetime of the string is ephemeral and + /// it may be destroyed after this method returns. + /// + /// This method allows the `Deserializer` to avoid a copy by retaining + /// ownership of any buffered data. `Deserialize` implementations that do + /// not benefit from taking ownership of `String` data should indicate that + /// to the deserializer by using `Deserializer::deserialize_str` rather than + /// `Deserializer::deserialize_string`. + /// + /// It is never correct to implement `visit_string` without implementing + /// `visit_str`. Implement neither, both, or just `visit_str`. + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Str(v), &self)) + } + + /// The input contains a string that lives at least as long as the + /// `Deserializer`. + /// + /// This enables zero-copy deserialization of strings in some formats. For + /// example JSON input containing the JSON string `"borrowed"` can be + /// deserialized with zero copying into a `&'a str` as long as the input + /// data outlives `'a`. + /// + /// The default implementation forwards to `visit_str`. + #[inline] + fn visit_borrowed_str(self, v: &'de str) -> Result + where + E: Error, + { + self.visit_str(v) + } + + /// The input contains a string and ownership of the string is being given + /// to the `Visitor`. + /// + /// This method allows the `Visitor` to avoid a copy by taking ownership of + /// a string created by the `Deserializer`. `Deserialize` implementations + /// that benefit from taking ownership of `String` data should indicate that + /// to the deserializer by using `Deserializer::deserialize_string` rather + /// than `Deserializer::deserialize_str`, although not every deserializer + /// will honor such a request. + /// + /// It is never correct to implement `visit_string` without implementing + /// `visit_str`. Implement neither, both, or just `visit_str`. + /// + /// The default implementation forwards to `visit_str` and then drops the + /// `String`. + #[inline] + #[cfg(any(feature = "std", feature = "alloc"))] + fn visit_string(self, v: String) -> Result + where + E: Error, + { + self.visit_str(&v) + } + + /// The input contains a byte array. The lifetime of the byte array is + /// ephemeral and it may be destroyed after this method returns. + /// + /// This method allows the `Deserializer` to avoid a copy by retaining + /// ownership of any buffered data. `Deserialize` implementations that do + /// not benefit from taking ownership of `Vec` data should indicate that + /// to the deserializer by using `Deserializer::deserialize_bytes` rather + /// than `Deserializer::deserialize_byte_buf`. + /// + /// It is never correct to implement `visit_byte_buf` without implementing + /// `visit_bytes`. Implement neither, both, or just `visit_bytes`. + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + let _ = v; + Err(Error::invalid_type(Unexpected::Bytes(v), &self)) + } + + /// The input contains a byte array that lives at least as long as the + /// `Deserializer`. + /// + /// This enables zero-copy deserialization of bytes in some formats. For + /// example Bincode data containing bytes can be deserialized with zero + /// copying into a `&'a [u8]` as long as the input data outlives `'a`. + /// + /// The default implementation forwards to `visit_bytes`. + #[inline] + fn visit_borrowed_bytes(self, v: &'de [u8]) -> Result + where + E: Error, + { + self.visit_bytes(v) + } + + /// The input contains a byte array and ownership of the byte array is being + /// given to the `Visitor`. + /// + /// This method allows the `Visitor` to avoid a copy by taking ownership of + /// a byte buffer created by the `Deserializer`. `Deserialize` + /// implementations that benefit from taking ownership of `Vec` data + /// should indicate that to the deserializer by using + /// `Deserializer::deserialize_byte_buf` rather than + /// `Deserializer::deserialize_bytes`, although not every deserializer will + /// honor such a request. + /// + /// It is never correct to implement `visit_byte_buf` without implementing + /// `visit_bytes`. Implement neither, both, or just `visit_bytes`. + /// + /// The default implementation forwards to `visit_bytes` and then drops the + /// `Vec`. + #[cfg(any(feature = "std", feature = "alloc"))] + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + self.visit_bytes(&v) + } + + /// The input contains an optional that is absent. + /// + /// The default implementation fails with a type error. + fn visit_none(self) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Option, &self)) + } + + /// The input contains an optional that is present. + /// + /// The default implementation fails with a type error. + fn visit_some(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let _ = deserializer; + Err(Error::invalid_type(Unexpected::Option, &self)) + } + + /// The input contains a unit `()`. + /// + /// The default implementation fails with a type error. + fn visit_unit(self) -> Result + where + E: Error, + { + Err(Error::invalid_type(Unexpected::Unit, &self)) + } + + /// The input contains a newtype struct. + /// + /// The content of the newtype struct may be read from the given + /// `Deserializer`. + /// + /// The default implementation fails with a type error. + fn visit_newtype_struct(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + let _ = deserializer; + Err(Error::invalid_type(Unexpected::NewtypeStruct, &self)) + } + + /// The input contains a sequence of elements. + /// + /// The default implementation fails with a type error. + fn visit_seq(self, seq: A) -> Result + where + A: SeqAccess<'de>, + { + let _ = seq; + Err(Error::invalid_type(Unexpected::Seq, &self)) + } + + /// The input contains a key-value map. + /// + /// The default implementation fails with a type error. + fn visit_map(self, map: A) -> Result + where + A: MapAccess<'de>, + { + let _ = map; + Err(Error::invalid_type(Unexpected::Map, &self)) + } + + /// The input contains an enum. + /// + /// The default implementation fails with a type error. + fn visit_enum(self, data: A) -> Result + where + A: EnumAccess<'de>, + { + let _ = data; + Err(Error::invalid_type(Unexpected::Enum, &self)) + } + + // Used when deserializing a flattened Option field. Not public API. + #[doc(hidden)] + fn __private_visit_untagged_option(self, _: D) -> Result + where + D: Deserializer<'de>, + { + Err(()) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// Provides a `Visitor` access to each element of a sequence in the input. +/// +/// This is a trait that a `Deserializer` passes to a `Visitor` implementation, +/// which deserializes each item in a sequence. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed by deserialized sequence elements. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SeqAccess` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SeqAccess<'de> { + /// The error type that can be returned if some error occurs during + /// deserialization. + type Error: Error; + + /// This returns `Ok(Some(value))` for the next value in the sequence, or + /// `Ok(None)` if there are no more remaining items. + /// + /// `Deserialize` implementations should typically use + /// `SeqAccess::next_element` instead. + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: DeserializeSeed<'de>; + + /// This returns `Ok(Some(value))` for the next value in the sequence, or + /// `Ok(None)` if there are no more remaining items. + /// + /// This method exists as a convenience for `Deserialize` implementations. + /// `SeqAccess` implementations should not override the default behavior. + #[inline] + fn next_element(&mut self) -> Result, Self::Error> + where + T: Deserialize<'de>, + { + self.next_element_seed(PhantomData) + } + + /// Returns the number of elements remaining in the sequence, if known. + #[inline] + fn size_hint(&self) -> Option { + None + } +} + +impl<'de, 'a, A> SeqAccess<'de> for &'a mut A +where + A: SeqAccess<'de>, +{ + type Error = A::Error; + + #[inline] + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: DeserializeSeed<'de>, + { + (**self).next_element_seed(seed) + } + + #[inline] + fn next_element(&mut self) -> Result, Self::Error> + where + T: Deserialize<'de>, + { + (**self).next_element() + } + + #[inline] + fn size_hint(&self) -> Option { + (**self).size_hint() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// Provides a `Visitor` access to each entry of a map in the input. +/// +/// This is a trait that a `Deserializer` passes to a `Visitor` implementation. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed by deserialized map entries. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `MapAccess` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait MapAccess<'de> { + /// The error type that can be returned if some error occurs during + /// deserialization. + type Error: Error; + + /// This returns `Ok(Some(key))` for the next key in the map, or `Ok(None)` + /// if there are no more remaining entries. + /// + /// `Deserialize` implementations should typically use + /// `MapAccess::next_key` or `MapAccess::next_entry` instead. + fn next_key_seed(&mut self, seed: K) -> Result, Self::Error> + where + K: DeserializeSeed<'de>; + + /// This returns a `Ok(value)` for the next value in the map. + /// + /// `Deserialize` implementations should typically use + /// `MapAccess::next_value` instead. + /// + /// # Panics + /// + /// Calling `next_value_seed` before `next_key_seed` is incorrect and is + /// allowed to panic or return bogus results. + fn next_value_seed(&mut self, seed: V) -> Result + where + V: DeserializeSeed<'de>; + + /// This returns `Ok(Some((key, value)))` for the next (key-value) pair in + /// the map, or `Ok(None)` if there are no more remaining items. + /// + /// `MapAccess` implementations should override the default behavior if a + /// more efficient implementation is possible. + /// + /// `Deserialize` implementations should typically use + /// `MapAccess::next_entry` instead. + #[inline] + fn next_entry_seed( + &mut self, + kseed: K, + vseed: V, + ) -> Result, Self::Error> + where + K: DeserializeSeed<'de>, + V: DeserializeSeed<'de>, + { + match try!(self.next_key_seed(kseed)) { + Some(key) => { + let value = try!(self.next_value_seed(vseed)); + Ok(Some((key, value))) + } + None => Ok(None), + } + } + + /// This returns `Ok(Some(key))` for the next key in the map, or `Ok(None)` + /// if there are no more remaining entries. + /// + /// This method exists as a convenience for `Deserialize` implementations. + /// `MapAccess` implementations should not override the default behavior. + #[inline] + fn next_key(&mut self) -> Result, Self::Error> + where + K: Deserialize<'de>, + { + self.next_key_seed(PhantomData) + } + + /// This returns a `Ok(value)` for the next value in the map. + /// + /// This method exists as a convenience for `Deserialize` implementations. + /// `MapAccess` implementations should not override the default behavior. + /// + /// # Panics + /// + /// Calling `next_value` before `next_key` is incorrect and is allowed to + /// panic or return bogus results. + #[inline] + fn next_value(&mut self) -> Result + where + V: Deserialize<'de>, + { + self.next_value_seed(PhantomData) + } + + /// This returns `Ok(Some((key, value)))` for the next (key-value) pair in + /// the map, or `Ok(None)` if there are no more remaining items. + /// + /// This method exists as a convenience for `Deserialize` implementations. + /// `MapAccess` implementations should not override the default behavior. + #[inline] + fn next_entry(&mut self) -> Result, Self::Error> + where + K: Deserialize<'de>, + V: Deserialize<'de>, + { + self.next_entry_seed(PhantomData, PhantomData) + } + + /// Returns the number of entries remaining in the map, if known. + #[inline] + fn size_hint(&self) -> Option { + None + } +} + +impl<'de, 'a, A> MapAccess<'de> for &'a mut A +where + A: MapAccess<'de>, +{ + type Error = A::Error; + + #[inline] + fn next_key_seed(&mut self, seed: K) -> Result, Self::Error> + where + K: DeserializeSeed<'de>, + { + (**self).next_key_seed(seed) + } + + #[inline] + fn next_value_seed(&mut self, seed: V) -> Result + where + V: DeserializeSeed<'de>, + { + (**self).next_value_seed(seed) + } + + #[inline] + fn next_entry_seed( + &mut self, + kseed: K, + vseed: V, + ) -> Result, Self::Error> + where + K: DeserializeSeed<'de>, + V: DeserializeSeed<'de>, + { + (**self).next_entry_seed(kseed, vseed) + } + + #[inline] + fn next_entry(&mut self) -> Result, Self::Error> + where + K: Deserialize<'de>, + V: Deserialize<'de>, + { + (**self).next_entry() + } + + #[inline] + fn next_key(&mut self) -> Result, Self::Error> + where + K: Deserialize<'de>, + { + (**self).next_key() + } + + #[inline] + fn next_value(&mut self) -> Result + where + V: Deserialize<'de>, + { + (**self).next_value() + } + + #[inline] + fn size_hint(&self) -> Option { + (**self).size_hint() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// Provides a `Visitor` access to the data of an enum in the input. +/// +/// `EnumAccess` is created by the `Deserializer` and passed to the +/// `Visitor` in order to identify which variant of an enum to deserialize. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed by the deserialized enum variant. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `EnumAccess` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait EnumAccess<'de>: Sized { + /// The error type that can be returned if some error occurs during + /// deserialization. + type Error: Error; + /// The `Visitor` that will be used to deserialize the content of the enum + /// variant. + type Variant: VariantAccess<'de, Error = Self::Error>; + + /// `variant` is called to identify which variant to deserialize. + /// + /// `Deserialize` implementations should typically use `EnumAccess::variant` + /// instead. + fn variant_seed(self, seed: V) -> Result<(V::Value, Self::Variant), Self::Error> + where + V: DeserializeSeed<'de>; + + /// `variant` is called to identify which variant to deserialize. + /// + /// This method exists as a convenience for `Deserialize` implementations. + /// `EnumAccess` implementations should not override the default behavior. + #[inline] + fn variant(self) -> Result<(V, Self::Variant), Self::Error> + where + V: Deserialize<'de>, + { + self.variant_seed(PhantomData) + } +} + +/// `VariantAccess` is a visitor that is created by the `Deserializer` and +/// passed to the `Deserialize` to deserialize the content of a particular enum +/// variant. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed by the deserialized enum variant. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `VariantAccess` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait VariantAccess<'de>: Sized { + /// The error type that can be returned if some error occurs during + /// deserialization. Must match the error type of our `EnumAccess`. + type Error: Error; + + /// Called when deserializing a variant with no values. + /// + /// If the data contains a different type of variant, the following + /// `invalid_type` error should be constructed: + /// + /// ```edition2018 + /// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected}; + /// # + /// # struct X; + /// # + /// # impl<'de> VariantAccess<'de> for X { + /// # type Error = value::Error; + /// # + /// fn unit_variant(self) -> Result<(), Self::Error> { + /// // What the data actually contained; suppose it is a tuple variant. + /// let unexp = Unexpected::TupleVariant; + /// Err(de::Error::invalid_type(unexp, &"unit variant")) + /// } + /// # + /// # fn newtype_variant_seed(self, _: T) -> Result + /// # where + /// # T: DeserializeSeed<'de>, + /// # { unimplemented!() } + /// # + /// # fn tuple_variant(self, _: usize, _: V) -> Result + /// # where + /// # V: Visitor<'de>, + /// # { unimplemented!() } + /// # + /// # fn struct_variant(self, _: &[&str], _: V) -> Result + /// # where + /// # V: Visitor<'de>, + /// # { unimplemented!() } + /// # } + /// ``` + fn unit_variant(self) -> Result<(), Self::Error>; + + /// Called when deserializing a variant with a single value. + /// + /// `Deserialize` implementations should typically use + /// `VariantAccess::newtype_variant` instead. + /// + /// If the data contains a different type of variant, the following + /// `invalid_type` error should be constructed: + /// + /// ```edition2018 + /// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected}; + /// # + /// # struct X; + /// # + /// # impl<'de> VariantAccess<'de> for X { + /// # type Error = value::Error; + /// # + /// # fn unit_variant(self) -> Result<(), Self::Error> { + /// # unimplemented!() + /// # } + /// # + /// fn newtype_variant_seed(self, _seed: T) -> Result + /// where + /// T: DeserializeSeed<'de>, + /// { + /// // What the data actually contained; suppose it is a unit variant. + /// let unexp = Unexpected::UnitVariant; + /// Err(de::Error::invalid_type(unexp, &"newtype variant")) + /// } + /// # + /// # fn tuple_variant(self, _: usize, _: V) -> Result + /// # where + /// # V: Visitor<'de>, + /// # { unimplemented!() } + /// # + /// # fn struct_variant(self, _: &[&str], _: V) -> Result + /// # where + /// # V: Visitor<'de>, + /// # { unimplemented!() } + /// # } + /// ``` + fn newtype_variant_seed(self, seed: T) -> Result + where + T: DeserializeSeed<'de>; + + /// Called when deserializing a variant with a single value. + /// + /// This method exists as a convenience for `Deserialize` implementations. + /// `VariantAccess` implementations should not override the default + /// behavior. + #[inline] + fn newtype_variant(self) -> Result + where + T: Deserialize<'de>, + { + self.newtype_variant_seed(PhantomData) + } + + /// Called when deserializing a tuple-like variant. + /// + /// The `len` is the number of fields expected in the tuple variant. + /// + /// If the data contains a different type of variant, the following + /// `invalid_type` error should be constructed: + /// + /// ```edition2018 + /// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected}; + /// # + /// # struct X; + /// # + /// # impl<'de> VariantAccess<'de> for X { + /// # type Error = value::Error; + /// # + /// # fn unit_variant(self) -> Result<(), Self::Error> { + /// # unimplemented!() + /// # } + /// # + /// # fn newtype_variant_seed(self, _: T) -> Result + /// # where + /// # T: DeserializeSeed<'de>, + /// # { unimplemented!() } + /// # + /// fn tuple_variant( + /// self, + /// _len: usize, + /// _visitor: V, + /// ) -> Result + /// where + /// V: Visitor<'de>, + /// { + /// // What the data actually contained; suppose it is a unit variant. + /// let unexp = Unexpected::UnitVariant; + /// Err(de::Error::invalid_type(unexp, &"tuple variant")) + /// } + /// # + /// # fn struct_variant(self, _: &[&str], _: V) -> Result + /// # where + /// # V: Visitor<'de>, + /// # { unimplemented!() } + /// # } + /// ``` + fn tuple_variant(self, len: usize, visitor: V) -> Result + where + V: Visitor<'de>; + + /// Called when deserializing a struct-like variant. + /// + /// The `fields` are the names of the fields of the struct variant. + /// + /// If the data contains a different type of variant, the following + /// `invalid_type` error should be constructed: + /// + /// ```edition2018 + /// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected}; + /// # + /// # struct X; + /// # + /// # impl<'de> VariantAccess<'de> for X { + /// # type Error = value::Error; + /// # + /// # fn unit_variant(self) -> Result<(), Self::Error> { + /// # unimplemented!() + /// # } + /// # + /// # fn newtype_variant_seed(self, _: T) -> Result + /// # where + /// # T: DeserializeSeed<'de>, + /// # { unimplemented!() } + /// # + /// # fn tuple_variant(self, _: usize, _: V) -> Result + /// # where + /// # V: Visitor<'de>, + /// # { unimplemented!() } + /// # + /// fn struct_variant( + /// self, + /// _fields: &'static [&'static str], + /// _visitor: V, + /// ) -> Result + /// where + /// V: Visitor<'de>, + /// { + /// // What the data actually contained; suppose it is a unit variant. + /// let unexp = Unexpected::UnitVariant; + /// Err(de::Error::invalid_type(unexp, &"struct variant")) + /// } + /// # } + /// ``` + fn struct_variant( + self, + fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>; +} + +//////////////////////////////////////////////////////////////////////////////// + +/// Converts an existing value into a `Deserializer` from which other values can +/// be deserialized. +/// +/// # Lifetime +/// +/// The `'de` lifetime of this trait is the lifetime of data that may be +/// borrowed from the resulting `Deserializer`. See the page [Understanding +/// deserializer lifetimes] for a more detailed explanation of these lifetimes. +/// +/// [Understanding deserializer lifetimes]: https://serde.rs/lifetimes.html +/// +/// # Example +/// +/// ```edition2018 +/// use std::str::FromStr; +/// use serde::Deserialize; +/// use serde::de::{value, IntoDeserializer}; +/// +/// #[derive(Deserialize)] +/// enum Setting { +/// On, +/// Off, +/// } +/// +/// impl FromStr for Setting { +/// type Err = value::Error; +/// +/// fn from_str(s: &str) -> Result { +/// Self::deserialize(s.into_deserializer()) +/// } +/// } +/// ``` +pub trait IntoDeserializer<'de, E: Error = value::Error> { + /// The type of the deserializer being converted into. + type Deserializer: Deserializer<'de, Error = E>; + + /// Convert this value into a deserializer. + fn into_deserializer(self) -> Self::Deserializer; +} + +//////////////////////////////////////////////////////////////////////////////// + +/// Used in error messages. +/// +/// - expected `a` +/// - expected `a` or `b` +/// - expected one of `a`, `b`, `c` +/// +/// The slice of names must not be empty. +struct OneOf { + names: &'static [&'static str], +} + +impl Display for OneOf { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match self.names.len() { + 0 => panic!(), // special case elsewhere + 1 => write!(formatter, "`{}`", self.names[0]), + 2 => write!(formatter, "`{}` or `{}`", self.names[0], self.names[1]), + _ => { + try!(write!(formatter, "one of ")); + for (i, alt) in self.names.iter().enumerate() { + if i > 0 { + try!(write!(formatter, ", ")); + } + try!(write!(formatter, "`{}`", alt)); + } + Ok(()) + } + } + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/de/utf8.rs b/third_party/cargo/vendor/serde-1.0.110/src/de/utf8.rs new file mode 100644 index 0000000..576fd03 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/de/utf8.rs @@ -0,0 +1,46 @@ +use lib::*; + +const TAG_CONT: u8 = 0b1000_0000; +const TAG_TWO_B: u8 = 0b1100_0000; +const TAG_THREE_B: u8 = 0b1110_0000; +const TAG_FOUR_B: u8 = 0b1111_0000; +const MAX_ONE_B: u32 = 0x80; +const MAX_TWO_B: u32 = 0x800; +const MAX_THREE_B: u32 = 0x10000; + +#[inline] +pub fn encode(c: char) -> Encode { + let code = c as u32; + let mut buf = [0; 4]; + let pos = if code < MAX_ONE_B { + buf[3] = code as u8; + 3 + } else if code < MAX_TWO_B { + buf[2] = (code >> 6 & 0x1F) as u8 | TAG_TWO_B; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 2 + } else if code < MAX_THREE_B { + buf[1] = (code >> 12 & 0x0F) as u8 | TAG_THREE_B; + buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 1 + } else { + buf[0] = (code >> 18 & 0x07) as u8 | TAG_FOUR_B; + buf[1] = (code >> 12 & 0x3F) as u8 | TAG_CONT; + buf[2] = (code >> 6 & 0x3F) as u8 | TAG_CONT; + buf[3] = (code & 0x3F) as u8 | TAG_CONT; + 0 + }; + Encode { buf: buf, pos: pos } +} + +pub struct Encode { + buf: [u8; 4], + pos: usize, +} + +impl Encode { + pub fn as_str(&self) -> &str { + str::from_utf8(&self.buf[self.pos..]).unwrap() + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/de/value.rs b/third_party/cargo/vendor/serde-1.0.110/src/de/value.rs new file mode 100644 index 0000000..d0a185d --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/de/value.rs @@ -0,0 +1,1497 @@ +//! Building blocks for deserializing basic values using the `IntoDeserializer` +//! trait. +//! +//! ```edition2018 +//! use std::str::FromStr; +//! use serde::Deserialize; +//! use serde::de::{value, IntoDeserializer}; +//! +//! #[derive(Deserialize)] +//! enum Setting { +//! On, +//! Off, +//! } +//! +//! impl FromStr for Setting { +//! type Err = value::Error; +//! +//! fn from_str(s: &str) -> Result { +//! Self::deserialize(s.into_deserializer()) +//! } +//! } +//! ``` + +use lib::*; + +use self::private::{First, Second}; +use de::{self, Expected, IntoDeserializer, SeqAccess}; +use private::de::size_hint; +use ser; + +//////////////////////////////////////////////////////////////////////////////// + +// For structs that contain a PhantomData. We do not want the trait +// bound `E: Clone` inferred by derive(Clone). +macro_rules! impl_copy_clone { + ($ty:ident $(<$lifetime:tt>)*) => { + impl<$($lifetime,)* E> Copy for $ty<$($lifetime,)* E> {} + + impl<$($lifetime,)* E> Clone for $ty<$($lifetime,)* E> { + fn clone(&self) -> Self { + *self + } + } + }; +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A minimal representation of all possible errors that can occur using the +/// `IntoDeserializer` trait. +#[derive(Clone, Debug, PartialEq)] +pub struct Error { + err: ErrorImpl, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +type ErrorImpl = Box; +#[cfg(not(any(feature = "std", feature = "alloc")))] +type ErrorImpl = (); + +impl de::Error for Error { + #[cfg(any(feature = "std", feature = "alloc"))] + #[cold] + fn custom(msg: T) -> Self + where + T: Display, + { + Error { + err: msg.to_string().into_boxed_str(), + } + } + + #[cfg(not(any(feature = "std", feature = "alloc")))] + #[cold] + fn custom(msg: T) -> Self + where + T: Display, + { + let _ = msg; + Error { err: () } + } +} + +impl ser::Error for Error { + #[cold] + fn custom(msg: T) -> Self + where + T: Display, + { + de::Error::custom(msg) + } +} + +impl Display for Error { + #[cfg(any(feature = "std", feature = "alloc"))] + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + formatter.write_str(&self.err) + } + + #[cfg(not(any(feature = "std", feature = "alloc")))] + fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { + formatter.write_str("Serde deserialization error") + } +} + +#[cfg(feature = "std")] +impl error::Error for Error { + fn description(&self) -> &str { + &self.err + } +} + +//////////////////////////////////////////////////////////////////////////////// + +impl<'de, E> IntoDeserializer<'de, E> for () +where + E: de::Error, +{ + type Deserializer = UnitDeserializer; + + fn into_deserializer(self) -> UnitDeserializer { + UnitDeserializer { + marker: PhantomData, + } + } +} + +/// A deserializer holding a `()`. +#[derive(Debug)] +pub struct UnitDeserializer { + marker: PhantomData, +} + +impl_copy_clone!(UnitDeserializer); + +impl<'de, E> de::Deserializer<'de> for UnitDeserializer +where + E: de::Error, +{ + type Error = E; + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf unit unit_struct newtype_struct seq tuple tuple_struct + map struct enum identifier ignored_any + } + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_unit() + } + + fn deserialize_option(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_none() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer that cannot be instantiated. +#[cfg(feature = "unstable")] +pub struct NeverDeserializer { + never: !, + marker: PhantomData, +} + +#[cfg(feature = "unstable")] +impl<'de, E> IntoDeserializer<'de, E> for ! +where + E: de::Error, +{ + type Deserializer = NeverDeserializer; + + fn into_deserializer(self) -> Self::Deserializer { + self + } +} + +#[cfg(feature = "unstable")] +impl<'de, E> de::Deserializer<'de> for NeverDeserializer +where + E: de::Error, +{ + type Error = E; + + fn deserialize_any(self, _visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.never + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } +} + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! primitive_deserializer { + ($ty:ty, $doc:tt, $name:ident, $method:ident $($cast:tt)*) => { + #[doc = "A deserializer holding"] + #[doc = $doc] + #[derive(Debug)] + pub struct $name { + value: $ty, + marker: PhantomData + } + + impl_copy_clone!($name); + + impl<'de, E> IntoDeserializer<'de, E> for $ty + where + E: de::Error, + { + type Deserializer = $name; + + fn into_deserializer(self) -> $name { + $name { + value: self, + marker: PhantomData, + } + } + } + + impl<'de, E> de::Deserializer<'de> for $name + where + E: de::Error, + { + type Error = E; + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str + string bytes byte_buf option unit unit_struct newtype_struct seq + tuple tuple_struct map struct enum identifier ignored_any + } + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.$method(self.value $($cast)*) + } + } + } +} + +primitive_deserializer!(bool, "a `bool`.", BoolDeserializer, visit_bool); +primitive_deserializer!(i8, "an `i8`.", I8Deserializer, visit_i8); +primitive_deserializer!(i16, "an `i16`.", I16Deserializer, visit_i16); +primitive_deserializer!(i32, "an `i32`.", I32Deserializer, visit_i32); +primitive_deserializer!(i64, "an `i64`.", I64Deserializer, visit_i64); +primitive_deserializer!(isize, "an `isize`.", IsizeDeserializer, visit_i64 as i64); +primitive_deserializer!(u8, "a `u8`.", U8Deserializer, visit_u8); +primitive_deserializer!(u16, "a `u16`.", U16Deserializer, visit_u16); +primitive_deserializer!(u64, "a `u64`.", U64Deserializer, visit_u64); +primitive_deserializer!(usize, "a `usize`.", UsizeDeserializer, visit_u64 as u64); +primitive_deserializer!(f32, "an `f32`.", F32Deserializer, visit_f32); +primitive_deserializer!(f64, "an `f64`.", F64Deserializer, visit_f64); +primitive_deserializer!(char, "a `char`.", CharDeserializer, visit_char); + +serde_if_integer128! { + primitive_deserializer!(i128, "an `i128`.", I128Deserializer, visit_i128); + primitive_deserializer!(u128, "a `u128`.", U128Deserializer, visit_u128); +} + +/// A deserializer holding a `u32`. +#[derive(Debug)] +pub struct U32Deserializer { + value: u32, + marker: PhantomData, +} + +impl_copy_clone!(U32Deserializer); + +impl<'de, E> IntoDeserializer<'de, E> for u32 +where + E: de::Error, +{ + type Deserializer = U32Deserializer; + + fn into_deserializer(self) -> U32Deserializer { + U32Deserializer { + value: self, + marker: PhantomData, + } + } +} + +impl<'de, E> de::Deserializer<'de> for U32Deserializer +where + E: de::Error, +{ + type Error = E; + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any + } + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_u32(self.value) + } + + fn deserialize_enum( + self, + name: &str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + let _ = name; + let _ = variants; + visitor.visit_enum(self) + } +} + +impl<'de, E> de::EnumAccess<'de> for U32Deserializer +where + E: de::Error, +{ + type Error = E; + type Variant = private::UnitOnly; + + fn variant_seed(self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + seed.deserialize(self).map(private::unit_only) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `&str`. +#[derive(Debug)] +pub struct StrDeserializer<'a, E> { + value: &'a str, + marker: PhantomData, +} + +impl_copy_clone!(StrDeserializer<'de>); + +impl<'de, 'a, E> IntoDeserializer<'de, E> for &'a str +where + E: de::Error, +{ + type Deserializer = StrDeserializer<'a, E>; + + fn into_deserializer(self) -> StrDeserializer<'a, E> { + StrDeserializer { + value: self, + marker: PhantomData, + } + } +} + +impl<'de, 'a, E> de::Deserializer<'de> for StrDeserializer<'a, E> +where + E: de::Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_str(self.value) + } + + fn deserialize_enum( + self, + name: &str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + let _ = name; + let _ = variants; + visitor.visit_enum(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any + } +} + +impl<'de, 'a, E> de::EnumAccess<'de> for StrDeserializer<'a, E> +where + E: de::Error, +{ + type Error = E; + type Variant = private::UnitOnly; + + fn variant_seed(self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + seed.deserialize(self).map(private::unit_only) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `&str` with a lifetime tied to another +/// deserializer. +#[derive(Debug)] +pub struct BorrowedStrDeserializer<'de, E> { + value: &'de str, + marker: PhantomData, +} + +impl_copy_clone!(BorrowedStrDeserializer<'de>); + +impl<'de, E> BorrowedStrDeserializer<'de, E> { + /// Create a new borrowed deserializer from the given string. + pub fn new(value: &'de str) -> BorrowedStrDeserializer<'de, E> { + BorrowedStrDeserializer { + value: value, + marker: PhantomData, + } + } +} + +impl<'de, E> de::Deserializer<'de> for BorrowedStrDeserializer<'de, E> +where + E: de::Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_borrowed_str(self.value) + } + + fn deserialize_enum( + self, + name: &str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + let _ = name; + let _ = variants; + visitor.visit_enum(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any + } +} + +impl<'de, E> de::EnumAccess<'de> for BorrowedStrDeserializer<'de, E> +where + E: de::Error, +{ + type Error = E; + type Variant = private::UnitOnly; + + fn variant_seed(self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + seed.deserialize(self).map(private::unit_only) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `String`. +#[cfg(any(feature = "std", feature = "alloc"))] +#[derive(Debug)] +pub struct StringDeserializer { + value: String, + marker: PhantomData, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Clone for StringDeserializer { + fn clone(&self) -> Self { + StringDeserializer { + value: self.value.clone(), + marker: PhantomData, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, E> IntoDeserializer<'de, E> for String +where + E: de::Error, +{ + type Deserializer = StringDeserializer; + + fn into_deserializer(self) -> StringDeserializer { + StringDeserializer { + value: self, + marker: PhantomData, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, E> de::Deserializer<'de> for StringDeserializer +where + E: de::Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_string(self.value) + } + + fn deserialize_enum( + self, + name: &str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + let _ = name; + let _ = variants; + visitor.visit_enum(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, 'a, E> de::EnumAccess<'de> for StringDeserializer +where + E: de::Error, +{ + type Error = E; + type Variant = private::UnitOnly; + + fn variant_seed(self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + seed.deserialize(self).map(private::unit_only) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `Cow`. +#[cfg(any(feature = "std", feature = "alloc"))] +#[derive(Debug)] +pub struct CowStrDeserializer<'a, E> { + value: Cow<'a, str>, + marker: PhantomData, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, E> Clone for CowStrDeserializer<'a, E> { + fn clone(&self) -> Self { + CowStrDeserializer { + value: self.value.clone(), + marker: PhantomData, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str> +where + E: de::Error, +{ + type Deserializer = CowStrDeserializer<'a, E>; + + fn into_deserializer(self) -> CowStrDeserializer<'a, E> { + CowStrDeserializer { + value: self, + marker: PhantomData, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, 'a, E> de::Deserializer<'de> for CowStrDeserializer<'a, E> +where + E: de::Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + match self.value { + Cow::Borrowed(string) => visitor.visit_str(string), + Cow::Owned(string) => visitor.visit_string(string), + } + } + + fn deserialize_enum( + self, + name: &str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + let _ = name; + let _ = variants; + visitor.visit_enum(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, 'a, E> de::EnumAccess<'de> for CowStrDeserializer<'a, E> +where + E: de::Error, +{ + type Error = E; + type Variant = private::UnitOnly; + + fn variant_seed(self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + seed.deserialize(self).map(private::unit_only) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `&[u8]` with a lifetime tied to another +/// deserializer. +#[derive(Debug)] +pub struct BorrowedBytesDeserializer<'de, E> { + value: &'de [u8], + marker: PhantomData, +} + +impl_copy_clone!(BorrowedBytesDeserializer<'de>); + +impl<'de, E> BorrowedBytesDeserializer<'de, E> { + /// Create a new borrowed deserializer from the given byte slice. + pub fn new(value: &'de [u8]) -> BorrowedBytesDeserializer<'de, E> { + BorrowedBytesDeserializer { + value: value, + marker: PhantomData, + } + } +} + +impl<'de, E> de::Deserializer<'de> for BorrowedBytesDeserializer<'de, E> +where + E: de::Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_borrowed_bytes(self.value) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any enum + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer that iterates over a sequence. +#[derive(Clone, Debug)] +pub struct SeqDeserializer { + iter: iter::Fuse, + count: usize, + marker: PhantomData, +} + +impl SeqDeserializer +where + I: Iterator, +{ + /// Construct a new `SeqDeserializer`. + pub fn new(iter: I) -> Self { + SeqDeserializer { + iter: iter.fuse(), + count: 0, + marker: PhantomData, + } + } +} + +impl SeqDeserializer +where + I: Iterator, + E: de::Error, +{ + /// Check for remaining elements after passing a `SeqDeserializer` to + /// `Visitor::visit_seq`. + pub fn end(self) -> Result<(), E> { + let remaining = self.iter.count(); + if remaining == 0 { + Ok(()) + } else { + // First argument is the number of elements in the data, second + // argument is the number of elements expected by the Deserialize. + Err(de::Error::invalid_length( + self.count + remaining, + &ExpectedInSeq(self.count), + )) + } + } +} + +impl<'de, I, T, E> de::Deserializer<'de> for SeqDeserializer +where + I: Iterator, + T: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + fn deserialize_any(mut self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let v = try!(visitor.visit_seq(&mut self)); + try!(self.end()); + Ok(v) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } +} + +impl<'de, I, T, E> de::SeqAccess<'de> for SeqDeserializer +where + I: Iterator, + T: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + fn next_element_seed(&mut self, seed: V) -> Result, Self::Error> + where + V: de::DeserializeSeed<'de>, + { + match self.iter.next() { + Some(value) => { + self.count += 1; + seed.deserialize(value.into_deserializer()).map(Some) + } + None => Ok(None), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } +} + +struct ExpectedInSeq(usize); + +impl Expected for ExpectedInSeq { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + if self.0 == 1 { + write!(formatter, "1 element in sequence") + } else { + write!(formatter, "{} elements in sequence", self.0) + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, T, E> IntoDeserializer<'de, E> for Vec +where + T: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Deserializer = SeqDeserializer<::IntoIter, E>; + + fn into_deserializer(self) -> Self::Deserializer { + SeqDeserializer::new(self.into_iter()) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, T, E> IntoDeserializer<'de, E> for BTreeSet +where + T: IntoDeserializer<'de, E> + Eq + Ord, + E: de::Error, +{ + type Deserializer = SeqDeserializer<::IntoIter, E>; + + fn into_deserializer(self) -> Self::Deserializer { + SeqDeserializer::new(self.into_iter()) + } +} + +#[cfg(feature = "std")] +impl<'de, T, S, E> IntoDeserializer<'de, E> for HashSet +where + T: IntoDeserializer<'de, E> + Eq + Hash, + S: BuildHasher, + E: de::Error, +{ + type Deserializer = SeqDeserializer<::IntoIter, E>; + + fn into_deserializer(self) -> Self::Deserializer { + SeqDeserializer::new(self.into_iter()) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `SeqAccess`. +#[derive(Clone, Debug)] +pub struct SeqAccessDeserializer { + seq: A, +} + +impl SeqAccessDeserializer { + /// Construct a new `SeqAccessDeserializer`. + pub fn new(seq: A) -> Self { + SeqAccessDeserializer { seq: seq } + } +} + +impl<'de, A> de::Deserializer<'de> for SeqAccessDeserializer +where + A: de::SeqAccess<'de>, +{ + type Error = A::Error; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_seq(self.seq) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer that iterates over a map. +pub struct MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, +{ + iter: iter::Fuse, + value: Option>, + count: usize, + lifetime: PhantomData<&'de ()>, + error: PhantomData, +} + +impl<'de, I, E> MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, +{ + /// Construct a new `MapDeserializer`. + pub fn new(iter: I) -> Self { + MapDeserializer { + iter: iter.fuse(), + value: None, + count: 0, + lifetime: PhantomData, + error: PhantomData, + } + } +} + +impl<'de, I, E> MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, + E: de::Error, +{ + /// Check for remaining elements after passing a `MapDeserializer` to + /// `Visitor::visit_map`. + pub fn end(self) -> Result<(), E> { + let remaining = self.iter.count(); + if remaining == 0 { + Ok(()) + } else { + // First argument is the number of elements in the data, second + // argument is the number of elements expected by the Deserialize. + Err(de::Error::invalid_length( + self.count + remaining, + &ExpectedInMap(self.count), + )) + } + } +} + +impl<'de, I, E> MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, +{ + fn next_pair(&mut self) -> Option<(First, Second)> { + match self.iter.next() { + Some(kv) => { + self.count += 1; + Some(private::Pair::split(kv)) + } + None => None, + } + } +} + +impl<'de, I, E> de::Deserializer<'de> for MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, + First: IntoDeserializer<'de, E>, + Second: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + fn deserialize_any(mut self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let value = try!(visitor.visit_map(&mut self)); + try!(self.end()); + Ok(value) + } + + fn deserialize_seq(mut self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let value = try!(visitor.visit_seq(&mut self)); + try!(self.end()); + Ok(value) + } + + fn deserialize_tuple(self, len: usize, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let _ = len; + self.deserialize_seq(visitor) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct tuple_struct map + struct enum identifier ignored_any + } +} + +impl<'de, I, E> de::MapAccess<'de> for MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, + First: IntoDeserializer<'de, E>, + Second: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + fn next_key_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.next_pair() { + Some((key, value)) => { + self.value = Some(value); + seed.deserialize(key.into_deserializer()).map(Some) + } + None => Ok(None), + } + } + + fn next_value_seed(&mut self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + let value = self.value.take(); + // Panic because this indicates a bug in the program rather than an + // expected failure. + let value = value.expect("MapAccess::visit_value called before visit_key"); + seed.deserialize(value.into_deserializer()) + } + + fn next_entry_seed( + &mut self, + kseed: TK, + vseed: TV, + ) -> Result, Self::Error> + where + TK: de::DeserializeSeed<'de>, + TV: de::DeserializeSeed<'de>, + { + match self.next_pair() { + Some((key, value)) => { + let key = try!(kseed.deserialize(key.into_deserializer())); + let value = try!(vseed.deserialize(value.into_deserializer())); + Ok(Some((key, value))) + } + None => Ok(None), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } +} + +impl<'de, I, E> de::SeqAccess<'de> for MapDeserializer<'de, I, E> +where + I: Iterator, + I::Item: private::Pair, + First: IntoDeserializer<'de, E>, + Second: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.next_pair() { + Some((k, v)) => { + let de = PairDeserializer(k, v, PhantomData); + seed.deserialize(de).map(Some) + } + None => Ok(None), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } +} + +// Cannot #[derive(Clone)] because of the bound `Second: Clone`. +impl<'de, I, E> Clone for MapDeserializer<'de, I, E> +where + I: Iterator + Clone, + I::Item: private::Pair, + Second: Clone, +{ + fn clone(&self) -> Self { + MapDeserializer { + iter: self.iter.clone(), + value: self.value.clone(), + count: self.count, + lifetime: self.lifetime, + error: self.error, + } + } +} + +// Cannot #[derive(Debug)] because of the bound `Second: Debug`. +impl<'de, I, E> Debug for MapDeserializer<'de, I, E> +where + I: Iterator + Debug, + I::Item: private::Pair, + Second: Debug, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter + .debug_struct("MapDeserializer") + .field("iter", &self.iter) + .field("value", &self.value) + .field("count", &self.count) + .field("lifetime", &self.lifetime) + .field("error", &self.error) + .finish() + } +} + +// Used in the `impl SeqAccess for MapDeserializer` to visit the map as a +// sequence of pairs. +struct PairDeserializer(A, B, PhantomData); + +impl<'de, A, B, E> de::Deserializer<'de> for PairDeserializer +where + A: IntoDeserializer<'de, E>, + B: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct tuple_struct map + struct enum identifier ignored_any + } + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_seq(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let mut pair_visitor = PairVisitor(Some(self.0), Some(self.1), PhantomData); + let pair = try!(visitor.visit_seq(&mut pair_visitor)); + if pair_visitor.1.is_none() { + Ok(pair) + } else { + let remaining = pair_visitor.size_hint().unwrap(); + // First argument is the number of elements in the data, second + // argument is the number of elements expected by the Deserialize. + Err(de::Error::invalid_length(2, &ExpectedInSeq(2 - remaining))) + } + } + + fn deserialize_tuple(self, len: usize, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + if len == 2 { + self.deserialize_seq(visitor) + } else { + // First argument is the number of elements in the data, second + // argument is the number of elements expected by the Deserialize. + Err(de::Error::invalid_length(2, &ExpectedInSeq(len))) + } + } +} + +struct PairVisitor(Option, Option, PhantomData); + +impl<'de, A, B, E> de::SeqAccess<'de> for PairVisitor +where + A: IntoDeserializer<'de, E>, + B: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Error = E; + + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + if let Some(k) = self.0.take() { + seed.deserialize(k.into_deserializer()).map(Some) + } else if let Some(v) = self.1.take() { + seed.deserialize(v.into_deserializer()).map(Some) + } else { + Ok(None) + } + } + + fn size_hint(&self) -> Option { + if self.0.is_some() { + Some(2) + } else if self.1.is_some() { + Some(1) + } else { + Some(0) + } + } +} + +struct ExpectedInMap(usize); + +impl Expected for ExpectedInMap { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + if self.0 == 1 { + write!(formatter, "1 element in map") + } else { + write!(formatter, "{} elements in map", self.0) + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'de, K, V, E> IntoDeserializer<'de, E> for BTreeMap +where + K: IntoDeserializer<'de, E> + Eq + Ord, + V: IntoDeserializer<'de, E>, + E: de::Error, +{ + type Deserializer = MapDeserializer<'de, ::IntoIter, E>; + + fn into_deserializer(self) -> Self::Deserializer { + MapDeserializer::new(self.into_iter()) + } +} + +#[cfg(feature = "std")] +impl<'de, K, V, S, E> IntoDeserializer<'de, E> for HashMap +where + K: IntoDeserializer<'de, E> + Eq + Hash, + V: IntoDeserializer<'de, E>, + S: BuildHasher, + E: de::Error, +{ + type Deserializer = MapDeserializer<'de, ::IntoIter, E>; + + fn into_deserializer(self) -> Self::Deserializer { + MapDeserializer::new(self.into_iter()) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A deserializer holding a `MapAccess`. +#[derive(Clone, Debug)] +pub struct MapAccessDeserializer { + map: A, +} + +impl MapAccessDeserializer { + /// Construct a new `MapAccessDeserializer`. + pub fn new(map: A) -> Self { + MapAccessDeserializer { map: map } + } +} + +impl<'de, A> de::Deserializer<'de> for MapAccessDeserializer +where + A: de::MapAccess<'de>, +{ + type Error = A::Error; + + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_map(self.map) + } + + fn deserialize_enum( + self, + _name: &str, + _variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_enum(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct identifier ignored_any + } +} + +impl<'de, A> de::EnumAccess<'de> for MapAccessDeserializer +where + A: de::MapAccess<'de>, +{ + type Error = A::Error; + type Variant = private::MapAsEnum; + + fn variant_seed(mut self, seed: T) -> Result<(T::Value, Self::Variant), Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.map.next_key_seed(seed)? { + Some(key) => Ok((key, private::map_as_enum(self.map))), + None => Err(de::Error::invalid_type(de::Unexpected::Map, &"enum")), + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +mod private { + use lib::*; + + use de::{self, DeserializeSeed, Deserializer, MapAccess, Unexpected, VariantAccess, Visitor}; + + #[derive(Clone, Debug)] + pub struct UnitOnly { + marker: PhantomData, + } + + pub fn unit_only(t: T) -> (T, UnitOnly) { + ( + t, + UnitOnly { + marker: PhantomData, + }, + ) + } + + impl<'de, E> de::VariantAccess<'de> for UnitOnly + where + E: de::Error, + { + type Error = E; + + fn unit_variant(self) -> Result<(), Self::Error> { + Ok(()) + } + + fn newtype_variant_seed(self, _seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + Err(de::Error::invalid_type( + Unexpected::UnitVariant, + &"newtype variant", + )) + } + + fn tuple_variant(self, _len: usize, _visitor: V) -> Result + where + V: de::Visitor<'de>, + { + Err(de::Error::invalid_type( + Unexpected::UnitVariant, + &"tuple variant", + )) + } + + fn struct_variant( + self, + _fields: &'static [&'static str], + _visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + Err(de::Error::invalid_type( + Unexpected::UnitVariant, + &"struct variant", + )) + } + } + + #[derive(Clone, Debug)] + pub struct MapAsEnum { + map: A, + } + + pub fn map_as_enum(map: A) -> MapAsEnum { + MapAsEnum { map: map } + } + + impl<'de, A> VariantAccess<'de> for MapAsEnum + where + A: MapAccess<'de>, + { + type Error = A::Error; + + fn unit_variant(mut self) -> Result<(), Self::Error> { + self.map.next_value() + } + + fn newtype_variant_seed(mut self, seed: T) -> Result + where + T: DeserializeSeed<'de>, + { + self.map.next_value_seed(seed) + } + + fn tuple_variant(mut self, len: usize, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.map.next_value_seed(SeedTupleVariant { + len: len, + visitor: visitor, + }) + } + + fn struct_variant( + mut self, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.map + .next_value_seed(SeedStructVariant { visitor: visitor }) + } + } + + struct SeedTupleVariant { + len: usize, + visitor: V, + } + + impl<'de, V> DeserializeSeed<'de> for SeedTupleVariant + where + V: Visitor<'de>, + { + type Value = V::Value; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_tuple(self.len, self.visitor) + } + } + + struct SeedStructVariant { + visitor: V, + } + + impl<'de, V> DeserializeSeed<'de> for SeedStructVariant + where + V: Visitor<'de>, + { + type Value = V::Value; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_map(self.visitor) + } + } + + /// Avoid having to restate the generic types on `MapDeserializer`. The + /// `Iterator::Item` contains enough information to figure out K and V. + pub trait Pair { + type First; + type Second; + fn split(self) -> (Self::First, Self::Second); + } + + impl Pair for (A, B) { + type First = A; + type Second = B; + fn split(self) -> (A, B) { + self + } + } + + pub type First = ::First; + pub type Second = ::Second; +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/export.rs b/third_party/cargo/vendor/serde-1.0.110/src/export.rs new file mode 100644 index 0000000..caa1f4d --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/export.rs @@ -0,0 +1,39 @@ +pub use lib::clone::Clone; +pub use lib::convert::{From, Into}; +pub use lib::default::Default; +pub use lib::fmt::{self, Formatter}; +pub use lib::marker::PhantomData; +pub use lib::option::Option::{self, None, Some}; +pub use lib::result::Result::{self, Err, Ok}; + +pub use self::string::from_utf8_lossy; + +#[cfg(any(feature = "alloc", feature = "std"))] +pub use lib::{ToString, Vec}; + +#[cfg(core_try_from)] +pub use lib::convert::TryFrom; + +mod string { + use lib::*; + + #[cfg(any(feature = "std", feature = "alloc"))] + pub fn from_utf8_lossy(bytes: &[u8]) -> Cow { + String::from_utf8_lossy(bytes) + } + + // The generated code calls this like: + // + // let value = &_serde::export::from_utf8_lossy(bytes); + // Err(_serde::de::Error::unknown_variant(value, VARIANTS)) + // + // so it is okay for the return type to be different from the std case as long + // as the above works. + #[cfg(not(any(feature = "std", feature = "alloc")))] + pub fn from_utf8_lossy(bytes: &[u8]) -> &str { + // Three unicode replacement characters if it fails. They look like a + // white-on-black question mark. The user will recognize it as invalid + // UTF-8. + str::from_utf8(bytes).unwrap_or("\u{fffd}\u{fffd}\u{fffd}") + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/integer128.rs b/third_party/cargo/vendor/serde-1.0.110/src/integer128.rs new file mode 100644 index 0000000..01d6f34 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/integer128.rs @@ -0,0 +1,82 @@ +/// Conditional compilation depending on whether Serde is built with support for +/// 128-bit integers. +/// +/// Data formats that wish to support Rust compiler versions older than 1.26 +/// (or targets that lack 128-bit integers) may place the i128 / u128 methods +/// of their Serializer and Deserializer behind this macro. +/// +/// Data formats that require a minimum Rust compiler version of at least 1.26, +/// or do not target platforms that lack 128-bit integers, do not need to +/// bother with this macro and may assume support for 128-bit integers. +/// +/// ```edition2018 +/// # use serde::private::ser::Error; +/// # +/// # struct MySerializer; +/// # +/// use serde::{serde_if_integer128, Serializer}; +/// +/// impl Serializer for MySerializer { +/// type Ok = (); +/// type Error = Error; +/// +/// fn serialize_i64(self, v: i64) -> Result { +/// /* ... */ +/// # unimplemented!() +/// } +/// +/// /* ... */ +/// +/// serde_if_integer128! { +/// fn serialize_i128(self, v: i128) -> Result { +/// /* ... */ +/// # unimplemented!() +/// } +/// +/// fn serialize_u128(self, v: u128) -> Result { +/// /* ... */ +/// # unimplemented!() +/// } +/// } +/// # +/// # serde::__serialize_unimplemented! { +/// # bool i8 i16 i32 u8 u16 u32 u64 f32 f64 char str bytes none some +/// # unit unit_struct unit_variant newtype_struct newtype_variant seq +/// # tuple tuple_struct tuple_variant map struct struct_variant +/// # } +/// } +/// ``` +/// +/// When Serde is built with support for 128-bit integers, this macro expands +/// transparently into just the input tokens. +/// +/// ```edition2018 +/// macro_rules! serde_if_integer128 { +/// ($($tt:tt)*) => { +/// $($tt)* +/// }; +/// } +/// ``` +/// +/// When built without support for 128-bit integers, this macro expands to +/// nothing. +/// +/// ```edition2018 +/// macro_rules! serde_if_integer128 { +/// ($($tt:tt)*) => {}; +/// } +/// ``` +#[cfg(integer128)] +#[macro_export] +macro_rules! serde_if_integer128 { + ($($tt:tt)*) => { + $($tt)* + }; +} + +#[cfg(not(integer128))] +#[macro_export] +#[doc(hidden)] +macro_rules! serde_if_integer128 { + ($($tt:tt)*) => {}; +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/lib.rs b/third_party/cargo/vendor/serde-1.0.110/src/lib.rs new file mode 100644 index 0000000..1399305 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/lib.rs @@ -0,0 +1,278 @@ +//! # Serde +//! +//! Serde is a framework for ***ser***ializing and ***de***serializing Rust data +//! structures efficiently and generically. +//! +//! The Serde ecosystem consists of data structures that know how to serialize +//! and deserialize themselves along with data formats that know how to +//! serialize and deserialize other things. Serde provides the layer by which +//! these two groups interact with each other, allowing any supported data +//! structure to be serialized and deserialized using any supported data format. +//! +//! See the Serde website [https://serde.rs/] for additional documentation and +//! usage examples. +//! +//! [https://serde.rs/]: https://serde.rs/ +//! +//! ## Design +//! +//! Where many other languages rely on runtime reflection for serializing data, +//! Serde is instead built on Rust's powerful trait system. A data structure +//! that knows how to serialize and deserialize itself is one that implements +//! Serde's `Serialize` and `Deserialize` traits (or uses Serde's derive +//! attribute to automatically generate implementations at compile time). This +//! avoids any overhead of reflection or runtime type information. In fact in +//! many situations the interaction between data structure and data format can +//! be completely optimized away by the Rust compiler, leaving Serde +//! serialization to perform the same speed as a handwritten serializer for the +//! specific selection of data structure and data format. +//! +//! ## Data formats +//! +//! The following is a partial list of data formats that have been implemented +//! for Serde by the community. +//! +//! - [JSON], the ubiquitous JavaScript Object Notation used by many HTTP APIs. +//! - [Bincode], a compact binary format +//! used for IPC within the Servo rendering engine. +//! - [CBOR], a Concise Binary Object Representation designed for small message +//! size without the need for version negotiation. +//! - [YAML], a popular human-friendly configuration language that ain't markup +//! language. +//! - [MessagePack], an efficient binary format that resembles a compact JSON. +//! - [TOML], a minimal configuration format used by [Cargo]. +//! - [Pickle], a format common in the Python world. +//! - [RON], a Rusty Object Notation. +//! - [BSON], the data storage and network transfer format used by MongoDB. +//! - [Avro], a binary format used within Apache Hadoop, with support for schema +//! definition. +//! - [JSON5], A superset of JSON including some productions from ES5. +//! - [Postcard], a no\_std and embedded-systems friendly compact binary format. +//! - [URL], the x-www-form-urlencoded format. +//! - [Envy], a way to deserialize environment variables into Rust structs. +//! *(deserialization only)* +//! - [Envy Store], a way to deserialize [AWS Parameter Store] parameters into +//! Rust structs. *(deserialization only)* +//! +//! [JSON]: https://github.com/serde-rs/json +//! [Bincode]: https://github.com/TyOverby/bincode +//! [CBOR]: https://github.com/pyfisch/cbor +//! [YAML]: https://github.com/dtolnay/serde-yaml +//! [MessagePack]: https://github.com/3Hren/msgpack-rust +//! [TOML]: https://github.com/alexcrichton/toml-rs +//! [Pickle]: https://github.com/birkenfeld/serde-pickle +//! [RON]: https://github.com/ron-rs/ron +//! [BSON]: https://github.com/zonyitoo/bson-rs +//! [Avro]: https://github.com/flavray/avro-rs +//! [JSON5]: https://github.com/callum-oakley/json5-rs +//! [Postcard]: https://github.com/jamesmunns/postcard +//! [URL]: https://github.com/nox/serde_urlencoded +//! [Envy]: https://github.com/softprops/envy +//! [Envy Store]: https://github.com/softprops/envy-store +//! [Cargo]: http://doc.crates.io/manifest.html +//! [AWS Parameter Store]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html + +//////////////////////////////////////////////////////////////////////////////// + +// Serde types in rustdoc of other crates get linked to here. +#![doc(html_root_url = "https://docs.rs/serde/1.0.110")] +// Support using Serde without the standard library! +#![cfg_attr(not(feature = "std"), no_std)] +// Unstable functionality only if the user asks for it. For tracking and +// discussion of these features please refer to this issue: +// +// https://github.com/serde-rs/serde/issues/812 +#![cfg_attr(feature = "unstable", feature(specialization, never_type))] +#![allow(unknown_lints, bare_trait_objects, deprecated)] +#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] +#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))] +// Ignored clippy and clippy_pedantic lints +#![cfg_attr( + feature = "cargo-clippy", + allow( + // not available in our oldest supported compiler + checked_conversions, + empty_enum, + redundant_field_names, + redundant_static_lifetimes, + // integer and float ser/de requires these sorts of casts + cast_possible_truncation, + cast_possible_wrap, + cast_sign_loss, + // things are often more readable this way + cast_lossless, + module_name_repetitions, + single_match_else, + type_complexity, + use_self, + zero_prefixed_literal, + // correctly used + enum_glob_use, + wildcard_imports, + // not practical + needless_pass_by_value, + similar_names, + too_many_lines, + // preference + doc_markdown, + unseparated_literal_suffix, + // false positive + needless_doctest_main, + // noisy + missing_errors_doc, + must_use_candidate, + ) +)] +// Rustc lints. +#![forbid(unsafe_code)] +#![deny(missing_docs, unused_imports)] + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "alloc")] +extern crate alloc; + +/// A facade around all the types we need from the `std`, `core`, and `alloc` +/// crates. This avoids elaborate import wrangling having to happen in every +/// module. +mod lib { + mod core { + #[cfg(not(feature = "std"))] + pub use core::*; + #[cfg(feature = "std")] + pub use std::*; + } + + pub use self::core::{cmp, iter, mem, num, slice, str}; + pub use self::core::{f32, f64}; + pub use self::core::{i16, i32, i64, i8, isize}; + pub use self::core::{u16, u32, u64, u8, usize}; + + pub use self::core::cell::{Cell, RefCell}; + pub use self::core::clone::{self, Clone}; + pub use self::core::convert::{self, From, Into}; + pub use self::core::default::{self, Default}; + pub use self::core::fmt::{self, Debug, Display}; + pub use self::core::marker::{self, PhantomData}; + pub use self::core::ops::Range; + pub use self::core::option::{self, Option}; + pub use self::core::result::{self, Result}; + + #[cfg(all(feature = "alloc", not(feature = "std")))] + pub use alloc::borrow::{Cow, ToOwned}; + #[cfg(feature = "std")] + pub use std::borrow::{Cow, ToOwned}; + + #[cfg(all(feature = "alloc", not(feature = "std")))] + pub use alloc::string::{String, ToString}; + #[cfg(feature = "std")] + pub use std::string::{String, ToString}; + + #[cfg(all(feature = "alloc", not(feature = "std")))] + pub use alloc::vec::Vec; + #[cfg(feature = "std")] + pub use std::vec::Vec; + + #[cfg(all(feature = "alloc", not(feature = "std")))] + pub use alloc::boxed::Box; + #[cfg(feature = "std")] + pub use std::boxed::Box; + + #[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))] + pub use alloc::rc::{Rc, Weak as RcWeak}; + #[cfg(all(feature = "rc", feature = "std"))] + pub use std::rc::{Rc, Weak as RcWeak}; + + #[cfg(all(feature = "rc", feature = "alloc", not(feature = "std")))] + pub use alloc::sync::{Arc, Weak as ArcWeak}; + #[cfg(all(feature = "rc", feature = "std"))] + pub use std::sync::{Arc, Weak as ArcWeak}; + + #[cfg(all(feature = "alloc", not(feature = "std")))] + pub use alloc::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque}; + #[cfg(feature = "std")] + pub use std::collections::{BTreeMap, BTreeSet, BinaryHeap, LinkedList, VecDeque}; + + #[cfg(feature = "std")] + pub use std::{error, net}; + + #[cfg(feature = "std")] + pub use std::collections::{HashMap, HashSet}; + #[cfg(feature = "std")] + pub use std::ffi::{CStr, CString, OsStr, OsString}; + #[cfg(feature = "std")] + pub use std::hash::{BuildHasher, Hash}; + #[cfg(feature = "std")] + pub use std::io::Write; + #[cfg(feature = "std")] + pub use std::num::Wrapping; + #[cfg(feature = "std")] + pub use std::path::{Path, PathBuf}; + #[cfg(feature = "std")] + pub use std::sync::{Mutex, RwLock}; + #[cfg(feature = "std")] + pub use std::time::{SystemTime, UNIX_EPOCH}; + + #[cfg(all(feature = "std", collections_bound))] + pub use std::collections::Bound; + + #[cfg(core_reverse)] + pub use self::core::cmp::Reverse; + + #[cfg(ops_bound)] + pub use self::core::ops::Bound; + + #[cfg(range_inclusive)] + pub use self::core::ops::RangeInclusive; + + #[cfg(all(feature = "std", std_atomic))] + pub use std::sync::atomic::{ + AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, + AtomicUsize, Ordering, + }; + #[cfg(all(feature = "std", std_atomic64))] + pub use std::sync::atomic::{AtomicI64, AtomicU64}; + + #[cfg(any(core_duration, feature = "std"))] + pub use self::core::time::Duration; +} + +//////////////////////////////////////////////////////////////////////////////// + +#[macro_use] +mod macros; + +#[macro_use] +mod integer128; + +pub mod de; +pub mod ser; + +#[doc(inline)] +pub use de::{Deserialize, Deserializer}; +#[doc(inline)] +pub use ser::{Serialize, Serializer}; + +// Generated code uses these to support no_std. Not public API. +#[doc(hidden)] +pub mod export; + +// Helpers used by generated code and doc tests. Not public API. +#[doc(hidden)] +pub mod private; + +#[cfg(not(feature = "std"))] +mod std_error; + +// Re-export #[derive(Serialize, Deserialize)]. +// +// The reason re-exporting is not enabled by default is that disabling it would +// be annoying for crates that provide handwritten impls or data formats. They +// would need to disable default features and then explicitly re-enable std. +#[cfg(feature = "serde_derive")] +#[allow(unused_imports)] +#[macro_use] +extern crate serde_derive; +#[cfg(feature = "serde_derive")] +#[doc(hidden)] +pub use serde_derive::*; diff --git a/third_party/cargo/vendor/serde-1.0.110/src/macros.rs b/third_party/cargo/vendor/serde-1.0.110/src/macros.rs new file mode 100644 index 0000000..57600a5 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/macros.rs @@ -0,0 +1,236 @@ +// Super explicit first paragraph because this shows up at the top level and +// trips up people who are just looking for basic Serialize / Deserialize +// documentation. +// +/// Helper macro when implementing the `Deserializer` part of a new data format +/// for Serde. +/// +/// Some [`Deserializer`] implementations for self-describing formats do not +/// care what hint the [`Visitor`] gives them, they just want to blindly call +/// the [`Visitor`] method corresponding to the data they can tell is in the +/// input. This requires repetitive implementations of all the [`Deserializer`] +/// trait methods. +/// +/// ```edition2018 +/// # use serde::forward_to_deserialize_any; +/// # use serde::de::{value, Deserializer, Visitor}; +/// # +/// # struct MyDeserializer; +/// # +/// # impl<'de> Deserializer<'de> for MyDeserializer { +/// # type Error = value::Error; +/// # +/// # fn deserialize_any(self, _: V) -> Result +/// # where +/// # V: Visitor<'de>, +/// # { +/// # unimplemented!() +/// # } +/// # +/// #[inline] +/// fn deserialize_bool(self, visitor: V) -> Result +/// where +/// V: Visitor<'de>, +/// { +/// self.deserialize_any(visitor) +/// } +/// # +/// # forward_to_deserialize_any! { +/// # i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string +/// # bytes byte_buf option unit unit_struct newtype_struct seq tuple +/// # tuple_struct map struct enum identifier ignored_any +/// # } +/// # } +/// ``` +/// +/// The `forward_to_deserialize_any!` macro implements these simple forwarding +/// methods so that they forward directly to [`Deserializer::deserialize_any`]. +/// You can choose which methods to forward. +/// +/// ```edition2018 +/// # use serde::forward_to_deserialize_any; +/// # use serde::de::{value, Deserializer, Visitor}; +/// # +/// # struct MyDeserializer; +/// # +/// impl<'de> Deserializer<'de> for MyDeserializer { +/// # type Error = value::Error; +/// # +/// fn deserialize_any(self, visitor: V) -> Result +/// where +/// V: Visitor<'de>, +/// { +/// /* ... */ +/// # let _ = visitor; +/// # unimplemented!() +/// } +/// +/// forward_to_deserialize_any! { +/// bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string +/// bytes byte_buf option unit unit_struct newtype_struct seq tuple +/// tuple_struct map struct enum identifier ignored_any +/// } +/// } +/// ``` +/// +/// The macro assumes the convention that your `Deserializer` lifetime parameter +/// is called `'de` and that the `Visitor` type parameters on each method are +/// called `V`. A different type parameter and a different lifetime can be +/// specified explicitly if necessary. +/// +/// ```edition2018 +/// # use std::marker::PhantomData; +/// # +/// # use serde::forward_to_deserialize_any; +/// # use serde::de::{value, Deserializer, Visitor}; +/// # +/// # struct MyDeserializer(PhantomData); +/// # +/// # impl<'q, V> Deserializer<'q> for MyDeserializer { +/// # type Error = value::Error; +/// # +/// # fn deserialize_any(self, visitor: W) -> Result +/// # where +/// # W: Visitor<'q>, +/// # { +/// # unimplemented!() +/// # } +/// # +/// forward_to_deserialize_any! { +/// > +/// bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string +/// bytes byte_buf option unit unit_struct newtype_struct seq tuple +/// tuple_struct map struct enum identifier ignored_any +/// } +/// # } +/// ``` +/// +/// [`Deserializer`]: trait.Deserializer.html +/// [`Visitor`]: de/trait.Visitor.html +/// [`Deserializer::deserialize_any`]: trait.Deserializer.html#tymethod.deserialize_any +#[macro_export(local_inner_macros)] +macro_rules! forward_to_deserialize_any { + (<$visitor:ident: Visitor<$lifetime:tt>> $($func:ident)*) => { + $(forward_to_deserialize_any_helper!{$func<$lifetime, $visitor>})* + }; + // This case must be after the previous one. + ($($func:ident)*) => { + $(forward_to_deserialize_any_helper!{$func<'de, V>})* + }; +} + +#[doc(hidden)] +#[macro_export] +macro_rules! forward_to_deserialize_any_method { + ($func:ident<$l:tt, $v:ident>($($arg:ident : $ty:ty),*)) => { + #[inline] + fn $func<$v>(self, $($arg: $ty,)* visitor: $v) -> $crate::export::Result<$v::Value, Self::Error> + where + $v: $crate::de::Visitor<$l>, + { + $( + let _ = $arg; + )* + self.deserialize_any(visitor) + } + }; +} + +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! forward_to_deserialize_any_helper { + (bool<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_bool<$l, $v>()} + }; + (i8<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_i8<$l, $v>()} + }; + (i16<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_i16<$l, $v>()} + }; + (i32<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_i32<$l, $v>()} + }; + (i64<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_i64<$l, $v>()} + }; + (i128<$l:tt, $v:ident>) => { + serde_if_integer128! { + forward_to_deserialize_any_method!{deserialize_i128<$l, $v>()} + } + }; + (u8<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_u8<$l, $v>()} + }; + (u16<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_u16<$l, $v>()} + }; + (u32<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_u32<$l, $v>()} + }; + (u64<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_u64<$l, $v>()} + }; + (u128<$l:tt, $v:ident>) => { + serde_if_integer128! { + forward_to_deserialize_any_method!{deserialize_u128<$l, $v>()} + } + }; + (f32<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_f32<$l, $v>()} + }; + (f64<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_f64<$l, $v>()} + }; + (char<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_char<$l, $v>()} + }; + (str<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_str<$l, $v>()} + }; + (string<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_string<$l, $v>()} + }; + (bytes<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_bytes<$l, $v>()} + }; + (byte_buf<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_byte_buf<$l, $v>()} + }; + (option<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_option<$l, $v>()} + }; + (unit<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_unit<$l, $v>()} + }; + (unit_struct<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_unit_struct<$l, $v>(name: &'static str)} + }; + (newtype_struct<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_newtype_struct<$l, $v>(name: &'static str)} + }; + (seq<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_seq<$l, $v>()} + }; + (tuple<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_tuple<$l, $v>(len: usize)} + }; + (tuple_struct<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_tuple_struct<$l, $v>(name: &'static str, len: usize)} + }; + (map<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_map<$l, $v>()} + }; + (struct<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_struct<$l, $v>(name: &'static str, fields: &'static [&'static str])} + }; + (enum<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_enum<$l, $v>(name: &'static str, variants: &'static [&'static str])} + }; + (identifier<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_identifier<$l, $v>()} + }; + (ignored_any<$l:tt, $v:ident>) => { + forward_to_deserialize_any_method!{deserialize_ignored_any<$l, $v>()} + }; +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/private/de.rs b/third_party/cargo/vendor/serde-1.0.110/src/private/de.rs new file mode 100644 index 0000000..06ff8c5 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/private/de.rs @@ -0,0 +1,2948 @@ +use lib::*; + +use de::{Deserialize, DeserializeSeed, Deserializer, Error, IntoDeserializer, Visitor}; + +#[cfg(any(feature = "std", feature = "alloc"))] +use de::{MapAccess, Unexpected}; + +#[cfg(any(feature = "std", feature = "alloc"))] +pub use self::content::{ + Content, ContentDeserializer, ContentRefDeserializer, EnumDeserializer, + InternallyTaggedUnitVisitor, TagContentOtherField, TagContentOtherFieldVisitor, + TagOrContentField, TagOrContentFieldVisitor, TaggedContentVisitor, UntaggedUnitVisitor, +}; + +/// If the missing field is of type `Option` then treat is as `None`, +/// otherwise it is an error. +pub fn missing_field<'de, V, E>(field: &'static str) -> Result +where + V: Deserialize<'de>, + E: Error, +{ + struct MissingFieldDeserializer(&'static str, PhantomData); + + impl<'de, E> Deserializer<'de> for MissingFieldDeserializer + where + E: Error, + { + type Error = E; + + fn deserialize_any(self, _visitor: V) -> Result + where + V: Visitor<'de>, + { + Err(Error::missing_field(self.0)) + } + + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_none() + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } + } + + let deserializer = MissingFieldDeserializer(field, PhantomData); + Deserialize::deserialize(deserializer) +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub fn borrow_cow_str<'de: 'a, 'a, D, R>(deserializer: D) -> Result +where + D: Deserializer<'de>, + R: From>, +{ + struct CowStrVisitor; + + impl<'a> Visitor<'a> for CowStrVisitor { + type Value = Cow<'a, str>; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a string") + } + + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + Ok(Cow::Owned(v.to_owned())) + } + + fn visit_borrowed_str(self, v: &'a str) -> Result + where + E: Error, + { + Ok(Cow::Borrowed(v)) + } + + fn visit_string(self, v: String) -> Result + where + E: Error, + { + Ok(Cow::Owned(v)) + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + match str::from_utf8(v) { + Ok(s) => Ok(Cow::Owned(s.to_owned())), + Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), + } + } + + fn visit_borrowed_bytes(self, v: &'a [u8]) -> Result + where + E: Error, + { + match str::from_utf8(v) { + Ok(s) => Ok(Cow::Borrowed(s)), + Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), + } + } + + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + match String::from_utf8(v) { + Ok(s) => Ok(Cow::Owned(s)), + Err(e) => Err(Error::invalid_value( + Unexpected::Bytes(&e.into_bytes()), + &self, + )), + } + } + } + + deserializer.deserialize_str(CowStrVisitor).map(From::from) +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub fn borrow_cow_bytes<'de: 'a, 'a, D, R>(deserializer: D) -> Result +where + D: Deserializer<'de>, + R: From>, +{ + struct CowBytesVisitor; + + impl<'a> Visitor<'a> for CowBytesVisitor { + type Value = Cow<'a, [u8]>; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a byte array") + } + + fn visit_str(self, v: &str) -> Result + where + E: Error, + { + Ok(Cow::Owned(v.as_bytes().to_vec())) + } + + fn visit_borrowed_str(self, v: &'a str) -> Result + where + E: Error, + { + Ok(Cow::Borrowed(v.as_bytes())) + } + + fn visit_string(self, v: String) -> Result + where + E: Error, + { + Ok(Cow::Owned(v.into_bytes())) + } + + fn visit_bytes(self, v: &[u8]) -> Result + where + E: Error, + { + Ok(Cow::Owned(v.to_vec())) + } + + fn visit_borrowed_bytes(self, v: &'a [u8]) -> Result + where + E: Error, + { + Ok(Cow::Borrowed(v)) + } + + fn visit_byte_buf(self, v: Vec) -> Result + where + E: Error, + { + Ok(Cow::Owned(v)) + } + } + + deserializer + .deserialize_bytes(CowBytesVisitor) + .map(From::from) +} + +pub mod size_hint { + use lib::*; + + pub fn from_bounds(iter: &I) -> Option + where + I: Iterator, + { + helper(iter.size_hint()) + } + + #[inline] + pub fn cautious(hint: Option) -> usize { + cmp::min(hint.unwrap_or(0), 4096) + } + + fn helper(bounds: (usize, Option)) -> Option { + match bounds { + (lower, Some(upper)) if lower == upper => Some(upper), + _ => None, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +mod content { + // This module is private and nothing here should be used outside of + // generated code. + // + // We will iterate on the implementation for a few releases and only have to + // worry about backward compatibility for the `untagged` and `tag` attributes + // rather than for this entire mechanism. + // + // This issue is tracking making some of this stuff public: + // https://github.com/serde-rs/serde/issues/741 + + use lib::*; + + use super::size_hint; + use de::{ + self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny, + MapAccess, SeqAccess, Unexpected, Visitor, + }; + + /// Used from generated code to buffer the contents of the Deserializer when + /// deserializing untagged enums and internally tagged enums. + /// + /// Not public API. Use serde-value instead. + #[derive(Debug)] + pub enum Content<'de> { + Bool(bool), + + U8(u8), + U16(u16), + U32(u32), + U64(u64), + + I8(i8), + I16(i16), + I32(i32), + I64(i64), + + F32(f32), + F64(f64), + + Char(char), + String(String), + Str(&'de str), + ByteBuf(Vec), + Bytes(&'de [u8]), + + None, + Some(Box>), + + Unit, + Newtype(Box>), + Seq(Vec>), + Map(Vec<(Content<'de>, Content<'de>)>), + } + + impl<'de> Content<'de> { + pub fn as_str(&self) -> Option<&str> { + match *self { + Content::Str(x) => Some(x), + Content::String(ref x) => Some(x), + Content::Bytes(x) => str::from_utf8(x).ok(), + Content::ByteBuf(ref x) => str::from_utf8(x).ok(), + _ => None, + } + } + + #[cold] + fn unexpected(&self) -> Unexpected { + match *self { + Content::Bool(b) => Unexpected::Bool(b), + Content::U8(n) => Unexpected::Unsigned(n as u64), + Content::U16(n) => Unexpected::Unsigned(n as u64), + Content::U32(n) => Unexpected::Unsigned(n as u64), + Content::U64(n) => Unexpected::Unsigned(n), + Content::I8(n) => Unexpected::Signed(n as i64), + Content::I16(n) => Unexpected::Signed(n as i64), + Content::I32(n) => Unexpected::Signed(n as i64), + Content::I64(n) => Unexpected::Signed(n), + Content::F32(f) => Unexpected::Float(f as f64), + Content::F64(f) => Unexpected::Float(f), + Content::Char(c) => Unexpected::Char(c), + Content::String(ref s) => Unexpected::Str(s), + Content::Str(s) => Unexpected::Str(s), + Content::ByteBuf(ref b) => Unexpected::Bytes(b), + Content::Bytes(b) => Unexpected::Bytes(b), + Content::None | Content::Some(_) => Unexpected::Option, + Content::Unit => Unexpected::Unit, + Content::Newtype(_) => Unexpected::NewtypeStruct, + Content::Seq(_) => Unexpected::Seq, + Content::Map(_) => Unexpected::Map, + } + } + } + + impl<'de> Deserialize<'de> for Content<'de> { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // Untagged and internally tagged enums are only supported in + // self-describing formats. + let visitor = ContentVisitor { value: PhantomData }; + deserializer.deserialize_any(visitor) + } + } + + struct ContentVisitor<'de> { + value: PhantomData>, + } + + impl<'de> ContentVisitor<'de> { + fn new() -> Self { + ContentVisitor { value: PhantomData } + } + } + + impl<'de> Visitor<'de> for ContentVisitor<'de> { + type Value = Content<'de>; + + fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.write_str("any value") + } + + fn visit_bool(self, value: bool) -> Result + where + F: de::Error, + { + Ok(Content::Bool(value)) + } + + fn visit_i8(self, value: i8) -> Result + where + F: de::Error, + { + Ok(Content::I8(value)) + } + + fn visit_i16(self, value: i16) -> Result + where + F: de::Error, + { + Ok(Content::I16(value)) + } + + fn visit_i32(self, value: i32) -> Result + where + F: de::Error, + { + Ok(Content::I32(value)) + } + + fn visit_i64(self, value: i64) -> Result + where + F: de::Error, + { + Ok(Content::I64(value)) + } + + fn visit_u8(self, value: u8) -> Result + where + F: de::Error, + { + Ok(Content::U8(value)) + } + + fn visit_u16(self, value: u16) -> Result + where + F: de::Error, + { + Ok(Content::U16(value)) + } + + fn visit_u32(self, value: u32) -> Result + where + F: de::Error, + { + Ok(Content::U32(value)) + } + + fn visit_u64(self, value: u64) -> Result + where + F: de::Error, + { + Ok(Content::U64(value)) + } + + fn visit_f32(self, value: f32) -> Result + where + F: de::Error, + { + Ok(Content::F32(value)) + } + + fn visit_f64(self, value: f64) -> Result + where + F: de::Error, + { + Ok(Content::F64(value)) + } + + fn visit_char(self, value: char) -> Result + where + F: de::Error, + { + Ok(Content::Char(value)) + } + + fn visit_str(self, value: &str) -> Result + where + F: de::Error, + { + Ok(Content::String(value.into())) + } + + fn visit_borrowed_str(self, value: &'de str) -> Result + where + F: de::Error, + { + Ok(Content::Str(value)) + } + + fn visit_string(self, value: String) -> Result + where + F: de::Error, + { + Ok(Content::String(value)) + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + F: de::Error, + { + Ok(Content::ByteBuf(value.into())) + } + + fn visit_borrowed_bytes(self, value: &'de [u8]) -> Result + where + F: de::Error, + { + Ok(Content::Bytes(value)) + } + + fn visit_byte_buf(self, value: Vec) -> Result + where + F: de::Error, + { + Ok(Content::ByteBuf(value)) + } + + fn visit_unit(self) -> Result + where + F: de::Error, + { + Ok(Content::Unit) + } + + fn visit_none(self) -> Result + where + F: de::Error, + { + Ok(Content::None) + } + + fn visit_some(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Deserialize::deserialize(deserializer).map(|v| Content::Some(Box::new(v))) + } + + fn visit_newtype_struct(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + Deserialize::deserialize(deserializer).map(|v| Content::Newtype(Box::new(v))) + } + + fn visit_seq(self, mut visitor: V) -> Result + where + V: SeqAccess<'de>, + { + let mut vec = Vec::with_capacity(size_hint::cautious(visitor.size_hint())); + while let Some(e) = try!(visitor.next_element()) { + vec.push(e); + } + Ok(Content::Seq(vec)) + } + + fn visit_map(self, mut visitor: V) -> Result + where + V: MapAccess<'de>, + { + let mut vec = Vec::with_capacity(size_hint::cautious(visitor.size_hint())); + while let Some(kv) = try!(visitor.next_entry()) { + vec.push(kv); + } + Ok(Content::Map(vec)) + } + + fn visit_enum(self, _visitor: V) -> Result + where + V: EnumAccess<'de>, + { + Err(de::Error::custom( + "untagged and internally tagged enums do not support enum input", + )) + } + } + + /// This is the type of the map keys in an internally tagged enum. + /// + /// Not public API. + pub enum TagOrContent<'de> { + Tag, + Content(Content<'de>), + } + + struct TagOrContentVisitor<'de> { + name: &'static str, + value: PhantomData>, + } + + impl<'de> TagOrContentVisitor<'de> { + fn new(name: &'static str) -> Self { + TagOrContentVisitor { + name: name, + value: PhantomData, + } + } + } + + impl<'de> DeserializeSeed<'de> for TagOrContentVisitor<'de> { + type Value = TagOrContent<'de>; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // Internally tagged enums are only supported in self-describing + // formats. + deserializer.deserialize_any(self) + } + } + + impl<'de> Visitor<'de> for TagOrContentVisitor<'de> { + type Value = TagOrContent<'de>; + + fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + write!(fmt, "a type tag `{}` or any other value", self.name) + } + + fn visit_bool(self, value: bool) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_bool(value) + .map(TagOrContent::Content) + } + + fn visit_i8(self, value: i8) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_i8(value) + .map(TagOrContent::Content) + } + + fn visit_i16(self, value: i16) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_i16(value) + .map(TagOrContent::Content) + } + + fn visit_i32(self, value: i32) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_i32(value) + .map(TagOrContent::Content) + } + + fn visit_i64(self, value: i64) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_i64(value) + .map(TagOrContent::Content) + } + + fn visit_u8(self, value: u8) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_u8(value) + .map(TagOrContent::Content) + } + + fn visit_u16(self, value: u16) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_u16(value) + .map(TagOrContent::Content) + } + + fn visit_u32(self, value: u32) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_u32(value) + .map(TagOrContent::Content) + } + + fn visit_u64(self, value: u64) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_u64(value) + .map(TagOrContent::Content) + } + + fn visit_f32(self, value: f32) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_f32(value) + .map(TagOrContent::Content) + } + + fn visit_f64(self, value: f64) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_f64(value) + .map(TagOrContent::Content) + } + + fn visit_char(self, value: char) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_char(value) + .map(TagOrContent::Content) + } + + fn visit_str(self, value: &str) -> Result + where + F: de::Error, + { + if value == self.name { + Ok(TagOrContent::Tag) + } else { + ContentVisitor::new() + .visit_str(value) + .map(TagOrContent::Content) + } + } + + fn visit_borrowed_str(self, value: &'de str) -> Result + where + F: de::Error, + { + if value == self.name { + Ok(TagOrContent::Tag) + } else { + ContentVisitor::new() + .visit_borrowed_str(value) + .map(TagOrContent::Content) + } + } + + fn visit_string(self, value: String) -> Result + where + F: de::Error, + { + if value == self.name { + Ok(TagOrContent::Tag) + } else { + ContentVisitor::new() + .visit_string(value) + .map(TagOrContent::Content) + } + } + + fn visit_bytes(self, value: &[u8]) -> Result + where + F: de::Error, + { + if value == self.name.as_bytes() { + Ok(TagOrContent::Tag) + } else { + ContentVisitor::new() + .visit_bytes(value) + .map(TagOrContent::Content) + } + } + + fn visit_borrowed_bytes(self, value: &'de [u8]) -> Result + where + F: de::Error, + { + if value == self.name.as_bytes() { + Ok(TagOrContent::Tag) + } else { + ContentVisitor::new() + .visit_borrowed_bytes(value) + .map(TagOrContent::Content) + } + } + + fn visit_byte_buf(self, value: Vec) -> Result + where + F: de::Error, + { + if value == self.name.as_bytes() { + Ok(TagOrContent::Tag) + } else { + ContentVisitor::new() + .visit_byte_buf(value) + .map(TagOrContent::Content) + } + } + + fn visit_unit(self) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_unit() + .map(TagOrContent::Content) + } + + fn visit_none(self) -> Result + where + F: de::Error, + { + ContentVisitor::new() + .visit_none() + .map(TagOrContent::Content) + } + + fn visit_some(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + ContentVisitor::new() + .visit_some(deserializer) + .map(TagOrContent::Content) + } + + fn visit_newtype_struct(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + ContentVisitor::new() + .visit_newtype_struct(deserializer) + .map(TagOrContent::Content) + } + + fn visit_seq(self, visitor: V) -> Result + where + V: SeqAccess<'de>, + { + ContentVisitor::new() + .visit_seq(visitor) + .map(TagOrContent::Content) + } + + fn visit_map(self, visitor: V) -> Result + where + V: MapAccess<'de>, + { + ContentVisitor::new() + .visit_map(visitor) + .map(TagOrContent::Content) + } + + fn visit_enum(self, visitor: V) -> Result + where + V: EnumAccess<'de>, + { + ContentVisitor::new() + .visit_enum(visitor) + .map(TagOrContent::Content) + } + } + + /// Used by generated code to deserialize an internally tagged enum. + /// + /// Not public API. + pub struct TaggedContent<'de, T> { + pub tag: T, + pub content: Content<'de>, + } + + /// Not public API. + pub struct TaggedContentVisitor<'de, T> { + tag_name: &'static str, + value: PhantomData>, + } + + impl<'de, T> TaggedContentVisitor<'de, T> { + /// Visitor for the content of an internally tagged enum with the given + /// tag name. + pub fn new(name: &'static str) -> Self { + TaggedContentVisitor { + tag_name: name, + value: PhantomData, + } + } + } + + impl<'de, T> DeserializeSeed<'de> for TaggedContentVisitor<'de, T> + where + T: Deserialize<'de>, + { + type Value = TaggedContent<'de, T>; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + // Internally tagged enums are only supported in self-describing + // formats. + deserializer.deserialize_any(self) + } + } + + impl<'de, T> Visitor<'de> for TaggedContentVisitor<'de, T> + where + T: Deserialize<'de>, + { + type Value = TaggedContent<'de, T>; + + fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.write_str("internally tagged enum") + } + + fn visit_seq(self, mut seq: S) -> Result + where + S: SeqAccess<'de>, + { + let tag = match try!(seq.next_element()) { + Some(tag) => tag, + None => { + return Err(de::Error::missing_field(self.tag_name)); + } + }; + let rest = de::value::SeqAccessDeserializer::new(seq); + Ok(TaggedContent { + tag: tag, + content: try!(Content::deserialize(rest)), + }) + } + + fn visit_map(self, mut map: M) -> Result + where + M: MapAccess<'de>, + { + let mut tag = None; + let mut vec = Vec::with_capacity(size_hint::cautious(map.size_hint())); + while let Some(k) = try!(map.next_key_seed(TagOrContentVisitor::new(self.tag_name))) { + match k { + TagOrContent::Tag => { + if tag.is_some() { + return Err(de::Error::duplicate_field(self.tag_name)); + } + tag = Some(try!(map.next_value())); + } + TagOrContent::Content(k) => { + let v = try!(map.next_value()); + vec.push((k, v)); + } + } + } + match tag { + None => Err(de::Error::missing_field(self.tag_name)), + Some(tag) => Ok(TaggedContent { + tag: tag, + content: Content::Map(vec), + }), + } + } + } + + /// Used by generated code to deserialize an adjacently tagged enum. + /// + /// Not public API. + pub enum TagOrContentField { + Tag, + Content, + } + + /// Not public API. + pub struct TagOrContentFieldVisitor { + pub tag: &'static str, + pub content: &'static str, + } + + impl<'de> DeserializeSeed<'de> for TagOrContentFieldVisitor { + type Value = TagOrContentField; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_str(self) + } + } + + impl<'de> Visitor<'de> for TagOrContentFieldVisitor { + type Value = TagOrContentField; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "{:?} or {:?}", self.tag, self.content) + } + + fn visit_str(self, field: &str) -> Result + where + E: de::Error, + { + if field == self.tag { + Ok(TagOrContentField::Tag) + } else if field == self.content { + Ok(TagOrContentField::Content) + } else { + Err(de::Error::invalid_value(Unexpected::Str(field), &self)) + } + } + } + + /// Used by generated code to deserialize an adjacently tagged enum when + /// ignoring unrelated fields is allowed. + /// + /// Not public API. + pub enum TagContentOtherField { + Tag, + Content, + Other, + } + + /// Not public API. + pub struct TagContentOtherFieldVisitor { + pub tag: &'static str, + pub content: &'static str, + } + + impl<'de> DeserializeSeed<'de> for TagContentOtherFieldVisitor { + type Value = TagContentOtherField; + + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_str(self) + } + } + + impl<'de> Visitor<'de> for TagContentOtherFieldVisitor { + type Value = TagContentOtherField; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!( + formatter, + "{:?}, {:?}, or other ignored fields", + self.tag, self.content + ) + } + + fn visit_str(self, field: &str) -> Result + where + E: de::Error, + { + if field == self.tag { + Ok(TagContentOtherField::Tag) + } else if field == self.content { + Ok(TagContentOtherField::Content) + } else { + Ok(TagContentOtherField::Other) + } + } + } + + /// Not public API + pub struct ContentDeserializer<'de, E> { + content: Content<'de>, + err: PhantomData, + } + + impl<'de, E> ContentDeserializer<'de, E> + where + E: de::Error, + { + #[cold] + fn invalid_type(self, exp: &Expected) -> E { + de::Error::invalid_type(self.content.unexpected(), exp) + } + + fn deserialize_integer(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::U8(v) => visitor.visit_u8(v), + Content::U16(v) => visitor.visit_u16(v), + Content::U32(v) => visitor.visit_u32(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I8(v) => visitor.visit_i8(v), + Content::I16(v) => visitor.visit_i16(v), + Content::I32(v) => visitor.visit_i32(v), + Content::I64(v) => visitor.visit_i64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + } + + fn visit_content_seq<'de, V, E>(content: Vec>, visitor: V) -> Result + where + V: Visitor<'de>, + E: de::Error, + { + let seq = content.into_iter().map(ContentDeserializer::new); + let mut seq_visitor = de::value::SeqDeserializer::new(seq); + let value = try!(visitor.visit_seq(&mut seq_visitor)); + try!(seq_visitor.end()); + Ok(value) + } + + fn visit_content_map<'de, V, E>( + content: Vec<(Content<'de>, Content<'de>)>, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + E: de::Error, + { + let map = content + .into_iter() + .map(|(k, v)| (ContentDeserializer::new(k), ContentDeserializer::new(v))); + let mut map_visitor = de::value::MapDeserializer::new(map); + let value = try!(visitor.visit_map(&mut map_visitor)); + try!(map_visitor.end()); + Ok(value) + } + + /// Used when deserializing an internally tagged enum because the content + /// will be used exactly once. + impl<'de, E> Deserializer<'de> for ContentDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Bool(v) => visitor.visit_bool(v), + Content::U8(v) => visitor.visit_u8(v), + Content::U16(v) => visitor.visit_u16(v), + Content::U32(v) => visitor.visit_u32(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I8(v) => visitor.visit_i8(v), + Content::I16(v) => visitor.visit_i16(v), + Content::I32(v) => visitor.visit_i32(v), + Content::I64(v) => visitor.visit_i64(v), + Content::F32(v) => visitor.visit_f32(v), + Content::F64(v) => visitor.visit_f64(v), + Content::Char(v) => visitor.visit_char(v), + Content::String(v) => visitor.visit_string(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(v) => visitor.visit_byte_buf(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + Content::Unit => visitor.visit_unit(), + Content::None => visitor.visit_none(), + Content::Some(v) => visitor.visit_some(ContentDeserializer::new(*v)), + Content::Newtype(v) => visitor.visit_newtype_struct(ContentDeserializer::new(*v)), + Content::Seq(v) => visit_content_seq(v, visitor), + Content::Map(v) => visit_content_map(v, visitor), + } + } + + fn deserialize_bool(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Bool(v) => visitor.visit_bool(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_i8(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_i16(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_i32(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_i64(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u8(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u16(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u32(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u64(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_f32(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::F32(v) => visitor.visit_f32(v), + Content::F64(v) => visitor.visit_f64(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I64(v) => visitor.visit_i64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_f64(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::F64(v) => visitor.visit_f64(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I64(v) => visitor.visit_i64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_char(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Char(v) => visitor.visit_char(v), + Content::String(v) => visitor.visit_string(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_str(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_string(visitor) + } + + fn deserialize_string(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::String(v) => visitor.visit_string(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(v) => visitor.visit_byte_buf(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_bytes(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_byte_buf(visitor) + } + + fn deserialize_byte_buf(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::String(v) => visitor.visit_string(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(v) => visitor.visit_byte_buf(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + Content::Seq(v) => visit_content_seq(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::None => visitor.visit_none(), + Content::Some(v) => visitor.visit_some(ContentDeserializer::new(*v)), + Content::Unit => visitor.visit_unit(), + _ => visitor.visit_some(self), + } + } + + fn deserialize_unit(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Unit => visitor.visit_unit(), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_unit_struct( + self, + _name: &'static str, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + match self.content { + // As a special case, allow deserializing untagged newtype + // variant containing unit struct. + // + // #[derive(Deserialize)] + // struct Info; + // + // #[derive(Deserialize)] + // #[serde(tag = "topic")] + // enum Message { + // Info(Info), + // } + // + // We want {"topic":"Info"} to deserialize even though + // ordinarily unit structs do not deserialize from empty map. + Content::Map(ref v) if v.is_empty() => visitor.visit_unit(), + _ => self.deserialize_any(visitor), + } + } + + fn deserialize_newtype_struct( + self, + _name: &str, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Newtype(v) => visitor.visit_newtype_struct(ContentDeserializer::new(*v)), + _ => visitor.visit_newtype_struct(self), + } + } + + fn deserialize_seq(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Seq(v) => visit_content_seq(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_tuple(self, _len: usize, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_map(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Map(v) => visit_content_map(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_struct( + self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::Seq(v) => visit_content_seq(v, visitor), + Content::Map(v) => visit_content_map(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_enum( + self, + _name: &str, + _variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + let (variant, value) = match self.content { + Content::Map(value) => { + let mut iter = value.into_iter(); + let (variant, value) = match iter.next() { + Some(v) => v, + None => { + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); + } + }; + // enums are encoded in json as maps with a single key:value pair + if iter.next().is_some() { + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); + } + (variant, Some(value)) + } + s @ Content::String(_) | s @ Content::Str(_) => (s, None), + other => { + return Err(de::Error::invalid_type( + other.unexpected(), + &"string or map", + )); + } + }; + + visitor.visit_enum(EnumDeserializer::new(variant, value)) + } + + fn deserialize_identifier(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match self.content { + Content::String(v) => visitor.visit_string(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(v) => visitor.visit_byte_buf(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + Content::U8(v) => visitor.visit_u8(v), + Content::U64(v) => visitor.visit_u64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_ignored_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + drop(self); + visitor.visit_unit() + } + } + + impl<'de, E> ContentDeserializer<'de, E> { + /// private API, don't use + pub fn new(content: Content<'de>) -> Self { + ContentDeserializer { + content: content, + err: PhantomData, + } + } + } + + pub struct EnumDeserializer<'de, E> + where + E: de::Error, + { + variant: Content<'de>, + value: Option>, + err: PhantomData, + } + + impl<'de, E> EnumDeserializer<'de, E> + where + E: de::Error, + { + pub fn new(variant: Content<'de>, value: Option>) -> EnumDeserializer<'de, E> { + EnumDeserializer { + variant: variant, + value: value, + err: PhantomData, + } + } + } + + impl<'de, E> de::EnumAccess<'de> for EnumDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + type Variant = VariantDeserializer<'de, Self::Error>; + + fn variant_seed(self, seed: V) -> Result<(V::Value, Self::Variant), E> + where + V: de::DeserializeSeed<'de>, + { + let visitor = VariantDeserializer { + value: self.value, + err: PhantomData, + }; + seed.deserialize(ContentDeserializer::new(self.variant)) + .map(|v| (v, visitor)) + } + } + + pub struct VariantDeserializer<'de, E> + where + E: de::Error, + { + value: Option>, + err: PhantomData, + } + + impl<'de, E> de::VariantAccess<'de> for VariantDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + + fn unit_variant(self) -> Result<(), E> { + match self.value { + Some(value) => de::Deserialize::deserialize(ContentDeserializer::new(value)), + None => Ok(()), + } + } + + fn newtype_variant_seed(self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + match self.value { + Some(value) => seed.deserialize(ContentDeserializer::new(value)), + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"newtype variant", + )), + } + } + + fn tuple_variant(self, _len: usize, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + match self.value { + Some(Content::Seq(v)) => { + de::Deserializer::deserialize_any(SeqDeserializer::new(v), visitor) + } + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"tuple variant", + )), + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"tuple variant", + )), + } + } + + fn struct_variant( + self, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + match self.value { + Some(Content::Map(v)) => { + de::Deserializer::deserialize_any(MapDeserializer::new(v), visitor) + } + Some(Content::Seq(v)) => { + de::Deserializer::deserialize_any(SeqDeserializer::new(v), visitor) + } + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"struct variant", + )), + _ => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"struct variant", + )), + } + } + } + + struct SeqDeserializer<'de, E> + where + E: de::Error, + { + iter: > as IntoIterator>::IntoIter, + err: PhantomData, + } + + impl<'de, E> SeqDeserializer<'de, E> + where + E: de::Error, + { + fn new(vec: Vec>) -> Self { + SeqDeserializer { + iter: vec.into_iter(), + err: PhantomData, + } + } + } + + impl<'de, E> de::Deserializer<'de> for SeqDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + + #[inline] + fn deserialize_any(mut self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let len = self.iter.len(); + if len == 0 { + visitor.visit_unit() + } else { + let ret = try!(visitor.visit_seq(&mut self)); + let remaining = self.iter.len(); + if remaining == 0 { + Ok(ret) + } else { + Err(de::Error::invalid_length(len, &"fewer elements in array")) + } + } + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } + } + + impl<'de, E> de::SeqAccess<'de> for SeqDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.iter.next() { + Some(value) => seed.deserialize(ContentDeserializer::new(value)).map(Some), + None => Ok(None), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } + } + + struct MapDeserializer<'de, E> + where + E: de::Error, + { + iter: , Content<'de>)> as IntoIterator>::IntoIter, + value: Option>, + err: PhantomData, + } + + impl<'de, E> MapDeserializer<'de, E> + where + E: de::Error, + { + fn new(map: Vec<(Content<'de>, Content<'de>)>) -> Self { + MapDeserializer { + iter: map.into_iter(), + value: None, + err: PhantomData, + } + } + } + + impl<'de, E> de::MapAccess<'de> for MapDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + + fn next_key_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.iter.next() { + Some((key, value)) => { + self.value = Some(value); + seed.deserialize(ContentDeserializer::new(key)).map(Some) + } + None => Ok(None), + } + } + + fn next_value_seed(&mut self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + match self.value.take() { + Some(value) => seed.deserialize(ContentDeserializer::new(value)), + None => Err(de::Error::custom("value is missing")), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } + } + + impl<'de, E> de::Deserializer<'de> for MapDeserializer<'de, E> + where + E: de::Error, + { + type Error = E; + + #[inline] + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_map(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } + } + + /// Not public API. + pub struct ContentRefDeserializer<'a, 'de: 'a, E> { + content: &'a Content<'de>, + err: PhantomData, + } + + impl<'a, 'de, E> ContentRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + #[cold] + fn invalid_type(self, exp: &Expected) -> E { + de::Error::invalid_type(self.content.unexpected(), exp) + } + + fn deserialize_integer(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::U8(v) => visitor.visit_u8(v), + Content::U16(v) => visitor.visit_u16(v), + Content::U32(v) => visitor.visit_u32(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I8(v) => visitor.visit_i8(v), + Content::I16(v) => visitor.visit_i16(v), + Content::I32(v) => visitor.visit_i32(v), + Content::I64(v) => visitor.visit_i64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + } + + fn visit_content_seq_ref<'a, 'de, V, E>( + content: &'a [Content<'de>], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + E: de::Error, + { + let seq = content.iter().map(ContentRefDeserializer::new); + let mut seq_visitor = de::value::SeqDeserializer::new(seq); + let value = try!(visitor.visit_seq(&mut seq_visitor)); + try!(seq_visitor.end()); + Ok(value) + } + + fn visit_content_map_ref<'a, 'de, V, E>( + content: &'a [(Content<'de>, Content<'de>)], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + E: de::Error, + { + let map = content.iter().map(|&(ref k, ref v)| { + ( + ContentRefDeserializer::new(k), + ContentRefDeserializer::new(v), + ) + }); + let mut map_visitor = de::value::MapDeserializer::new(map); + let value = try!(visitor.visit_map(&mut map_visitor)); + try!(map_visitor.end()); + Ok(value) + } + + /// Used when deserializing an untagged enum because the content may need + /// to be used more than once. + impl<'de, 'a, E> Deserializer<'de> for ContentRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Bool(v) => visitor.visit_bool(v), + Content::U8(v) => visitor.visit_u8(v), + Content::U16(v) => visitor.visit_u16(v), + Content::U32(v) => visitor.visit_u32(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I8(v) => visitor.visit_i8(v), + Content::I16(v) => visitor.visit_i16(v), + Content::I32(v) => visitor.visit_i32(v), + Content::I64(v) => visitor.visit_i64(v), + Content::F32(v) => visitor.visit_f32(v), + Content::F64(v) => visitor.visit_f64(v), + Content::Char(v) => visitor.visit_char(v), + Content::String(ref v) => visitor.visit_str(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(ref v) => visitor.visit_bytes(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + Content::Unit => visitor.visit_unit(), + Content::None => visitor.visit_none(), + Content::Some(ref v) => visitor.visit_some(ContentRefDeserializer::new(v)), + Content::Newtype(ref v) => { + visitor.visit_newtype_struct(ContentRefDeserializer::new(v)) + } + Content::Seq(ref v) => visit_content_seq_ref(v, visitor), + Content::Map(ref v) => visit_content_map_ref(v, visitor), + } + } + + fn deserialize_bool(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Bool(v) => visitor.visit_bool(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_i8(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_i16(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_i32(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_i64(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u8(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u16(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u32(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_u64(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_integer(visitor) + } + + fn deserialize_f32(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::F32(v) => visitor.visit_f32(v), + Content::F64(v) => visitor.visit_f64(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I64(v) => visitor.visit_i64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_f64(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::F64(v) => visitor.visit_f64(v), + Content::U64(v) => visitor.visit_u64(v), + Content::I64(v) => visitor.visit_i64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_char(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Char(v) => visitor.visit_char(v), + Content::String(ref v) => visitor.visit_str(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_str(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::String(ref v) => visitor.visit_str(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(ref v) => visitor.visit_bytes(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_string(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_str(visitor) + } + + fn deserialize_bytes(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::String(ref v) => visitor.visit_str(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(ref v) => visitor.visit_bytes(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + Content::Seq(ref v) => visit_content_seq_ref(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_byte_buf(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_bytes(visitor) + } + + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::None => visitor.visit_none(), + Content::Some(ref v) => visitor.visit_some(ContentRefDeserializer::new(v)), + Content::Unit => visitor.visit_unit(), + _ => visitor.visit_some(self), + } + } + + fn deserialize_unit(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Unit => visitor.visit_unit(), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_unit_struct( + self, + _name: &'static str, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.deserialize_unit(visitor) + } + + fn deserialize_newtype_struct(self, _name: &str, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Newtype(ref v) => { + visitor.visit_newtype_struct(ContentRefDeserializer::new(v)) + } + _ => visitor.visit_newtype_struct(self), + } + } + + fn deserialize_seq(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Seq(ref v) => visit_content_seq_ref(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_tuple(self, _len: usize, visitor: V) -> Result + where + V: Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + self.deserialize_seq(visitor) + } + + fn deserialize_map(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Map(ref v) => visit_content_map_ref(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_struct( + self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::Seq(ref v) => visit_content_seq_ref(v, visitor), + Content::Map(ref v) => visit_content_map_ref(v, visitor), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_enum( + self, + _name: &str, + _variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + let (variant, value) = match *self.content { + Content::Map(ref value) => { + let mut iter = value.iter(); + let &(ref variant, ref value) = match iter.next() { + Some(v) => v, + None => { + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); + } + }; + // enums are encoded in json as maps with a single key:value pair + if iter.next().is_some() { + return Err(de::Error::invalid_value( + de::Unexpected::Map, + &"map with a single key", + )); + } + (variant, Some(value)) + } + ref s @ Content::String(_) | ref s @ Content::Str(_) => (s, None), + ref other => { + return Err(de::Error::invalid_type( + other.unexpected(), + &"string or map", + )); + } + }; + + visitor.visit_enum(EnumRefDeserializer { + variant: variant, + value: value, + err: PhantomData, + }) + } + + fn deserialize_identifier(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match *self.content { + Content::String(ref v) => visitor.visit_str(v), + Content::Str(v) => visitor.visit_borrowed_str(v), + Content::ByteBuf(ref v) => visitor.visit_bytes(v), + Content::Bytes(v) => visitor.visit_borrowed_bytes(v), + Content::U8(v) => visitor.visit_u8(v), + Content::U64(v) => visitor.visit_u64(v), + _ => Err(self.invalid_type(&visitor)), + } + } + + fn deserialize_ignored_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_unit() + } + } + + impl<'a, 'de, E> ContentRefDeserializer<'a, 'de, E> { + /// private API, don't use + pub fn new(content: &'a Content<'de>) -> Self { + ContentRefDeserializer { + content: content, + err: PhantomData, + } + } + } + + struct EnumRefDeserializer<'a, 'de: 'a, E> + where + E: de::Error, + { + variant: &'a Content<'de>, + value: Option<&'a Content<'de>>, + err: PhantomData, + } + + impl<'de, 'a, E> de::EnumAccess<'de> for EnumRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + type Variant = VariantRefDeserializer<'a, 'de, Self::Error>; + + fn variant_seed(self, seed: V) -> Result<(V::Value, Self::Variant), Self::Error> + where + V: de::DeserializeSeed<'de>, + { + let visitor = VariantRefDeserializer { + value: self.value, + err: PhantomData, + }; + seed.deserialize(ContentRefDeserializer::new(self.variant)) + .map(|v| (v, visitor)) + } + } + + struct VariantRefDeserializer<'a, 'de: 'a, E> + where + E: de::Error, + { + value: Option<&'a Content<'de>>, + err: PhantomData, + } + + impl<'de, 'a, E> de::VariantAccess<'de> for VariantRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + + fn unit_variant(self) -> Result<(), E> { + match self.value { + Some(value) => de::Deserialize::deserialize(ContentRefDeserializer::new(value)), + None => Ok(()), + } + } + + fn newtype_variant_seed(self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + match self.value { + Some(value) => seed.deserialize(ContentRefDeserializer::new(value)), + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"newtype variant", + )), + } + } + + fn tuple_variant(self, _len: usize, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + match self.value { + Some(&Content::Seq(ref v)) => { + de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor) + } + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"tuple variant", + )), + None => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"tuple variant", + )), + } + } + + fn struct_variant( + self, + _fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: de::Visitor<'de>, + { + match self.value { + Some(&Content::Map(ref v)) => { + de::Deserializer::deserialize_any(MapRefDeserializer::new(v), visitor) + } + Some(&Content::Seq(ref v)) => { + de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor) + } + Some(other) => Err(de::Error::invalid_type( + other.unexpected(), + &"struct variant", + )), + _ => Err(de::Error::invalid_type( + de::Unexpected::UnitVariant, + &"struct variant", + )), + } + } + } + + struct SeqRefDeserializer<'a, 'de: 'a, E> + where + E: de::Error, + { + iter: <&'a [Content<'de>] as IntoIterator>::IntoIter, + err: PhantomData, + } + + impl<'a, 'de, E> SeqRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + fn new(slice: &'a [Content<'de>]) -> Self { + SeqRefDeserializer { + iter: slice.iter(), + err: PhantomData, + } + } + } + + impl<'de, 'a, E> de::Deserializer<'de> for SeqRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + + #[inline] + fn deserialize_any(mut self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + let len = self.iter.len(); + if len == 0 { + visitor.visit_unit() + } else { + let ret = try!(visitor.visit_seq(&mut self)); + let remaining = self.iter.len(); + if remaining == 0 { + Ok(ret) + } else { + Err(de::Error::invalid_length(len, &"fewer elements in array")) + } + } + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } + } + + impl<'de, 'a, E> de::SeqAccess<'de> for SeqRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + + fn next_element_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.iter.next() { + Some(value) => seed + .deserialize(ContentRefDeserializer::new(value)) + .map(Some), + None => Ok(None), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } + } + + struct MapRefDeserializer<'a, 'de: 'a, E> + where + E: de::Error, + { + iter: <&'a [(Content<'de>, Content<'de>)] as IntoIterator>::IntoIter, + value: Option<&'a Content<'de>>, + err: PhantomData, + } + + impl<'a, 'de, E> MapRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + fn new(map: &'a [(Content<'de>, Content<'de>)]) -> Self { + MapRefDeserializer { + iter: map.iter(), + value: None, + err: PhantomData, + } + } + } + + impl<'de, 'a, E> de::MapAccess<'de> for MapRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + + fn next_key_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: de::DeserializeSeed<'de>, + { + match self.iter.next() { + Some(&(ref key, ref value)) => { + self.value = Some(value); + seed.deserialize(ContentRefDeserializer::new(key)).map(Some) + } + None => Ok(None), + } + } + + fn next_value_seed(&mut self, seed: T) -> Result + where + T: de::DeserializeSeed<'de>, + { + match self.value.take() { + Some(value) => seed.deserialize(ContentRefDeserializer::new(value)), + None => Err(de::Error::custom("value is missing")), + } + } + + fn size_hint(&self) -> Option { + size_hint::from_bounds(&self.iter) + } + } + + impl<'de, 'a, E> de::Deserializer<'de> for MapRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Error = E; + + #[inline] + fn deserialize_any(self, visitor: V) -> Result + where + V: de::Visitor<'de>, + { + visitor.visit_map(self) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } + } + + impl<'de, E> de::IntoDeserializer<'de, E> for ContentDeserializer<'de, E> + where + E: de::Error, + { + type Deserializer = Self; + + fn into_deserializer(self) -> Self { + self + } + } + + impl<'de, 'a, E> de::IntoDeserializer<'de, E> for ContentRefDeserializer<'a, 'de, E> + where + E: de::Error, + { + type Deserializer = Self; + + fn into_deserializer(self) -> Self { + self + } + } + + /// Visitor for deserializing an internally tagged unit variant. + /// + /// Not public API. + pub struct InternallyTaggedUnitVisitor<'a> { + type_name: &'a str, + variant_name: &'a str, + } + + impl<'a> InternallyTaggedUnitVisitor<'a> { + /// Not public API. + pub fn new(type_name: &'a str, variant_name: &'a str) -> Self { + InternallyTaggedUnitVisitor { + type_name: type_name, + variant_name: variant_name, + } + } + } + + impl<'de, 'a> Visitor<'de> for InternallyTaggedUnitVisitor<'a> { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!( + formatter, + "unit variant {}::{}", + self.type_name, self.variant_name + ) + } + + fn visit_seq(self, _: S) -> Result<(), S::Error> + where + S: SeqAccess<'de>, + { + Ok(()) + } + + fn visit_map(self, mut access: M) -> Result<(), M::Error> + where + M: MapAccess<'de>, + { + while try!(access.next_entry::()).is_some() {} + Ok(()) + } + } + + /// Visitor for deserializing an untagged unit variant. + /// + /// Not public API. + pub struct UntaggedUnitVisitor<'a> { + type_name: &'a str, + variant_name: &'a str, + } + + impl<'a> UntaggedUnitVisitor<'a> { + /// Not public API. + pub fn new(type_name: &'a str, variant_name: &'a str) -> Self { + UntaggedUnitVisitor { + type_name: type_name, + variant_name: variant_name, + } + } + } + + impl<'de, 'a> Visitor<'de> for UntaggedUnitVisitor<'a> { + type Value = (); + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!( + formatter, + "unit variant {}::{}", + self.type_name, self.variant_name + ) + } + + fn visit_unit(self) -> Result<(), E> + where + E: de::Error, + { + Ok(()) + } + + fn visit_none(self) -> Result<(), E> + where + E: de::Error, + { + Ok(()) + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +// Like `IntoDeserializer` but also implemented for `&[u8]`. This is used for +// the newtype fallthrough case of `field_identifier`. +// +// #[derive(Deserialize)] +// #[serde(field_identifier)] +// enum F { +// A, +// B, +// Other(String), // deserialized using IdentifierDeserializer +// } +pub trait IdentifierDeserializer<'de, E: Error> { + type Deserializer: Deserializer<'de, Error = E>; + + fn from(self) -> Self::Deserializer; +} + +impl<'de, E> IdentifierDeserializer<'de, E> for u32 +where + E: Error, +{ + type Deserializer = >::Deserializer; + + fn from(self) -> Self::Deserializer { + self.into_deserializer() + } +} + +pub struct StrDeserializer<'a, E> { + value: &'a str, + marker: PhantomData, +} + +impl<'a, E> IdentifierDeserializer<'a, E> for &'a str +where + E: Error, +{ + type Deserializer = StrDeserializer<'a, E>; + + fn from(self) -> Self::Deserializer { + StrDeserializer { + value: self, + marker: PhantomData, + } + } +} + +impl<'de, 'a, E> Deserializer<'de> for StrDeserializer<'a, E> +where + E: Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_str(self.value) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } +} + +pub struct BytesDeserializer<'a, E> { + value: &'a [u8], + marker: PhantomData, +} + +impl<'a, E> IdentifierDeserializer<'a, E> for &'a [u8] +where + E: Error, +{ + type Deserializer = BytesDeserializer<'a, E>; + + fn from(self) -> Self::Deserializer { + BytesDeserializer { + value: self, + marker: PhantomData, + } + } +} + +impl<'de, 'a, E> Deserializer<'de> for BytesDeserializer<'a, E> +where + E: Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_bytes(self.value) + } + + forward_to_deserialize_any! { + bool i8 i16 i32 i64 i128 u8 u16 u32 u64 u128 f32 f64 char str string + bytes byte_buf option unit unit_struct newtype_struct seq tuple + tuple_struct map struct enum identifier ignored_any + } +} + +/// A DeserializeSeed helper for implementing deserialize_in_place Visitors. +/// +/// Wraps a mutable reference and calls deserialize_in_place on it. +pub struct InPlaceSeed<'a, T: 'a>(pub &'a mut T); + +impl<'a, 'de, T> DeserializeSeed<'de> for InPlaceSeed<'a, T> +where + T: Deserialize<'de>, +{ + type Value = (); + fn deserialize(self, deserializer: D) -> Result + where + D: Deserializer<'de>, + { + T::deserialize_in_place(deserializer, self.0) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatMapDeserializer<'a, 'de: 'a, E>( + pub &'a mut Vec, Content<'de>)>>, + pub PhantomData, +); + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> FlatMapDeserializer<'a, 'de, E> +where + E: Error, +{ + fn deserialize_other() -> Result { + Err(Error::custom("can only flatten structs and maps")) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +macro_rules! forward_to_deserialize_other { + ($($func:ident ( $($arg:ty),* ))*) => { + $( + fn $func(self, $(_: $arg,)* _visitor: V) -> Result + where + V: Visitor<'de>, + { + Self::deserialize_other() + } + )* + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> Deserializer<'de> for FlatMapDeserializer<'a, 'de, E> +where + E: Error, +{ + type Error = E; + + fn deserialize_any(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_map(FlatInternallyTaggedAccess { + iter: self.0.iter_mut(), + pending: None, + _marker: PhantomData, + }) + } + + fn deserialize_enum( + self, + name: &'static str, + variants: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + for item in self.0.iter_mut() { + // items in the vector are nulled out when used. So we can only use + // an item if it's still filled in and if the field is one we care + // about. + let use_item = match *item { + None => false, + Some((ref c, _)) => c.as_str().map_or(false, |x| variants.contains(&x)), + }; + + if use_item { + let (key, value) = item.take().unwrap(); + return visitor.visit_enum(EnumDeserializer::new(key, Some(value))); + } + } + + Err(Error::custom(format_args!( + "no variant of enum {} found in flattened data", + name + ))) + } + + fn deserialize_map(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_map(FlatMapAccess::new(self.0.iter())) + } + + fn deserialize_struct( + self, + _: &'static str, + fields: &'static [&'static str], + visitor: V, + ) -> Result + where + V: Visitor<'de>, + { + visitor.visit_map(FlatStructAccess::new(self.0.iter_mut(), fields)) + } + + fn deserialize_newtype_struct(self, _name: &str, visitor: V) -> Result + where + V: Visitor<'de>, + { + visitor.visit_newtype_struct(self) + } + + fn deserialize_option(self, visitor: V) -> Result + where + V: Visitor<'de>, + { + match visitor.__private_visit_untagged_option(self) { + Ok(value) => Ok(value), + Err(()) => Self::deserialize_other(), + } + } + + forward_to_deserialize_other! { + deserialize_bool() + deserialize_i8() + deserialize_i16() + deserialize_i32() + deserialize_i64() + deserialize_u8() + deserialize_u16() + deserialize_u32() + deserialize_u64() + deserialize_f32() + deserialize_f64() + deserialize_char() + deserialize_str() + deserialize_string() + deserialize_bytes() + deserialize_byte_buf() + deserialize_unit() + deserialize_unit_struct(&'static str) + deserialize_seq() + deserialize_tuple(usize) + deserialize_tuple_struct(&'static str, usize) + deserialize_identifier() + deserialize_ignored_any() + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatMapAccess<'a, 'de: 'a, E> { + iter: slice::Iter<'a, Option<(Content<'de>, Content<'de>)>>, + pending_content: Option<&'a Content<'de>>, + _marker: PhantomData, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> FlatMapAccess<'a, 'de, E> { + fn new( + iter: slice::Iter<'a, Option<(Content<'de>, Content<'de>)>>, + ) -> FlatMapAccess<'a, 'de, E> { + FlatMapAccess { + iter: iter, + pending_content: None, + _marker: PhantomData, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E> +where + E: Error, +{ + type Error = E; + + fn next_key_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: DeserializeSeed<'de>, + { + while let Some(item) = self.iter.next() { + // Items in the vector are nulled out when used by a struct. + if let Some((ref key, ref content)) = *item { + self.pending_content = Some(content); + return seed.deserialize(ContentRefDeserializer::new(key)).map(Some); + } + } + Ok(None) + } + + fn next_value_seed(&mut self, seed: T) -> Result + where + T: DeserializeSeed<'de>, + { + match self.pending_content.take() { + Some(value) => seed.deserialize(ContentRefDeserializer::new(value)), + None => Err(Error::custom("value is missing")), + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatStructAccess<'a, 'de: 'a, E> { + iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>, + pending_content: Option>, + fields: &'static [&'static str], + _marker: PhantomData, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> FlatStructAccess<'a, 'de, E> { + fn new( + iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>, + fields: &'static [&'static str], + ) -> FlatStructAccess<'a, 'de, E> { + FlatStructAccess { + iter: iter, + pending_content: None, + fields: fields, + _marker: PhantomData, + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> MapAccess<'de> for FlatStructAccess<'a, 'de, E> +where + E: Error, +{ + type Error = E; + + fn next_key_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: DeserializeSeed<'de>, + { + while let Some(item) = self.iter.next() { + // items in the vector are nulled out when used. So we can only use + // an item if it's still filled in and if the field is one we care + // about. In case we do not know which fields we want, we take them all. + let use_item = match *item { + None => false, + Some((ref c, _)) => c.as_str().map_or(false, |key| self.fields.contains(&key)), + }; + + if use_item { + let (key, content) = item.take().unwrap(); + self.pending_content = Some(content); + return seed.deserialize(ContentDeserializer::new(key)).map(Some); + } + } + Ok(None) + } + + fn next_value_seed(&mut self, seed: T) -> Result + where + T: DeserializeSeed<'de>, + { + match self.pending_content.take() { + Some(value) => seed.deserialize(ContentDeserializer::new(value)), + None => Err(Error::custom("value is missing")), + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatInternallyTaggedAccess<'a, 'de: 'a, E> { + iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>, + pending: Option<&'a Content<'de>>, + _marker: PhantomData, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, 'de, E> MapAccess<'de> for FlatInternallyTaggedAccess<'a, 'de, E> +where + E: Error, +{ + type Error = E; + + fn next_key_seed(&mut self, seed: T) -> Result, Self::Error> + where + T: DeserializeSeed<'de>, + { + while let Some(item) = self.iter.next() { + if let Some((ref key, ref content)) = *item { + // Do not take(), instead borrow this entry. The internally tagged + // enum does its own buffering so we can't tell whether this entry + // is going to be consumed. Borrowing here leaves the entry + // available for later flattened fields. + self.pending = Some(content); + return seed.deserialize(ContentRefDeserializer::new(key)).map(Some); + } + } + Ok(None) + } + + fn next_value_seed(&mut self, seed: T) -> Result + where + T: DeserializeSeed<'de>, + { + match self.pending.take() { + Some(value) => seed.deserialize(ContentRefDeserializer::new(value)), + None => panic!("value is missing"), + } + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/private/macros.rs b/third_party/cargo/vendor/serde-1.0.110/src/private/macros.rs new file mode 100644 index 0000000..4f7054f --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/private/macros.rs @@ -0,0 +1,140 @@ +#[doc(hidden)] +#[macro_export] +macro_rules! __private_serialize { + () => { + trait Serialize { + fn serialize(&self, serializer: S) -> Result + where + S: $crate::Serializer; + } + }; +} + +#[doc(hidden)] +#[macro_export] +macro_rules! __private_deserialize { + () => { + trait Deserialize<'de>: Sized { + fn deserialize(deserializer: D) -> Result + where + D: $crate::Deserializer<'de>; + } + }; +} + +/// Used only by Serde doc tests. Not public API. +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! __serialize_unimplemented { + ($($func:ident)*) => { + $( + __serialize_unimplemented_helper!($func); + )* + }; +} + +#[doc(hidden)] +#[macro_export] +macro_rules! __serialize_unimplemented_method { + ($func:ident $(<$t:ident>)* ($($arg:ty),*) -> $ret:ident) => { + fn $func $(<$t: ?Sized + $crate::Serialize>)* (self $(, _: $arg)*) -> $crate::export::Result { + unimplemented!() + } + }; +} + +#[doc(hidden)] +#[macro_export(local_inner_macros)] +macro_rules! __serialize_unimplemented_helper { + (bool) => { + __serialize_unimplemented_method!(serialize_bool(bool) -> Ok); + }; + (i8) => { + __serialize_unimplemented_method!(serialize_i8(i8) -> Ok); + }; + (i16) => { + __serialize_unimplemented_method!(serialize_i16(i16) -> Ok); + }; + (i32) => { + __serialize_unimplemented_method!(serialize_i32(i32) -> Ok); + }; + (i64) => { + __serialize_unimplemented_method!(serialize_i64(i64) -> Ok); + }; + (u8) => { + __serialize_unimplemented_method!(serialize_u8(u8) -> Ok); + }; + (u16) => { + __serialize_unimplemented_method!(serialize_u16(u16) -> Ok); + }; + (u32) => { + __serialize_unimplemented_method!(serialize_u32(u32) -> Ok); + }; + (u64) => { + __serialize_unimplemented_method!(serialize_u64(u64) -> Ok); + }; + (f32) => { + __serialize_unimplemented_method!(serialize_f32(f32) -> Ok); + }; + (f64) => { + __serialize_unimplemented_method!(serialize_f64(f64) -> Ok); + }; + (char) => { + __serialize_unimplemented_method!(serialize_char(char) -> Ok); + }; + (str) => { + __serialize_unimplemented_method!(serialize_str(&str) -> Ok); + }; + (bytes) => { + __serialize_unimplemented_method!(serialize_bytes(&[u8]) -> Ok); + }; + (none) => { + __serialize_unimplemented_method!(serialize_none() -> Ok); + }; + (some) => { + __serialize_unimplemented_method!(serialize_some(&T) -> Ok); + }; + (unit) => { + __serialize_unimplemented_method!(serialize_unit() -> Ok); + }; + (unit_struct) => { + __serialize_unimplemented_method!(serialize_unit_struct(&str) -> Ok); + }; + (unit_variant) => { + __serialize_unimplemented_method!(serialize_unit_variant(&str, u32, &str) -> Ok); + }; + (newtype_struct) => { + __serialize_unimplemented_method!(serialize_newtype_struct(&str, &T) -> Ok); + }; + (newtype_variant) => { + __serialize_unimplemented_method!(serialize_newtype_variant(&str, u32, &str, &T) -> Ok); + }; + (seq) => { + type SerializeSeq = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_seq(Option) -> SerializeSeq); + }; + (tuple) => { + type SerializeTuple = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_tuple(usize) -> SerializeTuple); + }; + (tuple_struct) => { + type SerializeTupleStruct = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_tuple_struct(&str, usize) -> SerializeTupleStruct); + }; + (tuple_variant) => { + type SerializeTupleVariant = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_tuple_variant(&str, u32, &str, usize) -> SerializeTupleVariant); + }; + (map) => { + type SerializeMap = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_map(Option) -> SerializeMap); + }; + (struct) => { + type SerializeStruct = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_struct(&str, usize) -> SerializeStruct); + }; + (struct_variant) => { + type SerializeStructVariant = $crate::ser::Impossible; + __serialize_unimplemented_method!(serialize_struct_variant(&str, u32, &str, usize) -> SerializeStructVariant); + }; +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/private/mod.rs b/third_party/cargo/vendor/serde-1.0.110/src/private/mod.rs new file mode 100644 index 0000000..79e0a7d --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/private/mod.rs @@ -0,0 +1,4 @@ +mod macros; + +pub mod de; +pub mod ser; diff --git a/third_party/cargo/vendor/serde-1.0.110/src/private/ser.rs b/third_party/cargo/vendor/serde-1.0.110/src/private/ser.rs new file mode 100644 index 0000000..4d9bce8 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/private/ser.rs @@ -0,0 +1,1326 @@ +use lib::*; + +use ser::{self, Impossible, Serialize, SerializeMap, SerializeStruct, Serializer}; + +#[cfg(any(feature = "std", feature = "alloc"))] +use self::content::{ + Content, ContentSerializer, SerializeStructVariantAsMapValue, SerializeTupleVariantAsMapValue, +}; + +/// Used to check that serde(getter) attributes return the expected type. +/// Not public API. +pub fn constrain(t: &T) -> &T { + t +} + +/// Not public API. +pub fn serialize_tagged_newtype( + serializer: S, + type_ident: &'static str, + variant_ident: &'static str, + tag: &'static str, + variant_name: &'static str, + value: &T, +) -> Result +where + S: Serializer, + T: Serialize, +{ + value.serialize(TaggedSerializer { + type_ident: type_ident, + variant_ident: variant_ident, + tag: tag, + variant_name: variant_name, + delegate: serializer, + }) +} + +struct TaggedSerializer { + type_ident: &'static str, + variant_ident: &'static str, + tag: &'static str, + variant_name: &'static str, + delegate: S, +} + +enum Unsupported { + Boolean, + Integer, + Float, + Char, + String, + ByteArray, + Optional, + Unit, + #[cfg(any(feature = "std", feature = "alloc"))] + UnitStruct, + Sequence, + Tuple, + TupleStruct, + Enum, +} + +impl Display for Unsupported { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + match *self { + Unsupported::Boolean => formatter.write_str("a boolean"), + Unsupported::Integer => formatter.write_str("an integer"), + Unsupported::Float => formatter.write_str("a float"), + Unsupported::Char => formatter.write_str("a char"), + Unsupported::String => formatter.write_str("a string"), + Unsupported::ByteArray => formatter.write_str("a byte array"), + Unsupported::Optional => formatter.write_str("an optional"), + Unsupported::Unit => formatter.write_str("unit"), + #[cfg(any(feature = "std", feature = "alloc"))] + Unsupported::UnitStruct => formatter.write_str("unit struct"), + Unsupported::Sequence => formatter.write_str("a sequence"), + Unsupported::Tuple => formatter.write_str("a tuple"), + Unsupported::TupleStruct => formatter.write_str("a tuple struct"), + Unsupported::Enum => formatter.write_str("an enum"), + } + } +} + +impl TaggedSerializer +where + S: Serializer, +{ + fn bad_type(self, what: Unsupported) -> S::Error { + ser::Error::custom(format_args!( + "cannot serialize tagged newtype variant {}::{} containing {}", + self.type_ident, self.variant_ident, what + )) + } +} + +impl Serializer for TaggedSerializer +where + S: Serializer, +{ + type Ok = S::Ok; + type Error = S::Error; + + type SerializeSeq = Impossible; + type SerializeTuple = Impossible; + type SerializeTupleStruct = Impossible; + type SerializeMap = S::SerializeMap; + type SerializeStruct = S::SerializeStruct; + + #[cfg(not(any(feature = "std", feature = "alloc")))] + type SerializeTupleVariant = Impossible; + #[cfg(any(feature = "std", feature = "alloc"))] + type SerializeTupleVariant = SerializeTupleVariantAsMapValue; + + #[cfg(not(any(feature = "std", feature = "alloc")))] + type SerializeStructVariant = Impossible; + #[cfg(any(feature = "std", feature = "alloc"))] + type SerializeStructVariant = SerializeStructVariantAsMapValue; + + fn serialize_bool(self, _: bool) -> Result { + Err(self.bad_type(Unsupported::Boolean)) + } + + fn serialize_i8(self, _: i8) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_i16(self, _: i16) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_i32(self, _: i32) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_i64(self, _: i64) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_u8(self, _: u8) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_u16(self, _: u16) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_u32(self, _: u32) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_u64(self, _: u64) -> Result { + Err(self.bad_type(Unsupported::Integer)) + } + + fn serialize_f32(self, _: f32) -> Result { + Err(self.bad_type(Unsupported::Float)) + } + + fn serialize_f64(self, _: f64) -> Result { + Err(self.bad_type(Unsupported::Float)) + } + + fn serialize_char(self, _: char) -> Result { + Err(self.bad_type(Unsupported::Char)) + } + + fn serialize_str(self, _: &str) -> Result { + Err(self.bad_type(Unsupported::String)) + } + + fn serialize_bytes(self, _: &[u8]) -> Result { + Err(self.bad_type(Unsupported::ByteArray)) + } + + fn serialize_none(self) -> Result { + Err(self.bad_type(Unsupported::Optional)) + } + + fn serialize_some(self, _: &T) -> Result + where + T: Serialize, + { + Err(self.bad_type(Unsupported::Optional)) + } + + fn serialize_unit(self) -> Result { + Err(self.bad_type(Unsupported::Unit)) + } + + fn serialize_unit_struct(self, _: &'static str) -> Result { + let mut map = try!(self.delegate.serialize_map(Some(1))); + try!(map.serialize_entry(self.tag, self.variant_name)); + map.end() + } + + fn serialize_unit_variant( + self, + _: &'static str, + _: u32, + inner_variant: &'static str, + ) -> Result { + let mut map = try!(self.delegate.serialize_map(Some(2))); + try!(map.serialize_entry(self.tag, self.variant_name)); + try!(map.serialize_entry(inner_variant, &())); + map.end() + } + + fn serialize_newtype_struct( + self, + _: &'static str, + value: &T, + ) -> Result + where + T: Serialize, + { + value.serialize(self) + } + + fn serialize_newtype_variant( + self, + _: &'static str, + _: u32, + inner_variant: &'static str, + inner_value: &T, + ) -> Result + where + T: Serialize, + { + let mut map = try!(self.delegate.serialize_map(Some(2))); + try!(map.serialize_entry(self.tag, self.variant_name)); + try!(map.serialize_entry(inner_variant, inner_value)); + map.end() + } + + fn serialize_seq(self, _: Option) -> Result { + Err(self.bad_type(Unsupported::Sequence)) + } + + fn serialize_tuple(self, _: usize) -> Result { + Err(self.bad_type(Unsupported::Tuple)) + } + + fn serialize_tuple_struct( + self, + _: &'static str, + _: usize, + ) -> Result { + Err(self.bad_type(Unsupported::TupleStruct)) + } + + #[cfg(not(any(feature = "std", feature = "alloc")))] + fn serialize_tuple_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + _: usize, + ) -> Result { + // Lack of push-based serialization means we need to buffer the content + // of the tuple variant, so it requires std. + Err(self.bad_type(Unsupported::Enum)) + } + + #[cfg(any(feature = "std", feature = "alloc"))] + fn serialize_tuple_variant( + self, + _: &'static str, + _: u32, + inner_variant: &'static str, + len: usize, + ) -> Result { + let mut map = try!(self.delegate.serialize_map(Some(2))); + try!(map.serialize_entry(self.tag, self.variant_name)); + try!(map.serialize_key(inner_variant)); + Ok(SerializeTupleVariantAsMapValue::new( + map, + inner_variant, + len, + )) + } + + fn serialize_map(self, len: Option) -> Result { + let mut map = try!(self.delegate.serialize_map(len.map(|len| len + 1))); + try!(map.serialize_entry(self.tag, self.variant_name)); + Ok(map) + } + + fn serialize_struct( + self, + name: &'static str, + len: usize, + ) -> Result { + let mut state = try!(self.delegate.serialize_struct(name, len + 1)); + try!(state.serialize_field(self.tag, self.variant_name)); + Ok(state) + } + + #[cfg(not(any(feature = "std", feature = "alloc")))] + fn serialize_struct_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + _: usize, + ) -> Result { + // Lack of push-based serialization means we need to buffer the content + // of the struct variant, so it requires std. + Err(self.bad_type(Unsupported::Enum)) + } + + #[cfg(any(feature = "std", feature = "alloc"))] + fn serialize_struct_variant( + self, + _: &'static str, + _: u32, + inner_variant: &'static str, + len: usize, + ) -> Result { + let mut map = try!(self.delegate.serialize_map(Some(2))); + try!(map.serialize_entry(self.tag, self.variant_name)); + try!(map.serialize_key(inner_variant)); + Ok(SerializeStructVariantAsMapValue::new( + map, + inner_variant, + len, + )) + } + + #[cfg(not(any(feature = "std", feature = "alloc")))] + fn collect_str(self, _: &T) -> Result + where + T: Display, + { + Err(self.bad_type(Unsupported::String)) + } +} + +/// Used only by Serde doc tests. Not public API. +#[doc(hidden)] +#[derive(Debug)] +pub struct Error; + +impl ser::Error for Error { + fn custom(_: T) -> Self + where + T: Display, + { + unimplemented!() + } +} + +#[cfg(feature = "std")] +impl error::Error for Error { + fn description(&self) -> &str { + unimplemented!() + } +} + +impl Display for Error { + fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { + unimplemented!() + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +mod content { + use lib::*; + + use ser::{self, Serialize, Serializer}; + + pub struct SerializeTupleVariantAsMapValue { + map: M, + name: &'static str, + fields: Vec, + } + + impl SerializeTupleVariantAsMapValue { + pub fn new(map: M, name: &'static str, len: usize) -> Self { + SerializeTupleVariantAsMapValue { + map: map, + name: name, + fields: Vec::with_capacity(len), + } + } + } + + impl ser::SerializeTupleVariant for SerializeTupleVariantAsMapValue + where + M: ser::SerializeMap, + { + type Ok = M::Ok; + type Error = M::Error; + + fn serialize_field(&mut self, value: &T) -> Result<(), M::Error> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push(value); + Ok(()) + } + + fn end(mut self) -> Result { + try!(self + .map + .serialize_value(&Content::TupleStruct(self.name, self.fields))); + self.map.end() + } + } + + pub struct SerializeStructVariantAsMapValue { + map: M, + name: &'static str, + fields: Vec<(&'static str, Content)>, + } + + impl SerializeStructVariantAsMapValue { + pub fn new(map: M, name: &'static str, len: usize) -> Self { + SerializeStructVariantAsMapValue { + map: map, + name: name, + fields: Vec::with_capacity(len), + } + } + } + + impl ser::SerializeStructVariant for SerializeStructVariantAsMapValue + where + M: ser::SerializeMap, + { + type Ok = M::Ok; + type Error = M::Error; + + fn serialize_field( + &mut self, + key: &'static str, + value: &T, + ) -> Result<(), M::Error> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push((key, value)); + Ok(()) + } + + fn end(mut self) -> Result { + try!(self + .map + .serialize_value(&Content::Struct(self.name, self.fields))); + self.map.end() + } + } + + #[derive(Debug)] + pub enum Content { + Bool(bool), + + U8(u8), + U16(u16), + U32(u32), + U64(u64), + + I8(i8), + I16(i16), + I32(i32), + I64(i64), + + F32(f32), + F64(f64), + + Char(char), + String(String), + Bytes(Vec), + + None, + Some(Box), + + Unit, + UnitStruct(&'static str), + UnitVariant(&'static str, u32, &'static str), + NewtypeStruct(&'static str, Box), + NewtypeVariant(&'static str, u32, &'static str, Box), + + Seq(Vec), + Tuple(Vec), + TupleStruct(&'static str, Vec), + TupleVariant(&'static str, u32, &'static str, Vec), + Map(Vec<(Content, Content)>), + Struct(&'static str, Vec<(&'static str, Content)>), + StructVariant( + &'static str, + u32, + &'static str, + Vec<(&'static str, Content)>, + ), + } + + impl Serialize for Content { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Content::Bool(b) => serializer.serialize_bool(b), + Content::U8(u) => serializer.serialize_u8(u), + Content::U16(u) => serializer.serialize_u16(u), + Content::U32(u) => serializer.serialize_u32(u), + Content::U64(u) => serializer.serialize_u64(u), + Content::I8(i) => serializer.serialize_i8(i), + Content::I16(i) => serializer.serialize_i16(i), + Content::I32(i) => serializer.serialize_i32(i), + Content::I64(i) => serializer.serialize_i64(i), + Content::F32(f) => serializer.serialize_f32(f), + Content::F64(f) => serializer.serialize_f64(f), + Content::Char(c) => serializer.serialize_char(c), + Content::String(ref s) => serializer.serialize_str(s), + Content::Bytes(ref b) => serializer.serialize_bytes(b), + Content::None => serializer.serialize_none(), + Content::Some(ref c) => serializer.serialize_some(&**c), + Content::Unit => serializer.serialize_unit(), + Content::UnitStruct(n) => serializer.serialize_unit_struct(n), + Content::UnitVariant(n, i, v) => serializer.serialize_unit_variant(n, i, v), + Content::NewtypeStruct(n, ref c) => serializer.serialize_newtype_struct(n, &**c), + Content::NewtypeVariant(n, i, v, ref c) => { + serializer.serialize_newtype_variant(n, i, v, &**c) + } + Content::Seq(ref elements) => elements.serialize(serializer), + Content::Tuple(ref elements) => { + use ser::SerializeTuple; + let mut tuple = try!(serializer.serialize_tuple(elements.len())); + for e in elements { + try!(tuple.serialize_element(e)); + } + tuple.end() + } + Content::TupleStruct(n, ref fields) => { + use ser::SerializeTupleStruct; + let mut ts = try!(serializer.serialize_tuple_struct(n, fields.len())); + for f in fields { + try!(ts.serialize_field(f)); + } + ts.end() + } + Content::TupleVariant(n, i, v, ref fields) => { + use ser::SerializeTupleVariant; + let mut tv = try!(serializer.serialize_tuple_variant(n, i, v, fields.len())); + for f in fields { + try!(tv.serialize_field(f)); + } + tv.end() + } + Content::Map(ref entries) => { + use ser::SerializeMap; + let mut map = try!(serializer.serialize_map(Some(entries.len()))); + for &(ref k, ref v) in entries { + try!(map.serialize_entry(k, v)); + } + map.end() + } + Content::Struct(n, ref fields) => { + use ser::SerializeStruct; + let mut s = try!(serializer.serialize_struct(n, fields.len())); + for &(k, ref v) in fields { + try!(s.serialize_field(k, v)); + } + s.end() + } + Content::StructVariant(n, i, v, ref fields) => { + use ser::SerializeStructVariant; + let mut sv = try!(serializer.serialize_struct_variant(n, i, v, fields.len())); + for &(k, ref v) in fields { + try!(sv.serialize_field(k, v)); + } + sv.end() + } + } + } + } + + pub struct ContentSerializer { + error: PhantomData, + } + + impl ContentSerializer { + pub fn new() -> Self { + ContentSerializer { error: PhantomData } + } + } + + impl Serializer for ContentSerializer + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + type SerializeSeq = SerializeSeq; + type SerializeTuple = SerializeTuple; + type SerializeTupleStruct = SerializeTupleStruct; + type SerializeTupleVariant = SerializeTupleVariant; + type SerializeMap = SerializeMap; + type SerializeStruct = SerializeStruct; + type SerializeStructVariant = SerializeStructVariant; + + fn serialize_bool(self, v: bool) -> Result { + Ok(Content::Bool(v)) + } + + fn serialize_i8(self, v: i8) -> Result { + Ok(Content::I8(v)) + } + + fn serialize_i16(self, v: i16) -> Result { + Ok(Content::I16(v)) + } + + fn serialize_i32(self, v: i32) -> Result { + Ok(Content::I32(v)) + } + + fn serialize_i64(self, v: i64) -> Result { + Ok(Content::I64(v)) + } + + fn serialize_u8(self, v: u8) -> Result { + Ok(Content::U8(v)) + } + + fn serialize_u16(self, v: u16) -> Result { + Ok(Content::U16(v)) + } + + fn serialize_u32(self, v: u32) -> Result { + Ok(Content::U32(v)) + } + + fn serialize_u64(self, v: u64) -> Result { + Ok(Content::U64(v)) + } + + fn serialize_f32(self, v: f32) -> Result { + Ok(Content::F32(v)) + } + + fn serialize_f64(self, v: f64) -> Result { + Ok(Content::F64(v)) + } + + fn serialize_char(self, v: char) -> Result { + Ok(Content::Char(v)) + } + + fn serialize_str(self, value: &str) -> Result { + Ok(Content::String(value.to_owned())) + } + + fn serialize_bytes(self, value: &[u8]) -> Result { + Ok(Content::Bytes(value.to_owned())) + } + + fn serialize_none(self) -> Result { + Ok(Content::None) + } + + fn serialize_some(self, value: &T) -> Result + where + T: Serialize, + { + Ok(Content::Some(Box::new(try!(value.serialize(self))))) + } + + fn serialize_unit(self) -> Result { + Ok(Content::Unit) + } + + fn serialize_unit_struct(self, name: &'static str) -> Result { + Ok(Content::UnitStruct(name)) + } + + fn serialize_unit_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + ) -> Result { + Ok(Content::UnitVariant(name, variant_index, variant)) + } + + fn serialize_newtype_struct( + self, + name: &'static str, + value: &T, + ) -> Result + where + T: Serialize, + { + Ok(Content::NewtypeStruct( + name, + Box::new(try!(value.serialize(self))), + )) + } + + fn serialize_newtype_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + value: &T, + ) -> Result + where + T: Serialize, + { + Ok(Content::NewtypeVariant( + name, + variant_index, + variant, + Box::new(try!(value.serialize(self))), + )) + } + + fn serialize_seq(self, len: Option) -> Result { + Ok(SerializeSeq { + elements: Vec::with_capacity(len.unwrap_or(0)), + error: PhantomData, + }) + } + + fn serialize_tuple(self, len: usize) -> Result { + Ok(SerializeTuple { + elements: Vec::with_capacity(len), + error: PhantomData, + }) + } + + fn serialize_tuple_struct( + self, + name: &'static str, + len: usize, + ) -> Result { + Ok(SerializeTupleStruct { + name: name, + fields: Vec::with_capacity(len), + error: PhantomData, + }) + } + + fn serialize_tuple_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + len: usize, + ) -> Result { + Ok(SerializeTupleVariant { + name: name, + variant_index: variant_index, + variant: variant, + fields: Vec::with_capacity(len), + error: PhantomData, + }) + } + + fn serialize_map(self, len: Option) -> Result { + Ok(SerializeMap { + entries: Vec::with_capacity(len.unwrap_or(0)), + key: None, + error: PhantomData, + }) + } + + fn serialize_struct( + self, + name: &'static str, + len: usize, + ) -> Result { + Ok(SerializeStruct { + name: name, + fields: Vec::with_capacity(len), + error: PhantomData, + }) + } + + fn serialize_struct_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + len: usize, + ) -> Result { + Ok(SerializeStructVariant { + name: name, + variant_index: variant_index, + variant: variant, + fields: Vec::with_capacity(len), + error: PhantomData, + }) + } + } + + pub struct SerializeSeq { + elements: Vec, + error: PhantomData, + } + + impl ser::SerializeSeq for SerializeSeq + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_element(&mut self, value: &T) -> Result<(), E> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.elements.push(value); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::Seq(self.elements)) + } + } + + pub struct SerializeTuple { + elements: Vec, + error: PhantomData, + } + + impl ser::SerializeTuple for SerializeTuple + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_element(&mut self, value: &T) -> Result<(), E> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.elements.push(value); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::Tuple(self.elements)) + } + } + + pub struct SerializeTupleStruct { + name: &'static str, + fields: Vec, + error: PhantomData, + } + + impl ser::SerializeTupleStruct for SerializeTupleStruct + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_field(&mut self, value: &T) -> Result<(), E> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push(value); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::TupleStruct(self.name, self.fields)) + } + } + + pub struct SerializeTupleVariant { + name: &'static str, + variant_index: u32, + variant: &'static str, + fields: Vec, + error: PhantomData, + } + + impl ser::SerializeTupleVariant for SerializeTupleVariant + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_field(&mut self, value: &T) -> Result<(), E> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push(value); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::TupleVariant( + self.name, + self.variant_index, + self.variant, + self.fields, + )) + } + } + + pub struct SerializeMap { + entries: Vec<(Content, Content)>, + key: Option, + error: PhantomData, + } + + impl ser::SerializeMap for SerializeMap + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_key(&mut self, key: &T) -> Result<(), E> + where + T: Serialize, + { + let key = try!(key.serialize(ContentSerializer::::new())); + self.key = Some(key); + Ok(()) + } + + fn serialize_value(&mut self, value: &T) -> Result<(), E> + where + T: Serialize, + { + let key = self + .key + .take() + .expect("serialize_value called before serialize_key"); + let value = try!(value.serialize(ContentSerializer::::new())); + self.entries.push((key, value)); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::Map(self.entries)) + } + + fn serialize_entry(&mut self, key: &K, value: &V) -> Result<(), E> + where + K: Serialize, + V: Serialize, + { + let key = try!(key.serialize(ContentSerializer::::new())); + let value = try!(value.serialize(ContentSerializer::::new())); + self.entries.push((key, value)); + Ok(()) + } + } + + pub struct SerializeStruct { + name: &'static str, + fields: Vec<(&'static str, Content)>, + error: PhantomData, + } + + impl ser::SerializeStruct for SerializeStruct + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), E> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push((key, value)); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::Struct(self.name, self.fields)) + } + } + + pub struct SerializeStructVariant { + name: &'static str, + variant_index: u32, + variant: &'static str, + fields: Vec<(&'static str, Content)>, + error: PhantomData, + } + + impl ser::SerializeStructVariant for SerializeStructVariant + where + E: ser::Error, + { + type Ok = Content; + type Error = E; + + fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), E> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push((key, value)); + Ok(()) + } + + fn end(self) -> Result { + Ok(Content::StructVariant( + self.name, + self.variant_index, + self.variant, + self.fields, + )) + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatMapSerializer<'a, M: 'a>(pub &'a mut M); + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, M> FlatMapSerializer<'a, M> +where + M: SerializeMap + 'a, +{ + fn bad_type(what: Unsupported) -> M::Error { + ser::Error::custom(format_args!( + "can only flatten structs and maps (got {})", + what + )) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, M> Serializer for FlatMapSerializer<'a, M> +where + M: SerializeMap + 'a, +{ + type Ok = (); + type Error = M::Error; + + type SerializeSeq = Impossible; + type SerializeTuple = Impossible; + type SerializeTupleStruct = Impossible; + type SerializeMap = FlatMapSerializeMap<'a, M>; + type SerializeStruct = FlatMapSerializeStruct<'a, M>; + type SerializeTupleVariant = Impossible; + type SerializeStructVariant = FlatMapSerializeStructVariantAsMapValue<'a, M>; + + fn serialize_bool(self, _: bool) -> Result { + Err(Self::bad_type(Unsupported::Boolean)) + } + + fn serialize_i8(self, _: i8) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_i16(self, _: i16) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_i32(self, _: i32) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_i64(self, _: i64) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_u8(self, _: u8) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_u16(self, _: u16) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_u32(self, _: u32) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_u64(self, _: u64) -> Result { + Err(Self::bad_type(Unsupported::Integer)) + } + + fn serialize_f32(self, _: f32) -> Result { + Err(Self::bad_type(Unsupported::Float)) + } + + fn serialize_f64(self, _: f64) -> Result { + Err(Self::bad_type(Unsupported::Float)) + } + + fn serialize_char(self, _: char) -> Result { + Err(Self::bad_type(Unsupported::Char)) + } + + fn serialize_str(self, _: &str) -> Result { + Err(Self::bad_type(Unsupported::String)) + } + + fn serialize_bytes(self, _: &[u8]) -> Result { + Err(Self::bad_type(Unsupported::ByteArray)) + } + + fn serialize_none(self) -> Result { + Ok(()) + } + + fn serialize_some(self, value: &T) -> Result + where + T: Serialize, + { + value.serialize(self) + } + + fn serialize_unit(self) -> Result { + Err(Self::bad_type(Unsupported::Unit)) + } + + fn serialize_unit_struct(self, _: &'static str) -> Result { + Err(Self::bad_type(Unsupported::UnitStruct)) + } + + fn serialize_unit_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + ) -> Result { + Err(Self::bad_type(Unsupported::Enum)) + } + + fn serialize_newtype_struct( + self, + _: &'static str, + value: &T, + ) -> Result + where + T: Serialize, + { + value.serialize(self) + } + + fn serialize_newtype_variant( + self, + _: &'static str, + _: u32, + variant: &'static str, + value: &T, + ) -> Result + where + T: Serialize, + { + try!(self.0.serialize_key(variant)); + self.0.serialize_value(value) + } + + fn serialize_seq(self, _: Option) -> Result { + Err(Self::bad_type(Unsupported::Sequence)) + } + + fn serialize_tuple(self, _: usize) -> Result { + Err(Self::bad_type(Unsupported::Tuple)) + } + + fn serialize_tuple_struct( + self, + _: &'static str, + _: usize, + ) -> Result { + Err(Self::bad_type(Unsupported::TupleStruct)) + } + + fn serialize_tuple_variant( + self, + _: &'static str, + _: u32, + _: &'static str, + _: usize, + ) -> Result { + Err(Self::bad_type(Unsupported::Enum)) + } + + fn serialize_map(self, _: Option) -> Result { + Ok(FlatMapSerializeMap(self.0)) + } + + fn serialize_struct( + self, + _: &'static str, + _: usize, + ) -> Result { + Ok(FlatMapSerializeStruct(self.0)) + } + + fn serialize_struct_variant( + self, + _: &'static str, + _: u32, + inner_variant: &'static str, + _: usize, + ) -> Result { + try!(self.0.serialize_key(inner_variant)); + Ok(FlatMapSerializeStructVariantAsMapValue::new( + self.0, + inner_variant, + )) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatMapSerializeMap<'a, M: 'a>(&'a mut M); + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, M> ser::SerializeMap for FlatMapSerializeMap<'a, M> +where + M: SerializeMap + 'a, +{ + type Ok = (); + type Error = M::Error; + + fn serialize_key(&mut self, key: &T) -> Result<(), Self::Error> + where + T: Serialize, + { + self.0.serialize_key(key) + } + + fn serialize_value(&mut self, value: &T) -> Result<(), Self::Error> + where + T: Serialize, + { + self.0.serialize_value(value) + } + + fn end(self) -> Result<(), Self::Error> { + Ok(()) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatMapSerializeStruct<'a, M: 'a>(&'a mut M); + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, M> ser::SerializeStruct for FlatMapSerializeStruct<'a, M> +where + M: SerializeMap + 'a, +{ + type Ok = (); + type Error = M::Error; + + fn serialize_field( + &mut self, + key: &'static str, + value: &T, + ) -> Result<(), Self::Error> + where + T: Serialize, + { + self.0.serialize_entry(key, value) + } + + fn end(self) -> Result<(), Self::Error> { + Ok(()) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +pub struct FlatMapSerializeStructVariantAsMapValue<'a, M: 'a> { + map: &'a mut M, + name: &'static str, + fields: Vec<(&'static str, Content)>, +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, M> FlatMapSerializeStructVariantAsMapValue<'a, M> +where + M: SerializeMap + 'a, +{ + fn new(map: &'a mut M, name: &'static str) -> FlatMapSerializeStructVariantAsMapValue<'a, M> { + FlatMapSerializeStructVariantAsMapValue { + map: map, + name: name, + fields: Vec::new(), + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl<'a, M> ser::SerializeStructVariant for FlatMapSerializeStructVariantAsMapValue<'a, M> +where + M: SerializeMap + 'a, +{ + type Ok = (); + type Error = M::Error; + + fn serialize_field( + &mut self, + key: &'static str, + value: &T, + ) -> Result<(), Self::Error> + where + T: Serialize, + { + let value = try!(value.serialize(ContentSerializer::::new())); + self.fields.push((key, value)); + Ok(()) + } + + fn end(self) -> Result<(), Self::Error> { + try!(self + .map + .serialize_value(&Content::Struct(self.name, self.fields))); + Ok(()) + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/ser/fmt.rs b/third_party/cargo/vendor/serde-1.0.110/src/ser/fmt.rs new file mode 100644 index 0000000..e7e09a1 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/ser/fmt.rs @@ -0,0 +1,174 @@ +use lib::*; +use ser::{Error, Impossible, Serialize, Serializer}; + +impl Error for fmt::Error { + fn custom(_msg: T) -> Self { + fmt::Error + } +} + +macro_rules! fmt_primitives { + ($($f:ident: $t:ty,)*) => { + $( + fn $f(self, v: $t) -> fmt::Result { + Display::fmt(&v, self) + } + )* + }; +} + +/// ```edition2018 +/// use serde::Serialize; +/// use std::fmt::{self, Display}; +/// +/// #[derive(Serialize)] +/// #[serde(rename_all = "kebab-case")] +/// pub enum MessageType { +/// StartRequest, +/// EndRequest, +/// } +/// +/// impl Display for MessageType { +/// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +/// self.serialize(f) +/// } +/// } +/// ``` +impl<'a, 'b> Serializer for &'a mut fmt::Formatter<'b> { + type Ok = (); + type Error = fmt::Error; + type SerializeSeq = Impossible<(), fmt::Error>; + type SerializeTuple = Impossible<(), fmt::Error>; + type SerializeTupleStruct = Impossible<(), fmt::Error>; + type SerializeTupleVariant = Impossible<(), fmt::Error>; + type SerializeMap = Impossible<(), fmt::Error>; + type SerializeStruct = Impossible<(), fmt::Error>; + type SerializeStructVariant = Impossible<(), fmt::Error>; + + fmt_primitives! { + serialize_bool: bool, + serialize_i8: i8, + serialize_i16: i16, + serialize_i32: i32, + serialize_i64: i64, + serialize_u8: u8, + serialize_u16: u16, + serialize_u32: u32, + serialize_u64: u64, + serialize_f32: f32, + serialize_f64: f64, + serialize_char: char, + serialize_str: &str, + serialize_unit_struct: &'static str, + } + + serde_if_integer128! { + fmt_primitives! { + serialize_i128: i128, + serialize_u128: u128, + } + } + + fn serialize_unit_variant( + self, + _name: &'static str, + _variant_index: u32, + variant: &'static str, + ) -> fmt::Result { + Display::fmt(variant, self) + } + + fn serialize_newtype_struct(self, _name: &'static str, value: &T) -> fmt::Result + where + T: Serialize, + { + Serialize::serialize(value, self) + } + + fn serialize_bytes(self, _v: &[u8]) -> fmt::Result { + Err(fmt::Error) + } + + fn serialize_none(self) -> fmt::Result { + Err(fmt::Error) + } + + fn serialize_some(self, _value: &T) -> fmt::Result + where + T: Serialize, + { + Err(fmt::Error) + } + + fn serialize_unit(self) -> fmt::Result { + Err(fmt::Error) + } + + fn serialize_newtype_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _value: &T, + ) -> fmt::Result + where + T: Serialize, + { + Err(fmt::Error) + } + + fn serialize_seq(self, _len: Option) -> Result { + Err(fmt::Error) + } + + fn serialize_tuple(self, _len: usize) -> Result { + Err(fmt::Error) + } + + fn serialize_tuple_struct( + self, + _name: &'static str, + _len: usize, + ) -> Result { + Err(fmt::Error) + } + + fn serialize_tuple_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { + Err(fmt::Error) + } + + fn serialize_map(self, _len: Option) -> Result { + Err(fmt::Error) + } + + fn serialize_struct( + self, + _name: &'static str, + _len: usize, + ) -> Result { + Err(fmt::Error) + } + + fn serialize_struct_variant( + self, + _name: &'static str, + _variant_index: u32, + _variant: &'static str, + _len: usize, + ) -> Result { + Err(fmt::Error) + } + + fn collect_str(self, value: &T) -> fmt::Result + where + T: Display, + { + Display::fmt(value, self) + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/ser/impls.rs b/third_party/cargo/vendor/serde-1.0.110/src/ser/impls.rs new file mode 100644 index 0000000..0dc8085 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/ser/impls.rs @@ -0,0 +1,883 @@ +use lib::*; + +use ser::{Error, Serialize, SerializeTuple, Serializer}; + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! primitive_impl { + ($ty:ident, $method:ident $($cast:tt)*) => { + impl Serialize for $ty { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.$method(*self $($cast)*) + } + } + } +} + +primitive_impl!(bool, serialize_bool); +primitive_impl!(isize, serialize_i64 as i64); +primitive_impl!(i8, serialize_i8); +primitive_impl!(i16, serialize_i16); +primitive_impl!(i32, serialize_i32); +primitive_impl!(i64, serialize_i64); +primitive_impl!(usize, serialize_u64 as u64); +primitive_impl!(u8, serialize_u8); +primitive_impl!(u16, serialize_u16); +primitive_impl!(u32, serialize_u32); +primitive_impl!(u64, serialize_u64); +primitive_impl!(f32, serialize_f32); +primitive_impl!(f64, serialize_f64); +primitive_impl!(char, serialize_char); + +serde_if_integer128! { + primitive_impl!(i128, serialize_i128); + primitive_impl!(u128, serialize_u128); +} + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for str { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(self) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +impl Serialize for String { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_str(self) + } +} + +impl<'a> Serialize for fmt::Arguments<'a> { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_str(self) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for CStr { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_bytes(self.to_bytes()) + } +} + +#[cfg(feature = "std")] +impl Serialize for CString { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_bytes(self.to_bytes()) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for Option +where + T: Serialize, +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Some(ref value) => serializer.serialize_some(value), + None => serializer.serialize_none(), + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for PhantomData { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_unit_struct("PhantomData") + } +} + +//////////////////////////////////////////////////////////////////////////////// + +// Does not require T: Serialize. +impl Serialize for [T; 0] { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + try!(serializer.serialize_tuple(0)).end() + } +} + +macro_rules! array_impls { + ($($len:tt)+) => { + $( + impl Serialize for [T; $len] + where + T: Serialize, + { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let mut seq = try!(serializer.serialize_tuple($len)); + for e in self { + try!(seq.serialize_element(e)); + } + seq.end() + } + } + )+ + } +} + +array_impls! { + 01 02 03 04 05 06 07 08 09 10 + 11 12 13 14 15 16 17 18 19 20 + 21 22 23 24 25 26 27 28 29 30 + 31 32 +} + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for [T] +where + T: Serialize, +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq(self) + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +macro_rules! seq_impl { + ($ty:ident < T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound:ident)* >) => { + impl Serialize for $ty + where + T: Serialize $(+ $tbound1 $(+ $tbound2)*)*, + $($typaram: $bound,)* + { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_seq(self) + } + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!(BinaryHeap); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!(BTreeSet); + +#[cfg(feature = "std")] +seq_impl!(HashSet); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!(LinkedList); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!(Vec); + +#[cfg(any(feature = "std", feature = "alloc"))] +seq_impl!(VecDeque); + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for Range +where + Idx: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use super::SerializeStruct; + let mut state = try!(serializer.serialize_struct("Range", 2)); + try!(state.serialize_field("start", &self.start)); + try!(state.serialize_field("end", &self.end)); + state.end() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(range_inclusive)] +impl Serialize for RangeInclusive +where + Idx: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use super::SerializeStruct; + let mut state = try!(serializer.serialize_struct("RangeInclusive", 2)); + try!(state.serialize_field("start", &self.start())); + try!(state.serialize_field("end", &self.end())); + state.end() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(ops_bound, collections_bound))] +impl Serialize for Bound +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Bound::Unbounded => serializer.serialize_unit_variant("Bound", 0, "Unbounded"), + Bound::Included(ref value) => { + serializer.serialize_newtype_variant("Bound", 1, "Included", value) + } + Bound::Excluded(ref value) => { + serializer.serialize_newtype_variant("Bound", 2, "Excluded", value) + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for () { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_unit() + } +} + +#[cfg(feature = "unstable")] +impl Serialize for ! { + fn serialize(&self, _serializer: S) -> Result + where + S: Serializer, + { + *self + } +} + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! tuple_impls { + ($($len:expr => ($($n:tt $name:ident)+))+) => { + $( + impl<$($name),+> Serialize for ($($name,)+) + where + $($name: Serialize,)+ + { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + let mut tuple = try!(serializer.serialize_tuple($len)); + $( + try!(tuple.serialize_element(&self.$n)); + )+ + tuple.end() + } + } + )+ + } +} + +tuple_impls! { + 1 => (0 T0) + 2 => (0 T0 1 T1) + 3 => (0 T0 1 T1 2 T2) + 4 => (0 T0 1 T1 2 T2 3 T3) + 5 => (0 T0 1 T1 2 T2 3 T3 4 T4) + 6 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5) + 7 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6) + 8 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7) + 9 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8) + 10 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9) + 11 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10) + 12 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11) + 13 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12) + 14 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13) + 15 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14) + 16 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14 15 T15) +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(feature = "std", feature = "alloc"))] +macro_rules! map_impl { + ($ty:ident < K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound:ident)* >) => { + impl Serialize for $ty + where + K: Serialize $(+ $kbound1 $(+ $kbound2)*)*, + V: Serialize, + $($typaram: $bound,)* + { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.collect_map(self) + } + } + } +} + +#[cfg(any(feature = "std", feature = "alloc"))] +map_impl!(BTreeMap); + +#[cfg(feature = "std")] +map_impl!(HashMap); + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! deref_impl { + ( + $(#[doc = $doc:tt])* + <$($desc:tt)+ + ) => { + $(#[doc = $doc])* + impl <$($desc)+ { + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + (**self).serialize(serializer) + } + } + }; +} + +deref_impl!(<'a, T: ?Sized> Serialize for &'a T where T: Serialize); +deref_impl!(<'a, T: ?Sized> Serialize for &'a mut T where T: Serialize); + +#[cfg(any(feature = "std", feature = "alloc"))] +deref_impl!( Serialize for Box where T: Serialize); + +#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] +deref_impl! { + /// This impl requires the [`"rc"`] Cargo feature of Serde. + /// + /// Serializing a data structure containing `Rc` will serialize a copy of + /// the contents of the `Rc` each time the `Rc` is referenced within the + /// data structure. Serialization will not attempt to deduplicate these + /// repeated data. + /// + /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc + Serialize for Rc where T: Serialize +} + +#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] +deref_impl! { + /// This impl requires the [`"rc"`] Cargo feature of Serde. + /// + /// Serializing a data structure containing `Arc` will serialize a copy of + /// the contents of the `Arc` each time the `Arc` is referenced within the + /// data structure. Serialization will not attempt to deduplicate these + /// repeated data. + /// + /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc + Serialize for Arc where T: Serialize +} + +#[cfg(any(feature = "std", feature = "alloc"))] +deref_impl!(<'a, T: ?Sized> Serialize for Cow<'a, T> where T: Serialize + ToOwned); + +//////////////////////////////////////////////////////////////////////////////// + +/// This impl requires the [`"rc"`] Cargo feature of Serde. +/// +/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc +#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] +impl Serialize for RcWeak +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.upgrade().serialize(serializer) + } +} + +/// This impl requires the [`"rc"`] Cargo feature of Serde. +/// +/// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc +#[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] +impl Serialize for ArcWeak +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.upgrade().serialize(serializer) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! nonzero_integers { + ( $( $T: ident, )+ ) => { + $( + #[cfg(num_nonzero)] + impl Serialize for num::$T { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.get().serialize(serializer) + } + } + )+ + } +} + +nonzero_integers! { + NonZeroU8, + NonZeroU16, + NonZeroU32, + NonZeroU64, + NonZeroUsize, +} + +#[cfg(num_nonzero_signed)] +nonzero_integers! { + NonZeroI8, + NonZeroI16, + NonZeroI32, + NonZeroI64, + NonZeroIsize, +} + +// Currently 128-bit integers do not work on Emscripten targets so we need an +// additional `#[cfg]` +serde_if_integer128! { + nonzero_integers! { + NonZeroU128, + } + + #[cfg(num_nonzero_signed)] + nonzero_integers! { + NonZeroI128, + } +} + +impl Serialize for Cell +where + T: Serialize + Copy, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.get().serialize(serializer) + } +} + +impl Serialize for RefCell +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self.try_borrow() { + Ok(value) => value.serialize(serializer), + Err(_) => Err(S::Error::custom("already mutably borrowed")), + } + } +} + +#[cfg(feature = "std")] +impl Serialize for Mutex +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self.lock() { + Ok(locked) => locked.serialize(serializer), + Err(_) => Err(S::Error::custom("lock poison error while serializing")), + } + } +} + +#[cfg(feature = "std")] +impl Serialize for RwLock +where + T: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self.read() { + Ok(locked) => locked.serialize(serializer), + Err(_) => Err(S::Error::custom("lock poison error while serializing")), + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +impl Serialize for Result +where + T: Serialize, + E: Serialize, +{ + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match *self { + Result::Ok(ref value) => serializer.serialize_newtype_variant("Result", 0, "Ok", value), + Result::Err(ref value) => { + serializer.serialize_newtype_variant("Result", 1, "Err", value) + } + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(any(core_duration, feature = "std"))] +impl Serialize for Duration { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use super::SerializeStruct; + let mut state = try!(serializer.serialize_struct("Duration", 2)); + try!(state.serialize_field("secs", &self.as_secs())); + try!(state.serialize_field("nanos", &self.subsec_nanos())); + state.end() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for SystemTime { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use super::SerializeStruct; + let duration_since_epoch = self + .duration_since(UNIX_EPOCH) + .map_err(|_| S::Error::custom("SystemTime must be later than UNIX_EPOCH"))?; + let mut state = try!(serializer.serialize_struct("SystemTime", 2)); + try!(state.serialize_field("secs_since_epoch", &duration_since_epoch.as_secs())); + try!(state.serialize_field("nanos_since_epoch", &duration_since_epoch.subsec_nanos())); + state.end() + } +} + +//////////////////////////////////////////////////////////////////////////////// + +/// Serialize a value that implements `Display` as a string, when that string is +/// statically known to never have more than a constant `MAX_LEN` bytes. +/// +/// Panics if the `Display` impl tries to write more than `MAX_LEN` bytes. +#[cfg(feature = "std")] +macro_rules! serialize_display_bounded_length { + ($value:expr, $max:expr, $serializer:expr) => {{ + let mut buffer = [0u8; $max]; + let remaining_len = { + let mut remaining = &mut buffer[..]; + write!(remaining, "{}", $value).unwrap(); + remaining.len() + }; + let written_len = buffer.len() - remaining_len; + let written = &buffer[..written_len]; + + // write! only provides fmt::Formatter to Display implementations, which + // has methods write_str and write_char but no method to write arbitrary + // bytes. Therefore `written` must be valid UTF-8. + let written_str = str::from_utf8(written).expect("must be valid UTF-8"); + $serializer.serialize_str(written_str) + }}; +} + +#[cfg(feature = "std")] +impl Serialize for net::IpAddr { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + if serializer.is_human_readable() { + match *self { + net::IpAddr::V4(ref a) => a.serialize(serializer), + net::IpAddr::V6(ref a) => a.serialize(serializer), + } + } else { + match *self { + net::IpAddr::V4(ref a) => { + serializer.serialize_newtype_variant("IpAddr", 0, "V4", a) + } + net::IpAddr::V6(ref a) => { + serializer.serialize_newtype_variant("IpAddr", 1, "V6", a) + } + } + } + } +} + +#[cfg(feature = "std")] +impl Serialize for net::Ipv4Addr { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + if serializer.is_human_readable() { + const MAX_LEN: usize = 15; + debug_assert_eq!(MAX_LEN, "101.102.103.104".len()); + serialize_display_bounded_length!(self, MAX_LEN, serializer) + } else { + self.octets().serialize(serializer) + } + } +} + +#[cfg(feature = "std")] +impl Serialize for net::Ipv6Addr { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + if serializer.is_human_readable() { + const MAX_LEN: usize = 39; + debug_assert_eq!(MAX_LEN, "1001:1002:1003:1004:1005:1006:1007:1008".len()); + serialize_display_bounded_length!(self, MAX_LEN, serializer) + } else { + self.octets().serialize(serializer) + } + } +} + +#[cfg(feature = "std")] +impl Serialize for net::SocketAddr { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + if serializer.is_human_readable() { + match *self { + net::SocketAddr::V4(ref addr) => addr.serialize(serializer), + net::SocketAddr::V6(ref addr) => addr.serialize(serializer), + } + } else { + match *self { + net::SocketAddr::V4(ref addr) => { + serializer.serialize_newtype_variant("SocketAddr", 0, "V4", addr) + } + net::SocketAddr::V6(ref addr) => { + serializer.serialize_newtype_variant("SocketAddr", 1, "V6", addr) + } + } + } + } +} + +#[cfg(feature = "std")] +impl Serialize for net::SocketAddrV4 { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + if serializer.is_human_readable() { + const MAX_LEN: usize = 21; + debug_assert_eq!(MAX_LEN, "101.102.103.104:65000".len()); + serialize_display_bounded_length!(self, MAX_LEN, serializer) + } else { + (self.ip(), self.port()).serialize(serializer) + } + } +} + +#[cfg(feature = "std")] +impl Serialize for net::SocketAddrV6 { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + if serializer.is_human_readable() { + const MAX_LEN: usize = 47; + debug_assert_eq!( + MAX_LEN, + "[1001:1002:1003:1004:1005:1006:1007:1008]:65000".len() + ); + serialize_display_bounded_length!(self, MAX_LEN, serializer) + } else { + (self.ip(), self.port()).serialize(serializer) + } + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for Path { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + match self.to_str() { + Some(s) => s.serialize(serializer), + None => Err(Error::custom("path contains invalid UTF-8 characters")), + } + } +} + +#[cfg(feature = "std")] +impl Serialize for PathBuf { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.as_path().serialize(serializer) + } +} + +#[cfg(all(feature = "std", any(unix, windows)))] +impl Serialize for OsStr { + #[cfg(unix)] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use std::os::unix::ffi::OsStrExt; + serializer.serialize_newtype_variant("OsString", 0, "Unix", self.as_bytes()) + } + + #[cfg(windows)] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use std::os::windows::ffi::OsStrExt; + let val = self.encode_wide().collect::>(); + serializer.serialize_newtype_variant("OsString", 1, "Windows", &val) + } +} + +#[cfg(all(feature = "std", any(unix, windows)))] +impl Serialize for OsString { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.as_os_str().serialize(serializer) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(feature = "std")] +impl Serialize for Wrapping +where + T: Serialize, +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.0.serialize(serializer) + } +} + +#[cfg(core_reverse)] +impl Serialize for Reverse +where + T: Serialize, +{ + #[inline] + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.0.serialize(serializer) + } +} + +//////////////////////////////////////////////////////////////////////////////// + +#[cfg(all(feature = "std", std_atomic))] +macro_rules! atomic_impl { + ($($ty:ident)*) => { + $( + impl Serialize for $ty { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + self.load(Ordering::SeqCst).serialize(serializer) + } + } + )* + } +} + +#[cfg(all(feature = "std", std_atomic))] +atomic_impl! { + AtomicBool + AtomicI8 AtomicI16 AtomicI32 AtomicIsize + AtomicU8 AtomicU16 AtomicU32 AtomicUsize +} + +#[cfg(all(feature = "std", std_atomic64))] +atomic_impl! { + AtomicI64 AtomicU64 +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/ser/impossible.rs b/third_party/cargo/vendor/serde-1.0.110/src/ser/impossible.rs new file mode 100644 index 0000000..90bab29 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/ser/impossible.rs @@ -0,0 +1,216 @@ +//! This module contains `Impossible` serializer and its implementations. + +use lib::*; + +use ser::{ + self, Serialize, SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant, + SerializeTuple, SerializeTupleStruct, SerializeTupleVariant, +}; + +/// Helper type for implementing a `Serializer` that does not support +/// serializing one of the compound types. +/// +/// This type cannot be instantiated, but implements every one of the traits +/// corresponding to the [`Serializer`] compound types: [`SerializeSeq`], +/// [`SerializeTuple`], [`SerializeTupleStruct`], [`SerializeTupleVariant`], +/// [`SerializeMap`], [`SerializeStruct`], and [`SerializeStructVariant`]. +/// +/// ```edition2018 +/// # use serde::ser::{Serializer, Impossible}; +/// # use serde::private::ser::Error; +/// # +/// # struct MySerializer; +/// # +/// impl Serializer for MySerializer { +/// type Ok = (); +/// type Error = Error; +/// +/// type SerializeSeq = Impossible<(), Error>; +/// /* other associated types */ +/// +/// /// This data format does not support serializing sequences. +/// fn serialize_seq(self, +/// len: Option) +/// -> Result { +/// // Given Impossible cannot be instantiated, the only +/// // thing we can do here is to return an error. +/// # stringify! { +/// Err(...) +/// # }; +/// # unimplemented!() +/// } +/// +/// /* other Serializer methods */ +/// # serde::__serialize_unimplemented! { +/// # bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str bytes none some +/// # unit unit_struct unit_variant newtype_struct newtype_variant +/// # tuple tuple_struct tuple_variant map struct struct_variant +/// # } +/// } +/// ``` +/// +/// [`Serializer`]: trait.Serializer.html +/// [`SerializeSeq`]: trait.SerializeSeq.html +/// [`SerializeTuple`]: trait.SerializeTuple.html +/// [`SerializeTupleStruct`]: trait.SerializeTupleStruct.html +/// [`SerializeTupleVariant`]: trait.SerializeTupleVariant.html +/// [`SerializeMap`]: trait.SerializeMap.html +/// [`SerializeStruct`]: trait.SerializeStruct.html +/// [`SerializeStructVariant`]: trait.SerializeStructVariant.html +pub struct Impossible { + void: Void, + ok: PhantomData, + error: PhantomData, +} + +enum Void {} + +impl SerializeSeq for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_element(&mut self, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} + +impl SerializeTuple for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_element(&mut self, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} + +impl SerializeTupleStruct for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_field(&mut self, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} + +impl SerializeTupleVariant for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_field(&mut self, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} + +impl SerializeMap for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_key(&mut self, key: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = key; + match self.void {} + } + + fn serialize_value(&mut self, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} + +impl SerializeStruct for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = key; + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} + +impl SerializeStructVariant for Impossible +where + Error: ser::Error, +{ + type Ok = Ok; + type Error = Error; + + fn serialize_field(&mut self, key: &'static str, value: &T) -> Result<(), Error> + where + T: Serialize, + { + let _ = key; + let _ = value; + match self.void {} + } + + fn end(self) -> Result { + match self.void {} + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/ser/mod.rs b/third_party/cargo/vendor/serde-1.0.110/src/ser/mod.rs new file mode 100644 index 0000000..8b57c02 --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/ser/mod.rs @@ -0,0 +1,1993 @@ +//! Generic data structure serialization framework. +//! +//! The two most important traits in this module are [`Serialize`] and +//! [`Serializer`]. +//! +//! - **A type that implements `Serialize` is a data structure** that can be +//! serialized to any data format supported by Serde, and conversely +//! - **A type that implements `Serializer` is a data format** that can +//! serialize any data structure supported by Serde. +//! +//! # The Serialize trait +//! +//! Serde provides [`Serialize`] implementations for many Rust primitive and +//! standard library types. The complete list is below. All of these can be +//! serialized using Serde out of the box. +//! +//! Additionally, Serde provides a procedural macro called [`serde_derive`] to +//! automatically generate [`Serialize`] implementations for structs and enums +//! in your program. See the [derive section of the manual] for how to use this. +//! +//! In rare cases it may be necessary to implement [`Serialize`] manually for +//! some type in your program. See the [Implementing `Serialize`] section of the +//! manual for more about this. +//! +//! Third-party crates may provide [`Serialize`] implementations for types that +//! they expose. For example the [`linked-hash-map`] crate provides a +//! [`LinkedHashMap`] type that is serializable by Serde because the crate +//! provides an implementation of [`Serialize`] for it. +//! +//! # The Serializer trait +//! +//! [`Serializer`] implementations are provided by third-party crates, for +//! example [`serde_json`], [`serde_yaml`] and [`bincode`]. +//! +//! A partial list of well-maintained formats is given on the [Serde +//! website][data formats]. +//! +//! # Implementations of Serialize provided by Serde +//! +//! - **Primitive types**: +//! - bool +//! - i8, i16, i32, i64, i128, isize +//! - u8, u16, u32, u64, u128, usize +//! - f32, f64 +//! - char +//! - str +//! - &T and &mut T +//! - **Compound types**: +//! - \[T\] +//! - \[T; 0\] through \[T; 32\] +//! - tuples up to size 16 +//! - **Common standard library types**: +//! - String +//! - Option\ +//! - Result\ +//! - PhantomData\ +//! - **Wrapper types**: +//! - Box\ +//! - Cow\<'a, T\> +//! - Cell\ +//! - RefCell\ +//! - Mutex\ +//! - RwLock\ +//! - Rc\ *(if* features = ["rc"] *is enabled)* +//! - Arc\ *(if* features = ["rc"] *is enabled)* +//! - **Collection types**: +//! - BTreeMap\ +//! - BTreeSet\ +//! - BinaryHeap\ +//! - HashMap\ +//! - HashSet\ +//! - LinkedList\ +//! - VecDeque\ +//! - Vec\ +//! - **FFI types**: +//! - CStr +//! - CString +//! - OsStr +//! - OsString +//! - **Miscellaneous standard library types**: +//! - Duration +//! - SystemTime +//! - Path +//! - PathBuf +//! - Range\ +//! - RangeInclusive\ +//! - Bound\ +//! - num::NonZero* +//! - `!` *(unstable)* +//! - **Net types**: +//! - IpAddr +//! - Ipv4Addr +//! - Ipv6Addr +//! - SocketAddr +//! - SocketAddrV4 +//! - SocketAddrV6 +//! +//! [Implementing `Serialize`]: https://serde.rs/impl-serialize.html +//! [`LinkedHashMap`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html +//! [`Serialize`]: ../trait.Serialize.html +//! [`Serializer`]: ../trait.Serializer.html +//! [`bincode`]: https://github.com/TyOverby/bincode +//! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map +//! [`serde_derive`]: https://crates.io/crates/serde_derive +//! [`serde_json`]: https://github.com/serde-rs/json +//! [`serde_yaml`]: https://github.com/dtolnay/serde-yaml +//! [derive section of the manual]: https://serde.rs/derive.html +//! [data formats]: https://serde.rs/#data-formats + +use lib::*; + +mod fmt; +mod impls; +mod impossible; + +pub use self::impossible::Impossible; + +#[cfg(feature = "std")] +#[doc(no_inline)] +pub use std::error::Error as StdError; +#[cfg(not(feature = "std"))] +#[doc(no_inline)] +pub use std_error::Error as StdError; + +//////////////////////////////////////////////////////////////////////////////// + +macro_rules! declare_error_trait { + (Error: Sized $(+ $($supertrait:ident)::+)*) => { + /// Trait used by `Serialize` implementations to generically construct + /// errors belonging to the `Serializer` against which they are + /// currently running. + /// + /// # Example implementation + /// + /// The [example data format] presented on the website shows an error + /// type appropriate for a basic JSON data format. + /// + /// [example data format]: https://serde.rs/data-format.html + pub trait Error: Sized $(+ $($supertrait)::+)* { + /// Used when a [`Serialize`] implementation encounters any error + /// while serializing a type. + /// + /// The message should not be capitalized and should not end with a + /// period. + /// + /// For example, a filesystem [`Path`] may refuse to serialize + /// itself if it contains invalid UTF-8 data. + /// + /// ```edition2018 + /// # struct Path; + /// # + /// # impl Path { + /// # fn to_str(&self) -> Option<&str> { + /// # unimplemented!() + /// # } + /// # } + /// # + /// use serde::ser::{self, Serialize, Serializer}; + /// + /// impl Serialize for Path { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match self.to_str() { + /// Some(s) => serializer.serialize_str(s), + /// None => Err(ser::Error::custom("path contains invalid UTF-8 characters")), + /// } + /// } + /// } + /// ``` + /// + /// [`Path`]: https://doc.rust-lang.org/std/path/struct.Path.html + /// [`Serialize`]: ../trait.Serialize.html + fn custom(msg: T) -> Self + where + T: Display; + } + } +} + +#[cfg(feature = "std")] +declare_error_trait!(Error: Sized + StdError); + +#[cfg(not(feature = "std"))] +declare_error_trait!(Error: Sized + Debug + Display); + +//////////////////////////////////////////////////////////////////////////////// + +/// A **data structure** that can be serialized into any data format supported +/// by Serde. +/// +/// Serde provides `Serialize` implementations for many Rust primitive and +/// standard library types. The complete list is [here][ser]. All of these can +/// be serialized using Serde out of the box. +/// +/// Additionally, Serde provides a procedural macro called [`serde_derive`] to +/// automatically generate `Serialize` implementations for structs and enums in +/// your program. See the [derive section of the manual] for how to use this. +/// +/// In rare cases it may be necessary to implement `Serialize` manually for some +/// type in your program. See the [Implementing `Serialize`] section of the +/// manual for more about this. +/// +/// Third-party crates may provide `Serialize` implementations for types that +/// they expose. For example the [`linked-hash-map`] crate provides a +/// [`LinkedHashMap`] type that is serializable by Serde because the crate +/// provides an implementation of `Serialize` for it. +/// +/// [Implementing `Serialize`]: https://serde.rs/impl-serialize.html +/// [`LinkedHashMap`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html +/// [`linked-hash-map`]: https://crates.io/crates/linked-hash-map +/// [`serde_derive`]: https://crates.io/crates/serde_derive +/// [derive section of the manual]: https://serde.rs/derive.html +/// [ser]: https://docs.serde.rs/serde/ser/index.html +pub trait Serialize { + /// Serialize this value into the given Serde serializer. + /// + /// See the [Implementing `Serialize`] section of the manual for more + /// information about how to implement this method. + /// + /// ```edition2018 + /// use serde::ser::{Serialize, SerializeStruct, Serializer}; + /// + /// struct Person { + /// name: String, + /// age: u8, + /// phones: Vec, + /// } + /// + /// // This is what #[derive(Serialize)] would generate. + /// impl Serialize for Person { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut s = serializer.serialize_struct("Person", 3)?; + /// s.serialize_field("name", &self.name)?; + /// s.serialize_field("age", &self.age)?; + /// s.serialize_field("phones", &self.phones)?; + /// s.end() + /// } + /// } + /// ``` + /// + /// [Implementing `Serialize`]: https://serde.rs/impl-serialize.html + fn serialize(&self, serializer: S) -> Result + where + S: Serializer; +} + +//////////////////////////////////////////////////////////////////////////////// + +/// A **data format** that can serialize any data structure supported by Serde. +/// +/// The role of this trait is to define the serialization half of the [Serde +/// data model], which is a way to categorize every Rust data structure into one +/// of 29 possible types. Each method of the `Serializer` trait corresponds to +/// one of the types of the data model. +/// +/// Implementations of `Serialize` map themselves into this data model by +/// invoking exactly one of the `Serializer` methods. +/// +/// The types that make up the Serde data model are: +/// +/// - **14 primitive types** +/// - bool +/// - i8, i16, i32, i64, i128 +/// - u8, u16, u32, u64, u128 +/// - f32, f64 +/// - char +/// - **string** +/// - UTF-8 bytes with a length and no null terminator. +/// - When serializing, all strings are handled equally. When deserializing, +/// there are three flavors of strings: transient, owned, and borrowed. +/// - **byte array** - \[u8\] +/// - Similar to strings, during deserialization byte arrays can be +/// transient, owned, or borrowed. +/// - **option** +/// - Either none or some value. +/// - **unit** +/// - The type of `()` in Rust. It represents an anonymous value containing +/// no data. +/// - **unit_struct** +/// - For example `struct Unit` or `PhantomData`. It represents a named +/// value containing no data. +/// - **unit_variant** +/// - For example the `E::A` and `E::B` in `enum E { A, B }`. +/// - **newtype_struct** +/// - For example `struct Millimeters(u8)`. +/// - **newtype_variant** +/// - For example the `E::N` in `enum E { N(u8) }`. +/// - **seq** +/// - A variably sized heterogeneous sequence of values, for example +/// `Vec` or `HashSet`. When serializing, the length may or may not +/// be known before iterating through all the data. When deserializing, +/// the length is determined by looking at the serialized data. +/// - **tuple** +/// - A statically sized heterogeneous sequence of values for which the +/// length will be known at deserialization time without looking at the +/// serialized data, for example `(u8,)` or `(String, u64, Vec)` or +/// `[u64; 10]`. +/// - **tuple_struct** +/// - A named tuple, for example `struct Rgb(u8, u8, u8)`. +/// - **tuple_variant** +/// - For example the `E::T` in `enum E { T(u8, u8) }`. +/// - **map** +/// - A heterogeneous key-value pairing, for example `BTreeMap`. +/// - **struct** +/// - A heterogeneous key-value pairing in which the keys are strings and +/// will be known at deserialization time without looking at the +/// serialized data, for example `struct S { r: u8, g: u8, b: u8 }`. +/// - **struct_variant** +/// - For example the `E::S` in `enum E { S { r: u8, g: u8, b: u8 } }`. +/// +/// Many Serde serializers produce text or binary data as output, for example +/// JSON or Bincode. This is not a requirement of the `Serializer` trait, and +/// there are serializers that do not produce text or binary output. One example +/// is the `serde_json::value::Serializer` (distinct from the main `serde_json` +/// serializer) that produces a `serde_json::Value` data structure in memory as +/// output. +/// +/// [Serde data model]: https://serde.rs/data-model.html +/// +/// # Example implementation +/// +/// The [example data format] presented on the website contains example code for +/// a basic JSON `Serializer`. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait Serializer: Sized { + /// The output type produced by this `Serializer` during successful + /// serialization. Most serializers that produce text or binary output + /// should set `Ok = ()` and serialize into an [`io::Write`] or buffer + /// contained within the `Serializer` instance. Serializers that build + /// in-memory data structures may be simplified by using `Ok` to propagate + /// the data structure around. + /// + /// [`io::Write`]: https://doc.rust-lang.org/std/io/trait.Write.html + type Ok; + + /// The error type when some error occurs during serialization. + type Error: Error; + + /// Type returned from [`serialize_seq`] for serializing the content of the + /// sequence. + /// + /// [`serialize_seq`]: #tymethod.serialize_seq + type SerializeSeq: SerializeSeq; + + /// Type returned from [`serialize_tuple`] for serializing the content of + /// the tuple. + /// + /// [`serialize_tuple`]: #tymethod.serialize_tuple + type SerializeTuple: SerializeTuple; + + /// Type returned from [`serialize_tuple_struct`] for serializing the + /// content of the tuple struct. + /// + /// [`serialize_tuple_struct`]: #tymethod.serialize_tuple_struct + type SerializeTupleStruct: SerializeTupleStruct; + + /// Type returned from [`serialize_tuple_variant`] for serializing the + /// content of the tuple variant. + /// + /// [`serialize_tuple_variant`]: #tymethod.serialize_tuple_variant + type SerializeTupleVariant: SerializeTupleVariant; + + /// Type returned from [`serialize_map`] for serializing the content of the + /// map. + /// + /// [`serialize_map`]: #tymethod.serialize_map + type SerializeMap: SerializeMap; + + /// Type returned from [`serialize_struct`] for serializing the content of + /// the struct. + /// + /// [`serialize_struct`]: #tymethod.serialize_struct + type SerializeStruct: SerializeStruct; + + /// Type returned from [`serialize_struct_variant`] for serializing the + /// content of the struct variant. + /// + /// [`serialize_struct_variant`]: #tymethod.serialize_struct_variant + type SerializeStructVariant: SerializeStructVariant; + + /// Serialize a `bool` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for bool { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_bool(*self) + /// } + /// } + /// ``` + fn serialize_bool(self, v: bool) -> Result; + + /// Serialize an `i8` value. + /// + /// If the format does not differentiate between `i8` and `i64`, a + /// reasonable implementation would be to cast the value to `i64` and + /// forward to `serialize_i64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for i8 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_i8(*self) + /// } + /// } + /// ``` + fn serialize_i8(self, v: i8) -> Result; + + /// Serialize an `i16` value. + /// + /// If the format does not differentiate between `i16` and `i64`, a + /// reasonable implementation would be to cast the value to `i64` and + /// forward to `serialize_i64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for i16 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_i16(*self) + /// } + /// } + /// ``` + fn serialize_i16(self, v: i16) -> Result; + + /// Serialize an `i32` value. + /// + /// If the format does not differentiate between `i32` and `i64`, a + /// reasonable implementation would be to cast the value to `i64` and + /// forward to `serialize_i64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for i32 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_i32(*self) + /// } + /// } + /// ``` + fn serialize_i32(self, v: i32) -> Result; + + /// Serialize an `i64` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for i64 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_i64(*self) + /// } + /// } + /// ``` + fn serialize_i64(self, v: i64) -> Result; + + serde_if_integer128! { + /// Serialize an `i128` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for i128 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_i128(*self) + /// } + /// } + /// ``` + /// + /// This method is available only on Rust compiler versions >=1.26. The + /// default behavior unconditionally returns an error. + fn serialize_i128(self, v: i128) -> Result { + let _ = v; + Err(Error::custom("i128 is not supported")) + } + } + + /// Serialize a `u8` value. + /// + /// If the format does not differentiate between `u8` and `u64`, a + /// reasonable implementation would be to cast the value to `u64` and + /// forward to `serialize_u64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for u8 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_u8(*self) + /// } + /// } + /// ``` + fn serialize_u8(self, v: u8) -> Result; + + /// Serialize a `u16` value. + /// + /// If the format does not differentiate between `u16` and `u64`, a + /// reasonable implementation would be to cast the value to `u64` and + /// forward to `serialize_u64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for u16 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_u16(*self) + /// } + /// } + /// ``` + fn serialize_u16(self, v: u16) -> Result; + + /// Serialize a `u32` value. + /// + /// If the format does not differentiate between `u32` and `u64`, a + /// reasonable implementation would be to cast the value to `u64` and + /// forward to `serialize_u64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for u32 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_u32(*self) + /// } + /// } + /// ``` + fn serialize_u32(self, v: u32) -> Result; + + /// Serialize a `u64` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for u64 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_u64(*self) + /// } + /// } + /// ``` + fn serialize_u64(self, v: u64) -> Result; + + serde_if_integer128! { + /// Serialize a `u128` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for u128 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_u128(*self) + /// } + /// } + /// ``` + /// + /// This method is available only on Rust compiler versions >=1.26. The + /// default behavior unconditionally returns an error. + fn serialize_u128(self, v: u128) -> Result { + let _ = v; + Err(Error::custom("u128 is not supported")) + } + } + + /// Serialize an `f32` value. + /// + /// If the format does not differentiate between `f32` and `f64`, a + /// reasonable implementation would be to cast the value to `f64` and + /// forward to `serialize_f64`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for f32 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_f32(*self) + /// } + /// } + /// ``` + fn serialize_f32(self, v: f32) -> Result; + + /// Serialize an `f64` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for f64 { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_f64(*self) + /// } + /// } + /// ``` + fn serialize_f64(self, v: f64) -> Result; + + /// Serialize a character. + /// + /// If the format does not support characters, it is reasonable to serialize + /// it as a single element `str` or a `u32`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for char { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_char(*self) + /// } + /// } + /// ``` + fn serialize_char(self, v: char) -> Result; + + /// Serialize a `&str`. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for str { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_str(self) + /// } + /// } + /// ``` + fn serialize_str(self, v: &str) -> Result; + + /// Serialize a chunk of raw byte data. + /// + /// Enables serializers to serialize byte slices more compactly or more + /// efficiently than other types of slices. If no efficient implementation + /// is available, a reasonable implementation would be to forward to + /// `serialize_seq`. If forwarded, the implementation looks usually just + /// like this: + /// + /// ```edition2018 + /// # use serde::ser::{Serializer, SerializeSeq}; + /// # use serde::private::ser::Error; + /// # + /// # struct MySerializer; + /// # + /// # impl Serializer for MySerializer { + /// # type Ok = (); + /// # type Error = Error; + /// # + /// fn serialize_bytes(self, v: &[u8]) -> Result { + /// let mut seq = self.serialize_seq(Some(v.len()))?; + /// for b in v { + /// seq.serialize_element(b)?; + /// } + /// seq.end() + /// } + /// # + /// # serde::__serialize_unimplemented! { + /// # bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str none some + /// # unit unit_struct unit_variant newtype_struct newtype_variant + /// # seq tuple tuple_struct tuple_variant map struct struct_variant + /// # } + /// # } + /// ``` + fn serialize_bytes(self, v: &[u8]) -> Result; + + /// Serialize a [`None`] value. + /// + /// ```edition2018 + /// # use serde::{Serialize, Serializer}; + /// # + /// # enum Option { + /// # Some(T), + /// # None, + /// # } + /// # + /// # use self::Option::{Some, None}; + /// # + /// impl Serialize for Option + /// where + /// T: Serialize, + /// { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match *self { + /// Some(ref value) => serializer.serialize_some(value), + /// None => serializer.serialize_none(), + /// } + /// } + /// } + /// # + /// # fn main() {} + /// ``` + /// + /// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None + fn serialize_none(self) -> Result; + + /// Serialize a [`Some(T)`] value. + /// + /// ```edition2018 + /// # use serde::{Serialize, Serializer}; + /// # + /// # enum Option { + /// # Some(T), + /// # None, + /// # } + /// # + /// # use self::Option::{Some, None}; + /// # + /// impl Serialize for Option + /// where + /// T: Serialize, + /// { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match *self { + /// Some(ref value) => serializer.serialize_some(value), + /// None => serializer.serialize_none(), + /// } + /// } + /// } + /// # + /// # fn main() {} + /// ``` + /// + /// [`Some(T)`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.Some + fn serialize_some(self, value: &T) -> Result + where + T: Serialize; + + /// Serialize a `()` value. + /// + /// ```edition2018 + /// # use serde::Serializer; + /// # + /// # serde::__private_serialize!(); + /// # + /// impl Serialize for () { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_unit() + /// } + /// } + /// ``` + fn serialize_unit(self) -> Result; + + /// Serialize a unit struct like `struct Unit` or `PhantomData`. + /// + /// A reasonable implementation would be to forward to `serialize_unit`. + /// + /// ```edition2018 + /// use serde::{Serialize, Serializer}; + /// + /// struct Nothing; + /// + /// impl Serialize for Nothing { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_unit_struct("Nothing") + /// } + /// } + /// ``` + fn serialize_unit_struct(self, name: &'static str) -> Result; + + /// Serialize a unit variant like `E::A` in `enum E { A, B }`. + /// + /// The `name` is the name of the enum, the `variant_index` is the index of + /// this variant within the enum, and the `variant` is the name of the + /// variant. + /// + /// ```edition2018 + /// use serde::{Serialize, Serializer}; + /// + /// enum E { + /// A, + /// B, + /// } + /// + /// impl Serialize for E { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match *self { + /// E::A => serializer.serialize_unit_variant("E", 0, "A"), + /// E::B => serializer.serialize_unit_variant("E", 1, "B"), + /// } + /// } + /// } + /// ``` + fn serialize_unit_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + ) -> Result; + + /// Serialize a newtype struct like `struct Millimeters(u8)`. + /// + /// Serializers are encouraged to treat newtype structs as insignificant + /// wrappers around the data they contain. A reasonable implementation would + /// be to forward to `value.serialize(self)`. + /// + /// ```edition2018 + /// use serde::{Serialize, Serializer}; + /// + /// struct Millimeters(u8); + /// + /// impl Serialize for Millimeters { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.serialize_newtype_struct("Millimeters", &self.0) + /// } + /// } + /// ``` + fn serialize_newtype_struct( + self, + name: &'static str, + value: &T, + ) -> Result + where + T: Serialize; + + /// Serialize a newtype variant like `E::N` in `enum E { N(u8) }`. + /// + /// The `name` is the name of the enum, the `variant_index` is the index of + /// this variant within the enum, and the `variant` is the name of the + /// variant. The `value` is the data contained within this newtype variant. + /// + /// ```edition2018 + /// use serde::{Serialize, Serializer}; + /// + /// enum E { + /// M(String), + /// N(u8), + /// } + /// + /// impl Serialize for E { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match *self { + /// E::M(ref s) => serializer.serialize_newtype_variant("E", 0, "M", s), + /// E::N(n) => serializer.serialize_newtype_variant("E", 1, "N", &n), + /// } + /// } + /// } + /// ``` + fn serialize_newtype_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + value: &T, + ) -> Result + where + T: Serialize; + + /// Begin to serialize a variably sized sequence. This call must be + /// followed by zero or more calls to `serialize_element`, then a call to + /// `end`. + /// + /// The argument is the number of elements in the sequence, which may or may + /// not be computable before the sequence is iterated. Some serializers only + /// support sequences whose length is known up front. + /// + /// ```edition2018 + /// # use std::marker::PhantomData; + /// # + /// # struct Vec(PhantomData); + /// # + /// # impl Vec { + /// # fn len(&self) -> usize { + /// # unimplemented!() + /// # } + /// # } + /// # + /// # impl<'a, T> IntoIterator for &'a Vec { + /// # type Item = &'a T; + /// # type IntoIter = Box>; + /// # + /// # fn into_iter(self) -> Self::IntoIter { + /// # unimplemented!() + /// # } + /// # } + /// # + /// use serde::ser::{Serialize, Serializer, SerializeSeq}; + /// + /// impl Serialize for Vec + /// where + /// T: Serialize, + /// { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut seq = serializer.serialize_seq(Some(self.len()))?; + /// for element in self { + /// seq.serialize_element(element)?; + /// } + /// seq.end() + /// } + /// } + /// ``` + fn serialize_seq(self, len: Option) -> Result; + + /// Begin to serialize a statically sized sequence whose length will be + /// known at deserialization time without looking at the serialized data. + /// This call must be followed by zero or more calls to `serialize_element`, + /// then a call to `end`. + /// + /// ```edition2018 + /// use serde::ser::{Serialize, Serializer, SerializeTuple}; + /// + /// # mod fool { + /// # trait Serialize {} + /// impl Serialize for (A, B, C) + /// # {} + /// # } + /// # + /// # struct Tuple3(A, B, C); + /// # + /// # impl Serialize for Tuple3 + /// where + /// A: Serialize, + /// B: Serialize, + /// C: Serialize, + /// { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut tup = serializer.serialize_tuple(3)?; + /// tup.serialize_element(&self.0)?; + /// tup.serialize_element(&self.1)?; + /// tup.serialize_element(&self.2)?; + /// tup.end() + /// } + /// } + /// ``` + /// + /// ```edition2018 + /// use serde::ser::{Serialize, SerializeTuple, Serializer}; + /// + /// const VRAM_SIZE: usize = 386; + /// struct Vram([u16; VRAM_SIZE]); + /// + /// impl Serialize for Vram { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut seq = serializer.serialize_tuple(VRAM_SIZE)?; + /// for element in &self.0[..] { + /// seq.serialize_element(element)?; + /// } + /// seq.end() + /// } + /// } + /// ``` + fn serialize_tuple(self, len: usize) -> Result; + + /// Begin to serialize a tuple struct like `struct Rgb(u8, u8, u8)`. This + /// call must be followed by zero or more calls to `serialize_field`, then a + /// call to `end`. + /// + /// The `name` is the name of the tuple struct and the `len` is the number + /// of data fields that will be serialized. + /// + /// ```edition2018 + /// use serde::ser::{Serialize, SerializeTupleStruct, Serializer}; + /// + /// struct Rgb(u8, u8, u8); + /// + /// impl Serialize for Rgb { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut ts = serializer.serialize_tuple_struct("Rgb", 3)?; + /// ts.serialize_field(&self.0)?; + /// ts.serialize_field(&self.1)?; + /// ts.serialize_field(&self.2)?; + /// ts.end() + /// } + /// } + /// ``` + fn serialize_tuple_struct( + self, + name: &'static str, + len: usize, + ) -> Result; + + /// Begin to serialize a tuple variant like `E::T` in `enum E { T(u8, u8) + /// }`. This call must be followed by zero or more calls to + /// `serialize_field`, then a call to `end`. + /// + /// The `name` is the name of the enum, the `variant_index` is the index of + /// this variant within the enum, the `variant` is the name of the variant, + /// and the `len` is the number of data fields that will be serialized. + /// + /// ```edition2018 + /// use serde::ser::{Serialize, SerializeTupleVariant, Serializer}; + /// + /// enum E { + /// T(u8, u8), + /// U(String, u32, u32), + /// } + /// + /// impl Serialize for E { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match *self { + /// E::T(ref a, ref b) => { + /// let mut tv = serializer.serialize_tuple_variant("E", 0, "T", 2)?; + /// tv.serialize_field(a)?; + /// tv.serialize_field(b)?; + /// tv.end() + /// } + /// E::U(ref a, ref b, ref c) => { + /// let mut tv = serializer.serialize_tuple_variant("E", 1, "U", 3)?; + /// tv.serialize_field(a)?; + /// tv.serialize_field(b)?; + /// tv.serialize_field(c)?; + /// tv.end() + /// } + /// } + /// } + /// } + /// ``` + fn serialize_tuple_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + len: usize, + ) -> Result; + + /// Begin to serialize a map. This call must be followed by zero or more + /// calls to `serialize_key` and `serialize_value`, then a call to `end`. + /// + /// The argument is the number of elements in the map, which may or may not + /// be computable before the map is iterated. Some serializers only support + /// maps whose length is known up front. + /// + /// ```edition2018 + /// # use std::marker::PhantomData; + /// # + /// # struct HashMap(PhantomData, PhantomData); + /// # + /// # impl HashMap { + /// # fn len(&self) -> usize { + /// # unimplemented!() + /// # } + /// # } + /// # + /// # impl<'a, K, V> IntoIterator for &'a HashMap { + /// # type Item = (&'a K, &'a V); + /// # type IntoIter = Box>; + /// # + /// # fn into_iter(self) -> Self::IntoIter { + /// # unimplemented!() + /// # } + /// # } + /// # + /// use serde::ser::{Serialize, Serializer, SerializeMap}; + /// + /// impl Serialize for HashMap + /// where + /// K: Serialize, + /// V: Serialize, + /// { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut map = serializer.serialize_map(Some(self.len()))?; + /// for (k, v) in self { + /// map.serialize_entry(k, v)?; + /// } + /// map.end() + /// } + /// } + /// ``` + fn serialize_map(self, len: Option) -> Result; + + /// Begin to serialize a struct like `struct Rgb { r: u8, g: u8, b: u8 }`. + /// This call must be followed by zero or more calls to `serialize_field`, + /// then a call to `end`. + /// + /// The `name` is the name of the struct and the `len` is the number of + /// data fields that will be serialized. + /// + /// ```edition2018 + /// use serde::ser::{Serialize, SerializeStruct, Serializer}; + /// + /// struct Rgb { + /// r: u8, + /// g: u8, + /// b: u8, + /// } + /// + /// impl Serialize for Rgb { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// let mut rgb = serializer.serialize_struct("Rgb", 3)?; + /// rgb.serialize_field("r", &self.r)?; + /// rgb.serialize_field("g", &self.g)?; + /// rgb.serialize_field("b", &self.b)?; + /// rgb.end() + /// } + /// } + /// ``` + fn serialize_struct( + self, + name: &'static str, + len: usize, + ) -> Result; + + /// Begin to serialize a struct variant like `E::S` in `enum E { S { r: u8, + /// g: u8, b: u8 } }`. This call must be followed by zero or more calls to + /// `serialize_field`, then a call to `end`. + /// + /// The `name` is the name of the enum, the `variant_index` is the index of + /// this variant within the enum, the `variant` is the name of the variant, + /// and the `len` is the number of data fields that will be serialized. + /// + /// ```edition2018 + /// use serde::ser::{Serialize, SerializeStructVariant, Serializer}; + /// + /// enum E { + /// S { r: u8, g: u8, b: u8 }, + /// } + /// + /// impl Serialize for E { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// match *self { + /// E::S { + /// ref r, + /// ref g, + /// ref b, + /// } => { + /// let mut sv = serializer.serialize_struct_variant("E", 0, "S", 3)?; + /// sv.serialize_field("r", r)?; + /// sv.serialize_field("g", g)?; + /// sv.serialize_field("b", b)?; + /// sv.end() + /// } + /// } + /// } + /// } + /// ``` + fn serialize_struct_variant( + self, + name: &'static str, + variant_index: u32, + variant: &'static str, + len: usize, + ) -> Result; + + /// Collect an iterator as a sequence. + /// + /// The default implementation serializes each item yielded by the iterator + /// using [`serialize_seq`]. Implementors should not need to override this + /// method. + /// + /// ```edition2018 + /// use serde::{Serialize, Serializer}; + /// + /// struct SecretlyOneHigher { + /// data: Vec, + /// } + /// + /// impl Serialize for SecretlyOneHigher { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.collect_seq(self.data.iter().map(|x| x + 1)) + /// } + /// } + /// ``` + /// + /// [`serialize_seq`]: #tymethod.serialize_seq + fn collect_seq(self, iter: I) -> Result + where + I: IntoIterator, + ::Item: Serialize, + { + let iter = iter.into_iter(); + let mut serializer = try!(self.serialize_seq(iter.len_hint())); + for item in iter { + try!(serializer.serialize_element(&item)); + } + serializer.end() + } + + /// Collect an iterator as a map. + /// + /// The default implementation serializes each pair yielded by the iterator + /// using [`serialize_map`]. Implementors should not need to override this + /// method. + /// + /// ```edition2018 + /// use serde::{Serialize, Serializer}; + /// use std::collections::BTreeSet; + /// + /// struct MapToUnit { + /// keys: BTreeSet, + /// } + /// + /// // Serializes as a map in which the values are all unit. + /// impl Serialize for MapToUnit { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.collect_map(self.keys.iter().map(|k| (k, ()))) + /// } + /// } + /// ``` + /// + /// [`serialize_map`]: #tymethod.serialize_map + fn collect_map(self, iter: I) -> Result + where + K: Serialize, + V: Serialize, + I: IntoIterator, + { + let iter = iter.into_iter(); + let mut serializer = try!(self.serialize_map(iter.len_hint())); + for (key, value) in iter { + try!(serializer.serialize_entry(&key, &value)); + } + serializer.end() + } + + /// Serialize a string produced by an implementation of `Display`. + /// + /// The default implementation builds a heap-allocated [`String`] and + /// delegates to [`serialize_str`]. Serializers are encouraged to provide a + /// more efficient implementation if possible. + /// + /// ```edition2018 + /// # struct DateTime; + /// # + /// # impl DateTime { + /// # fn naive_local(&self) -> () { () } + /// # fn offset(&self) -> () { () } + /// # } + /// # + /// use serde::{Serialize, Serializer}; + /// + /// impl Serialize for DateTime { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.collect_str(&format_args!("{:?}{:?}", + /// self.naive_local(), + /// self.offset())) + /// } + /// } + /// ``` + /// + /// [`String`]: https://doc.rust-lang.org/std/string/struct.String.html + /// [`serialize_str`]: #tymethod.serialize_str + #[cfg(any(feature = "std", feature = "alloc"))] + fn collect_str(self, value: &T) -> Result + where + T: Display, + { + self.serialize_str(&value.to_string()) + } + + /// Serialize a string produced by an implementation of `Display`. + /// + /// Serializers that use `no_std` are required to provide an implementation + /// of this method. If no more sensible behavior is possible, the + /// implementation is expected to return an error. + /// + /// ```edition2018 + /// # struct DateTime; + /// # + /// # impl DateTime { + /// # fn naive_local(&self) -> () { () } + /// # fn offset(&self) -> () { () } + /// # } + /// # + /// use serde::{Serialize, Serializer}; + /// + /// impl Serialize for DateTime { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// serializer.collect_str(&format_args!("{:?}{:?}", + /// self.naive_local(), + /// self.offset())) + /// } + /// } + /// ``` + #[cfg(not(any(feature = "std", feature = "alloc")))] + fn collect_str(self, value: &T) -> Result + where + T: Display; + + /// Determine whether `Serialize` implementations should serialize in + /// human-readable form. + /// + /// Some types have a human-readable form that may be somewhat expensive to + /// construct, as well as a binary form that is compact and efficient. + /// Generally text-based formats like JSON and YAML will prefer to use the + /// human-readable one and binary formats like Bincode will prefer the + /// compact one. + /// + /// ```edition2018 + /// # use std::fmt::{self, Display}; + /// # + /// # struct Timestamp; + /// # + /// # impl Timestamp { + /// # fn seconds_since_epoch(&self) -> u64 { unimplemented!() } + /// # } + /// # + /// # impl Display for Timestamp { + /// # fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// # unimplemented!() + /// # } + /// # } + /// # + /// use serde::{Serialize, Serializer}; + /// + /// impl Serialize for Timestamp { + /// fn serialize(&self, serializer: S) -> Result + /// where + /// S: Serializer, + /// { + /// if serializer.is_human_readable() { + /// // Serialize to a human-readable string "2015-05-15T17:01:00Z". + /// self.to_string().serialize(serializer) + /// } else { + /// // Serialize to a compact binary representation. + /// self.seconds_since_epoch().serialize(serializer) + /// } + /// } + /// } + /// ``` + /// + /// The default implementation of this method returns `true`. Data formats + /// may override this to `false` to request a compact form for types that + /// support one. Note that modifying this method to change a format from + /// human-readable to compact or vice versa should be regarded as a breaking + /// change, as a value serialized in human-readable mode is not required to + /// deserialize from the same data in compact mode. + #[inline] + fn is_human_readable(&self) -> bool { + true + } +} + +/// Returned from `Serializer::serialize_seq`. +/// +/// # Example use +/// +/// ```edition2018 +/// # use std::marker::PhantomData; +/// # +/// # struct Vec(PhantomData); +/// # +/// # impl Vec { +/// # fn len(&self) -> usize { +/// # unimplemented!() +/// # } +/// # } +/// # +/// # impl<'a, T> IntoIterator for &'a Vec { +/// # type Item = &'a T; +/// # type IntoIter = Box>; +/// # fn into_iter(self) -> Self::IntoIter { +/// # unimplemented!() +/// # } +/// # } +/// # +/// use serde::ser::{Serialize, Serializer, SerializeSeq}; +/// +/// impl Serialize for Vec +/// where +/// T: Serialize, +/// { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// let mut seq = serializer.serialize_seq(Some(self.len()))?; +/// for element in self { +/// seq.serialize_element(element)?; +/// } +/// seq.end() +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeSeq` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeSeq { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a sequence element. + fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> + where + T: Serialize; + + /// Finish serializing a sequence. + fn end(self) -> Result; +} + +/// Returned from `Serializer::serialize_tuple`. +/// +/// # Example use +/// +/// ```edition2018 +/// use serde::ser::{Serialize, Serializer, SerializeTuple}; +/// +/// # mod fool { +/// # trait Serialize {} +/// impl Serialize for (A, B, C) +/// # {} +/// # } +/// # +/// # struct Tuple3(A, B, C); +/// # +/// # impl Serialize for Tuple3 +/// where +/// A: Serialize, +/// B: Serialize, +/// C: Serialize, +/// { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// let mut tup = serializer.serialize_tuple(3)?; +/// tup.serialize_element(&self.0)?; +/// tup.serialize_element(&self.1)?; +/// tup.serialize_element(&self.2)?; +/// tup.end() +/// } +/// } +/// ``` +/// +/// ```edition2018 +/// # use std::marker::PhantomData; +/// # +/// # struct Array(PhantomData); +/// # +/// # impl Array { +/// # fn len(&self) -> usize { +/// # unimplemented!() +/// # } +/// # } +/// # +/// # impl<'a, T> IntoIterator for &'a Array { +/// # type Item = &'a T; +/// # type IntoIter = Box>; +/// # fn into_iter(self) -> Self::IntoIter { +/// # unimplemented!() +/// # } +/// # } +/// # +/// use serde::ser::{Serialize, Serializer, SerializeTuple}; +/// +/// # mod fool { +/// # trait Serialize {} +/// impl Serialize for [T; 16] +/// # {} +/// # } +/// # +/// # impl Serialize for Array +/// where +/// T: Serialize, +/// { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// let mut seq = serializer.serialize_tuple(16)?; +/// for element in self { +/// seq.serialize_element(element)?; +/// } +/// seq.end() +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeTuple` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeTuple { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a tuple element. + fn serialize_element(&mut self, value: &T) -> Result<(), Self::Error> + where + T: Serialize; + + /// Finish serializing a tuple. + fn end(self) -> Result; +} + +/// Returned from `Serializer::serialize_tuple_struct`. +/// +/// # Example use +/// +/// ```edition2018 +/// use serde::ser::{Serialize, SerializeTupleStruct, Serializer}; +/// +/// struct Rgb(u8, u8, u8); +/// +/// impl Serialize for Rgb { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// let mut ts = serializer.serialize_tuple_struct("Rgb", 3)?; +/// ts.serialize_field(&self.0)?; +/// ts.serialize_field(&self.1)?; +/// ts.serialize_field(&self.2)?; +/// ts.end() +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeTupleStruct` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeTupleStruct { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a tuple struct field. + fn serialize_field(&mut self, value: &T) -> Result<(), Self::Error> + where + T: Serialize; + + /// Finish serializing a tuple struct. + fn end(self) -> Result; +} + +/// Returned from `Serializer::serialize_tuple_variant`. +/// +/// # Example use +/// +/// ```edition2018 +/// use serde::ser::{Serialize, SerializeTupleVariant, Serializer}; +/// +/// enum E { +/// T(u8, u8), +/// U(String, u32, u32), +/// } +/// +/// impl Serialize for E { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// match *self { +/// E::T(ref a, ref b) => { +/// let mut tv = serializer.serialize_tuple_variant("E", 0, "T", 2)?; +/// tv.serialize_field(a)?; +/// tv.serialize_field(b)?; +/// tv.end() +/// } +/// E::U(ref a, ref b, ref c) => { +/// let mut tv = serializer.serialize_tuple_variant("E", 1, "U", 3)?; +/// tv.serialize_field(a)?; +/// tv.serialize_field(b)?; +/// tv.serialize_field(c)?; +/// tv.end() +/// } +/// } +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeTupleVariant` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeTupleVariant { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a tuple variant field. + fn serialize_field(&mut self, value: &T) -> Result<(), Self::Error> + where + T: Serialize; + + /// Finish serializing a tuple variant. + fn end(self) -> Result; +} + +/// Returned from `Serializer::serialize_map`. +/// +/// # Example use +/// +/// ```edition2018 +/// # use std::marker::PhantomData; +/// # +/// # struct HashMap(PhantomData, PhantomData); +/// # +/// # impl HashMap { +/// # fn len(&self) -> usize { +/// # unimplemented!() +/// # } +/// # } +/// # +/// # impl<'a, K, V> IntoIterator for &'a HashMap { +/// # type Item = (&'a K, &'a V); +/// # type IntoIter = Box>; +/// # +/// # fn into_iter(self) -> Self::IntoIter { +/// # unimplemented!() +/// # } +/// # } +/// # +/// use serde::ser::{Serialize, Serializer, SerializeMap}; +/// +/// impl Serialize for HashMap +/// where +/// K: Serialize, +/// V: Serialize, +/// { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// let mut map = serializer.serialize_map(Some(self.len()))?; +/// for (k, v) in self { +/// map.serialize_entry(k, v)?; +/// } +/// map.end() +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeMap` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeMap { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a map key. + /// + /// If possible, `Serialize` implementations are encouraged to use + /// `serialize_entry` instead as it may be implemented more efficiently in + /// some formats compared to a pair of calls to `serialize_key` and + /// `serialize_value`. + fn serialize_key(&mut self, key: &T) -> Result<(), Self::Error> + where + T: Serialize; + + /// Serialize a map value. + /// + /// # Panics + /// + /// Calling `serialize_value` before `serialize_key` is incorrect and is + /// allowed to panic or produce bogus results. + fn serialize_value(&mut self, value: &T) -> Result<(), Self::Error> + where + T: Serialize; + + /// Serialize a map entry consisting of a key and a value. + /// + /// Some [`Serialize`] types are not able to hold a key and value in memory + /// at the same time so `SerializeMap` implementations are required to + /// support [`serialize_key`] and [`serialize_value`] individually. The + /// `serialize_entry` method allows serializers to optimize for the case + /// where key and value are both available. [`Serialize`] implementations + /// are encouraged to use `serialize_entry` if possible. + /// + /// The default implementation delegates to [`serialize_key`] and + /// [`serialize_value`]. This is appropriate for serializers that do not + /// care about performance or are not able to optimize `serialize_entry` any + /// better than this. + /// + /// [`Serialize`]: ../trait.Serialize.html + /// [`serialize_key`]: #tymethod.serialize_key + /// [`serialize_value`]: #tymethod.serialize_value + fn serialize_entry( + &mut self, + key: &K, + value: &V, + ) -> Result<(), Self::Error> + where + K: Serialize, + V: Serialize, + { + try!(self.serialize_key(key)); + self.serialize_value(value) + } + + /// Finish serializing a map. + fn end(self) -> Result; +} + +/// Returned from `Serializer::serialize_struct`. +/// +/// # Example use +/// +/// ```edition2018 +/// use serde::ser::{Serialize, SerializeStruct, Serializer}; +/// +/// struct Rgb { +/// r: u8, +/// g: u8, +/// b: u8, +/// } +/// +/// impl Serialize for Rgb { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// let mut rgb = serializer.serialize_struct("Rgb", 3)?; +/// rgb.serialize_field("r", &self.r)?; +/// rgb.serialize_field("g", &self.g)?; +/// rgb.serialize_field("b", &self.b)?; +/// rgb.end() +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeStruct` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeStruct { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a struct field. + fn serialize_field( + &mut self, + key: &'static str, + value: &T, + ) -> Result<(), Self::Error> + where + T: Serialize; + + /// Indicate that a struct field has been skipped. + #[inline] + fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error> { + let _ = key; + Ok(()) + } + + /// Finish serializing a struct. + fn end(self) -> Result; +} + +/// Returned from `Serializer::serialize_struct_variant`. +/// +/// # Example use +/// +/// ```edition2018 +/// use serde::ser::{Serialize, SerializeStructVariant, Serializer}; +/// +/// enum E { +/// S { r: u8, g: u8, b: u8 }, +/// } +/// +/// impl Serialize for E { +/// fn serialize(&self, serializer: S) -> Result +/// where +/// S: Serializer, +/// { +/// match *self { +/// E::S { +/// ref r, +/// ref g, +/// ref b, +/// } => { +/// let mut sv = serializer.serialize_struct_variant("E", 0, "S", 3)?; +/// sv.serialize_field("r", r)?; +/// sv.serialize_field("g", g)?; +/// sv.serialize_field("b", b)?; +/// sv.end() +/// } +/// } +/// } +/// } +/// ``` +/// +/// # Example implementation +/// +/// The [example data format] presented on the website demonstrates an +/// implementation of `SerializeStructVariant` for a basic JSON data format. +/// +/// [example data format]: https://serde.rs/data-format.html +pub trait SerializeStructVariant { + /// Must match the `Ok` type of our `Serializer`. + type Ok; + + /// Must match the `Error` type of our `Serializer`. + type Error: Error; + + /// Serialize a struct variant field. + fn serialize_field( + &mut self, + key: &'static str, + value: &T, + ) -> Result<(), Self::Error> + where + T: Serialize; + + /// Indicate that a struct variant field has been skipped. + #[inline] + fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error> { + let _ = key; + Ok(()) + } + + /// Finish serializing a struct variant. + fn end(self) -> Result; +} + +trait LenHint: Iterator { + fn len_hint(&self) -> Option; +} + +impl LenHint for I +where + I: Iterator, +{ + #[cfg(not(feature = "unstable"))] + fn len_hint(&self) -> Option { + iterator_len_hint(self) + } + + #[cfg(feature = "unstable")] + default fn len_hint(&self) -> Option { + iterator_len_hint(self) + } +} + +#[cfg(feature = "unstable")] +impl LenHint for I +where + I: ExactSizeIterator, +{ + fn len_hint(&self) -> Option { + Some(self.len()) + } +} + +fn iterator_len_hint(iter: &I) -> Option +where + I: Iterator, +{ + match iter.size_hint() { + (lo, Some(hi)) if lo == hi => Some(lo), + _ => None, + } +} diff --git a/third_party/cargo/vendor/serde-1.0.110/src/std_error.rs b/third_party/cargo/vendor/serde-1.0.110/src/std_error.rs new file mode 100644 index 0000000..1055e0f --- /dev/null +++ b/third_party/cargo/vendor/serde-1.0.110/src/std_error.rs @@ -0,0 +1,48 @@ +use lib::{Debug, Display}; + +/// Either a re-export of std::error::Error or a new identical trait, depending +/// on whether Serde's "std" feature is enabled. +/// +/// Serde's error traits [`serde::ser::Error`] and [`serde::de::Error`] require +/// [`std::error::Error`] as a supertrait, but only when Serde is built with +/// "std" enabled. Data formats that don't care about no\_std support should +/// generally provide their error types with a `std::error::Error` impl +/// directly: +/// +/// ```edition2018 +/// #[derive(Debug)] +/// struct MySerError {...} +/// +/// impl serde::ser::Error for MySerError {...} +/// +/// impl std::fmt::Display for MySerError {...} +/// +/// // We don't support no_std! +/// impl std::error::Error for MySerError {} +/// ``` +/// +/// Data formats that *do* support no\_std may either have a "std" feature of +/// their own: +/// +/// ```toml +/// [features] +/// std = ["serde/std"] +/// ``` +/// +/// ```edition2018 +/// #[cfg(feature = "std")] +/// impl std::error::Error for MySerError {} +/// ``` +/// +/// ... or else provide the std Error impl unconditionally via Serde's +/// re-export: +/// +/// ```edition2018 +/// impl serde::ser::StdError for MySerError {} +/// ``` +pub trait Error: Debug + Display { + /// The underlying cause of this error, if any. + fn source(&self) -> Option<&(Error + 'static)> { + None + } +} diff --git a/third_party/cargo/vendor/shared_library-0.1.9/BUILD b/third_party/cargo/vendor/shared_library-0.1.9/BUILD index 6bdea9c..a4c6353 100644 --- a/third_party/cargo/vendor/shared_library-0.1.9/BUILD +++ b/third_party/cargo/vendor/shared_library-0.1.9/BUILD @@ -32,7 +32,7 @@ rust_library( srcs = glob(["**/*.rs"]), deps = [ "//third_party/cargo/vendor/lazy_static-1.4.0:lazy_static", - "//third_party/cargo/vendor/libc-0.2.67:libc", + "//third_party/cargo/vendor/libc-0.2.71:libc", ], rustc_flags = [ "--cap-lints=allow", diff --git a/third_party/cargo/vendor/smallvec-1.2.0/.cargo-checksum.json b/third_party/cargo/vendor/smallvec-1.2.0/.cargo-checksum.json deleted file mode 100644 index 3e4ba00..0000000 --- a/third_party/cargo/vendor/smallvec-1.2.0/.cargo-checksum.json +++ /dev/null @@ -1 +0,0 @@ -{"files":{"Cargo.toml":"82c58cfe1208040b0772a4eb0fc59c2f84c75dd28115f2847a6edc91a340b7f4","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b28172679e0009b655da42797c03fd163a3379d5cfa67ba1f1655e974a2a1a9","README.md":"a01127c37308457e8d396b176fb790846be0978c173be3f13260b62efcef011b","benches/bench.rs":"9dca7122a3dcb2c099e49807e4d3b8f01d9220e2b3db0a54e9901ee74392866f","lib.rs":"6b128fc5aa50b5dd775d45252e277c13546f1de2ebee340c6c8ff48627678244","scripts/run_miri.sh":"2e83d153efc16cbc3c41589e306faa0624c8b9a0feecea3baae6e34f4563ac42","specialization.rs":"46433586203399251cba496d67b88d34e1be3c2b591986b77463513da1c66471"},"package":"5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc"} \ No newline at end of file diff --git a/third_party/cargo/vendor/smallvec-1.4.0/.cargo-checksum.json b/third_party/cargo/vendor/smallvec-1.4.0/.cargo-checksum.json new file mode 100644 index 0000000..da27139 --- /dev/null +++ b/third_party/cargo/vendor/smallvec-1.4.0/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"3b1b1c08b9972759d0ffb7884ac85a9d28bfac48c5d24581f397d712a6110220","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b28172679e0009b655da42797c03fd163a3379d5cfa67ba1f1655e974a2a1a9","README.md":"a01127c37308457e8d396b176fb790846be0978c173be3f13260b62efcef011b","benches/bench.rs":"9dca7122a3dcb2c099e49807e4d3b8f01d9220e2b3db0a54e9901ee74392866f","lib.rs":"69b3c4984e2518bde77df3a8d3e38105944005cbe44ddab66552886ff9b2bc51","scripts/run_miri.sh":"0d0b8c54c73fa9da1217d29ed0984f8328dd9fb61bb5a02db44458c360cdc3c4","specialization.rs":"46433586203399251cba496d67b88d34e1be3c2b591986b77463513da1c66471"},"package":"c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"} \ No newline at end of file diff --git a/third_party/cargo/vendor/smallvec-1.2.0/BUILD b/third_party/cargo/vendor/smallvec-1.4.0/BUILD similarity index 97% rename from third_party/cargo/vendor/smallvec-1.2.0/BUILD rename to third_party/cargo/vendor/smallvec-1.4.0/BUILD index 1df4fb2..c515412 100644 --- a/third_party/cargo/vendor/smallvec-1.2.0/BUILD +++ b/third_party/cargo/vendor/smallvec-1.4.0/BUILD @@ -36,7 +36,7 @@ rust_library( rustc_flags = [ "--cap-lints=allow", ], - version = "1.2.0", + version = "1.4.0", crate_features = [ ], ) diff --git a/third_party/cargo/vendor/smallvec-1.2.0/Cargo.toml b/third_party/cargo/vendor/smallvec-1.4.0/Cargo.toml similarity index 96% rename from third_party/cargo/vendor/smallvec-1.2.0/Cargo.toml rename to third_party/cargo/vendor/smallvec-1.4.0/Cargo.toml index 199dc13..a316331 100644 --- a/third_party/cargo/vendor/smallvec-1.2.0/Cargo.toml +++ b/third_party/cargo/vendor/smallvec-1.4.0/Cargo.toml @@ -13,7 +13,7 @@ [package] edition = "2018" name = "smallvec" -version = "1.2.0" +version = "1.4.0" authors = ["Simon Sapin "] description = "'Small vector' optimization: store up to a small number of items on the stack" documentation = "https://docs.rs/smallvec/" @@ -33,6 +33,7 @@ optional = true version = "1.0.1" [features] +const_generics = [] may_dangle = [] specialization = [] union = [] diff --git a/third_party/cargo/vendor/smallvec-1.4.0/LICENSE-APACHE b/third_party/cargo/vendor/smallvec-1.4.0/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/third_party/cargo/vendor/smallvec-1.4.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/third_party/cargo/vendor/smallvec-1.2.0/LICENSE-MIT b/third_party/cargo/vendor/smallvec-1.4.0/LICENSE-MIT similarity index 100% rename from third_party/cargo/vendor/smallvec-1.2.0/LICENSE-MIT rename to third_party/cargo/vendor/smallvec-1.4.0/LICENSE-MIT diff --git a/third_party/cargo/vendor/smallvec-1.2.0/README.md b/third_party/cargo/vendor/smallvec-1.4.0/README.md similarity index 100% rename from third_party/cargo/vendor/smallvec-1.2.0/README.md rename to third_party/cargo/vendor/smallvec-1.4.0/README.md diff --git a/third_party/cargo/vendor/smallvec-1.2.0/benches/bench.rs b/third_party/cargo/vendor/smallvec-1.4.0/benches/bench.rs similarity index 100% rename from third_party/cargo/vendor/smallvec-1.2.0/benches/bench.rs rename to third_party/cargo/vendor/smallvec-1.4.0/benches/bench.rs diff --git a/third_party/cargo/vendor/smallvec-1.2.0/lib.rs b/third_party/cargo/vendor/smallvec-1.4.0/lib.rs similarity index 91% rename from third_party/cargo/vendor/smallvec-1.2.0/lib.rs rename to third_party/cargo/vendor/smallvec-1.4.0/lib.rs index 0c8243e..caea125 100644 --- a/third_party/cargo/vendor/smallvec-1.2.0/lib.rs +++ b/third_party/cargo/vendor/smallvec-1.4.0/lib.rs @@ -14,7 +14,16 @@ //! `write` feature implements the `std::io::Write` trait for vectors of `u8`. //! When this feature is enabled, `smallvec` depends on `std`. //! -//! ## `union` feature +//! ## Optional features +//! +//! ### `write` +//! +//! When this feature is enabled, `SmallVec<[u8; _]>` implements the `std::io::Write` trait. +//! This feature is not compatible with `#![no_std]` programs. +//! +//! ### `union` +//! +//! **This feature is unstable and requires a nightly build of the Rust toolchain.** //! //! When the `union` feature is enabled `smallvec` will track its state (inline or spilled) //! without the use of an enum tag, reducing the size of the `smallvec` by one machine word. @@ -24,11 +33,36 @@ //! //! To use this feature add `features = ["union"]` in the `smallvec` section of Cargo.toml. //! Note that this feature requires a nightly compiler (for now). +//! +//! ### `const_generics` +//! +//! **This feature is unstable and requires a nightly build of the Rust toolchain.** +//! +//! When this feature is enabled, `SmallVec` works with any arrays of any size, not just a fixed +//! list of sizes. +//! +//! ### `specialization` +//! +//! **This feature is unstable and requires a nightly build of the Rust toolchain.** +//! +//! When this feature is enabled, `SmallVec::from(slice)` has improved performance for slices +//! of `Copy` types. (Without this feature, you can use `SmallVec::from_slice` to get optimal +//! performance for `Copy` types.) +//! +//! ### `may_dangle` +//! +//! **This feature is unstable and requires a nightly build of the Rust toolchain.** +//! +//! This feature makes the Rust compiler less strict about use of vectors that contain borrowed +//! references. For details, see the +//! [Rustonomicon](https://doc.rust-lang.org/1.42.0/nomicon/dropck.html#an-escape-hatch). #![no_std] #![cfg_attr(feature = "union", feature(untagged_unions))] #![cfg_attr(feature = "specialization", feature(specialization))] #![cfg_attr(feature = "may_dangle", feature(dropck_eyepatch))] +#![cfg_attr(feature = "const_generics", allow(incomplete_features))] +#![cfg_attr(feature = "const_generics", feature(const_generics))] #![deny(missing_docs)] #[doc(hidden)] @@ -37,6 +71,7 @@ pub extern crate alloc; #[cfg(any(test, feature = "write"))] extern crate std; +use alloc::alloc::{Layout, LayoutErr}; use alloc::boxed::Box; use alloc::{vec, vec::Vec}; use core::borrow::{Borrow, BorrowMut}; @@ -166,9 +201,46 @@ impl ExtendFromSlice for Vec { } } +/// Error type for APIs with fallible heap allocation +#[derive(Debug)] +pub enum CollectionAllocErr { + /// Overflow `usize::MAX` or other error during size computation + CapacityOverflow, + /// The allocator return an error + AllocErr { + /// The layout that was passed to the allocator + layout: Layout, + }, +} + +impl From for CollectionAllocErr { + fn from(_: LayoutErr) -> Self { + CollectionAllocErr::CapacityOverflow + } +} + +fn infallible(result: Result) -> T { + match result { + Ok(x) => x, + Err(CollectionAllocErr::CapacityOverflow) => panic!("capacity overflow"), + Err(CollectionAllocErr::AllocErr { layout }) => alloc::alloc::handle_alloc_error(layout), + } +} + +/// FIXME: use `Layout::array` when we require a Rust version where it’s stable +/// https://github.com/rust-lang/rust/issues/55724 +fn layout_array(n: usize) -> Result { + let size = mem::size_of::().checked_mul(n) + .ok_or(CollectionAllocErr::CapacityOverflow)?; + let align = mem::align_of::(); + Layout::from_size_align(size, align) + .map_err(|_| CollectionAllocErr::CapacityOverflow) +} + unsafe fn deallocate(ptr: *mut T, capacity: usize) { - let _vec: Vec = Vec::from_raw_parts(ptr, 0, capacity); - // Let it drop. + // This unwrap should succeed since the same did when allocating. + let layout = layout_array::(capacity).unwrap(); + alloc::alloc::dealloc(ptr as *mut u8, layout) } /// An iterator that removes the items from a `SmallVec` and yields them by value. @@ -657,33 +729,52 @@ impl SmallVec { /// Re-allocate to set the capacity to `max(new_cap, inline_size())`. /// - /// Panics if `new_cap` is less than the vector's length. + /// Panics if `new_cap` is less than the vector's length + /// or if the capacity computation overflows `usize`. pub fn grow(&mut self, new_cap: usize) { + infallible(self.try_grow(new_cap)) + } + + /// Re-allocate to set the capacity to `max(new_cap, inline_size())`. + /// + /// Panics if `new_cap` is less than the vector's length + pub fn try_grow(&mut self, new_cap: usize) -> Result<(), CollectionAllocErr> { unsafe { let (ptr, &mut len, cap) = self.triple_mut(); let unspilled = !self.spilled(); assert!(new_cap >= len); if new_cap <= self.inline_size() { if unspilled { - return; + return Ok(()); } self.data = SmallVecData::from_inline(MaybeUninit::uninit()); ptr::copy_nonoverlapping(ptr, self.data.inline_mut(), len); self.capacity = len; + deallocate(ptr, cap); } else if new_cap != cap { - let mut vec = Vec::with_capacity(new_cap); - let new_alloc = vec.as_mut_ptr(); - mem::forget(vec); - ptr::copy_nonoverlapping(ptr, new_alloc, len); + let layout = layout_array::(new_cap)?; + let new_alloc; + if unspilled { + new_alloc = NonNull::new(alloc::alloc::alloc(layout)) + .ok_or(CollectionAllocErr::AllocErr { layout })? + .cast() + .as_ptr(); + ptr::copy_nonoverlapping(ptr, new_alloc, len); + } else { + // This should never fail since the same succeeded + // when previously allocating `ptr`. + let old_layout = layout_array::(cap)?; + + let new_ptr = alloc::alloc::realloc(ptr as *mut u8, old_layout, layout.size()); + new_alloc = NonNull::new(new_ptr) + .ok_or(CollectionAllocErr::AllocErr { layout })? + .cast() + .as_ptr(); + } self.data = SmallVecData::from_heap(new_alloc, len); self.capacity = new_cap; - if unspilled { - return; - } - } else { - return; } - deallocate(ptr, cap); + Ok(()) } } @@ -691,35 +782,47 @@ impl SmallVec { /// /// May reserve more space to avoid frequent reallocations. /// - /// If the new capacity would overflow `usize` then it will be set to `usize::max_value()` - /// instead. (This means that inserting `additional` new elements is not guaranteed to be - /// possible after calling this function.) + /// Panics if the capacity computation overflows `usize`. #[inline] pub fn reserve(&mut self, additional: usize) { + infallible(self.try_reserve(additional)) + } + + /// Reserve capacity for `additional` more elements to be inserted. + /// + /// May reserve more space to avoid frequent reallocations. + pub fn try_reserve(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { // prefer triple_mut() even if triple() would work // so that the optimizer removes duplicated calls to it // from callers like insert() let (_, &mut len, cap) = self.triple_mut(); - if cap - len < additional { - let new_cap = len - .checked_add(additional) - .and_then(usize::checked_next_power_of_two) - .unwrap_or(usize::max_value()); - self.grow(new_cap); + if cap - len >= additional { + return Ok(()); } + let new_cap = len + .checked_add(additional) + .and_then(usize::checked_next_power_of_two) + .ok_or(CollectionAllocErr::CapacityOverflow)?; + self.try_grow(new_cap) } /// Reserve the minimum capacity for `additional` more elements to be inserted. /// /// Panics if the new capacity overflows `usize`. pub fn reserve_exact(&mut self, additional: usize) { + infallible(self.try_reserve_exact(additional)) + } + + /// Reserve the minimum capacity for `additional` more elements to be inserted. + pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), CollectionAllocErr> { let (_, &mut len, cap) = self.triple_mut(); - if cap - len < additional { - match len.checked_add(additional) { - Some(cap) => self.grow(cap), - None => panic!("reserve_exact overflow"), - } + if cap - len >= additional { + return Ok(()); } + let new_cap = len + .checked_add(additional) + .ok_or(CollectionAllocErr::CapacityOverflow)?; + self.try_grow(new_cap) } /// Shrink the capacity of the vector as much as possible. @@ -831,6 +934,8 @@ impl SmallVec { /// Insert multiple elements at position `index`, shifting all following elements toward the /// back. + /// + /// Note: when the iterator panics, this can leak memory. pub fn insert_many>(&mut self, index: usize, iterable: I) { let iter = iterable.into_iter(); if index == self.len() { @@ -1053,6 +1158,7 @@ impl SmallVec { /// assert_eq!(&*rebuilt, &[4, 5, 6]); /// } /// } + #[inline] pub unsafe fn from_raw_parts(ptr: *mut A::Item, length: usize, capacity: usize) -> SmallVec { assert!(capacity > A::size()); SmallVec { @@ -1370,6 +1476,7 @@ where } impl FromIterator for SmallVec { + #[inline] fn from_iter>(iterable: I) -> SmallVec { let mut v = SmallVec::new(); v.extend(iterable); @@ -1450,6 +1557,7 @@ impl Clone for SmallVec where A::Item: Clone, { + #[inline] fn clone(&self) -> SmallVec { let mut new_vector = SmallVec::with_capacity(self.len()); for element in self.iter() { @@ -1667,6 +1775,13 @@ impl<'a> Drop for SetLenOnDrop<'a> { } } +#[cfg(feature = "const_generics")] +unsafe impl Array for [T; N] { + type Item = T; + fn size() -> usize { N } +} + +#[cfg(not(feature = "const_generics"))] macro_rules! impl_array( ($($size:expr),+) => { $( @@ -1678,12 +1793,27 @@ macro_rules! impl_array( } ); +#[cfg(not(feature = "const_generics"))] impl_array!( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 36, 0x40, 0x60, 0x80, 0x100, 0x200, 0x400, 0x600, 0x800, 0x1000, 0x2000, 0x4000, 0x6000, 0x8000, 0x10000, 0x20000, 0x40000, 0x60000, 0x80000, 0x10_0000 ); +/// Convenience trait for constructing a `SmallVec` +pub trait ToSmallVec { + /// Construct a new `SmallVec` from a slice. + fn to_smallvec(&self) -> SmallVec; +} + +impl ToSmallVec for [A::Item] + where A::Item: Copy { + #[inline] + fn to_smallvec(&self) -> SmallVec { + SmallVec::from_slice(self) + } +} + #[cfg(test)] mod tests { use crate::SmallVec; @@ -2033,12 +2163,17 @@ mod tests { } } + // These boxes are leaked on purpose by panicking `insert_many`, + // so we clean them up manually to appease Miri's leak checker. + let mut box1 = Box::new(false); + let mut box2 = Box::new(false); + let mut vec: SmallVec<[PanicOnDoubleDrop; 0]> = vec![ PanicOnDoubleDrop { - dropped: Box::new(false), + dropped: unsafe { Box::from_raw(&mut *box1) }, }, PanicOnDoubleDrop { - dropped: Box::new(false), + dropped: unsafe { Box::from_raw(&mut *box2) }, }, ] .into(); @@ -2046,6 +2181,9 @@ mod tests { vec.insert_many(0, BadIter); }); assert!(result.is_err()); + + drop(box1); + drop(box2); } #[test] @@ -2522,4 +2660,10 @@ mod tests { assert_eq!(v.capacity(), 4); assert_eq!(v[..], [0, 1, 2]); } + + #[cfg(feature = "const_generics")] + #[test] + fn const_generics() { + let _v = SmallVec::<[i32; 987]>::default(); + } } diff --git a/third_party/cargo/vendor/smallvec-1.2.0/scripts/run_miri.sh b/third_party/cargo/vendor/smallvec-1.4.0/scripts/run_miri.sh similarity index 76% rename from third_party/cargo/vendor/smallvec-1.2.0/scripts/run_miri.sh rename to third_party/cargo/vendor/smallvec-1.4.0/scripts/run_miri.sh index c5e5376..817928a 100644 --- a/third_party/cargo/vendor/smallvec-1.2.0/scripts/run_miri.sh +++ b/third_party/cargo/vendor/smallvec-1.4.0/scripts/run_miri.sh @@ -16,6 +16,6 @@ rustup default "$MIRI_NIGHTLY" rustup component add miri cargo miri setup -cargo miri test --verbose -- -Zmiri-ignore-leaks -cargo miri test --verbose --features union -- -Zmiri-ignore-leaks -cargo miri test --verbose --all-features -- -Zmiri-ignore-leaks +cargo miri test --verbose +cargo miri test --verbose --features union +cargo miri test --verbose --all-features diff --git a/third_party/cargo/vendor/smallvec-1.2.0/specialization.rs b/third_party/cargo/vendor/smallvec-1.4.0/specialization.rs similarity index 100% rename from third_party/cargo/vendor/smallvec-1.2.0/specialization.rs rename to third_party/cargo/vendor/smallvec-1.4.0/specialization.rs diff --git a/third_party/cargo/vendor/smithay-client-toolkit-0.6.6/BUILD b/third_party/cargo/vendor/smithay-client-toolkit-0.6.6/BUILD index 89a6d2d..607b21c 100644 --- a/third_party/cargo/vendor/smithay-client-toolkit-0.6.6/BUILD +++ b/third_party/cargo/vendor/smithay-client-toolkit-0.6.6/BUILD @@ -38,7 +38,7 @@ rust_library( deps = [ "//third_party/cargo/vendor/andrew-0.2.1:andrew", "//third_party/cargo/vendor/bitflags-1.2.1:bitflags", - "//third_party/cargo/vendor/dlib-0.4.1:dlib", + "//third_party/cargo/vendor/dlib-0.4.2:dlib", "//third_party/cargo/vendor/lazy_static-1.4.0:lazy_static", "//third_party/cargo/vendor/memmap-0.7.0:memmap", "//third_party/cargo/vendor/nix-0.14.1:nix", diff --git a/third_party/cargo/vendor/stb_truetype-0.3.1/.cargo-checksum.json b/third_party/cargo/vendor/stb_truetype-0.3.1/.cargo-checksum.json index f78a770..16622ae 100644 --- a/third_party/cargo/vendor/stb_truetype-0.3.1/.cargo-checksum.json +++ b/third_party/cargo/vendor/stb_truetype-0.3.1/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"ec2db7230716c5c111ad40ee7bf40ace7ccb3e3ba787b5bf0d0f79c1c5c06a4b","Cargo.toml":"3224d19a4ddd50259ff63526d043ffe0f0fe4879aeffd528591c9312ff1cd3c3","LICENSE-APACHE":"559a84a882160cd5ae5ad559efb15bc613adac9e5346fd047617f48e1bb9fcb4","LICENSE-MIT":"fd198949ebcc78b2d12fc57ebfb2da4ae8f781b7c3b7047aaccc2f804b6f12ef","README.md":"b048de643b604e9354c3f50b0ebb79356b3394e09bde19992cff704c0244f5b3","benches/api.rs":"b9884d6e0870a52de2ab7a86eab68b5ac73d0e1c7a35bf581b716c56f7217ef4","examples/fontnames.rs":"e8595f2f6c31ac543fccfe7ed1d208bf90cc622f66eec443170dd0a5515688d1","examples/simple.rs":"bfbc6dedbdacb90c341882bedaa613a2784e85e9a46346c226f6d657fdd28f9d","rustfmt.toml":"ed17bf27c3712b8f22ec7a2a9d8e5d9d2a5654299754fb93e9ac76ef6d153114","src/lib.rs":"dac930af78a95d6e05222438fd090231fd1f5c1f9f04efc1d9c121fa791132d3","tests/mod.rs":"e72f20ac7f3abf4afe29041f598c8dc3a6bcbdb78ab235775d80716ff0686b3a"},"package":"f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51"} \ No newline at end of file +{"files":{"CHANGELOG.md":"ec2db7230716c5c111ad40ee7bf40ace7ccb3e3ba787b5bf0d0f79c1c5c06a4b","Cargo.lock":"11df8c26db15c3f941575ac961a2e09269c5f6107bab10d8c0fb423af5a781a7","Cargo.toml":"3224d19a4ddd50259ff63526d043ffe0f0fe4879aeffd528591c9312ff1cd3c3","LICENSE-APACHE":"559a84a882160cd5ae5ad559efb15bc613adac9e5346fd047617f48e1bb9fcb4","LICENSE-MIT":"fd198949ebcc78b2d12fc57ebfb2da4ae8f781b7c3b7047aaccc2f804b6f12ef","README.md":"b048de643b604e9354c3f50b0ebb79356b3394e09bde19992cff704c0244f5b3","benches/api.rs":"b9884d6e0870a52de2ab7a86eab68b5ac73d0e1c7a35bf581b716c56f7217ef4","examples/fontnames.rs":"e8595f2f6c31ac543fccfe7ed1d208bf90cc622f66eec443170dd0a5515688d1","examples/simple.rs":"bfbc6dedbdacb90c341882bedaa613a2784e85e9a46346c226f6d657fdd28f9d","rustfmt.toml":"ed17bf27c3712b8f22ec7a2a9d8e5d9d2a5654299754fb93e9ac76ef6d153114","src/lib.rs":"dac930af78a95d6e05222438fd090231fd1f5c1f9f04efc1d9c121fa791132d3","tests/mod.rs":"e72f20ac7f3abf4afe29041f598c8dc3a6bcbdb78ab235775d80716ff0686b3a"},"package":"f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51"} \ No newline at end of file diff --git a/third_party/cargo/vendor/stb_truetype-0.3.1/Cargo.lock b/third_party/cargo/vendor/stb_truetype-0.3.1/Cargo.lock new file mode 100644 index 0000000..030d562 --- /dev/null +++ b/third_party/cargo/vendor/stb_truetype-0.3.1/Cargo.lock @@ -0,0 +1,48 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "approx" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libm" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num-traits" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stb_truetype" +version = "0.3.1" +dependencies = [ + "approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum approx 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" +"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" +"checksum libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4" diff --git a/third_party/cargo/vendor/syn-1.0.27/.cargo-checksum.json b/third_party/cargo/vendor/syn-1.0.27/.cargo-checksum.json new file mode 100644 index 0000000..1bda55e --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/.cargo-checksum.json @@ -0,0 +1 @@ +{"files":{"Cargo.toml":"aa1adbc22f91e5571da6d4224f357e7bb78eb625fa6878134309677df764bd22","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"ff2426878f6752f807732b0ea4370eb4ad6bbce403a8e9298ba4f3747fb24a74","benches/file.rs":"b4724fc7c0f48b8f488e2632a1064f6c0bf16ded3969680fc3f4a2369536269b","benches/rust.rs":"048cc32740985f95c186f7d0418e6984c354d46449f6793d1843eb2cb75f0d76","build.rs":"aeca2312f05aec658eaa66980a0ef3d578837db107a55702b39419ea0422eb4a","src/attr.rs":"673c53311ecaa5980b1166a773af40fa360faf0a909a7112986f5af50bf8cee4","src/await.rs":"18f0b2ecb319991f891e300011424985e3cf33d166ea9f29f22d575fc8c83a76","src/bigint.rs":"efc7f64959980653d73fe4f8bc2a3a2904dc05f45b02c6dc15cd316fa3d7c338","src/buffer.rs":"9cd103b3f85a07971ea18d35858c257ead008721ea17fc8dcb3acdb62f922271","src/custom_keyword.rs":"9627467063e41776315a6a14b2aaea3875592d8e0ebd2dc6df1fc2f12c06f146","src/custom_punctuation.rs":"b00e7bee96eb473507527e39db65e74e71592dc06421d2cfe45ed899c17d4847","src/data.rs":"67082db33d4c5fc546ad7e923773c166d071ac73da5c292761dc31b5e47f2ef5","src/derive.rs":"fa71866df6e383673dd3329f455a9f953585b83f9739050be3bf1f8c6d526b96","src/discouraged.rs":"a1f3d85e20dedf50b1b7b4571d970a3a6e9b2de4afde7dd0c986fe240df2ba46","src/error.rs":"5ed3503d9372cffb564a316c5eb5f68452d0e097471e367ffa6bda86c2443312","src/export.rs":"dcae67456278c0339acfbcbb4737b8d37cfba5a150ae789f31f4be79abf7e726","src/expr.rs":"c64b7e1e7adff9584a5277b082458b514bc4fbad22889b83f0ad895788b69170","src/ext.rs":"c99f0959fb5d5384e304d539db148a43a9401fc55cd7984280fc19e86837ee08","src/file.rs":"9ee5c7cccfc3074fec826ed0bd9ea5c94e4170ea549dcbbfdd58622fc4832cda","src/gen/fold.rs":"5892db3e869a2db4ec69b03934bcd094bc27d40ab0e0053eef6cd1d1084aa86d","src/gen/visit.rs":"23008c170d4dd3975232876a0a654921d9b6af57372cb9fcc133ca740588d666","src/gen/visit_mut.rs":"42886c3ee02ded72d9c3eec006e20431eaee0c6b90ddefc1a36ec7bf50c6a24a","src/gen_helper.rs":"ea6c66388365971db6a2fc86cbb208f7eacde77e245bc8623f27a3642a3d7741","src/generics.rs":"8c01b433ef8fbff6de763119657f28d0dad2495196dfb9bf5d6b315950e75a9c","src/group.rs":"119b62d8481b4b1c327639bed40e114bf1969765250b68186628247fd4144b3b","src/ident.rs":"503156ce51a7ef0420892e8dbf2ecf8fe51f42a84d52cc2c05654e1a83020cbf","src/item.rs":"80e37ff99856546f130124db27c38a1b24eb7c0459aca2e7931eb48db0bdf2af","src/lib.rs":"f9924665510717a64cfd1511e013bd08cdbbc3975f470557c053d34c10c3c22e","src/lifetime.rs":"001ecb56cb05b0f9c8a9e52f2dccd16091eb3696f1aba4c774df23a2ddea45df","src/lit.rs":"8b292710d485f049501945aebc1fdbf38f40e3b01083196b8f4417a93b193144","src/lookahead.rs":"5cce8b4cb345a85c24a452ea6d78eadb76f01ca0a789cbf5ce35108334904173","src/mac.rs":"465cb7e9f408d05a9a56456bdfef630d3063049ea997423a32de8605b1d62f7b","src/macros.rs":"3927364fdcf46bfebef97cf29f4b1a0c862484980707e714c4a572c5f7261065","src/op.rs":"8ff07703b14e40d64e27a06be0063c730699937959ea1cdf89eb74c33d9fffd6","src/parse.rs":"b9a3ab47a78a84adb58caa105af0791366e4109f23a467aaedb8744da685bd8e","src/parse_macro_input.rs":"ce3b34ec6c6311d90cacdecab2112ed3a79a3af31639db4adf8aff6da69ea2b7","src/parse_quote.rs":"642f21e5fa54df4b7c373fb158289ee1005d49e1a49b1d194df5438faee71c46","src/pat.rs":"9f0c36e116c0e98f91becb3c39cd523c00cf02ea5797519121db40baf87eb435","src/path.rs":"f119f0c2af12fabd360eac9a2312e0f6e6c28c633c9671bde6ef0bece7c5ba3c","src/print.rs":"da6529c1d9d21aaf6c835f66b4e67eacb7cf91a10eb5e9a2143b49bf99b3b5e1","src/punctuated.rs":"9f0c0496dcf6a797668c36a9a78ccb99164e324ebd884cf91f1b103160610b0b","src/sealed.rs":"896a495a5340eec898527f18bd4ddca408ea03ea0ee3af30074ff48deace778d","src/span.rs":"748c51c6feb223c26d3b1701f5bb98aee823666c775c98106cfa24fe29d8cec1","src/spanned.rs":"7d77714d585e6f42397091ffb3a799fd7b20c05c5442c737683c429ea7d409a5","src/stmt.rs":"3917fbc897f80efe838267833c55650ff8d636cb49a6d1084e28eff65d0e3ccd","src/thread.rs":"815eca6bd64f4eef7c447f0809e84108f5428ff50225224b373efd8fbb696874","src/token.rs":"d34ceaff5c33687ee8c6b04689595d66b0ec515b77128372cd36e53376bf5516","src/tt.rs":"1cc9e200624288322f800f32e3d6e2e53da946467bb312dd40a52c02cdcc4730","src/ty.rs":"10d5eb7aa866c33ef684c41bdfd865076fc383d53b0a57bcbddb64960465a043","src/verbatim.rs":"802a97df997432f18cac6e6200ff6ea29fb2474986005e0fcdbc2b65197f87f7","tests/common/eq.rs":"f328d42cdc1645a16a8fedc847622057b597691bcc7761053dd479810983059a","tests/common/mod.rs":"d65467142644b48bca796c819feb29ab0c013dbb64cdabb34a4908731505725d","tests/common/parse.rs":"8b7ba32f4988c30758c108536c4877dc5a039a237bf9b0687220ef2295797bbd","tests/debug/gen.rs":"57bd5cf585e0b86ad00f29f09ff3db3390c4a756d503514a9b28407500dcea3c","tests/debug/mod.rs":"868763d0ef1609a3ad5e05e9f1bfa0f813e91e7e9a36653414a188bb2fdaa425","tests/macros/mod.rs":"c0eafa4e3845fc08f6efe6021bac37822c0ac325eb7b51194a5f35236f648d92","tests/repo/mod.rs":"a1e587c8998d3d0537d7731959255fb62fd32f60efbd0a904a1571ac68e742aa","tests/repo/progress.rs":"c08d0314a7f3ecf760d471f27da3cd2a500aeb9f1c8331bffb2aa648f9fabf3f","tests/test_asyncness.rs":"cff01db49d28ab23b0b258bc6c0a5cc4071be4fe7248eef344a5d79d2fb649b7","tests/test_attribute.rs":"0ffd99384e1a52ae17d9fed5c4053e411e8f9018decef07ffa621d1faa7329d8","tests/test_derive_input.rs":"b1fce660c8f6244b83ed3aa04ef93edec26ab5db8d6d4ccf215a080933d0759b","tests/test_expr.rs":"95a25356c675a773a36c75c9169d1151ac092029712aa00fd8407a35415022ba","tests/test_generics.rs":"11cfddd46f55a4e0ab378872498b2ba1631f2b99beb39c53362d2105f677a569","tests/test_grouping.rs":"60504efdb75d681b4c38b7004e7754c22329653eb814013560c8046d06902a2f","tests/test_ident.rs":"9eb53d1e21edf23e7c9e14dc74dcc2b2538e9221e19dbcc0a44e3acc2e90f3f6","tests/test_iterators.rs":"53ed6078d37550bd6765d2411e3660be401aef8a31a407350cc064a7d08c7c33","tests/test_lit.rs":"17b09b5f21c8a25b89f469d922143305350f43757ad06c0feff7dd70703fb0d5","tests/test_meta.rs":"1fc98af3279cadc3d8db3c7e8d4d7f9e9dbd4d17548cf6a2f6f4536ed65367f6","tests/test_parse_buffer.rs":"8bbe2d24ca8a3788f72c6908fc96c26d546f11c69687bf8d72727f851d5e2d27","tests/test_pat.rs":"2cb331fe404496d51e7cc7e283ae13c519a2265ca82e1c88e113296f860c2cba","tests/test_path.rs":"fcd5591e639fc787acc9763d828a811c8114525c9341282eefda8f331e082a51","tests/test_precedence.rs":"da0c1e9f2615dd2d25c3ea4f07d52c616038422dafc0fcbfaeb9f0d901b14430","tests/test_receiver.rs":"084eca59984b9a18651da52f2c4407355da3de1335916a12477652999e2d01cc","tests/test_round_trip.rs":"8208b702ef30811baabcb3bd59f5fd54d787a56eb415359951a990286defea7d","tests/test_should_parse.rs":"1d3535698a446e2755bfc360676bdb161841a1f454cdef6e7556c6d06a95c89d","tests/test_size.rs":"5fae772bab66809d6708232f35cfb4a287882486763b0f763feec2ad79fbb68b","tests/test_stmt.rs":"00491621cf302751a42b7f2f0b8a59845ece920aafe5ae3fcb12b2f7deb35eaf","tests/test_token_trees.rs":"429ed8bdd04aa8d3baa55b61c04755b95565e23f94478b6f9c7595b93e017e0b","tests/test_ty.rs":"429334ad5cab6688de11e917214d1b51835f0048bbb62c8233f9e2b9cbbdb476","tests/test_visibility.rs":"36cf4c91f13f637e60f9814a68af65d5df4c2716f182579bdfbe86eba9ddd8c6","tests/zzz_stable.rs":"2a862e59cb446235ed99aec0e6ada8e16d3ecc30229b29d825b7c0bbc2602989"},"package":"ef781e621ee763a2a40721a8861ec519cb76966aee03bb5d00adb6a31dc1c1de"} \ No newline at end of file diff --git a/third_party/cargo/vendor/syn-1.0.27/BUILD b/third_party/cargo/vendor/syn-1.0.27/BUILD new file mode 100644 index 0000000..6b31014 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/BUILD @@ -0,0 +1,80 @@ +""" +cargo-raze crate build file. + +DO NOT EDIT! Replaced on runs of cargo-raze +""" +package(default_visibility = [ + # Public for visibility by "@raze__crate__version//" targets. + # + # Prefer access through "//third_party/cargo", which limits external + # visibility to explicit Cargo.toml dependencies. + "//visibility:public", +]) + +licenses([ + "restricted", # "MIT OR Apache-2.0" +]) + +load( + "@io_bazel_rules_rust//rust:rust.bzl", + "rust_library", + "rust_binary", + "rust_test", +) + + +# Unsupported target "build-script-build" with type "custom-build" omitted +# Unsupported target "file" with type "bench" omitted +# Unsupported target "rust" with type "bench" omitted + +rust_library( + name = "syn", + crate_root = "src/lib.rs", + crate_type = "lib", + edition = "2018", + srcs = glob(["**/*.rs"]), + deps = [ + "//third_party/cargo/vendor/proc-macro2-1.0.17:proc_macro2", + "//third_party/cargo/vendor/quote-1.0.6:quote", + "//third_party/cargo/vendor/unicode-xid-0.2.0:unicode_xid", + ], + rustc_flags = [ + "--cap-lints=allow", + ], + version = "1.0.27", + crate_features = [ + "clone-impls", + "default", + "derive", + "extra-traits", + "parsing", + "printing", + "proc-macro", + "quote", + "visit", + ], +) + +# Unsupported target "test_asyncness" with type "test" omitted +# Unsupported target "test_attribute" with type "test" omitted +# Unsupported target "test_derive_input" with type "test" omitted +# Unsupported target "test_expr" with type "test" omitted +# Unsupported target "test_generics" with type "test" omitted +# Unsupported target "test_grouping" with type "test" omitted +# Unsupported target "test_ident" with type "test" omitted +# Unsupported target "test_iterators" with type "test" omitted +# Unsupported target "test_lit" with type "test" omitted +# Unsupported target "test_meta" with type "test" omitted +# Unsupported target "test_parse_buffer" with type "test" omitted +# Unsupported target "test_pat" with type "test" omitted +# Unsupported target "test_path" with type "test" omitted +# Unsupported target "test_precedence" with type "test" omitted +# Unsupported target "test_receiver" with type "test" omitted +# Unsupported target "test_round_trip" with type "test" omitted +# Unsupported target "test_should_parse" with type "test" omitted +# Unsupported target "test_size" with type "test" omitted +# Unsupported target "test_stmt" with type "test" omitted +# Unsupported target "test_token_trees" with type "test" omitted +# Unsupported target "test_ty" with type "test" omitted +# Unsupported target "test_visibility" with type "test" omitted +# Unsupported target "zzz_stable" with type "test" omitted diff --git a/third_party/cargo/vendor/syn-1.0.27/Cargo.toml b/third_party/cargo/vendor/syn-1.0.27/Cargo.toml new file mode 100644 index 0000000..5b6f3e8 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/Cargo.toml @@ -0,0 +1,97 @@ +# 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 = "syn" +version = "1.0.27" +authors = ["David Tolnay "] +include = ["/benches/**", "/build.rs", "/Cargo.toml", "/LICENSE-APACHE", "/LICENSE-MIT", "/README.md", "/src/**", "/tests/**"] +description = "Parser for Rust source code" +documentation = "https://docs.rs/syn" +readme = "README.md" +categories = ["development-tools::procedural-macro-helpers"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/dtolnay/syn" +[package.metadata.docs.rs] +all-features = true +targets = ["x86_64-unknown-linux-gnu"] + +[package.metadata.playground] +features = ["full", "visit", "visit-mut", "fold", "extra-traits"] + +[[bench]] +name = "rust" +harness = false +required-features = ["full", "parsing"] + +[[bench]] +name = "file" +required-features = ["full", "parsing"] +[dependencies.proc-macro2] +version = "1.0.13" +default-features = false + +[dependencies.quote] +version = "1.0" +optional = true +default-features = false + +[dependencies.unicode-xid] +version = "0.2" +[dev-dependencies.anyhow] +version = "1.0" + +[dev-dependencies.flate2] +version = "1.0" + +[dev-dependencies.insta] +version = "0.16" + +[dev-dependencies.rayon] +version = "1.0" + +[dev-dependencies.ref-cast] +version = "1.0" + +[dev-dependencies.regex] +version = "1.0" + +[dev-dependencies.reqwest] +version = "0.10" +features = ["blocking"] + +[dev-dependencies.syn-test-suite] +version = "0" + +[dev-dependencies.tar] +version = "0.4" + +[dev-dependencies.termcolor] +version = "1.0" + +[dev-dependencies.walkdir] +version = "2.1" + +[features] +clone-impls = [] +default = ["derive", "parsing", "printing", "clone-impls", "proc-macro"] +derive = [] +extra-traits = [] +fold = [] +full = [] +parsing = [] +printing = ["quote"] +proc-macro = ["proc-macro2/proc-macro", "quote/proc-macro"] +test = ["syn-test-suite/all-features"] +visit = [] +visit-mut = [] diff --git a/third_party/cargo/vendor/syn-1.0.27/LICENSE-APACHE b/third_party/cargo/vendor/syn-1.0.27/LICENSE-APACHE new file mode 100644 index 0000000..16fe87b --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/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/third_party/cargo/vendor/syn-1.0.27/LICENSE-MIT b/third_party/cargo/vendor/syn-1.0.27/LICENSE-MIT new file mode 100644 index 0000000..31aa793 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/LICENSE-MIT @@ -0,0 +1,23 @@ +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/third_party/cargo/vendor/syn-1.0.27/README.md b/third_party/cargo/vendor/syn-1.0.27/README.md new file mode 100644 index 0000000..97f955b --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/README.md @@ -0,0 +1,291 @@ +Parser for Rust source code +=========================== + +[github](https://github.com/dtolnay/syn) +[crates.io](https://crates.io/crates/syn) +[docs.rs](https://docs.rs/syn) +[build status](https://github.com/dtolnay/syn/actions?query=branch%3Amaster) + +Syn is a parsing library for parsing a stream of Rust tokens into a syntax tree +of Rust source code. + +Currently this library is geared toward use in Rust procedural macros, but +contains some APIs that may be useful more generally. + +- **Data structures** — Syn provides a complete syntax tree that can represent + any valid Rust source code. The syntax tree is rooted at [`syn::File`] which + represents a full source file, but there are other entry points that may be + useful to procedural macros including [`syn::Item`], [`syn::Expr`] and + [`syn::Type`]. + +- **Derives** — Of particular interest to derive macros is [`syn::DeriveInput`] + which is any of the three legal input items to a derive macro. An example + below shows using this type in a library that can derive implementations of a + user-defined trait. + +- **Parsing** — Parsing in Syn is built around [parser functions] with the + signature `fn(ParseStream) -> Result`. Every syntax tree node defined by + Syn is individually parsable and may be used as a building block for custom + syntaxes, or you may dream up your own brand new syntax without involving any + of our syntax tree types. + +- **Location information** — Every token parsed by Syn is associated with a + `Span` that tracks line and column information back to the source of that + token. These spans allow a procedural macro to display detailed error messages + pointing to all the right places in the user's code. There is an example of + this below. + +- **Feature flags** — Functionality is aggressively feature gated so your + procedural macros enable only what they need, and do not pay in compile time + for all the rest. + +[`syn::File`]: https://docs.rs/syn/1.0/syn/struct.File.html +[`syn::Item`]: https://docs.rs/syn/1.0/syn/enum.Item.html +[`syn::Expr`]: https://docs.rs/syn/1.0/syn/enum.Expr.html +[`syn::Type`]: https://docs.rs/syn/1.0/syn/enum.Type.html +[`syn::DeriveInput`]: https://docs.rs/syn/1.0/syn/struct.DeriveInput.html +[parser functions]: https://docs.rs/syn/1.0/syn/parse/index.html + +If you get stuck with anything involving procedural macros in Rust I am happy to +provide help even if the issue is not related to Syn. Please file a ticket in +this repo. + +*Version requirement: Syn supports rustc 1.31 and up.* + +[*Release notes*](https://github.com/dtolnay/syn/releases) + +
+ +## Resources + +The best way to learn about procedural macros is by writing some. Consider +working through [this procedural macro workshop][workshop] to get familiar with +the different types of procedural macros. The workshop contains relevant links +into the Syn documentation as you work through each project. + +[workshop]: https://github.com/dtolnay/proc-macro-workshop + +
+ +## Example of a derive macro + +The canonical derive macro using Syn looks like this. We write an ordinary Rust +function tagged with a `proc_macro_derive` attribute and the name of the trait +we are deriving. Any time that derive appears in the user's code, the Rust +compiler passes their data structure as tokens into our macro. We get to execute +arbitrary Rust code to figure out what to do with those tokens, then hand some +tokens back to the compiler to compile into the user's crate. + +[`TokenStream`]: https://doc.rust-lang.org/proc_macro/struct.TokenStream.html + +```toml +[dependencies] +syn = "1.0" +quote = "1.0" + +[lib] +proc-macro = true +``` + +```rust +extern crate proc_macro; + +use proc_macro::TokenStream; +use quote::quote; +use syn::{parse_macro_input, DeriveInput}; + +#[proc_macro_derive(MyMacro)] +pub fn my_macro(input: TokenStream) -> TokenStream { + // Parse the input tokens into a syntax tree + let input = parse_macro_input!(input as DeriveInput); + + // Build the output, possibly using quasi-quotation + let expanded = quote! { + // ... + }; + + // Hand the output tokens back to the compiler + TokenStream::from(expanded) +} +``` + +The [`heapsize`] example directory shows a complete working implementation of a +derive macro. It works on any Rust compiler 1.31+. The example derives a +`HeapSize` trait which computes an estimate of the amount of heap memory owned +by a value. + +[`heapsize`]: examples/heapsize + +```rust +pub trait HeapSize { + /// Total number of bytes of heap memory owned by `self`. + fn heap_size_of_children(&self) -> usize; +} +``` + +The derive macro allows users to write `#[derive(HeapSize)]` on data structures +in their program. + +```rust +#[derive(HeapSize)] +struct Demo<'a, T: ?Sized> { + a: Box, + b: u8, + c: &'a str, + d: String, +} +``` + +
+ +## Spans and error reporting + +The token-based procedural macro API provides great control over where the +compiler's error messages are displayed in user code. Consider the error the +user sees if one of their field types does not implement `HeapSize`. + +```rust +#[derive(HeapSize)] +struct Broken { + ok: String, + bad: std::thread::Thread, +} +``` + +By tracking span information all the way through the expansion of a procedural +macro as shown in the `heapsize` example, token-based macros in Syn are able to +trigger errors that directly pinpoint the source of the problem. + +``` +error[E0277]: the trait bound `std::thread::Thread: HeapSize` is not satisfied + --> src/main.rs:7:5 + | +7 | bad: std::thread::Thread, + | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `HeapSize` is not implemented for `std::thread::Thread` +``` + +
+ +## Parsing a custom syntax + +The [`lazy-static`] example directory shows the implementation of a +`functionlike!(...)` procedural macro in which the input tokens are parsed using +Syn's parsing API. + +[`lazy-static`]: examples/lazy-static + +The example reimplements the popular `lazy_static` crate from crates.io as a +procedural macro. + +``` +lazy_static! { + static ref USERNAME: Regex = Regex::new("^[a-z0-9_-]{3,16}$").unwrap(); +} +``` + +The implementation shows how to trigger custom warnings and error messages on +the macro input. + +``` +warning: come on, pick a more creative name + --> src/main.rs:10:16 + | +10 | static ref FOO: String = "lazy_static".to_owned(); + | ^^^ +``` + +
+ +## Testing + +When testing macros, we often care not just that the macro can be used +successfully but also that when the macro is provided with invalid input it +produces maximally helpful error messages. Consider using the [`trybuild`] crate +to write tests for errors that are emitted by your macro or errors detected by +the Rust compiler in the expanded code following misuse of the macro. Such tests +help avoid regressions from later refactors that mistakenly make an error no +longer trigger or be less helpful than it used to be. + +[`trybuild`]: https://github.com/dtolnay/trybuild + +
+ +## Debugging + +When developing a procedural macro it can be helpful to look at what the +generated code looks like. Use `cargo rustc -- -Zunstable-options +--pretty=expanded` or the [`cargo expand`] subcommand. + +[`cargo expand`]: https://github.com/dtolnay/cargo-expand + +To show the expanded code for some crate that uses your procedural macro, run +`cargo expand` from that crate. To show the expanded code for one of your own +test cases, run `cargo expand --test the_test_case` where the last argument is +the name of the test file without the `.rs` extension. + +This write-up by Brandon W Maister discusses debugging in more detail: +[Debugging Rust's new Custom Derive system][debugging]. + +[debugging]: https://quodlibetor.github.io/posts/debugging-rusts-new-custom-derive-system/ + +
+ +## Optional features + +Syn puts a lot of functionality behind optional features in order to optimize +compile time for the most common use cases. The following features are +available. + +- **`derive`** *(enabled by default)* — Data structures for representing the + possible input to a derive macro, including structs and enums and types. +- **`full`** — Data structures for representing the syntax tree of all valid + Rust source code, including items and expressions. +- **`parsing`** *(enabled by default)* — Ability to parse input tokens into a + syntax tree node of a chosen type. +- **`printing`** *(enabled by default)* — Ability to print a syntax tree node as + tokens of Rust source code. +- **`visit`** — Trait for traversing a syntax tree. +- **`visit-mut`** — Trait for traversing and mutating in place a syntax tree. +- **`fold`** — Trait for transforming an owned syntax tree. +- **`clone-impls`** *(enabled by default)* — Clone impls for all syntax tree + types. +- **`extra-traits`** — Debug, Eq, PartialEq, Hash impls for all syntax tree + types. +- **`proc-macro`** *(enabled by default)* — Runtime dependency on the dynamic + library libproc_macro from rustc toolchain. + +
+ +## Proc macro shim + +Syn operates on the token representation provided by the [proc-macro2] crate +from crates.io rather than using the compiler's built in proc-macro crate +directly. This enables code using Syn to execute outside of the context of a +procedural macro, such as in unit tests or build.rs, and we avoid needing +incompatible ecosystems for proc macros vs non-macro use cases. + +In general all of your code should be written against proc-macro2 rather than +proc-macro. The one exception is in the signatures of procedural macro entry +points, which are required by the language to use `proc_macro::TokenStream`. + +The proc-macro2 crate will automatically detect and use the compiler's data +structures when a procedural macro is active. + +[proc-macro2]: https://docs.rs/proc-macro2/1.0/proc_macro2/ + +
+ +#### License + + +Licensed under either of
Apache License, Version +2.0 or MIT license at your option. + + +
+ + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in this crate 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/third_party/cargo/vendor/syn-1.0.27/benches/file.rs b/third_party/cargo/vendor/syn-1.0.27/benches/file.rs new file mode 100644 index 0000000..58ab8df --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/benches/file.rs @@ -0,0 +1,30 @@ +// $ cargo bench --features full --bench file + +#![feature(rustc_private, test)] +#![recursion_limit = "1024"] + +extern crate test; + +#[macro_use] +#[path = "../tests/macros/mod.rs"] +mod macros; + +#[path = "../tests/common/mod.rs"] +mod common; +#[path = "../tests/repo/mod.rs"] +pub mod repo; + +use proc_macro2::TokenStream; +use std::fs; +use std::str::FromStr; +use test::Bencher; + +const FILE: &str = "tests/rust/src/libcore/str/mod.rs"; + +#[bench] +fn parse_file(b: &mut Bencher) { + repo::clone_rust(); + let content = fs::read_to_string(FILE).unwrap(); + let tokens = TokenStream::from_str(&content).unwrap(); + b.iter(|| syn::parse2::(tokens.clone())); +} diff --git a/third_party/cargo/vendor/syn-1.0.27/benches/rust.rs b/third_party/cargo/vendor/syn-1.0.27/benches/rust.rs new file mode 100644 index 0000000..ab37e68 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/benches/rust.rs @@ -0,0 +1,159 @@ +// $ cargo bench --features full --bench rust +// +// Syn only, useful for profiling: +// $ RUSTFLAGS='--cfg syn_only' cargo build --release --features full --bench rust + +#![cfg_attr(not(syn_only), feature(rustc_private))] +#![recursion_limit = "1024"] + +#[macro_use] +#[path = "../tests/macros/mod.rs"] +mod macros; + +#[path = "../tests/common/mod.rs"] +mod common; +#[path = "../tests/repo/mod.rs"] +mod repo; + +use std::fs; +use std::time::{Duration, Instant}; + +#[cfg(not(syn_only))] +mod tokenstream_parse { + use proc_macro2::TokenStream; + use std::str::FromStr; + + pub fn bench(content: &str) -> Result<(), ()> { + TokenStream::from_str(content).map(drop).map_err(drop) + } +} + +mod syn_parse { + pub fn bench(content: &str) -> Result<(), ()> { + syn::parse_file(content).map(drop).map_err(drop) + } +} + +#[cfg(not(syn_only))] +mod librustc_parse { + extern crate rustc_ast; + extern crate rustc_data_structures; + extern crate rustc_errors; + extern crate rustc_parse; + extern crate rustc_session; + extern crate rustc_span; + + use rustc_data_structures::sync::Lrc; + use rustc_errors::{emitter::Emitter, Diagnostic, Handler}; + use rustc_session::parse::ParseSess; + use rustc_span::source_map::{FilePathMapping, SourceMap}; + use rustc_span::{edition::Edition, FileName}; + + pub fn bench(content: &str) -> Result<(), ()> { + struct SilentEmitter; + + impl Emitter for SilentEmitter { + fn emit_diagnostic(&mut self, _diag: &Diagnostic) {} + fn source_map(&self) -> Option<&Lrc> { + None + } + } + + rustc_ast::with_globals(Edition::Edition2018, || { + let cm = Lrc::new(SourceMap::new(FilePathMapping::empty())); + let emitter = Box::new(SilentEmitter); + let handler = Handler::with_emitter(false, None, emitter); + let sess = ParseSess::with_span_handler(handler, cm); + if let Err(mut diagnostic) = rustc_parse::parse_crate_from_source_str( + FileName::Custom("bench".to_owned()), + content.to_owned(), + &sess, + ) { + diagnostic.cancel(); + return Err(()); + }; + Ok(()) + }) + } +} + +#[cfg(not(syn_only))] +mod read_from_disk { + pub fn bench(content: &str) -> Result<(), ()> { + let _ = content; + Ok(()) + } +} + +fn exec(mut codepath: impl FnMut(&str) -> Result<(), ()>) -> Duration { + let begin = Instant::now(); + let mut success = 0; + let mut total = 0; + + walkdir::WalkDir::new("tests/rust/src") + .into_iter() + .filter_entry(repo::base_dir_filter) + .for_each(|entry| { + let entry = entry.unwrap(); + let path = entry.path(); + if path.is_dir() { + return; + } + let content = fs::read_to_string(path).unwrap(); + let ok = codepath(&content).is_ok(); + success += ok as usize; + total += 1; + if !ok { + eprintln!("FAIL {}", path.display()); + } + }); + + assert_eq!(success, total); + begin.elapsed() +} + +fn main() { + repo::clone_rust(); + + macro_rules! testcases { + ($($(#[$cfg:meta])* $name:ident,)*) => { + vec![ + $( + $(#[$cfg])* + (stringify!($name), $name::bench as fn(&str) -> Result<(), ()>), + )* + ] + }; + } + + #[cfg(not(syn_only))] + { + let mut lines = 0; + let mut files = 0; + exec(|content| { + lines += content.lines().count(); + files += 1; + Ok(()) + }); + eprintln!("\n{} lines in {} files", lines, files); + } + + for (name, f) in testcases!( + #[cfg(not(syn_only))] + read_from_disk, + #[cfg(not(syn_only))] + tokenstream_parse, + syn_parse, + #[cfg(not(syn_only))] + librustc_parse, + ) { + eprint!("{:20}", format!("{}:", name)); + let elapsed = exec(f); + eprintln!( + "elapsed={}.{:03}s", + elapsed.as_secs(), + elapsed.subsec_millis(), + ); + } + eprintln!(); +} diff --git a/third_party/cargo/vendor/syn-1.0.27/build.rs b/third_party/cargo/vendor/syn-1.0.27/build.rs new file mode 100644 index 0000000..cf7681c --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/build.rs @@ -0,0 +1,39 @@ +use std::env; +use std::process::Command; +use std::str; + +// The rustc-cfg strings below are *not* public API. Please let us know by +// opening a GitHub issue if your build environment requires some way to enable +// these cfgs other than by executing our build script. +fn main() { + let compiler = match rustc_version() { + Some(compiler) => compiler, + None => return, + }; + + if compiler.minor < 36 { + println!("cargo:rustc-cfg=syn_omit_await_from_token_macro"); + } + + if !compiler.nightly { + println!("cargo:rustc-cfg=syn_disable_nightly_tests"); + } +} + +struct Compiler { + minor: u32, + nightly: bool, +} + +fn rustc_version() -> Option { + let rustc = env::var_os("RUSTC")?; + let output = Command::new(rustc).arg("--version").output().ok()?; + let version = str::from_utf8(&output.stdout).ok()?; + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + let minor = pieces.next()?.parse().ok()?; + let nightly = version.contains("nightly"); + Some(Compiler { minor, nightly }) +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/attr.rs b/third_party/cargo/vendor/syn-1.0.27/src/attr.rs new file mode 100644 index 0000000..2a51c38 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/attr.rs @@ -0,0 +1,686 @@ +use super::*; +use crate::punctuated::Punctuated; + +use std::iter; + +use proc_macro2::TokenStream; + +#[cfg(feature = "parsing")] +use crate::parse::{Parse, ParseBuffer, ParseStream, Parser, Result}; +#[cfg(feature = "parsing")] +use crate::punctuated::Pair; +#[cfg(feature = "extra-traits")] +use crate::tt::TokenStreamHelper; +#[cfg(feature = "extra-traits")] +use std::hash::{Hash, Hasher}; + +ast_struct! { + /// An attribute like `#[repr(transparent)]`. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + ///
+ /// + /// # Syntax + /// + /// Rust has six types of attributes. + /// + /// - Outer attributes like `#[repr(transparent)]`. These appear outside or + /// in front of the item they describe. + /// - Inner attributes like `#![feature(proc_macro)]`. These appear inside + /// of the item they describe, usually a module. + /// - Outer doc comments like `/// # Example`. + /// - Inner doc comments like `//! Please file an issue`. + /// - Outer block comments `/** # Example */`. + /// - Inner block comments `/*! Please file an issue */`. + /// + /// The `style` field of type `AttrStyle` distinguishes whether an attribute + /// is outer or inner. Doc comments and block comments are promoted to + /// attributes, as this is how they are processed by the compiler and by + /// `macro_rules!` macros. + /// + /// The `path` field gives the possibly colon-delimited path against which + /// the attribute is resolved. It is equal to `"doc"` for desugared doc + /// comments. The `tokens` field contains the rest of the attribute body as + /// tokens. + /// + /// ```text + /// #[derive(Copy)] #[crate::precondition x < 5] + /// ^^^^^^~~~~~~ ^^^^^^^^^^^^^^^^^^^ ~~~~~ + /// path tokens path tokens + /// ``` + /// + ///
+ /// + /// # Parsing from tokens to Attribute + /// + /// This type does not implement the [`Parse`] trait and thus cannot be + /// parsed directly by [`ParseStream::parse`]. Instead use + /// [`ParseStream::call`] with one of the two parser functions + /// [`Attribute::parse_outer`] or [`Attribute::parse_inner`] depending on + /// which you intend to parse. + /// + /// [`Parse`]: parse::Parse + /// [`ParseStream::parse`]: parse::ParseBuffer::parse + /// [`ParseStream::call`]: parse::ParseBuffer::call + /// + /// ``` + /// use syn::{Attribute, Ident, Result, Token}; + /// use syn::parse::{Parse, ParseStream}; + /// + /// // Parses a unit struct with attributes. + /// // + /// // #[path = "s.tmpl"] + /// // struct S; + /// struct UnitStruct { + /// attrs: Vec, + /// struct_token: Token![struct], + /// name: Ident, + /// semi_token: Token![;], + /// } + /// + /// impl Parse for UnitStruct { + /// fn parse(input: ParseStream) -> Result { + /// Ok(UnitStruct { + /// attrs: input.call(Attribute::parse_outer)?, + /// struct_token: input.parse()?, + /// name: input.parse()?, + /// semi_token: input.parse()?, + /// }) + /// } + /// } + /// ``` + /// + ///


+ /// + /// # Parsing from Attribute to structured arguments + /// + /// The grammar of attributes in Rust is very flexible, which makes the + /// syntax tree not that useful on its own. In particular, arguments of the + /// attribute are held in an arbitrary `tokens: TokenStream`. Macros are + /// expected to check the `path` of the attribute, decide whether they + /// recognize it, and then parse the remaining tokens according to whatever + /// grammar they wish to require for that kind of attribute. + /// + /// If the attribute you are parsing is expected to conform to the + /// conventional structured form of attribute, use [`parse_meta()`] to + /// obtain that structured representation. If the attribute follows some + /// other grammar of its own, use [`parse_args()`] to parse that into the + /// expected data structure. + /// + /// [`parse_meta()`]: Attribute::parse_meta + /// [`parse_args()`]: Attribute::parse_args + /// + ///


+ /// + /// # Doc comments + /// + /// The compiler transforms doc comments, such as `/// comment` and `/*! + /// comment */`, into attributes before macros are expanded. Each comment is + /// expanded into an attribute of the form `#[doc = r"comment"]`. + /// + /// As an example, the following `mod` items are expanded identically: + /// + /// ``` + /// # use syn::{ItemMod, parse_quote}; + /// let doc: ItemMod = parse_quote! { + /// /// Single line doc comments + /// /// We write so many! + /// /** + /// * Multi-line comments... + /// * May span many lines + /// */ + /// mod example { + /// //! Of course, they can be inner too + /// /*! And fit in a single line */ + /// } + /// }; + /// let attr: ItemMod = parse_quote! { + /// #[doc = r" Single line doc comments"] + /// #[doc = r" We write so many!"] + /// #[doc = r" Multi-line comments... + /// May span many lines"] + /// mod example { + /// #![doc = r" Of course, they can be inner too"] + /// #![doc = r" And fit in a single line "] + /// } + /// }; + /// assert_eq!(doc, attr); + /// ``` + pub struct Attribute #manual_extra_traits { + pub pound_token: Token![#], + pub style: AttrStyle, + pub bracket_token: token::Bracket, + pub path: Path, + pub tokens: TokenStream, + } +} + +#[cfg(feature = "extra-traits")] +impl Eq for Attribute {} + +#[cfg(feature = "extra-traits")] +impl PartialEq for Attribute { + fn eq(&self, other: &Self) -> bool { + self.style == other.style + && self.pound_token == other.pound_token + && self.bracket_token == other.bracket_token + && self.path == other.path + && TokenStreamHelper(&self.tokens) == TokenStreamHelper(&other.tokens) + } +} + +#[cfg(feature = "extra-traits")] +impl Hash for Attribute { + fn hash(&self, state: &mut H) + where + H: Hasher, + { + self.style.hash(state); + self.pound_token.hash(state); + self.bracket_token.hash(state); + self.path.hash(state); + TokenStreamHelper(&self.tokens).hash(state); + } +} + +impl Attribute { + /// Parses the content of the attribute, consisting of the path and tokens, + /// as a [`Meta`] if possible. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + pub fn parse_meta(&self) -> Result { + fn clone_ident_segment(segment: &PathSegment) -> PathSegment { + PathSegment { + ident: segment.ident.clone(), + arguments: PathArguments::None, + } + } + + let path = Path { + leading_colon: self + .path + .leading_colon + .as_ref() + .map(|colon| Token![::](colon.spans)), + segments: self + .path + .segments + .pairs() + .map(|pair| match pair { + Pair::Punctuated(seg, punct) => { + Pair::Punctuated(clone_ident_segment(seg), Token![::](punct.spans)) + } + Pair::End(seg) => Pair::End(clone_ident_segment(seg)), + }) + .collect(), + }; + + let parser = |input: ParseStream| parsing::parse_meta_after_path(path, input); + parse::Parser::parse2(parser, self.tokens.clone()) + } + + /// Parse the arguments to the attribute as a syntax tree. + /// + /// This is similar to `syn::parse2::(attr.tokens)` except that: + /// + /// - the surrounding delimiters are *not* included in the input to the + /// parser; and + /// - the error message has a more useful span when `tokens` is empty. + /// + /// ```text + /// #[my_attr(value < 5)] + /// ^^^^^^^^^ what gets parsed + /// ``` + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + pub fn parse_args(&self) -> Result { + self.parse_args_with(T::parse) + } + + /// Parse the arguments to the attribute using the given parser. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + pub fn parse_args_with(&self, parser: F) -> Result { + let parser = |input: ParseStream| { + let args = enter_args(self, input)?; + parse::parse_stream(parser, &args) + }; + parser.parse2(self.tokens.clone()) + } + + /// Parses zero or more outer attributes from the stream. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + pub fn parse_outer(input: ParseStream) -> Result> { + let mut attrs = Vec::new(); + while input.peek(Token![#]) && !input.peek(token::Group) { + attrs.push(input.call(parsing::single_parse_outer)?); + } + Ok(attrs) + } + + /// Parses zero or more inner attributes from the stream. + /// + /// *This function is available only if Syn is built with the `"parsing"` + /// feature.* + #[cfg(feature = "parsing")] + pub fn parse_inner(input: ParseStream) -> Result> { + let mut attrs = Vec::new(); + while input.peek(Token![#]) && input.peek2(Token![!]) && !input.peek(token::Group) { + attrs.push(input.call(parsing::single_parse_inner)?); + } + Ok(attrs) + } +} + +#[cfg(feature = "parsing")] +fn expected_parentheses(attr: &Attribute) -> String { + let style = match attr.style { + AttrStyle::Outer => "#", + AttrStyle::Inner(_) => "#!", + }; + + let mut path = String::new(); + for segment in &attr.path.segments { + if !path.is_empty() || attr.path.leading_colon.is_some() { + path += "::"; + } + path += &segment.ident.to_string(); + } + + format!("{}[{}(...)]", style, path) +} + +#[cfg(feature = "parsing")] +fn enter_args<'a>(attr: &Attribute, input: ParseStream<'a>) -> Result> { + if input.is_empty() { + let expected = expected_parentheses(attr); + let msg = format!("expected attribute arguments in parentheses: {}", expected); + return Err(crate::error::new2( + attr.pound_token.span, + attr.bracket_token.span, + msg, + )); + } else if input.peek(Token![=]) { + let expected = expected_parentheses(attr); + let msg = format!("expected parentheses: {}", expected); + return Err(input.error(msg)); + }; + + let content; + if input.peek(token::Paren) { + parenthesized!(content in input); + } else if input.peek(token::Bracket) { + bracketed!(content in input); + } else if input.peek(token::Brace) { + braced!(content in input); + } else { + return Err(input.error("unexpected token in attribute arguments")); + } + + if input.is_empty() { + Ok(content) + } else { + Err(input.error("unexpected token in attribute arguments")) + } +} + +ast_enum! { + /// Distinguishes between attributes that decorate an item and attributes + /// that are contained within an item. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// # Outer attributes + /// + /// - `#[repr(transparent)]` + /// - `/// # Example` + /// - `/** Please file an issue */` + /// + /// # Inner attributes + /// + /// - `#![feature(proc_macro)]` + /// - `//! # Example` + /// - `/*! Please file an issue */` + #[cfg_attr(feature = "clone-impls", derive(Copy))] + pub enum AttrStyle { + Outer, + Inner(Token![!]), + } +} + +ast_enum_of_structs! { + /// Content of a compile-time structured attribute. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// ## Path + /// + /// A meta path is like the `test` in `#[test]`. + /// + /// ## List + /// + /// A meta list is like the `derive(Copy)` in `#[derive(Copy)]`. + /// + /// ## NameValue + /// + /// A name-value meta is like the `path = "..."` in `#[path = + /// "sys/windows.rs"]`. + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: enum.Expr.html#syntax-tree-enums + // + // TODO: change syntax-tree-enum link to an intra rustdoc link, currently + // blocked on https://github.com/rust-lang/rust/issues/62833 + pub enum Meta { + Path(Path), + + /// A structured list within an attribute, like `derive(Copy, Clone)`. + List(MetaList), + + /// A name-value pair within an attribute, like `feature = "nightly"`. + NameValue(MetaNameValue), + } +} + +ast_struct! { + /// A structured list within an attribute, like `derive(Copy, Clone)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct MetaList { + pub path: Path, + pub paren_token: token::Paren, + pub nested: Punctuated, + } +} + +ast_struct! { + /// A name-value pair within an attribute, like `feature = "nightly"`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct MetaNameValue { + pub path: Path, + pub eq_token: Token![=], + pub lit: Lit, + } +} + +impl Meta { + /// Returns the identifier that begins this structured meta item. + /// + /// For example this would return the `test` in `#[test]`, the `derive` in + /// `#[derive(Copy)]`, and the `path` in `#[path = "sys/windows.rs"]`. + pub fn path(&self) -> &Path { + match self { + Meta::Path(path) => path, + Meta::List(meta) => &meta.path, + Meta::NameValue(meta) => &meta.path, + } + } +} + +ast_enum_of_structs! { + /// Element of a compile-time attribute list. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + pub enum NestedMeta { + /// A structured meta item, like the `Copy` in `#[derive(Copy)]` which + /// would be a nested `Meta::Path`. + Meta(Meta), + + /// A Rust literal, like the `"new_name"` in `#[rename("new_name")]`. + Lit(Lit), + } +} + +/// Conventional argument type associated with an invocation of an attribute +/// macro. +/// +/// For example if we are developing an attribute macro that is intended to be +/// invoked on function items as follows: +/// +/// ``` +/// # const IGNORE: &str = stringify! { +/// #[my_attribute(path = "/v1/refresh")] +/// # }; +/// pub fn refresh() { +/// /* ... */ +/// } +/// ``` +/// +/// The implementation of this macro would want to parse its attribute arguments +/// as type `AttributeArgs`. +/// +/// ``` +/// extern crate proc_macro; +/// +/// use proc_macro::TokenStream; +/// use syn::{parse_macro_input, AttributeArgs, ItemFn}; +/// +/// # const IGNORE: &str = stringify! { +/// #[proc_macro_attribute] +/// # }; +/// pub fn my_attribute(args: TokenStream, input: TokenStream) -> TokenStream { +/// let args = parse_macro_input!(args as AttributeArgs); +/// let input = parse_macro_input!(input as ItemFn); +/// +/// /* ... */ +/// # "".parse().unwrap() +/// } +/// ``` +pub type AttributeArgs = Vec; + +pub trait FilterAttrs<'a> { + type Ret: Iterator; + + fn outer(self) -> Self::Ret; + fn inner(self) -> Self::Ret; +} + +impl<'a, T> FilterAttrs<'a> for T +where + T: IntoIterator, +{ + type Ret = iter::Filter bool>; + + fn outer(self) -> Self::Ret { + fn is_outer(attr: &&Attribute) -> bool { + match attr.style { + AttrStyle::Outer => true, + _ => false, + } + } + self.into_iter().filter(is_outer) + } + + fn inner(self) -> Self::Ret { + fn is_inner(attr: &&Attribute) -> bool { + match attr.style { + AttrStyle::Inner(_) => true, + _ => false, + } + } + self.into_iter().filter(is_inner) + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + + use crate::ext::IdentExt; + use crate::parse::{Parse, ParseStream, Result}; + #[cfg(feature = "full")] + use crate::private; + + pub fn single_parse_inner(input: ParseStream) -> Result { + let content; + Ok(Attribute { + pound_token: input.parse()?, + style: AttrStyle::Inner(input.parse()?), + bracket_token: bracketed!(content in input), + path: content.call(Path::parse_mod_style)?, + tokens: content.parse()?, + }) + } + + pub fn single_parse_outer(input: ParseStream) -> Result { + let content; + Ok(Attribute { + pound_token: input.parse()?, + style: AttrStyle::Outer, + bracket_token: bracketed!(content in input), + path: content.call(Path::parse_mod_style)?, + tokens: content.parse()?, + }) + } + + #[cfg(feature = "full")] + impl private { + pub fn attrs(outer: Vec, inner: Vec) -> Vec { + let mut attrs = outer; + attrs.extend(inner); + attrs + } + } + + // Like Path::parse_mod_style but accepts keywords in the path. + fn parse_meta_path(input: ParseStream) -> Result { + Ok(Path { + leading_colon: input.parse()?, + segments: { + let mut segments = Punctuated::new(); + while input.peek(Ident::peek_any) { + let ident = Ident::parse_any(input)?; + segments.push_value(PathSegment::from(ident)); + if !input.peek(Token![::]) { + break; + } + let punct = input.parse()?; + segments.push_punct(punct); + } + if segments.is_empty() { + return Err(input.error("expected path")); + } else if segments.trailing_punct() { + return Err(input.error("expected path segment")); + } + segments + }, + }) + } + + impl Parse for Meta { + fn parse(input: ParseStream) -> Result { + let path = input.call(parse_meta_path)?; + parse_meta_after_path(path, input) + } + } + + impl Parse for MetaList { + fn parse(input: ParseStream) -> Result { + let path = input.call(parse_meta_path)?; + parse_meta_list_after_path(path, input) + } + } + + impl Parse for MetaNameValue { + fn parse(input: ParseStream) -> Result { + let path = input.call(parse_meta_path)?; + parse_meta_name_value_after_path(path, input) + } + } + + impl Parse for NestedMeta { + fn parse(input: ParseStream) -> Result { + if input.peek(Lit) && !(input.peek(LitBool) && input.peek2(Token![=])) { + input.parse().map(NestedMeta::Lit) + } else if input.peek(Ident::peek_any) { + input.parse().map(NestedMeta::Meta) + } else { + Err(input.error("expected identifier or literal")) + } + } + } + + pub fn parse_meta_after_path(path: Path, input: ParseStream) -> Result { + if input.peek(token::Paren) { + parse_meta_list_after_path(path, input).map(Meta::List) + } else if input.peek(Token![=]) { + parse_meta_name_value_after_path(path, input).map(Meta::NameValue) + } else { + Ok(Meta::Path(path)) + } + } + + fn parse_meta_list_after_path(path: Path, input: ParseStream) -> Result { + let content; + Ok(MetaList { + path, + paren_token: parenthesized!(content in input), + nested: content.parse_terminated(NestedMeta::parse)?, + }) + } + + fn parse_meta_name_value_after_path(path: Path, input: ParseStream) -> Result { + Ok(MetaNameValue { + path, + eq_token: input.parse()?, + lit: input.parse()?, + }) + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + use proc_macro2::TokenStream; + use quote::ToTokens; + + impl ToTokens for Attribute { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.pound_token.to_tokens(tokens); + if let AttrStyle::Inner(b) = &self.style { + b.to_tokens(tokens); + } + self.bracket_token.surround(tokens, |tokens| { + self.path.to_tokens(tokens); + self.tokens.to_tokens(tokens); + }); + } + } + + impl ToTokens for MetaList { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.path.to_tokens(tokens); + self.paren_token.surround(tokens, |tokens| { + self.nested.to_tokens(tokens); + }) + } + } + + impl ToTokens for MetaNameValue { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.path.to_tokens(tokens); + self.eq_token.to_tokens(tokens); + self.lit.to_tokens(tokens); + } + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/await.rs b/third_party/cargo/vendor/syn-1.0.27/src/await.rs new file mode 100644 index 0000000..a8e24fd --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/await.rs @@ -0,0 +1,2 @@ +// See include!("await.rs") in token.rs. +export_token_macro![(await)]; diff --git a/third_party/cargo/vendor/syn-1.0.27/src/bigint.rs b/third_party/cargo/vendor/syn-1.0.27/src/bigint.rs new file mode 100644 index 0000000..5397d6b --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/bigint.rs @@ -0,0 +1,66 @@ +use std::ops::{AddAssign, MulAssign}; + +// For implementing base10_digits() accessor on LitInt. +pub struct BigInt { + digits: Vec, +} + +impl BigInt { + pub fn new() -> Self { + BigInt { digits: Vec::new() } + } + + pub fn to_string(&self) -> String { + let mut repr = String::with_capacity(self.digits.len()); + + let mut has_nonzero = false; + for digit in self.digits.iter().rev() { + has_nonzero |= *digit != 0; + if has_nonzero { + repr.push((*digit + b'0') as char); + } + } + + if repr.is_empty() { + repr.push('0'); + } + + repr + } + + fn reserve_two_digits(&mut self) { + let len = self.digits.len(); + let desired = + len + !self.digits.ends_with(&[0, 0]) as usize + !self.digits.ends_with(&[0]) as usize; + self.digits.resize(desired, 0); + } +} + +impl AddAssign for BigInt { + // Assumes increment <16. + fn add_assign(&mut self, mut increment: u8) { + self.reserve_two_digits(); + + let mut i = 0; + while increment > 0 { + let sum = self.digits[i] + increment; + self.digits[i] = sum % 10; + increment = sum / 10; + i += 1; + } + } +} + +impl MulAssign for BigInt { + // Assumes base <=16. + fn mul_assign(&mut self, base: u8) { + self.reserve_two_digits(); + + let mut carry = 0; + for digit in &mut self.digits { + let prod = *digit * base + carry; + *digit = prod % 10; + carry = prod / 10; + } + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/buffer.rs b/third_party/cargo/vendor/syn-1.0.27/src/buffer.rs new file mode 100644 index 0000000..73255d6 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/buffer.rs @@ -0,0 +1,382 @@ +//! A stably addressed token buffer supporting efficient traversal based on a +//! cheaply copyable cursor. +//! +//! *This module is available only if Syn is built with the `"parsing"` feature.* + +// This module is heavily commented as it contains most of the unsafe code in +// Syn, and caution should be used when editing it. The public-facing interface +// is 100% safe but the implementation is fragile internally. + +#[cfg(all( + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), + feature = "proc-macro" +))] +use crate::proc_macro as pm; +use proc_macro2::{Delimiter, Group, Ident, Literal, Punct, Spacing, Span, TokenStream, TokenTree}; + +use std::marker::PhantomData; +use std::ptr; + +use crate::Lifetime; + +/// Internal type which is used instead of `TokenTree` to represent a token tree +/// within a `TokenBuffer`. +enum Entry { + // Mimicking types from proc-macro. + Group(Group, TokenBuffer), + Ident(Ident), + Punct(Punct), + Literal(Literal), + // End entries contain a raw pointer to the entry from the containing + // token tree, or null if this is the outermost level. + End(*const Entry), +} + +/// A buffer that can be efficiently traversed multiple times, unlike +/// `TokenStream` which requires a deep copy in order to traverse more than +/// once. +/// +/// *This type is available only if Syn is built with the `"parsing"` feature.* +pub struct TokenBuffer { + // NOTE: Do not derive clone on this - there are raw pointers inside which + // will be messed up. Moving the `TokenBuffer` itself is safe as the actual + // backing slices won't be moved. + data: Box<[Entry]>, +} + +impl TokenBuffer { + // NOTE: DO NOT MUTATE THE `Vec` RETURNED FROM THIS FUNCTION ONCE IT + // RETURNS, THE ADDRESS OF ITS BACKING MEMORY MUST REMAIN STABLE. + fn inner_new(stream: TokenStream, up: *const Entry) -> TokenBuffer { + // Build up the entries list, recording the locations of any Groups + // in the list to be processed later. + let mut entries = Vec::new(); + let mut seqs = Vec::new(); + for tt in stream { + match tt { + TokenTree::Ident(sym) => { + entries.push(Entry::Ident(sym)); + } + TokenTree::Punct(op) => { + entries.push(Entry::Punct(op)); + } + TokenTree::Literal(l) => { + entries.push(Entry::Literal(l)); + } + TokenTree::Group(g) => { + // Record the index of the interesting entry, and store an + // `End(null)` there temporarially. + seqs.push((entries.len(), g)); + entries.push(Entry::End(ptr::null())); + } + } + } + // Add an `End` entry to the end with a reference to the enclosing token + // stream which was passed in. + entries.push(Entry::End(up)); + + // NOTE: This is done to ensure that we don't accidentally modify the + // length of the backing buffer. The backing buffer must remain at a + // constant address after this point, as we are going to store a raw + // pointer into it. + let mut entries = entries.into_boxed_slice(); + for (idx, group) in seqs { + // We know that this index refers to one of the temporary + // `End(null)` entries, and we know that the last entry is + // `End(up)`, so the next index is also valid. + let seq_up = &entries[idx + 1] as *const Entry; + + // The end entry stored at the end of this Entry::Group should + // point to the Entry which follows the Group in the list. + let inner = Self::inner_new(group.stream(), seq_up); + entries[idx] = Entry::Group(group, inner); + } + + TokenBuffer { data: entries } + } + + /// Creates a `TokenBuffer` containing all the tokens from the input + /// `TokenStream`. + /// + /// *This method is available only if Syn is built with both the `"parsing"` and + /// `"proc-macro"` features.* + #[cfg(all( + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), + feature = "proc-macro" + ))] + pub fn new(stream: pm::TokenStream) -> TokenBuffer { + Self::new2(stream.into()) + } + + /// Creates a `TokenBuffer` containing all the tokens from the input + /// `TokenStream`. + pub fn new2(stream: TokenStream) -> TokenBuffer { + Self::inner_new(stream, ptr::null()) + } + + /// Creates a cursor referencing the first token in the buffer and able to + /// traverse until the end of the buffer. + pub fn begin(&self) -> Cursor { + unsafe { Cursor::create(&self.data[0], &self.data[self.data.len() - 1]) } + } +} + +/// A cheaply copyable cursor into a `TokenBuffer`. +/// +/// This cursor holds a shared reference into the immutable data which is used +/// internally to represent a `TokenStream`, and can be efficiently manipulated +/// and copied around. +/// +/// An empty `Cursor` can be created directly, or one may create a `TokenBuffer` +/// object and get a cursor to its first token with `begin()`. +/// +/// Two cursors are equal if they have the same location in the same input +/// stream, and have the same scope. +/// +/// *This type is available only if Syn is built with the `"parsing"` feature.* +#[derive(Copy, Clone, Eq, PartialEq)] +pub struct Cursor<'a> { + // The current entry which the `Cursor` is pointing at. + ptr: *const Entry, + // This is the only `Entry::End(..)` object which this cursor is allowed to + // point at. All other `End` objects are skipped over in `Cursor::create`. + scope: *const Entry, + // Cursor is covariant in 'a. This field ensures that our pointers are still + // valid. + marker: PhantomData<&'a Entry>, +} + +impl<'a> Cursor<'a> { + /// Creates a cursor referencing a static empty TokenStream. + pub fn empty() -> Self { + // It's safe in this situation for us to put an `Entry` object in global + // storage, despite it not actually being safe to send across threads + // (`Ident` is a reference into a thread-local table). This is because + // this entry never includes a `Ident` object. + // + // This wrapper struct allows us to break the rules and put a `Sync` + // object in global storage. + struct UnsafeSyncEntry(Entry); + unsafe impl Sync for UnsafeSyncEntry {} + static EMPTY_ENTRY: UnsafeSyncEntry = UnsafeSyncEntry(Entry::End(0 as *const Entry)); + + Cursor { + ptr: &EMPTY_ENTRY.0, + scope: &EMPTY_ENTRY.0, + marker: PhantomData, + } + } + + /// This create method intelligently exits non-explicitly-entered + /// `None`-delimited scopes when the cursor reaches the end of them, + /// allowing for them to be treated transparently. + unsafe fn create(mut ptr: *const Entry, scope: *const Entry) -> Self { + // NOTE: If we're looking at a `End(..)`, we want to advance the cursor + // past it, unless `ptr == scope`, which means that we're at the edge of + // our cursor's scope. We should only have `ptr != scope` at the exit + // from None-delimited groups entered with `ignore_none`. + while let Entry::End(exit) = *ptr { + if ptr == scope { + break; + } + ptr = exit; + } + + Cursor { + ptr, + scope, + marker: PhantomData, + } + } + + /// Get the current entry. + fn entry(self) -> &'a Entry { + unsafe { &*self.ptr } + } + + /// Bump the cursor to point at the next token after the current one. This + /// is undefined behavior if the cursor is currently looking at an + /// `Entry::End`. + unsafe fn bump(self) -> Cursor<'a> { + Cursor::create(self.ptr.offset(1), self.scope) + } + + /// If the cursor is looking at a `None`-delimited group, move it to look at + /// the first token inside instead. If the group is empty, this will move + /// the cursor past the `None`-delimited group. + /// + /// WARNING: This mutates its argument. + fn ignore_none(&mut self) { + if let Entry::Group(group, buf) = self.entry() { + if group.delimiter() == Delimiter::None { + // NOTE: We call `Cursor::create` here to make sure that + // situations where we should immediately exit the span after + // entering it are handled correctly. + unsafe { + *self = Cursor::create(&buf.data[0], self.scope); + } + } + } + } + + /// Checks whether the cursor is currently pointing at the end of its valid + /// scope. + pub fn eof(self) -> bool { + // We're at eof if we're at the end of our scope. + self.ptr == self.scope + } + + /// If the cursor is pointing at a `Group` with the given delimiter, returns + /// a cursor into that group and one pointing to the next `TokenTree`. + pub fn group(mut self, delim: Delimiter) -> Option<(Cursor<'a>, Span, Cursor<'a>)> { + // If we're not trying to enter a none-delimited group, we want to + // ignore them. We have to make sure to _not_ ignore them when we want + // to enter them, of course. For obvious reasons. + if delim != Delimiter::None { + self.ignore_none(); + } + + if let Entry::Group(group, buf) = self.entry() { + if group.delimiter() == delim { + return Some((buf.begin(), group.span(), unsafe { self.bump() })); + } + } + + None + } + + /// If the cursor is pointing at a `Ident`, returns it along with a cursor + /// pointing at the next `TokenTree`. + pub fn ident(mut self) -> Option<(Ident, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Ident(ident) => Some((ident.clone(), unsafe { self.bump() })), + _ => None, + } + } + + /// If the cursor is pointing at an `Punct`, returns it along with a cursor + /// pointing at the next `TokenTree`. + pub fn punct(mut self) -> Option<(Punct, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Punct(op) if op.as_char() != '\'' => Some((op.clone(), unsafe { self.bump() })), + _ => None, + } + } + + /// If the cursor is pointing at a `Literal`, return it along with a cursor + /// pointing at the next `TokenTree`. + pub fn literal(mut self) -> Option<(Literal, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Literal(lit) => Some((lit.clone(), unsafe { self.bump() })), + _ => None, + } + } + + /// If the cursor is pointing at a `Lifetime`, returns it along with a + /// cursor pointing at the next `TokenTree`. + pub fn lifetime(mut self) -> Option<(Lifetime, Cursor<'a>)> { + self.ignore_none(); + match self.entry() { + Entry::Punct(op) if op.as_char() == '\'' && op.spacing() == Spacing::Joint => { + let next = unsafe { self.bump() }; + match next.ident() { + Some((ident, rest)) => { + let lifetime = Lifetime { + apostrophe: op.span(), + ident, + }; + Some((lifetime, rest)) + } + None => None, + } + } + _ => None, + } + } + + /// Copies all remaining tokens visible from this cursor into a + /// `TokenStream`. + pub fn token_stream(self) -> TokenStream { + let mut tts = Vec::new(); + let mut cursor = self; + while let Some((tt, rest)) = cursor.token_tree() { + tts.push(tt); + cursor = rest; + } + tts.into_iter().collect() + } + + /// If the cursor is pointing at a `TokenTree`, returns it along with a + /// cursor pointing at the next `TokenTree`. + /// + /// Returns `None` if the cursor has reached the end of its stream. + /// + /// This method does not treat `None`-delimited groups as transparent, and + /// will return a `Group(None, ..)` if the cursor is looking at one. + pub fn token_tree(self) -> Option<(TokenTree, Cursor<'a>)> { + let tree = match self.entry() { + Entry::Group(group, _) => group.clone().into(), + Entry::Literal(lit) => lit.clone().into(), + Entry::Ident(ident) => ident.clone().into(), + Entry::Punct(op) => op.clone().into(), + Entry::End(..) => { + return None; + } + }; + + Some((tree, unsafe { self.bump() })) + } + + /// Returns the `Span` of the current token, or `Span::call_site()` if this + /// cursor points to eof. + pub fn span(self) -> Span { + match self.entry() { + Entry::Group(group, _) => group.span(), + Entry::Literal(l) => l.span(), + Entry::Ident(t) => t.span(), + Entry::Punct(o) => o.span(), + Entry::End(..) => Span::call_site(), + } + } + + /// Skip over the next token without cloning it. Returns `None` if this + /// cursor points to eof. + /// + /// This method treats `'lifetimes` as a single token. + pub(crate) fn skip(self) -> Option> { + match self.entry() { + Entry::End(..) => None, + + // Treat lifetimes as a single tt for the purposes of 'skip'. + Entry::Punct(op) if op.as_char() == '\'' && op.spacing() == Spacing::Joint => { + let next = unsafe { self.bump() }; + match next.entry() { + Entry::Ident(_) => Some(unsafe { next.bump() }), + _ => Some(next), + } + } + _ => Some(unsafe { self.bump() }), + } + } +} + +pub(crate) fn same_scope(a: Cursor, b: Cursor) -> bool { + a.scope == b.scope +} + +pub(crate) fn open_span_of_group(cursor: Cursor) -> Span { + match cursor.entry() { + Entry::Group(group, _) => group.span_open(), + _ => cursor.span(), + } +} + +pub(crate) fn close_span_of_group(cursor: Cursor) -> Span { + match cursor.entry() { + Entry::Group(group, _) => group.span_close(), + _ => cursor.span(), + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/custom_keyword.rs b/third_party/cargo/vendor/syn-1.0.27/src/custom_keyword.rs new file mode 100644 index 0000000..a33044a --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/custom_keyword.rs @@ -0,0 +1,252 @@ +/// Define a type that supports parsing and printing a given identifier as if it +/// were a keyword. +/// +/// # Usage +/// +/// As a convention, it is recommended that this macro be invoked within a +/// module called `kw` or `keyword` and that the resulting parser be invoked +/// with a `kw::` or `keyword::` prefix. +/// +/// ``` +/// mod kw { +/// syn::custom_keyword!(whatever); +/// } +/// ``` +/// +/// The generated syntax tree node supports the following operations just like +/// any built-in keyword token. +/// +/// - [Peeking] — `input.peek(kw::whatever)` +/// +/// - [Parsing] — `input.parse::()?` +/// +/// - [Printing] — `quote!( ... #whatever_token ... )` +/// +/// - Construction from a [`Span`] — `let whatever_token = kw::whatever(sp)` +/// +/// - Field access to its span — `let sp = whatever_token.span` +/// +/// [Peeking]: parse::ParseBuffer::peek +/// [Parsing]: parse::ParseBuffer::parse +/// [Printing]: quote::ToTokens +/// [`Span`]: proc_macro2::Span +/// +/// # Example +/// +/// This example parses input that looks like `bool = true` or `str = "value"`. +/// The key must be either the identifier `bool` or the identifier `str`. If +/// `bool`, the value may be either `true` or `false`. If `str`, the value may +/// be any string literal. +/// +/// The symbols `bool` and `str` are not reserved keywords in Rust so these are +/// not considered keywords in the `syn::token` module. Like any other +/// identifier that is not a keyword, these can be declared as custom keywords +/// by crates that need to use them as such. +/// +/// ``` +/// use syn::{LitBool, LitStr, Result, Token}; +/// use syn::parse::{Parse, ParseStream}; +/// +/// mod kw { +/// syn::custom_keyword!(bool); +/// syn::custom_keyword!(str); +/// } +/// +/// enum Argument { +/// Bool { +/// bool_token: kw::bool, +/// eq_token: Token![=], +/// value: LitBool, +/// }, +/// Str { +/// str_token: kw::str, +/// eq_token: Token![=], +/// value: LitStr, +/// }, +/// } +/// +/// impl Parse for Argument { +/// fn parse(input: ParseStream) -> Result { +/// let lookahead = input.lookahead1(); +/// if lookahead.peek(kw::bool) { +/// Ok(Argument::Bool { +/// bool_token: input.parse::()?, +/// eq_token: input.parse()?, +/// value: input.parse()?, +/// }) +/// } else if lookahead.peek(kw::str) { +/// Ok(Argument::Str { +/// str_token: input.parse::()?, +/// eq_token: input.parse()?, +/// value: input.parse()?, +/// }) +/// } else { +/// Err(lookahead.error()) +/// } +/// } +/// } +/// ``` +#[macro_export] +macro_rules! custom_keyword { + ($ident:ident) => { + #[allow(non_camel_case_types)] + pub struct $ident { + pub span: $crate::export::Span, + } + + #[doc(hidden)] + #[allow(dead_code, non_snake_case)] + pub fn $ident<__S: $crate::export::IntoSpans<[$crate::export::Span; 1]>>( + span: __S, + ) -> $ident { + $ident { + span: $crate::export::IntoSpans::into_spans(span)[0], + } + } + + impl $crate::export::Default for $ident { + fn default() -> Self { + $ident { + span: $crate::export::Span::call_site(), + } + } + } + + $crate::impl_parse_for_custom_keyword!($ident); + $crate::impl_to_tokens_for_custom_keyword!($ident); + $crate::impl_clone_for_custom_keyword!($ident); + $crate::impl_extra_traits_for_custom_keyword!($ident); + }; +} + +// Not public API. +#[cfg(feature = "parsing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_keyword { + ($ident:ident) => { + // For peek. + impl $crate::token::CustomToken for $ident { + fn peek(cursor: $crate::buffer::Cursor) -> $crate::export::bool { + if let Some((ident, _rest)) = cursor.ident() { + ident == stringify!($ident) + } else { + false + } + } + + fn display() -> &'static $crate::export::str { + concat!("`", stringify!($ident), "`") + } + } + + impl $crate::parse::Parse for $ident { + fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> { + input.step(|cursor| { + if let $crate::export::Some((ident, rest)) = cursor.ident() { + if ident == stringify!($ident) { + return $crate::export::Ok(($ident { span: ident.span() }, rest)); + } + } + $crate::export::Err(cursor.error(concat!( + "expected `", + stringify!($ident), + "`" + ))) + }) + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "parsing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_keyword { + ($ident:ident) => {}; +} + +// Not public API. +#[cfg(feature = "printing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_keyword { + ($ident:ident) => { + impl $crate::export::ToTokens for $ident { + fn to_tokens(&self, tokens: &mut $crate::export::TokenStream2) { + let ident = $crate::Ident::new(stringify!($ident), self.span); + $crate::export::TokenStreamExt::append(tokens, ident); + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "printing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_keyword { + ($ident:ident) => {}; +} + +// Not public API. +#[cfg(feature = "clone-impls")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_keyword { + ($ident:ident) => { + impl $crate::export::Copy for $ident {} + + impl $crate::export::Clone for $ident { + fn clone(&self) -> Self { + *self + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "clone-impls"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_keyword { + ($ident:ident) => {}; +} + +// Not public API. +#[cfg(feature = "extra-traits")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_keyword { + ($ident:ident) => { + impl $crate::export::Debug for $ident { + fn fmt(&self, f: &mut $crate::export::Formatter) -> $crate::export::fmt::Result { + $crate::export::Formatter::write_str( + f, + concat!("Keyword [", stringify!($ident), "]"), + ) + } + } + + impl $crate::export::Eq for $ident {} + + impl $crate::export::PartialEq for $ident { + fn eq(&self, _other: &Self) -> $crate::export::bool { + true + } + } + + impl $crate::export::Hash for $ident { + fn hash<__H: $crate::export::Hasher>(&self, _state: &mut __H) {} + } + }; +} + +// Not public API. +#[cfg(not(feature = "extra-traits"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_keyword { + ($ident:ident) => {}; +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/custom_punctuation.rs b/third_party/cargo/vendor/syn-1.0.27/src/custom_punctuation.rs new file mode 100644 index 0000000..70dff42 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/custom_punctuation.rs @@ -0,0 +1,299 @@ +/// Define a type that supports parsing and printing a multi-character symbol +/// as if it were a punctuation token. +/// +/// # Usage +/// +/// ``` +/// syn::custom_punctuation!(LeftRightArrow, <=>); +/// ``` +/// +/// The generated syntax tree node supports the following operations just like +/// any built-in punctuation token. +/// +/// - [Peeking] — `input.peek(LeftRightArrow)` +/// +/// - [Parsing] — `input.parse::()?` +/// +/// - [Printing] — `quote!( ... #lrarrow ... )` +/// +/// - Construction from a [`Span`] — `let lrarrow = LeftRightArrow(sp)` +/// +/// - Construction from multiple [`Span`] — `let lrarrow = LeftRightArrow([sp, sp, sp])` +/// +/// - Field access to its spans — `let spans = lrarrow.spans` +/// +/// [Peeking]: parse::ParseBuffer::peek +/// [Parsing]: parse::ParseBuffer::parse +/// [Printing]: quote::ToTokens +/// [`Span`]: proc_macro2::Span +/// +/// # Example +/// +/// ``` +/// use proc_macro2::{TokenStream, TokenTree}; +/// use syn::parse::{Parse, ParseStream, Peek, Result}; +/// use syn::punctuated::Punctuated; +/// use syn::Expr; +/// +/// syn::custom_punctuation!(PathSeparator, ); +/// +/// // expr expr expr ... +/// struct PathSegments { +/// segments: Punctuated, +/// } +/// +/// impl Parse for PathSegments { +/// fn parse(input: ParseStream) -> Result { +/// let mut segments = Punctuated::new(); +/// +/// let first = parse_until(input, PathSeparator)?; +/// segments.push_value(syn::parse2(first)?); +/// +/// while input.peek(PathSeparator) { +/// segments.push_punct(input.parse()?); +/// +/// let next = parse_until(input, PathSeparator)?; +/// segments.push_value(syn::parse2(next)?); +/// } +/// +/// Ok(PathSegments { segments }) +/// } +/// } +/// +/// fn parse_until(input: ParseStream, end: E) -> Result { +/// let mut tokens = TokenStream::new(); +/// while !input.is_empty() && !input.peek(end) { +/// let next: TokenTree = input.parse()?; +/// tokens.extend(Some(next)); +/// } +/// Ok(tokens) +/// } +/// +/// fn main() { +/// let input = r#" a::b c::d::e "#; +/// let _: PathSegments = syn::parse_str(input).unwrap(); +/// } +/// ``` +#[macro_export] +macro_rules! custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + pub struct $ident { + pub spans: $crate::custom_punctuation_repr!($($tt)+), + } + + #[doc(hidden)] + #[allow(dead_code, non_snake_case)] + pub fn $ident<__S: $crate::export::IntoSpans<$crate::custom_punctuation_repr!($($tt)+)>>( + spans: __S, + ) -> $ident { + let _validate_len = 0 $(+ $crate::custom_punctuation_len!(strict, $tt))*; + $ident { + spans: $crate::export::IntoSpans::into_spans(spans) + } + } + + impl $crate::export::Default for $ident { + fn default() -> Self { + $ident($crate::export::Span::call_site()) + } + } + + $crate::impl_parse_for_custom_punctuation!($ident, $($tt)+); + $crate::impl_to_tokens_for_custom_punctuation!($ident, $($tt)+); + $crate::impl_clone_for_custom_punctuation!($ident, $($tt)+); + $crate::impl_extra_traits_for_custom_punctuation!($ident, $($tt)+); + }; +} + +// Not public API. +#[cfg(feature = "parsing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::token::CustomToken for $ident { + fn peek(cursor: $crate::buffer::Cursor) -> bool { + $crate::token::parsing::peek_punct(cursor, $crate::stringify_punct!($($tt)+)) + } + + fn display() -> &'static $crate::export::str { + concat!("`", $crate::stringify_punct!($($tt)+), "`") + } + } + + impl $crate::parse::Parse for $ident { + fn parse(input: $crate::parse::ParseStream) -> $crate::parse::Result<$ident> { + let spans: $crate::custom_punctuation_repr!($($tt)+) = + $crate::token::parsing::punct(input, $crate::stringify_punct!($($tt)+))?; + Ok($ident(spans)) + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "parsing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_parse_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[cfg(feature = "printing")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::export::ToTokens for $ident { + fn to_tokens(&self, tokens: &mut $crate::export::TokenStream2) { + $crate::token::printing::punct($crate::stringify_punct!($($tt)+), &self.spans, tokens) + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "printing"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_to_tokens_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[cfg(feature = "clone-impls")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::export::Copy for $ident {} + + impl $crate::export::Clone for $ident { + fn clone(&self) -> Self { + *self + } + } + }; +} + +// Not public API. +#[cfg(not(feature = "clone-impls"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_clone_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[cfg(feature = "extra-traits")] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => { + impl $crate::export::Debug for $ident { + fn fmt(&self, f: &mut $crate::export::Formatter) -> $crate::export::fmt::Result { + $crate::export::Formatter::write_str(f, stringify!($ident)) + } + } + + impl $crate::export::Eq for $ident {} + + impl $crate::export::PartialEq for $ident { + fn eq(&self, _other: &Self) -> $crate::export::bool { + true + } + } + + impl $crate::export::Hash for $ident { + fn hash<__H: $crate::export::Hasher>(&self, _state: &mut __H) {} + } + }; +} + +// Not public API. +#[cfg(not(feature = "extra-traits"))] +#[doc(hidden)] +#[macro_export] +macro_rules! impl_extra_traits_for_custom_punctuation { + ($ident:ident, $($tt:tt)+) => {}; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +macro_rules! custom_punctuation_repr { + ($($tt:tt)+) => { + [$crate::export::Span; 0 $(+ $crate::custom_punctuation_len!(lenient, $tt))+] + }; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +#[rustfmt::skip] +macro_rules! custom_punctuation_len { + ($mode:ident, +) => { 1 }; + ($mode:ident, +=) => { 2 }; + ($mode:ident, &) => { 1 }; + ($mode:ident, &&) => { 2 }; + ($mode:ident, &=) => { 2 }; + ($mode:ident, @) => { 1 }; + ($mode:ident, !) => { 1 }; + ($mode:ident, ^) => { 1 }; + ($mode:ident, ^=) => { 2 }; + ($mode:ident, :) => { 1 }; + ($mode:ident, ::) => { 2 }; + ($mode:ident, ,) => { 1 }; + ($mode:ident, /) => { 1 }; + ($mode:ident, /=) => { 2 }; + ($mode:ident, .) => { 1 }; + ($mode:ident, ..) => { 2 }; + ($mode:ident, ...) => { 3 }; + ($mode:ident, ..=) => { 3 }; + ($mode:ident, =) => { 1 }; + ($mode:ident, ==) => { 2 }; + ($mode:ident, >=) => { 2 }; + ($mode:ident, >) => { 1 }; + ($mode:ident, <=) => { 2 }; + ($mode:ident, <) => { 1 }; + ($mode:ident, *=) => { 2 }; + ($mode:ident, !=) => { 2 }; + ($mode:ident, |) => { 1 }; + ($mode:ident, |=) => { 2 }; + ($mode:ident, ||) => { 2 }; + ($mode:ident, #) => { 1 }; + ($mode:ident, ?) => { 1 }; + ($mode:ident, ->) => { 2 }; + ($mode:ident, <-) => { 2 }; + ($mode:ident, %) => { 1 }; + ($mode:ident, %=) => { 2 }; + ($mode:ident, =>) => { 2 }; + ($mode:ident, ;) => { 1 }; + ($mode:ident, <<) => { 2 }; + ($mode:ident, <<=) => { 3 }; + ($mode:ident, >>) => { 2 }; + ($mode:ident, >>=) => { 3 }; + ($mode:ident, *) => { 1 }; + ($mode:ident, -) => { 1 }; + ($mode:ident, -=) => { 2 }; + ($mode:ident, ~) => { 1 }; + (lenient, $tt:tt) => { 0 }; + (strict, $tt:tt) => {{ $crate::custom_punctuation_unexpected!($tt); 0 }}; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +macro_rules! custom_punctuation_unexpected { + () => {}; +} + +// Not public API. +#[doc(hidden)] +#[macro_export] +macro_rules! stringify_punct { + ($($tt:tt)+) => { + concat!($(stringify!($tt)),+) + }; +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/data.rs b/third_party/cargo/vendor/syn-1.0.27/src/data.rs new file mode 100644 index 0000000..a7174c4 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/data.rs @@ -0,0 +1,466 @@ +use super::*; +use crate::punctuated::Punctuated; + +ast_struct! { + /// An enum variant. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + pub struct Variant { + /// Attributes tagged on the variant. + pub attrs: Vec, + + /// Name of the variant. + pub ident: Ident, + + /// Content stored in the variant. + pub fields: Fields, + + /// Explicit discriminant: `Variant = 1` + pub discriminant: Option<(Token![=], Expr)>, + } +} + +ast_enum_of_structs! { + /// Data stored within an enum variant or struct. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: enum.Expr.html#syntax-tree-enums + // + // TODO: change syntax-tree-enum link to an intra rustdoc link, currently + // blocked on https://github.com/rust-lang/rust/issues/62833 + pub enum Fields { + /// Named fields of a struct or struct variant such as `Point { x: f64, + /// y: f64 }`. + Named(FieldsNamed), + + /// Unnamed fields of a tuple struct or tuple variant such as `Some(T)`. + Unnamed(FieldsUnnamed), + + /// Unit struct or unit variant such as `None`. + Unit, + } +} + +ast_struct! { + /// Named fields of a struct or struct variant such as `Point { x: f64, + /// y: f64 }`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct FieldsNamed { + pub brace_token: token::Brace, + pub named: Punctuated, + } +} + +ast_struct! { + /// Unnamed fields of a tuple struct or tuple variant such as `Some(T)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct FieldsUnnamed { + pub paren_token: token::Paren, + pub unnamed: Punctuated, + } +} + +impl Fields { + /// Get an iterator over the borrowed [`Field`] items in this object. This + /// iterator can be used to iterate over a named or unnamed struct or + /// variant's fields uniformly. + pub fn iter(&self) -> punctuated::Iter { + match self { + Fields::Unit => crate::punctuated::empty_punctuated_iter(), + Fields::Named(f) => f.named.iter(), + Fields::Unnamed(f) => f.unnamed.iter(), + } + } + + /// Get an iterator over the mutably borrowed [`Field`] items in this + /// object. This iterator can be used to iterate over a named or unnamed + /// struct or variant's fields uniformly. + pub fn iter_mut(&mut self) -> punctuated::IterMut { + match self { + Fields::Unit => crate::punctuated::empty_punctuated_iter_mut(), + Fields::Named(f) => f.named.iter_mut(), + Fields::Unnamed(f) => f.unnamed.iter_mut(), + } + } + + /// Returns the number of fields. + pub fn len(&self) -> usize { + match self { + Fields::Unit => 0, + Fields::Named(f) => f.named.len(), + Fields::Unnamed(f) => f.unnamed.len(), + } + } + + /// Returns `true` if there are zero fields. + pub fn is_empty(&self) -> bool { + match self { + Fields::Unit => true, + Fields::Named(f) => f.named.is_empty(), + Fields::Unnamed(f) => f.unnamed.is_empty(), + } + } +} + +impl IntoIterator for Fields { + type Item = Field; + type IntoIter = punctuated::IntoIter; + + fn into_iter(self) -> Self::IntoIter { + match self { + Fields::Unit => Punctuated::::new().into_iter(), + Fields::Named(f) => f.named.into_iter(), + Fields::Unnamed(f) => f.unnamed.into_iter(), + } + } +} + +impl<'a> IntoIterator for &'a Fields { + type Item = &'a Field; + type IntoIter = punctuated::Iter<'a, Field>; + + fn into_iter(self) -> Self::IntoIter { + self.iter() + } +} + +impl<'a> IntoIterator for &'a mut Fields { + type Item = &'a mut Field; + type IntoIter = punctuated::IterMut<'a, Field>; + + fn into_iter(self) -> Self::IntoIter { + self.iter_mut() + } +} + +ast_struct! { + /// A field of a struct or enum variant. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + pub struct Field { + /// Attributes tagged on the field. + pub attrs: Vec, + + /// Visibility of the field. + pub vis: Visibility, + + /// Name of the field, if any. + /// + /// Fields of tuple structs have no names. + pub ident: Option, + + pub colon_token: Option, + + /// Type of the field. + pub ty: Type, + } +} + +ast_enum_of_structs! { + /// The visibility level of an item: inherited or `pub` or + /// `pub(restricted)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature.* + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: enum.Expr.html#syntax-tree-enums + // + // TODO: change syntax-tree-enum link to an intra rustdoc link, currently + // blocked on https://github.com/rust-lang/rust/issues/62833 + pub enum Visibility { + /// A public visibility level: `pub`. + Public(VisPublic), + + /// A crate-level visibility: `crate`. + Crate(VisCrate), + + /// A visibility level restricted to some path: `pub(self)` or + /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. + Restricted(VisRestricted), + + /// An inherited visibility, which usually means private. + Inherited, + } +} + +ast_struct! { + /// A public visibility level: `pub`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct VisPublic { + pub pub_token: Token![pub], + } +} + +ast_struct! { + /// A crate-level visibility: `crate`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct VisCrate { + pub crate_token: Token![crate], + } +} + +ast_struct! { + /// A visibility level restricted to some path: `pub(self)` or + /// `pub(super)` or `pub(crate)` or `pub(in some::module)`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct VisRestricted { + pub pub_token: Token![pub], + pub paren_token: token::Paren, + pub in_token: Option, + pub path: Box, + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + + use crate::ext::IdentExt; + use crate::parse::discouraged::Speculative; + use crate::parse::{Parse, ParseStream, Result}; + + impl Parse for Variant { + fn parse(input: ParseStream) -> Result { + let attrs = input.call(Attribute::parse_outer)?; + let _visibility: Visibility = input.parse()?; + Ok(Variant { + attrs, + ident: input.parse()?, + fields: { + if input.peek(token::Brace) { + Fields::Named(input.parse()?) + } else if input.peek(token::Paren) { + Fields::Unnamed(input.parse()?) + } else { + Fields::Unit + } + }, + discriminant: { + if input.peek(Token![=]) { + let eq_token: Token![=] = input.parse()?; + let discriminant: Expr = input.parse()?; + Some((eq_token, discriminant)) + } else { + None + } + }, + }) + } + } + + impl Parse for FieldsNamed { + fn parse(input: ParseStream) -> Result { + let content; + Ok(FieldsNamed { + brace_token: braced!(content in input), + named: content.parse_terminated(Field::parse_named)?, + }) + } + } + + impl Parse for FieldsUnnamed { + fn parse(input: ParseStream) -> Result { + let content; + Ok(FieldsUnnamed { + paren_token: parenthesized!(content in input), + unnamed: content.parse_terminated(Field::parse_unnamed)?, + }) + } + } + + impl Field { + /// Parses a named (braced struct) field. + pub fn parse_named(input: ParseStream) -> Result { + Ok(Field { + attrs: input.call(Attribute::parse_outer)?, + vis: input.parse()?, + ident: Some(input.parse()?), + colon_token: Some(input.parse()?), + ty: input.parse()?, + }) + } + + /// Parses an unnamed (tuple struct) field. + pub fn parse_unnamed(input: ParseStream) -> Result { + Ok(Field { + attrs: input.call(Attribute::parse_outer)?, + vis: input.parse()?, + ident: None, + colon_token: None, + ty: input.parse()?, + }) + } + } + + impl Parse for Visibility { + fn parse(input: ParseStream) -> Result { + if input.peek(Token![pub]) { + Self::parse_pub(input) + } else if input.peek(Token![crate]) { + Self::parse_crate(input) + } else { + Ok(Visibility::Inherited) + } + } + } + + impl Visibility { + fn parse_pub(input: ParseStream) -> Result { + let pub_token = input.parse::()?; + + if input.peek(token::Paren) { + let ahead = input.fork(); + + let content; + let paren_token = parenthesized!(content in ahead); + if content.peek(Token![crate]) + || content.peek(Token![self]) + || content.peek(Token![super]) + { + let path = content.call(Ident::parse_any)?; + + // Ensure there are no additional tokens within `content`. + // Without explicitly checking, we may misinterpret a tuple + // field as a restricted visibility, causing a parse error. + // e.g. `pub (crate::A, crate::B)` (Issue #720). + if content.is_empty() { + input.advance_to(&ahead); + return Ok(Visibility::Restricted(VisRestricted { + pub_token, + paren_token, + in_token: None, + path: Box::new(Path::from(path)), + })); + } + } else if content.peek(Token![in]) { + let in_token: Token![in] = content.parse()?; + let path = content.call(Path::parse_mod_style)?; + + input.advance_to(&ahead); + return Ok(Visibility::Restricted(VisRestricted { + pub_token, + paren_token, + in_token: Some(in_token), + path: Box::new(path), + })); + } + } + + Ok(Visibility::Public(VisPublic { pub_token })) + } + + fn parse_crate(input: ParseStream) -> Result { + if input.peek2(Token![::]) { + Ok(Visibility::Inherited) + } else { + Ok(Visibility::Crate(VisCrate { + crate_token: input.parse()?, + })) + } + } + + #[cfg(feature = "full")] + pub(crate) fn is_some(&self) -> bool { + match self { + Visibility::Inherited => false, + _ => true, + } + } + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + + use proc_macro2::TokenStream; + use quote::{ToTokens, TokenStreamExt}; + + use crate::print::TokensOrDefault; + + impl ToTokens for Variant { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append_all(&self.attrs); + self.ident.to_tokens(tokens); + self.fields.to_tokens(tokens); + if let Some((eq_token, disc)) = &self.discriminant { + eq_token.to_tokens(tokens); + disc.to_tokens(tokens); + } + } + } + + impl ToTokens for FieldsNamed { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.brace_token.surround(tokens, |tokens| { + self.named.to_tokens(tokens); + }); + } + } + + impl ToTokens for FieldsUnnamed { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.paren_token.surround(tokens, |tokens| { + self.unnamed.to_tokens(tokens); + }); + } + } + + impl ToTokens for Field { + fn to_tokens(&self, tokens: &mut TokenStream) { + tokens.append_all(&self.attrs); + self.vis.to_tokens(tokens); + if let Some(ident) = &self.ident { + ident.to_tokens(tokens); + TokensOrDefault(&self.colon_token).to_tokens(tokens); + } + self.ty.to_tokens(tokens); + } + } + + impl ToTokens for VisPublic { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.pub_token.to_tokens(tokens) + } + } + + impl ToTokens for VisCrate { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.crate_token.to_tokens(tokens); + } + } + + impl ToTokens for VisRestricted { + fn to_tokens(&self, tokens: &mut TokenStream) { + self.pub_token.to_tokens(tokens); + self.paren_token.surround(tokens, |tokens| { + // TODO: If we have a path which is not "self" or "super" or + // "crate", automatically add the "in" token. + self.in_token.to_tokens(tokens); + self.path.to_tokens(tokens); + }); + } + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/derive.rs b/third_party/cargo/vendor/syn-1.0.27/src/derive.rs new file mode 100644 index 0000000..3fa9d89 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/derive.rs @@ -0,0 +1,273 @@ +use super::*; +use crate::punctuated::Punctuated; + +ast_struct! { + /// Data structure sent to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` feature.* + pub struct DeriveInput { + /// Attributes tagged on the whole struct or enum. + pub attrs: Vec, + + /// Visibility of the struct or enum. + pub vis: Visibility, + + /// Name of the struct or enum. + pub ident: Ident, + + /// Generics required to complete the definition. + pub generics: Generics, + + /// Data within the struct or enum. + pub data: Data, + } +} + +ast_enum_of_structs! { + /// The storage of a struct, enum or union data structure. + /// + /// *This type is available only if Syn is built with the `"derive"` feature.* + /// + /// # Syntax tree enum + /// + /// This type is a [syntax tree enum]. + /// + /// [syntax tree enum]: enum.Expr.html#syntax-tree-enums + // + // TODO: change syntax-tree-enum link to an intra rustdoc link, currently + // blocked on https://github.com/rust-lang/rust/issues/62833 + pub enum Data { + /// A struct input to a `proc_macro_derive` macro. + Struct(DataStruct), + + /// An enum input to a `proc_macro_derive` macro. + Enum(DataEnum), + + /// An untagged union input to a `proc_macro_derive` macro. + Union(DataUnion), + } + + do_not_generate_to_tokens +} + +ast_struct! { + /// A struct input to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` + /// feature.* + pub struct DataStruct { + pub struct_token: Token![struct], + pub fields: Fields, + pub semi_token: Option, + } +} + +ast_struct! { + /// An enum input to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` + /// feature.* + pub struct DataEnum { + pub enum_token: Token![enum], + pub brace_token: token::Brace, + pub variants: Punctuated, + } +} + +ast_struct! { + /// An untagged union input to a `proc_macro_derive` macro. + /// + /// *This type is available only if Syn is built with the `"derive"` + /// feature.* + pub struct DataUnion { + pub union_token: Token![union], + pub fields: FieldsNamed, + } +} + +#[cfg(feature = "parsing")] +pub mod parsing { + use super::*; + + use crate::parse::{Parse, ParseStream, Result}; + + impl Parse for DeriveInput { + fn parse(input: ParseStream) -> Result { + let attrs = input.call(Attribute::parse_outer)?; + let vis = input.parse::()?; + + let lookahead = input.lookahead1(); + if lookahead.peek(Token![struct]) { + let struct_token = input.parse::()?; + let ident = input.parse::()?; + let generics = input.parse::()?; + let (where_clause, fields, semi) = data_struct(input)?; + Ok(DeriveInput { + attrs, + vis, + ident, + generics: Generics { + where_clause, + ..generics + }, + data: Data::Struct(DataStruct { + struct_token, + fields, + semi_token: semi, + }), + }) + } else if lookahead.peek(Token![enum]) { + let enum_token = input.parse::()?; + let ident = input.parse::()?; + let generics = input.parse::()?; + let (where_clause, brace, variants) = data_enum(input)?; + Ok(DeriveInput { + attrs, + vis, + ident, + generics: Generics { + where_clause, + ..generics + }, + data: Data::Enum(DataEnum { + enum_token, + brace_token: brace, + variants, + }), + }) + } else if lookahead.peek(Token![union]) { + let union_token = input.parse::()?; + let ident = input.parse::()?; + let generics = input.parse::()?; + let (where_clause, fields) = data_union(input)?; + Ok(DeriveInput { + attrs, + vis, + ident, + generics: Generics { + where_clause, + ..generics + }, + data: Data::Union(DataUnion { + union_token, + fields, + }), + }) + } else { + Err(lookahead.error()) + } + } + } + + pub fn data_struct( + input: ParseStream, + ) -> Result<(Option, Fields, Option)> { + let mut lookahead = input.lookahead1(); + let mut where_clause = None; + if lookahead.peek(Token![where]) { + where_clause = Some(input.parse()?); + lookahead = input.lookahead1(); + } + + if where_clause.is_none() && lookahead.peek(token::Paren) { + let fields = input.parse()?; + + lookahead = input.lookahead1(); + if lookahead.peek(Token![where]) { + where_clause = Some(input.parse()?); + lookahead = input.lookahead1(); + } + + if lookahead.peek(Token![;]) { + let semi = input.parse()?; + Ok((where_clause, Fields::Unnamed(fields), Some(semi))) + } else { + Err(lookahead.error()) + } + } else if lookahead.peek(token::Brace) { + let fields = input.parse()?; + Ok((where_clause, Fields::Named(fields), None)) + } else if lookahead.peek(Token![;]) { + let semi = input.parse()?; + Ok((where_clause, Fields::Unit, Some(semi))) + } else { + Err(lookahead.error()) + } + } + + pub fn data_enum( + input: ParseStream, + ) -> Result<( + Option, + token::Brace, + Punctuated, + )> { + let where_clause = input.parse()?; + + let content; + let brace = braced!(content in input); + let variants = content.parse_terminated(Variant::parse)?; + + Ok((where_clause, brace, variants)) + } + + pub fn data_union(input: ParseStream) -> Result<(Option, FieldsNamed)> { + let where_clause = input.parse()?; + let fields = input.parse()?; + Ok((where_clause, fields)) + } +} + +#[cfg(feature = "printing")] +mod printing { + use super::*; + + use proc_macro2::TokenStream; + use quote::ToTokens; + + use crate::attr::FilterAttrs; + use crate::print::TokensOrDefault; + + impl ToTokens for DeriveInput { + fn to_tokens(&self, tokens: &mut TokenStream) { + for attr in self.attrs.outer() { + attr.to_tokens(tokens); + } + self.vis.to_tokens(tokens); + match &self.data { + Data::Struct(d) => d.struct_token.to_tokens(tokens), + Data::Enum(d) => d.enum_token.to_tokens(tokens), + Data::Union(d) => d.union_token.to_tokens(tokens), + } + self.ident.to_tokens(tokens); + self.generics.to_tokens(tokens); + match &self.data { + Data::Struct(data) => match &data.fields { + Fields::Named(fields) => { + self.generics.where_clause.to_tokens(tokens); + fields.to_tokens(tokens); + } + Fields::Unnamed(fields) => { + fields.to_tokens(tokens); + self.generics.where_clause.to_tokens(tokens); + TokensOrDefault(&data.semi_token).to_tokens(tokens); + } + Fields::Unit => { + self.generics.where_clause.to_tokens(tokens); + TokensOrDefault(&data.semi_token).to_tokens(tokens); + } + }, + Data::Enum(data) => { + self.generics.where_clause.to_tokens(tokens); + data.brace_token.surround(tokens, |tokens| { + data.variants.to_tokens(tokens); + }); + } + Data::Union(data) => { + self.generics.where_clause.to_tokens(tokens); + data.fields.to_tokens(tokens); + } + } + } + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/discouraged.rs b/third_party/cargo/vendor/syn-1.0.27/src/discouraged.rs new file mode 100644 index 0000000..76c9fce --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/discouraged.rs @@ -0,0 +1,194 @@ +//! Extensions to the parsing API with niche applicability. + +use super::*; + +/// Extensions to the `ParseStream` API to support speculative parsing. +pub trait Speculative { + /// Advance this parse stream to the position of a forked parse stream. + /// + /// This is the opposite operation to [`ParseStream::fork`]. You can fork a + /// parse stream, perform some speculative parsing, then join the original + /// stream to the fork to "commit" the parsing from the fork to the main + /// stream. + /// + /// If you can avoid doing this, you should, as it limits the ability to + /// generate useful errors. That said, it is often the only way to parse + /// syntax of the form `A* B*` for arbitrary syntax `A` and `B`. The problem + /// is that when the fork fails to parse an `A`, it's impossible to tell + /// whether that was because of a syntax error and the user meant to provide + /// an `A`, or that the `A`s are finished and it's time to start parsing + /// `B`s. Use with care. + /// + /// Also note that if `A` is a subset of `B`, `A* B*` can be parsed by + /// parsing `B*` and removing the leading members of `A` from the + /// repetition, bypassing the need to involve the downsides associated with + /// speculative parsing. + /// + /// [`ParseStream::fork`]: ParseBuffer::fork + /// + /// # Example + /// + /// There has been chatter about the possibility of making the colons in the + /// turbofish syntax like `path::to::` no longer required by accepting + /// `path::to` in expression position. Specifically, according to [RFC + /// 2544], [`PathSegment`] parsing should always try to consume a following + /// `<` token as the start of generic arguments, and reset to the `<` if + /// that fails (e.g. the token is acting as a less-than operator). + /// + /// This is the exact kind of parsing behavior which requires the "fork, + /// try, commit" behavior that [`ParseStream::fork`] discourages. With + /// `advance_to`, we can avoid having to parse the speculatively parsed + /// content a second time. + /// + /// This change in behavior can be implemented in syn by replacing just the + /// `Parse` implementation for `PathSegment`: + /// + /// ``` + /// # use syn::ext::IdentExt; + /// use syn::parse::discouraged::Speculative; + /// # use syn::parse::{Parse, ParseStream}; + /// # use syn::{Ident, PathArguments, Result, Token}; + /// + /// pub struct PathSegment { + /// pub ident: Ident, + /// pub arguments: PathArguments, + /// } + /// # + /// # impl From for PathSegment + /// # where + /// # T: Into, + /// # { + /// # fn from(ident: T) -> Self { + /// # PathSegment { + /// # ident: ident.into(), + /// # arguments: PathArguments::None, + /// # } + /// # } + /// # } + /// + /// impl Parse for PathSegment { + /// fn parse(input: ParseStream) -> Result { + /// if input.peek(Token![super]) + /// || input.peek(Token![self]) + /// || input.peek(Token![Self]) + /// || input.peek(Token![crate]) + /// { + /// let ident = input.call(Ident::parse_any)?; + /// return Ok(PathSegment::from(ident)); + /// } + /// + /// let ident = input.parse()?; + /// if input.peek(Token![::]) && input.peek3(Token![<]) { + /// return Ok(PathSegment { + /// ident, + /// arguments: PathArguments::AngleBracketed(input.parse()?), + /// }); + /// } + /// if input.peek(Token![<]) && !input.peek(Token![<=]) { + /// let fork = input.fork(); + /// if let Ok(arguments) = fork.parse() { + /// input.advance_to(&fork); + /// return Ok(PathSegment { + /// ident, + /// arguments: PathArguments::AngleBracketed(arguments), + /// }); + /// } + /// } + /// Ok(PathSegment::from(ident)) + /// } + /// } + /// + /// # syn::parse_str::("a").unwrap(); + /// ``` + /// + /// # Drawbacks + /// + /// The main drawback of this style of speculative parsing is in error + /// presentation. Even if the lookahead is the "correct" parse, the error + /// that is shown is that of the "fallback" parse. To use the same example + /// as the turbofish above, take the following unfinished "turbofish": + /// + /// ```text + /// let _ = f<&'a fn(), for<'a> serde::>(); + /// ``` + /// + /// If this is parsed as generic arguments, we can provide the error message + /// + /// ```text + /// error: expected identifier + /// --> src.rs:L:C + /// | + /// L | let _ = f<&'a fn(), for<'a> serde::>(); + /// | ^ + /// ``` + /// + /// but if parsed using the above speculative parsing, it falls back to + /// assuming that the `<` is a less-than when it fails to parse the generic + /// arguments, and tries to interpret the `&'a` as the start of a labelled + /// loop, resulting in the much less helpful error + /// + /// ```text + /// error: expected `:` + /// --> src.rs:L:C + /// | + /// L | let _ = f<&'a fn(), for<'a> serde::>(); + /// | ^^ + /// ``` + /// + /// This can be mitigated with various heuristics (two examples: show both + /// forks' parse errors, or show the one that consumed more tokens), but + /// when you can control the grammar, sticking to something that can be + /// parsed LL(3) and without the LL(*) speculative parsing this makes + /// possible, displaying reasonable errors becomes much more simple. + /// + /// [RFC 2544]: https://github.com/rust-lang/rfcs/pull/2544 + /// [`PathSegment`]: crate::PathSegment + /// + /// # Performance + /// + /// This method performs a cheap fixed amount of work that does not depend + /// on how far apart the two streams are positioned. + /// + /// # Panics + /// + /// The forked stream in the argument of `advance_to` must have been + /// obtained by forking `self`. Attempting to advance to any other stream + /// will cause a panic. + fn advance_to(&self, fork: &Self); +} + +impl<'a> Speculative for ParseBuffer<'a> { + fn advance_to(&self, fork: &Self) { + if !crate::buffer::same_scope(self.cursor(), fork.cursor()) { + panic!("Fork was not derived from the advancing parse stream"); + } + + let (self_unexp, self_sp) = inner_unexpected(self); + let (fork_unexp, fork_sp) = inner_unexpected(fork); + if !Rc::ptr_eq(&self_unexp, &fork_unexp) { + match (fork_sp, self_sp) { + // Unexpected set on the fork, but not on `self`, copy it over. + (Some(span), None) => { + self_unexp.set(Unexpected::Some(span)); + } + // Unexpected unset. Use chain to propagate errors from fork. + (None, None) => { + fork_unexp.set(Unexpected::Chain(self_unexp)); + + // Ensure toplevel 'unexpected' tokens from the fork don't + // bubble up the chain by replacing the root `unexpected` + // pointer, only 'unexpected' tokens from existing group + // parsers should bubble. + fork.unexpected + .set(Some(Rc::new(Cell::new(Unexpected::None)))); + } + // Unexpected has been set on `self`. No changes needed. + (_, Some(_)) => {} + } + } + + // See comment on `cell` in the struct definition. + self.cell + .set(unsafe { mem::transmute::>(fork.cursor()) }) + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/error.rs b/third_party/cargo/vendor/syn-1.0.27/src/error.rs new file mode 100644 index 0000000..545c47e --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/error.rs @@ -0,0 +1,375 @@ +use std::fmt::{self, Debug, Display}; +use std::iter::FromIterator; +use std::slice; +use std::vec; + +use proc_macro2::{ + Delimiter, Group, Ident, LexError, Literal, Punct, Spacing, Span, TokenStream, TokenTree, +}; +#[cfg(feature = "printing")] +use quote::ToTokens; + +#[cfg(feature = "parsing")] +use crate::buffer::Cursor; +use crate::thread::ThreadBound; + +/// The result of a Syn parser. +pub type Result = std::result::Result; + +/// Error returned when a Syn parser cannot parse the input tokens. +/// +/// # Error reporting in proc macros +/// +/// The correct way to report errors back to the compiler from a procedural +/// macro is by emitting an appropriately spanned invocation of +/// [`compile_error!`] in the generated code. This produces a better diagnostic +/// message than simply panicking the macro. +/// +/// [`compile_error!`]: https://doc.rust-lang.org/std/macro.compile_error.html +/// +/// When parsing macro input, the [`parse_macro_input!`] macro handles the +/// conversion to `compile_error!` automatically. +/// +/// ``` +/// extern crate proc_macro; +/// +/// use proc_macro::TokenStream; +/// use syn::{parse_macro_input, AttributeArgs, ItemFn}; +/// +/// # const IGNORE: &str = stringify! { +/// #[proc_macro_attribute] +/// # }; +/// pub fn my_attr(args: TokenStream, input: TokenStream) -> TokenStream { +/// let args = parse_macro_input!(args as AttributeArgs); +/// let input = parse_macro_input!(input as ItemFn); +/// +/// /* ... */ +/// # TokenStream::new() +/// } +/// ``` +/// +/// For errors that arise later than the initial parsing stage, the +/// [`.to_compile_error()`] method can be used to perform an explicit conversion +/// to `compile_error!`. +/// +/// [`.to_compile_error()`]: Error::to_compile_error +/// +/// ``` +/// # extern crate proc_macro; +/// # +/// # use proc_macro::TokenStream; +/// # use syn::{parse_macro_input, DeriveInput}; +/// # +/// # const IGNORE: &str = stringify! { +/// #[proc_macro_derive(MyDerive)] +/// # }; +/// pub fn my_derive(input: TokenStream) -> TokenStream { +/// let input = parse_macro_input!(input as DeriveInput); +/// +/// // fn(DeriveInput) -> syn::Result +/// expand::my_derive(input) +/// .unwrap_or_else(|err| err.to_compile_error()) +/// .into() +/// } +/// # +/// # mod expand { +/// # use proc_macro2::TokenStream; +/// # use syn::{DeriveInput, Result}; +/// # +/// # pub fn my_derive(input: DeriveInput) -> Result { +/// # unimplemented!() +/// # } +/// # } +/// ``` +#[derive(Clone)] +pub struct Error { + messages: Vec, +} + +struct ErrorMessage { + // Span is implemented as an index into a thread-local interner to keep the + // size small. It is not safe to access from a different thread. We want + // errors to be Send and Sync to play nicely with the Failure crate, so pin + // the span we're given to its original thread and assume it is + // Span::call_site if accessed from any other thread. + start_span: ThreadBound, + end_span: ThreadBound, + message: String, +} + +#[cfg(test)] +struct _Test +where + Error: Send + Sync; + +impl Error { + /// Usually the [`ParseStream::error`] method will be used instead, which + /// automatically uses the correct span from the current position of the + /// parse stream. + /// + /// Use `Error::new` when the error needs to be triggered on some span other + /// than where the parse stream is currently positioned. + /// + /// [`ParseStream::error`]: crate::parse::ParseBuffer::error + /// + /// # Example + /// + /// ``` + /// use syn::{Error, Ident, LitStr, Result, Token}; + /// use syn::parse::ParseStream; + /// + /// // Parses input that looks like `name = "string"` where the key must be + /// // the identifier `name` and the value may be any string literal. + /// // Returns the string literal. + /// fn parse_name(input: ParseStream) -> Result { + /// let name_token: Ident = input.parse()?; + /// if name_token != "name" { + /// // Trigger an error not on the current position of the stream, + /// // but on the position of the unexpected identifier. + /// return Err(Error::new(name_token.span(), "expected `name`")); + /// } + /// input.parse::()?; + /// let s: LitStr = input.parse()?; + /// Ok(s) + /// } + /// ``` + pub fn new(span: Span, message: T) -> Self { + Error { + messages: vec![ErrorMessage { + start_span: ThreadBound::new(span), + end_span: ThreadBound::new(span), + message: message.to_string(), + }], + } + } + + /// Creates an error with the specified message spanning the given syntax + /// tree node. + /// + /// Unlike the `Error::new` constructor, this constructor takes an argument + /// `tokens` which is a syntax tree node. This allows the resulting `Error` + /// to attempt to span all tokens inside of `tokens`. While you would + /// typically be able to use the `Spanned` trait with the above `Error::new` + /// constructor, implementation limitations today mean that + /// `Error::new_spanned` may provide a higher-quality error message on + /// stable Rust. + /// + /// When in doubt it's recommended to stick to `Error::new` (or + /// `ParseStream::error`)! + #[cfg(feature = "printing")] + pub fn new_spanned(tokens: T, message: U) -> Self { + let mut iter = tokens.into_token_stream().into_iter(); + let start = iter.next().map_or_else(Span::call_site, |t| t.span()); + let end = iter.last().map_or(start, |t| t.span()); + Error { + messages: vec![ErrorMessage { + start_span: ThreadBound::new(start), + end_span: ThreadBound::new(end), + message: message.to_string(), + }], + } + } + + /// The source location of the error. + /// + /// Spans are not thread-safe so this function returns `Span::call_site()` + /// if called from a different thread than the one on which the `Error` was + /// originally created. + pub fn span(&self) -> Span { + let start = match self.messages[0].start_span.get() { + Some(span) => *span, + None => return Span::call_site(), + }; + let end = match self.messages[0].end_span.get() { + Some(span) => *span, + None => return Span::call_site(), + }; + start.join(end).unwrap_or(start) + } + + /// Render the error as an invocation of [`compile_error!`]. + /// + /// The [`parse_macro_input!`] macro provides a convenient way to invoke + /// this method correctly in a procedural macro. + /// + /// [`compile_error!`]: https://doc.rust-lang.org/std/macro.compile_error.html + pub fn to_compile_error(&self) -> TokenStream { + self.messages + .iter() + .map(ErrorMessage::to_compile_error) + .collect() + } + + /// Add another error message to self such that when `to_compile_error()` is + /// called, both errors will be emitted together. + pub fn combine(&mut self, another: Error) { + self.messages.extend(another.messages) + } +} + +impl ErrorMessage { + fn to_compile_error(&self) -> TokenStream { + let start = self + .start_span + .get() + .cloned() + .unwrap_or_else(Span::call_site); + let end = self.end_span.get().cloned().unwrap_or_else(Span::call_site); + + // compile_error!($message) + TokenStream::from_iter(vec![ + TokenTree::Ident(Ident::new("compile_error", start)), + TokenTree::Punct({ + let mut punct = Punct::new('!', Spacing::Alone); + punct.set_span(start); + punct + }), + TokenTree::Group({ + let mut group = Group::new(Delimiter::Brace, { + TokenStream::from_iter(vec![TokenTree::Literal({ + let mut string = Literal::string(&self.message); + string.set_span(end); + string + })]) + }); + group.set_span(end); + group + }), + ]) + } +} + +#[cfg(feature = "parsing")] +pub fn new_at(scope: Span, cursor: Cursor, message: T) -> Error { + if cursor.eof() { + Error::new(scope, format!("unexpected end of input, {}", message)) + } else { + let span = crate::buffer::open_span_of_group(cursor); + Error::new(span, message) + } +} + +#[cfg(all(feature = "parsing", any(feature = "full", feature = "derive")))] +pub fn new2(start: Span, end: Span, message: T) -> Error { + Error { + messages: vec![ErrorMessage { + start_span: ThreadBound::new(start), + end_span: ThreadBound::new(end), + message: message.to_string(), + }], + } +} + +impl Debug for Error { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + if self.messages.len() == 1 { + formatter + .debug_tuple("Error") + .field(&self.messages[0]) + .finish() + } else { + formatter + .debug_tuple("Error") + .field(&self.messages) + .finish() + } + } +} + +impl Debug for ErrorMessage { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + Debug::fmt(&self.message, formatter) + } +} + +impl Display for Error { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str(&self.messages[0].message) + } +} + +impl Clone for ErrorMessage { + fn clone(&self) -> Self { + let start = self + .start_span + .get() + .cloned() + .unwrap_or_else(Span::call_site); + let end = self.end_span.get().cloned().unwrap_or_else(Span::call_site); + ErrorMessage { + start_span: ThreadBound::new(start), + end_span: ThreadBound::new(end), + message: self.message.clone(), + } + } +} + +impl std::error::Error for Error { + fn description(&self) -> &str { + "parse error" + } +} + +impl From for Error { + fn from(err: LexError) -> Self { + Error::new(Span::call_site(), format!("{:?}", err)) + } +} + +impl IntoIterator for Error { + type Item = Error; + type IntoIter = IntoIter; + + fn into_iter(self) -> Self::IntoIter { + IntoIter { + messages: self.messages.into_iter(), + } + } +} + +pub struct IntoIter { + messages: vec::IntoIter, +} + +impl Iterator for IntoIter { + type Item = Error; + + fn next(&mut self) -> Option { + Some(Error { + messages: vec![self.messages.next()?], + }) + } +} + +impl<'a> IntoIterator for &'a Error { + type Item = Error; + type IntoIter = Iter<'a>; + + fn into_iter(self) -> Self::IntoIter { + Iter { + messages: self.messages.iter(), + } + } +} + +pub struct Iter<'a> { + messages: slice::Iter<'a, ErrorMessage>, +} + +impl<'a> Iterator for Iter<'a> { + type Item = Error; + + fn next(&mut self) -> Option { + Some(Error { + messages: vec![self.messages.next()?.clone()], + }) + } +} + +impl Extend for Error { + fn extend>(&mut self, iter: T) { + for err in iter { + self.combine(err); + } + } +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/export.rs b/third_party/cargo/vendor/syn-1.0.27/src/export.rs new file mode 100644 index 0000000..37dc467 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/export.rs @@ -0,0 +1,35 @@ +pub use std::clone::Clone; +pub use std::cmp::{Eq, PartialEq}; +pub use std::convert::From; +pub use std::default::Default; +pub use std::fmt::{self, Debug, Formatter}; +pub use std::hash::{Hash, Hasher}; +pub use std::marker::Copy; +pub use std::option::Option::{None, Some}; +pub use std::result::Result::{Err, Ok}; + +#[cfg(feature = "printing")] +pub extern crate quote; + +pub use proc_macro2::{Span, TokenStream as TokenStream2}; + +pub use crate::span::IntoSpans; + +#[cfg(all( + not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "wasi"))), + feature = "proc-macro" +))] +pub use proc_macro::TokenStream; + +#[cfg(feature = "printing")] +pub use quote::{ToTokens, TokenStreamExt}; + +#[allow(non_camel_case_types)] +pub type bool = help::Bool; +#[allow(non_camel_case_types)] +pub type str = help::Str; + +mod help { + pub type Bool = bool; + pub type Str = str; +} diff --git a/third_party/cargo/vendor/syn-1.0.27/src/expr.rs b/third_party/cargo/vendor/syn-1.0.27/src/expr.rs new file mode 100644 index 0000000..ce87136 --- /dev/null +++ b/third_party/cargo/vendor/syn-1.0.27/src/expr.rs @@ -0,0 +1,3203 @@ +use super::*; +use crate::punctuated::Punctuated; +#[cfg(feature = "extra-traits")] +use crate::tt::TokenStreamHelper; +use proc_macro2::{Span, TokenStream}; +#[cfg(feature = "printing")] +use quote::IdentFragment; +#[cfg(feature = "printing")] +use std::fmt::{self, Display}; +use std::hash::{Hash, Hasher}; +#[cfg(all(feature = "parsing", feature = "full"))] +use std::mem; + +ast_enum_of_structs! { + /// A Rust expression. + /// + /// *This type is available only if Syn is built with the `"derive"` or `"full"` + /// feature, but most of the variants are not available unless "full" is enabled.* + /// + /// # Syntax tree enums + /// + /// This type is a syntax tree enum. In Syn this and other syntax tree enums + /// are designed to be traversed using the following rebinding idiom. + /// + /// ``` + /// # use syn::Expr; + /// # + /// # fn example(expr: Expr) { + /// # const IGNORE: &str = stringify! { + /// let expr: Expr = /* ... */; + /// # }; + /// match expr { + /// Expr::MethodCall(expr) => { + /// /* ... */ + /// } + /// Expr::Cast(expr) => { + /// /* ... */ + /// } + /// Expr::If(expr) => { + /// /* ... */ + /// } + /// + /// /* ... */ + /// # _ => {} + /// # } + /// # } + /// ``` + /// + /// We begin with a variable `expr` of type `Expr` that has no fields + /// (because it is an enum), and by matching on it and rebinding a variable + /// with the same name `expr` we effectively imbue our variable with all of + /// the data fields provided by the variant that it turned out to be. So for + /// example above if we ended up in the `MethodCall` case then we get to use + /// `expr.receiver`, `expr.args` etc; if we ended up in the `If` case we get + /// to use `expr.cond`, `expr.then_branch`, `expr.else_branch`. + /// + /// This approach avoids repeating the variant names twice on every line. + /// + /// ``` + /// # use syn::{Expr, ExprMethodCall}; + /// # + /// # fn example(expr: Expr) { + /// // Repetitive; recommend not doing this. + /// match expr { + /// Expr::MethodCall(ExprMethodCall { method, args, .. }) => { + /// # } + /// # _ => {} + /// # } + /// # } + /// ``` + /// + /// In general, the name to which a syntax tree enum variant is bound should + /// be a suitable name for the complete syntax tree enum type. + /// + /// ``` + /// # use syn::{Expr, ExprField}; + /// # + /// # fn example(discriminant: ExprField) { + /// // Binding is called `base` which is the name I would use if I were + /// // assigning `*discriminant.base` without an `if let`. + /// if let Expr::Tuple(base) = *discriminant.base { + /// # } + /// # } + /// ``` + /// + /// A sign that you may not be choosing the right variable names is if you + /// see names getting repeated in your code, like accessing + /// `receiver.receiver` or `pat.pat` or `cond.cond`. + pub enum Expr #manual_extra_traits { + /// A slice literal expression: `[a, b, c, d]`. + Array(ExprArray), + + /// An assignment expression: `a = compute()`. + Assign(ExprAssign), + + /// A compound assignment expression: `counter += 1`. + AssignOp(ExprAssignOp), + + /// An async block: `async { ... }`. + Async(ExprAsync), + + /// An await expression: `fut.await`. + Await(ExprAwait), + + /// A binary operation: `a + b`, `a * b`. + Binary(ExprBinary), + + /// A blocked scope: `{ ... }`. + Block(ExprBlock), + + /// A box expression: `box f`. + Box(ExprBox), + + /// A `break`, with an optional label to break and an optional + /// expression. + Break(ExprBreak), + + /// A function call expression: `invoke(a, b)`. + Call(ExprCall), + + /// A cast expression: `foo as f64`. + Cast(ExprCast), + + /// A closure expression: `|a, b| a + b`. + Closure(ExprClosure), + + /// A `continue`, with an optional label. + Continue(ExprContinue), + + /// Access of a named struct field (`obj.k`) or unnamed tuple struct + /// field (`obj.0`). + Field(ExprField), + + /// A for loop: `for pat in expr { ... }`. + ForLoop(ExprForLoop), + + /// An expression contained within invisible delimiters. + /// + /// This variant is important for faithfully representing the precedence + /// of expressions and is related to `None`-delimited spans in a + /// `TokenStream`. + Group(ExprGroup), + + /// An `if` expression with an optional `else` block: `if expr { ... } + /// else { ... }`. + /// + /// The `else` branch expression may only be an `If` or `Block` + /// expression, not any of the other types of expression. + If(ExprIf), + + /// A square bracketed indexing expression: `vector[2]`. + Index(ExprIndex), + + /// A `let` guard: `let Some(x) = opt`. + Let(ExprLet), + + /// A literal in place of an expression: `1`, `"foo"`. + Lit(ExprLit), + + /// Conditionless loop: `loop { ... }`. + Loop(ExprLoop), + + /// A macro invocation expression: `format!("{}", q)`. + Macro(ExprMacro), + + /// A `match` expression: `match n { Some(n) => {}, None => {} }`. + Match(ExprMatch), + + /// A method call expression: `x.foo::(a, b)`. + MethodCall(ExprMethodCall), + + /// A parenthesized expression: `(a + b)`. + Paren(ExprParen), + + /// A path like `std::mem::replace` possibly containing generic + /// parameters and a qualified self-type. + /// + /// A plain identifier like `x` is a path of length 1. + Path(ExprPath), + + /// A range expression: `1..2`, `1..`, `..2`, `1..=2`, `..=2`. + Range(ExprRange), + + /// A referencing operation: `&a` or `&mut a`. + Reference(ExprReference), + + /// An array literal constructed from one repeated element: `[0u8; N]`. + Repeat(ExprRepeat), + + /// A `return`, with an optional value to be returned. + Return(ExprReturn), + + /// A struct literal expression: `Point { x: 1, y: 1 }`. + /// + /// The `rest` provides the value of the remaining fields as in `S { a: + /// 1, b: 1, ..rest }`. + Struct(ExprStruct), + + /// A try-expression: `expr?`. + Try(ExprTry), + + /// A try block: `try { ... }`. + TryBlock(ExprTryBlock), + + /// A tuple expression: `(a, b, c, d)`. + Tuple(ExprTuple), + + /// A type ascription expression: `foo: f64`. + Type(ExprType), + + /// A unary operation: `!x`, `*x`. + Unary(ExprUnary), + + /// An unsafe block: `unsafe { ... }`. + Unsafe(ExprUnsafe), + + /// Tokens in expression position not interpreted by Syn. + Verbatim(TokenStream), + + /// A while loop: `while expr { ... }`. + While(ExprWhile), + + /// A yield expression: `yield expr`. + Yield(ExprYield), + + #[doc(hidden)] + __Nonexhaustive, + } +} + +ast_struct! { + /// A slice literal expression: `[a, b, c, d]`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + pub struct ExprArray #full { + pub attrs: Vec, + pub bracket_token: token::Bracket, + pub elems: Punctuated, + } +} + +ast_struct! { + /// An assignment expression: `a = compute()`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + pub struct ExprAssign #full { + pub attrs: Vec, + pub left: Box, + pub eq_token: Token![=], + pub right: Box, + } +} + +ast_struct! { + /// A compound assignment expression: `counter += 1`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + pub struct ExprAssignOp #full { + pub attrs: Vec, + pub left: Box, + pub op: BinOp, + pub right: Box, + } +} + +ast_struct! { + /// An async block: `async { ... }`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + pub struct ExprAsync #full { + pub attrs: Vec, + pub async_token: Token![async], + pub capture: Option, + pub block: Block, + } +} + +ast_struct! { + /// An await expression: `fut.await`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + pub struct ExprAwait #full { + pub attrs: Vec, + pub base: Box, + pub dot_token: Token![.], + pub await_token: token::Await, + } +} + +ast_struct! { + /// A binary operation: `a + b`, `a * b`. + /// + /// *This type is available only if Syn is built with the `"derive"` or + /// `"full"` feature.* + pub struct ExprBinary { + pub attrs: Vec, + pub left: Box, + pub op: BinOp, + pub right: Box, + } +} + +ast_struct! { + /// A blocked scope: `{ ... }`. + /// + /// *This type is available only if Syn is built with the `"full"` feature.* + pub struct ExprBlock #full { + pub attrs: Vec, + pub label: Option