From 79d4df26a1acbed42299dbc885745ddf50e02008 Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Thu, 8 Aug 2024 08:01:51 -0400 Subject: [PATCH] Lots of things to try and get publishing working (#557) --- .cargo/config.toml | 5 +- Cargo.lock | 186 +- Cargo.toml | 52 +- bench-vortex/Cargo.toml | 2 +- vortex-array/Cargo.toml | 36 +- vortex-array/build.rs | 3 - vortex-array/src/lib.rs | 22 +- vortex-build/Cargo.toml | 20 - vortex-build/README.md | 12 - vortex-build/src/lib.rs | 113 -- vortex-dtype/Cargo.toml | 18 +- vortex-dtype/build.rs | 3 - vortex-dtype/src/lib.rs | 15 +- vortex-dtype/src/serde/flatbuffers.rs | 2 - vortex-dtype/src/serde/mod.rs | 2 + vortex-dtype/src/serde/proto.rs | 2 - vortex-error/Cargo.toml | 3 +- vortex-error/src/lib.rs | 1 + vortex-expr/Cargo.toml | 12 +- vortex-expr/build.rs | 3 - vortex-expr/src/lib.rs | 12 +- vortex-expr/src/serde_proto.rs | 4 +- vortex-flatbuffers/Cargo.toml | 6 + vortex-flatbuffers/README.md | 9 + .../flatbuffers/vortex-array}/array.fbs | 8 +- .../flatbuffers/vortex-dtype}/dtype.fbs | 2 - .../flatbuffers/vortex-scalar/scalar.fbs | 12 + .../flatbuffers/vortex-serde}/footer.fbs | 2 - .../flatbuffers/vortex-serde}/message.fbs | 14 +- vortex-flatbuffers/src/generated/array.rs | 597 ++++++ vortex-flatbuffers/src/generated/dtype.rs | 1644 +++++++++++++++++ vortex-flatbuffers/src/generated/footer.rs | 666 +++++++ vortex-flatbuffers/src/generated/message.rs | 1065 +++++++++++ vortex-flatbuffers/src/generated/scalar.rs | 297 +++ vortex-flatbuffers/src/lib.rs | 50 + vortex-proto/Cargo.toml | 24 + .../dtype => vortex-proto/proto}/dtype.proto | 0 .../expr => vortex-proto/proto}/expr.proto | 4 +- .../proto}/scalar.proto | 2 +- vortex-proto/src/generated/vortex.dtype.rs | 175 ++ vortex-proto/src/generated/vortex.expr.rs | 75 + vortex-proto/src/generated/vortex.scalar.rs | 50 + vortex-proto/src/lib.rs | 14 + vortex-scalar/Cargo.toml | 17 +- vortex-scalar/build.rs | 3 - vortex-scalar/flatbuffers/scalar.fbs | 14 - vortex-scalar/src/lib.rs | 31 +- vortex-scalar/src/serde/flatbuffers.rs | 6 +- vortex-scalar/src/serde/mod.rs | 2 + vortex-scalar/src/serde/proto.rs | 13 +- vortex-scalar/src/serde/serde.rs | 2 - vortex-serde/Cargo.toml | 9 +- vortex-serde/build.rs | 3 - vortex-serde/src/layouts/reader/context.rs | 4 +- vortex-serde/src/layouts/reader/footer.rs | 7 +- vortex-serde/src/layouts/reader/layouts.rs | 2 +- .../src/layouts/writer/layout_writer.rs | 3 +- vortex-serde/src/layouts/writer/layouts.rs | 3 +- vortex-serde/src/lib.rs | 36 - vortex-serde/src/message_reader.rs | 3 +- vortex-serde/src/messages.rs | 5 +- xtask/Cargo.toml | 23 + xtask/README.md | 23 + xtask/src/main.rs | 72 + 64 files changed, 5052 insertions(+), 473 deletions(-) delete mode 100644 vortex-array/build.rs delete mode 100644 vortex-build/Cargo.toml delete mode 100644 vortex-build/README.md delete mode 100644 vortex-build/src/lib.rs delete mode 100644 vortex-dtype/build.rs delete mode 100644 vortex-expr/build.rs create mode 100644 vortex-flatbuffers/README.md rename {vortex-array/flatbuffers => vortex-flatbuffers/flatbuffers/vortex-array}/array.fbs (76%) rename {vortex-dtype/flatbuffers => vortex-flatbuffers/flatbuffers/vortex-dtype}/dtype.fbs (97%) create mode 100644 vortex-flatbuffers/flatbuffers/vortex-scalar/scalar.fbs rename {vortex-serde/flatbuffers => vortex-flatbuffers/flatbuffers/vortex-serde}/footer.fbs (91%) rename {vortex-serde/flatbuffers => vortex-flatbuffers/flatbuffers/vortex-serde}/message.fbs (65%) create mode 100644 vortex-flatbuffers/src/generated/array.rs create mode 100644 vortex-flatbuffers/src/generated/dtype.rs create mode 100644 vortex-flatbuffers/src/generated/footer.rs create mode 100644 vortex-flatbuffers/src/generated/message.rs create mode 100644 vortex-flatbuffers/src/generated/scalar.rs create mode 100644 vortex-proto/Cargo.toml rename {vortex-dtype/proto/vortex/dtype => vortex-proto/proto}/dtype.proto (100%) rename {vortex-expr/proto/vortex/expr => vortex-proto/proto}/expr.proto (85%) rename {vortex-scalar/proto/vortex/scalar => vortex-proto/proto}/scalar.proto (94%) create mode 100644 vortex-proto/src/generated/vortex.dtype.rs create mode 100644 vortex-proto/src/generated/vortex.expr.rs create mode 100644 vortex-proto/src/generated/vortex.scalar.rs create mode 100644 vortex-proto/src/lib.rs delete mode 100644 vortex-scalar/build.rs delete mode 100644 vortex-scalar/flatbuffers/scalar.fbs delete mode 100644 vortex-serde/build.rs create mode 100644 xtask/Cargo.toml create mode 100644 xtask/README.md create mode 100644 xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index fc1b154cb8..56a3c277b5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -9,4 +9,7 @@ rustflags = [ rustflags = [ "-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup", -] \ No newline at end of file +] + +[alias] +xtask = "run -p xtask --" diff --git a/Cargo.lock b/Cargo.lock index e34a75ac4d..50eb27b3e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,12 +82,55 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" +[[package]] +name = "anstream" +version = "0.6.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + [[package]] name = "anstyle" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +[[package]] +name = "anstyle-parse" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.86" @@ -417,7 +460,7 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bench-vortex" -version = "0.2.0" +version = "0.4.12" dependencies = [ "anyhow", "arrow-array", @@ -568,38 +611,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "camino" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo-platform" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror", -] - [[package]] name = "cast" version = "0.3.0" @@ -608,9 +619,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549" dependencies = [ "jobserver", "libc", @@ -701,8 +712,10 @@ version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ + "anstream", "anstyle", "clap_lex", + "strsim", "terminal_size", ] @@ -712,6 +725,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + [[package]] name = "comfy-table" version = "7.1.1" @@ -1930,6 +1949,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -2933,7 +2958,7 @@ dependencies = [ [[package]] name = "pyvortex" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow", "log", @@ -3386,9 +3411,6 @@ name = "semver" version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] [[package]] name = "seq-macro" @@ -3595,6 +3617,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "strum" version = "0.26.3" @@ -4057,6 +4085,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "1.10.0" @@ -4080,7 +4114,7 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vortex-alp" -version = "0.2.0" +version = "0.4.12" dependencies = [ "divan", "itertools 0.13.0", @@ -4094,7 +4128,7 @@ dependencies = [ [[package]] name = "vortex-array" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-arith", "arrow-array", @@ -4123,7 +4157,6 @@ dependencies = [ "serde", "tokio", "vortex-buffer", - "vortex-build", "vortex-dtype", "vortex-error", "vortex-expr", @@ -4133,25 +4166,16 @@ dependencies = [ [[package]] name = "vortex-buffer" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-buffer", "bytes", "flexbuffers", ] -[[package]] -name = "vortex-build" -version = "0.2.0" -dependencies = [ - "cargo_metadata", - "prost-build", - "walkdir", -] - [[package]] name = "vortex-bytebool" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-array", "arrow-buffer", @@ -4169,7 +4193,7 @@ dependencies = [ [[package]] name = "vortex-datafusion" -version = "0.2.0" +version = "0.4.12" dependencies = [ "anyhow", "arrow-array", @@ -4201,7 +4225,7 @@ dependencies = [ [[package]] name = "vortex-datetime-parts" -version = "0.2.0" +version = "0.4.12" dependencies = [ "log", "serde", @@ -4213,7 +4237,7 @@ dependencies = [ [[package]] name = "vortex-dict" -version = "0.2.0" +version = "0.4.12" dependencies = [ "ahash", "criterion", @@ -4231,7 +4255,7 @@ dependencies = [ [[package]] name = "vortex-dtype" -version = "0.2.0" +version = "0.4.12" dependencies = [ "flatbuffers", "half", @@ -4241,14 +4265,14 @@ dependencies = [ "serde", "serde_json", "serde_test", - "vortex-build", "vortex-error", "vortex-flatbuffers", + "vortex-proto", ] [[package]] name = "vortex-error" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-schema", "datafusion-common", @@ -4262,21 +4286,21 @@ dependencies = [ [[package]] name = "vortex-expr" -version = "0.2.0" +version = "0.4.12" dependencies = [ "datafusion-common", "datafusion-expr", "prost", "serde", - "vortex-build", "vortex-dtype", "vortex-error", + "vortex-proto", "vortex-scalar", ] [[package]] name = "vortex-fastlanes" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrayref", "criterion", @@ -4294,14 +4318,22 @@ dependencies = [ [[package]] name = "vortex-flatbuffers" -version = "0.2.0" +version = "0.4.12" dependencies = [ "flatbuffers", ] +[[package]] +name = "vortex-proto" +version = "0.4.12" +dependencies = [ + "prost", + "prost-types", +] + [[package]] name = "vortex-roaring" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-buffer", "croaring", @@ -4317,7 +4349,7 @@ dependencies = [ [[package]] name = "vortex-runend" -version = "0.2.0" +version = "0.4.12" dependencies = [ "itertools 0.13.0", "num-traits", @@ -4330,7 +4362,7 @@ dependencies = [ [[package]] name = "vortex-runend-bool" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-buffer", "criterion", @@ -4346,7 +4378,7 @@ dependencies = [ [[package]] name = "vortex-sampling-compressor" -version = "0.2.0" +version = "0.4.12" dependencies = [ "chrono", "log", @@ -4365,7 +4397,7 @@ dependencies = [ [[package]] name = "vortex-scalar" -version = "0.2.0" +version = "0.4.12" dependencies = [ "arrow-array", "datafusion-common", @@ -4378,15 +4410,15 @@ dependencies = [ "prost-types", "serde", "vortex-buffer", - "vortex-build", "vortex-dtype", "vortex-error", "vortex-flatbuffers", + "vortex-proto", ] [[package]] name = "vortex-serde" -version = "0.2.0" +version = "0.4.12" dependencies = [ "ahash", "arrow", @@ -4410,7 +4442,6 @@ dependencies = [ "vortex-alp", "vortex-array", "vortex-buffer", - "vortex-build", "vortex-dtype", "vortex-error", "vortex-expr", @@ -4422,7 +4453,7 @@ dependencies = [ [[package]] name = "vortex-zigzag" -version = "0.2.0" +version = "0.4.12" dependencies = [ "serde", "vortex-array", @@ -4913,6 +4944,17 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852" +[[package]] +name = "xtask" +version = "0.4.12" +dependencies = [ + "anyhow", + "clap", + "prost-build", + "walkdir", + "xshell", +] + [[package]] name = "xz2" version = "0.1.7" diff --git a/Cargo.toml b/Cargo.toml index 3c19d7289e..6ef27f8449 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,20 +5,21 @@ members = [ "pyvortex", "vortex-array", "vortex-buffer", - "vortex-build", "vortex-datafusion", "vortex-dtype", "vortex-error", "vortex-expr", "vortex-flatbuffers", + "vortex-proto", "vortex-sampling-compressor", "vortex-scalar", "vortex-serde", + "xtask", ] resolver = "2" [workspace.package] -version = "0.2.0" +version = "0.4.12" homepage = "https://github.com/spiraldb/vortex" repository = "https://github.com/spiraldb/vortex" authors = [ @@ -26,7 +27,7 @@ authors = [ ] license = "Apache-2.0" keywords = ["vortex"] -include = ["benches/*.rs", "src/**/*.rs", "Cargo.toml"] +include = ["benches/*.rs", "build.rs", "src/**/*.rs", "Cargo.toml", "proto/**/*.proto", "flatbuffers/*.fbs"] edition = "2021" rust-version = "1.76" @@ -52,6 +53,7 @@ bytes = "1.6.0" bzip2 = "0.4.4" cargo_metadata = "0.18.1" chrono = "0.4.38" +clap = "4.5.13" criterion = { version = "0.5.1", features = ["html_reports"] } croaring = "2.0.0" csv = "1.3.0" @@ -107,40 +109,40 @@ serde_json = "1.0.116" serde_test = "1.0.176" simplelog = { version = "0.12.2", features = ["paris"] } tar = "0.4" +tempfile = "3" thiserror = "1.0.58" tokio = "1.37.0" uninit = "0.6.2" +url = "2" uuid = "1.8.0" # BEGIN crates published by this project -vortex-alp = { version = "0.2.0", path = "./encodings/alp" } -vortex-array = { version = "0.2.0", path = "./vortex-array" } -vortex-buffer = { version = "0.2.0", path = "./vortex-buffer" } -vortex-build = { version = "0.2.0", path = "./vortex-build" } -vortex-byte-bool = { version = "0.2.0", path = "./encodings/byte-bool" } -vortex-datafusion = { version = "0.2.0", path = "./vortex-datafusion" } -vortex-datetime-parts = { version = "0.2.0", path = "./encodings/datetime-parts" } -vortex-dict = { version = "0.2.0", path = "./encodings/dict" } -vortex-dtype = { version = "0.2.0", path = "./vortex-dtype" } -vortex-error = { version = "0.2.0", path = "./vortex-error" } -vortex-expr = { version = "0.2.0", path = "./vortex-expr" } -vortex-flatbuffers = { version = "0.2.0", path = "./vortex-flatbuffers" } -vortex-fastlanes = { version = "0.2.0", path = "./encodings/fastlanes" } -vortex-roaring = { version = "0.2.0", path = "./encodings/roaring" } -vortex-runend = { version = "0.2.0", path = "./encodings/runend" } -vortex-runend-bool = { version = "0.2.0", path = "./encodings/runend-bool" } -vortex-scalar = { version = "0.2.0", path = "./vortex-scalar" } -vortex-serde = { version = "0.2.0", path = "./vortex-serde" } -vortex-sampling-compressor = { version = "0.2.0", path = "./vortex-sampling-compressor" } -vortex-zigzag = { version = "0.2.0", path = "./encodings/zigzag" } +vortex-alp = { version = "0.4.12", path = "./encodings/alp" } +vortex-array = { version = "0.4.12", path = "./vortex-array" } +vortex-buffer = { version = "0.4.12", path = "./vortex-buffer" } +vortex-byte-bool = { version = "0.4.12", path = "./encodings/byte-bool" } +vortex-datafusion = { version = "0.4.12", path = "./vortex-datafusion" } +vortex-datetime-parts = { version = "0.4.12", path = "./encodings/datetime-parts" } +vortex-dict = { version = "0.4.12", path = "./encodings/dict" } +vortex-dtype = { version = "0.4.12", path = "./vortex-dtype", default-features = false } +vortex-error = { version = "0.4.12", path = "./vortex-error" } +vortex-expr = { version = "0.4.12", path = "./vortex-expr" } +vortex-flatbuffers = { version = "0.4.12", path = "./vortex-flatbuffers" } +vortex-fastlanes = { version = "0.4.12", path = "./encodings/fastlanes" } +vortex-proto = { version = "0.4.12", path = "./vortex-proto" } +vortex-roaring = { version = "0.4.12", path = "./encodings/roaring" } +vortex-runend = { version = "0.4.12", path = "./encodings/runend" } +vortex-runend-bool = { version = "0.4.12", path = "./encodings/runend-bool" } +vortex-scalar = { version = "0.4.12", path = "./vortex-scalar", default-features = false } +vortex-serde = { version = "0.4.12", path = "./vortex-serde", default-features = false } +vortex-sampling-compressor = { version = "0.4.12", path = "./vortex-sampling-compressor" } +vortex-zigzag = { version = "0.4.12", path = "./encodings/zigzag" } # END crates published by this project walkdir = "2.5.0" worker = "0.3.0" xshell = "0.2.6" zigzag = "0.1.0" -url = "2" -tempfile = "3" [workspace.lints.rust] warnings = "deny" diff --git a/bench-vortex/Cargo.toml b/bench-vortex/Cargo.toml index 1f7c097dfe..175ae0623b 100644 --- a/bench-vortex/Cargo.toml +++ b/bench-vortex/Cargo.toml @@ -57,7 +57,7 @@ vortex-fastlanes = { workspace = true } vortex-roaring = { workspace = true } vortex-runend = { workspace = true } vortex-sampling-compressor = { workspace = true } -vortex-serde = { workspace = true, features = ["object_store"] } +vortex-serde = { workspace = true, features = ["futures", "monoio", "tokio", "object_store"] } xshell = { workspace = true } [dev-dependencies] diff --git a/vortex-array/Cargo.toml b/vortex-array/Cargo.toml index 89efacb4c7..7b4fa0db42 100644 --- a/vortex-array/Cargo.toml +++ b/vortex-array/Cargo.toml @@ -14,6 +14,7 @@ rust-version = { workspace = true } [lib] name = "vortex" path = "src/lib.rs" +bench = false [lints] workspace = true @@ -28,8 +29,8 @@ arrow-schema = { workspace = true } arrow-select = { workspace = true } bytes = { workspace = true } enum-iterator = { workspace = true } -flatbuffers = { workspace = true } -flexbuffers = { workspace = true } +flatbuffers = { workspace = true, optional = true } +flexbuffers = { workspace = true, optional = true } futures-util = { workspace = true } humansize = { workspace = true } itertools = { workspace = true } @@ -42,22 +43,33 @@ pin-project = { workspace = true } rand = { workspace = true } serde = { workspace = true, features = ["derive"] } vortex-buffer = { workspace = true } -vortex-dtype = { workspace = true, features = ["flatbuffers", "serde"] } -vortex-error = { workspace = true, features = ["flexbuffers"] } +vortex-dtype = { workspace = true } +vortex-error = { workspace = true } vortex-expr = { workspace = true } -vortex-flatbuffers = { workspace = true } -vortex-scalar = { workspace = true, features = [ - "flatbuffers", - "serde", -] } +vortex-flatbuffers = { workspace = true, optional = true } +vortex-scalar = { workspace = true } + +[features] +default = ["flatbuffers", "serde"] +flatbuffers = [ + "dep:flatbuffers", + "dep:flexbuffers", + "dep:vortex-flatbuffers", + "vortex-flatbuffers/array", + "vortex-dtype/flatbuffers", + "vortex-error/flatbuffers", + "vortex-error/flexbuffers", + "vortex-scalar/flatbuffers", +] +serde = [ + "vortex-dtype/serde", + "vortex-scalar/serde", +] [target.'cfg(target_arch = "wasm32")'.dependencies] # Enable the JS feature of getrandom (via rand) to supprt wasm32 target getrandom = { workspace = true, features = ["js"] } -[build-dependencies] -vortex-build = { workspace = true } - [dev-dependencies] criterion = { workspace = true } rstest = { workspace = true } diff --git a/vortex-array/build.rs b/vortex-array/build.rs deleted file mode 100644 index 434a68b4ff..0000000000 --- a/vortex-array/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - vortex_build::build_flatbuffers(); -} diff --git a/vortex-array/src/lib.rs b/vortex-array/src/lib.rs index 1158745a1d..06c7ab1b63 100644 --- a/vortex-array/src/lib.rs +++ b/vortex-array/src/lib.rs @@ -56,27 +56,7 @@ mod view; pub mod visitor; pub mod flatbuffers { - pub use generated::vortex::array::*; - - #[allow(unused_imports)] - #[allow(dead_code)] - #[allow(non_camel_case_types)] - #[allow(clippy::all)] - mod generated { - include!(concat!(env!("OUT_DIR"), "/flatbuffers/array.rs")); - } - - mod deps { - pub mod dtype { - #[allow(unused_imports)] - pub use vortex_dtype::flatbuffers as dtype; - } - - pub mod scalar { - #[allow(unused_imports)] - pub use vortex_scalar::flatbuffers as scalar; - } - } + pub use vortex_flatbuffers::array::*; } #[derive(Debug, Clone)] diff --git a/vortex-build/Cargo.toml b/vortex-build/Cargo.toml deleted file mode 100644 index 262aea9028..0000000000 --- a/vortex-build/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "vortex-build" -description = "Helpers used in build.rs file for the Vortex project" -version = { workspace = true } -homepage = { workspace = true } -repository = { workspace = true } -authors = { workspace = true } -license = { workspace = true } -keywords = { workspace = true } -include = { workspace = true } -edition = { workspace = true } -rust-version = { workspace = true } - -[dependencies] -cargo_metadata = { workspace = true } -prost-build = { workspace = true } -walkdir = { workspace = true } - -[lints] -workspace = true diff --git a/vortex-build/README.md b/vortex-build/README.md deleted file mode 100644 index ef392c09e4..0000000000 --- a/vortex-build/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Build Vortex - -A crate containing configuration logic for Vortex build.rs files. - -## Usage - -## Features - -Depending on the enabled features, this script supports: - -* FlatBuffers -* Protocol Buffers \ No newline at end of file diff --git a/vortex-build/src/lib.rs b/vortex-build/src/lib.rs deleted file mode 100644 index 16c9e121d1..0000000000 --- a/vortex-build/src/lib.rs +++ /dev/null @@ -1,113 +0,0 @@ -use std::env; -use std::ffi::OsStr; -use std::fs::create_dir_all; -use std::path::{Path, PathBuf}; -use std::process::Command; - -use cargo_metadata::MetadataCommand; -use walkdir::WalkDir; - -fn manifest_dir() -> PathBuf { - PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()) - .canonicalize() - .expect("Failed to canonicalize CARGO_MANIFEST_DIR") -} - -fn out_dir() -> PathBuf { - PathBuf::from(env::var("OUT_DIR").unwrap()) - .canonicalize() - .expect("Failed to canonicalize OUT_DIR") -} - -pub fn build() { - // FlatBuffers - if env::var("CARGO_FEATURE_FLATBUFFERS").ok().is_some() { - build_flatbuffers(); - } - - // Proto (prost) - if env::var("CARGO_FEATURE_PROTO").ok().is_some() { - build_proto(); - } -} - -pub fn build_proto() { - let proto_dir = manifest_dir().join("proto"); - let proto_files = walk_files(&proto_dir, "proto"); - let proto_out = out_dir().join("proto"); - - create_dir_all(&proto_out).expect("Failed to create proto output directory"); - - // The proto include path contains all $CRATE/proto directories of ourself plus all of our - // transitive dependencies. - let metadata = MetadataCommand::new() - .manifest_path(manifest_dir().join("Cargo.toml")) - .exec() - .unwrap(); - let proto_feature = "proto".to_string(); - let proto_includes = metadata - .packages - .iter() - .filter(|&pkg| { - pkg.features.contains_key(&proto_feature) - || pkg.id == metadata.root_package().unwrap().id - }) - .map(|pkg| pkg.manifest_path.parent().unwrap().join("proto")) - .collect::>(); - - prost_build::Config::new() - .out_dir(&proto_out) - .compile_protos(&proto_files, proto_includes.as_slice()) - .expect("Failed to compile protos"); -} - -pub fn build_flatbuffers() { - let flatbuffers_dir = manifest_dir().join("flatbuffers"); - let fbs_files = walk_files(&flatbuffers_dir, "fbs"); - check_call( - Command::new("flatc") - .arg("--rust") - .arg("--filename-suffix") - .arg("") - .arg("-I") - .arg(flatbuffers_dir.join("../../")) - .arg("--include-prefix") - .arg("flatbuffers::deps") - .arg("-o") - .arg(out_dir().join("flatbuffers")) - .args(fbs_files), - ) -} - -/// Recursively walk for files with the given extension, adding them to rerun-if-changed. -fn walk_files(dir: &Path, ext: &str) -> Vec { - WalkDir::new(dir) - .into_iter() - .filter_map(|e| e.ok()) - .filter(|e| e.path().extension() == Some(OsStr::new(ext))) - .map(|e| { - rerun_if_changed(e.path()); - e.path().to_path_buf() - }) - .collect() -} - -fn rerun_if_changed(path: &Path) { - println!( - "cargo:rerun-if-changed={}", - path.canonicalize() - .unwrap_or_else(|_| panic!("failed to canonicalize {}", path.to_str().unwrap())) - .to_str() - .unwrap() - ); -} - -fn check_call(command: &mut Command) { - let name = command.get_program().to_str().unwrap().to_string(); - let Ok(status) = command.status() else { - panic!("Failed to launch {}", &name) - }; - if !status.success() { - panic!("{} failed with status {}", &name, status.code().unwrap()); - } -} diff --git a/vortex-dtype/Cargo.toml b/vortex-dtype/Cargo.toml index 3607c2bfe6..21ee6e4f70 100644 --- a/vortex-dtype/Cargo.toml +++ b/vortex-dtype/Cargo.toml @@ -14,6 +14,7 @@ rust-version = { workspace = true } [lib] name = "vortex_dtype" path = "src/lib.rs" +bench = false [dependencies] flatbuffers = { workspace = true, optional = true } @@ -23,21 +24,24 @@ num-traits = { workspace = true } prost = { workspace = true, optional = true } serde = { workspace = true, optional = true, features = ["rc", "derive"] } vortex-error = { workspace = true } -vortex-flatbuffers = { workspace = true } +vortex-flatbuffers = { workspace = true, optional = true } +vortex-proto = { workspace = true, optional = true } [dev-dependencies] serde_json = { workspace = true } serde_test = { workspace = true } -[build-dependencies] -vortex-build = { workspace = true } - [lints] workspace = true [features] # Uncomment for improved IntelliJ support -# default = ["flatbuffers", "proto", "serde"] -flatbuffers = ["dep:flatbuffers"] -proto = ["dep:prost"] +flatbuffers = [ + "dep:flatbuffers", + "dep:vortex-flatbuffers", + "vortex-error/flatbuffers", + # enable flatbuffers generated code for scalar + "vortex-flatbuffers/dtype" +] +proto = ["dep:prost", "vortex-proto/dtype"] serde = ["dep:serde"] diff --git a/vortex-dtype/build.rs b/vortex-dtype/build.rs deleted file mode 100644 index abf278c83c..0000000000 --- a/vortex-dtype/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn main() { - vortex_build::build(); -} diff --git a/vortex-dtype/src/lib.rs b/vortex-dtype/src/lib.rs index 8c322f850b..59a81d2909 100644 --- a/vortex-dtype/src/lib.rs +++ b/vortex-dtype/src/lib.rs @@ -15,21 +15,10 @@ mod serde; #[cfg(feature = "proto")] pub mod proto { - pub mod dtype { - include!(concat!(env!("OUT_DIR"), "/proto/vortex.dtype.rs")); - } + pub use vortex_proto::dtype; } #[cfg(feature = "flatbuffers")] pub mod flatbuffers { - #[allow(unused_imports)] - #[allow(dead_code)] - #[allow(dead_code)] - #[allow(clippy::all)] - #[allow(non_camel_case_types)] - mod generated { - include!(concat!(env!("OUT_DIR"), "/flatbuffers/dtype.rs")); - } - - pub use generated::vortex::dtype::*; + pub use vortex_flatbuffers::dtype::*; } diff --git a/vortex-dtype/src/serde/flatbuffers.rs b/vortex-dtype/src/serde/flatbuffers.rs index 01309199d6..11dc492cdf 100644 --- a/vortex-dtype/src/serde/flatbuffers.rs +++ b/vortex-dtype/src/serde/flatbuffers.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "flatbuffers")] - use std::sync::Arc; use flatbuffers::{FlatBufferBuilder, WIPOffset}; diff --git a/vortex-dtype/src/serde/mod.rs b/vortex-dtype/src/serde/mod.rs index 859dd4a584..e1e70bfef1 100644 --- a/vortex-dtype/src/serde/mod.rs +++ b/vortex-dtype/src/serde/mod.rs @@ -1,4 +1,6 @@ +#[cfg(feature = "flatbuffers")] mod flatbuffers; +#[cfg(feature = "proto")] mod proto; #[allow(clippy::module_inception)] mod serde; diff --git a/vortex-dtype/src/serde/proto.rs b/vortex-dtype/src/serde/proto.rs index 3714027d13..839235474c 100644 --- a/vortex-dtype/src/serde/proto.rs +++ b/vortex-dtype/src/serde/proto.rs @@ -1,5 +1,3 @@ -#![cfg(feature = "proto")] - use std::sync::Arc; use vortex_error::{vortex_err, VortexError, VortexResult}; diff --git a/vortex-error/Cargo.toml b/vortex-error/Cargo.toml index 97fbf6f3f6..f2bdb9e6d4 100644 --- a/vortex-error/Cargo.toml +++ b/vortex-error/Cargo.toml @@ -16,12 +16,13 @@ name = "vortex_error" path = "src/lib.rs" [features] +flatbuffers = ["dep:flatbuffers"] datafusion = ["datafusion-common"] [dependencies] arrow-schema = { workspace = true } datafusion-common = { workspace = true, optional = true } -flatbuffers = { workspace = true } +flatbuffers = { workspace = true, optional = true } flexbuffers = { workspace = true, optional = true } object_store = { workspace = true, optional = true } parquet = { workspace = true, optional = true } diff --git a/vortex-error/src/lib.rs b/vortex-error/src/lib.rs index f9d44e74fa..fe1ca3167e 100644 --- a/vortex-error/src/lib.rs +++ b/vortex-error/src/lib.rs @@ -63,6 +63,7 @@ pub enum VortexError { #[backtrace] arrow_schema::ArrowError, ), + #[cfg(feature = "flatbuffers")] #[error(transparent)] FlatBuffersError( #[from] diff --git a/vortex-expr/Cargo.toml b/vortex-expr/Cargo.toml index 258af1a112..b968b140c7 100644 --- a/vortex-expr/Cargo.toml +++ b/vortex-expr/Cargo.toml @@ -11,6 +11,11 @@ include = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +[lib] +name = "vortex_expr" +path = "src/lib.rs" +bench = false + [lints] workspace = true @@ -22,12 +27,9 @@ serde = { workspace = true, optional = true, features = ["derive"] } vortex-dtype = { workspace = true } vortex-error = { workspace = true } vortex-scalar = { workspace = true } - -[build-dependencies] -vortex-build = { workspace = true } +vortex-proto = { workspace = true, optional = true } [features] -default = ["proto"] datafusion = ["dep:datafusion-common", "dep:datafusion-expr", "vortex-scalar/datafusion"] -proto = ["dep:prost", "vortex-dtype/proto", "vortex-scalar/proto"] +proto = ["dep:prost", "vortex-dtype/proto", "vortex-scalar/proto", "vortex-proto/expr"] serde = ["dep:serde", "vortex-dtype/serde", "vortex-scalar/serde"] diff --git a/vortex-expr/build.rs b/vortex-expr/build.rs deleted file mode 100644 index abf278c83c..0000000000 --- a/vortex-expr/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub fn main() { - vortex_build::build(); -} diff --git a/vortex-expr/src/lib.rs b/vortex-expr/src/lib.rs index e8b2fb2174..aecd726223 100644 --- a/vortex-expr/src/lib.rs +++ b/vortex-expr/src/lib.rs @@ -5,18 +5,10 @@ mod display; mod expressions; mod field_paths; mod operators; + +#[cfg(all(feature = "proto", feature = "serde"))] mod serde_proto; pub use expressions::*; pub use field_paths::*; pub use operators::*; - -#[cfg(feature = "proto")] -pub mod proto { - pub mod expr { - include!(concat!(env!("OUT_DIR"), "/proto/vortex.expr.rs")); - } - - pub use vortex_dtype::proto::dtype; - pub use vortex_scalar::proto::scalar; -} diff --git a/vortex-expr/src/serde_proto.rs b/vortex-expr/src/serde_proto.rs index a3cb3d7ba7..a2bdc9fe22 100644 --- a/vortex-expr/src/serde_proto.rs +++ b/vortex-expr/src/serde_proto.rs @@ -1,9 +1,9 @@ #![cfg(feature = "proto")] use vortex_error::{vortex_bail, vortex_err, VortexError}; +use vortex_proto::expr as pb; +use vortex_proto::expr::predicate::Rhs; -use crate::proto::expr as pb; -use crate::proto::expr::predicate::Rhs; use crate::{Operator, Predicate, Value}; impl TryFrom<&pb::Predicate> for Predicate { diff --git a/vortex-flatbuffers/Cargo.toml b/vortex-flatbuffers/Cargo.toml index e8e2848283..09d2788275 100644 --- a/vortex-flatbuffers/Cargo.toml +++ b/vortex-flatbuffers/Cargo.toml @@ -11,6 +11,12 @@ include = { workspace = true } edition = { workspace = true } rust-version = { workspace = true } +[features] +dtype = [] +scalar = ["dtype"] +array = ["dtype", "scalar"] +file = ["dtype", "scalar", "array"] + [dependencies] flatbuffers = { workspace = true } diff --git a/vortex-flatbuffers/README.md b/vortex-flatbuffers/README.md new file mode 100644 index 0000000000..7f15a71e5b --- /dev/null +++ b/vortex-flatbuffers/README.md @@ -0,0 +1,9 @@ +# vortex-flatbuffers + +This crate contains Flatbuffers definitions that can be used to convert other crates in this workspace back +and forth into Flatbuffers messages. + + +## Regenerating the bindings + +Run the `./regen.sh` script. Be sure that you have the `flatc` utility installed before doing so. diff --git a/vortex-array/flatbuffers/array.fbs b/vortex-flatbuffers/flatbuffers/vortex-array/array.fbs similarity index 76% rename from vortex-array/flatbuffers/array.fbs rename to vortex-flatbuffers/flatbuffers/vortex-array/array.fbs index 838b9cb43a..8c7dcc1749 100644 --- a/vortex-array/flatbuffers/array.fbs +++ b/vortex-flatbuffers/flatbuffers/vortex-array/array.fbs @@ -1,6 +1,4 @@ -include "vortex-scalar/flatbuffers/scalar.fbs"; - -namespace vortex.array; +include "vortex-scalar/scalar.fbs"; enum Version: uint8 { V0 = 0, @@ -16,8 +14,8 @@ table Array { } table ArrayStats { - min: vortex.scalar.ScalarValue; - max: vortex.scalar.ScalarValue; + min: ScalarValue; + max: ScalarValue; is_sorted: bool = null; is_strict_sorted: bool = null; is_constant: bool = null; diff --git a/vortex-dtype/flatbuffers/dtype.fbs b/vortex-flatbuffers/flatbuffers/vortex-dtype/dtype.fbs similarity index 97% rename from vortex-dtype/flatbuffers/dtype.fbs rename to vortex-flatbuffers/flatbuffers/vortex-dtype/dtype.fbs index e5d47a54a0..8a31de56e0 100644 --- a/vortex-dtype/flatbuffers/dtype.fbs +++ b/vortex-flatbuffers/flatbuffers/vortex-dtype/dtype.fbs @@ -1,5 +1,3 @@ -namespace vortex.dtype; - enum PType: uint8 { U8, U16, diff --git a/vortex-flatbuffers/flatbuffers/vortex-scalar/scalar.fbs b/vortex-flatbuffers/flatbuffers/vortex-scalar/scalar.fbs new file mode 100644 index 0000000000..b2b08f451d --- /dev/null +++ b/vortex-flatbuffers/flatbuffers/vortex-scalar/scalar.fbs @@ -0,0 +1,12 @@ +include "vortex-dtype/dtype.fbs"; + +table Scalar { + dtype: DType (required); + value: ScalarValue (required); +} + +table ScalarValue { + flex: [ubyte] (required, flexbuffer); +} + +root_type Scalar; diff --git a/vortex-serde/flatbuffers/footer.fbs b/vortex-flatbuffers/flatbuffers/vortex-serde/footer.fbs similarity index 91% rename from vortex-serde/flatbuffers/footer.fbs rename to vortex-flatbuffers/flatbuffers/vortex-serde/footer.fbs index 0a73356531..fecbf58f85 100644 --- a/vortex-serde/flatbuffers/footer.fbs +++ b/vortex-flatbuffers/flatbuffers/vortex-serde/footer.fbs @@ -1,5 +1,3 @@ -namespace vortex.footer; - table FlatLayout { begin: uint64; end: uint64; diff --git a/vortex-serde/flatbuffers/message.fbs b/vortex-flatbuffers/flatbuffers/vortex-serde/message.fbs similarity index 65% rename from vortex-serde/flatbuffers/message.fbs rename to vortex-flatbuffers/flatbuffers/vortex-serde/message.fbs index 130175ccec..b30572f7b6 100644 --- a/vortex-serde/flatbuffers/message.fbs +++ b/vortex-flatbuffers/flatbuffers/vortex-serde/message.fbs @@ -1,9 +1,7 @@ -include "vortex-array/flatbuffers/array.fbs"; -include "vortex-dtype/flatbuffers/dtype.fbs"; +include "vortex-array/array.fbs"; +include "vortex-dtype/dtype.fbs"; -namespace vortex.serde; - -enum Version: uint8 { +enum MessageVersion: uint8 { V0 = 0, } @@ -12,7 +10,7 @@ enum Compression: uint8 { } table Schema { - dtype: vortex.dtype.DType; + dtype: DType; } struct Buffer { @@ -22,7 +20,7 @@ struct Buffer { } table Batch { - array: vortex.array.Array; + array: Array; length: uint64; buffers: [Buffer]; buffer_size: uint64; @@ -40,7 +38,7 @@ union MessageHeader { } table Message { - version: Version = V0; + version: MessageVersion = V0; header: MessageHeader; } diff --git a/vortex-flatbuffers/src/generated/array.rs b/vortex-flatbuffers/src/generated/array.rs new file mode 100644 index 0000000000..7ba6ba97c7 --- /dev/null +++ b/vortex-flatbuffers/src/generated/array.rs @@ -0,0 +1,597 @@ +// automatically generated by the FlatBuffers compiler, do not modify + + +// @generated + +use crate::scalar::*; +use crate::dtype::*; +use core::mem; +use core::cmp::Ordering; + +extern crate flatbuffers; +use self::flatbuffers::{EndianScalar, Follow}; + +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MIN_VERSION: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MAX_VERSION: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[allow(non_camel_case_types)] +pub const ENUM_VALUES_VERSION: [Version; 1] = [ + Version::V0, +]; + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[repr(transparent)] +pub struct Version(pub u8); +#[allow(non_upper_case_globals)] +impl Version { + pub const V0: Self = Self(0); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 0; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::V0, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::V0 => Some("V0"), + _ => None, + } + } +} +impl core::fmt::Debug for Version { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + if let Some(name) = self.variant_name() { + f.write_str(name) + } else { + f.write_fmt(format_args!("", self.0)) + } + } +} +impl<'a> flatbuffers::Follow<'a> for Version { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } +} + +impl flatbuffers::Push for Version { + type Output = Version; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } +} + +impl flatbuffers::EndianScalar for Version { + type Scalar = u8; + #[inline] + fn to_little_endian(self) -> u8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: u8) -> Self { + let b = u8::from_le(v); + Self(b) + } +} + +impl<'a> flatbuffers::Verifiable for Version { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } +} + +impl flatbuffers::SimpleToVerifyInSlice for Version {} +pub enum ArrayOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Array<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Array<'a> { + type Inner = Array<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Array<'a> { + pub const VT_VERSION: flatbuffers::VOffsetT = 4; + pub const VT_HAS_BUFFER: flatbuffers::VOffsetT = 6; + pub const VT_ENCODING: flatbuffers::VOffsetT = 8; + pub const VT_METADATA: flatbuffers::VOffsetT = 10; + pub const VT_STATS: flatbuffers::VOffsetT = 12; + pub const VT_CHILDREN: flatbuffers::VOffsetT = 14; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Array { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args ArrayArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = ArrayBuilder::new(_fbb); + if let Some(x) = args.children { builder.add_children(x); } + if let Some(x) = args.stats { builder.add_stats(x); } + if let Some(x) = args.metadata { builder.add_metadata(x); } + builder.add_encoding(args.encoding); + builder.add_has_buffer(args.has_buffer); + builder.add_version(args.version); + builder.finish() + } + + + #[inline] + pub fn version(&self) -> Version { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Array::VT_VERSION, Some(Version::V0)).unwrap()} + } + #[inline] + pub fn has_buffer(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Array::VT_HAS_BUFFER, Some(false)).unwrap()} + } + #[inline] + pub fn encoding(&self) -> u16 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Array::VT_ENCODING, Some(0)).unwrap()} + } + #[inline] + pub fn metadata(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(Array::VT_METADATA, None)} + } + #[inline] + pub fn stats(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(Array::VT_STATS, None)} + } + #[inline] + pub fn children(&self) -> Option>>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>>(Array::VT_CHILDREN, None)} + } +} + +impl flatbuffers::Verifiable for Array<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("version", Self::VT_VERSION, false)? + .visit_field::("has_buffer", Self::VT_HAS_BUFFER, false)? + .visit_field::("encoding", Self::VT_ENCODING, false)? + .visit_field::>>("metadata", Self::VT_METADATA, false)? + .visit_field::>("stats", Self::VT_STATS, false)? + .visit_field::>>>("children", Self::VT_CHILDREN, false)? + .finish(); + Ok(()) + } +} +pub struct ArrayArgs<'a> { + pub version: Version, + pub has_buffer: bool, + pub encoding: u16, + pub metadata: Option>>, + pub stats: Option>>, + pub children: Option>>>>, +} +impl<'a> Default for ArrayArgs<'a> { + #[inline] + fn default() -> Self { + ArrayArgs { + version: Version::V0, + has_buffer: false, + encoding: 0, + metadata: None, + stats: None, + children: None, + } + } +} + +pub struct ArrayBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ArrayBuilder<'a, 'b, A> { + #[inline] + pub fn add_version(&mut self, version: Version) { + self.fbb_.push_slot::(Array::VT_VERSION, version, Version::V0); + } + #[inline] + pub fn add_has_buffer(&mut self, has_buffer: bool) { + self.fbb_.push_slot::(Array::VT_HAS_BUFFER, has_buffer, false); + } + #[inline] + pub fn add_encoding(&mut self, encoding: u16) { + self.fbb_.push_slot::(Array::VT_ENCODING, encoding, 0); + } + #[inline] + pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(Array::VT_METADATA, metadata); + } + #[inline] + pub fn add_stats(&mut self, stats: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(Array::VT_STATS, stats); + } + #[inline] + pub fn add_children(&mut self, children: flatbuffers::WIPOffset>>>) { + self.fbb_.push_slot_always::>(Array::VT_CHILDREN, children); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + ArrayBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Array<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Array"); + ds.field("version", &self.version()); + ds.field("has_buffer", &self.has_buffer()); + ds.field("encoding", &self.encoding()); + ds.field("metadata", &self.metadata()); + ds.field("stats", &self.stats()); + ds.field("children", &self.children()); + ds.finish() + } +} +pub enum ArrayStatsOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct ArrayStats<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for ArrayStats<'a> { + type Inner = ArrayStats<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> ArrayStats<'a> { + pub const VT_MIN: flatbuffers::VOffsetT = 4; + pub const VT_MAX: flatbuffers::VOffsetT = 6; + pub const VT_IS_SORTED: flatbuffers::VOffsetT = 8; + pub const VT_IS_STRICT_SORTED: flatbuffers::VOffsetT = 10; + pub const VT_IS_CONSTANT: flatbuffers::VOffsetT = 12; + pub const VT_RUN_COUNT: flatbuffers::VOffsetT = 14; + pub const VT_TRUE_COUNT: flatbuffers::VOffsetT = 16; + pub const VT_NULL_COUNT: flatbuffers::VOffsetT = 18; + pub const VT_BIT_WIDTH_FREQ: flatbuffers::VOffsetT = 20; + pub const VT_TRAILING_ZERO_FREQ: flatbuffers::VOffsetT = 22; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + ArrayStats { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args ArrayStatsArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = ArrayStatsBuilder::new(_fbb); + if let Some(x) = args.null_count { builder.add_null_count(x); } + if let Some(x) = args.true_count { builder.add_true_count(x); } + if let Some(x) = args.run_count { builder.add_run_count(x); } + if let Some(x) = args.trailing_zero_freq { builder.add_trailing_zero_freq(x); } + if let Some(x) = args.bit_width_freq { builder.add_bit_width_freq(x); } + if let Some(x) = args.max { builder.add_max(x); } + if let Some(x) = args.min { builder.add_min(x); } + if let Some(x) = args.is_constant { builder.add_is_constant(x); } + if let Some(x) = args.is_strict_sorted { builder.add_is_strict_sorted(x); } + if let Some(x) = args.is_sorted { builder.add_is_sorted(x); } + builder.finish() + } + + + #[inline] + pub fn min(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(ArrayStats::VT_MIN, None)} + } + #[inline] + pub fn max(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(ArrayStats::VT_MAX, None)} + } + #[inline] + pub fn is_sorted(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(ArrayStats::VT_IS_SORTED, None)} + } + #[inline] + pub fn is_strict_sorted(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(ArrayStats::VT_IS_STRICT_SORTED, None)} + } + #[inline] + pub fn is_constant(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(ArrayStats::VT_IS_CONSTANT, None)} + } + #[inline] + pub fn run_count(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(ArrayStats::VT_RUN_COUNT, None)} + } + #[inline] + pub fn true_count(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(ArrayStats::VT_TRUE_COUNT, None)} + } + #[inline] + pub fn null_count(&self) -> Option { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(ArrayStats::VT_NULL_COUNT, None)} + } + #[inline] + pub fn bit_width_freq(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(ArrayStats::VT_BIT_WIDTH_FREQ, None)} + } + #[inline] + pub fn trailing_zero_freq(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(ArrayStats::VT_TRAILING_ZERO_FREQ, None)} + } +} + +impl flatbuffers::Verifiable for ArrayStats<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("min", Self::VT_MIN, false)? + .visit_field::>("max", Self::VT_MAX, false)? + .visit_field::("is_sorted", Self::VT_IS_SORTED, false)? + .visit_field::("is_strict_sorted", Self::VT_IS_STRICT_SORTED, false)? + .visit_field::("is_constant", Self::VT_IS_CONSTANT, false)? + .visit_field::("run_count", Self::VT_RUN_COUNT, false)? + .visit_field::("true_count", Self::VT_TRUE_COUNT, false)? + .visit_field::("null_count", Self::VT_NULL_COUNT, false)? + .visit_field::>>("bit_width_freq", Self::VT_BIT_WIDTH_FREQ, false)? + .visit_field::>>("trailing_zero_freq", Self::VT_TRAILING_ZERO_FREQ, false)? + .finish(); + Ok(()) + } +} +pub struct ArrayStatsArgs<'a> { + pub min: Option>>, + pub max: Option>>, + pub is_sorted: Option, + pub is_strict_sorted: Option, + pub is_constant: Option, + pub run_count: Option, + pub true_count: Option, + pub null_count: Option, + pub bit_width_freq: Option>>, + pub trailing_zero_freq: Option>>, +} +impl<'a> Default for ArrayStatsArgs<'a> { + #[inline] + fn default() -> Self { + ArrayStatsArgs { + min: None, + max: None, + is_sorted: None, + is_strict_sorted: None, + is_constant: None, + run_count: None, + true_count: None, + null_count: None, + bit_width_freq: None, + trailing_zero_freq: None, + } + } +} + +pub struct ArrayStatsBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ArrayStatsBuilder<'a, 'b, A> { + #[inline] + pub fn add_min(&mut self, min: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(ArrayStats::VT_MIN, min); + } + #[inline] + pub fn add_max(&mut self, max: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(ArrayStats::VT_MAX, max); + } + #[inline] + pub fn add_is_sorted(&mut self, is_sorted: bool) { + self.fbb_.push_slot_always::(ArrayStats::VT_IS_SORTED, is_sorted); + } + #[inline] + pub fn add_is_strict_sorted(&mut self, is_strict_sorted: bool) { + self.fbb_.push_slot_always::(ArrayStats::VT_IS_STRICT_SORTED, is_strict_sorted); + } + #[inline] + pub fn add_is_constant(&mut self, is_constant: bool) { + self.fbb_.push_slot_always::(ArrayStats::VT_IS_CONSTANT, is_constant); + } + #[inline] + pub fn add_run_count(&mut self, run_count: u64) { + self.fbb_.push_slot_always::(ArrayStats::VT_RUN_COUNT, run_count); + } + #[inline] + pub fn add_true_count(&mut self, true_count: u64) { + self.fbb_.push_slot_always::(ArrayStats::VT_TRUE_COUNT, true_count); + } + #[inline] + pub fn add_null_count(&mut self, null_count: u64) { + self.fbb_.push_slot_always::(ArrayStats::VT_NULL_COUNT, null_count); + } + #[inline] + pub fn add_bit_width_freq(&mut self, bit_width_freq: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(ArrayStats::VT_BIT_WIDTH_FREQ, bit_width_freq); + } + #[inline] + pub fn add_trailing_zero_freq(&mut self, trailing_zero_freq: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(ArrayStats::VT_TRAILING_ZERO_FREQ, trailing_zero_freq); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ArrayStatsBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + ArrayStatsBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for ArrayStats<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("ArrayStats"); + ds.field("min", &self.min()); + ds.field("max", &self.max()); + ds.field("is_sorted", &self.is_sorted()); + ds.field("is_strict_sorted", &self.is_strict_sorted()); + ds.field("is_constant", &self.is_constant()); + ds.field("run_count", &self.run_count()); + ds.field("true_count", &self.true_count()); + ds.field("null_count", &self.null_count()); + ds.field("bit_width_freq", &self.bit_width_freq()); + ds.field("trailing_zero_freq", &self.trailing_zero_freq()); + ds.finish() + } +} +#[inline] +/// Verifies that a buffer of bytes contains a `Array` +/// and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_array_unchecked`. +pub fn root_as_array(buf: &[u8]) -> Result { + flatbuffers::root::(buf) +} +#[inline] +/// Verifies that a buffer of bytes contains a size prefixed +/// `Array` and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `size_prefixed_root_as_array_unchecked`. +pub fn size_prefixed_root_as_array(buf: &[u8]) -> Result { + flatbuffers::size_prefixed_root::(buf) +} +#[inline] +/// Verifies, with the given options, that a buffer of bytes +/// contains a `Array` and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_array_unchecked`. +pub fn root_as_array_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], +) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::root_with_opts::>(opts, buf) +} +#[inline] +/// Verifies, with the given verifier options, that a buffer of +/// bytes contains a size prefixed `Array` and returns +/// it. Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_array_unchecked`. +pub fn size_prefixed_root_as_array_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], +) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) +} +#[inline] +/// Assumes, without verification, that a buffer of bytes contains a Array and returns it. +/// # Safety +/// Callers must trust the given bytes do indeed contain a valid `Array`. +pub unsafe fn root_as_array_unchecked(buf: &[u8]) -> Array { + flatbuffers::root_unchecked::(buf) +} +#[inline] +/// Assumes, without verification, that a buffer of bytes contains a size prefixed Array and returns it. +/// # Safety +/// Callers must trust the given bytes do indeed contain a valid size prefixed `Array`. +pub unsafe fn size_prefixed_root_as_array_unchecked(buf: &[u8]) -> Array { + flatbuffers::size_prefixed_root_unchecked::(buf) +} +#[inline] +pub fn finish_array_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + root: flatbuffers::WIPOffset>) { + fbb.finish(root, None); +} + +#[inline] +pub fn finish_size_prefixed_array_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset>) { + fbb.finish_size_prefixed(root, None); +} diff --git a/vortex-flatbuffers/src/generated/dtype.rs b/vortex-flatbuffers/src/generated/dtype.rs new file mode 100644 index 0000000000..b86459ec7a --- /dev/null +++ b/vortex-flatbuffers/src/generated/dtype.rs @@ -0,0 +1,1644 @@ +// automatically generated by the FlatBuffers compiler, do not modify + + +// @generated + +use core::mem; +use core::cmp::Ordering; + +extern crate flatbuffers; +use self::flatbuffers::{EndianScalar, Follow}; + +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MIN_PTYPE: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MAX_PTYPE: u8 = 10; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[allow(non_camel_case_types)] +pub const ENUM_VALUES_PTYPE: [PType; 11] = [ + PType::U8, + PType::U16, + PType::U32, + PType::U64, + PType::I8, + PType::I16, + PType::I32, + PType::I64, + PType::F16, + PType::F32, + PType::F64, +]; + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[repr(transparent)] +pub struct PType(pub u8); +#[allow(non_upper_case_globals)] +impl PType { + pub const U8: Self = Self(0); + pub const U16: Self = Self(1); + pub const U32: Self = Self(2); + pub const U64: Self = Self(3); + pub const I8: Self = Self(4); + pub const I16: Self = Self(5); + pub const I32: Self = Self(6); + pub const I64: Self = Self(7); + pub const F16: Self = Self(8); + pub const F32: Self = Self(9); + pub const F64: Self = Self(10); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 10; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::U8, + Self::U16, + Self::U32, + Self::U64, + Self::I8, + Self::I16, + Self::I32, + Self::I64, + Self::F16, + Self::F32, + Self::F64, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::U8 => Some("U8"), + Self::U16 => Some("U16"), + Self::U32 => Some("U32"), + Self::U64 => Some("U64"), + Self::I8 => Some("I8"), + Self::I16 => Some("I16"), + Self::I32 => Some("I32"), + Self::I64 => Some("I64"), + Self::F16 => Some("F16"), + Self::F32 => Some("F32"), + Self::F64 => Some("F64"), + _ => None, + } + } +} +impl core::fmt::Debug for PType { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + if let Some(name) = self.variant_name() { + f.write_str(name) + } else { + f.write_fmt(format_args!("", self.0)) + } + } +} +impl<'a> flatbuffers::Follow<'a> for PType { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } +} + +impl flatbuffers::Push for PType { + type Output = PType; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } +} + +impl flatbuffers::EndianScalar for PType { + type Scalar = u8; + #[inline] + fn to_little_endian(self) -> u8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: u8) -> Self { + let b = u8::from_le(v); + Self(b) + } +} + +impl<'a> flatbuffers::Verifiable for PType { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } +} + +impl flatbuffers::SimpleToVerifyInSlice for PType {} +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MIN_TYPE: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MAX_TYPE: u8 = 9; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[allow(non_camel_case_types)] +pub const ENUM_VALUES_TYPE: [Type; 10] = [ + Type::NONE, + Type::Null, + Type::Bool, + Type::Primitive, + Type::Decimal, + Type::Utf8, + Type::Binary, + Type::Struct_, + Type::List, + Type::Extension, +]; + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[repr(transparent)] +pub struct Type(pub u8); +#[allow(non_upper_case_globals)] +impl Type { + pub const NONE: Self = Self(0); + pub const Null: Self = Self(1); + pub const Bool: Self = Self(2); + pub const Primitive: Self = Self(3); + pub const Decimal: Self = Self(4); + pub const Utf8: Self = Self(5); + pub const Binary: Self = Self(6); + pub const Struct_: Self = Self(7); + pub const List: Self = Self(8); + pub const Extension: Self = Self(9); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 9; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::Null, + Self::Bool, + Self::Primitive, + Self::Decimal, + Self::Utf8, + Self::Binary, + Self::Struct_, + Self::List, + Self::Extension, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::Null => Some("Null"), + Self::Bool => Some("Bool"), + Self::Primitive => Some("Primitive"), + Self::Decimal => Some("Decimal"), + Self::Utf8 => Some("Utf8"), + Self::Binary => Some("Binary"), + Self::Struct_ => Some("Struct_"), + Self::List => Some("List"), + Self::Extension => Some("Extension"), + _ => None, + } + } +} +impl core::fmt::Debug for Type { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + if let Some(name) = self.variant_name() { + f.write_str(name) + } else { + f.write_fmt(format_args!("", self.0)) + } + } +} +impl<'a> flatbuffers::Follow<'a> for Type { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } +} + +impl flatbuffers::Push for Type { + type Output = Type; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } +} + +impl flatbuffers::EndianScalar for Type { + type Scalar = u8; + #[inline] + fn to_little_endian(self) -> u8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: u8) -> Self { + let b = u8::from_le(v); + Self(b) + } +} + +impl<'a> flatbuffers::Verifiable for Type { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } +} + +impl flatbuffers::SimpleToVerifyInSlice for Type {} +pub struct TypeUnionTableOffset {} + +pub enum NullOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Null<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Null<'a> { + type Inner = Null<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Null<'a> { + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Null { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + _args: &'args NullArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = NullBuilder::new(_fbb); + builder.finish() + } + +} + +impl flatbuffers::Verifiable for Null<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .finish(); + Ok(()) + } +} +pub struct NullArgs { +} +impl<'a> Default for NullArgs { + #[inline] + fn default() -> Self { + NullArgs { + } + } +} + +pub struct NullBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> NullBuilder<'a, 'b, A> { + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> NullBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + NullBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Null<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Null"); + ds.finish() + } +} +pub enum BoolOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Bool<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Bool<'a> { + type Inner = Bool<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Bool<'a> { + pub const VT_NULLABLE: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Bool { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args BoolArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = BoolBuilder::new(_fbb); + builder.add_nullable(args.nullable); + builder.finish() + } + + + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Bool::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Bool<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct BoolArgs { + pub nullable: bool, +} +impl<'a> Default for BoolArgs { + #[inline] + fn default() -> Self { + BoolArgs { + nullable: false, + } + } +} + +pub struct BoolBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> BoolBuilder<'a, 'b, A> { + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Bool::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BoolBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + BoolBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Bool<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Bool"); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum PrimitiveOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Primitive<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Primitive<'a> { + type Inner = Primitive<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Primitive<'a> { + pub const VT_PTYPE: flatbuffers::VOffsetT = 4; + pub const VT_NULLABLE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Primitive { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args PrimitiveArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = PrimitiveBuilder::new(_fbb); + builder.add_nullable(args.nullable); + builder.add_ptype(args.ptype); + builder.finish() + } + + + #[inline] + pub fn ptype(&self) -> PType { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Primitive::VT_PTYPE, Some(PType::U8)).unwrap()} + } + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Primitive::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Primitive<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("ptype", Self::VT_PTYPE, false)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct PrimitiveArgs { + pub ptype: PType, + pub nullable: bool, +} +impl<'a> Default for PrimitiveArgs { + #[inline] + fn default() -> Self { + PrimitiveArgs { + ptype: PType::U8, + nullable: false, + } + } +} + +pub struct PrimitiveBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PrimitiveBuilder<'a, 'b, A> { + #[inline] + pub fn add_ptype(&mut self, ptype: PType) { + self.fbb_.push_slot::(Primitive::VT_PTYPE, ptype, PType::U8); + } + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Primitive::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PrimitiveBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + PrimitiveBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Primitive<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Primitive"); + ds.field("ptype", &self.ptype()); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum DecimalOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Decimal<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Decimal<'a> { + type Inner = Decimal<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Decimal<'a> { + pub const VT_PRECISION: flatbuffers::VOffsetT = 4; + pub const VT_SCALE: flatbuffers::VOffsetT = 6; + pub const VT_NULLABLE: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Decimal { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args DecimalArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = DecimalBuilder::new(_fbb); + builder.add_nullable(args.nullable); + builder.add_scale(args.scale); + builder.add_precision(args.precision); + builder.finish() + } + + + /// Total number of decimal digits + #[inline] + pub fn precision(&self) -> u8 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Decimal::VT_PRECISION, Some(0)).unwrap()} + } + /// Number of digits after the decimal point "." + #[inline] + pub fn scale(&self) -> u8 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Decimal::VT_SCALE, Some(0)).unwrap()} + } + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Decimal::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Decimal<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("precision", Self::VT_PRECISION, false)? + .visit_field::("scale", Self::VT_SCALE, false)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct DecimalArgs { + pub precision: u8, + pub scale: u8, + pub nullable: bool, +} +impl<'a> Default for DecimalArgs { + #[inline] + fn default() -> Self { + DecimalArgs { + precision: 0, + scale: 0, + nullable: false, + } + } +} + +pub struct DecimalBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DecimalBuilder<'a, 'b, A> { + #[inline] + pub fn add_precision(&mut self, precision: u8) { + self.fbb_.push_slot::(Decimal::VT_PRECISION, precision, 0); + } + #[inline] + pub fn add_scale(&mut self, scale: u8) { + self.fbb_.push_slot::(Decimal::VT_SCALE, scale, 0); + } + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Decimal::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DecimalBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + DecimalBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Decimal<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Decimal"); + ds.field("precision", &self.precision()); + ds.field("scale", &self.scale()); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum Utf8Offset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Utf8<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Utf8<'a> { + type Inner = Utf8<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Utf8<'a> { + pub const VT_NULLABLE: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Utf8 { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args Utf8Args + ) -> flatbuffers::WIPOffset> { + let mut builder = Utf8Builder::new(_fbb); + builder.add_nullable(args.nullable); + builder.finish() + } + + + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Utf8::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Utf8<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct Utf8Args { + pub nullable: bool, +} +impl<'a> Default for Utf8Args { + #[inline] + fn default() -> Self { + Utf8Args { + nullable: false, + } + } +} + +pub struct Utf8Builder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> Utf8Builder<'a, 'b, A> { + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Utf8::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Utf8Builder<'a, 'b, A> { + let start = _fbb.start_table(); + Utf8Builder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Utf8<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Utf8"); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum BinaryOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Binary<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Binary<'a> { + type Inner = Binary<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Binary<'a> { + pub const VT_NULLABLE: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Binary { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args BinaryArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = BinaryBuilder::new(_fbb); + builder.add_nullable(args.nullable); + builder.finish() + } + + + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Binary::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Binary<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct BinaryArgs { + pub nullable: bool, +} +impl<'a> Default for BinaryArgs { + #[inline] + fn default() -> Self { + BinaryArgs { + nullable: false, + } + } +} + +pub struct BinaryBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> BinaryBuilder<'a, 'b, A> { + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Binary::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> BinaryBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + BinaryBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Binary<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Binary"); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum Struct_Offset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Struct_<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Struct_<'a> { + type Inner = Struct_<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Struct_<'a> { + pub const VT_NAMES: flatbuffers::VOffsetT = 4; + pub const VT_DTYPES: flatbuffers::VOffsetT = 6; + pub const VT_NULLABLE: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Struct_ { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args Struct_Args<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = Struct_Builder::new(_fbb); + if let Some(x) = args.dtypes { builder.add_dtypes(x); } + if let Some(x) = args.names { builder.add_names(x); } + builder.add_nullable(args.nullable); + builder.finish() + } + + + #[inline] + pub fn names(&self) -> Option>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>>(Struct_::VT_NAMES, None)} + } + #[inline] + pub fn dtypes(&self) -> Option>>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>>(Struct_::VT_DTYPES, None)} + } + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Struct_::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Struct_<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>>("names", Self::VT_NAMES, false)? + .visit_field::>>>("dtypes", Self::VT_DTYPES, false)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct Struct_Args<'a> { + pub names: Option>>>, + pub dtypes: Option>>>>, + pub nullable: bool, +} +impl<'a> Default for Struct_Args<'a> { + #[inline] + fn default() -> Self { + Struct_Args { + names: None, + dtypes: None, + nullable: false, + } + } +} + +pub struct Struct_Builder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> Struct_Builder<'a, 'b, A> { + #[inline] + pub fn add_names(&mut self, names: flatbuffers::WIPOffset>>) { + self.fbb_.push_slot_always::>(Struct_::VT_NAMES, names); + } + #[inline] + pub fn add_dtypes(&mut self, dtypes: flatbuffers::WIPOffset>>>) { + self.fbb_.push_slot_always::>(Struct_::VT_DTYPES, dtypes); + } + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Struct_::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> Struct_Builder<'a, 'b, A> { + let start = _fbb.start_table(); + Struct_Builder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Struct_<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Struct_"); + ds.field("names", &self.names()); + ds.field("dtypes", &self.dtypes()); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum ListOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct List<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for List<'a> { + type Inner = List<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> List<'a> { + pub const VT_ELEMENT_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_NULLABLE: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + List { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args ListArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = ListBuilder::new(_fbb); + if let Some(x) = args.element_type { builder.add_element_type(x); } + builder.add_nullable(args.nullable); + builder.finish() + } + + + #[inline] + pub fn element_type(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(List::VT_ELEMENT_TYPE, None)} + } + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(List::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for List<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("element_type", Self::VT_ELEMENT_TYPE, false)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct ListArgs<'a> { + pub element_type: Option>>, + pub nullable: bool, +} +impl<'a> Default for ListArgs<'a> { + #[inline] + fn default() -> Self { + ListArgs { + element_type: None, + nullable: false, + } + } +} + +pub struct ListBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ListBuilder<'a, 'b, A> { + #[inline] + pub fn add_element_type(&mut self, element_type: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(List::VT_ELEMENT_TYPE, element_type); + } + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(List::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ListBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + ListBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for List<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("List"); + ds.field("element_type", &self.element_type()); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum ExtensionOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Extension<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Extension<'a> { + type Inner = Extension<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Extension<'a> { + pub const VT_ID: flatbuffers::VOffsetT = 4; + pub const VT_METADATA: flatbuffers::VOffsetT = 6; + pub const VT_NULLABLE: flatbuffers::VOffsetT = 8; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Extension { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args ExtensionArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = ExtensionBuilder::new(_fbb); + if let Some(x) = args.metadata { builder.add_metadata(x); } + if let Some(x) = args.id { builder.add_id(x); } + builder.add_nullable(args.nullable); + builder.finish() + } + + + #[inline] + pub fn id(&self) -> Option<&'a str> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(Extension::VT_ID, None)} + } + #[inline] + pub fn metadata(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(Extension::VT_METADATA, None)} + } + #[inline] + pub fn nullable(&self) -> bool { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Extension::VT_NULLABLE, Some(false)).unwrap()} + } +} + +impl flatbuffers::Verifiable for Extension<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("id", Self::VT_ID, false)? + .visit_field::>>("metadata", Self::VT_METADATA, false)? + .visit_field::("nullable", Self::VT_NULLABLE, false)? + .finish(); + Ok(()) + } +} +pub struct ExtensionArgs<'a> { + pub id: Option>, + pub metadata: Option>>, + pub nullable: bool, +} +impl<'a> Default for ExtensionArgs<'a> { + #[inline] + fn default() -> Self { + ExtensionArgs { + id: None, + metadata: None, + nullable: false, + } + } +} + +pub struct ExtensionBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ExtensionBuilder<'a, 'b, A> { + #[inline] + pub fn add_id(&mut self, id: flatbuffers::WIPOffset<&'b str>) { + self.fbb_.push_slot_always::>(Extension::VT_ID, id); + } + #[inline] + pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(Extension::VT_METADATA, metadata); + } + #[inline] + pub fn add_nullable(&mut self, nullable: bool) { + self.fbb_.push_slot::(Extension::VT_NULLABLE, nullable, false); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ExtensionBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + ExtensionBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Extension<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Extension"); + ds.field("id", &self.id()); + ds.field("metadata", &self.metadata()); + ds.field("nullable", &self.nullable()); + ds.finish() + } +} +pub enum DTypeOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct DType<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for DType<'a> { + type Inner = DType<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> DType<'a> { + pub const VT_TYPE_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_TYPE_: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + DType { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args DTypeArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = DTypeBuilder::new(_fbb); + if let Some(x) = args.type_ { builder.add_type_(x); } + builder.add_type_type(args.type_type); + builder.finish() + } + + + #[inline] + pub fn type_type(&self) -> Type { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(DType::VT_TYPE_TYPE, Some(Type::NONE)).unwrap()} + } + #[inline] + pub fn type_(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(DType::VT_TYPE_, None)} + } + #[inline] + #[allow(non_snake_case)] + pub fn type__as_null(&self) -> Option> { + if self.type_type() == Type::Null { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Null::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_bool(&self) -> Option> { + if self.type_type() == Type::Bool { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Bool::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_primitive(&self) -> Option> { + if self.type_type() == Type::Primitive { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Primitive::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_decimal(&self) -> Option> { + if self.type_type() == Type::Decimal { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Decimal::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_utf_8(&self) -> Option> { + if self.type_type() == Type::Utf8 { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Utf8::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_binary(&self) -> Option> { + if self.type_type() == Type::Binary { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Binary::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_struct_(&self) -> Option> { + if self.type_type() == Type::Struct_ { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Struct_::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_list(&self) -> Option> { + if self.type_type() == Type::List { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { List::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn type__as_extension(&self) -> Option> { + if self.type_type() == Type::Extension { + self.type_().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { Extension::init_from_table(t) } + }) + } else { + None + } + } + +} + +impl flatbuffers::Verifiable for DType<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::("type_type", Self::VT_TYPE_TYPE, "type_", Self::VT_TYPE_, false, |key, v, pos| { + match key { + Type::Null => v.verify_union_variant::>("Type::Null", pos), + Type::Bool => v.verify_union_variant::>("Type::Bool", pos), + Type::Primitive => v.verify_union_variant::>("Type::Primitive", pos), + Type::Decimal => v.verify_union_variant::>("Type::Decimal", pos), + Type::Utf8 => v.verify_union_variant::>("Type::Utf8", pos), + Type::Binary => v.verify_union_variant::>("Type::Binary", pos), + Type::Struct_ => v.verify_union_variant::>("Type::Struct_", pos), + Type::List => v.verify_union_variant::>("Type::List", pos), + Type::Extension => v.verify_union_variant::>("Type::Extension", pos), + _ => Ok(()), + } + })? + .finish(); + Ok(()) + } +} +pub struct DTypeArgs { + pub type_type: Type, + pub type_: Option>, +} +impl<'a> Default for DTypeArgs { + #[inline] + fn default() -> Self { + DTypeArgs { + type_type: Type::NONE, + type_: None, + } + } +} + +pub struct DTypeBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> DTypeBuilder<'a, 'b, A> { + #[inline] + pub fn add_type_type(&mut self, type_type: Type) { + self.fbb_.push_slot::(DType::VT_TYPE_TYPE, type_type, Type::NONE); + } + #[inline] + pub fn add_type_(&mut self, type_: flatbuffers::WIPOffset) { + self.fbb_.push_slot_always::>(DType::VT_TYPE_, type_); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> DTypeBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + DTypeBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for DType<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("DType"); + ds.field("type_type", &self.type_type()); + match self.type_type() { + Type::Null => { + if let Some(x) = self.type__as_null() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Bool => { + if let Some(x) = self.type__as_bool() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Primitive => { + if let Some(x) = self.type__as_primitive() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Decimal => { + if let Some(x) = self.type__as_decimal() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Utf8 => { + if let Some(x) = self.type__as_utf_8() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Binary => { + if let Some(x) = self.type__as_binary() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Struct_ => { + if let Some(x) = self.type__as_struct_() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::List => { + if let Some(x) = self.type__as_list() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + Type::Extension => { + if let Some(x) = self.type__as_extension() { + ds.field("type_", &x) + } else { + ds.field("type_", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + _ => { + let x: Option<()> = None; + ds.field("type_", &x) + }, + }; + ds.finish() + } +} +#[inline] +/// Verifies that a buffer of bytes contains a `DType` +/// and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_dtype_unchecked`. +pub fn root_as_dtype(buf: &[u8]) -> Result { + flatbuffers::root::(buf) +} +#[inline] +/// Verifies that a buffer of bytes contains a size prefixed +/// `DType` and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `size_prefixed_root_as_dtype_unchecked`. +pub fn size_prefixed_root_as_dtype(buf: &[u8]) -> Result { + flatbuffers::size_prefixed_root::(buf) +} +#[inline] +/// Verifies, with the given options, that a buffer of bytes +/// contains a `DType` and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_dtype_unchecked`. +pub fn root_as_dtype_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], +) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::root_with_opts::>(opts, buf) +} +#[inline] +/// Verifies, with the given verifier options, that a buffer of +/// bytes contains a size prefixed `DType` and returns +/// it. Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_dtype_unchecked`. +pub fn size_prefixed_root_as_dtype_with_opts<'b, 'o>( + opts: &'o flatbuffers::VerifierOptions, + buf: &'b [u8], +) -> Result, flatbuffers::InvalidFlatbuffer> { + flatbuffers::size_prefixed_root_with_opts::>(opts, buf) +} +#[inline] +/// Assumes, without verification, that a buffer of bytes contains a DType and returns it. +/// # Safety +/// Callers must trust the given bytes do indeed contain a valid `DType`. +pub unsafe fn root_as_dtype_unchecked(buf: &[u8]) -> DType { + flatbuffers::root_unchecked::(buf) +} +#[inline] +/// Assumes, without verification, that a buffer of bytes contains a size prefixed DType and returns it. +/// # Safety +/// Callers must trust the given bytes do indeed contain a valid size prefixed `DType`. +pub unsafe fn size_prefixed_root_as_dtype_unchecked(buf: &[u8]) -> DType { + flatbuffers::size_prefixed_root_unchecked::(buf) +} +#[inline] +pub fn finish_dtype_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>( + fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + root: flatbuffers::WIPOffset>) { + fbb.finish(root, None); +} + +#[inline] +pub fn finish_size_prefixed_dtype_buffer<'a, 'b, A: flatbuffers::Allocator + 'a>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, root: flatbuffers::WIPOffset>) { + fbb.finish_size_prefixed(root, None); +} diff --git a/vortex-flatbuffers/src/generated/footer.rs b/vortex-flatbuffers/src/generated/footer.rs new file mode 100644 index 0000000000..9db4c2d820 --- /dev/null +++ b/vortex-flatbuffers/src/generated/footer.rs @@ -0,0 +1,666 @@ +// automatically generated by the FlatBuffers compiler, do not modify + + +// @generated + +use core::mem; +use core::cmp::Ordering; + +extern crate flatbuffers; +use self::flatbuffers::{EndianScalar, Follow}; + +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MIN_LAYOUT_VARIANT: u8 = 0; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +pub const ENUM_MAX_LAYOUT_VARIANT: u8 = 2; +#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] +#[allow(non_camel_case_types)] +pub const ENUM_VALUES_LAYOUT_VARIANT: [LayoutVariant; 3] = [ + LayoutVariant::NONE, + LayoutVariant::FlatLayout, + LayoutVariant::NestedLayout, +]; + +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] +#[repr(transparent)] +pub struct LayoutVariant(pub u8); +#[allow(non_upper_case_globals)] +impl LayoutVariant { + pub const NONE: Self = Self(0); + pub const FlatLayout: Self = Self(1); + pub const NestedLayout: Self = Self(2); + + pub const ENUM_MIN: u8 = 0; + pub const ENUM_MAX: u8 = 2; + pub const ENUM_VALUES: &'static [Self] = &[ + Self::NONE, + Self::FlatLayout, + Self::NestedLayout, + ]; + /// Returns the variant's name or "" if unknown. + pub fn variant_name(self) -> Option<&'static str> { + match self { + Self::NONE => Some("NONE"), + Self::FlatLayout => Some("FlatLayout"), + Self::NestedLayout => Some("NestedLayout"), + _ => None, + } + } +} +impl core::fmt::Debug for LayoutVariant { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { + if let Some(name) = self.variant_name() { + f.write_str(name) + } else { + f.write_fmt(format_args!("", self.0)) + } + } +} +impl<'a> flatbuffers::Follow<'a> for LayoutVariant { + type Inner = Self; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + let b = flatbuffers::read_scalar_at::(buf, loc); + Self(b) + } +} + +impl flatbuffers::Push for LayoutVariant { + type Output = LayoutVariant; + #[inline] + unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { + flatbuffers::emplace_scalar::(dst, self.0); + } +} + +impl flatbuffers::EndianScalar for LayoutVariant { + type Scalar = u8; + #[inline] + fn to_little_endian(self) -> u8 { + self.0.to_le() + } + #[inline] + #[allow(clippy::wrong_self_convention)] + fn from_little_endian(v: u8) -> Self { + let b = u8::from_le(v); + Self(b) + } +} + +impl<'a> flatbuffers::Verifiable for LayoutVariant { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + u8::run_verifier(v, pos) + } +} + +impl flatbuffers::SimpleToVerifyInSlice for LayoutVariant {} +pub struct LayoutVariantUnionTableOffset {} + +pub enum FlatLayoutOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct FlatLayout<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for FlatLayout<'a> { + type Inner = FlatLayout<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> FlatLayout<'a> { + pub const VT_BEGIN: flatbuffers::VOffsetT = 4; + pub const VT_END: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + FlatLayout { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args FlatLayoutArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = FlatLayoutBuilder::new(_fbb); + builder.add_end(args.end); + builder.add_begin(args.begin); + builder.finish() + } + + + #[inline] + pub fn begin(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(FlatLayout::VT_BEGIN, Some(0)).unwrap()} + } + #[inline] + pub fn end(&self) -> u64 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(FlatLayout::VT_END, Some(0)).unwrap()} + } +} + +impl flatbuffers::Verifiable for FlatLayout<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::("begin", Self::VT_BEGIN, false)? + .visit_field::("end", Self::VT_END, false)? + .finish(); + Ok(()) + } +} +pub struct FlatLayoutArgs { + pub begin: u64, + pub end: u64, +} +impl<'a> Default for FlatLayoutArgs { + #[inline] + fn default() -> Self { + FlatLayoutArgs { + begin: 0, + end: 0, + } + } +} + +pub struct FlatLayoutBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FlatLayoutBuilder<'a, 'b, A> { + #[inline] + pub fn add_begin(&mut self, begin: u64) { + self.fbb_.push_slot::(FlatLayout::VT_BEGIN, begin, 0); + } + #[inline] + pub fn add_end(&mut self, end: u64) { + self.fbb_.push_slot::(FlatLayout::VT_END, end, 0); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FlatLayoutBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + FlatLayoutBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for FlatLayout<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("FlatLayout"); + ds.field("begin", &self.begin()); + ds.field("end", &self.end()); + ds.finish() + } +} +pub enum NestedLayoutOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct NestedLayout<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for NestedLayout<'a> { + type Inner = NestedLayout<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> NestedLayout<'a> { + pub const VT_CHILDREN: flatbuffers::VOffsetT = 4; + pub const VT_ENCODING: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + NestedLayout { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args NestedLayoutArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = NestedLayoutBuilder::new(_fbb); + if let Some(x) = args.children { builder.add_children(x); } + builder.add_encoding(args.encoding); + builder.finish() + } + + + #[inline] + pub fn children(&self) -> Option>>> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>>(NestedLayout::VT_CHILDREN, None)} + } + #[inline] + pub fn encoding(&self) -> u16 { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(NestedLayout::VT_ENCODING, Some(0)).unwrap()} + } +} + +impl flatbuffers::Verifiable for NestedLayout<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>>>("children", Self::VT_CHILDREN, false)? + .visit_field::("encoding", Self::VT_ENCODING, false)? + .finish(); + Ok(()) + } +} +pub struct NestedLayoutArgs<'a> { + pub children: Option>>>>, + pub encoding: u16, +} +impl<'a> Default for NestedLayoutArgs<'a> { + #[inline] + fn default() -> Self { + NestedLayoutArgs { + children: None, + encoding: 0, + } + } +} + +pub struct NestedLayoutBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> NestedLayoutBuilder<'a, 'b, A> { + #[inline] + pub fn add_children(&mut self, children: flatbuffers::WIPOffset>>>) { + self.fbb_.push_slot_always::>(NestedLayout::VT_CHILDREN, children); + } + #[inline] + pub fn add_encoding(&mut self, encoding: u16) { + self.fbb_.push_slot::(NestedLayout::VT_ENCODING, encoding, 0); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> NestedLayoutBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + NestedLayoutBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for NestedLayout<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("NestedLayout"); + ds.field("children", &self.children()); + ds.field("encoding", &self.encoding()); + ds.finish() + } +} +pub enum LayoutOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Layout<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Layout<'a> { + type Inner = Layout<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Layout<'a> { + pub const VT_LAYOUT_TYPE: flatbuffers::VOffsetT = 4; + pub const VT_LAYOUT: flatbuffers::VOffsetT = 6; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Layout { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args LayoutArgs + ) -> flatbuffers::WIPOffset> { + let mut builder = LayoutBuilder::new(_fbb); + if let Some(x) = args.layout { builder.add_layout(x); } + builder.add_layout_type(args.layout_type); + builder.finish() + } + + + #[inline] + pub fn layout_type(&self) -> LayoutVariant { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::(Layout::VT_LAYOUT_TYPE, Some(LayoutVariant::NONE)).unwrap()} + } + #[inline] + pub fn layout(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>>(Layout::VT_LAYOUT, None)} + } + #[inline] + #[allow(non_snake_case)] + pub fn layout_as_flat_layout(&self) -> Option> { + if self.layout_type() == LayoutVariant::FlatLayout { + self.layout().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { FlatLayout::init_from_table(t) } + }) + } else { + None + } + } + + #[inline] + #[allow(non_snake_case)] + pub fn layout_as_nested_layout(&self) -> Option> { + if self.layout_type() == LayoutVariant::NestedLayout { + self.layout().map(|t| { + // Safety: + // Created from a valid Table for this object + // Which contains a valid union in this slot + unsafe { NestedLayout::init_from_table(t) } + }) + } else { + None + } + } + +} + +impl flatbuffers::Verifiable for Layout<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_union::("layout_type", Self::VT_LAYOUT_TYPE, "layout", Self::VT_LAYOUT, false, |key, v, pos| { + match key { + LayoutVariant::FlatLayout => v.verify_union_variant::>("LayoutVariant::FlatLayout", pos), + LayoutVariant::NestedLayout => v.verify_union_variant::>("LayoutVariant::NestedLayout", pos), + _ => Ok(()), + } + })? + .finish(); + Ok(()) + } +} +pub struct LayoutArgs { + pub layout_type: LayoutVariant, + pub layout: Option>, +} +impl<'a> Default for LayoutArgs { + #[inline] + fn default() -> Self { + LayoutArgs { + layout_type: LayoutVariant::NONE, + layout: None, + } + } +} + +pub struct LayoutBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LayoutBuilder<'a, 'b, A> { + #[inline] + pub fn add_layout_type(&mut self, layout_type: LayoutVariant) { + self.fbb_.push_slot::(Layout::VT_LAYOUT_TYPE, layout_type, LayoutVariant::NONE); + } + #[inline] + pub fn add_layout(&mut self, layout: flatbuffers::WIPOffset) { + self.fbb_.push_slot_always::>(Layout::VT_LAYOUT, layout); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LayoutBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + LayoutBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Layout<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Layout"); + ds.field("layout_type", &self.layout_type()); + match self.layout_type() { + LayoutVariant::FlatLayout => { + if let Some(x) = self.layout_as_flat_layout() { + ds.field("layout", &x) + } else { + ds.field("layout", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + LayoutVariant::NestedLayout => { + if let Some(x) = self.layout_as_nested_layout() { + ds.field("layout", &x) + } else { + ds.field("layout", &"InvalidFlatbuffer: Union discriminant does not match value.") + } + }, + _ => { + let x: Option<()> = None; + ds.field("layout", &x) + }, + }; + ds.finish() + } +} +pub enum FooterOffset {} +#[derive(Copy, Clone, PartialEq)] + +pub struct Footer<'a> { + pub _tab: flatbuffers::Table<'a>, +} + +impl<'a> flatbuffers::Follow<'a> for Footer<'a> { + type Inner = Footer<'a>; + #[inline] + unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { + Self { _tab: flatbuffers::Table::new(buf, loc) } + } +} + +impl<'a> Footer<'a> { + pub const VT_LAYOUT: flatbuffers::VOffsetT = 4; + + #[inline] + pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { + Footer { _tab: table } + } + #[allow(unused_mut)] + pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>( + _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>, + args: &'args FooterArgs<'args> + ) -> flatbuffers::WIPOffset> { + let mut builder = FooterBuilder::new(_fbb); + if let Some(x) = args.layout { builder.add_layout(x); } + builder.finish() + } + + + #[inline] + pub fn layout(&self) -> Option> { + // Safety: + // Created from valid Table for this object + // which contains a valid value in this slot + unsafe { self._tab.get::>(Footer::VT_LAYOUT, None)} + } +} + +impl flatbuffers::Verifiable for Footer<'_> { + #[inline] + fn run_verifier( + v: &mut flatbuffers::Verifier, pos: usize + ) -> Result<(), flatbuffers::InvalidFlatbuffer> { + use self::flatbuffers::Verifiable; + v.visit_table(pos)? + .visit_field::>("layout", Self::VT_LAYOUT, false)? + .finish(); + Ok(()) + } +} +pub struct FooterArgs<'a> { + pub layout: Option>>, +} +impl<'a> Default for FooterArgs<'a> { + #[inline] + fn default() -> Self { + FooterArgs { + layout: None, + } + } +} + +pub struct FooterBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { + fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, + start_: flatbuffers::WIPOffset, +} +impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> FooterBuilder<'a, 'b, A> { + #[inline] + pub fn add_layout(&mut self, layout: flatbuffers::WIPOffset>) { + self.fbb_.push_slot_always::>(Footer::VT_LAYOUT, layout); + } + #[inline] + pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> FooterBuilder<'a, 'b, A> { + let start = _fbb.start_table(); + FooterBuilder { + fbb_: _fbb, + start_: start, + } + } + #[inline] + pub fn finish(self) -> flatbuffers::WIPOffset> { + let o = self.fbb_.end_table(self.start_); + flatbuffers::WIPOffset::new(o.value()) + } +} + +impl core::fmt::Debug for Footer<'_> { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + let mut ds = f.debug_struct("Footer"); + ds.field("layout", &self.layout()); + ds.finish() + } +} +#[inline] +/// Verifies that a buffer of bytes contains a `Footer` +/// and returns it. +/// Note that verification is still experimental and may not +/// catch every error, or be maximally performant. For the +/// previous, unchecked, behavior use +/// `root_as_footer_unchecked`. +pub fn root_as_footer(buf: &[u8]) -> Result { + flatbuffers::root::