Struct ChunkDecoder

Source
pub struct ChunkDecoder { /* private fields */ }
Expand description

A ChunkDecoder can decode an encoded string and report on any errors that were found / corrected.

Implementations§

Source§

impl ChunkDecoder

Source

pub fn decode_chunk( &self, encoded_data: &str, bits: u8, ) -> Result<(DecodedChunk, Option<EncodedChunk>), HumancodeError>

Decode and correct an encoded message.

bits much match the value that was passed to encode_chunk

encoded_data should be a value returned by encode_chunk. encoded_data may include any number of “-” characters which will be ignored.

encoded_data should be validated for the correct length prior to being passed to this method. Incorrect lengths will result in errors of type UsageError.

On success, a tuple of DecodedChunk and an Optional EncodedChunk is returned. The EncodedChunk will only be a Some value if there was an error in the input that was corrected. It is strongly recommended that the user be prompted to review any errors.

Trait Implementations§

Source§

impl Debug for ChunkDecoder

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.