pub struct PdCStr(/* private fields */);
Expand description

A borrowed slice of a PdCString.

Implementations§

source§

impl PdCStr

source

pub fn as_ptr(&self) -> *const PdChar

Returns a raw pointer to the string.

source

pub unsafe fn from_str_ptr<'a>(ptr: *const PdChar) -> &'a Self

Constructs a PdCStr from a nul-terminated string pointer.

source

pub fn from_slice_with_nul( slice: &[PdUChar] ) -> Result<&Self, MissingNulTerminator>

Constructs a PdCStr from a slice of characters with a terminating nul, checking for invalid interior nul values.

source

pub unsafe fn from_slice_with_nul_unchecked(slice: &[PdUChar]) -> &Self

Constructs a PdCStr from a slice of values without checking for a terminating or interior nul values.

source

pub fn to_os_string(&self) -> OsString

Copys the string to an owned OsString.

source

pub fn as_slice(&self) -> &[PdUChar]

Converts this string to a slice of the underlying elements. The slice will not include the nul terminator.

source

pub fn as_slice_with_nul(&self) -> &[PdUChar]

Converts this string to a slice of the underlying elements, including the nul terminator.

source

pub fn is_empty(&self) -> bool

Returns whether this string contains no data (i.e. is only the nul terminator).

source

pub fn len(&self) -> usize

Returns the length of the string as number of elements (not number of bytes) not including the nul terminator.

source

pub fn to_string(&self) -> Result<String, ToStringError>

Copies the string to a String if it contains valid encoded data.

source

pub fn to_string_lossy(&self) -> String

Decodes the string to a String even if it contains invalid data. Any invalid sequences are replaced with U+FFFD REPLACEMENT CHARACTER, which looks like this: �. It will *not have a nul terminator.

Trait Implementations§

source§

impl AsRef<PdCStr> for PdCStr

source§

fn as_ref(&self) -> &Self

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl AsRef<PdCStr> for PdCString

source§

fn as_ref(&self) -> &PdCStr

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Borrow<PdCStr> for PdCString

source§

fn borrow(&self) -> &PdCStr

Immutably borrows from an owned value. Read more
source§

impl Debug for PdCStr

source§

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

Formats the value using the given formatter. Read more
source§

impl Display for PdCStr

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a PdCStr> for PdCString

source§

fn from(s: &'a PdCStr) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&'a PdCString> for &'a PdCStr

source§

fn from(s: &'a PdCString) -> Self

Converts to this type from the input type.
source§

impl Hash for PdCStr

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
source§

impl Ord for PdCStr

source§

fn cmp(&self, other: &PdCStr) -> Ordering

This method returns an Ordering between self and other. Read more
source§

impl PartialEq for PdCStr

source§

fn eq(&self, other: &PdCStr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for PdCStr

source§

fn partial_cmp(&self, other: &PdCStr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PdCStrExt for PdCStr

source§

impl ToOwned for PdCStr

§

type Owned = PdCString

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Eq for PdCStr

source§

impl StructuralPartialEq for PdCStr

Auto Trait Implementations§

§

impl RefUnwindSafe for PdCStr

§

impl Send for PdCStr

§

impl !Sized for PdCStr

§

impl Sync for PdCStr

§

impl Unpin for PdCStr

§

impl UnwindSafe for PdCStr

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more