Skip to content

Instantly share code, notes, and snippets.

@grahamking
Created January 31, 2021 04:36
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 grahamking/f0ad62b4767aa9faf12b9ca967c8c1b2 to your computer and use it in GitHub Desktop.
Save grahamking/f0ad62b4767aa9faf12b9ca967c8c1b2 to your computer and use it in GitHub Desktop.
trait Logger {
fn log(&self, s: &str);
fn err(&self, e: &str) {
self.log(e);
}
}
struct StdoutLogger {}
impl Logger for StdoutLogger {
fn log(&self, s: &str) {
println!("{}", s);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment