Skip to content

Commit

Permalink
Merge branch 'main' into dark_color_pma
Browse files Browse the repository at this point in the history
  • Loading branch information
jabuwu committed Mar 16, 2024
2 parents a97280f + 228f564 commit 6435376
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/c_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,20 +371,21 @@ macro_rules! c_ptr {
/// Get a pointer to the underlying [`spine-c`](`crate::c`) type.
#[inline]
#[must_use]
#[allow(clippy::missing_const_for_fn)]
pub const fn c_ptr(&self) -> *mut $c_type {
self.$member.0
}

#[inline]
#[must_use]
#[allow(dead_code)]
#[allow(dead_code, clippy::missing_const_for_fn)]
pub(crate) unsafe fn c_ptr_ref(&self) -> &$c_type {
&*self.$member.0
}

#[inline]
#[must_use]
#[allow(dead_code, clippy::mut_from_ref)]
#[allow(dead_code, clippy::mut_from_ref, clippy::missing_const_for_fn)]
pub(crate) unsafe fn c_ptr_mut(&self) -> &mut $c_type {
&mut *self.$member.0
}
Expand Down Expand Up @@ -1124,13 +1125,13 @@ macro_rules! c_handle_indexed_decl {
};
}

/// Used to isolate this unwrap() in one place in the codebase. It is necessary to avoid proceeding
/// Used to isolate this `unwrap()` in one place in the codebase. It is necessary to avoid proceeding
/// with corrupt data, but the panic (ideally) never happens.
pub(crate) fn to_c_str(rust_string: &str) -> CString {
CString::new(rust_string).unwrap()
}

/// Used to isolate this unwrap() in one place in the codebase. It is necessary to avoid proceeding
/// Used to isolate this `unwrap()` in one place in the codebase. It is necessary to avoid proceeding
/// with corrupt data, but the panic (ideally) never happens.
pub(crate) fn from_c_str(c_string: &CStr) -> &str {
c_string.to_str().unwrap()
Expand Down

0 comments on commit 6435376

Please sign in to comment.