Skip to content

Instantly share code, notes, and snippets.

@daboross
Last active August 29, 2015 14:11
Show Gist options
  • Save daboross/e0467878f3fba640be8d to your computer and use it in GitHub Desktop.
Save daboross/e0467878f3fba640be8d to your computer and use it in GitHub Desktop.
Compiling simple-logging v0.0.1 (file:///home/daboross/Projects/Rust/simple-logging)
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35:5: 35:39 error: unable to infer enough type information to locate the impl of the trait `core::kinds::Send` for the type `_`; type annotations required
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35 loggers::WriterLogger::with_stdout();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35:5: 35:39 note: required by `loggers::WriterLogger<T>::with_stdout`
/home/daboross/Projects/Rust/simple-logging/src/lib.rs:35 loggers::WriterLogger::with_stdout();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Could not compile `simple-logging`.
The function giving this error literally just calls loggers::WriterLogger::with_stdout() and nothing else.
struct WriterLogger<T: io::Writer + Send> {
writer: Arc<Mutex<T>>,
}
impl <T: io::Writer + Send> WriterLogger<T> {
fn new(writer: T) -> WriterLogger<T> {
return WriterLogger {
writer: Arc::new(Mutex::new(writer)),
};
}
fn with_stdout() -> WriterLogger<io::stdio::StdWriter> {
return WriterLogger::new(stdio::stdout_raw());
}
fn with_stderr() -> WriterLogger<io::stdio::StdWriter> {
return WriterLogger::new(stdio::stderr_raw());
}
fn with_file(path: &Path) -> io::IoResult<WriterLogger<io::File>> {
return Ok(WriterLogger::new(try!(io::File::create(path))));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment