Commit Graph

24 Commits

Author SHA1 Message Date
Alex Bakon
fb33f261bf Upgrade crates to Rust 2024 edition
Co-authored-by: Andrew <andrew@signal.org>
2025-09-03 15:12:59 -04:00
Alex Bakon
8a9e18b6c6 Remove unused #[allow], replace with #[expect] 2025-06-03 16:07:06 -04:00
Jordan Rose
f631b09160 node: Update to Neon 1.1
This removes one (1) hack where Neon now provides stronger promises
about lifetimes. (Unfortunately the others are still technically
unsafe.)
2025-05-28 12:00:50 -07:00
Alex Bakon
151c96e52b Apply lint fixes from latest clippy 2025-05-23 10:29:25 -04:00
Jordan Rose
faaa374502 Rust: Move version, authors, and license up to workspace Cargo.toml
For 'authors' and 'license' this is a bulk setting for basically every
crate in the repo. It's not really *shorter* to say that they all get
their values from the root Cargo.toml, but it sets a precedent for
other values.

'version' is a little more interesting. The versions we use for tags
only really apply to the app libraries; it would be odd for Rust
clients to see a bump in the "version" for libsignal-protocol whenever
we do a release when most releases have no changes in
libsignal-protocol. So for now, only the bridge crates are taking the
version from the workspace; if we ever, say, release
libsignal-protocol on crates.io, it'll be important that it has its
own versioning scheme separate from libsignal as a whole.
2025-02-05 13:22:35 -08:00
Alex Konradi
a54e6b5b33 Format with group_imports=StdExternalCrate 2024-08-28 14:52:47 -04:00
Alex Konradi
e84af68a1b Use workspace.dependencies for common dependencies 2024-08-26 14:16:06 -04:00
Alex Konradi
9b34467614 Use taplo to auto-format TOML files
Use https://github.com/tamasfe/taplo to auto-format TOML files. Add a config 
file to force reordering of dependencies in Cargo.toml files. Run taplo in CI 
to check formatting.
2024-03-26 16:06:45 -04:00
Jordan Rose
f0f18e82b3 node: Update to Neon 1.0
- Feature flags removed for unconditionally-provided APIs.
- A function's this() is no longer guaranteed to be an object,
  so we have to check and error out more often.
- Use of usize instead of i32 in a few places.
- Convenience for fetching globals.
2024-02-23 13:40:44 -08:00
akonradi-signal
58a16be1b3 Bump all crates to Rust 2021 2023-10-31 13:43:33 -04:00
akonradi-signal
ef542e3b9f Bump rust compiler version to nightly 2023-09-01 2023-09-12 14:27:08 -04:00
Jordan Rose
f71e1c6693 Use "Signal Messenger LLC" as the author of all packages
(the copyright holder)
2022-10-12 17:02:53 -07:00
Jordan Rose
49ad15cd06 node: Remove now-unnecessary Vecs from Neon calls 2022-03-08 16:16:23 -08:00
Jordan Rose
b6c6839332 signal-neon-futures: Use Neon's JsPromise to implement our promise()
We still do some extra work to ensure panics are caught and turned
into JavaScript errors, so our promise() function doesn't go away
altogether, but the implementation's much simpler and now more
strongly typed.
2022-03-08 16:16:23 -08:00
Jordan Rose
0d8a530f60 Node: update to Neon 0.10 2022-03-08 16:16:23 -08:00
Jordan Rose
ca37067f5a Update to Neon 0.9.0
- Drop our fork of Neon now that our changes have been integrated
- Adopt rename of EventQueue to Channel
- Add a napi-6 feature to signal-neon-futures to make it easier to test
  under the configuration we're actually shipping
2021-07-26 12:37:42 -07:00
Jordan Rose
e7a0f4d424 Replace block_on and expect_ready with FutureExt::now_or_never
Both futures::executor::block_on and our own expect_ready were being
used to resolve futures that were, in practice, known to be
non-blocking. FutureExt::now_or_never handles that case more lightly
than block_on and more uniformly than expect_ready.

This lets us drop the dependency on the full 'futures' crate down to
just futures_util, which should help with compile time.
2021-07-06 10:30:42 -07:00
Jordan Rose
e1448a8e60 signal-neon-futures: Only run Rust futures on an existing EventQueue
Node can more efficiently handle multiple tasks coming in on the same
queue, so remove the "convenience" APIs that derive a new queue from a
Context, and require an existing EventQueue instead. This cuts more
time off of our decryption benchmark (not checked in).

Additionally, run the first poll for the future synchronously, to
avoid having to wait for the event loop to pick up the task to start
the future.
2021-05-05 17:45:53 -07:00
Jordan Rose
e77584753a signal-neon-futures: Add a Node benchmark for a single round trip
It turns out this takes less than a millisecond, at least when the
event loop is empty, but the setup might still be useful in the
future. Run with `cargo bench -p signal-neon-futures`.
2021-04-16 15:14:22 -07:00
Jordan Rose
df3e01f909 Node: update to Neon 0.8.0
And remove the FinalizableOption workaround.
2021-03-23 11:39:04 -07:00
Jordan Rose
a58fa94241 Feedback part 3: Add a call_method helper
I made it 'pub' because honestly it's generally useful.
2021-02-05 18:55:01 -08:00
Jordan Rose
449748459c Feedback part 2: remove unnecessary PersistentException helpers 2021-02-05 18:55:01 -08:00
Jordan Rose
c0a0a58189 Feedback part 1: renames and comments
In particular, I got the terms "fulfill" and "resolve" mixed up. This
version should have the correct use of "settled", "fulfilled",
"rejected", and (in rare cases) "resolved".
2021-02-05 18:55:01 -08:00
Jordan Rose
2d059643e1 Node: allow Rust async blocks to wait on JavaScript futures
Neon provides a way to expose *synchronous* JavaScript functions from
Rust. This means that if Rust wants to wait for the result of a
JavaScript promise, it can at best return a callback to continue its
work when the promise resolves. This does not naturally compose with
Rust's `async`, which works in terms of Futures.

This commit adds a new crate, signal-neon-futures, that provides
functionality for (1) wrapping JavaScript futures so they can be
awaited on in Rust, and (2) producing a JavaScript promise that wraps
a Rust future. It does so by synchronously resuming execution of the
Rust future whenever an awaited JavaScript promise is resolved.
2021-02-04 10:22:58 -08:00