Files
dependabot[bot] a657867bb6 Bump rand from 0.8.5 to 0.9.3 in /rust/bapi (#22241)
Bumps [rand](https://github.com/rust-random/rand) from 0.8.5 to 0.9.3.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-random/rand/blob/0.9.3/CHANGELOG.md">rand's
changelog</a>.</em></p>
<blockquote>
<h2>[0.9.3] — 2026-02-11</h2>
<p>This release back-ports a fix from v0.10. See also <a
href="https://redirect.github.com/rust-random/rand/issues/1763">#1763</a>.</p>
<h3>Changes</h3>
<ul>
<li>Deprecate feature <code>log</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1764">#1764</a>)</li>
<li>Replace usages of <code>doc_auto_cfg</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1764">#1764</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/rust-random/rand/issues/1763">#1763</a>:
<a
href="https://redirect.github.com/rust-random/rand/pull/1763">rust-random/rand#1763</a></p>
<h2>[0.9.2] — 2025-07-20</h2>
<h3>Deprecated</h3>
<ul>
<li>Deprecate <code>rand::rngs::mock</code> module and
<code>StepRng</code> generator (<a
href="https://redirect.github.com/rust-random/rand/issues/1634">#1634</a>)</li>
</ul>
<h3>Additions</h3>
<ul>
<li>Enable <code>WeightedIndex&lt;usize&gt;</code> (de)serialization (<a
href="https://redirect.github.com/rust-random/rand/issues/1646">#1646</a>)</li>
</ul>
<h2>[0.9.1] - 2025-04-17</h2>
<h3>Security and unsafe</h3>
<ul>
<li>Revise &quot;not a crypto library&quot; policy again (<a
href="https://redirect.github.com/rust-random/rand/issues/1565">#1565</a>)</li>
<li>Remove <code>zerocopy</code> dependency from <code>rand</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1579">#1579</a>)</li>
</ul>
<h3>Fixes</h3>
<ul>
<li>Fix feature <code>simd_support</code> for recent nightly rust (<a
href="https://redirect.github.com/rust-random/rand/issues/1586">#1586</a>)</li>
</ul>
<h3>Changes</h3>
<ul>
<li>Allow <code>fn rand::seq::index::sample_weighted</code> and <code>fn
IndexedRandom::choose_multiple_weighted</code> to return fewer than
<code>amount</code> results (<a
href="https://redirect.github.com/rust-random/rand/issues/1623">#1623</a>),
reverting an undocumented change (<a
href="https://redirect.github.com/rust-random/rand/issues/1382">#1382</a>)
to the previous release.</li>
</ul>
<h3>Additions</h3>
<ul>
<li>Add <code>rand::distr::Alphabetic</code> distribution. (<a
href="https://redirect.github.com/rust-random/rand/issues/1587">#1587</a>)</li>
<li>Re-export <code>rand_core</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1604">#1604</a>)</li>
</ul>
<h2>[0.9.0] - 2025-01-27</h2>
<h3>Security and unsafe</h3>
<ul>
<li>Policy: &quot;rand is not a crypto library&quot; (<a
href="https://redirect.github.com/rust-random/rand/issues/1514">#1514</a>)</li>
<li>Remove fork-protection from <code>ReseedingRng</code> and
<code>ThreadRng</code>. Instead, it is recommended to call
<code>ThreadRng::reseed</code> on fork. (<a
href="https://redirect.github.com/rust-random/rand/issues/1379">#1379</a>)</li>
<li>Use <code>zerocopy</code> to replace some <code>unsafe</code> code
(<a
href="https://redirect.github.com/rust-random/rand/issues/1349">#1349</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1393">#1393</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1446">#1446</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1502">#1502</a>)</li>
</ul>
<h3>Dependencies</h3>
<ul>
<li>Bump the MSRV to 1.63.0 (<a
href="https://redirect.github.com/rust-random/rand/issues/1207">#1207</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1246">#1246</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1269">#1269</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1341">#1341</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1416">#1416</a>,
<a
href="https://redirect.github.com/rust-random/rand/issues/1536">#1536</a>);
note that 1.60.0 may work for dependents when using
<code>--ignore-rust-version</code></li>
<li>Update to <code>rand_core</code> v0.9.0 (<a
href="https://redirect.github.com/rust-random/rand/issues/1558">#1558</a>)</li>
</ul>
<h3>Features</h3>
<ul>
<li>Support <code>std</code> feature without <code>getrandom</code> or
<code>rand_chacha</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1354">#1354</a>)</li>
<li>Enable feature <code>small_rng</code> by default (<a
href="https://redirect.github.com/rust-random/rand/issues/1455">#1455</a>)</li>
<li>Remove implicit feature <code>rand_chacha</code>; use
<code>std_rng</code> instead. (<a
href="https://redirect.github.com/rust-random/rand/issues/1473">#1473</a>)</li>
<li>Rename feature <code>serde1</code> to <code>serde</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1477">#1477</a>)</li>
<li>Rename feature <code>getrandom</code> to <code>os_rng</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1537">#1537</a>)</li>
<li>Add feature <code>thread_rng</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1547">#1547</a>)</li>
</ul>
<h3>API changes: rand_core traits</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/rust-random/rand/commit/1aeee9f4c506f9f737c6c37c169ccdc365bfbabf"><code>1aeee9f</code></a>
Prepare v0.9.3: deprecate feature <code>log</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1764">#1764</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/98473ee6f9b44eb85154b59b67adade7f2a9b8a1"><code>98473ee</code></a>
Prepare rand 0.9.2 (<a
href="https://redirect.github.com/rust-random/rand/issues/1648">#1648</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/031a1f5589e487ce95972cb3acc0833ef64cfc10"><code>031a1f5</code></a>
<code>examples/print-next.rs</code> (<a
href="https://redirect.github.com/rust-random/rand/issues/1647">#1647</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/6cb75ee59eda73967b6a3cae4fdcf2c21f6e0e4e"><code>6cb75ee</code></a>
Make UniformUsize serializable (<a
href="https://redirect.github.com/rust-random/rand/issues/1646">#1646</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/0c955c5b7a079bc2fe67fe946a8deb46c4bc58d8"><code>0c955c5</code></a>
Add some tests for BlockRng, BlockRng64 and Xoshiro RNGs (<a
href="https://redirect.github.com/rust-random/rand/issues/1639">#1639</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/204084a35fc7289e9a38575fdd80869818484517"><code>204084a</code></a>
Fix: Remove accidental editor swap file (<a
href="https://redirect.github.com/rust-random/rand/issues/1636">#1636</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/86262ac190ec20a79293607fb2347dc74c99122e"><code>86262ac</code></a>
Deprecate rand::rngs::mock module and StepRng (<a
href="https://redirect.github.com/rust-random/rand/issues/1634">#1634</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/a6e217f4a3ce78223a59cc1ff9afb2b5e589d785"><code>a6e217f</code></a>
Update statrs link (<a
href="https://redirect.github.com/rust-random/rand/issues/1630">#1630</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/db993ec12676119251eaf9f2cba8389a1b07abef"><code>db993ec</code></a>
Prepare rand v0.9.1 (<a
href="https://redirect.github.com/rust-random/rand/issues/1629">#1629</a>)</li>
<li><a
href="https://github.com/rust-random/rand/commit/3057641020408f64a4618b1c582cad45a9304811"><code>3057641</code></a>
Remove zerocopy from rand (<a
href="https://redirect.github.com/rust-random/rand/issues/1579">#1579</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/rust-random/rand/compare/0.8.5...0.9.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rand&package-manager=cargo&previous-version=0.8.5&new-version=0.9.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/Aurorastation/Aurora.3/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-20 11:33:24 +00:00
..

What is this

todo

On FFI

FFI means "foreign function interface". Basically, different languages can't easily "talk" to each other, as they have different features and mechanisms. One exception is scripting languages (like Python or Lua), but that is neither DM nor Rust. If we do want them to "talk", we need to find some other language, one that is common and basic, that both DM and Rust can understand. And that is C.

Rust functions callable from DM should end with _ffi, and have a very "raw" form, and do the least things possible to just call the actual Rust functions.

Rust functions that do actual things should not end with _ffi, and can be nice, idiomatic, Rust-like, and most importantly, safe.

On safety

I recommend reading up on these topics related to Rust: safety, unsafe {}, error-handling, panics.

Safety related stuff:

  • Generally, try to call stack trace dm proc on error or panic, so it fails tests and stops debugging (may need to turn on breakpoints on runtime errors).
  • Panics (like foo().unwrap();) are caught with a panic handler that calls stack trace proc, and writes to a file. Panics are unrecoverable, so this is the best we can do in this case. Panics should not really happen though, except in a "fatal error and literally cannot proceed further" situation.
  • Unhandled errors (like foo()?;) call stack trace proc and return null from the function. Errors should be propagated up, using the eyre library, with every function that may fail returning eyre::Result<T>.
  • Some unsafety may be required, like to parse args in _ffi functions, but should not be present any where else. And if for whatever reason it is needed, it should be documented well.
  • All rust code (generally, outside of _ffi) should be nice, safe, and idiomatic.

Compiling and testing

Command to compile bapi. The resulting .dll should be in ./rust/bapi/target/i686-pc-windows-msvc/release/.... The server should try to find and use the .dll in that location, otherwise use ./bapi.dll in main dir. Building either in release mode (with optimizations) or in debug (without, the default) is fine, but release .dll takes priority.

cargo build --target=i686-pc-windows-msvc
cargo build --release --target=i686-pc-windows-msvc