Skip to content

How to import module in Rust? #211

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

Open
ieviev opened this issue Apr 21, 2025 · 1 comment
Open

How to import module in Rust? #211

ieviev opened this issue Apr 21, 2025 · 1 comment

Comments

@ieviev
Copy link

ieviev commented Apr 21, 2025

Hi! i could not find a way to import modules to rust. Is there a way to do this?

Currently a workaround is to inject it into an outer attribute tag like:

[<Fable.Core.Rust.OuterAttr("allow(unused)]\nmod rust_glue;\nmod helpers;\n#[cfg",
                            [| "target_arch = \"wasm32\"" |])>]

which gives a result like this:

Image

@ncave
Copy link
Collaborator

ncave commented Apr 21, 2025

Currently the native Rust imports and bindings are not very user friendly, but something like this should work. Note the imports are wrapped in a dummy local function to make the result a bit less messy.

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

No branches or pull requests

2 participants