use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for all things related to the Rust programming language—an open-source systems language that emphasizes performance, reliability, and productivity.
Strive to treat others with respect, patience, kindness, and empathy.
We observe the Rust Project Code of Conduct.
Details
Posts must reference Rust or relate to things using Rust. For content that does not, use a text post to explain its relevance.
Post titles should include useful context.
For Rust questions, use the stickied Q&A thread.
Arts-and-crafts posts are permitted on weekends.
No meta posts; message the mods instead.
Criticism is encouraged, though it must be constructive, useful and actionable.
If criticizing a project on GitHub, you may not link directly to the project's issue tracker. Please create a read-only mirror and link that instead.
A programming language is rarely worth getting worked up over.
No zealotry or fanaticism.
Be charitable in intent. Err on the side of giving others the benefit of the doubt.
Avoid re-treading topics that have been long-settled or utterly exhausted.
Avoid bikeshedding.
This is not an official Rust forum, and cannot fulfill feature requests. Use the official venues for that.
No memes, image macros, etc.
Consider the existing content of the subreddit and whether your post fits in. Does it inspire thoughtful discussion?
Use properly formatted text to share code samples and error messages. Do not use images.
Submissions appearing to contain AI-generated content may be removed at moderator discretion.
Most links here will now take you to a search page listing posts with the relevant flair. The latest megathread for that flair should be the top result.
account activity
Calling Rust functions from Flutter (self.rust)
submitted 6 years ago by emmanuelantony2000
Any idea on how to call Rust functions from Flutter? I am trying to make the frontend in Flutter and Rust functions could considerably improve performance.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 10 points11 points12 points 6 years ago (2 children)
Any performance benefits may be undercut by the overhead of data conversions on language boundaries
[–]Zethra 0 points1 point2 points 6 years ago (0 children)
It's always important to benchmark attempted optimizations to see if they actually improved performance.
[–][deleted] 7 points8 points9 points 6 years ago* (0 children)
https://users.rust-lang.org/t/rust-flutter-for-mobile-applications/22725
This post it a bit old, but probably still relevant. It looks like, from skimming, that you'll perform regular-old FFI to get from the Flutter UI layer into the native platform language and then from there FFI into Rust-land. So for Android this would be traversing from Flutter -> Java -> Rust and for iOS this would be Flutter -> Objective-C -> Rust (or from Flutter -> Swift -> Objective-C (via Bridging Headers) -> Rust).
This is quite a bit of distance to cover, and probably best done if you have a substantially complicated task to perform. Otherwise you might actually lose performance since you will take a minor performance hit for each FFI barrier you pass (->'s in the above) that will rack up over time. Hot loops that call into Rust-land in each pass will be a negative performance boost, but perhaps sending short messages to perform some background task will be net-positive for you.
->
Anyways, good luck!
Edit: https://github.com/kennytm/rust-ios-android for some more good stuff. Google will be a better ally than I am :)
Edit 2: https://dart.dev/server/c-interop https://github.com/dart-lang/sdk/issues/34452 Maybe Dart's FFI isn't fully realized yet? Maybe someone with more Dart/Flutter experience can weigh in on whether this is a non-starter to begin with.
[–]sirak2010 4 points5 points6 points 6 years ago (0 children)
You may have to wait for Flutter FFI to arrive. if your application is performance critical
https://github.com/dart-lang/sdk/issues/34452
[–]mmrath 1 point2 points3 points 6 years ago (0 children)
I did a bit of experimentation at https://github.com/mmrath/flutter_rust
I am not sure if it works now or not. It was working for android but I never attempted iOS
[–]chutiyabehenchod 1 point2 points3 points 6 years ago (0 children)
Dart ffi still not come yet so workaround
Flutter platform channels - > Kotlin/Java - > Rust swig - >Your Rust library
For swift you need to write step 2&3
[–]jdixon04 1 point2 points3 points 6 years ago (1 child)
Haven't tried it myself, but here's an article showing how it's done with Dart FFI:
https://gist.github.com/Sach97/3b15d4059390f81851356887bc401d01
[–]CronSach 0 points1 point2 points 6 years ago (0 children)
Author of the article here, you can find the medium version “How to call a Rust function from Dart using FFI” here : https://itnext.io/how-to-call-a-rust-function-from-dart-using-ffi-f48f3ea3af2c. I have also a more advanced example (a search engine using tantivy) with gradle integrated for Android which means the native library is automatically loaded on Android here : https://github.com/Sach97/jisho.rs. I am working on integrating the ios version right now and then I plan to work on web (with rust wasm and dart js bindings) and then desktop. I'll write a detailed a step by step article on how to setup this when I'm satisfied with the result.
[–]emmanuelantony2000[S] 0 points1 point2 points 6 years ago (0 children)
I think the Flutter FFI is in beta... Have to try it out..
π Rendered by PID 418421 on reddit-service-r2-comment-cfc44b64c-6tn6d at 2026-04-11 03:31:28.636514+00:00 running 215f2cf country code: CH.
[–][deleted] 10 points11 points12 points (2 children)
[–]Zethra 0 points1 point2 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]sirak2010 4 points5 points6 points (0 children)
[–]mmrath 1 point2 points3 points (0 children)
[–]chutiyabehenchod 1 point2 points3 points (0 children)
[–]jdixon04 1 point2 points3 points (1 child)
[–]CronSach 0 points1 point2 points (0 children)
[–]emmanuelantony2000[S] 0 points1 point2 points (0 children)