├── LICENSE ├── README.md ├── chat_serv ├── Cargo.lock ├── Cargo.toml └── src │ ├── j_read.rs │ ├── j_write.rs │ └── main.rs ├── chatbox ├── Cargo.lock ├── Cargo.toml └── src │ └── lib.rs ├── mdrend ├── Cargo.lock ├── Cargo.toml ├── src │ └── main.rs └── test_data │ └── hello.md ├── pgrep ├── Cargo.lock ├── Cargo.toml ├── src │ └── main.rs └── test_data │ ├── t1.txt │ └── t2.txt ├── shop_base ├── Cargo.lock ├── Cargo.toml ├── diesel.toml ├── migrations │ ├── 00000000000000_diesel_initial_setup │ │ ├── down.sql │ │ └── up.sql │ └── 2019-03-26-103937_create_items │ │ ├── down.sql │ │ └── up.sql └── src │ ├── cli.rs │ ├── lib.rs │ ├── models.rs │ └── schema.rs └── shop_site ├── Cargo.lock ├── Cargo.toml ├── src └── main.rs └── test_site ├── static └── index.html └── templates └── item_list.html /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Packt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Rust-Projects 5 | This is the code repository for [Rust Projects [Video]](https://www.packtpub.com/in/programming/rust-projects-video), published by [Packt](https://www.packtpub.com/?utm_source=github). It contains all the supporting project files necessary to work through the video course from start to finish. 6 | ## About the Video Course 7 | The Rust programming language is a boon for systems programmers because of its powerful and expressive type system and strict compile-time static analysis. Still, there are best practices to follow and idioms that the community has developed over time. This course tackles testing, building and distributing applications, and other real-world challenges using Rust, Cargo, and the Rustup toolchain manager. 8 | You will build four projects, including a search tool, a Markdown parser, a chat server and client, and a blog. In this course, we’ll progress from command line applications, built with proper command line argument parsing and error handling, to more complex applications like a GUI text editor and several web applications. We’ll explore asynchronous programming and concurrent programming in Rust using real-world scenarios like file searching and stress testing. Finally, we’ll build a simple web app that interacts with a database in a type-safe manner using Diesel. 9 | By the end of the course, you will be adept with the knowledge of Rust to practically implement it in real-world projects. You’ll know enough to build high-quality software that can be shared with the rest of the Rust community or even used in production. 10 | 11 | The code bundle for this video course is available at: https://github.com/PacktPublishing/Rust-Projects 12 | 13 |

What You Will Learn

14 |
15 |
22 | 23 | ## Instructions and Navigation 24 | ### Assumed Knowledge 25 | To fully benefit from the coverage included in this course, you will need:
26 | This video is for Rust developers who would like to practically implement the Rust programming knowledge. Basic Rust knowledge is assumed. 27 | ### Technical Requirements 28 | This course has the following software requirements:
29 | Operating system: Windows/Mac/Linux Ubuntu
30 | Browser: Any
31 | Rustup >1.11, downloadable at https://rustup.rs/
32 | PostgreSQL 9 or 10, downloadable at https://www.postgresql.org/
33 | 34 | 35 | 36 | 37 | ## Related Products 38 | [Web Services/REST API Testing with SoapUI+ Real Time Projects [Video]](https://www.packtpub.com/in/application-development/webservicesrest-api-testing-soapui-real-time-projects) 39 | 40 | [Hyperledger for Blockchain Applications [Video]](https://www.packtpub.com/in/application-development/hyperledger-blockchain-applications-video) 41 | 42 | [RUST: The Easy Way [Video]](https://www.packtpub.com/in/application-development/rustthe-easy-way-video) 43 | -------------------------------------------------------------------------------- /chat_serv/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "arrayvec" 3 | version = "0.4.10" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "autocfg" 11 | version = "0.1.2" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | 14 | [[package]] 15 | name = "backtrace" 16 | version = "0.3.14" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | dependencies = [ 19 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 20 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", 21 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 22 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 23 | "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 24 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 25 | ] 26 | 27 | [[package]] 28 | name = "backtrace-sys" 29 | version = "0.1.28" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | dependencies = [ 32 | "cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)", 33 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 34 | ] 35 | 36 | [[package]] 37 | name = "bitflags" 38 | version = "1.0.4" 39 | source = "registry+https://github.com/rust-lang/crates.io-index" 40 | 41 | [[package]] 42 | name = "byteorder" 43 | version = "1.3.1" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | 46 | [[package]] 47 | name = "bytes" 48 | version = "0.4.12" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | dependencies = [ 51 | "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 52 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 53 | ] 54 | 55 | [[package]] 56 | name = "cc" 57 | version = "1.0.30" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | 60 | [[package]] 61 | name = "cfg-if" 62 | version = "0.1.7" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | 65 | [[package]] 66 | name = "chat_serv" 67 | version = "0.1.0" 68 | dependencies = [ 69 | "chatbox 0.1.0", 70 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 71 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 72 | "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", 73 | "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", 74 | "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", 75 | "tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", 76 | "tokio-channel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 77 | ] 78 | 79 | [[package]] 80 | name = "chatbox" 81 | version = "0.1.0" 82 | dependencies = [ 83 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 84 | "tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", 85 | "tokio-channel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 86 | ] 87 | 88 | [[package]] 89 | name = "cloudabi" 90 | version = "0.0.3" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | dependencies = [ 93 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 94 | ] 95 | 96 | [[package]] 97 | name = "crossbeam-deque" 98 | version = "0.7.1" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | dependencies = [ 101 | "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 102 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 103 | ] 104 | 105 | [[package]] 106 | name = "crossbeam-epoch" 107 | version = "0.7.1" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | dependencies = [ 110 | "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 111 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 112 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 113 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 114 | "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 115 | "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 116 | ] 117 | 118 | [[package]] 119 | name = "crossbeam-queue" 120 | version = "0.1.2" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | dependencies = [ 123 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 124 | ] 125 | 126 | [[package]] 127 | name = "crossbeam-utils" 128 | version = "0.6.5" 129 | source = "registry+https://github.com/rust-lang/crates.io-index" 130 | dependencies = [ 131 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 132 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 133 | ] 134 | 135 | [[package]] 136 | name = "failure" 137 | version = "0.1.5" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | dependencies = [ 140 | "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", 141 | "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 142 | ] 143 | 144 | [[package]] 145 | name = "failure_derive" 146 | version = "0.1.5" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | dependencies = [ 149 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 150 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 151 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 152 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 153 | ] 154 | 155 | [[package]] 156 | name = "fnv" 157 | version = "1.0.6" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | 160 | [[package]] 161 | name = "fuchsia-cprng" 162 | version = "0.1.1" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | 165 | [[package]] 166 | name = "fuchsia-zircon" 167 | version = "0.3.3" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | dependencies = [ 170 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 171 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 172 | ] 173 | 174 | [[package]] 175 | name = "fuchsia-zircon-sys" 176 | version = "0.3.3" 177 | source = "registry+https://github.com/rust-lang/crates.io-index" 178 | 179 | [[package]] 180 | name = "futures" 181 | version = "0.1.25" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | 184 | [[package]] 185 | name = "iovec" 186 | version = "0.1.2" 187 | source = "registry+https://github.com/rust-lang/crates.io-index" 188 | dependencies = [ 189 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 190 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 191 | ] 192 | 193 | [[package]] 194 | name = "itoa" 195 | version = "0.4.3" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | 198 | [[package]] 199 | name = "kernel32-sys" 200 | version = "0.2.2" 201 | source = "registry+https://github.com/rust-lang/crates.io-index" 202 | dependencies = [ 203 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 204 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 205 | ] 206 | 207 | [[package]] 208 | name = "lazy_static" 209 | version = "1.3.0" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | 212 | [[package]] 213 | name = "lazycell" 214 | version = "1.2.1" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | 217 | [[package]] 218 | name = "libc" 219 | version = "0.2.50" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | 222 | [[package]] 223 | name = "lock_api" 224 | version = "0.1.5" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | dependencies = [ 227 | "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 228 | "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 229 | ] 230 | 231 | [[package]] 232 | name = "log" 233 | version = "0.4.6" 234 | source = "registry+https://github.com/rust-lang/crates.io-index" 235 | dependencies = [ 236 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 237 | ] 238 | 239 | [[package]] 240 | name = "memoffset" 241 | version = "0.2.1" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | 244 | [[package]] 245 | name = "mio" 246 | version = "0.6.16" 247 | source = "registry+https://github.com/rust-lang/crates.io-index" 248 | dependencies = [ 249 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 250 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 251 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 252 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 253 | "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 254 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 255 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 256 | "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 257 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 258 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 259 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 260 | ] 261 | 262 | [[package]] 263 | name = "mio-uds" 264 | version = "0.6.7" 265 | source = "registry+https://github.com/rust-lang/crates.io-index" 266 | dependencies = [ 267 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 268 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 269 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 270 | ] 271 | 272 | [[package]] 273 | name = "miow" 274 | version = "0.2.1" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | dependencies = [ 277 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 278 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 279 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 280 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 281 | ] 282 | 283 | [[package]] 284 | name = "net2" 285 | version = "0.2.33" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | dependencies = [ 288 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 289 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 290 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 291 | ] 292 | 293 | [[package]] 294 | name = "nodrop" 295 | version = "0.1.13" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | 298 | [[package]] 299 | name = "num_cpus" 300 | version = "1.10.0" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | dependencies = [ 303 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 304 | ] 305 | 306 | [[package]] 307 | name = "owning_ref" 308 | version = "0.4.0" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | dependencies = [ 311 | "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 312 | ] 313 | 314 | [[package]] 315 | name = "parking_lot" 316 | version = "0.7.1" 317 | source = "registry+https://github.com/rust-lang/crates.io-index" 318 | dependencies = [ 319 | "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 320 | "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 321 | ] 322 | 323 | [[package]] 324 | name = "parking_lot_core" 325 | version = "0.4.0" 326 | source = "registry+https://github.com/rust-lang/crates.io-index" 327 | dependencies = [ 328 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 329 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 330 | "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 331 | "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", 332 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 333 | ] 334 | 335 | [[package]] 336 | name = "proc-macro2" 337 | version = "0.4.27" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | dependencies = [ 340 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 341 | ] 342 | 343 | [[package]] 344 | name = "quote" 345 | version = "0.6.11" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | dependencies = [ 348 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 349 | ] 350 | 351 | [[package]] 352 | name = "rand" 353 | version = "0.6.5" 354 | source = "registry+https://github.com/rust-lang/crates.io-index" 355 | dependencies = [ 356 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 357 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 358 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 359 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 360 | "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 361 | "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 362 | "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 363 | "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 364 | "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 365 | "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 366 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 367 | ] 368 | 369 | [[package]] 370 | name = "rand_chacha" 371 | version = "0.1.1" 372 | source = "registry+https://github.com/rust-lang/crates.io-index" 373 | dependencies = [ 374 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 375 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 376 | ] 377 | 378 | [[package]] 379 | name = "rand_core" 380 | version = "0.3.1" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | dependencies = [ 383 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 384 | ] 385 | 386 | [[package]] 387 | name = "rand_core" 388 | version = "0.4.0" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | 391 | [[package]] 392 | name = "rand_hc" 393 | version = "0.1.0" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | dependencies = [ 396 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 397 | ] 398 | 399 | [[package]] 400 | name = "rand_isaac" 401 | version = "0.1.1" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | dependencies = [ 404 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 405 | ] 406 | 407 | [[package]] 408 | name = "rand_jitter" 409 | version = "0.1.3" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | dependencies = [ 412 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 413 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 414 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 415 | ] 416 | 417 | [[package]] 418 | name = "rand_os" 419 | version = "0.1.3" 420 | source = "registry+https://github.com/rust-lang/crates.io-index" 421 | dependencies = [ 422 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 423 | "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 424 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 425 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 426 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 427 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 428 | ] 429 | 430 | [[package]] 431 | name = "rand_pcg" 432 | version = "0.1.2" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | dependencies = [ 435 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 436 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 437 | ] 438 | 439 | [[package]] 440 | name = "rand_xorshift" 441 | version = "0.1.1" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | dependencies = [ 444 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 445 | ] 446 | 447 | [[package]] 448 | name = "rdrand" 449 | version = "0.4.0" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | dependencies = [ 452 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 453 | ] 454 | 455 | [[package]] 456 | name = "rustc-demangle" 457 | version = "0.1.13" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | 460 | [[package]] 461 | name = "rustc_version" 462 | version = "0.2.3" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | dependencies = [ 465 | "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 466 | ] 467 | 468 | [[package]] 469 | name = "ryu" 470 | version = "0.2.7" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | 473 | [[package]] 474 | name = "scopeguard" 475 | version = "0.3.3" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | 478 | [[package]] 479 | name = "semver" 480 | version = "0.9.0" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | dependencies = [ 483 | "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 484 | ] 485 | 486 | [[package]] 487 | name = "semver-parser" 488 | version = "0.7.0" 489 | source = "registry+https://github.com/rust-lang/crates.io-index" 490 | 491 | [[package]] 492 | name = "serde" 493 | version = "1.0.89" 494 | source = "registry+https://github.com/rust-lang/crates.io-index" 495 | 496 | [[package]] 497 | name = "serde_derive" 498 | version = "1.0.89" 499 | source = "registry+https://github.com/rust-lang/crates.io-index" 500 | dependencies = [ 501 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 502 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 503 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 504 | ] 505 | 506 | [[package]] 507 | name = "serde_json" 508 | version = "1.0.39" 509 | source = "registry+https://github.com/rust-lang/crates.io-index" 510 | dependencies = [ 511 | "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", 512 | "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 513 | "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", 514 | ] 515 | 516 | [[package]] 517 | name = "slab" 518 | version = "0.4.2" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | 521 | [[package]] 522 | name = "smallvec" 523 | version = "0.6.9" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | 526 | [[package]] 527 | name = "stable_deref_trait" 528 | version = "1.1.1" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | 531 | [[package]] 532 | name = "syn" 533 | version = "0.15.29" 534 | source = "registry+https://github.com/rust-lang/crates.io-index" 535 | dependencies = [ 536 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 537 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 538 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 539 | ] 540 | 541 | [[package]] 542 | name = "synstructure" 543 | version = "0.10.1" 544 | source = "registry+https://github.com/rust-lang/crates.io-index" 545 | dependencies = [ 546 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 547 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 548 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 549 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 550 | ] 551 | 552 | [[package]] 553 | name = "tokio" 554 | version = "0.1.16" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | dependencies = [ 557 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 558 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 559 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 560 | "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 561 | "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 562 | "tokio-current-thread 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 563 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 564 | "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 565 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 566 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 567 | "tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 568 | "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 569 | "tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 570 | "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", 571 | "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 572 | "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", 573 | ] 574 | 575 | [[package]] 576 | name = "tokio-channel" 577 | version = "0.1.0" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | dependencies = [ 580 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 581 | ] 582 | 583 | [[package]] 584 | name = "tokio-codec" 585 | version = "0.1.1" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | dependencies = [ 588 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 589 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 590 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 591 | ] 592 | 593 | [[package]] 594 | name = "tokio-current-thread" 595 | version = "0.1.5" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | dependencies = [ 598 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 599 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 600 | ] 601 | 602 | [[package]] 603 | name = "tokio-executor" 604 | version = "0.1.6" 605 | source = "registry+https://github.com/rust-lang/crates.io-index" 606 | dependencies = [ 607 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 608 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 609 | ] 610 | 611 | [[package]] 612 | name = "tokio-fs" 613 | version = "0.1.6" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | dependencies = [ 616 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 617 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 618 | "tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 619 | ] 620 | 621 | [[package]] 622 | name = "tokio-io" 623 | version = "0.1.12" 624 | source = "registry+https://github.com/rust-lang/crates.io-index" 625 | dependencies = [ 626 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 627 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 628 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 629 | ] 630 | 631 | [[package]] 632 | name = "tokio-reactor" 633 | version = "0.1.9" 634 | source = "registry+https://github.com/rust-lang/crates.io-index" 635 | dependencies = [ 636 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 637 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 638 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 639 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 640 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 641 | "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 642 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 643 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 644 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 645 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 646 | "tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 647 | ] 648 | 649 | [[package]] 650 | name = "tokio-sync" 651 | version = "0.1.3" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | dependencies = [ 654 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 655 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 656 | ] 657 | 658 | [[package]] 659 | name = "tokio-tcp" 660 | version = "0.1.3" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | dependencies = [ 663 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 664 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 665 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 666 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 667 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 668 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 669 | ] 670 | 671 | [[package]] 672 | name = "tokio-threadpool" 673 | version = "0.1.12" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | dependencies = [ 676 | "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 677 | "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 678 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 679 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 680 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 681 | "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 682 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 683 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 684 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 685 | ] 686 | 687 | [[package]] 688 | name = "tokio-timer" 689 | version = "0.2.10" 690 | source = "registry+https://github.com/rust-lang/crates.io-index" 691 | dependencies = [ 692 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 693 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 694 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 695 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 696 | ] 697 | 698 | [[package]] 699 | name = "tokio-udp" 700 | version = "0.1.3" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | dependencies = [ 703 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 704 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 705 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 706 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 707 | "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 708 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 709 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 710 | ] 711 | 712 | [[package]] 713 | name = "tokio-uds" 714 | version = "0.2.5" 715 | source = "registry+https://github.com/rust-lang/crates.io-index" 716 | dependencies = [ 717 | "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", 718 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 719 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 720 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 721 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 722 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 723 | "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 724 | "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 725 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 726 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 727 | ] 728 | 729 | [[package]] 730 | name = "unicode-xid" 731 | version = "0.1.0" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | 734 | [[package]] 735 | name = "winapi" 736 | version = "0.2.8" 737 | source = "registry+https://github.com/rust-lang/crates.io-index" 738 | 739 | [[package]] 740 | name = "winapi" 741 | version = "0.3.6" 742 | source = "registry+https://github.com/rust-lang/crates.io-index" 743 | dependencies = [ 744 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 745 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 746 | ] 747 | 748 | [[package]] 749 | name = "winapi-build" 750 | version = "0.1.1" 751 | source = "registry+https://github.com/rust-lang/crates.io-index" 752 | 753 | [[package]] 754 | name = "winapi-i686-pc-windows-gnu" 755 | version = "0.4.0" 756 | source = "registry+https://github.com/rust-lang/crates.io-index" 757 | 758 | [[package]] 759 | name = "winapi-x86_64-pc-windows-gnu" 760 | version = "0.4.0" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | 763 | [[package]] 764 | name = "ws2_32-sys" 765 | version = "0.2.1" 766 | source = "registry+https://github.com/rust-lang/crates.io-index" 767 | dependencies = [ 768 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 769 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 770 | ] 771 | 772 | [metadata] 773 | "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" 774 | "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" 775 | "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" 776 | "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" 777 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 778 | "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" 779 | "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" 780 | "checksum cc 1.0.30 (registry+https://github.com/rust-lang/crates.io-index)" = "d01c69d08ff207f231f07196e30f84c70f1c815b04f980f8b7b01ff01f05eb92" 781 | "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" 782 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 783 | "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" 784 | "checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" 785 | "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" 786 | "checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" 787 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" 788 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" 789 | "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 790 | "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" 791 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 792 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 793 | "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" 794 | "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" 795 | "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" 796 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 797 | "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" 798 | "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" 799 | "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" 800 | "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" 801 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" 802 | "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" 803 | "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" 804 | "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" 805 | "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 806 | "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 807 | "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" 808 | "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" 809 | "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" 810 | "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" 811 | "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" 812 | "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" 813 | "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" 814 | "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" 815 | "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" 816 | "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" 817 | "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" 818 | "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" 819 | "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" 820 | "checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" 821 | "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" 822 | "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" 823 | "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" 824 | "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" 825 | "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" 826 | "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 827 | "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" 828 | "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" 829 | "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 830 | "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 831 | "checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560" 832 | "checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c" 833 | "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" 834 | "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 835 | "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" 836 | "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" 837 | "checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" 838 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 839 | "checksum tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcaabb3cec70485d0df6e9454fe514393ad1c4070dee8915f11041e95630b230" 840 | "checksum tokio-channel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "530d0fb87416dd531600f7cccc438bb35c5b91883065c9e6dca7cdecee991cfa" 841 | "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" 842 | "checksum tokio-current-thread 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c756b04680eea21902a46fca4e9f410a2332c04995af590e07ff262e2193a9a3" 843 | "checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" 844 | "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" 845 | "checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" 846 | "checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" 847 | "checksum tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1bf2b9dac2a0509b5cfd1df5aa25eafacb616a42a491a13604d6bbeab4486363" 848 | "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" 849 | "checksum tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "742e511f6ce2298aeb86fc9ea0d8df81c2388c6ebae3dc8a7316e8c9df0df801" 850 | "checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" 851 | "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" 852 | "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" 853 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 854 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 855 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 856 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 857 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 858 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 859 | "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 860 | -------------------------------------------------------------------------------- /chat_serv/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "chat_serv" 3 | version = "0.1.0" 4 | authors = ["matthew "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | failure = "0.1.5" 9 | futures = "0.1.25" 10 | tokio = "0.1.15" 11 | tokio-channel = "0.1.0" 12 | 13 | serde = "1.0.89" 14 | serde_json = "1.0.38" 15 | serde_derive = "1.0.89" 16 | 17 | chatbox = {path = "../chatbox/"} 18 | -------------------------------------------------------------------------------- /chat_serv/src/j_read.rs: -------------------------------------------------------------------------------- 1 | use failure::Error; 2 | use futures::try_ready; 3 | use tokio::prelude::*; 4 | 5 | enum Rding { 6 | Len(usize), 7 | Val(usize, Vec), 8 | } 9 | 10 | pub struct JRead { 11 | buf: [u8; 500], 12 | buflen: usize, 13 | ptr: usize, 14 | reading: Rding, 15 | r: R, 16 | } 17 | 18 | impl JRead { 19 | pub fn new(r: R) -> Self { 20 | JRead { 21 | buf: [0; 500], 22 | buflen: 0, 23 | ptr: 0, 24 | reading: Rding::Len(0), 25 | r, 26 | } 27 | } 28 | } 29 | 30 | impl Stream for JRead { 31 | type Item = String; 32 | type Error = Error; 33 | fn poll(&mut self) -> Result>, Self::Error> { 34 | loop { 35 | if self.ptr == self.buflen { 36 | self.buflen = try_ready! { self.r.poll_read(&mut self.buf)}; 37 | self.ptr = 0; 38 | } 39 | if self.buflen == 0 { 40 | return Ok(Async::Ready(None)); 41 | } 42 | match self.reading { 43 | Rding::Len(ref mut nb) => { 44 | match self.buf[self.ptr] { 45 | b':' => self.reading = Rding::Val(*nb, Vec::new()), 46 | v if v >= b'0' && v <= b'9' => { 47 | *nb = *nb * 10 + ((v - 48) as usize); 48 | } 49 | _ => {} 50 | } 51 | self.ptr += 1; 52 | } 53 | Rding::Val(n, ref mut v) => { 54 | let p_dist = std::cmp::min(self.ptr + n - v.len(), self.buflen); 55 | v.append(&mut self.buf[self.ptr..p_dist].to_vec()); 56 | self.ptr = p_dist; 57 | if v.len() == n { 58 | let res = String::from_utf8(v.clone())?; 59 | self.reading = Rding::Len(0); 60 | return Ok(Async::Ready(Some(res))); 61 | } 62 | } 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /chat_serv/src/j_write.rs: -------------------------------------------------------------------------------- 1 | use futures::future::Future; 2 | use futures::try_ready; 3 | use serde::Serialize; 4 | use tokio::prelude::*; 5 | 6 | pub struct JWrite { 7 | in_s: S, 8 | out_w: W, 9 | buff: Option>, 10 | } 11 | 12 | impl JWrite { 13 | pub fn new(in_s: S, out_w: W) -> Self { 14 | JWrite { 15 | in_s, 16 | out_w, 17 | buff: None, 18 | } 19 | } 20 | } 21 | 22 | impl Future for JWrite 23 | where 24 | S: Stream, 25 | I: Serialize, 26 | W: AsyncWrite, 27 | { 28 | type Item = (); 29 | type Error = (); 30 | fn poll(&mut self) -> Result, Self::Error> { 31 | loop { 32 | match self.buff { 33 | None => { 34 | let i = match try_ready! {self.in_s.poll()} { 35 | Some(v) => v, 36 | None => return Ok(Async::Ready(())), 37 | }; 38 | self.buff = serde_json::to_string(&i) 39 | .map(|v| v.as_bytes().to_vec()) 40 | .ok(); 41 | } 42 | Some(ref mut v) => { 43 | let n = try_ready! {self.out_w.poll_write(v).map_err(|_| println!("could not write out"))}; 44 | if n == v.len() { 45 | self.buff = None; 46 | } else { 47 | self.buff = Some(v.split_off(n)); 48 | } 49 | } 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /chat_serv/src/main.rs: -------------------------------------------------------------------------------- 1 | use tokio::net::TcpListener; 2 | use tokio::prelude::*; 3 | use serde_derive::*; 4 | use chatbox::{ChatBox,Request}; 5 | use tokio_channel::{mpsc,oneshot}; 6 | 7 | mod j_read; 8 | mod j_write; 9 | 10 | 11 | #[derive(Debug,Clone,Serialize,Deserialize)] 12 | pub struct Message{ 13 | name:String, 14 | tx:String, 15 | } 16 | 17 | #[derive(Debug,Clone,Serialize,Deserialize)] 18 | pub struct ServerMessage{ 19 | mess:Option, 20 | since:Option, 21 | 22 | } 23 | 24 | fn main() { 25 | let addr = "127.0.0.1:8088".parse().unwrap(); 26 | let lis = TcpListener::bind(&addr).expect("could not bind address"); 27 | 28 | let (ch_box,ch_s) = ChatBox::new(); 29 | 30 | 31 | let fut = lis.incoming().for_each(move |sock|{ 32 | let ch_s = ch_s.clone(); 33 | let (sock_r,sock_w) = sock.split(); 34 | let (fin_s,fin_r) = mpsc::channel(10); 35 | let write_f = j_write::JWrite::new(fin_r,sock_w); 36 | tokio::spawn(write_f); 37 | let rd = j_read::JRead::new(sock_r).for_each(move |s| { 38 | let v:ServerMessage = serde_json::from_str(&s)?; 39 | println!("recieved:{:?}",v); 40 | if let Some(m) = v.mess{ 41 | let f = ch_s.clone() 42 | .send(Request::Put(m)) 43 | .map(|_|()) 44 | .map_err(|_|println!("could not send message to chatbox")); 45 | tokio::spawn(f); 46 | } 47 | 48 | if let Some(n) = v.since{ 49 | let (os_s,os_r) = oneshot::channel(); 50 | let fc = fin_s.clone(); 51 | let f = ch_s.clone() 52 | .send(Request::Since(n,os_s)) 53 | .map_err(|_|println!("could not send since to chatbox")) 54 | .and_then(|_|os_r.map_err(|_|println!("could not get from chatbox oneshot"))) 55 | .and_then(move |v| fc.send(v).map_err(|_|println!("could not send to fin_c"))) 56 | .map(|_|()); 57 | tokio::spawn(f); 58 | } 59 | Ok(()) 60 | }).map_err(|_|()); 61 | tokio::spawn(rd); 62 | Ok(()) 63 | }).map_err(|e|println!("Listening Err :{:?}" ,e)); 64 | 65 | tokio::run(fut.join(ch_box).map(|_|())); 66 | 67 | println!("Hello, world!"); 68 | } 69 | -------------------------------------------------------------------------------- /chatbox/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "arrayvec" 3 | version = "0.4.10" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "autocfg" 11 | version = "0.1.2" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | 14 | [[package]] 15 | name = "bitflags" 16 | version = "1.0.4" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | 19 | [[package]] 20 | name = "byteorder" 21 | version = "1.3.1" 22 | source = "registry+https://github.com/rust-lang/crates.io-index" 23 | 24 | [[package]] 25 | name = "bytes" 26 | version = "0.4.11" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | dependencies = [ 29 | "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 30 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 31 | ] 32 | 33 | [[package]] 34 | name = "cfg-if" 35 | version = "0.1.7" 36 | source = "registry+https://github.com/rust-lang/crates.io-index" 37 | 38 | [[package]] 39 | name = "chatbox" 40 | version = "0.1.0" 41 | dependencies = [ 42 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 43 | "tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", 44 | "tokio-channel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 45 | ] 46 | 47 | [[package]] 48 | name = "cloudabi" 49 | version = "0.0.3" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | dependencies = [ 52 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 53 | ] 54 | 55 | [[package]] 56 | name = "crossbeam-deque" 57 | version = "0.7.1" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | dependencies = [ 60 | "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 61 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 62 | ] 63 | 64 | [[package]] 65 | name = "crossbeam-epoch" 66 | version = "0.7.1" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | dependencies = [ 69 | "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 70 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 71 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 72 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 73 | "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 74 | "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 75 | ] 76 | 77 | [[package]] 78 | name = "crossbeam-queue" 79 | version = "0.1.2" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | dependencies = [ 82 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 83 | ] 84 | 85 | [[package]] 86 | name = "crossbeam-utils" 87 | version = "0.6.5" 88 | source = "registry+https://github.com/rust-lang/crates.io-index" 89 | dependencies = [ 90 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 91 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 92 | ] 93 | 94 | [[package]] 95 | name = "fnv" 96 | version = "1.0.6" 97 | source = "registry+https://github.com/rust-lang/crates.io-index" 98 | 99 | [[package]] 100 | name = "fuchsia-cprng" 101 | version = "0.1.1" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | 104 | [[package]] 105 | name = "fuchsia-zircon" 106 | version = "0.3.3" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | dependencies = [ 109 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 110 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 111 | ] 112 | 113 | [[package]] 114 | name = "fuchsia-zircon-sys" 115 | version = "0.3.3" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | 118 | [[package]] 119 | name = "futures" 120 | version = "0.1.25" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | 123 | [[package]] 124 | name = "iovec" 125 | version = "0.1.2" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | dependencies = [ 128 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 129 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 130 | ] 131 | 132 | [[package]] 133 | name = "kernel32-sys" 134 | version = "0.2.2" 135 | source = "registry+https://github.com/rust-lang/crates.io-index" 136 | dependencies = [ 137 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 138 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 139 | ] 140 | 141 | [[package]] 142 | name = "lazy_static" 143 | version = "1.3.0" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | 146 | [[package]] 147 | name = "lazycell" 148 | version = "1.2.1" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | 151 | [[package]] 152 | name = "libc" 153 | version = "0.2.49" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | 156 | [[package]] 157 | name = "lock_api" 158 | version = "0.1.5" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | dependencies = [ 161 | "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 162 | "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 163 | ] 164 | 165 | [[package]] 166 | name = "log" 167 | version = "0.4.6" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | dependencies = [ 170 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 171 | ] 172 | 173 | [[package]] 174 | name = "memoffset" 175 | version = "0.2.1" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | 178 | [[package]] 179 | name = "mio" 180 | version = "0.6.16" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | dependencies = [ 183 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 184 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 185 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 186 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 187 | "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 188 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 189 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 190 | "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 191 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 192 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 193 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 194 | ] 195 | 196 | [[package]] 197 | name = "mio-uds" 198 | version = "0.6.7" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | dependencies = [ 201 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 202 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 203 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 204 | ] 205 | 206 | [[package]] 207 | name = "miow" 208 | version = "0.2.1" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | dependencies = [ 211 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 212 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 213 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 214 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 215 | ] 216 | 217 | [[package]] 218 | name = "net2" 219 | version = "0.2.33" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | dependencies = [ 222 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 223 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 224 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 225 | ] 226 | 227 | [[package]] 228 | name = "nodrop" 229 | version = "0.1.13" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | 232 | [[package]] 233 | name = "num_cpus" 234 | version = "1.10.0" 235 | source = "registry+https://github.com/rust-lang/crates.io-index" 236 | dependencies = [ 237 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 238 | ] 239 | 240 | [[package]] 241 | name = "owning_ref" 242 | version = "0.4.0" 243 | source = "registry+https://github.com/rust-lang/crates.io-index" 244 | dependencies = [ 245 | "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 246 | ] 247 | 248 | [[package]] 249 | name = "parking_lot" 250 | version = "0.7.1" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | dependencies = [ 253 | "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 254 | "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 255 | ] 256 | 257 | [[package]] 258 | name = "parking_lot_core" 259 | version = "0.4.0" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | dependencies = [ 262 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 263 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 264 | "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 265 | "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", 266 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 267 | ] 268 | 269 | [[package]] 270 | name = "rand" 271 | version = "0.6.5" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | dependencies = [ 274 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 275 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 276 | "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 277 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 278 | "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 279 | "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 280 | "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 281 | "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 283 | "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 284 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 285 | ] 286 | 287 | [[package]] 288 | name = "rand_chacha" 289 | version = "0.1.1" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | dependencies = [ 292 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 293 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 294 | ] 295 | 296 | [[package]] 297 | name = "rand_core" 298 | version = "0.3.1" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | dependencies = [ 301 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 302 | ] 303 | 304 | [[package]] 305 | name = "rand_core" 306 | version = "0.4.0" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | 309 | [[package]] 310 | name = "rand_hc" 311 | version = "0.1.0" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | dependencies = [ 314 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 315 | ] 316 | 317 | [[package]] 318 | name = "rand_isaac" 319 | version = "0.1.1" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | dependencies = [ 322 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 323 | ] 324 | 325 | [[package]] 326 | name = "rand_jitter" 327 | version = "0.1.3" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | dependencies = [ 330 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 331 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 332 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 333 | ] 334 | 335 | [[package]] 336 | name = "rand_os" 337 | version = "0.1.3" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | dependencies = [ 340 | "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 341 | "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 342 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 343 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 344 | "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 345 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 346 | ] 347 | 348 | [[package]] 349 | name = "rand_pcg" 350 | version = "0.1.2" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | dependencies = [ 353 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 354 | "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 355 | ] 356 | 357 | [[package]] 358 | name = "rand_xorshift" 359 | version = "0.1.1" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | dependencies = [ 362 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 363 | ] 364 | 365 | [[package]] 366 | name = "rdrand" 367 | version = "0.4.0" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | dependencies = [ 370 | "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 371 | ] 372 | 373 | [[package]] 374 | name = "rustc_version" 375 | version = "0.2.3" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | dependencies = [ 378 | "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 379 | ] 380 | 381 | [[package]] 382 | name = "scopeguard" 383 | version = "0.3.3" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | 386 | [[package]] 387 | name = "semver" 388 | version = "0.9.0" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | dependencies = [ 391 | "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 392 | ] 393 | 394 | [[package]] 395 | name = "semver-parser" 396 | version = "0.7.0" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | 399 | [[package]] 400 | name = "slab" 401 | version = "0.4.2" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | 404 | [[package]] 405 | name = "smallvec" 406 | version = "0.6.9" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | 409 | [[package]] 410 | name = "stable_deref_trait" 411 | version = "1.1.1" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | 414 | [[package]] 415 | name = "tokio" 416 | version = "0.1.16" 417 | source = "registry+https://github.com/rust-lang/crates.io-index" 418 | dependencies = [ 419 | "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", 420 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 421 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 422 | "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 423 | "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 424 | "tokio-current-thread 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 425 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 426 | "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 427 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 428 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 429 | "tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 430 | "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 431 | "tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 432 | "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", 433 | "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 434 | "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", 435 | ] 436 | 437 | [[package]] 438 | name = "tokio-channel" 439 | version = "0.1.0" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | dependencies = [ 442 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 443 | ] 444 | 445 | [[package]] 446 | name = "tokio-codec" 447 | version = "0.1.1" 448 | source = "registry+https://github.com/rust-lang/crates.io-index" 449 | dependencies = [ 450 | "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", 451 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 452 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 453 | ] 454 | 455 | [[package]] 456 | name = "tokio-current-thread" 457 | version = "0.1.5" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | dependencies = [ 460 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 461 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 462 | ] 463 | 464 | [[package]] 465 | name = "tokio-executor" 466 | version = "0.1.6" 467 | source = "registry+https://github.com/rust-lang/crates.io-index" 468 | dependencies = [ 469 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 470 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 471 | ] 472 | 473 | [[package]] 474 | name = "tokio-fs" 475 | version = "0.1.6" 476 | source = "registry+https://github.com/rust-lang/crates.io-index" 477 | dependencies = [ 478 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 479 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 480 | "tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 481 | ] 482 | 483 | [[package]] 484 | name = "tokio-io" 485 | version = "0.1.12" 486 | source = "registry+https://github.com/rust-lang/crates.io-index" 487 | dependencies = [ 488 | "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", 489 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 490 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 491 | ] 492 | 493 | [[package]] 494 | name = "tokio-reactor" 495 | version = "0.1.9" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | dependencies = [ 498 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 499 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 500 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 501 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 502 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 503 | "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 504 | "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 505 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 506 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 507 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 508 | "tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 509 | ] 510 | 511 | [[package]] 512 | name = "tokio-sync" 513 | version = "0.1.3" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | dependencies = [ 516 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 517 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 518 | ] 519 | 520 | [[package]] 521 | name = "tokio-tcp" 522 | version = "0.1.3" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | dependencies = [ 525 | "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", 526 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 527 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 528 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 529 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 530 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 531 | ] 532 | 533 | [[package]] 534 | name = "tokio-threadpool" 535 | version = "0.1.12" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | dependencies = [ 538 | "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", 539 | "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 540 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 541 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 542 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 543 | "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 544 | "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 545 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 546 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 547 | ] 548 | 549 | [[package]] 550 | name = "tokio-timer" 551 | version = "0.2.10" 552 | source = "registry+https://github.com/rust-lang/crates.io-index" 553 | dependencies = [ 554 | "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 555 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 556 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 557 | "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 558 | ] 559 | 560 | [[package]] 561 | name = "tokio-udp" 562 | version = "0.1.3" 563 | source = "registry+https://github.com/rust-lang/crates.io-index" 564 | dependencies = [ 565 | "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", 566 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 567 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 568 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 569 | "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 570 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 571 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 572 | ] 573 | 574 | [[package]] 575 | name = "tokio-uds" 576 | version = "0.2.5" 577 | source = "registry+https://github.com/rust-lang/crates.io-index" 578 | dependencies = [ 579 | "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", 580 | "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 581 | "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 582 | "libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)", 583 | "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 584 | "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", 585 | "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", 586 | "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 587 | "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 588 | "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 589 | ] 590 | 591 | [[package]] 592 | name = "winapi" 593 | version = "0.2.8" 594 | source = "registry+https://github.com/rust-lang/crates.io-index" 595 | 596 | [[package]] 597 | name = "winapi" 598 | version = "0.3.6" 599 | source = "registry+https://github.com/rust-lang/crates.io-index" 600 | dependencies = [ 601 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 602 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 603 | ] 604 | 605 | [[package]] 606 | name = "winapi-build" 607 | version = "0.1.1" 608 | source = "registry+https://github.com/rust-lang/crates.io-index" 609 | 610 | [[package]] 611 | name = "winapi-i686-pc-windows-gnu" 612 | version = "0.4.0" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | 615 | [[package]] 616 | name = "winapi-x86_64-pc-windows-gnu" 617 | version = "0.4.0" 618 | source = "registry+https://github.com/rust-lang/crates.io-index" 619 | 620 | [[package]] 621 | name = "ws2_32-sys" 622 | version = "0.2.1" 623 | source = "registry+https://github.com/rust-lang/crates.io-index" 624 | dependencies = [ 625 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 626 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 627 | ] 628 | 629 | [metadata] 630 | "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" 631 | "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" 632 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 633 | "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" 634 | "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" 635 | "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" 636 | "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" 637 | "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" 638 | "checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" 639 | "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" 640 | "checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" 641 | "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 642 | "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" 643 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 644 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 645 | "checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" 646 | "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" 647 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 648 | "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" 649 | "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" 650 | "checksum libc 0.2.49 (registry+https://github.com/rust-lang/crates.io-index)" = "413f3dfc802c5dc91dc570b05125b6cda9855edfaa9825c9849807876376e70e" 651 | "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" 652 | "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" 653 | "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" 654 | "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" 655 | "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" 656 | "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 657 | "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 658 | "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" 659 | "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" 660 | "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" 661 | "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" 662 | "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" 663 | "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" 664 | "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" 665 | "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" 666 | "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" 667 | "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" 668 | "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" 669 | "checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" 670 | "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" 671 | "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" 672 | "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" 673 | "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" 674 | "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" 675 | "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" 676 | "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 677 | "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 678 | "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 679 | "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" 680 | "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" 681 | "checksum tokio 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fcaabb3cec70485d0df6e9454fe514393ad1c4070dee8915f11041e95630b230" 682 | "checksum tokio-channel 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "530d0fb87416dd531600f7cccc438bb35c5b91883065c9e6dca7cdecee991cfa" 683 | "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" 684 | "checksum tokio-current-thread 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c756b04680eea21902a46fca4e9f410a2332c04995af590e07ff262e2193a9a3" 685 | "checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" 686 | "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" 687 | "checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" 688 | "checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" 689 | "checksum tokio-sync 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1bf2b9dac2a0509b5cfd1df5aa25eafacb616a42a491a13604d6bbeab4486363" 690 | "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" 691 | "checksum tokio-threadpool 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "742e511f6ce2298aeb86fc9ea0d8df81c2388c6ebae3dc8a7316e8c9df0df801" 692 | "checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" 693 | "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" 694 | "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" 695 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 696 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 697 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 698 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 699 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 700 | "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 701 | -------------------------------------------------------------------------------- /chatbox/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "chatbox" 3 | version = "0.1.0" 4 | authors = ["matthew "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | futures = "0.1.25" 9 | tokio = "0.1.16" 10 | tokio-channel = "0.1.0" 11 | -------------------------------------------------------------------------------- /chatbox/src/lib.rs: -------------------------------------------------------------------------------- 1 | use futures::Future; 2 | use std::fmt::Debug; 3 | use tokio::prelude::*; 4 | use tokio_channel::{mpsc, oneshot}; 5 | 6 | pub enum Request { 7 | Put(M), 8 | Since(usize, oneshot::Sender>), 9 | } 10 | 11 | pub struct ChatBox { 12 | store: Vec, 13 | ch_r: mpsc::Receiver>, 14 | } 15 | 16 | impl ChatBox { 17 | pub fn new() -> (Self, mpsc::Sender>) { 18 | let (ch_s, ch_r) = mpsc::channel(10); 19 | ( 20 | ChatBox { 21 | store: Vec::new(), 22 | ch_r, 23 | }, 24 | ch_s, 25 | ) 26 | } 27 | } 28 | 29 | impl Future for ChatBox { 30 | type Item = (); 31 | type Error = (); 32 | fn poll(&mut self) -> Result, Self::Error> { 33 | loop { 34 | let rq = match { self.ch_r.poll()? } { 35 | Async::NotReady => return Ok(Async::NotReady), 36 | Async::Ready(Some(v)) => v, 37 | Async::Ready(None) => return Ok(Async::Ready(())), 38 | }; 39 | match rq { 40 | Request::Put(m) => { 41 | println!("got message {:?}", m); 42 | self.store.push(m); 43 | } 44 | Request::Since(n, ch) => { 45 | println!("got request {:?}", n); 46 | let res = if n >= self.store.len() { 47 | Vec::new() 48 | } else { 49 | Vec::from(&self.store[n..]) 50 | }; 51 | ch.send(res).ok(); 52 | } 53 | } 54 | } 55 | } 56 | } 57 | 58 | #[cfg(test)] 59 | mod tests { 60 | use super::*; 61 | use futures::future::lazy; 62 | 63 | #[test] 64 | fn it_works() { 65 | let (ts_s, ts_r) = mpsc::channel(10); 66 | let f = lazy(move || { 67 | let (f, ch_s) = ChatBox::new(); 68 | tokio::spawn(f); 69 | for i in 0..5 { 70 | let tss = ts_s.clone(); 71 | let ch2 = ch_s.clone(); 72 | let (os_s, os_r) = oneshot::channel(); 73 | let f2 = ch_s 74 | .clone() 75 | .send(Request::Put(i)) 76 | .and_then(|_| ch2.send(Request::Since(0, os_s))) 77 | .map_err(|e| println!("{:?}", e)) 78 | .and_then(|_| os_r.map_err(|_| ())) 79 | .and_then(move |res| { 80 | println!("res {} = {:?}", i, res); 81 | tss.send(res) 82 | .map_err(move |_| println!("could not send {}", i)) 83 | }) 84 | .map(|_| ()); 85 | tokio::spawn(f2); 86 | } 87 | Ok(()) 88 | }); 89 | tokio::run(f); 90 | 91 | let mut longest = 0; 92 | for v in ts_r.wait() { 93 | longest = std::cmp::max(longest, v.unwrap().len()); 94 | } 95 | assert_eq!(longest, 5); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /mdrend/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "ansi_term" 5 | version = "0.11.0" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | dependencies = [ 8 | "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 9 | ] 10 | 11 | [[package]] 12 | name = "atty" 13 | version = "0.2.11" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | dependencies = [ 16 | "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", 17 | "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 18 | "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 19 | ] 20 | 21 | [[package]] 22 | name = "bitflags" 23 | version = "1.0.4" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | 26 | [[package]] 27 | name = "clap" 28 | version = "2.33.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | dependencies = [ 31 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 32 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 33 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 34 | "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", 35 | "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 36 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 37 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 38 | ] 39 | 40 | [[package]] 41 | name = "getopts" 42 | version = "0.2.18" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | dependencies = [ 45 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 46 | ] 47 | 48 | [[package]] 49 | name = "libc" 50 | version = "0.2.51" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | 53 | [[package]] 54 | name = "literalext" 55 | version = "0.1.1" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | 58 | [[package]] 59 | name = "matches" 60 | version = "0.1.8" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | 63 | [[package]] 64 | name = "maud" 65 | version = "0.20.0" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | dependencies = [ 68 | "maud_htmlescape 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", 69 | "maud_macros 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", 70 | ] 71 | 72 | [[package]] 73 | name = "maud_htmlescape" 74 | version = "0.17.0" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | 77 | [[package]] 78 | name = "maud_macros" 79 | version = "0.20.0" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | dependencies = [ 82 | "literalext 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 83 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 84 | "maud_htmlescape 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", 85 | ] 86 | 87 | [[package]] 88 | name = "mdrend-dont-use-test123" 89 | version = "0.1.0" 90 | dependencies = [ 91 | "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", 92 | "maud 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", 93 | "pulldown-cmark 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", 94 | ] 95 | 96 | [[package]] 97 | name = "memchr" 98 | version = "2.2.0" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | 101 | [[package]] 102 | name = "numtoa" 103 | version = "0.1.0" 104 | source = "registry+https://github.com/rust-lang/crates.io-index" 105 | 106 | [[package]] 107 | name = "pulldown-cmark" 108 | version = "0.4.1" 109 | source = "registry+https://github.com/rust-lang/crates.io-index" 110 | dependencies = [ 111 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 112 | "getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", 113 | "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 114 | "unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 115 | ] 116 | 117 | [[package]] 118 | name = "redox_syscall" 119 | version = "0.1.54" 120 | source = "registry+https://github.com/rust-lang/crates.io-index" 121 | 122 | [[package]] 123 | name = "redox_termios" 124 | version = "0.1.1" 125 | source = "registry+https://github.com/rust-lang/crates.io-index" 126 | dependencies = [ 127 | "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 128 | ] 129 | 130 | [[package]] 131 | name = "strsim" 132 | version = "0.8.0" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | 135 | [[package]] 136 | name = "termion" 137 | version = "1.5.2" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | dependencies = [ 140 | "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", 141 | "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 142 | "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", 143 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 144 | ] 145 | 146 | [[package]] 147 | name = "textwrap" 148 | version = "0.11.0" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | dependencies = [ 151 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 152 | ] 153 | 154 | [[package]] 155 | name = "unicase" 156 | version = "2.3.0" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | dependencies = [ 159 | "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 160 | ] 161 | 162 | [[package]] 163 | name = "unicode-width" 164 | version = "0.1.5" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | 167 | [[package]] 168 | name = "vec_map" 169 | version = "0.8.1" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | 172 | [[package]] 173 | name = "version_check" 174 | version = "0.1.5" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | 177 | [[package]] 178 | name = "winapi" 179 | version = "0.3.7" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | dependencies = [ 182 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 183 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 184 | ] 185 | 186 | [[package]] 187 | name = "winapi-i686-pc-windows-gnu" 188 | version = "0.4.0" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | 191 | [[package]] 192 | name = "winapi-x86_64-pc-windows-gnu" 193 | version = "0.4.0" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | 196 | [metadata] 197 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 198 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 199 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 200 | "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" 201 | "checksum getopts 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0a7292d30132fb5424b354f5dc02512a86e4c516fe544bb7a25e7f266951b797" 202 | "checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" 203 | "checksum literalext 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f42dd699527975a1e0d722e0707998671188a0125f2051d2d192fc201184a81" 204 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 205 | "checksum maud 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "337b4b2512ff8809450badd92cf3b529dc6108e333dfa1626971412f8de5793b" 206 | "checksum maud_htmlescape 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0fb85bccffc42302ad1e1ed8679f6a39d1317f775a37fbc3f79bdfbe054bfb7" 207 | "checksum maud_macros 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6f58751cda7f79eedc668ce60e5bcd88dca49e412ec37545a792e2c399fbca41" 208 | "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" 209 | "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" 210 | "checksum pulldown-cmark 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1b74cc784b038a9921fd1a48310cc2e238101aa8ae0b94201e2d85121dd68b5" 211 | "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" 212 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 213 | "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 214 | "checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" 215 | "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 216 | "checksum unicase 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41d17211f887da8e4a70a45b9536f26fc5de166b81e2d5d80de4a17fd22553bd" 217 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 218 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 219 | "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 220 | "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" 221 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 222 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 223 | -------------------------------------------------------------------------------- /mdrend/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "mdrend-dont-use-test123" 3 | version = "0.1.0" 4 | authors = ["matthew "] 5 | edition = "2018" 6 | license = "MIT" 7 | keywords = [ "Parse","markdown"] 8 | description = "Read a markdown file and return a parsed html file" 9 | 10 | [dependencies] 11 | 12 | clap = "2.33.0" 13 | pulldown-cmark = "0.4.1" 14 | maud = "0.20.0" 15 | 16 | 17 | -------------------------------------------------------------------------------- /mdrend/src/main.rs: -------------------------------------------------------------------------------- 1 | #![feature(proc_macro_hygiene)] 2 | 3 | use clap::{clap_app, crate_version}; 4 | use maud::html; 5 | use pulldown_cmark::{html::push_html, Event, Parser}; 6 | 7 | fn wrap_html(s:&str,css:Option<&str>)->String{ 8 | let res = html!{ 9 | (maud::DOCTYPE) 10 | html { 11 | head { 12 | meta charset="utf-8"; 13 | @if let Some(s) = css { 14 | link rel="stylesheet" type="text/css" href=(s) {} 15 | } 16 | 17 | } 18 | body { 19 | (maud::PreEscaped(s)) 20 | } 21 | } 22 | }; 23 | res.into_string() 24 | } 25 | 26 | 27 | fn main() { 28 | let clap = clap_app!( mdrend => 29 | (version:crate_version!()) 30 | (author:"Matt Stoodley") 31 | (about:"Renders markdown as you like") 32 | (@arg input: +required "Sets the input file") 33 | (@arg wrap: -w "Wrap in html") 34 | (@arg evnet: -e "Print events") 35 | (@arg css: --css +takes_value "Link to css") 36 | ) 37 | .get_matches(); 38 | 39 | let infile = 40 | std::fs::read_to_string(clap.value_of("input").unwrap()).expect("Could not read file"); 41 | 42 | let ps = Parser::new(&infile); 43 | 44 | let ps: Vec = ps.into_iter().collect(); 45 | if clap.is_present("event") { 46 | for p in &ps { 47 | println!("{:?}", p); 48 | } 49 | } 50 | 51 | 52 | let mut res = String::new(); 53 | push_html(&mut res, ps.into_iter()); 54 | 55 | if clap.is_present("wrap"){ 56 | res = wrap_html(&res,clap.value_of("css")); 57 | } 58 | println!("{}", res); 59 | } 60 | -------------------------------------------------------------------------------- /mdrend/test_data/hello.md: -------------------------------------------------------------------------------- 1 | Hello 2 | ===== 3 | 4 | Here is a page of markdown *stuff* 5 | -------------------------------------------------------------------------------- /pgrep/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "aho-corasick" 3 | version = "0.6.9" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "ansi_term" 11 | version = "0.11.0" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 15 | ] 16 | 17 | [[package]] 18 | name = "atty" 19 | version = "0.2.11" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | dependencies = [ 22 | "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", 23 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 24 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 25 | ] 26 | 27 | [[package]] 28 | name = "autocfg" 29 | version = "0.1.2" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | 32 | [[package]] 33 | name = "backtrace" 34 | version = "0.3.13" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | dependencies = [ 37 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 38 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", 39 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 40 | "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", 41 | "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 42 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 43 | ] 44 | 45 | [[package]] 46 | name = "backtrace-sys" 47 | version = "0.1.28" 48 | source = "registry+https://github.com/rust-lang/crates.io-index" 49 | dependencies = [ 50 | "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", 51 | "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", 52 | ] 53 | 54 | [[package]] 55 | name = "bitflags" 56 | version = "1.0.4" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | 59 | [[package]] 60 | name = "cc" 61 | version = "1.0.29" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | 64 | [[package]] 65 | name = "cfg-if" 66 | version = "0.1.6" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | 69 | [[package]] 70 | name = "clap" 71 | version = "2.32.0" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | dependencies = [ 74 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 75 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 76 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 77 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 78 | "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 79 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 80 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 81 | ] 82 | 83 | [[package]] 84 | name = "failure" 85 | version = "0.1.5" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | dependencies = [ 88 | "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", 89 | "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 90 | ] 91 | 92 | [[package]] 93 | name = "failure_derive" 94 | version = "0.1.5" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | dependencies = [ 97 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 98 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 99 | "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", 100 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 101 | ] 102 | 103 | [[package]] 104 | name = "lazy_static" 105 | version = "1.2.0" 106 | source = "registry+https://github.com/rust-lang/crates.io-index" 107 | 108 | [[package]] 109 | name = "libc" 110 | version = "0.2.48" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | 113 | [[package]] 114 | name = "memchr" 115 | version = "2.2.0" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | 118 | [[package]] 119 | name = "pgrep" 120 | version = "0.1.0" 121 | dependencies = [ 122 | "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 123 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 124 | "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 125 | ] 126 | 127 | [[package]] 128 | name = "proc-macro2" 129 | version = "0.4.27" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | dependencies = [ 132 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 133 | ] 134 | 135 | [[package]] 136 | name = "quote" 137 | version = "0.6.11" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | dependencies = [ 140 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 141 | ] 142 | 143 | [[package]] 144 | name = "redox_syscall" 145 | version = "0.1.51" 146 | source = "registry+https://github.com/rust-lang/crates.io-index" 147 | 148 | [[package]] 149 | name = "redox_termios" 150 | version = "0.1.1" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | dependencies = [ 153 | "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", 154 | ] 155 | 156 | [[package]] 157 | name = "regex" 158 | version = "1.1.0" 159 | source = "registry+https://github.com/rust-lang/crates.io-index" 160 | dependencies = [ 161 | "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", 162 | "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 163 | "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 164 | "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 165 | "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 166 | ] 167 | 168 | [[package]] 169 | name = "regex-syntax" 170 | version = "0.6.5" 171 | source = "registry+https://github.com/rust-lang/crates.io-index" 172 | dependencies = [ 173 | "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 174 | ] 175 | 176 | [[package]] 177 | name = "rustc-demangle" 178 | version = "0.1.13" 179 | source = "registry+https://github.com/rust-lang/crates.io-index" 180 | 181 | [[package]] 182 | name = "strsim" 183 | version = "0.7.0" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | 186 | [[package]] 187 | name = "syn" 188 | version = "0.15.26" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | dependencies = [ 191 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 192 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 193 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 194 | ] 195 | 196 | [[package]] 197 | name = "synstructure" 198 | version = "0.10.1" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | dependencies = [ 201 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 202 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 203 | "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", 204 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 205 | ] 206 | 207 | [[package]] 208 | name = "termion" 209 | version = "1.5.1" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | dependencies = [ 212 | "libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", 213 | "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", 214 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 215 | ] 216 | 217 | [[package]] 218 | name = "textwrap" 219 | version = "0.10.0" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | dependencies = [ 222 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 223 | ] 224 | 225 | [[package]] 226 | name = "thread_local" 227 | version = "0.3.6" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | dependencies = [ 230 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 231 | ] 232 | 233 | [[package]] 234 | name = "ucd-util" 235 | version = "0.1.3" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | 238 | [[package]] 239 | name = "unicode-width" 240 | version = "0.1.5" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | 243 | [[package]] 244 | name = "unicode-xid" 245 | version = "0.1.0" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | 248 | [[package]] 249 | name = "utf8-ranges" 250 | version = "1.0.2" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | 253 | [[package]] 254 | name = "vec_map" 255 | version = "0.8.1" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | 258 | [[package]] 259 | name = "winapi" 260 | version = "0.3.6" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | dependencies = [ 263 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 264 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 265 | ] 266 | 267 | [[package]] 268 | name = "winapi-i686-pc-windows-gnu" 269 | version = "0.4.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | 272 | [[package]] 273 | name = "winapi-x86_64-pc-windows-gnu" 274 | version = "0.4.0" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | 277 | [metadata] 278 | "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" 279 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 280 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 281 | "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" 282 | "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" 283 | "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" 284 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 285 | "checksum cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4390a3b5f4f6bce9c1d0c00128379df433e53777fdd30e92f16a529332baec4e" 286 | "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" 287 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" 288 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" 289 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" 290 | "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" 291 | "checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047" 292 | "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" 293 | "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" 294 | "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" 295 | "checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" 296 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 297 | "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" 298 | "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" 299 | "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" 300 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 301 | "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" 302 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 303 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 304 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" 305 | "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 306 | "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" 307 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 308 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 309 | "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" 310 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 311 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 312 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 313 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 314 | -------------------------------------------------------------------------------- /pgrep/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pgrep" 3 | version = "0.1.0" 4 | authors = ["matthew"] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | regex = "1.1.0" 9 | clap = "2.32.0" 10 | failure = "0.1.5" 11 | -------------------------------------------------------------------------------- /pgrep/src/main.rs: -------------------------------------------------------------------------------- 1 | use clap::{clap_app, crate_version}; 2 | use failure::{Error, Fail}; 3 | use regex::Regex; 4 | 5 | use std::path::Path; 6 | 7 | #[derive(Debug, Fail)] 8 | #[fail(display = "Argument not provided '{}'", arg)] 9 | struct ArgErr { 10 | arg: &'static str, 11 | } 12 | 13 | #[derive(Debug)] 14 | struct Record { 15 | line: usize, 16 | tx: String, 17 | } 18 | 19 | fn process_file>(p: P, re: &Regex) -> Result, Error> { 20 | let mut res = Vec::new(); 21 | let bts = std::fs::read(p)?; 22 | if let Ok(ss) = String::from_utf8(bts) { 23 | for (i, l) in ss.lines().enumerate() { 24 | if re.is_match(l) { 25 | res.push(Record { 26 | line: i, 27 | tx: l.to_string(), 28 | }); 29 | } 30 | } 31 | } 32 | Ok(res) 33 | } 34 | 35 | fn process_path(p: P, re: &Regex, ff: &FF, ef: &EF) -> Result<(), Error> 36 | where 37 | P: AsRef, 38 | FF: Fn(&Path, Vec), 39 | EF: Fn(Error), 40 | { 41 | let p = p.as_ref(); 42 | let md = p.metadata()?; 43 | let ft = md.file_type(); 44 | if ft.is_file() { 45 | let dt = process_file(p, re)?; 46 | ff(p, dt); 47 | } 48 | 49 | if ft.is_dir() { 50 | let dd = std::fs::read_dir(p)?; 51 | for d in dd { 52 | if let Err(e) = process_path(d?.path(), re, ff, ef) { 53 | ef(e); 54 | } 55 | } 56 | } 57 | 58 | Ok(()) 59 | } 60 | 61 | fn main() { 62 | if let Err(e) = run() { 63 | println!("There was an error: {}", e); 64 | } 65 | } 66 | 67 | fn run() -> Result<(), Error> { 68 | let cp = clap_app!( 69 | pgrep => 70 | (version : crate_version!()) 71 | (about : "A Grep like program") 72 | (author : "Matt") 73 | (@arg pattern : +required "The regex pattern to search for") 74 | (@arg file : -f --file +takes_value "The file to test") 75 | ) 76 | .get_matches(); 77 | 78 | let re = Regex::new(cp.value_of("pattern").unwrap())?; 79 | 80 | let p = process_path( 81 | cp.value_of("file").ok_or(ArgErr { arg: "file" })?, 82 | &re, 83 | &|pt, v| { 84 | println!("{:?}", pt); 85 | println!("{:?}", v); 86 | }, 87 | &|e| { 88 | println!("Error:{}", e); 89 | }, 90 | ); 91 | 92 | println!("{:?}", p); 93 | Ok(()) 94 | } 95 | -------------------------------------------------------------------------------- /pgrep/test_data/t1.txt: -------------------------------------------------------------------------------- 1 | help me I'm falling. 2 | Hello world 3 | 4 | Hello People of te world 5 | 6 | Lets all say Hello 7 | -------------------------------------------------------------------------------- /pgrep/test_data/t2.txt: -------------------------------------------------------------------------------- 1 | I'm going for a walk 2 | 3 | I'm going to say Hello 4 | 5 | People will say Hello back 6 | 7 | -------------------------------------------------------------------------------- /shop_base/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "aho-corasick" 3 | version = "0.6.10" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "ansi_term" 11 | version = "0.11.0" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 15 | ] 16 | 17 | [[package]] 18 | name = "atty" 19 | version = "0.2.11" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | dependencies = [ 22 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 23 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 24 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 25 | ] 26 | 27 | [[package]] 28 | name = "autocfg" 29 | version = "0.1.2" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | 32 | [[package]] 33 | name = "backtrace" 34 | version = "0.3.14" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | dependencies = [ 37 | "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 38 | "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", 39 | "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", 40 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 41 | "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", 42 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 43 | ] 44 | 45 | [[package]] 46 | name = "backtrace-sys" 47 | version = "0.1.28" 48 | source = "registry+https://github.com/rust-lang/crates.io-index" 49 | dependencies = [ 50 | "cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)", 51 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 52 | ] 53 | 54 | [[package]] 55 | name = "bitflags" 56 | version = "1.0.4" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | 59 | [[package]] 60 | name = "byteorder" 61 | version = "1.3.1" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | 64 | [[package]] 65 | name = "cc" 66 | version = "1.0.31" 67 | source = "registry+https://github.com/rust-lang/crates.io-index" 68 | 69 | [[package]] 70 | name = "cfg-if" 71 | version = "0.1.7" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | 74 | [[package]] 75 | name = "clap" 76 | version = "2.32.0" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | dependencies = [ 79 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 80 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 81 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 82 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 83 | "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 84 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 85 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 86 | ] 87 | 88 | [[package]] 89 | name = "diesel" 90 | version = "1.4.2" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | dependencies = [ 93 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 94 | "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 95 | "diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 96 | "pq-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", 97 | ] 98 | 99 | [[package]] 100 | name = "diesel_derives" 101 | version = "1.4.0" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | dependencies = [ 104 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 105 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 106 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 107 | ] 108 | 109 | [[package]] 110 | name = "dotenv" 111 | version = "0.13.0" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | dependencies = [ 114 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 115 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 116 | "regex 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 117 | ] 118 | 119 | [[package]] 120 | name = "failure" 121 | version = "0.1.5" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | dependencies = [ 124 | "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", 125 | "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 126 | ] 127 | 128 | [[package]] 129 | name = "failure_derive" 130 | version = "0.1.5" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | dependencies = [ 133 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 134 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 135 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 136 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 137 | ] 138 | 139 | [[package]] 140 | name = "lazy_static" 141 | version = "1.3.0" 142 | source = "registry+https://github.com/rust-lang/crates.io-index" 143 | 144 | [[package]] 145 | name = "libc" 146 | version = "0.2.50" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | 149 | [[package]] 150 | name = "memchr" 151 | version = "2.2.0" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | 154 | [[package]] 155 | name = "pq-sys" 156 | version = "0.4.6" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | dependencies = [ 159 | "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 160 | ] 161 | 162 | [[package]] 163 | name = "proc-macro2" 164 | version = "0.4.27" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | dependencies = [ 167 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 168 | ] 169 | 170 | [[package]] 171 | name = "quote" 172 | version = "0.6.11" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | dependencies = [ 175 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 176 | ] 177 | 178 | [[package]] 179 | name = "redox_syscall" 180 | version = "0.1.51" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | 183 | [[package]] 184 | name = "redox_termios" 185 | version = "0.1.1" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | dependencies = [ 188 | "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", 189 | ] 190 | 191 | [[package]] 192 | name = "regex" 193 | version = "1.1.2" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | dependencies = [ 196 | "aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 197 | "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 198 | "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 199 | "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 200 | "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 201 | ] 202 | 203 | [[package]] 204 | name = "regex-syntax" 205 | version = "0.6.5" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | dependencies = [ 208 | "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 209 | ] 210 | 211 | [[package]] 212 | name = "rustc-demangle" 213 | version = "0.1.13" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | 216 | [[package]] 217 | name = "serde" 218 | version = "1.0.90" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | 221 | [[package]] 222 | name = "serde_derive" 223 | version = "1.0.90" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | dependencies = [ 226 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 227 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 228 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 229 | ] 230 | 231 | [[package]] 232 | name = "shop_base" 233 | version = "0.1.0" 234 | dependencies = [ 235 | "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 236 | "diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 237 | "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", 238 | "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 239 | "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", 240 | "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", 241 | ] 242 | 243 | [[package]] 244 | name = "strsim" 245 | version = "0.7.0" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | 248 | [[package]] 249 | name = "syn" 250 | version = "0.15.29" 251 | source = "registry+https://github.com/rust-lang/crates.io-index" 252 | dependencies = [ 253 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 254 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 255 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 256 | ] 257 | 258 | [[package]] 259 | name = "synstructure" 260 | version = "0.10.1" 261 | source = "registry+https://github.com/rust-lang/crates.io-index" 262 | dependencies = [ 263 | "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", 264 | "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", 265 | "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)", 266 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 267 | ] 268 | 269 | [[package]] 270 | name = "termion" 271 | version = "1.5.1" 272 | source = "registry+https://github.com/rust-lang/crates.io-index" 273 | dependencies = [ 274 | "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)", 275 | "redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)", 276 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 277 | ] 278 | 279 | [[package]] 280 | name = "textwrap" 281 | version = "0.10.0" 282 | source = "registry+https://github.com/rust-lang/crates.io-index" 283 | dependencies = [ 284 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 285 | ] 286 | 287 | [[package]] 288 | name = "thread_local" 289 | version = "0.3.6" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | dependencies = [ 292 | "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 293 | ] 294 | 295 | [[package]] 296 | name = "ucd-util" 297 | version = "0.1.3" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | 300 | [[package]] 301 | name = "unicode-width" 302 | version = "0.1.5" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | 305 | [[package]] 306 | name = "unicode-xid" 307 | version = "0.1.0" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | 310 | [[package]] 311 | name = "utf8-ranges" 312 | version = "1.0.2" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | 315 | [[package]] 316 | name = "vcpkg" 317 | version = "0.2.6" 318 | source = "registry+https://github.com/rust-lang/crates.io-index" 319 | 320 | [[package]] 321 | name = "vec_map" 322 | version = "0.8.1" 323 | source = "registry+https://github.com/rust-lang/crates.io-index" 324 | 325 | [[package]] 326 | name = "winapi" 327 | version = "0.3.6" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | dependencies = [ 330 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 331 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 332 | ] 333 | 334 | [[package]] 335 | name = "winapi-i686-pc-windows-gnu" 336 | version = "0.4.0" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | 339 | [[package]] 340 | name = "winapi-x86_64-pc-windows-gnu" 341 | version = "0.4.0" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | 344 | [metadata] 345 | "checksum aho-corasick 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5" 346 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 347 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 348 | "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" 349 | "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" 350 | "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" 351 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 352 | "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" 353 | "checksum cc 1.0.31 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ce8bb087aacff865633f0bd5aeaed910fe2fe55b55f4739527f2e023a2e53d" 354 | "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" 355 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" 356 | "checksum diesel 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8d24935ba50c4a8dc375a0fd1f8a2ba6bdbdc4125713126a74b965d6a01a06d7" 357 | "checksum diesel_derives 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62a27666098617d52c487a41f70de23d44a1dc1f3aa5877ceba2790fb1f1cab4" 358 | "checksum dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" 359 | "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" 360 | "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" 361 | "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" 362 | "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1" 363 | "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" 364 | "checksum pq-sys 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac25eee5a0582f45a67e837e350d784e7003bd29a5f460796772061ca49ffda" 365 | "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" 366 | "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" 367 | "checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85" 368 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 369 | "checksum regex 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "53ee8cfdddb2e0291adfb9f13d31d3bbe0a03c9a402c01b1e24188d86c35b24f" 370 | "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" 371 | "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" 372 | "checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" 373 | "checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" 374 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 375 | "checksum syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1825685f977249735d510a242a6727b46efe914bb67e38d30c071b1b72b1d5c2" 376 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 377 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 378 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" 379 | "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" 380 | "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" 381 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 382 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 383 | "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" 384 | "checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d" 385 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 386 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 387 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 388 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 389 | -------------------------------------------------------------------------------- /shop_base/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "shop_base" 3 | version = "0.1.0" 4 | authors = ["matthew "] 5 | edition = "2018" 6 | 7 | [[bin]] 8 | name = "shop_cli" 9 | path = "src/cli.rs" 10 | 11 | [lib] 12 | name = "shop_base" 13 | path = "src/lib.rs" 14 | 15 | [dependencies] 16 | 17 | serde = "1.0.90" 18 | serde_derive = "1.0.90" 19 | diesel = {version = "1.4.1", features = ["postgres"]} 20 | dotenv = "0.13.0" 21 | failure = "0.1.5" 22 | clap = "2.32.0" 23 | -------------------------------------------------------------------------------- /shop_base/diesel.toml: -------------------------------------------------------------------------------- 1 | # For documentation on how to configure this file, 2 | # see diesel.rs/guides/configuring-diesel-cli 3 | 4 | [print_schema] 5 | file = "src/schema.rs" 6 | -------------------------------------------------------------------------------- /shop_base/migrations/00000000000000_diesel_initial_setup/down.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass); 6 | DROP FUNCTION IF EXISTS diesel_set_updated_at(); 7 | -------------------------------------------------------------------------------- /shop_base/migrations/00000000000000_diesel_initial_setup/up.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | 6 | 7 | 8 | -- Sets up a trigger for the given table to automatically set a column called 9 | -- `updated_at` whenever the row is modified (unless `updated_at` was included 10 | -- in the modified columns) 11 | -- 12 | -- # Example 13 | -- 14 | -- ```sql 15 | -- CREATE TABLE users (id SERIAL PRIMARY KEY, updated_at TIMESTAMP NOT NULL DEFAULT NOW()); 16 | -- 17 | -- SELECT diesel_manage_updated_at('users'); 18 | -- ``` 19 | CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$ 20 | BEGIN 21 | EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s 22 | FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl); 23 | END; 24 | $$ LANGUAGE plpgsql; 25 | 26 | CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$ 27 | BEGIN 28 | IF ( 29 | NEW IS DISTINCT FROM OLD AND 30 | NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at 31 | ) THEN 32 | NEW.updated_at := current_timestamp; 33 | END IF; 34 | RETURN NEW; 35 | END; 36 | $$ LANGUAGE plpgsql; 37 | -------------------------------------------------------------------------------- /shop_base/migrations/2019-03-26-103937_create_items/down.sql: -------------------------------------------------------------------------------- 1 | -- This file should undo anything in `up.sql` 2 | DROP TABLE items 3 | -------------------------------------------------------------------------------- /shop_base/migrations/2019-03-26-103937_create_items/up.sql: -------------------------------------------------------------------------------- 1 | -- Your SQL goes here 2 | CREATE TABLE items ( 3 | id SERIAL PRIMARY KEY, 4 | name VARCHAR NOT NULL, 5 | description VARCHAR NOT NULL, 6 | price INTEGER NOT NULL, 7 | instock INTEGER NOT NULL DEFAULT 0 8 | ) 9 | -------------------------------------------------------------------------------- /shop_base/src/cli.rs: -------------------------------------------------------------------------------- 1 | extern crate shop_base; 2 | use clap::{clap_app, crate_version}; 3 | use failure::Error; 4 | use shop_base::Conn; 5 | 6 | fn main() -> Result<(), Error> { 7 | let clap = clap_app!(blog_cli => 8 | (about:"Edit the shop_base contents") 9 | (version : crate_version!()) 10 | (author: "Matthew Stoodley") 11 | (@subcommand put => 12 | (about : "Put an item on the database") 13 | (@arg name:+required "The name of the item") 14 | (@arg description:+required "A description of the item") 15 | (@arg price:+required "The price of the item in pence") 16 | ) 17 | (@subcommand find => 18 | (about : "Find items matching a given name part") 19 | (@arg name:+required "A partial match of the item name") 20 | (@arg limit:+takes_value "The maximum number of entries to return") 21 | ) 22 | (@subcommand stock => 23 | (about :"Set the stock level for an item in the store") 24 | (@arg id:+required "The Item id") 25 | (@arg amount:+required "The new value") 26 | (@arg rel:-r "Add to previous value") 27 | ) 28 | ) 29 | .get_matches(); 30 | 31 | let conn = Conn::new()?; 32 | if let Some(sub) = clap.subcommand_matches("put") { 33 | let r = conn.put_item( 34 | sub.value_of("name").unwrap(), 35 | sub.value_of("description").unwrap(), 36 | sub.value_of("price").and_then(|v| v.parse().ok()).unwrap(), 37 | )?; 38 | println!("Added Item {:?}", r); 39 | } 40 | 41 | if let Some(sub) = clap.subcommand_matches("find") { 42 | let r = conn.find_items( 43 | sub.value_of("name").unwrap(), 44 | sub.value_of("limit") 45 | .and_then(|v| v.parse().ok()) 46 | .unwrap_or(5), 47 | )?; 48 | for p in r { 49 | println!("\n----------Entry----------\n"); 50 | println!("{:?}", p); 51 | } 52 | } 53 | 54 | if let Some(sub) = clap.subcommand_matches("stock") { 55 | let r = conn.set_stock( 56 | sub.value_of("id").unwrap().parse().unwrap(), 57 | sub.value_of("amount").unwrap().parse().unwrap(), 58 | sub.is_present("rel"), 59 | ); 60 | println!("Updated : {:?}", r); 61 | } 62 | Ok(()) 63 | } 64 | -------------------------------------------------------------------------------- /shop_base/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[macro_use] 2 | extern crate diesel; 3 | use diesel::pg::PgConnection; 4 | use diesel::prelude::*; 5 | use failure::Error; 6 | 7 | mod models; 8 | pub use models::{Item, NewItem}; 9 | mod schema; 10 | use schema::items; 11 | 12 | pub struct Conn(PgConnection); 13 | 14 | impl Conn { 15 | pub fn new() -> Result { 16 | dotenv::dotenv().ok(); 17 | let db_url = std::env::var("DATABASE_URL")?; 18 | Ok(Conn(PgConnection::establish(&db_url)?)) 19 | } 20 | 21 | pub fn put_item(&self, name: &str, description: &str, price: i32) -> Result { 22 | let nit = NewItem { 23 | name, 24 | description, 25 | price, 26 | }; 27 | diesel::insert_into(items::table) 28 | .values(&nit) 29 | .get_result(&self.0) 30 | .map_err(|x| x.into()) 31 | } 32 | 33 | pub fn find_items(&self, name: &str, lim: i64) -> Result, Error> { 34 | let lname = format!("%{}%", name); 35 | items::table 36 | .filter(items::name.ilike(lname)) 37 | .order(items::id.desc()) 38 | .limit(lim) 39 | .load(&self.0) 40 | .map_err(|e| e.into()) 41 | } 42 | 43 | pub fn set_stock(&self, id: i32, mut n: i32, rel: bool) -> Result { 44 | if rel { 45 | let items: Vec = items::table.find(id).for_update().load(&self.0)?; 46 | n += items[0].instock; 47 | } 48 | diesel::update(items::table::find(items::table, id)) 49 | .set(items::instock.eq(n)) 50 | .get_result(&self.0) 51 | .map_err(|e| e.into()) 52 | } 53 | } 54 | 55 | #[cfg(test)] 56 | mod tests { 57 | #[test] 58 | fn it_works() { 59 | assert_eq!(2 + 2, 4); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /shop_base/src/models.rs: -------------------------------------------------------------------------------- 1 | use crate::schema::items; 2 | use serde_derive::*; 3 | 4 | #[derive(Queryable, Serialize, Deserialize, Clone, Debug)] 5 | pub struct Item { 6 | pub id: i32, 7 | pub name: String, 8 | pub description: String, 9 | pub price: i32, 10 | pub instock: i32, 11 | } 12 | 13 | #[derive(Queryable, Insertable, Clone, Debug)] 14 | #[table_name = "items"] 15 | pub struct NewItem<'a> { 16 | pub name: &'a str, 17 | pub description: &'a str, 18 | pub price: i32, 19 | } 20 | -------------------------------------------------------------------------------- /shop_base/src/schema.rs: -------------------------------------------------------------------------------- 1 | table! { 2 | items (id) { 3 | id -> Int4, 4 | name -> Varchar, 5 | description -> Varchar, 6 | price -> Int4, 7 | instock -> Int4, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /shop_site/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "shop_site" 3 | version = "0.1.0" 4 | authors = ["matthew "] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | actix = "0.7.9" 9 | actix-web = "0.7.19" 10 | failure = "0.1.5" 11 | shop_base = {path = "../shop_base"} 12 | futures = "0.1.26" 13 | serde = "1.0.90" 14 | serde_derive = "1.0.90" 15 | lazy_static = "1.3.0" 16 | handlebars = "1.1.0" 17 | -------------------------------------------------------------------------------- /shop_site/src/main.rs: -------------------------------------------------------------------------------- 1 | use actix::prelude::*; 2 | use actix_web::middleware::session::{CookieSessionBackend, RequestSession, SessionStorage}; 3 | use actix_web::{ 4 | fs, http, server::HttpServer, App, AsyncResponder, Form, HttpRequest, HttpResponse, Query, 5 | Responder, State, 6 | }; 7 | use failure::Error; 8 | use futures::Future; 9 | use handlebars::Handlebars; 10 | use serde_derive::*; 11 | use shop_base::{Conn, Item}; 12 | 13 | enum DBRequest { 14 | FindItems(String, i64), 15 | } 16 | enum DBResponse { 17 | FoundItems(Vec), 18 | } 19 | 20 | impl Message for DBRequest { 21 | type Result = Result; 22 | } 23 | 24 | pub struct DBExecutor { 25 | conn: Conn, 26 | } 27 | 28 | impl Actor for DBExecutor { 29 | type Context = SyncContext; 30 | } 31 | 32 | impl Handler for DBExecutor { 33 | type Result = Result; 34 | fn handle(&mut self, msg: DBRequest, _: &mut Self::Context) -> Self::Result { 35 | match msg { 36 | DBRequest::FindItems(s, i) => Ok(DBResponse::FoundItems(self.conn.find_items(&s, i)?)), 37 | } 38 | } 39 | } 40 | 41 | #[derive(Deserialize, Debug)] 42 | struct FormFindItems { 43 | search_term: String, 44 | limit: Option, 45 | } 46 | 47 | fn search( 48 | page_hand: &Addr, 49 | ffi: &FormFindItems, 50 | req: &HttpRequest, 51 | ) -> impl Responder { 52 | let searches = req 53 | .session() 54 | .get::("searches") 55 | .expect("Session Should exist") 56 | .unwrap_or(0) 57 | + 1; 58 | req.session() 59 | .set("searches", searches) 60 | .expect("Could not set searches"); 61 | page_hand 62 | .send(DBRequest::FindItems( 63 | ffi.search_term.clone(), 64 | ffi.limit.unwrap_or(5), 65 | )) 66 | .and_then(move |r| match r { 67 | Ok(DBResponse::FoundItems(v)) => Ok(HttpResponse::Ok() 68 | .content_type("text/html") 69 | .body(TEMPLATES.render("item_list", &(&v, searches)).unwrap())), 70 | Err(_) => Ok(HttpResponse::Ok().json("Error finding Database")), 71 | }) 72 | .responder() 73 | } 74 | 75 | lazy_static::lazy_static! { 76 | static ref TEMPLATES:Handlebars = { 77 | let mut res = Handlebars::new(); 78 | let df = std::fs::read_to_string("test_site/templates/item_list.html").expect("Could not read template"); 79 | res.register_template_string("item_list",df).expect("Could not parse template"); 80 | res 81 | }; 82 | } 83 | 84 | fn main() { 85 | let sys = System::new("shop_site"); 86 | 87 | let db_hand = SyncArbiter::start(3, || DBExecutor { 88 | conn: Conn::new().unwrap(), 89 | }); 90 | 91 | HttpServer::new(move || { 92 | vec![ 93 | App::with_state(db_hand.clone()) 94 | .prefix("/db/") 95 | .middleware(SessionStorage::new( 96 | CookieSessionBackend::signed(&[0; 32]).secure(false), 97 | )) 98 | .resource("/", |r| { 99 | r.f(|_| { 100 | HttpResponse::Ok() 101 | .content_type("text/plain") 102 | .body("This is the Database side of the app") 103 | }) 104 | }) 105 | .resource("/find_items", |r| { 106 | r.method(http::Method::GET).with( 107 | |(state, query, req): ( 108 | State>, 109 | Query, 110 | HttpRequest<_>, 111 | )| { search(&state, &query, &req) }, 112 | ); 113 | 114 | r.method(http::Method::POST).with( 115 | |(state, form, req): ( 116 | State>, 117 | Form, 118 | HttpRequest<_>, 119 | )| { search(&state, &form, &req) }, 120 | ) 121 | }) 122 | .boxed(), 123 | App::new() 124 | .handler( 125 | "/", 126 | fs::StaticFiles::new("test_site/static/") 127 | .unwrap() 128 | .show_files_listing() 129 | .index_file("index.html"), 130 | ) 131 | .boxed(), 132 | ] 133 | }) 134 | .bind("127.0.0.1:8088") 135 | .unwrap() 136 | .start(); 137 | 138 | sys.run(); 139 | 140 | println!("Done"); 141 | } 142 | -------------------------------------------------------------------------------- /shop_site/test_site/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Welcome to the Shop

8 |

I hope you like it here

9 |

Get Request

10 |
11 | Term: 12 | Limit: 13 | 14 |
15 |

Post Request

16 |
17 | Term: 18 | Limit: 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /shop_site/test_site/templates/item_list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Welcome to the Shop

8 |

I hope you like it here

9 |

Get Request

10 |
11 | Term: 12 | Limit: 13 | 14 |
15 |

Post Request

16 |
17 | Term: 18 | Limit: 19 | 20 |
21 | 22 |

Searches so far = {{this.1}}

23 |

Results

24 | {{#each this.0}} 25 |
26 | {{id}} : {{name}} 27 |
28 | {{/each}} 29 | 30 | 31 | --------------------------------------------------------------------------------