PdCStr

Struct PdCStr 

Source
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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PdCStrExt for PdCStr

Available on non-Windows only.
Source§

fn from_c_str(s: &CStr) -> &Self

Source§

fn as_c_str(&self) -> &CStr

Source§

impl ToOwned for PdCStr

Source§

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 Freeze for PdCStr

§

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, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
Source§

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

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more