From ee68db379756f85a657821f3144b99523e160b5a Mon Sep 17 00:00:00 2001 From: Bendik Samseth Date: Thu, 31 Oct 2024 21:05:22 +0100 Subject: [PATCH] Update docs --- goldchess/src/error.rs | 2 ++ goldchess/src/file.rs | 1 + goldchess/src/lib.rs | 12 ++++++++++++ goldchess/src/rank.rs | 1 + 4 files changed, 16 insertions(+) diff --git a/goldchess/src/error.rs b/goldchess/src/error.rs index 752232e..0eb5ad8 100644 --- a/goldchess/src/error.rs +++ b/goldchess/src/error.rs @@ -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}")] @@ -14,4 +15,5 @@ pub enum Error { InvalidRankChar(char), } +/// A specialized [`Result`] type for this crate, used by all fallible functions. pub type Result = std::result::Result; diff --git a/goldchess/src/file.rs b/goldchess/src/file.rs index 924f5f5..650b250 100644 --- a/goldchess/src/file.rs +++ b/goldchess/src/file.rs @@ -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); diff --git a/goldchess/src/lib.rs b/goldchess/src/lib.rs index d63ac1e..9b54b29 100644 --- a/goldchess/src/lib.rs +++ b/goldchess/src/lib.rs @@ -1,12 +1,24 @@ +//! # Goldchess - A chess library +//! +//!

+//! Logo, a goldfish playing chess. +//!

+//! +//! 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; diff --git a/goldchess/src/rank.rs b/goldchess/src/rank.rs index 39df919..6d90a3b 100644 --- a/goldchess/src/rank.rs +++ b/goldchess/src/rank.rs @@ -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);