#[non_exhaustive]pub enum StringError {
ConversionError,
InvalidChar,
TooLong,
MissingNull,
}Expand description
Represents an error occurred while encoding or decoding a string, including intermediate conversion errors and the presence of null bytes in unexpected scenarios.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ConversionError
A generic conversion error. E.G. converting an OsStr to str and back
InvalidChar
A string contained invalid data
TooLong
A string (encoded using [StrLen::NullTerminatedOrMax]) exceeded the maximum length
MissingNull
A string (encoded using [StrLen::NullTerminatedOrMax]) contained a null byte followed
by an unexpected non-null byte before the end of the string data.
Trait Implementations§
Source§impl Debug for StringError
impl Debug for StringError
Source§impl Display for StringError
impl Display for StringError
Source§impl Error for StringError
Available on crate feature unstable only.
impl Error for StringError
Available on crate feature
unstable only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<StringError> for EncodingError
impl From<StringError> for EncodingError
Source§fn from(value: StringError) -> Self
fn from(value: StringError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StringError
impl RefUnwindSafe for StringError
impl Send for StringError
impl Sync for StringError
impl Unpin for StringError
impl UnwindSafe for StringError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more