├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── MesloLGS_NF_Regular.ttf ├── README.md ├── assets └── thumb.png ├── headlines ├── .gitignore ├── Cargo.toml └── src │ ├── headlines.rs │ ├── lib.rs │ └── main.rs ├── newsapi ├── Cargo.lock ├── Cargo.toml └── src │ └── lib.rs ├── setup_web.sh ├── start_web.sh └── webapp └── index.html /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | .vscode 3 | /.cargo 4 | 5 | # Generated by Cargo 6 | # will have compiled files and executables 7 | debug/ 8 | target/ 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # MSVC Windows builds of rustc generate these, which store debugging information 14 | *.pdb 15 | webapp/*.js 16 | webapp/*.wasm 17 | .todo -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "ab_glyph" 7 | version = "0.2.15" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "24606928a235e73cdef55a0c909719cadd72fce573e5713d58cb2952d8f5794c" 10 | dependencies = [ 11 | "ab_glyph_rasterizer", 12 | "owned_ttf_parser", 13 | ] 14 | 15 | [[package]] 16 | name = "ab_glyph_rasterizer" 17 | version = "0.1.5" 18 | source = "registry+https://github.com/rust-lang/crates.io-index" 19 | checksum = "a13739d7177fbd22bb0ed28badfff9f372f8bef46c863db4e1c6248f6b223b6e" 20 | 21 | [[package]] 22 | name = "adler" 23 | version = "1.0.2" 24 | source = "registry+https://github.com/rust-lang/crates.io-index" 25 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 26 | 27 | [[package]] 28 | name = "ahash" 29 | version = "0.8.1" 30 | source = "registry+https://github.com/rust-lang/crates.io-index" 31 | checksum = "464b3811b747f8f7ebc8849c9c728c39f6ac98a055edad93baf9eb330e3f8f9d" 32 | dependencies = [ 33 | "cfg-if", 34 | "getrandom", 35 | "once_cell", 36 | "serde", 37 | "version_check", 38 | ] 39 | 40 | [[package]] 41 | name = "ansi_term" 42 | version = "0.12.1" 43 | source = "registry+https://github.com/rust-lang/crates.io-index" 44 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 45 | dependencies = [ 46 | "winapi", 47 | ] 48 | 49 | [[package]] 50 | name = "arboard" 51 | version = "2.1.1" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "dc120354d1b5ec6d7aaf4876b602def75595937b5e15d356eb554ab5177e08bb" 54 | dependencies = [ 55 | "clipboard-win", 56 | "log", 57 | "objc", 58 | "objc-foundation", 59 | "objc_id", 60 | "parking_lot", 61 | "thiserror", 62 | "winapi", 63 | "x11rb", 64 | ] 65 | 66 | [[package]] 67 | name = "arrayref" 68 | version = "0.3.6" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" 71 | 72 | [[package]] 73 | name = "arrayvec" 74 | version = "0.5.2" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 77 | 78 | [[package]] 79 | name = "atomic_refcell" 80 | version = "0.1.8" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d" 83 | 84 | [[package]] 85 | name = "autocfg" 86 | version = "1.1.0" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 89 | 90 | [[package]] 91 | name = "base64" 92 | version = "0.13.0" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 95 | 96 | [[package]] 97 | name = "bitflags" 98 | version = "1.3.2" 99 | source = "registry+https://github.com/rust-lang/crates.io-index" 100 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 101 | 102 | [[package]] 103 | name = "block" 104 | version = "0.1.6" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" 107 | 108 | [[package]] 109 | name = "bumpalo" 110 | version = "3.9.1" 111 | source = "registry+https://github.com/rust-lang/crates.io-index" 112 | checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" 113 | 114 | [[package]] 115 | name = "bytemuck" 116 | version = "1.9.1" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "cdead85bdec19c194affaeeb670c0e41fe23de31459efd1c174d049269cf02cc" 119 | dependencies = [ 120 | "bytemuck_derive", 121 | ] 122 | 123 | [[package]] 124 | name = "bytemuck_derive" 125 | version = "1.1.0" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | checksum = "562e382481975bc61d11275ac5e62a19abd00b0547d99516a415336f183dcd0e" 128 | dependencies = [ 129 | "proc-macro2", 130 | "quote", 131 | "syn", 132 | ] 133 | 134 | [[package]] 135 | name = "bytes" 136 | version = "1.1.0" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" 139 | 140 | [[package]] 141 | name = "calloop" 142 | version = "0.10.2" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "595eb0438b3c6d262395fe30e6de9a61beb57ea56290b00a07f227fe6e20cbf2" 145 | dependencies = [ 146 | "log", 147 | "nix 0.24.2", 148 | "slotmap", 149 | "thiserror", 150 | "vec_map", 151 | ] 152 | 153 | [[package]] 154 | name = "cc" 155 | version = "1.0.73" 156 | source = "registry+https://github.com/rust-lang/crates.io-index" 157 | checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" 158 | 159 | [[package]] 160 | name = "cesu8" 161 | version = "1.1.0" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" 164 | 165 | [[package]] 166 | name = "cfg-if" 167 | version = "1.0.0" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 170 | 171 | [[package]] 172 | name = "cgl" 173 | version = "0.3.2" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" 176 | dependencies = [ 177 | "libc", 178 | ] 179 | 180 | [[package]] 181 | name = "chunked_transfer" 182 | version = "1.4.0" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" 185 | 186 | [[package]] 187 | name = "clipboard-win" 188 | version = "4.4.1" 189 | source = "registry+https://github.com/rust-lang/crates.io-index" 190 | checksum = "2f3e1238132dc01f081e1cbb9dace14e5ef4c3a51ee244bd982275fb514605db" 191 | dependencies = [ 192 | "error-code", 193 | "str-buf", 194 | "winapi", 195 | ] 196 | 197 | [[package]] 198 | name = "cmake" 199 | version = "0.1.49" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" 202 | dependencies = [ 203 | "cc", 204 | ] 205 | 206 | [[package]] 207 | name = "cocoa" 208 | version = "0.24.0" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" 211 | dependencies = [ 212 | "bitflags", 213 | "block", 214 | "cocoa-foundation", 215 | "core-foundation", 216 | "core-graphics", 217 | "foreign-types 0.3.2", 218 | "libc", 219 | "objc", 220 | ] 221 | 222 | [[package]] 223 | name = "cocoa-foundation" 224 | version = "0.1.0" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" 227 | dependencies = [ 228 | "bitflags", 229 | "block", 230 | "core-foundation", 231 | "core-graphics-types", 232 | "foreign-types 0.3.2", 233 | "libc", 234 | "objc", 235 | ] 236 | 237 | [[package]] 238 | name = "combine" 239 | version = "4.6.3" 240 | source = "registry+https://github.com/rust-lang/crates.io-index" 241 | checksum = "50b727aacc797f9fc28e355d21f34709ac4fc9adecfe470ad07b8f4464f53062" 242 | dependencies = [ 243 | "bytes", 244 | "memchr", 245 | ] 246 | 247 | [[package]] 248 | name = "core-foundation" 249 | version = "0.9.3" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 252 | dependencies = [ 253 | "core-foundation-sys", 254 | "libc", 255 | ] 256 | 257 | [[package]] 258 | name = "core-foundation-sys" 259 | version = "0.8.3" 260 | source = "registry+https://github.com/rust-lang/crates.io-index" 261 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 262 | 263 | [[package]] 264 | name = "core-graphics" 265 | version = "0.22.3" 266 | source = "registry+https://github.com/rust-lang/crates.io-index" 267 | checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" 268 | dependencies = [ 269 | "bitflags", 270 | "core-foundation", 271 | "core-graphics-types", 272 | "foreign-types 0.3.2", 273 | "libc", 274 | ] 275 | 276 | [[package]] 277 | name = "core-graphics-types" 278 | version = "0.1.1" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" 281 | dependencies = [ 282 | "bitflags", 283 | "core-foundation", 284 | "foreign-types 0.3.2", 285 | "libc", 286 | ] 287 | 288 | [[package]] 289 | name = "core-text" 290 | version = "19.2.0" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" 293 | dependencies = [ 294 | "core-foundation", 295 | "core-graphics", 296 | "foreign-types 0.3.2", 297 | "libc", 298 | ] 299 | 300 | [[package]] 301 | name = "crc32fast" 302 | version = "1.3.2" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 305 | dependencies = [ 306 | "cfg-if", 307 | ] 308 | 309 | [[package]] 310 | name = "crossfont" 311 | version = "0.5.1" 312 | source = "registry+https://github.com/rust-lang/crates.io-index" 313 | checksum = "21fd3add36ea31aba1520aa5288714dd63be506106753226d0eb387a93bc9c45" 314 | dependencies = [ 315 | "cocoa", 316 | "core-foundation", 317 | "core-foundation-sys", 318 | "core-graphics", 319 | "core-text", 320 | "dwrote", 321 | "foreign-types 0.5.0", 322 | "freetype-rs", 323 | "libc", 324 | "log", 325 | "objc", 326 | "once_cell", 327 | "pkg-config", 328 | "servo-fontconfig", 329 | "winapi", 330 | ] 331 | 332 | [[package]] 333 | name = "cty" 334 | version = "0.2.2" 335 | source = "registry+https://github.com/rust-lang/crates.io-index" 336 | checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" 337 | 338 | [[package]] 339 | name = "darling" 340 | version = "0.13.4" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" 343 | dependencies = [ 344 | "darling_core", 345 | "darling_macro", 346 | ] 347 | 348 | [[package]] 349 | name = "darling_core" 350 | version = "0.13.4" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" 353 | dependencies = [ 354 | "fnv", 355 | "ident_case", 356 | "proc-macro2", 357 | "quote", 358 | "strsim", 359 | "syn", 360 | ] 361 | 362 | [[package]] 363 | name = "darling_macro" 364 | version = "0.13.4" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" 367 | dependencies = [ 368 | "darling_core", 369 | "quote", 370 | "syn", 371 | ] 372 | 373 | [[package]] 374 | name = "directories-next" 375 | version = "2.0.0" 376 | source = "registry+https://github.com/rust-lang/crates.io-index" 377 | checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" 378 | dependencies = [ 379 | "cfg-if", 380 | "dirs-sys-next", 381 | ] 382 | 383 | [[package]] 384 | name = "dirs-sys-next" 385 | version = "0.1.2" 386 | source = "registry+https://github.com/rust-lang/crates.io-index" 387 | checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" 388 | dependencies = [ 389 | "libc", 390 | "redox_users", 391 | "winapi", 392 | ] 393 | 394 | [[package]] 395 | name = "dispatch" 396 | version = "0.2.0" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" 399 | 400 | [[package]] 401 | name = "dlib" 402 | version = "0.5.0" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" 405 | dependencies = [ 406 | "libloading", 407 | ] 408 | 409 | [[package]] 410 | name = "downcast-rs" 411 | version = "1.2.0" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" 414 | 415 | [[package]] 416 | name = "dwrote" 417 | version = "0.11.0" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" 420 | dependencies = [ 421 | "lazy_static", 422 | "libc", 423 | "serde", 424 | "serde_derive", 425 | "winapi", 426 | "wio", 427 | ] 428 | 429 | [[package]] 430 | name = "eframe" 431 | version = "0.19.0" 432 | source = "registry+https://github.com/rust-lang/crates.io-index" 433 | checksum = "b0d49426c3e72a6728b0c790d22db8bf7bbcff10d83b8b6f3a01295be982302e" 434 | dependencies = [ 435 | "bytemuck", 436 | "directories-next", 437 | "egui", 438 | "egui-winit", 439 | "egui_glow", 440 | "getrandom", 441 | "glow", 442 | "glutin", 443 | "js-sys", 444 | "percent-encoding", 445 | "ron", 446 | "serde", 447 | "tracing", 448 | "wasm-bindgen", 449 | "wasm-bindgen-futures", 450 | "web-sys", 451 | "winit", 452 | ] 453 | 454 | [[package]] 455 | name = "egui" 456 | version = "0.19.0" 457 | source = "registry+https://github.com/rust-lang/crates.io-index" 458 | checksum = "fc9fcd393c3daaaf5909008a1d948319d538b79c51871e4df0993260260a94e4" 459 | dependencies = [ 460 | "ahash", 461 | "epaint", 462 | "nohash-hasher", 463 | "ron", 464 | "serde", 465 | "tracing", 466 | ] 467 | 468 | [[package]] 469 | name = "egui-winit" 470 | version = "0.19.0" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "07ddc525334c416e11580123e147b970f738507f427c9fb1cd09ea2dd7416a3a" 473 | dependencies = [ 474 | "arboard", 475 | "egui", 476 | "instant", 477 | "serde", 478 | "smithay-clipboard", 479 | "tracing", 480 | "webbrowser", 481 | "winit", 482 | ] 483 | 484 | [[package]] 485 | name = "egui_glow" 486 | version = "0.19.0" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "ad77d4a00402bae9658ee64be148f4b2a0b38e4fc7874970575ca01ed1c5b75d" 489 | dependencies = [ 490 | "bytemuck", 491 | "egui", 492 | "glow", 493 | "memoffset", 494 | "tracing", 495 | "wasm-bindgen", 496 | "web-sys", 497 | ] 498 | 499 | [[package]] 500 | name = "emath" 501 | version = "0.19.0" 502 | source = "registry+https://github.com/rust-lang/crates.io-index" 503 | checksum = "9542a40106fdba943a055f418d1746a050e1a903a049b030c2b097d4686a33cf" 504 | dependencies = [ 505 | "bytemuck", 506 | "serde", 507 | ] 508 | 509 | [[package]] 510 | name = "encoding_rs" 511 | version = "0.8.31" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" 514 | dependencies = [ 515 | "cfg-if", 516 | ] 517 | 518 | [[package]] 519 | name = "epaint" 520 | version = "0.19.0" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "5ba04741be7f6602b1a1b28f1082cce45948a7032961c52814f8946b28493300" 523 | dependencies = [ 524 | "ab_glyph", 525 | "ahash", 526 | "atomic_refcell", 527 | "bytemuck", 528 | "emath", 529 | "nohash-hasher", 530 | "parking_lot", 531 | "serde", 532 | ] 533 | 534 | [[package]] 535 | name = "error-code" 536 | version = "2.3.1" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" 539 | dependencies = [ 540 | "libc", 541 | "str-buf", 542 | ] 543 | 544 | [[package]] 545 | name = "expat-sys" 546 | version = "2.1.6" 547 | source = "registry+https://github.com/rust-lang/crates.io-index" 548 | checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" 549 | dependencies = [ 550 | "cmake", 551 | "pkg-config", 552 | ] 553 | 554 | [[package]] 555 | name = "fastrand" 556 | version = "1.7.0" 557 | source = "registry+https://github.com/rust-lang/crates.io-index" 558 | checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" 559 | dependencies = [ 560 | "instant", 561 | ] 562 | 563 | [[package]] 564 | name = "flate2" 565 | version = "1.0.23" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" 568 | dependencies = [ 569 | "cfg-if", 570 | "crc32fast", 571 | "libc", 572 | "miniz_oxide 0.5.1", 573 | ] 574 | 575 | [[package]] 576 | name = "fnv" 577 | version = "1.0.7" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 580 | 581 | [[package]] 582 | name = "foreign-types" 583 | version = "0.3.2" 584 | source = "registry+https://github.com/rust-lang/crates.io-index" 585 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 586 | dependencies = [ 587 | "foreign-types-shared 0.1.1", 588 | ] 589 | 590 | [[package]] 591 | name = "foreign-types" 592 | version = "0.5.0" 593 | source = "registry+https://github.com/rust-lang/crates.io-index" 594 | checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" 595 | dependencies = [ 596 | "foreign-types-macros", 597 | "foreign-types-shared 0.3.1", 598 | ] 599 | 600 | [[package]] 601 | name = "foreign-types-macros" 602 | version = "0.2.2" 603 | source = "registry+https://github.com/rust-lang/crates.io-index" 604 | checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" 605 | dependencies = [ 606 | "proc-macro2", 607 | "quote", 608 | "syn", 609 | ] 610 | 611 | [[package]] 612 | name = "foreign-types-shared" 613 | version = "0.1.1" 614 | source = "registry+https://github.com/rust-lang/crates.io-index" 615 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 616 | 617 | [[package]] 618 | name = "foreign-types-shared" 619 | version = "0.3.1" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" 622 | 623 | [[package]] 624 | name = "form_urlencoded" 625 | version = "1.0.1" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 628 | dependencies = [ 629 | "matches", 630 | "percent-encoding", 631 | ] 632 | 633 | [[package]] 634 | name = "freetype-rs" 635 | version = "0.26.0" 636 | source = "registry+https://github.com/rust-lang/crates.io-index" 637 | checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" 638 | dependencies = [ 639 | "bitflags", 640 | "freetype-sys", 641 | "libc", 642 | ] 643 | 644 | [[package]] 645 | name = "freetype-sys" 646 | version = "0.13.1" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" 649 | dependencies = [ 650 | "cmake", 651 | "libc", 652 | "pkg-config", 653 | ] 654 | 655 | [[package]] 656 | name = "futures-channel" 657 | version = "0.3.21" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" 660 | dependencies = [ 661 | "futures-core", 662 | ] 663 | 664 | [[package]] 665 | name = "futures-core" 666 | version = "0.3.21" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" 669 | 670 | [[package]] 671 | name = "futures-sink" 672 | version = "0.3.21" 673 | source = "registry+https://github.com/rust-lang/crates.io-index" 674 | checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" 675 | 676 | [[package]] 677 | name = "futures-task" 678 | version = "0.3.21" 679 | source = "registry+https://github.com/rust-lang/crates.io-index" 680 | checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" 681 | 682 | [[package]] 683 | name = "futures-util" 684 | version = "0.3.21" 685 | source = "registry+https://github.com/rust-lang/crates.io-index" 686 | checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" 687 | dependencies = [ 688 | "futures-core", 689 | "futures-task", 690 | "pin-project-lite", 691 | "pin-utils", 692 | ] 693 | 694 | [[package]] 695 | name = "gethostname" 696 | version = "0.2.3" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" 699 | dependencies = [ 700 | "libc", 701 | "winapi", 702 | ] 703 | 704 | [[package]] 705 | name = "getrandom" 706 | version = "0.2.8" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" 709 | dependencies = [ 710 | "cfg-if", 711 | "js-sys", 712 | "libc", 713 | "wasi", 714 | "wasm-bindgen", 715 | ] 716 | 717 | [[package]] 718 | name = "gl_generator" 719 | version = "0.14.0" 720 | source = "registry+https://github.com/rust-lang/crates.io-index" 721 | checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" 722 | dependencies = [ 723 | "khronos_api", 724 | "log", 725 | "xml-rs", 726 | ] 727 | 728 | [[package]] 729 | name = "gloo-net" 730 | version = "0.1.0" 731 | source = "registry+https://github.com/rust-lang/crates.io-index" 732 | checksum = "2899cb1a13be9020b010967adc6b2a8a343b6f1428b90238c9d53ca24decc6db" 733 | dependencies = [ 734 | "futures-channel", 735 | "futures-core", 736 | "futures-sink", 737 | "gloo-utils", 738 | "js-sys", 739 | "pin-project", 740 | "serde", 741 | "serde_json", 742 | "thiserror", 743 | "wasm-bindgen", 744 | "wasm-bindgen-futures", 745 | "web-sys", 746 | ] 747 | 748 | [[package]] 749 | name = "gloo-timers" 750 | version = "0.2.4" 751 | source = "registry+https://github.com/rust-lang/crates.io-index" 752 | checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" 753 | dependencies = [ 754 | "js-sys", 755 | "wasm-bindgen", 756 | ] 757 | 758 | [[package]] 759 | name = "gloo-utils" 760 | version = "0.1.3" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "5c0bbef55e98d946adbd89f3c65a497cf9adb995a73b99573f30180e8813ab21" 763 | dependencies = [ 764 | "js-sys", 765 | "wasm-bindgen", 766 | "web-sys", 767 | ] 768 | 769 | [[package]] 770 | name = "glow" 771 | version = "0.11.2" 772 | source = "registry+https://github.com/rust-lang/crates.io-index" 773 | checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" 774 | dependencies = [ 775 | "js-sys", 776 | "slotmap", 777 | "wasm-bindgen", 778 | "web-sys", 779 | ] 780 | 781 | [[package]] 782 | name = "glutin" 783 | version = "0.29.1" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "444c9ad294fdcaf20ccf6726b78f380b5450275540c9b68ab62f49726ad1c713" 786 | dependencies = [ 787 | "cgl", 788 | "cocoa", 789 | "core-foundation", 790 | "glutin_egl_sys", 791 | "glutin_gles2_sys", 792 | "glutin_glx_sys", 793 | "glutin_wgl_sys", 794 | "libloading", 795 | "log", 796 | "objc", 797 | "once_cell", 798 | "osmesa-sys", 799 | "parking_lot", 800 | "raw-window-handle 0.5.0", 801 | "wayland-client", 802 | "wayland-egl", 803 | "winapi", 804 | "winit", 805 | ] 806 | 807 | [[package]] 808 | name = "glutin_egl_sys" 809 | version = "0.1.6" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "68900f84b471f31ea1d1355567eb865a2cf446294f06cef8d653ed7bcf5f013d" 812 | dependencies = [ 813 | "gl_generator", 814 | "winapi", 815 | ] 816 | 817 | [[package]] 818 | name = "glutin_gles2_sys" 819 | version = "0.1.5" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "e8094e708b730a7c8a1954f4f8a31880af00eb8a1c5b5bf85d28a0a3c6d69103" 822 | dependencies = [ 823 | "gl_generator", 824 | "objc", 825 | ] 826 | 827 | [[package]] 828 | name = "glutin_glx_sys" 829 | version = "0.1.8" 830 | source = "registry+https://github.com/rust-lang/crates.io-index" 831 | checksum = "d93d0575865098580c5b3a423188cd959419912ea60b1e48e8b3b526f6d02468" 832 | dependencies = [ 833 | "gl_generator", 834 | "x11-dl", 835 | ] 836 | 837 | [[package]] 838 | name = "glutin_wgl_sys" 839 | version = "0.1.5" 840 | source = "registry+https://github.com/rust-lang/crates.io-index" 841 | checksum = "3da5951a1569dbab865c6f2a863efafff193a93caf05538d193e9e3816d21696" 842 | dependencies = [ 843 | "gl_generator", 844 | ] 845 | 846 | [[package]] 847 | name = "h2" 848 | version = "0.3.13" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" 851 | dependencies = [ 852 | "bytes", 853 | "fnv", 854 | "futures-core", 855 | "futures-sink", 856 | "futures-util", 857 | "http", 858 | "indexmap", 859 | "slab", 860 | "tokio", 861 | "tokio-util", 862 | "tracing", 863 | ] 864 | 865 | [[package]] 866 | name = "hashbrown" 867 | version = "0.11.2" 868 | source = "registry+https://github.com/rust-lang/crates.io-index" 869 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 870 | 871 | [[package]] 872 | name = "headlines" 873 | version = "0.1.0" 874 | dependencies = [ 875 | "eframe", 876 | "gloo-timers", 877 | "newsapi", 878 | "serde", 879 | "tracing", 880 | "tracing-subscriber", 881 | "tracing-wasm", 882 | "wasm-bindgen-futures", 883 | ] 884 | 885 | [[package]] 886 | name = "http" 887 | version = "0.2.6" 888 | source = "registry+https://github.com/rust-lang/crates.io-index" 889 | checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" 890 | dependencies = [ 891 | "bytes", 892 | "fnv", 893 | "itoa", 894 | ] 895 | 896 | [[package]] 897 | name = "http-body" 898 | version = "0.4.4" 899 | source = "registry+https://github.com/rust-lang/crates.io-index" 900 | checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" 901 | dependencies = [ 902 | "bytes", 903 | "http", 904 | "pin-project-lite", 905 | ] 906 | 907 | [[package]] 908 | name = "httparse" 909 | version = "1.7.0" 910 | source = "registry+https://github.com/rust-lang/crates.io-index" 911 | checksum = "6330e8a36bd8c859f3fa6d9382911fbb7147ec39807f63b923933a247240b9ba" 912 | 913 | [[package]] 914 | name = "httpdate" 915 | version = "1.0.2" 916 | source = "registry+https://github.com/rust-lang/crates.io-index" 917 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 918 | 919 | [[package]] 920 | name = "hyper" 921 | version = "0.14.18" 922 | source = "registry+https://github.com/rust-lang/crates.io-index" 923 | checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" 924 | dependencies = [ 925 | "bytes", 926 | "futures-channel", 927 | "futures-core", 928 | "futures-util", 929 | "h2", 930 | "http", 931 | "http-body", 932 | "httparse", 933 | "httpdate", 934 | "itoa", 935 | "pin-project-lite", 936 | "socket2", 937 | "tokio", 938 | "tower-service", 939 | "tracing", 940 | "want", 941 | ] 942 | 943 | [[package]] 944 | name = "hyper-tls" 945 | version = "0.5.0" 946 | source = "registry+https://github.com/rust-lang/crates.io-index" 947 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 948 | dependencies = [ 949 | "bytes", 950 | "hyper", 951 | "native-tls", 952 | "tokio", 953 | "tokio-native-tls", 954 | ] 955 | 956 | [[package]] 957 | name = "ident_case" 958 | version = "1.0.1" 959 | source = "registry+https://github.com/rust-lang/crates.io-index" 960 | checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" 961 | 962 | [[package]] 963 | name = "idna" 964 | version = "0.2.3" 965 | source = "registry+https://github.com/rust-lang/crates.io-index" 966 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 967 | dependencies = [ 968 | "matches", 969 | "unicode-bidi", 970 | "unicode-normalization", 971 | ] 972 | 973 | [[package]] 974 | name = "indexmap" 975 | version = "1.8.1" 976 | source = "registry+https://github.com/rust-lang/crates.io-index" 977 | checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" 978 | dependencies = [ 979 | "autocfg", 980 | "hashbrown", 981 | ] 982 | 983 | [[package]] 984 | name = "instant" 985 | version = "0.1.12" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 988 | dependencies = [ 989 | "cfg-if", 990 | "js-sys", 991 | "wasm-bindgen", 992 | "web-sys", 993 | ] 994 | 995 | [[package]] 996 | name = "ipnet" 997 | version = "2.4.0" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "35e70ee094dc02fd9c13fdad4940090f22dbd6ac7c9e7094a46cf0232a50bc7c" 1000 | 1001 | [[package]] 1002 | name = "itoa" 1003 | version = "1.0.1" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 1006 | 1007 | [[package]] 1008 | name = "jni" 1009 | version = "0.19.0" 1010 | source = "registry+https://github.com/rust-lang/crates.io-index" 1011 | checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" 1012 | dependencies = [ 1013 | "cesu8", 1014 | "combine", 1015 | "jni-sys", 1016 | "log", 1017 | "thiserror", 1018 | "walkdir", 1019 | ] 1020 | 1021 | [[package]] 1022 | name = "jni-sys" 1023 | version = "0.3.0" 1024 | source = "registry+https://github.com/rust-lang/crates.io-index" 1025 | checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" 1026 | 1027 | [[package]] 1028 | name = "js-sys" 1029 | version = "0.3.57" 1030 | source = "registry+https://github.com/rust-lang/crates.io-index" 1031 | checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" 1032 | dependencies = [ 1033 | "wasm-bindgen", 1034 | ] 1035 | 1036 | [[package]] 1037 | name = "khronos_api" 1038 | version = "3.1.0" 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" 1040 | checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" 1041 | 1042 | [[package]] 1043 | name = "lazy_static" 1044 | version = "1.4.0" 1045 | source = "registry+https://github.com/rust-lang/crates.io-index" 1046 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 1047 | 1048 | [[package]] 1049 | name = "libc" 1050 | version = "0.2.123" 1051 | source = "registry+https://github.com/rust-lang/crates.io-index" 1052 | checksum = "cb691a747a7ab48abc15c5b42066eaafde10dc427e3b6ee2a1cf43db04c763bd" 1053 | 1054 | [[package]] 1055 | name = "libloading" 1056 | version = "0.7.3" 1057 | source = "registry+https://github.com/rust-lang/crates.io-index" 1058 | checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" 1059 | dependencies = [ 1060 | "cfg-if", 1061 | "winapi", 1062 | ] 1063 | 1064 | [[package]] 1065 | name = "lock_api" 1066 | version = "0.4.7" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" 1069 | dependencies = [ 1070 | "autocfg", 1071 | "scopeguard", 1072 | ] 1073 | 1074 | [[package]] 1075 | name = "log" 1076 | version = "0.4.16" 1077 | source = "registry+https://github.com/rust-lang/crates.io-index" 1078 | checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" 1079 | dependencies = [ 1080 | "cfg-if", 1081 | ] 1082 | 1083 | [[package]] 1084 | name = "malloc_buf" 1085 | version = "0.0.6" 1086 | source = "registry+https://github.com/rust-lang/crates.io-index" 1087 | checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" 1088 | dependencies = [ 1089 | "libc", 1090 | ] 1091 | 1092 | [[package]] 1093 | name = "matches" 1094 | version = "0.1.9" 1095 | source = "registry+https://github.com/rust-lang/crates.io-index" 1096 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 1097 | 1098 | [[package]] 1099 | name = "memchr" 1100 | version = "2.4.1" 1101 | source = "registry+https://github.com/rust-lang/crates.io-index" 1102 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 1103 | 1104 | [[package]] 1105 | name = "memmap2" 1106 | version = "0.5.8" 1107 | source = "registry+https://github.com/rust-lang/crates.io-index" 1108 | checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" 1109 | dependencies = [ 1110 | "libc", 1111 | ] 1112 | 1113 | [[package]] 1114 | name = "memoffset" 1115 | version = "0.6.5" 1116 | source = "registry+https://github.com/rust-lang/crates.io-index" 1117 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" 1118 | dependencies = [ 1119 | "autocfg", 1120 | ] 1121 | 1122 | [[package]] 1123 | name = "mime" 1124 | version = "0.3.16" 1125 | source = "registry+https://github.com/rust-lang/crates.io-index" 1126 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 1127 | 1128 | [[package]] 1129 | name = "minimal-lexical" 1130 | version = "0.2.1" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 1133 | 1134 | [[package]] 1135 | name = "miniz_oxide" 1136 | version = "0.5.1" 1137 | source = "registry+https://github.com/rust-lang/crates.io-index" 1138 | checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" 1139 | dependencies = [ 1140 | "adler", 1141 | ] 1142 | 1143 | [[package]] 1144 | name = "miniz_oxide" 1145 | version = "0.6.2" 1146 | source = "registry+https://github.com/rust-lang/crates.io-index" 1147 | checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" 1148 | dependencies = [ 1149 | "adler", 1150 | ] 1151 | 1152 | [[package]] 1153 | name = "mio" 1154 | version = "0.8.2" 1155 | source = "registry+https://github.com/rust-lang/crates.io-index" 1156 | checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" 1157 | dependencies = [ 1158 | "libc", 1159 | "log", 1160 | "miow", 1161 | "ntapi", 1162 | "wasi", 1163 | "winapi", 1164 | ] 1165 | 1166 | [[package]] 1167 | name = "miow" 1168 | version = "0.3.7" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 1171 | dependencies = [ 1172 | "winapi", 1173 | ] 1174 | 1175 | [[package]] 1176 | name = "native-tls" 1177 | version = "0.2.10" 1178 | source = "registry+https://github.com/rust-lang/crates.io-index" 1179 | checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" 1180 | dependencies = [ 1181 | "lazy_static", 1182 | "libc", 1183 | "log", 1184 | "openssl", 1185 | "openssl-probe", 1186 | "openssl-sys", 1187 | "schannel", 1188 | "security-framework", 1189 | "security-framework-sys", 1190 | "tempfile", 1191 | ] 1192 | 1193 | [[package]] 1194 | name = "ndk" 1195 | version = "0.6.0" 1196 | source = "registry+https://github.com/rust-lang/crates.io-index" 1197 | checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" 1198 | dependencies = [ 1199 | "bitflags", 1200 | "jni-sys", 1201 | "ndk-sys 0.3.0", 1202 | "num_enum", 1203 | "thiserror", 1204 | ] 1205 | 1206 | [[package]] 1207 | name = "ndk" 1208 | version = "0.7.0" 1209 | source = "registry+https://github.com/rust-lang/crates.io-index" 1210 | checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" 1211 | dependencies = [ 1212 | "bitflags", 1213 | "jni-sys", 1214 | "ndk-sys 0.4.0", 1215 | "num_enum", 1216 | "raw-window-handle 0.5.0", 1217 | "thiserror", 1218 | ] 1219 | 1220 | [[package]] 1221 | name = "ndk-context" 1222 | version = "0.1.1" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" 1225 | 1226 | [[package]] 1227 | name = "ndk-glue" 1228 | version = "0.6.1" 1229 | source = "registry+https://github.com/rust-lang/crates.io-index" 1230 | checksum = "d9ffb7443daba48349d545028777ca98853b018b4c16624aa01223bc29e078da" 1231 | dependencies = [ 1232 | "lazy_static", 1233 | "libc", 1234 | "log", 1235 | "ndk 0.6.0", 1236 | "ndk-context", 1237 | "ndk-macro", 1238 | "ndk-sys 0.3.0", 1239 | ] 1240 | 1241 | [[package]] 1242 | name = "ndk-glue" 1243 | version = "0.7.0" 1244 | source = "registry+https://github.com/rust-lang/crates.io-index" 1245 | checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" 1246 | dependencies = [ 1247 | "libc", 1248 | "log", 1249 | "ndk 0.7.0", 1250 | "ndk-context", 1251 | "ndk-macro", 1252 | "ndk-sys 0.4.0", 1253 | "once_cell", 1254 | "parking_lot", 1255 | ] 1256 | 1257 | [[package]] 1258 | name = "ndk-macro" 1259 | version = "0.3.0" 1260 | source = "registry+https://github.com/rust-lang/crates.io-index" 1261 | checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" 1262 | dependencies = [ 1263 | "darling", 1264 | "proc-macro-crate", 1265 | "proc-macro2", 1266 | "quote", 1267 | "syn", 1268 | ] 1269 | 1270 | [[package]] 1271 | name = "ndk-sys" 1272 | version = "0.3.0" 1273 | source = "registry+https://github.com/rust-lang/crates.io-index" 1274 | checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" 1275 | dependencies = [ 1276 | "jni-sys", 1277 | ] 1278 | 1279 | [[package]] 1280 | name = "ndk-sys" 1281 | version = "0.4.0" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "21d83ec9c63ec5bf950200a8e508bdad6659972187b625469f58ef8c08e29046" 1284 | dependencies = [ 1285 | "jni-sys", 1286 | ] 1287 | 1288 | [[package]] 1289 | name = "newsapi" 1290 | version = "0.1.0" 1291 | dependencies = [ 1292 | "reqwasm", 1293 | "reqwest", 1294 | "serde", 1295 | "serde_json", 1296 | "thiserror", 1297 | "ureq", 1298 | "url", 1299 | ] 1300 | 1301 | [[package]] 1302 | name = "nix" 1303 | version = "0.22.3" 1304 | source = "registry+https://github.com/rust-lang/crates.io-index" 1305 | checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf" 1306 | dependencies = [ 1307 | "bitflags", 1308 | "cc", 1309 | "cfg-if", 1310 | "libc", 1311 | "memoffset", 1312 | ] 1313 | 1314 | [[package]] 1315 | name = "nix" 1316 | version = "0.24.2" 1317 | source = "registry+https://github.com/rust-lang/crates.io-index" 1318 | checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" 1319 | dependencies = [ 1320 | "bitflags", 1321 | "cfg-if", 1322 | "libc", 1323 | "memoffset", 1324 | ] 1325 | 1326 | [[package]] 1327 | name = "nohash-hasher" 1328 | version = "0.2.0" 1329 | source = "registry+https://github.com/rust-lang/crates.io-index" 1330 | checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" 1331 | 1332 | [[package]] 1333 | name = "nom" 1334 | version = "7.1.1" 1335 | source = "registry+https://github.com/rust-lang/crates.io-index" 1336 | checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" 1337 | dependencies = [ 1338 | "memchr", 1339 | "minimal-lexical", 1340 | ] 1341 | 1342 | [[package]] 1343 | name = "ntapi" 1344 | version = "0.3.7" 1345 | source = "registry+https://github.com/rust-lang/crates.io-index" 1346 | checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" 1347 | dependencies = [ 1348 | "winapi", 1349 | ] 1350 | 1351 | [[package]] 1352 | name = "num_enum" 1353 | version = "0.5.7" 1354 | source = "registry+https://github.com/rust-lang/crates.io-index" 1355 | checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" 1356 | dependencies = [ 1357 | "num_enum_derive", 1358 | ] 1359 | 1360 | [[package]] 1361 | name = "num_enum_derive" 1362 | version = "0.5.7" 1363 | source = "registry+https://github.com/rust-lang/crates.io-index" 1364 | checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" 1365 | dependencies = [ 1366 | "proc-macro-crate", 1367 | "proc-macro2", 1368 | "quote", 1369 | "syn", 1370 | ] 1371 | 1372 | [[package]] 1373 | name = "objc" 1374 | version = "0.2.7" 1375 | source = "registry+https://github.com/rust-lang/crates.io-index" 1376 | checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" 1377 | dependencies = [ 1378 | "malloc_buf", 1379 | ] 1380 | 1381 | [[package]] 1382 | name = "objc-foundation" 1383 | version = "0.1.1" 1384 | source = "registry+https://github.com/rust-lang/crates.io-index" 1385 | checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" 1386 | dependencies = [ 1387 | "block", 1388 | "objc", 1389 | "objc_id", 1390 | ] 1391 | 1392 | [[package]] 1393 | name = "objc_id" 1394 | version = "0.1.1" 1395 | source = "registry+https://github.com/rust-lang/crates.io-index" 1396 | checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" 1397 | dependencies = [ 1398 | "objc", 1399 | ] 1400 | 1401 | [[package]] 1402 | name = "once_cell" 1403 | version = "1.16.0" 1404 | source = "registry+https://github.com/rust-lang/crates.io-index" 1405 | checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" 1406 | 1407 | [[package]] 1408 | name = "openssl" 1409 | version = "0.10.38" 1410 | source = "registry+https://github.com/rust-lang/crates.io-index" 1411 | checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" 1412 | dependencies = [ 1413 | "bitflags", 1414 | "cfg-if", 1415 | "foreign-types 0.3.2", 1416 | "libc", 1417 | "once_cell", 1418 | "openssl-sys", 1419 | ] 1420 | 1421 | [[package]] 1422 | name = "openssl-probe" 1423 | version = "0.1.5" 1424 | source = "registry+https://github.com/rust-lang/crates.io-index" 1425 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 1426 | 1427 | [[package]] 1428 | name = "openssl-sys" 1429 | version = "0.9.72" 1430 | source = "registry+https://github.com/rust-lang/crates.io-index" 1431 | checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" 1432 | dependencies = [ 1433 | "autocfg", 1434 | "cc", 1435 | "libc", 1436 | "pkg-config", 1437 | "vcpkg", 1438 | ] 1439 | 1440 | [[package]] 1441 | name = "osmesa-sys" 1442 | version = "0.1.2" 1443 | source = "registry+https://github.com/rust-lang/crates.io-index" 1444 | checksum = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" 1445 | dependencies = [ 1446 | "shared_library", 1447 | ] 1448 | 1449 | [[package]] 1450 | name = "owned_ttf_parser" 1451 | version = "0.15.0" 1452 | source = "registry+https://github.com/rust-lang/crates.io-index" 1453 | checksum = "4fb1e509cfe7a12db2a90bfa057dfcdbc55a347f5da677c506b53dd099cfec9d" 1454 | dependencies = [ 1455 | "ttf-parser", 1456 | ] 1457 | 1458 | [[package]] 1459 | name = "parking_lot" 1460 | version = "0.12.0" 1461 | source = "registry+https://github.com/rust-lang/crates.io-index" 1462 | checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" 1463 | dependencies = [ 1464 | "lock_api", 1465 | "parking_lot_core", 1466 | ] 1467 | 1468 | [[package]] 1469 | name = "parking_lot_core" 1470 | version = "0.9.2" 1471 | source = "registry+https://github.com/rust-lang/crates.io-index" 1472 | checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" 1473 | dependencies = [ 1474 | "cfg-if", 1475 | "libc", 1476 | "redox_syscall", 1477 | "smallvec", 1478 | "windows-sys 0.34.0", 1479 | ] 1480 | 1481 | [[package]] 1482 | name = "percent-encoding" 1483 | version = "2.1.0" 1484 | source = "registry+https://github.com/rust-lang/crates.io-index" 1485 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 1486 | 1487 | [[package]] 1488 | name = "pin-project" 1489 | version = "1.0.10" 1490 | source = "registry+https://github.com/rust-lang/crates.io-index" 1491 | checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" 1492 | dependencies = [ 1493 | "pin-project-internal", 1494 | ] 1495 | 1496 | [[package]] 1497 | name = "pin-project-internal" 1498 | version = "1.0.10" 1499 | source = "registry+https://github.com/rust-lang/crates.io-index" 1500 | checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" 1501 | dependencies = [ 1502 | "proc-macro2", 1503 | "quote", 1504 | "syn", 1505 | ] 1506 | 1507 | [[package]] 1508 | name = "pin-project-lite" 1509 | version = "0.2.8" 1510 | source = "registry+https://github.com/rust-lang/crates.io-index" 1511 | checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" 1512 | 1513 | [[package]] 1514 | name = "pin-utils" 1515 | version = "0.1.0" 1516 | source = "registry+https://github.com/rust-lang/crates.io-index" 1517 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 1518 | 1519 | [[package]] 1520 | name = "pkg-config" 1521 | version = "0.3.25" 1522 | source = "registry+https://github.com/rust-lang/crates.io-index" 1523 | checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" 1524 | 1525 | [[package]] 1526 | name = "png" 1527 | version = "0.17.7" 1528 | source = "registry+https://github.com/rust-lang/crates.io-index" 1529 | checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" 1530 | dependencies = [ 1531 | "bitflags", 1532 | "crc32fast", 1533 | "flate2", 1534 | "miniz_oxide 0.6.2", 1535 | ] 1536 | 1537 | [[package]] 1538 | name = "proc-macro-crate" 1539 | version = "1.1.3" 1540 | source = "registry+https://github.com/rust-lang/crates.io-index" 1541 | checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" 1542 | dependencies = [ 1543 | "thiserror", 1544 | "toml", 1545 | ] 1546 | 1547 | [[package]] 1548 | name = "proc-macro2" 1549 | version = "1.0.37" 1550 | source = "registry+https://github.com/rust-lang/crates.io-index" 1551 | checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" 1552 | dependencies = [ 1553 | "unicode-xid", 1554 | ] 1555 | 1556 | [[package]] 1557 | name = "quote" 1558 | version = "1.0.18" 1559 | source = "registry+https://github.com/rust-lang/crates.io-index" 1560 | checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" 1561 | dependencies = [ 1562 | "proc-macro2", 1563 | ] 1564 | 1565 | [[package]] 1566 | name = "raw-window-handle" 1567 | version = "0.4.3" 1568 | source = "registry+https://github.com/rust-lang/crates.io-index" 1569 | checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" 1570 | dependencies = [ 1571 | "cty", 1572 | ] 1573 | 1574 | [[package]] 1575 | name = "raw-window-handle" 1576 | version = "0.5.0" 1577 | source = "registry+https://github.com/rust-lang/crates.io-index" 1578 | checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" 1579 | dependencies = [ 1580 | "cty", 1581 | ] 1582 | 1583 | [[package]] 1584 | name = "redox_syscall" 1585 | version = "0.2.13" 1586 | source = "registry+https://github.com/rust-lang/crates.io-index" 1587 | checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" 1588 | dependencies = [ 1589 | "bitflags", 1590 | ] 1591 | 1592 | [[package]] 1593 | name = "redox_users" 1594 | version = "0.4.3" 1595 | source = "registry+https://github.com/rust-lang/crates.io-index" 1596 | checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" 1597 | dependencies = [ 1598 | "getrandom", 1599 | "redox_syscall", 1600 | "thiserror", 1601 | ] 1602 | 1603 | [[package]] 1604 | name = "remove_dir_all" 1605 | version = "0.5.3" 1606 | source = "registry+https://github.com/rust-lang/crates.io-index" 1607 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 1608 | dependencies = [ 1609 | "winapi", 1610 | ] 1611 | 1612 | [[package]] 1613 | name = "reqwasm" 1614 | version = "0.5.0" 1615 | source = "registry+https://github.com/rust-lang/crates.io-index" 1616 | checksum = "05b89870d729c501fa7a68c43bf4d938bbb3a8c156d333d90faa0e8b3e3212fb" 1617 | dependencies = [ 1618 | "gloo-net", 1619 | ] 1620 | 1621 | [[package]] 1622 | name = "reqwest" 1623 | version = "0.11.10" 1624 | source = "registry+https://github.com/rust-lang/crates.io-index" 1625 | checksum = "46a1f7aa4f35e5e8b4160449f51afc758f0ce6454315a9fa7d0d113e958c41eb" 1626 | dependencies = [ 1627 | "base64", 1628 | "bytes", 1629 | "encoding_rs", 1630 | "futures-core", 1631 | "futures-util", 1632 | "h2", 1633 | "http", 1634 | "http-body", 1635 | "hyper", 1636 | "hyper-tls", 1637 | "ipnet", 1638 | "js-sys", 1639 | "lazy_static", 1640 | "log", 1641 | "mime", 1642 | "native-tls", 1643 | "percent-encoding", 1644 | "pin-project-lite", 1645 | "serde", 1646 | "serde_json", 1647 | "serde_urlencoded", 1648 | "tokio", 1649 | "tokio-native-tls", 1650 | "url", 1651 | "wasm-bindgen", 1652 | "wasm-bindgen-futures", 1653 | "web-sys", 1654 | "winreg", 1655 | ] 1656 | 1657 | [[package]] 1658 | name = "ring" 1659 | version = "0.16.20" 1660 | source = "registry+https://github.com/rust-lang/crates.io-index" 1661 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" 1662 | dependencies = [ 1663 | "cc", 1664 | "libc", 1665 | "once_cell", 1666 | "spin", 1667 | "untrusted", 1668 | "web-sys", 1669 | "winapi", 1670 | ] 1671 | 1672 | [[package]] 1673 | name = "ron" 1674 | version = "0.8.0" 1675 | source = "registry+https://github.com/rust-lang/crates.io-index" 1676 | checksum = "300a51053b1cb55c80b7a9fde4120726ddf25ca241a1cbb926626f62fb136bff" 1677 | dependencies = [ 1678 | "base64", 1679 | "bitflags", 1680 | "serde", 1681 | ] 1682 | 1683 | [[package]] 1684 | name = "rustls" 1685 | version = "0.20.4" 1686 | source = "registry+https://github.com/rust-lang/crates.io-index" 1687 | checksum = "4fbfeb8d0ddb84706bc597a5574ab8912817c52a397f819e5b614e2265206921" 1688 | dependencies = [ 1689 | "log", 1690 | "ring", 1691 | "sct", 1692 | "webpki", 1693 | ] 1694 | 1695 | [[package]] 1696 | name = "ryu" 1697 | version = "1.0.9" 1698 | source = "registry+https://github.com/rust-lang/crates.io-index" 1699 | checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" 1700 | 1701 | [[package]] 1702 | name = "safe_arch" 1703 | version = "0.5.2" 1704 | source = "registry+https://github.com/rust-lang/crates.io-index" 1705 | checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" 1706 | dependencies = [ 1707 | "bytemuck", 1708 | ] 1709 | 1710 | [[package]] 1711 | name = "same-file" 1712 | version = "1.0.6" 1713 | source = "registry+https://github.com/rust-lang/crates.io-index" 1714 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" 1715 | dependencies = [ 1716 | "winapi-util", 1717 | ] 1718 | 1719 | [[package]] 1720 | name = "schannel" 1721 | version = "0.1.19" 1722 | source = "registry+https://github.com/rust-lang/crates.io-index" 1723 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 1724 | dependencies = [ 1725 | "lazy_static", 1726 | "winapi", 1727 | ] 1728 | 1729 | [[package]] 1730 | name = "scoped-tls" 1731 | version = "1.0.0" 1732 | source = "registry+https://github.com/rust-lang/crates.io-index" 1733 | checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" 1734 | 1735 | [[package]] 1736 | name = "scopeguard" 1737 | version = "1.1.0" 1738 | source = "registry+https://github.com/rust-lang/crates.io-index" 1739 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1740 | 1741 | [[package]] 1742 | name = "sct" 1743 | version = "0.7.0" 1744 | source = "registry+https://github.com/rust-lang/crates.io-index" 1745 | checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" 1746 | dependencies = [ 1747 | "ring", 1748 | "untrusted", 1749 | ] 1750 | 1751 | [[package]] 1752 | name = "sctk-adwaita" 1753 | version = "0.4.3" 1754 | source = "registry+https://github.com/rust-lang/crates.io-index" 1755 | checksum = "61270629cc6b4d77ec1907db1033d5c2e1a404c412743621981a871dc9c12339" 1756 | dependencies = [ 1757 | "crossfont", 1758 | "log", 1759 | "smithay-client-toolkit", 1760 | "tiny-skia", 1761 | ] 1762 | 1763 | [[package]] 1764 | name = "security-framework" 1765 | version = "2.6.1" 1766 | source = "registry+https://github.com/rust-lang/crates.io-index" 1767 | checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" 1768 | dependencies = [ 1769 | "bitflags", 1770 | "core-foundation", 1771 | "core-foundation-sys", 1772 | "libc", 1773 | "security-framework-sys", 1774 | ] 1775 | 1776 | [[package]] 1777 | name = "security-framework-sys" 1778 | version = "2.6.1" 1779 | source = "registry+https://github.com/rust-lang/crates.io-index" 1780 | checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" 1781 | dependencies = [ 1782 | "core-foundation-sys", 1783 | "libc", 1784 | ] 1785 | 1786 | [[package]] 1787 | name = "serde" 1788 | version = "1.0.136" 1789 | source = "registry+https://github.com/rust-lang/crates.io-index" 1790 | checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" 1791 | dependencies = [ 1792 | "serde_derive", 1793 | ] 1794 | 1795 | [[package]] 1796 | name = "serde_derive" 1797 | version = "1.0.136" 1798 | source = "registry+https://github.com/rust-lang/crates.io-index" 1799 | checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" 1800 | dependencies = [ 1801 | "proc-macro2", 1802 | "quote", 1803 | "syn", 1804 | ] 1805 | 1806 | [[package]] 1807 | name = "serde_json" 1808 | version = "1.0.79" 1809 | source = "registry+https://github.com/rust-lang/crates.io-index" 1810 | checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" 1811 | dependencies = [ 1812 | "itoa", 1813 | "ryu", 1814 | "serde", 1815 | ] 1816 | 1817 | [[package]] 1818 | name = "serde_urlencoded" 1819 | version = "0.7.1" 1820 | source = "registry+https://github.com/rust-lang/crates.io-index" 1821 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1822 | dependencies = [ 1823 | "form_urlencoded", 1824 | "itoa", 1825 | "ryu", 1826 | "serde", 1827 | ] 1828 | 1829 | [[package]] 1830 | name = "servo-fontconfig" 1831 | version = "0.5.1" 1832 | source = "registry+https://github.com/rust-lang/crates.io-index" 1833 | checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" 1834 | dependencies = [ 1835 | "libc", 1836 | "servo-fontconfig-sys", 1837 | ] 1838 | 1839 | [[package]] 1840 | name = "servo-fontconfig-sys" 1841 | version = "5.1.0" 1842 | source = "registry+https://github.com/rust-lang/crates.io-index" 1843 | checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" 1844 | dependencies = [ 1845 | "expat-sys", 1846 | "freetype-sys", 1847 | "pkg-config", 1848 | ] 1849 | 1850 | [[package]] 1851 | name = "sharded-slab" 1852 | version = "0.1.4" 1853 | source = "registry+https://github.com/rust-lang/crates.io-index" 1854 | checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" 1855 | dependencies = [ 1856 | "lazy_static", 1857 | ] 1858 | 1859 | [[package]] 1860 | name = "shared_library" 1861 | version = "0.1.9" 1862 | source = "registry+https://github.com/rust-lang/crates.io-index" 1863 | checksum = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" 1864 | dependencies = [ 1865 | "lazy_static", 1866 | "libc", 1867 | ] 1868 | 1869 | [[package]] 1870 | name = "slab" 1871 | version = "0.4.6" 1872 | source = "registry+https://github.com/rust-lang/crates.io-index" 1873 | checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" 1874 | 1875 | [[package]] 1876 | name = "slotmap" 1877 | version = "1.0.6" 1878 | source = "registry+https://github.com/rust-lang/crates.io-index" 1879 | checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" 1880 | dependencies = [ 1881 | "version_check", 1882 | ] 1883 | 1884 | [[package]] 1885 | name = "smallvec" 1886 | version = "1.8.0" 1887 | source = "registry+https://github.com/rust-lang/crates.io-index" 1888 | checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" 1889 | 1890 | [[package]] 1891 | name = "smithay-client-toolkit" 1892 | version = "0.16.0" 1893 | source = "registry+https://github.com/rust-lang/crates.io-index" 1894 | checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" 1895 | dependencies = [ 1896 | "bitflags", 1897 | "calloop", 1898 | "dlib", 1899 | "lazy_static", 1900 | "log", 1901 | "memmap2", 1902 | "nix 0.24.2", 1903 | "pkg-config", 1904 | "wayland-client", 1905 | "wayland-cursor", 1906 | "wayland-protocols", 1907 | ] 1908 | 1909 | [[package]] 1910 | name = "smithay-clipboard" 1911 | version = "0.6.6" 1912 | source = "registry+https://github.com/rust-lang/crates.io-index" 1913 | checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" 1914 | dependencies = [ 1915 | "smithay-client-toolkit", 1916 | "wayland-client", 1917 | ] 1918 | 1919 | [[package]] 1920 | name = "socket2" 1921 | version = "0.4.4" 1922 | source = "registry+https://github.com/rust-lang/crates.io-index" 1923 | checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" 1924 | dependencies = [ 1925 | "libc", 1926 | "winapi", 1927 | ] 1928 | 1929 | [[package]] 1930 | name = "spin" 1931 | version = "0.5.2" 1932 | source = "registry+https://github.com/rust-lang/crates.io-index" 1933 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 1934 | 1935 | [[package]] 1936 | name = "str-buf" 1937 | version = "1.0.6" 1938 | source = "registry+https://github.com/rust-lang/crates.io-index" 1939 | checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" 1940 | 1941 | [[package]] 1942 | name = "strsim" 1943 | version = "0.10.0" 1944 | source = "registry+https://github.com/rust-lang/crates.io-index" 1945 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" 1946 | 1947 | [[package]] 1948 | name = "syn" 1949 | version = "1.0.91" 1950 | source = "registry+https://github.com/rust-lang/crates.io-index" 1951 | checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" 1952 | dependencies = [ 1953 | "proc-macro2", 1954 | "quote", 1955 | "unicode-xid", 1956 | ] 1957 | 1958 | [[package]] 1959 | name = "tempfile" 1960 | version = "3.3.0" 1961 | source = "registry+https://github.com/rust-lang/crates.io-index" 1962 | checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" 1963 | dependencies = [ 1964 | "cfg-if", 1965 | "fastrand", 1966 | "libc", 1967 | "redox_syscall", 1968 | "remove_dir_all", 1969 | "winapi", 1970 | ] 1971 | 1972 | [[package]] 1973 | name = "thiserror" 1974 | version = "1.0.30" 1975 | source = "registry+https://github.com/rust-lang/crates.io-index" 1976 | checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" 1977 | dependencies = [ 1978 | "thiserror-impl", 1979 | ] 1980 | 1981 | [[package]] 1982 | name = "thiserror-impl" 1983 | version = "1.0.30" 1984 | source = "registry+https://github.com/rust-lang/crates.io-index" 1985 | checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" 1986 | dependencies = [ 1987 | "proc-macro2", 1988 | "quote", 1989 | "syn", 1990 | ] 1991 | 1992 | [[package]] 1993 | name = "thread_local" 1994 | version = "1.1.4" 1995 | source = "registry+https://github.com/rust-lang/crates.io-index" 1996 | checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" 1997 | dependencies = [ 1998 | "once_cell", 1999 | ] 2000 | 2001 | [[package]] 2002 | name = "tiny-skia" 2003 | version = "0.7.0" 2004 | source = "registry+https://github.com/rust-lang/crates.io-index" 2005 | checksum = "642680569bb895b16e4b9d181c60be1ed136fa0c9c7f11d004daf053ba89bf82" 2006 | dependencies = [ 2007 | "arrayref", 2008 | "arrayvec", 2009 | "bytemuck", 2010 | "cfg-if", 2011 | "png", 2012 | "safe_arch", 2013 | "tiny-skia-path", 2014 | ] 2015 | 2016 | [[package]] 2017 | name = "tiny-skia-path" 2018 | version = "0.7.0" 2019 | source = "registry+https://github.com/rust-lang/crates.io-index" 2020 | checksum = "c114d32f0c2ee43d585367cb013dfaba967ab9f62b90d9af0d696e955e70fa6c" 2021 | dependencies = [ 2022 | "arrayref", 2023 | "bytemuck", 2024 | ] 2025 | 2026 | [[package]] 2027 | name = "tinyvec" 2028 | version = "1.5.1" 2029 | source = "registry+https://github.com/rust-lang/crates.io-index" 2030 | checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" 2031 | dependencies = [ 2032 | "tinyvec_macros", 2033 | ] 2034 | 2035 | [[package]] 2036 | name = "tinyvec_macros" 2037 | version = "0.1.0" 2038 | source = "registry+https://github.com/rust-lang/crates.io-index" 2039 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 2040 | 2041 | [[package]] 2042 | name = "tokio" 2043 | version = "1.17.0" 2044 | source = "registry+https://github.com/rust-lang/crates.io-index" 2045 | checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" 2046 | dependencies = [ 2047 | "bytes", 2048 | "libc", 2049 | "memchr", 2050 | "mio", 2051 | "pin-project-lite", 2052 | "socket2", 2053 | "winapi", 2054 | ] 2055 | 2056 | [[package]] 2057 | name = "tokio-native-tls" 2058 | version = "0.3.0" 2059 | source = "registry+https://github.com/rust-lang/crates.io-index" 2060 | checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" 2061 | dependencies = [ 2062 | "native-tls", 2063 | "tokio", 2064 | ] 2065 | 2066 | [[package]] 2067 | name = "tokio-util" 2068 | version = "0.7.1" 2069 | source = "registry+https://github.com/rust-lang/crates.io-index" 2070 | checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" 2071 | dependencies = [ 2072 | "bytes", 2073 | "futures-core", 2074 | "futures-sink", 2075 | "pin-project-lite", 2076 | "tokio", 2077 | "tracing", 2078 | ] 2079 | 2080 | [[package]] 2081 | name = "toml" 2082 | version = "0.5.9" 2083 | source = "registry+https://github.com/rust-lang/crates.io-index" 2084 | checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" 2085 | dependencies = [ 2086 | "serde", 2087 | ] 2088 | 2089 | [[package]] 2090 | name = "tower-service" 2091 | version = "0.3.1" 2092 | source = "registry+https://github.com/rust-lang/crates.io-index" 2093 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 2094 | 2095 | [[package]] 2096 | name = "tracing" 2097 | version = "0.1.34" 2098 | source = "registry+https://github.com/rust-lang/crates.io-index" 2099 | checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" 2100 | dependencies = [ 2101 | "cfg-if", 2102 | "pin-project-lite", 2103 | "tracing-attributes", 2104 | "tracing-core", 2105 | ] 2106 | 2107 | [[package]] 2108 | name = "tracing-attributes" 2109 | version = "0.1.20" 2110 | source = "registry+https://github.com/rust-lang/crates.io-index" 2111 | checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" 2112 | dependencies = [ 2113 | "proc-macro2", 2114 | "quote", 2115 | "syn", 2116 | ] 2117 | 2118 | [[package]] 2119 | name = "tracing-core" 2120 | version = "0.1.26" 2121 | source = "registry+https://github.com/rust-lang/crates.io-index" 2122 | checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" 2123 | dependencies = [ 2124 | "lazy_static", 2125 | "valuable", 2126 | ] 2127 | 2128 | [[package]] 2129 | name = "tracing-log" 2130 | version = "0.1.2" 2131 | source = "registry+https://github.com/rust-lang/crates.io-index" 2132 | checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" 2133 | dependencies = [ 2134 | "lazy_static", 2135 | "log", 2136 | "tracing-core", 2137 | ] 2138 | 2139 | [[package]] 2140 | name = "tracing-subscriber" 2141 | version = "0.3.11" 2142 | source = "registry+https://github.com/rust-lang/crates.io-index" 2143 | checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" 2144 | dependencies = [ 2145 | "ansi_term", 2146 | "sharded-slab", 2147 | "smallvec", 2148 | "thread_local", 2149 | "tracing-core", 2150 | "tracing-log", 2151 | ] 2152 | 2153 | [[package]] 2154 | name = "tracing-wasm" 2155 | version = "0.2.1" 2156 | source = "registry+https://github.com/rust-lang/crates.io-index" 2157 | checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07" 2158 | dependencies = [ 2159 | "tracing", 2160 | "tracing-subscriber", 2161 | "wasm-bindgen", 2162 | ] 2163 | 2164 | [[package]] 2165 | name = "try-lock" 2166 | version = "0.2.3" 2167 | source = "registry+https://github.com/rust-lang/crates.io-index" 2168 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 2169 | 2170 | [[package]] 2171 | name = "ttf-parser" 2172 | version = "0.15.0" 2173 | source = "registry+https://github.com/rust-lang/crates.io-index" 2174 | checksum = "c74c96594835e10fa545e2a51e8709f30b173a092bfd6036ef2cec53376244f3" 2175 | 2176 | [[package]] 2177 | name = "unicode-bidi" 2178 | version = "0.3.7" 2179 | source = "registry+https://github.com/rust-lang/crates.io-index" 2180 | checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" 2181 | 2182 | [[package]] 2183 | name = "unicode-normalization" 2184 | version = "0.1.19" 2185 | source = "registry+https://github.com/rust-lang/crates.io-index" 2186 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 2187 | dependencies = [ 2188 | "tinyvec", 2189 | ] 2190 | 2191 | [[package]] 2192 | name = "unicode-xid" 2193 | version = "0.2.2" 2194 | source = "registry+https://github.com/rust-lang/crates.io-index" 2195 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 2196 | 2197 | [[package]] 2198 | name = "untrusted" 2199 | version = "0.7.1" 2200 | source = "registry+https://github.com/rust-lang/crates.io-index" 2201 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" 2202 | 2203 | [[package]] 2204 | name = "ureq" 2205 | version = "2.4.0" 2206 | source = "registry+https://github.com/rust-lang/crates.io-index" 2207 | checksum = "9399fa2f927a3d327187cbd201480cee55bee6ac5d3c77dd27f0c6814cff16d5" 2208 | dependencies = [ 2209 | "base64", 2210 | "chunked_transfer", 2211 | "flate2", 2212 | "log", 2213 | "once_cell", 2214 | "rustls", 2215 | "serde", 2216 | "serde_json", 2217 | "url", 2218 | "webpki", 2219 | "webpki-roots", 2220 | ] 2221 | 2222 | [[package]] 2223 | name = "url" 2224 | version = "2.2.2" 2225 | source = "registry+https://github.com/rust-lang/crates.io-index" 2226 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 2227 | dependencies = [ 2228 | "form_urlencoded", 2229 | "idna", 2230 | "matches", 2231 | "percent-encoding", 2232 | ] 2233 | 2234 | [[package]] 2235 | name = "valuable" 2236 | version = "0.1.0" 2237 | source = "registry+https://github.com/rust-lang/crates.io-index" 2238 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" 2239 | 2240 | [[package]] 2241 | name = "vcpkg" 2242 | version = "0.2.15" 2243 | source = "registry+https://github.com/rust-lang/crates.io-index" 2244 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 2245 | 2246 | [[package]] 2247 | name = "vec_map" 2248 | version = "0.8.2" 2249 | source = "registry+https://github.com/rust-lang/crates.io-index" 2250 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 2251 | 2252 | [[package]] 2253 | name = "version_check" 2254 | version = "0.9.4" 2255 | source = "registry+https://github.com/rust-lang/crates.io-index" 2256 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 2257 | 2258 | [[package]] 2259 | name = "walkdir" 2260 | version = "2.3.2" 2261 | source = "registry+https://github.com/rust-lang/crates.io-index" 2262 | checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" 2263 | dependencies = [ 2264 | "same-file", 2265 | "winapi", 2266 | "winapi-util", 2267 | ] 2268 | 2269 | [[package]] 2270 | name = "want" 2271 | version = "0.3.0" 2272 | source = "registry+https://github.com/rust-lang/crates.io-index" 2273 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 2274 | dependencies = [ 2275 | "log", 2276 | "try-lock", 2277 | ] 2278 | 2279 | [[package]] 2280 | name = "wasi" 2281 | version = "0.11.0+wasi-snapshot-preview1" 2282 | source = "registry+https://github.com/rust-lang/crates.io-index" 2283 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 2284 | 2285 | [[package]] 2286 | name = "wasm-bindgen" 2287 | version = "0.2.81" 2288 | source = "registry+https://github.com/rust-lang/crates.io-index" 2289 | checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" 2290 | dependencies = [ 2291 | "cfg-if", 2292 | "serde", 2293 | "serde_json", 2294 | "wasm-bindgen-macro", 2295 | ] 2296 | 2297 | [[package]] 2298 | name = "wasm-bindgen-backend" 2299 | version = "0.2.81" 2300 | source = "registry+https://github.com/rust-lang/crates.io-index" 2301 | checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" 2302 | dependencies = [ 2303 | "bumpalo", 2304 | "lazy_static", 2305 | "log", 2306 | "proc-macro2", 2307 | "quote", 2308 | "syn", 2309 | "wasm-bindgen-shared", 2310 | ] 2311 | 2312 | [[package]] 2313 | name = "wasm-bindgen-futures" 2314 | version = "0.4.30" 2315 | source = "registry+https://github.com/rust-lang/crates.io-index" 2316 | checksum = "6f741de44b75e14c35df886aff5f1eb73aa114fa5d4d00dcd37b5e01259bf3b2" 2317 | dependencies = [ 2318 | "cfg-if", 2319 | "js-sys", 2320 | "wasm-bindgen", 2321 | "web-sys", 2322 | ] 2323 | 2324 | [[package]] 2325 | name = "wasm-bindgen-macro" 2326 | version = "0.2.81" 2327 | source = "registry+https://github.com/rust-lang/crates.io-index" 2328 | checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" 2329 | dependencies = [ 2330 | "quote", 2331 | "wasm-bindgen-macro-support", 2332 | ] 2333 | 2334 | [[package]] 2335 | name = "wasm-bindgen-macro-support" 2336 | version = "0.2.81" 2337 | source = "registry+https://github.com/rust-lang/crates.io-index" 2338 | checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" 2339 | dependencies = [ 2340 | "proc-macro2", 2341 | "quote", 2342 | "syn", 2343 | "wasm-bindgen-backend", 2344 | "wasm-bindgen-shared", 2345 | ] 2346 | 2347 | [[package]] 2348 | name = "wasm-bindgen-shared" 2349 | version = "0.2.81" 2350 | source = "registry+https://github.com/rust-lang/crates.io-index" 2351 | checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" 2352 | 2353 | [[package]] 2354 | name = "wayland-client" 2355 | version = "0.29.4" 2356 | source = "registry+https://github.com/rust-lang/crates.io-index" 2357 | checksum = "91223460e73257f697d9e23d401279123d36039a3f7a449e983f123292d4458f" 2358 | dependencies = [ 2359 | "bitflags", 2360 | "downcast-rs", 2361 | "libc", 2362 | "nix 0.22.3", 2363 | "scoped-tls", 2364 | "wayland-commons", 2365 | "wayland-scanner", 2366 | "wayland-sys", 2367 | ] 2368 | 2369 | [[package]] 2370 | name = "wayland-commons" 2371 | version = "0.29.4" 2372 | source = "registry+https://github.com/rust-lang/crates.io-index" 2373 | checksum = "94f6e5e340d7c13490eca867898c4cec5af56c27a5ffe5c80c6fc4708e22d33e" 2374 | dependencies = [ 2375 | "nix 0.22.3", 2376 | "once_cell", 2377 | "smallvec", 2378 | "wayland-sys", 2379 | ] 2380 | 2381 | [[package]] 2382 | name = "wayland-cursor" 2383 | version = "0.29.4" 2384 | source = "registry+https://github.com/rust-lang/crates.io-index" 2385 | checksum = "c52758f13d5e7861fc83d942d3d99bf270c83269575e52ac29e5b73cb956a6bd" 2386 | dependencies = [ 2387 | "nix 0.22.3", 2388 | "wayland-client", 2389 | "xcursor", 2390 | ] 2391 | 2392 | [[package]] 2393 | name = "wayland-egl" 2394 | version = "0.29.4" 2395 | source = "registry+https://github.com/rust-lang/crates.io-index" 2396 | checksum = "83281d69ee162b59031c666385e93bde4039ec553b90c4191cdb128ceea29a3a" 2397 | dependencies = [ 2398 | "wayland-client", 2399 | "wayland-sys", 2400 | ] 2401 | 2402 | [[package]] 2403 | name = "wayland-protocols" 2404 | version = "0.29.4" 2405 | source = "registry+https://github.com/rust-lang/crates.io-index" 2406 | checksum = "60147ae23303402e41fe034f74fb2c35ad0780ee88a1c40ac09a3be1e7465741" 2407 | dependencies = [ 2408 | "bitflags", 2409 | "wayland-client", 2410 | "wayland-commons", 2411 | "wayland-scanner", 2412 | ] 2413 | 2414 | [[package]] 2415 | name = "wayland-scanner" 2416 | version = "0.29.4" 2417 | source = "registry+https://github.com/rust-lang/crates.io-index" 2418 | checksum = "39a1ed3143f7a143187156a2ab52742e89dac33245ba505c17224df48939f9e0" 2419 | dependencies = [ 2420 | "proc-macro2", 2421 | "quote", 2422 | "xml-rs", 2423 | ] 2424 | 2425 | [[package]] 2426 | name = "wayland-sys" 2427 | version = "0.29.4" 2428 | source = "registry+https://github.com/rust-lang/crates.io-index" 2429 | checksum = "d9341df79a8975679188e37dab3889bfa57c44ac2cb6da166f519a81cbe452d4" 2430 | dependencies = [ 2431 | "dlib", 2432 | "lazy_static", 2433 | "pkg-config", 2434 | ] 2435 | 2436 | [[package]] 2437 | name = "web-sys" 2438 | version = "0.3.57" 2439 | source = "registry+https://github.com/rust-lang/crates.io-index" 2440 | checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" 2441 | dependencies = [ 2442 | "js-sys", 2443 | "wasm-bindgen", 2444 | ] 2445 | 2446 | [[package]] 2447 | name = "webbrowser" 2448 | version = "0.7.1" 2449 | source = "registry+https://github.com/rust-lang/crates.io-index" 2450 | checksum = "fc6a3cffdb686fbb24d9fb8f03a213803277ed2300f11026a3afe1f108dc021b" 2451 | dependencies = [ 2452 | "jni", 2453 | "ndk-glue 0.6.1", 2454 | "url", 2455 | "web-sys", 2456 | "widestring", 2457 | "winapi", 2458 | ] 2459 | 2460 | [[package]] 2461 | name = "webpki" 2462 | version = "0.22.0" 2463 | source = "registry+https://github.com/rust-lang/crates.io-index" 2464 | checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" 2465 | dependencies = [ 2466 | "ring", 2467 | "untrusted", 2468 | ] 2469 | 2470 | [[package]] 2471 | name = "webpki-roots" 2472 | version = "0.22.3" 2473 | source = "registry+https://github.com/rust-lang/crates.io-index" 2474 | checksum = "44d8de8415c823c8abd270ad483c6feeac771fad964890779f9a8cb24fbbc1bf" 2475 | dependencies = [ 2476 | "webpki", 2477 | ] 2478 | 2479 | [[package]] 2480 | name = "widestring" 2481 | version = "0.5.1" 2482 | source = "registry+https://github.com/rust-lang/crates.io-index" 2483 | checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" 2484 | 2485 | [[package]] 2486 | name = "winapi" 2487 | version = "0.3.9" 2488 | source = "registry+https://github.com/rust-lang/crates.io-index" 2489 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 2490 | dependencies = [ 2491 | "winapi-i686-pc-windows-gnu", 2492 | "winapi-x86_64-pc-windows-gnu", 2493 | ] 2494 | 2495 | [[package]] 2496 | name = "winapi-i686-pc-windows-gnu" 2497 | version = "0.4.0" 2498 | source = "registry+https://github.com/rust-lang/crates.io-index" 2499 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 2500 | 2501 | [[package]] 2502 | name = "winapi-util" 2503 | version = "0.1.5" 2504 | source = "registry+https://github.com/rust-lang/crates.io-index" 2505 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 2506 | dependencies = [ 2507 | "winapi", 2508 | ] 2509 | 2510 | [[package]] 2511 | name = "winapi-wsapoll" 2512 | version = "0.1.1" 2513 | source = "registry+https://github.com/rust-lang/crates.io-index" 2514 | checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" 2515 | dependencies = [ 2516 | "winapi", 2517 | ] 2518 | 2519 | [[package]] 2520 | name = "winapi-x86_64-pc-windows-gnu" 2521 | version = "0.4.0" 2522 | source = "registry+https://github.com/rust-lang/crates.io-index" 2523 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 2524 | 2525 | [[package]] 2526 | name = "windows-sys" 2527 | version = "0.34.0" 2528 | source = "registry+https://github.com/rust-lang/crates.io-index" 2529 | checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" 2530 | dependencies = [ 2531 | "windows_aarch64_msvc 0.34.0", 2532 | "windows_i686_gnu 0.34.0", 2533 | "windows_i686_msvc 0.34.0", 2534 | "windows_x86_64_gnu 0.34.0", 2535 | "windows_x86_64_msvc 0.34.0", 2536 | ] 2537 | 2538 | [[package]] 2539 | name = "windows-sys" 2540 | version = "0.36.1" 2541 | source = "registry+https://github.com/rust-lang/crates.io-index" 2542 | checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" 2543 | dependencies = [ 2544 | "windows_aarch64_msvc 0.36.1", 2545 | "windows_i686_gnu 0.36.1", 2546 | "windows_i686_msvc 0.36.1", 2547 | "windows_x86_64_gnu 0.36.1", 2548 | "windows_x86_64_msvc 0.36.1", 2549 | ] 2550 | 2551 | [[package]] 2552 | name = "windows_aarch64_msvc" 2553 | version = "0.34.0" 2554 | source = "registry+https://github.com/rust-lang/crates.io-index" 2555 | checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" 2556 | 2557 | [[package]] 2558 | name = "windows_aarch64_msvc" 2559 | version = "0.36.1" 2560 | source = "registry+https://github.com/rust-lang/crates.io-index" 2561 | checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" 2562 | 2563 | [[package]] 2564 | name = "windows_i686_gnu" 2565 | version = "0.34.0" 2566 | source = "registry+https://github.com/rust-lang/crates.io-index" 2567 | checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" 2568 | 2569 | [[package]] 2570 | name = "windows_i686_gnu" 2571 | version = "0.36.1" 2572 | source = "registry+https://github.com/rust-lang/crates.io-index" 2573 | checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" 2574 | 2575 | [[package]] 2576 | name = "windows_i686_msvc" 2577 | version = "0.34.0" 2578 | source = "registry+https://github.com/rust-lang/crates.io-index" 2579 | checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" 2580 | 2581 | [[package]] 2582 | name = "windows_i686_msvc" 2583 | version = "0.36.1" 2584 | source = "registry+https://github.com/rust-lang/crates.io-index" 2585 | checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" 2586 | 2587 | [[package]] 2588 | name = "windows_x86_64_gnu" 2589 | version = "0.34.0" 2590 | source = "registry+https://github.com/rust-lang/crates.io-index" 2591 | checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" 2592 | 2593 | [[package]] 2594 | name = "windows_x86_64_gnu" 2595 | version = "0.36.1" 2596 | source = "registry+https://github.com/rust-lang/crates.io-index" 2597 | checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" 2598 | 2599 | [[package]] 2600 | name = "windows_x86_64_msvc" 2601 | version = "0.34.0" 2602 | source = "registry+https://github.com/rust-lang/crates.io-index" 2603 | checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" 2604 | 2605 | [[package]] 2606 | name = "windows_x86_64_msvc" 2607 | version = "0.36.1" 2608 | source = "registry+https://github.com/rust-lang/crates.io-index" 2609 | checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" 2610 | 2611 | [[package]] 2612 | name = "winit" 2613 | version = "0.27.5" 2614 | source = "registry+https://github.com/rust-lang/crates.io-index" 2615 | checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" 2616 | dependencies = [ 2617 | "bitflags", 2618 | "cocoa", 2619 | "core-foundation", 2620 | "core-graphics", 2621 | "dispatch", 2622 | "instant", 2623 | "libc", 2624 | "log", 2625 | "mio", 2626 | "ndk 0.7.0", 2627 | "ndk-glue 0.7.0", 2628 | "objc", 2629 | "once_cell", 2630 | "parking_lot", 2631 | "percent-encoding", 2632 | "raw-window-handle 0.4.3", 2633 | "raw-window-handle 0.5.0", 2634 | "sctk-adwaita", 2635 | "smithay-client-toolkit", 2636 | "wasm-bindgen", 2637 | "wayland-client", 2638 | "wayland-protocols", 2639 | "web-sys", 2640 | "windows-sys 0.36.1", 2641 | "x11-dl", 2642 | ] 2643 | 2644 | [[package]] 2645 | name = "winreg" 2646 | version = "0.10.1" 2647 | source = "registry+https://github.com/rust-lang/crates.io-index" 2648 | checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 2649 | dependencies = [ 2650 | "winapi", 2651 | ] 2652 | 2653 | [[package]] 2654 | name = "wio" 2655 | version = "0.2.2" 2656 | source = "registry+https://github.com/rust-lang/crates.io-index" 2657 | checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" 2658 | dependencies = [ 2659 | "winapi", 2660 | ] 2661 | 2662 | [[package]] 2663 | name = "x11-dl" 2664 | version = "2.19.1" 2665 | source = "registry+https://github.com/rust-lang/crates.io-index" 2666 | checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" 2667 | dependencies = [ 2668 | "lazy_static", 2669 | "libc", 2670 | "pkg-config", 2671 | ] 2672 | 2673 | [[package]] 2674 | name = "x11rb" 2675 | version = "0.9.0" 2676 | source = "registry+https://github.com/rust-lang/crates.io-index" 2677 | checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a" 2678 | dependencies = [ 2679 | "gethostname", 2680 | "nix 0.22.3", 2681 | "winapi", 2682 | "winapi-wsapoll", 2683 | ] 2684 | 2685 | [[package]] 2686 | name = "xcursor" 2687 | version = "0.3.4" 2688 | source = "registry+https://github.com/rust-lang/crates.io-index" 2689 | checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" 2690 | dependencies = [ 2691 | "nom", 2692 | ] 2693 | 2694 | [[package]] 2695 | name = "xml-rs" 2696 | version = "0.8.4" 2697 | source = "registry+https://github.com/rust-lang/crates.io-index" 2698 | checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" 2699 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | 3 | members = [ 4 | "newsapi", 5 | "headlines" 6 | ] 7 | -------------------------------------------------------------------------------- /MesloLGS_NF_Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/creativcoder/headlines/da4791fffe52c74afe9e51c5584ae4886b8e81ae/MesloLGS_NF_Regular.ttf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |

Headlines [WIP]

5 | 6 | 7 | A cross platform native GUI app built with Rust using [egui](https://github.com/emilk/egui). Uses newsapi.org as the source to fetch news articles. 8 |
9 | 10 | 11 | ![screenshot](./assets/thumb.png) 12 | 13 | This project is intended to serve as educational content 14 | for folks learning Rust. To follow along in the journey check out the video walkthoughs below: 15 | 16 | ## Video walkthroughs 17 | 18 | [EP 7a](https://youtu.be/NtUkr_z7l84) 19 | 20 | [EP 7b](https://www.youtube.com/watch?v=SvFPdgGwzTQ) 21 | 22 | [EP 8](https://www.youtube.com/watch?v=4MKcqR9z8AU) 23 | 24 | [EP 9](https://youtu.be/EOIhsRxhV80) 25 | 26 | Subscribe to the [creativcoder](https://www.youtube.com/c/creativcoder?sub_confirmation=1) channel to stay updated for more. 27 | 28 | ## Implementation Status / Roadmap 29 | 30 | - [X] Base UI 31 | - [X] Integrate dark mode 32 | - [X] Integrate real articles feed. 33 | - [X] Config window for setting API_KEY 34 | - [X] State persistance 35 | - [X] Cross platform 36 | - [ ] Build and release script 37 | - [ ] CI integration using GitHub Actions 38 | - [ ] More API features 39 | - [ ] Multiple news sources. 40 | 41 | ## Build and run instructions 42 | 43 | Before building headlines make sure you have rust toolchain installed and `egui` [dependencies](https://github.com/emilk/egui#demo) are installed. 44 | 45 | ### Linux 46 | 47 | `cargo run` 48 | 49 | ### Windows 50 | 51 | `cargo run`. 52 | 53 | ### Mac 54 | 55 | `cargo run` should work but would help if someone can test it. 56 | 57 | ### Web 58 | 59 | Headlines can be served from your browser (only at localhost at the moment, because of CORS) 60 | 61 | * Run `./setup_web.sh` script to install dependencies. 62 | * Run `./start_web.sh` to spawn the app in the browser. 63 | 64 | ## Contributions 65 | 66 | All kinds of contributions are welcome. 67 | 68 | ## License 69 | 70 | MIT 71 | -------------------------------------------------------------------------------- /assets/thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/creativcoder/headlines/da4791fffe52c74afe9e51c5584ae4886b8e81ae/assets/thumb.png -------------------------------------------------------------------------------- /headlines/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /headlines/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "headlines" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | eframe = {version = "0.19", features = ["persistence"]} 10 | serde = { version = "1.0.136", features = ["derive"] } 11 | tracing = "0.1.34" 12 | tracing-subscriber = "0.3.11" 13 | newsapi = {path = "../newsapi"} 14 | 15 | [lib] 16 | crate-type = ["cdylib", "rlib"] 17 | 18 | [target.'cfg(target_arch = "wasm32")'.dependencies] 19 | gloo-timers = "0.2.4" 20 | tracing-wasm = "0.2.1" 21 | wasm-bindgen-futures = "0.4.30" 22 | -------------------------------------------------------------------------------- /headlines/src/headlines.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | use std::sync::mpsc::{channel, sync_channel, Receiver, SyncSender}; 3 | 4 | #[cfg(not(target_arch = "wasm32"))] 5 | use crate::fetch_news; 6 | use crate::APP_NAME; 7 | #[cfg(not(target_arch = "wasm32"))] 8 | use std::thread; 9 | 10 | #[cfg(target_arch = "wasm32")] 11 | use crate::fetch_web; 12 | use eframe::{ 13 | egui::{ 14 | self, Button, CentralPanel, Color32, Context, FontData, FontDefinitions, FontFamily, 15 | Hyperlink, Label, Layout, RichText, Separator, TextStyle, TopBottomPanel, Ui, Window, 16 | }, 17 | CreationContext, 18 | }; 19 | 20 | pub const PADDING: f32 = 5.0; 21 | const WHITE: Color32 = Color32::from_rgb(255, 255, 255); 22 | const BLACK: Color32 = Color32::from_rgb(0, 0, 0); 23 | const CYAN: Color32 = Color32::from_rgb(0, 255, 255); 24 | const RED: Color32 = Color32::from_rgb(255, 0, 0); 25 | 26 | pub enum Msg { 27 | ApiKeySet(String), 28 | Refresh, 29 | } 30 | 31 | #[derive(Serialize, Deserialize)] 32 | pub struct HeadlinesConfig { 33 | pub dark_mode: bool, 34 | pub api_key: String, 35 | } 36 | 37 | impl Default for HeadlinesConfig { 38 | fn default() -> Self { 39 | Self { 40 | dark_mode: Default::default(), 41 | api_key: String::new(), 42 | } 43 | } 44 | } 45 | 46 | #[derive(Default)] 47 | pub struct Headlines { 48 | pub articles: Vec, 49 | pub config: HeadlinesConfig, 50 | pub api_key_initialized: bool, 51 | pub toggle_config: bool, 52 | pub toggle_about: bool, 53 | pub news_rx: Option>, 54 | pub app_tx: Option>, 55 | } 56 | 57 | pub struct NewsCardData { 58 | pub title: String, 59 | pub desc: String, 60 | pub url: String, 61 | } 62 | 63 | impl Headlines { 64 | pub fn init(mut self, cc: &CreationContext) -> Self { 65 | if let Some(storage) = cc.storage { 66 | self.config = eframe::get_value(storage, APP_NAME).unwrap_or_default(); 67 | self.api_key_initialized = !self.config.api_key.is_empty(); 68 | } 69 | 70 | let api_key = self.config.api_key.to_string(); 71 | let (app_tx, app_rx) = sync_channel(1); 72 | self.app_tx = Some(app_tx); 73 | #[allow(unused_mut)] 74 | let (mut news_tx, news_rx) = channel(); 75 | self.news_rx = Some(news_rx); 76 | self.toggle_config = false; 77 | 78 | #[cfg(not(target_arch = "wasm32"))] 79 | { 80 | thread::spawn(move || { 81 | if !api_key.is_empty() { 82 | fetch_news(&api_key, &mut news_tx); 83 | } 84 | 85 | loop { 86 | match app_rx.recv() { 87 | Ok(Msg::ApiKeySet(api_key)) => { 88 | tracing::info!("api key set recvd"); 89 | fetch_news(&api_key, &mut news_tx); 90 | } 91 | Ok(Msg::Refresh) => { 92 | fetch_news(&api_key, &mut news_tx); 93 | } 94 | Err(_) => continue, 95 | } 96 | } 97 | }); 98 | } 99 | 100 | #[cfg(target_arch = "wasm32")] 101 | { 102 | let api_key_web = api_key.clone(); 103 | let news_tx_web = news_tx.clone(); 104 | gloo_timers::callback::Timeout::new(10, move || { 105 | wasm_bindgen_futures::spawn_local(async { 106 | fetch_web(api_key_web, news_tx_web).await; 107 | }); 108 | }) 109 | .forget(); 110 | 111 | gloo_timers::callback::Interval::new(2000, move || match app_rx.try_recv() { 112 | Ok(Msg::ApiKeySet(api_key)) => { 113 | wasm_bindgen_futures::spawn_local(fetch_web(api_key.clone(), news_tx.clone())); 114 | } 115 | Ok(Msg::Refresh) => { 116 | let api_key = api_key.clone(); 117 | wasm_bindgen_futures::spawn_local(fetch_web(api_key, news_tx.clone())); 118 | } 119 | Err(e) => { 120 | tracing::warn!("failed receiving msg: {}", e); 121 | } 122 | }) 123 | .forget(); 124 | } 125 | 126 | self.configure_fonts(&cc.egui_ctx); 127 | 128 | self 129 | } 130 | 131 | pub fn configure_fonts(&self, ctx: &Context) { 132 | let mut font_def = FontDefinitions::default(); 133 | font_def.font_data.insert( 134 | "MesloLGS".to_string(), 135 | FontData::from_static(include_bytes!("../../MesloLGS_NF_Regular.ttf")), 136 | ); 137 | 138 | font_def 139 | .families 140 | .get_mut(&FontFamily::Proportional) 141 | .unwrap() 142 | .insert(0, "MesloLGS".to_string()); 143 | 144 | ctx.set_fonts(font_def); 145 | } 146 | 147 | pub fn render_news_cards(&self, ui: &mut eframe::egui::Ui) { 148 | for a in &self.articles { 149 | ui.add_space(PADDING); 150 | // render title 151 | let title = format!("▶ {}", a.title); 152 | if self.config.dark_mode { 153 | ui.colored_label(WHITE, title); 154 | } else { 155 | ui.colored_label(BLACK, title); 156 | } 157 | // render desc 158 | ui.add_space(PADDING); 159 | let desc = 160 | Label::new(RichText::new(&a.desc).text_style(eframe::egui::TextStyle::Button)); 161 | ui.add(desc); 162 | 163 | // render hyperlinks 164 | if self.config.dark_mode { 165 | ui.style_mut().visuals.hyperlink_color = CYAN; 166 | } else { 167 | ui.style_mut().visuals.hyperlink_color = RED; 168 | } 169 | ui.add_space(PADDING); 170 | ui.with_layout( 171 | Layout::right_to_left(eframe::emath::Align::Min) 172 | .with_cross_align(eframe::emath::Align::Min), 173 | |ui| { 174 | ui.add(Hyperlink::from_label_and_url("read more ⤴", &a.url)); 175 | }, 176 | ); 177 | ui.add_space(PADDING); 178 | ui.add(Separator::default()); 179 | } 180 | } 181 | 182 | #[allow(unused)] 183 | pub(crate) fn render_top_panel(&mut self, ctx: &Context, frame: &mut eframe::Frame) { 184 | // define a TopBottomPanel widget 185 | TopBottomPanel::top("top_panel").show(ctx, |ui| { 186 | ui.add_space(10.); 187 | egui::menu::bar(ui, |ui| { 188 | // logo 189 | ui.with_layout(Layout::left_to_right(eframe::emath::Align::Min), |ui| { 190 | ui.add(Label::new( 191 | RichText::new("📰").text_style(egui::TextStyle::Heading), 192 | )); 193 | }); 194 | // controls 195 | ui.with_layout(Layout::right_to_left(eframe::emath::Align::Min), |ui| { 196 | #[cfg(not(target_arch = "wasm32"))] 197 | { 198 | let close_btn = ui.add(Button::new( 199 | RichText::new("❌").text_style(egui::TextStyle::Body), 200 | )); 201 | 202 | if close_btn.clicked() { 203 | frame.close(); 204 | } 205 | } 206 | 207 | let refresh_btn = ui.add(Button::new( 208 | RichText::new("🔄").text_style(egui::TextStyle::Body), 209 | )); 210 | if refresh_btn.clicked() { 211 | self.articles.clear(); 212 | if let Some(tx) = &self.app_tx { 213 | tx.send(Msg::Refresh) 214 | .expect("Failed sending refresh event."); 215 | } 216 | } 217 | // theme button 218 | let theme_btn = ui.add(Button::new( 219 | RichText::new({ 220 | if self.config.dark_mode { 221 | "🌞" 222 | } else { 223 | "🌙" 224 | } 225 | }) 226 | .text_style(egui::TextStyle::Body), 227 | )); 228 | if theme_btn.clicked() { 229 | self.config.dark_mode = !self.config.dark_mode; 230 | } 231 | 232 | // config button 233 | let config_btn = ui.add(Button::new( 234 | RichText::new("🛠").text_style(egui::TextStyle::Body), 235 | )); 236 | 237 | if config_btn.clicked() { 238 | self.toggle_config = !self.toggle_config; 239 | } 240 | 241 | // about button 242 | let about_btn = 243 | ui.add(Button::new(RichText::new("ℹ").text_style(TextStyle::Body))); 244 | if about_btn.clicked() { 245 | self.toggle_about = !self.toggle_about; 246 | } 247 | }); 248 | }); 249 | ui.add_space(10.); 250 | }); 251 | } 252 | 253 | pub fn preload_articles(&mut self) { 254 | if let Some(rx) = &self.news_rx { 255 | if let Ok(news_data) = rx.try_recv() { 256 | self.articles.push(news_data); 257 | } 258 | } 259 | } 260 | 261 | pub fn render_config(&mut self, ctx: &Context) { 262 | CentralPanel::default().show(ctx, |_| { 263 | let Headlines { 264 | toggle_config, 265 | config, 266 | app_tx, 267 | api_key_initialized, 268 | .. 269 | } = self; 270 | Window::new("App configuration") 271 | .open(toggle_config) 272 | .show(ctx, |ui| { 273 | ui.label("Enter you API_KEY for newsapi.org"); 274 | let text_input = ui.text_edit_singleline(&mut config.api_key); 275 | if text_input.lost_focus() && ui.input().key_pressed(egui::Key::Enter) { 276 | if let Some(tx) = &app_tx { 277 | tx.send(Msg::ApiKeySet(config.api_key.to_string())) 278 | .expect("Failed sending ApiKeySet event"); 279 | } 280 | *api_key_initialized = true; 281 | tracing::info!("API_KEY set"); 282 | ui.close_menu(); 283 | } 284 | ui.label("Don't have the API_KEY? register at:"); 285 | ui.hyperlink("https://newsapi.org/register"); 286 | }); 287 | }); 288 | } 289 | 290 | pub fn render_about(&mut self, ctx: &Context) { 291 | let window = Window::new("About headlines").open(&mut self.toggle_about); 292 | window.show(ctx, |ui| { 293 | let info = Label::new("A simple news reading app that runs on all platforms."); 294 | ui.add(info); 295 | }); 296 | } 297 | 298 | pub(crate) fn render_footer(&self, ctx: &Context) { 299 | TopBottomPanel::bottom("footer").show(ctx, |ui| { 300 | ui.vertical_centered(|ui| { 301 | ui.add_space(10.); 302 | ui.add(Label::new( 303 | RichText::new("API source: newsapi.org") 304 | .small() 305 | .text_style(TextStyle::Monospace), 306 | )); 307 | ui.add(Hyperlink::from_label_and_url( 308 | "Made with egui", 309 | "https://github.com/emilk/egui", 310 | )); 311 | ui.add(Hyperlink::from_label_and_url( 312 | "creativcoder/headlines", 313 | "https://github.com/creativcoder/headlines", 314 | )); 315 | ui.add_space(10.); 316 | }) 317 | }); 318 | } 319 | 320 | pub(crate) fn render_header(&self, ui: &mut Ui) { 321 | ui.vertical_centered(|ui| { 322 | ui.heading("headlines"); 323 | }); 324 | ui.add_space(PADDING); 325 | let sep = Separator::default().spacing(20.); 326 | ui.add(sep); 327 | } 328 | } 329 | -------------------------------------------------------------------------------- /headlines/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod headlines; 2 | 3 | use eframe::{ 4 | egui::{CentralPanel, ScrollArea, Spinner, Visuals}, 5 | App, 6 | }; 7 | pub use headlines::{Headlines, Msg, NewsCardData, PADDING}; 8 | use newsapi::NewsAPI; 9 | 10 | const APP_NAME: &str = "headlines"; 11 | 12 | impl App for Headlines { 13 | fn update(&mut self, ctx: &eframe::egui::Context, frame: &mut eframe::Frame) { 14 | ctx.request_repaint(); 15 | ctx.set_debug_on_hover(false); 16 | 17 | if self.config.dark_mode { 18 | ctx.set_visuals(Visuals::dark()); 19 | } else { 20 | ctx.set_visuals(Visuals::light()); 21 | } 22 | 23 | if self.toggle_about { 24 | self.render_about(ctx); 25 | return; 26 | } 27 | 28 | if self.toggle_config || !self.api_key_initialized { 29 | self.render_config(ctx); 30 | } else { 31 | self.preload_articles(); 32 | self.render_top_panel(ctx, frame); 33 | self.render_footer(ctx); 34 | CentralPanel::default().show(ctx, |ui| { 35 | if self.articles.is_empty() { 36 | ui.vertical_centered_justified(|ui| ui.add(Spinner::new())); 37 | } else { 38 | self.render_header(ui); 39 | ScrollArea::vertical().show(ui, |ui| { 40 | self.render_news_cards(ui); 41 | }); 42 | } 43 | }); 44 | } 45 | } 46 | 47 | fn save(&mut self, storage: &mut dyn eframe::Storage) { 48 | eframe::set_value(storage, APP_NAME, &self.config); 49 | } 50 | } 51 | 52 | #[cfg(not(target_arch = "wasm32"))] 53 | fn fetch_news(api_key: &str, news_tx: &mut std::sync::mpsc::Sender) { 54 | if let Ok(response) = NewsAPI::new(&api_key).fetch() { 55 | let resp_articles = response.articles(); 56 | for a in resp_articles.iter() { 57 | let news = NewsCardData { 58 | title: a.title().to_string(), 59 | url: a.url().to_string(), 60 | desc: a.desc().map(|s| s.to_string()).unwrap_or("...".to_string()), 61 | }; 62 | if let Err(e) = news_tx.send(news) { 63 | tracing::error!("Error sending news data: {}", e); 64 | } 65 | } 66 | } else { 67 | tracing::error!("failed fetching news"); 68 | } 69 | } 70 | 71 | #[cfg(target_arch = "wasm32")] 72 | async fn fetch_web(api_key: String, news_tx: std::sync::mpsc::Sender) { 73 | if let Ok(response) = NewsAPI::new(&api_key).fetch_web().await { 74 | let resp_articles = response.articles(); 75 | for a in resp_articles.iter() { 76 | let news = NewsCardData { 77 | title: a.title().to_string(), 78 | url: a.url().to_string(), 79 | desc: a.desc().map(|s| s.to_string()).unwrap_or("...".to_string()), 80 | }; 81 | if let Err(e) = news_tx.send(news) { 82 | tracing::error!("Error sending news data: {}", e); 83 | } 84 | } 85 | } else { 86 | tracing::error!("failed fetching news"); 87 | } 88 | } 89 | 90 | #[cfg(target_arch = "wasm32")] 91 | use eframe::wasm_bindgen::{self, prelude::*}; 92 | 93 | #[cfg(target_arch = "wasm32")] 94 | #[wasm_bindgen] 95 | pub fn main_web(canvas_id: &str) { 96 | let headlines = Headlines::default(); 97 | tracing_wasm::set_as_global_default(); 98 | let web_options = eframe::WebOptions::default(); 99 | eframe::start_web( 100 | canvas_id, 101 | web_options, 102 | Box::new(|cc| Box::new(headlines.init(cc))), 103 | ) 104 | .expect("Failed to launch headlines"); 105 | } 106 | -------------------------------------------------------------------------------- /headlines/src/main.rs: -------------------------------------------------------------------------------- 1 | use eframe::{egui::Vec2, run_native, NativeOptions}; 2 | use headlines::Headlines; 3 | 4 | fn main() { 5 | tracing_subscriber::fmt() 6 | .with_file(true) 7 | .with_line_number(true) 8 | .init(); 9 | 10 | let headlines = Headlines::default(); 11 | let mut win_option = NativeOptions::default(); 12 | win_option.initial_window_size = Some(Vec2::new(540., 960.)); 13 | run_native( 14 | "Headlines", 15 | win_option, 16 | Box::new(|cc| Box::new(headlines.init(cc))), 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /newsapi/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "autocfg" 7 | version = "1.0.1" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" 10 | 11 | [[package]] 12 | name = "base64" 13 | version = "0.13.0" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 16 | 17 | [[package]] 18 | name = "bitflags" 19 | version = "1.3.2" 20 | source = "registry+https://github.com/rust-lang/crates.io-index" 21 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 22 | 23 | [[package]] 24 | name = "bumpalo" 25 | version = "3.7.1" 26 | source = "registry+https://github.com/rust-lang/crates.io-index" 27 | checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538" 28 | 29 | [[package]] 30 | name = "bytes" 31 | version = "1.1.0" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" 34 | 35 | [[package]] 36 | name = "cc" 37 | version = "1.0.70" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" 40 | 41 | [[package]] 42 | name = "cfg-if" 43 | version = "1.0.0" 44 | source = "registry+https://github.com/rust-lang/crates.io-index" 45 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 46 | 47 | [[package]] 48 | name = "chunked_transfer" 49 | version = "1.4.0" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" 52 | 53 | [[package]] 54 | name = "core-foundation" 55 | version = "0.9.1" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" 58 | dependencies = [ 59 | "core-foundation-sys", 60 | "libc", 61 | ] 62 | 63 | [[package]] 64 | name = "core-foundation-sys" 65 | version = "0.8.2" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" 68 | 69 | [[package]] 70 | name = "encoding_rs" 71 | version = "0.8.28" 72 | source = "registry+https://github.com/rust-lang/crates.io-index" 73 | checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" 74 | dependencies = [ 75 | "cfg-if", 76 | ] 77 | 78 | [[package]] 79 | name = "fnv" 80 | version = "1.0.7" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 83 | 84 | [[package]] 85 | name = "foreign-types" 86 | version = "0.3.2" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 89 | dependencies = [ 90 | "foreign-types-shared", 91 | ] 92 | 93 | [[package]] 94 | name = "foreign-types-shared" 95 | version = "0.1.1" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 98 | 99 | [[package]] 100 | name = "form_urlencoded" 101 | version = "1.0.1" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 104 | dependencies = [ 105 | "matches", 106 | "percent-encoding", 107 | ] 108 | 109 | [[package]] 110 | name = "futures-channel" 111 | version = "0.3.17" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" 114 | dependencies = [ 115 | "futures-core", 116 | ] 117 | 118 | [[package]] 119 | name = "futures-core" 120 | version = "0.3.17" 121 | source = "registry+https://github.com/rust-lang/crates.io-index" 122 | checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" 123 | 124 | [[package]] 125 | name = "futures-sink" 126 | version = "0.3.17" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" 129 | 130 | [[package]] 131 | name = "futures-task" 132 | version = "0.3.17" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" 135 | 136 | [[package]] 137 | name = "futures-util" 138 | version = "0.3.17" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" 141 | dependencies = [ 142 | "autocfg", 143 | "futures-core", 144 | "futures-task", 145 | "pin-project-lite", 146 | "pin-utils", 147 | ] 148 | 149 | [[package]] 150 | name = "getrandom" 151 | version = "0.2.3" 152 | source = "registry+https://github.com/rust-lang/crates.io-index" 153 | checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" 154 | dependencies = [ 155 | "cfg-if", 156 | "libc", 157 | "wasi", 158 | ] 159 | 160 | [[package]] 161 | name = "h2" 162 | version = "0.3.4" 163 | source = "registry+https://github.com/rust-lang/crates.io-index" 164 | checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" 165 | dependencies = [ 166 | "bytes", 167 | "fnv", 168 | "futures-core", 169 | "futures-sink", 170 | "futures-util", 171 | "http", 172 | "indexmap", 173 | "slab", 174 | "tokio", 175 | "tokio-util", 176 | "tracing", 177 | ] 178 | 179 | [[package]] 180 | name = "hashbrown" 181 | version = "0.11.2" 182 | source = "registry+https://github.com/rust-lang/crates.io-index" 183 | checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" 184 | 185 | [[package]] 186 | name = "http" 187 | version = "0.2.5" 188 | source = "registry+https://github.com/rust-lang/crates.io-index" 189 | checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" 190 | dependencies = [ 191 | "bytes", 192 | "fnv", 193 | "itoa", 194 | ] 195 | 196 | [[package]] 197 | name = "http-body" 198 | version = "0.4.3" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" 201 | dependencies = [ 202 | "bytes", 203 | "http", 204 | "pin-project-lite", 205 | ] 206 | 207 | [[package]] 208 | name = "httparse" 209 | version = "1.5.1" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" 212 | 213 | [[package]] 214 | name = "httpdate" 215 | version = "1.0.1" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" 218 | 219 | [[package]] 220 | name = "hyper" 221 | version = "0.14.13" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593" 224 | dependencies = [ 225 | "bytes", 226 | "futures-channel", 227 | "futures-core", 228 | "futures-util", 229 | "h2", 230 | "http", 231 | "http-body", 232 | "httparse", 233 | "httpdate", 234 | "itoa", 235 | "pin-project-lite", 236 | "socket2", 237 | "tokio", 238 | "tower-service", 239 | "tracing", 240 | "want", 241 | ] 242 | 243 | [[package]] 244 | name = "hyper-tls" 245 | version = "0.5.0" 246 | source = "registry+https://github.com/rust-lang/crates.io-index" 247 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 248 | dependencies = [ 249 | "bytes", 250 | "hyper", 251 | "native-tls", 252 | "tokio", 253 | "tokio-native-tls", 254 | ] 255 | 256 | [[package]] 257 | name = "idna" 258 | version = "0.2.3" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 261 | dependencies = [ 262 | "matches", 263 | "unicode-bidi", 264 | "unicode-normalization", 265 | ] 266 | 267 | [[package]] 268 | name = "indexmap" 269 | version = "1.7.0" 270 | source = "registry+https://github.com/rust-lang/crates.io-index" 271 | checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" 272 | dependencies = [ 273 | "autocfg", 274 | "hashbrown", 275 | ] 276 | 277 | [[package]] 278 | name = "ipnet" 279 | version = "2.3.1" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" 282 | 283 | [[package]] 284 | name = "itoa" 285 | version = "0.4.8" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" 288 | 289 | [[package]] 290 | name = "js-sys" 291 | version = "0.3.55" 292 | source = "registry+https://github.com/rust-lang/crates.io-index" 293 | checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" 294 | dependencies = [ 295 | "wasm-bindgen", 296 | ] 297 | 298 | [[package]] 299 | name = "lazy_static" 300 | version = "1.4.0" 301 | source = "registry+https://github.com/rust-lang/crates.io-index" 302 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 303 | 304 | [[package]] 305 | name = "libc" 306 | version = "0.2.102" 307 | source = "registry+https://github.com/rust-lang/crates.io-index" 308 | checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103" 309 | 310 | [[package]] 311 | name = "log" 312 | version = "0.4.14" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 315 | dependencies = [ 316 | "cfg-if", 317 | ] 318 | 319 | [[package]] 320 | name = "matches" 321 | version = "0.1.9" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 324 | 325 | [[package]] 326 | name = "memchr" 327 | version = "2.4.1" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" 330 | 331 | [[package]] 332 | name = "mime" 333 | version = "0.3.16" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" 336 | 337 | [[package]] 338 | name = "mio" 339 | version = "0.7.13" 340 | source = "registry+https://github.com/rust-lang/crates.io-index" 341 | checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" 342 | dependencies = [ 343 | "libc", 344 | "log", 345 | "miow", 346 | "ntapi", 347 | "winapi", 348 | ] 349 | 350 | [[package]] 351 | name = "miow" 352 | version = "0.3.7" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" 355 | dependencies = [ 356 | "winapi", 357 | ] 358 | 359 | [[package]] 360 | name = "native-tls" 361 | version = "0.2.8" 362 | source = "registry+https://github.com/rust-lang/crates.io-index" 363 | checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" 364 | dependencies = [ 365 | "lazy_static", 366 | "libc", 367 | "log", 368 | "openssl", 369 | "openssl-probe", 370 | "openssl-sys", 371 | "schannel", 372 | "security-framework", 373 | "security-framework-sys", 374 | "tempfile", 375 | ] 376 | 377 | [[package]] 378 | name = "newsapi" 379 | version = "0.1.0" 380 | dependencies = [ 381 | "reqwest", 382 | "serde", 383 | "serde_json", 384 | "thiserror", 385 | "ureq", 386 | "url", 387 | ] 388 | 389 | [[package]] 390 | name = "ntapi" 391 | version = "0.3.6" 392 | source = "registry+https://github.com/rust-lang/crates.io-index" 393 | checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" 394 | dependencies = [ 395 | "winapi", 396 | ] 397 | 398 | [[package]] 399 | name = "once_cell" 400 | version = "1.8.0" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" 403 | 404 | [[package]] 405 | name = "openssl" 406 | version = "0.10.36" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" 409 | dependencies = [ 410 | "bitflags", 411 | "cfg-if", 412 | "foreign-types", 413 | "libc", 414 | "once_cell", 415 | "openssl-sys", 416 | ] 417 | 418 | [[package]] 419 | name = "openssl-probe" 420 | version = "0.1.4" 421 | source = "registry+https://github.com/rust-lang/crates.io-index" 422 | checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" 423 | 424 | [[package]] 425 | name = "openssl-sys" 426 | version = "0.9.67" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "69df2d8dfc6ce3aaf44b40dec6f487d5a886516cf6879c49e98e0710f310a058" 429 | dependencies = [ 430 | "autocfg", 431 | "cc", 432 | "libc", 433 | "pkg-config", 434 | "vcpkg", 435 | ] 436 | 437 | [[package]] 438 | name = "percent-encoding" 439 | version = "2.1.0" 440 | source = "registry+https://github.com/rust-lang/crates.io-index" 441 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 442 | 443 | [[package]] 444 | name = "pin-project-lite" 445 | version = "0.2.7" 446 | source = "registry+https://github.com/rust-lang/crates.io-index" 447 | checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" 448 | 449 | [[package]] 450 | name = "pin-utils" 451 | version = "0.1.0" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 454 | 455 | [[package]] 456 | name = "pkg-config" 457 | version = "0.3.19" 458 | source = "registry+https://github.com/rust-lang/crates.io-index" 459 | checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" 460 | 461 | [[package]] 462 | name = "ppv-lite86" 463 | version = "0.2.10" 464 | source = "registry+https://github.com/rust-lang/crates.io-index" 465 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" 466 | 467 | [[package]] 468 | name = "proc-macro2" 469 | version = "1.0.29" 470 | source = "registry+https://github.com/rust-lang/crates.io-index" 471 | checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" 472 | dependencies = [ 473 | "unicode-xid", 474 | ] 475 | 476 | [[package]] 477 | name = "quote" 478 | version = "1.0.9" 479 | source = "registry+https://github.com/rust-lang/crates.io-index" 480 | checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" 481 | dependencies = [ 482 | "proc-macro2", 483 | ] 484 | 485 | [[package]] 486 | name = "rand" 487 | version = "0.8.4" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" 490 | dependencies = [ 491 | "libc", 492 | "rand_chacha", 493 | "rand_core", 494 | "rand_hc", 495 | ] 496 | 497 | [[package]] 498 | name = "rand_chacha" 499 | version = "0.3.1" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 502 | dependencies = [ 503 | "ppv-lite86", 504 | "rand_core", 505 | ] 506 | 507 | [[package]] 508 | name = "rand_core" 509 | version = "0.6.3" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 512 | dependencies = [ 513 | "getrandom", 514 | ] 515 | 516 | [[package]] 517 | name = "rand_hc" 518 | version = "0.3.1" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" 521 | dependencies = [ 522 | "rand_core", 523 | ] 524 | 525 | [[package]] 526 | name = "redox_syscall" 527 | version = "0.2.10" 528 | source = "registry+https://github.com/rust-lang/crates.io-index" 529 | checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" 530 | dependencies = [ 531 | "bitflags", 532 | ] 533 | 534 | [[package]] 535 | name = "remove_dir_all" 536 | version = "0.5.3" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" 539 | dependencies = [ 540 | "winapi", 541 | ] 542 | 543 | [[package]] 544 | name = "reqwest" 545 | version = "0.11.4" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" 548 | dependencies = [ 549 | "base64", 550 | "bytes", 551 | "encoding_rs", 552 | "futures-core", 553 | "futures-util", 554 | "http", 555 | "http-body", 556 | "hyper", 557 | "hyper-tls", 558 | "ipnet", 559 | "js-sys", 560 | "lazy_static", 561 | "log", 562 | "mime", 563 | "native-tls", 564 | "percent-encoding", 565 | "pin-project-lite", 566 | "serde", 567 | "serde_json", 568 | "serde_urlencoded", 569 | "tokio", 570 | "tokio-native-tls", 571 | "url", 572 | "wasm-bindgen", 573 | "wasm-bindgen-futures", 574 | "web-sys", 575 | "winreg", 576 | ] 577 | 578 | [[package]] 579 | name = "ring" 580 | version = "0.16.20" 581 | source = "registry+https://github.com/rust-lang/crates.io-index" 582 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" 583 | dependencies = [ 584 | "cc", 585 | "libc", 586 | "once_cell", 587 | "spin", 588 | "untrusted", 589 | "web-sys", 590 | "winapi", 591 | ] 592 | 593 | [[package]] 594 | name = "rustls" 595 | version = "0.19.1" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" 598 | dependencies = [ 599 | "base64", 600 | "log", 601 | "ring", 602 | "sct", 603 | "webpki", 604 | ] 605 | 606 | [[package]] 607 | name = "ryu" 608 | version = "1.0.5" 609 | source = "registry+https://github.com/rust-lang/crates.io-index" 610 | checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" 611 | 612 | [[package]] 613 | name = "schannel" 614 | version = "0.1.19" 615 | source = "registry+https://github.com/rust-lang/crates.io-index" 616 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 617 | dependencies = [ 618 | "lazy_static", 619 | "winapi", 620 | ] 621 | 622 | [[package]] 623 | name = "sct" 624 | version = "0.6.1" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" 627 | dependencies = [ 628 | "ring", 629 | "untrusted", 630 | ] 631 | 632 | [[package]] 633 | name = "security-framework" 634 | version = "2.4.2" 635 | source = "registry+https://github.com/rust-lang/crates.io-index" 636 | checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" 637 | dependencies = [ 638 | "bitflags", 639 | "core-foundation", 640 | "core-foundation-sys", 641 | "libc", 642 | "security-framework-sys", 643 | ] 644 | 645 | [[package]] 646 | name = "security-framework-sys" 647 | version = "2.4.2" 648 | source = "registry+https://github.com/rust-lang/crates.io-index" 649 | checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" 650 | dependencies = [ 651 | "core-foundation-sys", 652 | "libc", 653 | ] 654 | 655 | [[package]] 656 | name = "serde" 657 | version = "1.0.130" 658 | source = "registry+https://github.com/rust-lang/crates.io-index" 659 | checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" 660 | dependencies = [ 661 | "serde_derive", 662 | ] 663 | 664 | [[package]] 665 | name = "serde_derive" 666 | version = "1.0.130" 667 | source = "registry+https://github.com/rust-lang/crates.io-index" 668 | checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" 669 | dependencies = [ 670 | "proc-macro2", 671 | "quote", 672 | "syn", 673 | ] 674 | 675 | [[package]] 676 | name = "serde_json" 677 | version = "1.0.68" 678 | source = "registry+https://github.com/rust-lang/crates.io-index" 679 | checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" 680 | dependencies = [ 681 | "itoa", 682 | "ryu", 683 | "serde", 684 | ] 685 | 686 | [[package]] 687 | name = "serde_urlencoded" 688 | version = "0.7.0" 689 | source = "registry+https://github.com/rust-lang/crates.io-index" 690 | checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" 691 | dependencies = [ 692 | "form_urlencoded", 693 | "itoa", 694 | "ryu", 695 | "serde", 696 | ] 697 | 698 | [[package]] 699 | name = "slab" 700 | version = "0.4.4" 701 | source = "registry+https://github.com/rust-lang/crates.io-index" 702 | checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" 703 | 704 | [[package]] 705 | name = "socket2" 706 | version = "0.4.2" 707 | source = "registry+https://github.com/rust-lang/crates.io-index" 708 | checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" 709 | dependencies = [ 710 | "libc", 711 | "winapi", 712 | ] 713 | 714 | [[package]] 715 | name = "spin" 716 | version = "0.5.2" 717 | source = "registry+https://github.com/rust-lang/crates.io-index" 718 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" 719 | 720 | [[package]] 721 | name = "syn" 722 | version = "1.0.76" 723 | source = "registry+https://github.com/rust-lang/crates.io-index" 724 | checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84" 725 | dependencies = [ 726 | "proc-macro2", 727 | "quote", 728 | "unicode-xid", 729 | ] 730 | 731 | [[package]] 732 | name = "tempfile" 733 | version = "3.2.0" 734 | source = "registry+https://github.com/rust-lang/crates.io-index" 735 | checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" 736 | dependencies = [ 737 | "cfg-if", 738 | "libc", 739 | "rand", 740 | "redox_syscall", 741 | "remove_dir_all", 742 | "winapi", 743 | ] 744 | 745 | [[package]] 746 | name = "thiserror" 747 | version = "1.0.29" 748 | source = "registry+https://github.com/rust-lang/crates.io-index" 749 | checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" 750 | dependencies = [ 751 | "thiserror-impl", 752 | ] 753 | 754 | [[package]] 755 | name = "thiserror-impl" 756 | version = "1.0.29" 757 | source = "registry+https://github.com/rust-lang/crates.io-index" 758 | checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" 759 | dependencies = [ 760 | "proc-macro2", 761 | "quote", 762 | "syn", 763 | ] 764 | 765 | [[package]] 766 | name = "tinyvec" 767 | version = "1.4.0" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "5241dd6f21443a3606b432718b166d3cedc962fd4b8bea54a8bc7f514ebda986" 770 | dependencies = [ 771 | "tinyvec_macros", 772 | ] 773 | 774 | [[package]] 775 | name = "tinyvec_macros" 776 | version = "0.1.0" 777 | source = "registry+https://github.com/rust-lang/crates.io-index" 778 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 779 | 780 | [[package]] 781 | name = "tokio" 782 | version = "1.12.0" 783 | source = "registry+https://github.com/rust-lang/crates.io-index" 784 | checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc" 785 | dependencies = [ 786 | "autocfg", 787 | "bytes", 788 | "libc", 789 | "memchr", 790 | "mio", 791 | "pin-project-lite", 792 | "winapi", 793 | ] 794 | 795 | [[package]] 796 | name = "tokio-native-tls" 797 | version = "0.3.0" 798 | source = "registry+https://github.com/rust-lang/crates.io-index" 799 | checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" 800 | dependencies = [ 801 | "native-tls", 802 | "tokio", 803 | ] 804 | 805 | [[package]] 806 | name = "tokio-util" 807 | version = "0.6.8" 808 | source = "registry+https://github.com/rust-lang/crates.io-index" 809 | checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" 810 | dependencies = [ 811 | "bytes", 812 | "futures-core", 813 | "futures-sink", 814 | "log", 815 | "pin-project-lite", 816 | "tokio", 817 | ] 818 | 819 | [[package]] 820 | name = "tower-service" 821 | version = "0.3.1" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" 824 | 825 | [[package]] 826 | name = "tracing" 827 | version = "0.1.28" 828 | source = "registry+https://github.com/rust-lang/crates.io-index" 829 | checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8" 830 | dependencies = [ 831 | "cfg-if", 832 | "pin-project-lite", 833 | "tracing-core", 834 | ] 835 | 836 | [[package]] 837 | name = "tracing-core" 838 | version = "0.1.20" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "46125608c26121c81b0c6d693eab5a420e416da7e43c426d2e8f7df8da8a3acf" 841 | dependencies = [ 842 | "lazy_static", 843 | ] 844 | 845 | [[package]] 846 | name = "try-lock" 847 | version = "0.2.3" 848 | source = "registry+https://github.com/rust-lang/crates.io-index" 849 | checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" 850 | 851 | [[package]] 852 | name = "unicode-bidi" 853 | version = "0.3.6" 854 | source = "registry+https://github.com/rust-lang/crates.io-index" 855 | checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" 856 | 857 | [[package]] 858 | name = "unicode-normalization" 859 | version = "0.1.19" 860 | source = "registry+https://github.com/rust-lang/crates.io-index" 861 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 862 | dependencies = [ 863 | "tinyvec", 864 | ] 865 | 866 | [[package]] 867 | name = "unicode-xid" 868 | version = "0.2.2" 869 | source = "registry+https://github.com/rust-lang/crates.io-index" 870 | checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" 871 | 872 | [[package]] 873 | name = "untrusted" 874 | version = "0.7.1" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" 877 | 878 | [[package]] 879 | name = "ureq" 880 | version = "2.2.0" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "3131cd6cb18488da91da1d10ed31e966f453c06b65bf010d35638456976a3fd7" 883 | dependencies = [ 884 | "base64", 885 | "chunked_transfer", 886 | "log", 887 | "once_cell", 888 | "rustls", 889 | "serde", 890 | "serde_json", 891 | "url", 892 | "webpki", 893 | "webpki-roots", 894 | ] 895 | 896 | [[package]] 897 | name = "url" 898 | version = "2.2.2" 899 | source = "registry+https://github.com/rust-lang/crates.io-index" 900 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 901 | dependencies = [ 902 | "form_urlencoded", 903 | "idna", 904 | "matches", 905 | "percent-encoding", 906 | ] 907 | 908 | [[package]] 909 | name = "vcpkg" 910 | version = "0.2.15" 911 | source = "registry+https://github.com/rust-lang/crates.io-index" 912 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 913 | 914 | [[package]] 915 | name = "want" 916 | version = "0.3.0" 917 | source = "registry+https://github.com/rust-lang/crates.io-index" 918 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 919 | dependencies = [ 920 | "log", 921 | "try-lock", 922 | ] 923 | 924 | [[package]] 925 | name = "wasi" 926 | version = "0.10.2+wasi-snapshot-preview1" 927 | source = "registry+https://github.com/rust-lang/crates.io-index" 928 | checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" 929 | 930 | [[package]] 931 | name = "wasm-bindgen" 932 | version = "0.2.78" 933 | source = "registry+https://github.com/rust-lang/crates.io-index" 934 | checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" 935 | dependencies = [ 936 | "cfg-if", 937 | "serde", 938 | "serde_json", 939 | "wasm-bindgen-macro", 940 | ] 941 | 942 | [[package]] 943 | name = "wasm-bindgen-backend" 944 | version = "0.2.78" 945 | source = "registry+https://github.com/rust-lang/crates.io-index" 946 | checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" 947 | dependencies = [ 948 | "bumpalo", 949 | "lazy_static", 950 | "log", 951 | "proc-macro2", 952 | "quote", 953 | "syn", 954 | "wasm-bindgen-shared", 955 | ] 956 | 957 | [[package]] 958 | name = "wasm-bindgen-futures" 959 | version = "0.4.28" 960 | source = "registry+https://github.com/rust-lang/crates.io-index" 961 | checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" 962 | dependencies = [ 963 | "cfg-if", 964 | "js-sys", 965 | "wasm-bindgen", 966 | "web-sys", 967 | ] 968 | 969 | [[package]] 970 | name = "wasm-bindgen-macro" 971 | version = "0.2.78" 972 | source = "registry+https://github.com/rust-lang/crates.io-index" 973 | checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" 974 | dependencies = [ 975 | "quote", 976 | "wasm-bindgen-macro-support", 977 | ] 978 | 979 | [[package]] 980 | name = "wasm-bindgen-macro-support" 981 | version = "0.2.78" 982 | source = "registry+https://github.com/rust-lang/crates.io-index" 983 | checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" 984 | dependencies = [ 985 | "proc-macro2", 986 | "quote", 987 | "syn", 988 | "wasm-bindgen-backend", 989 | "wasm-bindgen-shared", 990 | ] 991 | 992 | [[package]] 993 | name = "wasm-bindgen-shared" 994 | version = "0.2.78" 995 | source = "registry+https://github.com/rust-lang/crates.io-index" 996 | checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" 997 | 998 | [[package]] 999 | name = "web-sys" 1000 | version = "0.3.55" 1001 | source = "registry+https://github.com/rust-lang/crates.io-index" 1002 | checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" 1003 | dependencies = [ 1004 | "js-sys", 1005 | "wasm-bindgen", 1006 | ] 1007 | 1008 | [[package]] 1009 | name = "webpki" 1010 | version = "0.21.4" 1011 | source = "registry+https://github.com/rust-lang/crates.io-index" 1012 | checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" 1013 | dependencies = [ 1014 | "ring", 1015 | "untrusted", 1016 | ] 1017 | 1018 | [[package]] 1019 | name = "webpki-roots" 1020 | version = "0.21.1" 1021 | source = "registry+https://github.com/rust-lang/crates.io-index" 1022 | checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" 1023 | dependencies = [ 1024 | "webpki", 1025 | ] 1026 | 1027 | [[package]] 1028 | name = "winapi" 1029 | version = "0.3.9" 1030 | source = "registry+https://github.com/rust-lang/crates.io-index" 1031 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1032 | dependencies = [ 1033 | "winapi-i686-pc-windows-gnu", 1034 | "winapi-x86_64-pc-windows-gnu", 1035 | ] 1036 | 1037 | [[package]] 1038 | name = "winapi-i686-pc-windows-gnu" 1039 | version = "0.4.0" 1040 | source = "registry+https://github.com/rust-lang/crates.io-index" 1041 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1042 | 1043 | [[package]] 1044 | name = "winapi-x86_64-pc-windows-gnu" 1045 | version = "0.4.0" 1046 | source = "registry+https://github.com/rust-lang/crates.io-index" 1047 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1048 | 1049 | [[package]] 1050 | name = "winreg" 1051 | version = "0.7.0" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" 1054 | dependencies = [ 1055 | "winapi", 1056 | ] 1057 | -------------------------------------------------------------------------------- /newsapi/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "newsapi" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | ureq = { version = "2.4.0", features = ["json"] } 10 | serde = { version = "1.0.136", features = ["derive"] } 11 | serde_json = "1.0.79" 12 | thiserror = "1.0.30" 13 | url = "2.2.2" 14 | reqwest = { version = "0.11.10", features = ["json"], optional = true } 15 | 16 | [target.'cfg(target_arch = "wasm32")'.dependencies] 17 | reqwasm = "0.5.0" 18 | 19 | [features] 20 | async = [ 21 | "reqwest" 22 | ] 23 | -------------------------------------------------------------------------------- /newsapi/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg(feature = "async")] 2 | use reqwest::Method; 3 | use serde::Deserialize; 4 | use url::Url; 5 | 6 | const BASE_URL: &str = "https://newsapi.org/v2"; 7 | 8 | #[derive(thiserror::Error, Debug)] 9 | pub enum NewsApiError { 10 | #[error("Failed fetching articles")] 11 | RequestFailed(#[from] ureq::Error), 12 | #[error("Failed converting response to string")] 13 | FailedResponseToString(#[from] std::io::Error), 14 | #[error("Article Parsing failed")] 15 | ArticleParseFailed(#[from] serde_json::Error), 16 | #[error("Url parsing failed")] 17 | UrlParsing(#[from] url::ParseError), 18 | #[error("Request failed: {0}")] 19 | BadRequest(&'static str), 20 | #[error("Async request failed")] 21 | #[cfg(feature = "async")] 22 | AsyncRequestFailed(#[from] reqwest::Error), 23 | } 24 | 25 | #[derive(Deserialize, Debug)] 26 | pub struct NewsAPIResponse { 27 | status: String, 28 | articles: Vec
, 29 | code: Option, 30 | } 31 | 32 | impl NewsAPIResponse { 33 | pub fn articles(&self) -> &Vec
{ 34 | &self.articles 35 | } 36 | } 37 | 38 | #[derive(Deserialize, Debug)] 39 | pub struct Article { 40 | title: String, 41 | url: String, 42 | description: Option, 43 | } 44 | 45 | impl Article { 46 | pub fn title(&self) -> &str { 47 | &self.title 48 | } 49 | 50 | pub fn url(&self) -> &str { 51 | &self.url 52 | } 53 | 54 | pub fn desc(&self) -> Option<&String> { 55 | self.description.as_ref() 56 | } 57 | } 58 | 59 | pub enum Endpoint { 60 | TopHeadlines, 61 | } 62 | 63 | impl ToString for Endpoint { 64 | fn to_string(&self) -> String { 65 | match self { 66 | Self::TopHeadlines => "top-headlines".to_string(), 67 | } 68 | } 69 | } 70 | 71 | pub enum Country { 72 | Us, 73 | } 74 | 75 | impl ToString for Country { 76 | fn to_string(&self) -> String { 77 | match self { 78 | Self::Us => "us".to_string(), 79 | } 80 | } 81 | } 82 | 83 | pub struct NewsAPI { 84 | api_key: String, 85 | endpoint: Endpoint, 86 | country: Country, 87 | } 88 | 89 | impl NewsAPI { 90 | pub fn new(api_key: &str) -> NewsAPI { 91 | NewsAPI { 92 | api_key: api_key.to_string(), 93 | endpoint: Endpoint::TopHeadlines, 94 | country: Country::Us, 95 | } 96 | } 97 | 98 | pub fn endpoint(&mut self, endpoint: Endpoint) -> &mut NewsAPI { 99 | self.endpoint = endpoint; 100 | self 101 | } 102 | 103 | pub fn country(&mut self, country: Country) -> &mut NewsAPI { 104 | self.country = country; 105 | self 106 | } 107 | 108 | fn prepare_url(&self) -> Result { 109 | let mut url = Url::parse(BASE_URL)?; 110 | url.path_segments_mut() 111 | .unwrap() 112 | .push(&self.endpoint.to_string()); 113 | 114 | let country = format!("country={}", self.country.to_string()); 115 | url.set_query(Some(&country)); 116 | 117 | Ok(url.to_string()) 118 | } 119 | 120 | pub fn fetch(&self) -> Result { 121 | let url = self.prepare_url()?; 122 | let req = ureq::get(&url).set("Authorization", &self.api_key); 123 | let response: NewsAPIResponse = req.call()?.into_json()?; 124 | match response.status.as_str() { 125 | "ok" => return Ok(response), 126 | _ => return Err(map_response_err(response.code)), 127 | } 128 | } 129 | 130 | #[cfg(feature = "async")] 131 | pub async fn fetch_async(&self) -> Result { 132 | let url = self.prepare_url()?; 133 | let client = reqwest::Client::new(); 134 | let request = client 135 | .request(Method::GET, url) 136 | .header("Authorization", &self.api_key) 137 | .build() 138 | .map_err(|e| NewsApiError::AsyncRequestFailed(e))?; 139 | 140 | let response: NewsAPIResponse = client 141 | .execute(request) 142 | .await? 143 | .json() 144 | .await 145 | .map_err(|e| NewsApiError::AsyncRequestFailed(e))?; 146 | 147 | match response.status.as_str() { 148 | "ok" => return Ok(response), 149 | _ => return Err(map_response_err(response.code)), 150 | } 151 | } 152 | 153 | #[cfg(target_arch = "wasm32")] 154 | pub async fn fetch_web(&self) -> Result { 155 | let url = self.prepare_url()?; 156 | let req = reqwasm::http::Request::get(&url).header("Authorization", &self.api_key); 157 | let resp = req 158 | .send() 159 | .await 160 | .map_err(|_| NewsApiError::BadRequest("failed sending request"))?; 161 | 162 | let response: NewsAPIResponse = resp 163 | .json() 164 | .await 165 | .map_err(|_| NewsApiError::BadRequest("failed converting response to json"))?; 166 | 167 | match response.status.as_str() { 168 | "ok" => return Ok(response), 169 | _ => return Err(map_response_err(response.code)), 170 | } 171 | } 172 | } 173 | 174 | fn map_response_err(code: Option) -> NewsApiError { 175 | if let Some(code) = code { 176 | match code.as_str() { 177 | "apiKeyDisabled" => NewsApiError::BadRequest("Your API key has been disabled"), 178 | _ => NewsApiError::BadRequest("Unknown error"), 179 | } 180 | } else { 181 | NewsApiError::BadRequest("Unknown error") 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /setup_web.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | set -eu 4 | 5 | rustup target add wasm32-unknown-unknown 6 | cargo install -f wasm-bindgen-cli --version 0.2.81 7 | cargo install basic-http-server 8 | -------------------------------------------------------------------------------- /start_web.sh: -------------------------------------------------------------------------------- 1 | 2 | #!/bin/bash 3 | set -eu 4 | 5 | cargo build --release -p headlines --lib --target wasm32-unknown-unknown 6 | 7 | wasm-bindgen target/wasm32-unknown-unknown/release/headlines.wasm \ 8 | --out-dir webapp --no-modules --no-typescript 9 | 10 | cd webapp 11 | sleep 1s && xdg-open http://127.0.0.1:3000 & 12 | basic-http-server --addr 127.0.0.1:3000 . 13 | -------------------------------------------------------------------------------- /webapp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Headlines 8 | 9 | 10 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 56 | 57 | 58 | 59 | --------------------------------------------------------------------------------