pub struct CountingSource<'a, S: Source> { /* private fields */ }
Expand description

A source that counts the amount of elements read

Warning: if a call to read would cause ctr to exceed usize::max_value(), this source will return an error and the element that has been read from the underlying source will be lost

Trait Implementations§

source§

impl<'a, S: Source> Source for CountingSource<'a, S>

source§

fn read(&mut self) -> Result<u8, Asn1DerError>

Reads the next element
source§

fn counting_source(self, ctr: &mut usize) -> CountingSource<'_, Self>

Creates a counting source
source§

fn copying_source<U: Sink>(self, sink: U) -> CopyingSource<Self, U>

Creates a copying source

Auto Trait Implementations§

§

impl<'a, S> RefUnwindSafe for CountingSource<'a, S>where S: RefUnwindSafe,

§

impl<'a, S> Send for CountingSource<'a, S>where S: Send,

§

impl<'a, S> Sync for CountingSource<'a, S>where S: Sync,

§

impl<'a, S> Unpin for CountingSource<'a, S>where S: Unpin,

§

impl<'a, S> !UnwindSafe for CountingSource<'a, S>

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.