diff --git a/Cargo.toml b/Cargo.toml index a837211..78b0927 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,6 @@ reqwest = {version = "0.10", features= ["stream"]} memmap = "0.7" getrandom = "0.1" base64 = "0.12" + +[target.'cfg(not(nightly))'.dependencies] +linked-list = "0.0" diff --git a/src/list.rs b/src/list.rs index fee4c3d..c5caccc 100644 --- a/src/list.rs +++ b/src/list.rs @@ -97,7 +97,6 @@ impl LinkedList assert!(at < self.sz, "Cannot remove at element > than size"); todo!() - //TODO: Implement through iter_mut() } } diff --git a/src/main.rs b/src/main.rs index b3dcc4a..c550268 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ -#![feature(linked_list_remove)] -#![feature(label_break_value)] -#![feature(never_type)] +#![cfg_attr(nightly, feature(linked_list_remove))] +//#![feature(label_break_value)] +//#![feature(never_type)] #![allow(dead_code)] diff --git a/src/work_async.rs b/src/work_async.rs index 126302a..2a80f9b 100644 --- a/src/work_async.rs +++ b/src/work_async.rs @@ -108,7 +108,7 @@ pub async fn work(conf: config::Config) -> Result<(), Box prog_send!(link unwind prog.push_task(&task)); let temp = tempfile::TempFile::new(); - let return_value = 'clean: { + let return_value = loop { match perform(&url, &temp, &mut prog).await { Err(e) => prog_send!(link prog.println(format!("Failed downloading {} -> {:?}: {}", url, temp, e))), Ok(_) => { @@ -120,15 +120,15 @@ pub async fn work(conf: config::Config) -> Result<(), Box Ok(v) => v, Err(e) => { prog_send!(link prog.println(format!("Failed decoding: {}", e))); - break 'clean Some(e); + break Some(e); }, }; prog_send!(link prog.println(format!("{:?} Complete", loli))); - break 'clean None; + break None; }, }; - Some(error::Error::Unknown) + break Some(error::Error::Unknown); }; prog_send!(link prog.pop_task(task)); diff --git a/src/work_async/tasklist.rs b/src/work_async/tasklist.rs index 49202df..a50334d 100644 --- a/src/work_async/tasklist.rs +++ b/src/work_async/tasklist.rs @@ -1,12 +1,20 @@ use super::*; +#[cfg(nightly)] use std::{ collections::LinkedList, }; +#[cfg(not(nightly))] +use linked_list::LinkedList; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TaskList(LinkedList<(usize, String)>, String, usize); +#[cfg(not(nightly))] +unsafe impl std::marker::Send for TaskList{} +#[cfg(not(nightly))] +unsafe impl std::marker::Sync for TaskList{} + fn find(list: &LinkedList, mut fun: F) -> Option where F: FnMut(&T) -> bool {