Struct TryFromUtf8Error

Source
pub struct TryFromUtf8Error<'s, S: ?Sized> { /* private fields */ }
Expand description

An error signifying that a buffer was too small, when trying to convert UTF8 to another string type.

This type contains information necessary to continue the conversion into an owned type without repeating checks.

Implementations§

Source§

impl<'s, S: ?Sized> TryFromUtf8Error<'s, S>

Source

pub fn bytes_read(&self) -> usize

The number of bytes consumed from the source string

Source

pub fn bytes_written(&self) -> usize

The number of bytes written to the destination buffer

Source

pub fn source_str(&self) -> &str

The original source string to convert

Source

pub fn source_str_used(&self) -> &str

The portion of the source string that was converted

Source

pub fn source_str_rest(&self) -> &str

The portion of the source string that is left to convert

Source

pub fn encoded_bytes(&self) -> &[u8]

The portion of the user buffer that has been encoded. Note that it will not contain a nul-byte, if required for the string encoding. It should however, be valid other than that (particularly, partial codepoints should not exist)

Source§

impl<'s> TryFromUtf8Error<'s, Cesu8Str>

Source

pub fn finish(self) -> <Cesu8Str as ToOwned>::Owned

Finishes the conversion process from a str that requires conversion, to an owned Cesu8String

Source§

impl<'s> TryFromUtf8Error<'s, Mutf8Str>

Source

pub fn finish(self) -> <Mutf8Str as ToOwned>::Owned

Finishes the conversion process from a str that requires conversion, to an owned Mutf8String

Source§

impl<'s> TryFromUtf8Error<'s, Mutf8CStr>

Source

pub fn finish(self) -> <Mutf8CStr as ToOwned>::Owned

Finishes the conversion process from a str that requires conversion, to an owned Mutf8CString

Trait Implementations§

Source§

impl<'s, S: Clone + ?Sized> Clone for TryFromUtf8Error<'s, S>

Source§

fn clone(&self) -> TryFromUtf8Error<'s, S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'s, S: Debug + ?Sized> Debug for TryFromUtf8Error<'s, S>

Source§

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

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

impl<'s, S: PartialEq + ?Sized> PartialEq for TryFromUtf8Error<'s, S>

Source§

fn eq(&self, other: &TryFromUtf8Error<'s, S>) -> bool

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

const 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<'s, S: Copy + ?Sized> Copy for TryFromUtf8Error<'s, S>

Source§

impl<'s, S: Eq + ?Sized> Eq for TryFromUtf8Error<'s, S>

Source§

impl<'s, S: ?Sized> StructuralPartialEq for TryFromUtf8Error<'s, S>

Auto Trait Implementations§

§

impl<'s, S> Freeze for TryFromUtf8Error<'s, S>
where S: ?Sized,

§

impl<'s, S> RefUnwindSafe for TryFromUtf8Error<'s, S>
where S: RefUnwindSafe + ?Sized,

§

impl<'s, S> Send for TryFromUtf8Error<'s, S>
where S: Send + ?Sized,

§

impl<'s, S> Sync for TryFromUtf8Error<'s, S>
where S: Sync + ?Sized,

§

impl<'s, S> Unpin for TryFromUtf8Error<'s, S>
where S: Unpin + ?Sized,

§

impl<'s, S> UnwindSafe for TryFromUtf8Error<'s, S>
where S: UnwindSafe + ?Sized,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.