pub struct Utf8Parser { /* private fields */ }
Expand description
A stateful UTF-8 parser.
§Behavior on Errors
Utf8Parser will reset on errors. Example:
use utf8_parser::Utf8Parser;
let mut parser = Utf8Parser::new();
// Utf-8 start byte
assert!(parser.push(0xf0)?.is_none());
// A continuation byte is expected here, but we're pushing an ASCII char
assert!(parser.push(b'a').is_err());
// The state is reset, so this now no longer errors
assert_eq!(parser.push(b'a'), Ok(Some('a')));
Implementations§
Trait Implementations§
Source§impl Clone for Utf8Parser
impl Clone for Utf8Parser
Source§fn clone(&self) -> Utf8Parser
fn clone(&self) -> Utf8Parser
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 Utf8Parser
impl Debug for Utf8Parser
Auto Trait Implementations§
impl Freeze for Utf8Parser
impl RefUnwindSafe for Utf8Parser
impl Send for Utf8Parser
impl Sync for Utf8Parser
impl Unpin for Utf8Parser
impl UnwindSafe for Utf8Parser
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