MCPcopy Create free account
hub / github.com/Freaky/Compactor / it_walks

Function it_walks

src/folder.rs:244–269  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

242
243#[test]
244fn it_walks() {
245 use crate::background::BackgroundHandle;
246 use crate::config::Config;
247
248 let gs = Config::default().globset().unwrap();
249 let scanner = FolderScan::new("C:\\Games", gs);
250
251 let task = BackgroundHandle::spawn(scanner);
252
253 let deadline = Instant::now() + Duration::from_millis(2000);
254
255 loop {
256 let ret = task.wait_timeout(Duration::from_millis(100));
257
258 if ret.is_some() {
259 println!("Scanned: {:?}", ret);
260 break;
261 } else {
262 println!("Status: {:?}", task.status());
263 }
264
265 if Instant::now() > deadline {
266 task.cancel();
267 }
268 }
269}

Callers

nothing calls this directly

Calls 3

globsetMethod · 0.80
wait_timeoutMethod · 0.80
cancelMethod · 0.80

Tested by

no test coverage detected