super basic rust cdylib plugin system

initial

rad.vg dece5560

+1105
+2
.gitignore
··· 1 + **/target 2 + plugins
+863
Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "adler2" 7 + version = "2.0.1" 8 + source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" 10 + 11 + [[package]] 12 + name = "aes" 13 + version = "0.8.4" 14 + source = "registry+https://github.com/rust-lang/crates.io-index" 15 + checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" 16 + dependencies = [ 17 + "cfg-if", 18 + "cipher", 19 + "cpufeatures", 20 + ] 21 + 22 + [[package]] 23 + name = "anyhow" 24 + version = "1.0.99" 25 + source = "registry+https://github.com/rust-lang/crates.io-index" 26 + checksum = "b0674a1ddeecb70197781e945de4b3b8ffb61fa939a5597bcf48503737663100" 27 + 28 + [[package]] 29 + name = "arbitrary" 30 + version = "1.4.2" 31 + source = "registry+https://github.com/rust-lang/crates.io-index" 32 + checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" 33 + dependencies = [ 34 + "derive_arbitrary", 35 + ] 36 + 37 + [[package]] 38 + name = "bitflags" 39 + version = "2.9.2" 40 + source = "registry+https://github.com/rust-lang/crates.io-index" 41 + checksum = "6a65b545ab31d687cff52899d4890855fec459eb6afe0da6417b8a18da87aa29" 42 + 43 + [[package]] 44 + name = "block-buffer" 45 + version = "0.10.4" 46 + source = "registry+https://github.com/rust-lang/crates.io-index" 47 + checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 48 + dependencies = [ 49 + "generic-array", 50 + ] 51 + 52 + [[package]] 53 + name = "bumpalo" 54 + version = "3.19.0" 55 + source = "registry+https://github.com/rust-lang/crates.io-index" 56 + checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" 57 + 58 + [[package]] 59 + name = "bzip2" 60 + version = "0.6.0" 61 + source = "registry+https://github.com/rust-lang/crates.io-index" 62 + checksum = "bea8dcd42434048e4f7a304411d9273a411f647446c1234a65ce0554923f4cff" 63 + dependencies = [ 64 + "libbz2-rs-sys", 65 + ] 66 + 67 + [[package]] 68 + name = "cc" 69 + version = "1.2.33" 70 + source = "registry+https://github.com/rust-lang/crates.io-index" 71 + checksum = "3ee0f8803222ba5a7e2777dd72ca451868909b1ac410621b676adf07280e9b5f" 72 + dependencies = [ 73 + "jobserver", 74 + "libc", 75 + "shlex", 76 + ] 77 + 78 + [[package]] 79 + name = "cfg-if" 80 + version = "1.0.3" 81 + source = "registry+https://github.com/rust-lang/crates.io-index" 82 + checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" 83 + 84 + [[package]] 85 + name = "cipher" 86 + version = "0.4.4" 87 + source = "registry+https://github.com/rust-lang/crates.io-index" 88 + checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" 89 + dependencies = [ 90 + "crypto-common", 91 + "inout", 92 + ] 93 + 94 + [[package]] 95 + name = "constant_time_eq" 96 + version = "0.3.1" 97 + source = "registry+https://github.com/rust-lang/crates.io-index" 98 + checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" 99 + 100 + [[package]] 101 + name = "cpufeatures" 102 + version = "0.2.17" 103 + source = "registry+https://github.com/rust-lang/crates.io-index" 104 + checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" 105 + dependencies = [ 106 + "libc", 107 + ] 108 + 109 + [[package]] 110 + name = "crc32fast" 111 + version = "1.5.0" 112 + source = "registry+https://github.com/rust-lang/crates.io-index" 113 + checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" 114 + dependencies = [ 115 + "cfg-if", 116 + ] 117 + 118 + [[package]] 119 + name = "crypto-common" 120 + version = "0.1.6" 121 + source = "registry+https://github.com/rust-lang/crates.io-index" 122 + checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 123 + dependencies = [ 124 + "generic-array", 125 + "typenum", 126 + ] 127 + 128 + [[package]] 129 + name = "deflate64" 130 + version = "0.1.9" 131 + source = "registry+https://github.com/rust-lang/crates.io-index" 132 + checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" 133 + 134 + [[package]] 135 + name = "deranged" 136 + version = "0.4.0" 137 + source = "registry+https://github.com/rust-lang/crates.io-index" 138 + checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" 139 + dependencies = [ 140 + "powerfmt", 141 + ] 142 + 143 + [[package]] 144 + name = "derive_arbitrary" 145 + version = "1.4.2" 146 + source = "registry+https://github.com/rust-lang/crates.io-index" 147 + checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" 148 + dependencies = [ 149 + "proc-macro2", 150 + "quote", 151 + "syn", 152 + ] 153 + 154 + [[package]] 155 + name = "digest" 156 + version = "0.10.7" 157 + source = "registry+https://github.com/rust-lang/crates.io-index" 158 + checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 159 + dependencies = [ 160 + "block-buffer", 161 + "crypto-common", 162 + "subtle", 163 + ] 164 + 165 + [[package]] 166 + name = "equivalent" 167 + version = "1.0.2" 168 + source = "registry+https://github.com/rust-lang/crates.io-index" 169 + checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" 170 + 171 + [[package]] 172 + name = "errno" 173 + version = "0.3.13" 174 + source = "registry+https://github.com/rust-lang/crates.io-index" 175 + checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" 176 + dependencies = [ 177 + "libc", 178 + "windows-sys 0.60.2", 179 + ] 180 + 181 + [[package]] 182 + name = "fastrand" 183 + version = "2.3.0" 184 + source = "registry+https://github.com/rust-lang/crates.io-index" 185 + checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 186 + 187 + [[package]] 188 + name = "flate2" 189 + version = "1.1.2" 190 + source = "registry+https://github.com/rust-lang/crates.io-index" 191 + checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" 192 + dependencies = [ 193 + "crc32fast", 194 + "libz-rs-sys", 195 + "miniz_oxide", 196 + ] 197 + 198 + [[package]] 199 + name = "generic-array" 200 + version = "0.14.7" 201 + source = "registry+https://github.com/rust-lang/crates.io-index" 202 + checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 203 + dependencies = [ 204 + "typenum", 205 + "version_check", 206 + ] 207 + 208 + [[package]] 209 + name = "getrandom" 210 + version = "0.3.3" 211 + source = "registry+https://github.com/rust-lang/crates.io-index" 212 + checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" 213 + dependencies = [ 214 + "cfg-if", 215 + "libc", 216 + "r-efi", 217 + "wasi", 218 + ] 219 + 220 + [[package]] 221 + name = "hashbrown" 222 + version = "0.15.5" 223 + source = "registry+https://github.com/rust-lang/crates.io-index" 224 + checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" 225 + 226 + [[package]] 227 + name = "hmac" 228 + version = "0.12.1" 229 + source = "registry+https://github.com/rust-lang/crates.io-index" 230 + checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 231 + dependencies = [ 232 + "digest", 233 + ] 234 + 235 + [[package]] 236 + name = "indexmap" 237 + version = "2.10.0" 238 + source = "registry+https://github.com/rust-lang/crates.io-index" 239 + checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" 240 + dependencies = [ 241 + "equivalent", 242 + "hashbrown", 243 + ] 244 + 245 + [[package]] 246 + name = "inout" 247 + version = "0.1.4" 248 + source = "registry+https://github.com/rust-lang/crates.io-index" 249 + checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" 250 + dependencies = [ 251 + "generic-array", 252 + ] 253 + 254 + [[package]] 255 + name = "jobserver" 256 + version = "0.1.33" 257 + source = "registry+https://github.com/rust-lang/crates.io-index" 258 + checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" 259 + dependencies = [ 260 + "getrandom", 261 + "libc", 262 + ] 263 + 264 + [[package]] 265 + name = "libbz2-rs-sys" 266 + version = "0.2.2" 267 + source = "registry+https://github.com/rust-lang/crates.io-index" 268 + checksum = "2c4a545a15244c7d945065b5d392b2d2d7f21526fba56ce51467b06ed445e8f7" 269 + 270 + [[package]] 271 + name = "libc" 272 + version = "0.2.175" 273 + source = "registry+https://github.com/rust-lang/crates.io-index" 274 + checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543" 275 + 276 + [[package]] 277 + name = "libloading" 278 + version = "0.8.8" 279 + source = "registry+https://github.com/rust-lang/crates.io-index" 280 + checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" 281 + dependencies = [ 282 + "cfg-if", 283 + "windows-targets 0.53.3", 284 + ] 285 + 286 + [[package]] 287 + name = "liblzma" 288 + version = "0.4.3" 289 + source = "registry+https://github.com/rust-lang/crates.io-index" 290 + checksum = "272b875472a046e39ff7408374a5a050b112d2142211a0f54a295c0bd1c3c757" 291 + dependencies = [ 292 + "liblzma-sys", 293 + ] 294 + 295 + [[package]] 296 + name = "liblzma-sys" 297 + version = "0.4.4" 298 + source = "registry+https://github.com/rust-lang/crates.io-index" 299 + checksum = "01b9596486f6d60c3bbe644c0e1be1aa6ccc472ad630fe8927b456973d7cb736" 300 + dependencies = [ 301 + "cc", 302 + "libc", 303 + "pkg-config", 304 + ] 305 + 306 + [[package]] 307 + name = "libz-rs-sys" 308 + version = "0.5.1" 309 + source = "registry+https://github.com/rust-lang/crates.io-index" 310 + checksum = "172a788537a2221661b480fee8dc5f96c580eb34fa88764d3205dc356c7e4221" 311 + dependencies = [ 312 + "zlib-rs", 313 + ] 314 + 315 + [[package]] 316 + name = "linux-raw-sys" 317 + version = "0.9.4" 318 + source = "registry+https://github.com/rust-lang/crates.io-index" 319 + checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" 320 + 321 + [[package]] 322 + name = "log" 323 + version = "0.4.27" 324 + source = "registry+https://github.com/rust-lang/crates.io-index" 325 + checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" 326 + 327 + [[package]] 328 + name = "memchr" 329 + version = "2.7.5" 330 + source = "registry+https://github.com/rust-lang/crates.io-index" 331 + checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" 332 + 333 + [[package]] 334 + name = "miniz_oxide" 335 + version = "0.8.9" 336 + source = "registry+https://github.com/rust-lang/crates.io-index" 337 + checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" 338 + dependencies = [ 339 + "adler2", 340 + ] 341 + 342 + [[package]] 343 + name = "num-conv" 344 + version = "0.1.0" 345 + source = "registry+https://github.com/rust-lang/crates.io-index" 346 + checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" 347 + 348 + [[package]] 349 + name = "once_cell" 350 + version = "1.21.3" 351 + source = "registry+https://github.com/rust-lang/crates.io-index" 352 + checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 353 + 354 + [[package]] 355 + name = "pbkdf2" 356 + version = "0.12.2" 357 + source = "registry+https://github.com/rust-lang/crates.io-index" 358 + checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" 359 + dependencies = [ 360 + "digest", 361 + "hmac", 362 + ] 363 + 364 + [[package]] 365 + name = "pkg-config" 366 + version = "0.3.32" 367 + source = "registry+https://github.com/rust-lang/crates.io-index" 368 + checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" 369 + 370 + [[package]] 371 + name = "plugin_api" 372 + version = "0.1.0" 373 + 374 + [[package]] 375 + name = "powerfmt" 376 + version = "0.2.0" 377 + source = "registry+https://github.com/rust-lang/crates.io-index" 378 + checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" 379 + 380 + [[package]] 381 + name = "ppmd-rust" 382 + version = "1.2.1" 383 + source = "registry+https://github.com/rust-lang/crates.io-index" 384 + checksum = "c834641d8ad1b348c9ee86dec3b9840d805acd5f24daa5f90c788951a52ff59b" 385 + 386 + [[package]] 387 + name = "proc-macro2" 388 + version = "1.0.101" 389 + source = "registry+https://github.com/rust-lang/crates.io-index" 390 + checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" 391 + dependencies = [ 392 + "unicode-ident", 393 + ] 394 + 395 + [[package]] 396 + name = "quote" 397 + version = "1.0.40" 398 + source = "registry+https://github.com/rust-lang/crates.io-index" 399 + checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" 400 + dependencies = [ 401 + "proc-macro2", 402 + ] 403 + 404 + [[package]] 405 + name = "r-efi" 406 + version = "5.3.0" 407 + source = "registry+https://github.com/rust-lang/crates.io-index" 408 + checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" 409 + 410 + [[package]] 411 + name = "rustin" 412 + version = "0.1.0" 413 + dependencies = [ 414 + "anyhow", 415 + "libloading", 416 + "plugin_api", 417 + "serde", 418 + "serde_derive", 419 + "tempfile", 420 + "toml", 421 + "zip", 422 + ] 423 + 424 + [[package]] 425 + name = "rustix" 426 + version = "1.0.8" 427 + source = "registry+https://github.com/rust-lang/crates.io-index" 428 + checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" 429 + dependencies = [ 430 + "bitflags", 431 + "errno", 432 + "libc", 433 + "linux-raw-sys", 434 + "windows-sys 0.60.2", 435 + ] 436 + 437 + [[package]] 438 + name = "serde" 439 + version = "1.0.219" 440 + source = "registry+https://github.com/rust-lang/crates.io-index" 441 + checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" 442 + dependencies = [ 443 + "serde_derive", 444 + ] 445 + 446 + [[package]] 447 + name = "serde_derive" 448 + version = "1.0.219" 449 + source = "registry+https://github.com/rust-lang/crates.io-index" 450 + checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" 451 + dependencies = [ 452 + "proc-macro2", 453 + "quote", 454 + "syn", 455 + ] 456 + 457 + [[package]] 458 + name = "serde_spanned" 459 + version = "1.0.0" 460 + source = "registry+https://github.com/rust-lang/crates.io-index" 461 + checksum = "40734c41988f7306bb04f0ecf60ec0f3f1caa34290e4e8ea471dcd3346483b83" 462 + dependencies = [ 463 + "serde", 464 + ] 465 + 466 + [[package]] 467 + name = "sha1" 468 + version = "0.10.6" 469 + source = "registry+https://github.com/rust-lang/crates.io-index" 470 + checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 471 + dependencies = [ 472 + "cfg-if", 473 + "cpufeatures", 474 + "digest", 475 + ] 476 + 477 + [[package]] 478 + name = "shlex" 479 + version = "1.3.0" 480 + source = "registry+https://github.com/rust-lang/crates.io-index" 481 + checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 482 + 483 + [[package]] 484 + name = "simd-adler32" 485 + version = "0.3.7" 486 + source = "registry+https://github.com/rust-lang/crates.io-index" 487 + checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" 488 + 489 + [[package]] 490 + name = "subtle" 491 + version = "2.6.1" 492 + source = "registry+https://github.com/rust-lang/crates.io-index" 493 + checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 494 + 495 + [[package]] 496 + name = "syn" 497 + version = "2.0.106" 498 + source = "registry+https://github.com/rust-lang/crates.io-index" 499 + checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" 500 + dependencies = [ 501 + "proc-macro2", 502 + "quote", 503 + "unicode-ident", 504 + ] 505 + 506 + [[package]] 507 + name = "tempfile" 508 + version = "3.20.0" 509 + source = "registry+https://github.com/rust-lang/crates.io-index" 510 + checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" 511 + dependencies = [ 512 + "fastrand", 513 + "getrandom", 514 + "once_cell", 515 + "rustix", 516 + "windows-sys 0.59.0", 517 + ] 518 + 519 + [[package]] 520 + name = "time" 521 + version = "0.3.41" 522 + source = "registry+https://github.com/rust-lang/crates.io-index" 523 + checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" 524 + dependencies = [ 525 + "deranged", 526 + "num-conv", 527 + "powerfmt", 528 + "serde", 529 + "time-core", 530 + ] 531 + 532 + [[package]] 533 + name = "time-core" 534 + version = "0.1.4" 535 + source = "registry+https://github.com/rust-lang/crates.io-index" 536 + checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" 537 + 538 + [[package]] 539 + name = "toml" 540 + version = "0.9.5" 541 + source = "registry+https://github.com/rust-lang/crates.io-index" 542 + checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" 543 + dependencies = [ 544 + "indexmap", 545 + "serde", 546 + "serde_spanned", 547 + "toml_datetime", 548 + "toml_parser", 549 + "toml_writer", 550 + "winnow", 551 + ] 552 + 553 + [[package]] 554 + name = "toml_datetime" 555 + version = "0.7.0" 556 + source = "registry+https://github.com/rust-lang/crates.io-index" 557 + checksum = "bade1c3e902f58d73d3f294cd7f20391c1cb2fbcb643b73566bc773971df91e3" 558 + dependencies = [ 559 + "serde", 560 + ] 561 + 562 + [[package]] 563 + name = "toml_parser" 564 + version = "1.0.2" 565 + source = "registry+https://github.com/rust-lang/crates.io-index" 566 + checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" 567 + dependencies = [ 568 + "winnow", 569 + ] 570 + 571 + [[package]] 572 + name = "toml_writer" 573 + version = "1.0.2" 574 + source = "registry+https://github.com/rust-lang/crates.io-index" 575 + checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" 576 + 577 + [[package]] 578 + name = "typenum" 579 + version = "1.18.0" 580 + source = "registry+https://github.com/rust-lang/crates.io-index" 581 + checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" 582 + 583 + [[package]] 584 + name = "unicode-ident" 585 + version = "1.0.18" 586 + source = "registry+https://github.com/rust-lang/crates.io-index" 587 + checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" 588 + 589 + [[package]] 590 + name = "version_check" 591 + version = "0.9.5" 592 + source = "registry+https://github.com/rust-lang/crates.io-index" 593 + checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" 594 + 595 + [[package]] 596 + name = "wasi" 597 + version = "0.14.2+wasi-0.2.4" 598 + source = "registry+https://github.com/rust-lang/crates.io-index" 599 + checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" 600 + dependencies = [ 601 + "wit-bindgen-rt", 602 + ] 603 + 604 + [[package]] 605 + name = "windows-link" 606 + version = "0.1.3" 607 + source = "registry+https://github.com/rust-lang/crates.io-index" 608 + checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" 609 + 610 + [[package]] 611 + name = "windows-sys" 612 + version = "0.59.0" 613 + source = "registry+https://github.com/rust-lang/crates.io-index" 614 + checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 615 + dependencies = [ 616 + "windows-targets 0.52.6", 617 + ] 618 + 619 + [[package]] 620 + name = "windows-sys" 621 + version = "0.60.2" 622 + source = "registry+https://github.com/rust-lang/crates.io-index" 623 + checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" 624 + dependencies = [ 625 + "windows-targets 0.53.3", 626 + ] 627 + 628 + [[package]] 629 + name = "windows-targets" 630 + version = "0.52.6" 631 + source = "registry+https://github.com/rust-lang/crates.io-index" 632 + checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 633 + dependencies = [ 634 + "windows_aarch64_gnullvm 0.52.6", 635 + "windows_aarch64_msvc 0.52.6", 636 + "windows_i686_gnu 0.52.6", 637 + "windows_i686_gnullvm 0.52.6", 638 + "windows_i686_msvc 0.52.6", 639 + "windows_x86_64_gnu 0.52.6", 640 + "windows_x86_64_gnullvm 0.52.6", 641 + "windows_x86_64_msvc 0.52.6", 642 + ] 643 + 644 + [[package]] 645 + name = "windows-targets" 646 + version = "0.53.3" 647 + source = "registry+https://github.com/rust-lang/crates.io-index" 648 + checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" 649 + dependencies = [ 650 + "windows-link", 651 + "windows_aarch64_gnullvm 0.53.0", 652 + "windows_aarch64_msvc 0.53.0", 653 + "windows_i686_gnu 0.53.0", 654 + "windows_i686_gnullvm 0.53.0", 655 + "windows_i686_msvc 0.53.0", 656 + "windows_x86_64_gnu 0.53.0", 657 + "windows_x86_64_gnullvm 0.53.0", 658 + "windows_x86_64_msvc 0.53.0", 659 + ] 660 + 661 + [[package]] 662 + name = "windows_aarch64_gnullvm" 663 + version = "0.52.6" 664 + source = "registry+https://github.com/rust-lang/crates.io-index" 665 + checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 666 + 667 + [[package]] 668 + name = "windows_aarch64_gnullvm" 669 + version = "0.53.0" 670 + source = "registry+https://github.com/rust-lang/crates.io-index" 671 + checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" 672 + 673 + [[package]] 674 + name = "windows_aarch64_msvc" 675 + version = "0.52.6" 676 + source = "registry+https://github.com/rust-lang/crates.io-index" 677 + checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 678 + 679 + [[package]] 680 + name = "windows_aarch64_msvc" 681 + version = "0.53.0" 682 + source = "registry+https://github.com/rust-lang/crates.io-index" 683 + checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" 684 + 685 + [[package]] 686 + name = "windows_i686_gnu" 687 + version = "0.52.6" 688 + source = "registry+https://github.com/rust-lang/crates.io-index" 689 + checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 690 + 691 + [[package]] 692 + name = "windows_i686_gnu" 693 + version = "0.53.0" 694 + source = "registry+https://github.com/rust-lang/crates.io-index" 695 + checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" 696 + 697 + [[package]] 698 + name = "windows_i686_gnullvm" 699 + version = "0.52.6" 700 + source = "registry+https://github.com/rust-lang/crates.io-index" 701 + checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 702 + 703 + [[package]] 704 + name = "windows_i686_gnullvm" 705 + version = "0.53.0" 706 + source = "registry+https://github.com/rust-lang/crates.io-index" 707 + checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" 708 + 709 + [[package]] 710 + name = "windows_i686_msvc" 711 + version = "0.52.6" 712 + source = "registry+https://github.com/rust-lang/crates.io-index" 713 + checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 714 + 715 + [[package]] 716 + name = "windows_i686_msvc" 717 + version = "0.53.0" 718 + source = "registry+https://github.com/rust-lang/crates.io-index" 719 + checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" 720 + 721 + [[package]] 722 + name = "windows_x86_64_gnu" 723 + version = "0.52.6" 724 + source = "registry+https://github.com/rust-lang/crates.io-index" 725 + checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 726 + 727 + [[package]] 728 + name = "windows_x86_64_gnu" 729 + version = "0.53.0" 730 + source = "registry+https://github.com/rust-lang/crates.io-index" 731 + checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" 732 + 733 + [[package]] 734 + name = "windows_x86_64_gnullvm" 735 + version = "0.52.6" 736 + source = "registry+https://github.com/rust-lang/crates.io-index" 737 + checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 738 + 739 + [[package]] 740 + name = "windows_x86_64_gnullvm" 741 + version = "0.53.0" 742 + source = "registry+https://github.com/rust-lang/crates.io-index" 743 + checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" 744 + 745 + [[package]] 746 + name = "windows_x86_64_msvc" 747 + version = "0.52.6" 748 + source = "registry+https://github.com/rust-lang/crates.io-index" 749 + checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 750 + 751 + [[package]] 752 + name = "windows_x86_64_msvc" 753 + version = "0.53.0" 754 + source = "registry+https://github.com/rust-lang/crates.io-index" 755 + checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" 756 + 757 + [[package]] 758 + name = "winnow" 759 + version = "0.7.12" 760 + source = "registry+https://github.com/rust-lang/crates.io-index" 761 + checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" 762 + 763 + [[package]] 764 + name = "wit-bindgen-rt" 765 + version = "0.39.0" 766 + source = "registry+https://github.com/rust-lang/crates.io-index" 767 + checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" 768 + dependencies = [ 769 + "bitflags", 770 + ] 771 + 772 + [[package]] 773 + name = "zeroize" 774 + version = "1.8.1" 775 + source = "registry+https://github.com/rust-lang/crates.io-index" 776 + checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 777 + dependencies = [ 778 + "zeroize_derive", 779 + ] 780 + 781 + [[package]] 782 + name = "zeroize_derive" 783 + version = "1.4.2" 784 + source = "registry+https://github.com/rust-lang/crates.io-index" 785 + checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" 786 + dependencies = [ 787 + "proc-macro2", 788 + "quote", 789 + "syn", 790 + ] 791 + 792 + [[package]] 793 + name = "zip" 794 + version = "4.3.0" 795 + source = "registry+https://github.com/rust-lang/crates.io-index" 796 + checksum = "9aed4ac33e8eb078c89e6cbb1d5c4c7703ec6d299fc3e7c3695af8f8b423468b" 797 + dependencies = [ 798 + "aes", 799 + "arbitrary", 800 + "bzip2", 801 + "constant_time_eq", 802 + "crc32fast", 803 + "deflate64", 804 + "flate2", 805 + "getrandom", 806 + "hmac", 807 + "indexmap", 808 + "liblzma", 809 + "memchr", 810 + "pbkdf2", 811 + "ppmd-rust", 812 + "sha1", 813 + "time", 814 + "zeroize", 815 + "zopfli", 816 + "zstd", 817 + ] 818 + 819 + [[package]] 820 + name = "zlib-rs" 821 + version = "0.5.1" 822 + source = "registry+https://github.com/rust-lang/crates.io-index" 823 + checksum = "626bd9fa9734751fc50d6060752170984d7053f5a39061f524cda68023d4db8a" 824 + 825 + [[package]] 826 + name = "zopfli" 827 + version = "0.8.2" 828 + source = "registry+https://github.com/rust-lang/crates.io-index" 829 + checksum = "edfc5ee405f504cd4984ecc6f14d02d55cfda60fa4b689434ef4102aae150cd7" 830 + dependencies = [ 831 + "bumpalo", 832 + "crc32fast", 833 + "log", 834 + "simd-adler32", 835 + ] 836 + 837 + [[package]] 838 + name = "zstd" 839 + version = "0.13.3" 840 + source = "registry+https://github.com/rust-lang/crates.io-index" 841 + checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" 842 + dependencies = [ 843 + "zstd-safe", 844 + ] 845 + 846 + [[package]] 847 + name = "zstd-safe" 848 + version = "7.2.4" 849 + source = "registry+https://github.com/rust-lang/crates.io-index" 850 + checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" 851 + dependencies = [ 852 + "zstd-sys", 853 + ] 854 + 855 + [[package]] 856 + name = "zstd-sys" 857 + version = "2.0.15+zstd.1.5.7" 858 + source = "registry+https://github.com/rust-lang/crates.io-index" 859 + checksum = "eb81183ddd97d0c74cedf1d50d85c8d08c1b8b68ee863bdee9e706eedba1a237" 860 + dependencies = [ 861 + "cc", 862 + "pkg-config", 863 + ]
+14
Cargo.toml
··· 1 + [package] 2 + name = "rustin" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + anyhow = "1.0.99" 8 + plugin_api = { path = "api" } 9 + libloading = "0.8.8" 10 + serde = "1.0.219" 11 + serde_derive = "1.0.219" 12 + toml = "0.9.5" 13 + zip = "4.3.0" 14 + tempfile = "3.20.0"
+11
README.md
··· 1 + # rustin 2 + 3 + Super basic rust plugin system based on dynamic library loading that I made in an hour. 4 + 5 + This will probably require cross compilation. The easiest way to do this properly is Github CI, tbh. 6 + Looking for a better way, but it's hard to find one, mostly because of macOS. Windows and Linux are 7 + both super easy, but macOS is probably CI-only for most developers. 8 + 9 + ## Usage 10 + 11 + Run `make plugin` inside of `plugin`, then `cargo run` in the root. It should print `Hello, everyone!` or similar.
+9
api/Cargo.toml
··· 1 + [package] 2 + name = "plugin_api" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [lib] 7 + crate-type = ["rlib", "cdylib"] 8 + 9 + [dependencies]
+17
api/src/lib.rs
··· 1 + pub trait Plugin { 2 + fn load(&self); 3 + } 4 + 5 + pub fn say_hello(name: String) { 6 + println!("Hello, {name}!"); 7 + } 8 + 9 + #[macro_export] 10 + macro_rules! plugin { 11 + ($plugin:tt) => { 12 + #[unsafe(no_mangle)] 13 + pub unsafe extern "Rust" fn provide_plugin() -> Box<dyn plugin_api::Plugin> { 14 + Box::new($plugin) 15 + } 16 + }; 17 + }
+14
plugin/Cargo.lock
··· 1 + # This file is automatically @generated by Cargo. 2 + # It is not intended for manual editing. 3 + version = 4 4 + 5 + [[package]] 6 + name = "plugin" 7 + version = "0.1.0" 8 + dependencies = [ 9 + "plugin_api", 10 + ] 11 + 12 + [[package]] 13 + name = "plugin_api" 14 + version = "0.1.0"
+10
plugin/Cargo.toml
··· 1 + [package] 2 + name = "plugin" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [lib] 7 + crate-type = ["cdylib"] 8 + 9 + [dependencies] 10 + plugin_api = { path = "../api" }
+6
plugin/Makefile
··· 1 + plugin: 2 + cargo build 3 + cp target/debug/libplugin.so plugin.so 4 + mkdir -p ../plugins 5 + zip ../plugins/test.rstn plugin.so plugin.toml 6 + rm plugin.so
+2
plugin/plugin.toml
··· 1 + name = "test" 2 + version = "0"
+11
plugin/src/lib.rs
··· 1 + use plugin_api::{Plugin, plugin, say_hello}; 2 + 3 + pub struct HelloWorld; 4 + 5 + impl Plugin for HelloWorld { 6 + fn load(&self) { 7 + say_hello("everyone".to_string()); 8 + } 9 + } 10 + 11 + plugin!(HelloWorld);
+53
src/lib.rs
··· 1 + #![feature(iterator_try_collect)] 2 + 3 + use anyhow::{Context, Result}; 4 + use std::{ 5 + fs::{self, File}, 6 + path::PathBuf, 7 + }; 8 + use zip::ZipArchive; 9 + 10 + use crate::meta::PluginMeta; 11 + 12 + pub mod loader; 13 + pub mod meta; 14 + 15 + #[derive(Debug)] 16 + pub struct LocatedPlugin { 17 + pub meta: PluginMeta, 18 + pub zip: ZipArchive<File>, 19 + pub so: bool, 20 + pub dll: bool, 21 + pub dylib: bool, 22 + } 23 + 24 + pub fn locate_plugins(dir: PathBuf) -> Result<Vec<LocatedPlugin>> { 25 + let mut plugins = Vec::new(); 26 + 27 + for entry in fs::read_dir(dir).context("failed reading directory")? { 28 + let entry = entry.context("failed opening directory entry")?; 29 + if entry.path().is_dir() { 30 + continue; 31 + } 32 + if entry.path().extension().is_none_or(|ext| ext != "rstn") { 33 + continue; 34 + } 35 + 36 + let mut zip = ZipArchive::new(File::open(entry.path()).context("failed opening file")?) 37 + .context("failed reading zip")?; 38 + let meta = meta::read(&mut zip)?; 39 + let so = zip.by_name("plugin.so").is_ok(); 40 + let dll = zip.by_name("plugin.dll").is_ok(); 41 + let dylib = zip.by_name("plugin.dylib").is_ok(); 42 + 43 + plugins.push(LocatedPlugin { 44 + meta, 45 + zip, 46 + so, 47 + dll, 48 + dylib, 49 + }); 50 + } 51 + 52 + Ok(plugins) 53 + }
+62
src/loader.rs
··· 1 + use std::io; 2 + 3 + use anyhow::{Context, Result, bail}; 4 + use libloading::Library; 5 + use plugin_api::Plugin; 6 + use tempfile::NamedTempFile; 7 + 8 + use crate::LocatedPlugin; 9 + 10 + pub struct LoadedPlugin { 11 + pub located: LocatedPlugin, 12 + pub plugin: Box<dyn Plugin>, 13 + // DO NOT MOVE THIS UP! 14 + // This is due to rust's dropping order! 15 + // If the library gets dropped (unloaded) before the plugin, a segfault will occur. 16 + pub lib: Library, 17 + } 18 + 19 + pub fn load(mut plugin: LocatedPlugin) -> Result<LoadedPlugin> { 20 + #[cfg(target_os = "linux")] 21 + let cdylib = plugin.so; 22 + 23 + #[cfg(target_os = "windows")] 24 + let cdylib = plugin.dll; 25 + 26 + #[cfg(target_os = "macos")] 27 + let cdylib = plugin.dylib; 28 + 29 + if !cdylib { 30 + bail!("unsupported platform"); 31 + } 32 + 33 + #[cfg(target_os = "linux")] 34 + let cdylib = "plugin.so"; 35 + 36 + #[cfg(target_os = "windows")] 37 + let cdylib = "plugin.dll"; 38 + 39 + #[cfg(target_os = "macos")] 40 + let cdylib = "plugin.dylib"; 41 + 42 + let mut tmp = NamedTempFile::new().context("failed creating temp file")?; 43 + { 44 + let mut entry = plugin.zip.by_name(cdylib).unwrap(); 45 + io::copy(&mut entry, &mut tmp).context("failed copying cdylib to temp file")?; 46 + } 47 + 48 + unsafe { 49 + let lib = 50 + Library::new(tmp.path().display().to_string()).context("failed loading library")?; 51 + let ctor = lib 52 + .get::<unsafe extern "Rust" fn() -> Box<dyn Plugin>>(b"provide_plugin") 53 + .context("plugin does not have a provide_plugin function")?; 54 + let instance = ctor(); 55 + 56 + Ok(LoadedPlugin { 57 + located: plugin, 58 + lib, 59 + plugin: instance, 60 + }) 61 + } 62 + }
+14
src/main.rs
··· 1 + use std::path::PathBuf; 2 + 3 + use rustin::{loader, locate_plugins}; 4 + 5 + fn main() -> anyhow::Result<()> { 6 + let plugins = locate_plugins(PathBuf::from("plugins"))?; 7 + for plugin in plugins { 8 + println!("Found plugin {}, v{}", plugin.meta.name.clone(), plugin.meta.version.clone()); 9 + let plugin = loader::load(plugin)?; 10 + (*plugin.plugin).load(); 11 + } 12 + 13 + Ok(()) 14 + }
+17
src/meta.rs
··· 1 + use std::io::{Read, Seek}; 2 + 3 + use anyhow::*; 4 + use serde_derive::{Deserialize, Serialize}; 5 + use zip::read::ZipArchive; 6 + 7 + #[derive(Clone, Debug, Serialize, Deserialize)] 8 + pub struct PluginMeta { 9 + pub name: String, 10 + pub version: String, 11 + } 12 + 13 + pub fn read<R: Read + Seek>(zip: &mut ZipArchive<R>) -> Result<PluginMeta> { 14 + let file = zip.by_name("plugin.toml").context("missing plugin.toml")?; 15 + let bytes = file.bytes().try_collect::<Vec<u8>>().context("bad bytes")?; 16 + Ok(toml::from_slice::<PluginMeta>(&bytes).context("invalid plugin.toml")?) 17 + }