Lines Matching defs:u8
35 pub struct BStr([u8]);
50 /// Creates a [`BStr`] from a `[u8]`.
52 pub const fn from_bytes(bytes: &[u8]) -> &Self {
53 // SAFETY: `BStr` is transparent to `[u8]`.
142 type Target = [u8];
158 [u8]: Index<Idx, Output = [u8]>,
167 impl AsRef<BStr> for [u8] {
229 /// Creates a mutable [`CStr`] from a `[u8]` without performing any
236 unsafe fn from_bytes_with_nul_unchecked_mut(bytes: &mut [u8]) -> &mut Self;
327 unsafe fn to_bytes_mut(s: &mut CStr) -> &mut [u8] {
328 // SAFETY: the cast from `&CStr` to `&[u8]` is safe since `CStr` has the same layout as `&[u8]`
331 unsafe { &mut *(core::ptr::from_mut(s) as *mut [u8]) }
343 unsafe fn from_bytes_with_nul_unchecked_mut(bytes: &mut [u8]) -> &mut Self {
344 // SAFETY: the cast from `&[u8]` to `&CStr` is safe since the properties of `bytes` are
345 // guaranteed by the safety precondition and `CStr` has the same layout as `&[u8]` (this is
493 let mut bytes: [u8; 256] = [0; 256];
495 for i in u8::MIN..=u8::MAX {
578 pub(crate) unsafe fn from_ptrs(pos: *mut u8, end: *mut u8) -> Self {
593 pub(crate) unsafe fn from_buffer(buf: *mut u8, len: usize) -> Self {
607 pub(crate) fn pos(&self) -> *mut u8 {
608 self.pos as *mut u8
632 self.pos as *mut u8,
655 pub(crate) unsafe fn from_buffer(buf: *mut u8, len: usize) -> Self {
661 pub fn new(buffer: &mut [u8]) -> Self {
698 buffer: &'a mut [u8],
703 pub fn new(buffer: &'a mut [u8]) -> Option<NullTerminatedFormatter<'a>> {
740 unsafe fn kstrtobool_raw(string: *const u8) -> Result<bool> {
804 /// Convert `&[u8]` to `bool` by deferring to [`kernel::str::kstrtobool`].
807 pub fn kstrtobool_bytes(bytes: &[u8]) -> Result<bool> {
841 buf: KVec<u8>,