pub enum UnencodableByteError {
NonprintableAscii(u8, usize, &'static str),
NotAscii(u8, usize),
}
Expand description
The error returned by the encoding functions if they encounter a byte they can not encode.
Variants§
Implementations§
source§impl UnencodableByteError
impl UnencodableByteError
sourcepub const fn line(&self) -> usize
pub const fn line(&self) -> usize
Returns the (1-indexed) line number of the line on which the unencodable byte occured.
sourcepub const fn byte(&self) -> u8
pub const fn byte(&self) -> u8
Returns the byte value of the unencodable character. Note that this might not be the complete representation of the character in unicode, just the first byte of it.
sourcepub const fn representation(&self) -> Option<&'static str>
pub const fn representation(&self) -> Option<&'static str>
Return a representation of the unencodable byte if there is one.
Example
assert_eq!(zalgo_encode("\r").err().unwrap().representation(), Some("Carriage Return"));
assert_eq!(zalgo_encode("❤").err().unwrap().representation(), None);
Trait Implementations§
source§impl Clone for UnencodableByteError
impl Clone for UnencodableByteError
source§fn clone(&self) -> UnencodableByteError
fn clone(&self) -> UnencodableByteError
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UnencodableByteError
impl Debug for UnencodableByteError
source§impl Display for UnencodableByteError
impl Display for UnencodableByteError
source§impl Error for UnencodableByteError
impl Error for UnencodableByteError
source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
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<UnencodableByteError> for UnencodableFileError
impl From<UnencodableByteError> for UnencodableFileError
source§fn from(err: UnencodableByteError) -> Self
fn from(err: UnencodableByteError) -> Self
Converts to this type from the input type.
source§impl PartialEq<UnencodableByteError> for UnencodableByteError
impl PartialEq<UnencodableByteError> for UnencodableByteError
source§fn eq(&self, other: &UnencodableByteError) -> bool
fn eq(&self, other: &UnencodableByteError) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for UnencodableByteError
Auto Trait Implementations§
impl RefUnwindSafe for UnencodableByteError
impl Send for UnencodableByteError
impl Sync for UnencodableByteError
impl Unpin for UnencodableByteError
impl UnwindSafe for UnencodableByteError
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