|
|
Log in / Subscribe / Register

Rust in the 6.2 kernel

Rust in the 6.2 kernel

Posted Nov 17, 2022 17:03 UTC (Thu) by rillian (guest, #11344)
In reply to: Rust in the 6.2 kernel by atnot
Parent article: Rust in the 6.2 kernel

FWIW re our editor's difficulty, the C++17 standard library has a similar construction with std::string_view vs. std::string. Rust "simplifies" things a bit by making the string_view the same thing as a const std::string& and keeping track of the relative lifetimes of the two. In C it's all the same thing, of course.


to post comments

Rust in the 6.2 kernel

Posted Nov 18, 2022 13:15 UTC (Fri) by walters (subscriber, #7396) [Link]

> In C it's all the same thing, of course.

Not quite; without a capacity value from a standard NUL terminated string, one can't do some useful patterns like having a single allocated "buffer" used in a loop without allocating/freeing. The equivalent of Rust's String is really things like https://developer-old.gnome.org/glib/stable/glib-Strings.html
(I'd assume there's some variant of this in the linux kernel? But not seeing it offhand)


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds