diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 81a4448..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,2030 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anstream" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" - -[[package]] -name = "anstyle-parse" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" -dependencies = [ - "anstyle", - "windows-sys 0.52.0", -] - -[[package]] -name = "anyhow" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "assert_cmd" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c98233c6673d8601ab23e77eb38f999c51100d46c5703b17288c57fddf3a1ffe" -dependencies = [ - "bstr 0.2.17", - "doc-comment", - "predicates", - "predicates-core", - "predicates-tree", - "wait-timeout", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - -[[package]] -name = "bigdecimal" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" -dependencies = [ - "num-bigint 0.4.4", - "num-integer", - "num-traits", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bstr" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" -dependencies = [ - "lazy_static", - "memchr", - "regex-automata 0.1.10", -] - -[[package]] -name = "bstr" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" -dependencies = [ - "memchr", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] - -[[package]] -name = "cfb" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" -dependencies = [ - "byteorder", - "fnv", - "uuid", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "wasm-bindgen", - "windows-targets 0.52.0", -] - -[[package]] -name = "chrono-tz" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d7b79e99bfaa0d47da0687c43aa3b7381938a62ad3a6498599039321f660b7" -dependencies = [ - "chrono", - "chrono-tz-build", - "phf", -] - -[[package]] -name = "chrono-tz-build" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" -dependencies = [ - "parse-zoneinfo", - "phf", - "phf_codegen", -] - -[[package]] -name = "clap" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" -dependencies = [ - "clap_builder", -] - -[[package]] -name = "clap_builder" -version = "4.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_lex" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "colored" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" -dependencies = [ - "lazy_static", - "windows-sys 0.48.0", -] - -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "darling" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.48", -] - -[[package]] -name = "darling_macro" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "delegate" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d358e0ec5c59a5e1603b933def447096886121660fc680dc1e64a0753981fe3c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "delegate" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee5df75c70b95bd3aacc8e2fd098797692fb1d54121019c4de481e42f04c8a1" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", - "serde", -] - -[[package]] -name = "deunicode" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ae2a35373c5c74340b79ae6780b498b2b183915ec5dacf263aac5a099bf485a" - -[[package]] -name = "difflib" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "globset" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" -dependencies = [ - "aho-corasick", - "bstr 1.9.0", - "log", - "regex-automata 0.4.5", - "regex-syntax", -] - -[[package]] -name = "globwalk" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" -dependencies = [ - "bitflags", - "ignore", - "walkdir", -] - -[[package]] -name = "half" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" -dependencies = [ - "cfg-if", - "crunchy", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - -[[package]] -name = "hermit-abi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "humansize" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" -dependencies = [ - "libm", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "ignore" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" -dependencies = [ - "crossbeam-deque", - "globset", - "log", - "memchr", - "regex-automata 0.4.5", - "same-file", - "walkdir", - "winapi-util", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" -dependencies = [ - "equivalent", - "hashbrown 0.14.3", -] - -[[package]] -name = "infer" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199" -dependencies = [ - "cfb", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "ion-cli" -version = "0.5.1" -dependencies = [ - "anyhow", - "assert_cmd", - "base64 0.21.7", - "clap", - "colored", - "convert_case", - "flate2", - "infer", - "ion-rs 1.0.0-rc.2", - "ion-schema", - "matches", - "memmap", - "rstest", - "serde", - "serde_json", - "tempfile", - "tera", - "thiserror", - "zstd", -] - -[[package]] -name = "ion-rs" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7434986c985887a9da57b80429e02225cc561d0a9351fcd39aa309f08abea7db" -dependencies = [ - "arrayvec", - "base64 0.12.3", - "bigdecimal", - "bytes", - "chrono", - "delegate 0.9.0", - "nom", - "num-bigint 0.4.4", - "num-integer", - "num-traits", - "smallvec", - "thiserror", -] - -[[package]] -name = "ion-rs" -version = "1.0.0-rc.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff0d9e29b24ad7c2ee3784c31241655143f45d790de852628122b3771c4d279" -dependencies = [ - "arrayvec", - "base64 0.12.3", - "bumpalo", - "bytes", - "chrono", - "delegate 0.10.0", - "nom", - "num-bigint 0.4.4", - "num-integer", - "num-traits", - "serde", - "serde_with", - "smallvec", - "thiserror", -] - -[[package]] -name = "ion-schema" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c270634d42a3369c81e1f04087a62809407db9722667a484786b3844365204f" -dependencies = [ - "half", - "ion-rs 0.18.1", - "num-bigint 0.3.3", - "num-traits", - "regex", - "thiserror", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.153" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "memchr" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" - -[[package]] -name = "memmap" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-bigint" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-bigint" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "parse-zoneinfo" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" -dependencies = [ - "regex", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pest" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "pest_meta" -version = "2.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_codegen" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" -dependencies = [ - "phf_generator", - "phf_shared", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared", - "rand", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "predicates" -version = "2.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" -dependencies = [ - "difflib", - "itertools", - "predicates-core", -] - -[[package]] -name = "predicates-core" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" - -[[package]] -name = "predicates-tree" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" -dependencies = [ - "predicates-core", - "termtree", -] - -[[package]] -name = "proc-macro2" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.5", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" - -[[package]] -name = "regex-automata" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "rstest" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de1bb486a691878cd320c2f0d319ba91eeaa2e894066d8b5f8f117c000e9d962" -dependencies = [ - "futures", - "futures-timer", - "rstest_macros", - "rustc_version", -] - -[[package]] -name = "rstest_macros" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290ca1a1c8ca7edb7c3283bd44dc35dd54fdec6253a3912e201ba1072018fca8" -dependencies = [ - "cfg-if", - "proc-macro2", - "quote", - "rustc_version", - "syn 1.0.109", - "unicode-ident", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "rustix" -version = "0.37.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "ryu" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "semver" -version = "1.0.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" - -[[package]] -name = "serde" -version = "1.0.196" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.196" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "serde_json" -version = "1.0.113" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" -dependencies = [ - "indexmap 2.2.2", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" -dependencies = [ - "base64 0.13.1", - "chrono", - "hex", - "indexmap 1.9.3", - "serde", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "slug" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd94acec9c8da640005f8e135a39fc0372e74535e6b368b7a04b875f784c8c4" -dependencies = [ - "deunicode", - "wasm-bindgen", -] - -[[package]] -name = "smallvec" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.45.0", -] - -[[package]] -name = "tera" -version = "1.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970dff17c11e884a4a09bc76e3a17ef71e01bb13447a11e85226e254fe6d10b8" -dependencies = [ - "chrono", - "chrono-tz", - "globwalk", - "humansize", - "lazy_static", - "percent-encoding", - "pest", - "pest_derive", - "rand", - "regex", - "serde", - "serde_json", - "slug", - "unic-segment", -] - -[[package]] -name = "termtree" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" - -[[package]] -name = "thiserror" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "time" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe80ced77cbfb4cb91a94bf72b378b4b6791a0d9b7f09d0be747d1bdff4e68bd" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "unic-char-property" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8c57a407d9b6fa02b4795eb81c5b6652060a15a7903ea981f3d723e6c0be221" -dependencies = [ - "unic-char-range", -] - -[[package]] -name = "unic-char-range" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0398022d5f700414f6b899e10b8348231abf9173fa93144cbc1a43b9793c1fbc" - -[[package]] -name = "unic-common" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d7ff825a6a654ee85a63e80f92f054f904f21e7d12da4e22f9834a4aaa35bc" - -[[package]] -name = "unic-segment" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ed5d26be57f84f176157270c112ef57b86debac9cd21daaabbe56db0f88f23" -dependencies = [ - "unic-ucd-segment", -] - -[[package]] -name = "unic-ucd-segment" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2079c122a62205b421f499da10f3ee0f7697f012f55b675e002483c73ea34700" -dependencies = [ - "unic-char-property", - "unic-char-range", - "unic-ucd-version", -] - -[[package]] -name = "unic-ucd-version" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96bd2f2237fe450fcd0a1d2f5f4e91711124f7857ba2e964247776ebeeb7b0c4" -dependencies = [ - "unic-common", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "uuid" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wait-timeout" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" -dependencies = [ - "libc", -] - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.90" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" -dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" - -[[package]] -name = "zstd" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/src/bin/ion/commands/beta/generate/context.rs b/src/bin/ion/commands/beta/generate/context.rs index 97fd7e1..dda9705 100644 --- a/src/bin/ion/commands/beta/generate/context.rs +++ b/src/bin/ion/commands/beta/generate/context.rs @@ -3,40 +3,86 @@ use std::fmt::{Display, Formatter}; /// Represents a context that will be used for code generation pub struct CodeGenContext { - // Initially the data_model field is set to None. - // Once an ISL type definition is mapped to a data model this will have Some value. - pub(crate) data_model: Option, + // Initially the abstract_data_type field is set to None. + // Once an ISL type definition is mapped to an abstract data type this will have Some value. + pub(crate) abstract_data_type: Option, } impl CodeGenContext { pub fn new() -> Self { - Self { data_model: None } + Self { + abstract_data_type: None, + } } - pub fn with_data_model(&mut self, data_model: DataModel) { - self.data_model = Some(data_model); + pub fn with_abstract_data_type(&mut self, abstract_data_type: AbstractDataType) { + self.abstract_data_type = Some(abstract_data_type); } } -/// Represents a data model type that can be used to determine which templates can be used for code generation. +/// A target-language-agnostic data type that determines which template(s) to use for code generation. #[derive(Debug, Clone, PartialEq, Serialize)] -pub enum DataModel { - Value, // a struct with a scalar value (used for `type` constraint) - // TODO: Make Sequence parameterized over data type. - // add a data type for sequence here that can be used to read elements for that data type. - Sequence, // a struct with a sequence/collection value (used for `element` constraint) +pub enum AbstractDataType { + // A scalar value (e.g. a string or integer or user defined type) + // e.g. Given below ISL, + // ``` + // type::{ + // name: value_type, + // type: int + // } + // ``` + // Corresponding abstract type in Rust would look like following: + // ``` + // struct ValueType { + // value: i64 + // } + // ``` + Value, + // A series of zero or more values whose type is described by the nested `String` (e.g. a list) + // e.g. Given below ISL, + // ``` + // type::{ + // name: sequence_type, + // element: int + // } + // ``` + // Corresponding abstract type in Rust would look like following: + // ``` + // struct SequenceType { + // value: Vec + // } + // ``` + Sequence(String), + // A collection of field name/value pairs (e.g. a map) + // e.g. Given below ISL, + // ``` + // type::{ + // name: struct_type, + // fields: { + // a: int, + // b: string, + // } + // } + // ``` + // Corresponding abstract type in Rust would look like following: + // ``` + // struct StructType { + // a: i64, + // b: String, + // } + // ``` Struct, } -impl Display for DataModel { +impl Display for AbstractDataType { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!( f, "{}", match self { - DataModel::Value => "single value struct", - DataModel::Sequence => "sequence value struct", - DataModel::Struct => "struct", + AbstractDataType::Value => "scalar value struct", + AbstractDataType::Sequence(_) => "sequence", + AbstractDataType::Struct => "struct", } ) } diff --git a/src/bin/ion/commands/beta/generate/generator.rs b/src/bin/ion/commands/beta/generate/generator.rs index 183c9f2..e9ea1a3 100644 --- a/src/bin/ion/commands/beta/generate/generator.rs +++ b/src/bin/ion/commands/beta/generate/generator.rs @@ -1,6 +1,6 @@ -use crate::commands::beta::generate::context::{CodeGenContext, DataModel}; -use crate::commands::beta::generate::result::{invalid_data_model_error, CodeGenResult}; -use crate::commands::beta::generate::utils::{Field, Import, Language}; +use crate::commands::beta::generate::context::{AbstractDataType, CodeGenContext}; +use crate::commands::beta::generate::result::{invalid_abstract_data_type_error, CodeGenResult}; +use crate::commands::beta::generate::utils::{Field, Import, JavaLanguage, Language, RustLanguage}; use crate::commands::beta::generate::utils::{IonSchemaType, Template}; use convert_case::{Case, Casing}; use ion_schema::isl::isl_constraint::{IslConstraint, IslConstraintValue}; @@ -10,42 +10,92 @@ use ion_schema::isl::IslSchema; use std::collections::HashMap; use std::fs::File; use std::io::Write; +use std::marker::PhantomData; use std::path::Path; use tera::{Context, Tera}; -// TODO: generator can store language and output path as it doesn't change during code generation process -pub(crate) struct CodeGenerator<'a> { +pub(crate) struct CodeGenerator<'a, L: Language> { // Represents the templating engine - tera // more information: https://docs.rs/tera/latest/tera/ pub(crate) tera: Tera, - language: Language, output: &'a Path, // Represents a counter for naming anonymous type definitions pub(crate) anonymous_type_counter: usize, + phantom: PhantomData, } -impl<'a> CodeGenerator<'a> { - pub fn new(language: Language, output: &'a Path) -> Self { +impl<'a> CodeGenerator<'a, RustLanguage> { + pub fn new(output: &'a Path) -> CodeGenerator { Self { - language, output, anonymous_type_counter: 0, - tera: Tera::new("src/bin/ion/commands/beta/generate/templates/**/*.templ").unwrap(), + tera: Tera::new("src/bin/ion/commands/beta/generate/templates/rust/*.templ").unwrap(), + phantom: PhantomData, } } - /// Returns true if its a built in type otherwise returns false - pub fn is_built_in_type(&self, name: &str) -> bool { - match self.language { - Language::Rust => { - matches!(name, "i64" | "String" | "bool" | "Vec" | "f64") - } - Language::Java => { - matches!(name, "int" | "String" | "boolean" | "byte[]" | "float") - } + /// Generates code in Rust for given Ion Schema + pub fn generate(&mut self, schema: IslSchema) -> CodeGenResult<()> { + // this will be used for Rust to create mod.rs which lists all the generated modules + let mut modules = vec![]; + let mut module_context = tera::Context::new(); + + // Register a tera filter that can be used to convert a string based on case + self.tera.register_filter("upper_camel", Self::upper_camel); + self.tera.register_filter("snake", Self::snake); + // Register a tera filter that can be used to see if a type is built in data type or not + self.tera + .register_filter("is_built_in_type", Self::is_built_in_type); + + for isl_type in schema.types() { + self.generate_abstract_data_type(&mut modules, isl_type)?; + } + + self.generate_modules(&mut modules, &mut module_context)?; + + Ok(()) + } + + pub fn generate_modules( + &mut self, + modules: &mut Vec, + module_context: &mut Context, + ) -> CodeGenResult<()> { + module_context.insert("modules", &modules); + let rendered = self.tera.render("mod.templ", module_context)?; + let mut file = File::create(self.output.join("mod.rs"))?; + file.write_all(rendered.as_bytes())?; + Ok(()) + } +} + +impl<'a> CodeGenerator<'a, JavaLanguage> { + pub fn new(output: &'a Path) -> CodeGenerator { + Self { + output, + anonymous_type_counter: 0, + tera: Tera::new("src/bin/ion/commands/beta/generate/templates/java/*.templ").unwrap(), + phantom: PhantomData, } } + /// Generates code in Java for given Ion Schema + pub fn generate(&mut self, schema: IslSchema) -> CodeGenResult<()> { + // this will be used for Rust to create mod.rs which lists all the generated modules + let mut modules = vec![]; + + // Register a tera filter that can be used to convert a string based on case + self.tera.register_filter("upper_camel", Self::upper_camel); + + for isl_type in schema.types() { + self.generate_abstract_data_type(&mut modules, isl_type)?; + } + + Ok(()) + } +} + +impl<'a, L: Language> CodeGenerator<'a, L> { /// Represents a [tera] filter that converts given tera string value to [upper camel case]. /// Returns error if the given value is not a string. /// @@ -60,61 +110,69 @@ impl<'a> CodeGenerator<'a> { Ok(tera::Value::String( value .as_str() - .ok_or(tera::Error::msg("Required string for this filter"))? + .ok_or(tera::Error::msg( + "the `upper_camel` filter only accepts strings", + ))? .to_case(Case::UpperCamel), )) } - /// Generates code for given Ion Schema - pub fn generate(&mut self, schema: IslSchema) -> CodeGenResult<()> { - // this will be used for Rust to create mod.rs which lists all the generated modules - let mut modules = vec![]; - let mut module_context = tera::Context::new(); - - // Register a tera filter that can be used to convert a string to upper camel case - self.tera.register_filter("upper_camel", Self::upper_camel); - - for isl_type in schema.types() { - self.generate_data_model(&mut modules, isl_type)?; - } - - if self.language == Language::Rust { - module_context.insert("modules", &modules); - let rendered = self.tera.render("rust/mod.templ", &module_context)?; - let mut file = File::create(self.output.join("mod.rs"))?; - file.write_all(rendered.as_bytes())?; - } + /// Represents a [tera] filter that converts given tera string value to [snake case]. + /// Returns error if the given value is not a string. + /// + /// For more information: + /// + /// [tera]: + /// [upper camel case]: + pub fn snake( + value: &tera::Value, + _map: &HashMap, + ) -> Result { + Ok(tera::Value::String( + value + .as_str() + .ok_or(tera::Error::msg("the `snake` filter only accepts strings"))? + .to_case(Case::Snake), + )) + } - Ok(()) + /// Represents a [tera] filter that return true if the value is a built in type, otherwise returns false. + /// + /// For more information: + /// + /// [tera]: + pub fn is_built_in_type( + value: &tera::Value, + _map: &HashMap, + ) -> Result { + Ok(tera::Value::Bool(L::is_built_in_type( + value.as_str().ok_or(tera::Error::msg( + "`is_built_in_type` called with non-String Value", + ))?, + ))) } - /// Generates data model based on given ISL type definition - fn generate_data_model( + fn generate_abstract_data_type( &mut self, modules: &mut Vec, isl_type: &IslType, ) -> CodeGenResult<()> { - let data_model_name = match isl_type.name().clone() { - None => { - format!("AnonymousType{}", self.anonymous_type_counter) - } - Some(name) => name, - }; + let isl_type_name = isl_type + .name() + .clone() + .unwrap_or_else(|| format!("AnonymousType{}", self.anonymous_type_counter)); let mut context = Context::new(); let mut tera_fields = vec![]; let mut imports: Vec = vec![]; let mut code_gen_context = CodeGenContext::new(); - // Set the target kind name of the data model (i.e. enum/class) - context.insert( - "target_kind_name", - &data_model_name.to_case(Case::UpperCamel), - ); + // Set the ISL type name for the generated abstract data type + context.insert("target_kind_name", &isl_type_name.to_case(Case::UpperCamel)); let constraints = isl_type.constraints(); for constraint in constraints { - self.map_constraint_to_data_model( + self.map_constraint_to_abstract_data_type( modules, &mut tera_fields, &mut imports, @@ -126,31 +184,77 @@ impl<'a> CodeGenerator<'a> { // add imports for the template context.insert("imports", &imports); - // generate read and write APIs for the data model - self.generate_read_api(&mut context, &mut tera_fields, &mut code_gen_context)?; - self.generate_write_api(&mut context, &mut tera_fields, &mut code_gen_context); - modules.push(self.language.file_name(&data_model_name)); + // add fields for template + if let Some(abstract_data_type) = &code_gen_context.abstract_data_type { + context.insert("fields", &tera_fields); + context.insert("abstract_data_type", abstract_data_type); + } else { + return invalid_abstract_data_type_error( + "Can not determine abstract data type, constraints are mapping not mapping to an abstract data type.", + ); + } + + self.render_generated_code(modules, &isl_type_name, &mut context, &mut code_gen_context) + } + + fn render_generated_code( + &mut self, + modules: &mut Vec, + abstract_data_type_name: &str, + context: &mut Context, + code_gen_context: &mut CodeGenContext, + ) -> CodeGenResult<()> { + modules.push(L::file_name_for_type(abstract_data_type_name)); // Render or generate file for the template with the given context - let template: &Template = &code_gen_context.data_model.as_ref().try_into()?; + let template: &Template = &code_gen_context.abstract_data_type.as_ref().try_into()?; let rendered = self .tera - .render( - &format!("{}/{}.templ", &self.language, template.name(&self.language)), - &context, - ) + .render(&format!("{}.templ", L::template_name(template)), context) .unwrap(); let mut file = File::create(self.output.join(format!( "{}.{}", - self.language.file_name(&data_model_name), - self.language.file_extension() + L::file_name_for_type(abstract_data_type_name), + L::file_extension() )))?; file.write_all(rendered.as_bytes())?; Ok(()) } - /// Maps the given constraint value to a data model - fn map_constraint_to_data_model( + /// Provides name of the type reference that will be used for generated abstract data type + fn type_reference_name( + &mut self, + isl_type_ref: &IslTypeRef, + modules: &mut Vec, + imports: &mut Vec, + ) -> CodeGenResult { + Ok(match isl_type_ref { + IslTypeRef::Named(name, _) => { + if !L::is_built_in_type(name) { + imports.push(Import { + name: name.to_string(), + }); + } + let schema_type: IonSchemaType = name.into(); + L::target_type(&schema_type) + } + IslTypeRef::TypeImport(_, _) => { + unimplemented!("Imports in schema are not supported yet!"); + } + IslTypeRef::Anonymous(type_def, _) => { + self.anonymous_type_counter += 1; + self.generate_abstract_data_type(modules, type_def)?; + let name = format!("AnonymousType{}", self.anonymous_type_counter); + imports.push(Import { + name: name.to_string(), + }); + name + } + }) + } + + /// Maps the given constraint value to an abstract data type + fn map_constraint_to_abstract_data_type( &mut self, modules: &mut Vec, tera_fields: &mut Vec, @@ -160,48 +264,60 @@ impl<'a> CodeGenerator<'a> { ) -> CodeGenResult<()> { match constraint.constraint() { IslConstraintValue::Element(isl_type, _) => { - self.verify_data_model_consistency(DataModel::Sequence, code_gen_context)?; + let type_name = self.type_reference_name(isl_type, modules, imports)?; + self.verify_abstract_data_type_consistency( + AbstractDataType::Sequence(type_name.to_owned()), + code_gen_context, + )?; self.generate_struct_field( tera_fields, - isl_type, - modules, + L::target_type_as_sequence(&type_name), "value", - imports, - code_gen_context, )?; } IslConstraintValue::Fields(fields, _content_closed) => { - self.verify_data_model_consistency(DataModel::Struct, code_gen_context)?; + self.verify_abstract_data_type_consistency( + AbstractDataType::Struct, + code_gen_context, + )?; for (name, value) in fields.iter() { - self.generate_struct_field( - tera_fields, - value.type_reference(), - modules, - name, - imports, - code_gen_context, - )?; + let type_name = + self.type_reference_name(value.type_reference(), modules, imports)?; + + self.generate_struct_field(tera_fields, type_name, name)?; } } IslConstraintValue::Type(isl_type) => { - self.verify_data_model_consistency(DataModel::Value, code_gen_context)?; - self.generate_struct_field( - tera_fields, - isl_type, - modules, - "value", - imports, + let type_name = self.type_reference_name(isl_type, modules, imports)?; + + self.verify_abstract_data_type_consistency( + AbstractDataType::Value, code_gen_context, )?; + self.generate_struct_field(tera_fields, type_name, "value")?; } _ => {} } Ok(()) } - /// Verify that the current data model is same as previously determined data model - /// This is referring to data model determined with each constraint that is verifies - /// that all the constraints map to a single data model and not different data models. + /// Generates a struct field based on field name and value(data type) + fn generate_struct_field( + &mut self, + tera_fields: &mut Vec, + abstract_data_type_name: String, + field_name: &str, + ) -> CodeGenResult<()> { + tera_fields.push(Field { + name: field_name.to_case(L::field_name_case()), + value: abstract_data_type_name, + }); + Ok(()) + } + + /// Verify that the current abstract data type is same as previously determined abstract data type + /// This is referring to abstract data type determined with each constraint that is verifies + /// that all the constraints map to a single abstract data type and not different abstract data types. /// e.g. /// ``` /// type::{ @@ -213,245 +329,20 @@ impl<'a> CodeGenerator<'a> { /// } /// } /// ``` - /// For the above schema, both `fields` and `type` constraints map to different data models + /// For the above schema, both `fields` and `type` constraints map to different abstract data types /// respectively Struct(with given fields `source` and `destination`) and Value(with a single field that has String data type). - fn verify_data_model_consistency( + fn verify_abstract_data_type_consistency( &mut self, - current_data_model: DataModel, + current_abstract_data_type: AbstractDataType, code_gen_context: &mut CodeGenContext, ) -> CodeGenResult<()> { - if let Some(data_model) = &code_gen_context.data_model { - if data_model != ¤t_data_model { - return invalid_data_model_error(format!("Can not determine abstract data type as current constraint {} conflicts with prior constraints for {}.", current_data_model, data_model)); + if let Some(abstract_data_type) = &code_gen_context.abstract_data_type { + if abstract_data_type != ¤t_abstract_data_type { + return invalid_abstract_data_type_error(format!("Can not determine abstract data type as current constraint {} conflicts with prior constraints for {}.", current_abstract_data_type, abstract_data_type)); } } else { - code_gen_context.with_data_model(current_data_model); + code_gen_context.with_abstract_data_type(current_abstract_data_type); } Ok(()) } - - /// Generates a struct field based on field name and value(data type) - fn generate_struct_field( - &mut self, - tera_fields: &mut Vec, - isl_type_ref: &IslTypeRef, - modules: &mut Vec, - field_name: &str, - imports: &mut Vec, - code_gen_context: &mut CodeGenContext, - ) -> CodeGenResult<()> { - let value = self.generate_field_value(isl_type_ref, modules, imports, code_gen_context)?; - - tera_fields.push(Field { - name: { - match self.language { - Language::Rust => field_name.to_case(Case::Snake), - Language::Java => field_name.to_case(Case::Camel), - } - }, - value, - }); - Ok(()) - } - - /// Generates field value in a struct which represents a data type in codegen's programming language - fn generate_field_value( - &mut self, - isl_type_ref: &IslTypeRef, - modules: &mut Vec, - imports: &mut Vec, - code_gen_context: &mut CodeGenContext, - ) -> CodeGenResult { - Ok(match isl_type_ref { - IslTypeRef::Named(name, _) => { - if !self.is_built_in_type(name) { - imports.push(Import { - module_name: name.to_case(Case::Snake), - type_name: name.to_case(Case::UpperCamel), - }); - } - let schema_type: IonSchemaType = name.into(); - self.generate_sequence_field_value( - schema_type.target_type(&self.language).to_string(), - code_gen_context, - ) - } - IslTypeRef::TypeImport(_, _) => { - unimplemented!("Imports in schema are not supported yet!"); - } - IslTypeRef::Anonymous(type_def, _) => { - self.anonymous_type_counter += 1; - self.generate_data_model(modules, type_def)?; - let name = format!("AnonymousType{}", self.anonymous_type_counter); - imports.push(Import { - module_name: name.to_case(Case::Snake), - type_name: name.to_case(Case::UpperCamel), - }); - self.generate_sequence_field_value(name, code_gen_context) - } - }) - } - - /// Generates an appropriately typed sequence in the target programming language to use as a field value - pub fn generate_sequence_field_value( - &mut self, - name: String, - code_gen_context: &mut CodeGenContext, - ) -> String { - if code_gen_context.data_model == Some(DataModel::Sequence) { - return match self.language { - Language::Rust => { - format!("Vec<{}>", name) - } - Language::Java => { - format!("ArrayList<{}>", name) - } - }; - } - name - } - - /// Generates Generates a read API for an abstract data type. - /// This adds statements for reading each the Ion value(s) that collectively represent the given abstract data type. - // TODO: add support for Java - fn generate_read_api( - &mut self, - context: &mut Context, - tera_fields: &mut Vec, - code_gen_context: &mut CodeGenContext, - ) -> CodeGenResult<()> { - let mut read_statements = vec![]; - - if code_gen_context.data_model == Some(DataModel::Struct) - || code_gen_context.data_model == Some(DataModel::Value) - || code_gen_context.data_model == Some(DataModel::Sequence) - { - context.insert("fields", &tera_fields); - if let Some(data_model) = &code_gen_context.data_model { - context.insert("data_model", data_model); - } else { - return invalid_data_model_error( - "Can not determine data model, constraints are mapping not mapping to a data model.", - ); - } - - for tera_field in tera_fields { - if !self.is_built_in_type(&tera_field.value) { - if code_gen_context.data_model == Some(DataModel::Sequence) { - read_statements.push(format!( - "\"{}\" => {{ data_model.{} =", - &tera_field.name, &tera_field.name, - )); - read_statements.push( - r#"{ - let mut values = vec![]; - reader.step_in()?; - while reader.next()? != StreamItem::Nothing {"# - .to_string(), - ); - let sequence_type = &tera_field.value.replace("Vec<", "").replace('>', ""); - if !self.is_built_in_type(sequence_type) { - read_statements.push(format!( - "values.push({}::read_from(reader)?)", - sequence_type - )); - } else { - read_statements.push(format!( - "values.push(reader.read_{}()?)", - sequence_type.to_lowercase() - )); - } - - read_statements.push( - r#"} - values }}"# - .to_string(), - ); - } else if code_gen_context.data_model == Some(DataModel::Value) { - context.insert( - "read_statement", - &format!("{}::read_from(reader)?", &tera_field.value,), - ); - } else { - read_statements.push(format!( - "\"{}\" => {{ data_model.{} = {}::read_from(reader)?;}}", - &tera_field.name, &tera_field.name, &tera_field.value, - )); - } - } else { - if code_gen_context.data_model == Some(DataModel::Value) { - context.insert( - "read_statement", - &format!("reader.read_{}()?", &tera_field.value.to_lowercase(),), - ); - } - read_statements.push(format!( - "\"{}\" => {{ data_model.{} = reader.read_{}()?;}}", - &tera_field.name, - &tera_field.name, - &tera_field.value.to_lowercase() - )); - } - } - } - context.insert("statements", &read_statements); - Ok(()) - } - - /// Generates write API for a data model - /// This adds statements for writing data model as Ion value that will be used by data model templates - // TODO: add support for Java - fn generate_write_api( - &mut self, - context: &mut Context, - tera_fields: &mut Vec, - code_gen_context: &mut CodeGenContext, - ) { - let mut write_statements = Vec::new(); - if code_gen_context.data_model == Some(DataModel::Value) { - for tera_field in tera_fields { - if !self.is_built_in_type(&tera_field.value) { - write_statements.push(format!("self.{}.write_to(writer)?;", &tera_field.name,)); - } else { - write_statements.push(format!( - "writer.write_{}(self.value)?;", - &tera_field.value.to_lowercase(), - )); - } - } - } else if code_gen_context.data_model == Some(DataModel::Struct) { - write_statements.push("writer.step_in(IonType::Struct)?;".to_string()); - for tera_field in tera_fields { - write_statements.push(format!("writer.set_field_name(\"{}\");", &tera_field.name)); - - if !self.is_built_in_type(&tera_field.value) { - write_statements.push(format!("self.{}.write_to(writer)?;", &tera_field.name,)); - } else { - write_statements.push(format!( - "writer.write_{}(self.{})?;", - &tera_field.value.to_lowercase(), - &tera_field.name - )); - } - } - write_statements.push("writer.step_out()?;".to_string()); - } else if code_gen_context.data_model == Some(DataModel::Sequence) { - write_statements.push("writer.step_in(IonType::List)?;".to_string()); - for tera_field in tera_fields { - let sequence_type = &tera_field.value.replace("Vec<", "").replace('>', ""); - write_statements.push("for value in self.value {".to_string()); - if !self.is_built_in_type(sequence_type) { - write_statements.push("value.write_to(writer)?;".to_string()); - } else { - write_statements.push(format!( - "writer.write_{}(value)?;", - &sequence_type.to_lowercase(), - )); - } - write_statements.push("}".to_string()); - } - write_statements.push("writer.step_out()?;".to_string()); - } - context.insert("write_statements", &write_statements); - } } diff --git a/src/bin/ion/commands/beta/generate/mod.rs b/src/bin/ion/commands/beta/generate/mod.rs index 0abb0e7..7adea3c 100644 --- a/src/bin/ion/commands/beta/generate/mod.rs +++ b/src/bin/ion/commands/beta/generate/mod.rs @@ -4,15 +4,14 @@ mod result; mod utils; use crate::commands::beta::generate::generator::CodeGenerator; -use crate::commands::beta::generate::utils::Language; +use crate::commands::beta::generate::utils::{JavaLanguage, RustLanguage}; use crate::commands::IonCliCommand; -use anyhow::Result; +use anyhow::{bail, Result}; use clap::{Arg, ArgAction, ArgMatches, Command}; use ion_schema::authority::{DocumentAuthority, FileSystemDocumentAuthority}; use ion_schema::system::SchemaSystem; use std::fs; use std::path::{Path, PathBuf}; - pub struct GenerateCommand; impl IonCliCommand for GenerateCommand { @@ -62,7 +61,7 @@ impl IonCliCommand for GenerateCommand { fn run(&self, _command_path: &mut Vec, args: &ArgMatches) -> Result<()> { // Extract programming language for code generation - let language: Language = args.get_one::("language").unwrap().as_str().into(); + let language: &str = args.get_one::("language").unwrap().as_str(); // Extract output path information where the generated code will be saved // Create a module `ion_data_model` for storing all the generated code in the output directory @@ -102,7 +101,14 @@ impl IonCliCommand for GenerateCommand { println!("Started generating code..."); // generate code based on schema and programming language - CodeGenerator::new(language, output).generate(schema)?; + match language { + "java" => CodeGenerator::::new(output).generate(schema)?, + "rust" => CodeGenerator::::new(output).generate(schema)?, + _ => bail!( + "Programming language '{}' is not yet supported. Currently supported targets: 'java', 'rust'", + language + ) + } println!("Code generation complete successfully!"); println!("Path to generated code: {}", output.display()); diff --git a/src/bin/ion/commands/beta/generate/result.rs b/src/bin/ion/commands/beta/generate/result.rs index 5c33810..16b9ea7 100644 --- a/src/bin/ion/commands/beta/generate/result.rs +++ b/src/bin/ion/commands/beta/generate/result.rs @@ -28,7 +28,7 @@ pub enum CodeGenError { /// A convenience method for creating an CodeGen containing an CodeGenError::InvalidDataModel /// with the provided description text. -pub fn invalid_data_model_error>(description: S) -> CodeGenResult { +pub fn invalid_abstract_data_type_error>(description: S) -> CodeGenResult { Err(CodeGenError::InvalidDataModel { description: description.as_ref().to_string(), }) diff --git a/src/bin/ion/commands/beta/generate/templates/java/class.templ b/src/bin/ion/commands/beta/generate/templates/java/class.templ index 588bf80..2f94bcc 100644 --- a/src/bin/ion/commands/beta/generate/templates/java/class.templ +++ b/src/bin/ion/commands/beta/generate/templates/java/class.templ @@ -1,5 +1,5 @@ {% if import %} -import ion_data_model.{{ import_type }}; +import ion_data_model.{{ import.name | upper_camel }}; {% endif %} public final class {{ target_kind_name }} { {% for field in fields -%} diff --git a/src/bin/ion/commands/beta/generate/templates/rust/struct.templ b/src/bin/ion/commands/beta/generate/templates/rust/struct.templ index e49560b..3cd7372 100644 --- a/src/bin/ion/commands/beta/generate/templates/rust/struct.templ +++ b/src/bin/ion/commands/beta/generate/templates/rust/struct.templ @@ -1,6 +1,6 @@ use ion_rs::{IonResult, IonReader, Reader, StreamItem}; {% for import in imports %} -use crate::ion_data_model::{{ import.module_name }}::{{ import.type_name }}; +use crate::ion_data_model::{{ import.name | snake }}::{{ import.name | upper_camel }}; {% endfor %} #[derive(Debug, Clone, Default)] @@ -25,36 +25,84 @@ impl {{ target_kind_name }} { } {% endfor %} - {% if statements %} + pub fn read_from(reader: &mut Reader) -> IonResult { reader.next()?; - {% if data_model == "UnitStruct"%} - let mut data_model = {{ target_kind_name }}::default(); - data_model.value = {{ read_statement }}; + {% if abstract_data_type == "Value"%} + let mut abstract_data_type = {{ target_kind_name }}::default(); + abstract_data_type.value = {% if target_kind_name | is_built_in_type == false %} + {{ target_kind_name }}::read_from(reader)?; + {% else %} + reader.read_{{ target_kind_name }}()?; + {% endif %} {% else %} - {% if data_model == "Struct"%}reader.step_in()?;{% endif %} - let mut data_model = {{ target_kind_name }}::default(); + {% if abstract_data_type == "Struct"%}reader.step_in()?;{% endif %} + let mut abstract_data_type = {{ target_kind_name }}::default(); while reader.next()? != StreamItem::Nothing { if let Some(field_name) = reader.field_name()?.text() { match field_name { - - {% for statement in statements -%} - {{ statement }} - {% endfor %} + {% for field in fields -%} + {% if field.value | is_built_in_type == false %} + {% if abstract_data_type is object and abstract_data_type["Sequence"] | length != 0 %} + "{{ field.name }}" => { abstract_data_type.{{ field.name }} = { + let mut values = vec![]; + reader.step_in()?; + while reader.next()? != StreamItem::Nothing { + {% if abstract_data_type["Sequence"] | is_built_in_type == false %} + values.push({{ abstract_data_type["Sequence"] }}::read_from(reader)?); + {% else %} + values.push(reader.read_{{ abstract_data_type["Sequence"] }}()?); + {% endif %} + } + values + };} + {% elif abstract_data_type == "Struct" %} + "{{ field.name }}" => { abstract_data_type.{{ field.name }} = {{ field.value }}::read_from(reader)?; } + {% endif %} + {% else %} + "{{ field.name }}" => { abstract_data_type.{{ field.name }} = reader.read_{{ field.value }}()?; } + {% endif %} + {% endfor %} _ => {} } } } - {% if data_model == "Struct"%}reader.step_out()?;{% endif %} + {% if abstract_data_type == "Struct"%}reader.step_out()?;{% endif %} {% endif %} - Ok(data_model) + Ok(abstract_data_type) } - {% endif %} pub fn write_to(&self, writer: &mut W) -> IonResult<()> { - {% for statement in write_statements -%} - {{ statement }} - {% endfor %} + {% if abstract_data_type == "Value" %} + {% for field in fields %} + {% if field.value | is_built_in_type ==false %} + self.{{ field.name }}.write_to(writer)?; + {% else %} + writer.write_{{ field.value | lower }}(self.value)?; + {% endif %} + {% endfor %} + {% elif abstract_data_type == "Struct"%} + writer.step_in(IonType::Struct)?; + {% for field in fields %} + writer.set_field_name("{{ field.name }}"); + {% if field.value | is_built_in_type == false %} + self.{{ field.name }}.write_to(writer)?; + {% else %} + writer.write_{{ field.value | lower }}(self.{{ field.name }})?; + {% endif %} + {% endfor %} + writer.step_out()?; + {% elif abstract_data_type is object and abstract_data_type["Sequence"] | length != 0 %} + writer.step_in(IonType::List)?; + for value in self.value { + {% if abstract_data_type["Sequence"] | is_built_in_type == false %} + value.write_to(writer)?; + {% else %} + writer.write_{{ abstract_data_type["Sequence"] | lower }}(value)?; + {% endif %} + } + writer.step_out()?; + {% endif %} Ok(()) } } diff --git a/src/bin/ion/commands/beta/generate/utils.rs b/src/bin/ion/commands/beta/generate/utils.rs index 8e53157..98483fd 100644 --- a/src/bin/ion/commands/beta/generate/utils.rs +++ b/src/bin/ion/commands/beta/generate/utils.rs @@ -1,5 +1,5 @@ -use crate::commands::beta::generate::context::DataModel; -use crate::commands::beta::generate::result::{invalid_data_model_error, CodeGenError}; +use crate::commands::beta::generate::context::AbstractDataType; +use crate::commands::beta::generate::result::{invalid_abstract_data_type_error, CodeGenError}; use convert_case::{Case, Casing}; use serde::Serialize; use std::fmt::{Display, Formatter}; @@ -12,57 +12,154 @@ pub struct Field { pub(crate) value: String, } -/// Represents an import statement in a module file. +/// Represents an import in a generated code file. /// This will be used by template engine to fill import statements of a type definition. #[derive(Serialize)] pub struct Import { - pub(crate) module_name: String, - pub(crate) type_name: String, + pub(crate) name: String, } -/// Represent the programming language for code generation. -#[derive(Debug, Clone, PartialEq)] -pub enum Language { - Rust, - Java, +pub trait Language { + /// Provides a file extension based on programming language + fn file_extension() -> String; + + /// Returns string representation of programming language name + fn name() -> String; + + /// Provides generated code's file name for given type `name` based on programming language standards + /// e.g. + /// In Rust, this will return a string casing `name` to [Case::Snake]. + /// In Java, this will return a string casing `name` to [Case::UpperCamel] + fn file_name_for_type(name: &str) -> String; + + /// Maps the given ISL type to a target type name + fn target_type(ion_schema_type: &IonSchemaType) -> String; + + /// Provides given target type as sequence + /// e.g. + /// target_type = "Foo" returns "ArrayList" + /// target_type = "Foo" returns "Vec" + fn target_type_as_sequence(target_type: &str) -> String; + + /// Returns the [Case] based on programming languages + /// e.g. + /// Rust field name case -> [Case::Snake] + /// Java field name case -> [Case::Camel] + fn field_name_case() -> Case; + + /// Returns true if the type name specified is provided by the target language implementation + fn is_built_in_type(name: &str) -> bool; + + /// Returns the template as string based on programming language + /// e.g. + /// In Rust, Template::Struct -> "struct" + /// In Java, Template::Struct -> "class" + fn template_name(template: &Template) -> String; } -impl Language { - pub fn file_extension(&self) -> &str { - match self { - Language::Rust => "rs", - Language::Java => "java", +pub struct JavaLanguage; + +impl Language for JavaLanguage { + fn file_extension() -> String { + "java".to_string() + } + + fn name() -> String { + "java".to_string() + } + + fn file_name_for_type(name: &str) -> String { + name.to_case(Case::UpperCamel) + } + + fn target_type(ion_schema_type: &IonSchemaType) -> String { + use IonSchemaType::*; + match ion_schema_type { + Int => "int", + String | Symbol => "String", + Float => "double", + Bool => "boolean", + Blob | Clob => "byte[]", + SchemaDefined(name) => name, } + .to_string() + } + + fn target_type_as_sequence(target_type: &str) -> String { + format!("ArrayList<{}>", target_type) + } + + fn field_name_case() -> Case { + Case::Camel } - pub fn file_name(&self, name: &str) -> String { - match self { - Language::Rust => name.to_case(Case::Snake), - Language::Java => name.to_case(Case::UpperCamel), + fn is_built_in_type(name: &str) -> bool { + matches!(name, "int" | "String" | "boolean" | "byte[]" | "float") + } + + fn template_name(template: &Template) -> String { + match template { + Template::Struct => "class".to_string(), } } } -impl From<&str> for Language { - fn from(value: &str) -> Self { - match value { - "java" => Language::Java, - "rust" => Language::Rust, - _ => unreachable!("Unsupported programming language: {}, this tool only supports Java and Rust code generation.", value) +impl Display for JavaLanguage { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "java") + } +} + +pub struct RustLanguage; + +impl Language for RustLanguage { + fn file_extension() -> String { + "rs".to_string() + } + + fn name() -> String { + "rust".to_string() + } + + fn file_name_for_type(name: &str) -> String { + name.to_case(Case::Snake) + } + + fn target_type(ion_schema_type: &IonSchemaType) -> String { + use IonSchemaType::*; + match ion_schema_type { + Int => "i64", + String | Symbol => "String", + Float => "f64", + Bool => "bool", + Blob | Clob => "Vec", + SchemaDefined(name) => name, + } + .to_string() + } + + fn target_type_as_sequence(target_type: &str) -> String { + format!("Vec<{}>", target_type) + } + + fn field_name_case() -> Case { + Case::Snake + } + + fn is_built_in_type(name: &str) -> bool { + matches!(name, "i64" | "String" | "bool" | "Vec" | "f64") + } + + fn template_name(template: &Template) -> String { + match template { + Template::Struct => "struct".to_string(), } } } -impl Display for Language { +impl Display for RustLanguage { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - match self { - Language::Rust => { - write!(f, "rust") - } - Language::Java => { - write!(f, "java") - } - } + write!(f, "rust") } } @@ -76,25 +173,13 @@ pub enum Template { Struct, // Represents a template for a Rust struct or Java class } -impl Template { - /// Returns a string that represent the template file name based on given programming language. - pub fn name(&self, language: &Language) -> &str { - match language { - Language::Rust => "struct", - Language::Java => "class", - } - } -} - -impl TryFrom> for Template { +impl TryFrom> for Template { type Error = CodeGenError; - fn try_from(value: Option<&DataModel>) -> Result { + fn try_from(value: Option<&AbstractDataType>) -> Result { match value { - Some(DataModel::Value) | Some(DataModel::Sequence) | Some(DataModel::Struct) => { - Ok(Template::Struct) - } - None => invalid_data_model_error( + Some(_) => Ok(Template::Struct), + None => invalid_abstract_data_type_error( "Can not get a template without determining data model first.", ), } @@ -116,26 +201,6 @@ pub enum IonSchemaType { SchemaDefined(String), // A user defined schema type } -impl IonSchemaType { - /// Maps the given ISL type name to a target type - pub fn target_type(&self, language: &Language) -> &str { - use IonSchemaType::*; - use Language::*; - match (self, language) { - (Int, Rust) => "i64", - (Int, Java) => "int", - (String | Symbol, _) => "String", - (Float, Rust) => "f64", - (Float, Java) => "double", - (Bool, Rust) => "bool", - (Bool, Java) => "boolean", - (Blob | Clob, Rust) => "Vec", - (Blob | Clob, Java) => "byte[]", - (SchemaDefined(name), _) => name, - } - } -} - impl From<&str> for IonSchemaType { fn from(value: &str) -> Self { use IonSchemaType::*; diff --git a/tests/cli.rs b/tests/cli.rs index 6dcf30e..c401dc8 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -297,8 +297,8 @@ fn test_code_generation_in_rust( let mut cmd = Command::cargo_bin("ion")?; let temp_dir = TempDir::new()?; let input_schema_path = temp_dir.path().join("test_schema.isl"); - let mut input_schema_file = File::create(input_schema_path)?; - input_schema_file.write_all(test_schema.as_bytes())?; + let mut input_schema_file = File::create(&input_schema_path)?; + input_schema_file.write(test_schema.as_bytes())?; input_schema_file.flush()?; cmd.args([ "beta", @@ -412,8 +412,8 @@ fn test_code_generation_in_java( let mut cmd = Command::cargo_bin("ion")?; let temp_dir = TempDir::new()?; let input_schema_path = temp_dir.path().join("test_schema.isl"); - let mut input_schema_file = File::create(input_schema_path)?; - input_schema_file.write_all(test_schema.as_bytes())?; + let mut input_schema_file = File::create(&input_schema_path)?; + input_schema_file.write(test_schema.as_bytes())?; input_schema_file.flush()?; cmd.args([ "beta",