[][src]Struct partial_io::PartialRead

pub struct PartialRead<R> { /* fields omitted */ }

A reader wrapper that breaks inner Read instances up according to the provided iterator.

Examples

use std::io::{Cursor, Read};

use partial_io::{PartialOp, PartialRead};

let reader = Cursor::new(vec![1, 2, 3, 4]);
let iter = ::std::iter::repeat(PartialOp::Limited(1));
let mut partial_reader = PartialRead::new(reader, iter);
let mut out = vec![0; 256];

let size = partial_reader.read(&mut out).unwrap();
assert_eq!(size, 1);
assert_eq!(&out[..1], &[1]);

Implementations

impl<R> PartialRead<R> where
    R: Read
[src]

pub fn new<I>(inner: R, iter: I) -> Self where
    I: IntoIterator<Item = PartialOp> + 'static,
    I::IntoIter: Send
[src]

Creates a new PartialRead wrapper over the reader with the specified PartialOps.

pub fn set_ops<I>(&mut self, iter: I) -> &mut Self where
    I: IntoIterator<Item = PartialOp> + 'static,
    I::IntoIter: Send
[src]

Sets the PartialOps for this reader.

pub fn get_ref(&self) -> &R[src]

Acquires a reference to the underlying reader.

pub fn get_mut(&mut self) -> &mut R[src]

Acquires a mutable reference to the underlying reader.

pub fn into_inner(self) -> R[src]

Consumes this wrapper, returning the underlying reader.

Trait Implementations

impl<R> Debug for PartialRead<R> where
    R: Debug
[src]

impl<R> Read for PartialRead<R> where
    R: Read
[src]

impl<R> Write for PartialRead<R> where
    R: Read + Write
[src]

Auto Trait Implementations

impl<R> !RefUnwindSafe for PartialRead<R>

impl<R> Send for PartialRead<R> where
    R: Send

impl<R> !Sync for PartialRead<R>

impl<R> Unpin for PartialRead<R> where
    R: Unpin

impl<R> !UnwindSafe for PartialRead<R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,