[][src]Struct glommio::io::StreamReaderBuilder

pub struct StreamReaderBuilder { /* fields omitted */ }

Builds a StreamReader, allowing linear read access to a BufferedFile

Implementations

impl StreamReaderBuilder[src]

#[must_use = "The builder must be built to be useful"]pub fn new(file: BufferedFile) -> StreamReaderBuilder[src]

Creates a new StreamReaderBuilder, given a BufferedFile

Various properties can be set by using its with methods.

A StreamReader can later be constructed from it by calling build

Examples

use glommio::io::{BufferedFile, StreamReaderBuilder};
use glommio::LocalExecutor;

let ex = LocalExecutor::make_default();
ex.run(async {
    let file = BufferedFile::open("myfile.txt").await.unwrap();
    let _reader = StreamReaderBuilder::new(file).build();
});

pub fn with_start_pos(self, start: u64) -> Self[src]

Define a starting position.

Reads from the StreamReader will start from this position

pub fn with_end_pos(self, end: u64) -> Self[src]

Define an end position.

Reads from the StreamReader will end at this position even if the file is larger.

pub fn with_buffer_size(self, buffer_size: usize) -> Self[src]

Define the buffer size that will be used by the StreamReader

pub fn build(self) -> StreamReader[src]

Builds a StreamReader with the properties defined by this StreamReaderBuilder

Trait Implementations

impl Debug for StreamReaderBuilder[src]

Auto Trait Implementations

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> Same<T> for T[src]

type Output = T

Should always be Self

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.