From 977ea519d552153b30d6fac8a43f36dd7c1241f1 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Mon, 7 Apr 2025 19:30:51 -0700 Subject: [PATCH] Add inline annotations --- src/c_string.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/c_string.rs b/src/c_string.rs index b8aa879a..71fa1775 100644 --- a/src/c_string.rs +++ b/src/c_string.rs @@ -274,12 +274,14 @@ impl CString { } impl Borrow for CString { + #[inline] fn borrow(&self) -> &CStr { self.as_c_str() } } impl AsRef for CString { + #[inline] fn as_ref(&self) -> &CStr { self.as_c_str() } @@ -288,24 +290,28 @@ impl AsRef for CString { impl Deref for CString { type Target = CStr; + #[inline] fn deref(&self) -> &Self::Target { self.as_c_str() } } impl> PartialEq for CString { + #[inline] fn eq(&self, rhs: &T) -> bool { self.as_c_str() == rhs.as_ref() } } impl PartialEq> for CStr { + #[inline] fn eq(&self, rhs: &CString) -> bool { self == rhs.as_c_str() } } impl PartialEq> for &CStr { + #[inline] fn eq(&self, rhs: &CString) -> bool { *self == rhs.as_c_str() } @@ -314,12 +320,14 @@ impl PartialEq> for &CStr { impl Eq for CString {} impl> PartialOrd for CString { + #[inline] fn partial_cmp(&self, rhs: &T) -> Option { self.as_c_str().partial_cmp(rhs.as_ref()) } } impl Ord for CString { + #[inline] fn cmp(&self, rhs: &Self) -> Ordering { self.as_c_str().cmp(rhs.as_c_str()) }