mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-26 20:44:23 +01:00
core: Kill Many variant from IOCompletions enum
This commit is contained in:
@@ -1633,9 +1633,6 @@ impl Pager {
|
||||
IOCompletions::Single(c) => {
|
||||
commit_info.completions.push(c);
|
||||
}
|
||||
IOCompletions::Many(c) => {
|
||||
commit_info.completions.extend(c);
|
||||
}
|
||||
}
|
||||
let mut group = CompletionGroup::new(|_| {});
|
||||
for c in commit_info.completions.drain(..) {
|
||||
|
||||
@@ -2349,7 +2349,6 @@ impl Cursor {
|
||||
#[must_use]
|
||||
pub enum IOCompletions {
|
||||
Single(Completion),
|
||||
Many(Vec<Completion>),
|
||||
}
|
||||
|
||||
impl IOCompletions {
|
||||
@@ -2357,26 +2356,12 @@ impl IOCompletions {
|
||||
pub fn wait<I: ?Sized + IO>(self, io: &I) -> Result<()> {
|
||||
match self {
|
||||
IOCompletions::Single(c) => io.wait_for_completion(c),
|
||||
IOCompletions::Many(completions) => {
|
||||
let mut completions = completions.into_iter();
|
||||
while let Some(c) = completions.next() {
|
||||
let res = io.wait_for_completion(c);
|
||||
if res.is_err() {
|
||||
for c in completions {
|
||||
c.abort();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn finished(&self) -> bool {
|
||||
match self {
|
||||
IOCompletions::Single(c) => c.finished(),
|
||||
IOCompletions::Many(completions) => completions.iter().all(|c| c.finished()),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2384,14 +2369,12 @@ impl IOCompletions {
|
||||
pub fn abort(&self) {
|
||||
match self {
|
||||
IOCompletions::Single(c) => c.abort(),
|
||||
IOCompletions::Many(completions) => completions.iter().for_each(|c| c.abort()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_error(&self) -> Option<CompletionError> {
|
||||
match self {
|
||||
IOCompletions::Single(c) => c.get_error(),
|
||||
IOCompletions::Many(completions) => completions.iter().find_map(|c| c.get_error()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user