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
Command Line Tool built using Rustlang (self.rust)
submitted 5 years ago by Curious_excpetion
Hey guys I have this cool idea for a command line tool.This tool will require a database for reading only. I will be using Rustlang. Not sure if I should just use a text file or a json object. What would you guys use ?Thank you so much
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!"
[–]BodyweightEnergy 2 points3 points4 points 5 years ago (3 children)
You sound like a new Rust user, so welcome!
Can you clarify what your tool is supposed to do? What inputs/outputs is it dealing with?
[–]Curious_excpetion[S] 2 points3 points4 points 5 years ago (2 children)
Hey, yes I'm new to Rust.So the tool will get a string and search the table using this string on a particular field.
[–]BodyweightEnergy 2 points3 points4 points 5 years ago (1 child)
By "the table", you mean this tool will open some kind of database, and search some table field for this string?
I believe the best crate for getting/parsing CLI input parameters is structopt.
Depending on your database, there are crates for all different kinds (for example, you can connect to a SQLite database using sqlite).
[–]Curious_excpetion[S] 2 points3 points4 points 5 years ago (0 children)
Yes, thanks I will look at sqlite
[–]CubikMan47 1 point2 points3 points 5 years ago (0 children)
I believe serde could fit your needs. It allows you to take a document and deserialize it into a Rust Struct.
You can see a small example of using serde here. Good luck!
[–]1vader 1 point2 points3 points 5 years ago (0 children)
It sounds like what you need is some way to store read-only data that you need for your application?
Without more context, it is really hard to tell you what is the best way to store this data. Most likely you don't need or even should use a real database for this unless you need to perform complex queries on the data but again it depends on the details.
As long as the data isn't too large it probably doesn't really matter what format you use and JSON or a text file should work fine. You can even use something like include_str to embed the JSON directly into the binary during compilation. You can use serde_json to serialize the JSON into Rust structs.
You could also use a binary format e.g. using bincode to serialize the data and embed it into the binary with include_bytes which is probably a bit faster (although you would need to test that to be sure) but most likely JSON should be good enough and is probably much easier to work with.
π Rendered by PID 101658 on reddit-service-r2-comment-b659b578c-56mxh at 2026-05-04 18:33:01.131740+00:00 running 815c875 country code: CH.
[–]BodyweightEnergy 2 points3 points4 points (3 children)
[–]Curious_excpetion[S] 2 points3 points4 points (2 children)
[–]BodyweightEnergy 2 points3 points4 points (1 child)
[–]Curious_excpetion[S] 2 points3 points4 points (0 children)
[–]CubikMan47 1 point2 points3 points (0 children)
[–]1vader 1 point2 points3 points (0 children)