[][src]Trait uninit::read::VecExtendFromReader

pub trait VecExtendFromReader {
    fn extend_from_reader<R: ReadIntoUninit>(
        &mut self,
        max_count: usize,
        reader: R
    ) -> Result<usize>;
fn extend_from_reader_exact<R: ReadIntoUninit>(
        &mut self,
        exact_count: usize,
        reader: R
    ) -> Result<()>; }
This is supported on crate feature std only.

Extension trait for Vec, that grows the vec by a bounded amount of bytes, obtained when reading from R.

This guarantees that the allocated memory starts uninitialized (before being initialized by the read), for maximum performance.

Example

use ::uninit::read::VecExtendFromReader;

let mut reader = &b"World!"[..];
let mut vec = b"Greetings, ".to_vec();
vec.extend_from_reader_exact(6, &mut reader).unwrap();
assert_eq!(
    vec,
    b"Greetings, World!",
);

Required methods

fn extend_from_reader<R: ReadIntoUninit>(
    &mut self,
    max_count: usize,
    reader: R
) -> Result<usize>

This is supported on crate feature std only.

Tries to extends the Vec with up to max_count bytes read from reader.

fn extend_from_reader_exact<R: ReadIntoUninit>(
    &mut self,
    exact_count: usize,
    reader: R
) -> Result<()>

This is supported on crate feature std only.

Tries to extends the Vec with exactly exact_count bytes read from reader.

Loading content...

Implementations on Foreign Types

impl VecExtendFromReader for Vec<u8>[src]

Loading content...

Implementors

Loading content...