├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE.txt ├── README.md ├── eventsourcing-derive ├── .gitignore ├── Cargo.lock ├── Cargo.toml └── src │ └── lib.rs ├── examples ├── bank.rs ├── combat │ ├── domain.rs │ └── main.rs └── location.rs ├── src ├── cloudevents.rs ├── eventstore │ ├── inmemory.rs │ ├── mod.rs │ └── orgeventstore.rs ├── lib.rs └── prelude.rs └── tests └── cloudevents.rs /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | /target 3 | **/*.rs.bk 4 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | [[package]] 4 | name = "anyhow" 5 | version = "1.0.26" 6 | source = "registry+https://github.com/rust-lang/crates.io-index" 7 | 8 | [[package]] 9 | name = "autocfg" 10 | version = "1.0.0" 11 | source = "registry+https://github.com/rust-lang/crates.io-index" 12 | 13 | [[package]] 14 | name = "base64" 15 | version = "0.11.0" 16 | source = "registry+https://github.com/rust-lang/crates.io-index" 17 | 18 | [[package]] 19 | name = "bitflags" 20 | version = "1.2.1" 21 | source = "registry+https://github.com/rust-lang/crates.io-index" 22 | 23 | [[package]] 24 | name = "bumpalo" 25 | version = "3.1.2" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | 28 | [[package]] 29 | name = "bytes" 30 | version = "0.5.4" 31 | source = "registry+https://github.com/rust-lang/crates.io-index" 32 | 33 | [[package]] 34 | name = "c2-chacha" 35 | version = "0.2.3" 36 | source = "registry+https://github.com/rust-lang/crates.io-index" 37 | dependencies = [ 38 | "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 39 | ] 40 | 41 | [[package]] 42 | name = "cc" 43 | version = "1.0.50" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | 46 | [[package]] 47 | name = "cfg-if" 48 | version = "0.1.10" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | 51 | [[package]] 52 | name = "chrono" 53 | version = "0.4.10" 54 | source = "registry+https://github.com/rust-lang/crates.io-index" 55 | dependencies = [ 56 | "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 57 | "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 58 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 59 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 60 | ] 61 | 62 | [[package]] 63 | name = "core-foundation" 64 | version = "0.6.4" 65 | source = "registry+https://github.com/rust-lang/crates.io-index" 66 | dependencies = [ 67 | "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", 68 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 69 | ] 70 | 71 | [[package]] 72 | name = "core-foundation-sys" 73 | version = "0.6.2" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | 76 | [[package]] 77 | name = "dtoa" 78 | version = "0.4.5" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | 81 | [[package]] 82 | name = "encoding_rs" 83 | version = "0.8.22" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | dependencies = [ 86 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 87 | ] 88 | 89 | [[package]] 90 | name = "eventsourcing" 91 | version = "0.1.5" 92 | dependencies = [ 93 | "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 94 | "eventsourcing-derive 0.1.3", 95 | "reqwest 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 96 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 97 | "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 98 | "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", 99 | "uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 100 | ] 101 | 102 | [[package]] 103 | name = "eventsourcing-derive" 104 | version = "0.1.3" 105 | dependencies = [ 106 | "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 107 | "syn 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)", 108 | ] 109 | 110 | [[package]] 111 | name = "fnv" 112 | version = "1.0.6" 113 | source = "registry+https://github.com/rust-lang/crates.io-index" 114 | 115 | [[package]] 116 | name = "foreign-types" 117 | version = "0.3.2" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | dependencies = [ 120 | "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 121 | ] 122 | 123 | [[package]] 124 | name = "foreign-types-shared" 125 | version = "0.1.1" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | 128 | [[package]] 129 | name = "fuchsia-zircon" 130 | version = "0.3.3" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | dependencies = [ 133 | "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 134 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 135 | ] 136 | 137 | [[package]] 138 | name = "fuchsia-zircon-sys" 139 | version = "0.3.3" 140 | source = "registry+https://github.com/rust-lang/crates.io-index" 141 | 142 | [[package]] 143 | name = "futures-channel" 144 | version = "0.3.1" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | dependencies = [ 147 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 148 | ] 149 | 150 | [[package]] 151 | name = "futures-core" 152 | version = "0.3.1" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | 155 | [[package]] 156 | name = "futures-io" 157 | version = "0.3.1" 158 | source = "registry+https://github.com/rust-lang/crates.io-index" 159 | 160 | [[package]] 161 | name = "futures-sink" 162 | version = "0.3.1" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | 165 | [[package]] 166 | name = "futures-task" 167 | version = "0.3.1" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | 170 | [[package]] 171 | name = "futures-util" 172 | version = "0.3.1" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | dependencies = [ 175 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 176 | "futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 177 | "futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 178 | "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 179 | "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", 180 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 181 | ] 182 | 183 | [[package]] 184 | name = "getrandom" 185 | version = "0.1.14" 186 | source = "registry+https://github.com/rust-lang/crates.io-index" 187 | dependencies = [ 188 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 189 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 190 | "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", 191 | ] 192 | 193 | [[package]] 194 | name = "h2" 195 | version = "0.2.1" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | dependencies = [ 198 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 199 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 200 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 201 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 202 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 203 | "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 204 | "indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 205 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 206 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 207 | "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 208 | "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 209 | ] 210 | 211 | [[package]] 212 | name = "heck" 213 | version = "0.3.1" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | dependencies = [ 216 | "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", 217 | ] 218 | 219 | [[package]] 220 | name = "hermit-abi" 221 | version = "0.1.6" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | dependencies = [ 224 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 225 | ] 226 | 227 | [[package]] 228 | name = "http" 229 | version = "0.2.0" 230 | source = "registry+https://github.com/rust-lang/crates.io-index" 231 | dependencies = [ 232 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 233 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 234 | "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", 235 | ] 236 | 237 | [[package]] 238 | name = "http-body" 239 | version = "0.3.1" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | dependencies = [ 242 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 243 | "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 244 | ] 245 | 246 | [[package]] 247 | name = "httparse" 248 | version = "1.3.4" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | 251 | [[package]] 252 | name = "hyper" 253 | version = "0.13.2" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | dependencies = [ 256 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 257 | "futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 258 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 259 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 260 | "h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 261 | "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 262 | "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 263 | "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 264 | "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", 265 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 266 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 267 | "pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 268 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 269 | "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 270 | "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 271 | "want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 272 | ] 273 | 274 | [[package]] 275 | name = "hyper-tls" 276 | version = "0.4.1" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | dependencies = [ 279 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 280 | "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", 281 | "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 283 | "tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 284 | ] 285 | 286 | [[package]] 287 | name = "idna" 288 | version = "0.2.0" 289 | source = "registry+https://github.com/rust-lang/crates.io-index" 290 | dependencies = [ 291 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 292 | "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 293 | "unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", 294 | ] 295 | 296 | [[package]] 297 | name = "indexmap" 298 | version = "1.3.1" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | dependencies = [ 301 | "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 302 | ] 303 | 304 | [[package]] 305 | name = "iovec" 306 | version = "0.1.4" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | dependencies = [ 309 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 310 | ] 311 | 312 | [[package]] 313 | name = "itoa" 314 | version = "0.4.5" 315 | source = "registry+https://github.com/rust-lang/crates.io-index" 316 | 317 | [[package]] 318 | name = "js-sys" 319 | version = "0.3.35" 320 | source = "registry+https://github.com/rust-lang/crates.io-index" 321 | dependencies = [ 322 | "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 323 | ] 324 | 325 | [[package]] 326 | name = "kernel32-sys" 327 | version = "0.2.2" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | dependencies = [ 330 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 331 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 332 | ] 333 | 334 | [[package]] 335 | name = "lazy_static" 336 | version = "1.4.0" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | 339 | [[package]] 340 | name = "libc" 341 | version = "0.2.66" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | 344 | [[package]] 345 | name = "log" 346 | version = "0.4.8" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | dependencies = [ 349 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 350 | ] 351 | 352 | [[package]] 353 | name = "matches" 354 | version = "0.1.8" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | 357 | [[package]] 358 | name = "memchr" 359 | version = "2.3.0" 360 | source = "registry+https://github.com/rust-lang/crates.io-index" 361 | 362 | [[package]] 363 | name = "mime" 364 | version = "0.3.16" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | 367 | [[package]] 368 | name = "mime_guess" 369 | version = "2.0.1" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | dependencies = [ 372 | "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 373 | "unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", 374 | ] 375 | 376 | [[package]] 377 | name = "mio" 378 | version = "0.6.21" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | dependencies = [ 381 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 382 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 383 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 384 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 385 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 386 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 387 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 388 | "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 389 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 390 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 391 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 392 | ] 393 | 394 | [[package]] 395 | name = "miow" 396 | version = "0.2.1" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | dependencies = [ 399 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 400 | "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", 401 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 402 | "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 403 | ] 404 | 405 | [[package]] 406 | name = "native-tls" 407 | version = "0.2.3" 408 | source = "registry+https://github.com/rust-lang/crates.io-index" 409 | dependencies = [ 410 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 411 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 412 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 413 | "openssl 0.10.27 (registry+https://github.com/rust-lang/crates.io-index)", 414 | "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 415 | "openssl-sys 0.9.54 (registry+https://github.com/rust-lang/crates.io-index)", 416 | "schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", 417 | "security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 418 | "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 419 | "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 420 | ] 421 | 422 | [[package]] 423 | name = "net2" 424 | version = "0.2.33" 425 | source = "registry+https://github.com/rust-lang/crates.io-index" 426 | dependencies = [ 427 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 428 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 429 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 430 | ] 431 | 432 | [[package]] 433 | name = "nom" 434 | version = "4.2.3" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | dependencies = [ 437 | "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 438 | "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 439 | ] 440 | 441 | [[package]] 442 | name = "num-integer" 443 | version = "0.1.42" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | dependencies = [ 446 | "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 447 | "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 448 | ] 449 | 450 | [[package]] 451 | name = "num-traits" 452 | version = "0.2.11" 453 | source = "registry+https://github.com/rust-lang/crates.io-index" 454 | dependencies = [ 455 | "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 456 | ] 457 | 458 | [[package]] 459 | name = "num_cpus" 460 | version = "1.12.0" 461 | source = "registry+https://github.com/rust-lang/crates.io-index" 462 | dependencies = [ 463 | "hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 464 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 465 | ] 466 | 467 | [[package]] 468 | name = "openssl" 469 | version = "0.10.27" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | dependencies = [ 472 | "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 473 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 474 | "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 475 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 476 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 477 | "openssl-sys 0.9.54 (registry+https://github.com/rust-lang/crates.io-index)", 478 | ] 479 | 480 | [[package]] 481 | name = "openssl-probe" 482 | version = "0.1.2" 483 | source = "registry+https://github.com/rust-lang/crates.io-index" 484 | 485 | [[package]] 486 | name = "openssl-sys" 487 | version = "0.9.54" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | dependencies = [ 490 | "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 491 | "cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)", 492 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 493 | "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", 494 | "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 495 | ] 496 | 497 | [[package]] 498 | name = "percent-encoding" 499 | version = "2.1.0" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | 502 | [[package]] 503 | name = "pin-project" 504 | version = "0.4.8" 505 | source = "registry+https://github.com/rust-lang/crates.io-index" 506 | dependencies = [ 507 | "pin-project-internal 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 508 | ] 509 | 510 | [[package]] 511 | name = "pin-project-internal" 512 | version = "0.4.8" 513 | source = "registry+https://github.com/rust-lang/crates.io-index" 514 | dependencies = [ 515 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 516 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 517 | "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", 518 | ] 519 | 520 | [[package]] 521 | name = "pin-project-lite" 522 | version = "0.1.4" 523 | source = "registry+https://github.com/rust-lang/crates.io-index" 524 | 525 | [[package]] 526 | name = "pin-utils" 527 | version = "0.1.0-alpha.4" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | 530 | [[package]] 531 | name = "pkg-config" 532 | version = "0.3.17" 533 | source = "registry+https://github.com/rust-lang/crates.io-index" 534 | 535 | [[package]] 536 | name = "ppv-lite86" 537 | version = "0.2.6" 538 | source = "registry+https://github.com/rust-lang/crates.io-index" 539 | 540 | [[package]] 541 | name = "proc-macro2" 542 | version = "0.2.3" 543 | source = "registry+https://github.com/rust-lang/crates.io-index" 544 | dependencies = [ 545 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 546 | ] 547 | 548 | [[package]] 549 | name = "proc-macro2" 550 | version = "1.0.8" 551 | source = "registry+https://github.com/rust-lang/crates.io-index" 552 | dependencies = [ 553 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 554 | ] 555 | 556 | [[package]] 557 | name = "quote" 558 | version = "0.4.2" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | dependencies = [ 561 | "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 562 | ] 563 | 564 | [[package]] 565 | name = "quote" 566 | version = "1.0.2" 567 | source = "registry+https://github.com/rust-lang/crates.io-index" 568 | dependencies = [ 569 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 570 | ] 571 | 572 | [[package]] 573 | name = "rand" 574 | version = "0.7.3" 575 | source = "registry+https://github.com/rust-lang/crates.io-index" 576 | dependencies = [ 577 | "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", 578 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 579 | "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", 580 | "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 581 | "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 582 | ] 583 | 584 | [[package]] 585 | name = "rand_chacha" 586 | version = "0.2.1" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | dependencies = [ 589 | "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 590 | "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 591 | ] 592 | 593 | [[package]] 594 | name = "rand_core" 595 | version = "0.5.1" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | dependencies = [ 598 | "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", 599 | ] 600 | 601 | [[package]] 602 | name = "rand_hc" 603 | version = "0.2.0" 604 | source = "registry+https://github.com/rust-lang/crates.io-index" 605 | dependencies = [ 606 | "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 607 | ] 608 | 609 | [[package]] 610 | name = "redox_syscall" 611 | version = "0.1.56" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | 614 | [[package]] 615 | name = "remove_dir_all" 616 | version = "0.5.2" 617 | source = "registry+https://github.com/rust-lang/crates.io-index" 618 | dependencies = [ 619 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 620 | ] 621 | 622 | [[package]] 623 | name = "reqwest" 624 | version = "0.10.1" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | dependencies = [ 627 | "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 628 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 629 | "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", 630 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 631 | "futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 632 | "http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 633 | "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 634 | "hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)", 635 | "hyper-tls 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", 636 | "js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 637 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 638 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 639 | "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 640 | "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", 641 | "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 642 | "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 643 | "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 644 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 645 | "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", 646 | "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 647 | "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", 648 | "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 649 | "tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 650 | "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 651 | "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 652 | "wasm-bindgen-futures 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 653 | "web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 654 | "winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", 655 | ] 656 | 657 | [[package]] 658 | name = "ryu" 659 | version = "1.0.2" 660 | source = "registry+https://github.com/rust-lang/crates.io-index" 661 | 662 | [[package]] 663 | name = "schannel" 664 | version = "0.1.16" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | dependencies = [ 667 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 668 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 669 | ] 670 | 671 | [[package]] 672 | name = "security-framework" 673 | version = "0.3.4" 674 | source = "registry+https://github.com/rust-lang/crates.io-index" 675 | dependencies = [ 676 | "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", 677 | "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", 678 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 679 | "security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 680 | ] 681 | 682 | [[package]] 683 | name = "security-framework-sys" 684 | version = "0.3.3" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | dependencies = [ 687 | "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", 688 | ] 689 | 690 | [[package]] 691 | name = "serde" 692 | version = "1.0.104" 693 | source = "registry+https://github.com/rust-lang/crates.io-index" 694 | 695 | [[package]] 696 | name = "serde_derive" 697 | version = "1.0.104" 698 | source = "registry+https://github.com/rust-lang/crates.io-index" 699 | dependencies = [ 700 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 701 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 702 | "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", 703 | ] 704 | 705 | [[package]] 706 | name = "serde_json" 707 | version = "1.0.46" 708 | source = "registry+https://github.com/rust-lang/crates.io-index" 709 | dependencies = [ 710 | "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", 711 | "ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 712 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 713 | ] 714 | 715 | [[package]] 716 | name = "serde_urlencoded" 717 | version = "0.6.1" 718 | source = "registry+https://github.com/rust-lang/crates.io-index" 719 | dependencies = [ 720 | "dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", 721 | "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", 722 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 723 | "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 724 | ] 725 | 726 | [[package]] 727 | name = "slab" 728 | version = "0.4.2" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | 731 | [[package]] 732 | name = "smallvec" 733 | version = "1.2.0" 734 | source = "registry+https://github.com/rust-lang/crates.io-index" 735 | 736 | [[package]] 737 | name = "sourcefile" 738 | version = "0.1.4" 739 | source = "registry+https://github.com/rust-lang/crates.io-index" 740 | 741 | [[package]] 742 | name = "syn" 743 | version = "0.12.15" 744 | source = "registry+https://github.com/rust-lang/crates.io-index" 745 | dependencies = [ 746 | "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 747 | "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 748 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 749 | ] 750 | 751 | [[package]] 752 | name = "syn" 753 | version = "1.0.14" 754 | source = "registry+https://github.com/rust-lang/crates.io-index" 755 | dependencies = [ 756 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 757 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 758 | "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 759 | ] 760 | 761 | [[package]] 762 | name = "tempfile" 763 | version = "3.1.0" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | dependencies = [ 766 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 767 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 768 | "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", 769 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 770 | "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 771 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 772 | ] 773 | 774 | [[package]] 775 | name = "time" 776 | version = "0.1.42" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | dependencies = [ 779 | "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", 780 | "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", 781 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 782 | ] 783 | 784 | [[package]] 785 | name = "tokio" 786 | version = "0.2.11" 787 | source = "registry+https://github.com/rust-lang/crates.io-index" 788 | dependencies = [ 789 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 790 | "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", 791 | "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 792 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 793 | "memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 794 | "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", 795 | "num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 796 | "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 797 | "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 798 | ] 799 | 800 | [[package]] 801 | name = "tokio-tls" 802 | version = "0.3.0" 803 | source = "registry+https://github.com/rust-lang/crates.io-index" 804 | dependencies = [ 805 | "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 806 | "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 807 | ] 808 | 809 | [[package]] 810 | name = "tokio-util" 811 | version = "0.2.0" 812 | source = "registry+https://github.com/rust-lang/crates.io-index" 813 | dependencies = [ 814 | "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", 815 | "futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 816 | "futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 817 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 818 | "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 819 | "tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 820 | ] 821 | 822 | [[package]] 823 | name = "tower-service" 824 | version = "0.3.0" 825 | source = "registry+https://github.com/rust-lang/crates.io-index" 826 | 827 | [[package]] 828 | name = "try-lock" 829 | version = "0.2.2" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | 832 | [[package]] 833 | name = "unicase" 834 | version = "2.6.0" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | dependencies = [ 837 | "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", 838 | ] 839 | 840 | [[package]] 841 | name = "unicode-bidi" 842 | version = "0.3.4" 843 | source = "registry+https://github.com/rust-lang/crates.io-index" 844 | dependencies = [ 845 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 846 | ] 847 | 848 | [[package]] 849 | name = "unicode-normalization" 850 | version = "0.1.12" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | dependencies = [ 853 | "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 854 | ] 855 | 856 | [[package]] 857 | name = "unicode-segmentation" 858 | version = "1.6.0" 859 | source = "registry+https://github.com/rust-lang/crates.io-index" 860 | 861 | [[package]] 862 | name = "unicode-xid" 863 | version = "0.1.0" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | 866 | [[package]] 867 | name = "unicode-xid" 868 | version = "0.2.0" 869 | source = "registry+https://github.com/rust-lang/crates.io-index" 870 | 871 | [[package]] 872 | name = "url" 873 | version = "2.1.1" 874 | source = "registry+https://github.com/rust-lang/crates.io-index" 875 | dependencies = [ 876 | "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 877 | "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 878 | "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 879 | ] 880 | 881 | [[package]] 882 | name = "uuid" 883 | version = "0.8.1" 884 | source = "registry+https://github.com/rust-lang/crates.io-index" 885 | dependencies = [ 886 | "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", 887 | ] 888 | 889 | [[package]] 890 | name = "vcpkg" 891 | version = "0.2.8" 892 | source = "registry+https://github.com/rust-lang/crates.io-index" 893 | 894 | [[package]] 895 | name = "version_check" 896 | version = "0.1.5" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | 899 | [[package]] 900 | name = "version_check" 901 | version = "0.9.1" 902 | source = "registry+https://github.com/rust-lang/crates.io-index" 903 | 904 | [[package]] 905 | name = "want" 906 | version = "0.3.0" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | dependencies = [ 909 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 910 | "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 911 | ] 912 | 913 | [[package]] 914 | name = "wasi" 915 | version = "0.9.0+wasi-snapshot-preview1" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | 918 | [[package]] 919 | name = "wasm-bindgen" 920 | version = "0.2.58" 921 | source = "registry+https://github.com/rust-lang/crates.io-index" 922 | dependencies = [ 923 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 924 | "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", 925 | "serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)", 926 | "wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 927 | ] 928 | 929 | [[package]] 930 | name = "wasm-bindgen-backend" 931 | version = "0.2.58" 932 | source = "registry+https://github.com/rust-lang/crates.io-index" 933 | dependencies = [ 934 | "bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 935 | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 936 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 937 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 938 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 939 | "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", 940 | "wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 941 | ] 942 | 943 | [[package]] 944 | name = "wasm-bindgen-futures" 945 | version = "0.4.8" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | dependencies = [ 948 | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 949 | "js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 950 | "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 951 | "web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 952 | ] 953 | 954 | [[package]] 955 | name = "wasm-bindgen-macro" 956 | version = "0.2.58" 957 | source = "registry+https://github.com/rust-lang/crates.io-index" 958 | dependencies = [ 959 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 960 | "wasm-bindgen-macro-support 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 961 | ] 962 | 963 | [[package]] 964 | name = "wasm-bindgen-macro-support" 965 | version = "0.2.58" 966 | source = "registry+https://github.com/rust-lang/crates.io-index" 967 | dependencies = [ 968 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 969 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 970 | "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", 971 | "wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 972 | "wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 973 | ] 974 | 975 | [[package]] 976 | name = "wasm-bindgen-shared" 977 | version = "0.2.58" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | 980 | [[package]] 981 | name = "wasm-bindgen-webidl" 982 | version = "0.2.58" 983 | source = "registry+https://github.com/rust-lang/crates.io-index" 984 | dependencies = [ 985 | "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", 986 | "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 987 | "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", 988 | "proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", 989 | "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 990 | "syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", 991 | "wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 992 | "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 993 | ] 994 | 995 | [[package]] 996 | name = "web-sys" 997 | version = "0.3.35" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | dependencies = [ 1000 | "anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)", 1001 | "js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)", 1002 | "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 1003 | "wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 1004 | "wasm-bindgen-webidl 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", 1005 | ] 1006 | 1007 | [[package]] 1008 | name = "weedle" 1009 | version = "0.10.0" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | dependencies = [ 1012 | "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "winapi" 1017 | version = "0.2.8" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | 1020 | [[package]] 1021 | name = "winapi" 1022 | version = "0.3.8" 1023 | source = "registry+https://github.com/rust-lang/crates.io-index" 1024 | dependencies = [ 1025 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1026 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 1027 | ] 1028 | 1029 | [[package]] 1030 | name = "winapi-build" 1031 | version = "0.1.1" 1032 | source = "registry+https://github.com/rust-lang/crates.io-index" 1033 | 1034 | [[package]] 1035 | name = "winapi-i686-pc-windows-gnu" 1036 | version = "0.4.0" 1037 | source = "registry+https://github.com/rust-lang/crates.io-index" 1038 | 1039 | [[package]] 1040 | name = "winapi-x86_64-pc-windows-gnu" 1041 | version = "0.4.0" 1042 | source = "registry+https://github.com/rust-lang/crates.io-index" 1043 | 1044 | [[package]] 1045 | name = "winreg" 1046 | version = "0.6.2" 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" 1048 | dependencies = [ 1049 | "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 1050 | ] 1051 | 1052 | [[package]] 1053 | name = "ws2_32-sys" 1054 | version = "0.2.1" 1055 | source = "registry+https://github.com/rust-lang/crates.io-index" 1056 | dependencies = [ 1057 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 1058 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 1059 | ] 1060 | 1061 | [metadata] 1062 | "checksum anyhow 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "7825f6833612eb2414095684fcf6c635becf3ce97fe48cf6421321e93bfbd53c" 1063 | "checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" 1064 | "checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" 1065 | "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" 1066 | "checksum bumpalo 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5fb8038c1ddc0a5f73787b130f4cc75151e96ed33e417fde765eb5a81e3532f4" 1067 | "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" 1068 | "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" 1069 | "checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd" 1070 | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 1071 | "checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01" 1072 | "checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" 1073 | "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" 1074 | "checksum dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" 1075 | "checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" 1076 | "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" 1077 | "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 1078 | "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 1079 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 1080 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 1081 | "checksum futures-channel 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fcae98ca17d102fd8a3603727b9259fcf7fa4239b603d2142926189bc8999b86" 1082 | "checksum futures-core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "79564c427afefab1dfb3298535b21eda083ef7935b4f0ecbfcb121f0aec10866" 1083 | "checksum futures-io 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e676577d229e70952ab25f3945795ba5b16d63ca794ca9d2c860e5595d20b5ff" 1084 | "checksum futures-sink 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "171be33efae63c2d59e6dbba34186fe0d6394fb378069a76dfd80fdcffd43c16" 1085 | "checksum futures-task 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0bae52d6b29cf440e298856fec3965ee6fa71b06aa7495178615953fd669e5f9" 1086 | "checksum futures-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d66274fb76985d3c62c886d1da7ac4c0903a8c9f754e8fe0f35a6a6cc39e76" 1087 | "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" 1088 | "checksum h2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9433d71e471c1736fd5a61b671fc0b148d7a2992f666c958d03cd8feb3b88d1" 1089 | "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" 1090 | "checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772" 1091 | "checksum http 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b708cc7f06493459026f53b9a61a7a121a5d1ec6238dee58ea4941132b30156b" 1092 | "checksum http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" 1093 | "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" 1094 | "checksum hyper 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fa1c527bbc634be72aa7ba31e4e4def9bbb020f5416916279b7c705cd838893e" 1095 | "checksum hyper-tls 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" 1096 | "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" 1097 | "checksum indexmap 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b54058f0a6ff80b6803da8faf8997cde53872b38f4023728f6830b06cd3c0dc" 1098 | "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" 1099 | "checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" 1100 | "checksum js-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "7889c7c36282151f6bf465be4700359318aef36baa951462382eae49e9577cf9" 1101 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 1102 | "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 1103 | "checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" 1104 | "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" 1105 | "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" 1106 | "checksum memchr 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3197e20c7edb283f87c071ddfc7a2cca8f8e0b888c242959846a6fce03c72223" 1107 | "checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 1108 | "checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599" 1109 | "checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" 1110 | "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" 1111 | "checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" 1112 | "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" 1113 | "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" 1114 | "checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" 1115 | "checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" 1116 | "checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6" 1117 | "checksum openssl 0.10.27 (registry+https://github.com/rust-lang/crates.io-index)" = "e176a45fedd4c990e26580847a525e39e16ec32ac78957dbf62ded31b3abfd6f" 1118 | "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" 1119 | "checksum openssl-sys 0.9.54 (registry+https://github.com/rust-lang/crates.io-index)" = "1024c0a59774200a555087a6da3f253a9095a5f344e353b212ac4c8b8e450986" 1120 | "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 1121 | "checksum pin-project 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c" 1122 | "checksum pin-project-internal 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f" 1123 | "checksum pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" 1124 | "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" 1125 | "checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" 1126 | "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" 1127 | "checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" 1128 | "checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548" 1129 | "checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" 1130 | "checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" 1131 | "checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" 1132 | "checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" 1133 | "checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" 1134 | "checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" 1135 | "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" 1136 | "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" 1137 | "checksum reqwest 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0e798e19e258bf6c30a304622e3e9ac820e483b06a1857a026e1f109b113fe4" 1138 | "checksum ryu 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfa8506c1de11c9c4e4c38863ccbe02a305c8188e85a05a784c9e11e1c3910c8" 1139 | "checksum schannel 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "87f550b06b6cba9c8b8be3ee73f391990116bf527450d2556e9b9ce263b9a021" 1140 | "checksum security-framework 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8ef2429d7cefe5fd28bd1d2ed41c944547d4ff84776f5935b456da44593a16df" 1141 | "checksum security-framework-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e31493fc37615debb8c5090a7aeb4a9730bc61e77ab10b9af59f1a202284f895" 1142 | "checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449" 1143 | "checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64" 1144 | "checksum serde_json 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)" = "21b01d7f0288608a01dca632cf1df859df6fd6ffa885300fc275ce2ba6221953" 1145 | "checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" 1146 | "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 1147 | "checksum smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" 1148 | "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" 1149 | "checksum syn 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c97c05b8ebc34ddd6b967994d5c6e9852fa92f8b82b3858c39451f97346dcce5" 1150 | "checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5" 1151 | "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" 1152 | "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" 1153 | "checksum tokio 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b" 1154 | "checksum tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828" 1155 | "checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" 1156 | "checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" 1157 | "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" 1158 | "checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" 1159 | "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" 1160 | "checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" 1161 | "checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" 1162 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 1163 | "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" 1164 | "checksum url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" 1165 | "checksum uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" 1166 | "checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" 1167 | "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" 1168 | "checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" 1169 | "checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1170 | "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 1171 | "checksum wasm-bindgen 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "5205e9afdf42282b192e2310a5b463a6d1c1d774e30dc3c791ac37ab42d2616c" 1172 | "checksum wasm-bindgen-backend 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "11cdb95816290b525b32587d76419facd99662a07e59d3cdb560488a819d9a45" 1173 | "checksum wasm-bindgen-futures 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8bbdd49e3e28b40dec6a9ba8d17798245ce32b019513a845369c641b275135d9" 1174 | "checksum wasm-bindgen-macro 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "574094772ce6921576fb6f2e3f7497b8a76273b6db092be18fc48a082de09dc3" 1175 | "checksum wasm-bindgen-macro-support 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "e85031354f25eaebe78bb7db1c3d86140312a911a106b2e29f9cc440ce3e7668" 1176 | "checksum wasm-bindgen-shared 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e7e61fc929f4c0dddb748b102ebf9f632e2b8d739f2016542b4de2965a9601" 1177 | "checksum wasm-bindgen-webidl 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "ef012a0d93fc0432df126a8eaf547b2dce25a8ce9212e1d3cbeef5c11157975d" 1178 | "checksum web-sys 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "aaf97caf6aa8c2b1dac90faf0db529d9d63c93846cca4911856f78a83cebf53b" 1179 | "checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" 1180 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 1181 | "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" 1182 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 1183 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1184 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1185 | "checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" 1186 | "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" 1187 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "eventsourcing" 3 | version = "0.1.5" 4 | authors = ["Kevin Hoffman "] 5 | description = "Event Sourcing for Rust" 6 | documentation = "https://docs.rs/eventsourcing" 7 | repository = "https://github.com/pholactery/eventsourcing" 8 | keywords = ["event", "eventsourcing", "aggregate", "command"] 9 | categories = ["asynchronous","data-structures","rust-patterns","simulation"] 10 | readme = "README.md" 11 | license = "Apache-2.0" 12 | homepage = "https://github.com/pholactery/eventsourcing" 13 | edition = "2018" 14 | 15 | [dependencies] 16 | chrono = { version = "0.4", features = ["serde"] } 17 | serde_json = "1.0" 18 | serde_derive = "1.0" 19 | serde = "1.0" 20 | uuid = { version = "0.8.1", features = ["v4"], optional = true } 21 | reqwest = { version = "0.10.1", features = ["json", "blocking"], optional = true } 22 | 23 | [features] 24 | default = [] 25 | eventstore = [ "uuid"] 26 | orgeventstore = ["reqwest", "eventstore"] 27 | 28 | 29 | [dev-dependencies] 30 | eventsourcing-derive = { path = "eventsourcing-derive", version = "0.1.2"} 31 | 32 | [workspace] 33 | members = ["eventsourcing-derive"] 34 | 35 | [[example]] 36 | name = "combat" 37 | required-features = ["orgeventstore"] 38 | 39 | [[example]] 40 | name = "bank" 41 | required-features = ["eventstore"] 42 | 43 | [[example]] 44 | name = "location" 45 | required-features = ["eventstore"] 46 | 47 | [package.metadata.docs.rs] 48 | no-default-features = true 49 | all-features = true -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Event Sourcing 2 | 3 | An eventsourcing library for Rust 4 | 5 | One of the benefits of [event sourcing](https://martinfowler.com/eaaDev/EventSourcing.html) 6 | is that in most cases, embracing this pattern does not require that much code. 7 | However, there's still a bit of boilerplate required as well as the discipline for ensuring 8 | the events, commands, and aggregates all perform their roles without sharing concerns. 9 | 10 | The fundamental workflow to remember is that **commands** are applied to **aggregates**, 11 | which then emit one or more events. An **aggregate**'s business logic is also responsible 12 | for returning a new state from a previous state combined with a new event. Put 13 | mathematically, this looks like: 14 | 15 | ```terminal 16 | f(state1, event) = state2 17 | ``` 18 | 19 | There are some event sourcing libraries that allow for, or even encourage, mutation of 20 | state in memory. I prefer a more functional approach, and the design of this library 21 | reflects that. It encourages you to write unit tests for your aggregate business logic that 22 | are predictable and can be executed in isolation without concern for how you receive events 23 | or how you persist them in a store. 24 | 25 | To start, you create an undecorated enum for your **Command** type: 26 | ```rust 27 | enum LocationCommand { 28 | UpdateLocation { lat: f32, long: f32, alt: f32 }, 29 | } 30 | ``` 31 | 32 | Next, you create an enum for your events and use a derive macro to write some boilerplate 33 | on your behalf. Note how the command variants are _imperative_ statements while the 34 | event variants are _verbs phrases in the past tense_. While this is by convention and 35 | not enforced via code, this is a good practice to adopt. 36 | 37 | ```rust 38 | #[derive(Serialize, Deserialize, Debug, Clone, Event)] 39 | #[event_type_version("1.0")] 40 | #[event_source("events://github.com/pholactery/eventsourcing/samples/location")] 41 | enum LocationEvent { 42 | LocationUpdated { lat: f32, long: f32, alt: f32 }, 43 | } 44 | ``` 45 | 46 | We then define a type that represents the state to be used by an aggregate. 47 | With that in place, we write all of our business logic, the core of our event sourcing system, 48 | in the aggregate. 49 | 50 | ```rust 51 | #[derive(Debug, Clone)] 52 | struct LocationData { 53 | lat: f32, 54 | long: f32, 55 | alt: f32, 56 | generation: u64, 57 | } 58 | 59 | impl AggregateState for LocationData { 60 | fn generation(&self) -> u64 { 61 | self.generation 62 | } 63 | } 64 | 65 | struct Location; 66 | impl Aggregate for Location { 67 | type Event = LocationEvent; 68 | type Command = LocationCommand; 69 | type State = LocationData; 70 | 71 | fn apply_event(state: &Self::State, evt: &Self::Event) -> Result { 72 | // TODO: validate event 73 | let ld = match evt { 74 | LocationEvent::LocationUpdated { lat, long, alt } => LocationData { 75 | lat: *lat, 76 | long: *long, 77 | alt: *alt, 78 | generation: state.generation + 1, 79 | }, 80 | }; 81 | Ok(ld) 82 | } 83 | 84 | fn handle_command(_state: &Self::State, cmd: &Self::Command) -> Result> { 85 | // TODO: add code to validate state and command 86 | 87 | // if validation passes... 88 | Ok(vec![LocationEvent::LocationUpdated { lat: 10.0, long: 10.0, alt: 10.0 }]) 89 | } 90 | } 91 | ``` 92 | 93 | For more examples of usage, check out the [examples](https://github.com/pholactery/eventsourcing/tree/master/examples) directory in github. -------------------------------------------------------------------------------- /eventsourcing-derive/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | -------------------------------------------------------------------------------- /eventsourcing-derive/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "eventsourcing-derive" 3 | version = "0.1.0" 4 | dependencies = [ 5 | "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 6 | "syn 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "proc-macro2" 11 | version = "0.2.3" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 15 | ] 16 | 17 | [[package]] 18 | name = "quote" 19 | version = "0.4.2" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | dependencies = [ 22 | "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 23 | ] 24 | 25 | [[package]] 26 | name = "syn" 27 | version = "0.12.15" 28 | source = "registry+https://github.com/rust-lang/crates.io-index" 29 | dependencies = [ 30 | "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", 31 | "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", 32 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 33 | ] 34 | 35 | [[package]] 36 | name = "unicode-xid" 37 | version = "0.1.0" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | 40 | [metadata] 41 | "checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" 42 | "checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" 43 | "checksum syn 0.12.15 (registry+https://github.com/rust-lang/crates.io-index)" = "c97c05b8ebc34ddd6b967994d5c6e9852fa92f8b82b3858c39451f97346dcce5" 44 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 45 | -------------------------------------------------------------------------------- /eventsourcing-derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "eventsourcing-derive" 3 | version = "0.1.3" 4 | authors = ["autodidaddict "] 5 | description = "Custom derive macros for Eventsourcing components" 6 | documentation = "https://docs.rs/eventsourcing-derive" 7 | repository = "https://github.com/pholactery/eventsourcing/eventsourcing-derive" 8 | keywords = ["event", "eventsourcing", "aggregate", "command"] 9 | categories = ["asynchronous","data-structures","rust-patterns","simulation"] 10 | license = "MPL-2.0" 11 | homepage = "https://github.com/pholactery/eventsourcing" 12 | 13 | [dependencies] 14 | syn = "0.12" 15 | quote = "0.4" 16 | 17 | [lib] 18 | proc-macro = true 19 | -------------------------------------------------------------------------------- /eventsourcing-derive/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # EventSourcing Derive 2 | //! 3 | //! Macro implementations for custom derivations for the *eventsourcing* crate 4 | #![recursion_limit = "128"] 5 | 6 | extern crate proc_macro; 7 | #[macro_use] 8 | extern crate quote; 9 | #[macro_use] 10 | extern crate syn; 11 | 12 | use proc_macro::TokenStream; 13 | use quote::Tokens; 14 | use syn::punctuated::Punctuated; 15 | use syn::synom::Synom; 16 | use syn::token::Comma; 17 | use syn::{Data, DataEnum, DeriveInput, Fields, Ident, LitStr, Path, Variant}; 18 | 19 | /// Derives the boilerplate code for a Dispatcher 20 | #[proc_macro_derive(Dispatcher, attributes(aggregate))] 21 | pub fn component(input: TokenStream) -> TokenStream { 22 | let ast = syn::parse(input).unwrap(); 23 | let gen = impl_component(&ast); 24 | gen.into() 25 | } 26 | 27 | /// Derives the boilerplate code for an Event 28 | #[proc_macro_derive(Event, attributes(event_type_version, event_source))] 29 | pub fn component_event(input: TokenStream) -> TokenStream { 30 | let ast: DeriveInput = syn::parse(input).unwrap(); 31 | let gen = match ast.data { 32 | Data::Enum(ref data_enum) => impl_component_event(&ast, data_enum), 33 | Data::Struct(_) => quote! { 34 | panic!("#[derive(Event)] is only defined for enums, not structs") 35 | }, 36 | Data::Union(_) => quote! { 37 | panic!("#[derive(Event)] is only defined for enums, not unions") 38 | }, 39 | }; 40 | 41 | gen.into() 42 | } 43 | 44 | struct EventSourceAttribute { 45 | event_source: LitStr, 46 | } 47 | 48 | struct EventTypeVersionAttribute { 49 | event_type_version: Ident, 50 | } 51 | 52 | struct AggregateAttribute { 53 | aggregate: Path, 54 | } 55 | 56 | impl Synom for EventSourceAttribute { 57 | named!(parse -> Self, map!( 58 | parens!(syn!(LitStr)), 59 | |(_, event_source)| EventSourceAttribute { event_source } 60 | )); 61 | } 62 | 63 | impl Synom for AggregateAttribute { 64 | named!(parse -> Self, map!( 65 | parens!(syn!(Path)), 66 | |(_, aggregate)| AggregateAttribute { aggregate } 67 | )); 68 | } 69 | 70 | impl Synom for EventTypeVersionAttribute { 71 | named!(parse -> Self, map!( 72 | parens!(syn!(Ident)), 73 | |(_, event_type_version) | EventTypeVersionAttribute { event_type_version } 74 | )); 75 | } 76 | 77 | fn impl_component_event(ast: &DeriveInput, data_enum: &DataEnum) -> Tokens { 78 | let name = &ast.ident; 79 | let variants = &data_enum.variants; 80 | let (impl_generics, _ty_generics, where_clause) = ast.generics.split_for_impl(); 81 | let event_type_version = ast 82 | .attrs 83 | .iter() 84 | .find(|attr| attr.path.segments[0].ident == "event_type_version") 85 | .map(|attr| { 86 | syn::parse2::(attr.tts.clone()) 87 | .unwrap() 88 | .event_type_version 89 | }) 90 | .unwrap_or_else(|| parse_quote!(NoSchemaVersion)); 91 | 92 | let event_source = ast 93 | .attrs 94 | .iter() 95 | .find(|attr| attr.path.segments[0].ident == "event_source") 96 | .map(|attr| { 97 | syn::parse2::(attr.tts.clone()) 98 | .unwrap() 99 | .event_source 100 | }) 101 | .unwrap_or_else(|| parse_quote!(NoEventSource)); 102 | 103 | let event_matches = generate_event_matches(&name, &variants); 104 | 105 | quote! { 106 | impl #impl_generics ::eventsourcing::Event for #name #where_clause { 107 | fn event_type_version(&self) -> &str { 108 | #event_type_version 109 | } 110 | 111 | fn event_source(&self) -> &str { 112 | #event_source 113 | } 114 | 115 | fn event_type(&self) -> &str { 116 | match self { 117 | #(#event_matches)* 118 | } 119 | } 120 | } 121 | #[cfg(feature = "orgeventstore")] 122 | impl From<::eventsourcing::cloudevents::CloudEvent> for #name { 123 | fn from(__source: ::eventsourcing::cloudevents::CloudEvent) -> Self { 124 | ::serde_json::from_str(&::serde_json::to_string(&__source.data).unwrap()).unwrap() 125 | } 126 | } 127 | } 128 | } 129 | 130 | fn generate_event_matches( 131 | name: &Ident, 132 | variants: &Punctuated, 133 | ) -> Vec { 134 | let mut result = Vec::new(); 135 | for (_idx, variant) in variants.iter().enumerate() { 136 | let id = &variant.ident; 137 | let et_name = event_type_name(name, id); 138 | let new = match variant.fields { 139 | Fields::Unit => quote! { 140 | #name::#id => #et_name, 141 | }, 142 | Fields::Unnamed(ref fields) => { 143 | let idents: Vec<_> = fields.unnamed.pairs().map(|p| p.value().ident).collect(); 144 | quote! { 145 | #name::#id( #(_#idents,)* ) => #et_name, 146 | } 147 | } 148 | Fields::Named(ref fields) => { 149 | let idents: Vec<_> = fields.named.pairs().map(|p| p.value().ident).collect(); 150 | quote! { 151 | #name::#id { #(#idents: _,)* } => #et_name, 152 | } 153 | } 154 | }; 155 | result.push(new); 156 | } 157 | result 158 | } 159 | 160 | fn event_type_name(name: &Ident, variant_id: &Ident) -> String { 161 | let name_s = name.to_string().to_lowercase(); 162 | let variant_s = variant_id.to_string().to_lowercase(); 163 | format!("{}.{}", name_s, variant_s) 164 | } 165 | 166 | fn impl_component(ast: &DeriveInput) -> Tokens { 167 | let name = &ast.ident; 168 | let (impl_generics, _ty_generics, where_clause) = ast.generics.split_for_impl(); 169 | 170 | let aggregate = ast 171 | .attrs 172 | .iter() 173 | .find(|attr| attr.path.segments[0].ident == "aggregate") 174 | .map(|attr| { 175 | syn::parse2::(attr.tts.clone()) 176 | .unwrap() 177 | .aggregate 178 | }) 179 | .unwrap_or_else(|| parse_quote!(NoAggregate)); 180 | 181 | quote! { 182 | impl #impl_generics ::eventsourcing::Dispatcher for #name #where_clause { 183 | type Aggregate = #aggregate; 184 | type Event = <#aggregate as Aggregate>::Event; 185 | type Command = <#aggregate as Aggregate>::Command; 186 | type State = <#aggregate as Aggregate>::State; 187 | 188 | fn dispatch( 189 | state: &Self::State, 190 | cmd: &Self::Command, 191 | store: &impl ::eventsourcing::eventstore::EventStore, 192 | stream: &str, 193 | ) -> Vec> { 194 | match Self::Aggregate::handle_command(state, cmd) { 195 | Ok(evts) => evts.into_iter().map(|evt| store.append(evt, stream)).collect(), 196 | Err(e) => vec![Err(e)], 197 | } 198 | } 199 | } 200 | } 201 | } 202 | -------------------------------------------------------------------------------- /examples/bank.rs: -------------------------------------------------------------------------------- 1 | extern crate serde; 2 | #[macro_use] 3 | extern crate serde_derive; 4 | extern crate eventsourcing; 5 | extern crate serde_json; 6 | #[macro_use] 7 | extern crate eventsourcing_derive; 8 | 9 | use eventsourcing::{eventstore::MemoryEventStore, prelude::*, Result}; 10 | 11 | const DOMAIN_VERSION: &str = "1.0"; 12 | 13 | #[derive(Serialize, Deserialize, Debug, Clone, Event)] 14 | #[event_type_version(DOMAIN_VERSION)] 15 | #[event_source("events://github.com/pholactery/eventsourcing/samples/bank")] 16 | enum BankEvent { 17 | FundsWithdrawn(String, u32), 18 | FundsDeposited(String, u32), 19 | } 20 | 21 | enum BankCommand { 22 | WithdrawFunds(String, u32), 23 | DepositFunds(String, u32), 24 | } 25 | 26 | #[derive(Debug, Clone)] 27 | struct AccountData { 28 | acctnum: String, 29 | balance: u32, 30 | generation: u64, 31 | } 32 | 33 | impl AggregateState for AccountData { 34 | fn generation(&self) -> u64 { 35 | self.generation 36 | } 37 | } 38 | 39 | struct Account; 40 | 41 | impl Aggregate for Account { 42 | type Event = BankEvent; 43 | type State = AccountData; 44 | type Command = BankCommand; 45 | 46 | fn apply_event(state: &Self::State, evt: &Self::Event) -> Result { 47 | let state = match *evt { 48 | BankEvent::FundsWithdrawn(_, amt) => AccountData { 49 | balance: state.balance - amt, 50 | acctnum: state.acctnum.to_owned(), 51 | generation: state.generation + 1, 52 | }, 53 | BankEvent::FundsDeposited(_, amt) => AccountData { 54 | balance: state.balance + amt, 55 | acctnum: state.acctnum.to_owned(), 56 | generation: state.generation + 1, 57 | }, 58 | }; 59 | Ok(state) 60 | } 61 | 62 | fn handle_command(_state: &Self::State, cmd: &Self::Command) -> Result> { 63 | // SHOULD DO: validate state and command 64 | 65 | // if validation passes... 66 | let evts = match cmd { 67 | BankCommand::DepositFunds(acct, amt) => { 68 | vec![BankEvent::FundsDeposited(acct.clone(), *amt)] 69 | } 70 | BankCommand::WithdrawFunds(acct, amt) => { 71 | vec![BankEvent::FundsWithdrawn(acct.clone(), *amt)] 72 | } 73 | }; 74 | Ok(evts) 75 | } 76 | } 77 | 78 | fn main() { 79 | let _account_store = MemoryEventStore::new(); 80 | 81 | let deposit = BankCommand::DepositFunds("SAVINGS100".to_string(), 500); 82 | 83 | let initial_state = AccountData { 84 | balance: 800, 85 | acctnum: "SAVINGS100".to_string(), 86 | generation: 1, 87 | }; 88 | 89 | let post_deposit = Account::handle_command(&initial_state, &deposit).unwrap(); 90 | let state = Account::apply_event(&initial_state, &post_deposit[0]).unwrap(); 91 | 92 | println!("{:#?}", post_deposit); 93 | println!("{:#?}", state); 94 | } 95 | -------------------------------------------------------------------------------- /examples/combat/domain.rs: -------------------------------------------------------------------------------- 1 | const DOMAIN_VERSION: &str = "1.0"; 2 | 3 | use eventsourcing::{Aggregate, AggregateState, Result}; 4 | 5 | #[derive(Debug)] 6 | pub enum CombatCommand { 7 | Attack(String, u32), 8 | } 9 | 10 | #[derive(Serialize, Deserialize, Debug, Clone, Event)] 11 | #[event_type_version(DOMAIN_VERSION)] 12 | #[event_source("events://github.com/pholactery/eventsourcing/samples/combat")] 13 | pub enum CombatEvent { 14 | EntityAttacked(String, u32), 15 | RandomEvent { a: u32, b: u32 }, 16 | UnitEvent, 17 | } 18 | 19 | #[derive(Debug, Clone)] 20 | pub struct CombatState { 21 | pub entity_id: String, 22 | pub hitpoints: u32, 23 | pub generation: u64, 24 | } 25 | 26 | impl AggregateState for CombatState { 27 | fn generation(&self) -> u64 { 28 | self.generation 29 | } 30 | } 31 | 32 | pub struct Combat; 33 | impl Aggregate for Combat { 34 | type Event = CombatEvent; 35 | type Command = CombatCommand; 36 | type State = CombatState; 37 | 38 | fn apply_event(_state: &Self::State, _evt: &Self::Event) -> Result { 39 | unimplemented!() 40 | } 41 | 42 | fn handle_command(_state: &Self::State, cmd: &Self::Command) -> Result> { 43 | println!("Command handled: {:#?}", cmd); 44 | // SHOULD DO: validate state and command 45 | let evt = match *cmd { 46 | CombatCommand::Attack(ref entity_id, pts) => { 47 | CombatEvent::EntityAttacked(entity_id.clone(), pts) 48 | } 49 | }; 50 | 51 | // if validation passes... 52 | Ok(vec![evt]) 53 | } 54 | } 55 | 56 | #[derive(Dispatcher)] 57 | #[aggregate(Combat)] 58 | pub struct CombatDispatcher; 59 | -------------------------------------------------------------------------------- /examples/combat/main.rs: -------------------------------------------------------------------------------- 1 | extern crate serde; 2 | #[macro_use] 3 | extern crate serde_derive; 4 | #[macro_use] 5 | extern crate eventsourcing_derive; 6 | extern crate eventsourcing; 7 | extern crate serde_json; 8 | 9 | mod domain; 10 | 11 | use domain::{CombatCommand, CombatDispatcher, CombatEvent, CombatState}; 12 | use eventsourcing::eventstore::OrgEventStore; 13 | use eventsourcing::prelude::*; 14 | 15 | fn main() { 16 | let combat_store = OrgEventStore::new("localhost", 2113); 17 | let swing = CombatCommand::Attack("ogre".to_owned(), 150); 18 | 19 | let state = CombatState { 20 | entity_id: "ogre".to_owned(), 21 | hitpoints: 900, 22 | generation: 0, 23 | }; 24 | 25 | let rando = CombatEvent::RandomEvent { a: 12, b: 13 }; 26 | println!("{}", rando.event_type()); 27 | let unit = CombatEvent::UnitEvent; 28 | println!("{}", unit.event_type()); 29 | 30 | let res = CombatDispatcher::dispatch(&state, &swing, &combat_store, "ogre"); 31 | println!("dispatch results - {:#?}", res); 32 | } 33 | -------------------------------------------------------------------------------- /examples/location.rs: -------------------------------------------------------------------------------- 1 | extern crate serde; 2 | #[macro_use] 3 | extern crate serde_derive; 4 | extern crate eventsourcing; 5 | extern crate serde_json; 6 | #[macro_use] 7 | extern crate eventsourcing_derive; 8 | 9 | use eventsourcing::{eventstore::MemoryEventStore, prelude::*, Result}; 10 | 11 | const DOMAIN_VERSION: &str = "1.0"; 12 | 13 | #[derive(Debug, Clone)] 14 | struct LocationData { 15 | lat: f32, 16 | long: f32, 17 | alt: f32, 18 | generation: u64, 19 | } 20 | 21 | impl AggregateState for LocationData { 22 | fn generation(&self) -> u64 { 23 | self.generation 24 | } 25 | } 26 | 27 | #[event_type_version(DOMAIN_VERSION)] 28 | #[event_source("events://github.com/pholactery/eventsourcing/samples/location")] 29 | #[derive(Serialize, Deserialize, Debug, Clone, Event)] 30 | enum LocationEvent { 31 | LocationUpdated { lat: f32, long: f32, alt: f32 }, 32 | } 33 | 34 | struct Location; 35 | 36 | enum LocationCommand { 37 | UpdateLocation { lat: f32, long: f32, alt: f32 }, 38 | } 39 | 40 | impl Aggregate for Location { 41 | type Event = LocationEvent; 42 | type Command = LocationCommand; 43 | type State = LocationData; 44 | 45 | fn apply_event(state: &Self::State, evt: &Self::Event) -> Result { 46 | let ld = match *evt { 47 | LocationEvent::LocationUpdated { lat, long, alt } => LocationData { 48 | lat, 49 | long, 50 | alt, 51 | generation: state.generation + 1, 52 | }, 53 | }; 54 | Ok(ld) 55 | } 56 | 57 | fn handle_command(_state: &Self::State, cmd: &Self::Command) -> Result> { 58 | // SHOULD DO: validate state and command 59 | let evt = match *cmd { 60 | LocationCommand::UpdateLocation { lat, long, alt } => { 61 | LocationEvent::LocationUpdated { lat, long, alt } 62 | } 63 | }; 64 | 65 | // if validation passes... 66 | Ok(vec![evt]) 67 | } 68 | } 69 | 70 | fn main() -> std::result::Result<(), Box> { 71 | let location_store = MemoryEventStore::new(); 72 | 73 | let update = LocationCommand::UpdateLocation { 74 | lat: 10.0, 75 | long: 52.0, 76 | alt: 31.0, 77 | }; 78 | let old_state = LocationData { 79 | lat: 57.06, 80 | long: 36.07, 81 | alt: 15.0, 82 | generation: 0, 83 | }; 84 | 85 | // First, handle a command to get an event vector 86 | let res = Location::handle_command(&old_state, &update)?; 87 | // Second, apply the events to get a new state 88 | let state = Location::apply_all(&old_state, &res)?; 89 | // Third, append to store (can do this alternatively with a dispatcher) 90 | let store_result = location_store.append(res[0].clone(), "locations")?; 91 | println!("Store result: {:?}", store_result); 92 | 93 | println!("Original state: {:?}", old_state); 94 | println!("Post-process state: {:?}", state); 95 | 96 | println!( 97 | "all events - {:#?}", 98 | location_store.get_all("locationevent.locationupdated") 99 | ); 100 | 101 | Ok(()) 102 | } 103 | -------------------------------------------------------------------------------- /src/cloudevents.rs: -------------------------------------------------------------------------------- 1 | //! Cloud Events Implementation 2 | //! 3 | //! This module provides an implementation of a [cloud event](https://cloudevents.io/) 4 | //! data structure that conforms to the cloud events v1.0 spec as outlined in 5 | //! [CloudEvents v1.0 Spec](https://github.com/cloudevents/spec/blob/v1.0/spec.md) 6 | //! 7 | //! In the current version of this library, only the _application/json_ content type is supported 8 | //! for the `data` field on the cloud event. 9 | use super::Event; 10 | use chrono::prelude::*; 11 | use serde_json; 12 | use uuid::Uuid; 13 | 14 | /// CloudEvent provides a data structure that is JSON-compliant with v1.0 of the CloudEvents 15 | /// specification. This means that any system with which you want to communicate that is 16 | /// also CloudEvents-aware can accept the serialized version of this data structure. 17 | #[derive(Debug, Serialize, Deserialize, Clone)] 18 | pub struct CloudEvent { 19 | #[serde(rename = "specversion")] 20 | pub cloud_events_version: String, 21 | #[serde(rename = "type")] 22 | pub event_type: String, 23 | #[serde(rename = "typeversion")] 24 | pub event_type_version: String, 25 | pub source: String, // URI 26 | #[serde(rename = "id")] 27 | pub event_id: String, 28 | #[serde(rename = "time")] 29 | pub event_time: DateTime, 30 | #[serde(rename = "datacontenttype")] 31 | pub content_type: String, 32 | pub data: serde_json::Value, 33 | } 34 | 35 | impl From for CloudEvent 36 | where 37 | E: Event, 38 | { 39 | fn from(source: E) -> Self { 40 | let raw_data = serde_json::to_string(&source).unwrap(); 41 | 42 | CloudEvent { 43 | cloud_events_version: "1.0".to_owned(), 44 | event_type: source.event_type().to_owned(), 45 | event_type_version: source.event_type_version().to_owned(), 46 | source: source.event_source().to_owned(), 47 | event_id: Uuid::new_v4().to_hyphenated().to_string(), 48 | event_time: Utc::now(), 49 | content_type: "application/json".to_owned(), 50 | data: serde_json::from_str(&raw_data).unwrap(), 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/eventstore/inmemory.rs: -------------------------------------------------------------------------------- 1 | //! In-Memory Event Store 2 | //! 3 | //! This module provides an implementation of the event store trait for a simple in-memory 4 | //! cache. This is not an event store you should be using for production and we recommend 5 | //! it is recommended that you only use this for testing/demonstration purposes. 6 | 7 | #[cfg(feature = "eventstore")] 8 | use super::super::cloudevents::CloudEvent; 9 | use super::super::Event; 10 | use super::super::Result; 11 | #[cfg(feature = "eventstore")] 12 | use super::EventStore; 13 | use chrono::prelude::*; 14 | use std::sync::Mutex; 15 | #[cfg(feature = "eventstore")] 16 | /// An simple, in-memory implementation of the event store trait 17 | pub struct MemoryEventStore { 18 | evts: Mutex>, 19 | } 20 | #[cfg(feature = "eventstore")] 21 | impl MemoryEventStore { 22 | /// Creates a new in-memory event store. The resulting store is thread-safe. 23 | pub fn new() -> MemoryEventStore { 24 | MemoryEventStore { 25 | evts: Mutex::new(Vec::::new()), 26 | } 27 | } 28 | } 29 | #[cfg(feature = "eventstore")] 30 | impl EventStore for MemoryEventStore { 31 | /// Appends an event to the in-memory store 32 | fn append(&self, evt: impl Event, _stream: &str) -> Result { 33 | let mut guard = self.evts.lock().unwrap(); 34 | let cloud_event = CloudEvent::from(evt); 35 | guard.push(cloud_event.clone()); 36 | Ok(cloud_event) 37 | } 38 | } 39 | 40 | #[cfg(feature = "eventstore")] 41 | impl MemoryEventStore { 42 | pub fn get_all(&self, event_type: &str) -> Result> { 43 | let guard = self.evts.lock().unwrap(); 44 | let matches = guard 45 | .iter() 46 | .filter(|evt| evt.event_type == event_type) 47 | .cloned() 48 | .collect(); 49 | 50 | Ok(matches) 51 | } 52 | 53 | pub fn get_from(&self, event_type: &str, start: DateTime) -> Result> { 54 | let guard = self.evts.lock().unwrap(); 55 | let matches = guard 56 | .iter() 57 | .filter(|evt| evt.event_type == event_type && evt.event_time >= start) 58 | .cloned() 59 | .collect(); 60 | Ok(matches) 61 | } 62 | 63 | pub fn get_range( 64 | &self, 65 | event_type: &str, 66 | start: DateTime, 67 | end: DateTime, 68 | ) -> Result> { 69 | let guard = self.evts.lock().unwrap(); 70 | let matches = guard 71 | .iter() 72 | .filter(|evt| { 73 | evt.event_type == event_type && evt.event_time >= start && evt.event_time <= end 74 | }) 75 | .cloned() 76 | .collect(); 77 | Ok(matches) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/eventstore/mod.rs: -------------------------------------------------------------------------------- 1 | //! Event store trait and implementations 2 | #[cfg(feature = "eventstore")] 3 | use super::cloudevents::CloudEvent; 4 | use super::{Event, Result}; 5 | 6 | #[cfg(feature = "eventstore")] 7 | pub use self::inmemory::MemoryEventStore; 8 | 9 | #[cfg(feature = "orgeventstore")] 10 | pub use self::orgeventstore::OrgEventStore; 11 | 12 | #[cfg(feature = "eventstore")] 13 | /// Trait required for event stores. For the moment, event stores are append-only 14 | pub trait EventStore { 15 | fn append(&self, evt: impl Event, stream: &str) -> Result; 16 | } 17 | 18 | mod inmemory; 19 | #[cfg(feature = "orgeventstore")] 20 | mod orgeventstore; 21 | -------------------------------------------------------------------------------- /src/eventstore/orgeventstore.rs: -------------------------------------------------------------------------------- 1 | //! Implementation of Greg Young's Event Store (eventstore.org) 2 | 3 | #[cfg(feature = "orgeventstore")] 4 | use super::super::cloudevents::CloudEvent; 5 | use super::super::{Error, Event, Kind, Result}; 6 | #[cfg(feature = "orgeventstore")] 7 | use super::EventStore; 8 | use reqwest::header::{HeaderMap, CONTENT_TYPE}; 9 | use reqwest::StatusCode; 10 | 11 | /// Client for the eventstore.org Event Store 12 | pub struct OrgEventStore { 13 | host: String, 14 | port: u16, 15 | } 16 | 17 | #[derive(Serialize, Deserialize, Clone, Debug)] 18 | #[serde(rename_all = "camelCase")] 19 | struct StoreEvent { 20 | event_id: String, 21 | event_type: String, 22 | data: serde_json::Value, 23 | } 24 | 25 | impl OrgEventStore { 26 | /// Creates a new event store client with the given host name and port number. 27 | pub fn new(host: &str, port: u16) -> OrgEventStore { 28 | OrgEventStore { 29 | host: host.to_owned(), 30 | port, 31 | } 32 | } 33 | 34 | fn build_stream_url(&self, stream: &str) -> String { 35 | format!("http://{}:{}/streams/{}", self.host, self.port, stream) 36 | } 37 | } 38 | 39 | impl Default for OrgEventStore { 40 | /// Creates an event store client pointing to localhost:2113, the default address 41 | fn default() -> Self { 42 | OrgEventStore::new("localhost", 2113) 43 | } 44 | } 45 | 46 | fn generate_headers() -> HeaderMap { 47 | let mut headers = HeaderMap::new(); 48 | 49 | headers.insert( 50 | CONTENT_TYPE, 51 | "application/vnd.eventstore.events+json".parse().unwrap(), 52 | ); 53 | headers 54 | } 55 | 56 | impl EventStore for OrgEventStore { 57 | fn append(&self, evt: impl Event, stream: &str) -> Result { 58 | let ce: CloudEvent = evt.into(); 59 | let se = vec![StoreEvent { 60 | event_id: ce.event_id.to_owned(), 61 | event_type: ce.event_type.to_owned(), 62 | data: ce.data.clone(), 63 | }]; 64 | 65 | let client = reqwest::blocking::Client::new(); 66 | 67 | let url = self.build_stream_url(stream); 68 | let headers = generate_headers(); 69 | 70 | match client.post(&url).json(&se).headers(headers).send() { 71 | Ok(response) => { 72 | if response.status() == StatusCode::CREATED { 73 | Ok(ce) 74 | } else { 75 | Err(Error { 76 | kind: Kind::StoreFailure(format!( 77 | "Failed to post to event store ({})", 78 | response.status() 79 | )), 80 | }) 81 | } 82 | } 83 | Err(e) => Err(Error { 84 | kind: Kind::StoreFailure(format!("Failed to post to event store {:?}", e)), 85 | }), 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! # Event Sourcing 2 | //! 3 | //! An eventsourcing library for Rust 4 | //! 5 | //! One of the benefits of [event sourcing](https://martinfowler.com/eaaDev/EventSourcing.html) 6 | //! is that in most cases, embracing this pattern does not require that much code. 7 | //! However, there's still a bit of boilerplate required as well as the discipline for ensuring 8 | //! the events, commands, and aggregates all perform their roles without sharing concerns. 9 | //! 10 | //! The fundamental workflow to remember is that **commands** are applied to **aggregates**, 11 | //! which then emit one or more events. An **aggregate**'s business logic is also responsible 12 | //! for returning a new state from a previous state combined with a new event. Put 13 | //! mathematically, this looks like: 14 | //! 15 | //! ```terminal,ignore 16 | //! f(state1, event) = state2 17 | //! ``` 18 | //! 19 | //! There are some event sourcing libraries that allow for, or even encourage, mutation of 20 | //! state in memory. I prefer a more functional approach, and the design of this library 21 | //! reflects that. It encourages you to write unit tests for your aggregate business logic that 22 | //! are predictable and can be executed in isolation without concern for how you receive events 23 | //! or how you persist them in a store. 24 | //! 25 | //! To start, you create an undecorated enum for your **Command** type: 26 | //! ```rust 27 | //! enum LocationCommand { 28 | //! UpdateLocation { lat: f32, long: f32, alt: f32 }, 29 | //!} 30 | //! ``` 31 | //! 32 | //! Next, you create an enum for your events and use a derive macro to write some boilerplate 33 | //! on your behalf. Note how the command variants are _imperative_ statements while the 34 | //! event variants are _verbs phrases in the past tense_. While this is by convention and 35 | //! not enforced via code, this is a good practice to adopt. 36 | //! ```rust 37 | //! 38 | //!# extern crate serde; 39 | //!# #[macro_use] extern crate serde_derive; 40 | //!# extern crate eventsourcing; 41 | //!# extern crate serde_json; 42 | //!# #[macro_use] extern crate eventsourcing_derive; 43 | //!const DOMAIN_VERSION: &str = "1.0"; 44 | //!#[derive(Serialize, Deserialize, Debug, Clone, Event)] 45 | //!#[event_type_version(DOMAIN_VERSION)] 46 | //!#[event_source("events://github.com/pholactery/eventsourcing/samples/location")] 47 | //!enum LocationEvent { 48 | //! LocationUpdated { lat: f32, long: f32, alt: f32 }, 49 | //!} 50 | //! ``` 51 | //! 52 | //! We then define a type that represents the state to be used by an aggregate. 53 | //! With that in place, we write all of our business logic, the core of our event sourcing system, 54 | //! in the aggregate. 55 | //!```rust 56 | //!# extern crate serde; 57 | //!# #[macro_use] extern crate serde_derive; 58 | //!# extern crate eventsourcing; 59 | //!# extern crate serde_json; 60 | //!# #[macro_use] extern crate eventsourcing_derive; 61 | //!# use eventsourcing::{prelude::*, Result}; 62 | //!const DOMAIN_VERSION: &str = "1.0"; 63 | //!# #[derive(Serialize, Deserialize, Debug, Clone, Event)] 64 | //!# #[event_type_version(DOMAIN_VERSION)] 65 | //!# #[event_source("events://github.com/pholactery/eventsourcing/samples/location")] 66 | //!# enum LocationEvent { 67 | //!# LocationUpdated { lat: f32, long: f32, alt: f32 }, 68 | //!# } 69 | //!# enum LocationCommand { 70 | //!# UpdateLocation { lat: f32, long: f32, alt: f32 }, 71 | //!# } 72 | //!#[derive(Debug, Clone)] 73 | //!struct LocationData { 74 | //! lat: f32, 75 | //! long: f32, 76 | //! alt: f32, 77 | //! generation: u64, 78 | //!} 79 | //! 80 | //!impl AggregateState for LocationData { 81 | //! fn generation(&self) -> u64 { 82 | //! self.generation 83 | //! } 84 | //!} 85 | //!struct Location; 86 | //!impl Aggregate for Location { 87 | //! type Event = LocationEvent; 88 | //! type Command = LocationCommand; 89 | //! type State = LocationData; 90 | //! 91 | //! fn apply_event(state: &Self::State, evt: &Self::Event) -> Result { 92 | //! // TODO: validate event 93 | //! let ld = match evt { 94 | //! LocationEvent::LocationUpdated { lat, long, alt } => LocationData { 95 | //! lat: *lat, 96 | //! long: *long, 97 | //! alt: *alt, 98 | //! generation: state.generation + 1, 99 | //! }, 100 | //! }; 101 | //! Ok(ld) 102 | //! } 103 | //! 104 | //! fn handle_command(_state: &Self::State, cmd: &Self::Command) -> Result> { 105 | //! // TODO: add code to validate state and command 106 | //! 107 | //! // if validation passes... 108 | //! Ok(vec![LocationEvent::LocationUpdated { lat: 10.0, long: 10.0, alt: 10.0 }]) 109 | //! } 110 | //!} 111 | //! ``` 112 | 113 | extern crate chrono; 114 | extern crate serde; 115 | #[macro_use] 116 | extern crate serde_derive; 117 | extern crate serde_json; 118 | #[cfg(feature = "eventstore")] 119 | extern crate uuid; 120 | 121 | #[cfg(feature = "eventstore")] 122 | pub use cloudevents::CloudEvent; 123 | 124 | #[cfg(feature = "eventstore")] 125 | use eventstore::EventStore; 126 | use serde::Serialize; 127 | use std::fmt; 128 | 129 | /// An event sourcing error 130 | #[derive(Debug)] 131 | pub struct Error { 132 | pub kind: Kind, 133 | } 134 | 135 | impl std::error::Error for Error { 136 | fn description(&self) -> &str { 137 | "An eventsourcing error ocurred" 138 | } 139 | 140 | fn cause(&self) -> Option<&dyn std::error::Error> { 141 | None 142 | } 143 | } 144 | 145 | impl fmt::Display for Error { 146 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 147 | match self.kind { 148 | Kind::ApplicationFailure(ref s) => fmt::Display::fmt(s, f), 149 | Kind::CommandFailure(ref s) => fmt::Display::fmt(s, f), 150 | Kind::StoreFailure(ref s) => fmt::Display::fmt(s, f), 151 | } 152 | } 153 | } 154 | 155 | /// Indicates the kind of event sourcing error that occurred. 156 | #[derive(Debug)] 157 | pub enum Kind { 158 | ApplicationFailure(String), 159 | CommandFailure(String), 160 | StoreFailure(String), 161 | } 162 | 163 | /// A Result where failure is an event sourcing error 164 | pub type Result = std::result::Result; 165 | 166 | /// All events must be serializable, and they need to expose some basic metadata 167 | /// about the event, including the type name, the type version, and a source 168 | /// to be used when events are emitted. If you use the derive macro fror events, 169 | /// you do not have to implement these functions manually. 170 | pub trait Event: Serialize { 171 | fn event_type_version(&self) -> &str; 172 | fn event_type(&self) -> &str; 173 | fn event_source(&self) -> &str; 174 | } 175 | 176 | /// Aggregate state only requires that it expose the generation number. State generation 177 | /// can be thought of as a sequential _version_. When a previous state is combined with 178 | /// an event to produce a new state, that new state has a generation 1 higher than the 179 | /// previous. 180 | pub trait AggregateState { 181 | fn generation(&self) -> u64; 182 | } 183 | 184 | /// An aggregate is where the vast majority of business logic for an event sourcing system 185 | /// occurs. They have two roles: 186 | /// 1. Apply events to state, producing new state. 187 | /// 2. Handle commands, producing a vector of outbound events, likely candidates for publication. 188 | /// 189 | /// Both of these functions are stateless, as aggregates should also be stateless. 190 | pub trait Aggregate { 191 | type Event: Event; 192 | type Command; 193 | type State: AggregateState + Clone; 194 | 195 | fn apply_event(state: &Self::State, evt: &Self::Event) -> Result; 196 | fn handle_command(state: &Self::State, cmd: &Self::Command) -> Result>; 197 | fn apply_all(state: &Self::State, evts: &[Self::Event]) -> Result { 198 | Ok(evts.iter().fold(state.clone(), |acc_state, event| { 199 | Self::apply_event(&acc_state, event).unwrap() 200 | })) 201 | } 202 | } 203 | 204 | /// A dispatcher is a type of pipeline glue that eliminates a certain set of boilerplate 205 | /// code for when you want to emit the events produced through the application of a command 206 | /// immediately to a store, for a given event stream name. You don't have to build a dispatcher 207 | /// yourself, you can use a derive macro to make a placeholder struct your dispatcher. 208 | /// The result of a dispatch is a vector capturing the success of command application. If it 209 | /// succeeded, you will get a CloudEvent, a CloudEvents v0.1 spec-compliant data structure. 210 | #[cfg(feature = "orgeventstore")] 211 | pub trait Dispatcher { 212 | type Command; 213 | type Event: Event; 214 | type State: AggregateState + Clone; 215 | type Aggregate: Aggregate; 216 | 217 | fn dispatch( 218 | state: &Self::State, 219 | cmd: &Self::Command, 220 | store: &impl EventStore, 221 | stream: &str, 222 | ) -> Vec>; 223 | } 224 | 225 | #[cfg(feature = "eventstore")] 226 | pub mod cloudevents; 227 | 228 | pub mod eventstore; 229 | pub mod prelude; 230 | -------------------------------------------------------------------------------- /src/prelude.rs: -------------------------------------------------------------------------------- 1 | //! Standard prelude for eventsourcing applications 2 | pub use super::{Aggregate, AggregateState, Event, Kind}; 3 | 4 | 5 | #[cfg(feature = "orgeventstore")] 6 | pub use super::CloudEvent; 7 | #[cfg(feature = "orgeventstore")] 8 | pub use crate::eventstore::EventStore; 9 | -------------------------------------------------------------------------------- /tests/cloudevents.rs: -------------------------------------------------------------------------------- 1 | extern crate serde; 2 | #[macro_use] 3 | extern crate serde_derive; 4 | extern crate eventsourcing; 5 | extern crate serde_json; 6 | #[macro_use] 7 | extern crate eventsourcing_derive; 8 | extern crate chrono; 9 | 10 | use chrono::prelude::*; 11 | #[cfg(feature = "eventstore")] 12 | use eventsourcing::prelude::*; 13 | 14 | const DOMAIN_VERSION: &str = "1.0"; 15 | 16 | #[derive(Serialize, Deserialize, Event)] 17 | #[event_type_version(DOMAIN_VERSION)] 18 | #[event_source("events://github.com/pholactery/eventsourcing/tests/integration")] 19 | enum TestEvent { 20 | Sample { val1: u32, val2: u32, val3: String }, 21 | } 22 | 23 | #[cfg(feature = "eventstore")] 24 | #[test] 25 | fn cloud_event_roundtrip() { 26 | // ensure that we can produce a cloud event with an arbitrary nested JSON value in the data 27 | // field and serialize it, then deserialize it, and still be able to convert the serde_json::Value 28 | // back into the original raw event type. 29 | let se = TestEvent::Sample { 30 | val1: 1, 31 | val2: 2, 32 | val3: "hello".to_owned(), 33 | }; 34 | 35 | let ce = CloudEvent { 36 | cloud_events_version: "0.1".to_owned(), 37 | event_type: "testevent.sample".to_owned(), 38 | event_type_version: "1.0".to_owned(), 39 | source: "events://test/source".to_owned(), 40 | event_id: "abc12345-1111".to_owned(), 41 | event_time: Utc::now(), 42 | content_type: "application/json".to_owned(), 43 | data: serde_json::from_str(&serde_json::to_string(&se).unwrap()).unwrap(), 44 | }; 45 | 46 | let s = serde_json::to_string(&ce).unwrap(); 47 | let round_trip: CloudEvent = serde_json::from_str(&s).unwrap(); 48 | let evtype = round_trip.event_type.clone(); 49 | let evtype_ver = round_trip.event_type_version.clone(); 50 | let event2: TestEvent = round_trip.into(); 51 | 52 | assert_eq!(evtype, "testevent.sample"); 53 | assert_eq!(evtype_ver, DOMAIN_VERSION); 54 | 55 | let TestEvent::Sample { val1, val2, val3 } = se; 56 | let TestEvent::Sample { 57 | val1: tval1, 58 | val2: tval2, 59 | val3: tval3, 60 | } = event2; 61 | assert_eq!(val1, tval1); 62 | assert_eq!(val2, tval2); 63 | assert_eq!(val3, tval3); 64 | } 65 | --------------------------------------------------------------------------------