[][src]Struct abi_stable::sabi_types::NulStr

#[repr(transparent)]
pub struct NulStr<'a> { /* fields omitted */ }

A utf8 null-terminated string slice.

Methods

impl NulStr<'static>[src]

pub const EMPTY: Self[src]

An empty string.

impl<'a> NulStr<'a>[src]

pub const unsafe fn from_str(str: &'a str) -> Self[src]

Constructs an NulStr from a slice.

Safety

str must be nul terminated(a 0 byte).

pub const unsafe fn from_ptr(ptr: *const u8) -> Self[src]

Constructs an NulStr from a pointer.

Safety

The pointer must point to a utf8 and nul terminated (a 0 byte) sequence of bytes.

pub fn to_str_with_nul(&self) -> &'a str[src]

Converts this NulStr<'a> to a &'a str,including the nul byte.

Performance

This conversion requires traversing through the entire string to find the nul byte.

pub fn to_rstr_with_nul(&self) -> RStr<'a>[src]

Converts this NulStr<'a> to a RStr<'a>,including the nul byte.

Performance

This conversion requires traversing through the entire string to find the nul byte.

pub fn to_str(self) -> &'a str[src]

Converts this NulStr<'a> to a &'a str,not including the nul byte.

Performance

This conversion requires traversing through the entire string to find the nul byte.

pub fn to_rstr(self) -> RStr<'a>[src]

Converts this NulStr<'a> to a RStr<'a>,not including the nul byte.

Performance

This conversion requires traversing through the entire string to find the nul byte.

Trait Implementations

impl<'a> GetStaticEquivalent_ for NulStr<'a>[src]

type StaticEquivalent = _static_NulStr<'static>

impl<'a> SharedStableAbi for NulStr<'a>[src]

type IsNonZeroType = <*const u8 as __SharedStableAbi>::IsNonZeroType

Whether this type has a single invalid bit-pattern. Read more

type Kind = __ValueKind

The kind of abi stability of this type,there are 2: Read more

impl<'_> Send for NulStr<'_>[src]

impl<'_> Sync for NulStr<'_>[src]

impl<'a> Clone for NulStr<'a>[src]

impl<'a> Copy for NulStr<'a>[src]

impl<'a> Eq for NulStr<'a>[src]

impl<'a> PartialEq<NulStr<'a>> for NulStr<'a>[src]

impl<'_> Display for NulStr<'_>[src]

impl<'_> Debug for NulStr<'_>[src]

Auto Trait Implementations

impl<'a> Unpin for NulStr<'a>

impl<'a> UnwindSafe for NulStr<'a>

impl<'a> RefUnwindSafe for NulStr<'a>

Blanket Implementations

impl<This> GetConstGenericVTable for This where
    This: StableAbi + Eq + PartialEq<This> + Debug + Send + Sync
[src]

impl<This> StableAbi for This where
    This: SharedStableAbi<Kind = ValueKind>, 
[src]

impl<This> TransmuteElement for This where
    This: ?Sized
[src]

impl<'a, T> BorrowOwned<'a> for T where
    T: 'a + Clone
[src]

type ROwned = T

type RBorrowed = &'a T

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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

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

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

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

type Type = T

The same type as Self. Read more

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

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The error type returned when the conversion fails.