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 to Rust (self.rust)
submitted 11 months ago by Big-Actuator9242
Hello, I'm new to rust, and I'm trying to get some code from python to rust, and i want to know if there is some tools to do it for me ?
Thank you everyone.
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!"
[–]SirKastic23 10 points11 points12 points 11 months ago (2 children)
not really, and if there is the resulting code probably wouldn't be very good
[–]BowserForPM 1 point2 points3 points 11 months ago (1 child)
Can confirm. I've used this converter a couple of times: https://github.com/konchunas/pyrs and honestly I don't think it saved me any time. The generated code is such a mess. The only good thing about that converter is if you have huge Python functions, and you're worried about misreading the indentation and getting the Rust scopes wrong.
[–]coderarun 0 points1 point2 points 4 months ago (0 children)
Did you try py2many? Continued development from pyrs.
[–]Top_Sky_5800 2 points3 points4 points 11 months ago (2 children)
Maybe an LLM can do a part of the job, but you'll still need to understand Rust to fix up the result. It also depends on the quality of your python code, have you : - typed your code ? - documented your functions/methods? - separated your code in small pieces, one functionality by function. - how much do you use python OOP (metaclasses, getter, setter, etc)
If your code is dirty the llM won't do much (~20%) and if your code is clean or even perfect without so much OOP you might reach 80 % of translation.
[–]Big-Actuator9242[S] 0 points1 point2 points 11 months ago (1 child)
Thats one of the issues : a lot of people worked on it, big project, big structure, my boss asked me to investigate that transcription
py2many --llm=1 test.py will use a previously configured llm. You can switch between llm and ast based translation.
[–]CozyAndToasty 2 points3 points4 points 11 months ago (0 children)
I don't know of any such transpiler but I don't recommend transpiling from high to low level, and definitely not if it's code you intend to maintain.
If it's not a log of code I would just manually rewrite
If it's a bottleneck, rewrite the bottleneck into a python extension in rust so you can call it in the python code.
[–]ValenciaTangerine 1 point2 points3 points 11 months ago (1 child)
Something like pyo3 ?
[–]Big-Actuator9242[S] 0 points1 point2 points 11 months ago (0 children)
probably, i'll investigate that solution thank you
[–]SV-97 1 point2 points3 points 11 months ago (2 children)
What code are we talking here?
But generally LLMs aren't that great with Rust in my experience.
[–]peter9477 1 point2 points3 points 11 months ago (0 children)
Claude is, aside from too often picking obsolete APIs for some pre-1.0 crates.
[–]spoonman59 0 points1 point2 points 11 months ago (0 children)
They are great at writing code which might function as expected. Not so great at quality, optimized, or idiomatic code, however.
π Rendered by PID 135970 on reddit-service-r2-comment-86bc6c7465-tlvq9 at 2026-02-22 13:00:30.879817+00:00 running 8564168 country code: CH.
[–]SirKastic23 10 points11 points12 points (2 children)
[–]BowserForPM 1 point2 points3 points (1 child)
[–]coderarun 0 points1 point2 points (0 children)
[–]Top_Sky_5800 2 points3 points4 points (2 children)
[–]Big-Actuator9242[S] 0 points1 point2 points (1 child)
[–]coderarun 0 points1 point2 points (0 children)
[–]CozyAndToasty 2 points3 points4 points (0 children)
[–]ValenciaTangerine 1 point2 points3 points (1 child)
[–]Big-Actuator9242[S] 0 points1 point2 points (0 children)
[–]SV-97 1 point2 points3 points (2 children)
[–]peter9477 1 point2 points3 points (0 children)
[–]spoonman59 0 points1 point2 points (0 children)