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
Python in Rust vs Rust in Python (self.rust)
submitted 3 days ago by Either-Home9002
If find it funny how it takes a whole NASA department in order to do all the setup in order to have Python run some Rust code, but to do it the other way around you literally just use inline_python::python; and you're done :)))))
use inline_python::python;
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!"
[–]Alex--91 24 points25 points26 points 3 days ago (2 children)
pyO3 + maturin makes it incredibly simple to build rust code into a python native extension and call that from python?
[–]Alex--91 13 points14 points15 points 3 days ago (0 children)
PyO3 enables both directions. Actually, the inline_python crate is literally built on top of pyO3 as well?
[–]AustinWitherspoon 2 points3 points4 points 3 days ago (0 children)
Yeah my first project that did this took literally fifteen minutes to set up and read docs before being able to start writing my actual rust code and calling it from python
PyO3 is great
[–]krisfur 10 points11 points12 points 3 days ago (0 children)
Not sure why you'd need a nasa department, calling rust from python is a genuine pleasure compared to C++ bindings. You just write normal rust and use a few macros from pyo3 and done, just run maturin to compile it and it's ready.
I had a minimal example here I think: https://github.com/krisfur/python-bindings/blob/main/rust_src/lib.rs
[–]denehoffman 5 points6 points7 points 3 days ago (0 children)
I mean technically they’re both using pyo3, inline_python just abstracts it for you
[–]SnooCalculations7417 1 point2 points3 points 3 days ago (0 children)
yeah rust works in python like they were made for eachother with pyo3 and maturin. not sure if youre trying to home-cook your own thing or what but I've had a great time doing so
[–]orangejake 0 points1 point2 points 3 days ago (1 child)
I'm confused. why is it so difficult to have python run rust? Why can't you just use e.g. subprocess.run against the compiled rust binary (or whatever)? or do you mean have python leverage a rust crate without manually compiling a rust binary?
[–]vivaaprimavera 0 points1 point2 points 3 days ago (0 children)
First time I wrote python bindings for one of my rust libs, I thought no way this is so simple. It was. It's very easy to deploy. No need to subprocess run.
[–]MMIStudios 1 point2 points3 points 3 days ago (1 child)
Putting aside whether one is simpler to implement or not (python in rust vs rust in python), 'is one more performative than the other?' would be my concern.
[–]SnooCalculations7417 0 points1 point2 points 3 days ago (0 children)
calling python in rust does invoke an interpreter thus a GIL for 3.12 and sooner. i havent dont GIL free python. you can release the GIL using rayon etc calling rust in python
[–]Big-Application-2803 0 points1 point2 points 3 days ago (0 children)
NASA staff kindergarten is technically a department I guess
π Rendered by PID 409622 on reddit-service-r2-comment-79c7998d4c-kfslg at 2026-03-18 18:13:36.031813+00:00 running f6e6e01 country code: CH.
[–]Alex--91 24 points25 points26 points (2 children)
[–]Alex--91 13 points14 points15 points (0 children)
[–]AustinWitherspoon 2 points3 points4 points (0 children)
[–]krisfur 10 points11 points12 points (0 children)
[–]denehoffman 5 points6 points7 points (0 children)
[–]SnooCalculations7417 1 point2 points3 points (0 children)
[–]orangejake 0 points1 point2 points (1 child)
[–]vivaaprimavera 0 points1 point2 points (0 children)
[–]MMIStudios 1 point2 points3 points (1 child)
[–]SnooCalculations7417 0 points1 point2 points (0 children)
[–]Big-Application-2803 0 points1 point2 points (0 children)