Skip to content

Commit 977ea51

Browse files
committed
Add inline annotations
1 parent 06a737a commit 977ea51

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/c_string.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,14 @@ impl<const N: usize> CString<N> {
274274
}
275275

276276
impl<const N: usize> Borrow<CStr> for CString<N> {
277+
#[inline]
277278
fn borrow(&self) -> &CStr {
278279
self.as_c_str()
279280
}
280281
}
281282

282283
impl<const N: usize> AsRef<CStr> for CString<N> {
284+
#[inline]
283285
fn as_ref(&self) -> &CStr {
284286
self.as_c_str()
285287
}
@@ -288,24 +290,28 @@ impl<const N: usize> AsRef<CStr> for CString<N> {
288290
impl<const N: usize> Deref for CString<N> {
289291
type Target = CStr;
290292

293+
#[inline]
291294
fn deref(&self) -> &Self::Target {
292295
self.as_c_str()
293296
}
294297
}
295298

296299
impl<const N: usize, T: AsRef<CStr>> PartialEq<T> for CString<N> {
300+
#[inline]
297301
fn eq(&self, rhs: &T) -> bool {
298302
self.as_c_str() == rhs.as_ref()
299303
}
300304
}
301305

302306
impl<const N: usize> PartialEq<CString<N>> for CStr {
307+
#[inline]
303308
fn eq(&self, rhs: &CString<N>) -> bool {
304309
self == rhs.as_c_str()
305310
}
306311
}
307312

308313
impl<const N: usize> PartialEq<CString<N>> for &CStr {
314+
#[inline]
309315
fn eq(&self, rhs: &CString<N>) -> bool {
310316
*self == rhs.as_c_str()
311317
}
@@ -314,12 +320,14 @@ impl<const N: usize> PartialEq<CString<N>> for &CStr {
314320
impl<const N: usize> Eq for CString<N> {}
315321

316322
impl<const N: usize, T: AsRef<CStr>> PartialOrd<T> for CString<N> {
323+
#[inline]
317324
fn partial_cmp(&self, rhs: &T) -> Option<Ordering> {
318325
self.as_c_str().partial_cmp(rhs.as_ref())
319326
}
320327
}
321328

322329
impl<const N: usize> Ord for CString<N> {
330+
#[inline]
323331
fn cmp(&self, rhs: &Self) -> Ordering {
324332
self.as_c_str().cmp(rhs.as_c_str())
325333
}

0 commit comments

Comments
 (0)