UTF32BEEncoder

Struct UTF32BEEncoder 

Source
pub struct UTF32BEEncoder;
Expand description

A byte encoder for UTF-32 (big-endian).

§Examples

use conversion::converter::encoding::utf32::UTF32BEEncoder;
use conversion::iter::ConvertedIterator;

let iter = "💯❤".chars();
let encoded = ConvertedIterator::new(iter, UTF32BEEncoder::new());

assert_eq!(Ok(b"\x00\x01\xF4\xAF\x00\x00\x27\x64".to_vec()), encoded.collect());

Implementations§

Source§

impl UTF32BEEncoder

Source

pub fn new() -> Self

Create a new instance.

Trait Implementations§

Source§

impl Clone for UTF32BEEncoder

Source§

fn clone(&self) -> UTF32BEEncoder

Returns a duplicate 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 Converter for UTF32BEEncoder

Source§

type Item = char

The type of input items.
Source§

type Output = u8

The type of outputs.
Source§

type Error = Infallible

The type of errors while conversion.
Source§

fn convert<E>( &mut self, item: Self::Item, buf: &mut E, ) -> Result<usize, Self::Error>
where E: Extend<Self::Output>,

Consumes one item, stores outputs into buf implements Extend, and returns the number of stored outputs or a conversion error. If there are no outputs yet, you should store the item and return Ok(0).
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returnd the estimated bounds about the numbers of outputs that one item will produce. Read more
Source§

fn is_ended(&self) -> bool

Returns whether the converter reached the end, or not. Read more
Source§

fn finalize(&mut self) -> Result<(), Self::Error>

Finalizing the converter. Read more
Source§

fn chain<C>(self, other: C) -> ChainedConverter<Self, C>
where C: Converter<Item = Self::Item, Output = Self::Output>, Self: Sized,

Chaining two converters. Read more
Source§

impl Debug for UTF32BEEncoder

Source§

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

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

impl Default for UTF32BEEncoder

Source§

fn default() -> UTF32BEEncoder

Returns the “default value” for a type. Read more
Source§

impl PartialEq for UTF32BEEncoder

Source§

fn eq(&self, other: &UTF32BEEncoder) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for UTF32BEEncoder

Source§

impl Eq for UTF32BEEncoder

Source§

impl StructuralPartialEq for UTF32BEEncoder

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<C> InfallibleConverter for C

Source§

fn convert_ok<E>(&mut self, item: <C as Converter>::Item, buf: &mut E) -> usize
where E: Extend<<C as Converter>::Output>,

Converting without any errors.
Source§

fn finalize_ok(&mut self)

Finalizing without any errors.
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> ToOwned for T
where T: Clone,

Source§

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 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.