Skip to content

Instantly share code, notes, and snippets.

Created August 17, 2016 00:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/3127edd0271ed975157a8d6152ffa706 to your computer and use it in GitHub Desktop.
Save anonymous/3127edd0271ed975157a8d6152ffa706 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
use std::io::{self};
use std::result;
type KKResults <T> = Result <T, KKError>;
#[derive(Debug)]
enum KKError {
Io(io::Error),
}
impl From<io::Error> for KKError {
fn from(err: io::Error) -> KKError {
KKError::Io(err)
}
}
trait knightknave {
fn is_knight_or_knave (&self) -> KKResults <T>;
}
struct Knight;
struct Knave;
struct visitor;
impl knightknave for visitor {
fn is_knight_or_knave(&self) ->KKResults <T> {
Ok(())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment