Skip to content

Commit

Permalink
Update based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
GKFX committed May 2, 2024
1 parent e610a52 commit 0e0042f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions library/core/src/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ use crate::str;
/// use std::ffi::CStr;
/// use std::os::raw::c_char;
///
/// # #[cfg(any())] // Extern functions are awkward in doc comments - fake it instead
/// # /* Extern functions are awkward in doc comments - fake it instead
/// extern "C" { fn my_string() -> *const c_char; }
/// # unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
/// # */ unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
///
/// unsafe {
/// let slice = CStr::from_ptr(my_string());
Expand All @@ -63,9 +63,9 @@ use crate::str;
/// use std::os::raw::c_char;
///
/// fn work(data: &CStr) {
/// # #[cfg(any())] // Extern functions are awkward in doc comments - fake it instead
/// # /* Extern functions are awkward in doc comments - fake it instead
/// extern "C" { fn work_with(data: *const c_char); }
/// # unsafe extern "C" fn work_with(s: *const c_char) {}
/// # */ unsafe extern "C" fn work_with(s: *const c_char) {}
///
/// unsafe { work_with(data.as_ptr()) }
/// }
Expand All @@ -80,9 +80,9 @@ use crate::str;
/// use std::ffi::CStr;
/// use std::os::raw::c_char;
///
/// # #[cfg(any())] // Extern functions are awkward in doc comments - fake it instead
/// # /* Extern functions are awkward in doc comments - fake it instead
/// extern "C" { fn my_string() -> *const c_char; }
/// # unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
/// # */ unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
///
/// fn my_string_safe() -> String {
/// let cstr = unsafe { CStr::from_ptr(my_string()) };
Expand Down Expand Up @@ -258,7 +258,7 @@ impl CStr {
///
/// unsafe {
/// let slice = CStr::from_ptr(my_string());
/// println!("string returned: {}", slice.to_str().unwrap());
/// assert_eq!(slice.to_str().unwrap(), "hello");
/// }
/// ```
///
Expand Down

0 comments on commit 0e0042f

Please sign in to comment.