use std::error::Error;
use std::fmt;
use crate::Utf16Error;
impl fmt::Display for Utf16Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Invalid UTF-16LE data in byte slice")
}
}
impl Error for Utf16Error {}
impl Utf16Error {
pub fn valid_up_to(&self) -> usize {
self.valid_up_to
}
pub fn error_len(&self) -> Option<usize> {
self.error_len.map(|len| len.into())
}
}