Struct glommio::io::DmaStreamReaderBuilder [−][src]
pub struct DmaStreamReaderBuilder { /* fields omitted */ }
Builds a DmaStreamReader, allowing linear access to a Direct I/O DmaFile
Implementations
impl DmaStreamReaderBuilder
[src]
impl DmaStreamReaderBuilder
[src]#[must_use = "The builder must be built to be useful"]pub fn from_rc(file: Rc<DmaFile>) -> DmaStreamReaderBuilder
[src]
Creates a new DmaStreamReaderBuilder, given a shared pointer to a
DmaFile
This method is useful in situations where a shared pointer was already present. For example if you need to scan a header in the file and also make it available for random reads.
Other than that, it is the same as new
Examples
use glommio::{ io::{DmaFile, DmaStreamReaderBuilder}, Local, LocalExecutor, }; use std::rc::Rc; let ex = LocalExecutor::default(); ex.run(async { let file = Rc::new(DmaFile::open("myfile.txt").await.unwrap()); let _reader = DmaStreamReaderBuilder::from_rc(file.clone()).build(); // issue random I/O now, even though a stream is open. Local::local(async move { file.read_at(0, 8).await.unwrap(); }) .await; });
#[must_use = "The builder must be built to be useful"]pub fn new(file: DmaFile) -> DmaStreamReaderBuilder
[src]
Creates a new DmaStreamReaderBuilder, given a DmaFile
Various properties can be set by using its with
methods.
A DmaStreamReader
can later be constructed from it by
calling build
Examples
use glommio::{ io::{DmaFile, DmaStreamReaderBuilder}, LocalExecutor, }; let ex = LocalExecutor::default(); ex.run(async { let file = DmaFile::open("myfile.txt").await.unwrap(); let _reader = DmaStreamReaderBuilder::new(file).build(); });
pub fn with_start_pos(self, start: u64) -> Self
[src]
Define a starting position.
Reads from the DmaStreamReader
will start from this position
pub fn with_end_pos(self, end: u64) -> Self
[src]
Define an end position.
Reads from the DmaStreamReader
will end at this position even if the
file is larger.
pub fn with_read_ahead(self, read_ahead: usize) -> Self
[src]
Define the number of read-ahead buffers that will be used by the
DmaStreamReader
Higher read-ahead numbers mean more parallelism but also more memory usage.
pub fn with_buffer_size(self, buffer_size: usize) -> Self
[src]
Define the buffer size that will be used by the DmaStreamReader
pub fn build(self) -> DmaStreamReader
[src]
Builds a DmaStreamReader
with the properties defined by this
DmaStreamReaderBuilder
Trait Implementations
impl Clone for DmaStreamReaderBuilder
[src]
impl Clone for DmaStreamReaderBuilder
[src]fn clone(&self) -> DmaStreamReaderBuilder
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl !RefUnwindSafe for DmaStreamReaderBuilder
impl !RefUnwindSafe for DmaStreamReaderBuilder
impl !Send for DmaStreamReaderBuilder
impl !Send for DmaStreamReaderBuilder
impl !Sync for DmaStreamReaderBuilder
impl !Sync for DmaStreamReaderBuilder
impl Unpin for DmaStreamReaderBuilder
impl Unpin for DmaStreamReaderBuilder
impl !UnwindSafe for DmaStreamReaderBuilder
impl !UnwindSafe for DmaStreamReaderBuilder