From 280fbc2acedcc5bbfcca141e610b3b37cf7d4397 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sun, 26 Feb 2023 19:43:29 +0300 Subject: feat: implement notation Display for moves --- src/square.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/square.rs') diff --git a/src/square.rs b/src/square.rs index 8a268ea..c7f185e 100644 --- a/src/square.rs +++ b/src/square.rs @@ -1,4 +1,4 @@ -use std::str::Chars; +use std::{str::Chars, fmt::Display}; use crate::bitboard::Bitboard; @@ -91,4 +91,11 @@ impl Square { } } +impl Display for Square { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let notation = format!("{:?}", self).to_lowercase(); + write!(f, "{}", notation) + } +} + -- cgit v1.2.3