On 2/16/24 17:53, Alice Ryhl wrote:
+ /// Returns a copy of this [`CString`] where each character is mapped to its
+ /// ASCII upper case equivalent.
+ ///
+ /// ASCII letters 'a' to 'z' are mapped to 'A' to 'Z',
+ /// but non-ASCII letters are unchanged.
+ ///
+ /// To uppercase the value in-place, use [`make_ascii_uppercase`].
+ ///
+ /// [`make_ascii_uppercase`]: str::make_ascii_uppercase
+ pub fn to_ascii_uppercase(&self) -> Result<CString, AllocError> {
+ let mut s = (*self).to_cstring()?;
+
+ s.make_ascii_uppercase();
+
+ return Ok(s);
+ }
Please move these to `CStr` as well.
That would result into two copies if I actually want a CString, wouldn't it?
Also, what would be the use case? And even if someone wants to have a CStr
again, couldn't we just deref the resulting CString?