I am currently making an operating system in rust by following Philipp Opperman's rust kernel tutorial. I have gotten through the tutorials and now i am trying to make an embedded shell but i cannot find how to join a char and a &str together without the standard library, i have been trying to solve this problem for almost 2 nights now. Can any of you help me?
Asked
Active
Viewed 108 times
0
-
3By "join" I assume you mean "concatenate"? Where is the strings' character data coming from? Are these actually Rust `String` instances (unlikely...) or raw C-style `char*` buffers? With or without a known length? If they're string-literals then why not concatenate them at compile-time? If it's user-input then you likely have user-input copied into an oversized buffer, so just like in any low-level language doing kernel dev you'll need to copy the valid ranges of string data into a new buffer from the OS' own allocator. – Dai Jul 18 '21 at 14:37
-
1You can implement your own allocator for your operating system, which is [also covered in the tutorial](https://os.phil-opp.com/heap-allocation/). This allows you to use Rust's `String` type together with your operating system's custom allocator. – Sven Marnach Jul 18 '21 at 14:54