Struct utf8::Incomplete

source ·
pub struct Incomplete {
    pub buffer: [u8; 4],
    pub buffer_len: u8,
}

Fields§

§buffer: [u8; 4]§buffer_len: u8

Implementations§

source§

impl Incomplete

source

pub fn empty() -> Self

source

pub fn is_empty(&self) -> bool

source

pub fn new(bytes: &[u8]) -> Self

source

pub fn try_complete<'input>( &mut self, input: &'input [u8] ) -> Option<(Result<&str, &[u8]>, &'input [u8])>

  • None: still incomplete, call try_complete again with more input. If no more input is available, this is invalid byte sequence.
  • Some((result, remaining_input)): We’re done with this Incomplete. To keep decoding, pass remaining_input to decode().
source

pub(crate) fn take_buffer(&mut self) -> &[u8]

source

pub(crate) fn try_complete_offsets( &mut self, input: &[u8] ) -> (usize, Option<Result<(), ()>>)

(consumed_from_input, None): not enough input (consumed_from_input, Some(Err(()))): error bytes in buffer (consumed_from_input, Some(Ok(()))): UTF-8 string in buffer

Trait Implementations§

source§

impl Clone for Incomplete

source§

fn clone(&self) -> Incomplete

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Incomplete

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Copy for Incomplete

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.