back
10 comments
I've worked on some projects (private and commercial) where embedding Rust into one of those targets was required: iOS, Android, Flutter, macOS, Web. I've played around with a variety of approaches because there exist multiple solutions depending on the platform. Apart from Web/Wasm, where Rust really shines, the next best solution is uniffi by Mozilla, which has quite solid iOS/Android support:

https://github.com/mozilla/uniffi-rs

While this works, the bigger pain (at least on iOS) is that the Rust-Compiler LLVM and Xcode LLVM are not always in sync leading to strange bugs. Also, packaging Rust libraries into a nice XCFramework (or even SPM Module) works, but usually involves hacky shell scripts.

The reason why you'd still want to do this is if there's a Rust library that has no equivalent on the Kotlin or Swift side. There're a lot of good crates / libraries for Rust would require an expensive re-implementation in Swift or Kotlin. Also, because Rust doesn't have a garbage collector, it is easier to embed in garbage collected languages like Kotlin without running into situations where the two garbage collectors don't agree.

So even using uniffi you are getting weird bugs on iOS?

I've long been interested in sharing Rust code between iOS and Android but found the integration to be pretty daunting.

Could it be compiled into a React Native app, I wonder?

No, sorry, that was phrased wrongly. Uniffi works fine, but you might have compile-time issues whenever the Rust & Swift LLVM versions are out of sync. When Rust is ahead, it is easy to resolve by going to an earlier Rust release. When Swift is ahead, this means staying with an older Xcode version until Rust also upgrades LLVM. However, this means sometimes you can't upgrade to new features on one of the two platforms.
I don't have a need for this personally, but having been forced to deal with some Java build nightmares like PyLucene's JCC[1], I respect the hell out of these guys for figuring it out and actually documenting it with a working example for others to take advantage of.

[1]: https://lucene.apache.org/pylucene/jcc/

This is why I learned to only bother with the platform SDKs.

Most of the time they already have their share of problems, no need to introduce additional ones that I have to debug on my own.

"Since I have experience in cross-compiling and building automation, I often choose Rust as my primary programming language." - hmmm, not sure I see how the second follows from the first?

"In addition, Rust is still a relatively new language, and utilizing any technology from the previous decade is setting you up to fail." - er, no? Or at least you should consider the thought that using a technology that isn't established yet and might be abandoned could also set you up for failure? Not saying that Rust is in danger of that, but...

"Sometimes, following the hype train is the quickest route to success." - ok, I'm not sure I want to read this article anymore. Or is my irony detector malfunctioning?

I've noticed logrocket churns out semi-technical blog posts on mass on all sorts of subjects. Take a look at what has been submitted from them: https://news.ycombinator.com/from?site=logrocket.com

There isn't much a common theme on what they write about. It seems to be a bit of everything programming related and usually fairly shallow tutorials.

My guess is that it is a marketing strategy. They write all these tutorials to show up in developers searches for technical problems and hackernews. Its gets them a little name recognition. I guess it's worked in that I know their name and what they do but it hasn't worked in that I don't have an extremely high opinion of their articles. I mean they aren't bad, one helped me out once, but they are never amazing.

I don't really disagree, but I would note they aren't arbitrary, there's some topics they're interested in and write about. Like Rust and data visualization. Lots of them are about gluing together two popular technologies. I imagine that this a compromise between their expertise and which topics are trendy. I agree it's for sure a marketing strategy, and that that necessarily makes the content middling to good but never great.

Sometimes I'm interested in some pair of technologies that feels like something Logrocket would write about, and it usually turns out to be true. If you wanna use D3 with your favorite frontend framework and want to avoid some of the pain of starting out, you'll probably find a reasonable competent explanation and avoid some of the early pitfalls.

> blog posts on mass on all sorts of subjects

"en masse"?

I had the same reaction. The only charitable idea I could come up with is that the author believes using tools with a lot of attention sets them up to receive more support from the community.

But it could also be that the author simply wants to garner more attention for the article/project, or thinks using the hype train technologies looks better on a resume.