Setup::validate -> Setup::into_position
This commit is contained in:
parent
0d22c59cc3
commit
6f409799db
5 changed files with 19 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue