File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,14 @@ pub use c::*;
54
54
55
55
/// Reads string until null byte is reached and returns slice excluding the terminating null.
56
56
///
57
- /// SAFETY: The data from the pointer until the null terminator must be valid for reads and
58
- /// not mutated for all of `'a`. The length of the string must also be less than `isize::MAX`.
59
- /// See the documentation on [`from_raw_parts`](https://doc.rust-lang.org/core/slice/fn.from_raw_parts.html)
60
- /// for further details on safety of converting a pointer to a slice.
57
+ /// # Safety
58
+ ///
59
+ /// The data from the pointer until the null terminator must be valid for reads
60
+ /// and not mutated for all of `'a`. The length of the string must also be less
61
+ /// than `isize::MAX`. See the documentation on [`from_raw_parts`] for further
62
+ /// details on safety of converting a pointer to a slice.
63
+ ///
64
+ /// [`from_raw_parts`]: https://doc.rust-lang.org/core/slice/fn.from_raw_parts.html
61
65
pub unsafe fn c_string_bytes < ' a > ( ptr : * const crate :: c_types:: c_char ) -> & ' a [ u8 ] {
62
66
let length = crate :: bindings:: strlen ( ptr) as usize ;
63
67
& core:: slice:: from_raw_parts ( ptr as * const u8 , length)
You can’t perform that action at this time.
0 commit comments