1
0
Fork 0

Setup::validate -> Setup::into_position

This commit is contained in:
Paul-Nicolas Madelaine 2025-10-23 23:34:31 +02:00
parent 0d22c59cc3
commit 6f409799db
5 changed files with 19 additions and 18 deletions

View file

@ -82,12 +82,14 @@ impl Position {
/// ```
/// # use eschac::setup::Setup;
/// # |s: &str| -> Option<eschac::position::Position> {
/// s.parse::<Setup>().ok().and_then(|pos| pos.validate().ok())
/// s.parse::<Setup>().ok().and_then(|pos| pos.into_position().ok())
/// # };
/// ```
#[inline]
pub fn from_text_record(s: &str) -> Option<Self> {
s.parse::<Setup>().ok().and_then(|pos| pos.validate().ok())
s.parse::<Setup>()
.ok()
.and_then(|pos| pos.into_position().ok())
}
/// Returns all the legal moves on the position.
@ -196,8 +198,7 @@ impl Position {
&self.0
}
/// Converts a position to a [`Setup`], allowing to edit the position without enforcing its
/// legality.
/// Converts the position into the [`Setup`] type, allowing to edit it without enforcing its legality.
#[inline]
pub fn into_setup(self) -> Setup {
self.0