From dde5b69f81a3162df5c0de979625a6ca7727a0b4 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 27 Jul 2022 23:25:35 +0200 Subject: [PATCH] Add 'FromFen' trait --- src/board/fen.rs | 6 ++++++ src/board/mod.rs | 3 +++ 2 files changed, 9 insertions(+) create mode 100644 src/board/fen.rs diff --git a/src/board/fen.rs b/src/board/fen.rs new file mode 100644 index 0000000..f112bc9 --- /dev/null +++ b/src/board/fen.rs @@ -0,0 +1,6 @@ +/// A trait to mark items that can be converted from a FEN input. +pub trait FromFen: Sized { + type Err; + + fn from_fen(s: &str) -> Result; +} diff --git a/src/board/mod.rs b/src/board/mod.rs index d23ef25..b4e746b 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -10,6 +10,9 @@ pub use color::*; pub mod direction; pub use direction::*; +pub mod fen; +pub use fen::*; + pub mod file; pub use file::*;