Lines Matching refs:CStr
153 pub struct CStr([u8]); struct
155 impl CStr { implementation
231 pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr { in from_bytes_with_nul_unchecked() argument
244 pub unsafe fn from_bytes_with_nul_unchecked_mut(bytes: &mut [u8]) -> &mut CStr { in from_bytes_with_nul_unchecked_mut() argument
246 unsafe { &mut *(bytes as *mut [u8] as *mut CStr) } in from_bytes_with_nul_unchecked_mut()
378 impl fmt::Display for CStr { implementation
407 impl fmt::Debug for CStr { implementation
438 impl AsRef<BStr> for CStr { implementation
445 impl Deref for CStr { implementation
454 impl Index<ops::RangeFrom<usize>> for CStr { implementation
455 type Output = CStr;
467 impl Index<ops::RangeFull> for CStr { implementation
468 type Output = CStr;
488 impl<Idx> Index<Idx> for CStr implementation
516 const C: &$crate::str::CStr = match $crate::str::CStr::from_bytes_with_nul(S.as_bytes()) {
546 let checked_cstr = CStr::from_bytes_with_nul(good_bytes).unwrap(); in test_cstr_to_str()
555 let checked_cstr = CStr::from_bytes_with_nul(bad_bytes).unwrap(); in test_cstr_to_str_panic()
562 let checked_cstr = CStr::from_bytes_with_nul(good_bytes).unwrap(); in test_cstr_as_str_unchecked()
569 let hello_world = CStr::from_bytes_with_nul(b"hello, world!\0").unwrap(); in test_cstr_display()
571 let non_printables = CStr::from_bytes_with_nul(b"\x01\x09\x0a\0").unwrap(); in test_cstr_display()
573 let non_ascii = CStr::from_bytes_with_nul(b"d\xe9j\xe0 vu\0").unwrap(); in test_cstr_display()
575 let good_bytes = CStr::from_bytes_with_nul(b"\xf0\x9f\xa6\x80\0").unwrap(); in test_cstr_display()
586 let cstr = CStr::from_bytes_with_nul(&bytes).unwrap(); in test_cstr_display_all_bytes()
592 let hello_world = CStr::from_bytes_with_nul(b"hello, world!\0").unwrap(); in test_cstr_debug()
594 let non_printables = CStr::from_bytes_with_nul(b"\x01\x09\x0a\0").unwrap(); in test_cstr_debug()
596 let non_ascii = CStr::from_bytes_with_nul(b"d\xe9j\xe0 vu\0").unwrap(); in test_cstr_debug()
598 let good_bytes = CStr::from_bytes_with_nul(b"\xf0\x9f\xa6\x80\0").unwrap(); in test_cstr_debug()
832 type Target = CStr;
837 unsafe { CStr::from_bytes_with_nul_unchecked(self.buf.as_slice()) } in deref()
845 unsafe { CStr::from_bytes_with_nul_unchecked_mut(self.buf.as_mut_slice()) } in deref_mut()
849 impl<'a> TryFrom<&'a CStr> for CString {
852 fn try_from(cstr: &'a CStr) -> Result<CString, AllocError> { in try_from()