├── .DS_Store ├── .gitignore ├── .gitmodules ├── 01-认识面向基础架构语言Rust-苏林 ├── .DS_Store └── 认识面向基础架构语言Rust.pdf ├── 02-理解Rust的所有权-苏林 ├── .DS_Store └── 理解Rust的所有权-Datafuse.pdf ├── 03-通过实战理解Rust宏-苏林 ├── .DS_Store └── three-通过实战理解Rust宏.pdf ├── 04-通过Datafuse理解全链路跟踪-苏林 └── 通过Datafuse理解全链路跟踪-Vol4.pdf ├── 05-Rust异步编程入门Future-苏林 ├── .DS_Store ├── 05-Rust培养提高计划-code.zip ├── Rust异步编程入门-Datafuse.pdf └── 公开课05-Rust异步编程入门Future.png ├── 06-Tokio入门运行时介绍-苏林 ├── .DS_Store ├── course-6.zip └── six-Tokio入门运行时介绍.pdf ├── 07-深入了解 rust 闭包-董泽润 ├── .DS_Store └── 07-深入了解 rust 闭包.pptx ├── 08-利用 Tokio 实现一个高性能 Mini Http server-苏林 ├── .DS_Store ├── eight-利用Tokio实现一个高性能Mini-Http-Server.key.zip ├── eight-利用Tokio实现一个高性能Mini-Http-Server.pdf └── mini-http-server.zip ├── 09-基于Rust Axum-web 和 MySQL 开发短链服务 ├── api-service-demo │ ├── .gitignore │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ ├── app │ │ ├── controllers │ │ │ ├── mod.rs │ │ │ └── shortlink_controller.rs │ │ ├── mod.rs │ │ └── models │ │ │ ├── dto.rs │ │ │ ├── mod.rs │ │ │ └── shortlink.rs │ │ ├── config │ │ ├── database.rs │ │ ├── mod.rs │ │ └── routes.rs │ │ └── main.rs ├── 基于auxm+sqlx+mysql开发短链api.pdf └── 表结构 ├── 10-使用Redis给短链服务加速 ├── api-service-demo │ ├── .DS_Store │ ├── Cargo.toml │ └── src │ │ ├── app │ │ ├── controllers │ │ │ ├── mod.rs │ │ │ └── shortlink_controller.rs │ │ ├── mod.rs │ │ └── models │ │ │ ├── dto.rs │ │ │ ├── mod.rs │ │ │ └── shortlink.rs │ │ ├── config │ │ ├── database.rs │ │ ├── env.rs │ │ ├── mod.rs │ │ └── routes.rs │ │ └── main.rs └── ten-使用Redis给短链服务加速.pdf ├── 11-实战-使用 Rust 开发动态链接库并在 Golang中使用-上 └── 实战:使用 Rust 开发动态链接库并在 Golang中使用(上)乎.pdf ├── 12-初探Rust微服务架构(gRPC+Tonic) ├── .DS_Store ├── 12-初探Rust微服务架构(gRPC+Tonic).pdf ├── api-service-demo │ ├── .DS_Store │ ├── Cargo.toml │ ├── build.rs │ ├── proto │ │ └── shortlink.proto │ └── src │ │ ├── app │ │ ├── controllers │ │ │ ├── mod.rs │ │ │ └── shortlink_controller.rs │ │ ├── mod.rs │ │ └── models │ │ │ ├── dto.rs │ │ │ ├── mod.rs │ │ │ └── shortlink.rs │ │ ├── config │ │ ├── database.rs │ │ ├── env.rs │ │ ├── mod.rs │ │ └── routes.rs │ │ ├── main.rs │ │ └── server.rs └── helloworld-tonic │ ├── .DS_Store │ ├── Cargo.toml │ ├── build.rs │ ├── proto │ └── helloworld.proto │ └── src │ ├── client.rs │ ├── main.rs │ └── server.rs ├── 13-Databend 如何做测试品控 └── databend-workflow.pdf ├── 14-探讨Rust异步编程框架Mio └── 探讨Rust异步编程框架Mio.pdf ├── 15-探讨为什么Pin在Rust异步编程中如此重要 ├── learn-pin │ ├── Cargo.toml │ └── src │ │ ├── example.rs │ │ ├── main.rs │ │ └── main1.rs └── 探讨为什么Pin在Rust异步编程中如此重要.pdf ├── 16-通过Futures库分析加深对Rust异步机制的理解 └── 通过对futures库分析加深对 Rust 异步运行时的理解.pdf ├── 17-探讨Rust智能指针 └── 探讨Rust智能指针.pdf ├── 18-Databend_in_github └── databend_github.pdf ├── 19-探讨Rust智能指针II └── 探讨Rust智能指针 2.pdf ├── 20-Serverless-SQL-Database └── Serverless SQL database.pdf ├── 21-探讨Rust中的Trait └── 探讨Rust中的Trait.pdf ├── 22-聊一聊Rust生命周期 └── 聊一聊Rust生命周期.pdf ├── 23-succinct trie ├── readme.md └── succinct-trie.pdf ├── 24-performance-tuning-in-databend └── performance-tuning-in-databend.pdf ├── 25-第一课-rust入门基本原理-1-rust内存模型 └── 第一课 Rust入门.pdf ├── 26-第一课-rust入门基本原理-2-rust所有权机制-借用规则 └── 第一课 Rust入门基本原理(2) .pdf ├── 27-第二课-rust类型系统 └── 第二课 Rust类型系统.pdf ├── 28-第三课-如何优雅的处理错误 └── 第三课 如何优雅的处理错误.pdf ├── 29-第四课-Cargo包管理 └── 第四课 cargo包管理.pdf ├── 30-第五课-如何编写测试1 └── 第五课 如何编写测试.pdf ├── 31-第五课-如何编写测试2 └── 第五课 如何编写测试 2.pdf ├── 32-第六课-理解Rust宏 ├── rust_macro_study.zip └── 第六课 理解Rust宏.pdf ├── 33-第七课-Rust异步编程 └── 第七课 Rust异步编程.pdf ├── 34-第八课-unsafe-rust └── 第八课 unsafe rust.pdf ├── README.md └── img └── 学习二维码.png /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IntelliJ project files 2 | .idea/* 3 | 4 | # visual studio code files 5 | .vscode 6 | .dir-locals.el 7 | 8 | # Rust 9 | target/* 10 | distro/* 11 | cli/e2e/bendctl 12 | .cargo/config.toml 13 | 14 | # OS related 15 | ### MacOS ### 16 | .DS_Store 17 | .AppleDouble 18 | .LSOverride 19 | 20 | # profile 21 | flamegraph.* 22 | perf.* 23 | 24 | # tests 25 | *.stderr 26 | *.stdout 27 | *.out 28 | *.err 29 | *.error 30 | *.swp 31 | _local_fs/* 32 | _meta*/* 33 | stateless_test_data/* 34 | **/_logs*/* 35 | _data/ 36 | _tmp/* 37 | tls/certs/* 38 | .databend/ 39 | checksums.txt 40 | 41 | # for tests in mac 42 | *.stderr-e 43 | *.stdout-e 44 | tests/perfs/*-result.json 45 | 46 | # python 47 | venv/ 48 | *.pyc 49 | __pycache__/* 50 | 51 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "11-实战-使用 Rust 开发动态链接库并在 Golang中使用-上/rust_golang_ffi_demo"] 2 | path = 11-实战-使用 Rust 开发动态链接库并在 Golang中使用-上/rust_golang_ffi_demo 3 | url = https://github.com/myrfy001/rust_golang_ffi_demo 4 | -------------------------------------------------------------------------------- /01-认识面向基础架构语言Rust-苏林/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/01-认识面向基础架构语言Rust-苏林/.DS_Store -------------------------------------------------------------------------------- /01-认识面向基础架构语言Rust-苏林/认识面向基础架构语言Rust.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/01-认识面向基础架构语言Rust-苏林/认识面向基础架构语言Rust.pdf -------------------------------------------------------------------------------- /02-理解Rust的所有权-苏林/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/02-理解Rust的所有权-苏林/.DS_Store -------------------------------------------------------------------------------- /02-理解Rust的所有权-苏林/理解Rust的所有权-Datafuse.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/02-理解Rust的所有权-苏林/理解Rust的所有权-Datafuse.pdf -------------------------------------------------------------------------------- /03-通过实战理解Rust宏-苏林/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/03-通过实战理解Rust宏-苏林/.DS_Store -------------------------------------------------------------------------------- /03-通过实战理解Rust宏-苏林/three-通过实战理解Rust宏.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/03-通过实战理解Rust宏-苏林/three-通过实战理解Rust宏.pdf -------------------------------------------------------------------------------- /04-通过Datafuse理解全链路跟踪-苏林/通过Datafuse理解全链路跟踪-Vol4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/04-通过Datafuse理解全链路跟踪-苏林/通过Datafuse理解全链路跟踪-Vol4.pdf -------------------------------------------------------------------------------- /05-Rust异步编程入门Future-苏林/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/05-Rust异步编程入门Future-苏林/.DS_Store -------------------------------------------------------------------------------- /05-Rust异步编程入门Future-苏林/05-Rust培养提高计划-code.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/05-Rust异步编程入门Future-苏林/05-Rust培养提高计划-code.zip -------------------------------------------------------------------------------- /05-Rust异步编程入门Future-苏林/Rust异步编程入门-Datafuse.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/05-Rust异步编程入门Future-苏林/Rust异步编程入门-Datafuse.pdf -------------------------------------------------------------------------------- /05-Rust异步编程入门Future-苏林/公开课05-Rust异步编程入门Future.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/05-Rust异步编程入门Future-苏林/公开课05-Rust异步编程入门Future.png -------------------------------------------------------------------------------- /06-Tokio入门运行时介绍-苏林/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/06-Tokio入门运行时介绍-苏林/.DS_Store -------------------------------------------------------------------------------- /06-Tokio入门运行时介绍-苏林/course-6.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/06-Tokio入门运行时介绍-苏林/course-6.zip -------------------------------------------------------------------------------- /06-Tokio入门运行时介绍-苏林/six-Tokio入门运行时介绍.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/06-Tokio入门运行时介绍-苏林/six-Tokio入门运行时介绍.pdf -------------------------------------------------------------------------------- /07-深入了解 rust 闭包-董泽润/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/07-深入了解 rust 闭包-董泽润/.DS_Store -------------------------------------------------------------------------------- /07-深入了解 rust 闭包-董泽润/07-深入了解 rust 闭包.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/07-深入了解 rust 闭包-董泽润/07-深入了解 rust 闭包.pptx -------------------------------------------------------------------------------- /08-利用 Tokio 实现一个高性能 Mini Http server-苏林/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/08-利用 Tokio 实现一个高性能 Mini Http server-苏林/.DS_Store -------------------------------------------------------------------------------- /08-利用 Tokio 实现一个高性能 Mini Http server-苏林/eight-利用Tokio实现一个高性能Mini-Http-Server.key.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/08-利用 Tokio 实现一个高性能 Mini Http server-苏林/eight-利用Tokio实现一个高性能Mini-Http-Server.key.zip -------------------------------------------------------------------------------- /08-利用 Tokio 实现一个高性能 Mini Http server-苏林/eight-利用Tokio实现一个高性能Mini-Http-Server.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/08-利用 Tokio 实现一个高性能 Mini Http server-苏林/eight-利用Tokio实现一个高性能Mini-Http-Server.pdf -------------------------------------------------------------------------------- /08-利用 Tokio 实现一个高性能 Mini Http server-苏林/mini-http-server.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/08-利用 Tokio 实现一个高性能 Mini Http server-苏林/mini-http-server.zip -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | .idea/ 3 | .vscode/ 4 | .DS_Store 5 | Cargo.lock 6 | -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "ahash" 7 | version = "0.7.4" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "43bb833f0bf979d8475d38fbf09ed3b8a55e1885fe93ad3f93239fc6a4f17b98" 10 | dependencies = [ 11 | "getrandom", 12 | "once_cell", 13 | "version_check", 14 | ] 15 | 16 | [[package]] 17 | name = "aho-corasick" 18 | version = "0.7.18" 19 | source = "registry+https://github.com/rust-lang/crates.io-index" 20 | checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" 21 | dependencies = [ 22 | "memchr", 23 | ] 24 | 25 | [[package]] 26 | name = "anyhow" 27 | version = "1.0.44" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1" 30 | 31 | [[package]] 32 | name = "api-service-demo" 33 | version = "0.1.0" 34 | dependencies = [ 35 | "anyhow", 36 | "axum", 37 | "redis", 38 | "serde", 39 | "sqlx", 40 | "tokio", 41 | "tower", 42 | "tower-http", 43 | "uuid", 44 | ] 45 | 46 | [[package]] 47 | name = "async-trait" 48 | version = "0.1.51" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" 51 | dependencies = [ 52 | "proc-macro2", 53 | "quote", 54 | "syn", 55 | ] 56 | 57 | [[package]] 58 | name = "atoi" 59 | version = "0.4.0" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5" 62 | dependencies = [ 63 | "num-traits", 64 | ] 65 | 66 | [[package]] 67 | name = "autocfg" 68 | version = "0.1.7" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" 71 | 72 | [[package]] 73 | name = "autocfg" 74 | version = "1.0.1" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 77 | 78 | [[package]] 79 | name = "axum" 80 | version = "0.2.4" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "6eb8eeaec8dea1b26a8f6f2b7a5aff11465292023a91a3b045bf3fe2830a1944" 83 | dependencies = [ 84 | "async-trait", 85 | "bitflags", 86 | "bytes", 87 | "futures-util", 88 | "http", 89 | "http-body", 90 | "hyper", 91 | "pin-project-lite", 92 | "regex", 93 | "serde", 94 | "serde_json", 95 | "serde_urlencoded", 96 | "sync_wrapper", 97 | "tokio", 98 | "tokio-util", 99 | "tower", 100 | "tower-http", 101 | "tower-layer", 102 | "tower-service", 103 | ] 104 | 105 | [[package]] 106 | name = "base64" 107 | version = "0.13.0" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 110 | 111 | [[package]] 112 | name = "bitflags" 113 | version = "1.3.2" 114 | source = "registry+https://github.com/rust-lang/crates.io-index" 115 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 116 | 117 | [[package]] 118 | name = "block-buffer" 119 | version = "0.9.0" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" 122 | dependencies = [ 123 | "generic-array", 124 | ] 125 | 126 | [[package]] 127 | name = "bumpalo" 128 | version = "3.7.0" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" 131 | 132 | [[package]] 133 | name = "byteorder" 134 | version = "1.4.3" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 137 | 138 | [[package]] 139 | name = "bytes" 140 | version = "1.1.0" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" 143 | 144 | [[package]] 145 | name = "cc" 146 | version = "1.0.70" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" 149 | 150 | [[package]] 151 | name = "cfg-if" 152 | version = "1.0.0" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 155 | 156 | [[package]] 157 | name = "chrono" 158 | version = "0.4.19" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" 161 | dependencies = [ 162 | "num-integer", 163 | "num-traits", 164 | ] 165 | 166 | [[package]] 167 | name = "combine" 168 | version = "4.6.1" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "a909e4d93292cd8e9c42e189f61681eff9d67b6541f96b8a1a737f23737bd001" 171 | dependencies = [ 172 | "bytes", 173 | "futures-core", 174 | "memchr", 175 | "pin-project-lite", 176 | "tokio", 177 | "tokio-util", 178 | ] 179 | 180 | [[package]] 181 | name = "cpufeatures" 182 | version = "0.2.1" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" 185 | dependencies = [ 186 | "libc", 187 | ] 188 | 189 | [[package]] 190 | name = "crc" 191 | version = "2.0.0" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "10c2722795460108a7872e1cd933a85d6ec38abc4baecad51028f702da28889f" 194 | dependencies = [ 195 | "crc-catalog", 196 | ] 197 | 198 | [[package]] 199 | name = "crc-catalog" 200 | version = "1.1.1" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" 203 | 204 | [[package]] 205 | name = "crossbeam-channel" 206 | version = "0.5.1" 207 | source = "registry+https://github.com/rust-lang/crates.io-index" 208 | checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" 209 | dependencies = [ 210 | "cfg-if", 211 | "crossbeam-utils", 212 | ] 213 | 214 | [[package]] 215 | name = "crossbeam-queue" 216 | version = "0.3.2" 217 | source = "registry+https://github.com/rust-lang/crates.io-index" 218 | checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9" 219 | dependencies = [ 220 | "cfg-if", 221 | "crossbeam-utils", 222 | ] 223 | 224 | [[package]] 225 | name = "crossbeam-utils" 226 | version = "0.8.5" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" 229 | dependencies = [ 230 | "cfg-if", 231 | "lazy_static", 232 | ] 233 | 234 | [[package]] 235 | name = "digest" 236 | version = "0.9.0" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" 239 | dependencies = [ 240 | "generic-array", 241 | ] 242 | 243 | [[package]] 244 | name = "dotenv" 245 | version = "0.15.0" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" 248 | 249 | [[package]] 250 | name = "dtoa" 251 | version = "0.4.8" 252 | source = "registry+https://github.com/rust-lang/crates.io-index" 253 | checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" 254 | 255 | [[package]] 256 | name = "either" 257 | version = "1.6.1" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" 260 | 261 | [[package]] 262 | name = "fnv" 263 | version = "1.0.7" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 266 | 267 | [[package]] 268 | name = "form_urlencoded" 269 | version = "1.0.1" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 272 | dependencies = [ 273 | "matches", 274 | "percent-encoding", 275 | ] 276 | 277 | [[package]] 278 | name = "futures" 279 | version = "0.3.17" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" 282 | dependencies = [ 283 | "futures-channel", 284 | "futures-core", 285 | "futures-executor", 286 | "futures-io", 287 | "futures-sink", 288 | "futures-task", 289 | "futures-util", 290 | ] 291 | 292 | [[package]] 293 | name = "futures-channel" 294 | version = "0.3.17" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" 297 | dependencies = [ 298 | "futures-core", 299 | "futures-sink", 300 | ] 301 | 302 | [[package]] 303 | name = "futures-core" 304 | version = "0.3.17" 305 | source = "registry+https://github.com/rust-lang/crates.io-index" 306 | checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" 307 | 308 | [[package]] 309 | name = "futures-executor" 310 | version = "0.3.17" 311 | source = "registry+https://github.com/rust-lang/crates.io-index" 312 | checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" 313 | dependencies = [ 314 | "futures-core", 315 | "futures-task", 316 | "futures-util", 317 | ] 318 | 319 | [[package]] 320 | name = "futures-intrusive" 321 | version = "0.4.0" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "62007592ac46aa7c2b6416f7deb9a8a8f63a01e0f1d6e1787d5630170db2b63e" 324 | dependencies = [ 325 | "futures-core", 326 | "lock_api", 327 | "parking_lot", 328 | ] 329 | 330 | [[package]] 331 | name = "futures-io" 332 | version = "0.3.17" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" 335 | 336 | [[package]] 337 | name = "futures-macro" 338 | version = "0.3.17" 339 | source = "registry+https://github.com/rust-lang/crates.io-index" 340 | checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" 341 | dependencies = [ 342 | "autocfg 1.0.1", 343 | "proc-macro-hack", 344 | "proc-macro2", 345 | "quote", 346 | "syn", 347 | ] 348 | 349 | [[package]] 350 | name = "futures-sink" 351 | version = "0.3.17" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" 354 | 355 | [[package]] 356 | name = "futures-task" 357 | version = "0.3.17" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" 360 | 361 | [[package]] 362 | name = "futures-util" 363 | version = "0.3.17" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" 366 | dependencies = [ 367 | "autocfg 1.0.1", 368 | "futures-channel", 369 | "futures-core", 370 | "futures-io", 371 | "futures-macro", 372 | "futures-sink", 373 | "futures-task", 374 | "memchr", 375 | "pin-project-lite", 376 | "pin-utils", 377 | "proc-macro-hack", 378 | "proc-macro-nested", 379 | "slab", 380 | ] 381 | 382 | [[package]] 383 | name = "generic-array" 384 | version = "0.14.4" 385 | source = "registry+https://github.com/rust-lang/crates.io-index" 386 | checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" 387 | dependencies = [ 388 | "typenum", 389 | "version_check", 390 | ] 391 | 392 | [[package]] 393 | name = "getrandom" 394 | version = "0.2.3" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" 397 | dependencies = [ 398 | "cfg-if", 399 | "libc", 400 | "wasi", 401 | ] 402 | 403 | [[package]] 404 | name = "hashbrown" 405 | version = "0.11.2" 406 | source = "registry+https://github.com/rust-lang/crates.io-index" 407 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 408 | dependencies = [ 409 | "ahash", 410 | ] 411 | 412 | [[package]] 413 | name = "hashlink" 414 | version = "0.7.0" 415 | source = "registry+https://github.com/rust-lang/crates.io-index" 416 | checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" 417 | dependencies = [ 418 | "hashbrown", 419 | ] 420 | 421 | [[package]] 422 | name = "heck" 423 | version = "0.3.3" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" 426 | dependencies = [ 427 | "unicode-segmentation", 428 | ] 429 | 430 | [[package]] 431 | name = "hermit-abi" 432 | version = "0.1.19" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 435 | dependencies = [ 436 | "libc", 437 | ] 438 | 439 | [[package]] 440 | name = "hex" 441 | version = "0.4.3" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 444 | 445 | [[package]] 446 | name = "http" 447 | version = "0.2.4" 448 | source = "registry+https://github.com/rust-lang/crates.io-index" 449 | checksum = "527e8c9ac747e28542699a951517aa9a6945af506cd1f2e1b53a576c17b6cc11" 450 | dependencies = [ 451 | "bytes", 452 | "fnv", 453 | "itoa", 454 | ] 455 | 456 | [[package]] 457 | name = "http-body" 458 | version = "0.4.3" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" 461 | dependencies = [ 462 | "bytes", 463 | "http", 464 | "pin-project-lite", 465 | ] 466 | 467 | [[package]] 468 | name = "httparse" 469 | version = "1.5.1" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" 472 | 473 | [[package]] 474 | name = "httpdate" 475 | version = "1.0.1" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" 478 | 479 | [[package]] 480 | name = "hyper" 481 | version = "0.14.12" 482 | source = "registry+https://github.com/rust-lang/crates.io-index" 483 | checksum = "13f67199e765030fa08fe0bd581af683f0d5bc04ea09c2b1102012c5fb90e7fd" 484 | dependencies = [ 485 | "bytes", 486 | "futures-channel", 487 | "futures-core", 488 | "futures-util", 489 | "http", 490 | "http-body", 491 | "httparse", 492 | "httpdate", 493 | "itoa", 494 | "pin-project-lite", 495 | "socket2", 496 | "tokio", 497 | "tower-service", 498 | "tracing", 499 | "want", 500 | ] 501 | 502 | [[package]] 503 | name = "idna" 504 | version = "0.2.3" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 507 | dependencies = [ 508 | "matches", 509 | "unicode-bidi", 510 | "unicode-normalization", 511 | ] 512 | 513 | [[package]] 514 | name = "instant" 515 | version = "0.1.10" 516 | source = "registry+https://github.com/rust-lang/crates.io-index" 517 | checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" 518 | dependencies = [ 519 | "cfg-if", 520 | ] 521 | 522 | [[package]] 523 | name = "itoa" 524 | version = "0.4.8" 525 | source = "registry+https://github.com/rust-lang/crates.io-index" 526 | checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" 527 | 528 | [[package]] 529 | name = "js-sys" 530 | version = "0.3.54" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "1866b355d9c878e5e607473cbe3f63282c0b7aad2db1dbebf55076c686918254" 533 | dependencies = [ 534 | "wasm-bindgen", 535 | ] 536 | 537 | [[package]] 538 | name = "lazy_static" 539 | version = "1.4.0" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 542 | dependencies = [ 543 | "spin", 544 | ] 545 | 546 | [[package]] 547 | name = "libc" 548 | version = "0.2.101" 549 | source = "registry+https://github.com/rust-lang/crates.io-index" 550 | checksum = "3cb00336871be5ed2c8ed44b60ae9959dc5b9f08539422ed43f09e34ecaeba21" 551 | 552 | [[package]] 553 | name = "libm" 554 | version = "0.2.1" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" 557 | 558 | [[package]] 559 | name = "lock_api" 560 | version = "0.4.5" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" 563 | dependencies = [ 564 | "scopeguard", 565 | ] 566 | 567 | [[package]] 568 | name = "log" 569 | version = "0.4.14" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 572 | dependencies = [ 573 | "cfg-if", 574 | ] 575 | 576 | [[package]] 577 | name = "maplit" 578 | version = "1.0.2" 579 | source = "registry+https://github.com/rust-lang/crates.io-index" 580 | checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" 581 | 582 | [[package]] 583 | name = "matches" 584 | version = "0.1.9" 585 | source = "registry+https://github.com/rust-lang/crates.io-index" 586 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 587 | 588 | [[package]] 589 | name = "memchr" 590 | version = "2.4.1" 591 | source = "registry+https://github.com/rust-lang/crates.io-index" 592 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 593 | 594 | [[package]] 595 | name = "minimal-lexical" 596 | version = "0.1.3" 597 | source = "registry+https://github.com/rust-lang/crates.io-index" 598 | checksum = "0c835948974f68e0bd58636fc6c5b1fbff7b297e3046f11b3b3c18bbac012c6d" 599 | 600 | [[package]] 601 | name = "mio" 602 | version = "0.7.13" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" 605 | dependencies = [ 606 | "libc", 607 | "log", 608 | "miow", 609 | "ntapi", 610 | "winapi", 611 | ] 612 | 613 | [[package]] 614 | name = "miow" 615 | version = "0.3.7" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 618 | dependencies = [ 619 | "winapi", 620 | ] 621 | 622 | [[package]] 623 | name = "nom" 624 | version = "7.0.0" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "7ffd9d26838a953b4af82cbeb9f1592c6798916983959be223a7124e992742c1" 627 | dependencies = [ 628 | "memchr", 629 | "minimal-lexical", 630 | "version_check", 631 | ] 632 | 633 | [[package]] 634 | name = "ntapi" 635 | version = "0.3.6" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" 638 | dependencies = [ 639 | "winapi", 640 | ] 641 | 642 | [[package]] 643 | name = "num-bigint" 644 | version = "0.3.3" 645 | source = "registry+https://github.com/rust-lang/crates.io-index" 646 | checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" 647 | dependencies = [ 648 | "autocfg 1.0.1", 649 | "num-integer", 650 | "num-traits", 651 | ] 652 | 653 | [[package]] 654 | name = "num-bigint" 655 | version = "0.4.2" 656 | source = "registry+https://github.com/rust-lang/crates.io-index" 657 | checksum = "74e768dff5fb39a41b3bcd30bb25cf989706c90d028d1ad71971987aa309d535" 658 | dependencies = [ 659 | "autocfg 1.0.1", 660 | "num-integer", 661 | "num-traits", 662 | ] 663 | 664 | [[package]] 665 | name = "num-bigint-dig" 666 | version = "0.7.0" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "4547ee5541c18742396ae2c895d0717d0f886d8823b8399cdaf7b07d63ad0480" 669 | dependencies = [ 670 | "autocfg 0.1.7", 671 | "byteorder", 672 | "lazy_static", 673 | "libm", 674 | "num-integer", 675 | "num-iter", 676 | "num-traits", 677 | "rand", 678 | "smallvec", 679 | "zeroize", 680 | ] 681 | 682 | [[package]] 683 | name = "num-integer" 684 | version = "0.1.44" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" 687 | dependencies = [ 688 | "autocfg 1.0.1", 689 | "num-traits", 690 | ] 691 | 692 | [[package]] 693 | name = "num-iter" 694 | version = "0.1.42" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" 697 | dependencies = [ 698 | "autocfg 1.0.1", 699 | "num-integer", 700 | "num-traits", 701 | ] 702 | 703 | [[package]] 704 | name = "num-traits" 705 | version = "0.2.14" 706 | source = "registry+https://github.com/rust-lang/crates.io-index" 707 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" 708 | dependencies = [ 709 | "autocfg 1.0.1", 710 | "libm", 711 | ] 712 | 713 | [[package]] 714 | name = "num_cpus" 715 | version = "1.13.0" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" 718 | dependencies = [ 719 | "hermit-abi", 720 | "libc", 721 | ] 722 | 723 | [[package]] 724 | name = "once_cell" 725 | version = "1.8.0" 726 | source = "registry+https://github.com/rust-lang/crates.io-index" 727 | checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" 728 | 729 | [[package]] 730 | name = "opaque-debug" 731 | version = "0.3.0" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" 734 | 735 | [[package]] 736 | name = "parking_lot" 737 | version = "0.11.2" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" 740 | dependencies = [ 741 | "instant", 742 | "lock_api", 743 | "parking_lot_core", 744 | ] 745 | 746 | [[package]] 747 | name = "parking_lot_core" 748 | version = "0.8.5" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" 751 | dependencies = [ 752 | "cfg-if", 753 | "instant", 754 | "libc", 755 | "redox_syscall", 756 | "smallvec", 757 | "winapi", 758 | ] 759 | 760 | [[package]] 761 | name = "pem" 762 | version = "0.8.3" 763 | source = "registry+https://github.com/rust-lang/crates.io-index" 764 | checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" 765 | dependencies = [ 766 | "base64", 767 | "once_cell", 768 | "regex", 769 | ] 770 | 771 | [[package]] 772 | name = "percent-encoding" 773 | version = "2.1.0" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 776 | 777 | [[package]] 778 | name = "pin-project" 779 | version = "1.0.8" 780 | source = "registry+https://github.com/rust-lang/crates.io-index" 781 | checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" 782 | dependencies = [ 783 | "pin-project-internal", 784 | ] 785 | 786 | [[package]] 787 | name = "pin-project-internal" 788 | version = "1.0.8" 789 | source = "registry+https://github.com/rust-lang/crates.io-index" 790 | checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" 791 | dependencies = [ 792 | "proc-macro2", 793 | "quote", 794 | "syn", 795 | ] 796 | 797 | [[package]] 798 | name = "pin-project-lite" 799 | version = "0.2.7" 800 | source = "registry+https://github.com/rust-lang/crates.io-index" 801 | checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" 802 | 803 | [[package]] 804 | name = "pin-utils" 805 | version = "0.1.0" 806 | source = "registry+https://github.com/rust-lang/crates.io-index" 807 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 808 | 809 | [[package]] 810 | name = "ppv-lite86" 811 | version = "0.2.10" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" 814 | 815 | [[package]] 816 | name = "proc-macro-hack" 817 | version = "0.5.19" 818 | source = "registry+https://github.com/rust-lang/crates.io-index" 819 | checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" 820 | 821 | [[package]] 822 | name = "proc-macro-nested" 823 | version = "0.1.7" 824 | source = "registry+https://github.com/rust-lang/crates.io-index" 825 | checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" 826 | 827 | [[package]] 828 | name = "proc-macro2" 829 | version = "1.0.29" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" 832 | dependencies = [ 833 | "unicode-xid", 834 | ] 835 | 836 | [[package]] 837 | name = "quote" 838 | version = "1.0.9" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 841 | dependencies = [ 842 | "proc-macro2", 843 | ] 844 | 845 | [[package]] 846 | name = "rand" 847 | version = "0.8.4" 848 | source = "registry+https://github.com/rust-lang/crates.io-index" 849 | checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" 850 | dependencies = [ 851 | "libc", 852 | "rand_chacha", 853 | "rand_core", 854 | "rand_hc", 855 | ] 856 | 857 | [[package]] 858 | name = "rand_chacha" 859 | version = "0.3.1" 860 | source = "registry+https://github.com/rust-lang/crates.io-index" 861 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 862 | dependencies = [ 863 | "ppv-lite86", 864 | "rand_core", 865 | ] 866 | 867 | [[package]] 868 | name = "rand_core" 869 | version = "0.6.3" 870 | source = "registry+https://github.com/rust-lang/crates.io-index" 871 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 872 | dependencies = [ 873 | "getrandom", 874 | ] 875 | 876 | [[package]] 877 | name = "rand_hc" 878 | version = "0.3.1" 879 | source = "registry+https://github.com/rust-lang/crates.io-index" 880 | checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" 881 | dependencies = [ 882 | "rand_core", 883 | ] 884 | 885 | [[package]] 886 | name = "redis" 887 | version = "0.21.2" 888 | source = "registry+https://github.com/rust-lang/crates.io-index" 889 | checksum = "202c5bf92cad3d57605c366e644a7fbf305a83f19754fc66678c6265dcc9b8b4" 890 | dependencies = [ 891 | "async-trait", 892 | "bytes", 893 | "combine", 894 | "dtoa", 895 | "futures-util", 896 | "itoa", 897 | "percent-encoding", 898 | "pin-project-lite", 899 | "sha1", 900 | "tokio", 901 | "tokio-util", 902 | "url", 903 | ] 904 | 905 | [[package]] 906 | name = "redox_syscall" 907 | version = "0.2.10" 908 | source = "registry+https://github.com/rust-lang/crates.io-index" 909 | checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" 910 | dependencies = [ 911 | "bitflags", 912 | ] 913 | 914 | [[package]] 915 | name = "regex" 916 | version = "1.5.4" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" 919 | dependencies = [ 920 | "aho-corasick", 921 | "memchr", 922 | "regex-syntax", 923 | ] 924 | 925 | [[package]] 926 | name = "regex-syntax" 927 | version = "0.6.25" 928 | source = "registry+https://github.com/rust-lang/crates.io-index" 929 | checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" 930 | 931 | [[package]] 932 | name = "ring" 933 | version = "0.16.20" 934 | source = "registry+https://github.com/rust-lang/crates.io-index" 935 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" 936 | dependencies = [ 937 | "cc", 938 | "libc", 939 | "once_cell", 940 | "spin", 941 | "untrusted", 942 | "web-sys", 943 | "winapi", 944 | ] 945 | 946 | [[package]] 947 | name = "rsa" 948 | version = "0.4.1" 949 | source = "registry+https://github.com/rust-lang/crates.io-index" 950 | checksum = "7b0aeddcca1082112a6eeb43bf25fd7820b066aaf6eaef776e19d0a1febe38fe" 951 | dependencies = [ 952 | "byteorder", 953 | "digest", 954 | "lazy_static", 955 | "num-bigint-dig", 956 | "num-integer", 957 | "num-iter", 958 | "num-traits", 959 | "pem", 960 | "rand", 961 | "simple_asn1", 962 | "subtle", 963 | "zeroize", 964 | ] 965 | 966 | [[package]] 967 | name = "rustls" 968 | version = "0.19.1" 969 | source = "registry+https://github.com/rust-lang/crates.io-index" 970 | checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" 971 | dependencies = [ 972 | "base64", 973 | "log", 974 | "ring", 975 | "sct", 976 | "webpki", 977 | ] 978 | 979 | [[package]] 980 | name = "ryu" 981 | version = "1.0.5" 982 | source = "registry+https://github.com/rust-lang/crates.io-index" 983 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 984 | 985 | [[package]] 986 | name = "scopeguard" 987 | version = "1.1.0" 988 | source = "registry+https://github.com/rust-lang/crates.io-index" 989 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 990 | 991 | [[package]] 992 | name = "sct" 993 | version = "0.6.1" 994 | source = "registry+https://github.com/rust-lang/crates.io-index" 995 | checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" 996 | dependencies = [ 997 | "ring", 998 | "untrusted", 999 | ] 1000 | 1001 | [[package]] 1002 | name = "serde" 1003 | version = "1.0.130" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" 1006 | dependencies = [ 1007 | "serde_derive", 1008 | ] 1009 | 1010 | [[package]] 1011 | name = "serde_derive" 1012 | version = "1.0.130" 1013 | source = "registry+https://github.com/rust-lang/crates.io-index" 1014 | checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" 1015 | dependencies = [ 1016 | "proc-macro2", 1017 | "quote", 1018 | "syn", 1019 | ] 1020 | 1021 | [[package]] 1022 | name = "serde_json" 1023 | version = "1.0.67" 1024 | source = "registry+https://github.com/rust-lang/crates.io-index" 1025 | checksum = "a7f9e390c27c3c0ce8bc5d725f6e4d30a29d26659494aa4b17535f7522c5c950" 1026 | dependencies = [ 1027 | "itoa", 1028 | "ryu", 1029 | "serde", 1030 | ] 1031 | 1032 | [[package]] 1033 | name = "serde_urlencoded" 1034 | version = "0.7.0" 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" 1036 | checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" 1037 | dependencies = [ 1038 | "form_urlencoded", 1039 | "itoa", 1040 | "ryu", 1041 | "serde", 1042 | ] 1043 | 1044 | [[package]] 1045 | name = "sha-1" 1046 | version = "0.9.8" 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" 1048 | checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" 1049 | dependencies = [ 1050 | "block-buffer", 1051 | "cfg-if", 1052 | "cpufeatures", 1053 | "digest", 1054 | "opaque-debug", 1055 | ] 1056 | 1057 | [[package]] 1058 | name = "sha1" 1059 | version = "0.6.0" 1060 | source = "registry+https://github.com/rust-lang/crates.io-index" 1061 | checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" 1062 | 1063 | [[package]] 1064 | name = "sha2" 1065 | version = "0.9.8" 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" 1067 | checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" 1068 | dependencies = [ 1069 | "block-buffer", 1070 | "cfg-if", 1071 | "cpufeatures", 1072 | "digest", 1073 | "opaque-debug", 1074 | ] 1075 | 1076 | [[package]] 1077 | name = "signal-hook-registry" 1078 | version = "1.4.0" 1079 | source = "registry+https://github.com/rust-lang/crates.io-index" 1080 | checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" 1081 | dependencies = [ 1082 | "libc", 1083 | ] 1084 | 1085 | [[package]] 1086 | name = "simple_asn1" 1087 | version = "0.5.4" 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" 1089 | checksum = "8eb4ea60fb301dc81dfc113df680571045d375ab7345d171c5dc7d7e13107a80" 1090 | dependencies = [ 1091 | "chrono", 1092 | "num-bigint 0.4.2", 1093 | "num-traits", 1094 | "thiserror", 1095 | ] 1096 | 1097 | [[package]] 1098 | name = "slab" 1099 | version = "0.4.4" 1100 | source = "registry+https://github.com/rust-lang/crates.io-index" 1101 | checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" 1102 | 1103 | [[package]] 1104 | name = "smallvec" 1105 | version = "1.6.1" 1106 | source = "registry+https://github.com/rust-lang/crates.io-index" 1107 | checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" 1108 | 1109 | [[package]] 1110 | name = "socket2" 1111 | version = "0.4.1" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" 1114 | dependencies = [ 1115 | "libc", 1116 | "winapi", 1117 | ] 1118 | 1119 | [[package]] 1120 | name = "spin" 1121 | version = "0.5.2" 1122 | source = "registry+https://github.com/rust-lang/crates.io-index" 1123 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1124 | 1125 | [[package]] 1126 | name = "sqlformat" 1127 | version = "0.1.7" 1128 | source = "registry+https://github.com/rust-lang/crates.io-index" 1129 | checksum = "684001e7985ec1a9a66963b77ed151ef22a7876b3fdd7e37a57ec774f54b7d96" 1130 | dependencies = [ 1131 | "lazy_static", 1132 | "maplit", 1133 | "nom", 1134 | "regex", 1135 | "unicode_categories", 1136 | ] 1137 | 1138 | [[package]] 1139 | name = "sqlx" 1140 | version = "0.5.7" 1141 | source = "registry+https://github.com/rust-lang/crates.io-index" 1142 | checksum = "0e4b94ab0f8c21ee4899b93b06451ef5d965f1a355982ee73684338228498440" 1143 | dependencies = [ 1144 | "sqlx-core", 1145 | "sqlx-macros", 1146 | ] 1147 | 1148 | [[package]] 1149 | name = "sqlx-core" 1150 | version = "0.5.7" 1151 | source = "registry+https://github.com/rust-lang/crates.io-index" 1152 | checksum = "ec28b91a01e1fe286d6ba66f68289a2286df023fc97444e1fd86c2fd6d5dc026" 1153 | dependencies = [ 1154 | "ahash", 1155 | "atoi", 1156 | "base64", 1157 | "bitflags", 1158 | "byteorder", 1159 | "bytes", 1160 | "crc", 1161 | "crossbeam-channel", 1162 | "crossbeam-queue", 1163 | "crossbeam-utils", 1164 | "digest", 1165 | "either", 1166 | "futures-channel", 1167 | "futures-core", 1168 | "futures-intrusive", 1169 | "futures-util", 1170 | "generic-array", 1171 | "hashlink", 1172 | "hex", 1173 | "itoa", 1174 | "libc", 1175 | "log", 1176 | "memchr", 1177 | "num-bigint 0.3.3", 1178 | "once_cell", 1179 | "parking_lot", 1180 | "percent-encoding", 1181 | "rand", 1182 | "rsa", 1183 | "rustls", 1184 | "sha-1", 1185 | "sha2", 1186 | "smallvec", 1187 | "sqlformat", 1188 | "sqlx-rt", 1189 | "stringprep", 1190 | "thiserror", 1191 | "tokio-stream", 1192 | "url", 1193 | "webpki", 1194 | "webpki-roots", 1195 | "whoami", 1196 | ] 1197 | 1198 | [[package]] 1199 | name = "sqlx-macros" 1200 | version = "0.5.7" 1201 | source = "registry+https://github.com/rust-lang/crates.io-index" 1202 | checksum = "4dc33c35d54774eed73d54568d47a6ac099aed8af5e1556a017c131be88217d5" 1203 | dependencies = [ 1204 | "dotenv", 1205 | "either", 1206 | "futures", 1207 | "heck", 1208 | "once_cell", 1209 | "proc-macro2", 1210 | "quote", 1211 | "sha2", 1212 | "sqlx-core", 1213 | "sqlx-rt", 1214 | "syn", 1215 | "url", 1216 | ] 1217 | 1218 | [[package]] 1219 | name = "sqlx-rt" 1220 | version = "0.5.7" 1221 | source = "registry+https://github.com/rust-lang/crates.io-index" 1222 | checksum = "14302b678d9c76b28f2e60115211e25e0aabc938269991745a169753dc00e35c" 1223 | dependencies = [ 1224 | "once_cell", 1225 | "tokio", 1226 | "tokio-rustls", 1227 | ] 1228 | 1229 | [[package]] 1230 | name = "stringprep" 1231 | version = "0.1.2" 1232 | source = "registry+https://github.com/rust-lang/crates.io-index" 1233 | checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" 1234 | dependencies = [ 1235 | "unicode-bidi", 1236 | "unicode-normalization", 1237 | ] 1238 | 1239 | [[package]] 1240 | name = "subtle" 1241 | version = "2.4.1" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" 1244 | 1245 | [[package]] 1246 | name = "syn" 1247 | version = "1.0.76" 1248 | source = "registry+https://github.com/rust-lang/crates.io-index" 1249 | checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84" 1250 | dependencies = [ 1251 | "proc-macro2", 1252 | "quote", 1253 | "unicode-xid", 1254 | ] 1255 | 1256 | [[package]] 1257 | name = "sync_wrapper" 1258 | version = "0.1.1" 1259 | source = "registry+https://github.com/rust-lang/crates.io-index" 1260 | checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" 1261 | 1262 | [[package]] 1263 | name = "synstructure" 1264 | version = "0.12.5" 1265 | source = "registry+https://github.com/rust-lang/crates.io-index" 1266 | checksum = "474aaa926faa1603c40b7885a9eaea29b444d1cb2850cb7c0e37bb1a4182f4fa" 1267 | dependencies = [ 1268 | "proc-macro2", 1269 | "quote", 1270 | "syn", 1271 | "unicode-xid", 1272 | ] 1273 | 1274 | [[package]] 1275 | name = "thiserror" 1276 | version = "1.0.29" 1277 | source = "registry+https://github.com/rust-lang/crates.io-index" 1278 | checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" 1279 | dependencies = [ 1280 | "thiserror-impl", 1281 | ] 1282 | 1283 | [[package]] 1284 | name = "thiserror-impl" 1285 | version = "1.0.29" 1286 | source = "registry+https://github.com/rust-lang/crates.io-index" 1287 | checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" 1288 | dependencies = [ 1289 | "proc-macro2", 1290 | "quote", 1291 | "syn", 1292 | ] 1293 | 1294 | [[package]] 1295 | name = "tinyvec" 1296 | version = "1.3.1" 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" 1298 | checksum = "848a1e1181b9f6753b5e96a092749e29b11d19ede67dfbbd6c7dc7e0f49b5338" 1299 | dependencies = [ 1300 | "tinyvec_macros", 1301 | ] 1302 | 1303 | [[package]] 1304 | name = "tinyvec_macros" 1305 | version = "0.1.0" 1306 | source = "registry+https://github.com/rust-lang/crates.io-index" 1307 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 1308 | 1309 | [[package]] 1310 | name = "tokio" 1311 | version = "1.11.0" 1312 | source = "registry+https://github.com/rust-lang/crates.io-index" 1313 | checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" 1314 | dependencies = [ 1315 | "autocfg 1.0.1", 1316 | "bytes", 1317 | "libc", 1318 | "memchr", 1319 | "mio", 1320 | "num_cpus", 1321 | "once_cell", 1322 | "parking_lot", 1323 | "pin-project-lite", 1324 | "signal-hook-registry", 1325 | "tokio-macros", 1326 | "winapi", 1327 | ] 1328 | 1329 | [[package]] 1330 | name = "tokio-macros" 1331 | version = "1.3.0" 1332 | source = "registry+https://github.com/rust-lang/crates.io-index" 1333 | checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" 1334 | dependencies = [ 1335 | "proc-macro2", 1336 | "quote", 1337 | "syn", 1338 | ] 1339 | 1340 | [[package]] 1341 | name = "tokio-rustls" 1342 | version = "0.22.0" 1343 | source = "registry+https://github.com/rust-lang/crates.io-index" 1344 | checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" 1345 | dependencies = [ 1346 | "rustls", 1347 | "tokio", 1348 | "webpki", 1349 | ] 1350 | 1351 | [[package]] 1352 | name = "tokio-stream" 1353 | version = "0.1.7" 1354 | source = "registry+https://github.com/rust-lang/crates.io-index" 1355 | checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" 1356 | dependencies = [ 1357 | "futures-core", 1358 | "pin-project-lite", 1359 | "tokio", 1360 | ] 1361 | 1362 | [[package]] 1363 | name = "tokio-util" 1364 | version = "0.6.8" 1365 | source = "registry+https://github.com/rust-lang/crates.io-index" 1366 | checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" 1367 | dependencies = [ 1368 | "bytes", 1369 | "futures-core", 1370 | "futures-sink", 1371 | "log", 1372 | "pin-project-lite", 1373 | "tokio", 1374 | ] 1375 | 1376 | [[package]] 1377 | name = "tower" 1378 | version = "0.4.8" 1379 | source = "registry+https://github.com/rust-lang/crates.io-index" 1380 | checksum = "f60422bc7fefa2f3ec70359b8ff1caff59d785877eb70595904605bcc412470f" 1381 | dependencies = [ 1382 | "futures-core", 1383 | "futures-util", 1384 | "pin-project", 1385 | "tokio", 1386 | "tokio-util", 1387 | "tower-layer", 1388 | "tower-service", 1389 | "tracing", 1390 | ] 1391 | 1392 | [[package]] 1393 | name = "tower-http" 1394 | version = "0.1.1" 1395 | source = "registry+https://github.com/rust-lang/crates.io-index" 1396 | checksum = "0b7b56efe69aa0ad2b5da6b942e57ea9f6fe683b7a314d4ff48662e2c8838de1" 1397 | dependencies = [ 1398 | "bytes", 1399 | "futures-core", 1400 | "futures-util", 1401 | "http", 1402 | "http-body", 1403 | "pin-project", 1404 | "tower-layer", 1405 | "tower-service", 1406 | "tracing", 1407 | ] 1408 | 1409 | [[package]] 1410 | name = "tower-layer" 1411 | version = "0.3.1" 1412 | source = "registry+https://github.com/rust-lang/crates.io-index" 1413 | checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" 1414 | 1415 | [[package]] 1416 | name = "tower-service" 1417 | version = "0.3.1" 1418 | source = "registry+https://github.com/rust-lang/crates.io-index" 1419 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 1420 | 1421 | [[package]] 1422 | name = "tracing" 1423 | version = "0.1.26" 1424 | source = "registry+https://github.com/rust-lang/crates.io-index" 1425 | checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" 1426 | dependencies = [ 1427 | "cfg-if", 1428 | "log", 1429 | "pin-project-lite", 1430 | "tracing-attributes", 1431 | "tracing-core", 1432 | ] 1433 | 1434 | [[package]] 1435 | name = "tracing-attributes" 1436 | version = "0.1.15" 1437 | source = "registry+https://github.com/rust-lang/crates.io-index" 1438 | checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" 1439 | dependencies = [ 1440 | "proc-macro2", 1441 | "quote", 1442 | "syn", 1443 | ] 1444 | 1445 | [[package]] 1446 | name = "tracing-core" 1447 | version = "0.1.19" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" 1450 | dependencies = [ 1451 | "lazy_static", 1452 | ] 1453 | 1454 | [[package]] 1455 | name = "try-lock" 1456 | version = "0.2.3" 1457 | source = "registry+https://github.com/rust-lang/crates.io-index" 1458 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 1459 | 1460 | [[package]] 1461 | name = "typenum" 1462 | version = "1.14.0" 1463 | source = "registry+https://github.com/rust-lang/crates.io-index" 1464 | checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" 1465 | 1466 | [[package]] 1467 | name = "unicode-bidi" 1468 | version = "0.3.6" 1469 | source = "registry+https://github.com/rust-lang/crates.io-index" 1470 | checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" 1471 | 1472 | [[package]] 1473 | name = "unicode-normalization" 1474 | version = "0.1.19" 1475 | source = "registry+https://github.com/rust-lang/crates.io-index" 1476 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 1477 | dependencies = [ 1478 | "tinyvec", 1479 | ] 1480 | 1481 | [[package]] 1482 | name = "unicode-segmentation" 1483 | version = "1.8.0" 1484 | source = "registry+https://github.com/rust-lang/crates.io-index" 1485 | checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" 1486 | 1487 | [[package]] 1488 | name = "unicode-xid" 1489 | version = "0.2.2" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 1492 | 1493 | [[package]] 1494 | name = "unicode_categories" 1495 | version = "0.1.1" 1496 | source = "registry+https://github.com/rust-lang/crates.io-index" 1497 | checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" 1498 | 1499 | [[package]] 1500 | name = "untrusted" 1501 | version = "0.7.1" 1502 | source = "registry+https://github.com/rust-lang/crates.io-index" 1503 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" 1504 | 1505 | [[package]] 1506 | name = "url" 1507 | version = "2.2.2" 1508 | source = "registry+https://github.com/rust-lang/crates.io-index" 1509 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 1510 | dependencies = [ 1511 | "form_urlencoded", 1512 | "idna", 1513 | "matches", 1514 | "percent-encoding", 1515 | ] 1516 | 1517 | [[package]] 1518 | name = "uuid" 1519 | version = "0.8.2" 1520 | source = "registry+https://github.com/rust-lang/crates.io-index" 1521 | checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" 1522 | dependencies = [ 1523 | "getrandom", 1524 | "serde", 1525 | ] 1526 | 1527 | [[package]] 1528 | name = "version_check" 1529 | version = "0.9.3" 1530 | source = "registry+https://github.com/rust-lang/crates.io-index" 1531 | checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" 1532 | 1533 | [[package]] 1534 | name = "want" 1535 | version = "0.3.0" 1536 | source = "registry+https://github.com/rust-lang/crates.io-index" 1537 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1538 | dependencies = [ 1539 | "log", 1540 | "try-lock", 1541 | ] 1542 | 1543 | [[package]] 1544 | name = "wasi" 1545 | version = "0.10.2+wasi-snapshot-preview1" 1546 | source = "registry+https://github.com/rust-lang/crates.io-index" 1547 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 1548 | 1549 | [[package]] 1550 | name = "wasm-bindgen" 1551 | version = "0.2.77" 1552 | source = "registry+https://github.com/rust-lang/crates.io-index" 1553 | checksum = "5e68338db6becec24d3c7977b5bf8a48be992c934b5d07177e3931f5dc9b076c" 1554 | dependencies = [ 1555 | "cfg-if", 1556 | "wasm-bindgen-macro", 1557 | ] 1558 | 1559 | [[package]] 1560 | name = "wasm-bindgen-backend" 1561 | version = "0.2.77" 1562 | source = "registry+https://github.com/rust-lang/crates.io-index" 1563 | checksum = "f34c405b4f0658583dba0c1c7c9b694f3cac32655db463b56c254a1c75269523" 1564 | dependencies = [ 1565 | "bumpalo", 1566 | "lazy_static", 1567 | "log", 1568 | "proc-macro2", 1569 | "quote", 1570 | "syn", 1571 | "wasm-bindgen-shared", 1572 | ] 1573 | 1574 | [[package]] 1575 | name = "wasm-bindgen-macro" 1576 | version = "0.2.77" 1577 | source = "registry+https://github.com/rust-lang/crates.io-index" 1578 | checksum = "b9d5a6580be83b19dc570a8f9c324251687ab2184e57086f71625feb57ec77c8" 1579 | dependencies = [ 1580 | "quote", 1581 | "wasm-bindgen-macro-support", 1582 | ] 1583 | 1584 | [[package]] 1585 | name = "wasm-bindgen-macro-support" 1586 | version = "0.2.77" 1587 | source = "registry+https://github.com/rust-lang/crates.io-index" 1588 | checksum = "e3775a030dc6f5a0afd8a84981a21cc92a781eb429acef9ecce476d0c9113e92" 1589 | dependencies = [ 1590 | "proc-macro2", 1591 | "quote", 1592 | "syn", 1593 | "wasm-bindgen-backend", 1594 | "wasm-bindgen-shared", 1595 | ] 1596 | 1597 | [[package]] 1598 | name = "wasm-bindgen-shared" 1599 | version = "0.2.77" 1600 | source = "registry+https://github.com/rust-lang/crates.io-index" 1601 | checksum = "c279e376c7a8e8752a8f1eaa35b7b0bee6bb9fb0cdacfa97cc3f1f289c87e2b4" 1602 | 1603 | [[package]] 1604 | name = "web-sys" 1605 | version = "0.3.54" 1606 | source = "registry+https://github.com/rust-lang/crates.io-index" 1607 | checksum = "0a84d70d1ec7d2da2d26a5bd78f4bca1b8c3254805363ce743b7a05bc30d195a" 1608 | dependencies = [ 1609 | "js-sys", 1610 | "wasm-bindgen", 1611 | ] 1612 | 1613 | [[package]] 1614 | name = "webpki" 1615 | version = "0.21.4" 1616 | source = "registry+https://github.com/rust-lang/crates.io-index" 1617 | checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" 1618 | dependencies = [ 1619 | "ring", 1620 | "untrusted", 1621 | ] 1622 | 1623 | [[package]] 1624 | name = "webpki-roots" 1625 | version = "0.21.1" 1626 | source = "registry+https://github.com/rust-lang/crates.io-index" 1627 | checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" 1628 | dependencies = [ 1629 | "webpki", 1630 | ] 1631 | 1632 | [[package]] 1633 | name = "whoami" 1634 | version = "1.1.3" 1635 | source = "registry+https://github.com/rust-lang/crates.io-index" 1636 | checksum = "f7741161a40200a867c96dfa5574544efa4178cf4c8f770b62dd1cc0362d7ae1" 1637 | dependencies = [ 1638 | "wasm-bindgen", 1639 | "web-sys", 1640 | ] 1641 | 1642 | [[package]] 1643 | name = "winapi" 1644 | version = "0.3.9" 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" 1646 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1647 | dependencies = [ 1648 | "winapi-i686-pc-windows-gnu", 1649 | "winapi-x86_64-pc-windows-gnu", 1650 | ] 1651 | 1652 | [[package]] 1653 | name = "winapi-i686-pc-windows-gnu" 1654 | version = "0.4.0" 1655 | source = "registry+https://github.com/rust-lang/crates.io-index" 1656 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1657 | 1658 | [[package]] 1659 | name = "winapi-x86_64-pc-windows-gnu" 1660 | version = "0.4.0" 1661 | source = "registry+https://github.com/rust-lang/crates.io-index" 1662 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1663 | 1664 | [[package]] 1665 | name = "zeroize" 1666 | version = "1.3.0" 1667 | source = "registry+https://github.com/rust-lang/crates.io-index" 1668 | checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" 1669 | dependencies = [ 1670 | "zeroize_derive", 1671 | ] 1672 | 1673 | [[package]] 1674 | name = "zeroize_derive" 1675 | version = "1.1.0" 1676 | source = "registry+https://github.com/rust-lang/crates.io-index" 1677 | checksum = "a2c1e130bebaeab2f23886bf9acbaca14b092408c452543c857f66399cd6dab1" 1678 | dependencies = [ 1679 | "proc-macro2", 1680 | "quote", 1681 | "syn", 1682 | "synstructure", 1683 | ] 1684 | -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "api-service-demo" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = { version = "0.2.3" } 10 | sqlx = { version = "0.5.6", features = ["mysql", "runtime-tokio-rustls"] } 11 | tokio = { version = "1.11.0", features = ["full"] } 12 | serde = { version = "1.0", features = ["derive"] } 13 | tower = { version = "0.4", features = ["util", "timeout"] } 14 | tower-http = { version = "0.1", features = ["add-extension", "trace"] } 15 | uuid = { version = "0.8.2", features = ["serde", "v4"] } 16 | anyhow = "1.0.44" -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/app/controllers/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod shortlink_controller; -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/app/controllers/shortlink_controller.rs: -------------------------------------------------------------------------------- 1 | use axum::{Json, extract}; 2 | use crate::app::models::dto; 3 | use axum::extract::Extension; 4 | use axum::response::IntoResponse; 5 | use axum::http::{StatusCode, HeaderMap}; 6 | use crate::app::models::shortlink; 7 | use sqlx::{Pool, MySql}; 8 | use axum::http::header::LOCATION; 9 | 10 | pub async fn create_shortlink( 11 | Json(req): Json, 12 | Extension(pool): Extension>, 13 | ) -> impl IntoResponse { 14 | println!("{:#?}", req); 15 | match shortlink::create_shortlink(&pool, &req.url).await { 16 | Ok(_) => { 17 | (StatusCode::OK, Json(dto::CreateUserResp { 18 | ok: true 19 | })) 20 | } 21 | Err(_) => { 22 | (StatusCode::INTERNAL_SERVER_ERROR, Json(dto::CreateUserResp { 23 | ok: false 24 | })) 25 | } 26 | } 27 | } 28 | 29 | pub async fn delete_shortlink( 30 | Json(req): Json, 31 | Extension(pool): Extension>, 32 | ) -> impl IntoResponse { 33 | println!("{:#?}", req); 34 | match shortlink::delete_shortlink(&pool, req.id).await { 35 | Ok(_) => { 36 | (StatusCode::OK, Json(dto::DeleteShortLinkResp { 37 | ok: true 38 | })) 39 | } 40 | Err(_) => { 41 | (StatusCode::INTERNAL_SERVER_ERROR, Json(dto::DeleteShortLinkResp { 42 | ok: false 43 | })) 44 | } 45 | } 46 | } 47 | 48 | pub async fn get_shortlink( 49 | extract::Path(id): extract::Path, 50 | Extension(pool): Extension> 51 | ) -> impl IntoResponse { 52 | let mut url = "/api/not_found"; 53 | match shortlink::get_shortlink(&pool, id).await { 54 | Ok(record) => { 55 | url = Box::leak(record.url.into_boxed_str()); 56 | } 57 | Err(err) => { 58 | println!("err = {:#?}", err); 59 | } 60 | } 61 | 62 | let mut headers = HeaderMap::new(); 63 | headers.insert(LOCATION, url.parse().unwrap()); 64 | (StatusCode::FOUND, headers, ()) 65 | } 66 | 67 | pub async fn not_found() -> impl IntoResponse { 68 | (StatusCode::OK, "404 Not Found") 69 | } -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/app/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod controllers; 2 | pub mod models; -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/app/models/dto.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | #[derive(Debug, Serialize, Deserialize, Clone)] 4 | pub struct CreateShortLinkReq { 5 | pub url: String 6 | } 7 | 8 | #[derive(Debug, Serialize, Deserialize, Clone)] 9 | pub struct CreateUserResp { 10 | pub ok: bool, 11 | } 12 | 13 | #[derive(Debug, Serialize, Deserialize, Clone)] 14 | pub struct DeleteShortLinkReq { 15 | pub id: u64, 16 | } 17 | 18 | #[derive(Debug, Serialize, Deserialize, Clone)] 19 | pub struct DeleteShortLinkResp { 20 | pub ok: bool, 21 | } 22 | 23 | #[derive(Debug, Serialize, Deserialize, Clone)] 24 | pub struct ShortLinkInfoResp { 25 | pub id: u32, 26 | pub url: String 27 | } 28 | -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/app/models/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod shortlink; 2 | pub mod dto; 3 | -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/app/models/shortlink.rs: -------------------------------------------------------------------------------- 1 | use sqlx::{Error, MySql, Pool, FromRow}; 2 | use sqlx::mysql::MySqlQueryResult; 3 | use serde::{Deserialize, Serialize}; 4 | 5 | #[derive(Serialize, Deserialize, Debug, FromRow, Clone)] 6 | pub struct ShortLink { 7 | pub id: u32, 8 | pub url: String, 9 | } 10 | 11 | pub async fn create_shortlink(pool: &Pool, url: &str) -> Result { 12 | sqlx::query( 13 | r#" 14 | INSERT INTO short_links (`url`) 15 | VALUES(?)"#, 16 | ) 17 | .bind(url) 18 | .execute(pool).await 19 | } 20 | 21 | pub async fn delete_shortlink(pool: &Pool, id: u64) -> Result { 22 | sqlx::query( 23 | r#" 24 | DELETE FROM short_links 25 | WHERE id = ? 26 | "#, 27 | ) 28 | .bind(id) 29 | .execute(pool).await 30 | } 31 | 32 | pub async fn get_shortlink(pool: &Pool, id: i32) -> Result { 33 | sqlx::query_as::<_, ShortLink>( 34 | r#" 35 | SELECT * FROM short_links 36 | WHERE id = ? 37 | "#, 38 | ) 39 | .bind(id) 40 | .fetch_one(pool).await 41 | } 42 | -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/config/database.rs: -------------------------------------------------------------------------------- 1 | use sqlx::mysql::MySqlPoolOptions; 2 | use sqlx::{MySql, Pool}; 3 | 4 | pub async fn do_connect() -> Pool { 5 | let pool = MySqlPoolOptions::new() 6 | .max_connections(5) 7 | .connect("mysql://root:jkxsl12369@127.0.0.1/shorten_db").await; 8 | // .connect("mysql://sulin:databenD!9@localhost:3306/shorten_db").await; 9 | pool.unwrap() 10 | } 11 | -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/config/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod routes; 2 | pub mod database; -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/config/routes.rs: -------------------------------------------------------------------------------- 1 | use axum::handler::{post, get}; 2 | use axum::{Router, AddExtensionLayer}; 3 | use axum::routing::BoxRoute; 4 | 5 | use crate::app::controllers::shortlink_controller; 6 | use sqlx::{Pool, MySql}; 7 | 8 | pub fn app(pool: Pool) -> Router { 9 | Router::new() 10 | .route("/", get(|| async { "welcome to use axum!" })) 11 | .nest("/api", short_links()) 12 | .layer(AddExtensionLayer::new(pool)) 13 | .layer(tower_http::trace::TraceLayer::new_for_http()) 14 | .boxed() 15 | } 16 | 17 | pub fn short_links() -> Router { 18 | Router::new() 19 | .route("/create_shortlink", post(shortlink_controller::create_shortlink)) 20 | .route("/delete_shortlink", post(shortlink_controller::delete_shortlink)) 21 | .route("/:id", get(shortlink_controller::get_shortlink)) 22 | .route("/not_found", get(shortlink_controller::not_found)) 23 | .boxed() 24 | } -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/api-service-demo/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use std::net::SocketAddr; 3 | 4 | mod config; 5 | mod app; 6 | 7 | #[tokio::main] 8 | async fn main() -> Result<(), Box> { 9 | let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); 10 | let pool = config::database::do_connect().await; 11 | 12 | axum::Server::bind(&addr) 13 | .serve(config::routes::app(pool).into_make_service()) 14 | .await?; 15 | Ok(()) 16 | } -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/基于auxm+sqlx+mysql开发短链api.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/09-基于Rust Axum-web 和 MySQL 开发短链服务/基于auxm+sqlx+mysql开发短链api.pdf -------------------------------------------------------------------------------- /09-基于Rust Axum-web 和 MySQL 开发短链服务/表结构: -------------------------------------------------------------------------------- 1 | CREATE TABLE `short_links` ( 2 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, 3 | `url` varchar(255) NOT NULL DEFAULT '', 4 | PRIMARY KEY (`id`) 5 | ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; 6 | -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/10-使用Redis给短链服务加速/api-service-demo/.DS_Store -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "api-service-demo" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = { version = "0.2.3" } 10 | sqlx = { version = "0.5.6", features = ["mysql", "runtime-tokio-rustls"] } 11 | tokio = { version = "1.11.0", features = ["full"] } 12 | serde = { version = "1.0", features = ["derive"] } 13 | tower = { version = "0.4", features = ["util", "timeout"] } 14 | tower-http = { version = "0.1", features = ["add-extension", "trace"] } 15 | uuid = { version = "0.8.2", features = ["serde", "v4"] } 16 | anyhow = "1.0.44" 17 | redis = { version = "0.21", features = ["tokio-comp", "aio"] } -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/app/controllers/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod shortlink_controller; -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/app/controllers/shortlink_controller.rs: -------------------------------------------------------------------------------- 1 | use axum::{Json, extract}; 2 | use crate::app::models::dto; 3 | use axum::extract::Extension; 4 | use axum::response::IntoResponse; 5 | use axum::http::{StatusCode, HeaderMap, Request}; 6 | use crate::app::models::shortlink; 7 | use sqlx::{Pool, MySql}; 8 | use axum::http::header::LOCATION; 9 | use axum::body::Body; 10 | use redis::{Client, AsyncCommands, RedisResult}; 11 | use redis::aio::Connection; 12 | use std::sync::Arc; 13 | use tokio::sync::{RwLock, Mutex}; 14 | use std::ops::Deref; 15 | 16 | pub async fn create_shortlink( 17 | Json(req): Json, 18 | Extension(pool): Extension> 19 | ) -> impl IntoResponse { 20 | println!("{:#?}", req); 21 | match shortlink::create_shortlink(&pool, &req.url).await { 22 | Ok(_) => { 23 | (StatusCode::OK, Json(dto::CreateUserResp { 24 | ok: true 25 | })) 26 | } 27 | Err(_) => { 28 | (StatusCode::INTERNAL_SERVER_ERROR, Json(dto::CreateUserResp { 29 | ok: false 30 | })) 31 | } 32 | } 33 | } 34 | 35 | pub async fn delete_shortlink( 36 | Json(req): Json, 37 | Extension(pool): Extension>, 38 | ) -> impl IntoResponse { 39 | println!("{:#?}", req); 40 | match shortlink::delete_shortlink(&pool, req.id).await { 41 | Ok(_) => { 42 | (StatusCode::OK, Json(dto::DeleteShortLinkResp { 43 | ok: true 44 | })) 45 | } 46 | Err(_) => { 47 | (StatusCode::INTERNAL_SERVER_ERROR, Json(dto::DeleteShortLinkResp { 48 | ok: false 49 | })) 50 | } 51 | } 52 | } 53 | 54 | pub async fn get_shortlink( 55 | extract::Path(id): extract::Path, 56 | req: Request 57 | ) -> impl IntoResponse { 58 | let mut url = String::from("/api/not_found"); 59 | //let pool = req.extensions().get::>().unwrap(); 60 | let mut con = req.extensions().get::>>().unwrap().lock().await; 61 | let mut redis_key = String::from("url_"); 62 | redis_key.push_str(&*id.to_string()); 63 | let res: RedisResult = con.get(redis_key).await; 64 | match res { 65 | Ok(v) => { 66 | url = v; 67 | } 68 | Err(err) => { 69 | println!("err = {:#?}", err); 70 | } 71 | } 72 | // match shortlink::get_shortlink(pool, id).await { 73 | // Ok(record) => { 74 | // url = Box::leak(record.url.into_boxed_str()); 75 | // } 76 | // Err(err) => { 77 | // println!("err = {:#?}", err); 78 | // } 79 | // } 80 | let mut headers = HeaderMap::new(); 81 | headers.insert(LOCATION, url.parse().unwrap()); 82 | (StatusCode::FOUND, headers, ()) 83 | } 84 | 85 | pub async fn not_found() -> impl IntoResponse { 86 | (StatusCode::OK, "404 Not Found") 87 | } -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/app/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod controllers; 2 | pub mod models; -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/app/models/dto.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | #[derive(Debug, Serialize, Deserialize, Clone)] 4 | pub struct CreateShortLinkReq { 5 | pub url: String 6 | } 7 | 8 | #[derive(Debug, Serialize, Deserialize, Clone)] 9 | pub struct CreateUserResp { 10 | pub ok: bool, 11 | } 12 | 13 | #[derive(Debug, Serialize, Deserialize, Clone)] 14 | pub struct DeleteShortLinkReq { 15 | pub id: u64, 16 | } 17 | 18 | #[derive(Debug, Serialize, Deserialize, Clone)] 19 | pub struct DeleteShortLinkResp { 20 | pub ok: bool, 21 | } 22 | 23 | #[derive(Debug, Serialize, Deserialize, Clone)] 24 | pub struct ShortLinkInfoResp { 25 | pub id: u32, 26 | pub url: String 27 | } 28 | -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/app/models/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod shortlink; 2 | pub mod dto; 3 | -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/app/models/shortlink.rs: -------------------------------------------------------------------------------- 1 | use sqlx::{Error, MySql, Pool, FromRow}; 2 | use sqlx::mysql::MySqlQueryResult; 3 | use serde::{Deserialize, Serialize}; 4 | 5 | #[derive(Serialize, Deserialize, Debug, FromRow, Clone)] 6 | pub struct ShortLink { 7 | pub id: u32, 8 | pub url: String, 9 | } 10 | 11 | pub async fn create_shortlink(pool: &Pool, url: &str) -> Result { 12 | sqlx::query( 13 | r#" 14 | INSERT INTO short_links (`url`) 15 | VALUES(?)"#, 16 | ) 17 | .bind(url) 18 | .execute(pool).await 19 | } 20 | 21 | pub async fn delete_shortlink(pool: &Pool, id: u64) -> Result { 22 | sqlx::query( 23 | r#" 24 | DELETE FROM short_links 25 | WHERE id = ? 26 | "#, 27 | ) 28 | .bind(id) 29 | .execute(pool).await 30 | } 31 | 32 | // pub async fn get_shortlink(pool: &Pool, id: i32) -> Result { 33 | // sqlx::query_as::<_, ShortLink>( 34 | // r#" 35 | // SELECT * FROM short_links 36 | // WHERE id = ? 37 | // "#, 38 | // ) 39 | // .bind(id) 40 | // .fetch_one(pool).await 41 | // } 42 | -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/config/database.rs: -------------------------------------------------------------------------------- 1 | use sqlx::mysql::MySqlPoolOptions; 2 | use sqlx::{MySql, Pool}; 3 | use redis::Client; 4 | use redis::aio::Connection; 5 | 6 | pub async fn do_connect() -> Pool { 7 | let pool = MySqlPoolOptions::new() 8 | .max_connections(5) 9 | .connect("mysql://root:jkxsl12369@127.0.0.1/shorten_db").await; 10 | pool.unwrap() 11 | } 12 | 13 | pub async fn do_redis_connect() -> Connection { 14 | let client = redis::Client::open("redis://127.0.0.1/").unwrap(); 15 | client.get_async_connection().await.unwrap() 16 | } 17 | -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/config/env.rs: -------------------------------------------------------------------------------- 1 | // use sqlx::{Pool, MySql}; 2 | // use redis::aio::Connection; 3 | // use std::sync::Arc; 4 | // 5 | // #[derive(Clone, Debug)] 6 | // pub struct Environment { 7 | // mysql_conn: Pool, 8 | // redis_conn: Arc::new 9 | // } 10 | // 11 | // impl Environment { 12 | // pub async fn new(mysql_conn: Pool, redis_conn: Arc::new) -> anyhow::Result { 13 | // Ok(Self { 14 | // mysql_conn, 15 | // redis_conn 16 | // }) 17 | // } 18 | // 19 | // pub fn db(self) -> Pool { 20 | // self.mysql_conn 21 | // } 22 | // 23 | // pub fn clients(self) -> Arc::new { 24 | // self.redis_conn 25 | // } 26 | // } -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/config/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod routes; 2 | pub mod database; 3 | pub mod env; -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/config/routes.rs: -------------------------------------------------------------------------------- 1 | use axum::handler::{post, get}; 2 | use axum::{Router, AddExtensionLayer}; 3 | use axum::routing::BoxRoute; 4 | use redis::Client; 5 | 6 | use crate::app::controllers::shortlink_controller; 7 | use sqlx::{Pool, MySql}; 8 | use redis::aio::Connection; 9 | use std::sync::Arc; 10 | use tokio::sync::{RwLock, Mutex}; 11 | 12 | pub fn app(pool: Pool, redis_client: Connection) -> Router { 13 | Router::new() 14 | .route("/", get(|| async { "welcome to use axum!" })) 15 | .nest("/api", short_links()) 16 | .layer(AddExtensionLayer::new(pool)) 17 | .layer(AddExtensionLayer::new(Arc::new(Mutex::new(redis_client)))) 18 | .layer(tower_http::trace::TraceLayer::new_for_http()) 19 | .boxed() 20 | } 21 | 22 | pub fn short_links() -> Router { 23 | Router::new() 24 | .route("/create_shortlink", post(shortlink_controller::create_shortlink)) 25 | .route("/delete_shortlink", post(shortlink_controller::delete_shortlink)) 26 | .route("/:id", get(shortlink_controller::get_shortlink)) 27 | .route("/not_found", get(shortlink_controller::not_found)) 28 | .boxed() 29 | } -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/api-service-demo/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use std::net::SocketAddr; 3 | 4 | mod config; 5 | mod app; 6 | 7 | #[tokio::main] 8 | async fn main() -> Result<(), Box> { 9 | let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); 10 | let pool = config::database::do_connect().await; 11 | let redis_client = config::database::do_redis_connect().await; 12 | axum::Server::bind(&addr) 13 | .serve(config::routes::app(pool, redis_client).into_make_service()) 14 | .await?; 15 | Ok(()) 16 | } -------------------------------------------------------------------------------- /10-使用Redis给短链服务加速/ten-使用Redis给短链服务加速.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/10-使用Redis给短链服务加速/ten-使用Redis给短链服务加速.pdf -------------------------------------------------------------------------------- /11-实战-使用 Rust 开发动态链接库并在 Golang中使用-上/实战:使用 Rust 开发动态链接库并在 Golang中使用(上)乎.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/11-实战-使用 Rust 开发动态链接库并在 Golang中使用-上/实战:使用 Rust 开发动态链接库并在 Golang中使用(上)乎.pdf -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/12-初探Rust微服务架构(gRPC+Tonic)/.DS_Store -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/12-初探Rust微服务架构(gRPC+Tonic).pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/12-初探Rust微服务架构(gRPC+Tonic)/12-初探Rust微服务架构(gRPC+Tonic).pdf -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/.DS_Store -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "api-service-demo" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [[bin]] # 用来运行 HelloWorld gRPC 服务器的可执行文件 9 | name = "shortlink-server" 10 | path = "src/server.rs" 11 | 12 | [dependencies] 13 | tonic = "0.5" 14 | prost = "0.8" 15 | axum = { version = "0.2.3" } 16 | sqlx = { version = "0.5.6", features = ["mysql", "runtime-tokio-rustls"] } 17 | tokio = { version = "1.11.0", features = ["full"] } 18 | serde = { version = "1.0", features = ["derive"] } 19 | tower = { version = "0.4", features = ["util", "timeout"] } 20 | tower-http = { version = "0.1", features = ["add-extension", "trace"] } 21 | uuid = { version = "0.8.2", features = ["serde", "v4"] } 22 | anyhow = "1.0.44" 23 | redis = { version = "0.21", features = ["tokio-comp", "aio"] } 24 | 25 | [build-dependencies] 26 | tonic-build = "0.5" -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/build.rs: -------------------------------------------------------------------------------- 1 | fn main() -> Result<(), Box> { 2 | println!("======"); 3 | tonic_build::compile_protos("proto/shortlink.proto")?; 4 | Ok(()) 5 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/proto/shortlink.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package shortlink; 3 | 4 | service ShortLink { 5 | rpc GetInfo(ShortLinkRequest) returns (ShortLinkReply); 6 | } 7 | 8 | message ShortLinkRequest { 9 | int32 id = 1; 10 | } 11 | 12 | message ShortLinkReply { 13 | string url = 1; 14 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/app/controllers/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod shortlink_controller; -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/app/controllers/shortlink_controller.rs: -------------------------------------------------------------------------------- 1 | use axum::{Json, extract}; 2 | use crate::app::models::dto; 3 | use axum::extract::Extension; 4 | use axum::response::IntoResponse; 5 | use axum::http::{StatusCode, HeaderMap, Request}; 6 | use crate::app::models::shortlink; 7 | use sqlx::{Pool, MySql}; 8 | use axum::http::header::LOCATION; 9 | use axum::body::Body; 10 | use redis::{Client, AsyncCommands, RedisResult}; 11 | use redis::aio::Connection; 12 | use std::sync::Arc; 13 | use tokio::sync::{RwLock, Mutex}; 14 | use std::ops::Deref; 15 | 16 | pub async fn create_shortlink( 17 | Json(req): Json, 18 | Extension(pool): Extension> 19 | ) -> impl IntoResponse { 20 | println!("{:#?}", req); 21 | match shortlink::create_shortlink(&pool, &req.url).await { 22 | Ok(_) => { 23 | (StatusCode::OK, Json(dto::CreateUserResp { 24 | ok: true 25 | })) 26 | } 27 | Err(_) => { 28 | (StatusCode::INTERNAL_SERVER_ERROR, Json(dto::CreateUserResp { 29 | ok: false 30 | })) 31 | } 32 | } 33 | } 34 | 35 | pub async fn delete_shortlink( 36 | Json(req): Json, 37 | Extension(pool): Extension>, 38 | ) -> impl IntoResponse { 39 | println!("{:#?}", req); 40 | match shortlink::delete_shortlink(&pool, req.id).await { 41 | Ok(_) => { 42 | (StatusCode::OK, Json(dto::DeleteShortLinkResp { 43 | ok: true 44 | })) 45 | } 46 | Err(_) => { 47 | (StatusCode::INTERNAL_SERVER_ERROR, Json(dto::DeleteShortLinkResp { 48 | ok: false 49 | })) 50 | } 51 | } 52 | } 53 | 54 | pub async fn get_shortlink( 55 | extract::Path(id): extract::Path, 56 | req: Request 57 | ) -> impl IntoResponse { 58 | let mut url = String::from("/api/not_found"); 59 | //let pool = req.extensions().get::>().unwrap(); 60 | let mut con = req.extensions().get::>>().unwrap().lock().await; 61 | let mut redis_key = String::from("url_"); 62 | redis_key.push_str(&*id.to_string()); 63 | let res: RedisResult = con.get(redis_key).await; 64 | match res { 65 | Ok(v) => { 66 | url = v; 67 | } 68 | Err(err) => { 69 | println!("err = {:#?}", err); 70 | } 71 | } 72 | // match shortlink::get_shortlink(pool, id).await { 73 | // Ok(record) => { 74 | // url = Box::leak(record.url.into_boxed_str()); 75 | // } 76 | // Err(err) => { 77 | // println!("err = {:#?}", err); 78 | // } 79 | // } 80 | let mut headers = HeaderMap::new(); 81 | headers.insert(LOCATION, url.parse().unwrap()); 82 | (StatusCode::FOUND, headers, ()) 83 | } 84 | 85 | pub async fn not_found() -> impl IntoResponse { 86 | (StatusCode::OK, "404 Not Found") 87 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/app/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod controllers; 2 | pub mod models; -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/app/models/dto.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | #[derive(Debug, Serialize, Deserialize, Clone)] 4 | pub struct CreateShortLinkReq { 5 | pub url: String 6 | } 7 | 8 | #[derive(Debug, Serialize, Deserialize, Clone)] 9 | pub struct CreateUserResp { 10 | pub ok: bool, 11 | } 12 | 13 | #[derive(Debug, Serialize, Deserialize, Clone)] 14 | pub struct DeleteShortLinkReq { 15 | pub id: u64, 16 | } 17 | 18 | #[derive(Debug, Serialize, Deserialize, Clone)] 19 | pub struct DeleteShortLinkResp { 20 | pub ok: bool, 21 | } 22 | 23 | #[derive(Debug, Serialize, Deserialize, Clone)] 24 | pub struct ShortLinkInfoResp { 25 | pub id: u32, 26 | pub url: String 27 | } 28 | -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/app/models/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod shortlink; 2 | pub mod dto; 3 | -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/app/models/shortlink.rs: -------------------------------------------------------------------------------- 1 | use sqlx::{Error, MySql, Pool, FromRow}; 2 | use sqlx::mysql::MySqlQueryResult; 3 | use serde::{Deserialize, Serialize}; 4 | 5 | #[derive(Serialize, Deserialize, Debug, FromRow, Clone)] 6 | pub struct ShortLink { 7 | pub id: u32, 8 | pub url: String, 9 | } 10 | 11 | pub async fn create_shortlink(pool: &Pool, url: &str) -> Result { 12 | sqlx::query( 13 | r#" 14 | INSERT INTO short_links (`url`) 15 | VALUES(?)"#, 16 | ) 17 | .bind(url) 18 | .execute(pool).await 19 | } 20 | 21 | pub async fn delete_shortlink(pool: &Pool, id: u64) -> Result { 22 | sqlx::query( 23 | r#" 24 | DELETE FROM short_links 25 | WHERE id = ? 26 | "#, 27 | ) 28 | .bind(id) 29 | .execute(pool).await 30 | } 31 | 32 | // pub async fn get_shortlink(pool: &Pool, id: i32) -> Result { 33 | // sqlx::query_as::<_, ShortLink>( 34 | // r#" 35 | // SELECT * FROM short_links 36 | // WHERE id = ? 37 | // "#, 38 | // ) 39 | // .bind(id) 40 | // .fetch_one(pool).await 41 | // } 42 | -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/config/database.rs: -------------------------------------------------------------------------------- 1 | use sqlx::mysql::MySqlPoolOptions; 2 | use sqlx::{MySql, Pool}; 3 | use redis::Client; 4 | use redis::aio::Connection; 5 | 6 | pub async fn do_connect() -> Pool { 7 | let pool = MySqlPoolOptions::new() 8 | .max_connections(5) 9 | .connect("mysql://root:jkxsl12369@127.0.0.1/shorten_db").await; 10 | pool.unwrap() 11 | } 12 | 13 | pub async fn do_redis_connect() -> Connection { 14 | let client = redis::Client::open("redis://127.0.0.1/").unwrap(); 15 | client.get_async_connection().await.unwrap() 16 | } 17 | -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/config/env.rs: -------------------------------------------------------------------------------- 1 | // use sqlx::{Pool, MySql}; 2 | // use redis::aio::Connection; 3 | // use std::sync::Arc; 4 | // 5 | // #[derive(Clone, Debug)] 6 | // pub struct Environment { 7 | // mysql_conn: Pool, 8 | // redis_conn: Arc::new 9 | // } 10 | // 11 | // impl Environment { 12 | // pub async fn new(mysql_conn: Pool, redis_conn: Arc::new) -> anyhow::Result { 13 | // Ok(Self { 14 | // mysql_conn, 15 | // redis_conn 16 | // }) 17 | // } 18 | // 19 | // pub fn db(self) -> Pool { 20 | // self.mysql_conn 21 | // } 22 | // 23 | // pub fn clients(self) -> Arc::new { 24 | // self.redis_conn 25 | // } 26 | // } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/config/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod routes; 2 | pub mod database; 3 | pub mod env; -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/config/routes.rs: -------------------------------------------------------------------------------- 1 | use axum::handler::{post, get}; 2 | use axum::{Router, AddExtensionLayer}; 3 | use axum::routing::BoxRoute; 4 | use redis::Client; 5 | 6 | use crate::app::controllers::shortlink_controller; 7 | use sqlx::{Pool, MySql}; 8 | use redis::aio::Connection; 9 | use std::sync::Arc; 10 | use tokio::sync::{RwLock, Mutex}; 11 | 12 | pub fn app(pool: Pool, redis_client: Connection) -> Router { 13 | Router::new() 14 | .route("/", get(|| async { "welcome to use axum!" })) 15 | .nest("/api", short_links()) 16 | .layer(AddExtensionLayer::new(pool)) 17 | .layer(AddExtensionLayer::new(Arc::new(Mutex::new(redis_client)))) 18 | .layer(tower_http::trace::TraceLayer::new_for_http()) 19 | .boxed() 20 | } 21 | 22 | pub fn short_links() -> Router { 23 | Router::new() 24 | .route("/create_shortlink", post(shortlink_controller::create_shortlink)) 25 | .route("/delete_shortlink", post(shortlink_controller::delete_shortlink)) 26 | .route("/:id", get(shortlink_controller::get_shortlink)) 27 | .route("/not_found", get(shortlink_controller::not_found)) 28 | .boxed() 29 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use std::net::SocketAddr; 3 | 4 | mod config; 5 | mod app; 6 | 7 | #[tokio::main] 8 | async fn main() -> Result<(), Box> { 9 | let addr = SocketAddr::from(([0, 0, 0, 0], 3000)); 10 | let pool = config::database::do_connect().await; 11 | let redis_client = config::database::do_redis_connect().await; 12 | axum::Server::bind(&addr) 13 | .serve(config::routes::app(pool, redis_client).into_make_service()) 14 | .await?; 15 | Ok(()) 16 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/api-service-demo/src/server.rs: -------------------------------------------------------------------------------- 1 | use tonic::{transport::Server, Request, Response, Status}; 2 | 3 | use short_link::short_link_server::{ShortLink, ShortLinkServer}; 4 | 5 | use short_link::{ShortLinkReply, ShortLinkRequest}; 6 | 7 | pub mod short_link { 8 | tonic::include_proto!("shortlink"); 9 | } 10 | 11 | #[derive(Debug, Default)] 12 | pub struct MyShortLink {} 13 | 14 | #[tonic::async_trait] 15 | impl ShortLink for MyShortLink { 16 | async fn get_info( 17 | &self, 18 | request: Request, 19 | ) -> Result, Status> { 20 | println!("Got a request: {:?}", request); 21 | 22 | // todo: 需要实现根据request.id来查询数据库和读redis, 这些都是上次公开课说过的, 所以就不写了 23 | let reply = short_link::ShortLinkReply { 24 | url: String::from("http://www.baidu.com"), 25 | }; 26 | 27 | Ok(Response::new(reply)) 28 | } 29 | } 30 | 31 | #[tokio::main] 32 | async fn main() -> Result<(), Box> { 33 | let addr = "[::1]:50052".parse()?; 34 | let shortlink = MyShortLink::default(); 35 | 36 | Server::builder() 37 | .add_service(ShortLinkServer::new(shortlink)) 38 | .serve(addr) 39 | .await?; 40 | 41 | Ok(()) 42 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/.DS_Store -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "helloworld-tonic" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [[bin]] # 用来运行 HelloWorld gRPC 服务器的可执行文件 9 | name = "helloworld-server" 10 | path = "src/server.rs" 11 | 12 | [[bin]] # 用来运行 HelloWorld gRPC 客户端的可执行文件 13 | name = "helloworld-client" 14 | path = "src/client.rs" 15 | 16 | [dependencies] 17 | tonic = "0.5" 18 | prost = "0.8" 19 | tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } 20 | 21 | [build-dependencies] 22 | tonic-build = "0.5" -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/build.rs: -------------------------------------------------------------------------------- 1 | fn main() -> Result<(), Box> { 2 | tonic_build::compile_protos("proto/helloworld.proto")?; 3 | Ok(()) 4 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/proto/helloworld.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package helloworld; 3 | 4 | service Greeter { 5 | rpc SayHello(HelloRequest) returns (HelloReply); 6 | } 7 | 8 | message HelloRequest { 9 | string name = 1; 10 | } 11 | 12 | message HelloReply { 13 | string message = 1; 14 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/src/client.rs: -------------------------------------------------------------------------------- 1 | use hello_world::greeter_client::GreeterClient; 2 | use hello_world::HelloRequest; 3 | pub mod hello_world { 4 | tonic::include_proto!("helloworld"); 5 | } 6 | 7 | #[tokio::main] 8 | async fn main() -> Result<(), Box> { 9 | let mut client = GreeterClient::connect("http://[::1]:50051").await?; 10 | 11 | let request = tonic::Request::new(HelloRequest { 12 | name: "Tonic".into(), 13 | }); 14 | 15 | let response = client.say_hello(request).await?; 16 | 17 | println!("RESPONSE={:?}", response); 18 | 19 | Ok(()) 20 | } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/src/main.rs: -------------------------------------------------------------------------------- 1 | // fn main() -> Result<(), Box> { 2 | // tonic_build::configure() 3 | // .build_server(false) 4 | // .compile( 5 | // &["proto/helloworld/helloworld.proto"], 6 | // &["proto/helloworld"], 7 | // )?; 8 | // Ok(()) 9 | // } -------------------------------------------------------------------------------- /12-初探Rust微服务架构(gRPC+Tonic)/helloworld-tonic/src/server.rs: -------------------------------------------------------------------------------- 1 | use tonic::{transport::Server, Request, Response, Status}; 2 | 3 | use hello_world::greeter_server::{Greeter, GreeterServer}; 4 | use hello_world::{HelloReply, HelloRequest}; 5 | 6 | pub mod hello_world { 7 | tonic::include_proto!("helloworld"); 8 | } 9 | 10 | #[derive(Debug, Default)] 11 | pub struct MyGreeter {} 12 | 13 | #[tonic::async_trait] 14 | impl Greeter for MyGreeter { 15 | async fn say_hello( 16 | &self, 17 | request: Request, 18 | ) -> Result, Status> { 19 | println!("Got a request: {:?}", request); 20 | 21 | let reply = hello_world::HelloReply { 22 | message: format!("Hello {}!", request.into_inner().name).into(), 23 | }; 24 | 25 | Ok(Response::new(reply)) 26 | } 27 | } 28 | 29 | #[tokio::main] 30 | async fn main() -> Result<(), Box> { 31 | let addr = "[::1]:50051".parse()?; 32 | let greeter = MyGreeter::default(); 33 | 34 | Server::builder() 35 | .add_service(GreeterServer::new(greeter)) 36 | .serve(addr) 37 | .await?; 38 | 39 | Ok(()) 40 | } -------------------------------------------------------------------------------- /13-Databend 如何做测试品控/databend-workflow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/13-Databend 如何做测试品控/databend-workflow.pdf -------------------------------------------------------------------------------- /14-探讨Rust异步编程框架Mio/探讨Rust异步编程框架Mio.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/14-探讨Rust异步编程框架Mio/探讨Rust异步编程框架Mio.pdf -------------------------------------------------------------------------------- /15-探讨为什么Pin在Rust异步编程中如此重要/learn-pin/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "learn-pin" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | rand = "0.8.4" 10 | -------------------------------------------------------------------------------- /15-探讨为什么Pin在Rust异步编程中如此重要/learn-pin/src/example.rs: -------------------------------------------------------------------------------- 1 | use std::future::Future; 2 | use std::pin::Pin; 3 | use std::task::{Context, Poll}; 4 | 5 | struct StartState { 6 | min_len: usize, 7 | } 8 | 9 | struct WaitingOnFooTxtState { 10 | min_len: usize, 11 | foo_txt_future: impl Future, 12 | } 13 | 14 | struct WaitingOnBarTxtState { 15 | content: String, 16 | bar_txt_future: impl Future, 17 | } 18 | 19 | struct EndState {} 20 | 21 | enum ExampleStateMachine { 22 | Start(StartState), 23 | WaitingOnFooTxt(WaitingOnFooTxtState), 24 | WaitingOnBarTxt(WaitingOnBarTxtState), 25 | End(EndState), 26 | } 27 | 28 | impl Future for ExampleStateMachine { 29 | type Output = String; // return type of `example` 30 | 31 | fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll { 32 | loop { 33 | match self { // TODO: handle pinning 34 | ExampleStateMachine::Start(state) => { 35 | // from body of `example` 36 | let foo_txt_future = async_read_file("foo.txt"); 37 | // `.await` operation 38 | let state = WaitingOnFooTxtState { 39 | min_len: state.min_len, 40 | foo_txt_future, 41 | }; 42 | *self = ExampleStateMachine::WaitingOnFooTxt(state); 43 | } 44 | ExampleStateMachine::WaitingOnFooTxt(state) => { 45 | match state.foo_txt_future.poll(cx) { 46 | Poll::Pending => return Poll::Pending, 47 | Poll::Ready(content) => { 48 | // from body of `example` 49 | if content.len() < state.min_len { 50 | let bar_txt_future = async_read_file("bar.txt"); 51 | // `.await` operation 52 | let state = WaitingOnBarTxtState { 53 | content, 54 | bar_txt_future, 55 | }; 56 | *self = ExampleStateMachine::WaitingOnBarTxt(state); 57 | } else { 58 | *self = ExampleStateMachine::End(EndState)); 59 | return Poll::Ready(content); 60 | } 61 | } 62 | } 63 | } 64 | ExampleStateMachine::WaitingOnBarTxt(state) => { 65 | match state.bar_txt_future.poll(cx) { 66 | Poll::Pending => return Poll::Pending, 67 | Poll::Ready(bar_txt) => { 68 | *self = ExampleStateMachine::End(EndState)); 69 | // from body of `example` 70 | return Poll::Ready(state.content + &bar_txt); 71 | } 72 | } 73 | } 74 | ExampleStateMachine::End(state) => { 75 | panic!("poll called after Poll::Ready was returned"); 76 | } 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /15-探讨为什么Pin在Rust异步编程中如此重要/learn-pin/src/main.rs: -------------------------------------------------------------------------------- 1 | struct Test { 2 | a: String, 3 | b: *const String, // 改成指针 4 | } 5 | 6 | impl Test { 7 | fn new(txt: &str) -> Self { 8 | Test { 9 | a: String::from(txt), 10 | b: std::ptr::null(), 11 | } 12 | } 13 | 14 | fn init(&mut self) { 15 | let self_ref: *const String = &self.a; 16 | self.b = self_ref; 17 | } 18 | 19 | fn b(&self) -> &String { 20 | unsafe {&*(self.b)} 21 | } 22 | } 23 | 24 | fn main() { 25 | let mut test1 = Test::new("test1"); 26 | test1.init(); 27 | 28 | let mut test2 = Test::new("test2"); 29 | test2.init(); 30 | 31 | println!("a: {}, b: {}", test1.a, test1.b()); 32 | 33 | // 使用swap()函数交换两者, 这里发生了move 34 | std::mem::swap(&mut test1, &mut test2); 35 | 36 | test1.a = "xxxxxxx".to_string(); 37 | 38 | println!("a: {}, b: {}", test2.a, test2.b()); 39 | } -------------------------------------------------------------------------------- /15-探讨为什么Pin在Rust异步编程中如此重要/learn-pin/src/main1.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let mut s1 = String::from("Hello"); 3 | let s2 = s1; // s1的所有权转移给了s2,这里发生了move 4 | // let s3 = s1; // s1的所有权以及转移走了,不能再move,否则会报错:error[E0382]: use of moved value: `s1` 5 | } -------------------------------------------------------------------------------- /15-探讨为什么Pin在Rust异步编程中如此重要/探讨为什么Pin在Rust异步编程中如此重要.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/15-探讨为什么Pin在Rust异步编程中如此重要/探讨为什么Pin在Rust异步编程中如此重要.pdf -------------------------------------------------------------------------------- /16-通过Futures库分析加深对Rust异步机制的理解/通过对futures库分析加深对 Rust 异步运行时的理解.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/16-通过Futures库分析加深对Rust异步机制的理解/通过对futures库分析加深对 Rust 异步运行时的理解.pdf -------------------------------------------------------------------------------- /17-探讨Rust智能指针/探讨Rust智能指针.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/17-探讨Rust智能指针/探讨Rust智能指针.pdf -------------------------------------------------------------------------------- /18-Databend_in_github/databend_github.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/18-Databend_in_github/databend_github.pdf -------------------------------------------------------------------------------- /19-探讨Rust智能指针II/探讨Rust智能指针 2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/19-探讨Rust智能指针II/探讨Rust智能指针 2.pdf -------------------------------------------------------------------------------- /20-Serverless-SQL-Database/Serverless SQL database.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/20-Serverless-SQL-Database/Serverless SQL database.pdf -------------------------------------------------------------------------------- /21-探讨Rust中的Trait/探讨Rust中的Trait.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/21-探讨Rust中的Trait/探讨Rust中的Trait.pdf -------------------------------------------------------------------------------- /22-聊一聊Rust生命周期/聊一聊Rust生命周期.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/22-聊一聊Rust生命周期/聊一聊Rust生命周期.pdf -------------------------------------------------------------------------------- /23-succinct trie/readme.md: -------------------------------------------------------------------------------- 1 | blog: https://blog.openacid.com/algo/succinctset/ 2 | 3 | code: https://github.com/openacid/succinct/tree/loc100 4 | 5 | B站回放: https://www.bilibili.com/video/BV1b34y1X7Sc/ -------------------------------------------------------------------------------- /23-succinct trie/succinct-trie.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/23-succinct trie/succinct-trie.pdf -------------------------------------------------------------------------------- /24-performance-tuning-in-databend/performance-tuning-in-databend.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/24-performance-tuning-in-databend/performance-tuning-in-databend.pdf -------------------------------------------------------------------------------- /25-第一课-rust入门基本原理-1-rust内存模型/第一课 Rust入门.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/25-第一课-rust入门基本原理-1-rust内存模型/第一课 Rust入门.pdf -------------------------------------------------------------------------------- /26-第一课-rust入门基本原理-2-rust所有权机制-借用规则/第一课 Rust入门基本原理(2) .pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/26-第一课-rust入门基本原理-2-rust所有权机制-借用规则/第一课 Rust入门基本原理(2) .pdf -------------------------------------------------------------------------------- /27-第二课-rust类型系统/第二课 Rust类型系统.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/27-第二课-rust类型系统/第二课 Rust类型系统.pdf -------------------------------------------------------------------------------- /28-第三课-如何优雅的处理错误/第三课 如何优雅的处理错误.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/28-第三课-如何优雅的处理错误/第三课 如何优雅的处理错误.pdf -------------------------------------------------------------------------------- /29-第四课-Cargo包管理/第四课 cargo包管理.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/29-第四课-Cargo包管理/第四课 cargo包管理.pdf -------------------------------------------------------------------------------- /30-第五课-如何编写测试1/第五课 如何编写测试.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/30-第五课-如何编写测试1/第五课 如何编写测试.pdf -------------------------------------------------------------------------------- /31-第五课-如何编写测试2/第五课 如何编写测试 2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/31-第五课-如何编写测试2/第五课 如何编写测试 2.pdf -------------------------------------------------------------------------------- /32-第六课-理解Rust宏/rust_macro_study.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/32-第六课-理解Rust宏/rust_macro_study.zip -------------------------------------------------------------------------------- /32-第六课-理解Rust宏/第六课 理解Rust宏.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/32-第六课-理解Rust宏/第六课 理解Rust宏.pdf -------------------------------------------------------------------------------- /33-第七课-Rust异步编程/第七课 Rust异步编程.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/33-第七课-Rust异步编程/第七课 Rust异步编程.pdf -------------------------------------------------------------------------------- /34-第八课-unsafe-rust/第八课 unsafe rust.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/34-第八课-unsafe-rust/第八课 unsafe rust.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rust-in-databend 2 | 3 | Rust 培养提高计划 4 | 5 | 该课程是由 Datafuse Labs 发起,联合 Rust 语言中文社区 , 知数堂联合承办。 6 | 7 | Databend 项目地址: https://github.com/datafuselabs/databend 8 | 欢迎 Star | Watch | Fork 9 | 10 | 往期视频回看: https://space.bilibili.com/275673537/channel/detail?cid=200962&ctype=0 11 | 12 | 如果对课程有建议或是想参与进来,也可以提 issue 交流。 13 | 14 | ![](img/学习二维码.png) 15 | 16 | ## 课程同步地址: 17 | - 腾讯会议: https://meeting.tencent.com/dm/dOCkBrbQZtKx 腾讯会议:974-4046-2341 18 | - PPT发布: https://github.com/wubx/rust-in-databend 19 | - B站视频回放: https://space.bilibili.com/275673537 20 | - Databend公众号: Databend 21 | - Rust中文社区 : rustcc.cn 22 | 23 | 目前课程分为 : 周四晚上,周日晚上,其中周四晚上不是一个固定时间(课程内容属于邀请制), 周日晚上的内容定位在一个系统教学内容。 24 | -------------------------------------------------------------------------------- /img/学习二维码.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wubx/rust-in-databend/319305d39c9415936a62880126484dd3047acdf7/img/学习二维码.png --------------------------------------------------------------------------------