[][src]Struct uefi::CStr8

#[repr(transparent)]pub struct CStr8(_);

A Latin-1 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 CStr8[src]

pub unsafe fn from_ptr<'ptr>(ptr: *const Char8) -> &'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_bytes_with_nul(chars: &[u8]) -> Result<&Self, FromSliceWithNulError>[src]

Creates a C string wrapper from bytes

pub unsafe fn from_bytes_with_nul_unchecked(chars: &[u8]) -> &Self[src]

Unsafely creates a C string wrapper from bytes

Safety

It's the callers responsability to ensure chars is a valid Latin-1 null-terminated string, with no interior null bytes.

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

Returns the inner pointer to this C string

pub fn to_bytes(&self) -> &[u8][src]

Converts this C string to a slice of bytes

pub fn to_bytes_with_nul(&self) -> &[u8][src]

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

Auto Trait Implementations

impl Send for CStr8

impl Sync for CStr8

impl Unpin for CStr8

Blanket Implementations

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

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

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