Skip to content

Instantly share code, notes, and snippets.

@bollu
Last active August 29, 2015 14:02
Show Gist options
  • Save bollu/9713a431852f4f27a320 to your computer and use it in GitHub Desktop.
Save bollu/9713a431852f4f27a320 to your computer and use it in GitHub Desktop.
error
* 1) bin: rustc ../src/main.rs -L ../lib/ -o fs
<std macros>:6:9: 6:32 error: instantiating a type parameter with an incompatible type `&str`, which does not fulfill `Send`
<std macros>:6 ::std::rt::begin_unwind($msg, file!(), line!())
^~~~~~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 26:2 note: in expansion of fail!
../src/types.rs:41:4: 42:4 note: expansion site
error: aborting due to previous error
use std::path::Path;
use std::fmt::{Show, Formatter, Result};
use std::io::FileStat;
use std::vec::Vec;
///represents a collection of paths used for batch processing
pub struct PathCollection {
paths: Vec<Path>,
///can be used by Operations to setup till where they have processed. useful to store information
num_processed: uint,
}
impl PathCollection {
pub fn new(paths: Vec<Path>) -> PathCollection {
return PathCollection { paths: paths, num_processed: 0 }
}
///returns num_processed / len(Paths). can be used to get a measure of progress
pub fn get_progress(&self) -> f32 {
self.num_processed as f32 / self.paths.len() as f32
}
pub fn get_current<'a>(&'a self) -> &'a Path {
return self.paths.get(self.num_processed)
}
pub fn goto_next(&mut self) -> () {
self.num_processed += 1;
assert!(self.num_processed <= self.paths.len(), "asked to goto next where none exists")
}
}
pub trait Operation {
fn run(&mut self) -> bool;
fn done(&self) -> bool;
fn assert_done(&self, error: &str) {
if !self.done() {
fail!(error)
}
}
}
pub trait Progress {
fn get_progress(&self) -> f32;
}
@bollu
Copy link
Author

bollu commented Jun 8, 2014

* 1) bin: rustc ../src/main.rs -L ../lib/ -o fs
<std macros>:6:9: 6:32 error: instantiating a type parameter with an incompatible type `&str`, which does not fulfill `Send`
<std macros>:6 ::std::rt::begin_unwind($msg, file!(), line!())
^~~~~~~~~~~~~~~~~~~~~~~
<std macros>:1:1: 26:2 note: in expansion of fail!
../src/types.rs:41:4: 42:4 note: expansion site
error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment