# From Rust to Mojo

**URL:** <https://forum.modular.com/t/from-rust-to-mojo/3629>\
**Category:** Mojo\
**Tags:** discussion\
**Created:** [November 5, 2026, 5:49am UTC](https://forum.modular.com/t/from-rust-to-mojo/3629 "2026-11-05T05:49:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@Peter](https://forum.modular.com/u/Peter)\
**Post date:** [November 5, 2026, 5:49am UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/1 "2026-11-05T05:49:41Z")

</div>

Since there is already a large ecosystem for Rust with many useful libraries, I was wondering if it is feasible to port some of them to Mojo with the help of AI.

Curious if anyone has already tried this approach and would share some of their findings.

I mention Rust because I assumed it is easier than C++ or other languages due to the similarities between Rust and Mojo (but other insights are welcome).

---

<div class="post-metadata">

**Author:** ![yvv1](https://avatars.discourse-cdn.com/v4/letter/y/8797f3/32.png) [@yvv1](https://forum.modular.com/u/yvv1)\
**Post date:** [November 5, 2026, 9:33am UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/2 "2026-11-05T09:33:49Z")

</div>

WASM components promise us a universal way of interop between different languages, which is super cool, but is years away from practical use, as far as I understand. So, I don’t know what is more rational, start porting libraries to mojo, or sit down and wait when WASM components mature enough to be usable for interop.

---

<div class="post-metadata">

**Author:** ![melodyogonna](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/melodyogonna/32/33_2.png) [@melodyogonna](https://forum.modular.com/u/melodyogonna)\
**Post date:** [November 5, 2026, 11:41am UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/3 "2026-11-05T11:41:59Z")

</div>

In the future, it would be much easier to use the C/C++ libraries written for Python in Mojo. Those are much larger than anything in Rust’s ecosystem

---

<div class="post-metadata">

**Author:** ![denis](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/denis/32/399_2.png) [@denis](https://forum.modular.com/u/denis)\
**Post date:** [November 5, 2026, 3:53pm UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/4 "2026-11-05T15:53:46Z")

</div>

Peter, yes, porting Rust libraries to Mojo would be quite a valuable effort.

I’d say that the Mojo ecosystem is a little bit not ready yet – we need to build the package manager (so that the libraries can be maintained, used, etc), and we need to build seamless Mojo/C interop (something similar to bindgen).

Once those exist, using agents to port libraries makes sense.

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/randyzwitch/32/982_2.png) [@randyzwitch](https://forum.modular.com/u/randyzwitch)\
**Post date:** [November 5, 2026, 7:07pm UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/5 "2026-11-05T19:07:08Z")

</div>

I’ve had pretty good success porting all sorts of libraries into Mojo using LLMs, both Rust and C++. There’s nothing really missing currently that keeps it from working effectively, based on my experience with Opus 5.5 and GPT 6.1 Sol.

---

<div class="post-metadata">

**Author:** ![nate](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/nate/32/740_2.png) [@nate](https://forum.modular.com/u/nate)\
**Post date:** [November 6, 2026, 7:56pm UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/6 "2026-11-06T19:56:35Z")

</div>

I think something worth considering here is what it means to “correctly port” a library from Rust (or any other language) to Mojo.

I believe that simply translating a library from one language to another usually isn’t the best approach. While LLMs might be good at that translation, it can miss part of _why_ someone would choose Mojo over Rust, C++, Zig, etc. Part of choosing one systems language over another is choosing the capabilities that language provides that aren’t easily expressed (or simply inexpressible) in another language. For Mojo, that would be things like linear types, origins, native SIMD, ASAP destruction, etc.

A direct port may “work”, but you can easily end up with a “Rust-flavored library in Mojo syntax.” My hope for Mojo is that we use what makes it unique and interesting to design libraries that would be difficult, or even impossible, to express in other languages. Simply translating an existing design over doesn’t always get us there.

That said, I do think popular libraries from other languages can be a useful starting point, and LLMs could help with that work. There would still need to be some deliberate redesign to express the library’s APIs in a more “Mojo-ish” manner and take advantage of what the language offers.

Otherwise, I think it’s worth asking, what does someone gain by using the ported Mojo version over the original Rust version? If the goal is just to make the existing functionality available in Mojo, it may make more sense to use the original library and expose a C FFI that Mojo can hook into.

---

<div class="post-metadata">

**Author:** ![randyzwitch](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/randyzwitch/32/982_2.png) [@randyzwitch](https://forum.modular.com/u/randyzwitch)\
**Post date:** [November 6, 2026, 8:51pm UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/7 "2026-11-06T20:51:39Z")

</div>

> [@nate](#):
>
> I believe that simply translating a library from one language to another usually isn’t the best approach.

This is a great point. Some of the beginning work I was doing was trying to make a visualization library using Mojo without any FFI calls/dependencies on Cairo or other pre-existing work. By explaining what I wanted to the LLM and a lot of back and forth, my package both does what I want (serves as a basis for a dataviz library), doesn’t carry any of the baggage from past Cairo decisions, and is stupid fast because of multithreading/SIMD.

But in another case, I’ve been trying to make a dataframe library that automatically hands off to GPU when present and when the estimate is that it would be faster. In that case, I’d be remiss by not comparing performance to DuckDB or Polars, especially when they do something faster. Then I can say “implement radix sort in a similar manner as DuckDB”, getting all of the performance from using the same algorithm but using Mojo-specific constructs.

---

<div class="post-metadata">

**Author:** ![owenhilyard](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/owenhilyard/32/41_2.png) [@owenhilyard](https://forum.modular.com/u/owenhilyard)\
**Post date:** [November 7, 2026, 2:31pm UTC](https://forum.modular.com/t/from-rust-to-mojo/3629/8 "2026-11-07T14:31:58Z")

</div>

I’ll agree with Nate here. While “Claude pls port this Rust lib” is nice for getting things working, Mojo is missing parametric traits, which makes large portions of the Rust ecosystem not translate very well. Mojo offers linear types and much more ergonomic stack machines, which enable a lot more ways to turn the Rust philosophy of “misuse-resistant libraries” up a few levels. Given that Mojo is likely going to see a lot of LLM written code, libraries which are hard to use incorrectly are very valuable and I think the time investment to re-architect things is well worth it.

That being said, Mojo is still a new language and unblocking oneself sometimes means asking for a one to one port is the most reasonable option to get something working. In that case, in my opinion Rust is the best language to do that from.
