rust icon indicating copy to clipboard operation
rust copied to clipboard

Tracking Issue for `CStr::bytes`

Open clarfonthey opened this issue 1 year ago • 0 comments

Feature gate: #![feature(cstr_bytes)]

This is a tracking issue for the CStr::bytes API.

Public API

impl CStr {
    pub fn bytes(&self) -> CStrBytes<'_>;
}

// core::ffi::c_str::Bytes
pub struct Bytes<'a> {
    // ...
}
impl Iterator for Bytes<'_> {
    type Item = u8;
    // ...
}

Steps / History

  • [x] API change proposal (ACP)^1: rust-lang/libs-team#135
  • [ ] Implementation: #104353
  • [ ] Final comment period (FCP)^2
  • [ ] Stabilization PR

Unresolved Questions

  • [x] Where should this type be located? This is discussed in rust-lang/libs-team#134. (Resolution: Store in core::ffi::c_str.)
  • [ ] Should an AsRef<CStr> and as_c_str method be added to CStrBytes to reflect the slice::Iter API?

clarfonthey avatar May 30 '23 19:05 clarfonthey