Skip to content

[workerd-cxx] rust type aliases #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2025
Merged

[workerd-cxx] rust type aliases #43

merged 2 commits into from
Jul 10, 2025

Conversation

mikea
Copy link
Collaborator

@mikea mikea commented Jul 7, 2025

This is dtolnay#1181 merged in.

I have reviewed it and verified in my async io branch. With this change we can now do in the other module:

    extern "Rust" {
        #[namespace = "kj_rs_io::ffi"]
        type RustAsyncInputStream = io::RustAsyncInputStream;

        fn create_rust_mock_input_stream(data: &[u8]) -> Box<RustAsyncInputStream>;
   }

The intention is to provide support to re-import Rust types already
exported elsewhere into other bridges, creating equivalence of
`extern "Rust"` types on the C++ side.

Currently, the support is limited to re-exporting the type under the
same name and the C++ namespace must be explicitly specified. Then,
C++ functions can use the same type.
@mikea mikea changed the title Schreter rust type alias [workerd-cxx] rust type aliases Jul 7, 2025
@mikea mikea force-pushed the schreter_rust_type_alias branch from 9d848a4 to 944a05b Compare July 8, 2025 15:09
@mikea mikea force-pushed the schreter_rust_type_alias branch from 944a05b to 9c92af4 Compare July 8, 2025 16:28
@mikea mikea marked this pull request as ready for review July 8, 2025 16:42
@mikea mikea merged commit bd77fec into master Jul 10, 2025
7 checks passed
@mikea mikea deleted the schreter_rust_type_alias branch July 10, 2025 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants