Compare commits
6 Commits
1.3.4
...
1.4.1-hotf
Author | SHA1 | Date | |
---|---|---|---|
8cbb2757a5 | |||
3389b2264e | |||
5cd1c075a5 | |||
7a0cf00cbc | |||
971556af64 | |||
b685d81e00 |
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@ -15,4 +15,4 @@ jobs:
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose --all-features
|
||||
run: cargo test --verbose --all-features --workspace
|
9
.idea/lib.iml
generated
9
.idea/lib.iml
generated
@ -2,13 +2,18 @@
|
||||
<module type="EMPTY_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/derive/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/examples" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/examples/multipart_file/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/derive/target" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/crates/into_response_derive/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/crates/read_files/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/crates/read_files/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/crates/read_files/tests" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/examples/multipart_file/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/crates/into_response_derive/target" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/crates/read_files/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
@ -1,12 +1,12 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
|
||||
<option name="command" value="test --package lib --lib tests --all-features" />
|
||||
<configuration default="false" name="All Tests" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
|
||||
<option name="command" value="test --workspace" />
|
||||
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
|
||||
<envs />
|
||||
<option name="emulateTerminal" value="true" />
|
||||
<option name="channel" value="DEFAULT" />
|
||||
<option name="requiredFeatures" value="true" />
|
||||
<option name="allFeatures" value="false" />
|
||||
<option name="allFeatures" value="true" />
|
||||
<option name="withSudo" value="false" />
|
||||
<option name="buildTarget" value="REMOTE" />
|
||||
<option name="backtrace" value="SHORT" />
|
19
.idea/runConfigurations/Release.xml
generated
Normal file
19
.idea/runConfigurations/Release.xml
generated
Normal file
@ -0,0 +1,19 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Release" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
|
||||
<option name="command" value="build --release --all-features" />
|
||||
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
|
||||
<envs />
|
||||
<option name="emulateTerminal" value="true" />
|
||||
<option name="channel" value="DEFAULT" />
|
||||
<option name="requiredFeatures" value="true" />
|
||||
<option name="allFeatures" value="true" />
|
||||
<option name="withSudo" value="false" />
|
||||
<option name="buildTarget" value="REMOTE" />
|
||||
<option name="backtrace" value="SHORT" />
|
||||
<option name="isRedirectInput" value="false" />
|
||||
<option name="redirectInputPath" value="" />
|
||||
<method v="2">
|
||||
<option name="CARGO.BUILD_TASK_PROVIDER" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
6
.idea/rust.xml
generated
Normal file
6
.idea/rust.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RsVcsConfiguration">
|
||||
<option name="rustFmt" value="true" />
|
||||
</component>
|
||||
</project>
|
182
Cargo.lock
generated
182
Cargo.lock
generated
@ -18,10 +18,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.80"
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -107,15 +116,15 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.6.0"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
checksum = "a12916984aab3fa6e39d655a33e09c0071eb36d6ab3aea5c2d78551f1df6d952"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.99"
|
||||
version = "1.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695"
|
||||
checksum = "324c74f2155653c90b04f25b2a47a8a631360cb908f92a772695f430c7e31052"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
@ -123,14 +132,6 @@ version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "derive"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.34"
|
||||
@ -213,9 +214,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "http-body"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
|
||||
checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"http",
|
||||
@ -248,9 +249,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "1.3.1"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d"
|
||||
checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-channel",
|
||||
@ -267,9 +268,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hyper-util"
|
||||
version = "0.1.5"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56"
|
||||
checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"futures-util",
|
||||
@ -280,6 +281,14 @@ dependencies = [
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "into-response-derive"
|
||||
version = "1.1.0"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
@ -294,11 +303,12 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lib"
|
||||
version = "1.3.4"
|
||||
version = "1.4.1-hotfix"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"derive",
|
||||
"into-response-derive",
|
||||
"nom",
|
||||
"read-files",
|
||||
"serde",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
@ -317,9 +327,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.21"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "matchit"
|
||||
@ -404,9 +414,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.0"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434"
|
||||
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@ -479,6 +489,44 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "read-files"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"regex",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.24"
|
||||
@ -499,18 +547,18 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.203"
|
||||
version = "1.0.204"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
|
||||
checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.203"
|
||||
version = "1.0.204"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
|
||||
checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -519,9 +567,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.117"
|
||||
version = "1.0.120"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
|
||||
checksum = "4e0d21c9a8cae1235ad58a00c11cb40d4b1e5c784f1ef2c537876ed6ffd8b7c5"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
@ -583,9 +631,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.67"
|
||||
version = "2.0.71"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
|
||||
checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -606,18 +654,18 @@ checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.61"
|
||||
version = "1.0.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
||||
checksum = "f2675633b1499176c2dff06b0856a27976a8f9d436737b4cf4f312d4d91d8bbb"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.61"
|
||||
version = "1.0.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
||||
checksum = "d20468752b09f49e909e55a5d338caa8bedf615594e9d80bc4c565d30faf798c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -636,9 +684,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.38.0"
|
||||
version = "1.38.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
|
||||
checksum = "eb2caba9f80616f438e09748d5acda951967e1ea58508ef53d9c6402485a46df"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"libc",
|
||||
@ -837,7 +885,7 @@ version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.5",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -857,18 +905,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.5",
|
||||
"windows_aarch64_msvc 0.52.5",
|
||||
"windows_i686_gnu 0.52.5",
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.5",
|
||||
"windows_x86_64_gnu 0.52.5",
|
||||
"windows_x86_64_gnullvm 0.52.5",
|
||||
"windows_x86_64_msvc 0.52.5",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -879,9 +927,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
@ -891,9 +939,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
@ -903,15 +951,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
@ -921,9 +969,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
@ -933,9 +981,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
@ -945,9 +993,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
@ -957,6 +1005,6 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.5"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
49
Cargo.toml
49
Cargo.toml
@ -1,31 +1,47 @@
|
||||
[package]
|
||||
name = "lib"
|
||||
version = "1.3.4"
|
||||
[workspace]
|
||||
members = ["crates/*"]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2021"
|
||||
rust-version = "1.79.0"
|
||||
authors = ["Martin Berg Alstad"]
|
||||
homepage = "emberal.github.io"
|
||||
|
||||
[package]
|
||||
name = "lib"
|
||||
version = "1.4.1-hotfix"
|
||||
description = "A library with utilities and helper fuctions."
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
# Api
|
||||
axum = { version = "0.7.5", optional = true, features = ["multipart"] }
|
||||
tower = { version = "0.4.13", optional = true }
|
||||
tower-http = { version = "0.5.2", optional = true, features = ["trace", "cors", "normalize-path"] }
|
||||
axum = { version = "0.7", optional = true, features = ["multipart"] }
|
||||
tower = { version = "0.4", optional = true }
|
||||
tower-http = { version = "0.5", optional = true, features = ["trace", "cors", "normalize-path"] }
|
||||
# Async
|
||||
tokio = { version = "1.38.0", optional = true, features = ["fs"] }
|
||||
tokio-util = { version = "0.7.11", optional = true, features = ["io"] }
|
||||
tokio = { version = "1.38", optional = true, features = ["fs"] }
|
||||
tokio-util = { version = "0.7", optional = true, features = ["io"] }
|
||||
# Error handling
|
||||
thiserror = { version = "1.0.61", optional = true }
|
||||
thiserror = { version = "1.0", optional = true }
|
||||
# Logging
|
||||
tracing = { version = "0.1.40", optional = true }
|
||||
tracing-subscriber = { version = "0.3.18", optional = true }
|
||||
tracing = { version = "0.1", optional = true }
|
||||
tracing-subscriber = { version = "0.3", optional = true }
|
||||
# Parsing
|
||||
nom = { version = "7.1.3", optional = true }
|
||||
nom = { version = "7.1", optional = true }
|
||||
# Procedural macros
|
||||
into-response-derive = { path = "crates/into_response_derive", optional = true }
|
||||
read-files = { path = "crates/read_files", optional = true }
|
||||
# Serialization / Deserialization
|
||||
serde = { version = "1.0.203", optional = true, features = ["derive"] }
|
||||
# Derive macros
|
||||
derive = { path = "derive", optional = true }
|
||||
serde = { version = "1.0", optional = true, features = ["derive"] }
|
||||
|
||||
[workspace.dependencies]
|
||||
syn = "2.0"
|
||||
quote = "1.0"
|
||||
|
||||
[features]
|
||||
axum = ["dep:axum", "dep:tower", "dep:tower-http", "dep:thiserror", "dep:tracing", "dep:tracing-subscriber", "dep:tokio"]
|
||||
@ -33,4 +49,5 @@ io = ["dep:tokio", "dep:tokio-util"]
|
||||
iter = []
|
||||
nom = ["dep:nom"]
|
||||
serde = ["dep:serde"]
|
||||
derive = ["dep:derive", "axum", "serde"]
|
||||
derive = ["dep:into-response-derive", "axum", "serde"]
|
||||
read-files = ["dep:read-files"]
|
||||
|
3
Makefile
Normal file
3
Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
fmt:
|
||||
cargo clippy --all-targets --all-features
|
||||
cargo fmt
|
12
crates/into_response_derive/Cargo.toml
Normal file
12
crates/into_response_derive/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "into-response-derive"
|
||||
version = "1.1.0"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = { workspace = true }
|
||||
quote = { workspace = true }
|
@ -1,16 +1,9 @@
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
use quote::quote;
|
||||
use syn::{parse_macro_input, DeriveInput};
|
||||
use syn::DeriveInput;
|
||||
|
||||
#[proc_macro_derive(IntoResponse)]
|
||||
pub fn into_response_derive(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
into_response_derive_impl(input)
|
||||
}
|
||||
|
||||
fn into_response_derive_impl(input: DeriveInput) -> TokenStream {
|
||||
pub fn into_response_derive_impl(input: DeriveInput) -> TokenStream {
|
||||
let name = &input.ident;
|
||||
|
||||
let expanded = quote! {
|
13
crates/into_response_derive/src/lib.rs
Normal file
13
crates/into_response_derive/src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
extern crate proc_macro;
|
||||
use {
|
||||
proc_macro::TokenStream,
|
||||
syn::{parse_macro_input, DeriveInput},
|
||||
};
|
||||
|
||||
mod derive;
|
||||
|
||||
#[proc_macro_derive(IntoResponse)]
|
||||
pub fn into_response_derive(input: TokenStream) -> TokenStream {
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
derive::into_response_derive_impl(input)
|
||||
}
|
13
crates/read_files/Cargo.toml
Normal file
13
crates/read_files/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "read-files"
|
||||
version = "0.1.0"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = { workspace = true }
|
||||
quote = { workspace = true }
|
||||
regex = "1.10.5"
|
34
crates/read_files/src/lib.rs
Normal file
34
crates/read_files/src/lib.rs
Normal file
@ -0,0 +1,34 @@
|
||||
extern crate proc_macro;
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
use syn::parse_macro_input;
|
||||
|
||||
use crate::read_files::read_files_to_string_impl;
|
||||
|
||||
mod read_files;
|
||||
|
||||
/// Read files from a directory into a HashMap.
|
||||
/// The key is the file path relative to the root directory.
|
||||
/// The value is the file contents as a string.
|
||||
/// # Arguments
|
||||
/// * `path` - The directory to search for files, relative to the root directory.
|
||||
/// * `pattern` - The regex pattern to match files against. If missing, all files are matched.
|
||||
/// # Returns
|
||||
/// A HashMap containing the file paths and contents.
|
||||
/// # Example
|
||||
/// ```
|
||||
/// use read_files::read_files_to_string;
|
||||
///
|
||||
/// let files = read_files_to_string!("./src", ".rs$");
|
||||
/// assert!(!files.is_empty());
|
||||
/// ```
|
||||
/// # Panics
|
||||
/// If the path is empty. \
|
||||
/// If the pattern is invalid. \
|
||||
/// If the path does not exist. \
|
||||
/// If there are unexpected tokens. \
|
||||
#[proc_macro]
|
||||
pub fn read_files_to_string(input: TokenStream) -> TokenStream {
|
||||
let args = parse_macro_input!(input as read_files::Args);
|
||||
read_files_to_string_impl(args)
|
||||
}
|
124
crates/read_files/src/read_files.rs
Normal file
124
crates/read_files/src/read_files.rs
Normal file
@ -0,0 +1,124 @@
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::{metadata, read_dir, read_to_string},
|
||||
io,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use quote::quote;
|
||||
use syn::{
|
||||
parse::{Parse, ParseStream},
|
||||
LitStr, Token,
|
||||
};
|
||||
|
||||
pub fn read_files_to_string_impl(args: Args) -> TokenStream {
|
||||
let (keys, values) = split_hashmap(args);
|
||||
|
||||
let expanded = quote! {
|
||||
{
|
||||
let keys = vec![#( #keys, )*];
|
||||
let values = vec![#( #values, )*];
|
||||
keys.into_iter()
|
||||
.zip(values.into_iter())
|
||||
.collect::<std::collections::HashMap<&'static str, &'static str>>()
|
||||
}
|
||||
};
|
||||
expanded.into()
|
||||
}
|
||||
|
||||
pub struct Args {
|
||||
pub path: String,
|
||||
pub pattern: String,
|
||||
}
|
||||
|
||||
struct Syntax {
|
||||
path: LitStr,
|
||||
/* Comma */
|
||||
pattern: Option<LitStr>,
|
||||
}
|
||||
|
||||
impl From<Syntax> for Args {
|
||||
fn from(syntax: Syntax) -> Self {
|
||||
Self {
|
||||
path: syntax.path.value(),
|
||||
pattern: syntax
|
||||
.pattern
|
||||
.map(|pattern| pattern.value())
|
||||
.unwrap_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Parse for Args {
|
||||
fn parse(stream: ParseStream) -> syn::Result<Self> {
|
||||
if stream.is_empty() {
|
||||
panic!("Expected path argument");
|
||||
}
|
||||
|
||||
let path: LitStr = stream.parse()?;
|
||||
if path.value().is_empty() {
|
||||
panic!("Path must not be empty");
|
||||
}
|
||||
|
||||
let pattern = if stream.peek(Token![,]) {
|
||||
stream.parse::<Token![,]>()?;
|
||||
Some(stream.parse()?)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let syntax = Syntax { path, pattern };
|
||||
if !stream.is_empty() {
|
||||
panic!("Expected end of input");
|
||||
}
|
||||
|
||||
Ok(syntax.into())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn split_hashmap(args: Args) -> (Vec<String>, Vec<String>) {
|
||||
read_files_to_string(Path::new(&args.path), &args.pattern)
|
||||
.unwrap()
|
||||
.into_iter()
|
||||
.map(|(key, value)| (key.to_string_lossy().to_string(), value))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Find files within a directory and load them into a HashMap.
|
||||
/// The key is the file path relative to the root directory.
|
||||
/// The value is the file contents as a string.
|
||||
/// # Arguments
|
||||
/// * `path` - The directory to search for files.
|
||||
/// * `extension` - The pattern to match files against.
|
||||
/// # Returns
|
||||
/// A HashMap containing the file paths and contents.
|
||||
pub fn read_files_to_string(
|
||||
path: &Path,
|
||||
pattern: &str,
|
||||
) -> Result<HashMap<PathBuf, String>, io::Error> {
|
||||
use regex::Regex;
|
||||
|
||||
let mut files: HashMap<PathBuf, String> = HashMap::new();
|
||||
let dir = read_dir(path)?;
|
||||
|
||||
for entry in dir {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
let file_name = entry.file_name();
|
||||
let file_name = file_name.to_string_lossy();
|
||||
let metadata = metadata(&path)?;
|
||||
|
||||
let regex =
|
||||
Regex::new(pattern).map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
|
||||
if metadata.is_file() && regex.is_match(file_name.as_ref()) {
|
||||
let file = read_to_string(&path)?;
|
||||
files.insert(path, file);
|
||||
} else if metadata.is_dir() {
|
||||
files.extend(read_files_to_string(&path, pattern)?);
|
||||
}
|
||||
}
|
||||
Ok(files)
|
||||
}
|
13
crates/read_files/tests/lib.rs
Normal file
13
crates/read_files/tests/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use read_files::read_files_to_string;
|
||||
|
||||
#[test]
|
||||
fn test_load_files() {
|
||||
let files = read_files_to_string!("./src", ".rs$");
|
||||
assert!(!files.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_all_files() {
|
||||
let files = read_files_to_string!("./src");
|
||||
assert!(!files.is_empty());
|
||||
}
|
46
derive/Cargo.lock
generated
46
derive/Cargo.lock
generated
@ -1,46 +0,0 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "derive"
|
||||
version = "1.0.0"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.85"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.36"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ff8655ed1d86f3af4ee3fd3263786bc14245ad17c4c7e85ba7187fb3ae028c90"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
@ -1,12 +0,0 @@
|
||||
[package]
|
||||
name = "derive"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
authors = ["Martin Berg Alstad"]
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
syn = "2.0.66"
|
||||
quote = "1.0.36"
|
2
examples/multipart_file/Cargo.lock
generated
2
examples/multipart_file/Cargo.lock
generated
@ -286,7 +286,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lib"
|
||||
version = "1.3.4"
|
||||
version = "1.3.5"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"thiserror",
|
||||
|
@ -1,3 +1,4 @@
|
||||
use std::net::IpAddr;
|
||||
use {
|
||||
axum::{extract::Request, handler::Handler, Router, ServiceExt},
|
||||
std::{io, net::Ipv4Addr, net::SocketAddr},
|
||||
@ -26,7 +27,7 @@ macro_rules! create_app {
|
||||
#[derive(Default)]
|
||||
pub struct AppBuilder {
|
||||
router: Router,
|
||||
socket: Option<(Ipv4Addr, u16)>,
|
||||
socket: Option<(IpAddr, u16)>,
|
||||
cors: Option<CorsLayer>,
|
||||
normalize_path: Option<bool>,
|
||||
tracing: Option<TraceLayer<HttpMakeClassifier>>,
|
||||
@ -47,8 +48,18 @@ impl AppBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn socket(mut self, socket: impl Into<(Ipv4Addr, u16)>) -> Self {
|
||||
self.socket = Some(socket.into());
|
||||
pub fn socket<IP: Into<IpAddr>>(mut self, socket: impl Into<(IP, u16)>) -> Self {
|
||||
let (ip, port) = socket.into();
|
||||
self.socket = Some((ip.into(), port));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn port(mut self, port: u16) -> Self {
|
||||
self.socket = if let Some((ip, _)) = self.socket {
|
||||
Some((ip, port))
|
||||
} else {
|
||||
Some((Ipv4Addr::UNSPECIFIED.into(), port))
|
||||
};
|
||||
self
|
||||
}
|
||||
|
||||
@ -91,7 +102,7 @@ impl AppBuilder {
|
||||
}
|
||||
|
||||
async fn listener(&self) -> io::Result<TcpListener> {
|
||||
let addr = SocketAddr::from(self.socket.unwrap_or((Ipv4Addr::UNSPECIFIED, 8000)));
|
||||
let addr = SocketAddr::from(self.socket.unwrap_or((Ipv4Addr::UNSPECIFIED.into(), 8000)));
|
||||
info!("Initializing server on: {addr}");
|
||||
TcpListener::bind(&addr).await
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
#[cfg(all(feature = "derive", feature = "serde"))]
|
||||
pub extern crate into_response_derive;
|
||||
#[cfg(feature = "load-files")]
|
||||
pub extern crate load_files;
|
||||
|
||||
#[cfg(feature = "axum")]
|
||||
pub mod axum;
|
||||
#[cfg(feature = "io")]
|
||||
@ -11,6 +16,3 @@ pub mod serde;
|
||||
pub mod traits;
|
||||
#[cfg(feature = "iter")]
|
||||
pub mod vector;
|
||||
|
||||
#[cfg(all(feature = "derive", feature = "serde"))]
|
||||
pub extern crate derive;
|
||||
|
@ -31,7 +31,7 @@ pub fn parenthesized<'a, Parser, R>(inner: Parser) -> impl FnMut(&'a str) -> IRe
|
||||
where
|
||||
Parser: FnMut(&'a str) -> IResult<&'a str, R>,
|
||||
{
|
||||
delimited(char('('), trim(inner), char(')'))
|
||||
delimited(char('('), inner, char(')'))
|
||||
}
|
||||
|
||||
/// Take where the predicate is true and the length is exactly `n`
|
||||
@ -56,9 +56,10 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use nom::{bytes::complete::take_while, sequence::tuple};
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_trim_both_sides() {
|
||||
let input = " test ";
|
||||
|
Reference in New Issue
Block a user