Skip to content

Instantly share code, notes, and snippets.

@daschl
Created September 8, 2017 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daschl/c3eabd0bc79c06259f1d9fea6b4d8f1c to your computer and use it in GitHub Desktop.
Save daschl/c3eabd0bc79c06259f1d9fea6b4d8f1c to your computer and use it in GitHub Desktop.
pub fn from_config<S>(config: &BackendConfig) -> Result<impl Backend<S>, BackendError> where S: IntoBuf + 'static {
match config.name() {
"stdout" => Ok(StdoutBackend::stdout()),
"stderr" => Ok(StderrBackend::stderr()),
n => Err(BackendError::UnsupportedBackend(n.into())),
}
}
@daschl
Copy link
Author

daschl commented Sep 8, 2017

error[E0308]: mismatched types
--> src/backend/mod.rs:24:24
|
24 | "stderr" => Ok(StderrBackend::stderr()),
| ^^^^^^^^^^^^^^^^^^^^^^^ expected struct std::io::Stdout, found struct std::io::Stderr
|
= note: expected type backend::console::ConsoleBackend<S, std::io::Stdout>
found type backend::console::ConsoleBackend<_, std::io::Stderr>

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