#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
#![doc(test(attr(deny(warnings))))]
#[cfg(feature = "alloc")]
extern crate alloc;
pub mod error;
pub mod infallible;
#[cfg(feature = "alloc")]
#[cfg_attr(feature = "nightly", doc(cfg(feature = "alloc")))]
pub mod iter;
#[cfg(feature = "async")]
#[cfg_attr(feature = "nightly", doc(cfg(feature = "async")))]
pub mod stream;
pub mod converter;
use converter::ChainedConverter;
pub trait Converter {
type Item;
type Output;
type Error;
fn convert<E>(&mut self, item: Self::Item, buf: &mut E) -> Result<usize, Self::Error>
where
E: Extend<Self::Output>;
#[inline]
fn is_ended(&self) -> bool {
false
}
#[inline]
fn finalize(&mut self) -> Result<(), Self::Error> {
Ok(())
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
(0, None)
}
#[inline]
fn chain<C>(self, other: C) -> ChainedConverter<Self, C>
where
C: Converter<Item = Self::Item, Output = Self::Output>,
Self: Sized,
{
ChainedConverter::new(self, other)
}
}