From 829362dbced2edce8d0cd5570a02e9446714a297 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 1 Apr 2024 21:30:52 +0100 Subject: [PATCH] Add 'From' for 'FenError' --- src/fen.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fen.rs b/src/fen.rs index 3034003..78452c2 100644 --- a/src/fen.rs +++ b/src/fen.rs @@ -27,6 +27,13 @@ impl std::fmt::Display for FenError { impl std::error::Error for FenError {} +/// Allow converting a [InvalidError] into [FenError], for use with the '?' operator. +impl From for FenError { + fn from(err: InvalidError) -> Self { + Self::InvalidPosition(err) + } +} + /// Convert the castling rights segment of a FEN string to an array of [CastleRights]. impl FromFen for [CastleRights; 2] { type Err = FenError;