Add Rust wrapper for score::cpp::stop_token - #461
Open
eclipse-impl wants to merge 1 commit into
Open
Conversation
eclipse-impl
requested review from
4og,
antonkri,
arkjedrz,
fbaeuerle and
pawelrutkaq
as code owners
August 11, 2026 15:23
eclipse-impl
requested a deployment
to
workflow-approval
August 11, 2026 15:23 — with
GitHub Actions
Waiting
eclipse-impl
requested a deployment
to
workflow-approval
August 11, 2026 15:23 — with
GitHub Actions
Waiting
eclipse-impl
requested a deployment
to
workflow-approval
August 11, 2026 15:23 — with
GitHub Actions
Waiting
eclipse-impl
requested a deployment
to
workflow-approval
August 11, 2026 15:23 — with
GitHub Actions
Waiting
eclipse-impl
force-pushed
the
swp-271167
branch
from
August 11, 2026 15:24
42e3720 to
0223eb6
Compare
Contributor
|
The created documentation from the pull request is available at: docu-html |
There was a problem hiding this comment.
Pull request overview
Adds CXX-based Rust bindings for FutureCpp stop tokens and sources.
Changes:
- Exposes stop-state creation, querying, equality, and cancellation.
- Adds C++ bridge adapters and Rust unit tests.
- Integrates the crate with Bazel and Cargo.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
score/language/rust/stop_token/src/lib.rs |
Implements the Rust API and tests. |
score/language/rust/stop_token/cpp/stop_token_adapter.h |
Declares C++ bridge functions. |
score/language/rust/stop_token/cpp/stop_token_adapter.cpp |
Implements FutureCpp forwarding. |
score/language/rust/stop_token/Cargo.toml |
Defines the Rust crate. |
score/language/rust/stop_token/BUILD |
Adds Bazel bridge, library, and test targets. |
Cargo.toml |
Registers the workspace member. |
Cargo.lock |
Locks the new CXX dependency graph. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "score/testing_macros", | ||
| "score/language/rust/libcpp", | ||
| "score/language/rust/libcpp_derive", | ||
| "score/language/rust/stop_token", |
Comment on lines
+92
to
+95
| unsafe impl Send for StopToken {} | ||
| unsafe impl Sync for StopToken {} | ||
| unsafe impl Send for StopSource {} | ||
| unsafe impl Sync for StopSource {} |
| #ifndef SCORE_LANGUAGE_RUST_STOP_TOKEN_CPP_STOP_TOKEN_ADAPTER_H | ||
| #define SCORE_LANGUAGE_RUST_STOP_TOKEN_CPP_STOP_TOKEN_ADAPTER_H | ||
|
|
||
| #include <score/stop_token.hpp> |
| bool StopSourceRequestStop(const score::cpp::stop_source& source) noexcept | ||
| { | ||
| // request_stop() only updates the shared stop state atomically. | ||
| return const_cast<score::cpp::stop_source&>(source).request_stop(); |
arkjedrz
requested changes
Aug 18, 2026
| "score/testing_macros", | ||
| "score/language/rust/libcpp", | ||
| "score/language/rust/libcpp_derive", | ||
| "score/language/rust/stop_token", |
Contributor
There was a problem hiding this comment.
What happens when You cargo build the project?
Contributor
Author
There was a problem hiding this comment.
it works:
$ cargo build
Compiling score_log_fmt v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/log_rust/score_log_fmt)
Compiling foldhash v0.2.0
Compiling memres v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/language/rust/memres)
Compiling libc v0.2.189
Compiling syn v2.0.119
Compiling link-cplusplus v1.0.12
warning: missing documentation for a struct field
--> score/language/rust/memres/src/lib.rs:141:17
|
141 | Monotonic { size: usize },
| ^^^^^^^^^^^
|
= note: requested on the command line with `-W missing-docs`
warning: `memres` (lib) generated 1 warning
Compiling cxx v1.0.199
Compiling stop_token v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/language/rust/stop_token)
Compiling score_log_fmt_macro v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/log_rust/score_log_fmt_macro)
Compiling libcpp_derive v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/language/rust/libcpp_derive)
warning: missing documentation for the crate
--> score/language/rust/libcpp_derive/lib.rs:14:1
|
14 | / use proc_macro2::TokenStream;
15 | | use quote::{format_ident, quote};
16 | | use syn::parse::Parse;
17 | | use syn::spanned::Spanned;
... |
234 | | }
| |_^
|
= note: requested on the command line with `-W missing-docs`
warning: `libcpp_derive` (lib) generated 1 warning
Compiling libcpp v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/language/rust/libcpp)
Compiling score_log v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/log_rust/score_log)
Compiling result_rs v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/result/rust)
warning: missing documentation for a struct
--> score/result/rust/result.rs:156:5
|
156 | pub struct Expected<T, E> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: requested on the command line with `-W missing-docs`
Compiling allocator v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/allocator)
Compiling stdout_logger v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/log_rust/stdout_logger)
Compiling pal v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/pal)
warning: `result_rs` (lib) generated 1 warning
Compiling sync v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/sync)
Compiling containers v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/containers_rust)
Compiling thread v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/thread)
Compiling score_testing_macros v0.0.1 (/home/q474126/code/eclipse-score-baselibs/score/testing_macros)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.65s
| path = "src/lib.rs" | ||
|
|
||
| [dependencies] | ||
| cxx = "1.0.186" |
Contributor
There was a problem hiding this comment.
Replace with a regular FFI layer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.