pub struct WrapFileBuilder<'a, R: Read> { /* private fields */ }Expand description
Builder for creating a ProgressReader with optional configuration.
§Example
ⓘ
use std::fs::File;
use std::io::Read;
use rich_rs::{Progress, WrapFileBuilder};
use rich_rs::live::LiveOptions;
let progress = Progress::new_default(LiveOptions::default(), false, false, false);
let file = File::open("data.bin").unwrap();
let reader = WrapFileBuilder::new(&progress, file)
.total(1024)
.description("Processing...")
.build();Implementations§
Source§impl<'a, R: Read> WrapFileBuilder<'a, R>
impl<'a, R: Read> WrapFileBuilder<'a, R>
Sourcepub fn new(progress: &'a Progress, reader: R) -> Self
pub fn new(progress: &'a Progress, reader: R) -> Self
Create a new builder with the given progress and reader.
Sourcepub fn total_opt(self, total: Option<u64>) -> Self
pub fn total_opt(self, total: Option<u64>) -> Self
Set an optional total (None for indeterminate progress).
Sourcepub fn task_id(self, task_id: TaskID) -> Self
pub fn task_id(self, task_id: TaskID) -> Self
Use an existing task instead of creating a new one.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the description for the task (used when creating a new task).
Sourcepub fn close_handle(self, close: bool) -> Self
pub fn close_handle(self, close: bool) -> Self
Set whether the inner handle should be considered “owned” and closed.
Sourcepub fn build(self) -> ProgressReader<'a, R> ⓘ
pub fn build(self) -> ProgressReader<'a, R> ⓘ
Build the ProgressReader.
If no task_id was provided, a new task is created with the
configured description and total.
Auto Trait Implementations§
impl<'a, R> Freeze for WrapFileBuilder<'a, R>where
R: Freeze,
impl<'a, R> !RefUnwindSafe for WrapFileBuilder<'a, R>
impl<'a, R> Send for WrapFileBuilder<'a, R>where
R: Send,
impl<'a, R> Sync for WrapFileBuilder<'a, R>where
R: Sync,
impl<'a, R> Unpin for WrapFileBuilder<'a, R>where
R: Unpin,
impl<'a, R> !UnwindSafe for WrapFileBuilder<'a, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more