[][src]Trait genio::ExtendFromReaderSlow

pub trait ExtendFromReaderSlow {
    type ExtendError;
    fn extend_from_reader_slow<R: Read + ?Sized>(
        &mut self,
        reader: &mut R
    ) -> Result<usize, ExtendError<R::ReadError, Self::ExtendError>>; }

Some types can be extended by reading from reader. The most well-known is probably Vec. It is possible to implement it manually, but it may be more efficient if the type implements this trait directly. In case of Vec, it means reading directly into uninitialized part of reserved memory in case of the fast version of this trait.

Associated Types

type ExtendError

This type is returned when extending fails. For example, if not enough memory could be allocated. All other errors should be passed directly from reader.

Loading content...

Required methods

fn extend_from_reader_slow<R: Read + ?Sized>(
    &mut self,
    reader: &mut R
) -> Result<usize, ExtendError<R::ReadError, Self::ExtendError>>

This method performs extending from reader - that means calling read() just once.

Loading content...

Implementations on Foreign Types

impl ExtendFromReaderSlow for Vec<u8>[src]

type ExtendError = Void

Loading content...

Implementors

Loading content...