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

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

A utf8 null-terminated string slice.

Implementations

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> Clone for NulStr<'a>[src]

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

impl Debug for NulStr<'_>[src]

impl Display for NulStr<'_>[src]

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

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

type StaticEquivalent = _static_NulStr<'static>

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

impl Send for NulStr<'_>[src]

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

type IsNonZeroType = <NonNull<u8> as __StableAbi>::IsNonZeroType

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

impl Sync for NulStr<'_>[src]

Auto Trait Implementations

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

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

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

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]

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

type ROwned = T

The owned type, stored in RCow::Owned

type RBorrowed = &'a T

The borrowed type, stored in RCow::Borrowed

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

impl<T> GetWithMetadata for T[src]

type ForSelf = WithMetadata_<T, T>

This is always WithMetadata_<Self, Self>

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

impl<T> SelfOps for T where
    T: ?Sized
[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<This> TransmuteElement for This where
    This: ?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, 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.

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

type Type = T

The same type as Self. Read more

impl<This> ValidTag_Bounds for This where
    This: Debug + Clone + PartialEq<This>, 
[src]