@@ -197,8 +197,8 @@ impl CStr {
197
197
///
198
198
/// This function will wrap the provided `ptr` with a `CStr` wrapper, which
199
199
/// allows inspection and interoperation of non-owned C strings. The total
200
- /// size of the raw C string must be smaller than `isize::MAX` **bytes**
201
- /// in memory due to calling the `slice::from_raw_parts` function .
200
+ /// size of the terminated buffer must be smaller than [ `isize::MAX`] **bytes**
201
+ /// in memory (a restriction from [ `slice::from_raw_parts`]) .
202
202
///
203
203
/// # Safety
204
204
///
@@ -295,11 +295,11 @@ impl CStr {
295
295
}
296
296
}
297
297
298
- /// Creates a C string wrapper from a byte slice.
298
+ /// Creates a C string wrapper from a byte slice with any number of nuls .
299
299
///
300
300
/// This method will create a `CStr` from any byte slice that contains at
301
- /// least one nul byte. The caller does not need to know or specify where
302
- /// the nul byte is located.
301
+ /// least one nul byte. Unlike with [`CStr::from_bytes_with_nul`], the caller
302
+ /// does not need to know where the nul byte is located.
303
303
///
304
304
/// If the first byte is a nul character, this method will return an
305
305
/// empty `CStr`. If multiple nul characters are present, the `CStr` will
@@ -341,7 +341,8 @@ impl CStr {
341
341
}
342
342
}
343
343
344
- /// Creates a C string wrapper from a byte slice.
344
+ /// Creates a C string wrapper from a byte slice with exactly one nul
345
+ /// terminator.
345
346
///
346
347
/// This function will cast the provided `bytes` to a `CStr`
347
348
/// wrapper after ensuring that the byte slice is nul-terminated
0 commit comments