minor renamings

This commit is contained in:
Jörn-Michael Miehe 2025-06-12 23:43:03 +00:00
parent f77acc1afd
commit 09d22a0ad9

View file

@ -16,7 +16,7 @@ use super::{
};
pub struct AppState {
current_bar: RefCell<Option<ProgressBar>>,
progress: RefCell<Option<ProgressBar>>,
buffer: Vec<u8>,
http: ureq::Agent,
@ -41,7 +41,7 @@ fn new_http(timeout: Option<Duration>) -> ureq::Agent {
impl AppState {
fn new(chunk_size: usize, http: ureq::Agent, inner: CacheFile) -> Self {
Self {
current_bar: None.into(),
progress: None.into(),
buffer: vec![0; chunk_size * 1024 * 1024],
http,
inner,
@ -77,7 +77,7 @@ impl AppState {
}
fn get_or_create_progressbar(&self, uploading: &file::Uploading) -> Ref<'_, ProgressBar> {
let mut slot = self.current_bar.borrow_mut();
let mut slot = self.progress.borrow_mut();
if slot.is_none() {
let bar = ProgressBar::new(uploading.get_size())
.with_style(
@ -99,14 +99,14 @@ impl AppState {
}
drop(slot);
Ref::map(self.current_bar.borrow(), |opt| {
Ref::map(self.progress.borrow(), |opt| {
opt.as_ref().expect("somehow the slot holds None")
})
}
fn finish_bar(&self) {
let mut slot = self.current_bar.borrow_mut();
if let Some(bar) = &*slot {
let mut slot = self.progress.borrow_mut();
if let Some(bar) = slot.as_ref() {
bar.finish();
*slot = None;
}