Skip to main content

Coder

Struct Coder 

Source
pub struct Coder<S, C = FeaturedCode> { /* private fields */ }
Expand description

A coder type that can be used for either encode or decode which determined by De type.

Implementations§

Source§

impl<S, C> Coder<S, C>
where S: Body, C: Code<S::Data>, S::Data: AsRef<[u8]>,

Source

pub const fn new(body: S, coder: C) -> Self

Construct a new coder.

Source

pub fn into_inner(self) -> S

Trait Implementations§

Source§

impl<S, C> Body for Coder<S, C>
where S: Body, CoderError: From<S::Error>, C: Code<S::Data>,

Source§

type Data = <C as Code<<S as Body>::Data>>::Item

The payload data type yielded by Frame::Data variants.
Source§

type Error = Box<dyn Error + Sync + Send>

The error type that can occur while producing frames.
Source§

fn poll_frame( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Option<Result<Frame<Self::Data>, Self::Error>>>

Attempt to pull the next frame from the body. Read more
Source§

fn is_end_stream(&self) -> bool

Indicates whether the body has been fully consumed. Read more
Source§

fn size_hint(&self) -> SizeHint

Returns a hint about the total size of the remaining Frame::Data payload. Read more
Source§

impl<S: Default, C: Default> Default for Coder<S, C>

Source§

fn default() -> Coder<S, C>

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

impl<'__pin, S, C> Unpin for Coder<S, C>
where PinnedFieldsOf<__Origin<'__pin, S, C>>: Unpin,

Auto Trait Implementations§

§

impl<S, C> Freeze for Coder<S, C>
where S: Freeze, C: Freeze,

§

impl<S, C> RefUnwindSafe for Coder<S, C>

§

impl<S, C> Send for Coder<S, C>
where S: Send, C: Send,

§

impl<S, C> Sync for Coder<S, C>
where S: Sync, C: Sync,

§

impl<S, C> UnsafeUnpin for Coder<S, C>
where S: UnsafeUnpin, C: UnsafeUnpin,

§

impl<S, C> UnwindSafe for Coder<S, C>
where S: UnwindSafe, C: UnwindSafe,

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<B> BodyExt for B
where B: Body,

Source§

fn frame(&mut self) -> FrameFuture<'_, Self>
where Self: Unpin,

Source§

fn data(&mut self) -> DataFuture<'_, Self>
where Self: Unpin,

Source§

fn chain<B>(self, other: B) -> ChainBody<Self, B>
where B: Body<Data = Self::Data>, Self: Sized, Self::Error: From<<B as Body>::Error>,

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.