Struct uefi::data_types::CStr16[][src]

#[repr(transparent)]
pub struct CStr16(_);
Expand description

An UCS-2 null-terminated string

This type is largely inspired by std::ffi::CStr, see the documentation of CStr for more details on its semantics.

Implementations

impl CStr16[src]

pub unsafe fn from_ptr<'ptr>(ptr: *const Char16) -> &'ptr Self[src]

Wraps a raw UEFI string with a safe C string wrapper

Safety

The function will start accessing memory from ptr until the first null byte. It’s the callers responsability to ensure ptr points to a valid string, in accessible memory.

pub fn from_u16_with_nul(codes: &[u16]) -> Result<&Self, FromSliceWithNulError>[src]

Creates a C string wrapper from a u16 slice

Since not every u16 value is a valid UCS-2 code point, this function must do a bit more validity checking than CStr::from_bytes_with_nul

pub unsafe fn from_u16_with_nul_unchecked(codes: &[u16]) -> &Self[src]

Unsafely creates a C string wrapper from a u16 slice.

Safety

It’s the callers responsability to ensure chars is a valid UCS-2 null-terminated string, with no interior null bytes.

pub fn as_ptr(&self) -> *const Char16[src]

Returns the inner pointer to this C string

pub fn to_u16_slice(&self) -> &[u16][src]

Converts this C string to a u16 slice

pub fn to_u16_slice_with_nul(&self) -> &[u16][src]

Converts this C string to a u16 slice containing the trailing 0 char

pub fn iter(&self) -> CStr16Iter<'_>[src]

Returns an iterator over this C string

Trait Implementations

impl Debug for CStr16[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Display for CStr16[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for CStr16

impl !Sized for CStr16

impl Sync for CStr16

impl Unpin for CStr16

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more