|
|
Subscribe / Log in / New account

Rust in the 6.2 kernel

Rust in the 6.2 kernel

Posted Nov 18, 2022 3:59 UTC (Fri) by ABCD (subscriber, #53650)
In reply to: Rust in the 6.2 kernel by droundy
Parent article: Rust in the 6.2 kernel

CStr (both kernel::str::CStr and core::ffi::CStr) are implemented as dynamically-sized types (specifically, a newtype wrapper around [u8]), so a &CStr is a fat pointer containing both the pointer to the data and the length of that data, just like a &str or &[u8].


to post comments

Rust in the 6.2 kernel

Posted Nov 18, 2022 14:21 UTC (Fri) by xav (guest, #18536) [Link]

It is yes, but AFAIK it's an oversight and could be replaced soon with a thin pointer - this is alluded to here for example: https://github.com/m-ou-se/rfcs/blob/c-str-literal/text/3...


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