Lines Matching defs:unsafe

37         unsafe { &*(core::ptr::from_ref(bytes) as *const BStr) }
230 unsafe { core::hint::unreachable_unchecked() };
249 pub unsafe fn from_char_ptr<'a>(ptr: *const c_char) -> &'a Self {
252 let len = unsafe { bindings::strlen(ptr) } + 1;
254 let bytes = unsafe { core::slice::from_raw_parts(ptr.cast(), len) };
257 unsafe { Self::from_bytes_with_nul_unchecked(bytes) }
281 Ok(unsafe { Self::from_bytes_with_nul_unchecked(bytes) })
292 pub const unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
294 unsafe { core::mem::transmute(bytes) }
305 pub unsafe fn from_bytes_with_nul_unchecked_mut(bytes: &mut [u8]) -> &mut CStr {
307 unsafe { &mut *(core::ptr::from_mut(bytes) as *mut CStr) }
384 /// assert_eq!(unsafe { bar.as_str_unchecked() }, "ツ");
387 pub unsafe fn as_str_unchecked(&self) -> &str {
389 unsafe { core::str::from_utf8_unchecked(self.as_bytes()) }
550 unsafe { Self::from_bytes_with_nul_unchecked(&self.0[index.start..]) }
657 let unchecked_str = unsafe { checked_cstr.as_str_unchecked() };
764 pub(crate) unsafe fn from_ptrs(pos: *mut u8, end: *mut u8) -> Self {
779 pub(crate) unsafe fn from_buffer(buf: *mut u8, len: usize) -> Self {
815 unsafe {
841 pub(crate) unsafe fn from_buffer(buf: *mut u8, len: usize) -> Self {
843 Self(unsafe { RawFormatter::from_buffer(buf, len) }, PhantomData)
850 unsafe { Formatter::from_buffer(buffer.as_mut_ptr(), buffer.len()) }
926 unsafe fn kstrtobool_raw(string: *const u8) -> Result<bool> {
932 to_result(unsafe { bindings::kstrtobool(string, &mut result) })?;
987 unsafe { kstrtobool_raw(string.as_char_ptr()) }
998 unsafe { kstrtobool_raw(stack_string.as_ptr()) }
1042 let mut f = unsafe { Formatter::from_buffer(buf.as_mut_ptr(), size) };
1048 unsafe { buf.inc_len(f.bytes_written()) };
1054 let ptr = unsafe { bindings::memchr(buf.as_ptr().cast(), 0, f.bytes_written() - 1) };
1071 unsafe { CStr::from_bytes_with_nul_unchecked(self.buf.as_slice()) }
1079 unsafe { CStr::from_bytes_with_nul_unchecked_mut(self.buf.as_mut_slice()) }