pub struct Cp437Error {
pub representable_up_to: usize,
}
Expand description
Errors which can occur when attempting to interpret a string as a sequence of cp437 codepoints.
As such, the into_cp437
family of functions and functions make use of this error, for example.
Fields§
§representable_up_to: usize
Returns the index in the given string up to which valid cp437 was verified.
It is the maximum index such that input[..index].to_cp_437()
would return Ok(_)
.
§Examples
// some unrepresentable characters, in a &str
let word = "Eżektor";
// ToCp437::to_cp437() returns a Cp437Error
let error = word.to_cp437(&CP437_CONTROL).unwrap_err();
// the second character is unrepresentable here
assert_eq!(error.representable_up_to, 1);
Trait Implementations§
Source§impl Clone for Cp437Error
impl Clone for Cp437Error
Source§fn clone(&self) -> Cp437Error
fn clone(&self) -> Cp437Error
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 Cp437Error
impl Debug for Cp437Error
Source§impl Hash for Cp437Error
impl Hash for Cp437Error
Source§impl Ord for Cp437Error
impl Ord for Cp437Error
Source§fn cmp(&self, other: &Cp437Error) -> Ordering
fn cmp(&self, other: &Cp437Error) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Cp437Error
impl PartialEq for Cp437Error
Source§impl PartialOrd for Cp437Error
impl PartialOrd for Cp437Error
impl Copy for Cp437Error
impl Eq for Cp437Error
impl StructuralPartialEq for Cp437Error
Auto Trait Implementations§
impl Freeze for Cp437Error
impl RefUnwindSafe for Cp437Error
impl Send for Cp437Error
impl Sync for Cp437Error
impl Unpin for Cp437Error
impl UnwindSafe for Cp437Error
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