Rust
3 Followers 5 Questions

Rust is a systems programming language focused on safety, speed, and concurrency. It offers memory safety without a garbage collector, making it ideal for performance-critical applications. Rust has grown popular for web assembly, embedded, and backend development.

How to split a string into chunks in Rust and insert spaces (or another character)?

I'm working with hexadecimal strings and I want to insert a space between every two characters in a string so that each byte can be easily distinguished. I'm aware that chunks and join could be used, but no such methods are available in [Chars](https://doc.rust-lan...

0 votes 3 views 1 Answer Asked 3 days ago
J
J Early User
109
How can I concatenate strings in Rust?

How can I perform string concatenation with &str String, and the various combinations you can make with them (&str and &str, String and String, etc.) in Rust?

0 votes 7 views 1 Answer Asked about 2 months ago
J
J Early User
109
When should I use Rc, Arc, or Box in Rust, and how do they differ in memory management?

I’m working on a Rust project and keep running into different smart pointer types like Rc, Arc, and Box. I understand they’re used for memory management, but I’m confused about the real-world scenarios for each. - When should I choose Rc over Arc, and vice-versa...

0 votes 8 views No Answers
Asked about 2 months ago
How to get epoch time in Rust?

How can I get the current system epoch time in milliseconds/seconds (and to a lesser extent nanoseconds and microseconds) in Rust?

1 vote 15 views 1 Answer
Asked about 2 months ago
w
79
Should I write string function arguments as &str, String, AsRef<str>, or Into<String> in Rust?

I'm developing a public Rust library and I'm unsure how to handle function parameters that deal with strings. There seem to be multiple idiomatic options: - &str - String - impl AsRef<str> - impl Into<String> Each of these works in different cases, but I don't u...

2 votes 25 views 1 Answer Asked about 2 months ago