Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bsamseth committed Oct 31, 2024
1 parent 6441a7f commit ee68db3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions goldchess/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use thiserror::Error;

/// For when things don't go as planned.
#[derive(Debug, Error)]
pub enum Error {
#[error("Invalid square index: {0}")]
Expand All @@ -14,4 +15,5 @@ pub enum Error {
InvalidRankChar(char),
}

/// A specialized [`Result`] type for this crate, used by all fallible functions.
pub type Result<T, E = Error> = std::result::Result<T, E>;
1 change: 1 addition & 0 deletions goldchess/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::str::FromStr;

use crate::{Bitboard, Error, Result};

/// Represent a file (column) on a chess board.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct File(pub u8);

Expand Down
12 changes: 12 additions & 0 deletions goldchess/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
//! # Goldchess - A chess library
//!
//! <p align="center">
//! <img src="https://github.com/bsamseth/goldfish/blob/main/logo.jpg?raw=true" width=60% alt="Logo, a goldfish playing chess."/>
//! </p>
//!
//! This is a library useful for writing chess engines in Rust. Its primary reason to exist is to
//! support the [Goldfish](https://github.com/bsamseth/goldfish) chess engine, but very well might be useful for other projects as well.
mod bitboard;
mod color;
mod error;
mod file;
mod generated_tables;
mod piece;
mod rank;
mod square;

pub use bitboard::Bitboard;
pub use color::Color;
pub use error::{Error, Result};
pub use file::File;
pub use piece::Piece;
pub use rank::Rank;
pub use square::Square;
1 change: 1 addition & 0 deletions goldchess/src/rank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::str::FromStr;

use crate::{Bitboard, Error, Result};

/// Represent a rank (row) on a chess board.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Rank(pub u8);

Expand Down

0 comments on commit ee68db3

Please sign in to comment.