[]Enum bitboard_xo::XOError

pub enum XOError {
    PositionError {
        source: XOPosError,
    },
    GameError {
        source: XOGameError,
    },
}

Super Error combining all error in this crate (XOPosError and XOGameError)

both XOPosError and XOGameError can convert to XOError with ? operator

use bitboard_xo::XOError;
fn main() -> Result<(), XOError> {
    use bitboard_xo::{XOPos, XO, XOPosError, XOGameError};

    // ? auto convert XOPosError to XOError
    let result_pos: Result<_, XOPosError> =
        XOPos::col_row(1, 1);
    let pos: XOPos = result_pos?;

    // ? auto convert XOGameError to XOError
    let mut game = XO::new();
    let result_win_state: Result<_, XOGameError> =
        game.play(pos);
    let win_state = result_win_state?;

    Ok(())
}

Variants

PositionError

Fields of PositionError

source: XOPosError
GameError

Fields of GameError

source: XOGameError

Trait Implementations

impl Debug for XOError

impl Display for XOError

impl Error for XOError

impl From<XOGameError> for XOError

impl From<XOPosError> for XOError

Auto Trait Implementations

impl RefUnwindSafe for XOError

impl Send for XOError

impl Sync for XOError

impl Unpin for XOError

impl UnwindSafe for XOError

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.